From cb19660fbe5f527331d0558ae0f2c116c100018f Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 11:24:51 +0200 Subject: [PATCH 001/253] Build Horizon Rust parity foundations and differential validation Add version-bound core, world data, geometry, generation and feature implementations with native client/server comparison tools and scoped evidence reports. Apply Horizon project branding. Workspace tests, Clippy and 147 Python tests passed. Full 51-family survival and expanded provider comparisons are still running; complete gameplay parity and a playable Rust client remain unfinished. Private game artifacts and the isolated simple-block placement work are excluded. --- .github/workflows/ci.yml | 249 +++- .gitignore | 2 +- Cargo.lock | 169 +++ Cargo.toml | 2 +- README.md | 67 +- .../rust-anchor-2026-10-06/scoped-parity.json | 118 ++ .../scoped-parity.json | 153 +++ .../scoped-parity.json | 131 ++ .../scoped-parity.json | 149 ++ .../scoped-parity.json | 158 +++ .../scoped-parity.json | 136 ++ .../scoped-parity.json | 148 ++ .../scoped-parity.json | 126 ++ .../scoped-parity.json | 131 ++ .../scoped-parity.json | 176 +++ .../scoped-parity.json | 127 ++ .../scoped-parity.json | 172 +++ .../scoped-parity.json | 192 +++ .../scoped-parity.json | 169 +++ .../scoped-parity.json | 146 ++ .../scoped-parity.json | 141 ++ .../scoped-parity.json | 134 ++ .../scoped-parity.json | 146 ++ .../scoped-parity.json | 161 +++ .../scoped-parity.json | 75 + .../rust-core-2026-10-04/scoped-parity.json | 44 + .../rust-core-2026-10-05/scoped-parity.json | 69 + .../scoped-parity.json | 161 +++ .../scoped-parity.json | 178 +++ .../scoped-parity.json | 159 +++ .../scoped-parity.json | 182 +++ .../scoped-parity.json | 164 +++ .../scoped-parity.json | 167 +++ .../scoped-parity.json | 181 +++ .../scoped-parity.json | 159 +++ .../scoped-parity.json | 160 +++ .../scoped-parity.json | 169 +++ .../scoped-parity.json | 156 +++ .../scoped-parity.json | 157 +++ .../boundary-parity.json | 373 +++++ .../scoped-parity.json | 87 ++ .../rust-fluid-2026-10-06/scoped-parity.json | 168 +++ .../scoped-parity.json | 73 + .../scoped-parity.json | 110 ++ .../scoped-parity.json | 152 +++ .../scoped-parity.json | 126 ++ .../scoped-parity.json | 145 ++ .../scoped-parity.json | 134 ++ .../scoped-parity.json | 149 ++ .../scoped-parity.json | 180 +++ .../scoped-parity.json | 118 ++ .../rust-noise-2026-10-05/scoped-parity.json | 71 + .../scoped-parity.json | 177 +++ .../scoped-parity.json | 153 +++ .../scoped-parity.json | 161 +++ .../scoped-parity.json | 163 +++ .../scoped-parity.json | 161 +++ .../scoped-parity.json | 213 +++ .../scoped-parity.json | 115 ++ .../scoped-parity.json | 123 ++ .../rust-ticks-2026-10-05/scoped-parity.json | 87 ++ .../scoped-parity.json | 151 ++ .../rust-world-2026-10-05/scoped-parity.json | 77 ++ .../scoped-parity.json | 307 +++++ .../scoped-parity.json | 627 +++++++++ .../scoped-parity.json | 162 +++ crates/horizon-core/Cargo.toml | 31 + .../examples/biome_zoom_fixture.rs | 46 + crates/horizon-core/src/bin/density_parity.rs | 1103 +++++++++++++++ .../horizon-core/src/bin/float_log_parity.rs | 55 + .../horizon-core/src/bin/geometry_parity.rs | 564 ++++++++ crates/horizon-core/src/bin/noise_parity.rs | 423 ++++++ crates/horizon-core/src/bin/parity.rs | 321 +++++ crates/horizon-core/src/bin/tick_parity.rs | 246 ++++ crates/horizon-core/src/biome.rs | 74 + crates/horizon-core/src/biome/seed_hash.rs | 66 + crates/horizon-core/src/carving.rs | 164 +++ crates/horizon-core/src/carving/ellipsoid.rs | 124 ++ crates/horizon-core/src/density/arithmetic.rs | 248 ++++ crates/horizon-core/src/density/beardifier.rs | 214 +++ crates/horizon-core/src/density/cache.rs | 128 ++ .../horizon-core/src/density/end_islands.rs | 79 ++ .../src/density/graph/compiler.rs | 498 +++++++ crates/horizon-core/src/density/graph/mod.rs | 712 ++++++++++ .../horizon-core/src/density/graph/seeded.rs | 97 ++ .../horizon-core/src/density/graph/tests.rs | 552 ++++++++ .../horizon-core/src/density/interpolation.rs | 207 +++ crates/horizon-core/src/density/interval.rs | 412 ++++++ crates/horizon-core/src/density/mod.rs | 391 ++++++ crates/horizon-core/src/density/power.rs | 72 + crates/horizon-core/src/density/rounding.rs | 98 ++ crates/horizon-core/src/density/selection.rs | 228 ++++ crates/horizon-core/src/density/slice.rs | 85 ++ crates/horizon-core/src/density/spline.rs | 344 +++++ crates/horizon-core/src/density/surface.rs | 99 ++ .../horizon-core/src/density/terrain_noise.rs | 220 +++ crates/horizon-core/src/density/tests.rs | 757 ++++++++++ .../horizon-core/src/density/world_fields.rs | 151 ++ crates/horizon-core/src/geometry/mod.rs | 656 +++++++++ crates/horizon-core/src/geometry/movement.rs | 208 +++ crates/horizon-core/src/geometry/shape.rs | 551 ++++++++ .../horizon-core/src/geometry/shape/create.rs | 147 ++ .../horizon-core/src/geometry/shape/face.rs | 123 ++ .../horizon-core/src/geometry/shape/join.rs | 363 +++++ crates/horizon-core/src/geometry/sweep.rs | 224 +++ crates/horizon-core/src/geometry/traversal.rs | 155 +++ crates/horizon-core/src/geometry/trig.rs | 38 + crates/horizon-core/src/lib.rs | 17 + crates/horizon-core/src/noise/mod.rs | 289 ++++ crates/horizon-core/src/noise/normal.rs | 387 ++++++ crates/horizon-core/src/noise/perlin.rs | 273 ++++ crates/horizon-core/src/noise/simplex.rs | 121 ++ crates/horizon-core/src/noise/stack.rs | 233 ++++ crates/horizon-core/src/noise/volume.rs | 94 ++ crates/horizon-core/src/position.rs | 184 +++ crates/horizon-core/src/position/iter.rs | 159 +++ crates/horizon-core/src/random.rs | 263 ++++ crates/horizon-core/src/random/hash.rs | 157 +++ crates/horizon-core/src/random/positional.rs | 79 ++ crates/horizon-core/src/random/worldgen.rs | 190 +++ crates/horizon-core/src/storage.rs | 172 +++ crates/horizon-core/src/ticks/heap.rs | 101 ++ crates/horizon-core/src/ticks/index.rs | 159 +++ crates/horizon-core/src/ticks/mod.rs | 638 +++++++++ crates/horizon-core/tests/carving_bounds.rs | 58 + .../tests/density_world_fields.rs | 202 +++ crates/horizon-world/Cargo.toml | 22 + .../horizon-world/examples/anchor_fixture.rs | 71 + .../examples/basic_feature_fixture.rs | 175 +++ .../examples/biome_chunk_fixture.rs | 62 + .../examples/biome_generation_fixture.rs | 106 ++ .../examples/biome_placement_fixture.rs | 175 +++ .../examples/biome_source_codec_fixture.rs | 79 ++ .../examples/biome_source_fixture.rs | 79 ++ .../examples/biome_temperature_fixture.rs | 119 ++ .../examples/block_properties_fixture.rs | 142 ++ .../examples/block_state_codec_fixture.rs | 70 + .../examples/block_support_fixture.rs | 69 + .../examples/block_survival_fixture.rs | 279 ++++ .../examples/bulk_section_fixture.rs | 209 +++ .../examples/canyon_carver_fixture.rs | 99 ++ .../examples/carving_geometry_fixture.rs | 119 ++ .../examples/carving_mask_fixture.rs | 76 ++ .../examples/cave_carver_fixture.rs | 99 ++ .../examples/chunk_stage_fixture.rs | 212 +++ .../examples/collision_fixture.rs | 199 +++ .../examples/decoration_fixture.rs | 211 +++ .../examples/decoration_region_fixture.rs | 304 +++++ .../examples/dynamic_support_fixture.rs | 252 ++++ .../examples/entity_obstruction_fixture.rs | 115 ++ .../examples/face_support_fixture.rs | 147 ++ .../examples/feature_catalog_fixture.rs | 276 ++++ .../examples/feature_graph_fixture.rs | 180 +++ .../examples/feature_placement_fixture.rs | 91 ++ .../examples/feature_region_fixture.rs | 294 ++++ .../examples/feature_sort_fixture.rs | 50 + .../examples/fill_layer_fixture.rs | 195 +++ .../horizon-world/examples/fluid_fixture.rs | 121 ++ .../examples/height_provider_fixture.rs | 50 + .../examples/heightmap_fixture.rs | 253 ++++ .../examples/material_condition_fixture.rs | 735 ++++++++++ .../examples/material_extension_fixture.rs | 208 +++ .../examples/material_stage_fixture.rs | 838 ++++++++++++ .../examples/material_surface_fixture.rs | 137 ++ .../examples/piston_shape_fixture.rs | 190 +++ .../examples/placement_fixture.rs | 84 ++ .../examples/replace_block_fixture.rs | 204 +++ .../examples/rule_test_fixture.rs | 95 ++ .../examples/scattered_ore_fixture.rs | 228 ++++ .../examples/state_provider_fixture.rs | 540 ++++++++ .../examples/structure_density_fixture.rs | 97 ++ .../examples/support/decoration_storage.rs | 101 ++ .../examples/support/placement_queries.rs | 149 ++ .../horizon-world/examples/terrain_fixture.rs | 303 ++++ crates/horizon-world/examples/tick_fixture.rs | 71 + .../examples/value_provider_fixture.rs | 68 + .../horizon-world/examples/world_fixture.rs | 154 +++ .../examples/worldgen_random_fixture.rs | 134 ++ .../horizon-world/src/bin/worldgen_parity.rs | 915 +++++++++++++ crates/horizon-world/src/block_collision.rs | 112 ++ crates/horizon-world/src/block_properties.rs | 171 +++ crates/horizon-world/src/block_support.rs | 221 +++ crates/horizon-world/src/block_survival.rs | 1215 +++++++++++++++++ crates/horizon-world/src/chunk.rs | 556 ++++++++ crates/horizon-world/src/collision.rs | 190 +++ crates/horizon-world/src/compression.rs | 227 +++ crates/horizon-world/src/dynamic_support.rs | 251 ++++ .../horizon-world/src/entity_obstruction.rs | 89 ++ crates/horizon-world/src/fluid.rs | 252 ++++ crates/horizon-world/src/heightmap.rs | 249 ++++ crates/horizon-world/src/lib.rs | 22 + crates/horizon-world/src/main.rs | 197 +++ crates/horizon-world/src/nbt.rs | 606 ++++++++ crates/horizon-world/src/piston_shape.rs | 196 +++ crates/horizon-world/src/region.rs | 376 +++++ crates/horizon-world/src/registry.rs | 106 ++ crates/horizon-world/src/registry/json.rs | 135 ++ crates/horizon-world/src/tick_data.rs | 81 ++ crates/horizon-world/src/worldgen.rs | 258 ++++ crates/horizon-world/src/worldgen/anchor.rs | 102 ++ crates/horizon-world/src/worldgen/aquifer.rs | 100 ++ .../src/worldgen/aquifer/config.rs | 127 ++ .../src/worldgen/aquifer/noise_based.rs | 578 ++++++++ crates/horizon-world/src/worldgen/biome.rs | 153 +++ .../horizon-world/src/worldgen/biome_chunk.rs | 178 +++ .../src/worldgen/biome_predicate.rs | 81 ++ .../src/worldgen/biome_source.rs | 92 ++ .../src/worldgen/biome_source/codec.rs | 262 ++++ .../src/worldgen/biome_source/runtime.rs | 170 +++ .../src/worldgen/biome_temperature.rs | 193 +++ .../src/worldgen/block_feature.rs | 333 +++++ .../src/worldgen/block_predicate.rs | 360 +++++ .../src/worldgen/bulk_section.rs | 113 ++ crates/horizon-world/src/worldgen/carver.rs | 296 ++++ .../src/worldgen/carver/canyon.rs | 161 +++ .../src/worldgen/carver/generation.rs | 167 +++ crates/horizon-world/src/worldgen/carving.rs | 122 ++ crates/horizon-world/src/worldgen/climate.rs | 118 ++ .../src/worldgen/climate/codec.rs | 59 + .../src/worldgen/climate/index.rs | 325 +++++ .../horizon-world/src/worldgen/decoration.rs | 141 ++ crates/horizon-world/src/worldgen/density.rs | 578 ++++++++ crates/horizon-world/src/worldgen/feature.rs | 162 +++ .../src/worldgen/feature_catalog.rs | 266 ++++ .../src/worldgen/feature_graph.rs | 441 ++++++ .../src/worldgen/feature_region.rs | 231 ++++ .../src/worldgen/feature_sort.rs | 116 ++ .../src/worldgen/fluid_predicate.rs | 92 ++ .../src/worldgen/height_provider.rs | 149 ++ .../src/worldgen/material_condition.rs | 611 +++++++++ .../src/worldgen/material_condition/codec.rs | 474 +++++++ .../worldgen/material_condition/density.rs | 147 ++ .../worldgen/material_condition/library.rs | 359 +++++ .../src/worldgen/material_condition/noise.rs | 112 ++ .../src/worldgen/material_condition/rule.rs | 222 +++ .../src/worldgen/material_extensions.rs | 229 ++++ .../src/worldgen/material_stage.rs | 351 +++++ .../src/worldgen/material_surface.rs | 142 ++ .../horizon-world/src/worldgen/ore_feature.rs | 101 ++ .../horizon-world/src/worldgen/placement.rs | 505 +++++++ .../src/worldgen/placement/chain.rs | 270 ++++ .../src/worldgen/placement/context.rs | 117 ++ .../src/worldgen/placement/layer.rs | 68 + crates/horizon-world/src/worldgen/router.rs | 168 +++ .../horizon-world/src/worldgen/rule_test.rs | 133 ++ crates/horizon-world/src/worldgen/settings.rs | 45 + .../src/worldgen/state_provider.rs | 601 ++++++++ .../src/worldgen/state_provider/catalog.rs | 55 + .../src/worldgen/state_provider/noise.rs | 231 ++++ .../src/worldgen/state_provider/properties.rs | 178 +++ crates/horizon-world/src/worldgen/tags.rs | 369 +++++ crates/horizon-world/src/worldgen/terrain.rs | 479 +++++++ .../src/worldgen/value_provider.rs | 215 +++ crates/horizon-world/src/worldgen/weighted.rs | 105 ++ crates/horizon-world/tests/biome_data.rs | 91 ++ .../tests/biome_predicate_bounds.rs | 39 + crates/horizon-world/tests/biome_region.rs | 40 + .../tests/block_predicate_bounds.rs | 92 ++ .../horizon-world/tests/carver_generation.rs | 89 ++ crates/horizon-world/tests/carving_stage.rs | 172 +++ crates/horizon-world/tests/collision_data.rs | 157 +++ .../horizon-world/tests/decoration_bounds.rs | 35 + crates/horizon-world/tests/feature_catalog.rs | 62 + .../tests/feature_graph_bounds.rs | 89 ++ .../horizon-world/tests/feature_placement.rs | 41 + crates/horizon-world/tests/feature_region.rs | 148 ++ .../tests/feature_sort_bounds.rs | 34 + crates/horizon-world/tests/material_stage.rs | 295 ++++ .../horizon-world/tests/placement_bounds.rs | 58 + .../horizon-world/tests/placement_queries.rs | 45 + .../horizon-world/tests/rule_test_bounds.rs | 69 + .../tests/state_provider_bounds.rs | 81 ++ crates/horizon-world/tests/tick_data.rs | 117 ++ .../horizon-world/tests/weighted_provider.rs | 53 + crates/horizon-world/tests/world_io.rs | 199 +++ docs/biome-lookup.md | 133 ++ docs/biome-temperatures.md | 33 + docs/block-state-codecs.md | 25 + docs/carving.md | 126 ++ docs/collision-geometry.md | 283 ++++ docs/compact-headers.md | 2 +- docs/debounce-queue.md | 2 +- docs/density-functions.md | 502 +++++++ docs/dispatch-retry.md | 2 +- docs/feature-placement.md | 543 ++++++++ docs/heightmaps.md | 57 + docs/mac-first-test.md | 2 +- docs/material-conditions.md | 88 ++ docs/material-rule-libraries.md | 36 + docs/material-surfaces.md | 125 ++ docs/noise-generation.md | 96 ++ docs/optimization-plan.md | 7 + docs/playable-validation.md | 4 +- docs/process-memory.md | 2 +- docs/rust-parity.md | 381 ++++++ docs/scheduled-ticks.md | 136 ++ docs/shader-world-smoke.md | 2 +- docs/structure-density.md | 43 + docs/terrain-filling.md | 88 ++ docs/value-providers.md | 63 + docs/vertical-anchors.md | 22 + docs/worker-pacing.md | 2 +- docs/world-data.md | 147 ++ docs/world-generation.md | 192 +++ .../main/java/dev/horizonlab/HorizonLab.java | 2 +- .../dev/horizonlab/budget/DebounceWait.java | 0 .../dev/horizonlab/budget/DispatchRetry.java | 0 .../dev/horizonlab/budget/TerrainBudget.java | 0 .../horizonlab/budget/TerrainReadWait.java | 0 .../horizonlab/budget/WakeableIdleWait.java | 0 .../dev/horizonlab/budget/WorkerPacer.java | 0 .../client/DistantTerrainBudget.java | 2 +- .../client/DistantTerrainSettings.java | 0 .../dev/horizonlab/client/HorizonClient.java | 0 .../dev/horizonlab/client/ShaderSettings.java | 0 .../geometry/RelativeTerrainPosition.java | 0 .../metrics/ProcessMemoryMonitor.java | 0 .../dev/horizonlab/metrics/Recording.java | 0 .../java/dev/horizonlab/metrics/Reports.java | 0 .../horizonlab/metrics/ResidentMemory.java | 0 .../dev/horizonlab/metrics/SampleStats.java | 0 .../dev/horizonlab/metrics/ServerContext.java | 0 .../horizonlab/metrics/SoftwareContext.java | 0 .../dev/horizonlab/metrics/TickState.java | 0 .../mixin/CullingEmptyWhitelistMixin.java | 0 .../mixin/CullingRayScratchMixin.java | 0 .../horizonlab/mixin/DhDebounceWaitMixin.java | 0 .../mixin/DhPriorityDispatchMixin.java | 0 .../horizonlab/mixin/DhQuadReuseMixin.java | 0 .../mixin/DhRelativePositionMixin.java | 0 .../mixin/DhTerrainReadWaitMixin.java | 0 .../horizonlab/mixin/DhTickDedupMixin.java | 0 .../horizonlab/mixin/DhWorkerPacingMixin.java | 0 .../java/dev/horizonlab/mixin/FrameMixin.java | 0 .../horizonlab/mixin/HorizonMixinPlugin.java | 0 .../dev/horizonlab/mixin/ServerTickMixin.java | 0 .../assets/horizonlab/lang/en_us.json | 0 .../src/main/resources/fabric.mod.json | 2 +- .../src/main/resources/horizonlab.mixins.json | 0 .../budget/DebounceQueueBenchmark.java | 0 .../horizonlab/budget/DebounceWaitTest.java | 0 .../horizonlab/budget/DispatchRetryTest.java | 0 .../horizonlab/budget/IdleQueueBenchmark.java | 0 .../horizonlab/budget/TerrainBudgetTest.java | 0 .../budget/WakeableIdleWaitTest.java | 0 .../horizonlab/budget/WorkerPacerTest.java | 0 .../budget/WorkerPacingBenchmark.java | 0 .../client/DistantTerrainBudgetTest.java | 0 .../client/DistantTerrainSettingsTest.java | 0 .../dispatch/CullingEmptyIntegration.java | 0 .../dispatch/CullingRayIntegration.java | 0 .../dispatch/DispatchIntegration.java | 0 .../dispatch/PositionIntegration.java | 0 .../dispatch/QuadReuseIntegration.java | 0 .../dispatch/QuadSizeIntegration.java | 0 .../dispatch/TerrainReadIntegration.java | 0 .../dispatch/TickDedupIntegration.java | 0 .../dispatch/fixture/CullingRayAccess.java | 0 .../fixture/GraphicsBackendTraceMixin.java | 0 .../geometry/RelativeTerrainPositionTest.java | 0 .../metrics/ClientGraphicsIntegration.java | 0 .../dev/horizonlab/metrics/MetricsTest.java | 0 .../metrics/ObjectHeaderBenchmark.java | 0 .../horizonlab/metrics/ObjectSizeAgent.java | 0 .../metrics/ResidentMemoryTest.java | 0 .../metrics/ServerGraphicsIntegration.java | 0 .../metrics/TickStateIntegration.java | 0 .../parity/VanillaAnchorOracle.java | 57 + .../parity/VanillaBasicFeatureOracle.java | 78 ++ .../parity/VanillaBiomeChunkOracle.java | 45 + .../horizonlab/parity/VanillaBiomeExport.java | 32 + .../parity/VanillaBiomeGenerationOracle.java | 69 + .../parity/VanillaBiomePlacementOracle.java | 80 ++ .../parity/VanillaBiomeSourceCodecOracle.java | 47 + .../parity/VanillaBiomeSourceOracle.java | 39 + .../parity/VanillaBiomeTemperatureOracle.java | 69 + .../parity/VanillaBiomeZoomOracle.java | 36 + .../parity/VanillaBlockPropertiesOracle.java | 56 + .../parity/VanillaBlockStateCodecOracle.java | 46 + .../parity/VanillaBlockSupportOracle.java | 37 + .../parity/VanillaBlockSurvivalOracle.java | 91 ++ .../parity/VanillaBulkSectionOracle.java | 88 ++ .../parity/VanillaCanyonCarverOracle.java | 40 + .../parity/VanillaCarvingGeometryOracle.java | 43 + .../parity/VanillaCarvingMaskOracle.java | 51 + .../parity/VanillaCaveCarverOracle.java | 40 + .../parity/VanillaChunkStageOracle.java | 56 + .../parity/VanillaCollisionOracle.java | 153 +++ .../horizonlab/parity/VanillaCoreOracle.java | 161 +++ .../parity/VanillaDecorationOracle.java | 102 ++ .../parity/VanillaDecorationRegionOracle.java | 125 ++ .../parity/VanillaDensityOracle.java | 471 +++++++ .../parity/VanillaDynamicSupportOracle.java | 55 + .../VanillaEntityObstructionOracle.java | 58 + .../parity/VanillaFaceSupportOracle.java | 56 + .../parity/VanillaFeatureCatalogOracle.java | 123 ++ .../parity/VanillaFeatureGraphOracle.java | 79 ++ .../parity/VanillaFeaturePlacementOracle.java | 53 + .../parity/VanillaFeatureRegionOracle.java | 97 ++ .../parity/VanillaFeatureSortOracle.java | 45 + .../parity/VanillaFillLayerOracle.java | 76 ++ .../parity/VanillaFloatLogOracle.java | 32 + .../horizonlab/parity/VanillaFluidOracle.java | 45 + .../parity/VanillaGeometryOracle.java | 218 +++ .../parity/VanillaHeightProviderOracle.java | 32 + .../parity/VanillaHeightmapOracle.java | 145 ++ .../VanillaMaterialConditionOracle.java | 251 ++++ .../VanillaMaterialExtensionOracle.java | 67 + .../parity/VanillaMaterialStageOracle.java | 181 +++ .../parity/VanillaMaterialSurfaceOracle.java | 75 + .../horizonlab/parity/VanillaNoiseOracle.java | 149 ++ .../parity/VanillaPistonShapeOracle.java | 41 + .../parity/VanillaPlacementOracle.java | 101 ++ .../parity/VanillaReplaceBlockOracle.java | 74 + .../parity/VanillaRuleTestOracle.java | 37 + .../parity/VanillaScatteredOreOracle.java | 78 ++ .../parity/VanillaStateProviderOracle.java | 147 ++ .../parity/VanillaStructureDensityOracle.java | 38 + .../horizonlab/parity/VanillaTagExport.java | 12 + .../parity/VanillaTerrainOracle.java | 110 ++ .../parity/VanillaTickDataOracle.java | 90 ++ .../horizonlab/parity/VanillaTickOracle.java | 109 ++ .../parity/VanillaValueProviderOracle.java | 39 + .../horizonlab/parity/VanillaWorldOracle.java | 217 +++ .../parity/VanillaWorldgenOracle.java | 387 ++++++ .../parity/VanillaWorldgenRandomOracle.java | 50 + packs/START-HERE.txt | 4 +- tests/test_anchor_parity.py | 22 + tests/test_basic_feature_parity.py | 25 + tests/test_biome_chunk_parity.py | 23 + tests/test_biome_generation_parity.py | 27 + tests/test_biome_placement_parity.py | 20 + tests/test_biome_source_codec_parity.py | 23 + tests/test_biome_source_parity.py | 23 + tests/test_biome_temperature_parity.py | 33 + tests/test_biome_zoom_parity.py | 20 + tests/test_block_properties_parity.py | 19 + tests/test_block_state_codec_parity.py | 19 + tests/test_block_survival_parity.py | 72 + tests/test_bulk_section_parity.py | 22 + tests/test_canyon_carver_parity.py | 20 + tests/test_carving_geometry_parity.py | 22 + tests/test_carving_mask_parity.py | 20 + tests/test_cave_carver_parity.py | 21 + tests/test_chunk_stage_parity.py | 22 + tests/test_decoration_parity.py | 22 + tests/test_decoration_region_parity.py | 22 + tests/test_density_parity.py | 254 ++++ tests/test_dynamic_support_parity.py | 31 + tests/test_entity_obstruction_parity.py | 19 + tests/test_face_support_parity.py | 20 + tests/test_feature_catalog_parity.py | 24 + tests/test_feature_graph_parity.py | 22 + tests/test_feature_placement_parity.py | 21 + tests/test_feature_region_parity.py | 21 + tests/test_feature_sort_parity.py | 18 + tests/test_fill_layer_parity.py | 20 + tests/test_float_log_parity.py | 37 + tests/test_fluid_parity.py | 17 + tests/test_geometry_parity.py | 41 + tests/test_height_provider_parity.py | 23 + tests/test_heightmap_parity.py | 39 + tests/test_lab.py | 3 +- tests/test_material_condition_parity.py | 112 ++ tests/test_material_extension_parity.py | 19 + tests/test_material_rule_library_parity.py | 24 + tests/test_material_stage_parity.py | 95 ++ tests/test_material_surface_parity.py | 21 + tests/test_noise_parity.py | 43 + tests/test_packs.py | 26 +- tests/test_piston_shape_parity.py | 19 + tests/test_placement_parity.py | 27 + tests/test_replace_block_parity.py | 20 + tests/test_rule_test_parity.py | 19 + tests/test_rust_parity.py | 72 + tests/test_scattered_ore_parity.py | 21 + tests/test_state_provider_parity.py | 32 + tests/test_structure_density_parity.py | 27 + tests/test_terrain_parity.py | 37 + tests/test_tick_parity.py | 32 + tests/test_value_provider_parity.py | 23 + tests/test_worldgen_parity.py | 150 ++ tests/test_worldgen_random_parity.py | 20 + tools/Compare-Benchmarks.html | 4 +- tools/build_mod.py | 6 +- tools/build_pack.py | 8 +- tools/build_release.py | 2 +- tools/check_public_tree.py | 4 +- tools/lab.py | 2 +- tools/runtime.py | 4 +- tools/server.py | 2 +- tools/test_anchor_parity.py | 76 ++ tools/test_basic_feature_parity.py | 95 ++ tools/test_biome_chunk_parity.py | 66 + tools/test_biome_generation_parity.py | 88 ++ tools/test_biome_placement_parity.py | 70 + tools/test_biome_source_codec_parity.py | 120 ++ tools/test_biome_source_parity.py | 68 + tools/test_biome_temperature_parity.py | 105 ++ tools/test_biome_zoom_parity.py | 81 ++ tools/test_block_properties_parity.py | 73 + tools/test_block_state_codec_parity.py | 76 ++ tools/test_block_support_parity.py | 51 + tools/test_block_survival_parity.py | 267 ++++ tools/test_bulk_section_parity.py | 93 ++ tools/test_canyon_carver_parity.py | 89 ++ tools/test_carving_geometry_parity.py | 96 ++ tools/test_carving_mask_parity.py | 89 ++ tools/test_cave_carver_parity.py | 84 ++ tools/test_chunk_stage_parity.py | 96 ++ tools/test_client_graphics.py | 2 +- tools/test_collision_parity.py | 78 ++ tools/test_culling_empty.py | 2 +- tools/test_culling_rays.py | 2 +- tools/test_decoration_parity.py | 92 ++ tools/test_decoration_region_parity.py | 97 ++ tools/test_density_parity.py | 1100 +++++++++++++++ tools/test_dispatch.py | 2 +- tools/test_dynamic_support_parity.py | 98 ++ tools/test_entity_obstruction_parity.py | 77 ++ tools/test_face_support_parity.py | 77 ++ tools/test_feature_catalog_parity.py | 123 ++ tools/test_feature_graph_parity.py | 104 ++ tools/test_feature_placement_parity.py | 111 ++ tools/test_feature_region_parity.py | 93 ++ tools/test_feature_sort_parity.py | 81 ++ tools/test_fill_layer_parity.py | 85 ++ tools/test_float_log_parity.py | 100 ++ tools/test_fluid_parity.py | 62 + tools/test_geometry_parity.py | 313 +++++ tools/test_height_provider_parity.py | 97 ++ tools/test_heightmap_parity.py | 122 ++ tools/test_material_condition_parity.py | 316 +++++ tools/test_material_extension_parity.py | 80 ++ tools/test_material_rule_library_parity.py | 93 ++ tools/test_material_stage_parity.py | 146 ++ tools/test_material_surface_parity.py | 75 + tools/test_noise_parity.py | 209 +++ tools/test_piston_shape_parity.py | 79 ++ tools/test_placement_parity.py | 132 ++ tools/test_quad_reuse.py | 2 +- tools/test_quad_sizes.py | 2 +- tools/test_replace_block_parity.py | 93 ++ tools/test_rule_test_parity.py | 89 ++ tools/test_rust_parity.py | 185 +++ tools/test_scattered_ore_parity.py | 94 ++ tools/test_server_graphics.py | 2 +- tools/test_state_provider_parity.py | 400 ++++++ tools/test_structure_density_parity.py | 91 ++ tools/test_terrain_parity.py | 121 ++ tools/test_terrain_position.py | 2 +- tools/test_terrain_read.py | 2 +- tools/test_tick_dedup.py | 2 +- tools/test_tick_parity.py | 194 +++ tools/test_value_provider_parity.py | 98 ++ tools/test_world_parity.py | 112 ++ tools/test_worldgen_parity.py | 394 ++++++ tools/test_worldgen_random_parity.py | 70 + 558 files changed, 73754 insertions(+), 58 deletions(-) create mode 100644 benchmarks/rust-anchor-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-basic-feature-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-biome-chunk-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-biome-generation-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-biome-placement-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-biome-source-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-biome-source-codec-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-biome-temperature-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-biome-zoom-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-block-properties-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-block-state-codec-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-block-support-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-block-survival-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-bulk-section-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-canyon-carver-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-carving-geometry-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-carving-mask-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-cave-carver-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-chunk-stage-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-collision-2026-10-05/scoped-parity.json create mode 100644 benchmarks/rust-core-2026-10-04/scoped-parity.json create mode 100644 benchmarks/rust-core-2026-10-05/scoped-parity.json create mode 100644 benchmarks/rust-decoration-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-decoration-region-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-density-2026-10-05/scoped-parity.json create mode 100644 benchmarks/rust-dynamic-support-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-entity-obstruction-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-face-support-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-feature-catalog-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-feature-graph-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-feature-placement-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-feature-region-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-feature-sort-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-fill-layer-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-float-log-2026-10-05/boundary-parity.json create mode 100644 benchmarks/rust-float-log-2026-10-05/scoped-parity.json create mode 100644 benchmarks/rust-fluid-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-geometry-2026-10-05/scoped-parity.json create mode 100644 benchmarks/rust-geometry-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-height-provider-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-heightmap-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-material-condition-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-material-extension-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-material-rule-library-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-material-stage-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-material-surface-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-noise-2026-10-05/scoped-parity.json create mode 100644 benchmarks/rust-piston-shape-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-placement-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-replace-block-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-rule-test-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-scattered-ore-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-state-provider-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-structure-density-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-terrain-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-ticks-2026-10-05/scoped-parity.json create mode 100644 benchmarks/rust-value-provider-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-world-2026-10-05/scoped-parity.json create mode 100644 benchmarks/rust-worldgen-2026-10-05/scoped-parity.json create mode 100644 benchmarks/rust-worldgen-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-worldgen-random-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-core/Cargo.toml create mode 100644 crates/horizon-core/examples/biome_zoom_fixture.rs create mode 100644 crates/horizon-core/src/bin/density_parity.rs create mode 100644 crates/horizon-core/src/bin/float_log_parity.rs create mode 100644 crates/horizon-core/src/bin/geometry_parity.rs create mode 100644 crates/horizon-core/src/bin/noise_parity.rs create mode 100644 crates/horizon-core/src/bin/parity.rs create mode 100644 crates/horizon-core/src/bin/tick_parity.rs create mode 100644 crates/horizon-core/src/biome.rs create mode 100644 crates/horizon-core/src/biome/seed_hash.rs create mode 100644 crates/horizon-core/src/carving.rs create mode 100644 crates/horizon-core/src/carving/ellipsoid.rs create mode 100644 crates/horizon-core/src/density/arithmetic.rs create mode 100644 crates/horizon-core/src/density/beardifier.rs create mode 100644 crates/horizon-core/src/density/cache.rs create mode 100644 crates/horizon-core/src/density/end_islands.rs create mode 100644 crates/horizon-core/src/density/graph/compiler.rs create mode 100644 crates/horizon-core/src/density/graph/mod.rs create mode 100644 crates/horizon-core/src/density/graph/seeded.rs create mode 100644 crates/horizon-core/src/density/graph/tests.rs create mode 100644 crates/horizon-core/src/density/interpolation.rs create mode 100644 crates/horizon-core/src/density/interval.rs create mode 100644 crates/horizon-core/src/density/mod.rs create mode 100644 crates/horizon-core/src/density/power.rs create mode 100644 crates/horizon-core/src/density/rounding.rs create mode 100644 crates/horizon-core/src/density/selection.rs create mode 100644 crates/horizon-core/src/density/slice.rs create mode 100644 crates/horizon-core/src/density/spline.rs create mode 100644 crates/horizon-core/src/density/surface.rs create mode 100644 crates/horizon-core/src/density/terrain_noise.rs create mode 100644 crates/horizon-core/src/density/tests.rs create mode 100644 crates/horizon-core/src/density/world_fields.rs create mode 100644 crates/horizon-core/src/geometry/mod.rs create mode 100644 crates/horizon-core/src/geometry/movement.rs create mode 100644 crates/horizon-core/src/geometry/shape.rs create mode 100644 crates/horizon-core/src/geometry/shape/create.rs create mode 100644 crates/horizon-core/src/geometry/shape/face.rs create mode 100644 crates/horizon-core/src/geometry/shape/join.rs create mode 100644 crates/horizon-core/src/geometry/sweep.rs create mode 100644 crates/horizon-core/src/geometry/traversal.rs create mode 100644 crates/horizon-core/src/geometry/trig.rs create mode 100644 crates/horizon-core/src/lib.rs create mode 100644 crates/horizon-core/src/noise/mod.rs create mode 100644 crates/horizon-core/src/noise/normal.rs create mode 100644 crates/horizon-core/src/noise/perlin.rs create mode 100644 crates/horizon-core/src/noise/simplex.rs create mode 100644 crates/horizon-core/src/noise/stack.rs create mode 100644 crates/horizon-core/src/noise/volume.rs create mode 100644 crates/horizon-core/src/position.rs create mode 100644 crates/horizon-core/src/position/iter.rs create mode 100644 crates/horizon-core/src/random.rs create mode 100644 crates/horizon-core/src/random/hash.rs create mode 100644 crates/horizon-core/src/random/positional.rs create mode 100644 crates/horizon-core/src/random/worldgen.rs create mode 100644 crates/horizon-core/src/storage.rs create mode 100644 crates/horizon-core/src/ticks/heap.rs create mode 100644 crates/horizon-core/src/ticks/index.rs create mode 100644 crates/horizon-core/src/ticks/mod.rs create mode 100644 crates/horizon-core/tests/carving_bounds.rs create mode 100644 crates/horizon-core/tests/density_world_fields.rs create mode 100644 crates/horizon-world/Cargo.toml create mode 100644 crates/horizon-world/examples/anchor_fixture.rs create mode 100644 crates/horizon-world/examples/basic_feature_fixture.rs create mode 100644 crates/horizon-world/examples/biome_chunk_fixture.rs create mode 100644 crates/horizon-world/examples/biome_generation_fixture.rs create mode 100644 crates/horizon-world/examples/biome_placement_fixture.rs create mode 100644 crates/horizon-world/examples/biome_source_codec_fixture.rs create mode 100644 crates/horizon-world/examples/biome_source_fixture.rs create mode 100644 crates/horizon-world/examples/biome_temperature_fixture.rs create mode 100644 crates/horizon-world/examples/block_properties_fixture.rs create mode 100644 crates/horizon-world/examples/block_state_codec_fixture.rs create mode 100644 crates/horizon-world/examples/block_support_fixture.rs create mode 100644 crates/horizon-world/examples/block_survival_fixture.rs create mode 100644 crates/horizon-world/examples/bulk_section_fixture.rs create mode 100644 crates/horizon-world/examples/canyon_carver_fixture.rs create mode 100644 crates/horizon-world/examples/carving_geometry_fixture.rs create mode 100644 crates/horizon-world/examples/carving_mask_fixture.rs create mode 100644 crates/horizon-world/examples/cave_carver_fixture.rs create mode 100644 crates/horizon-world/examples/chunk_stage_fixture.rs create mode 100644 crates/horizon-world/examples/collision_fixture.rs create mode 100644 crates/horizon-world/examples/decoration_fixture.rs create mode 100644 crates/horizon-world/examples/decoration_region_fixture.rs create mode 100644 crates/horizon-world/examples/dynamic_support_fixture.rs create mode 100644 crates/horizon-world/examples/entity_obstruction_fixture.rs create mode 100644 crates/horizon-world/examples/face_support_fixture.rs create mode 100644 crates/horizon-world/examples/feature_catalog_fixture.rs create mode 100644 crates/horizon-world/examples/feature_graph_fixture.rs create mode 100644 crates/horizon-world/examples/feature_placement_fixture.rs create mode 100644 crates/horizon-world/examples/feature_region_fixture.rs create mode 100644 crates/horizon-world/examples/feature_sort_fixture.rs create mode 100644 crates/horizon-world/examples/fill_layer_fixture.rs create mode 100644 crates/horizon-world/examples/fluid_fixture.rs create mode 100644 crates/horizon-world/examples/height_provider_fixture.rs create mode 100644 crates/horizon-world/examples/heightmap_fixture.rs create mode 100644 crates/horizon-world/examples/material_condition_fixture.rs create mode 100644 crates/horizon-world/examples/material_extension_fixture.rs create mode 100644 crates/horizon-world/examples/material_stage_fixture.rs create mode 100644 crates/horizon-world/examples/material_surface_fixture.rs create mode 100644 crates/horizon-world/examples/piston_shape_fixture.rs create mode 100644 crates/horizon-world/examples/placement_fixture.rs create mode 100644 crates/horizon-world/examples/replace_block_fixture.rs create mode 100644 crates/horizon-world/examples/rule_test_fixture.rs create mode 100644 crates/horizon-world/examples/scattered_ore_fixture.rs create mode 100644 crates/horizon-world/examples/state_provider_fixture.rs create mode 100644 crates/horizon-world/examples/structure_density_fixture.rs create mode 100644 crates/horizon-world/examples/support/decoration_storage.rs create mode 100644 crates/horizon-world/examples/support/placement_queries.rs create mode 100644 crates/horizon-world/examples/terrain_fixture.rs create mode 100644 crates/horizon-world/examples/tick_fixture.rs create mode 100644 crates/horizon-world/examples/value_provider_fixture.rs create mode 100644 crates/horizon-world/examples/world_fixture.rs create mode 100644 crates/horizon-world/examples/worldgen_random_fixture.rs create mode 100644 crates/horizon-world/src/bin/worldgen_parity.rs create mode 100644 crates/horizon-world/src/block_collision.rs create mode 100644 crates/horizon-world/src/block_properties.rs create mode 100644 crates/horizon-world/src/block_support.rs create mode 100644 crates/horizon-world/src/block_survival.rs create mode 100644 crates/horizon-world/src/chunk.rs create mode 100644 crates/horizon-world/src/collision.rs create mode 100644 crates/horizon-world/src/compression.rs create mode 100644 crates/horizon-world/src/dynamic_support.rs create mode 100644 crates/horizon-world/src/entity_obstruction.rs create mode 100644 crates/horizon-world/src/fluid.rs create mode 100644 crates/horizon-world/src/heightmap.rs create mode 100644 crates/horizon-world/src/lib.rs create mode 100644 crates/horizon-world/src/main.rs create mode 100644 crates/horizon-world/src/nbt.rs create mode 100644 crates/horizon-world/src/piston_shape.rs create mode 100644 crates/horizon-world/src/region.rs create mode 100644 crates/horizon-world/src/registry.rs create mode 100644 crates/horizon-world/src/registry/json.rs create mode 100644 crates/horizon-world/src/tick_data.rs create mode 100644 crates/horizon-world/src/worldgen.rs create mode 100644 crates/horizon-world/src/worldgen/anchor.rs create mode 100644 crates/horizon-world/src/worldgen/aquifer.rs create mode 100644 crates/horizon-world/src/worldgen/aquifer/config.rs create mode 100644 crates/horizon-world/src/worldgen/aquifer/noise_based.rs create mode 100644 crates/horizon-world/src/worldgen/biome.rs create mode 100644 crates/horizon-world/src/worldgen/biome_chunk.rs create mode 100644 crates/horizon-world/src/worldgen/biome_predicate.rs create mode 100644 crates/horizon-world/src/worldgen/biome_source.rs create mode 100644 crates/horizon-world/src/worldgen/biome_source/codec.rs create mode 100644 crates/horizon-world/src/worldgen/biome_source/runtime.rs create mode 100644 crates/horizon-world/src/worldgen/biome_temperature.rs create mode 100644 crates/horizon-world/src/worldgen/block_feature.rs create mode 100644 crates/horizon-world/src/worldgen/block_predicate.rs create mode 100644 crates/horizon-world/src/worldgen/bulk_section.rs create mode 100644 crates/horizon-world/src/worldgen/carver.rs create mode 100644 crates/horizon-world/src/worldgen/carver/canyon.rs create mode 100644 crates/horizon-world/src/worldgen/carver/generation.rs create mode 100644 crates/horizon-world/src/worldgen/carving.rs create mode 100644 crates/horizon-world/src/worldgen/climate.rs create mode 100644 crates/horizon-world/src/worldgen/climate/codec.rs create mode 100644 crates/horizon-world/src/worldgen/climate/index.rs create mode 100644 crates/horizon-world/src/worldgen/decoration.rs create mode 100644 crates/horizon-world/src/worldgen/density.rs create mode 100644 crates/horizon-world/src/worldgen/feature.rs create mode 100644 crates/horizon-world/src/worldgen/feature_catalog.rs create mode 100644 crates/horizon-world/src/worldgen/feature_graph.rs create mode 100644 crates/horizon-world/src/worldgen/feature_region.rs create mode 100644 crates/horizon-world/src/worldgen/feature_sort.rs create mode 100644 crates/horizon-world/src/worldgen/fluid_predicate.rs create mode 100644 crates/horizon-world/src/worldgen/height_provider.rs create mode 100644 crates/horizon-world/src/worldgen/material_condition.rs create mode 100644 crates/horizon-world/src/worldgen/material_condition/codec.rs create mode 100644 crates/horizon-world/src/worldgen/material_condition/density.rs create mode 100644 crates/horizon-world/src/worldgen/material_condition/library.rs create mode 100644 crates/horizon-world/src/worldgen/material_condition/noise.rs create mode 100644 crates/horizon-world/src/worldgen/material_condition/rule.rs create mode 100644 crates/horizon-world/src/worldgen/material_extensions.rs create mode 100644 crates/horizon-world/src/worldgen/material_stage.rs create mode 100644 crates/horizon-world/src/worldgen/material_surface.rs create mode 100644 crates/horizon-world/src/worldgen/ore_feature.rs create mode 100644 crates/horizon-world/src/worldgen/placement.rs create mode 100644 crates/horizon-world/src/worldgen/placement/chain.rs create mode 100644 crates/horizon-world/src/worldgen/placement/context.rs create mode 100644 crates/horizon-world/src/worldgen/placement/layer.rs create mode 100644 crates/horizon-world/src/worldgen/router.rs create mode 100644 crates/horizon-world/src/worldgen/rule_test.rs create mode 100644 crates/horizon-world/src/worldgen/settings.rs create mode 100644 crates/horizon-world/src/worldgen/state_provider.rs create mode 100644 crates/horizon-world/src/worldgen/state_provider/catalog.rs create mode 100644 crates/horizon-world/src/worldgen/state_provider/noise.rs create mode 100644 crates/horizon-world/src/worldgen/state_provider/properties.rs create mode 100644 crates/horizon-world/src/worldgen/tags.rs create mode 100644 crates/horizon-world/src/worldgen/terrain.rs create mode 100644 crates/horizon-world/src/worldgen/value_provider.rs create mode 100644 crates/horizon-world/src/worldgen/weighted.rs create mode 100644 crates/horizon-world/tests/biome_data.rs create mode 100644 crates/horizon-world/tests/biome_predicate_bounds.rs create mode 100644 crates/horizon-world/tests/biome_region.rs create mode 100644 crates/horizon-world/tests/block_predicate_bounds.rs create mode 100644 crates/horizon-world/tests/carver_generation.rs create mode 100644 crates/horizon-world/tests/carving_stage.rs create mode 100644 crates/horizon-world/tests/collision_data.rs create mode 100644 crates/horizon-world/tests/decoration_bounds.rs create mode 100644 crates/horizon-world/tests/feature_catalog.rs create mode 100644 crates/horizon-world/tests/feature_graph_bounds.rs create mode 100644 crates/horizon-world/tests/feature_placement.rs create mode 100644 crates/horizon-world/tests/feature_region.rs create mode 100644 crates/horizon-world/tests/feature_sort_bounds.rs create mode 100644 crates/horizon-world/tests/material_stage.rs create mode 100644 crates/horizon-world/tests/placement_bounds.rs create mode 100644 crates/horizon-world/tests/placement_queries.rs create mode 100644 crates/horizon-world/tests/rule_test_bounds.rs create mode 100644 crates/horizon-world/tests/state_provider_bounds.rs create mode 100644 crates/horizon-world/tests/tick_data.rs create mode 100644 crates/horizon-world/tests/weighted_provider.rs create mode 100644 crates/horizon-world/tests/world_io.rs create mode 100644 docs/biome-lookup.md create mode 100644 docs/biome-temperatures.md create mode 100644 docs/block-state-codecs.md create mode 100644 docs/carving.md create mode 100644 docs/collision-geometry.md create mode 100644 docs/density-functions.md create mode 100644 docs/feature-placement.md create mode 100644 docs/heightmaps.md create mode 100644 docs/material-conditions.md create mode 100644 docs/material-rule-libraries.md create mode 100644 docs/material-surfaces.md create mode 100644 docs/noise-generation.md create mode 100644 docs/rust-parity.md create mode 100644 docs/scheduled-ticks.md create mode 100644 docs/structure-density.md create mode 100644 docs/terrain-filling.md create mode 100644 docs/value-providers.md create mode 100644 docs/vertical-anchors.md create mode 100644 docs/world-data.md create mode 100644 docs/world-generation.md rename mods/{horizon-lab => horizon}/src/main/java/dev/horizonlab/HorizonLab.java (97%) rename mods/{horizon-lab => horizon}/src/main/java/dev/horizonlab/budget/DebounceWait.java (100%) rename mods/{horizon-lab => horizon}/src/main/java/dev/horizonlab/budget/DispatchRetry.java (100%) rename mods/{horizon-lab => horizon}/src/main/java/dev/horizonlab/budget/TerrainBudget.java (100%) rename mods/{horizon-lab => horizon}/src/main/java/dev/horizonlab/budget/TerrainReadWait.java (100%) rename mods/{horizon-lab => horizon}/src/main/java/dev/horizonlab/budget/WakeableIdleWait.java (100%) rename mods/{horizon-lab => horizon}/src/main/java/dev/horizonlab/budget/WorkerPacer.java (100%) rename mods/{horizon-lab => horizon}/src/main/java/dev/horizonlab/client/DistantTerrainBudget.java (97%) rename mods/{horizon-lab => horizon}/src/main/java/dev/horizonlab/client/DistantTerrainSettings.java (100%) rename mods/{horizon-lab => horizon}/src/main/java/dev/horizonlab/client/HorizonClient.java (100%) rename mods/{horizon-lab => horizon}/src/main/java/dev/horizonlab/client/ShaderSettings.java (100%) rename mods/{horizon-lab => horizon}/src/main/java/dev/horizonlab/geometry/RelativeTerrainPosition.java (100%) rename mods/{horizon-lab => horizon}/src/main/java/dev/horizonlab/metrics/ProcessMemoryMonitor.java (100%) rename mods/{horizon-lab => horizon}/src/main/java/dev/horizonlab/metrics/Recording.java (100%) rename mods/{horizon-lab => horizon}/src/main/java/dev/horizonlab/metrics/Reports.java (100%) rename mods/{horizon-lab => horizon}/src/main/java/dev/horizonlab/metrics/ResidentMemory.java (100%) rename mods/{horizon-lab => horizon}/src/main/java/dev/horizonlab/metrics/SampleStats.java (100%) rename mods/{horizon-lab => horizon}/src/main/java/dev/horizonlab/metrics/ServerContext.java (100%) rename mods/{horizon-lab => horizon}/src/main/java/dev/horizonlab/metrics/SoftwareContext.java (100%) rename mods/{horizon-lab => horizon}/src/main/java/dev/horizonlab/metrics/TickState.java (100%) rename mods/{horizon-lab => horizon}/src/main/java/dev/horizonlab/mixin/CullingEmptyWhitelistMixin.java (100%) rename mods/{horizon-lab => horizon}/src/main/java/dev/horizonlab/mixin/CullingRayScratchMixin.java (100%) rename mods/{horizon-lab => horizon}/src/main/java/dev/horizonlab/mixin/DhDebounceWaitMixin.java (100%) rename mods/{horizon-lab => horizon}/src/main/java/dev/horizonlab/mixin/DhPriorityDispatchMixin.java (100%) rename mods/{horizon-lab => horizon}/src/main/java/dev/horizonlab/mixin/DhQuadReuseMixin.java (100%) rename mods/{horizon-lab => horizon}/src/main/java/dev/horizonlab/mixin/DhRelativePositionMixin.java (100%) rename mods/{horizon-lab => horizon}/src/main/java/dev/horizonlab/mixin/DhTerrainReadWaitMixin.java (100%) rename mods/{horizon-lab => horizon}/src/main/java/dev/horizonlab/mixin/DhTickDedupMixin.java (100%) rename mods/{horizon-lab => horizon}/src/main/java/dev/horizonlab/mixin/DhWorkerPacingMixin.java (100%) rename mods/{horizon-lab => horizon}/src/main/java/dev/horizonlab/mixin/FrameMixin.java (100%) rename mods/{horizon-lab => horizon}/src/main/java/dev/horizonlab/mixin/HorizonMixinPlugin.java (100%) rename mods/{horizon-lab => horizon}/src/main/java/dev/horizonlab/mixin/ServerTickMixin.java (100%) rename mods/{horizon-lab => horizon}/src/main/resources/assets/horizonlab/lang/en_us.json (100%) rename mods/{horizon-lab => horizon}/src/main/resources/fabric.mod.json (95%) rename mods/{horizon-lab => horizon}/src/main/resources/horizonlab.mixins.json (100%) rename mods/{horizon-lab => horizon}/src/test/java/dev/horizonlab/budget/DebounceQueueBenchmark.java (100%) rename mods/{horizon-lab => horizon}/src/test/java/dev/horizonlab/budget/DebounceWaitTest.java (100%) rename mods/{horizon-lab => horizon}/src/test/java/dev/horizonlab/budget/DispatchRetryTest.java (100%) rename mods/{horizon-lab => horizon}/src/test/java/dev/horizonlab/budget/IdleQueueBenchmark.java (100%) rename mods/{horizon-lab => horizon}/src/test/java/dev/horizonlab/budget/TerrainBudgetTest.java (100%) rename mods/{horizon-lab => horizon}/src/test/java/dev/horizonlab/budget/WakeableIdleWaitTest.java (100%) rename mods/{horizon-lab => horizon}/src/test/java/dev/horizonlab/budget/WorkerPacerTest.java (100%) rename mods/{horizon-lab => horizon}/src/test/java/dev/horizonlab/budget/WorkerPacingBenchmark.java (100%) rename mods/{horizon-lab => horizon}/src/test/java/dev/horizonlab/client/DistantTerrainBudgetTest.java (100%) rename mods/{horizon-lab => horizon}/src/test/java/dev/horizonlab/client/DistantTerrainSettingsTest.java (100%) rename mods/{horizon-lab => horizon}/src/test/java/dev/horizonlab/dispatch/CullingEmptyIntegration.java (100%) rename mods/{horizon-lab => horizon}/src/test/java/dev/horizonlab/dispatch/CullingRayIntegration.java (100%) rename mods/{horizon-lab => horizon}/src/test/java/dev/horizonlab/dispatch/DispatchIntegration.java (100%) rename mods/{horizon-lab => horizon}/src/test/java/dev/horizonlab/dispatch/PositionIntegration.java (100%) rename mods/{horizon-lab => horizon}/src/test/java/dev/horizonlab/dispatch/QuadReuseIntegration.java (100%) rename mods/{horizon-lab => horizon}/src/test/java/dev/horizonlab/dispatch/QuadSizeIntegration.java (100%) rename mods/{horizon-lab => horizon}/src/test/java/dev/horizonlab/dispatch/TerrainReadIntegration.java (100%) rename mods/{horizon-lab => horizon}/src/test/java/dev/horizonlab/dispatch/TickDedupIntegration.java (100%) rename mods/{horizon-lab => horizon}/src/test/java/dev/horizonlab/dispatch/fixture/CullingRayAccess.java (100%) rename mods/{horizon-lab => horizon}/src/test/java/dev/horizonlab/dispatch/fixture/GraphicsBackendTraceMixin.java (100%) rename mods/{horizon-lab => horizon}/src/test/java/dev/horizonlab/geometry/RelativeTerrainPositionTest.java (100%) rename mods/{horizon-lab => horizon}/src/test/java/dev/horizonlab/metrics/ClientGraphicsIntegration.java (100%) rename mods/{horizon-lab => horizon}/src/test/java/dev/horizonlab/metrics/MetricsTest.java (100%) rename mods/{horizon-lab => horizon}/src/test/java/dev/horizonlab/metrics/ObjectHeaderBenchmark.java (100%) rename mods/{horizon-lab => horizon}/src/test/java/dev/horizonlab/metrics/ObjectSizeAgent.java (100%) rename mods/{horizon-lab => horizon}/src/test/java/dev/horizonlab/metrics/ResidentMemoryTest.java (100%) rename mods/{horizon-lab => horizon}/src/test/java/dev/horizonlab/metrics/ServerGraphicsIntegration.java (100%) rename mods/{horizon-lab => horizon}/src/test/java/dev/horizonlab/metrics/TickStateIntegration.java (100%) create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaAnchorOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBasicFeatureOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeChunkOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeExport.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeGenerationOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomePlacementOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeSourceCodecOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeSourceOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeTemperatureOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeZoomOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSupportOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSurvivalOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBulkSectionOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCanyonCarverOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCarvingGeometryOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCarvingMaskOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCaveCarverOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaChunkStageOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCoreOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDecorationOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDecorationRegionOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDensityOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDynamicSupportOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityObstructionOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceSupportOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureCatalogOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureGraphOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeaturePlacementOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureRegionOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureSortOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFillLayerOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFloatLogOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFluidOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaGeometryOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightProviderOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMaterialConditionOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMaterialExtensionOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMaterialStageOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMaterialSurfaceOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaNoiseOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPistonShapeOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaReplaceBlockOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRuleTestOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaScatteredOreOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaStateProviderOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaStructureDensityOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaTagExport.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaTerrainOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaTickDataOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaTickOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaValueProviderOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaWorldOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaWorldgenOracle.java create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaWorldgenRandomOracle.java create mode 100644 tests/test_anchor_parity.py create mode 100644 tests/test_basic_feature_parity.py create mode 100644 tests/test_biome_chunk_parity.py create mode 100644 tests/test_biome_generation_parity.py create mode 100644 tests/test_biome_placement_parity.py create mode 100644 tests/test_biome_source_codec_parity.py create mode 100644 tests/test_biome_source_parity.py create mode 100644 tests/test_biome_temperature_parity.py create mode 100644 tests/test_biome_zoom_parity.py create mode 100644 tests/test_block_properties_parity.py create mode 100644 tests/test_block_state_codec_parity.py create mode 100644 tests/test_block_survival_parity.py create mode 100644 tests/test_bulk_section_parity.py create mode 100644 tests/test_canyon_carver_parity.py create mode 100644 tests/test_carving_geometry_parity.py create mode 100644 tests/test_carving_mask_parity.py create mode 100644 tests/test_cave_carver_parity.py create mode 100644 tests/test_chunk_stage_parity.py create mode 100644 tests/test_decoration_parity.py create mode 100644 tests/test_decoration_region_parity.py create mode 100644 tests/test_density_parity.py create mode 100644 tests/test_dynamic_support_parity.py create mode 100644 tests/test_entity_obstruction_parity.py create mode 100644 tests/test_face_support_parity.py create mode 100644 tests/test_feature_catalog_parity.py create mode 100644 tests/test_feature_graph_parity.py create mode 100644 tests/test_feature_placement_parity.py create mode 100644 tests/test_feature_region_parity.py create mode 100644 tests/test_feature_sort_parity.py create mode 100644 tests/test_fill_layer_parity.py create mode 100644 tests/test_float_log_parity.py create mode 100644 tests/test_fluid_parity.py create mode 100644 tests/test_geometry_parity.py create mode 100644 tests/test_height_provider_parity.py create mode 100644 tests/test_heightmap_parity.py create mode 100644 tests/test_material_condition_parity.py create mode 100644 tests/test_material_extension_parity.py create mode 100644 tests/test_material_rule_library_parity.py create mode 100644 tests/test_material_stage_parity.py create mode 100644 tests/test_material_surface_parity.py create mode 100644 tests/test_noise_parity.py create mode 100644 tests/test_piston_shape_parity.py create mode 100644 tests/test_placement_parity.py create mode 100644 tests/test_replace_block_parity.py create mode 100644 tests/test_rule_test_parity.py create mode 100644 tests/test_rust_parity.py create mode 100644 tests/test_scattered_ore_parity.py create mode 100644 tests/test_state_provider_parity.py create mode 100644 tests/test_structure_density_parity.py create mode 100644 tests/test_terrain_parity.py create mode 100644 tests/test_tick_parity.py create mode 100644 tests/test_value_provider_parity.py create mode 100644 tests/test_worldgen_parity.py create mode 100644 tests/test_worldgen_random_parity.py create mode 100644 tools/test_anchor_parity.py create mode 100644 tools/test_basic_feature_parity.py create mode 100644 tools/test_biome_chunk_parity.py create mode 100644 tools/test_biome_generation_parity.py create mode 100644 tools/test_biome_placement_parity.py create mode 100644 tools/test_biome_source_codec_parity.py create mode 100644 tools/test_biome_source_parity.py create mode 100644 tools/test_biome_temperature_parity.py create mode 100644 tools/test_biome_zoom_parity.py create mode 100644 tools/test_block_properties_parity.py create mode 100644 tools/test_block_state_codec_parity.py create mode 100644 tools/test_block_support_parity.py create mode 100644 tools/test_block_survival_parity.py create mode 100644 tools/test_bulk_section_parity.py create mode 100644 tools/test_canyon_carver_parity.py create mode 100644 tools/test_carving_geometry_parity.py create mode 100644 tools/test_carving_mask_parity.py create mode 100644 tools/test_cave_carver_parity.py create mode 100644 tools/test_chunk_stage_parity.py create mode 100644 tools/test_collision_parity.py create mode 100644 tools/test_decoration_parity.py create mode 100644 tools/test_decoration_region_parity.py create mode 100644 tools/test_density_parity.py create mode 100644 tools/test_dynamic_support_parity.py create mode 100644 tools/test_entity_obstruction_parity.py create mode 100644 tools/test_face_support_parity.py create mode 100644 tools/test_feature_catalog_parity.py create mode 100644 tools/test_feature_graph_parity.py create mode 100644 tools/test_feature_placement_parity.py create mode 100644 tools/test_feature_region_parity.py create mode 100644 tools/test_feature_sort_parity.py create mode 100644 tools/test_fill_layer_parity.py create mode 100644 tools/test_float_log_parity.py create mode 100644 tools/test_fluid_parity.py create mode 100644 tools/test_geometry_parity.py create mode 100644 tools/test_height_provider_parity.py create mode 100644 tools/test_heightmap_parity.py create mode 100644 tools/test_material_condition_parity.py create mode 100644 tools/test_material_extension_parity.py create mode 100644 tools/test_material_rule_library_parity.py create mode 100644 tools/test_material_stage_parity.py create mode 100644 tools/test_material_surface_parity.py create mode 100644 tools/test_noise_parity.py create mode 100644 tools/test_piston_shape_parity.py create mode 100644 tools/test_placement_parity.py create mode 100644 tools/test_replace_block_parity.py create mode 100644 tools/test_rule_test_parity.py create mode 100644 tools/test_rust_parity.py create mode 100644 tools/test_scattered_ore_parity.py create mode 100644 tools/test_state_provider_parity.py create mode 100644 tools/test_structure_density_parity.py create mode 100644 tools/test_terrain_parity.py create mode 100644 tools/test_tick_parity.py create mode 100644 tools/test_value_provider_parity.py create mode 100644 tools/test_world_parity.py create mode 100644 tools/test_worldgen_parity.py create mode 100644 tools/test_worldgen_random_parity.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7df85d008..975936753 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,25 +7,262 @@ permissions: contents: read jobs: verify: - runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-26, windows-latest] + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 with: fetch-depth: 0 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' - name: Keep game artifacts out of Git run: | - python3 tools/check_public_tree.py - python3 tools/check_public_tree.py --history + python tools/check_public_tree.py + python tools/check_public_tree.py --history - name: Test offline research tooling - run: python3 -m unittest discover -s tests -v + run: python -m unittest discover -s tests -v - name: Install Rust toolchain run: rustup toolchain install stable --profile minimal --component rustfmt --component clippy - name: Check formatting and lint run: | cargo +stable fmt --all -- --check cargo +stable clippy --workspace --all-targets -- -D warnings - - name: Test voxel kernel correctness + - name: Test Rust core and voxel kernel correctness run: cargo +stable test --workspace + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '25' + - name: Compare Rust foundations with pinned vanilla client and server bytecode + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_rust_parity.py --prepare + - name: Check Rust world-data interoperability with pinned vanilla client and server + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_world_parity.py + - name: Compare scheduled ticks and saved tick data with pinned vanilla client and server + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_tick_parity.py + - name: Compare simulation geometry and cached block collision shapes + env: + RUSTUP_TOOLCHAIN: stable + run: | + python tools/test_geometry_parity.py + python tools/test_collision_parity.py + - name: Compare noise samplers and density kernels with pinned vanilla client and server + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_noise_parity.py + - name: Compare compiled density samplers with pinned vanilla client and server + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_density_parity.py + - name: Compare world-generation JSON codecs with pinned vanilla client and server + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_worldgen_parity.py + - name: Compare heightmap predicates and chunk mutations with pinned vanilla client and server + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_heightmap_parity.py + - name: Compare pre-light chunk status transitions and block writes + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_chunk_stage_parity.py + - name: Compare feature placement into resident neighboring chunks + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_feature_region_parity.py + - name: Compare nested feature selectors and sequences + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_feature_graph_parity.py + - name: Compare named feature holders and placed-feature tags + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_feature_catalog_parity.py + - name: Compare configured fill-layer block placement + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_fill_layer_parity.py + - name: Compare replacement-rule codecs and evaluation + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_rule_test_parity.py + - name: Compare ordered single-block replacement features + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_replace_block_parity.py + - name: Compare scattered ore placement and air-exposure checks + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_scattered_ore_parity.py + - name: Compare resident bulk-section access and raw writes + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_bulk_section_parity.py + - name: Compare biome feature ordering and cycle detection + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_feature_sort_parity.py + - name: Compare world-generation random wrappers and seeding + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_worldgen_random_parity.py + - name: Compare biome filtering and top-level feature context + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_biome_placement_parity.py + - name: Compare biome decoration feature scheduling and seeding + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_decoration_parity.py + - name: Compare decoration against resident biome and terrain sections + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_decoration_region_parity.py + - name: Compare block-state provider choices and rotation + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_state_provider_parity.py + - name: Compare contained fluids and height queries with pinned vanilla client and server + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_fluid_parity.py + - name: Compare entity obstruction with pinned vanilla client and server + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_entity_obstruction_parity.py + - name: Compare block solidity and replaceability with pinned vanilla client and server + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_block_properties_parity.py + - name: Compare face slicing and block support with pinned vanilla client and server + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_face_support_parity.py + - name: Compare cached block support with pinned vanilla client and server + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_block_support_parity.py + - name: Compare dynamic block support with pinned vanilla client and server + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_dynamic_support_parity.py + - name: Compare moving-piston collision and interpolation with pinned vanilla + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_piston_shape_parity.py + - name: Compare supported block survival rules with pinned vanilla + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_block_survival_parity.py + - name: Compare noise-stage chunk filling with pinned vanilla client and server + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_terrain_parity.py + - name: Compare structure terrain-adaptation density with pinned vanilla client and server + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_structure_density_parity.py + - name: Compare seeded material bands and surface queries with pinned vanilla client and server + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_material_surface_parity.py + - name: Compare material condition codecs and rule evaluation with pinned vanilla client and server + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_material_condition_parity.py + - name: Compare biome temperatures and cache behavior with pinned vanilla client and server + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_biome_temperature_parity.py + - name: Compare badlands and frozen-ocean extensions with pinned vanilla + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_material_extension_parity.py + - name: Compare bundled material-rule libraries with pinned vanilla client and server + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_material_rule_library_parity.py + - name: Compare fixed, checkerboard and End biome sources with pinned vanilla + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_biome_source_parity.py + - name: Compare seeded cave paths and failure state with pinned vanilla + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_cave_carver_parity.py + - name: Compare seeded canyon paths and width factors with pinned vanilla + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_canyon_carver_parity.py + - name: Compare initial block-writing feature algorithms with pinned vanilla + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_basic_feature_parity.py + - name: Compare feature placement chains with pinned vanilla + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_feature_placement_parity.py + - name: Compare feature placement primitives with pinned vanilla + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_placement_parity.py + - name: Compare anchored height providers with pinned vanilla + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_height_provider_parity.py + - name: Compare scalar value providers with pinned vanilla + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_value_provider_parity.py + - name: Compare cave and canyon geometric primitives with pinned vanilla + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_carving_geometry_parity.py + - name: Compare carving-mask traversal and callback mutations with pinned vanilla + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_carving_mask_parity.py + - name: Compare registry-bound biome-source codecs with pinned vanilla + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_biome_source_codec_parity.py + - name: Compare all four biome-source kinds in chunk generation with pinned vanilla + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_biome_generation_parity.py + - name: Compare chunk biome filling and failure state with pinned vanilla + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_biome_chunk_parity.py + - name: Compare biome zoom and seed obfuscation with pinned vanilla + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_biome_zoom_parity.py + - name: Compare surface-stage chunks with pinned vanilla client and server + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_material_stage_parity.py + - name: Compare block-state JSON codecs with pinned vanilla client and server + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_block_state_codec_parity.py + - name: Compare vertical anchors with pinned vanilla client and server + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_anchor_parity.py + - name: Compare float logarithms at domain and rounding boundaries + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_float_log_parity.py portable-mod: strategy: fail-fast: false @@ -122,7 +359,7 @@ jobs: name: horizon-${{ matrix.os }} path: | dist/*.mrpack - dist/horizon-lab-*.jar + dist/horizon-*.jar dist/worker-pacing-benchmark.txt dist/debounce-queue-benchmark.txt dist/idle-queue-benchmark.txt diff --git a/.gitignore b/.gitignore index d50bc8051..e47691442 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,4 @@ /run/ /logs/ /dist/ -/mods/horizon-lab/build/ +/mods/horizon/build/ diff --git a/Cargo.lock b/Cargo.lock index c676f4e42..09592a28b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,175 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "cfg-if" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" + +[[package]] +name = "crc32fast" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01a7799fd6b852db0e61728dde9a204c423b44d689dbd432522543614b490e78" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "flate2" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e634e2e0ebac1ee034020da1ca582e17ffe4e0f5e985823721e168928136dcb" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "horizon-core" +version = "0.1.0" + +[[package]] +name = "horizon-world" +version = "0.1.0" +dependencies = [ + "flate2", + "horizon-core", + "lz4_flex", + "serde_json", + "xxhash-rust", +] + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "lz4_flex" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecbdfe44b1bd960b68170b417450a628c43f7cf56bb3c5317e61cb230ee7f226" + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "miniz_oxide" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.151" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "simd-adler32" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea" + +[[package]] +name = "syn" +version = "3.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8593e8e72159ed2257d083c7a454a85cbf854f37a0966d8d483aff8c8a3ebcee" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d245f478577f809a851594d02313b640fb437e0bb33866753cff937863096954" + [[package]] name = "voxel-kernels" version = "0.1.0" + +[[package]] +name = "xxhash-rust" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "550a2b930b62486a393c52d5c3b84bff264b28aa437ed64694d31e93b1757af7" + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" diff --git a/Cargo.toml b/Cargo.toml index 26510443b..5cc45265c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace] -members = ["crates/voxel-kernels"] +members = ["crates/horizon-core", "crates/horizon-world", "crates/voxel-kernels"] resolver = "2" [workspace.package] diff --git a/README.md b/README.md index 809990868..bfc5d4022 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ -# Minecraft Optimization Lab / Horizon Lab +# Horizon -Client-first performance research for Minecraft Java **26.3**, preserving vanilla gameplay rules. Any language or renderer may be used when measured gains justify it. Not affiliated with Mojang or Microsoft. +Horizon is a Rust rewrite effort targeting one-to-one vanilla gameplay parity with Minecraft Java **26.3**, alongside client performance research. The Rust implementation has core primitives and world-data storage verified against pinned vanilla classes. It does not yet run a playable game. Existing playable downloads use Java performance packs. Not affiliated with Mojang or Microsoft. **First playable release:** pinned Java performance packs, distant terrain, an original frame/tick recorder, and Mac/client/server starter downloads. The M2 Pro/16 GB Mac is the first testing target. A Rust rewrite or custom renderer has not been completed; no M2 FPS improvement has been measured yet. ## Play on your Mac -Download **horizon-mac-starter-0.21.0.zip** from [Releases](https://github.com/ludovic111/minecraft-optimization-lab/releases), extract it and open `Mac-Start.command`. It verifies and installs official universal Prism Launcher in `~/Applications` if needed, then opens the balanced pack import. Sign into Microsoft **inside Prism yourself**. This project needs no credentials. +Download **horizon-mac-starter-0.21.0.zip** from [Releases](https://github.com/ludovic111/Horizon/releases), extract it and open `Mac-Start.command`. It verifies and installs official universal Prism Launcher in `~/Applications` if needed, then opens the balanced pack import. Sign into Microsoft **inside Prism yourself**. This project needs no credentials. Use native **Java 25 ARM64**, maximum heap **6144 MiB**, minimum **512 MiB** on your 16 GB M2 Pro. Prism can download Java automatically. Start at 1280×800 or 1920×1200; full Retina resolution is a larger GPU workload. [START-HERE.txt](packs/START-HERE.txt) has details. The same `.mrpack` files import into Prism on Windows and Linux. @@ -180,8 +180,8 @@ this launcher correction is not a measured graphics performance improvement. Game JARs, decompiled Java, libraries, inventories, worlds and logs live **inside this checkout** under gitignored **`.local/`**. No game code is in Git history or release downloads. Fresh clones regenerate the inspection workspace from official downloads; Microsoft credentials are not needed for this step. ```sh -git clone https://github.com/ludovic111/minecraft-optimization-lab.git -cd minecraft-optimization-lab +git clone https://github.com/ludovic111/Horizon.git +cd Horizon git config core.hooksPath .githooks python3 tools/lab.py prepare python3 tools/lab.py decompile @@ -194,6 +194,58 @@ Class-file SourceFile metadata covers inner classes, which often share a source ## Original Rust research +The dependency-free `horizon-core` crate starts the Rust simulation foundation: +integer block/chunk/section positions, legacy and xoroshiro seeded random streams and positional factories, +padded palette-index storage, scheduled block/fluid tick queues, and double-precision +bounding-box and voxel-grid collision geometry. Noise samplers, octave stacks and +bulk density kernels provide the next world-generation foundation. Compiled +density samplers add gradients, shifted and blended terrain noise, distance +metrics and arithmetic evaluation. +Differential runners compare selected +operations with the checksum-pinned vanilla client and server bytecode. +[Implemented scope, validation, and remaining rewrite work](docs/rust-parity.md). + +```sh +python3 tools/test_rust_parity.py --prepare +python3 tools/test_world_parity.py +python3 tools/test_tick_parity.py +python3 tools/test_geometry_parity.py +python3 tools/test_collision_parity.py +python3 tools/test_noise_parity.py +python3 tools/test_density_parity.py +``` + +The core corpus checks 1,634,520 output lines per reference JAR, including +signed boundaries, RNG rejection/state consumption and raw storage words. +Passing it does not establish full gameplay parity or an FPS improvement. +The separate [noise suite](docs/noise-generation.md) checks 26.3 Perlin/simplex, +derivatives, density-volume accumulation, stack composition, normal-noise +normalization and modern/legacy initialization against both reference JARs. +The [density suite](docs/density-functions.md) checks compiled scalar and bulk +evaluation, including nested samplers, their different arithmetic paths, and +selected interval operations used for graph range analysis. + +`horizon-world` adds NBT, four region compression codecs, `.mca`/`.mcc` +reading and export, saved palettes, a version-checked block-state registry, +and packed resident block sections. The world-data suite checks Rust output +with the actual vanilla NBT, region and block-state decoders on both JARs. +It covers all 35,723 exported state IDs and a 100,000-edit section trace. +[World-data commands and validation limits](docs/world-data.md). + +Scheduled ticks now support vanilla ordering, duplicate suppression, save/reload, +chunk eligibility and callback mutations. The tick suite compares 97,776 output +lines per reference JAR and checks saved block/fluid lists through vanilla codecs +and region files. [Scheduler behavior and remaining integration](docs/scheduled-ticks.md). + +Voxel shapes preserve vanilla collision tolerances, greedy box ordering, ray faces, +inside hits, and cube-versus-array cell lookup. A cached collision registry connects +imported shapes to resident block sections while checking exact state identities. +Movement helpers resolve supplied colliders and step-up candidates, including +landing adjustment and the second collider query. Movement-path block visits +preserve vanilla ordering, step indices and packed-position deduplication. +Uncached states require block behavior; the entity-context overload also needs +separate implementation. [Geometry and collision scope](docs/collision-geometry.md). + ```sh cargo test --workspace cargo run --release --bin voxel-bench -- 100 > .local/voxel-benchmark.csv @@ -201,6 +253,11 @@ cargo run --release --bin voxel-bench -- 100 > .local/voxel-benchmark.csv The dependency-free occupancy experiment compares scalar and bitset exposed-face counting for synthetic 16³ sections. It has no real mesh, material/AO/light work, neighboring-section context, JNI bridge or game integration. Speedups are kernel-only, not Minecraft FPS. [Research plan](docs/optimization-plan.md) describes profiling, improved Java baselines, native integration and behavior checks before expanding scope. +Public branding and new mod downloads use **Horizon**. The existing Fabric mod +ID and `dev.horizonlab` namespace remain stable for installed instances and +measurement compatibility. The installer backs up both old `horizon-lab-*.jar` +and new `horizon-*.jar` versions before installing an update. + ## Validation and ownership ```sh diff --git a/benchmarks/rust-anchor-2026-10-06/scoped-parity.json b/benchmarks/rust-anchor-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..344423502 --- /dev/null +++ b/benchmarks/rust-anchor-2026-10-06/scoped-parity.json @@ -0,0 +1,118 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 192, + "codec_inputs": 74112, + "runtime_anchors": 107328, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaAnchorOracle.java": "226628d98b89aadbdd374936575d033945e7064a900dbb050c662204dbc7e119", + "tools/test_anchor_parity.py": "6f394f5cc236fc6ca96bfa526b09ac3009fd90b1db997ff1aed059b51170437a", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "3968e2a337a6a23226c485057c79359e66df16683f00fb4ebc9fabb03910a015", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry.rs": "f46065659e60eb5e84ad69b9f3b5e94dc87ee19de16408817e26f23d16b6c7e7", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "7516e20a20479d1c4a9734d7d8e9826740b324869d7afe51eab94bb1bc7c97ae", + "crates/horizon-world/src/worldgen/terrain.rs": "134cf93b53a40fb1ed0e0170c90316c80e270773b2968c63dc3f9cef2c941bff", + "crates/horizon-world/src/worldgen.rs": "e1e815997cfef573c36d7814582fe28086456488be3d87708dbfd94740cf04fd", + "crates/horizon-world/examples/anchor_fixture.rs": "ff824b3b85d09881217c8bdb5219d602099cad21b6efdd180e6c8e3149337b31" + }, + "fixtures_sha256": { + ".local/rust-anchor-parity/inputs.txt": "cc495eb8aca212c1768c882a309052cf4612664570a208082d08ea83f7e8ee60" + }, + "rust_output_sha256": "e48ad3177f302e687ece755cc8933f76ca610ac1e9cba00c0e919431f75cd19b", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "e48ad3177f302e687ece755cc8933f76ca610ac1e9cba00c0e919431f75cd19b", + "matched_output_lines": 181632 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "e48ad3177f302e687ece755cc8933f76ca610ac1e9cba00c0e919431f75cd19b", + "matched_output_lines": 181632 + } + ], + "scope": "Actual VerticalAnchor.CODEC parsing and encoding, all four anchor kinds, constant helpers, runtime integer overflow and unrestricted constructor values. WorldGenerationContext.of uses a LevelAccessor proxy with verified method calls; the generator constructor uses a native NoiseBasedChunkGenerator with supplied minimum, height and sea level. Strict JSON transport covers range limits, numeric truncation/wrapping, null/wrong field types, duplicate fields and nested exclusive alternatives. Level access outside the three queried values, JSON syntax diagnostics and complete material conditions remain pending." +} diff --git a/benchmarks/rust-basic-feature-2026-10-06/scoped-parity.json b/benchmarks/rust-basic-feature-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..e1f455b12 --- /dev/null +++ b/benchmarks/rust-basic-feature-2026-10-06/scoped-parity.json @@ -0,0 +1,153 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 3608, + "basic_features": 3, + "block_states": 5, + "composed_fixtures": 1584, + "requested_placements": 7208, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBasicFeatureOracle.java": "5a0de14f47f344f3d1b7eda7e1204156545358f6b5770b72120f805a85773938", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "ac727111418c4263d302a9fea4050bd4e050cf4d94674bb0b532ea4b36557eb7", + "tools/test_basic_feature_parity.py": "19e8b87b83ba5f8698e648a6946b6998f83dee29ffa0627836177baf53a49844", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "32b937832b7058d86e8557a2012df32be1c97be324f15d0ae85245c45c73b314", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/placement/chain.rs": "76832dd4f76b44edfcc8bd52d8115f6e30684bfaea0e0b959ba060f07cc3483d", + "crates/horizon-world/src/worldgen/placement/context.rs": "cb57bbdadc2b933528278a0ec13b545e453021765ee59fa3b638fb79199dd110", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "bed9b24771fde57b4845b721f539f558af59d804b8a1ecdbb41f4614c8a6b5a0", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "7516e20a20479d1c4a9734d7d8e9826740b324869d7afe51eab94bb1bc7c97ae", + "crates/horizon-world/src/worldgen/terrain.rs": "42823918deec5e149dc729a95bfe54aa32d91604098d5eb8452da0162d557d22", + "crates/horizon-world/src/worldgen/value_provider.rs": "ad1c0efffcc201839e3471d7dfa06c39307d8cbabddb4c5aed8389ee7b68737a", + "crates/horizon-world/src/worldgen/weighted.rs": "1ae40b843721d0f1e1c849b984e0a065aacda6e1384e21fc599cda261f996945", + "crates/horizon-world/src/worldgen.rs": "3fd53d507b2749a9fe5461c77a516fd673de40eb6b51f0b625cd637ade4dcfb5", + "crates/horizon-world/examples/basic_feature_fixture.rs": "40636fe2de41279f1a5633b3150e86d73b7f76dd7f447ecba2d39186abaa2957" + }, + "fixtures_sha256": { + ".local/rust-basic-feature-parity/inputs.txt": "e8b48d25591a8902972fdf8ac9bdaa7f16c0890b3f2076f1161f2c2b87bd5a20", + ".local/rust-basic-feature-parity/facts-client.json": "6c8d9aeb824f4150293f5d6a580d3347d866589b3eeee185a2c18479f5c64b0a", + ".local/rust-basic-feature-parity/facts-server.json": "6c8d9aeb824f4150293f5d6a580d3347d866589b3eeee185a2c18479f5c64b0a" + }, + "rust_output_sha256": "1e7df8d3ee5bfa2f750b94c95b03f426b50608e1a37991ebc3bc3c5c656ee811", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "1e7df8d3ee5bfa2f750b94c95b03f426b50608e1a37991ebc3bc3c5c656ee811", + "matched_output_lines": 1820614 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "1e7df8d3ee5bfa2f750b94c95b03f426b50608e1a37991ebc3bc3c5c656ee811", + "matched_output_lines": 1820614 + } + ], + "scope": "Actual Feature.DIRECT_CODEC and native void-start-platform, End-island and End-platform feature algorithms. A mutable WorldGenLevel proxy logs ordered block reads, writes, update flags, rejected writes, thrown failures and accumulated stored states after repeated placements. Native LevelWriter.setBlockAndUpdate executes through its actual default method. Required default block-state IDs are independently exported and checked across both authenticated JARs. Direct calls and native FeaturePlacer modifier chains share the mutable world and random stream, including reused placer buffers after failures. Both random modes, multiple seeds, nearby/far chunks and extreme wrapped coordinates are compared, with nextLong values after every placement and at fixture end. The End-platform feature invokes its ordinary generation path without block destruction/drops. Actual chunk mutation, neighbor updates, lighting, entity/block drops, full feature registry behavior and complete generated worlds remain outside this comparison." +} diff --git a/benchmarks/rust-biome-chunk-2026-10-06/scoped-parity.json b/benchmarks/rust-biome-chunk-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..8add1e527 --- /dev/null +++ b/benchmarks/rust-biome-chunk-2026-10-06/scoped-parity.json @@ -0,0 +1,131 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 20, + "fills": 160, + "block_queries": 21120, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeChunkOracle.java": "5d1a7f967d2b35af4e0ff4783278d40077df61383c1d6dbf27b7ed52974bdae8", + "tools/test_biome_chunk_parity.py": "f469958617099939c6ae9e6f149e8d6458e75ad9ea5da3710572c5f6017718d2", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "055caaeaa507f45dd6df4c219da874831c88db05f7cfa15c8a11cbfd98ae4332", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "32b937832b7058d86e8557a2012df32be1c97be324f15d0ae85245c45c73b314", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "476f1542d335eb02fb627b7480d708f4aa6b7f9929f4dbc2c646e15b063cf083", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "04ac9130138ea4ce67fc43f7701f5036972984724ffcd49bfe857d0693361d87", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "4ab2681a45108e5d2ea6fb761ea1cb7fa40b72833fa6190d2efe34ce29845c21", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "7516e20a20479d1c4a9734d7d8e9826740b324869d7afe51eab94bb1bc7c97ae", + "crates/horizon-world/src/worldgen/terrain.rs": "42823918deec5e149dc729a95bfe54aa32d91604098d5eb8452da0162d557d22", + "crates/horizon-world/src/worldgen.rs": "c2cfc116613456f98901732c24fedaba6532e58b3342833674b88b2e17f9f13c", + "crates/horizon-world/examples/biome_chunk_fixture.rs": "b16fdee8abcaac7d714ae71efb0c327deb2bb85a2e9a2419829441cc59e1bd02" + }, + "fixtures_sha256": { + ".local/rust-biome-chunk-parity/inputs.txt": "b2be08e1b743547c1e2880c01a3473c42cc10191d1de32eb2cad2e364c463094" + }, + "rust_output_sha256": "00ae2e07b4ccaa18f6ce6f35258833801e9f4f9335089fbb0bf7f7661988bca6", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "00ae2e07b4ccaa18f6ce6f35258833801e9f4f9335089fbb0bf7f7661988bca6", + "matched_output_lines": 478340 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "00ae2e07b4ccaa18f6ce6f35258833801e9f4f9335089fbb0bf7f7661988bca6", + "matched_output_lines": 478340 + } + ], + "scope": "Actual ChunkAccess.fillBiomesFromNoise, LevelChunkSection.fillBiomesFromNoise and chunk/section biome reads using synthetic registered holder identities. Ordered resolver queries, section contents and clamped/wrapped chunk lookups are compared after repeated fills and failures at section boundaries. Covers full supported aligned vertical bounds, generation bounds cutting through sections, negative/extreme chunk coordinates and 1..512 possible biome identities. Completed earlier sections survive failure while the failing section retains its previous values. This compares stored biome values, not native in-memory palette layout, wire encoding, biome-source generation, blending, retrogen or complete generated worlds." +} diff --git a/benchmarks/rust-biome-generation-2026-10-06/scoped-parity.json b/benchmarks/rust-biome-generation-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..895d7196b --- /dev/null +++ b/benchmarks/rust-biome-generation-2026-10-06/scoped-parity.json @@ -0,0 +1,149 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 252, + "fills": 322, + "biome_values": 341504, + "block_queries": 35910, + "preset_entries": { + "minecraft:nether": 5, + "minecraft:overworld": 7594 + }, + "source_fixtures": { + "multi": 84, + "fixed": 56, + "checkerboard": 56, + "end": 56 + }, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeGenerationOracle.java": "7285f7d0e358cae2857e0704bcc5fcdb73deb895653b16490eb44323c2789f7d", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeExport.java": "f9a773713cf21b69bfa10018b76f27b953bda140ede9934f43d3aa3091101cf5", + "tools/test_biome_generation_parity.py": "919af38c6c5903cb692b33d39d20c0d6cc6daf8351694f7683f7ab20cf322d93", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "055caaeaa507f45dd6df4c219da874831c88db05f7cfa15c8a11cbfd98ae4332", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "32b937832b7058d86e8557a2012df32be1c97be324f15d0ae85245c45c73b314", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "476f1542d335eb02fb627b7480d708f4aa6b7f9929f4dbc2c646e15b063cf083", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "04ac9130138ea4ce67fc43f7701f5036972984724ffcd49bfe857d0693361d87", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "4ab2681a45108e5d2ea6fb761ea1cb7fa40b72833fa6190d2efe34ce29845c21", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "7516e20a20479d1c4a9734d7d8e9826740b324869d7afe51eab94bb1bc7c97ae", + "crates/horizon-world/src/worldgen/terrain.rs": "42823918deec5e149dc729a95bfe54aa32d91604098d5eb8452da0162d557d22", + "crates/horizon-world/src/worldgen.rs": "3ea3386996321113027dcf51d918d29d363ac1944b7c146a7f1383d17a50967b", + "crates/horizon-world/examples/biome_generation_fixture.rs": "161b985f41123dc97451f4fe0060070276466ca9aa652141aa82e62284442c7e" + }, + "fixtures_sha256": { + ".local/rust-biome-generation-parity/inputs.txt": "10cf6ac3eaeaacafecf786eaa902d5c0b8700dcad9f045d4b6032ba78b4e30f9", + ".local/rust-biome-generation-parity/registries.json": "c6868228cc1002755dab31d947e953cc4be785a1b6ae82697755817a238b7de9", + ".local/rust-biome-generation-parity/presets-client.json": "b03e2fbe85c191a22f333bc989bd2a73c66f0f9fbcd9ddb54774f17c247832e9", + ".local/rust-biome-generation-parity/presets-server.json": "b03e2fbe85c191a22f333bc989bd2a73c66f0f9fbcd9ddb54774f17c247832e9" + }, + "rust_output_sha256": "b84a1734641fbec028768da94208f583546f564eb45939c75da13efe85f3f0b9", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "b84a1734641fbec028768da94208f583546f564eb45939c75da13efe85f3f0b9", + "matched_output_lines": 383072 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "b84a1734641fbec028768da94208f583546f564eb45939c75da13efe85f3f0b9", + "matched_output_lines": 383072 + } + ], + "scope": "Actual ChunkGenerator.doCreateBiomes through NoiseBasedChunkGenerator with empty Blender and no retrogen. Both bundled Overworld/Nether multi-noise preset tables are independently exported from authenticated JARs; Rust imports quantized tables and compiles climate routers itself. All seven bundled routers, both random modes, multiple seeds and distant positive/negative chunks are tested. Complete section biome values and subsequent BiomeManager block lookups are compared, including repeated generation with fresh density contexts and persistent previous-leaf search state, and generation bounds excluding top/bottom sections. Holders are identity placeholders; no biome properties are evaluated. Fixed, checkerboard and End source fixtures also run actual chunk generation through every bundled router, including real seeded End erosion, the central-island shortcut, distant coordinates and wrapped checkerboard shifts. Preset builders, complete biome-source codecs, blending, retrogen, terrain-stage linkage and complete generated worlds remain pending." +} diff --git a/benchmarks/rust-biome-placement-2026-10-06/scoped-parity.json b/benchmarks/rust-biome-placement-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..0f1630313 --- /dev/null +++ b/benchmarks/rust-biome-placement-2026-10-06/scoped-parity.json @@ -0,0 +1,158 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 9152, + "random_modes": 2, + "requested_placements": 27456, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomePlacementOracle.java": "e8fd44142ad1448a32758036705ce2be41b0ecbf411c4562f2caed2eea9b50b9", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", + "tools/test_biome_placement_parity.py": "bac6b4857b1d4e84b23e6736398f5fce5ea1a4297b05d77235d9d242a2219b80", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "32b937832b7058d86e8557a2012df32be1c97be324f15d0ae85245c45c73b314", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_feature.rs": "c215156f2ecf7faf214b3d89e0829b65d54f4ff6d134d778ec941f18a606a327", + "crates/horizon-world/src/worldgen/block_predicate.rs": "dd8cbda2ec110444950f0b31bf4e088897eab0994674a91568c7b063f8f16210", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "486fe9d8588eb09e0ee5707a0541b0df167b63b0b56c90a2709bfa09a0a3ad19", + "crates/horizon-world/src/worldgen/feature_graph.rs": "2297b194514925688dba25016a69d5ba5eb8b869bdfff28f2e611a6742ac5954", + "crates/horizon-world/src/worldgen/feature_region.rs": "4a95a30c0987d97e671f84380e13ddea070ad81f996baa65b2a06c4d892971c7", + "crates/horizon-world/src/worldgen/feature_sort.rs": "0b9d1e1c15d8449125d39e400776b8f28eec7b7cbd047660a94f8cb90160adfe", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9bce6b17b60fec575d810713d9fb2714780aadbbc973db969c07cf4455201847", + "crates/horizon-world/src/worldgen/placement/context.rs": "f8fa467d3b931d0f98d3572fbc80c659d452a7fc5755d5c98123dc477c2b541c", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "c39c0b5f761fd573ff2f2a1d9d42901305995cc88f5c4ca3a49aaa4ef5dd933b", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/value_provider.rs": "ad1c0efffcc201839e3471d7dfa06c39307d8cbabddb4c5aed8389ee7b68737a", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "55c4317bd9c782378de7c2a7d58be5aa08febc5b8f2f4b86379a39e0ba500b3c", + "crates/horizon-world/examples/biome_placement_fixture.rs": "93b4668e04daf52aed34def93aeed9af4f5bf55a8e1c60b616428aadd454648c" + }, + "fixtures_sha256": { + ".local/rust-biome-placement-parity/inputs.txt": "f823d452b40ad5c4448e5c6b6e59d7f1b0db8f40f8fdb4c36b2bc23cc99ffd09" + }, + "rust_output_sha256": "84aceee3d6197790495a2b877b04c037340258cf3d36bc440af78f82be15010b", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "84aceee3d6197790495a2b877b04c037340258cf3d36bc440af78f82be15010b", + "matched_output_lines": 121423 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "84aceee3d6197790495a2b877b04c037340258cf3d36bc440af78f82be15010b", + "matched_output_lines": 121423 + } + ], + "scope": "Actual BiomeFilter.modify and FeaturePlacer.place/placeWithBiomeCheck with native biome generation settings. Missing top features fail before biome lookup. Direct, absent, structurally equal and different placed-feature membership, query order, callback random draws/results/errors, dirty buffers across repeats and nested plain placers are compared. Direct and WorldgenRandom-wrapped legacy/xoroshiro streams execute modifier chains. Rust delegates biome resolution and generation-settings membership to the caller while isolating each placer invocation context. Full biome sampling/registry equality, complete decoration, crash-report text and gameplay remain pending." +} diff --git a/benchmarks/rust-biome-source-2026-10-06/scoped-parity.json b/benchmarks/rust-biome-source-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..47138c9a6 --- /dev/null +++ b/benchmarks/rust-biome-source-2026-10-06/scoped-parity.json @@ -0,0 +1,136 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 457, + "queries": 1147984, + "sources": { + "fixed": 1, + "checkerboard": 375, + "end": 81 + }, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeSourceOracle.java": "8a3807e4bcb871ad3cd5eb281c803df55daf1ffb654a91d0cdb7b927643b2601", + "tools/test_biome_source_parity.py": "38a1bd39ab15d87538316541424e09a91a621f539c2202543d9c859297c0b8e4", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "055caaeaa507f45dd6df4c219da874831c88db05f7cfa15c8a11cbfd98ae4332", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "32b937832b7058d86e8557a2012df32be1c97be324f15d0ae85245c45c73b314", + "crates/horizon-world/src/worldgen/biome_source.rs": "bd1efc819d45df54a99744a90918e5e98c76759e92e7436c11933b1ce6e96c53", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "476f1542d335eb02fb627b7480d708f4aa6b7f9929f4dbc2c646e15b063cf083", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "04ac9130138ea4ce67fc43f7701f5036972984724ffcd49bfe857d0693361d87", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "4ab2681a45108e5d2ea6fb761ea1cb7fa40b72833fa6190d2efe34ce29845c21", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "7516e20a20479d1c4a9734d7d8e9826740b324869d7afe51eab94bb1bc7c97ae", + "crates/horizon-world/src/worldgen/terrain.rs": "42823918deec5e149dc729a95bfe54aa32d91604098d5eb8452da0162d557d22", + "crates/horizon-world/src/worldgen.rs": "3ea3386996321113027dcf51d918d29d363ac1944b7c146a7f1383d17a50967b", + "crates/horizon-world/examples/biome_source_fixture.rs": "dd485dba7cef8fd924b7a8ba4357766fb874d144120c16ad3f8f6c41a863c074" + }, + "fixtures_sha256": { + ".local/rust-biome-source-parity/inputs.txt": "165d02b6bcac5cb70e7129368b4c5b2220c5cdcaba2314d94f86b687886beffa" + }, + "rust_output_sha256": "a57198fab8b45fe8db011b7153ffdc6781d6c0862c95eb9b8c0ebc6318be526d", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "a57198fab8b45fe8db011b7153ffdc6781d6c0862c95eb9b8c0ebc6318be526d", + "matched_output_lines": 1306096 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "a57198fab8b45fe8db011b7153ffdc6781d6c0862c95eb9b8c0ebc6318be526d", + "matched_output_lines": 1306096 + } + ], + "scope": "Actual FixedBiomeSource, CheckerboardColumnBiomeSource and TheEndBiomeSource runtime queries using synthetic holder identities. Fixed results, checkerboard empty/duplicate/large lists, all codec-valid scales plus unrestricted runtime scales, Java masked shifts and wrapping sums are compared. End central-circle shortcuts, erosion sampler coordinates, exact threshold boundaries, nonfinite float samples, sampler failures and integer coordinate wrapping are compared through actual Climate.Sampler bindings. End density inputs in this suite are supplied constants; real seeded End density, biome-source codecs, registry/preset loading, possible-biome metadata and generated-world integration remain separate work." +} diff --git a/benchmarks/rust-biome-source-codec-2026-10-06/scoped-parity.json b/benchmarks/rust-biome-source-codec-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..b2998f65d --- /dev/null +++ b/benchmarks/rust-biome-source-codec-2026-10-06/scoped-parity.json @@ -0,0 +1,148 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 40481, + "query_positions": 7, + "climate_grid_cases": 40001, + "biomes": 67, + "biome_tags": 86, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeSourceCodecOracle.java": "a6f231ee68fe0aa94159c63d55f589b86c668b9f2052e215f832e10763a818e2", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeExport.java": "f9a773713cf21b69bfa10018b76f27b953bda140ede9934f43d3aa3091101cf5", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMaterialConditionOracle.java": "04a87405fd2a1c79baf4eb3a8895aa66dc96b8f6baffb9b486ef207f8b91b5ee", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaAnchorOracle.java": "226628d98b89aadbdd374936575d033945e7064a900dbb050c662204dbc7e119", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeTemperatureOracle.java": "243bbc525c6aec24674e7f172c5fb4f7b50f9a679d8b9dfba40ea278219a2d28", + "tools/test_biome_temperature_parity.py": "68f84d02e7802349e491b8cb66e18d9b08c9e72ab2306b663667259e852cc2b1", + "tools/test_material_condition_parity.py": "01c82e1a768d9131f8f7e6d59d01ddb06272074469dbdcd8547f44f0a8fa152d", + "tools/test_biome_source_codec_parity.py": "e7d19478429b0c6c550f45d804d4771194b2f5cecb094ebd21007a3afdbe8ca2", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "055caaeaa507f45dd6df4c219da874831c88db05f7cfa15c8a11cbfd98ae4332", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "32b937832b7058d86e8557a2012df32be1c97be324f15d0ae85245c45c73b314", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "476f1542d335eb02fb627b7480d708f4aa6b7f9929f4dbc2c646e15b063cf083", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "04ac9130138ea4ce67fc43f7701f5036972984724ffcd49bfe857d0693361d87", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "4ab2681a45108e5d2ea6fb761ea1cb7fa40b72833fa6190d2efe34ce29845c21", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "7516e20a20479d1c4a9734d7d8e9826740b324869d7afe51eab94bb1bc7c97ae", + "crates/horizon-world/src/worldgen/terrain.rs": "42823918deec5e149dc729a95bfe54aa32d91604098d5eb8452da0162d557d22", + "crates/horizon-world/src/worldgen.rs": "3ea3386996321113027dcf51d918d29d363ac1944b7c146a7f1383d17a50967b", + "crates/horizon-world/examples/biome_source_codec_fixture.rs": "654094b2846692c34233ee2016fd3a4f9a44df0281e5bb2552ed6c35ffb17bc1" + }, + "fixtures_sha256": { + ".local/rust-biome-source-codec-parity/inputs.txt": "c9e3cbc7af471f04bbd4d8cc79a2399e2f61c00f2d2ebcc9343a254798095fbb", + ".local/rust-biome-source-codec-parity/presets-client.json": "b03e2fbe85c191a22f333bc989bd2a73c66f0f9fbcd9ddb54774f17c247832e9", + ".local/rust-biome-source-codec-parity/presets-server.json": "b03e2fbe85c191a22f333bc989bd2a73c66f0f9fbcd9ddb54774f17c247832e9", + ".local/rust-biome-source-codec-parity/positions.json": "35e94adf55d9bc0326133967abf93d50b896c39489f77f81d2bfa4f278364430", + ".local/rust-biome-source-codec-parity/biomes.json": "9b26dc3b662627dc3bbbf8da209f287882ce79ff4daf8f454b994ddc7510df99", + ".local/rust-biome-source-codec-parity/biome_tags.json": "4006b76c24f616cb457a6fdad816db9b27f4528fe6daaed5747f1f79cf6225cf", + ".local/rust-biome-source-codec-parity/presets.json": "b03e2fbe85c191a22f333bc989bd2a73c66f0f9fbcd9ddb54774f17c247832e9" + }, + "rust_output_sha256": "568792acae9f5b0df02bb5cf7cd6b4f7edb017a0223236c57c6fef4b0dfbb1a8", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "568792acae9f5b0df02bb5cf7cd6b4f7edb017a0223236c57c6fef4b0dfbb1a8", + "matched_output_lines": 363121 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "568792acae9f5b0df02bb5cf7cd6b4f7edb017a0223236c57c6fef4b0dfbb1a8", + "matched_output_lines": 363121 + } + ], + "scope": "Actual BiomeSource.CODEC parsing and encoding for fixed, checkerboard, End and multi-noise sources bound to pinned biome/tag registries and preset holders. Named biome holders, direct/tag holder sets, canonical identifiers, scale defaults/bounds/numeric narrowing, inline climate parameter lists, named/inline preset holders, inline-list preference/fallback, malformed fields and duplicate keys are compared. Canonical serialized JSON is compared as sorted structures with numeric double-bit values; possible-biome sets are sorted and compared, followed by source queries against zero climate/erosion. Rust imports independently authenticated preset tables. Full inline biome definitions, live registry ownership/reloads and complete source/world generation remain outside this scoped codec comparison." +} diff --git a/benchmarks/rust-biome-temperature-2026-10-06/scoped-parity.json b/benchmarks/rust-biome-temperature-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..1306b9bd0 --- /dev/null +++ b/benchmarks/rust-biome-temperature-2026-10-06/scoped-parity.json @@ -0,0 +1,126 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 387, + "biome_resources": 67, + "codec_inputs": 183, + "operations": 53790, + "thread_isolation_fixtures": 12, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeTemperatureOracle.java": "243bbc525c6aec24674e7f172c5fb4f7b50f9a679d8b9dfba40ea278219a2d28", + "tools/test_biome_temperature_parity.py": "68f84d02e7802349e491b8cb66e18d9b08c9e72ab2306b663667259e852cc2b1", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "3968e2a337a6a23226c485057c79359e66df16683f00fb4ebc9fabb03910a015", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry.rs": "f46065659e60eb5e84ad69b9f3b5e94dc87ee19de16408817e26f23d16b6c7e7", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "476f1542d335eb02fb627b7480d708f4aa6b7f9929f4dbc2c646e15b063cf083", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "3094bb2c4abe911720a7143953f43fda3db97dcb80405b4a62f35204a06920dc", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "a6d613eed1876d7c6ef4a491ffbda36d673f27a62a9db3c4d50006ed9fc0e0b8", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "8cb30bcf221def3b2ea14aa5bd9c719aa9655432149a177180f716ba218457b8", + "crates/horizon-world/src/worldgen/material_condition.rs": "e577927593cdbc7b8aa01b7e8d641df0374f36cc8b5b4cc1eb797f526fa8e636", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "7516e20a20479d1c4a9734d7d8e9826740b324869d7afe51eab94bb1bc7c97ae", + "crates/horizon-world/src/worldgen/terrain.rs": "134cf93b53a40fb1ed0e0170c90316c80e270773b2968c63dc3f9cef2c941bff", + "crates/horizon-world/src/worldgen.rs": "e5123e2249017e2cef7067cd7ddd85316a075c418bf9d1b452db601eea3483a0", + "crates/horizon-world/examples/biome_temperature_fixture.rs": "192fb207c28c2a040c6264d2c3573bd71d389ce04f66408eed47b9bfa6aa6df0" + }, + "fixtures_sha256": { + ".local/rust-biome-temperature-parity/inputs.txt": "f882dff81e4b3be8b37e2a5130198a6bd0eb437ebd903f68b15899bd1509e681", + ".local/rust-biome-temperature-parity/biomes.json": "9b26dc3b662627dc3bbbf8da209f287882ce79ff4daf8f454b994ddc7510df99" + }, + "rust_output_sha256": "2c40a4156ce3edd9dbbecc80aeea0cd1606fd462e79abb377d778c02a973d38e", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "2c40a4156ce3edd9dbbecc80aeea0cd1606fd462e79abb377d778c02a973d38e", + "matched_output_lines": 836659 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "2c40a4156ce3edd9dbbecc80aeea0cd1606fd462e79abb377d778c02a973d38e", + "matched_output_lines": 836659 + } + ], + "scope": "Actual Biome temperature methods, warm/cold/iceberg-melt predicates and precipitation selection, with both temperature modifiers and arbitrary base float bits. Native private climate/biome constructors provide explicit temperature inputs; unrelated biome fields are null and never queried. Fixed seeded simplex/stack sources, float/double conversion and arithmetic order, height adjustment and sea-level overflow, packed-position aliases, repeated queries with changed sea levels, cache capacity/order/content, NaN recomputation and eviction, and actual native thread-local isolation versus independently owned Rust workers. ClimateSettings map-codec parsing additionally covers all independently authenticated bundled biome definitions, direct float conversion, nonfinite overflow, modifier defaults/null handling, field types, duplicates and missing fields. Full biome data codecs, climate encoding, complete weather placement/freezing, material condition integration and automatic migration of shared biome instances between threads remain outside this scope." +} diff --git a/benchmarks/rust-biome-zoom-2026-10-06/scoped-parity.json b/benchmarks/rust-biome-zoom-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..4f607d3ae --- /dev/null +++ b/benchmarks/rust-biome-zoom-2026-10-06/scoped-parity.json @@ -0,0 +1,131 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 256933, + "seed_hashes": 4104, + "block_queries": 169408, + "position_queries": 83421, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeZoomOracle.java": "89962784c285822d11ff72cbff0c22d41a3a27993793a61e35869c50a72ed614", + "tools/test_biome_zoom_parity.py": "0b5f02ed01306a2acb0143da1019562a8413602afa05fef16bdc485e0e6ae716", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "055caaeaa507f45dd6df4c219da874831c88db05f7cfa15c8a11cbfd98ae4332", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "476f1542d335eb02fb627b7480d708f4aa6b7f9929f4dbc2c646e15b063cf083", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "04ac9130138ea4ce67fc43f7701f5036972984724ffcd49bfe857d0693361d87", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "4ab2681a45108e5d2ea6fb761ea1cb7fa40b72833fa6190d2efe34ce29845c21", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "7516e20a20479d1c4a9734d7d8e9826740b324869d7afe51eab94bb1bc7c97ae", + "crates/horizon-world/src/worldgen/terrain.rs": "42823918deec5e149dc729a95bfe54aa32d91604098d5eb8452da0162d557d22", + "crates/horizon-world/src/worldgen.rs": "cffb5e72b59222dad13e57fa74ed4f553570a61a8773f27b5199444111ced2e0", + "crates/horizon-core/examples/biome_zoom_fixture.rs": "8bdb7a4f15ac94cd4807ea1e1211c53f0ea050fda5ddfea65b2dc345e13b2e27" + }, + "fixtures_sha256": { + ".local/rust-biome-zoom-parity/inputs.txt": "61abb5e562325847d5c7f7849dac79aa9392b9ae2dab9f42dab6485dd89c5ea7" + }, + "rust_output_sha256": "7b5d1c89f31ce1a803bafe9a675677d035cbce49ecede300d6beab7240501c95", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "7b5d1c89f31ce1a803bafe9a675677d035cbce49ecede300d6beab7240501c95", + "matched_output_lines": 256933 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "7b5d1c89f31ce1a803bafe9a675677d035cbce49ecede300d6beab7240501c95", + "matched_output_lines": 256933 + } + ], + "scope": "Actual BiomeManager seed obfuscation, block-position eight-corner jitter selection, direct block/double-to-quart queries, and source replacement preserving the zoom seed. Captured resolver coordinates are compared, including dense local grids, signed coordinate overflow, negative boundaries, distant blocks, long-seed boundaries, random seeds/positions, double infinities/NaNs/subnormals and saturating conversion. SHA-256 seed transforms are also compared against Python hashlib independently. Biome storage/source generation, blending, chunk integration and gameplay remain separate work." +} diff --git a/benchmarks/rust-block-properties-2026-10-06/scoped-parity.json b/benchmarks/rust-block-properties-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..0382cf402 --- /dev/null +++ b/benchmarks/rust-block-properties-2026-10-06/scoped-parity.json @@ -0,0 +1,176 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "registry_states": 35723, + "fixtures": 18096, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java": "99a396b9b983f6ca9149133251f3ece9aaf76d3d16dafa1f322378212a19490c", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "60ff9ef7c1d5e23c080f9aec95ab2e7d3b7c5b5bcd67b9efa9518776c400629a", + "tools/test_block_properties_parity.py": "083d09fe190a783b2939068b7ad01e98938d9277f9583c5273bb2453e870d713", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_properties.rs": "b3caf26bd3afc9d10cdcca3f7e794c30abf5ba09afa1fe80ba8f44713acdb274", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "2c882aeb095c27a8edfda1e934ac829102e4be136d53fd83110132150b7293b1", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "8a2834a9347ee2c2db7cf1c86a064907ec06e9ac16ba9cc3936e315fc4ad49ca", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "09f697d8d4e709acacc8e9f7c35c5fd307bab6ab0df4a1339fe760afc655cdab", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_feature.rs": "82a424d3b20837dc401005f5fe038616659eb17b5bbd78d0c8c29f8bdeb1104a", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "486fe9d8588eb09e0ee5707a0541b0df167b63b0b56c90a2709bfa09a0a3ad19", + "crates/horizon-world/src/worldgen/feature_graph.rs": "fe61a5e43179a7588737a71782ea246811fe2c8721e74793e1ac018c8eb93c34", + "crates/horizon-world/src/worldgen/feature_region.rs": "2c78e5f1bdb08307f8d982f231f1abbc3306cd54348d9023b86ee6ed3516fd33", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "e682d13a21f90605215b79f5d254bf2e524d35e89eab2e3b46384709af80b847", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "cd1d2fe305ad4e205e7e01b32128ff895fa8aacc76fa11f200ad6c7c9fba1f49", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "fa0616353f07460975ab323357ab280b7f35e7bfe2de6edc08d304316766ed26", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "9cc353d474184f4db880c4305137ec6e35a564a983f602c76af39349ecb58541", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "821981c893fc84312351503f2be0c06c681d8bc768dade14576697cf047a9f8f", + "crates/horizon-world/examples/block_properties_fixture.rs": "c5438e5397136631e29858e08eb5c09ad2c82647e20bf1913d7ce9160df530a4" + }, + "fixtures_sha256": { + ".local/rust-block-properties-parity/inputs.txt": "b4d336ea8fc168df652a71651bb48e41e5f23fc22bb451b6969c8021140cfe53", + ".local/rust-block-properties-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-block-properties-parity/cached-collision.nbt": "f3a5c6a5b2d51dad6c52e486e2b9989e79fd55db1a9bda6196db399550b04078", + ".local/rust-block-properties-parity/block-properties.nbt": "1aba22092f70d16b8092014c058ddc210e4aaa77bac32f6ec62e4d0e91d92a99" + }, + "rust_output_sha256": "235f4a96d29c0753c31b8f142a22383031458be5606f12539b34e6c72217deb6", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "235f4a96d29c0753c31b8f142a22383031458be5606f12539b34e6c72217deb6", + "matched_output_lines": 143361 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "235f4a96d29c0753c31b8f142a22383031458be5606f12539b34e6c72217deb6", + "matched_output_lines": 143361 + } + ], + "scope": "All pinned block-definition force-solid, replaceability, liquid and occlusion flags and raw occlusion geometry are imported privately; Rust computes legacy solidity from cached collision shapes and solid rendering from occlusion geometry. Actual native BlockState isSolid, liquid, canOcclude, isSolidRender and no-context canBeReplaced are compared for every state, together with raw cached bounds and synthetic force-flag/cache/shape threshold combinations using the private native solidity calculator and native full-shape test. Item/fluid replacement, block support, survival, dynamic collision and full gameplay remain pending." +} diff --git a/benchmarks/rust-block-state-codec-2026-10-06/scoped-parity.json b/benchmarks/rust-block-state-codec-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..2c5e1f897 --- /dev/null +++ b/benchmarks/rust-block-state-codec-2026-10-06/scoped-parity.json @@ -0,0 +1,127 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "block_states": 35723, + "blocks": 1286, + "integer_properties": 146, + "codec_inputs": 185538, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "tools/test_block_state_codec_parity.py": "51b8174d92fbf2326362141eb66e3c1d4c302bffc3914ce9405b1eb66d8856bb", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "3968e2a337a6a23226c485057c79359e66df16683f00fb4ebc9fabb03910a015", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "476f1542d335eb02fb627b7480d708f4aa6b7f9929f4dbc2c646e15b063cf083", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "92638c9461715244f9fb9aa4c1830e97f0708cd4195ab0b3ce6bcac19d969f63", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "eba4d1fff21be6748ba93fd917b990dc0928673848ff5251fa9f41c3b42a93d9", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "b8afa733ba6289920d8563dea480bcc7efba04f53a3948d514d2a72ed4177348", + "crates/horizon-world/src/worldgen/material_condition.rs": "dca4498ce95e952334f80b67e6518e1a6ad83b3c7100de532d5a38ea63f75b9e", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "7516e20a20479d1c4a9734d7d8e9826740b324869d7afe51eab94bb1bc7c97ae", + "crates/horizon-world/src/worldgen/terrain.rs": "134cf93b53a40fb1ed0e0170c90316c80e270773b2968c63dc3f9cef2c941bff", + "crates/horizon-world/src/worldgen.rs": "a5abb8b8b186c90b12eaa1552c0304c952cf40e4cb0f60d2665b34202154893d", + "crates/horizon-world/examples/block_state_codec_fixture.rs": "c053e44f17b3641bf5c45ed05c2fd0c88c3ac2a20cdf385737502d5a865e7a2b" + }, + "fixtures_sha256": { + ".local/rust-block-state-codec-parity/inputs.txt": "3266a7d8ac5b6afbbcb786f6bd85ba98d876eab589e0d4ed4af9d2212235af5e", + ".local/rust-block-state-codec-parity/facts-client.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-block-state-codec-parity/facts-server.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b" + }, + "rust_output_sha256": "fb4b7c50dcfb93170898f0c378aa3893a6ff8a211c1b8a25725dd898cb45ce5b", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "fb4b7c50dcfb93170898f0c378aa3893a6ff8a211c1b8a25725dd898cb45ce5b", + "matched_output_lines": 221261 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "fb4b7c50dcfb93170898f0c378aa3893a6ff8a211c1b8a25725dd898cb45ce5b", + "matched_output_lines": 221261 + } + ], + "scope": "Actual BlockState.CODEC and FULL_CODEC, every pinned runtime block state, compact/default versus full encoding, canonical object keys, namespaces, property omission/invalid fallback, unknown fields, malformed property containers, Java integer-property parsing including signs/leading zeroes/BMP decimal digits and overflow, invalid identifiers/types, duplicate fields. Registry identities, defaults and integer property kinds are imported from both authenticated JARs and must agree. This ports codec behavior over that metadata, not block gameplay. Native warning text, arbitrary malformed JSON/unpaired surrogate text, registry lifecycle/ownership and full material-rule codecs remain pending." +} diff --git a/benchmarks/rust-block-support-2026-10-06/scoped-parity.json b/benchmarks/rust-block-support-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..9d1e28341 --- /dev/null +++ b/benchmarks/rust-block-support-2026-10-06/scoped-parity.json @@ -0,0 +1,172 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "registry_states": 35723, + "cached_states": 35524, + "uncached_states": 199, + "support_queries": 639432, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSupportOracle.java": "7ffafa1a5769872b32652d2f29ed94a9a514a18d7dabc96f46d8776e27cc8fdb", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "02acfbae94aee306c5a4e1db7c86c68f7d6156ddd3dd477dc9e9d06e5ca98118", + "tools/test_block_support_parity.py": "48bc64c5a75e1b0a8821412e0318401aacc711700c6032c49effd56a7e2d444e", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_properties.rs": "e74b368012d4d440dcdbd4d9bcaf80495220b90557f0e0c733b0aa21ad03c53c", + "crates/horizon-world/src/block_support.rs": "1c8676c3e85743bc8f64ba30bea52842703e4acce312da8389a5761d0cd112e3", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "8a2834a9347ee2c2db7cf1c86a064907ec06e9ac16ba9cc3936e315fc4ad49ca", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "9f1c2f81745412ccdac0ddf7b5edd33077059e14d498ff8e6b6b385b0a8c9f6a", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_feature.rs": "7c8f628601a6d835d913c034b0d421a8f83bee6c569033448aac99123ed84a2c", + "crates/horizon-world/src/worldgen/block_predicate.rs": "b5c02b44e759a121d8b4a977e2c52874ab2eaf3aa787a15bae7f5c7eaa2ce503", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "486fe9d8588eb09e0ee5707a0541b0df167b63b0b56c90a2709bfa09a0a3ad19", + "crates/horizon-world/src/worldgen/feature_graph.rs": "fe61a5e43179a7588737a71782ea246811fe2c8721e74793e1ac018c8eb93c34", + "crates/horizon-world/src/worldgen/feature_region.rs": "2c78e5f1bdb08307f8d982f231f1abbc3306cd54348d9023b86ee6ed3516fd33", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "e682d13a21f90605215b79f5d254bf2e524d35e89eab2e3b46384709af80b847", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "2f9849fcd492d0b987a15857607004a95380deff4217c48cbbf02a27339b3aa3", + "crates/horizon-world/src/worldgen/placement/context.rs": "bc0ad613ba599b825bdc3e746b6618e5d427d01e0729287269d452e4c7018143", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "fa0616353f07460975ab323357ab280b7f35e7bfe2de6edc08d304316766ed26", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "647f253a7d14d724086b4d146f26295e0da825df86f4adbd6a0e367d5198f3d5", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "821981c893fc84312351503f2be0c06c681d8bc768dade14576697cf047a9f8f", + "crates/horizon-world/examples/block_support_fixture.rs": "a459611c5f0ba22d7f9d3b964ff877dbfa513e5db1cf6e9f5114a73e746fa8ce" + }, + "fixtures_sha256": { + ".local/rust-block-support-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-block-support-parity/cached-support.nbt": "b6fdc9471b0b61e904206d3f099f4dc235aad6d723536c210be0cb7c3560d82c" + }, + "rust_output_sha256": "6489ad4b567eefca4a3b1c1253b80f19b039a6cec8c5fa56e1d82c569be4d9f8", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "6489ad4b567eefca4a3b1c1253b80f19b039a6cec8c5fa56e1d82c569be4d9f8", + "matched_output_lines": 248867 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "6489ad4b567eefca4a3b1c1253b80f19b039a6cec8c5fa56e1d82c569be4d9f8", + "matched_output_lines": 248867 + } + ], + "scope": "All 35,524 cached block-state support shapes are imported privately and Rust derives FULL/CENTER/RIGID face-support masks. These are compared with actual BlockState.isFaceSturdy cache results across all six directions; all 199 uncached states remain explicitly unsupported. Registry/DataVersion/kind validation, shared shape identities, exact face geometry and full-state queries are covered. Dynamic support selection, block survival and full gameplay remain pending." +} diff --git a/benchmarks/rust-block-survival-2026-10-06/scoped-parity.json b/benchmarks/rust-block-survival-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..c7fe41a50 --- /dev/null +++ b/benchmarks/rust-block-survival-2026-10-06/scoped-parity.json @@ -0,0 +1,192 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "supported_blocks": 1274, + "supported_states": 34758, + "survival_rules": 54, + "survival_rule_kinds": 42, + "fluid_tag_files": 10, + "fixtures": 4501019, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSurvivalOracle.java": "dcbaacd909f0ae33d20957e21306dc1e060f428ea5bff2bd2f3833ce8f131b6f", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java": "82e5cadbcdcba5b4577c56c5a033262b066ccc4cc4a14c7c48ce46c4c6247a03", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSupportOracle.java": "04350901a2d708fb8fa672de61d058f73f332d2e90df1b93a67781862f89c1ad", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "02acfbae94aee306c5a4e1db7c86c68f7d6156ddd3dd477dc9e9d06e5ca98118", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_block_survival_parity.py": "5ebed710b5674e535a6cbb616878824efe89c53bca53e114c3d2ec9e7da619c1", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_properties.rs": "e74b368012d4d440dcdbd4d9bcaf80495220b90557f0e0c733b0aa21ad03c53c", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "b0fccfd7b44976b3cf27316da1ce0b202d5aa6a5574e821c36e79952d23026a2", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "1bf4ad95fcdf7f2df4e33dde38e08959d9b76a6260838c13e97c2bb59e006294", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "8a2834a9347ee2c2db7cf1c86a064907ec06e9ac16ba9cc3936e315fc4ad49ca", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "69cdc611b7a7e20a7da705fcc25de6b97cdb64cf63f954be49d0a11f9a820465", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_feature.rs": "6be7c0161cecf1362c196e91ecbeb166e16c8da3731d988ce8f2308f06209265", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "486fe9d8588eb09e0ee5707a0541b0df167b63b0b56c90a2709bfa09a0a3ad19", + "crates/horizon-world/src/worldgen/feature_graph.rs": "fe61a5e43179a7588737a71782ea246811fe2c8721e74793e1ac018c8eb93c34", + "crates/horizon-world/src/worldgen/feature_region.rs": "2c78e5f1bdb08307f8d982f231f1abbc3306cd54348d9023b86ee6ed3516fd33", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "e682d13a21f90605215b79f5d254bf2e524d35e89eab2e3b46384709af80b847", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "cd1d2fe305ad4e205e7e01b32128ff895fa8aacc76fa11f200ad6c7c9fba1f49", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "fa0616353f07460975ab323357ab280b7f35e7bfe2de6edc08d304316766ed26", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "89cb0410899608545aa1ba3b1b4c1babf533fb25efd341feab1c87661f44f7b9", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "821981c893fc84312351503f2be0c06c681d8bc768dade14576697cf047a9f8f", + "crates/horizon-world/examples/block_survival_fixture.rs": "a3b53925164b72be53d0d8137c1ee5bb07276cd64be8b20f4cd6dbe2ec4377bd" + }, + "fixtures_sha256": { + ".local/rust-block-survival-parity/inputs.txt": "bed87f9edbe95e9b0c019e1a544bac7c563a10beda8a2a5283b26b0b39e53161", + ".local/rust-block-survival-parity/fluid-tags.json": "f1e5eb6d22ea7effbb118a2282709cfdeef1bfae4516b775a55ad7a4df29d7d0", + ".local/rust-block-survival-parity/survival-placement-classes.json": "7fdbf48ab18c87098bbe1b6176cb81f4842b6c5d9a4d6bbaf7037ff61cb1848c", + ".local/rust-block-survival-parity/survival-support-tags.json": "15d88d5bb5ad10d65124d5abb2cc055d251b06d129bca7be06f55b43dc13f6fd", + ".local/rust-block-survival-parity/facts.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-block-survival-parity/survival-classes.json": "361832008eea0aa9151d367a125a19c6353d99a0b88b27dd0682f55b7954553e", + ".local/rust-block-survival-parity/survival-rules.json": "4360a5430f28eea27c40491352a0400ca29247a5f5e870895a665be08c298716", + ".local/rust-block-survival-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0", + ".local/rust-block-survival-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-block-survival-parity/cached-collision.nbt": "f3a5c6a5b2d51dad6c52e486e2b9989e79fd55db1a9bda6196db399550b04078", + ".local/rust-block-survival-parity/block-properties.nbt": "699a994c5c0c9f7ee58e35b9c23c4503a5936efe84133643113232f825ae2216", + ".local/rust-block-survival-parity/cached-support.nbt": "b6fdc9471b0b61e904206d3f099f4dc235aad6d723536c210be0cb7c3560d82c" + }, + "rust_output_sha256": "1bd97e34be67e70f536602c085d8fddb294f7b983589a1db2ed129ec8fae8e10", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "1bd97e34be67e70f536602c085d8fddb294f7b983589a1db2ed129ec8fae8e10", + "matched_output_lines": 14574905 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "1bd97e34be67e70f536602c085d8fddb294f7b983589a1db2ed129ec8fae8e10", + "matched_output_lines": 14574905 + } + ], + "scope": "Initial block survival rules are assigned from privately inspected native definition classes and executed in Rust against solid/air/tag tests and unified support geometry. Actual native canSurvive evaluates every supported candidate state, each neighbor state against behavior representatives, changing repeated reads, world-coordinate wrapping, absent/closed/open shulker snapshots, brightness thresholds, independent fluid state sequences and block/entity/light/fluid query failures. Unsupported survival families, full block placement/update behavior and full gameplay remain pending." +} diff --git a/benchmarks/rust-bulk-section-2026-10-06/scoped-parity.json b/benchmarks/rust-bulk-section-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..a0278a0df --- /dev/null +++ b/benchmarks/rust-bulk-section-2026-10-06/scoped-parity.json @@ -0,0 +1,169 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "block_states": 35723, + "block_tag_files": 300, + "fixtures": 8, + "resident_chunks_per_fixture": 4, + "operations": { + "has": 56, + "get": 72022, + "set": 71966, + "world": 71966, + "height": 32, + "reset": 8 + }, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBulkSectionOracle.java": "aa235a47cfa64e4daf3c38901f80534957e4418e4cba1b726deaedd83ce5289f", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_bulk_section_parity.py": "f3e1415ec54a42e04406f278375eec0a0d7b4dff7e4e550e630a3b4453b90f55", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "32b937832b7058d86e8557a2012df32be1c97be324f15d0ae85245c45c73b314", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_feature.rs": "c215156f2ecf7faf214b3d89e0829b65d54f4ff6d134d778ec941f18a606a327", + "crates/horizon-world/src/worldgen/block_predicate.rs": "dd8cbda2ec110444950f0b31bf4e088897eab0994674a91568c7b063f8f16210", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "486fe9d8588eb09e0ee5707a0541b0df167b63b0b56c90a2709bfa09a0a3ad19", + "crates/horizon-world/src/worldgen/feature_graph.rs": "2297b194514925688dba25016a69d5ba5eb8b869bdfff28f2e611a6742ac5954", + "crates/horizon-world/src/worldgen/feature_region.rs": "4a95a30c0987d97e671f84380e13ddea070ad81f996baa65b2a06c4d892971c7", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "1b976aa4dd2516468196d0af3451e3fdd037493a14d269f54ebdd7254055e05e", + "crates/horizon-world/src/worldgen/placement/context.rs": "b36dfd9297896e62770f2085cf934fc08ebd4c030ecc7ae17d864e819a113201", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "68ecf36954fea5705436d486e9be93836933fd56779022afeb881a0399d6a674", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/value_provider.rs": "ad1c0efffcc201839e3471d7dfa06c39307d8cbabddb4c5aed8389ee7b68737a", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "828ef13e9d498037598d2ea86e3b46fa2713a35818ddac1d883b04ecceefd5ce", + "crates/horizon-world/examples/bulk_section_fixture.rs": "543dcae1cda92b0a14fd00c853f55c1af516240def6bdcd2612539b0ed955157" + }, + "fixtures_sha256": { + ".local/rust-bulk-section-parity/inputs.txt": "44b1c8c133d9c868bbdbe5fd577c01e6a5e1fa6382731211dcb35919975eff60", + ".local/rust-bulk-section-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0", + ".local/rust-bulk-section-parity/facts-client.json": "1d24883ee807b0b71473f0bbf8ed548ddaf712148caeb3fcc7aa13ab973a97b0", + ".local/rust-bulk-section-parity/facts-server.json": "1d24883ee807b0b71473f0bbf8ed548ddaf712148caeb3fcc7aa13ab973a97b0" + }, + "rust_output_sha256": "2628afc7a43f0eda9513298cb5a05dd1e0a225e7ae4e643b2dec03f21beb068f", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "2628afc7a43f0eda9513298cb5a05dd1e0a225e7ae4e643b2dec03f21beb068f", + "matched_output_lines": 959640 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "2628afc7a43f0eda9513298cb5a05dd1e0a225e7ae4e643b2dec03f21beb068f", + "matched_output_lines": 959640 + } + ], + "scope": "Actual BulkSectionAccess over resident ProtoChunks: raw reads/writes, all-air chunk-read collapse, outside-height AIR, absent sections, missing neighbors, packed-key caching and aliasing, cache reset and complete final raw sections/heightmap words. Every pinned block state is inserted and read with both preprimed and lazy heightmaps. Rust holds an exclusive region borrow instead of Java section acquire/release locks. Concurrent ownership, ordinary ore geometry, region side effects and complete gameplay remain pending." +} diff --git a/benchmarks/rust-canyon-carver-2026-10-06/scoped-parity.json b/benchmarks/rust-canyon-carver-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..c548896a0 --- /dev/null +++ b/benchmarks/rust-canyon-carver-2026-10-06/scoped-parity.json @@ -0,0 +1,146 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 508, + "carve_attempts": 924, + "bundled_canyon_definitions": 1, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCanyonCarverOracle.java": "d8456c8f79a1d9094ddfd2b83a73c2e6593c5bb2eeca69227326b1cb47c817b7", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaAnchorOracle.java": "226628d98b89aadbdd374936575d033945e7064a900dbb050c662204dbc7e119", + "tools/test_canyon_carver_parity.py": "0a69288d2acb4f7b467ce7104bf6f11a432db71e214c61282c5987ffa8243204", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "32b937832b7058d86e8557a2012df32be1c97be324f15d0ae85245c45c73b314", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "476f1542d335eb02fb627b7480d708f4aa6b7f9929f4dbc2c646e15b063cf083", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/placement.rs": "54131e84ee04b6605d13584c1fbfd5f8c19e746455577febf6aaeebe5a51c2b1", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "7516e20a20479d1c4a9734d7d8e9826740b324869d7afe51eab94bb1bc7c97ae", + "crates/horizon-world/src/worldgen/terrain.rs": "42823918deec5e149dc729a95bfe54aa32d91604098d5eb8452da0162d557d22", + "crates/horizon-world/src/worldgen/value_provider.rs": "ad1c0efffcc201839e3471d7dfa06c39307d8cbabddb4c5aed8389ee7b68737a", + "crates/horizon-world/src/worldgen/weighted.rs": "1ae40b843721d0f1e1c849b984e0a065aacda6e1384e21fc599cda261f996945", + "crates/horizon-world/src/worldgen.rs": "810bac2405b8370d2851df54eca5dcbb7a762492eafaedfce333670707408da5", + "crates/horizon-world/examples/canyon_carver_fixture.rs": "351a20f891b7f87251341336089138200facc660bbe924ac378f25829b4bba2d" + }, + "fixtures_sha256": { + ".local/rust-canyon-carver-parity/inputs.txt": "4b8d8d6d7d309ee3f5b7537848eca0279673d364aca55caaff3072e7288b8bd1", + ".local/rust-canyon-carver-parity/carvers.json": "cff93e18a087786ad09d04c329293a0d7f4c4944cabecb4d618cee2dbc519096" + }, + "rust_output_sha256": "b02ebaf90c2638965b1b890b75ec5b953b5ede9790250a42bb5886eb85035351", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "b02ebaf90c2638965b1b890b75ec5b953b5ede9790250a42bb5886eb85035351", + "matched_output_lines": 1094517 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "b02ebaf90c2638965b1b890b75ec5b953b5ede9790250a42bb5886eb85035351", + "matched_output_lines": 1094517 + } + ], + "scope": "Actual WorldCarver.DIRECT_CODEC, CanyonWorldCarver.isStartChunk and CanyonWorldCarver.carve using the independently authenticated bundled canyon definition. Compares ordered output cells including duplicates, partial output failures, resulting mask intervals and subsequent random longs across repeated invocations. Covers both outer random modes, local legacy streams, height-dependent width factors, horizontal/vertical radius variation, four generation heights, negative/distant/extreme coordinates and adjacent/far origin chunks. Custom shapes exercise width smoothness, path length, degenerate radii and failure branches; malformed selected codec fields are tested. Gaussian/weighted provider codecs, neighbor-carver seeding/biome selection, blending and complete worlds remain outside this scope. Rust bounds paths to 4096 steps, height to 4064 and total candidates to 2^24 per invocation." +} diff --git a/benchmarks/rust-carving-geometry-2026-10-06/scoped-parity.json b/benchmarks/rust-carving-geometry-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..b579052ea --- /dev/null +++ b/benchmarks/rust-carving-geometry-2026-10-06/scoped-parity.json @@ -0,0 +1,141 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 15, + "ellipsoids": 690, + "reach_queries": 5536, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCarvingGeometryOracle.java": "558ac2108421822d7def914969e99ff10a44ca9ff63932e747f5d0a1d8946ef2", + "tools/test_carving_geometry_parity.py": "5c6548495da71606ab5e47d12acf8633c6713e79662193d48a1fc7f030bee208", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "32b937832b7058d86e8557a2012df32be1c97be324f15d0ae85245c45c73b314", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "476f1542d335eb02fb627b7480d708f4aa6b7f9929f4dbc2c646e15b063cf083", + "crates/horizon-world/src/worldgen/carver.rs": "0a75ec71570f80f8800c349c3b612e0d0bc35b6009d1b66a0ae1056be1eb8e3a", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/height_provider.rs": "c9a148cdbd392b4ae998e466120c0870eb121736366a160347e1a697bdad914f", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "7516e20a20479d1c4a9734d7d8e9826740b324869d7afe51eab94bb1bc7c97ae", + "crates/horizon-world/src/worldgen/terrain.rs": "42823918deec5e149dc729a95bfe54aa32d91604098d5eb8452da0162d557d22", + "crates/horizon-world/src/worldgen/value_provider.rs": "7083e7a494894e080c252e7fb485651eb9f54e72043122e4f2b5bee5749e6184", + "crates/horizon-world/src/worldgen.rs": "58527080379e82d834763d661ebf51fb8f9a83f6d530c85ddf26bf0ea2d53f7d", + "crates/horizon-world/examples/carving_geometry_fixture.rs": "acf2c1b2c0c55726a6adbe185adb81505e163100e11ef739d8dcec60bda9f25b" + }, + "fixtures_sha256": { + ".local/rust-carving-geometry-parity/inputs.txt": "a3ccf40f7eec666483d901d3de637ba37badb306652f43fc60159fdaa8a702b2", + ".local/rust-carving-geometry-parity/reach.txt": "fb9945ca459d53d1c07c39b53d3a98628f65a3caa90954255c66e0d010aa9647" + }, + "rust_output_sha256": "4b40510463e96accae26cfd7cbf617b15b8fc6a53d704040674ea444a25dae6a", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "4b40510463e96accae26cfd7cbf617b15b8fc6a53d704040674ea444a25dae6a", + "matched_output_lines": 106699 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "4b40510463e96accae26cfd7cbf617b15b8fc6a53d704040674ea444a25dae6a", + "matched_output_lines": 106699 + } + ], + "scope": "Actual WorldCarver.carveEllipsoid and canReach methods. Compares ordered normalized-coordinate skip queries, output cells, partial output on callback failure and resulting mask column runs; canReach includes Java float thickness arithmetic and signed step overflow. Corpus covers negative/extreme/distant chunk coordinates, output-height clipping, small/large/zero/negative radii, boundaries and IEEE NaNs/infinities/subnormals. NaN trace values are canonicalized. This validates shared geometric primitives, not randomized cave/canyon paths, codecs, provider sampling, biome carver selection or complete worlds." +} diff --git a/benchmarks/rust-carving-mask-2026-10-06/scoped-parity.json b/benchmarks/rust-carving-mask-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..cc7b8b436 --- /dev/null +++ b/benchmarks/rust-carving-mask-2026-10-06/scoped-parity.json @@ -0,0 +1,134 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 28, + "operations": 6988, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCarvingMaskOracle.java": "7d6d395e9e8659cb00e6ec7c24f9f0e7f59477198533137f9428eabfb592c7e6", + "tools/test_carving_mask_parity.py": "1f0b8f800ee42a84c69cb3c23a83e1463eb4941f9a996499d0eb665c3ffdc779", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving.rs": "f6042ae85ec6dda6803ff353de035bf00c499f383b6933994a424e0dfe196b93", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "32b937832b7058d86e8557a2012df32be1c97be324f15d0ae85245c45c73b314", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "476f1542d335eb02fb627b7480d708f4aa6b7f9929f4dbc2c646e15b063cf083", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "04ac9130138ea4ce67fc43f7701f5036972984724ffcd49bfe857d0693361d87", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "4ab2681a45108e5d2ea6fb761ea1cb7fa40b72833fa6190d2efe34ce29845c21", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "7516e20a20479d1c4a9734d7d8e9826740b324869d7afe51eab94bb1bc7c97ae", + "crates/horizon-world/src/worldgen/terrain.rs": "42823918deec5e149dc729a95bfe54aa32d91604098d5eb8452da0162d557d22", + "crates/horizon-world/src/worldgen.rs": "3ea3386996321113027dcf51d918d29d363ac1944b7c146a7f1383d17a50967b", + "crates/horizon-world/examples/carving_mask_fixture.rs": "0e3069cf0b4cabae8b4016e034727465e123cce2fd389acf448bc053106677d0" + }, + "fixtures_sha256": { + ".local/rust-carving-mask-parity/inputs.txt": "07a5dceb375ea41d9d2acd80b5d6951bf16f7829c3c656a785f486d373e6a4cc" + }, + "rust_output_sha256": "854a0f1074132dacec5989aa92fcf38258c84cbc800aabc6d7e580256bf06175", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "854a0f1074132dacec5989aa92fcf38258c84cbc800aabc6d7e580256bf06175", + "matched_output_lines": 45742 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "854a0f1074132dacec5989aa92fcf38258c84cbc800aabc6d7e580256bf06175", + "matched_output_lines": 45742 + } + ], + "scope": "Actual CarvingMask construction, carve, isEmpty and visit methods. Compares packed vertical-run traversal, splitting across columns, dense/sparse masks, duplicate writes, word boundaries, coordinate overflow and positive aliases, negative index failures, callback additions during traversal and mutations retained after visitor failures. Rust bounds height to 1..4064 and positive index growth to 2^24 bits; corpus indices remain below 2^20. This validates masks, not cave/canyon generation, mask application, aquifers, blending or complete terrain generation." +} diff --git a/benchmarks/rust-cave-carver-2026-10-06/scoped-parity.json b/benchmarks/rust-cave-carver-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..27f95ecc1 --- /dev/null +++ b/benchmarks/rust-cave-carver-2026-10-06/scoped-parity.json @@ -0,0 +1,146 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 415, + "carve_attempts": 739, + "bundled_cave_definitions": 3, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCaveCarverOracle.java": "28e029f0d535f8529291124337855c2d7c1b123ec77b7728938e5afeb9be4c3b", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaAnchorOracle.java": "226628d98b89aadbdd374936575d033945e7064a900dbb050c662204dbc7e119", + "tools/test_cave_carver_parity.py": "11ec1ceb25fb0d8ec193d619c8bcc744b2c5a9105c2d3ac769a802f59a5b63d7", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "32b937832b7058d86e8557a2012df32be1c97be324f15d0ae85245c45c73b314", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "476f1542d335eb02fb627b7480d708f4aa6b7f9929f4dbc2c646e15b063cf083", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/placement.rs": "54131e84ee04b6605d13584c1fbfd5f8c19e746455577febf6aaeebe5a51c2b1", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "7516e20a20479d1c4a9734d7d8e9826740b324869d7afe51eab94bb1bc7c97ae", + "crates/horizon-world/src/worldgen/terrain.rs": "42823918deec5e149dc729a95bfe54aa32d91604098d5eb8452da0162d557d22", + "crates/horizon-world/src/worldgen/value_provider.rs": "ad1c0efffcc201839e3471d7dfa06c39307d8cbabddb4c5aed8389ee7b68737a", + "crates/horizon-world/src/worldgen/weighted.rs": "1ae40b843721d0f1e1c849b984e0a065aacda6e1384e21fc599cda261f996945", + "crates/horizon-world/src/worldgen.rs": "810bac2405b8370d2851df54eca5dcbb7a762492eafaedfce333670707408da5", + "crates/horizon-world/examples/cave_carver_fixture.rs": "2aae82674be65a4fc0e13975b2f4185b66fd73a553784d2fa5be3875c3d65c91" + }, + "fixtures_sha256": { + ".local/rust-cave-carver-parity/inputs.txt": "44cc4a5532fe65dcc38d70f708b8f72dcac4df1b04cafc131c5ffecc5a8588bd", + ".local/rust-cave-carver-parity/carvers.json": "cff93e18a087786ad09d04c329293a0d7f4c4944cabecb4d618cee2dbc519096" + }, + "rust_output_sha256": "bed22be613f5b1d8caa0d75546afb4e6cee33222d8d9b51004acff70e1a03d7d", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "bed22be613f5b1d8caa0d75546afb4e6cee33222d8d9b51004acff70e1a03d7d", + "matched_output_lines": 882005 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "bed22be613f5b1d8caa0d75546afb4e6cee33222d8d9b51004acff70e1a03d7d", + "matched_output_lines": 882005 + } + ], + "scope": "Actual WorldCarver.DIRECT_CODEC, CaveWorldCarver.isStartChunk and CaveWorldCarver.carve using all three independently authenticated bundled cave definitions. Compares ordered output cells including duplicates, partial output failures, resulting mask intervals and subsequent random longs across repeated invocations. Covers both outer random modes, local legacy tunnel streams, rooms, branching, thickness bias, floor thresholds, negative/distant/extreme target coordinates and adjacent/far origin chunks. Explicit custom distributions force path and failure branches; malformed selected codec fields are tested. Gaussian/weighted provider codecs, canyon paths, neighbor-carver seeding/biome selection, blending and complete generated worlds remain outside this scope. Rust bounds count to 4096 and total candidates to 2^24 per invocation." +} diff --git a/benchmarks/rust-chunk-stage-2026-10-06/scoped-parity.json b/benchmarks/rust-chunk-stage-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..66324076a --- /dev/null +++ b/benchmarks/rust-chunk-stage-2026-10-06/scoped-parity.json @@ -0,0 +1,161 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "block_states": 35723, + "block_tag_files": 300, + "fixtures": 32, + "operation_counts": { + "stage": 392, + "set": 151562, + "get": 80086, + "query": 151922, + "dump": 32, + "prime": 120 + }, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaChunkStageOracle.java": "dea4639bd8b0196b0044d30a046d9971200f1fcc32c29b5d2202a996f7dc0161", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_chunk_stage_parity.py": "655f1fd5e79bddad3a1d2a1b7b51bb61d6e7fce6aece086c32bc0cbacac5acc3", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "32b937832b7058d86e8557a2012df32be1c97be324f15d0ae85245c45c73b314", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_predicate.rs": "dd8cbda2ec110444950f0b31bf4e088897eab0994674a91568c7b063f8f16210", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/placement/chain.rs": "76832dd4f76b44edfcc8bd52d8115f6e30684bfaea0e0b959ba060f07cc3483d", + "crates/horizon-world/src/worldgen/placement/context.rs": "b36dfd9297896e62770f2085cf934fc08ebd4c030ecc7ae17d864e819a113201", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "f9d264985d0ce6a7eb91a4f559661efbecc5a3fe097ce559f6acbcf0132c8c87", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "7516e20a20479d1c4a9734d7d8e9826740b324869d7afe51eab94bb1bc7c97ae", + "crates/horizon-world/src/worldgen/terrain.rs": "fa7ef419e62e67c8ff226f45ced1f7cc4e6f1cc583684476cced17be49b8ab46", + "crates/horizon-world/src/worldgen/value_provider.rs": "ad1c0efffcc201839e3471d7dfa06c39307d8cbabddb4c5aed8389ee7b68737a", + "crates/horizon-world/src/worldgen/weighted.rs": "1ae40b843721d0f1e1c849b984e0a065aacda6e1384e21fc599cda261f996945", + "crates/horizon-world/src/worldgen.rs": "edc1d675acc52d264486a3c8c56e93a21ebf2c6a73da912f35b8fa2a7233cdde", + "crates/horizon-world/examples/chunk_stage_fixture.rs": "ea09c70cf987fc5d332ed993de11a553f30a70d40852f22b80b26c555ffcab06" + }, + "fixtures_sha256": { + ".local/rust-chunk-stage-parity/inputs.txt": "401e093fd21a566637a9ee3d28afec5c2f0be6b538eda69ec0a7d184af545c5c", + ".local/rust-chunk-stage-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0", + ".local/rust-chunk-stage-parity/facts-client.json": "1d24883ee807b0b71473f0bbf8ed548ddaf712148caeb3fcc7aa13ab973a97b0", + ".local/rust-chunk-stage-parity/facts-server.json": "1d24883ee807b0b71473f0bbf8ed548ddaf712148caeb3fcc7aa13ab973a97b0" + }, + "rust_output_sha256": "95dbf7a1cade1004b7055dc131e45af8f3cecc1ffe2f194ad816a831bc2d9975", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "95dbf7a1cade1004b7055dc131e45af8f3cecc1ffe2f194ad816a831bc2d9975", + "matched_output_lines": 8090090 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "95dbf7a1cade1004b7055dc131e45af8f3cecc1ffe2f194ad816a831bc2d9975", + "matched_output_lines": 8090090 + } + ], + "scope": "Actual ProtoChunk.setBlockState, direct section reads, heightmap presence/packed data and pre-light persisted-status assignments for empty, structure starts, structure references, biomes, terrain and features. Every pinned block state is inserted/removed under both heightmap groups. Forward/backward status assignments, untouched stale maps, missing-map priming, explicit priming, empty-section AIR writes, cave/void-air collapse, outside-height writes and wrapped X/Z coordinates are compared. Facts are independently exported from both authenticated JARs; block tags are resolved in Rust. This covers stage-dependent mutation and map selection, not the scheduler, persisted metadata, retro-generation, block entities, lighting, whole region behavior or a complete generated world." +} diff --git a/benchmarks/rust-collision-2026-10-05/scoped-parity.json b/benchmarks/rust-collision-2026-10-05/scoped-parity.json new file mode 100644 index 000000000..a0ccf862a --- /dev/null +++ b/benchmarks/rust-collision-2026-10-05/scoped-parity.json @@ -0,0 +1,75 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "inputs_sha256": "ec4d8458f10935a5e68dd27e69af493bd38463eb0a59747741cc7a5bd49957c7", + "rust_output_sha256": "2bc52fdaef3bc6b404642565139555ddb9568d4d669d7c2cb15a21d475f0b796", + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "02acfbae94aee306c5a4e1db7c86c68f7d6156ddd3dd477dc9e9d06e5ca98118", + "tools/test_collision_parity.py": "2ca10b21bf94146ef62cb79ce2e38b753d1565c4f34da7c9f6a887805253d853", + "tools/test_rust_parity.py": "500652427164c7e067a5eb69310ec81f843d5fe37a7c9d88edd2b1ca6606020a", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "faae2edce8b573fd32fcb4bd1f898be7d700a5b38479439f5bec96df764688fd", + "crates/horizon-core/Cargo.toml": "09243cac4d45e8b4aaed3a6169bf3ee0e1272fdff4298c43c80d5fff0116d01c", + "crates/horizon-world/Cargo.toml": "e3250c38fb21b149b5ccaf3c90b5c87ff15b2902f5204b7159207ef7fbf229f2", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/parity.rs": "7b455f2181862e1430e7387633c146877c2d317c2ea682c1e6fa64345dbc5885", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "acaa0a51a759e1a08d417538e567847a66b8c9ae6a7434872e1621ed210364b1", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random.rs": "2f304dfb580a6bc1b5c51b048a2fa2a57f73c5f28f5eb2447f925bf138513389", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/lib.rs": "521ed8987f9fc21e9df75206795414871611e5b6acbf3906c26f44a4c6e6115e", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry.rs": "f46065659e60eb5e84ad69b9f3b5e94dc87ee19de16408817e26f23d16b6c7e7", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/examples/collision_fixture.rs": "ee754b5b42e0a51fe0a305b3f4bb56522ff3fffae564180aab8087b1b9e44afc" + }, + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "2bc52fdaef3bc6b404642565139555ddb9568d4d669d7c2cb15a21d475f0b796", + "matched_output_lines": 1097456, + "registry_states": 35723, + "cached_states": 35524, + "uncached_states": 199, + "unique_shapes": 6093, + "unique_grids": 330, + "queries": 213144 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "2bc52fdaef3bc6b404642565139555ddb9568d4d669d7c2cb15a21d475f0b796", + "matched_output_lines": 1097456, + "registry_states": 35723, + "cached_states": 35524, + "uncached_states": 199, + "unique_shapes": 6093, + "unique_grids": 330, + "queries": 213144 + } + ], + "scope": "Pinned no-context cached collision branch only. Registry identity validation, resident section lookup, grids, discrete extrema including empty shapes, greedy boxes, bounds, translated collide, ray hits, closest points and moved cell lookup. Uncached states and entity-context behavior remain unsupported." +} diff --git a/benchmarks/rust-core-2026-10-04/scoped-parity.json b/benchmarks/rust-core-2026-10-04/scoped-parity.json new file mode 100644 index 000000000..94680d453 --- /dev/null +++ b/benchmarks/rust-core-2026-10-04/scoped-parity.json @@ -0,0 +1,44 @@ +{ + "schema": 1, + "minecraft": "26.3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "commands": { + "position": 12375, + "legacy": 23, + "xoroshiro": 23, + "xoroshiro_state": 5, + "storage": 274 + }, + "inputs_sha256": "dbdebadd4b14ec57d198d22f15e196e0cc9a6b88bac6691db702348a769459c1", + "rust_output_sha256": "7801e3274307aab1852d96d996d7f29b1ca1567750d231c5f74c9e3263f84f87", + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCoreOracle.java": "649b8353fcc3c45a3baf8e2d78dc76cfedfd96de36030b0dddfb2305829cd844", + "tools/test_rust_parity.py": "d2d06842abb80d9c718a5bf0e71ab0c098ad4c519b8ef35711e30cf58af140d7", + "crates/horizon-core/src/bin/parity.rs": "7b455f2181862e1430e7387633c146877c2d317c2ea682c1e6fa64345dbc5885", + "crates/horizon-core/src/lib.rs": "deb2e339f78c9f5bd55a1c8a8428f3e37fae93a02268f9a2fc782dc3e27c2869", + "crates/horizon-core/src/position.rs": "8c2a54e912f8c31a774682b3377ca5f2138910350fbf605e760b24e2cbcacfba", + "crates/horizon-core/src/random.rs": "2f304dfb580a6bc1b5c51b048a2fa2a57f73c5f28f5eb2447f925bf138513389", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/Cargo.toml": "1928b71e389c24c506804f0d8e3104976da6feb27d9bfdbb3b55fb7af0c62664", + "Cargo.toml": "9ca59fba126895de9e58952eb5e9421bee0ffdfb5f6d2fcb03d7726e394e7c3f", + "Cargo.lock": "f2b104dbb3f64512b6c72e8d8732b7adda849212689e8c816f9a6abf564f4660" + }, + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "7801e3274307aab1852d96d996d7f29b1ca1567750d231c5f74c9e3263f84f87", + "matched_output_lines": 1017920 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "7801e3274307aab1852d96d996d7f29b1ca1567750d231c5f74c9e3263f84f87", + "matched_output_lines": 1017920 + } + ], + "scope": "Selected integer position, seeded RNG and packed-storage operations only. No gameplay, rendering or performance claim." +} diff --git a/benchmarks/rust-core-2026-10-05/scoped-parity.json b/benchmarks/rust-core-2026-10-05/scoped-parity.json new file mode 100644 index 000000000..67cc61e06 --- /dev/null +++ b/benchmarks/rust-core-2026-10-05/scoped-parity.json @@ -0,0 +1,69 @@ +{ + "schema": 1, + "minecraft": "26.3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "commands": { + "position": 12375, + "legacy": 23, + "xoroshiro": 23, + "xoroshiro_state": 5, + "storage": 274, + "factory": 4400, + "helpers": 5000 + }, + "inputs_sha256": "fa3dce6416a2d2a6e4af89b29715bab9575bb99b18be9c188f777af415383c03", + "rust_output_sha256": "799ae9305fe380b8bc63fc280d9f0222e62d093bfdb8d286305e7414448bb0e7", + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCoreOracle.java": "69d9d3ff45e56122136d6a6f6b8fde0972985c4ced1a052fcb9c44a9df6b3c14", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "86e7a87439acf5458be3c9b6ed5dfc3705170f39483ec0f1c2b723b4f5e3ff28", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "f00ebba7484168ae0064fa993ace9afafb323c3222ab80cfee3792bd98562e8d", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-core/Cargo.toml": "f9aff52d34439ed6511b026beee5cbd9918f34cc0a67e90e441df12c905a6dc0", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "faae2edce8b573fd32fcb4bd1f898be7d700a5b38479439f5bec96df764688fd" + }, + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "799ae9305fe380b8bc63fc280d9f0222e62d093bfdb8d286305e7414448bb0e7", + "matched_output_lines": 1634520 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "799ae9305fe380b8bc63fc280d9f0222e62d093bfdb8d286305e7414448bb0e7", + "matched_output_lines": 1634520 + } + ], + "scope": "Selected integer positions, seeded RNG operations including inclusive/exclusive integer intervals and float/double triangular draws, positional factories, UTF-16 Java string hashing, MD5-derived seeds and packed-storage operations. Floating-point helper NaNs canonicalized; finite results and signed zeros compared by bits. No gameplay, rendering or performance claim." +} diff --git a/benchmarks/rust-decoration-2026-10-06/scoped-parity.json b/benchmarks/rust-decoration-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..649dad3b8 --- /dev/null +++ b/benchmarks/rust-decoration-2026-10-06/scoped-parity.json @@ -0,0 +1,161 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 2188, + "biomes": 67, + "requested_decorations": 4376, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDecorationOracle.java": "ddec65c7fbc798fb40eca1e4b0301c201d8ae90e771e989fdbc8915553973543", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", + "tools/test_decoration_parity.py": "6309a586685b3795610b04659b721b8a94e120841d4509112494a81c08733f07", + "tools/test_feature_sort_parity.py": "ba745b738c3181c432c77c939126ed8f41fa7bc0430c1900d909f2ed50e5fdd6", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "32b937832b7058d86e8557a2012df32be1c97be324f15d0ae85245c45c73b314", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_feature.rs": "c215156f2ecf7faf214b3d89e0829b65d54f4ff6d134d778ec941f18a606a327", + "crates/horizon-world/src/worldgen/block_predicate.rs": "dd8cbda2ec110444950f0b31bf4e088897eab0994674a91568c7b063f8f16210", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "8e29ca35bf432232b47087b162a513e18a5b0ac470461b73ca8444bef7cd9960", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "486fe9d8588eb09e0ee5707a0541b0df167b63b0b56c90a2709bfa09a0a3ad19", + "crates/horizon-world/src/worldgen/feature_graph.rs": "2297b194514925688dba25016a69d5ba5eb8b869bdfff28f2e611a6742ac5954", + "crates/horizon-world/src/worldgen/feature_region.rs": "4a95a30c0987d97e671f84380e13ddea070ad81f996baa65b2a06c4d892971c7", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9bce6b17b60fec575d810713d9fb2714780aadbbc973db969c07cf4455201847", + "crates/horizon-world/src/worldgen/placement/context.rs": "f8fa467d3b931d0f98d3572fbc80c659d452a7fc5755d5c98123dc477c2b541c", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "c39c0b5f761fd573ff2f2a1d9d42901305995cc88f5c4ca3a49aaa4ef5dd933b", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/value_provider.rs": "ad1c0efffcc201839e3471d7dfa06c39307d8cbabddb4c5aed8389ee7b68737a", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "d69e6a02e628df1238a253c99b7ee6d1597b8fcd6703795525e0f77fdf1cf47b", + "crates/horizon-world/examples/decoration_fixture.rs": "d195a9edbe2b82694fba45ada3a619340506d441d4063aedf8111c1ccfde6df7" + }, + "fixtures_sha256": { + ".local/rust-decoration-parity/inputs.txt": "3ead79dc3276a770c3c2a70fe080e355ca9e45af763f927cd82e9eb5475fbad0", + ".local/rust-decoration-parity/biome-features.json": "cc3846a9d2eae7e45ba9fd69f07e37a715ce5cb946c9cdbe8a86a471c8a8a975" + }, + "rust_output_sha256": "7c34f5bf7b39df3d175c5a4e2da4917ce538ed5fa125a88c4b44a43805a964de", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "7c34f5bf7b39df3d175c5a4e2da4917ce538ed5fa125a88c4b44a43805a964de", + "matched_output_lines": 337398 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "7c34f5bf7b39df3d175c5a4e2da4917ce538ed5fa125a88c4b44a43805a964de", + "matched_output_lines": 337398 + } + ], + "scope": "Actual ChunkGenerator.applyBiomeDecoration with structure generation disabled, native ProtoChunk biome palettes, native FeatureSorter and WorldgenRandom, and traced feature sinks. Nine-chunk query order, possible-biome intersection, sorted global feature indices, decoration/feature seeds, biome-check placement, repeated calls, ignored false results, progress markers and partial failures are compared. All 67 bundled biome feature lists participate with synthetic payloads. Rust owns immutable generation settings and delegates resident palette transport and feature callbacks. Structure decoration, complete registry/world region integration, all feature algorithms, crash-report formatting and full gameplay remain pending." +} diff --git a/benchmarks/rust-decoration-region-2026-10-06/scoped-parity.json b/benchmarks/rust-decoration-region-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..c6915af64 --- /dev/null +++ b/benchmarks/rust-decoration-region-2026-10-06/scoped-parity.json @@ -0,0 +1,178 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "block_states": 35723, + "block_tag_files": 300, + "fixtures": 240, + "biome_zoom": true, + "resident_chunks_per_fixture": 9, + "requested_decorations": 480, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDecorationRegionOracle.java": "9c67be65ec6b7c86850fce4277a930fba9b613e416cd749b33989b75d34ee971", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", + "tools/test_decoration_region_parity.py": "d85b316b4fca4f71239b8e6edf7fad4be4e7be972b108450d62ec96bea8a3196", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_feature_region_parity.py": "fceba45d5aa9bb2c137350f1df70f4ba64ea65c4179a50920e713a2669bf4e28", + "tools/test_decoration_parity.py": "6309a586685b3795610b04659b721b8a94e120841d4509112494a81c08733f07", + "tools/test_feature_sort_parity.py": "ba745b738c3181c432c77c939126ed8f41fa7bc0430c1900d909f2ed50e5fdd6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/fluid.rs": "8a2834a9347ee2c2db7cf1c86a064907ec06e9ac16ba9cc3936e315fc4ad49ca", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5e93b751c43417dc0a5eac05f4389c8097959e1df3b307e499a7b3e4403c6584", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_feature.rs": "d8b2d3f19f49a0a60c913596f5a8f5fcb5be2e8633c9910e4e583e5d85916bde", + "crates/horizon-world/src/worldgen/block_predicate.rs": "95997ad124f4ee85abf02c8a1058cf9fb5e6d0289f4ef6721e532ae39c886640", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "486fe9d8588eb09e0ee5707a0541b0df167b63b0b56c90a2709bfa09a0a3ad19", + "crates/horizon-world/src/worldgen/feature_graph.rs": "fe61a5e43179a7588737a71782ea246811fe2c8721e74793e1ac018c8eb93c34", + "crates/horizon-world/src/worldgen/feature_region.rs": "2c78e5f1bdb08307f8d982f231f1abbc3306cd54348d9023b86ee6ed3516fd33", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "e682d13a21f90605215b79f5d254bf2e524d35e89eab2e3b46384709af80b847", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "4b5a908d6572ba166b82e232927ad884f0d6cf1ca997c8a4c89f41fd15370041", + "crates/horizon-world/src/worldgen/placement/context.rs": "6d450931cdeab1427253a19baa5184c1b70cfaecb1ee3f60d5400f083b96e682", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "fa0616353f07460975ab323357ab280b7f35e7bfe2de6edc08d304316766ed26", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "64a9ecb17f3567d5928de9959702a8f45e75b36a3227342ef392a8f840d18d18", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "821981c893fc84312351503f2be0c06c681d8bc768dade14576697cf047a9f8f", + "crates/horizon-world/examples/decoration_region_fixture.rs": "f22941c968628c13326890abb627223092ded53565db234be0867b56bc126749", + "crates/horizon-world/examples/support/decoration_storage.rs": "feb724e80bbcc1f66b671881ce58875f9bb419434dbd83b90475488e6e0bda99" + }, + "fixtures_sha256": { + ".local/rust-decoration-region-parity/inputs.txt": "cd00683424d45ef1edbd39dc5be3001554e182b3b9fca220f4feb18fef339cbf", + ".local/rust-decoration-region-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0", + ".local/rust-decoration-region-parity/facts-client.json": "1d24883ee807b0b71473f0bbf8ed548ddaf712148caeb3fcc7aa13ab973a97b0", + ".local/rust-decoration-region-parity/facts-server.json": "1d24883ee807b0b71473f0bbf8ed548ddaf712148caeb3fcc7aa13ab973a97b0" + }, + "rust_output_sha256": "5065d7e427a570e65b844e13d2a98f2127b62d87ab501cd68b9b5ea47b41638b", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "5065d7e427a570e65b844e13d2a98f2127b62d87ab501cd68b9b5ea47b41638b", + "matched_output_lines": 36173951 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "5065d7e427a570e65b844e13d2a98f2127b62d87ab501cd68b9b5ea47b41638b", + "matched_output_lines": 36173951 + } + ], + "scope": "Actual ChunkGenerator.applyBiomeDecoration with structures disabled executes three native basic features, configured fill-layer sequences, replacements and scattered ore into nine ProtoChunks. Biome palettes, native BiomeManager zoom, possible-biome selection, FeatureSorter order, WorldgenRandom seeding, biome filters, registry-bound matching-biome predicates, ordered volume predicates and graph composition share resident terrain. Both pre-light heightmap groups, mixed/uniform biome neighborhoods, count/square/heightmap/layered chains, repeated decoration, rejected writes and partial failures are compared. Ordered writes, current-feature markers, complete final raw sections and all heightmap presence/data are checked. Rust uses resident BiomeRegion and TerrainRegion with caller-owned biome membership/write effects. Actual WorldGenRegion write-zone policy, POIs, block entities, postprocessing, lighting, structures, remaining feature algorithms, complete noise-to-decoration lifecycle and gameplay remain pending." +} diff --git a/benchmarks/rust-density-2026-10-05/scoped-parity.json b/benchmarks/rust-density-2026-10-05/scoped-parity.json new file mode 100644 index 000000000..98ad5e490 --- /dev/null +++ b/benchmarks/rust-density-2026-10-05/scoped-parity.json @@ -0,0 +1,159 @@ +{ + "schema": 1, + "minecraft": "26.3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "commands": { + "constant": 336, + "query": 931724, + "volume": 225642, + "gradient": 2041, + "noise": 272, + "shift": 1200, + "unary": 3168, + "binary": 2408, + "choice": 1250, + "lerp": 1216, + "interval": 1000, + "bounds": 41176, + "offset": 816, + "blended": 192, + "distance": 320, + "metric": 12000, + "blendfail": 10, + "blendfbm": 256, + "counted": 3120, + "cache": 532, + "context": 34805, + "counts": 532632, + "lookup": 10000, + "slice": 384, + "interpolate": 384, + "surface": 384, + "spconstant": 78, + "spsampler": 330, + "spfail": 4, + "sppoints": 768, + "sprange": 13536, + "greset": 368, + "gconst": 3414, + "ggradient": 672, + "gbind": 768, + "gcache": 2870, + "gsame": 1808, + "gslice": 272, + "gunary": 832, + "gbinary": 960, + "gclamp": 384, + "gchoice": 128, + "glerp": 128, + "ginterp": 368, + "gsurface": 256, + "ginfo": 17906, + "gtry": 3900, + "gcompile": 18282, + "gdistance": 128, + "ginterval": 1024, + "gsconstant": 1120, + "gspline": 2160, + "gspoints": 1456, + "gseed": 70, + "gregister": 326, + "gready": 70, + "ginstance": 640, + "goffset": 262, + "gnoise": 838, + "gblended": 64, + "gend": 128, + "round": 1576, + "ground": 880, + "power": 1456, + "gpow": 1552, + "wfield": 96, + "blenddensity": 96, + "wcontext": 20416, + "gwfield": 96, + "gblenddensity": 176, + "gref": 288, + "gnamed": 224, + "glookup": 64 + }, + "inputs_sha256": "3bb59de57994936c7347c504b212900f9ec7c3c3eff1f0e49c051b46d23bed97", + "rust_output_sha256": "e1fcf55d697acd4d0f6470079416c5cae2cbc75d524f8f7aee50b5555f2c330d", + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDensityOracle.java": "0be907c58f2bb35f924b1c42919397cdfc0c38f7be500e26c5d462f46aaf1f08", + "tools/test_density_parity.py": "ab052eb065a0ae0c0469e95335b952153adbb01f46b5d12ad075fc1a5a8ec0d0", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "69f89566a78456c29caaa39dacedfe711ca59e49b78f64e68b0414fb6a73d8fc", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "3968e2a337a6a23226c485057c79359e66df16683f00fb4ebc9fabb03910a015", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-core/tests/density_world_fields.rs": "e193e45080817ef92547828a8d106482a376b9f788e39d4d3831f44e9d693148", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "faae2edce8b573fd32fcb4bd1f898be7d700a5b38479439f5bec96df764688fd" + }, + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "e1fcf55d697acd4d0f6470079416c5cae2cbc75d524f8f7aee50b5555f2c330d", + "matched_output_lines": 15524627 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "e1fcf55d697acd4d0f6470079416c5cae2cbc75d524f8f7aee50b5555f2c330d", + "matched_output_lines": 15524627 + } + ], + "scope": "Compiled constant, clamped/repeated/mirrored gradient, unshifted and XZ/XYZ shifted noise, all eleven vanilla unary operators and constant-operand specializations, binary arithmetic/min/max, power with constant base/exponent samplers, floor/nearest/ceil/truncate rounding to integer or sampled multiples, range choice and linear interpolation with constant-branch/endpoint specializations; multi-threshold and single-threshold selection; shift/shift-A/shift-B offset samplers; old blended terrain noise definition ranges, ordered smeared FBM construction, scalar/bulk composition and failure RNG state; distance metrics and distance-to-point samplers with wrapped differences; cached and uncached density contexts, nested cache nodes, scalar/volume hits, packed-coordinate key collisions, NaN misses and zero-initialized failure buffers, exact lattice lookup; X/Y/Z and combined XZ slices, reduced-volume bulk evaluation, unchanged-volume delegation, nested and cached children; positive-cell grid interpolation with aligned delegation, eight-corner scalar sampling, repeated-addition bulk columns and dense-then-strided selection; raw and Y=0-sliced surface-height search with scalar density probes, bulk upper bounds, strict positive crossing, saturating floor conversion and wrapped cell alignment, early lower-bound return and single-layer validation; nested cubic splines with endpoint extrapolation, binary interval selection, compact coordinate IDs, lazy scalar/volume coordinate caches, repeated NaN scalar misses and partial output failures, constant-NaN compile rejection and conservative spline range propagation; interval construction, hulls, arithmetic/min/max, reciprocal, abs/square/sign, powers and logarithms, clamp, monotonic endpoint mapping, finite/infinite interpolation, predicates, equality and Java hashes; scalar and strided bulk paths, signed/wrapped integer coordinates, nested child bulk evaluation, unary/leaf buffer tails, exact-volume multi-input buffers, scalar short circuits, NaN/signed-zero differences between scalar and bulk min/max, arithmetic failures and partial writes. Finite outputs and signed zeros compared by bits; NaNs canonicalized. Initial integrated density graph compiler for constants, gradients, all eleven unary and six binary operations, power, rounding, clamp, range choice, lerp, interval selection, distance-to-point, slices, caches, interpolation, surface search, nested cubic splines, registered normal and shifted noise, offset noise, old blended noise and outer End island density: structural interning, range/axis metadata, constant and disjoint-range specialization, uniform-axis slicing, cache-ID allocation/deduplication, memoized roots and failed preparation state are compared with vanilla. Seeded normal-noise lookup, modern/legacy positional factories, named instance reuse, dedicated Nether legacy branches and old blended terrain seed selection are checked against vanilla RandomState's actual compile context. Power samplers retain base/exponent evaluation order, literal-base precedence, sqrt/identity/square/cube exponent specialization, negative-exponent reciprocal composition for sqrt/identity/square/cube and the direct signed-exponent fallback, f64 constant operands, buffer tails and partial writes. Power ranges check exact and interval exponents, signed-zero bases, negative bases with integer exponent bounds, infinite exponents and NaI hulls. Log and square-root graphs check partially invalid domains, range clipping, cache preparation, scalar/bulk composition and trusted bound metadata. Rounding checks positive-infinity ties, int saturation, signed zeros, NaNs, infinite and zero multiples, literal-one specialization, dynamic-multiple child order, declared range propagation, cache preparation and partial input writes on multiple failure. End islands use the dedicated legacy world-seed stream, 17,292 discarded draws, simplex island threshold, truncated negative coordinates, wrapped integer edges, vertical bulk columns and nested/cache/spline/interpolation graphs. Context-bound alpha, offset and structure-density samplers compare fallback/custom fallback, missing/bound fields, declared metadata independent of bindings, same-context delegation, scalar/bulk child calls, failure writes, constant tails, cache namespaces, uniform-axis slicing and nested spline/arithmetic/interpolation graphs. Blend-density wrappers compare absent and actual EMPTY vanilla Blender contexts, input-first evaluation and input metadata propagation; nonempty old-world Blender math remains pending. Direct and registered density holders compare structural value versus holder identity, named lookup, raw delegation and metadata, one-level reference inlining before cache detection, nested holder rewrite replacement, constant specialization, cache allocation/deduplication and memoized roots. Remaining graph definitions, remaining range integration, codecs, world-dependent samplers and terrain integration remain pending; no complete terrain, gameplay, rendering or performance claim." +} diff --git a/benchmarks/rust-dynamic-support-2026-10-06/scoped-parity.json b/benchmarks/rust-dynamic-support-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..2b1faf4b7 --- /dev/null +++ b/benchmarks/rust-dynamic-support-2026-10-06/scoped-parity.json @@ -0,0 +1,182 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "uncached_states": 199, + "collision_fixtures": 60161, + "shulker_progress_fixtures": 13014, + "active_piston_fixtures": 9216, + "fixtures": 107308, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDynamicSupportOracle.java": "d608e197b5b48d3a3ed522e72427610343dede1146e24bf5d17c6f046b480b57", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceSupportOracle.java": "9ce939a435842867786fed648951bbe77f6ab843f6df09af15f3deb1948c4877", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "02acfbae94aee306c5a4e1db7c86c68f7d6156ddd3dd477dc9e9d06e5ca98118", + "tools/test_dynamic_support_parity.py": "6652e6284f7da62787a5fc03332950dba0b2c4b81348d22421617b658d3d7ce1", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_properties.rs": "e74b368012d4d440dcdbd4d9bcaf80495220b90557f0e0c733b0aa21ad03c53c", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "cf97e26f839a393687922e4b74ecbe140a048ee6eeab98b4d19818e6dc3bea3e", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "8a2834a9347ee2c2db7cf1c86a064907ec06e9ac16ba9cc3936e315fc4ad49ca", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "09f697d8d4e709acacc8e9f7c35c5fd307bab6ab0df4a1339fe760afc655cdab", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_feature.rs": "6be7c0161cecf1362c196e91ecbeb166e16c8da3731d988ce8f2308f06209265", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "486fe9d8588eb09e0ee5707a0541b0df167b63b0b56c90a2709bfa09a0a3ad19", + "crates/horizon-world/src/worldgen/feature_graph.rs": "fe61a5e43179a7588737a71782ea246811fe2c8721e74793e1ac018c8eb93c34", + "crates/horizon-world/src/worldgen/feature_region.rs": "2c78e5f1bdb08307f8d982f231f1abbc3306cd54348d9023b86ee6ed3516fd33", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "e682d13a21f90605215b79f5d254bf2e524d35e89eab2e3b46384709af80b847", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "cd1d2fe305ad4e205e7e01b32128ff895fa8aacc76fa11f200ad6c7c9fba1f49", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "fa0616353f07460975ab323357ab280b7f35e7bfe2de6edc08d304316766ed26", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "89cb0410899608545aa1ba3b1b4c1babf533fb25efd341feab1c87661f44f7b9", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "821981c893fc84312351503f2be0c06c681d8bc768dade14576697cf047a9f8f", + "crates/horizon-world/examples/dynamic_support_fixture.rs": "5ab94e91a419b43d5644f13f7d7e39b3bc60b95f625ae78b43d50543b84997a7" + }, + "fixtures_sha256": { + ".local/rust-dynamic-support-parity/inputs.txt": "2d24447d3bbcd56ab60a6d485fcae13f6e723d57090280a9597ac073763903fe", + ".local/rust-dynamic-support-parity/facts.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-dynamic-support-parity/uncached-states.json": "0e4a57a4ac3e1cde7463b2245d2d76f776d572628eb3ad4a0bbc11184ef7afc3", + ".local/rust-dynamic-support-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-dynamic-support-parity/cached-collision.nbt": "f3a5c6a5b2d51dad6c52e486e2b9989e79fd55db1a9bda6196db399550b04078" + }, + "rust_output_sha256": "9eee435b8d88db41ae17ff424f122f63e6cda51bdab5f6069160d781b6a038a7", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "9eee435b8d88db41ae17ff424f122f63e6cda51bdab5f6069160d781b6a038a7", + "matched_output_lines": 4867780 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "9eee435b8d88db41ae17ff424f122f63e6cda51bdab5f6069160d781b6a038a7", + "matched_output_lines": 4867780 + } + ], + "scope": "Actual native support-shape and no-entity-context collision selection, block offsets and all support directions/types for the 199 uncached states. Bamboo, speleothem thickness/direction, scaffolding, powder snow and shulker support are compared over coordinate boundaries and privately allocated block-entity snapshots, including animation state, absent/wrong entity types and failures. Collision checks additionally cover exact shulker bounds and shape representation over progress interpolation boundaries and deterministic finite progress pairs. Moving-piston selection also delegates to actual native entity collision generation for active snapshots; Rust composes the independently tested piston algorithm with registry collision shapes across extension/retraction, source heads, progress boundaries, noclip directions and world-query failures. Entity lifecycle, ticking/pushing and full gameplay remain pending." +} diff --git a/benchmarks/rust-entity-obstruction-2026-10-06/scoped-parity.json b/benchmarks/rust-entity-obstruction-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..64dcf886b --- /dev/null +++ b/benchmarks/rust-entity-obstruction-2026-10-06/scoped-parity.json @@ -0,0 +1,164 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 5254, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityObstructionOracle.java": "90fbb4438ac9dbfb0705138ece57bc418ca97e73bddb2fbdfc10609b2aefc42f", + "tools/test_entity_obstruction_parity.py": "769d478003e91902e103503a128f88e7be595462213b78dd1c1ef8b76d96a105", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "8a2834a9347ee2c2db7cf1c86a064907ec06e9ac16ba9cc3936e315fc4ad49ca", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "2cfc358d87afa4b6e45247ef799114d33c2e0930f7aa7b2106cd4756ca007f5e", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_feature.rs": "d8b2d3f19f49a0a60c913596f5a8f5fcb5be2e8633c9910e4e583e5d85916bde", + "crates/horizon-world/src/worldgen/block_predicate.rs": "4f8e0782db36423b4968dfc35633ff5ae4394b3eb6b97fd94c18b8df92a61929", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "486fe9d8588eb09e0ee5707a0541b0df167b63b0b56c90a2709bfa09a0a3ad19", + "crates/horizon-world/src/worldgen/feature_graph.rs": "fe61a5e43179a7588737a71782ea246811fe2c8721e74793e1ac018c8eb93c34", + "crates/horizon-world/src/worldgen/feature_region.rs": "2c78e5f1bdb08307f8d982f231f1abbc3306cd54348d9023b86ee6ed3516fd33", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "e682d13a21f90605215b79f5d254bf2e524d35e89eab2e3b46384709af80b847", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "2f9849fcd492d0b987a15857607004a95380deff4217c48cbbf02a27339b3aa3", + "crates/horizon-world/src/worldgen/placement/context.rs": "bc0ad613ba599b825bdc3e746b6618e5d427d01e0729287269d452e4c7018143", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "fa0616353f07460975ab323357ab280b7f35e7bfe2de6edc08d304316766ed26", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "64a9ecb17f3567d5928de9959702a8f45e75b36a3227342ef392a8f840d18d18", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "821981c893fc84312351503f2be0c06c681d8bc768dade14576697cf047a9f8f", + "crates/horizon-world/examples/entity_obstruction_fixture.rs": "1fdb7c690d59fbc8431bb846121f2935c79b69eafc2afbe4250668c0a984302f" + }, + "fixtures_sha256": { + ".local/rust-entity-obstruction-parity/inputs.txt": "dc4094ffbb54a57a36df53927c6b07fbd46338b11c5ce356b4a10544d848afeb" + }, + "rust_output_sha256": "e7f66070f9980b005a79012c408cd32ba0df4bcdee8b7409e4225e48de2f6eb1", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "e7f66070f9980b005a79012c408cd32ba0df4bcdee8b7409e4225e48de2f6eb1", + "matched_output_lines": 15121 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "e7f66070f9980b005a79012c408cd32ba0df4bcdee8b7409e4225e48de2f6eb1", + "matched_output_lines": 15121 + } + ], + "scope": "Actual EntityGetter.isUnobstructed, its default non-spectator query, Entity removal/root-vehicle methods and voxel intersection execute over privately allocated entity snapshots. Empty shapes, excluded identities, spectators, removed/non-building entities, same-root vehicle exclusions, ordered broad-phase queries and selected candidates, thin boxes, boundary contacts, composite shapes and query failures are compared. Entity construction, lifecycle, spatial indexing, vehicle maintenance and full gameplay remain pending." +} diff --git a/benchmarks/rust-face-support-2026-10-06/scoped-parity.json b/benchmarks/rust-face-support-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..5fc447943 --- /dev/null +++ b/benchmarks/rust-face-support-2026-10-06/scoped-parity.json @@ -0,0 +1,167 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 1615, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceSupportOracle.java": "9ce939a435842867786fed648951bbe77f6ab843f6df09af15f3deb1948c4877", + "tools/test_face_support_parity.py": "a8d09fd0f2e7d9e5bf651dd86e4fe08ff025c596e0c5e15bea42ec8aadcf1fd9", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_properties.rs": "e74b368012d4d440dcdbd4d9bcaf80495220b90557f0e0c733b0aa21ad03c53c", + "crates/horizon-world/src/block_support.rs": "1c8676c3e85743bc8f64ba30bea52842703e4acce312da8389a5761d0cd112e3", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "8a2834a9347ee2c2db7cf1c86a064907ec06e9ac16ba9cc3936e315fc4ad49ca", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "9f1c2f81745412ccdac0ddf7b5edd33077059e14d498ff8e6b6b385b0a8c9f6a", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_feature.rs": "7c8f628601a6d835d913c034b0d421a8f83bee6c569033448aac99123ed84a2c", + "crates/horizon-world/src/worldgen/block_predicate.rs": "b5c02b44e759a121d8b4a977e2c52874ab2eaf3aa787a15bae7f5c7eaa2ce503", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "486fe9d8588eb09e0ee5707a0541b0df167b63b0b56c90a2709bfa09a0a3ad19", + "crates/horizon-world/src/worldgen/feature_graph.rs": "fe61a5e43179a7588737a71782ea246811fe2c8721e74793e1ac018c8eb93c34", + "crates/horizon-world/src/worldgen/feature_region.rs": "2c78e5f1bdb08307f8d982f231f1abbc3306cd54348d9023b86ee6ed3516fd33", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "e682d13a21f90605215b79f5d254bf2e524d35e89eab2e3b46384709af80b847", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "2f9849fcd492d0b987a15857607004a95380deff4217c48cbbf02a27339b3aa3", + "crates/horizon-world/src/worldgen/placement/context.rs": "bc0ad613ba599b825bdc3e746b6618e5d427d01e0729287269d452e4c7018143", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "fa0616353f07460975ab323357ab280b7f35e7bfe2de6edc08d304316766ed26", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "647f253a7d14d724086b4d146f26295e0da825df86f4adbd6a0e367d5198f3d5", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "821981c893fc84312351503f2be0c06c681d8bc768dade14576697cf047a9f8f", + "crates/horizon-world/examples/face_support_fixture.rs": "25c2a1505ff3ff323228390d0b059985927bed82173a3ff1a9985ad382e7a563" + }, + "fixtures_sha256": { + ".local/rust-face-support-parity/inputs.txt": "317b3e7d2b9df64adb1ec4e034f7c6951eb6363b627e890794589220a17021d1" + }, + "rust_output_sha256": "7d4af4acb31cf95e8f512fda8a623d047fa4651b3845354cac36f6d7cd2c3a4a", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "7d4af4acb31cf95e8f512fda8a623d047fa4651b3845354cac36f6d7cd2c3a4a", + "matched_output_lines": 595686 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "7d4af4acb31cf95e8f512fda8a623d047fa4651b3845354cac36f6d7cd2c3a4a", + "matched_output_lines": 595686 + } + ], + "scope": "Actual VoxelShape.getFaceShape and nested face slicing, shape identity/cache reuse, exact coordinate metadata, extrema, bounds and decomposition, plus FULL/CENTER/RIGID SupportType algorithms over caller-supplied support shapes. Sparse grids, phantom slice bounds, cube/array lookup, epsilon boundaries and translations are included. Per-block support-shape selection, world/entity context, survival and full gameplay remain pending." +} diff --git a/benchmarks/rust-feature-catalog-2026-10-06/scoped-parity.json b/benchmarks/rust-feature-catalog-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..f7dc0483a --- /dev/null +++ b/benchmarks/rust-feature-catalog-2026-10-06/scoped-parity.json @@ -0,0 +1,181 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 6408, + "worldgen_random_modes": [ + false, + true + ], + "basic_features": 3, + "composition_features": 6, + "definitions": 89, + "block_states": 35723, + "configured_block_features": 3, + "named_features": 9, + "named_placed_features": 14, + "tag_files": 5, + "requested_placements": 12816, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureCatalogOracle.java": "28adc261de263896b32dc7e196bc0091060677b73823d2babbe829a35f1f9f0d", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "tools/test_feature_catalog_parity.py": "2f85e37a24361bd64b0abf8620cb0e3c3b80bf2f69bc9aa1de957e39cb96c547", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/fluid.rs": "8a2834a9347ee2c2db7cf1c86a064907ec06e9ac16ba9cc3936e315fc4ad49ca", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "06aa7b44e1229b3cf50abcf3827f2cacd7ae54321865873bdba0f371cb458b3f", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_feature.rs": "f8c2ef2de1cfe9a8689a7375d4bf0cc00431484e06f6d4b2b95aabac8fdfffb0", + "crates/horizon-world/src/worldgen/block_predicate.rs": "8513e9d96c8626594b5ee078bf20ccf3de90fc9f9d7123780d1cab5eefb6b5c2", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "297524aefeb4567c5f5c0c1678013e44002eb91ca16ee63b51ffacf93f31a095", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "486fe9d8588eb09e0ee5707a0541b0df167b63b0b56c90a2709bfa09a0a3ad19", + "crates/horizon-world/src/worldgen/feature_graph.rs": "fe61a5e43179a7588737a71782ea246811fe2c8721e74793e1ac018c8eb93c34", + "crates/horizon-world/src/worldgen/feature_region.rs": "2c78e5f1bdb08307f8d982f231f1abbc3306cd54348d9023b86ee6ed3516fd33", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "e682d13a21f90605215b79f5d254bf2e524d35e89eab2e3b46384709af80b847", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "08ee8697f589e96b69653b395238eecd144d51cfec30017214275f9b338d82af", + "crates/horizon-world/src/worldgen/placement/context.rs": "c916b30177e283e8eedfa342dc5282b42c898a2873668b44f59c83501ff866bd", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "fa0616353f07460975ab323357ab280b7f35e7bfe2de6edc08d304316766ed26", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "d1097d91b43e30cec38b09365d3ed58f15522b829feb584e255718447e4c68b4", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "b08f074f54f451c24795d5dda68968165b84b8d762d244f0444a8d62de61820e", + "crates/horizon-world/examples/feature_catalog_fixture.rs": "fe03581cad3593d7fae403251ec2a1cde0fc87f958cd42a70ec5f3d0c6840715" + }, + "fixtures_sha256": { + ".local/rust-feature-catalog-parity/inputs.txt": "b0ee5e1737bd138c7997086cb20c2324cc63a70a5966aad1372c40264a62d32e", + ".local/rust-feature-catalog-parity/catalog.json": "5dc542269399635bbe3f82deb0916bba9052c62ec9328306f3e70c24f26a4443", + ".local/rust-feature-catalog-parity/facts-client.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-feature-catalog-parity/facts-server.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b" + }, + "rust_output_sha256": "4f6cb77afc2bb55c744e1b3c1b726eeba7655e500ff0df3913e6dc7ce6228f4e", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "4f6cb77afc2bb55c744e1b3c1b726eeba7655e500ff0df3913e6dc7ce6228f4e", + "matched_output_lines": 1734390 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "4f6cb77afc2bb55c744e1b3c1b726eeba7655e500ff0df3913e6dc7ce6228f4e", + "matched_output_lines": 1734390 + } + ], + "scope": "Actual Feature.CODEC and PlacedFeature.CODEC bind named and inline holders through RegistryOps and registered feature/placed-feature snapshots. Native TagLoader resolves ordered nested, duplicate, empty, optional-missing and required-missing placed-feature tags. Root holders, named children, tag lists, mixed inline/named lists, namespace shorthand, unknown names and unselected malformed children are compared. Registry-bound fill-layer, single-block replacement and scattered-ore states execute through named roots, nested tags and composed placement. Registry-bound matching-block/fluid predicates also execute through filters, ordered volumes, environment scans and composed named features against the mutable world, including a flowing-water fill followed by repeated fluid-filtered replacement. Actual feature algorithms, nested placement, ordered world mutations, rejected writes, partial failures and direct and WorldgenRandom-wrapped legacy/xoroshiro streams execute through the same mutable world transport. Rust expands requested immutable resource roots with bounded dependency/node traversal; unused resources, cyclic references, registry reload/lifecycle, encoding, all feature algorithms and complete world generation remain outside this comparison." +} diff --git a/benchmarks/rust-feature-graph-2026-10-06/scoped-parity.json b/benchmarks/rust-feature-graph-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..529fd53d9 --- /dev/null +++ b/benchmarks/rust-feature-graph-2026-10-06/scoped-parity.json @@ -0,0 +1,159 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 3885, + "basic_features": 3, + "composition_features": 6, + "definitions": 105, + "block_states": 5, + "composed_fixtures": 105, + "requested_placements": 7770, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureGraphOracle.java": "27d25432c07f6d9af7b3d5de5f7ea231ae59b9e3439fa83195e9fa05f95ce8ea", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", + "tools/test_feature_graph_parity.py": "d12fcefa11c1b6971819157528326fd8f80b28d4c5329c9f13dd567e0e11ee9c", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "32b937832b7058d86e8557a2012df32be1c97be324f15d0ae85245c45c73b314", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_predicate.rs": "dd8cbda2ec110444950f0b31bf4e088897eab0994674a91568c7b063f8f16210", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "4b445c59c37738ce7dd1cb52234b8743fef68642f6ea9fbb41032e4101617dfb", + "crates/horizon-world/src/worldgen/feature_graph.rs": "36a0017782b6d1d4f4fe419698467646cec447838e8b86f96cfc2ed40b632a4f", + "crates/horizon-world/src/worldgen/feature_region.rs": "4a95a30c0987d97e671f84380e13ddea070ad81f996baa65b2a06c4d892971c7", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/placement/chain.rs": "1b976aa4dd2516468196d0af3451e3fdd037493a14d269f54ebdd7254055e05e", + "crates/horizon-world/src/worldgen/placement/context.rs": "b36dfd9297896e62770f2085cf934fc08ebd4c030ecc7ae17d864e819a113201", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "68ecf36954fea5705436d486e9be93836933fd56779022afeb881a0399d6a674", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "7516e20a20479d1c4a9734d7d8e9826740b324869d7afe51eab94bb1bc7c97ae", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/value_provider.rs": "ad1c0efffcc201839e3471d7dfa06c39307d8cbabddb4c5aed8389ee7b68737a", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "c40017f3449b57558921e1c968b4998f9d32d9d16054ef1741a0d8edc4478489", + "crates/horizon-world/examples/feature_graph_fixture.rs": "5999d3902d8980dd46cfe172ab026adba012e33237b0184f7995318c60c6c499" + }, + "fixtures_sha256": { + ".local/rust-feature-graph-parity/inputs.txt": "10a2c498d0b8ca151715c93de61eaf8b04e5b83a882c117eb26627ff5ca183b4", + ".local/rust-feature-graph-parity/facts-client.json": "6c8d9aeb824f4150293f5d6a580d3347d866589b3eeee185a2c18479f5c64b0a", + ".local/rust-feature-graph-parity/facts-server.json": "6c8d9aeb824f4150293f5d6a580d3347d866589b3eeee185a2c18479f5c64b0a" + }, + "rust_output_sha256": "a0e074e6ae8f81d383c33deafce607285c27f461ac970734983018054bee5127", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "a0e074e6ae8f81d383c33deafce607285c27f461ac970734983018054bee5127", + "matched_output_lines": 737779 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "a0e074e6ae8f81d383c33deafce607285c27f461ac970734983018054bee5127", + "matched_output_lines": 737779 + } + ], + "scope": "Actual Feature.DIRECT_CODEC and native no-op, sequence, random-boolean-selector, simple-random-selector and chance-based random-selector and weighted-random-selector features compose three native block-writing features through inline PlacedFeature holders and actual nested FeaturePlacer calls. Ordered writes, reads, flags, accumulated states, boolean results, rejected writes, partial failures, shared randomness and top-level modifier chains are compared. Sequence short-circuiting, selector return propagation and empty/all-zero weighted choices without random draws are included. Named registry holders/tags, encoders, full feature registries and complete generated worlds remain pending. Rust bounds decode depth/nodes/lists, nested execution depth and feature/placed-feature visits; nested modifier-chain execution shares the feature work budget." +} diff --git a/benchmarks/rust-feature-placement-2026-10-06/scoped-parity.json b/benchmarks/rust-feature-placement-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..b0c66f7ae --- /dev/null +++ b/benchmarks/rust-feature-placement-2026-10-06/scoped-parity.json @@ -0,0 +1,160 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 5544, + "modifier_chains": 80, + "requested_placements": 22176, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeaturePlacementOracle.java": "537f5926111131960e2fdf3e5a0c2f21b46fda629286831f9d9528fe1390afe0", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", + "tools/test_feature_placement_parity.py": "6b158d8f63296660ecb362310ffd9f1cdadebfe213352bc9acb147ff5c129345", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "32b937832b7058d86e8557a2012df32be1c97be324f15d0ae85245c45c73b314", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_feature.rs": "c215156f2ecf7faf214b3d89e0829b65d54f4ff6d134d778ec941f18a606a327", + "crates/horizon-world/src/worldgen/block_predicate.rs": "dd8cbda2ec110444950f0b31bf4e088897eab0994674a91568c7b063f8f16210", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "486fe9d8588eb09e0ee5707a0541b0df167b63b0b56c90a2709bfa09a0a3ad19", + "crates/horizon-world/src/worldgen/feature_graph.rs": "2297b194514925688dba25016a69d5ba5eb8b869bdfff28f2e611a6742ac5954", + "crates/horizon-world/src/worldgen/feature_region.rs": "4a95a30c0987d97e671f84380e13ddea070ad81f996baa65b2a06c4d892971c7", + "crates/horizon-world/src/worldgen/feature_sort.rs": "0b9d1e1c15d8449125d39e400776b8f28eec7b7cbd047660a94f8cb90160adfe", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9bce6b17b60fec575d810713d9fb2714780aadbbc973db969c07cf4455201847", + "crates/horizon-world/src/worldgen/placement/context.rs": "f8fa467d3b931d0f98d3572fbc80c659d452a7fc5755d5c98123dc477c2b541c", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "c39c0b5f761fd573ff2f2a1d9d42901305995cc88f5c4ca3a49aaa4ef5dd933b", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/value_provider.rs": "ad1c0efffcc201839e3471d7dfa06c39307d8cbabddb4c5aed8389ee7b68737a", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "55c4317bd9c782378de7c2a7d58be5aa08febc5b8f2f4b86379a39e0ba500b3c", + "crates/horizon-world/examples/feature_placement_fixture.rs": "0c46c49a53cb962ef86c2af81842a969e9fbc5266f84f7710870af0b781d48e2", + "crates/horizon-world/examples/support/placement_queries.rs": "623b98c33245cb584d666a06bd5a3ddf7f19bf77e0ea9dc67be9a242086c063c" + }, + "fixtures_sha256": { + ".local/rust-feature-placement-parity/inputs.txt": "193b18bbac342a2dbcd70a3bc1c88a694ac042ae30fd76f8015d87a6d57d7f34" + }, + "rust_output_sha256": "52ccd98ab6617d3b21694d1033851a1782d2eee5595f027113bd6d635b0e9190", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "52ccd98ab6617d3b21694d1033851a1782d2eee5595f027113bd6d635b0e9190", + "matched_output_lines": 548461 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "52ccd98ab6617d3b21694d1033851a1782d2eee5595f027113bd6d635b0e9190", + "matched_output_lines": 548461 + } + ], + "scope": "Actual native FeaturePlacer executing decoded placement-modifier chains with a synthetic Feature sink. Empty chains, repeated modifiers, nested random choices, count expansion, filtering, fixed positions, offsets, anchored heights heightmap filters and layered scans are compared. Sink callbacks emit positions, optionally consume the shared random stream, return true/false/mixed results or fail after partial placement. The same native placer is reused across calls, including after errors, exposing retained pending and modified-position buffers. Both random modes, repeated calls, ordinary and overflowing generation contexts and subsequent nextLong values are compared. Predicate filtering and vertical environment scans compare bounds-query order, short-circuiting and failures. Traced heightmap queries include synthetic extreme heights, distinct world/generation minima and injected failures. Configured feature algorithms, block queries, biome checks, registry lifecycle, nested feature placement, Gaussian providers, encoding and complete world generation remain pending. Rust bounds chain length to 1024 and pending/output work to 2^20." +} diff --git a/benchmarks/rust-feature-region-2026-10-06/scoped-parity.json b/benchmarks/rust-feature-region-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..dbb26ff03 --- /dev/null +++ b/benchmarks/rust-feature-region-2026-10-06/scoped-parity.json @@ -0,0 +1,169 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "block_states": 35723, + "block_tag_files": 300, + "fixtures": 192, + "worldgen_random_modes": [ + false, + true + ], + "resident_chunks_per_fixture": 9, + "requested_placements": 2304, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureRegionOracle.java": "5a4cabc6e5c79a0af42b4b840d4fb48e206d146c336af89b919fd47e922bda20", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", + "tools/test_feature_region_parity.py": "fceba45d5aa9bb2c137350f1df70f4ba64ea65c4179a50920e713a2669bf4e28", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "32b937832b7058d86e8557a2012df32be1c97be324f15d0ae85245c45c73b314", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_feature.rs": "c215156f2ecf7faf214b3d89e0829b65d54f4ff6d134d778ec941f18a606a327", + "crates/horizon-world/src/worldgen/block_predicate.rs": "dd8cbda2ec110444950f0b31bf4e088897eab0994674a91568c7b063f8f16210", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "486fe9d8588eb09e0ee5707a0541b0df167b63b0b56c90a2709bfa09a0a3ad19", + "crates/horizon-world/src/worldgen/feature_graph.rs": "2297b194514925688dba25016a69d5ba5eb8b869bdfff28f2e611a6742ac5954", + "crates/horizon-world/src/worldgen/feature_region.rs": "4a95a30c0987d97e671f84380e13ddea070ad81f996baa65b2a06c4d892971c7", + "crates/horizon-world/src/worldgen/feature_sort.rs": "0b9d1e1c15d8449125d39e400776b8f28eec7b7cbd047660a94f8cb90160adfe", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "1b976aa4dd2516468196d0af3451e3fdd037493a14d269f54ebdd7254055e05e", + "crates/horizon-world/src/worldgen/placement/context.rs": "b36dfd9297896e62770f2085cf934fc08ebd4c030ecc7ae17d864e819a113201", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "68ecf36954fea5705436d486e9be93836933fd56779022afeb881a0399d6a674", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/value_provider.rs": "ad1c0efffcc201839e3471d7dfa06c39307d8cbabddb4c5aed8389ee7b68737a", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "55c4317bd9c782378de7c2a7d58be5aa08febc5b8f2f4b86379a39e0ba500b3c", + "crates/horizon-world/examples/feature_region_fixture.rs": "7f915c3795e16bc8e2b156c6b3a5d4f2b24f786fdd2ee64eb5159adef7170255" + }, + "fixtures_sha256": { + ".local/rust-feature-region-parity/inputs.txt": "c6ac6ff43c8da61a74dec0e7e72b80da5d2abed0c5a2277f921247cf8dcb04db", + ".local/rust-feature-region-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0", + ".local/rust-feature-region-parity/facts-client.json": "1d24883ee807b0b71473f0bbf8ed548ddaf712148caeb3fcc7aa13ab973a97b0", + ".local/rust-feature-region-parity/facts-server.json": "1d24883ee807b0b71473f0bbf8ed548ddaf712148caeb3fcc7aa13ab973a97b0" + }, + "rust_output_sha256": "93b8b0b9900d2cab972f4d50d4ba9a580db725a20dbc2ebb7fee723af414fc31", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "93b8b0b9900d2cab972f4d50d4ba9a580db725a20dbc2ebb7fee723af414fc31", + "matched_output_lines": 28922634 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "93b8b0b9900d2cab972f4d50d4ba9a580db725a20dbc2ebb7fee723af414fc31", + "matched_output_lines": 28922634 + } + ], + "scope": "Native FeaturePlacer and three basic block-writing features, a composed sequence of four configured fill layers, single-block replacements and scattered ore share a world proxy backed by nine actual ProtoChunks. Configured water, horizontal logs, air, out-of-height fills and ore/replacement rules test graph-to-region binding. Initial two-layer stone/dirt terrain, both pre-light heightmap groups, count/square/heightmap/layered modifier chains, repeated placements, direct and WorldgenRandom-wrapped random streams, missing-neighbor errors, rejected writes and injected partial failures are compared. Final complete raw sections, heightmap presence and packed words are compared alongside ordered feature writes, update flags, explicit height queries and subsequent random draws. Rust uses resident registry-backed chunks, lazy heightmap priming and a caller-supplied write callback; imported air/fluid facts and bundled block tags bind independently across authenticated JARs. The proxy supplies storage mutation only. Actual WorldGenRegion construction, write-zone policy, POIs, block entities, postprocessing effects, lighting, complete feature registries and complete world generation remain outside this comparison." +} diff --git a/benchmarks/rust-feature-sort-2026-10-06/scoped-parity.json b/benchmarks/rust-feature-sort-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..9ace2a9c1 --- /dev/null +++ b/benchmarks/rust-feature-sort-2026-10-06/scoped-parity.json @@ -0,0 +1,156 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 3871, + "biomes": 67, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureSortOracle.java": "cbb527d2a204197bf344597487164e6948f9894641971899e8d023d0b3603abe", + "tools/test_feature_sort_parity.py": "ba745b738c3181c432c77c939126ed8f41fa7bc0430c1900d909f2ed50e5fdd6", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "32b937832b7058d86e8557a2012df32be1c97be324f15d0ae85245c45c73b314", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_feature.rs": "c215156f2ecf7faf214b3d89e0829b65d54f4ff6d134d778ec941f18a606a327", + "crates/horizon-world/src/worldgen/block_predicate.rs": "dd8cbda2ec110444950f0b31bf4e088897eab0994674a91568c7b063f8f16210", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "486fe9d8588eb09e0ee5707a0541b0df167b63b0b56c90a2709bfa09a0a3ad19", + "crates/horizon-world/src/worldgen/feature_graph.rs": "2297b194514925688dba25016a69d5ba5eb8b869bdfff28f2e611a6742ac5954", + "crates/horizon-world/src/worldgen/feature_region.rs": "4a95a30c0987d97e671f84380e13ddea070ad81f996baa65b2a06c4d892971c7", + "crates/horizon-world/src/worldgen/feature_sort.rs": "0b9d1e1c15d8449125d39e400776b8f28eec7b7cbd047660a94f8cb90160adfe", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "1b976aa4dd2516468196d0af3451e3fdd037493a14d269f54ebdd7254055e05e", + "crates/horizon-world/src/worldgen/placement/context.rs": "b36dfd9297896e62770f2085cf934fc08ebd4c030ecc7ae17d864e819a113201", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "68ecf36954fea5705436d486e9be93836933fd56779022afeb881a0399d6a674", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/value_provider.rs": "ad1c0efffcc201839e3471d7dfa06c39307d8cbabddb4c5aed8389ee7b68737a", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "55c4317bd9c782378de7c2a7d58be5aa08febc5b8f2f4b86379a39e0ba500b3c", + "crates/horizon-world/examples/feature_sort_fixture.rs": "36dc9257be8b823a8dfb632934c56a5bdb733911d470fa8015506b1febc4225c" + }, + "fixtures_sha256": { + ".local/rust-feature-sort-parity/inputs.txt": "ab3aa064287cc2d3c39f1caf3c3f497270e6b91a7af6581cf0e19a01aeb2b720", + ".local/rust-feature-sort-parity/biome-features.json": "cc3846a9d2eae7e45ba9fd69f07e37a715ce5cb946c9cdbe8a86a471c8a8a975" + }, + "rust_output_sha256": "a20952d4dac7add773c676543ec414dfb0bd498737a293a3c18341951e7ddea8", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "a20952d4dac7add773c676543ec414dfb0bd498737a293a3c18341951e7ddea8", + "matched_output_lines": 411751 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "a20952d4dac7add773c676543ec414dfb0bd498737a293a3c18341951e7ddea8", + "matched_output_lines": 411751 + } + ], + "scope": "Actual FeatureSorter.buildFeaturesPerStep with structurally equal but identity-distinct placed-feature payloads. Ordered per-biome step lists, repeated references, cycles, cross-step reuse, disconnected nodes, empty steps and identity index lookups are compared. Every bundled biome feature list and deterministic shuffled/subset combinations bind named references to stable object identities without executing unported feature algorithms. Rust uses bounded iterative DFS. Cycle diagnostic minimization/text, full registry ownership, decoration seeding and feature execution remain pending." +} diff --git a/benchmarks/rust-fill-layer-2026-10-06/scoped-parity.json b/benchmarks/rust-fill-layer-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..8488d5e86 --- /dev/null +++ b/benchmarks/rust-fill-layer-2026-10-06/scoped-parity.json @@ -0,0 +1,157 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 39541, + "block_states": 35723, + "integer_properties": 146, + "requested_placements": 7636, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFillLayerOracle.java": "17730a2248b4b4c808ef6455a09eb80aaad6cf5d7f6b089f8f617993965da7ea", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "tools/test_fill_layer_parity.py": "4b534276e6d9feb291d1ba965e596efcbef1be97c186dc6cb3bcdc376a57a7b8", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "32b937832b7058d86e8557a2012df32be1c97be324f15d0ae85245c45c73b314", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_feature.rs": "22f571a0e4a0ca4e97413b34edabfb1dec9eaccbb8efcefd3ae140b5cee10200", + "crates/horizon-world/src/worldgen/block_predicate.rs": "dd8cbda2ec110444950f0b31bf4e088897eab0994674a91568c7b063f8f16210", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "486fe9d8588eb09e0ee5707a0541b0df167b63b0b56c90a2709bfa09a0a3ad19", + "crates/horizon-world/src/worldgen/feature_graph.rs": "80f55c85f5e719aa2df293e6f3afa576ee0783eb0aeccd088e4a4866fa426d7c", + "crates/horizon-world/src/worldgen/feature_region.rs": "4a95a30c0987d97e671f84380e13ddea070ad81f996baa65b2a06c4d892971c7", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/placement/chain.rs": "1b976aa4dd2516468196d0af3451e3fdd037493a14d269f54ebdd7254055e05e", + "crates/horizon-world/src/worldgen/placement/context.rs": "b36dfd9297896e62770f2085cf934fc08ebd4c030ecc7ae17d864e819a113201", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "68ecf36954fea5705436d486e9be93836933fd56779022afeb881a0399d6a674", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "7516e20a20479d1c4a9734d7d8e9826740b324869d7afe51eab94bb1bc7c97ae", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/value_provider.rs": "ad1c0efffcc201839e3471d7dfa06c39307d8cbabddb4c5aed8389ee7b68737a", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "bbb07d92a4ba00513c68e437309a7cb80cd0dd676e6e71aa816168e5676dd96d", + "crates/horizon-world/examples/fill_layer_fixture.rs": "af96e1b2659ea5882a0bc5826c5374baf7cf062463846b481d3682d70cfc673b" + }, + "fixtures_sha256": { + ".local/rust-fill-layer-parity/facts-client.json": "5c785e645fd0bfb583e48c30eaf8bbffc185ee5515b158a8cd32a8bc3c508ba6", + ".local/rust-fill-layer-parity/facts-server.json": "5c785e645fd0bfb583e48c30eaf8bbffc185ee5515b158a8cd32a8bc3c508ba6", + ".local/rust-fill-layer-parity/inputs.txt": "afcceccc92af42fa419325a44bf4d0264c345ada72390c168cf53bbd99cb1a64" + }, + "rust_output_sha256": "75cc33fedb778e95c292c3fd9a6c6b1ef5c567b4b904b970f43e9a28fb5e205f", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "75cc33fedb778e95c292c3fd9a6c6b1ef5c567b4b904b970f43e9a28fb5e205f", + "matched_output_lines": 1305274 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "75cc33fedb778e95c292c3fd9a6c6b1ef5c567b4b904b970f43e9a28fb5e205f", + "matched_output_lines": 1305274 + } + ], + "scope": "Actual Feature.DIRECT_CODEC decoding of fill-layer features binds every pinned block state through BlockState.CODEC; selected compact/full states exercise integer properties and invalid-property defaults. Native FillLayerFeature.place traces each world-minimum query, ordered X/Z block reads and conditional writes, flags, rejected writes, thrown minimum/read/write failures and accumulated stored states after repeated calls. Air-state identity and height-limit metadata are independently exported from both authenticated JARs and checked. Extreme wrapping coordinates and world minima, both random modes and untouched subsequent random state are compared. Full world effects, region integration of fill-layer features, other configured block features and complete generated worlds remain pending." +} diff --git a/benchmarks/rust-float-log-2026-10-05/boundary-parity.json b/benchmarks/rust-float-log-2026-10-05/boundary-parity.json new file mode 100644 index 000000000..3cca81044 --- /dev/null +++ b/benchmarks/rust-float-log-2026-10-05/boundary-parity.json @@ -0,0 +1,373 @@ +{ + "schema": 1, + "minecraft": "26.3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "exhaustive": false, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFloatLogOracle.java": "1794510183faa07892761e93094301b69665d4b6a5300ef7117b5482832165f2", + "tools/test_float_log_parity.py": "1ba733163133ea6232a9021fcee5b38255887d62ebab8d1b42e4ccad259b21f3", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "crates/horizon-core/src/bin/density_parity.rs": "ca79feb1ff690557a54dcb3a504967453dd0190ac65d7322512c778048127c5e", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/density/arithmetic.rs": "e42a19893a8d75f8f62b564bd9e527131d87fb469c808422fb8d3b14eb9edac0", + "crates/horizon-core/src/density/cache.rs": "3ccc1268dca96259890279e9f91cb7a099c74b12e6ca2973880d4fa246f7a619", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ede1da60dec40f6df846e44a663bff03c21631c21f2b6e25a58c358115f122a1", + "crates/horizon-core/src/density/graph/mod.rs": "47f1716a8b5fffc1012b9e4654e223b0ff818f00f6a059818ab3dfe8c37e3056", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "3034eccba649851d7a95e276a48472efd70cdf747b54526b565fb0feb88ce43a", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "3e56cc0f6b51c6faa4bd8d9fc259bf01a0c3bf647f36be8be7640971cfe3b334", + "crates/horizon-core/src/density/power.rs": "b18a5b0d524de52a3d1e6028adcddd183424be2913f24d3f098ff56c5e1c6942", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "3968e2a337a6a23226c485057c79359e66df16683f00fb4ebc9fabb03910a015", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "faae2edce8b573fd32fcb4bd1f898be7d700a5b38479439f5bec96df764688fd" + }, + "comparisons": [ + { + "start_bits": 0, + "count": 65536, + "rust_output_sha256": "1e684e3e6b93407fb3f37762a4de01f8706c047cf5294cf9d2a1ac173fc02075", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "1e684e3e6b93407fb3f37762a4de01f8706c047cf5294cf9d2a1ac173fc02075", + "matched_float_values": 65536 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "1e684e3e6b93407fb3f37762a4de01f8706c047cf5294cf9d2a1ac173fc02075", + "matched_float_values": 65536 + } + ] + }, + { + "start_bits": 8388608, + "count": 65536, + "rust_output_sha256": "4200cba9cf0053911e1d672fabbee94f5267d5b7aa109fbe57ddc5a4f7b70393", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "4200cba9cf0053911e1d672fabbee94f5267d5b7aa109fbe57ddc5a4f7b70393", + "matched_float_values": 65536 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "4200cba9cf0053911e1d672fabbee94f5267d5b7aa109fbe57ddc5a4f7b70393", + "matched_float_values": 65536 + } + ] + }, + { + "start_bits": 1056899072, + "count": 65536, + "rust_output_sha256": "cae10428767d3e776f5183caba1780897d2e1831913c05ae6dd8d843a6e25a76", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "cae10428767d3e776f5183caba1780897d2e1831913c05ae6dd8d843a6e25a76", + "matched_float_values": 65536 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "cae10428767d3e776f5183caba1780897d2e1831913c05ae6dd8d843a6e25a76", + "matched_float_values": 65536 + } + ] + }, + { + "start_bits": 1065287680, + "count": 65536, + "rust_output_sha256": "59024062288c0bc65906a38484eff0fb73aaba11cb8110aaebc6dde8891ed10c", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "59024062288c0bc65906a38484eff0fb73aaba11cb8110aaebc6dde8891ed10c", + "matched_float_values": 65536 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "59024062288c0bc65906a38484eff0fb73aaba11cb8110aaebc6dde8891ed10c", + "matched_float_values": 65536 + } + ] + }, + { + "start_bits": 1065353216, + "count": 65536, + "rust_output_sha256": "01849695d0e9a30ccd132270cb79ecaaf1065411d66b323a36f1b87f5d0e4596", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "01849695d0e9a30ccd132270cb79ecaaf1065411d66b323a36f1b87f5d0e4596", + "matched_float_values": 65536 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "01849695d0e9a30ccd132270cb79ecaaf1065411d66b323a36f1b87f5d0e4596", + "matched_float_values": 65536 + } + ] + }, + { + "start_bits": 1073741824, + "count": 65536, + "rust_output_sha256": "0df001f091df446399cccd24b0fa1e4114894c263d5cdc707b8c4a2ded269936", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "0df001f091df446399cccd24b0fa1e4114894c263d5cdc707b8c4a2ded269936", + "matched_float_values": 65536 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "0df001f091df446399cccd24b0fa1e4114894c263d5cdc707b8c4a2ded269936", + "matched_float_values": 65536 + } + ] + }, + { + "start_bits": 2139029504, + "count": 65536, + "rust_output_sha256": "c39faee80d047d450472ae5eb25f2811e4010b5aad1ccad80ff4d8f7638bd3d5", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "c39faee80d047d450472ae5eb25f2811e4010b5aad1ccad80ff4d8f7638bd3d5", + "matched_float_values": 65536 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "c39faee80d047d450472ae5eb25f2811e4010b5aad1ccad80ff4d8f7638bd3d5", + "matched_float_values": 65536 + } + ] + }, + { + "start_bits": 2139095040, + "count": 65536, + "rust_output_sha256": "1c60d380d4dc55a05bed3452e32f4d5c813c9beb4459ba890338c27f0b047345", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "1c60d380d4dc55a05bed3452e32f4d5c813c9beb4459ba890338c27f0b047345", + "matched_float_values": 65536 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "1c60d380d4dc55a05bed3452e32f4d5c813c9beb4459ba890338c27f0b047345", + "matched_float_values": 65536 + } + ] + }, + { + "start_bits": 2147418112, + "count": 65536, + "rust_output_sha256": "f3b37b44be6c4c25b1d85b2bce7844c67cc9f3e5a3270d4a53101d99049b966e", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "f3b37b44be6c4c25b1d85b2bce7844c67cc9f3e5a3270d4a53101d99049b966e", + "matched_float_values": 65536 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "f3b37b44be6c4c25b1d85b2bce7844c67cc9f3e5a3270d4a53101d99049b966e", + "matched_float_values": 65536 + } + ] + }, + { + "start_bits": 2147483648, + "count": 65536, + "rust_output_sha256": "b365699b17956be9409c58c88b48da5f7edf7e4783fcca72efa00b0dae84455f", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "b365699b17956be9409c58c88b48da5f7edf7e4783fcca72efa00b0dae84455f", + "matched_float_values": 65536 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "b365699b17956be9409c58c88b48da5f7edf7e4783fcca72efa00b0dae84455f", + "matched_float_values": 65536 + } + ] + }, + { + "start_bits": 2155872256, + "count": 65536, + "rust_output_sha256": "f3b37b44be6c4c25b1d85b2bce7844c67cc9f3e5a3270d4a53101d99049b966e", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "f3b37b44be6c4c25b1d85b2bce7844c67cc9f3e5a3270d4a53101d99049b966e", + "matched_float_values": 65536 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "f3b37b44be6c4c25b1d85b2bce7844c67cc9f3e5a3270d4a53101d99049b966e", + "matched_float_values": 65536 + } + ] + }, + { + "start_bits": 3212771328, + "count": 65536, + "rust_output_sha256": "f3b37b44be6c4c25b1d85b2bce7844c67cc9f3e5a3270d4a53101d99049b966e", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "f3b37b44be6c4c25b1d85b2bce7844c67cc9f3e5a3270d4a53101d99049b966e", + "matched_float_values": 65536 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "f3b37b44be6c4c25b1d85b2bce7844c67cc9f3e5a3270d4a53101d99049b966e", + "matched_float_values": 65536 + } + ] + }, + { + "start_bits": 3212836864, + "count": 65536, + "rust_output_sha256": "f3b37b44be6c4c25b1d85b2bce7844c67cc9f3e5a3270d4a53101d99049b966e", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "f3b37b44be6c4c25b1d85b2bce7844c67cc9f3e5a3270d4a53101d99049b966e", + "matched_float_values": 65536 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "f3b37b44be6c4c25b1d85b2bce7844c67cc9f3e5a3270d4a53101d99049b966e", + "matched_float_values": 65536 + } + ] + }, + { + "start_bits": 4286513152, + "count": 65536, + "rust_output_sha256": "f3b37b44be6c4c25b1d85b2bce7844c67cc9f3e5a3270d4a53101d99049b966e", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "f3b37b44be6c4c25b1d85b2bce7844c67cc9f3e5a3270d4a53101d99049b966e", + "matched_float_values": 65536 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "f3b37b44be6c4c25b1d85b2bce7844c67cc9f3e5a3270d4a53101d99049b966e", + "matched_float_values": 65536 + } + ] + }, + { + "start_bits": 4286578688, + "count": 65536, + "rust_output_sha256": "f3b37b44be6c4c25b1d85b2bce7844c67cc9f3e5a3270d4a53101d99049b966e", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "f3b37b44be6c4c25b1d85b2bce7844c67cc9f3e5a3270d4a53101d99049b966e", + "matched_float_values": 65536 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "f3b37b44be6c4c25b1d85b2bce7844c67cc9f3e5a3270d4a53101d99049b966e", + "matched_float_values": 65536 + } + ] + }, + { + "start_bits": 4294901760, + "count": 65536, + "rust_output_sha256": "f3b37b44be6c4c25b1d85b2bce7844c67cc9f3e5a3270d4a53101d99049b966e", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "f3b37b44be6c4c25b1d85b2bce7844c67cc9f3e5a3270d4a53101d99049b966e", + "matched_float_values": 65536 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "f3b37b44be6c4c25b1d85b2bce7844c67cc9f3e5a3270d4a53101d99049b966e", + "matched_float_values": 65536 + } + ] + } + ], + "scope": "Compiled scalar UnaryFunction.LogSampler compared by float result bits across the recorded input bit ranges, including signed zeros, subnormals, finite values, infinities and NaNs. NaN results are canonicalized as Float.floatToIntBits. Exhaustive mode checks all 2^32 float input bit patterns against both checksum-pinned JARs on this machine's JDK. Bulk composition, range propagation, compiler rewriting and other operations belong to the separate density suite. This does not establish double-precision Math.log parity, other-platform math parity, complete terrain, gameplay or performance." +} diff --git a/benchmarks/rust-float-log-2026-10-05/scoped-parity.json b/benchmarks/rust-float-log-2026-10-05/scoped-parity.json new file mode 100644 index 000000000..df0091792 --- /dev/null +++ b/benchmarks/rust-float-log-2026-10-05/scoped-parity.json @@ -0,0 +1,87 @@ +{ + "schema": 1, + "minecraft": "26.3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "exhaustive": true, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFloatLogOracle.java": "1794510183faa07892761e93094301b69665d4b6a5300ef7117b5482832165f2", + "tools/test_float_log_parity.py": "c7f9aa59351309cba8a1e8c118e304c58dee0ddd31dcd98d3f0d41a86b5d77a9", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "crates/horizon-core/src/bin/density_parity.rs": "9a1b2d7033682f23e413d1e8764365052c673a05306ee254a4f6f5d6c5a728f6", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/density/arithmetic.rs": "e23a963bfbc75ba7c3e7bdefd0e300907dcc4f8c8336826c27ddf479d320f075", + "crates/horizon-core/src/density/cache.rs": "3ccc1268dca96259890279e9f91cb7a099c74b12e6ca2973880d4fa246f7a619", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "89993bf84b2bb5ca8d28b8c1c944db87078a43890a904a8d2bd1989e6cd3864f", + "crates/horizon-core/src/density/graph/mod.rs": "7a05a8b2b99fa41b69fd85d38228b8c0cc95b11761039643abb9af5f6a0d07d7", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "91da8b08b1567640e82daab5440fb767c74ff14e63bcc555cbd2e6b4f5ff3cd6", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "e5cd03f4c1b15caf5d6680f2a6d6271f324af9d9f6cad7068ddf942509b3fe62", + "crates/horizon-core/src/density/mod.rs": "6a3eec3feb37bdeb574b9070036c207544f2375a41ef25ab93315cccaba6ebc2", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "3968e2a337a6a23226c485057c79359e66df16683f00fb4ebc9fabb03910a015", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "faae2edce8b573fd32fcb4bd1f898be7d700a5b38479439f5bec96df764688fd" + }, + "comparisons": [ + { + "start_bits": 0, + "count": 4294967296, + "rust_output_sha256": "3a67757c8e4e4c70d597613ea11b7ace2ea45d8f02effaa23e70233e4ee327d7", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "3a67757c8e4e4c70d597613ea11b7ace2ea45d8f02effaa23e70233e4ee327d7", + "matched_float_values": 4294967296 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "3a67757c8e4e4c70d597613ea11b7ace2ea45d8f02effaa23e70233e4ee327d7", + "matched_float_values": 4294967296 + } + ] + } + ], + "scope": "Compiled scalar UnaryFunction.LogSampler compared by float result bits across the recorded input bit ranges, including signed zeros, subnormals, finite values, infinities and NaNs. NaN results are canonicalized as Float.floatToIntBits. Exhaustive mode checks all 2^32 float input bit patterns against both checksum-pinned JARs on this machine's JDK. Bulk composition, range propagation, compiler rewriting and other operations belong to the separate density suite. This does not establish double-precision Math.log parity, other-platform math parity, complete terrain, gameplay or performance." +} diff --git a/benchmarks/rust-fluid-2026-10-06/scoped-parity.json b/benchmarks/rust-fluid-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..d19807d8a --- /dev/null +++ b/benchmarks/rust-fluid-2026-10-06/scoped-parity.json @@ -0,0 +1,168 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "block_states": 35723, + "fluid_kinds": 5, + "fixtures": 40344, + "requested_height_queries": 80688, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFluidOracle.java": "616e256245f1a95069745b7cde26ade08ae16dadd7e9224fa54abf16cef9fee9", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "tools/test_fluid_parity.py": "3728655b2e524a01bfaac137dd9351bf3f4e7b4053037ec72049e6f549d38ba2", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/fluid.rs": "8a2834a9347ee2c2db7cf1c86a064907ec06e9ac16ba9cc3936e315fc4ad49ca", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "06aa7b44e1229b3cf50abcf3827f2cacd7ae54321865873bdba0f371cb458b3f", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_feature.rs": "f8c2ef2de1cfe9a8689a7375d4bf0cc00431484e06f6d4b2b95aabac8fdfffb0", + "crates/horizon-world/src/worldgen/block_predicate.rs": "8513e9d96c8626594b5ee078bf20ccf3de90fc9f9d7123780d1cab5eefb6b5c2", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "297524aefeb4567c5f5c0c1678013e44002eb91ca16ee63b51ffacf93f31a095", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "486fe9d8588eb09e0ee5707a0541b0df167b63b0b56c90a2709bfa09a0a3ad19", + "crates/horizon-world/src/worldgen/feature_graph.rs": "fe61a5e43179a7588737a71782ea246811fe2c8721e74793e1ac018c8eb93c34", + "crates/horizon-world/src/worldgen/feature_region.rs": "2c78e5f1bdb08307f8d982f231f1abbc3306cd54348d9023b86ee6ed3516fd33", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "e682d13a21f90605215b79f5d254bf2e524d35e89eab2e3b46384709af80b847", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "08ee8697f589e96b69653b395238eecd144d51cfec30017214275f9b338d82af", + "crates/horizon-world/src/worldgen/placement/context.rs": "c916b30177e283e8eedfa342dc5282b42c898a2873668b44f59c83501ff866bd", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "fa0616353f07460975ab323357ab280b7f35e7bfe2de6edc08d304316766ed26", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "d1097d91b43e30cec38b09365d3ed58f15522b829feb584e255718447e4c68b4", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "b08f074f54f451c24795d5dda68968165b84b8d762d244f0444a8d62de61820e", + "crates/horizon-world/examples/fluid_fixture.rs": "4603e462ce92f60426bb6025cd42b08410d0d4e81293e08861636a5664dfe0b1" + }, + "fixtures_sha256": { + ".local/rust-fluid-parity/inputs.txt": "532b6e5965ce43b01989e7ee11c104d6bb498e52bcad0a79b14c5865068d287d", + ".local/rust-fluid-parity/facts-client.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-fluid-parity/facts-server.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b" + }, + "rust_output_sha256": "b25ed573e8c2177c68a5f48ff62665144cf687aee3b948e8de696ab43e16fad1", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "b25ed573e8c2177c68a5f48ff62665144cf687aee3b948e8de696ab43e16fad1", + "matched_output_lines": 239190 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "b25ed573e8c2177c68a5f48ff62665144cf687aee3b948e8de696ab43e16fad1", + "matched_output_lines": 239190 + } + ], + "scope": "Native fluid identity, amount, falling/source/full flags, own-height bits and legacy block conversion for every pinned block state; all fluid-family identity pairs. Surface and camera height query order, above-fluid family checks, source-only downward-face support checks, coordinate wrapping and injected query failures are compared. The fixture supplies stone/air support states; general block support shapes, fluid spreading/ticks, entities and rendering remain outside this comparison." +} diff --git a/benchmarks/rust-geometry-2026-10-05/scoped-parity.json b/benchmarks/rust-geometry-2026-10-05/scoped-parity.json new file mode 100644 index 000000000..9efcea4a4 --- /dev/null +++ b/benchmarks/rust-geometry-2026-10-05/scoped-parity.json @@ -0,0 +1,73 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "commands": { + "traverse": 8448, + "trig-table": 1, + "rotation": 16000, + "vec": 7256, + "box": 7006, + "block-box": 100, + "grid": 201, + "query": 52500, + "many": 2500, + "motion": 12000, + "join": 5652, + "make-box": 600, + "optimize": 500, + "join-optimized": 500, + "step-motion": 17680, + "block-iterate": 2400, + "box-iterate": 2400, + "sweep": 9022, + "floor-height": 12000 + }, + "inputs_sha256": "95abe82bf9f328e8b51aafb84a3e97954073f743b963a3d2fa4892cc120f49f1", + "rust_output_sha256": "ebb938b5288e05a291b6e1039f286aa7565821f8de46afb1d853d8112c079dd5", + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaGeometryOracle.java": "48c233ec1a5684cbd5a9edb5d7972aa4647465045ef298dce14a91de45cc4809", + "tools/test_geometry_parity.py": "38ce169dc520535c217a01705510b71ef3ee81128376640e849f47bc999ef64d", + "tools/test_rust_parity.py": "500652427164c7e067a5eb69310ec81f843d5fe37a7c9d88edd2b1ca6606020a", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "faae2edce8b573fd32fcb4bd1f898be7d700a5b38479439f5bec96df764688fd", + "crates/horizon-core/Cargo.toml": "09243cac4d45e8b4aaed3a6169bf3ee0e1272fdff4298c43c80d5fff0116d01c", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/parity.rs": "7b455f2181862e1430e7387633c146877c2d317c2ea682c1e6fa64345dbc5885", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "acaa0a51a759e1a08d417538e567847a66b8c9ae6a7434872e1621ed210364b1", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random.rs": "2f304dfb580a6bc1b5c51b048a2fa2a57f73c5f28f5eb2447f925bf138513389", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e" + }, + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "ebb938b5288e05a291b6e1039f286aa7565821f8de46afb1d853d8112c079dd5", + "matched_output_lines": 1320187 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "ebb938b5288e05a291b6e1039f286aa7565821f8de46afb1d853d8112c079dd5", + "matched_output_lines": 1320187 + } + ], + "scope": "Selected Vec3/AABB operations, sine table entries, quantized trig, rotations and look directions; finite block-ray traversal; bounded inclusive/directional block iteration and finite swept-block visits with step indices; immutable cube/array voxel-grid bounds, column minima/maxima, greedy boxes, collide, ray hits, closest points and cell lookup; lazy floor-height selection; box quantization, optimized/unoptimized Boolean joins, alias identity and joinIsNotEmpty; Entity.collideWithShapes, candidate step heights and Entity.collide step-up decisions/query bounds with caller-controlled block/entity/border shape lists. No live entities, actual world shape selection, grounding/velocity side effects, fluids or block behavior." +} diff --git a/benchmarks/rust-geometry-2026-10-06/scoped-parity.json b/benchmarks/rust-geometry-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..1dbed368b --- /dev/null +++ b/benchmarks/rust-geometry-2026-10-06/scoped-parity.json @@ -0,0 +1,110 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "commands": { + "traverse": 8448, + "trig-table": 1, + "rotation": 16000, + "vec": 7256, + "box": 7006, + "block-box": 100, + "grid": 201, + "query": 52500, + "many": 2500, + "motion": 12000, + "join": 5652, + "make-box": 600, + "optimize": 500, + "join-optimized": 500, + "step-motion": 17680, + "block-iterate": 2400, + "box-iterate": 2400, + "sweep": 9022, + "floor-height": 12000 + }, + "inputs_sha256": "95abe82bf9f328e8b51aafb84a3e97954073f743b963a3d2fa4892cc120f49f1", + "rust_output_sha256": "ebb938b5288e05a291b6e1039f286aa7565821f8de46afb1d853d8112c079dd5", + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaGeometryOracle.java": "48c233ec1a5684cbd5a9edb5d7972aa4647465045ef298dce14a91de45cc4809", + "tools/test_geometry_parity.py": "38ce169dc520535c217a01705510b71ef3ee81128376640e849f47bc999ef64d", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e" + }, + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "ebb938b5288e05a291b6e1039f286aa7565821f8de46afb1d853d8112c079dd5", + "matched_output_lines": 1320187 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "ebb938b5288e05a291b6e1039f286aa7565821f8de46afb1d853d8112c079dd5", + "matched_output_lines": 1320187 + } + ], + "scope": "Selected Vec3/AABB operations, sine table entries, quantized trig, rotations and look directions; finite block-ray traversal; bounded inclusive/directional block iteration and finite swept-block visits with step indices; immutable cube/array voxel-grid bounds, column minima/maxima, greedy boxes, collide, ray hits, closest points and cell lookup; lazy floor-height selection; box quantization, optimized/unoptimized Boolean joins, alias identity and joinIsNotEmpty; Entity.collideWithShapes, candidate step heights and Entity.collide step-up decisions/query bounds with caller-controlled block/entity/border shape lists. No live entities, actual world shape selection, grounding/velocity side effects, fluids or block behavior." +} diff --git a/benchmarks/rust-height-provider-2026-10-06/scoped-parity.json b/benchmarks/rust-height-provider-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..5419d587f --- /dev/null +++ b/benchmarks/rust-height-provider-2026-10-06/scoped-parity.json @@ -0,0 +1,152 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 9030, + "definitions": 301, + "samples_per_valid_fixture": 32, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightProviderOracle.java": "fa366ca1ed396353f8ec4a79c553f23aa9d0fc9bc85275427552e98cd27a777e", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaAnchorOracle.java": "226628d98b89aadbdd374936575d033945e7064a900dbb050c662204dbc7e119", + "tools/test_height_provider_parity.py": "06685252f1e2ffbe6988759655f96b95f5895353dd43b774db9908bc59365fe2", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "32b937832b7058d86e8557a2012df32be1c97be324f15d0ae85245c45c73b314", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_predicate.rs": "dd8cbda2ec110444950f0b31bf4e088897eab0994674a91568c7b063f8f16210", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_graph.rs": "5dfb83b9f97eb24b386e3514aaac957b314461b32d59e1fdb6dcac7ca0a32e1b", + "crates/horizon-world/src/worldgen/feature_region.rs": "4a95a30c0987d97e671f84380e13ddea070ad81f996baa65b2a06c4d892971c7", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/placement/chain.rs": "1b976aa4dd2516468196d0af3451e3fdd037493a14d269f54ebdd7254055e05e", + "crates/horizon-world/src/worldgen/placement/context.rs": "b36dfd9297896e62770f2085cf934fc08ebd4c030ecc7ae17d864e819a113201", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "68ecf36954fea5705436d486e9be93836933fd56779022afeb881a0399d6a674", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "7516e20a20479d1c4a9734d7d8e9826740b324869d7afe51eab94bb1bc7c97ae", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/value_provider.rs": "ad1c0efffcc201839e3471d7dfa06c39307d8cbabddb4c5aed8389ee7b68737a", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "f18a6c0e66cadec431d2e3154ad70d96b3be623e675f939d4419858f2cce92ab", + "crates/horizon-world/examples/height_provider_fixture.rs": "d8a314edf7c3c90483f86aaa3786f41192c957480a751353fbbf6e9dbc8cad3f" + }, + "fixtures_sha256": { + ".local/rust-height-provider-parity/inputs.txt": "03bcc47709132ca5afe9b4fd1b6c9b1ba2bd238270ddfed90fd284f39817e143" + }, + "rust_output_sha256": "bb3677402722cf44c4d4572e8b0a915774e15a2d04928171ea69b194603c44fb", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "bb3677402722cf44c4d4572e8b0a915774e15a2d04928171ea69b194603c44fb", + "matched_output_lines": 507660 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "bb3677402722cf44c4d4572e8b0a915774e15a2d04928171ea69b194603c44fb", + "matched_output_lines": 507660 + } + ], + "scope": "Actual HeightProvider.CODEC decoding and sampled heights with interleaved nextLong values, using actual WorldGenerationContext and all four vertical-anchor kinds. Covers constant, uniform, biased-to-bottom, very-biased-to-bottom trapezoid and weighted-list providers, both random modes, empty/equal ranges, inner/plateau defaults and bounds, numeric narrowing, relative coordinate overflow, malformed fields and anchor-versus-dispatch preference. Warning logs are excluded. Weighted lists include zero weights, singleton draws, nested providers, 63/64/65 weight totals, maximum/overflow totals and malformed entries; native constructor rejections count as decode errors. Encoding, cave/canyon paths and complete generation remain outside this scope." +} diff --git a/benchmarks/rust-heightmap-2026-10-06/scoped-parity.json b/benchmarks/rust-heightmap-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..83cda8c9d --- /dev/null +++ b/benchmarks/rust-heightmap-2026-10-06/scoped-parity.json @@ -0,0 +1,126 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "block_states": 35723, + "block_tag_files": 300, + "fixtures": 100, + "operation_counts": { + "set": 86806, + "query": 54306, + "dump": 474, + "prime": 516, + "raw": 378, + "update": 42 + }, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_heightmap_parity.py": "d8c0e68d51fa102c518030c816ce9f41d05c7d6d65e2d484b2e57c253b407510", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/test_worldgen_parity.py": "3574ac73f81e3a6606ac9d3c16fa2c50b57a37b89be52e7d5448e7045c41a9ee", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "69f89566a78456c29caaa39dacedfe711ca59e49b78f64e68b0414fb6a73d8fc", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "3968e2a337a6a23226c485057c79359e66df16683f00fb4ebc9fabb03910a015", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry.rs": "f46065659e60eb5e84ad69b9f3b5e94dc87ee19de16408817e26f23d16b6c7e7", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "7516e20a20479d1c4a9734d7d8e9826740b324869d7afe51eab94bb1bc7c97ae", + "crates/horizon-world/src/worldgen/terrain.rs": "134cf93b53a40fb1ed0e0170c90316c80e270773b2968c63dc3f9cef2c941bff", + "crates/horizon-world/src/worldgen.rs": "b89dd4a9de02caf6bce457304a105ffbc0f0f220f8647c095852a45a1bf292bb", + "crates/horizon-world/examples/heightmap_fixture.rs": "eddd4c15620eebfc5bd919d3b19b0b2fd69d6fd31a19d8c512121aa297efa848" + }, + "fixtures_sha256": { + ".local/rust-heightmap-parity/inputs.txt": "bf53719ac137e1ebbf7b874bd887e3208516e9938372c00d8f3d2c969297ec22", + ".local/rust-heightmap-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0", + ".local/rust-heightmap-parity/facts-client.json": "1d24883ee807b0b71473f0bbf8ed548ddaf712148caeb3fcc7aa13ab973a97b0", + ".local/rust-heightmap-parity/facts-server.json": "1d24883ee807b0b71473f0bbf8ed548ddaf712148caeb3fcc7aa13ab973a97b0" + }, + "rust_output_sha256": "1268526add13ad33c0db95dc70df1e37fb12d35d5c95ce82fbb2bcef2d830a9d", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "1268526add13ad33c0db95dc70df1e37fb12d35d5c95ce82fbb2bcef2d830a9d", + "matched_output_lines": 1671668 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "1268526add13ad33c0db95dc70df1e37fb12d35d5c95ce82fbb2bcef2d830a9d", + "matched_output_lines": 1671668 + } + ], + "scope": "Six heightmap types, client/persistence flags and predicates for every pinned block state. Air/fluid facts are imported independently from both authenticated JARs and required to agree; block-tag membership is resolved in Rust from bundled resources. State behavioral methods are not ported by that import. Actual vanilla ProtoChunk and Heightmap APIs compare insertion/removal, downward rescans, repeated priming, empty-column retention, raw packed words including padding/unused slots, invalid-length fallback, wrapped column indexing, height queries, errors and selected exact block-read traces. Positive aligned vertical ranges are bounded to the NoiseSettings codec domain; arbitrary height accessors, chunk lifecycle integration, complete terrain/gameplay and rendering remain pending." +} diff --git a/benchmarks/rust-material-condition-2026-10-06/scoped-parity.json b/benchmarks/rust-material-condition-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..9843a46c6 --- /dev/null +++ b/benchmarks/rust-material-condition-2026-10-06/scoped-parity.json @@ -0,0 +1,145 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 245, + "initial_conditions": 11288, + "context_operations": 217969, + "noise_resources": 64, + "condition_resources": 8, + "biome_resources": 67, + "biome_tag_resources": 86, + "biome_fixtures": 23, + "preliminary_fixtures": 61, + "ore_fixtures": 57, + "noise_fixtures": 24, + "initial_rules": 6271, + "codec_inputs": 8609, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMaterialConditionOracle.java": "04a87405fd2a1c79baf4eb3a8895aa66dc96b8f6baffb9b486ef207f8b91b5ee", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaAnchorOracle.java": "226628d98b89aadbdd374936575d033945e7064a900dbb050c662204dbc7e119", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeTemperatureOracle.java": "243bbc525c6aec24674e7f172c5fb4f7b50f9a679d8b9dfba40ea278219a2d28", + "tools/test_biome_temperature_parity.py": "68f84d02e7802349e491b8cb66e18d9b08c9e72ab2306b663667259e852cc2b1", + "tools/test_material_condition_parity.py": "01c82e1a768d9131f8f7e6d59d01ddb06272074469dbdcd8547f44f0a8fa152d", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "3968e2a337a6a23226c485057c79359e66df16683f00fb4ebc9fabb03910a015", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "476f1542d335eb02fb627b7480d708f4aa6b7f9929f4dbc2c646e15b063cf083", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "39e1a8807f9ae975ff5a4c92effe619050049a386549a94c0d1ddaebf66f24af", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "04ac9130138ea4ce67fc43f7701f5036972984724ffcd49bfe857d0693361d87", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "4ab2681a45108e5d2ea6fb761ea1cb7fa40b72833fa6190d2efe34ce29845c21", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "7516e20a20479d1c4a9734d7d8e9826740b324869d7afe51eab94bb1bc7c97ae", + "crates/horizon-world/src/worldgen/terrain.rs": "99926c7b867b752966084cdf2b20530dde8069703f4b3709bf623fefad425102", + "crates/horizon-world/src/worldgen.rs": "cffb5e72b59222dad13e57fa74ed4f553570a61a8773f27b5199444111ced2e0", + "crates/horizon-world/examples/material_condition_fixture.rs": "a9b6c0adf7308eebfa746baa84696ec6df75e6a0d93c5742958fb9a58e090000" + }, + "fixtures_sha256": { + ".local/rust-material-condition-parity/inputs.txt": "56215086f8ae7d82df35e05235d67da42749bd4f8b629bb55d9c408e6aab70ef", + ".local/rust-material-condition-parity/noises.json": "310b240c9b70586bb704ca44a915766a8d41d6a073183324c37184fcb317a992", + ".local/rust-material-condition-parity/conditions.json": "a417b8cd9e41ad6b45ea9ac8d587d70c0a50f0b0c4aa7d4812fce1a6c6016ba8", + ".local/rust-material-condition-parity/biomes.json": "9b26dc3b662627dc3bbbf8da209f287882ce79ff4daf8f454b994ddc7510df99", + ".local/rust-material-condition-parity/biome_tags.json": "f7ed4da9e7755712a1116b2fd64e749639f085d8698b5def3ecabae5ece87095" + }, + "rust_output_sha256": "02c3bcbfae34fe6f7eed98add6ef550a3dae15734eda587d269d622661c68633", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "02c3bcbfae34fe6f7eed98add6ef550a3dae15734eda587d269d622661c68633", + "matched_output_lines": 5627426 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "02c3bcbfae34fe6f7eed98add6ef550a3dae15734eda587d269d622661c68633", + "matched_output_lines": 5627426 + } + ], + "scope": "Actual runtime constructors and compiled evaluators for hole, steep, Y, water, stone-depth, vertical-gradient, noise-threshold, biome-membership, temperature and negated conditions, with actual MaterialRuleContext updates and secondary-noise caching. Both world random algorithms and named positional gradient factories, boundary/overflow arithmetic, floor/ceiling selection, reversed/equal gradient bounds, late compilation and repeated/changed context evaluations. Context surfaceDepth is injected after native updateXZ and the secondary sampler is a traced constant-noise override; these supplied inputs isolate condition behavior, with full MaterialSystem surface inputs checked separately. Direct and holder condition codecs cover all eight bundled definitions, canonical encoding, forward and nested references, default namespaces, numeric wrapping/truncation, required fields, invalid types and nested anchor alternatives. Cycles and bounded resource limits are typed Rust errors, not compared to native stack overflow. Actual BlockRule, SequenceRule, ConditionRule and BandlandsRule compilation/application additionally cover ordered short circuiting, nested and empty/singleton sequences, independent context versus application coordinates, late compilation and seeded band results/failures. Noise-threshold conditions additionally cover shared/separate XZ and XYZ cached suppliers, all bundled named noise resources under both random modes, traced changing source inputs, repeated coordinates/updates, late binding, float promotion, NaN/infinite thresholds and values. Encoded JSON numbers are compared as canonical double bits, including nonfinite Gson output tokens. Biome membership and temperature conditions additionally cover all bundled biome climate settings, possible-biome constant folding (including empty sets), context biome caching and XZ/Y invalidation, shared temperature caches across contexts, null biome results, query failures and lazy-condition retry behavior. Named biome-tag holders additionally cover every bundled biome tag, native TagLoader resolution/binding versus Rust TagDefinitions, encoded tag identity, namespace aliases, empty/duplicate/nested/optional entries, membership and possible-biome folding, predicate errors and conditional-rule application. Preliminary-surface conditions additionally cover lazy unit-spaced XZ plane sampling versus scalar fallback, traced sample order, ignored source-volume strides/Y extent, column minimum caching, block-height changes, partial density failures and retained buffers, same-column failure retries, floor/nonfinite conversions and wrapping arithmetic. Provider error occurrence is compared, not exception class or message. Preliminary planes are bounded to 1,048,576 samples in Rust. Ore-vein rules additionally cover eager density/richness volumes, lazy gap sampling, exact strided lattice hits and scalar misses, shared context versus independent application/random coordinates, both positional random modes, ordered draws and short circuiting, mutable/NaN/infinite sources, raw-ore chances, failed compilation and provider retries. Rust requires precompiled density roots for the same world context; live registry/tag reloads, rule codecs, registry-owner validation, arbitrary provider failures and full surface-stage application remain pending." +} diff --git a/benchmarks/rust-material-extension-2026-10-06/scoped-parity.json b/benchmarks/rust-material-extension-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..96b409158 --- /dev/null +++ b/benchmarks/rust-material-extension-2026-10-06/scoped-parity.json @@ -0,0 +1,134 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 410, + "extension_calls": 3920, + "biome_resources": 67, + "noise_resources": 64, + "constant_noise_fixtures": 142, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMaterialExtensionOracle.java": "4ad5ad2836095f06394d84c9b86ca5866b6180dd6ed9f81bc038754051537184", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeTemperatureOracle.java": "243bbc525c6aec24674e7f172c5fb4f7b50f9a679d8b9dfba40ea278219a2d28", + "tools/test_material_extension_parity.py": "b4e03657bfcec04e1844f1c738d6dd28181b97686b8f07dbe32ba4b541e30364", + "tools/test_biome_temperature_parity.py": "68f84d02e7802349e491b8cb66e18d9b08c9e72ab2306b663667259e852cc2b1", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "3968e2a337a6a23226c485057c79359e66df16683f00fb4ebc9fabb03910a015", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "476f1542d335eb02fb627b7480d708f4aa6b7f9929f4dbc2c646e15b063cf083", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "39e1a8807f9ae975ff5a4c92effe619050049a386549a94c0d1ddaebf66f24af", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "04ac9130138ea4ce67fc43f7701f5036972984724ffcd49bfe857d0693361d87", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "4ab2681a45108e5d2ea6fb761ea1cb7fa40b72833fa6190d2efe34ce29845c21", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "7516e20a20479d1c4a9734d7d8e9826740b324869d7afe51eab94bb1bc7c97ae", + "crates/horizon-world/src/worldgen/terrain.rs": "99926c7b867b752966084cdf2b20530dde8069703f4b3709bf623fefad425102", + "crates/horizon-world/src/worldgen.rs": "cffb5e72b59222dad13e57fa74ed4f553570a61a8773f27b5199444111ced2e0", + "crates/horizon-world/examples/material_extension_fixture.rs": "3eae986504abfc5087b9f93d570aa26a3a0b4ad7dfc354c53cf887d7a2ad31a4" + }, + "fixtures_sha256": { + ".local/rust-material-extension-parity/inputs.txt": "9b688fb99c7ff971b5824749f9b6fef0cc647b8543efb7a0b1e52e24eba798be", + ".local/rust-material-extension-parity/noises.json": "310b240c9b70586bb704ca44a915766a8d41d6a073183324c37184fcb317a992", + ".local/rust-material-extension-parity/biomes.json": "9b26dc3b662627dc3bbbf8da209f287882ce79ff4daf8f454b994ddc7510df99" + }, + "rust_output_sha256": "8cdb9fb92fe6b66759941ece3ba56d6653c1bcebf1b6744ab3b74c7ad7bed9c5", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "8cdb9fb92fe6b66759941ece3ba56d6653c1bcebf1b6744ab3b74c7ad7bed9c5", + "matched_output_lines": 233100 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "8cdb9fb92fe6b66759941ece3ba56d6653c1bcebf1b6744ab3b74c7ad7bed9c5", + "matched_output_lines": 233100 + } + ], + "scope": "Actual private MaterialSystem erodedBadlandsExtension and frozenOceanExtension methods, with ordered noise-coordinate/block-read/block-write traces and complete resulting columns. Both positional random modes, actual seeded bundled noises, all biome climate settings, same-block identity across state properties, air variants, flowing water, waterlogged nonwater blocks, snow/ice thresholds, repeated calls and height clipping by supplied column providers. Constant overrides cover thresholds, signed zero, NaN/infinity, sea-level integer extremes and bounded provider read failures. Native exception class/message and full chunk/heightmap/postprocessing integration are not compared here. Rust caps extension loops to 1,048,576 iterations; oversized synthetic scans hit the fixture provider limit in both implementations. Full surface-stage and playable parity remain pending." +} diff --git a/benchmarks/rust-material-rule-library-2026-10-06/scoped-parity.json b/benchmarks/rust-material-rule-library-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..4f0d1c51a --- /dev/null +++ b/benchmarks/rust-material-rule-library-2026-10-06/scoped-parity.json @@ -0,0 +1,149 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "resources": { + "noises": 64, + "densities": 55, + "rules": 42, + "conditions": 8, + "biomes": 67, + "biome_tags": 86 + }, + "fixtures": 12, + "codec_inputs": 142, + "rule_applications": 665712, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMaterialConditionOracle.java": "04a87405fd2a1c79baf4eb3a8895aa66dc96b8f6baffb9b486ef207f8b91b5ee", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaAnchorOracle.java": "226628d98b89aadbdd374936575d033945e7064a900dbb050c662204dbc7e119", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeTemperatureOracle.java": "243bbc525c6aec24674e7f172c5fb4f7b50f9a679d8b9dfba40ea278219a2d28", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "tools/test_material_rule_library_parity.py": "21bf17b6bebd7dab2927be075f9098b773a56365462cf910d69160995a7b6939", + "tools/test_material_condition_parity.py": "01c82e1a768d9131f8f7e6d59d01ddb06272074469dbdcd8547f44f0a8fa152d", + "tools/test_biome_temperature_parity.py": "68f84d02e7802349e491b8cb66e18d9b08c9e72ab2306b663667259e852cc2b1", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "3968e2a337a6a23226c485057c79359e66df16683f00fb4ebc9fabb03910a015", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "476f1542d335eb02fb627b7480d708f4aa6b7f9929f4dbc2c646e15b063cf083", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "39e1a8807f9ae975ff5a4c92effe619050049a386549a94c0d1ddaebf66f24af", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "04ac9130138ea4ce67fc43f7701f5036972984724ffcd49bfe857d0693361d87", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "4ab2681a45108e5d2ea6fb761ea1cb7fa40b72833fa6190d2efe34ce29845c21", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "7516e20a20479d1c4a9734d7d8e9826740b324869d7afe51eab94bb1bc7c97ae", + "crates/horizon-world/src/worldgen/terrain.rs": "99926c7b867b752966084cdf2b20530dde8069703f4b3709bf623fefad425102", + "crates/horizon-world/src/worldgen.rs": "cffb5e72b59222dad13e57fa74ed4f553570a61a8773f27b5199444111ced2e0", + "crates/horizon-world/examples/material_condition_fixture.rs": "a9b6c0adf7308eebfa746baa84696ec6df75e6a0d93c5742958fb9a58e090000" + }, + "fixtures_sha256": { + ".local/rust-material-rule-library-parity/inputs.txt": "194b14c212a1fb423cb689141d2f38b79654c9f665616094ca0f6a70e2220633", + ".local/rust-material-rule-library-parity/facts-client.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-material-rule-library-parity/facts-server.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-material-rule-library-parity/noises.json": "310b240c9b70586bb704ca44a915766a8d41d6a073183324c37184fcb317a992", + ".local/rust-material-rule-library-parity/densities.json": "28fe94e1b7cf3a06edfa2337319c03b5374c15bf18235570ee76e9c498c2f450", + ".local/rust-material-rule-library-parity/rules.json": "d5410ec3af96cf17a672a2f4c0a27b4e10ac4e4c75d63c52f6de406b64acbe57", + ".local/rust-material-rule-library-parity/conditions.json": "54a470a4513fb34a23e0fe66b0a5129a468dbd0002f5b2839437a9861a6005b9", + ".local/rust-material-rule-library-parity/biomes.json": "9b26dc3b662627dc3bbbf8da209f287882ce79ff4daf8f454b994ddc7510df99", + ".local/rust-material-rule-library-parity/biome_tags.json": "4006b76c24f616cb457a6fdad816db9b27f4528fe6daaed5747f1f79cf6225cf" + }, + "rust_output_sha256": "8f4055c8b6b4ca1a01c1451808a76a79ea5453cc5bfca21d879810a3322ca10d", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "8f4055c8b6b4ca1a01c1451808a76a79ea5453cc5bfca21d879810a3322ca10d", + "matched_output_lines": 678174 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "8f4055c8b6b4ca1a01c1451808a76a79ea5453cc5bfca21d879810a3322ca10d", + "matched_output_lines": 678174 + } + ], + "scope": "All bundled material-rule definitions loaded against authenticated condition, biome/tag, block-state, noise and density registries, then compiled/evaluated for both world random modes. Forward/nested rule holders, all five rule kinds, malformed/omitted fields and property fallback, actual seeded density/richness/gap sources, strided chunk-volume caching, scalar fallback and independent context/application positions are covered. Surface depth and secondary noise remain supplied context inputs; preliminary density is zero for isolation. All bundled biome climates are used, with unrestricted or complete possible-biome sets. Rust library definitions are immutable and atomically loaded, with typed cycle/resource-bound errors. Rule/density encoding, live reload/registry owner validation, complete surface-stage chunks and gameplay remain pending." +} diff --git a/benchmarks/rust-material-stage-2026-10-06/scoped-parity.json b/benchmarks/rust-material-stage-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..eb6e129f8 --- /dev/null +++ b/benchmarks/rust-material-stage-2026-10-06/scoped-parity.json @@ -0,0 +1,180 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "resources": { + "noises": 64, + "densities": 55, + "rules": 42, + "settings": 7, + "carvers": 4, + "conditions": 8, + "biomes": 67, + "biome_tags": 86, + "block_tags": 300 + }, + "fixtures": 79, + "generated_carving_passes": 42, + "carving_passes": 158, + "top_material_queries": 7584, + "surface_builds": 106, + "terrain_builds": 42, + "biome_chunks": 378, + "biome_values": 400896, + "block_values": 21757952, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMaterialStageOracle.java": "2eda078914d39c40ff995e465a0be02dc413d9de8fd9272b9658a4d1587762b5", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMaterialConditionOracle.java": "04a87405fd2a1c79baf4eb3a8895aa66dc96b8f6baffb9b486ef207f8b91b5ee", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaAnchorOracle.java": "226628d98b89aadbdd374936575d033945e7064a900dbb050c662204dbc7e119", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeTemperatureOracle.java": "243bbc525c6aec24674e7f172c5fb4f7b50f9a679d8b9dfba40ea278219a2d28", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeExport.java": "f9a773713cf21b69bfa10018b76f27b953bda140ede9934f43d3aa3091101cf5", + "tools/test_material_stage_parity.py": "002cc17628a05b94ce4d40e1e5c29240d1a87ea8fc29281794e0a2e42be7add2", + "tools/test_material_condition_parity.py": "01c82e1a768d9131f8f7e6d59d01ddb06272074469dbdcd8547f44f0a8fa152d", + "tools/test_biome_temperature_parity.py": "68f84d02e7802349e491b8cb66e18d9b08c9e72ab2306b663667259e852cc2b1", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "32b937832b7058d86e8557a2012df32be1c97be324f15d0ae85245c45c73b314", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "476f1542d335eb02fb627b7480d708f4aa6b7f9929f4dbc2c646e15b063cf083", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "ecf8fd3be57fa773033bac4a303a951f8c12dcd5cbb4d5432a21534525a69546", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "db91c00342842cab4f001b1428692d12dce7fa43b0704a7c0bb6f4f26ad8e2d9", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/height_provider.rs": "c9a148cdbd392b4ae998e466120c0870eb121736366a160347e1a697bdad914f", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "7516e20a20479d1c4a9734d7d8e9826740b324869d7afe51eab94bb1bc7c97ae", + "crates/horizon-world/src/worldgen/terrain.rs": "42823918deec5e149dc729a95bfe54aa32d91604098d5eb8452da0162d557d22", + "crates/horizon-world/src/worldgen/value_provider.rs": "7083e7a494894e080c252e7fb485651eb9f54e72043122e4f2b5bee5749e6184", + "crates/horizon-world/src/worldgen.rs": "58527080379e82d834763d661ebf51fb8f9a83f6d530c85ddf26bf0ea2d53f7d", + "crates/horizon-world/examples/material_stage_fixture.rs": "58f2b8cbcc537c43c4596a9d0ef937ae4e23612a49a7865ab5546bc346726d96" + }, + "fixtures_sha256": { + ".local/rust-material-stage-parity/inputs.txt": "7b0e92acc72ccf74f8f89a0feb2c5d42a65cf479ce86ed4338c2fe01d2e2cb83", + ".local/rust-material-stage-parity/presets-client.json": "b03e2fbe85c191a22f333bc989bd2a73c66f0f9fbcd9ddb54774f17c247832e9", + ".local/rust-material-stage-parity/presets-server.json": "b03e2fbe85c191a22f333bc989bd2a73c66f0f9fbcd9ddb54774f17c247832e9", + ".local/rust-material-stage-parity/facts-client.json": "e4b5e33240a44a6c86a5ec0a3793c22b507e8aea31ea85ed6d6c9d3069384e7f", + ".local/rust-material-stage-parity/facts-server.json": "e4b5e33240a44a6c86a5ec0a3793c22b507e8aea31ea85ed6d6c9d3069384e7f", + ".local/rust-material-stage-parity/noises.json": "310b240c9b70586bb704ca44a915766a8d41d6a073183324c37184fcb317a992", + ".local/rust-material-stage-parity/densities.json": "28fe94e1b7cf3a06edfa2337319c03b5374c15bf18235570ee76e9c498c2f450", + ".local/rust-material-stage-parity/rules.json": "b47af5bc7a19f2f3796326b310af49d677432ac87c6c9f4dc9c9cc4664fd5afb", + ".local/rust-material-stage-parity/settings.json": "dcc7d892420fb3faadab36c935ef0d2d8709a038a8fb944c00e354f417b3b586", + ".local/rust-material-stage-parity/carvers.json": "b09cf69ff328cad7836da8cd9565d0fb7ecf8bc35aebf17815f40f32a6a0ca4e", + ".local/rust-material-stage-parity/conditions.json": "54a470a4513fb34a23e0fe66b0a5129a468dbd0002f5b2839437a9861a6005b9", + ".local/rust-material-stage-parity/biomes.json": "9b26dc3b662627dc3bbbf8da209f287882ce79ff4daf8f454b994ddc7510df99", + ".local/rust-material-stage-parity/biome_tags.json": "4006b76c24f616cb457a6fdad816db9b27f4528fe6daaed5747f1f79cf6225cf", + ".local/rust-material-stage-parity/block_tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0", + ".local/rust-material-stage-parity/presets.json": "b03e2fbe85c191a22f333bc989bd2a73c66f0f9fbcd9ddb54774f17c247832e9" + }, + "rust_output_sha256": "6cf2554dae38af3e828ce4f04934b5f08b1db0c034c5e95f4087e3a17ef2ae3d", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "6cf2554dae38af3e828ce4f04934b5f08b1db0c034c5e95f4087e3a17ef2ae3d", + "matched_output_lines": 6733382 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "6cf2554dae38af3e828ce4f04934b5f08b1db0c034c5e95f4087e3a17ef2ae3d", + "matched_output_lines": 6733382 + } + ], + "scope": "Actual MaterialSystem.buildSurface and topMaterial against ProtoChunk before lighting, with complete raw sections, WG heightmap words, ordered fluid-postprocessing offsets and biome-lookup traces. All bundled rule registries, both seeded random modes, real surface/band/extension noises, real or supplied preliminary density, ore densities, empty/populated chunks, synthetic vertical spans/cavities/nondefault solids, clipped generation writes, lazy/primed maps and repeated surface builds sharing density contexts. Synthetic prefilled fixtures use a supplied deterministic block-position biome resolver; generated terrain fixtures first generate a 3x3 biome neighborhood through actual ChunkGenerator.doCreateBiomes, using pinned multi-noise preset tables or the End biome source. Complete stored biome values and subsequent BiomeManager block/quart lookup traces are compared. Both runtimes load the biome-source JSON against their biome/preset registries before generation. Rust imports independently authenticated preset tables; preset builders remain outside this comparison. Block air/fluid identities are imported from both authenticated JARs and motion predicates use resolved block tags. Each fixture applies an explicit carving mask twice through actual NoiseBasedChunkGenerator.applyCarvingMask after surface and top-material queries. The native aquifer is wrapped only to trace ordered computeSubstance/results/fluid-scheduling queries. Filtered and unfiltered passes, uncarvable tags, grass/mycelium/dirt restoration, repeated writes and disjoint runs are compared, followed by full chunk/heightmap/postprocessing dumps. Generated fixtures additionally invoke actual generateCarvers with biome carver settings selected from a 17x17 origin neighborhood, ordinal world seeds, native start checks and cave/canyon paths. The same source is reused after biome filling, preserving prior search state; a traced wrapper exposes uncached quart lookup order. Terrain/aquifer/postprocessing state is compared after procedural carving before explicit mask stress. Native carver settings retain actual carver holder lists while placed features are empty, as features are not evaluated in this stage. Each completed fixture also queries topMaterial at column edges and interior positions, above/below vertical bounds and around sea level, in dry and submerged contexts; these bind fresh one-cell material contexts without possible-biome restrictions. Empty blending only. Generated terrain fixtures also invoke actual NoiseBasedChunkGenerator.doFill before the surface stage, sharing a NoiseChunk and comparing full chunk state before and after surface builds for all bundled terrain routers and aquifers. Biome/feature/structure stages, nonempty blending, lighting and complete generated worlds/gameplay remain pending." +} diff --git a/benchmarks/rust-material-surface-2026-10-06/scoped-parity.json b/benchmarks/rust-material-surface-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..13c1637ed --- /dev/null +++ b/benchmarks/rust-material-surface-2026-10-06/scoped-parity.json @@ -0,0 +1,118 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 277, + "surface_queries": 5263, + "noise_resources": 64, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMaterialSurfaceOracle.java": "37ecc58f73344830bc743075d813411ace42032e23b6c4572a1d2e5206d30fc3", + "tools/test_material_surface_parity.py": "8fcc300339e33017c4475adce5ae1d0fb79ae7eae95f70015fda58f8d383c1a2", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "3968e2a337a6a23226c485057c79359e66df16683f00fb4ebc9fabb03910a015", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry.rs": "f46065659e60eb5e84ad69b9f3b5e94dc87ee19de16408817e26f23d16b6c7e7", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "7516e20a20479d1c4a9734d7d8e9826740b324869d7afe51eab94bb1bc7c97ae", + "crates/horizon-world/src/worldgen/terrain.rs": "134cf93b53a40fb1ed0e0170c90316c80e270773b2968c63dc3f9cef2c941bff", + "crates/horizon-world/src/worldgen.rs": "3460256893108079ecebed39d496b0d1ad17feb5193455ad8c51f441dfd19b2f", + "crates/horizon-world/examples/material_surface_fixture.rs": "5283d0c1cabfc0585e259525bba09a1acf30a749cfa7d8735bac415f3505305f" + }, + "fixtures_sha256": { + ".local/rust-material-surface-parity/inputs.txt": "2f070e7a9cc33fd7c5fba9a76dfedde9514aca66e36c7599b46b5a2d2e2ab0eb", + ".local/rust-material-surface-parity/noises.json": "310b240c9b70586bb704ca44a915766a8d41d6a073183324c37184fcb317a992" + }, + "rust_output_sha256": "f36a2c1972b0cce429fd2ef23a4dae9f91b134ca161f085c27da03b2ff74e0f3", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "f36a2c1972b0cce429fd2ef23a4dae9f91b134ca161f085c27da03b2ff74e0f3", + "matched_output_lines": 122988 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "f36a2c1972b0cce429fd2ef23a4dae9f91b134ca161f085c27da03b2ff74e0f3", + "matched_output_lines": 122988 + } + ], + "scope": "Actual MaterialSystem.generateBands and constructor-generated terracotta bands, protected getBand/getSurfaceDepth/getSurfaceSecondary methods. Both random streams, direct and world-root-derived clay_bands child streams, preconsumed inputs, complete 192-state band arrays and subsequent RNG draws. Surface lookups use independently authenticated bundled noise definitions, world-root positional random factories and optional constant-noise overrides for rounding/cast edges, nonfinite float values and signed integer overflow/remainder. Raw float-to-double secondary bits use canonical NaNs. Registry adapter identity binding, full material rule evaluation, eroded badlands/frozen ocean extensions and surface-stage chunk integration remain pending." +} diff --git a/benchmarks/rust-noise-2026-10-05/scoped-parity.json b/benchmarks/rust-noise-2026-10-05/scoped-parity.json new file mode 100644 index 000000000..bd9a46e65 --- /dev/null +++ b/benchmarks/rust-noise-2026-10-05/scoped-parity.json @@ -0,0 +1,71 @@ +{ + "schema": 1, + "minecraft": "26.3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "commands": { + "wrap": 12026, + "create": 384, + "query": 234497, + "local": 38400, + "volume": 14208, + "stack": 723, + "normal": 3600 + }, + "inputs_sha256": "358956a9ee89ce2db357f6ad9b8b3c1fba68008d044af4758f3ae73e1249ad6d", + "rust_output_sha256": "21a1c084822f9ea6e97421e4280727fae1b9c01c1b04e1f44e552ccb84b6e92b", + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaNoiseOracle.java": "ac087a06452fbbe2823875cd771d7c06be313f3320aa0efa6e16c64c399c562e", + "tools/test_noise_parity.py": "3f2bcccc2fb8ff42f7d9d9b4c8f8df992195779144113309de8f411780fce595", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "86e7a87439acf5458be3c9b6ed5dfc3705170f39483ec0f1c2b723b4f5e3ff28", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "f00ebba7484168ae0064fa993ace9afafb323c3222ab80cfee3792bd98562e8d", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-core/Cargo.toml": "f9aff52d34439ed6511b026beee5cbd9918f34cc0a67e90e441df12c905a6dc0", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "faae2edce8b573fd32fcb4bd1f898be7d700a5b38479439f5bec96df764688fd" + }, + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "21a1c084822f9ea6e97421e4280727fae1b9c01c1b04e1f44e552ccb84b6e92b", + "matched_output_lines": 1443539 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "21a1c084822f9ea6e97421e4280727fae1b9c01c1b04e1f44e552ccb84b6e92b", + "matched_output_lines": 1443539 + } + ], + "scope": "26.3 gradient offsets, permutation tables, constructor RNG consumption, ranges, coordinate wrap, Perlin 2D/3D and derivative accumulation, simplex 2D/3D with both offset modes, smeared Perlin 2D/3D and inherited unsmeared derivatives; bounded strided density volumes, wrapped block coordinates, flat indices, cached and scalar bulk accumulation with preserved buffer tails; nested and flattened noise stacks; normal-noise octave construction, enabled/disabled/legacy normalization, parity factory, modern positional seeding, legacy Nether biome initialization, failure draw state, scalar and bulk sampling. Finite outputs and signed zeros compared by bits; NaNs canonicalized. No serialized noise definitions, density-function graphs, generated terrain, gameplay, rendering or performance claim." +} diff --git a/benchmarks/rust-piston-shape-2026-10-06/scoped-parity.json b/benchmarks/rust-piston-shape-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..d13eb0942 --- /dev/null +++ b/benchmarks/rust-piston-shape-2026-10-06/scoped-parity.json @@ -0,0 +1,177 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "block_states": 35723, + "kinematic_cases": 10000, + "fixtures": 102315, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPistonShapeOracle.java": "f8ce2b8d50a2ca8dfd131968cf79437af6ec686a827fdc0841dcd528418f43de", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceSupportOracle.java": "9ce939a435842867786fed648951bbe77f6ab843f6df09af15f3deb1948c4877", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "02acfbae94aee306c5a4e1db7c86c68f7d6156ddd3dd477dc9e9d06e5ca98118", + "tools/test_piston_shape_parity.py": "e1bed92b9f9fbdbcd42eba540bdb06c64cd2ddbb9e522943b96cf1764b87860e", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_properties.rs": "e74b368012d4d440dcdbd4d9bcaf80495220b90557f0e0c733b0aa21ad03c53c", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "1bf4ad95fcdf7f2df4e33dde38e08959d9b76a6260838c13e97c2bb59e006294", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "8a2834a9347ee2c2db7cf1c86a064907ec06e9ac16ba9cc3936e315fc4ad49ca", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "d347020c29ea795b6f9554828a84274d27820bdaf6257ce3b2d265c5c9051ecc", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_feature.rs": "7c8f628601a6d835d913c034b0d421a8f83bee6c569033448aac99123ed84a2c", + "crates/horizon-world/src/worldgen/block_predicate.rs": "535c9840de71704f0338b5d77c63084aceb5239644f9ebb6f2993b95acfec042", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "486fe9d8588eb09e0ee5707a0541b0df167b63b0b56c90a2709bfa09a0a3ad19", + "crates/horizon-world/src/worldgen/feature_graph.rs": "fe61a5e43179a7588737a71782ea246811fe2c8721e74793e1ac018c8eb93c34", + "crates/horizon-world/src/worldgen/feature_region.rs": "2c78e5f1bdb08307f8d982f231f1abbc3306cd54348d9023b86ee6ed3516fd33", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "e682d13a21f90605215b79f5d254bf2e524d35e89eab2e3b46384709af80b847", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "09d79c5acf7332e18a9049aed1a05c38a2bccbc6c2f20bbac560f2e58c35c6f5", + "crates/horizon-world/src/worldgen/placement/context.rs": "d801e1831200ddd9161ea960aa0009c9f5b8227d2113027abf88ad48ca259eed", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "fa0616353f07460975ab323357ab280b7f35e7bfe2de6edc08d304316766ed26", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "647f253a7d14d724086b4d146f26295e0da825df86f4adbd6a0e367d5198f3d5", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "821981c893fc84312351503f2be0c06c681d8bc768dade14576697cf047a9f8f", + "crates/horizon-world/examples/piston_shape_fixture.rs": "d3c6ae35bfd1183fcfe5360b0c175bd008c29b0db001bad122dbc2fc3169dab3" + }, + "fixtures_sha256": { + ".local/rust-piston-shape-parity/inputs.txt": "cc974edd3f7053e7b29d9f34695a3dde8bd5fdffdd034e3972f80dc56b4452ec", + ".local/rust-piston-shape-parity/facts.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-piston-shape-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-piston-shape-parity/cached-collision.nbt": "f3a5c6a5b2d51dad6c52e486e2b9989e79fd55db1a9bda6196db399550b04078" + }, + "rust_output_sha256": "c86088bc353d6bb31da1aa6b9918c689bccc67da07129fcb38de21a639fb5ca7", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "c86088bc353d6bb31da1aa6b9918c689bccc67da07129fcb38de21a639fb5ca7", + "matched_output_lines": 1096811 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "c86088bc353d6bb31da1aa6b9918c689bccc67da07129fcb38de21a639fb5ca7", + "matched_output_lines": 1096811 + } + ], + "scope": "Actual moving-piston entity collision shape, interpolation/offset float bits, movement direction and collision-related block-state selection. Every registered moved state is sampled, piston-base/source/extension/head thresholds and all noclip directions are crossed, and dynamic block-entity query failures are compared. Cached collision geometry is imported privately; uncached moved blocks use Rust support selection only in the tested empty-collision-context, absent-block-entity world. Piston ticking, entity pushes, live block entities, networking and full gameplay remain pending." +} diff --git a/benchmarks/rust-placement-2026-10-06/scoped-parity.json b/benchmarks/rust-placement-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..69df2a846 --- /dev/null +++ b/benchmarks/rust-placement-2026-10-06/scoped-parity.json @@ -0,0 +1,153 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 21840, + "modifier_kinds": 17, + "predicate_kinds": 5, + "definitions": 520, + "requested_modifications": 70080, + "requested_counts": 17280, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", + "tools/test_placement_parity.py": "eeb3759f09561e00c9ec436bef84d2c14358a1e839e06b1214580f6fe043fc5d", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "32b937832b7058d86e8557a2012df32be1c97be324f15d0ae85245c45c73b314", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_predicate.rs": "dd8cbda2ec110444950f0b31bf4e088897eab0994674a91568c7b063f8f16210", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/placement/chain.rs": "76832dd4f76b44edfcc8bd52d8115f6e30684bfaea0e0b959ba060f07cc3483d", + "crates/horizon-world/src/worldgen/placement/context.rs": "b36dfd9297896e62770f2085cf934fc08ebd4c030ecc7ae17d864e819a113201", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "f9d264985d0ce6a7eb91a4f559661efbecc5a3fe097ce559f6acbcf0132c8c87", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "7516e20a20479d1c4a9734d7d8e9826740b324869d7afe51eab94bb1bc7c97ae", + "crates/horizon-world/src/worldgen/terrain.rs": "42823918deec5e149dc729a95bfe54aa32d91604098d5eb8452da0162d557d22", + "crates/horizon-world/src/worldgen/value_provider.rs": "ad1c0efffcc201839e3471d7dfa06c39307d8cbabddb4c5aed8389ee7b68737a", + "crates/horizon-world/src/worldgen/weighted.rs": "1ae40b843721d0f1e1c849b984e0a065aacda6e1384e21fc599cda261f996945", + "crates/horizon-world/src/worldgen.rs": "edc1d675acc52d264486a3c8c56e93a21ebf2c6a73da912f35b8fa2a7233cdde", + "crates/horizon-world/examples/placement_fixture.rs": "ad7ba1c87b033f26967e8a3b773bc656e03f41cbbf9e45f2a3687fd0b11c3deb", + "crates/horizon-world/examples/support/placement_queries.rs": "623b98c33245cb584d666a06bd5a3ddf7f19bf77e0ea9dc67be9a242086c063c" + }, + "fixtures_sha256": { + ".local/rust-placement-parity/inputs.txt": "7809f8d0b891cc84e12f317504b67493e2998a1f528517ec918bd49de810b6e5" + }, + "rust_output_sha256": "a9ebcecfb5ada440004a86c2a65de67968d648bdf5126dbdafa92ecf7b575d5a", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "a9ebcecfb5ada440004a86c2a65de67968d648bdf5126dbdafa92ecf7b575d5a", + "matched_output_lines": 1268600 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "a9ebcecfb5ada440004a86c2a65de67968d648bdf5126dbdafa92ecf7b575d5a", + "matched_output_lines": 1268600 + } + ], + "scope": "Actual PlacementModifier.CODEC parsing and modify callbacks for count, in-square, offset, height-range, rarity, random-chance, fixed-position randomly-selected, heightmap, surface-relative-threshold and surface-water-depth modifiers, plus native noise-based and noise-threshold repeating counts and cuboid placement with edge/interior controls and count-on-every-layer scans, predicate filters and environment scans. Logical and inside-world-bounds predicates preserve short-circuiting and offset wrapping; traced world-bound queries expose scan termination, final target tests and failures. Layer scanning uses traced synthetic block strata containing air variants, water/lava, ordinary ground, bubble columns and bedrock; callbacks and injected height/block failures preserve query order and random consumption. Both random modes, repeated calls, zero counts, inclusive provider bounds, nested random choices, anchored and overflowing coordinates, same-chunk fixed filtering, duplicates, malformed fields and failing consumers. Consumer callbacks optionally draw from the shared random stream; subsequent nextLong values verify exact consumption. Contexts use an actual PlacementContext with a traced WorldGenLevel proxy and native noise generator. Heightmap queries use traced synthetic world responses, ordinary/extreme heights and injected query failures; world minimum and generation minimum can differ. Noise count-only calls include extreme ratios, factors, offsets and thresholds without expanding huge position lists. Additional block predicates, biome filtering, configured features, provider encoders, Gaussian providers and complete world generation remain pending." +} diff --git a/benchmarks/rust-replace-block-2026-10-06/scoped-parity.json b/benchmarks/rust-replace-block-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..e803da170 --- /dev/null +++ b/benchmarks/rust-replace-block-2026-10-06/scoped-parity.json @@ -0,0 +1,161 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 14840, + "block_states": 35723, + "integer_properties": 146, + "requested_placements": 44520, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaReplaceBlockOracle.java": "12de4d544e91d7e470fe225389ea8901a9590b89e9a16a1fb3bfc762584cd847", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_replace_block_parity.py": "7c670b047595bf2753a5e362f1c360d58944e2610e8598e4cea22d1ad2c7738b", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "32b937832b7058d86e8557a2012df32be1c97be324f15d0ae85245c45c73b314", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_feature.rs": "23b2a335505bebfa512f2fee699cf0bf69f65b59ddf22add616fc5a3fcf5432c", + "crates/horizon-world/src/worldgen/block_predicate.rs": "dd8cbda2ec110444950f0b31bf4e088897eab0994674a91568c7b063f8f16210", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "486fe9d8588eb09e0ee5707a0541b0df167b63b0b56c90a2709bfa09a0a3ad19", + "crates/horizon-world/src/worldgen/feature_graph.rs": "2297b194514925688dba25016a69d5ba5eb8b869bdfff28f2e611a6742ac5954", + "crates/horizon-world/src/worldgen/feature_region.rs": "4a95a30c0987d97e671f84380e13ddea070ad81f996baa65b2a06c4d892971c7", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "1b976aa4dd2516468196d0af3451e3fdd037493a14d269f54ebdd7254055e05e", + "crates/horizon-world/src/worldgen/placement/context.rs": "b36dfd9297896e62770f2085cf934fc08ebd4c030ecc7ae17d864e819a113201", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "68ecf36954fea5705436d486e9be93836933fd56779022afeb881a0399d6a674", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/value_provider.rs": "ad1c0efffcc201839e3471d7dfa06c39307d8cbabddb4c5aed8389ee7b68737a", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "3ffc2db40a9c2d0ecc2d8de68f9d853c2d11320709139a203d4b3f5f9023fb0a", + "crates/horizon-world/examples/replace_block_fixture.rs": "15a088eb29f4efbe9ec1f872cea0f108cea080424d984516db6f3858217319f6" + }, + "fixtures_sha256": { + ".local/rust-replace-block-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0", + ".local/rust-replace-block-parity/facts-client.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-replace-block-parity/facts-server.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-replace-block-parity/inputs.txt": "cc29f71f4afaa654bcea09f182cfcd3d04bbc64acc5e965e3082e8bfb1e5e132" + }, + "rust_output_sha256": "86fe7a04e08d0f2690843a8dab63cfb27be2fc491e1eb3c7fa053a1d2c05904d", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "86fe7a04e08d0f2690843a8dab63cfb27be2fc491e1eb3c7fa053a1d2c05904d", + "matched_output_lines": 303678 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "86fe7a04e08d0f2690843a8dab63cfb27be2fc491e1eb3c7fa053a1d2c05904d", + "matched_output_lines": 303678 + } + ], + "scope": "Actual replace_single_block feature codecs and native ReplaceBlockFeature.place. Ordered target rules re-read the origin state, short-circuit on the first match, preserve random draw order and write flags, ignore rejected writes, retain partial mutations and stop on injected read/write failures. Bound block/tag/state/height/random/logical targets and malformed unselected entries are compared across both random modes and repeated calls. Full region side effects, structure processors, ore clusters and complete gameplay remain pending." +} diff --git a/benchmarks/rust-rule-test-2026-10-06/scoped-parity.json b/benchmarks/rust-rule-test-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..686e1c15a --- /dev/null +++ b/benchmarks/rust-rule-test-2026-10-06/scoped-parity.json @@ -0,0 +1,163 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "block_states": 35723, + "blocks": 1286, + "integer_properties": 146, + "codec_inputs": 75920, + "rule_types": 10, + "block_tag_files": 300, + "requested_tests": 1866052, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRuleTestOracle.java": "881ca5018ee48b5853f98aa1232462523a9bf6b3b5818e27a5a2a4a809a8bca2", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rule_test_parity.py": "ac7d41cda769b1538dd6bcfb8b5b21215b869220b35defb07725d0eb58f8c1ae", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "32b937832b7058d86e8557a2012df32be1c97be324f15d0ae85245c45c73b314", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_feature.rs": "2f5e4f01628dd783c3c21203be533db585caacfe3eb26037fc5cd05e574d8273", + "crates/horizon-world/src/worldgen/block_predicate.rs": "dd8cbda2ec110444950f0b31bf4e088897eab0994674a91568c7b063f8f16210", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "486fe9d8588eb09e0ee5707a0541b0df167b63b0b56c90a2709bfa09a0a3ad19", + "crates/horizon-world/src/worldgen/feature_graph.rs": "5df2e58e2070b3a9e205b3cb7f52936fad16b5bcf538c2c2861a9d94d5ea90c1", + "crates/horizon-world/src/worldgen/feature_region.rs": "4a95a30c0987d97e671f84380e13ddea070ad81f996baa65b2a06c4d892971c7", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/placement/chain.rs": "1b976aa4dd2516468196d0af3451e3fdd037493a14d269f54ebdd7254055e05e", + "crates/horizon-world/src/worldgen/placement/context.rs": "b36dfd9297896e62770f2085cf934fc08ebd4c030ecc7ae17d864e819a113201", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "68ecf36954fea5705436d486e9be93836933fd56779022afeb881a0399d6a674", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/value_provider.rs": "ad1c0efffcc201839e3471d7dfa06c39307d8cbabddb4c5aed8389ee7b68737a", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "8494d32cbc0bf0b8f4b50c7e83e123f66d12490181844f14f633921dd7e20676", + "crates/horizon-world/examples/rule_test_fixture.rs": "91aa337a4d2b44b37003716658bbcd739479f23714471a2f2af73fb23cb58310" + }, + "fixtures_sha256": { + ".local/rust-rule-test-parity/inputs.txt": "4c101191c2f0feb5f4c9597dc90eba62246af06ab60ece43ff9535e88973da6d", + ".local/rust-rule-test-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0", + ".local/rust-rule-test-parity/facts-client.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-rule-test-parity/facts-server.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b" + }, + "rust_output_sha256": "22050d0a64e4406d86231a0d905d978a294734e1a5adc9501b819ebd3f3fa5e3", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "22050d0a64e4406d86231a0d905d978a294734e1a5adc9501b819ebd3f3fa5e3", + "matched_output_lines": 1890716 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "22050d0a64e4406d86231a0d905d978a294734e1a5adc9501b819ebd3f3fa5e3", + "matched_output_lines": 1890716 + } + ], + "scope": "Actual RuleTest.CODEC and all ten registered replacement-rule types. Every block and block-state identity, all bundled block tags, absent tags, inclusive and reversed height ranges, unrestricted random probabilities, logical short-circuit evaluation, malformed inputs, both random modes and subsequent draws are compared. Registry metadata and tag resources independently agree across authenticated JARs. Bound tags are immutable snapshots. Replacement feature mutations, structure processors, reload ownership and complete gameplay remain outside this standalone comparison." +} diff --git a/benchmarks/rust-scattered-ore-2026-10-06/scoped-parity.json b/benchmarks/rust-scattered-ore-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..e5abaaeb2 --- /dev/null +++ b/benchmarks/rust-scattered-ore-2026-10-06/scoped-parity.json @@ -0,0 +1,161 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 11544, + "block_states": 35723, + "integer_properties": 146, + "requested_placements": 23088, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaScatteredOreOracle.java": "3c635f6a2c169688db210710eebb269a91fad6432fc84485a41f1059f9a6e895", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_scattered_ore_parity.py": "7834042bcba27f5f538a063e173d49b73f7b1a174fda2086c3e4955a4ea9daed", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "32b937832b7058d86e8557a2012df32be1c97be324f15d0ae85245c45c73b314", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_feature.rs": "23b2a335505bebfa512f2fee699cf0bf69f65b59ddf22add616fc5a3fcf5432c", + "crates/horizon-world/src/worldgen/block_predicate.rs": "dd8cbda2ec110444950f0b31bf4e088897eab0994674a91568c7b063f8f16210", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "486fe9d8588eb09e0ee5707a0541b0df167b63b0b56c90a2709bfa09a0a3ad19", + "crates/horizon-world/src/worldgen/feature_graph.rs": "2297b194514925688dba25016a69d5ba5eb8b869bdfff28f2e611a6742ac5954", + "crates/horizon-world/src/worldgen/feature_region.rs": "4a95a30c0987d97e671f84380e13ddea070ad81f996baa65b2a06c4d892971c7", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "1b976aa4dd2516468196d0af3451e3fdd037493a14d269f54ebdd7254055e05e", + "crates/horizon-world/src/worldgen/placement/context.rs": "b36dfd9297896e62770f2085cf934fc08ebd4c030ecc7ae17d864e819a113201", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "68ecf36954fea5705436d486e9be93836933fd56779022afeb881a0399d6a674", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/value_provider.rs": "ad1c0efffcc201839e3471d7dfa06c39307d8cbabddb4c5aed8389ee7b68737a", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "3ffc2db40a9c2d0ecc2d8de68f9d853c2d11320709139a203d4b3f5f9023fb0a", + "crates/horizon-world/examples/scattered_ore_fixture.rs": "1f5d77e1ce57230a1ca80870fd139fad8405a74e36b18bc781e2cdd61ec3eddf" + }, + "fixtures_sha256": { + ".local/rust-scattered-ore-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0", + ".local/rust-scattered-ore-parity/facts-client.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-scattered-ore-parity/facts-server.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-scattered-ore-parity/inputs.txt": "16b9b7dc315f01f8a86a063323f261e91047096131e46df9fbf721eccdaa8c0f" + }, + "rust_output_sha256": "2f63fa6cb1317368053a1983f0cac8914c8f3139bee1ddb1d3e376b8c9913c29", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "2f63fa6cb1317368053a1983f0cac8914c8f3139bee1ddb1d3e376b8c9913c29", + "matched_output_lines": 758484 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "2f63fa6cb1317368053a1983f0cac8914c8f3139bee1ddb1d3e376b8c9913c29", + "matched_output_lines": 758484 + } + ], + "scope": "Actual scattered_ore feature codec and native ScatteredOreFeature.place. Attempt counts, six float draws per offset, Java rounding, wrapped coordinates, state capture per attempt, ordered target predicates, conditional air-exposure draws, directional neighbor reads, early air detection and mutation flags/results/errors are compared. Both random modes, size/discard boundaries, empty targets, repeated calls, solid/mixed/directional-air worlds and partial failures are included. Complete ore veins, region side effects, chunk decoration and gameplay remain pending." +} diff --git a/benchmarks/rust-state-provider-2026-10-06/scoped-parity.json b/benchmarks/rust-state-provider-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..44f186dd5 --- /dev/null +++ b/benchmarks/rust-state-provider-2026-10-06/scoped-parity.json @@ -0,0 +1,213 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "block_states": 35723, + "blocks": 1286, + "integer_properties": 146, + "codec_inputs": 299507, + "provider_types": 10, + "named_providers": 22, + "rule_predicate_types": 16, + "survival_supported_blocks": 1138, + "survival_supported_states": 31171, + "support_cached_states": 35524, + "support_dynamic_states": 199, + "biomes": 67, + "biome_tag_files": 88, + "fluid_tag_files": 11, + "bundled_provider_definitions": 8, + "block_tag_files": 302, + "requested_samples": 39270062, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaStateProviderOracle.java": "33ca3001656490ad4eb66e1e61ded306de4e448210eb7aca6299a068780761a0", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMaterialConditionOracle.java": "04a87405fd2a1c79baf4eb3a8895aa66dc96b8f6baffb9b486ef207f8b91b5ee", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeTemperatureOracle.java": "243bbc525c6aec24674e7f172c5fb4f7b50f9a679d8b9dfba40ea278219a2d28", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaAnchorOracle.java": "226628d98b89aadbdd374936575d033945e7064a900dbb050c662204dbc7e119", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java": "82e5cadbcdcba5b4577c56c5a033262b066ccc4cc4a14c7c48ce46c4c6247a03", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSupportOracle.java": "04350901a2d708fb8fa672de61d058f73f332d2e90df1b93a67781862f89c1ad", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSurvivalOracle.java": "00010bad8feea549c4243787e0d594b467a3227236a38c2e528d4247c7ba1c70", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "02acfbae94aee306c5a4e1db7c86c68f7d6156ddd3dd477dc9e9d06e5ca98118", + "tools/test_block_survival_parity.py": "e2f661afbf67a8726c9423d610f8b05b9e348c8140c40efb3aafaca0291efe31", + "tools/test_biome_temperature_parity.py": "68f84d02e7802349e491b8cb66e18d9b08c9e72ab2306b663667259e852cc2b1", + "tools/test_material_condition_parity.py": "01c82e1a768d9131f8f7e6d59d01ddb06272074469dbdcd8547f44f0a8fa152d", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_state_provider_parity.py": "f52ab05832e9e9acf8aae779c3e199a1cd836592f1a993837edb0757d87b0f55", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_properties.rs": "e74b368012d4d440dcdbd4d9bcaf80495220b90557f0e0c733b0aa21ad03c53c", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "d7e4ba3709fe1fe1b4998d067080bf48ebfc549cdfc883d8d648d13d6fdf4e3f", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "1bf4ad95fcdf7f2df4e33dde38e08959d9b76a6260838c13e97c2bb59e006294", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "8a2834a9347ee2c2db7cf1c86a064907ec06e9ac16ba9cc3936e315fc4ad49ca", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "69cdc611b7a7e20a7da705fcc25de6b97cdb64cf63f954be49d0a11f9a820465", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_feature.rs": "6be7c0161cecf1362c196e91ecbeb166e16c8da3731d988ce8f2308f06209265", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "486fe9d8588eb09e0ee5707a0541b0df167b63b0b56c90a2709bfa09a0a3ad19", + "crates/horizon-world/src/worldgen/feature_graph.rs": "fe61a5e43179a7588737a71782ea246811fe2c8721e74793e1ac018c8eb93c34", + "crates/horizon-world/src/worldgen/feature_region.rs": "2c78e5f1bdb08307f8d982f231f1abbc3306cd54348d9023b86ee6ed3516fd33", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "e682d13a21f90605215b79f5d254bf2e524d35e89eab2e3b46384709af80b847", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "cd1d2fe305ad4e205e7e01b32128ff895fa8aacc76fa11f200ad6c7c9fba1f49", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "fa0616353f07460975ab323357ab280b7f35e7bfe2de6edc08d304316766ed26", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "89cb0410899608545aa1ba3b1b4c1babf533fb25efd341feab1c87661f44f7b9", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "821981c893fc84312351503f2be0c06c681d8bc768dade14576697cf047a9f8f", + "crates/horizon-world/examples/state_provider_fixture.rs": "ec20f6ee5b3d1f2e69c4c5345fd31ef98ef660fc26b69ac0145e4d8473bca498" + }, + "fixtures_sha256": { + ".local/rust-state-provider-parity/inputs.txt": "8b4ebd390ba64d0c9af15df6355c1722dffb4485248deb784e141d447cec512d", + ".local/rust-state-provider-parity/survival-classes.json": "361832008eea0aa9151d367a125a19c6353d99a0b88b27dd0682f55b7954553e", + ".local/rust-state-provider-parity/survival-rules.json": "2d82abb640c1235179e195b0234b13f3b74af84741b1b739aa6cec648ab3b3d2", + ".local/rust-state-provider-parity/cached-support.nbt": "b6fdc9471b0b61e904206d3f099f4dc235aad6d723536c210be0cb7c3560d82c", + ".local/rust-state-provider-parity/support-cached-states.json": "353945a58fe69b352925473f1693f9b14a9ad19f13c15159c4184f2c29258622", + ".local/rust-state-provider-parity/block-properties.nbt": "699a994c5c0c9f7ee58e35b9c23c4503a5936efe84133643113232f825ae2216", + ".local/rust-state-provider-parity/cached-collision.nbt": "f3a5c6a5b2d51dad6c52e486e2b9989e79fd55db1a9bda6196db399550b04078", + ".local/rust-state-provider-parity/biomes.json": "9b26dc3b662627dc3bbbf8da209f287882ce79ff4daf8f454b994ddc7510df99", + ".local/rust-state-provider-parity/biome_tags.json": "2c0193d998b196c2b909e92f51e8158f5e8773f5387ade5a8b85a85f063ca560", + ".local/rust-state-provider-parity/fluid-tags.json": "244b4f208fd0d14613e1ded922c13ccb30a57b0b85db77b8922d3564e224774f", + ".local/rust-state-provider-parity/catalog.json": "7331cac31ef90434ab71ac75bad0a68e9abfd96942416a650a7d0e75f0ab558e", + ".local/rust-state-provider-parity/providers.json": "65f3c3a9a45682d9f654f772c871d70bced81fb133209b29cac06e26a1409c75", + ".local/rust-state-provider-parity/tags.json": "58948bd795faff8714b71ba1076afc68a645591e043ab97f1dec69817ed6885a", + ".local/rust-state-provider-parity/facts-client.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-state-provider-parity/facts-server.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b" + }, + "rust_output_sha256": "aa089984db4632a9b1e2d1c965fa0429f9d8b034e2ceb200bccbe2a4a5b545c8", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "aa089984db4632a9b1e2d1c965fa0429f9d8b034e2ceb200bccbe2a4a5b545c8", + "matched_output_lines": 105340143 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "aa089984db4632a9b1e2d1c965fa0429f9d8b034e2ceb200bccbe2a4a5b545c8", + "matched_output_lines": 105340143 + } + ], + "scope": "Actual BlockStateProvider DIRECT_CODEC/TYPED_CODEC and simple, weighted, random_block, rotated, copy_properties, randomized_int three noise-based providers and rule_based over the pinned state registry. All states and block defaults, full-state versus typed exclusive decoding, ordered holder sets/tags, duplicates, empty optional results versus world-state fallback, zero/overflow weights, query failures, every state across six fixed rotations, nested random rotations, property copying for every target state against representatives of every compatible property value, integer-property ranges/missing properties, composed transforms and subsequent random consumption. Native property equality families are checked for ambiguity; Rust validates Cartesian state tables and uses compact property strides. Both legacy/xoroshiro streams execute directly and through WorldgenRandom. Noise comparisons include every bundled provider definition, independent legacy seeding, float/double scaling, dual-noise variety selection, threshold draw order and coordinate/codec boundaries. Rule-based comparisons cover true/not/all_of/any_of/inside_world_bounds/height_range/volume_match/matching_block_tag/matching_blocks/matching_fluids/matching_biomes/unobstructed/solid/replaceable/has_sturdy_face/would_survive predicates, ordered optional results, fallbacks, nested rules and world-query failures. Every pinned block-state fluid identity, amount, falling/source flag and own-height bits are derived from descriptors and compared. Fluid-holder sets and all bundled fluid tags are tested against every state. Biome-holder membership and all bundled biome tags are compared across every pinned biome identity, including empty sets, missing names, ordered world queries and short-circuit composition. Unobstructed predicates compare null excluded entities, exact translated unit-shape bounds, ignored-but-validated offsets, true/false world results and failures. Named holder versus direct/typed decoding, nested named providers, missing names, inline ambiguity, ordered resource registration and all bundled named definitions are compared. Solidity and replacement predicates cover every block state, offset wrapping/validation, empty-child fallthrough, composed predicates and query failures using privately imported definition flags and Rust-calculated collision solidity. Has-sturdy-face predicates cover all 35,723 states through unified cached/dynamic support dispatch across six directions, native offset rules, failed state reads, block-entity query failures and ordered optional-child/boolean composition. Block entities are absent in this integration corpus; shulker animation-state shape selection is separately tested and active moving-piston entity collision generation remains pending. Would-survive decodes candidate states and bounded offsets, evaluates all supported candidate states and each rule against every neighbor state, and preserves world read/entity failures and short-circuit/optional-child behavior. Survival support is limited to the rule families explicitly recorded here; unsupported survival families, complete registry loading/reloading, full block placement behavior and full feature generation remain pending." +} diff --git a/benchmarks/rust-structure-density-2026-10-06/scoped-parity.json b/benchmarks/rust-structure-density-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..b1b4e9bfd --- /dev/null +++ b/benchmarks/rust-structure-density-2026-10-06/scoped-parity.json @@ -0,0 +1,115 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 183, + "scalar_queries": 28093, + "volumes": 339, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaStructureDensityOracle.java": "24fa3c5ac568997ede53cebc4bf9c8a98ba0586e195c74c2217a2770c8c104ec", + "tools/test_structure_density_parity.py": "9020711ae9f53c950c7a644a5587f0298f3bae272ce501cf653df51b85bddf4a", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "3968e2a337a6a23226c485057c79359e66df16683f00fb4ebc9fabb03910a015", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry.rs": "f46065659e60eb5e84ad69b9f3b5e94dc87ee19de16408817e26f23d16b6c7e7", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "7516e20a20479d1c4a9734d7d8e9826740b324869d7afe51eab94bb1bc7c97ae", + "crates/horizon-world/src/worldgen/terrain.rs": "134cf93b53a40fb1ed0e0170c90316c80e270773b2968c63dc3f9cef2c941bff", + "crates/horizon-world/src/worldgen.rs": "b89dd4a9de02caf6bce457304a105ffbc0f0f220f8647c095852a45a1bf292bb", + "crates/horizon-world/examples/structure_density_fixture.rs": "780cbf5dbf1f948e2d8aac54eff67a900de652fe31eb007f55dd33177f38fdab" + }, + "fixtures_sha256": { + ".local/rust-structure-density-parity/inputs.txt": "1c948f36b4741ce0f5a16ccd5c3bda0626274a40ccdfcaabb95210336ed21836" + }, + "rust_output_sha256": "09f0779c2f39773e4772b259ab06a217f98324b5acb0bda472d603f543ef9bf1", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "09f0779c2f39773e4772b259ab06a217f98324b5acb0bda472d603f543ef9bf1", + "matched_output_lines": 1360095 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "09f0779c2f39773e4772b259ab06a217f98324b5acb0bda472d603f543ef9bf1", + "matched_output_lines": 1360095 + } + ], + "scope": "Actual vanilla Beardifier constructor and scalar/bulk samplers from supplied ordered rigid pieces, jigsaw junctions and normalized affected bounds. Five terrain-adjustment modes, the full 24-cubed junction kernel neighborhood, ground-level offsets and extreme wrapping arithmetic, ordered accumulation, nullable/empty affected bounds, clipped strided volumes including scalar/bulk floor-clipping differences and oversized output tails. Floating outputs compared as canonical-NaN raw bits. Live structure discovery/filtering, invalid bounding-box repair, structure placement and terrain integration remain pending. Local Math.pow-derived kernel results do not establish cross-platform math parity." +} diff --git a/benchmarks/rust-terrain-2026-10-06/scoped-parity.json b/benchmarks/rust-terrain-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..8e06e6bb0 --- /dev/null +++ b/benchmarks/rust-terrain-2026-10-06/scoped-parity.json @@ -0,0 +1,123 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "block_states": 35723, + "block_tag_files": 300, + "fixtures": 114, + "fill_calls": 200, + "noise_aquifer_fixtures": 61, + "structure_density_fixtures": 24, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaTerrainOracle.java": "47887c16a4106e6a9ef4d665fd4603ea23b62e38491376bcf9038b904e39b406", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_terrain_parity.py": "8bb8e716e957ef07d1117ed9939fab1b551ebab94d20e48d11f64bc477e4571f", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/test_worldgen_parity.py": "3574ac73f81e3a6606ac9d3c16fa2c50b57a37b89be52e7d5448e7045c41a9ee", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "3968e2a337a6a23226c485057c79359e66df16683f00fb4ebc9fabb03910a015", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry.rs": "f46065659e60eb5e84ad69b9f3b5e94dc87ee19de16408817e26f23d16b6c7e7", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "7516e20a20479d1c4a9734d7d8e9826740b324869d7afe51eab94bb1bc7c97ae", + "crates/horizon-world/src/worldgen/terrain.rs": "134cf93b53a40fb1ed0e0170c90316c80e270773b2968c63dc3f9cef2c941bff", + "crates/horizon-world/src/worldgen.rs": "b89dd4a9de02caf6bce457304a105ffbc0f0f220f8647c095852a45a1bf292bb", + "crates/horizon-world/examples/terrain_fixture.rs": "eb521404a3e850be522f3bda2f7c724c7d1b66e154e1bc53121b4e7511e5b1bd" + }, + "fixtures_sha256": { + ".local/rust-terrain-parity/inputs.txt": "a9ddccd711b0b6bdcae612a21f2b0dc143e156c9c97f47fce33071c7ceb660bd", + ".local/rust-terrain-parity/registries.json": "2a4e6b29a707ebbb7261f978b9e0dcd372f0c8548e2fb7e00c6bebb043bc49b9", + ".local/rust-terrain-parity/facts-client.json": "1d24883ee807b0b71473f0bbf8ed548ddaf712148caeb3fcc7aa13ab973a97b0", + ".local/rust-terrain-parity/facts-server.json": "1d24883ee807b0b71473f0bbf8ed548ddaf712148caeb3fcc7aa13ab973a97b0" + }, + "rust_output_sha256": "ff3612b2d998278b65c1b453b9df73ecf198151b8d094c150c16872106212bfc", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "ff3612b2d998278b65c1b453b9df73ecf198151b8d094c150c16872106212bfc", + "matched_output_lines": 7950873 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "ff3612b2d998278b65c1b453b9df73ecf198151b8d094c150c16872106212bfc", + "matched_output_lines": 7950873 + } + ], + "scope": "Noise-stage filling only, using actual vanilla NoiseBasedChunkGenerator.doFill and NoiseChunk with empty blending and empty or supplied rigid-piece/junction structure fields. Independently authenticated client/server registry resources and exported block identities/properties/air/fluid facts must agree. Rust compiles the final density and optional aquifer through a shared compiler/context, writes resident block sections, updates ocean-floor/world-surface worldgen heightmaps and records ordered per-section fluid postprocessing offsets. Comparisons cover every raw section state, heightmap word and postprocessing offset after each fill, all bundled routers/aquifers, both seeded random factories, synthetic roots, prefilled chunks, partial vertical volumes, repeated fills and structure-density bindings in final-density/aquifer graphs. Block behavior facts remain imported; actual biome properties and material rules are not evaluated. Surface/material/carver/feature/structure stages, nonempty blending and live structure discovery, complete generated worlds and gameplay/rendering remain pending." +} diff --git a/benchmarks/rust-ticks-2026-10-05/scoped-parity.json b/benchmarks/rust-ticks-2026-10-05/scoped-parity.json new file mode 100644 index 000000000..c30f13981 --- /dev/null +++ b/benchmarks/rust-ticks-2026-10-05/scoped-parity.json @@ -0,0 +1,87 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "commands": { + "reset": 23, + "add": 1507, + "schedule": 13944, + "save": 814, + "tick": 2096, + "chunk": 1067, + "query": 976, + "load": 5, + "unpack": 5, + "remove": 1125, + "restore": 1145, + "copy": 423, + "clear": 558, + "enable": 1350, + "reload": 777 + }, + "inputs_sha256": "74c8b7c4cd29148e7a47834986d26e32d6eb45e59c8727984ecb0911a6c288eb", + "rust_output_sha256": "3f82d7de0cd6d114e8b52920ada98067134e7394880958d599d8faf2088ede98", + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaTickOracle.java": "17bfb6ed3b35f20b84ee989e2688fa8754ed6a74c7f95663e75583ca9ac602f2", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaTickDataOracle.java": "00a7ac5795ff0a3e489d0b41cb5ba40f00f04e560699d5d6d4641b96736ecda4", + "tools/test_tick_parity.py": "ca1fd537a77a0dfd1144e408028010e76d9bb8d82cf6121db7d7dc99d3a75949", + "tools/test_rust_parity.py": "500652427164c7e067a5eb69310ec81f843d5fe37a7c9d88edd2b1ca6606020a", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "faae2edce8b573fd32fcb4bd1f898be7d700a5b38479439f5bec96df764688fd", + "crates/horizon-core/Cargo.toml": "09243cac4d45e8b4aaed3a6169bf3ee0e1272fdff4298c43c80d5fff0116d01c", + "crates/horizon-world/Cargo.toml": "e3250c38fb21b149b5ccaf3c90b5c87ff15b2902f5204b7159207ef7fbf229f2", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/parity.rs": "7b455f2181862e1430e7387633c146877c2d317c2ea682c1e6fa64345dbc5885", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "acaa0a51a759e1a08d417538e567847a66b8c9ae6a7434872e1621ed210364b1", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random.rs": "2f304dfb580a6bc1b5c51b048a2fa2a57f73c5f28f5eb2447f925bf138513389", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/lib.rs": "521ed8987f9fc21e9df75206795414871611e5b6acbf3906c26f44a4c6e6115e", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry.rs": "f46065659e60eb5e84ad69b9f3b5e94dc87ee19de16408817e26f23d16b6c7e7", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/examples/tick_fixture.rs": "df267c307e0491a238b2d93edf0384514f38f8ee3252e315b989de56c6e17990" + }, + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "3f82d7de0cd6d114e8b52920ada98067134e7394880958d599d8faf2088ede98", + "matched_output_lines": 97776, + "block_ticks": 251, + "fluid_ticks": 251, + "region_chunks": 1 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "3f82d7de0cd6d114e8b52920ada98067134e7394880958d599d8faf2088ede98", + "matched_output_lines": 97776, + "block_ticks": 251, + "fluid_ticks": 251, + "region_chunks": 1 + } + ], + "scope": "Scheduled tick ordering, deduplication, save packing, chunk eligibility/loading and callback mutations only. Block/fluid behavior is not implemented." +} diff --git a/benchmarks/rust-value-provider-2026-10-06/scoped-parity.json b/benchmarks/rust-value-provider-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..d6c3ab752 --- /dev/null +++ b/benchmarks/rust-value-provider-2026-10-06/scoped-parity.json @@ -0,0 +1,151 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 5040, + "definitions": 504, + "samples_per_valid_fixture": 64, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaValueProviderOracle.java": "7cbaea3053efe6d861a05f9ab1cbd772c8010218b95102ff05d4028139c333bd", + "tools/test_value_provider_parity.py": "38f34d1a7b7ecc8acafd563c8acd74f12be930d4b1e181e371782a315cf84a87", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "32b937832b7058d86e8557a2012df32be1c97be324f15d0ae85245c45c73b314", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_predicate.rs": "dd8cbda2ec110444950f0b31bf4e088897eab0994674a91568c7b063f8f16210", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_graph.rs": "5dfb83b9f97eb24b386e3514aaac957b314461b32d59e1fdb6dcac7ca0a32e1b", + "crates/horizon-world/src/worldgen/feature_region.rs": "4a95a30c0987d97e671f84380e13ddea070ad81f996baa65b2a06c4d892971c7", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/placement/chain.rs": "1b976aa4dd2516468196d0af3451e3fdd037493a14d269f54ebdd7254055e05e", + "crates/horizon-world/src/worldgen/placement/context.rs": "b36dfd9297896e62770f2085cf934fc08ebd4c030ecc7ae17d864e819a113201", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "68ecf36954fea5705436d486e9be93836933fd56779022afeb881a0399d6a674", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "7516e20a20479d1c4a9734d7d8e9826740b324869d7afe51eab94bb1bc7c97ae", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/value_provider.rs": "ad1c0efffcc201839e3471d7dfa06c39307d8cbabddb4c5aed8389ee7b68737a", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "f18a6c0e66cadec431d2e3154ad70d96b3be623e675f939d4419858f2cce92ab", + "crates/horizon-world/examples/value_provider_fixture.rs": "ed66e3bb34c3d3c73c1e143843f7245f0c02eb36d584d856b6a15a8600caf5d1" + }, + "fixtures_sha256": { + ".local/rust-value-provider-parity/inputs.txt": "ec80fb8b841488b4167aaecf5417cbcbc39891ffb0fdff18ffd947affdd96492" + }, + "rust_output_sha256": "0115440c04ca851e177582e815b590409ba4af7b0d66e77806c2fba8ee82081d", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "0115440c04ca851e177582e815b590409ba4af7b0d66e77806c2fba8ee82081d", + "matched_output_lines": 429920 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "0115440c04ca851e177582e815b590409ba4af7b0d66e77806c2fba8ee82081d", + "matched_output_lines": 429920 + } + ], + "scope": "Actual FloatProviders.CODEC and IntProviders.CODEC decoding, declared ranges, seeded samples and interleaved subsequent nextLong values. Covers constant/uniform/trapezoid floats and constant/uniform/biased-to-bottom/very-biased-to-bottom/trapezoid/clamped/weighted-list integers, both random modes, numeric narrowing, signed zeros, overflow, equal/reversed bounds, negative plateaus, missing fields, duplicate keys and sampling failures. Float NaNs are canonicalized. Weighted lists include zero weights, singleton draws, nested providers, 63/64/65 weight totals, maximum/overflow totals and malformed entries; native constructor rejections count as decode errors. Gaussian providers, encoding, height providers and complete generation remain outside this scope." +} diff --git a/benchmarks/rust-world-2026-10-05/scoped-parity.json b/benchmarks/rust-world-2026-10-05/scoped-parity.json new file mode 100644 index 000000000..6e441300a --- /dev/null +++ b/benchmarks/rust-world-2026-10-05/scoped-parity.json @@ -0,0 +1,77 @@ +{ + "schema": 1, + "minecraft": "26.3", + "data_version": 5023, + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "references": [ + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "nbt_pairs": 32, + "palettes": 44, + "palette_values": 123776, + "region_chunks": 48, + "registry_states": 35723, + "resident_values": 8192 + }, + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "nbt_pairs": 32, + "palettes": 44, + "palette_values": 123776, + "region_chunks": 48, + "registry_states": 35723, + "resident_values": 8192 + } + ], + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaWorldOracle.java": "d7cf12dda8c284d6a9b3a1e08ee60831a20dea3883e227b51c5b268636421fd0", + "tools/test_world_parity.py": "cb86934e74b0840dcec2c3de1bf252307edc86d1ba650032ca28506536e39438", + "tools/test_rust_parity.py": "500652427164c7e067a5eb69310ec81f843d5fe37a7c9d88edd2b1ca6606020a", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "faae2edce8b573fd32fcb4bd1f898be7d700a5b38479439f5bec96df764688fd", + "crates/horizon-world/Cargo.toml": "e3250c38fb21b149b5ccaf3c90b5c87ff15b2902f5204b7159207ef7fbf229f2", + "crates/horizon-world/examples/collision_fixture.rs": "ee754b5b42e0a51fe0a305b3f4bb56522ff3fffae564180aab8087b1b9e44afc", + "crates/horizon-world/examples/tick_fixture.rs": "df267c307e0491a238b2d93edf0384514f38f8ee3252e315b989de56c6e17990", + "crates/horizon-world/examples/world_fixture.rs": "a3c4c0f5131ae051b24662eff0ed11ed797c6fd5069fbfdf819f0e3fcdfb2cf4", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/lib.rs": "521ed8987f9fc21e9df75206795414871611e5b6acbf3906c26f44a4c6e6115e", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry.rs": "f46065659e60eb5e84ad69b9f3b5e94dc87ee19de16408817e26f23d16b6c7e7", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/tests/collision_data.rs": "45f3d33b36efe720e99ebf75b9f4fbddd777cebea4618bba245ca106b3443391", + "crates/horizon-world/tests/tick_data.rs": "ab345209367db6963b987797992c4a06433bd2039e6021bd834f6305324c04d7", + "crates/horizon-world/tests/world_io.rs": "4a42630c99ce89b27cc2be1a1b961ad880f62762ab661f9e92ef9bcf7f3e76e0", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/parity.rs": "7b455f2181862e1430e7387633c146877c2d317c2ea682c1e6fa64345dbc5885", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "acaa0a51a759e1a08d417538e567847a66b8c9ae6a7434872e1621ed210364b1", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random.rs": "2f304dfb580a6bc1b5c51b048a2fa2a57f73c5f28f5eb2447f925bf138513389", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e" + }, + "notes": [ + "Synthetic NBT and region fixtures serialized and verified by pinned vanilla classes.", + "Includes all four region codecs, external oversized chunks, UTF-16 edge cases, mixed lists, palette mutation, and the full exported block-state ID registry.", + "Storage-only edits; no world generation, simulation, lighting, live multiplayer, renderer, FPS or whole-game parity claim." + ] +} diff --git a/benchmarks/rust-worldgen-2026-10-05/scoped-parity.json b/benchmarks/rust-worldgen-2026-10-05/scoped-parity.json new file mode 100644 index 000000000..bc588a6de --- /dev/null +++ b/benchmarks/rust-worldgen-2026-10-05/scoped-parity.json @@ -0,0 +1,307 @@ +{ + "schema": 1, + "minecraft": "26.3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "commands": 16770, + "command_counts": { + "noise": 2111, + "quantize": 4116, + "index": 229, + "climate_parameter": 25, + "climate_point": 183, + "noise_settings": 217, + "settings_create": 182, + "aquifer": 9136, + "noise_aquifer": 379, + "registry": 24, + "router": 168 + }, + "noise_aquifer_injected_failures": { + "0": 3, + "1": 3, + "2": 3, + "3": 3, + "4": 3, + "5": 3 + }, + "noise_aquifer_outcomes": { + "1 false": 5800, + "0 false": 9995, + "default_solid false": 12655, + "2 false": 35365, + "0 true": 1114, + "2 true": 2021, + "1 true": 43, + "5 false": 443, + "5 true": 5, + "6 false": 295, + "6 true": 8, + "7 false": 49, + "7 true": 1, + "4 false": 51, + "4 true": 4, + "error false": 17, + "3 false": 81, + "error true": 2 + }, + "noise_registry_entries": 64, + "density_registry_entries": 55, + "noise_settings_entries": 7, + "biome_parameter_entries": { + "minecraft:nether": 5, + "minecraft:overworld": 7594 + }, + "biome_tables_sha256": { + "minecraft:nether": "09e477f851380a6e726ea85fee39cd1d41c7f160fe424f58cb3f0056b5c11218", + "minecraft:overworld": "6bc45ce2eed04b6afecdfaf2cf89273e83dad071aeb45638e181d33fe5180f57" + }, + "fixtures_sha256": { + ".local/rust-worldgen-parity/registries.json": "c6868228cc1002755dab31d947e953cc4be785a1b6ae82697755817a238b7de9", + ".local/rust-worldgen-parity/inputs.txt": "4afb482c8aa6e654ef47b9696f76c16fa862414248202c9bf748941bfc8d0877", + ".local/rust-worldgen-parity/biome-presets-client.json": "b03e2fbe85c191a22f333bc989bd2a73c66f0f9fbcd9ddb54774f17c247832e9", + ".local/rust-worldgen-parity/biome-presets-server.json": "b03e2fbe85c191a22f333bc989bd2a73c66f0f9fbcd9ddb54774f17c247832e9" + }, + "noise_resources_sha256": { + "data/minecraft/worldgen/noise/aquifer_barrier.json": "864a9d66a03b081adc8d4bf51a6d0cd5fdd94a0ebf1cecadec2aed9e549db7e4", + "data/minecraft/worldgen/noise/aquifer_fluid_level_floodedness.json": "e755b926628bc49edf48a3bd3b1e1bc3e2895b774f5e2e81f1d4340782a9fc56", + "data/minecraft/worldgen/noise/aquifer_fluid_level_spread.json": "6afc3f09b6616f799d739b5b114c4436059dcc60308af55fe96a8594de815214", + "data/minecraft/worldgen/noise/aquifer_lava.json": "96e1c4e411ffe302c5541cd2ee8462e1992f0290d623c560f353c39981737346", + "data/minecraft/worldgen/noise/badlands_pillar.json": "79c0d0628db949d3b83bbca145da427bcdc3ff585b0ad736f7cb20e4c593c9a2", + "data/minecraft/worldgen/noise/badlands_pillar_roof.json": "7f137a0382721b8c7b3227e65dc32a3f6d9c3d5893458b03e892797ae31d85d7", + "data/minecraft/worldgen/noise/badlands_surface.json": "79365a5c2017e93878d989a176520ba9cbdf8685cff8b3cb148730d949d98b09", + "data/minecraft/worldgen/noise/calcite.json": "331259d84572c32b4b268d069e0132da9e6623ba614080e34b815472c7f4ee0c", + "data/minecraft/worldgen/noise/cave_cheese.json": "24c6846b7fc1f7c652bf185797fe98b943146b6aaf8766d1bff2066c59b7ed24", + "data/minecraft/worldgen/noise/cave_entrance.json": "f75146a7b1a033998edd3c77319f78243fe933bdcda2067b78658940f145cac6", + "data/minecraft/worldgen/noise/cave_layer.json": "7f137a0382721b8c7b3227e65dc32a3f6d9c3d5893458b03e892797ae31d85d7", + "data/minecraft/worldgen/noise/clay_bands_offset.json": "7f137a0382721b8c7b3227e65dc32a3f6d9c3d5893458b03e892797ae31d85d7", + "data/minecraft/worldgen/noise/continentalness.json": "b7ce5ac29a2c7a7cfbfaa1e1eeca9ba8f4a52139e59318850fa2407242c69ba8", + "data/minecraft/worldgen/noise/continentalness_large.json": "76834cff0227d52b19b5932142925f4fc639e713c2180e489f813701ca45f53e", + "data/minecraft/worldgen/noise/erosion.json": "af8a7a0f16ff3e568ad646df9cbc28e04a31b16dad4f162705c0f7c747da6983", + "data/minecraft/worldgen/noise/erosion_large.json": "d20c2c6ec805a366b105924b3cee29ac5b84cc06d636b539ae0047aac413b60a", + "data/minecraft/worldgen/noise/gravel.json": "87d627634161e51a79512f3d3f42f990d2a185e35198eb5e2161939d866751e0", + "data/minecraft/worldgen/noise/gravel_layer.json": "a4b45bdb6efef2509b053b970f6e84250d7b16d54f3906bc7fcf2665ada2a692", + "data/minecraft/worldgen/noise/ice.json": "85d03cc06d6bc552dc399dcc90ca9749c2625ddf0049dc0f95684631a7c6e66e", + "data/minecraft/worldgen/noise/iceberg_pillar.json": "98816326f84a21ce29421a9cba3ad85e5a26069312c9819aaf5662691e777fd5", + "data/minecraft/worldgen/noise/iceberg_pillar_roof.json": "864a9d66a03b081adc8d4bf51a6d0cd5fdd94a0ebf1cecadec2aed9e549db7e4", + "data/minecraft/worldgen/noise/iceberg_surface.json": "79365a5c2017e93878d989a176520ba9cbdf8685cff8b3cb148730d949d98b09", + "data/minecraft/worldgen/noise/jagged.json": "d64347f4f9acb984075e3b4945b4699907ec6d893588388dd8f738f29f75f4d1", + "data/minecraft/worldgen/noise/nether/temperature.json": "5a67fbc28b5c2578b4ca5f6abdd115c715ea2ef1be3e1a7a8eb1a0de4c3a8f7c", + "data/minecraft/worldgen/noise/nether/vegetation.json": "5a67fbc28b5c2578b4ca5f6abdd115c715ea2ef1be3e1a7a8eb1a0de4c3a8f7c", + "data/minecraft/worldgen/noise/nether_state_selector.json": "116c8bf1d676fd3a3dea3908e074a4f4b7ee55d3263e93abf5889b41bfc77f5b", + "data/minecraft/worldgen/noise/nether_wart.json": "4518b186ffe4b65394a35276c8708037c6f3f73c7cb95ef6d41a5cd4b8d234f6", + "data/minecraft/worldgen/noise/netherrack.json": "cef60938a0304eec78a6bdebd24b80a45c5d1bad894c6c012e3413ecc485a81a", + "data/minecraft/worldgen/noise/noodle.json": "7f137a0382721b8c7b3227e65dc32a3f6d9c3d5893458b03e892797ae31d85d7", + "data/minecraft/worldgen/noise/noodle_ridge_a.json": "e755b926628bc49edf48a3bd3b1e1bc3e2895b774f5e2e81f1d4340782a9fc56", + "data/minecraft/worldgen/noise/noodle_ridge_b.json": "e755b926628bc49edf48a3bd3b1e1bc3e2895b774f5e2e81f1d4340782a9fc56", + "data/minecraft/worldgen/noise/noodle_thickness.json": "7f137a0382721b8c7b3227e65dc32a3f6d9c3d5893458b03e892797ae31d85d7", + "data/minecraft/worldgen/noise/offset.json": "45f51565587e2dc055271648037c0ec3466815e82f0d762e0198c16285fc8ae7", + "data/minecraft/worldgen/noise/ore_gap.json": "6afc3f09b6616f799d739b5b114c4436059dcc60308af55fe96a8594de815214", + "data/minecraft/worldgen/noise/ore_vein_a.json": "e755b926628bc49edf48a3bd3b1e1bc3e2895b774f5e2e81f1d4340782a9fc56", + "data/minecraft/worldgen/noise/ore_vein_b.json": "e755b926628bc49edf48a3bd3b1e1bc3e2895b774f5e2e81f1d4340782a9fc56", + "data/minecraft/worldgen/noise/ore_veininess.json": "7f137a0382721b8c7b3227e65dc32a3f6d9c3d5893458b03e892797ae31d85d7", + "data/minecraft/worldgen/noise/packed_ice.json": "0f51993727dcb0aa7c6cb9288e462443e711e9980c12927435126a3c45922786", + "data/minecraft/worldgen/noise/patch.json": "83a0052d4220c67c5513bce689d681e3af3325c18fec612cdd4941fc738f4be0", + "data/minecraft/worldgen/noise/pillar.json": "5a67fbc28b5c2578b4ca5f6abdd115c715ea2ef1be3e1a7a8eb1a0de4c3a8f7c", + "data/minecraft/worldgen/noise/pillar_rareness.json": "7f137a0382721b8c7b3227e65dc32a3f6d9c3d5893458b03e892797ae31d85d7", + "data/minecraft/worldgen/noise/pillar_thickness.json": "7f137a0382721b8c7b3227e65dc32a3f6d9c3d5893458b03e892797ae31d85d7", + "data/minecraft/worldgen/noise/powder_snow.json": "98816326f84a21ce29421a9cba3ad85e5a26069312c9819aaf5662691e777fd5", + "data/minecraft/worldgen/noise/ridge.json": "e05d077746b27d662a8c981807819df3e3bb1f1779d2245dd911c8193e03bbf8", + "data/minecraft/worldgen/noise/small_patch.json": "9ecc836feb68b42d717217e028f2a72112179f1097f5bd156b1d3f1db637732e", + "data/minecraft/worldgen/noise/soul_sand_layer.json": "a4b45bdb6efef2509b053b970f6e84250d7b16d54f3906bc7fcf2665ada2a692", + "data/minecraft/worldgen/noise/spaghetti_2d.json": "e755b926628bc49edf48a3bd3b1e1bc3e2895b774f5e2e81f1d4340782a9fc56", + "data/minecraft/worldgen/noise/spaghetti_2d_elevation.json": "7f137a0382721b8c7b3227e65dc32a3f6d9c3d5893458b03e892797ae31d85d7", + "data/minecraft/worldgen/noise/spaghetti_2d_modulator.json": "d210211c0c76c53f15908f0b004a7e98e9d753ed996cd5468f2068f2e23932d1", + "data/minecraft/worldgen/noise/spaghetti_2d_thickness.json": "d210211c0c76c53f15908f0b004a7e98e9d753ed996cd5468f2068f2e23932d1", + "data/minecraft/worldgen/noise/spaghetti_3d_1.json": "e755b926628bc49edf48a3bd3b1e1bc3e2895b774f5e2e81f1d4340782a9fc56", + "data/minecraft/worldgen/noise/spaghetti_3d_2.json": "e755b926628bc49edf48a3bd3b1e1bc3e2895b774f5e2e81f1d4340782a9fc56", + "data/minecraft/worldgen/noise/spaghetti_3d_rarity.json": "d210211c0c76c53f15908f0b004a7e98e9d753ed996cd5468f2068f2e23932d1", + "data/minecraft/worldgen/noise/spaghetti_3d_thickness.json": "7f137a0382721b8c7b3227e65dc32a3f6d9c3d5893458b03e892797ae31d85d7", + "data/minecraft/worldgen/noise/spaghetti_roughness.json": "6afc3f09b6616f799d739b5b114c4436059dcc60308af55fe96a8594de815214", + "data/minecraft/worldgen/noise/spaghetti_roughness_modulator.json": "7f137a0382721b8c7b3227e65dc32a3f6d9c3d5893458b03e892797ae31d85d7", + "data/minecraft/worldgen/noise/sulfur_cave_gradient.json": "4900ffd885ce33b220a673ba0a248504c78f9f2cdfce824106a237d9ad18a6a7", + "data/minecraft/worldgen/noise/surface.json": "79365a5c2017e93878d989a176520ba9cbdf8685cff8b3cb148730d949d98b09", + "data/minecraft/worldgen/noise/surface_secondary.json": "ae23cb210db7b64b66b327dbbf1e7b2acb5c15cb6fe5df0455eb29910d9312eb", + "data/minecraft/worldgen/noise/surface_swamp.json": "19e08e0d1dff257cf748d3cef79e939e8f25cc5e7226653c789008171f40695b", + "data/minecraft/worldgen/noise/temperature.json": "9b1d5a87d575abf2891882ec3e1544b964cd15fedc84ad14d2abbd3b48ee2e4b", + "data/minecraft/worldgen/noise/temperature_large.json": "4fe64b952b751eb7e45b4d1e274add508b504ee8bbc54cad417ce3a3b068d42e", + "data/minecraft/worldgen/noise/vegetation.json": "ff4c10776eb2822f9f66dec4e9878a1bc797aca711480bf8430f851ff9af77dc", + "data/minecraft/worldgen/noise/vegetation_large.json": "20f4a255e3f9452f4cf983b3efed71ead184d04f4070283f355ad4d97993d133" + }, + "density_resources_sha256": { + "data/minecraft/worldgen/density_function/end/base_3d_noise.json": "38db7d590abc3144e3357a79562d649d9880bc2c62ddc99480d93f4b6401c9a6", + "data/minecraft/worldgen/density_function/end/islands.json": "6e4f02929580ecc34bfb059855b4e88d080dc7ca6c9984f216bdaa32e6b47700", + "data/minecraft/worldgen/density_function/end/sloped_cheese.json": "5dee072865321e57e5e231e60a57bfcd1919454f93da33b3c1651b3712f2cfb2", + "data/minecraft/worldgen/density_function/nether/base_3d_noise.json": "76cfd16e6fc2b1ce8bdb5f5ee277d431c167bc01afc2462bffff09eb5f0bd582", + "data/minecraft/worldgen/density_function/overworld/base_3d_noise.json": "2791a1e6c5c730eac1bd35aaea9a7ab22855872fdb92349192d045330fd4614f", + "data/minecraft/worldgen/density_function/overworld/caves/entrances.json": "63a1b8351e6dea212501c36f515f32e5a0e960228b5b5ccf0dc5b43855cbc1ab", + "data/minecraft/worldgen/density_function/overworld/caves/noodle.json": "3bce7453470fd37e3bfc11dc8584494aab094f9fd820038dc5592cb47e825a69", + "data/minecraft/worldgen/density_function/overworld/caves/pillars.json": "069d35fbdaed7d74521fc3e9355a94e778450b52a05f1efbd470ce3917b8a207", + "data/minecraft/worldgen/density_function/overworld/caves/spaghetti_2d.json": "a99c68ac415596788c84e93e81c96c9786e31db21a81157459a13272cda4cb1f", + "data/minecraft/worldgen/density_function/overworld/caves/spaghetti_2d_thickness_modulator.json": "4f987a0b9e8c0adb02df47034fa8b3cebfbfb2c8e607123614ef009a16bfaf6c", + "data/minecraft/worldgen/density_function/overworld/caves/spaghetti_roughness_function.json": "03bd1b405e53aeb75b6a3440d97975c25b6f11c7fc07149471b86c80fbdb6ea4", + "data/minecraft/worldgen/density_function/overworld/chunk_surface_level.json": "93a4e26ce4a1144c42040f52ca375f0dec94648c70ccdcc52db4a7f55ca526a5", + "data/minecraft/worldgen/density_function/overworld/continents.json": "0f2ff487c0556391ae2d56b7cab6990d45766ade2503236fe2669f83a64517be", + "data/minecraft/worldgen/density_function/overworld/depth.json": "9fcd7c8badcae4dc8e86303b0f72b05b5fd998d5bb7ac637729dd7e688688069", + "data/minecraft/worldgen/density_function/overworld/erosion.json": "8173a3df61a3c5cfe352fb4a8fa64e99840836e42f2f4b0ddf8035f4d28f97a5", + "data/minecraft/worldgen/density_function/overworld/factor.json": "f7cd1629f1a034504bd74fd38af5ea75a59257c565b5d919a6212e2e08778e30", + "data/minecraft/worldgen/density_function/overworld/final_density.json": "a7e6b9f4618e27cb08ec37a294d8ca2a96747128a8d65d788dc418fda372cfb1", + "data/minecraft/worldgen/density_function/overworld/jaggedness.json": "5e8acc680409ae0b56596be02954eb5b49a72069d004e5dcf9a92c5e106ccdb2", + "data/minecraft/worldgen/density_function/overworld/offset.json": "da6b4e686d8eb16c19443a1126168b6f2719712c02b690b9d7384ce53badf995", + "data/minecraft/worldgen/density_function/overworld/ore_vein/copper_density.json": "3b16d3a4499981f40bfd2b33786a99046bbca0c958f8f41692ffcbf44ae927d7", + "data/minecraft/worldgen/density_function/overworld/ore_vein/gap.json": "89ccfa58c6b8ae3e3954d2ff2dbcc42a8a3ae24a7b07437dbfb85fdced55945a", + "data/minecraft/worldgen/density_function/overworld/ore_vein/iron_density.json": "8de70a31c97e2a8299679770d53c8e366ace1aa8585e8d840375d25f85b72f8f", + "data/minecraft/worldgen/density_function/overworld/ore_vein/mask.json": "7f92df0b19e7d29fef01abc7025fea2bdae7a57453e186785cde2fc7d08aa5bc", + "data/minecraft/worldgen/density_function/overworld/ore_vein/richness.json": "3eb0183e295a5f9c54aab936b706b4b9d570ddf56c983ae89b91151e6e38fb9d", + "data/minecraft/worldgen/density_function/overworld/ore_vein/toggle.json": "49b9db48740578911d0f8a2de40f02eced3ae742f03ebb05fee381af579cc9ed", + "data/minecraft/worldgen/density_function/overworld/preliminary_surface_level.json": "4b6ce4c38ede0bec7485d4c029b9fcc7ceb5b26977c2c391a650fe8f3a3272b6", + "data/minecraft/worldgen/density_function/overworld/ridges.json": "bf66a03bd8474d09dad4da23f4b7e76816b83e23df9f53d9c0b7c529c25ed9c1", + "data/minecraft/worldgen/density_function/overworld/ridges_folded.json": "c8a4343b56273a476648a84fbbe07d8c473c1dd3769749260db6340ba5b37f9a", + "data/minecraft/worldgen/density_function/overworld/sloped_cheese.json": "5e2e7756881a4f2acf2e8c8dc826a04681939ff1dc7508ce868e865e92a069d7", + "data/minecraft/worldgen/density_function/overworld/temperature.json": "3c2f498cbf4636cd1fa7f555c14220a733c9d07fb5a1563f11c6144a27f31ce8", + "data/minecraft/worldgen/density_function/overworld/vegetation.json": "c902ef045f63a568ef4c3d834716c67b5835f0994997ee45756837de111a806c", + "data/minecraft/worldgen/density_function/overworld_amplified/chunk_surface_level.json": "378eef8542e7ee3adffeaf746e0c776d1e00ff75cf030d9244292acd796739f6", + "data/minecraft/worldgen/density_function/overworld_amplified/depth.json": "35bbe18bc8eaec3bc8d81f1b3130018874d6cc8fa516c1e8380bdb8caf68c803", + "data/minecraft/worldgen/density_function/overworld_amplified/factor.json": "b42bc13d4d3c1cbeb7c6dfa2e16f4ef532ad0cff3a92d20bace01711fee6edd4", + "data/minecraft/worldgen/density_function/overworld_amplified/final_density.json": "cde96d8a5efa63cd20cea615dd1172e5e6f2626e9275d359fa2864e77083ac4f", + "data/minecraft/worldgen/density_function/overworld_amplified/jaggedness.json": "9f9a8993ce50cd2f0736ef98c3f8ff55db02d47b2a3e4f6aacae7c45a3c95bcc", + "data/minecraft/worldgen/density_function/overworld_amplified/offset.json": "0bb9ae6088ea4dbfdf79f6f2b2eed789c68e9a4e919a31bf912f91ddeda28e8b", + "data/minecraft/worldgen/density_function/overworld_amplified/preliminary_surface_level.json": "e8a82a9dfe183f4e624ea7a268efa2c54376caf99139596a26ad1dd27e887e5f", + "data/minecraft/worldgen/density_function/overworld_amplified/sloped_cheese.json": "d8609154b76d0eefcfbc3746fa84f32cb04c5817a2fd1b80e72ee0ae9d88e96c", + "data/minecraft/worldgen/density_function/overworld_large_biomes/chunk_surface_level.json": "72f29b5fa9c01afa296d3679e6be662ee1b0bfdc1ba40cc2092ea74380be5c47", + "data/minecraft/worldgen/density_function/overworld_large_biomes/continents.json": "cfab013269cff17cfdf95497f87e70591378e7a39da44a241199fb64b304d411", + "data/minecraft/worldgen/density_function/overworld_large_biomes/depth.json": "9ec8ced85b58494f5400d4a5f6a27f1d4d44271d7a87adb8c5d842319eb5997f", + "data/minecraft/worldgen/density_function/overworld_large_biomes/erosion.json": "773d626db8e356d92a321270895ce085287d2befcb4504842371c38fd10102ac", + "data/minecraft/worldgen/density_function/overworld_large_biomes/factor.json": "0e7aa57eca20ebd6d2f089a9a4a34502efe902295812650f71b2ff087bb8b15f", + "data/minecraft/worldgen/density_function/overworld_large_biomes/final_density.json": "6f644644293c5489c499dc57663f2c12de60fc720bc4f1120efd343246eb159e", + "data/minecraft/worldgen/density_function/overworld_large_biomes/jaggedness.json": "30090703d4d9e493d40d60e06ee12f1310a608e20b73aeb8f86efa8e31b11453", + "data/minecraft/worldgen/density_function/overworld_large_biomes/offset.json": "75517306420732023e2dfeeb253439d8f0edcde9bb8b10ee7870d1bdb072ec22", + "data/minecraft/worldgen/density_function/overworld_large_biomes/preliminary_surface_level.json": "ece7767faac91980f5349ddfdc6040dc4ebbfce71a9f4d5842fa1b7bb169db3b", + "data/minecraft/worldgen/density_function/overworld_large_biomes/sloped_cheese.json": "347e160b5f951137b5f82a39c18572f8851c5a22484d11f31d1f90f5e5f6ac99", + "data/minecraft/worldgen/density_function/overworld_large_biomes/temperature.json": "051138f2c2f0ca4050b92f7320ddea461dca2038a49eb6f9931ecbf39129f4ef", + "data/minecraft/worldgen/density_function/overworld_large_biomes/vegetation.json": "187b08814a3831cd0ff2f405c6683e7213a79dc7eeec44cd46136e350b0718b7", + "data/minecraft/worldgen/density_function/shift_x.json": "0db6e5f781089feede9d8d2936d7564024752e34006b8bc9f2a138749f91e3e7", + "data/minecraft/worldgen/density_function/shift_z.json": "0b561cdfafa9e82f431a8051576eb2ddc386d01459df571d7040021b0debb762", + "data/minecraft/worldgen/density_function/y.json": "e7766e59792605f5c3d8e05ff6263db1dc6c91343c736b3ab7a58ddee9771282", + "data/minecraft/worldgen/density_function/zero.json": "8aed642bf5118b9d3c859bd4be35ecac75b6e873cce34e7b6f554b06f75550d7" + }, + "noise_settings_resources_sha256": { + "data/minecraft/worldgen/noise_settings/amplified.json": "07fbadd0fd71e16e5497c575d3c86d997166087ccfaaba70a589a440b915024e", + "data/minecraft/worldgen/noise_settings/caves.json": "29a378b845f7bff27a8badecba7ecf2bb22d0d4224b751ab6d91677c83bc6a6a", + "data/minecraft/worldgen/noise_settings/end.json": "d0fd92ddd39081f1779ce5482041a837fb4a03841ea4d843556f17b557e31f4b", + "data/minecraft/worldgen/noise_settings/floating_islands.json": "54923e55bfad4274bea513eccb42e1eb3625fb47ae00905537e0d3d68f82045d", + "data/minecraft/worldgen/noise_settings/large_biomes.json": "dcb29a9e3fb630f2b76a52d759c6925b40e67cd13bc7f9ae93976f0633cc2c05", + "data/minecraft/worldgen/noise_settings/nether.json": "e6d7856fe4523e4c3fa4dce756b6b1e211bfc263c5e417fb6294d032b8f53e9b", + "data/minecraft/worldgen/noise_settings/overworld.json": "d093895d50edd79d53555b33b62d767115399764e32a4f9ae2687739f785d4b9" + }, + "inputs_sha256": "4afb482c8aa6e654ef47b9696f76c16fa862414248202c9bf748941bfc8d0877", + "rust_output_sha256": "c39201a8d64b2ec12dc08d8eddcb962d336885a749200a0a33c0fefd7910c193", + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaWorldgenOracle.java": "272b7e7c90dfc1344f6964033b61ee27ac867da7b375e406586b88de08d02b08", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeExport.java": "f9a773713cf21b69bfa10018b76f27b953bda140ede9934f43d3aa3091101cf5", + "tools/test_worldgen_parity.py": "699826ef3d3f1ac5419b91153539bf0857e931fd128a39fc47d8c8071cc03268", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "69f89566a78456c29caaa39dacedfe711ca59e49b78f64e68b0414fb6a73d8fc", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "3968e2a337a6a23226c485057c79359e66df16683f00fb4ebc9fabb03910a015", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-core/tests/density_world_fields.rs": "e193e45080817ef92547828a8d106482a376b9f788e39d4d3831f44e9d693148", + "crates/horizon-world/examples/collision_fixture.rs": "ee754b5b42e0a51fe0a305b3f4bb56522ff3fffae564180aab8087b1b9e44afc", + "crates/horizon-world/examples/tick_fixture.rs": "df267c307e0491a238b2d93edf0384514f38f8ee3252e315b989de56c6e17990", + "crates/horizon-world/examples/world_fixture.rs": "a3c4c0f5131ae051b24662eff0ed11ed797c6fd5069fbfdf819f0e3fcdfb2cf4", + "crates/horizon-world/src/bin/worldgen_parity.rs": "5af97baa6681bc7aa04d981ec5c07c38cb27f28213abf34b1e83270828dd2980", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/lib.rs": "a6376d79c90ebdee539f4b460a9dd18d75e0c049c24f028d00c9c45c85ebf668", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry.rs": "f46065659e60eb5e84ad69b9f3b5e94dc87ee19de16408817e26f23d16b6c7e7", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen.rs": "24f440a4be7546e79b4f462dd18aad9031e94dc87c5f1d32b78912650f7dd162", + "crates/horizon-world/tests/biome_data.rs": "d4de462ccc3e6ad5760490330e0f0cd8a45734077708a2eca95ca06e65f779b0", + "crates/horizon-world/tests/collision_data.rs": "45f3d33b36efe720e99ebf75b9f4fbddd777cebea4618bba245ca106b3443391", + "crates/horizon-world/tests/tick_data.rs": "ab345209367db6963b987797992c4a06433bd2039e6021bd834f6305324c04d7", + "crates/horizon-world/tests/world_io.rs": "4a42630c99ce89b27cc2be1a1b961ad880f62762ab661f9e92ef9bcf7f3e76e0", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e" + }, + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "c39201a8d64b2ec12dc08d8eddcb962d336885a749200a0a33c0fefd7910c193", + "matched_output_lines": 922238, + "biome_export_sha256": "b03e2fbe85c191a22f333bc989bd2a73c66f0f9fbcd9ddb54774f17c247832e9" + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "c39201a8d64b2ec12dc08d8eddcb962d336885a749200a0a33c0fefd7910c193", + "matched_output_lines": 922238, + "biome_export_sha256": "b03e2fbe85c191a22f333bc989bd2a73c66f0f9fbcd9ddb54774f17c247832e9" + } + ], + "scope": "Direct normal-noise JSON decoding using the actual pinned vanilla CODEC. Every bundled noise registry resource, explicit/default parameters, empty and full amplitude modifiers, normalization modes, inclusive field bounds with signed-zero comparator ordering, malformed types, null fields, duplicate and ignored keys, decimal/exponent integer truncation and wrapping, signed zero, seeded modern/legacy and Nether construction, octave metadata, range and normalization bits, scalar noise values and parent random state. JSON resource contents stay private. Strict JSON parsing; no claim for Gson's permissive non-JSON syntax. Bundled density registries are also decoded with actual vanilla registry-aware CODECs: named forward references, all bundled function kinds, declared range/axes, raw compilation errors, seeded optimized roots, cache allocation, scalar values, strided bulk values, repeated cache hits and surface-volume errors are compared using RandomState's actual compile context. All seven bundled noise-setting resources contribute their actual eight-field NoiseRouter.CODEC objects to RandomState. Router fields are compiled in declaration order with a shared compiler/context; cache allocation, raw/optimized scalar and repeated strided volume values, successful single-layer surface volumes and invalid surface-volume shapes are compared. Actual RandomState climate sampler binding and quart-to-block coordinate wrapping are checked at ordinary and extreme positions. Float-to-long climate quantization and long-to-float conversion include subnormals, signed zeros, NaNs, infinities, cast saturation and seeded random bit patterns. Actual vanilla Climate.Parameter and ParameterPoint JSON codecs compare scalar, two-element list and min/max object intervals, float endpoint bounds/ordering, required coordinate/offset fields, negative zero, precision-sensitive float parsing, malformed types and duplicate keys. Climate parameter distances, wrapping squared fitness, stable search-tree leaf order and nearest lookup are compared across every supported branching value 2..32, sizes around branch powers, the 65536-entry API bound, duplicates, warm ties, fresh lookups, brute-force lookup and extreme signed-long endpoints/targets. The Rust tree is immutable with per-worker search state instead of hidden thread locals; invalid or degenerate searches return typed errors. Inline arbitrary distance metrics and behavior outside the bounded API are not covered. Built-in Overworld and Nether quantized biome parameter tables are exported independently by each authenticated JAR and required to agree before Rust consumes them. The Rust multi-noise resolver and actual vanilla MultiNoiseBiomeSource compare biome identities through scalar climate queries and prepared bulk quart volumes, including forward/reverse/repeated query order, wrapped extreme origins and shared previous-result state. Biome holder keys in the reference are registration placeholders; no biome property or gameplay behavior is evaluated. The Rust loader reads a Horizon quantized table format, not the vanilla biome codec, and the preset builders themselves have not been ported. Source and private fixture mutations during validation invalidate the report. The two-field 26.3 NoiseSettings codec, create helper and LevelHeightAccessor clamping are also compared across bundled noise members, dimension/alignment bounds, zero/negative runtime heights, disjoint ranges, wrapped integer arithmetic and decimal/exponent integer conversion. Global fluid cutoff selection and the actual disabled Aquifer implementation are compared with original default block-state identities, extreme sea levels/coordinates, signed-zero/subnormal/nonfinite density and counted picker calls; developer fluid-disable behavior is outside the regular-mode corpus. The actual noise-based Aquifer.Config codec and runtime are compared across bundled aquifer settings, modern/legacy world-seeded aquifer factories, synthetic density roots, nondefault water/lava states, cave/void air, nonfinite sampler overrides, strided volume extents, wrapped coordinates, repeated and reversed queries, counted picker calls, sampler call order/values, injected failures and retry state, scheduling flags, populated location/status caches and sorted surface-cache entries. Oversized or wrapped-invalid grid allocations and developer fluid-disable behavior are outside the bounded regular-mode API. Terrain filling is not yet validated. Router, vertical noise and optional aquifer members are decoded from each noise-setting resource; complete NoiseGeneratorSettings, material rules, nonempty world fields, biome registry/codecs and complete chunk biome assignment, generated chunks, gameplay and rendering remain pending. Inline noise holders and general codec behavior beyond the covered fixtures remain pending." +} diff --git a/benchmarks/rust-worldgen-2026-10-06/scoped-parity.json b/benchmarks/rust-worldgen-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..be295c20a --- /dev/null +++ b/benchmarks/rust-worldgen-2026-10-06/scoped-parity.json @@ -0,0 +1,627 @@ +{ + "schema": 1, + "minecraft": "26.3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "commands": 17338, + "command_counts": { + "noise": 2111, + "quantize": 4116, + "index": 229, + "climate_parameter": 25, + "climate_point": 183, + "noise_settings": 217, + "settings_create": 182, + "tag_entry": 32, + "tag_file": 335, + "tags": 200, + "tag_registry": 1, + "aquifer": 9136, + "noise_aquifer": 379, + "registry": 24, + "router": 168 + }, + "noise_aquifer_injected_failures": { + "0": 3, + "1": 3, + "2": 3, + "3": 3, + "4": 3, + "5": 3 + }, + "noise_aquifer_outcomes": { + "1 false": 5800, + "0 false": 9995, + "default_solid false": 12655, + "2 false": 35365, + "0 true": 1114, + "2 true": 2021, + "1 true": 43, + "5 false": 443, + "5 true": 5, + "6 false": 295, + "6 true": 8, + "7 false": 49, + "7 true": 1, + "4 false": 51, + "4 true": 4, + "error false": 17, + "3 false": 81, + "error true": 2 + }, + "block_tag_entries": 300, + "block_identifier_entries": 1286, + "block_tag_resources_sha256": { + "minecraft:acacia_logs": "a3fe4062ef8bb3451c897eb79914295a11f65798067f46125973c6fcbc38cd4a", + "minecraft:air": "8291f3984418fa56cd1ca3f5132344de25cee407647b0f97d6008bc0f3d47d1b", + "minecraft:all_hanging_signs": "33646181d260854e86dbec7cb3bdba15e5eb19a60e73a153ab08a4e6f309b022", + "minecraft:all_signs": "39fb174cfec0c7e7ab900d41688e5891ac054e8da52ed07a6ec9cd0a8e9f6109", + "minecraft:ancient_city_replaceable": "dfe7692dddb25cd1945334741782d2b85048aad2d20fc8e1106585a23ec34acf", + "minecraft:animals_spawnable_on": "29bc3cad17be92ae4b0e091a505cce0f6faf221dac55d2ee45268c9c3c9737ae", + "minecraft:anvil": "35b635afc68b437deab9e22b105f2157142f3c8982e9ae58768fce792794d9f9", + "minecraft:armadillo_spawnable_on": "d51ba988ad47362d4a0125a716d3d489ff97e86f5f81520f696647cbcd0d8e14", + "minecraft:axolotls_spawnable_on": "7cbbc9d5d3bc7c9a5f25486c13e0257beeeb33f5dd9d0e67e3c2e1cd5317fc0c", + "minecraft:azalea_grows_on": "06462d5bcf74a19283aa696ec12252c59f5779fb18919680e24e2632bcfa332f", + "minecraft:azalea_root_replaceable": "ea787c96911c9c031f6a08761a13df0e365f3ad32dd5550a6b467b1b0e6b823a", + "minecraft:badlands_terracotta": "fb20ddb79e6d9cf29cbe40a5712a563305022adbe1daa31ea6c690f99389c50c", + "minecraft:bamboo_blocks": "d31d10554cafb75ae74d3b753d985f2cbd7446902097581021666da9934e0d3c", + "minecraft:banners": "a619cc9e21da600971dcce0ecabbb2d08156e874e2d6eb753e08242a2f80c75c", + "minecraft:bars": "9a6bc562f574cdfff902974ab1165727eb6e81504dc4b4d44ba0f32e5957b268", + "minecraft:base_stone_nether": "8a29caeac2ba106f3b704764bec7d08f51825469933b022302dafd1692067ffa", + "minecraft:base_stone_overworld": "dbc51469f7d53ba1abd680a073c2cc25ba98985f0028404f1119e141dad0218f", + "minecraft:bats_spawnable_on": "69333efdca32f71c9dcee137cf6ffbec22607ee5619d381ea1c68f60efa49aea", + "minecraft:beacon_base_blocks": "14af42fff017cf89fc8386b3159c9257554c24dcf09143232bda49e3576f81c8", + "minecraft:beds": "c60f07a2c3442866abead7f297dc56d835b66d669e84b3bfb5b21e82d59de0cb", + "minecraft:bee_attractive": "079044ad1df6dfdb4db0fd4b0bfaa9b43faa10e2ddeb78375602d6aaf2157963", + "minecraft:bee_growables": "2914a1ec2a067fb0c86da831b73023bd7d877cc6d21bd16415464674724fec8d", + "minecraft:beehives": "f3da4490467e3cd1512d348a0c6fc007531de4709abc5503331db32759cd27e6", + "minecraft:beneath_bamboo_podzol_replaceable": "0e1b480d0de85f7442f0d6a8e2c6de59f85ac6a373cae267cf58f47d4d1fb6d9", + "minecraft:beneath_tree_podzol_replaceable": "0e1b480d0de85f7442f0d6a8e2c6de59f85ac6a373cae267cf58f47d4d1fb6d9", + "minecraft:birch_logs": "2a11ab5f2ebe93d1711c665f111b5ff2d64506a6df2a3fc74c0052ebefa18430", + "minecraft:blocks_dolphin_jump": "50071b6af79dbe9d94c0b98058dc2457d5480854d768bc74668411f7f58b9165", + "minecraft:blocks_fluid_flow": "d4c2425e9fe5472ddda8338490328855c546db5fe1851d6c1f4b4d32756caf56", + "minecraft:blocks_lava_fire_spread": "50071b6af79dbe9d94c0b98058dc2457d5480854d768bc74668411f7f58b9165", + "minecraft:blocks_motion": "35acfdd0a05447730fe2e6f07e32a847bb5b27fb3f4e6171e40c0d9612e81cda", + "minecraft:blocks_motion_in_heightmap": "50071b6af79dbe9d94c0b98058dc2457d5480854d768bc74668411f7f58b9165", + "minecraft:blocks_motion_in_heightmap_no_leaves": "653310d03a663ac3f29b65527057ef8858b6ea1082e9f06e9615f69018a972b4", + "minecraft:blocks_motion_no_leaves": "9b3eb333f9eb30185ec87d3bc81e0ee54c0ab31ddd3e9b7581b3b4266574f214", + "minecraft:blocks_wind_charge_explosions": "ef9816aea3e3beef7ed5c049c3d827955000272e810468e082d98cae0586da12", + "minecraft:buttons": "6f2192e09f74a817ba9861e0cb374e6859ef94cfd584f3d5945bb4b8ce15f360", + "minecraft:camel_sand_step_sound_blocks": "dae4cb2e5b66d4132350b8d27d9d725b6f82d1e0275ae8891aee704ff36d3bd5", + "minecraft:camels_spawnable_on": "99d10c8d690cda2d9334d3cf49f1feb4d1980c8661a0c903e2df7b5a5f23048f", + "minecraft:campfires": "32cb4dd3346afa7bf10901cb37304e6208e6c10dd63c88b1767d693d27b22c1d", + "minecraft:can_glide_through": "e1b304a494b93be2a3280ea6cc7c73ebc0fd76e21654af801d5e4359e94232a8", + "minecraft:candle_cakes": "6074402049e9768ee880ce88e7a00a8382ac0190b95a0534fea33b370b8c9289", + "minecraft:candles": "dc2341cd97a3d8dc1df1d442bacb0a911d1f81c25df08710eea0d7253415f345", + "minecraft:cannot_place_basalt_pillar_on": "d577b04d4223092aa2b1983f4e9802438daa7937c85ee53d1dbd54281ae13a84", + "minecraft:cannot_replace_below_tree_trunk": "b869c9fdac19692d9c365cdffadaabc73633e1588bbfdb08bdceb4a17c837309", + "minecraft:cannot_support_kelp": "c4aa173611f0f072f04e625e5d3d7a7b5e1cdb7f81a54103d7f89e4f4faa487b", + "minecraft:cannot_support_seagrass": "c4aa173611f0f072f04e625e5d3d7a7b5e1cdb7f81a54103d7f89e4f4faa487b", + "minecraft:cannot_support_snow_layer": "282662c1139488dcc43e3bfe48a36a6c4a759e53cb6a4024454236b8f07384cb", + "minecraft:cat_does_not_teleport_to": "c9da7ebe4c3f5cbb5dc72510a64484c68c79414cd63bba2b603cfb3d49a57ebe", + "minecraft:cats_can_lie_on": "bf3cb7e9d117fc573fca34ab86c6979289cc3192b17d84306ad534321e899fd3", + "minecraft:cats_can_sit_on": "4416a8f4f8d5cfcb599958932e3257483f9261c8972ff2defabdb02c7d6493e7", + "minecraft:cauldrons": "12ddaf45c37b545b22dbc7f05da886e6c97300e020e998a9d1bec68cd51b998c", + "minecraft:causes_continuous_geyser_eruptions": "83522a84667866ab21d9776f961368ac345c579f1eeb388580343261f1b21457", + "minecraft:causes_periodic_geyser_eruptions": "c4aa173611f0f072f04e625e5d3d7a7b5e1cdb7f81a54103d7f89e4f4faa487b", + "minecraft:causes_suffocation": "50071b6af79dbe9d94c0b98058dc2457d5480854d768bc74668411f7f58b9165", + "minecraft:cave_vines": "b936bbb57d972003dda38f1d3584e3749915f26220843b941fc2571ef901c75a", + "minecraft:ceiling_hanging_signs": "d1dbf93fc2ffe927d72c0fc6ea5702d7bbf77b5b9a5cd48a93a6ffcadab84598", + "minecraft:chains": "4e3ec3f4c41f349ed0b469c047e6084748b091d14ffd25caa3037ead63e21d48", + "minecraft:cherry_logs": "651f86e2ab999dcd89ca1bdf2e0cf8ed532b15e65d6a71bb6ea4dda59ebcc49e", + "minecraft:climbable": "d0e3e76d7457f3f3f3d7219fe218c7746e4b2e7626d5c388fcf193089069e365", + "minecraft:coal_ores": "a6d65d25fbfef911eb3df9b2fb2eb6412cafefda7e4b0dd3df3cda7d1fcb1df9", + "minecraft:combination_step_sound_blocks": "0f0049644c911eb764bf3b8fdaa59428c4e2fbc7c3de2717af173b649e8f882e", + "minecraft:completes_find_tree_tutorial": "0ba6fb9b71c4350443fc0c9e0a5c2155b95ecf3a13f855e4a58714b9a4955711", + "minecraft:concrete": "57fc0503da49743426d50286c13bb21794d31d566d273e26fe6ff81f5f9a719c", + "minecraft:concrete_powders": "353ec33929acd67fb3fd2d2d9afd400f4b78d728eb98aec54b71670915b101a8", + "minecraft:concrete_slabs": "8bbcc1487efaa92df0a692c6e981071815667f0dd7e54ccee902a68e66855b1a", + "minecraft:concrete_stairs": "f1aef28be2123848182ee00437371d1c654fdd03d5fba9f5dd047bc1146a5a22", + "minecraft:conduit_effect_block": "78203bb255a7f38b712e4901e216e2ba40134a178d6eb5c75513719954ee9280", + "minecraft:convertible_to_mud": "602250ca21d148d2039d75c295eb98a4298d0fdc262240d6d55d7ebb872809c6", + "minecraft:copper": "4e34e2f842a084c1604b7a3df787b35dc3b44a45b1019ada8ea4f50b2fc9c4f0", + "minecraft:copper_chests": "09fd20c394be6e02fd845abc57fd8f50c5731f373707831f54ea49da0b9136e5", + "minecraft:copper_golem_statues": "5f71ff30a9bd7f06790ea7bd7c622644ea01d1cfc609ff056c565194524208a5", + "minecraft:copper_ores": "d89eef2319cb6ee0c5dbd39e1750557ee92c7d94d262354f941fd5dbc323dc5b", + "minecraft:coral_blocks": "d890e6d640cc21a2b692c6e32e25baeeb2c120245105297a78fd4abf8250ff2c", + "minecraft:coral_plants": "f6646184b65ca1bc37deffc95cb56ff01a71374904052bca67985226e1ec85c2", + "minecraft:corals": "421caec9d699d741d7fd69c003fb46e0d551eaa94c9af80ea1a9e75e8d89d029", + "minecraft:crimson_stems": "d8a1ace15b4c981ad4e454dc064c7551e31f40430c93efadca268a008bcf8fbd", + "minecraft:crops": "3b97869fd0e334992d610f1285698384ad2a4d48446f4afb61bc774a066c9c77", + "minecraft:crystal_sound_blocks": "6217bd619dea59a80a48ae687cb20ac977d50bd5cffca7c53f5692fc478c063f", + "minecraft:cushion_uses_collision_shape": "fe4833d3ddebf67fc42ea78907d44c40b58e42bfe4a8a1aa25a6d26265052b9f", + "minecraft:dampens_vibrations": "7cf346b29f2939878163a82291418a9236e8fb5c290e2d07f2acc2469336050f", + "minecraft:dangerous_for_teleportation": "5c411d83a4d828689fad334c774b259120eb47f7c5996f7cc84c569b565a2a10", + "minecraft:dark_oak_logs": "482327a22a5acf4dcd54076ae08ef869c3a05b4ebc3c41eec4349c1c0af8fc6d", + "minecraft:deepslate_ore_replaceables": "358db693d329fa6830f0db25a6287812f04ca16bc76007bd02b27a9a783a09b0", + "minecraft:default_immune_to": "b83114c23eeec820ce7eca52011f13013fb6c64002254be7aebe1e4b36244d48", + "minecraft:diamond_ores": "6061b325909705037f8418bedc24508519507cace911b79369b9c8a2006d4b04", + "minecraft:dirt": "602250ca21d148d2039d75c295eb98a4298d0fdc262240d6d55d7ebb872809c6", + "minecraft:does_not_block_hoppers": "1fe898820d7fafb4b8e154f3f91870571975ca8efdd53041a704162711cf607e", + "minecraft:doors": "07865a23bdc74e0f220b6dc7dbd96bb913f7bf243e71376983de0856e93720d1", + "minecraft:dragon_immune": "b6b5f6eed47888883574b9eccd06178251a730f15c828c2dc83d0870b37a2fd3", + "minecraft:dragon_transparent": "fceddc0e5ad8b41c33a47f6ad3d232a57c04b8f1d3ca2f1fc1edf37741591e03", + "minecraft:dripstone_replaceable_blocks": "69333efdca32f71c9dcee137cf6ffbec22607ee5619d381ea1c68f60efa49aea", + "minecraft:edible_for_sheep": "bd5e054d8a8833a0dd829316196eeb43e9b5ae80d55b0986f26ac6240233cba6", + "minecraft:emerald_ores": "9c4bfb7344364eb612ab4a0cff87356d8538aa508ae0dae134806b946207b6d7", + "minecraft:enables_bubble_column_drag_down": "c4aa173611f0f072f04e625e5d3d7a7b5e1cdb7f81a54103d7f89e4f4faa487b", + "minecraft:enables_bubble_column_push_up": "34064a586d19afe34ef83fbd356eacfe026b9b3a3569efdf28cd88fea8c4bbb1", + "minecraft:enchantment_power_provider": "10d762f960be6460c3c451690b8b2275a339ee188aa6ee2c562611ea2a154cf7", + "minecraft:enchantment_power_transmitter": "994fa10c1ef5d93ac297c5cd254c8487c359c5b8c18b272f02dab1630d4a932c", + "minecraft:enderman_does_not_teleport_to": "791133f6dfd29b7e3dd4f972c520731d5f3ba5ea6a788631e3abb3dc26fbf87d", + "minecraft:enderman_holdable": "62810b2747680097db833ac445364363691001206f22023b73ff54cae43ab289", + "minecraft:entities_can_teleport_to": "50071b6af79dbe9d94c0b98058dc2457d5480854d768bc74668411f7f58b9165", + "minecraft:fall_damage_resetting": "3a765259768c8ecdfcb83e97e00dd808e709d51919d6d52436869bc93bc7b9e4", + "minecraft:features_cannot_replace": "a117e03f857eacf14ff5862ba6f885bb02b476a844b683c2be61211202a9a10d", + "minecraft:fence_gates": "e7f5073f8d01da657f1672b267f11259850f1f516e9682e4d72753bab8f0692f", + "minecraft:fences": "214462701d11703b222317fb7d470caa40e017b5036b127db242986b92fb30cd", + "minecraft:fire": "0074ed2ae89b03a2008a8220636c7544c868326e925b4bfae223891bd5727a97", + "minecraft:flower_pots": "cfcd5bf8e08722705d4c39799b817e6def554f87c39a0c901a3b4a2770f5e754", + "minecraft:flowers": "879e9a5ef65da1212023dfb2f7d842c1053606ef9902c86f45def1efbe5925d8", + "minecraft:forest_rock_can_place_on": "089172380f9dad33704e6f888dad7cbe8ffc5084f1580db5ada9f17ff7509489", + "minecraft:fox_immune_to": "24140175721e7b970c19144465d65d9ad51f2f7eee62b0d46eea2fd9e8b41cde", + "minecraft:foxes_spawnable_on": "235a81e5c7a3fc53d4674d8ace8682999ad357d77f57093af82d50ab8210cc6a", + "minecraft:frog_prefer_jump_to": "746f4240de2b36def3a89d86323027f25e1e9c92cf80cb465e31e581b723ab5c", + "minecraft:frogs_spawnable_on": "26600c631e98396171480739ecef5da2a9a6c988aded4e4fe98e1037c13c5452", + "minecraft:geode_invalid_blocks": "bdf2c9f19d40e9648c58eb6ebe9583e32102a88acda417d89bb8ec8151b93313", + "minecraft:glazed_terracotta": "b26bcf2138eb8a100e648cd036e5ab76142edbbdbf679988e1f816087cda7680", + "minecraft:goats_spawnable_on": "b5da3deb14f0c4e78384638b9b770b628f4a394dd15fac8e4d3266926d802c75", + "minecraft:gold_ores": "65ad25a49ab9172921f468a528cb1a14de1c4f46b14cf275434cbe3e8d069bf0", + "minecraft:grass_blocks": "43e3ca99c7840ab423acdc412cc895a3d420061e5471f79c273de5c3ef665037", + "minecraft:grows_crops": "4d7f9113151ae6fcfc7622ffe89f7c64f3f5bd0cefe5b778c9e7c11491183cea", + "minecraft:guarded_by_piglins": "df149f60e06249fcfb0f70f92a3ea34917bcf5f265729425147597eb2aca0441", + "minecraft:happy_ghast_avoids": "f4e76ec462e4f8b120f14f3eab2dac459348c85090da677a8051c8699919f929", + "minecraft:height_specific_ore_replaceables": "4b5787e3d7aec6d70ce5f9a7919df0aab705e2e368695065e6abcd21005f1681", + "minecraft:hoglin_repellents": "09e4345473c0448dad9192dba6c9273f7dbe919cbe547c8eb6f0cea0247d027b", + "minecraft:huge_brown_mushroom_can_place_on": "334213e1abb6463227cc3d9a24970800047ebc02d596277e9c4e7ba6a9feb013", + "minecraft:huge_red_mushroom_can_place_on": "334213e1abb6463227cc3d9a24970800047ebc02d596277e9c4e7ba6a9feb013", + "minecraft:ice": "85098bdeb333fb4b630565e8679bfaae143d78defa4dbf0398280a9f4d863db7", + "minecraft:ice_melts_when_destroyed_above": "50071b6af79dbe9d94c0b98058dc2457d5480854d768bc74668411f7f58b9165", + "minecraft:ice_spike_replaceable": "5da056adf11b03c033541fc4cbb69ce878bfa31c48d54a6e88656f6b7284e841", + "minecraft:impermeable": "3afa898d24e49ba1e32165e8bfc370aeebd508cc90eec9e3bf0f5a3d202d5ad2", + "minecraft:incorrect_for_copper_tool": "5fe30a57d8935ba07c4b1f3d76498655ac4e8471e118474c18e42ca5caa9ca47", + "minecraft:incorrect_for_diamond_tool": "b83114c23eeec820ce7eca52011f13013fb6c64002254be7aebe1e4b36244d48", + "minecraft:incorrect_for_gold_tool": "dbe4a0337c74949f118c6252dd75488c75c41b672b753f1f5222d5def15711ac", + "minecraft:incorrect_for_iron_tool": "61c0fa3215f263a2bd4a01d504e03e3d83613f9f09a76d060136b37941abc78e", + "minecraft:incorrect_for_netherite_tool": "b83114c23eeec820ce7eca52011f13013fb6c64002254be7aebe1e4b36244d48", + "minecraft:incorrect_for_stone_tool": "5fe30a57d8935ba07c4b1f3d76498655ac4e8471e118474c18e42ca5caa9ca47", + "minecraft:incorrect_for_wooden_tool": "dbe4a0337c74949f118c6252dd75488c75c41b672b753f1f5222d5def15711ac", + "minecraft:infiniburn_end": "f498b235a368f9abe32ab4190fee70924da9af4624d0d2383260805f85882858", + "minecraft:infiniburn_nether": "c5256847f721908d61a51568598a141bc60bd2779aec34505b7b90381064592e", + "minecraft:infiniburn_overworld": "463640bbca53006d499273ffb36499d1f6f596a11d073ccd7ad7156335ba1a58", + "minecraft:inside_step_sound_blocks": "2d97011bfe26d35e5895027ce80f3372b79ced9138bc567bf8cb031520f8a596", + "minecraft:invalid_spawn_inside": "68137e3d5f9fa6a087427c73f686f7c2282011007153eed9377abfb3c57c4a04", + "minecraft:iron_ores": "2f6f3610e361a06ca72bda39893431eeebc864dcf389cb0c4c55826ebe6bb587", + "minecraft:jungle_logs": "4ae9b365f5d403065b424f54a80018da98fbc73dd9b21564dca5a0ed77e89f2d", + "minecraft:lanterns": "ed570e0784f38272eec1325490be861a719e0d3747a591aa865f175cc0ee9f54", + "minecraft:lapis_ores": "2c986a71c5f2819549e17647415b6911250ddba23f03d9720fd10b6ad7c066d4", + "minecraft:lava_pool_stone_cannot_replace": "5b276c48e550fd769a8137a42f7dadf5e15625c336c7def6e07379c60a27bc92", + "minecraft:leaves": "4e531a80db177ab0b6fa8c65bbb6d82179a1fd5c1e31ca2ca8860b9b6c26329f", + "minecraft:lightning_rods": "54efd924cb3670c6894bd5a1d3cefd40f80752a98c8c457c78210a8e3efd0e36", + "minecraft:logs": "439a696d433df1387db440b32017d1ae9a5b1ffad9ffce5d5c9cdc3a02b29484", + "minecraft:logs_that_burn": "6697c4380b98c6d240f59ba291974c61067e6e4e45bce4464ed7a0a15c333b93", + "minecraft:lush_ground_replaceable": "b783ab0f70d5d9aa2807bc852410a0e1b682d46c476a05ca947f6f33001f839d", + "minecraft:maintains_farmland": "8d059a868793fe740b1cd2a6edc013246a068e35fb7477effef2b59b49f07bdc", + "minecraft:mangrove_logs": "0e314f82ca811b358eac141f3fd65b5f886ca1de9a5055a370901118c4096f1e", + "minecraft:mangrove_logs_can_grow_through": "7bd6f349aa8ae59cea0cc1469abad9963d5df24ec797777e3c3d750fe7555ce2", + "minecraft:mangrove_roots_can_grow_through": "64ba58eb3e4e89e8488a641f35dbad02fc2f19517ec690013d6aa2c9266d95a9", + "minecraft:mineable/axe": "14cad4e01465720095785e2d83807ca9b5eff6a1e24a76d50d17eabbee327ee9", + "minecraft:mineable/hoe": "138f9a28a1ca58c362dbcff3d7487f33b5e921b60c82a155a38dc5ef3a1ca26f", + "minecraft:mineable/pickaxe": "1573d7327fd943eb1f58f81e56bf29f55140ab200f4e721773fcb10b6cdfa7fd", + "minecraft:mineable/shovel": "732d8db1157516e8238ed13c85d4d85b5e49313b745007f361970a83b5f0b87e", + "minecraft:mob_interactable_doors": "e1b420c07e8f75bd802a2fded9307c0d13db1b72624660f59bcd99ff0552592d", + "minecraft:mooshrooms_spawnable_on": "67dd8577579b4c563afcb5d0f4c66677af1d0be4c5061b3e87eb4f3438c2f8f5", + "minecraft:moss_blocks": "4302e1e162fddeb21cf18ac8375f57bc2885fbdfa5b5cdcfecf1406b701d73d7", + "minecraft:moss_replaceable": "d53f7ef7d5c4cec3347e1a6aa39dd92655d09685768446e15b7e944ee9d3add2", + "minecraft:mud": "21b98cf5d9598dd147bd1cb169d5ab133083b0af90bfdf343e786c7b2e764ee2", + "minecraft:needs_diamond_tool": "fce3d4bef99721711ffb1bcdd72812c82e55e90d02417fa3065c260c0f96b833", + "minecraft:needs_iron_tool": "38ddda4cdd6d06afa8afa328f3606c944f736ef6e85e376121c84bbb8743d2e5", + "minecraft:needs_stone_tool": "9086735ddeba00745a8fca8d8768d19d638613a50a3835064aaa0188a9867200", + "minecraft:nether_portal_frame": "b72bce8b52e825930a2b907f6d720d8019a98405c4e66db0cd785235d378791e", + "minecraft:nylium": "2bf59f6932ed8a1530f92d4dfe8410eaa25741291f9f882688438814701bfe53", + "minecraft:oak_logs": "939819db71415f16498a0f19ab34e80c9cd60e08a507b31f60d49762575613e0", + "minecraft:occludes_vibration_signals": "b848777c11c4a202a79169339d6f3898c63610b2556cca783395fdbe36377a41", + "minecraft:ores": "0571768a41f42bf46252e9be35515558245b8640f2809bb6be74fd00a7c57da1", + "minecraft:overrides_mushroom_light_requirement": "efdca24061ea4c72dfd92d7fc85ba4febacbe7b2438430ad22fc50a5c31c4a9e", + "minecraft:overworld_natural_logs": "6e0974d475d448f34b0c23f062aaa7ab007afbddaa808870b63ae97aa88d82f5", + "minecraft:pale_oak_logs": "272aa7c38e04ab5616d8b70bd319fb7867fa9fa54ca4f815f338ba22084268ac", + "minecraft:parrots_spawnable_on": "d95d588b2b0971b6a1ea9ec59917c3834c5b6faee760e64455090b024417553c", + "minecraft:piglin_repellents": "e8d41b3b596d6bd2614787d1ad0d9eb79f79243aaf37c4f22be77edd4d6639e3", + "minecraft:planks": "1b2433c0a7edddaea36d87189429fb22d726ba2f8c406532624ba1df49998908", + "minecraft:polar_bear_immune_to": "c9331c65e0f8e076b9556a4951117b5db18676ebeaedd34c98a4c36229721b0e", + "minecraft:polar_bears_spawnable_on_alternate": "0214bf0cf9dc2da33e3c8619b6bc8654ae81126711ce8a55d07fe3af80cd6bdc", + "minecraft:poplar_logs": "9f2c1c5cf9a53e7cb2d21dc770b4c10c1bde4fefe5c2c46e1c3d95b53b69e968", + "minecraft:portals": "fe9759678b07daacfebc3ce9e5aa616489cb432af36d14ce4cc1128cd3a410ef", + "minecraft:pressure_plates": "f230b7dfb4144845d2a5c8686c22d0ee6401ac7688e9941025f322c76b93d807", + "minecraft:prevent_mob_spawning_inside": "6b48540f3809b6cde38322153e4c09a45e91c5d8b6356ac03ac2ed763af40f3d", + "minecraft:prevents_nearby_leaf_decay": "1f97c8515ceb8886dab66238b675a3c4ea0eef6b8a92350bc7667d81a90dcfee", + "minecraft:rabbits_spawnable_on": "a908ed77300ac3d697c8a3c56570fe60e08562b8bd5a3f079aa4671218ac94e7", + "minecraft:rails": "fa33f7e0ee5381b318e70b3a0a96a73ea420c75355ac77e9ae69933491585a99", + "minecraft:redstone_ores": "7884553e4f4b0ac64a7dfdf172271b870ada01b0fbdfbc8a4af3bb8db6ab974b", + "minecraft:replaceable": "6abeeb6e8520263e0876b4ef457f0d38dae703abca63ca4408adf3ba99fe2ecf", + "minecraft:replaceable_by_mushrooms": "f62394a973f927da9b4b667938c03528412ea2dac58663fbf94e0f3eeda31d0d", + "minecraft:replaceable_by_trees": "8aae57fc70df3c4c9a7224adb842df9e35b3456567e75b7598d236a38a0b3f04", + "minecraft:required_for_poplar_leaf_ambience": "14a398b48f6980dabd49663f04bd864effe9fca3287da35d7217f95668abd206", + "minecraft:sand": "8b019e944ba404bfbfadd0389a94e0fe907819b109cbccf577f7bb80826cc8e8", + "minecraft:saplings": "a59858d94b488625036481631db5b63c716ea1027cd89eedcc3749e3832e3ff2", + "minecraft:sculk_growth_inhibitors": "86f2dc2d79bfe4f8a25e9877b2453b0b493654af80f9fd1f77d8133c8abd5377", + "minecraft:sculk_replaceable": "8f5c608ef4e8c74002bf9d13a50e81804d37f72c59faf80dfcb7367f6e1ec476", + "minecraft:sculk_replaceable_world_gen": "35a9d8a4e947c8f09d44a9836766d639ac37e647dd5da23ca5b8b8f3e0afcb34", + "minecraft:shears_extreme_breaking_speed": "5f10b4c2ffc5a5a565fbbf9e36f5ef7a39db59cc52d495e82f59232a87055cfd", + "minecraft:shears_major_breaking_speed": "bbca62b8be3d948489f7a36a58ca63e9a88d7a400ca48c20bd7c16dcab8302e4", + "minecraft:shears_minor_breaking_speed": "400e88cc600815a02e905e834331d8f5f7f06d0f7a8bfeb762b2914a1e1930df", + "minecraft:shulker_boxes": "9bc43c47d90eb246371c67b7d5b631ceed7acdaf489be766f5f03b32cae9d12a", + "minecraft:shulker_does_not_teleport_to": "6948279d2a8c57c2033996a56afb1cdf5f9bb08e54b48449834d25aa11b56b8f", + "minecraft:signs": "f17adec59bd57315440524f6edfe7d18a8f6f372afe887dc9a0151055a15706e", + "minecraft:skulls": "9d95ce3eff65efe58e979dd82eb66fcbf224c8d583a28a12f6f9ed8499e2c987", + "minecraft:slabs": "c29f6f1f62555855b99d525641ce4bd4e6e31516d7c20fb9ff987762ab8d1a9b", + "minecraft:small_flowers": "d54cf92939e90d72302dfe7c0c2f127e56ccb9622e8564729a591089f42e9d0f", + "minecraft:smelts_to_glass": "f32f9a585b721d552bdddd85e3ae92515b24f320508be56e79da1b5dfbe40126", + "minecraft:snaps_goat_horn": "e0adabc6b55755bbe745e2d1ad76a888bc0ddb0946c49066f43781b6d260db27", + "minecraft:sniffer_diggable_block": "882d72a1c6578f0daa93700cb32833ab255fb92b8db0b7008c48d43592cfcc80", + "minecraft:sniffer_egg_hatch_boost": "bb3f57906b51fa5d25833d31618a004ad8674079f221080ad3f725a06dbfab39", + "minecraft:snow": "24d5e3b9042595e734d911caf4d1d59f8d27c865743fd7562fa72d32f0b5acd0", + "minecraft:snow_golem_immune_to": "c9331c65e0f8e076b9556a4951117b5db18676ebeaedd34c98a4c36229721b0e", + "minecraft:soul_fire_base_blocks": "8ba7eac6f7c74d25601ef4455b71e3947fdb8e51b8fafd55dddee48397b144b6", + "minecraft:soul_speed_blocks": "8ba7eac6f7c74d25601ef4455b71e3947fdb8e51b8fafd55dddee48397b144b6", + "minecraft:speeds_up_zombie_villager_curing": "38c66dd46c59f72fe7832706e8f197e2654975aa2c9c8a87d5d9bb3bfe5a80a1", + "minecraft:speleothems": "ab7de03a837a56a0ddba55735f279688546b19a80e4f6cd73332dd3a5da8c286", + "minecraft:spruce_logs": "129c6d79945e1bc246fb8ff32b8a6848035c6ba63f0a6d65c18adfbd41111307", + "minecraft:stairs": "5d25e93ee7bf03994223098ea9bcf2f9a49a619aa345e7097848e441ad63d33c", + "minecraft:standing_signs": "0d212a5664d8626496b70b38aba8cda581db0ccea7021d051be5cc5b1e2f9335", + "minecraft:stone_bricks": "61f8c78df54ce0d2af255dfda5d13d9768c82817518122b77a27da6d5f62e924", + "minecraft:stone_buttons": "1ebb5c3d79c2828ace64c52636451f05ea536411050c3d198646dc60d367051c", + "minecraft:stone_ore_replaceables": "73e4e80760bec9744d8f16343b21c396ce656e21593512264034b71f39164b27", + "minecraft:stone_pressure_plates": "88ef362edff8fcd8911d9e66db8b9e8d7202666e349706399ee97cd532126e01", + "minecraft:stray_immune_to": "c9331c65e0f8e076b9556a4951117b5db18676ebeaedd34c98a4c36229721b0e", + "minecraft:strider_warm_blocks": "83522a84667866ab21d9776f961368ac345c579f1eeb388580343261f1b21457", + "minecraft:substrate_overworld": "bd87412cd52db66ca8be5c79bad2622ec04318a5ccd90da89304e03d15360e5a", + "minecraft:sulfur_spike_replaceable_blocks": "9b691bdeedfa35a01dabb7554b1c32dca4c5de67da85a841c381db7d3ce84bb6", + "minecraft:support_override_cactus_flower": "396c699cd80945fbeda41f41c5797e36464f866c43a0dca08740c790dd428923", + "minecraft:support_override_snow_layer": "c7491ae1bafae440421e90a1387ac87f46f7e003f37315f4acf5ea0d0ee8cd5a", + "minecraft:supports_azalea": "7cd5cc83fc555289eac260b9a6726e531e6590ac4abac92e1de2a9e163d25b31", + "minecraft:supports_bamboo": "3d11eaccececc7c180f07c29103f4e0c0de0eae88cef00cb6c830df27fe6bbb1", + "minecraft:supports_big_dripleaf": "29b86e096da2a2a4c1efdd676b64ad7d7c8db65b537412d374781f068e6c14c7", + "minecraft:supports_cactus": "99d10c8d690cda2d9334d3cf49f1feb4d1980c8661a0c903e2df7b5a5f23048f", + "minecraft:supports_chorus_flower": "fd1861976dd8d10f3181b7070dc066b06d20b1ec6764bec7ef1d26f5c500b989", + "minecraft:supports_chorus_plant": "fd1861976dd8d10f3181b7070dc066b06d20b1ec6764bec7ef1d26f5c500b989", + "minecraft:supports_cocoa": "9c052ed599c8b8c782ae8bfaeb82cf241b8e5fdf0dfb8461f72db7de41991e98", + "minecraft:supports_crimson_fungus": "edfb0dd7ad8c89ecc53d6983332b353b1c9bae7bae38dbf6ef01d9805d79ca66", + "minecraft:supports_crimson_roots": "3c682d1feea46f22e4a1c382321347ef6c7f0c875c472ccb5ee77c5ef6cffda4", + "minecraft:supports_crops": "4d7f9113151ae6fcfc7622ffe89f7c64f3f5bd0cefe5b778c9e7c11491183cea", + "minecraft:supports_dry_vegetation": "15c03a19f25f4e359ce7bbed76e3545b003afee26a6dd1fa9fc54ed13d757f14", + "minecraft:supports_frogspawn": "b83114c23eeec820ce7eca52011f13013fb6c64002254be7aebe1e4b36244d48", + "minecraft:supports_hanging_mangrove_propagule": "568c4172f5e1c709753e9bd5c0b90fd8d00ebf273d3ae41ce2d0b994b3d70e30", + "minecraft:supports_lily_pad": "083ad48f95c51480fe049d717ae88770fb736087f5e654260eb3fea47cefee9b", + "minecraft:supports_mangrove_propagule": "7cd5cc83fc555289eac260b9a6726e531e6590ac4abac92e1de2a9e163d25b31", + "minecraft:supports_melon_stem": "95f16c95de4122a2d1cf36e4a465ea02c9f471adfe846fa3edcf147c5df0cf14", + "minecraft:supports_melon_stem_fruit": "0aec0e82e8fe82cb1900a7c4b25755985f863af73d7f473d2bbcfa51c2dbd14c", + "minecraft:supports_nether_sprouts": "da4cbcf213787b215358c9c671b8a0f675f6066b2b057126b320d7bdc8b7b3c6", + "minecraft:supports_nether_wart": "34064a586d19afe34ef83fbd356eacfe026b9b3a3569efdf28cd88fea8c4bbb1", + "minecraft:supports_pumpkin_stem": "95f16c95de4122a2d1cf36e4a465ea02c9f471adfe846fa3edcf147c5df0cf14", + "minecraft:supports_pumpkin_stem_fruit": "0aec0e82e8fe82cb1900a7c4b25755985f863af73d7f473d2bbcfa51c2dbd14c", + "minecraft:supports_small_dripleaf": "a99bba4f6b9d38de565a516dc3225a44bf1bfb0abcb5a41b741b4391ad82185d", + "minecraft:supports_stem_crops": "95fa800e152c76f36a71d12f471f9410676c5a959685e16067e1858bd6aadc43", + "minecraft:supports_stem_fruit": "d60c648291a7878f5e2b817990e4cf96861a0ff0665f9279cd7ccd2edc9f1502", + "minecraft:supports_sugar_cane": "e14e48890d10f8a260218e45d9461ae7f3d2a8b67f40760e4d61f6e4f1ed082c", + "minecraft:supports_sugar_cane_adjacently": "d423c0f2b573812f5145e497cf05f1a0f58919f8e8102d1cc8e41460c82c0a4e", + "minecraft:supports_vegetation": "4d1b4da00fa525283307235bbf0ccb7d9d0d5b7ca2fb79a9bc526c45cdaed94f", + "minecraft:supports_warped_fungus": "f19d6362b9fae5e2142e3b0dfee12b71ca41f4017d711d1629e374ddff03995b", + "minecraft:supports_warped_roots": "da4cbcf213787b215358c9c671b8a0f675f6066b2b057126b320d7bdc8b7b3c6", + "minecraft:supports_wither_rose": "1e4b2b3e19deb22aa3d5342e530a184f1d9388bb957bd39f5bb4da5f36c7bd08", + "minecraft:suppresses_bounce": "a477a87ac4bcb97971cb0b445f4cc9b6b8e02cd31ba3d01bc842b17a6a8477a8", + "minecraft:sword_efficient": "d7dd01ce779d198112646b71060382d7f6e10fee51f69dd792bb7e70cdbd3796", + "minecraft:sword_instantly_mines": "3160a75a72843c85ea22a98f4cd3b811cd1c9d71b807a3f7ad1fed05d6e2f06f", + "minecraft:terracotta": "d05ea6b1a2f1e794ff11745534938eaf024ac9debed7b29ef272aba4f1b648b9", + "minecraft:trail_ruins_replaceable": "dd61dc33a8cad62aaf6ee212ec69a4cfa06a2548259203d8d5f975048c6d6c68", + "minecraft:trapdoors": "0b72384f2da185aa3727914af7c4b72eb09574b1f3319a8bfd38b7899e77871d", + "minecraft:triggers_ambient_desert_dry_vegetation_block_sounds": "b9a1ed369a8a7d615f5fdb4a189dc6692984f562136502238c31c8b43344f74b", + "minecraft:triggers_ambient_desert_sand_block_sounds": "f32f9a585b721d552bdddd85e3ae92515b24f320508be56e79da1b5dfbe40126", + "minecraft:triggers_ambient_dried_ghast_block_sounds": "8ba7eac6f7c74d25601ef4455b71e3947fdb8e51b8fafd55dddee48397b144b6", + "minecraft:turns_into_dirt_path": "1e1986bfbc635a9c2e8dafe50201c9ab228973770bd4adf60336451b0eaff725", + "minecraft:turns_into_farmland": "b6e5c0b39744b55dff4b471486cf653757095ed24898fec15111a6da6eb21232", + "minecraft:uncarvable": "6948279d2a8c57c2033996a56afb1cdf5f9bb08e54b48449834d25aa11b56b8f", + "minecraft:underwater_bonemeals": "7f145355f4840f498d2e8951e905562df9ec57b35bd2e239db60fe5e6c4b78c4", + "minecraft:unstable_bottom_center": "b7b0ae50f52c2c35c3c2aa266d7365f88d6b6d463eb3c23ddb6f25d7438e0c11", + "minecraft:valid_spawn": "0fa990e0cfe3e367fce4af268e5cb1958b2ce2f1fd569c1bb2ce38c28bd4092b", + "minecraft:vibration_resonators": "21ae4048432850b44fc277224bc0bb04ac26c43ea865b677c4d61d316cf4199d", + "minecraft:villager_babies_can_jump_on_bed": "bf3cb7e9d117fc573fca34ab86c6979289cc3192b17d84306ad534321e899fd3", + "minecraft:villagers_can_sleep_on_bed": "bf3cb7e9d117fc573fca34ab86c6979289cc3192b17d84306ad534321e899fd3", + "minecraft:wall_corals": "e218e0a27b6e0b1ff685c3181a747b25eef3fdecf1d91bd22acc420eed16cf39", + "minecraft:wall_hanging_signs": "4015ec17b365fbbf2790fcc77f9cce25c2bc8f573b2bfb76615920d5b4f480c3", + "minecraft:wall_post_override": "c0aff6e7027ae63685e75d05e9d317ac35b8f0e65ef0702a1a0e7e92dd711c34", + "minecraft:wall_signs": "48193b7fd4ae4ed47b4bd3b143fa2679d3389301c89eeec62f87421b3ae3048a", + "minecraft:walls": "b41e70add357bbf1b1498ad15df2257c3fd8677f27578a2980b6e3f1e9082996", + "minecraft:warped_stems": "7515406d2b3d3f41697dc6b31579d2750730de34638196df3b9ba1618e3afbaa", + "minecraft:wart_blocks": "548bc2c73a5292d7beab476a32329866c2a5c870ae5d537eb20c459578f06b28", + "minecraft:washed_away_by_fluids": "766b16b3c4a49982103214e10398f4dd8a941cd69e100e3ae89c6a7c0267cab1", + "minecraft:wither_immune": "b6e3c98f2ffab1e0c4ac7000ff5a0da7446caddda14128d629ad8e91d1088d21", + "minecraft:wither_immune_to": "6c5034bdd6acf6121eba6ecac49c3492f5a0c640d71d37802231f413331ebdb3", + "minecraft:wither_skeleton_immune_to": "6c5034bdd6acf6121eba6ecac49c3492f5a0c640d71d37802231f413331ebdb3", + "minecraft:wither_summon_base_blocks": "8ba7eac6f7c74d25601ef4455b71e3947fdb8e51b8fafd55dddee48397b144b6", + "minecraft:wolves_spawnable_on": "52048dd1c3d0b7c8e53b50a377759e08da6bc258d874f299809ccf2e3ceaf16f", + "minecraft:wooden_buttons": "9b98c5efd80d70e2c0c242742faadf928c55bb87a12537ceaab819098de59acf", + "minecraft:wooden_doors": "a1119985376529ec73b217cb1fa776232830d03d6504d7479819e49067dc195f", + "minecraft:wooden_fences": "5d2ef0da8c97d26478f44329541792cbd0be1f141a0a347fba32a1f1b292f552", + "minecraft:wooden_pressure_plates": "013f6d8f09d6cd0c0d3a173971fc5aada626122361c164c36ec0291d642de082", + "minecraft:wooden_shelves": "a9934fc780d5e6e533443a842f36eab0c09e14c19ff06d537d77964952f5b91c", + "minecraft:wooden_slabs": "191dbe3c0e7a6a8a1c5cdca0ef89f8e0d5d15d7df01d05afde971e1954944745", + "minecraft:wooden_stairs": "9c6340ce2573c3b988be980ebe15200d9f817bc14d6f4982fab430f0b6696923", + "minecraft:wooden_trapdoors": "b5cd0998d48fe3ecb24b49cffe4eeed411085e3c3b9ed05e794254c29b0afb93", + "minecraft:wool": "02dba7a59e67c70ea0c21e21ff9b081047f9d6f0d39b5b6ad8d95d53eff28ca4", + "minecraft:wool_carpets": "bcf8ca0da1842f340fbb23f7582913a0ede9f33c6b99149fde3cb944c4bef545", + "minecraft:wool_slabs": "7047da1dc7f8f64b74d327b6e491b5ce4d3296ccb73cd8813b01853fcd54c660", + "minecraft:wool_stairs": "7f70163726c2e5632c673f0cf7b0ca3cc39347eff97284c41d3d787c2fb8c7f5" + }, + "noise_registry_entries": 64, + "density_registry_entries": 55, + "noise_settings_entries": 7, + "biome_parameter_entries": { + "minecraft:nether": 5, + "minecraft:overworld": 7594 + }, + "biome_tables_sha256": { + "minecraft:nether": "09e477f851380a6e726ea85fee39cd1d41c7f160fe424f58cb3f0056b5c11218", + "minecraft:overworld": "6bc45ce2eed04b6afecdfaf2cf89273e83dad071aeb45638e181d33fe5180f57" + }, + "fixtures_sha256": { + ".local/rust-worldgen-parity/registries.json": "816a473e6109c3eca1800f15641eb67b909a17b5e638e38428878dfa1ba2bc56", + ".local/rust-worldgen-parity/inputs.txt": "838760bf635afb0ae8925f490cef9dbdc30142bbcc67be088c2b5a65dff91937", + ".local/rust-worldgen-parity/biome-presets-client.json": "b03e2fbe85c191a22f333bc989bd2a73c66f0f9fbcd9ddb54774f17c247832e9", + ".local/rust-worldgen-parity/biome-presets-server.json": "b03e2fbe85c191a22f333bc989bd2a73c66f0f9fbcd9ddb54774f17c247832e9", + ".local/rust-worldgen-parity/blocks-client.json": "2e1b3c1c168bd1b54665df724791923f703db859bf62cf8ac1d083a8da9b3ec9", + ".local/rust-worldgen-parity/blocks-server.json": "2e1b3c1c168bd1b54665df724791923f703db859bf62cf8ac1d083a8da9b3ec9" + }, + "noise_resources_sha256": { + "data/minecraft/worldgen/noise/aquifer_barrier.json": "864a9d66a03b081adc8d4bf51a6d0cd5fdd94a0ebf1cecadec2aed9e549db7e4", + "data/minecraft/worldgen/noise/aquifer_fluid_level_floodedness.json": "e755b926628bc49edf48a3bd3b1e1bc3e2895b774f5e2e81f1d4340782a9fc56", + "data/minecraft/worldgen/noise/aquifer_fluid_level_spread.json": "6afc3f09b6616f799d739b5b114c4436059dcc60308af55fe96a8594de815214", + "data/minecraft/worldgen/noise/aquifer_lava.json": "96e1c4e411ffe302c5541cd2ee8462e1992f0290d623c560f353c39981737346", + "data/minecraft/worldgen/noise/badlands_pillar.json": "79c0d0628db949d3b83bbca145da427bcdc3ff585b0ad736f7cb20e4c593c9a2", + "data/minecraft/worldgen/noise/badlands_pillar_roof.json": "7f137a0382721b8c7b3227e65dc32a3f6d9c3d5893458b03e892797ae31d85d7", + "data/minecraft/worldgen/noise/badlands_surface.json": "79365a5c2017e93878d989a176520ba9cbdf8685cff8b3cb148730d949d98b09", + "data/minecraft/worldgen/noise/calcite.json": "331259d84572c32b4b268d069e0132da9e6623ba614080e34b815472c7f4ee0c", + "data/minecraft/worldgen/noise/cave_cheese.json": "24c6846b7fc1f7c652bf185797fe98b943146b6aaf8766d1bff2066c59b7ed24", + "data/minecraft/worldgen/noise/cave_entrance.json": "f75146a7b1a033998edd3c77319f78243fe933bdcda2067b78658940f145cac6", + "data/minecraft/worldgen/noise/cave_layer.json": "7f137a0382721b8c7b3227e65dc32a3f6d9c3d5893458b03e892797ae31d85d7", + "data/minecraft/worldgen/noise/clay_bands_offset.json": "7f137a0382721b8c7b3227e65dc32a3f6d9c3d5893458b03e892797ae31d85d7", + "data/minecraft/worldgen/noise/continentalness.json": "b7ce5ac29a2c7a7cfbfaa1e1eeca9ba8f4a52139e59318850fa2407242c69ba8", + "data/minecraft/worldgen/noise/continentalness_large.json": "76834cff0227d52b19b5932142925f4fc639e713c2180e489f813701ca45f53e", + "data/minecraft/worldgen/noise/erosion.json": "af8a7a0f16ff3e568ad646df9cbc28e04a31b16dad4f162705c0f7c747da6983", + "data/minecraft/worldgen/noise/erosion_large.json": "d20c2c6ec805a366b105924b3cee29ac5b84cc06d636b539ae0047aac413b60a", + "data/minecraft/worldgen/noise/gravel.json": "87d627634161e51a79512f3d3f42f990d2a185e35198eb5e2161939d866751e0", + "data/minecraft/worldgen/noise/gravel_layer.json": "a4b45bdb6efef2509b053b970f6e84250d7b16d54f3906bc7fcf2665ada2a692", + "data/minecraft/worldgen/noise/ice.json": "85d03cc06d6bc552dc399dcc90ca9749c2625ddf0049dc0f95684631a7c6e66e", + "data/minecraft/worldgen/noise/iceberg_pillar.json": "98816326f84a21ce29421a9cba3ad85e5a26069312c9819aaf5662691e777fd5", + "data/minecraft/worldgen/noise/iceberg_pillar_roof.json": "864a9d66a03b081adc8d4bf51a6d0cd5fdd94a0ebf1cecadec2aed9e549db7e4", + "data/minecraft/worldgen/noise/iceberg_surface.json": "79365a5c2017e93878d989a176520ba9cbdf8685cff8b3cb148730d949d98b09", + "data/minecraft/worldgen/noise/jagged.json": "d64347f4f9acb984075e3b4945b4699907ec6d893588388dd8f738f29f75f4d1", + "data/minecraft/worldgen/noise/nether/temperature.json": "5a67fbc28b5c2578b4ca5f6abdd115c715ea2ef1be3e1a7a8eb1a0de4c3a8f7c", + "data/minecraft/worldgen/noise/nether/vegetation.json": "5a67fbc28b5c2578b4ca5f6abdd115c715ea2ef1be3e1a7a8eb1a0de4c3a8f7c", + "data/minecraft/worldgen/noise/nether_state_selector.json": "116c8bf1d676fd3a3dea3908e074a4f4b7ee55d3263e93abf5889b41bfc77f5b", + "data/minecraft/worldgen/noise/nether_wart.json": "4518b186ffe4b65394a35276c8708037c6f3f73c7cb95ef6d41a5cd4b8d234f6", + "data/minecraft/worldgen/noise/netherrack.json": "cef60938a0304eec78a6bdebd24b80a45c5d1bad894c6c012e3413ecc485a81a", + "data/minecraft/worldgen/noise/noodle.json": "7f137a0382721b8c7b3227e65dc32a3f6d9c3d5893458b03e892797ae31d85d7", + "data/minecraft/worldgen/noise/noodle_ridge_a.json": "e755b926628bc49edf48a3bd3b1e1bc3e2895b774f5e2e81f1d4340782a9fc56", + "data/minecraft/worldgen/noise/noodle_ridge_b.json": "e755b926628bc49edf48a3bd3b1e1bc3e2895b774f5e2e81f1d4340782a9fc56", + "data/minecraft/worldgen/noise/noodle_thickness.json": "7f137a0382721b8c7b3227e65dc32a3f6d9c3d5893458b03e892797ae31d85d7", + "data/minecraft/worldgen/noise/offset.json": "45f51565587e2dc055271648037c0ec3466815e82f0d762e0198c16285fc8ae7", + "data/minecraft/worldgen/noise/ore_gap.json": "6afc3f09b6616f799d739b5b114c4436059dcc60308af55fe96a8594de815214", + "data/minecraft/worldgen/noise/ore_vein_a.json": "e755b926628bc49edf48a3bd3b1e1bc3e2895b774f5e2e81f1d4340782a9fc56", + "data/minecraft/worldgen/noise/ore_vein_b.json": "e755b926628bc49edf48a3bd3b1e1bc3e2895b774f5e2e81f1d4340782a9fc56", + "data/minecraft/worldgen/noise/ore_veininess.json": "7f137a0382721b8c7b3227e65dc32a3f6d9c3d5893458b03e892797ae31d85d7", + "data/minecraft/worldgen/noise/packed_ice.json": "0f51993727dcb0aa7c6cb9288e462443e711e9980c12927435126a3c45922786", + "data/minecraft/worldgen/noise/patch.json": "83a0052d4220c67c5513bce689d681e3af3325c18fec612cdd4941fc738f4be0", + "data/minecraft/worldgen/noise/pillar.json": "5a67fbc28b5c2578b4ca5f6abdd115c715ea2ef1be3e1a7a8eb1a0de4c3a8f7c", + "data/minecraft/worldgen/noise/pillar_rareness.json": "7f137a0382721b8c7b3227e65dc32a3f6d9c3d5893458b03e892797ae31d85d7", + "data/minecraft/worldgen/noise/pillar_thickness.json": "7f137a0382721b8c7b3227e65dc32a3f6d9c3d5893458b03e892797ae31d85d7", + "data/minecraft/worldgen/noise/powder_snow.json": "98816326f84a21ce29421a9cba3ad85e5a26069312c9819aaf5662691e777fd5", + "data/minecraft/worldgen/noise/ridge.json": "e05d077746b27d662a8c981807819df3e3bb1f1779d2245dd911c8193e03bbf8", + "data/minecraft/worldgen/noise/small_patch.json": "9ecc836feb68b42d717217e028f2a72112179f1097f5bd156b1d3f1db637732e", + "data/minecraft/worldgen/noise/soul_sand_layer.json": "a4b45bdb6efef2509b053b970f6e84250d7b16d54f3906bc7fcf2665ada2a692", + "data/minecraft/worldgen/noise/spaghetti_2d.json": "e755b926628bc49edf48a3bd3b1e1bc3e2895b774f5e2e81f1d4340782a9fc56", + "data/minecraft/worldgen/noise/spaghetti_2d_elevation.json": "7f137a0382721b8c7b3227e65dc32a3f6d9c3d5893458b03e892797ae31d85d7", + "data/minecraft/worldgen/noise/spaghetti_2d_modulator.json": "d210211c0c76c53f15908f0b004a7e98e9d753ed996cd5468f2068f2e23932d1", + "data/minecraft/worldgen/noise/spaghetti_2d_thickness.json": "d210211c0c76c53f15908f0b004a7e98e9d753ed996cd5468f2068f2e23932d1", + "data/minecraft/worldgen/noise/spaghetti_3d_1.json": "e755b926628bc49edf48a3bd3b1e1bc3e2895b774f5e2e81f1d4340782a9fc56", + "data/minecraft/worldgen/noise/spaghetti_3d_2.json": "e755b926628bc49edf48a3bd3b1e1bc3e2895b774f5e2e81f1d4340782a9fc56", + "data/minecraft/worldgen/noise/spaghetti_3d_rarity.json": "d210211c0c76c53f15908f0b004a7e98e9d753ed996cd5468f2068f2e23932d1", + "data/minecraft/worldgen/noise/spaghetti_3d_thickness.json": "7f137a0382721b8c7b3227e65dc32a3f6d9c3d5893458b03e892797ae31d85d7", + "data/minecraft/worldgen/noise/spaghetti_roughness.json": "6afc3f09b6616f799d739b5b114c4436059dcc60308af55fe96a8594de815214", + "data/minecraft/worldgen/noise/spaghetti_roughness_modulator.json": "7f137a0382721b8c7b3227e65dc32a3f6d9c3d5893458b03e892797ae31d85d7", + "data/minecraft/worldgen/noise/sulfur_cave_gradient.json": "4900ffd885ce33b220a673ba0a248504c78f9f2cdfce824106a237d9ad18a6a7", + "data/minecraft/worldgen/noise/surface.json": "79365a5c2017e93878d989a176520ba9cbdf8685cff8b3cb148730d949d98b09", + "data/minecraft/worldgen/noise/surface_secondary.json": "ae23cb210db7b64b66b327dbbf1e7b2acb5c15cb6fe5df0455eb29910d9312eb", + "data/minecraft/worldgen/noise/surface_swamp.json": "19e08e0d1dff257cf748d3cef79e939e8f25cc5e7226653c789008171f40695b", + "data/minecraft/worldgen/noise/temperature.json": "9b1d5a87d575abf2891882ec3e1544b964cd15fedc84ad14d2abbd3b48ee2e4b", + "data/minecraft/worldgen/noise/temperature_large.json": "4fe64b952b751eb7e45b4d1e274add508b504ee8bbc54cad417ce3a3b068d42e", + "data/minecraft/worldgen/noise/vegetation.json": "ff4c10776eb2822f9f66dec4e9878a1bc797aca711480bf8430f851ff9af77dc", + "data/minecraft/worldgen/noise/vegetation_large.json": "20f4a255e3f9452f4cf983b3efed71ead184d04f4070283f355ad4d97993d133" + }, + "density_resources_sha256": { + "data/minecraft/worldgen/density_function/end/base_3d_noise.json": "38db7d590abc3144e3357a79562d649d9880bc2c62ddc99480d93f4b6401c9a6", + "data/minecraft/worldgen/density_function/end/islands.json": "6e4f02929580ecc34bfb059855b4e88d080dc7ca6c9984f216bdaa32e6b47700", + "data/minecraft/worldgen/density_function/end/sloped_cheese.json": "5dee072865321e57e5e231e60a57bfcd1919454f93da33b3c1651b3712f2cfb2", + "data/minecraft/worldgen/density_function/nether/base_3d_noise.json": "76cfd16e6fc2b1ce8bdb5f5ee277d431c167bc01afc2462bffff09eb5f0bd582", + "data/minecraft/worldgen/density_function/overworld/base_3d_noise.json": "2791a1e6c5c730eac1bd35aaea9a7ab22855872fdb92349192d045330fd4614f", + "data/minecraft/worldgen/density_function/overworld/caves/entrances.json": "63a1b8351e6dea212501c36f515f32e5a0e960228b5b5ccf0dc5b43855cbc1ab", + "data/minecraft/worldgen/density_function/overworld/caves/noodle.json": "3bce7453470fd37e3bfc11dc8584494aab094f9fd820038dc5592cb47e825a69", + "data/minecraft/worldgen/density_function/overworld/caves/pillars.json": "069d35fbdaed7d74521fc3e9355a94e778450b52a05f1efbd470ce3917b8a207", + "data/minecraft/worldgen/density_function/overworld/caves/spaghetti_2d.json": "a99c68ac415596788c84e93e81c96c9786e31db21a81157459a13272cda4cb1f", + "data/minecraft/worldgen/density_function/overworld/caves/spaghetti_2d_thickness_modulator.json": "4f987a0b9e8c0adb02df47034fa8b3cebfbfb2c8e607123614ef009a16bfaf6c", + "data/minecraft/worldgen/density_function/overworld/caves/spaghetti_roughness_function.json": "03bd1b405e53aeb75b6a3440d97975c25b6f11c7fc07149471b86c80fbdb6ea4", + "data/minecraft/worldgen/density_function/overworld/chunk_surface_level.json": "93a4e26ce4a1144c42040f52ca375f0dec94648c70ccdcc52db4a7f55ca526a5", + "data/minecraft/worldgen/density_function/overworld/continents.json": "0f2ff487c0556391ae2d56b7cab6990d45766ade2503236fe2669f83a64517be", + "data/minecraft/worldgen/density_function/overworld/depth.json": "9fcd7c8badcae4dc8e86303b0f72b05b5fd998d5bb7ac637729dd7e688688069", + "data/minecraft/worldgen/density_function/overworld/erosion.json": "8173a3df61a3c5cfe352fb4a8fa64e99840836e42f2f4b0ddf8035f4d28f97a5", + "data/minecraft/worldgen/density_function/overworld/factor.json": "f7cd1629f1a034504bd74fd38af5ea75a59257c565b5d919a6212e2e08778e30", + "data/minecraft/worldgen/density_function/overworld/final_density.json": "a7e6b9f4618e27cb08ec37a294d8ca2a96747128a8d65d788dc418fda372cfb1", + "data/minecraft/worldgen/density_function/overworld/jaggedness.json": "5e8acc680409ae0b56596be02954eb5b49a72069d004e5dcf9a92c5e106ccdb2", + "data/minecraft/worldgen/density_function/overworld/offset.json": "da6b4e686d8eb16c19443a1126168b6f2719712c02b690b9d7384ce53badf995", + "data/minecraft/worldgen/density_function/overworld/ore_vein/copper_density.json": "3b16d3a4499981f40bfd2b33786a99046bbca0c958f8f41692ffcbf44ae927d7", + "data/minecraft/worldgen/density_function/overworld/ore_vein/gap.json": "89ccfa58c6b8ae3e3954d2ff2dbcc42a8a3ae24a7b07437dbfb85fdced55945a", + "data/minecraft/worldgen/density_function/overworld/ore_vein/iron_density.json": "8de70a31c97e2a8299679770d53c8e366ace1aa8585e8d840375d25f85b72f8f", + "data/minecraft/worldgen/density_function/overworld/ore_vein/mask.json": "7f92df0b19e7d29fef01abc7025fea2bdae7a57453e186785cde2fc7d08aa5bc", + "data/minecraft/worldgen/density_function/overworld/ore_vein/richness.json": "3eb0183e295a5f9c54aab936b706b4b9d570ddf56c983ae89b91151e6e38fb9d", + "data/minecraft/worldgen/density_function/overworld/ore_vein/toggle.json": "49b9db48740578911d0f8a2de40f02eced3ae742f03ebb05fee381af579cc9ed", + "data/minecraft/worldgen/density_function/overworld/preliminary_surface_level.json": "4b6ce4c38ede0bec7485d4c029b9fcc7ceb5b26977c2c391a650fe8f3a3272b6", + "data/minecraft/worldgen/density_function/overworld/ridges.json": "bf66a03bd8474d09dad4da23f4b7e76816b83e23df9f53d9c0b7c529c25ed9c1", + "data/minecraft/worldgen/density_function/overworld/ridges_folded.json": "c8a4343b56273a476648a84fbbe07d8c473c1dd3769749260db6340ba5b37f9a", + "data/minecraft/worldgen/density_function/overworld/sloped_cheese.json": "5e2e7756881a4f2acf2e8c8dc826a04681939ff1dc7508ce868e865e92a069d7", + "data/minecraft/worldgen/density_function/overworld/temperature.json": "3c2f498cbf4636cd1fa7f555c14220a733c9d07fb5a1563f11c6144a27f31ce8", + "data/minecraft/worldgen/density_function/overworld/vegetation.json": "c902ef045f63a568ef4c3d834716c67b5835f0994997ee45756837de111a806c", + "data/minecraft/worldgen/density_function/overworld_amplified/chunk_surface_level.json": "378eef8542e7ee3adffeaf746e0c776d1e00ff75cf030d9244292acd796739f6", + "data/minecraft/worldgen/density_function/overworld_amplified/depth.json": "35bbe18bc8eaec3bc8d81f1b3130018874d6cc8fa516c1e8380bdb8caf68c803", + "data/minecraft/worldgen/density_function/overworld_amplified/factor.json": "b42bc13d4d3c1cbeb7c6dfa2e16f4ef532ad0cff3a92d20bace01711fee6edd4", + "data/minecraft/worldgen/density_function/overworld_amplified/final_density.json": "cde96d8a5efa63cd20cea615dd1172e5e6f2626e9275d359fa2864e77083ac4f", + "data/minecraft/worldgen/density_function/overworld_amplified/jaggedness.json": "9f9a8993ce50cd2f0736ef98c3f8ff55db02d47b2a3e4f6aacae7c45a3c95bcc", + "data/minecraft/worldgen/density_function/overworld_amplified/offset.json": "0bb9ae6088ea4dbfdf79f6f2b2eed789c68e9a4e919a31bf912f91ddeda28e8b", + "data/minecraft/worldgen/density_function/overworld_amplified/preliminary_surface_level.json": "e8a82a9dfe183f4e624ea7a268efa2c54376caf99139596a26ad1dd27e887e5f", + "data/minecraft/worldgen/density_function/overworld_amplified/sloped_cheese.json": "d8609154b76d0eefcfbc3746fa84f32cb04c5817a2fd1b80e72ee0ae9d88e96c", + "data/minecraft/worldgen/density_function/overworld_large_biomes/chunk_surface_level.json": "72f29b5fa9c01afa296d3679e6be662ee1b0bfdc1ba40cc2092ea74380be5c47", + "data/minecraft/worldgen/density_function/overworld_large_biomes/continents.json": "cfab013269cff17cfdf95497f87e70591378e7a39da44a241199fb64b304d411", + "data/minecraft/worldgen/density_function/overworld_large_biomes/depth.json": "9ec8ced85b58494f5400d4a5f6a27f1d4d44271d7a87adb8c5d842319eb5997f", + "data/minecraft/worldgen/density_function/overworld_large_biomes/erosion.json": "773d626db8e356d92a321270895ce085287d2befcb4504842371c38fd10102ac", + "data/minecraft/worldgen/density_function/overworld_large_biomes/factor.json": "0e7aa57eca20ebd6d2f089a9a4a34502efe902295812650f71b2ff087bb8b15f", + "data/minecraft/worldgen/density_function/overworld_large_biomes/final_density.json": "6f644644293c5489c499dc57663f2c12de60fc720bc4f1120efd343246eb159e", + "data/minecraft/worldgen/density_function/overworld_large_biomes/jaggedness.json": "30090703d4d9e493d40d60e06ee12f1310a608e20b73aeb8f86efa8e31b11453", + "data/minecraft/worldgen/density_function/overworld_large_biomes/offset.json": "75517306420732023e2dfeeb253439d8f0edcde9bb8b10ee7870d1bdb072ec22", + "data/minecraft/worldgen/density_function/overworld_large_biomes/preliminary_surface_level.json": "ece7767faac91980f5349ddfdc6040dc4ebbfce71a9f4d5842fa1b7bb169db3b", + "data/minecraft/worldgen/density_function/overworld_large_biomes/sloped_cheese.json": "347e160b5f951137b5f82a39c18572f8851c5a22484d11f31d1f90f5e5f6ac99", + "data/minecraft/worldgen/density_function/overworld_large_biomes/temperature.json": "051138f2c2f0ca4050b92f7320ddea461dca2038a49eb6f9931ecbf39129f4ef", + "data/minecraft/worldgen/density_function/overworld_large_biomes/vegetation.json": "187b08814a3831cd0ff2f405c6683e7213a79dc7eeec44cd46136e350b0718b7", + "data/minecraft/worldgen/density_function/shift_x.json": "0db6e5f781089feede9d8d2936d7564024752e34006b8bc9f2a138749f91e3e7", + "data/minecraft/worldgen/density_function/shift_z.json": "0b561cdfafa9e82f431a8051576eb2ddc386d01459df571d7040021b0debb762", + "data/minecraft/worldgen/density_function/y.json": "e7766e59792605f5c3d8e05ff6263db1dc6c91343c736b3ab7a58ddee9771282", + "data/minecraft/worldgen/density_function/zero.json": "8aed642bf5118b9d3c859bd4be35ecac75b6e873cce34e7b6f554b06f75550d7" + }, + "noise_settings_resources_sha256": { + "data/minecraft/worldgen/noise_settings/amplified.json": "07fbadd0fd71e16e5497c575d3c86d997166087ccfaaba70a589a440b915024e", + "data/minecraft/worldgen/noise_settings/caves.json": "29a378b845f7bff27a8badecba7ecf2bb22d0d4224b751ab6d91677c83bc6a6a", + "data/minecraft/worldgen/noise_settings/end.json": "d0fd92ddd39081f1779ce5482041a837fb4a03841ea4d843556f17b557e31f4b", + "data/minecraft/worldgen/noise_settings/floating_islands.json": "54923e55bfad4274bea513eccb42e1eb3625fb47ae00905537e0d3d68f82045d", + "data/minecraft/worldgen/noise_settings/large_biomes.json": "dcb29a9e3fb630f2b76a52d759c6925b40e67cd13bc7f9ae93976f0633cc2c05", + "data/minecraft/worldgen/noise_settings/nether.json": "e6d7856fe4523e4c3fa4dce756b6b1e211bfc263c5e417fb6294d032b8f53e9b", + "data/minecraft/worldgen/noise_settings/overworld.json": "d093895d50edd79d53555b33b62d767115399764e32a4f9ae2687739f785d4b9" + }, + "inputs_sha256": "838760bf635afb0ae8925f490cef9dbdc30142bbcc67be088c2b5a65dff91937", + "rust_output_sha256": "9a006099c19f8527b739ea906bfe3c7db54e7517910562e16a78482ed0f9b4fb", + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaWorldgenOracle.java": "f81e5e2c3cbdc47ecbc14333f43c10487aa67e1a4166cf96c7c6cb11d8dbd27c", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeExport.java": "f9a773713cf21b69bfa10018b76f27b953bda140ede9934f43d3aa3091101cf5", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaTagExport.java": "83b3ae46e8d052eda3f65c044ae742651366138c7014b91464824c79dae24b41", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "3968e2a337a6a23226c485057c79359e66df16683f00fb4ebc9fabb03910a015", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-core/tests/density_world_fields.rs": "e193e45080817ef92547828a8d106482a376b9f788e39d4d3831f44e9d693148", + "crates/horizon-world/examples/collision_fixture.rs": "ee754b5b42e0a51fe0a305b3f4bb56522ff3fffae564180aab8087b1b9e44afc", + "crates/horizon-world/examples/heightmap_fixture.rs": "eddd4c15620eebfc5bd919d3b19b0b2fd69d6fd31a19d8c512121aa297efa848", + "crates/horizon-world/examples/structure_density_fixture.rs": "780cbf5dbf1f948e2d8aac54eff67a900de652fe31eb007f55dd33177f38fdab", + "crates/horizon-world/examples/terrain_fixture.rs": "eb521404a3e850be522f3bda2f7c724c7d1b66e154e1bc53121b4e7511e5b1bd", + "crates/horizon-world/examples/tick_fixture.rs": "df267c307e0491a238b2d93edf0384514f38f8ee3252e315b989de56c6e17990", + "crates/horizon-world/examples/world_fixture.rs": "a3c4c0f5131ae051b24662eff0ed11ed797c6fd5069fbfdf819f0e3fcdfb2cf4", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry.rs": "f46065659e60eb5e84ad69b9f3b5e94dc87ee19de16408817e26f23d16b6c7e7", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "7516e20a20479d1c4a9734d7d8e9826740b324869d7afe51eab94bb1bc7c97ae", + "crates/horizon-world/src/worldgen/terrain.rs": "134cf93b53a40fb1ed0e0170c90316c80e270773b2968c63dc3f9cef2c941bff", + "crates/horizon-world/src/worldgen.rs": "b89dd4a9de02caf6bce457304a105ffbc0f0f220f8647c095852a45a1bf292bb", + "crates/horizon-world/tests/biome_data.rs": "d4de462ccc3e6ad5760490330e0f0cd8a45734077708a2eca95ca06e65f779b0", + "crates/horizon-world/tests/collision_data.rs": "45f3d33b36efe720e99ebf75b9f4fbddd777cebea4618bba245ca106b3443391", + "crates/horizon-world/tests/tick_data.rs": "ab345209367db6963b987797992c4a06433bd2039e6021bd834f6305324c04d7", + "crates/horizon-world/tests/world_io.rs": "4a42630c99ce89b27cc2be1a1b961ad880f62762ab661f9e92ef9bcf7f3e76e0", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e" + }, + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "9a006099c19f8527b739ea906bfe3c7db54e7517910562e16a78482ed0f9b4fb", + "matched_output_lines": 961693, + "biome_export_sha256": "b03e2fbe85c191a22f333bc989bd2a73c66f0f9fbcd9ddb54774f17c247832e9", + "block_export_sha256": "2e1b3c1c168bd1b54665df724791923f703db859bf62cf8ac1d083a8da9b3ec9" + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "9a006099c19f8527b739ea906bfe3c7db54e7517910562e16a78482ed0f9b4fb", + "matched_output_lines": 961693, + "biome_export_sha256": "b03e2fbe85c191a22f333bc989bd2a73c66f0f9fbcd9ddb54774f17c247832e9", + "block_export_sha256": "2e1b3c1c168bd1b54665df724791923f703db859bf62cf8ac1d083a8da9b3ec9" + } + ], + "scope": "Direct normal-noise JSON decoding using the actual pinned vanilla CODEC. Every bundled noise registry resource, explicit/default parameters, empty and full amplitude modifiers, normalization modes, inclusive field bounds with signed-zero comparator ordering, malformed types, null fields, duplicate and ignored keys, decimal/exponent integer truncation and wrapping, signed zero, seeded modern/legacy and Nether construction, octave metadata, range and normalization bits, scalar noise values and parent random state. JSON resource contents stay private. Strict JSON parsing; no claim for Gson's permissive non-JSON syntax. Bundled density registries are also decoded with actual vanilla registry-aware CODECs: named forward references, all bundled function kinds, declared range/axes, raw compilation errors, seeded optimized roots, cache allocation, scalar values, strided bulk values, repeated cache hits and surface-volume errors are compared using RandomState's actual compile context. All seven bundled noise-setting resources contribute their actual eight-field NoiseRouter.CODEC objects to RandomState. Router fields are compiled in declaration order with a shared compiler/context; cache allocation, raw/optimized scalar and repeated strided volume values, successful single-layer surface volumes and invalid surface-volume shapes are compared. Actual RandomState climate sampler binding and quart-to-block coordinate wrapping are checked at ordinary and extreme positions. Float-to-long climate quantization and long-to-float conversion include subnormals, signed zeros, NaNs, infinities, cast saturation and seeded random bit patterns. Actual vanilla Climate.Parameter and ParameterPoint JSON codecs compare scalar, two-element list and min/max object intervals, float endpoint bounds/ordering, required coordinate/offset fields, negative zero, precision-sensitive float parsing, malformed types and duplicate keys. Climate parameter distances, wrapping squared fitness, stable search-tree leaf order and nearest lookup are compared across every supported branching value 2..32, sizes around branch powers, the 65536-entry API bound, duplicates, warm ties, fresh lookups, brute-force lookup and extreme signed-long endpoints/targets. The Rust tree is immutable with per-worker search state instead of hidden thread locals; invalid or degenerate searches return typed errors. Inline arbitrary distance metrics and behavior outside the bounded API are not covered. Built-in Overworld and Nether quantized biome parameter tables are exported independently by each authenticated JAR and required to agree before Rust consumes them. The Rust multi-noise resolver and actual vanilla MultiNoiseBiomeSource compare biome identities through scalar climate queries and prepared bulk quart volumes, including forward/reverse/repeated query order, wrapped extreme origins and shared previous-result state. Biome holder keys in the reference are registration placeholders; no biome property or gameplay behavior is evaluated. The Rust loader reads a Horizon quantized table format, not the vanilla biome codec, and the preset builders themselves have not been ported. Source and private fixture mutations during validation invalidate the report. The two-field 26.3 NoiseSettings codec, create helper and LevelHeightAccessor clamping are also compared across bundled noise members, dimension/alignment bounds, zero/negative runtime heights, disjoint ranges, wrapped integer arithmetic and decimal/exponent integer conversion. Global fluid cutoff selection and the actual disabled Aquifer implementation are compared with original default block-state identities, extreme sea levels/coordinates, signed-zero/subnormal/nonfinite density and counted picker calls; developer fluid-disable behavior is outside the regular-mode corpus. The actual noise-based Aquifer.Config codec and runtime are compared across bundled aquifer settings, modern/legacy world-seeded aquifer factories, synthetic density roots, nondefault water/lava states, cave/void air, nonfinite sampler overrides, strided volume extents, wrapped coordinates, repeated and reversed queries, counted picker calls, sampler call order/values, injected failures and retry state, scheduling flags, populated location/status caches and sorted surface-cache entries. Oversized or wrapped-invalid grid allocations and developer fluid-disable behavior are outside the bounded regular-mode API. Terrain filling is not yet validated. Router, vertical noise and optional aquifer members are decoded from each noise-setting resource; complete NoiseGeneratorSettings, material rules, nonempty world fields, biome registry/codecs and complete chunk biome assignment, generated chunks, gameplay and rendering remain pending. TagEntry and TagFile codecs, ordered resource-stack replacement, first-occurrence member deduplication, required/optional dependency cycle pruning, lookup order and flags, missing-reference partial results and all bundled block tag members are also compared with actual vanilla TagLoader. Block identifier tables are exported independently by authenticated client/server JARs and required to agree. The bounded tag API supports at most 8192 tags, dependency depth 256 and Java hash buckets without tree nodes; hash-tree ordering and pathological self-cycle failures remain pending. No heightmap or complete terrain integration follows from tag resolution. Inline noise holders and general codec behavior beyond the covered fixtures remain pending." +} diff --git a/benchmarks/rust-worldgen-random-2026-10-06/scoped-parity.json b/benchmarks/rust-worldgen-random-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..f0c80d9d4 --- /dev/null +++ b/benchmarks/rust-worldgen-random-2026-10-06/scoped-parity.json @@ -0,0 +1,162 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 300, + "random_modes": 2, + "wrapper_depths": [ + 1, + 2, + 3 + ], + "operations": 119100, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaWorldgenRandomOracle.java": "25e4a0c0403d1261038aa525e04e53c0484f4e5ada6c6a32f951bf6af5b057c8", + "tools/test_worldgen_random_parity.py": "be09554796751cfd2c872676f36ebb4a71def368049a7ab413ca478defdc63a3", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "32b937832b7058d86e8557a2012df32be1c97be324f15d0ae85245c45c73b314", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_feature.rs": "c215156f2ecf7faf214b3d89e0829b65d54f4ff6d134d778ec941f18a606a327", + "crates/horizon-world/src/worldgen/block_predicate.rs": "dd8cbda2ec110444950f0b31bf4e088897eab0994674a91568c7b063f8f16210", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "486fe9d8588eb09e0ee5707a0541b0df167b63b0b56c90a2709bfa09a0a3ad19", + "crates/horizon-world/src/worldgen/feature_graph.rs": "2297b194514925688dba25016a69d5ba5eb8b869bdfff28f2e611a6742ac5954", + "crates/horizon-world/src/worldgen/feature_region.rs": "4a95a30c0987d97e671f84380e13ddea070ad81f996baa65b2a06c4d892971c7", + "crates/horizon-world/src/worldgen/feature_sort.rs": "0b9d1e1c15d8449125d39e400776b8f28eec7b7cbd047660a94f8cb90160adfe", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "1b976aa4dd2516468196d0af3451e3fdd037493a14d269f54ebdd7254055e05e", + "crates/horizon-world/src/worldgen/placement/context.rs": "b36dfd9297896e62770f2085cf934fc08ebd4c030ecc7ae17d864e819a113201", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "68ecf36954fea5705436d486e9be93836933fd56779022afeb881a0399d6a674", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/value_provider.rs": "ad1c0efffcc201839e3471d7dfa06c39307d8cbabddb4c5aed8389ee7b68737a", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "55c4317bd9c782378de7c2a7d58be5aa08febc5b8f2f4b86379a39e0ba500b3c", + "crates/horizon-world/examples/worldgen_random_fixture.rs": "9b1d7c9035245edd112b6ea93f49cefb9ae1a64d34ff75a16d66598d6b152664" + }, + "fixtures_sha256": { + ".local/rust-worldgen-random-parity/inputs.txt": "a2315c27a8afa09528edc6d1c71c3f429b395b2cdad648ee76f13029b367870d" + }, + "rust_output_sha256": "87634cb2d11a28031ef8b2ed0dc7c8afafad5dc1dca5a53a67f57f4727e11397", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "87634cb2d11a28031ef8b2ed0dc7c8afafad5dc1dca5a53a67f57f4727e11397", + "matched_output_lines": 238800 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "87634cb2d11a28031ef8b2ed0dc7c8afafad5dc1dca5a53a67f57f4727e11397", + "matched_output_lines": 238800 + } + ], + "scope": "Actual WorldgenRandom bit sampling over legacy and xoroshiro sources, nested wrappers, signed bit-width shifts, draw counters, valid/invalid bounds, reseeding, fork and positional-factory delegation. Decoration, per-feature, large-feature, salt and slime-chunk seeds exercise signed int/long overflow, extreme coordinates and inherited legacy multi-draw behavior. Gaussian samples, concurrent access and full chunk decoration remain pending." +} diff --git a/crates/horizon-core/Cargo.toml b/crates/horizon-core/Cargo.toml new file mode 100644 index 000000000..65b2acc65 --- /dev/null +++ b/crates/horizon-core/Cargo.toml @@ -0,0 +1,31 @@ +[package] +name = "horizon-core" +version = "0.1.0" +edition.workspace = true +license.workspace = true +rust-version.workspace = true +description = "Horizon simulation foundations for the pinned vanilla Java Edition target" + +[[bin]] +name = "horizon-parity" +path = "src/bin/parity.rs" + +[[bin]] +name = "horizon-tick-parity" +path = "src/bin/tick_parity.rs" + +[[bin]] +name = "horizon-geometry-parity" +path = "src/bin/geometry_parity.rs" + +[[bin]] +name = "horizon-noise-parity" +path = "src/bin/noise_parity.rs" + +[[bin]] +name = "horizon-density-parity" +path = "src/bin/density_parity.rs" + +[[bin]] +name = "horizon-float-log-parity" +path = "src/bin/float_log_parity.rs" diff --git a/crates/horizon-core/examples/biome_zoom_fixture.rs b/crates/horizon-core/examples/biome_zoom_fixture.rs new file mode 100644 index 000000000..4099bed13 --- /dev/null +++ b/crates/horizon-core/examples/biome_zoom_fixture.rs @@ -0,0 +1,46 @@ +//! Text transport for native BiomeManager comparisons. +use horizon_core::{ + biome::{BiomeZoom, noise_quart_at_block, noise_quart_at_position, obfuscate_seed}, + position::BlockPos, +}; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let mut values = line.split_whitespace(); + match values.next().unwrap() { + "s" => writeln!(out, "s {}", obfuscate_seed(values.next().unwrap().parse()?))?, + "b" => { + let seed: i64 = values.next().unwrap().parse()?; + let xyz: Vec = values.map(str::parse).collect::>()?; + let pos = BlockPos::new(xyz[0], xyz[1], xyz[2]); + let zoom = BiomeZoom::new(seed); + write!(out, "b")?; + for value in zoom + .quart_at_block(pos) + .into_iter() + .chain(noise_quart_at_block(pos)) + .chain(zoom.quart_at_block(pos)) + { + write!(out, " {value}")?; + } + writeln!(out)?; + } + "p" => { + let bits: Vec<_> = values + .map(|v| u64::from_str_radix(v, 16).map(f64::from_bits)) + .collect::>()?; + let xyz = noise_quart_at_position(bits.try_into().unwrap()); + writeln!(out, "p {} {} {}", xyz[0], xyz[1], xyz[2])?; + } + _ => panic!("unknown fixture operation"), + } + } + Ok(()) +} diff --git a/crates/horizon-core/src/bin/density_parity.rs b/crates/horizon-core/src/bin/density_parity.rs new file mode 100644 index 000000000..07bdf6537 --- /dev/null +++ b/crates/horizon-core/src/bin/density_parity.rs @@ -0,0 +1,1103 @@ +//! Original line transport for differential tests of density evaluation. +use horizon_core::density::graph::{ + DensityCompiler, DensityGraph, FunctionId, GraphBinary, GraphNode, GraphUnary, NoiseId, +}; +use horizon_core::{ + density::{ + BinaryOp, BinarySampler, BlendDensitySampler, BlendedNoise, CachingDensitySampler, + ConstantSampler, ContextBoundSampler, CubicSpline, DensitySampler, DensityValue, + DistanceMetric, DistanceToPointSampler, EmptyBlender, FindTopSurfaceSampler, + GradientSampler, InterpolatedSampler, Interval, IntervalError, IntervalSelectSampler, + LerpSampler, NoiseSampler, PowerSampler, RangeChoiceSampler, RoundMode, RoundSampler, + SamplerContext, ShiftNoiseKind, ShiftedNoiseSampler, SliceAxes, SliceSampler, SplinePoint, + SplineSampler, TilingMode, UnaryOp, UnarySampler, WorldField, WorldFields, + compile_shift_noise, compile_surface_search, create_blended_fbm, + }, + geometry::Axis, + noise::{ + DensityVolume, Noise, NormalNoise, Normalization, PerlinNoise, SimplexNoise, + SmearedPerlinNoise, + }, + random::{LegacyRandom, RandomSource, XoroshiroRandom}, +}; +use std::{ + io::{self, BufRead, BufWriter, Write}, + sync::Arc, +}; +#[derive(Debug)] +struct CountedSampler { + input: Arc, + calls: Arc<[std::sync::atomic::AtomicUsize; 2]>, +} +impl DensitySampler for CountedSampler { + fn sample_value( + &self, + context: &mut SamplerContext, + position: [i32; 3], + ) -> Result { + self.calls[0].fetch_add(1, std::sync::atomic::Ordering::Relaxed); + self.input.sample_value(context, position) + } + fn sample_volume( + &self, + context: &mut SamplerContext, + buffer: &mut [f32], + volume: DensityVolume, + ) -> Result<(), horizon_core::density::SampleError> { + self.calls[1].fetch_add(1, std::sync::atomic::Ordering::Relaxed); + self.input.sample_volume(context, buffer, volume) + } +} +fn read( + args: &mut std::str::SplitWhitespace<'_>, +) -> Result> { + args.next() + .ok_or("missing argument")? + .parse() + .map_err(|_| "invalid argument".into()) +} +fn float(args: &mut std::str::SplitWhitespace<'_>) -> Result> { + Ok(f32::from_bits(u32::from_str_radix( + args.next().ok_or("missing float")?, + 16, + )?)) +} +fn double(args: &mut std::str::SplitWhitespace<'_>) -> Result> { + Ok(f64::from_bits(u64::from_str_radix( + args.next().ok_or("missing double")?, + 16, + )?)) +} +fn bits(v: f32) -> u32 { + if v.is_nan() { 0x7fc0_0000 } else { v.to_bits() } +} +fn noise(kind: &str, mut random: impl RandomSource, scale: f64) -> Arc { + match kind { + "normal" => { + let mut definition = NormalNoise::builder(); + definition.set_base_octave(-7); + definition.set_octave_count(4).unwrap(); + Arc::new(definition.build().unwrap().create(&mut random).unwrap()) + } + "perlin" => Arc::new(PerlinNoise::new(&mut random)), + "simplex" => Arc::new(SimplexNoise::new(&mut random)), + "smeared" => Arc::new(SmearedPerlinNoise::new(&mut random, scale)), + _ => panic!("unknown noise kind"), + } +} +fn interval_output( + out: &mut impl Write, + name: &str, + result: Result, +) -> io::Result<()> { + match result { + Ok(range) => writeln!( + out, + "bounds {name} {} {} {} {}", + bits(range.min()), + bits(range.max()), + u8::from(range.is_nai()), + range.java_hash_code() + ), + Err(_) => writeln!(out, "bounds {name} error"), + } +} +fn blended_probe( + random: &mut impl RandomSource, + definition: BlendedNoise, + out: &mut impl Write, +) -> Result>, Box> { + interval_output(out, "blended", definition.range())?; + let result = definition.compile(random); + writeln!( + out, + "blended {} {}", + if result.is_ok() { "ok" } else { "error" }, + random.next_long() + )?; + Ok(result + .ok() + .map(|value| Arc::new(value) as Arc)) +} +fn fbm_probe( + random: &mut impl RandomSource, + octave: i32, + smear: f64, + amplitude: f64, + out: &mut impl Write, +) -> Result<(), Box> { + let result = create_blended_fbm(random, octave, smear, amplitude); + match result { + Ok(stack) => { + let range = stack.range()?; + writeln!( + out, + "fbm {} {} {}", + stack.layers().len(), + bits(range[0]), + bits(range[1]) + )?; + for layer in stack.layers() { + writeln!( + out, + "fbm-layer {} {} {}", + layer.frequency.to_bits(), + bits(layer.amplitude), + bits(layer.noise.get3(-17.25, 64.125, 32.5)) + )?; + } + for point in [ + [0.0; 3], + [-17.25, 64.125, 32.5], + [3e7, -64.0, -3e7], + [f64::INFINITY; 3], + ] { + writeln!( + out, + "fbm-query {} {}", + bits(stack.get2(point[0], point[2])), + bits(stack.get3(point[0], point[1], point[2])) + )?; + } + let volume = DensityVolume::new([2, 5, 2], [-17, -64, 32], [4, 1, 4])?; + let mut buffer = vec![0.0; volume.size() + 2]; + for (i, v) in buffer.iter_mut().enumerate() { + *v = (i as f32 - 10.0) * 0.125; + } + stack.add_to_volume(&mut buffer, volume, 0.125, 0.25, -0.5)?; + for value in buffer { + writeln!(out, "fbm-cell {}", bits(value))?; + } + } + Err(_) => writeln!(out, "fbm error")?, + } + writeln!(out, "fbm-parent {}", random.next_long())?; + Ok(()) +} +fn main() -> Result<(), Box> { + let mut samplers: Vec> = Vec::new(); + let mut graph_compiler = DensityCompiler::new(DensityGraph::new()); + let mut functions: Vec = Vec::new(); + let mut graph_splines: Vec> = Vec::new(); + let mut graph_noises: Vec = Vec::new(); + let mut noises = Vec::new(); + let mut splines: Vec = Vec::new(); + let mut counters: Vec> = Vec::new(); + let mut context = SamplerContext::default(); + let mut out = BufWriter::new(io::stdout().lock()); + for line in io::stdin().lock().lines() { + let line = line?; + let mut args = line.split_whitespace(); + match args.next().ok_or("empty command")? { + "constant" => { + samplers.push(Arc::new(ConstantSampler(float(&mut args)?))); + writeln!(out, "create {}", samplers.len() - 1)?; + } + "gradient" => { + let axis = Axis::ALL[read::(&mut args)?]; + let tiling = [ + TilingMode::ClampToEdge, + TilingMode::Repeat, + TilingMode::MirroredRepeat, + ][read::(&mut args)?]; + let from = read(&mut args)?; + let to = read(&mut args)?; + let low = float(&mut args)?; + let high = float(&mut args)?; + samplers.push(Arc::new(GradientSampler::new( + axis, tiling, from, to, low, high, + ))); + writeln!(out, "create {}", samplers.len() - 1)?; + } + "noise" => { + let kind = args.next().ok_or("missing noise kind")?; + let stream = args.next().ok_or("missing stream")?; + let seed = read(&mut args)?; + let scale = double(&mut args)?; + let source = if stream == "legacy" { + noise(kind, LegacyRandom::new(seed), scale) + } else { + noise(kind, XoroshiroRandom::new(seed), scale) + }; + let sampler = NoiseSampler { + noise: source, + xz_scale: double(&mut args)?, + y_scale: double(&mut args)?, + }; + noises.push(sampler.clone()); + samplers.push(Arc::new(sampler)); + writeln!(out, "noise {} {}", noises.len() - 1, samplers.len() - 1)?; + } + "shift" => { + let source = noises[read::(&mut args)?].clone(); + let x = read::(&mut args)?; + let y = read::(&mut args)?; + let z = read::(&mut args)?; + samplers.push(Arc::new(ShiftedNoiseSampler { + source, + shift_x: samplers[x].clone(), + shift_y: if y < 0 { + None + } else { + Some(samplers[y as usize].clone()) + }, + shift_z: samplers[z].clone(), + })); + writeln!(out, "create {}", samplers.len() - 1)?; + } + "unary" => { + let kind = args.next().ok_or("missing unary kind")?; + let input = samplers[read::(&mut args)?].clone(); + let a = float(&mut args)?; + let b = float(&mut args)?; + let operation = match kind { + "abs" => UnaryOp::Abs, + "negate" => UnaryOp::Negate, + "square" => UnaryOp::Square, + "cube" => UnaryOp::Cube, + "sqrt" => UnaryOp::Sqrt, + "log" => UnaryOp::Log, + "reciprocal" => UnaryOp::Reciprocal, + "sign" => UnaryOp::Sign, + "squeeze" => UnaryOp::Squeeze, + "leaky" => UnaryOp::LeakyRelu(a), + "add" => UnaryOp::Add(a), + "sub" => UnaryOp::SubtractFrom(a), + "mul" => UnaryOp::Multiply(a), + "div" => UnaryOp::DivideInto(a), + "min" => UnaryOp::Minimum(a), + "max" => UnaryOp::Maximum(a), + "clamp" => UnaryOp::Clamp { min: a, max: b }, + _ => return Err("unknown unary kind".into()), + }; + samplers.push(Arc::new(UnarySampler { input, operation })); + writeln!(out, "create {}", samplers.len() - 1)?; + } + "power" => { + let mode = read::(&mut args)?; + let sampler: Arc = match mode { + 0 => Arc::new(PowerSampler { + base: samplers[read::(&mut args)?].clone(), + exponent: samplers[read::(&mut args)?].clone(), + }), + 1 => { + let base = double(&mut args)?; + Arc::new(UnarySampler { + input: samplers[read::(&mut args)?].clone(), + operation: UnaryOp::PowerBase(base), + }) + } + 2 => { + let base = samplers[read::(&mut args)?].clone(); + Arc::new(UnarySampler { + input: base, + operation: UnaryOp::PowerExponent(double(&mut args)?), + }) + } + _ => return Err("unknown power mode".into()), + }; + samplers.push(sampler); + writeln!(out, "create {}", samplers.len() - 1)?; + } + "round" => { + let mode = [ + RoundMode::Floor, + RoundMode::Round, + RoundMode::Ceil, + RoundMode::Truncate, + ][read::(&mut args)?]; + let input = samplers[read::(&mut args)?].clone(); + let multiple = read::(&mut args)?; + let multiple = if multiple < 0 { + None + } else { + Some(samplers[multiple as usize].clone()) + }; + samplers.push(Arc::new(RoundSampler { + mode, + input, + multiple, + })); + writeln!(out, "create {}", samplers.len() - 1)?; + } + "binary" => { + let kind = args.next().ok_or("missing binary kind")?; + let left = samplers[read::(&mut args)?].clone(); + let right = samplers[read::(&mut args)?].clone(); + let bound = float(&mut args)?; + let operation = match kind { + "add" => BinaryOp::Add, + "sub" => BinaryOp::Subtract, + "mul" => BinaryOp::Multiply, + "div" => BinaryOp::Divide, + "min" => BinaryOp::Minimum { right_min: bound }, + "max" => BinaryOp::Maximum { right_max: bound }, + _ => return Err("unknown binary kind".into()), + }; + samplers.push(Arc::new(BinarySampler { + left, + right, + operation, + })); + writeln!(out, "create {}", samplers.len() - 1)?; + } + "choice" => { + let mode = read::(&mut args)?; + let input = samplers[read::(&mut args)?].clone(); + let min_inclusive = float(&mut args)?; + let max_exclusive = float(&mut args)?; + let sampler: Arc = if mode == 1 { + let inside = float(&mut args)?; + let outside = float(&mut args)?; + Arc::new(UnarySampler { + input, + operation: UnaryOp::ConstantRangeChoice { + min_inclusive, + max_exclusive, + inside, + outside, + }, + }) + } else { + let when_in_range = samplers[read::(&mut args)?].clone(); + let when_out_of_range = samplers[read::(&mut args)?].clone(); + Arc::new(RangeChoiceSampler { + input, + min_inclusive, + max_exclusive, + when_in_range, + when_out_of_range, + }) + }; + samplers.push(sampler); + writeln!(out, "create {}", samplers.len() - 1)?; + } + "lerp" => { + let mode = read::(&mut args)?; + let alpha = samplers[read::(&mut args)?].clone(); + let first = if mode == 1 { + DensityValue::Constant(float(&mut args)?) + } else { + DensityValue::Sampler(samplers[read::(&mut args)?].clone()) + }; + let second = if mode == 2 { + DensityValue::Constant(float(&mut args)?) + } else { + DensityValue::Sampler(samplers[read::(&mut args)?].clone()) + }; + samplers.push(Arc::new(LerpSampler { + alpha, + first, + second, + })); + writeln!(out, "create {}", samplers.len() - 1)?; + } + "interval" => { + let _specialization = read::(&mut args)?; + let input = samplers[read::(&mut args)?].clone(); + let count = read::(&mut args)?; + let thresholds = (0..count) + .map(|_| float(&mut args)) + .collect::, _>>()?; + let branches = (0..=count) + .map(|_| read::(&mut args).map(|id| samplers[id].clone())) + .collect::, _>>()?; + samplers.push(Arc::new(IntervalSelectSampler::new( + input, thresholds, branches, + )?)); + writeln!(out, "create {}", samplers.len() - 1)?; + } + "bounds" => { + let mode = read::(&mut args)?; + let a = float(&mut args)?; + let b = float(&mut args)?; + let c = float(&mut args)?; + let d = float(&mut args)?; + let e = float(&mut args)?; + let f = float(&mut args)?; + let result = match mode { + 0 => Interval::new(a, b), + 1 => Interval::symmetric(a), + 2 => Interval::exact(a), + 3 => Ok(Interval::encapsulating_values(a, b)), + 4 => Ok(Interval::NAI), + 5 => Ok(Interval::INFINITE), + _ => return Err("unknown interval constructor".into()), + }; + interval_output(&mut out, "create", result)?; + if let Ok(left) = result { + let right = Interval::encapsulating_values(c, d); + let third = Interval::encapsulating_values(e, f); + interval_output(&mut out, "right", Ok(right))?; + for (name, value) in [ + ("add", left.add_range(right)), + ("sub", left.subtract_range(right)), + ("mul", left.multiply_range(right)), + ("div", left.divide_range(right)), + ("min", left.minimum(right)), + ("max", left.maximum(right)), + ("reciprocal", left.reciprocal()), + ("abs", left.abs()), + ("square", left.square()), + ("sign", left.sign()), + ("power", left.power(right)), + ] { + interval_output(&mut out, name, Ok(value))?; + } + interval_output(&mut out, "clamp", left.clamp(c, d))?; + interval_output(&mut out, "log", left.log())?; + interval_output(&mut out, "lerp-values", Ok(left.lerp_values(c, d)))?; + interval_output(&mut out, "lerp-ranges", Ok(left.lerp_ranges(right, third)))?; + interval_output(&mut out, "map-negate", left.map_monotonic(|v| -v))?; + interval_output(&mut out, "map-cube", left.map_monotonic(|v| v * v * v))?; + interval_output( + &mut out, + "map-sqrt", + left.map_monotonic(|v| (v as f64).sqrt() as f32), + )?; + interval_output(&mut out, "map-reciprocal", left.map_monotonic(|v| 1.0 / v))?; + interval_output( + &mut out, + "hull", + Interval::encapsulating(&[left, right, third]), + )?; + interval_output(&mut out, "empty", Interval::encapsulating(&[]))?; + writeln!( + out, + "bounds query {} {} {} {}", + u8::from(left.contains(e)), + u8::from(left.intersects(right)), + u8::from(left == right), + u8::from(left == result.unwrap()) + )?; + } + } + "offset" => { + let kind = [ + ShiftNoiseKind::Shift, + ShiftNoiseKind::ShiftA, + ShiftNoiseKind::ShiftB, + ][read::(&mut args)?]; + let noise = noises[read::(&mut args)?].noise.clone(); + samplers.push(compile_shift_noise(noise, kind)); + writeln!(out, "create {}", samplers.len() - 1)?; + } + "blended" | "blendfail" => { + let stream = args.next().ok_or("missing stream")?; + let seed = read(&mut args)?; + let definition = BlendedNoise { + xz_scale: double(&mut args)?, + y_scale: double(&mut args)?, + xz_factor: double(&mut args)?, + y_factor: double(&mut args)?, + smear_scale_multiplier: double(&mut args)?, + }; + let result = if stream == "legacy" { + blended_probe(&mut LegacyRandom::new(seed), definition, &mut out)? + } else { + blended_probe(&mut XoroshiroRandom::new(seed), definition, &mut out)? + }; + if let Some(sampler) = result { + samplers.push(sampler); + writeln!(out, "create {}", samplers.len() - 1)?; + } + } + "blendfbm" => { + let stream = args.next().ok_or("missing stream")?; + let seed = read(&mut args)?; + let octave = read(&mut args)?; + let smear = double(&mut args)?; + let amplitude = double(&mut args)?; + if stream == "legacy" { + fbm_probe( + &mut LegacyRandom::new(seed), + octave, + smear, + amplitude, + &mut out, + )?; + } else { + fbm_probe( + &mut XoroshiroRandom::new(seed), + octave, + smear, + amplitude, + &mut out, + )?; + } + } + "distance" => { + let metric = [ + DistanceMetric::Euclidean, + DistanceMetric::EuclideanSquared, + DistanceMetric::Manhattan, + DistanceMetric::Chebyshev, + ][read::(&mut args)?]; + let point = [read(&mut args)?, read(&mut args)?, read(&mut args)?]; + samplers.push(Arc::new(DistanceToPointSampler { point, metric })); + writeln!(out, "create {}", samplers.len() - 1)?; + } + "metric" => { + let x = float(&mut args)?; + let y = float(&mut args)?; + let z = float(&mut args)?; + for metric in [ + DistanceMetric::Euclidean, + DistanceMetric::EuclideanSquared, + DistanceMetric::Manhattan, + DistanceMetric::Chebyshev, + ] { + writeln!( + out, + "metric {} {}", + bits(metric.compute2(x, y)), + bits(metric.compute3(x, y, z)) + )?; + } + } + "wcontext" => { + let cached = read::(&mut args)? != 0; + let mut fields = WorldFields::default(); + for field in [ + WorldField::BlendAlpha, + WorldField::BlendOffset, + WorldField::Beardifier, + ] { + let binding = read::(&mut args)?; + if binding >= 0 { + fields = fields.with_field(field, samplers[binding as usize].clone()); + } + } + if read::(&mut args)? != 0 { + fields = fields.with_blender(Arc::new(EmptyBlender)); + } + context = (if cached { + SamplerContext::cached() + } else { + SamplerContext::default() + }) + .with_world_fields(fields); + writeln!(out, "context")?; + } + "wfield" => { + let field = [ + WorldField::BlendAlpha, + WorldField::BlendOffset, + WorldField::Beardifier, + ][read::(&mut args)?]; + let fallback = read::(&mut args)?; + samplers.push(Arc::new(if fallback < 0 { + ContextBoundSampler::new(field) + } else { + ContextBoundSampler::with_fallback(field, samplers[fallback as usize].clone()) + })); + writeln!(out, "create {}", samplers.len() - 1)?; + } + "blenddensity" => { + let input = samplers[read::(&mut args)?].clone(); + samplers.push(Arc::new(BlendDensitySampler { input })); + writeln!(out, "create {}", samplers.len() - 1)?; + } + "context" => { + context = if read::(&mut args)? == 0 { + SamplerContext::default() + } else { + SamplerContext::cached() + }; + writeln!(out, "context")?; + } + "counted" => { + let input = samplers[read::(&mut args)?].clone(); + let calls = Arc::new(std::array::from_fn(|_| { + std::sync::atomic::AtomicUsize::new(0) + })); + counters.push(calls.clone()); + samplers.push(Arc::new(CountedSampler { input, calls })); + writeln!(out, "counted {} {}", counters.len() - 1, samplers.len() - 1)?; + } + "counts" => { + let calls = &counters[read::(&mut args)?]; + writeln!( + out, + "counts {} {}", + calls[0].load(std::sync::atomic::Ordering::Relaxed), + calls[1].load(std::sync::atomic::Ordering::Relaxed) + )?; + } + "greset" => { + graph_compiler = DensityCompiler::new(DensityGraph::new()); + functions.clear(); + graph_splines.clear(); + graph_noises.clear(); + context = SamplerContext::default(); + writeln!(out, "graph-reset")?; + } + "gseed" => { + let seed = read::(&mut args)?; + let legacy = read::(&mut args)? != 0; + graph_compiler = DensityCompiler::new_seeded(DensityGraph::new(), seed, legacy); + functions.clear(); + graph_splines.clear(); + graph_noises.clear(); + context = SamplerContext::default(); + writeln!(out, "graph-seed")?; + } + "gready" => writeln!(out, "graph-ready")?, + "gend" => { + functions.push(graph_compiler.graph_mut().insert(GraphNode::EndIslands)?); + writeln!(out, "graph-create {}", functions.len() - 1)?; + } + "gregister" => { + let name = args.next().ok_or("missing noise identifier")?.to_owned(); + let mut builder = NormalNoise::builder(); + builder + .set_base_octave(read(&mut args)?) + .set_base_amplitude(double(&mut args)?); + builder.set_octave_count(read(&mut args)?)?; + builder.set_normalization( + [ + Normalization::Disabled, + Normalization::Enabled, + Normalization::Legacy, + ][read::(&mut args)?], + ); + let modifiers = read::(&mut args)?; + for index in 0..modifiers { + builder.set_amplitude_modifier(index as i32, double(&mut args)?)?; + } + graph_noises.push( + graph_compiler + .graph_mut() + .register_noise(name, builder.build()?)?, + ); + writeln!(out, "graph-noise {}", graph_noises.len() - 1)?; + } + "ginstance" => { + let id = graph_noises[read::(&mut args)?]; + let a = graph_compiler.get_noise_sampler(id)?; + let b = graph_compiler.get_noise_sampler(id)?; + writeln!(out, "graph-instance {}", u8::from(Arc::ptr_eq(&a, &b)))?; + } + "gbind" => { + let sampler = samplers[read::(&mut args)?].clone(); + let range = Interval::encapsulating_values(float(&mut args)?, float(&mut args)?); + let axes = read(&mut args)?; + functions.push(graph_compiler.graph_mut().bind(sampler, range, axes)?); + writeln!(out, "graph-create {}", functions.len() - 1)?; + } + "gsconstant" => { + graph_splines.push(CubicSpline::Constant(float(&mut args)?)); + writeln!(out, "graph-spline {}", graph_splines.len() - 1)?; + } + "gspoints" => { + let coordinate = functions[read::(&mut args)?]; + let count = read::(&mut args)?; + let mut points = Vec::with_capacity(count); + for _ in 0..count { + let location = float(&mut args)?; + let derivative = float(&mut args)?; + let value = graph_splines[read::(&mut args)?].clone(); + points.push(SplinePoint { + location, + derivative, + value, + }); + } + graph_splines.push(CubicSpline::multipoint(coordinate, points)?); + writeln!(out, "graph-spline {}", graph_splines.len() - 1)?; + } + "gref" => { + let input = functions[read::(&mut args)?]; + functions.push(graph_compiler.graph_mut().insert(GraphNode::Reference { + input, + holder: None, + })?); + writeln!(out, "graph-create {}", functions.len() - 1)?; + } + "gnamed" => { + let name = read::(&mut args)?; + let input = functions[read::(&mut args)?]; + functions.push(graph_compiler.graph_mut().register_function(name, input)?); + writeln!(out, "graph-create {}", functions.len() - 1)?; + } + "glookup" => { + let name = read::(&mut args)?; + functions.push( + graph_compiler + .graph() + .function(&name) + .ok_or("unknown density name")?, + ); + writeln!(out, "graph-create {}", functions.len() - 1)?; + } + "gspline" => { + let spline = graph_splines[read::(&mut args)?].clone(); + functions.push( + graph_compiler + .graph_mut() + .insert(GraphNode::Spline(spline))?, + ); + writeln!(out, "graph-create {}", functions.len() - 1)?; + } + command @ ("gconst" | "ggradient" | "gunary" | "gbinary" | "gclamp" | "gchoice" + | "glerp" | "gslice" | "gcache" | "ginterp" | "gsurface" | "ginterval" + | "gdistance" | "gnoise" | "goffset" | "gblended" | "ground" | "gpow" + | "gwfield" | "gblenddensity") => { + let reference = |args: &mut std::str::SplitWhitespace<'_>| -> Result> { Ok(functions[read::(args)?]) }; + let node = match command { + "gconst" => GraphNode::Constant(float(&mut args)?), + "gwfield" => GraphNode::WorldField( + [ + WorldField::BlendAlpha, + WorldField::BlendOffset, + WorldField::Beardifier, + ][read::(&mut args)?], + ), + "gblenddensity" => GraphNode::BlendDensity(reference(&mut args)?), + "gpow" => GraphNode::Power { + base: reference(&mut args)?, + exponent: reference(&mut args)?, + }, + "ground" => GraphNode::Round { + mode: [ + RoundMode::Floor, + RoundMode::Round, + RoundMode::Ceil, + RoundMode::Truncate, + ][read::(&mut args)?], + input: reference(&mut args)?, + multiple: reference(&mut args)?, + }, + "gnoise" => GraphNode::Noise { + noise: graph_noises[read::(&mut args)?], + xz_scale: double(&mut args)?, + y_scale: double(&mut args)?, + shift_x: reference(&mut args)?, + shift_y: reference(&mut args)?, + shift_z: reference(&mut args)?, + }, + "goffset" => GraphNode::OffsetNoise { + noise: graph_noises[read::(&mut args)?], + kind: [ + ShiftNoiseKind::Shift, + ShiftNoiseKind::ShiftA, + ShiftNoiseKind::ShiftB, + ][read::(&mut args)?], + }, + "gblended" => GraphNode::BlendedNoise(BlendedNoise { + xz_scale: double(&mut args)?, + y_scale: double(&mut args)?, + xz_factor: double(&mut args)?, + y_factor: double(&mut args)?, + smear_scale_multiplier: double(&mut args)?, + }), + "gdistance" => GraphNode::DistanceToPoint { + point: [read(&mut args)?, read(&mut args)?, read(&mut args)?], + metric: [ + DistanceMetric::Euclidean, + DistanceMetric::EuclideanSquared, + DistanceMetric::Manhattan, + DistanceMetric::Chebyshev, + ][read::(&mut args)?], + }, + "ginterval" => { + let input = reference(&mut args)?; + let count: usize = read(&mut args)?; + let thresholds = (0..count) + .map(|_| float(&mut args)) + .collect::, _>>()?; + let branches = + (0..=count) + .map(|_| reference(&mut args)) + .collect::, _>>()?; + GraphNode::IntervalSelect { + input, + thresholds: thresholds.into(), + branches, + } + } + "ggradient" => { + let axis = [Axis::X, Axis::Y, Axis::Z][read::(&mut args)?]; + let tiling = [ + TilingMode::ClampToEdge, + TilingMode::Repeat, + TilingMode::MirroredRepeat, + ][read::(&mut args)?]; + GraphNode::Gradient { + axis, + tiling, + from: read(&mut args)?, + to: read(&mut args)?, + low: float(&mut args)?, + high: float(&mut args)?, + } + } + "gunary" => { + let kind = [ + GraphUnary::Abs, + GraphUnary::Square, + GraphUnary::Cube, + GraphUnary::HalfNegative, + GraphUnary::QuarterNegative, + GraphUnary::Reciprocal, + GraphUnary::Negate, + GraphUnary::Squeeze, + GraphUnary::Sign, + GraphUnary::Log, + GraphUnary::Sqrt, + ][read::(&mut args)?]; + GraphNode::Unary { + kind, + input: reference(&mut args)?, + } + } + "gbinary" => { + let kind = [ + GraphBinary::Add, + GraphBinary::Subtract, + GraphBinary::Multiply, + GraphBinary::Divide, + GraphBinary::Minimum, + GraphBinary::Maximum, + ][read::(&mut args)?]; + GraphNode::Binary { + kind, + left: reference(&mut args)?, + right: reference(&mut args)?, + } + } + "gclamp" => GraphNode::Clamp { + input: reference(&mut args)?, + min: float(&mut args)?, + max: float(&mut args)?, + }, + "gchoice" => GraphNode::Choice { + input: reference(&mut args)?, + min: float(&mut args)?, + max: float(&mut args)?, + inside: reference(&mut args)?, + outside: reference(&mut args)?, + }, + "glerp" => GraphNode::Lerp { + alpha: reference(&mut args)?, + first: reference(&mut args)?, + second: reference(&mut args)?, + }, + "gslice" => GraphNode::Slice { + axis: [Axis::X, Axis::Y, Axis::Z][read::(&mut args)?], + coordinate: read(&mut args)?, + input: reference(&mut args)?, + }, + "gcache" => GraphNode::Cache(reference(&mut args)?), + "ginterp" => GraphNode::Interpolated { + input: reference(&mut args)?, + xz: read(&mut args)?, + y: read(&mut args)?, + }, + "gsurface" => GraphNode::Surface { + density: reference(&mut args)?, + upper: reference(&mut args)?, + lower: read(&mut args)?, + height: read(&mut args)?, + }, + _ => unreachable!(), + }; + functions.push(graph_compiler.graph_mut().insert(node)?); + writeln!(out, "graph-create {}", functions.len() - 1)?; + } + "ginfo" => { + let id = functions[read::(&mut args)?]; + let range = graph_compiler + .graph() + .range(id) + .map_err(|_| IntervalError::NanBound); + interval_output(&mut out, "graph", range)?; + writeln!( + out, + "graph-axes {}", + graph_compiler.graph().domain_axes(id)? + )?; + } + "gsame" => { + let a = functions[read::(&mut args)?]; + let b = functions[read::(&mut args)?]; + writeln!( + out, + "graph-same {}", + u8::from(graph_compiler.graph().java_equals(a, b)?) + )?; + } + command @ ("gcompile" | "gtry") => { + let mode = read::(&mut args)?; + let id = functions[read::(&mut args)?]; + let result = if mode == 0 { + graph_compiler.compile_raw(id) + } else { + graph_compiler.get_sampler(id) + }; + if command == "gtry" { + writeln!( + out, + "graph-try {} {}", + if result.is_ok() { "ok" } else { "error" }, + graph_compiler.cache_count() + )?; + } else { + let sampler = result?; + let same = if mode == 0 { + -1 + } else { + i32::from(Arc::ptr_eq(&sampler, &graph_compiler.get_sampler(id)?)) + }; + samplers.push(sampler); + writeln!( + out, + "graph-compile {} {} {}", + samplers.len() - 1, + graph_compiler.cache_count(), + same + )?; + } + } + "spconstant" => { + splines.push(CubicSpline::Constant(float(&mut args)?)); + writeln!(out, "spline {}", splines.len() - 1)?; + } + "sppoints" => { + let coordinate = read(&mut args)?; + let count = read::(&mut args)?; + let mut points = Vec::new(); + for _ in 0..count { + let location = float(&mut args)?; + let derivative = float(&mut args)?; + let value = splines[read::(&mut args)?].clone(); + points.push(SplinePoint { + location, + derivative, + value, + }); + } + splines.push(CubicSpline::multipoint(coordinate, points)?); + writeln!(out, "spline {}", splines.len() - 1)?; + } + "spfail" => { + let spline = &splines[read::(&mut args)?]; + writeln!( + out, + "spline-compile {}", + if SplineSampler::new(spline, &samplers).is_err() { + "error" + } else { + "ok" + } + )?; + } + "sprange" => { + let spline = &splines[read::(&mut args)?]; + let mut ranges = [Interval::NAI; 3]; + for range in &mut ranges { + *range = Interval::encapsulating_values(float(&mut args)?, float(&mut args)?); + } + interval_output(&mut out, "spline", spline.range(&mut |id| ranges[id % 3]))?; + } + "spsampler" => { + let spline = &splines[read::(&mut args)?]; + samplers.push(Arc::new(SplineSampler::new(spline, &samplers)?)); + writeln!(out, "create {}", samplers.len() - 1)?; + } + "surface" => { + let mode = read::(&mut args)?; + let density = samplers[read::(&mut args)?].clone(); + let upper = samplers[read::(&mut args)?].clone(); + let lower = read(&mut args)?; + let height = read(&mut args)?; + let sampler: Arc = if mode == 0 { + Arc::new(FindTopSurfaceSampler::new(density, upper, lower, height)?) + } else { + Arc::new(compile_surface_search(density, upper, lower, height)?) + }; + samplers.push(sampler); + writeln!(out, "create {}", samplers.len() - 1)?; + } + "interpolate" => { + let input = samplers[read::(&mut args)?].clone(); + let xz = read(&mut args)?; + let y = read(&mut args)?; + samplers.push(Arc::new(InterpolatedSampler::new(input, xz, y)?)); + writeln!(out, "create {}", samplers.len() - 1)?; + } + "slice" => { + let mode = read::(&mut args)?; + let input = samplers[read::(&mut args)?].clone(); + let a = read(&mut args)?; + let b = read(&mut args)?; + let axes = match mode { + 0 => SliceAxes::X(a), + 1 => SliceAxes::Y(a), + 2 => SliceAxes::Z(a), + 3 => SliceAxes::Xz { x: a, z: b }, + _ => return Err("invalid slice mode".into()), + }; + samplers.push(Arc::new(SliceSampler { input, axes })); + writeln!(out, "create {}", samplers.len() - 1)?; + } + "cache" => { + let id = read::(&mut args)?; + let input = samplers[read::(&mut args)?].clone(); + samplers.push(Arc::new(CachingDensitySampler::new(id, input)?)); + writeln!(out, "create {}", samplers.len() - 1)?; + } + "lookup" => { + let sizes = [read(&mut args)?, read(&mut args)?, read(&mut args)?]; + let minimum = [read(&mut args)?, read(&mut args)?, read(&mut args)?]; + let steps = [read(&mut args)?, read(&mut args)?, read(&mut args)?]; + let position = [read(&mut args)?, read(&mut args)?, read(&mut args)?]; + let volume = DensityVolume::new(sizes, minimum, steps)?; + writeln!( + out, + "lookup {}", + volume.index_of_block(position).map_or(-1, |v| v as i32) + )?; + } + "query" => { + let sampler = &samplers[read::(&mut args)?]; + let position = [read(&mut args)?, read(&mut args)?, read(&mut args)?]; + match sampler.sample_value(&mut context, position) { + Ok(value) => writeln!(out, "query {}", bits(value))?, + Err(_) => writeln!(out, "query error")?, + } + } + "volume" => { + let sampler = &samplers[read::(&mut args)?]; + let sizes = [read(&mut args)?, read(&mut args)?, read(&mut args)?]; + let minimum = [read(&mut args)?, read(&mut args)?, read(&mut args)?]; + let steps = [read(&mut args)?, read(&mut args)?, read(&mut args)?]; + let tail = read::(&mut args)?; + let seed = read(&mut args)?; + let repeats = read::(&mut args)?; + let volume = DensityVolume::new(sizes, minimum, steps)?; + let mut random = LegacyRandom::new(seed); + let mut buffer: Vec<_> = (0..volume.size() + tail) + .map(|_| f32::from_bits(random.next_int() as u32)) + .collect(); + for pass in 0..repeats { + let result = sampler.sample_volume(&mut context, &mut buffer, volume); + writeln!( + out, + "volume {pass} {}", + if result.is_ok() { "ok" } else { "error" } + )?; + for (i, value) in buffer.iter().enumerate() { + writeln!(out, "cell {i} {}", bits(*value))?; + } + } + } + _ => return Err("unknown command".into()), + } + if args.next().is_some() { + return Err("extra argument".into()); + } + } + out.flush()?; + Ok(()) +} diff --git a/crates/horizon-core/src/bin/float_log_parity.rs b/crates/horizon-core/src/bin/float_log_parity.rs new file mode 100644 index 000000000..570a7c666 --- /dev/null +++ b/crates/horizon-core/src/bin/float_log_parity.rs @@ -0,0 +1,55 @@ +//! Binary transport for exhaustive comparison of the compiled float log sampler. +use horizon_core::density::{DensitySampler, SampleError, SamplerContext, UnaryOp, UnarySampler}; +use std::{ + io::{self, Write}, + sync::Arc, +}; + +#[derive(Debug)] +struct FloatBitsInput; +impl DensitySampler for FloatBitsInput { + fn sample_value(&self, _: &mut SamplerContext, position: [i32; 3]) -> Result { + Ok(f32::from_bits(position[0] as u32)) + } +} + +fn main() -> Result<(), Box> { + let mut args = std::env::args().skip(1); + let mut start = args + .next() + .ok_or("missing first float bits")? + .parse::()?; + let mut remaining = args.next().ok_or("missing float count")?.parse::()?; + if args.next().is_some() + || start + .checked_add(remaining) + .is_none_or(|end| end > 1_u64 << 32) + { + return Err("invalid float bit range".into()); + } + let sampler = UnarySampler { + input: Arc::new(FloatBitsInput), + operation: UnaryOp::Log, + }; + let mut context = SamplerContext::default(); + let mut out = io::BufWriter::with_capacity(1 << 20, io::stdout().lock()); + let mut buffer = vec![0_u8; 1 << 20]; + while remaining > 0 { + let entries = remaining.min((buffer.len() / 4) as u64) as usize; + for (offset, bytes) in buffer[..entries * 4].chunks_exact_mut(4).enumerate() { + let bits = (start + offset as u64) as u32; + let value = sampler.sample_value(&mut context, [bits as i32, 0, 0])?; + let result = if value.is_nan() { + 0x7fc0_0000 + } else { + value.to_bits() + }; + bytes.copy_from_slice(&result.to_be_bytes()); + } + out.write_all(&buffer[..entries * 4])?; + start += entries as u64; + remaining -= entries as u64; + } + out.flush()?; + Ok(()) +} diff --git a/crates/horizon-core/src/bin/geometry_parity.rs b/crates/horizon-core/src/bin/geometry_parity.rs new file mode 100644 index 000000000..a51f51887 --- /dev/null +++ b/crates/horizon-core/src/bin/geometry_parity.rs @@ -0,0 +1,564 @@ +//! Text adapter for differential checks; no vanilla logic lives in the adapter. +use horizon_core::geometry::{ + Aabb, Axis, BlockHit, Direction, Vec3, VoxelShape, block_floor_height, candidate_step_heights, + entity_collision_bounds, resolve_shape_movement, resolve_step_movement, + sweep_intersected_blocks, +}; +use horizon_core::position::BlockPos; +use std::io::{self, BufRead, Write}; + +struct Input<'a>(std::str::SplitWhitespace<'a>); +impl Input<'_> { + fn word(&mut self) -> &str { + self.0.next().expect("missing input") + } + fn integer(&mut self) -> i32 { + self.word().parse().expect("integer") + } + fn number(&mut self) -> f64 { + f64::from_bits(u64::from_str_radix(self.word(), 16).expect("double bits")) + } + fn vector(&mut self) -> Vec3 { + Vec3::new(self.number(), self.number(), self.number()) + } + fn aabb(&mut self) -> Aabb { + Aabb::new(self.vector(), self.vector()) + } + fn pos(&mut self) -> BlockPos { + BlockPos::new(self.integer(), self.integer(), self.integer()) + } +} +fn bits(value: f64) -> String { + format!( + "{:016x}", + if value.is_nan() { + 0x7ff8_0000_0000_0000 + } else { + value.to_bits() + } + ) +} +fn positions( + out: &mut impl Write, + label: &str, + iter: impl Iterator, + limit: usize, +) -> io::Result<()> { + let mut count = 0; + for pos in iter.take(limit) { + writeln!(out, "{label} {} {} {}", pos.x, pos.y, pos.z)?; + count += 1; + } + writeln!(out, "{label}-count {count}") +} +fn values( + out: &mut impl Write, + label: &str, + values: impl IntoIterator, +) -> io::Result<()> { + write!(out, "{label}")?; + for value in values { + write!(out, " {}", bits(value))?; + } + writeln!(out) +} +fn vector(out: &mut impl Write, label: &str, v: Vec3) -> io::Result<()> { + values(out, label, v.components()) +} +fn aabb(out: &mut impl Write, label: &str, b: Aabb) -> io::Result<()> { + values( + out, + label, + b.min_position() + .components() + .into_iter() + .chain(b.max_position().components()), + ) +} +fn point(out: &mut impl Write, label: &str, p: Option) -> io::Result<()> { + match p { + Some(v) => vector(out, label, v), + None => writeln!(out, "{label} none"), + } +} +fn hit(out: &mut impl Write, h: Option) -> io::Result<()> { + match h { + Some(h) => { + write!( + out, + "hit {} {} {} {} {}", + h.direction as u8, + u8::from(h.inside), + h.block.x, + h.block.y, + h.block.z + )?; + for c in h.location.components() { + write!(out, " {}", bits(c))?; + } + writeln!(out) + } + None => writeln!(out, "hit none"), + } +} +fn shape_values(out: &mut impl Write, id: usize, shape: &VoxelShape) -> io::Result<()> { + values( + out, + "axis-extrema", + Axis::ALL + .map(|axis| shape.min(axis)) + .into_iter() + .chain(Axis::ALL.map(|axis| shape.max(axis))), + )?; + writeln!(out, "shape {id} {}", shape.boxes().len())?; + let flags = shape.cube_coordinate_axes(); + writeln!( + out, + "cube {} {}", + u8::from(shape.is_cube()), + u8::from(flags[0]) + 2 * u8::from(flags[1]) + 4 * u8::from(flags[2]) + )?; + for (axis, label) in Axis::ALL + .into_iter() + .zip(["x-coords", "y-coords", "z-coords"]) + { + values(out, label, shape.coordinates(axis).iter().copied())?; + } + if let Some(b) = shape.bounds() { + aabb(out, "shape-bounds", b)?; + } else { + writeln!(out, "shape-bounds none")?; + } + for b in shape.boxes() { + aabb(out, "part", *b)?; + } + Ok(()) +} +fn main() -> io::Result<()> { + let mut out = io::BufWriter::new(io::stdout().lock()); + let mut shapes = Vec::::new(); + for (line_number, line) in io::stdin().lock().lines().enumerate() { + let line = line?; + let mut input = Input(line.split_whitespace()); + let operation = input.word().to_owned(); + writeln!(out, "command {} {operation}", line_number + 1)?; + match operation.as_str() { + "make-box" => { + let shape = VoxelShape::from_box(input.aabb()).expect("valid box"); + shape_values(&mut out, shapes.len(), &shape)?; + shapes.push(shape); + } + "optimize" => { + let shape = shapes[input.integer() as usize] + .optimized() + .expect("bounded optimization"); + shape_values(&mut out, shapes.len(), &shape)?; + shapes.push(shape); + } + "join" | "join-optimized" => { + let optimized = operation == "join-optimized"; + let a = input.integer() as usize; + let b = input.integer() as usize; + let operation = + horizon_core::geometry::ShapeOp::from_truth_table(input.integer() as u8); + let result = if optimized { + shapes[a].join(&shapes[b], operation) + } else { + shapes[a].join_unoptimized(&shapes[b], operation) + }; + match result { + Err(horizon_core::geometry::ShapeError::UnboundedBoolean) => { + writeln!(out, "join invalid")? + } + Err(error) => panic!("join failed: {error}"), + Ok(shape) => { + writeln!( + out, + "overlap {}", + u8::from( + shapes[a] + .join_is_not_empty(&shapes[b], operation) + .expect("bounded Boolean") + ) + )?; + shape_values(&mut out, shapes.len(), &shape)?; + shapes.push(shape); + } + } + } + "traverse" => { + let start = input.vector(); + let end = input.vector(); + let stop = input.integer(); + let mut count = 0; + let result = horizon_core::geometry::traverse_blocks(start, end, 10000, |pos| { + count += 1; + writeln!(out, "visit {} {} {}", pos.x, pos.y, pos.z).expect("write visit"); + (count == stop).then_some(pos) + }) + .expect("finite bounded corpus"); + match result { + Some(pos) => writeln!(out, "traverse {} {} {} {count}", pos.x, pos.y, pos.z)?, + None => writeln!(out, "traverse none {count}")?, + } + } + "trig-table" => { + for (i, value) in horizon_core::geometry::trig::sine_table() + .iter() + .enumerate() + { + writeln!(out, "sine {i} {:08x}", value.to_bits())?; + } + } + "rotation" => { + let v = input.vector(); + let angle = input.number(); + let pitch = input.number() as f32; + let yaw = input.number() as f32; + let axes = input.integer(); + let axis = Axis::ALL[input.integer() as usize]; + let direction = Direction::ALL[input.integer() as usize]; + let amount = input.number(); + values( + &mut out, + "trig", + [ + horizon_core::geometry::trig::sin(angle) as f64, + horizon_core::geometry::trig::cos(angle) as f64, + ], + )?; + vector(&mut out, "rotate-x", v.rotate_x(angle as f32))?; + vector(&mut out, "rotate-y", v.rotate_y(angle as f32))?; + vector(&mut out, "rotate-z", v.rotate_z(angle as f32))?; + vector(&mut out, "clockwise", v.rotate_clockwise_90())?; + vector(&mut out, "look", Vec3::direction_from_rotation(pitch, yaw))?; + values(&mut out, "rotation", v.rotation().map(|v| v as f64))?; + vector( + &mut out, + "align", + v.align([axes & 1 != 0, axes & 2 != 0, axes & 4 != 0]), + )?; + vector(&mut out, "with", v.with_component(axis, amount))?; + vector(&mut out, "relative", v.relative(direction, amount))?; + } + "vec" => { + let a = input.vector(); + let b = input.vector(); + let t = input.number(); + for (label, v) in [ + ("add", a.add_vector(b)), + ("subtract", a.subtract(b)), + ("vector-to", a.vector_to(b)), + ("multiply", a.multiply(b)), + ("scale", a.scale(t)), + ("normalize", a.normalize()), + ("cross", a.cross(b)), + ("lerp", a.lerp(b, t)), + ("projected", a.projected_on(b)), + ("reverse", a.reverse()), + ("horizontal", a.horizontal()), + ] { + vector(&mut out, label, v)?; + } + values( + &mut out, + "scalar", + [ + a.dot(b), + a.length_squared(), + a.length(), + a.horizontal_distance_squared(), + a.horizontal_distance(), + a.distance_squared(b), + a.distance(b), + ], + )?; + writeln!( + out, + "flags {} {} {} {}", + u8::from(a == b), + u8::from(a.is_finite()), + u8::from(a.closer_than(b, t)), + Direction::approximate_nearest(a) as u8 + )?; + let order = Axis::step_order(a); + writeln!( + out, + "order {} {} {}", + order[0] as u8, order[1] as u8, order[2] as u8 + )?; + } + "box" => { + let a = input.aabb(); + let b = input.aabb(); + let start = input.vector(); + let end = input.vector(); + let amount = input.vector(); + let axis = Axis::ALL[input.integer() as usize]; + let value = input.number(); + for (label, b) in [ + ("bounds", a), + ("move", a.move_by(amount)), + ("inflate", a.inflate(amount)), + ("deflate", a.deflate(amount)), + ("contract", a.contract(amount)), + ("expand", a.expand_towards(amount)), + ("intersect", a.intersect(b)), + ("union", a.union_bounds(b)), + ("next", a.next_deflated()), + ("set-min", a.with_min(axis, value)), + ("set-max", a.with_max(axis, value)), + ("of-size", Aabb::of_size(start, amount)), + ("unit", Aabb::unit_cube(start)), + ] { + aabb(&mut out, label, b)?; + } + vector(&mut out, "center", a.center())?; + vector(&mut out, "bottom", a.bottom_center())?; + vector(&mut out, "size", a.size())?; + values( + &mut out, + "distance", + [ + a.average_size(), + a.distance_squared_to_point(start), + a.distance_squared_to_box(b), + ], + )?; + writeln!( + out, + "flags {} {} {} {}", + u8::from(a.intersects(b)), + u8::from(a.contains(start)), + u8::from(a.has_nan()), + u8::from(a.collided_along_vector(amount, &[b])) + )?; + point(&mut out, "clip", a.clip(start, end))?; + hit( + &mut out, + Aabb::clip_boxes([a, b], start, end, BlockPos::default()), + )?; + } + "block-box" => { + let a = input.pos(); + let b = input.pos(); + aabb(&mut out, "block", Aabb::block(a))?; + aabb(&mut out, "encapsulate", Aabb::encapsulating_blocks(a, b))?; + } + "grid" => { + let cube = input.integer() != 0; + let sizes = std::array::from_fn(|_| input.integer() as usize); + let coords = std::array::from_fn(|i| { + (0..=sizes[i]).map(|_| input.number()).collect::>() + }); + let occupied = input.word().bytes().map(|b| b == b'1').collect::>(); + let occupied = if sizes.contains(&0) { + &[][..] + } else { + &occupied[..] + }; + let shape = if cube { + VoxelShape::from_cube(sizes, occupied) + } else { + VoxelShape::from_grid(coords, occupied) + } + .expect("valid shape"); + writeln!(out, "shape {} {}", shapes.len(), shape.boxes().len())?; + values( + &mut out, + "axis-extrema", + Axis::ALL + .map(|axis| shape.min(axis)) + .into_iter() + .chain(Axis::ALL.map(|axis| shape.max(axis))), + )?; + if let Some(b) = shape.bounds() { + aabb(&mut out, "shape-bounds", b)?; + } else { + writeln!(out, "shape-bounds none")?; + } + for b in shape.boxes() { + aabb(&mut out, "part", *b)?; + } + shapes.push(shape); + } + "query" => { + let id = input.integer() as usize; + let b = input.aabb(); + let start = input.vector(); + let end = input.vector(); + let p = input.vector(); + let block = input.pos(); + let axis = Axis::ALL[input.integer() as usize]; + let amount = input.number(); + let shape = &shapes[id]; + values( + &mut out, + "column", + [shape.min_at(axis, p.x, p.y), shape.max_at(axis, p.x, p.y)], + )?; + values(&mut out, "collide", [shape.collide(axis, b, amount)])?; + hit(&mut out, shape.clip(start, end, block))?; + point(&mut out, "closest", shape.closest_point(p))?; + writeln!( + out, + "index {} {} {}", + shape.find_index(Axis::X, p.x), + shape.find_index(Axis::Y, p.y), + shape.find_index(Axis::Z, p.z) + )?; + } + "many" => { + let b = input.aabb(); + let axis = Axis::ALL[input.integer() as usize]; + let amount = input.number(); + let count = input.integer(); + let selected = (0..count) + .map(|_| &shapes[input.integer() as usize]) + .collect::>(); + values( + &mut out, + "many", + [VoxelShape::collide_all(axis, b, selected, amount)], + )?; + } + "floor-height" => { + let shape = &shapes[input.integer() as usize]; + let below = &shapes[input.integer() as usize]; + let mut calls = 0; + let height = block_floor_height(shape, || { + calls += 1; + below + }); + values(&mut out, "floor-height", [height])?; + writeln!(out, "below-calls {calls}")?; + } + "block-iterate" => { + let a = input.pos(); + let b = input.pos(); + let direction = input.vector(); + let limit = input.integer() as usize; + positions( + &mut out, + "closed", + BlockPos::between_closed(a, b).expect("bounded block box"), + limit, + )?; + positions( + &mut out, + "direction", + BlockPos::between_corners_in_direction(a, b, direction) + .expect("bounded block box"), + limit, + )?; + } + "box-iterate" => { + let b = input.aabb(); + let direction = input.vector(); + let limit = input.integer() as usize; + positions( + &mut out, + "closed", + BlockPos::between_closed_box(b).expect("bounded block box"), + limit, + )?; + positions( + &mut out, + "direction", + BlockPos::between_box_corners_in_direction(b, direction) + .expect("bounded block box"), + limit, + )?; + } + "sweep" => { + let start = input.vector(); + let end = input.vector(); + let b = input.aabb(); + let stop = input.integer() as usize; + let mut visits = Vec::new(); + let completed = sweep_intersected_blocks(start, end, b, 1_000_000, |pos, step| { + visits.push((pos, step)); + visits.len() != stop + }) + .expect("bounded finite sweep"); + for (pos, step) in &visits { + writeln!(out, "block-visit {} {} {} {step}", pos.x, pos.y, pos.z)?; + } + writeln!(out, "sweep {} {}", u8::from(completed), visits.len())?; + } + "step-motion" => { + let b = input.aabb(); + let movement = input.vector(); + let max_step = input.number() as f32; + let grounded = input.integer() != 0; + let mut read_shapes = || { + let count = input.integer(); + (0..count) + .map(|_| &shapes[input.integer() as usize]) + .collect::>() + }; + let entities = read_shapes(); + let initial = read_shapes(); + let stepping = read_shapes(); + let border = input.integer(); + aabb( + &mut out, + "entity-query", + entity_collision_bounds(movement, b, max_step), + )?; + let mut queries = Vec::new(); + let result = resolve_step_movement(movement, b, max_step, grounded, |query| { + let blocks = if queries.is_empty() { + &initial + } else { + &stepping + }; + queries.push(query); + let mut selected = entities.clone(); + if border >= 0 { + selected.push(&shapes[border as usize]); + } + selected.extend(blocks.iter().copied()); + selected + }); + for query in &queries { + aabb(&mut out, "block-query", *query)?; + } + vector(&mut out, "step-motion", result)?; + writeln!(out, "block-queries {}", queries.len())?; + } + "motion" => { + let b = input.aabb(); + let movement = input.vector(); + let max_step = input.number() as f32; + let current_y = input.number() as f32; + let count = input.integer(); + let selected = (0..count) + .map(|_| &shapes[input.integer() as usize]) + .collect::>(); + vector( + &mut out, + "motion", + resolve_shape_movement(movement, b, &selected), + )?; + let candidates = candidate_step_heights(b, &selected, max_step, current_y); + write!(out, "steps {}", candidates.len())?; + for value in candidates { + write!( + out, + " {:08x}", + if value.is_nan() { + 0x7fc0_0000 + } else { + value.to_bits() + } + )?; + } + writeln!(out)?; + } + _ => panic!("unknown command {operation}"), + } + assert!(input.0.next().is_none(), "trailing input"); + } + out.flush() +} diff --git a/crates/horizon-core/src/bin/noise_parity.rs b/crates/horizon-core/src/bin/noise_parity.rs new file mode 100644 index 000000000..52085cddd --- /dev/null +++ b/crates/horizon-core/src/bin/noise_parity.rs @@ -0,0 +1,423 @@ +//! Test transport for comparing noise with the downloaded vanilla artifacts. +use horizon_core::{ + geometry::Axis, + noise::{ + DensityVolume, GradientTable, Noise, NoiseBuildError, NoiseStack, NormalNoise, + Normalization, PerlinNoise, SimplexNoise, SmearedPerlinNoise, wrap, + }, + random::{LegacyRandom, RandomSource, XoroshiroRandom}, +}; +use std::io::{self, BufRead, BufWriter, Write}; +use std::sync::Arc; + +enum Sampler { + Perlin(PerlinNoise), + Simplex(SimplexNoise), + Smeared(SmearedPerlinNoise), + Stack(NoiseStack), +} +impl Sampler { + fn table(&self) -> &GradientTable { + match self { + Self::Perlin(n) => n.table(), + Self::Simplex(n) => n.table(), + Self::Smeared(n) => n.table(), + Self::Stack(_) => panic!("stack has no gradient table"), + } + } + fn as_noise(&self) -> &dyn Noise { + match self { + Self::Perlin(n) => n, + Self::Simplex(n) => n, + Self::Smeared(n) => n, + Self::Stack(n) => n, + } + } + fn shared_noise(&self) -> Arc { + match self { + Self::Perlin(n) => Arc::new(n.clone()), + Self::Simplex(n) => Arc::new(n.clone()), + Self::Smeared(n) => Arc::new(n.clone()), + Self::Stack(n) => Arc::new(n.clone()), + } + } + fn range(&self) -> Result<[f32; 2], horizon_core::noise::NanRange> { + self.as_noise().range() + } + fn get2(&self, x: f64, z: f64) -> f32 { + self.as_noise().get2(x, z) + } + fn get3(&self, x: f64, y: f64, z: f64) -> f32 { + self.as_noise().get3(x, y, z) + } +} +fn read( + args: &mut std::str::SplitWhitespace<'_>, +) -> Result> { + args.next() + .ok_or("missing argument")? + .parse() + .map_err(|_| "invalid argument".into()) +} +fn double(args: &mut std::str::SplitWhitespace<'_>) -> Result> { + Ok(f64::from_bits(u64::from_str_radix( + args.next().ok_or("missing double")?, + 16, + )?)) +} +fn float(args: &mut std::str::SplitWhitespace<'_>) -> Result> { + Ok(f32::from_bits(u32::from_str_radix( + args.next().ok_or("missing float")?, + 16, + )?)) +} +fn bits(v: f32) -> u32 { + if v.is_nan() { 0x7fc0_0000 } else { v.to_bits() } +} +fn dbits(v: f64) -> u64 { + if v.is_nan() { + 0x7ff8_0000_0000_0000 + } else { + v.to_bits() + } +} +fn create( + kind: &str, + mut rng: R, + skip: bool, + scale: f64, + out: &mut impl Write, +) -> io::Result { + let sampler = match kind { + "perlin" => Sampler::Perlin(PerlinNoise::new(&mut rng)), + "simplex" => Sampler::Simplex(SimplexNoise::with_skipped_offsets(&mut rng, skip)), + "smeared" => Sampler::Smeared(SmearedPerlinNoise::new(&mut rng, scale)), + _ => { + return Err(io::Error::new( + io::ErrorKind::InvalidInput, + "unknown sampler", + )); + } + }; + let offsets = sampler.table().offsets(); + let range = sampler.range(); + let (lower, upper) = match range { + Ok(range) => (bits(range[0]).to_string(), bits(range[1]).to_string()), + Err(_) => ("error".to_owned(), "error".to_owned()), + }; + writeln!( + out, + "create {} {} {} {} {} {}", + dbits(offsets[0]), + dbits(offsets[1]), + dbits(offsets[2]), + lower, + upper, + rng.next_long() + )?; + write!(out, "permutations")?; + for v in sampler.table().permutations() { + write!(out, " {v}")?; + } + writeln!(out)?; + Ok(sampler) +} +fn normal_probe( + out: &mut impl Write, + definition: Result, + mut random: R, + points: &[[f64; 3]], + legacy: bool, +) -> Result<(), Box> { + let Ok(definition) = definition else { + writeln!(out, "normal error {}", random.next_long())?; + return Ok(()); + }; + let range = definition.range(); + writeln!( + out, + "normal {} {} {} {}", + definition.octaves().len(), + dbits(definition.normalization_factor()), + bits(range[0]), + bits(range[1]) + )?; + for octave in definition.octaves() { + writeln!( + out, + "octave {} {} {} {}", + octave.octave_index, + dbits(octave.frequency), + dbits(octave.amplitude), + octave.seed() + )?; + } + let created = if legacy { + definition.create_for_legacy_nether_biome(&mut random) + } else { + definition.create(&mut random) + }; + match created { + Err(_) => writeln!(out, "normal-create error")?, + Ok(noise) => { + let range = noise.range()?; + writeln!( + out, + "normal-create {} {} {}", + noise.layers().len(), + bits(range[0]), + bits(range[1]) + )?; + for layer in noise.layers() { + writeln!( + out, + "normal-layer {} {} {} {}", + dbits(layer.frequency), + bits(layer.amplitude), + bits(layer.noise.get2(0.25, 0.75)), + bits(layer.noise.get3(-17.25, 64.125, 32.5)) + )?; + } + for &[x, y, z] in points { + writeln!( + out, + "normal-query {} {}", + bits(noise.get2(x, z)), + bits(noise.get3(x, y, z)) + )?; + } + let volume = DensityVolume::new([2, 5, 2], [-17, -64, 32], [4, 1, 4])?; + let mut values: Vec = (0..volume.size()) + .map(|i| (i as f32 - 10.0) * 0.125) + .collect(); + for (pass, amplitude) in [0.5, -0.25].into_iter().enumerate() { + noise.add_to_volume(&mut values, volume, 0.125, 0.25, amplitude)?; + for (i, value) in values.iter().enumerate() { + writeln!(out, "normal-volume {pass} {i} {}", bits(*value))?; + } + } + } + } + writeln!(out, "normal-parent {}", random.next_long())?; + Ok(()) +} +fn main() -> Result<(), Box> { + let stdin = io::stdin(); + let mut out = BufWriter::new(io::stdout().lock()); + let mut samplers = Vec::new(); + for line in stdin.lock().lines() { + let line = line?; + let mut args = line.split_whitespace(); + match args.next().ok_or("missing operation")? { + "normal" => { + let kind = args.next().ok_or("missing RNG kind")?; + let seed: i64 = read(&mut args)?; + let parity: i32 = read(&mut args)?; + let base: i32 = read(&mut args)?; + let count: i32 = read(&mut args)?; + let normalization: i32 = read(&mut args)?; + let amplitude = double(&mut args)?; + let modifiers: usize = read(&mut args)?; + let modifiers = (0..modifiers) + .map(|_| double(&mut args)) + .collect::, _>>()?; + let point_count: usize = read(&mut args)?; + let points = (0..point_count) + .map(|_| Ok([double(&mut args)?, double(&mut args)?, double(&mut args)?])) + .collect::, Box>>()?; + let definition = if parity & 1 != 0 { + NormalNoise::create_parity(base, &modifiers) + } else { + (|| { + let mut builder = NormalNoise::builder(); + builder + .set_base_octave(base) + .set_base_amplitude(amplitude) + .set_normalization(match normalization { + 0 => Normalization::Disabled, + 1 => Normalization::Enabled, + _ => Normalization::Legacy, + }); + builder.set_octave_count(count)?; + for (index, value) in modifiers.iter().enumerate() { + builder.set_amplitude_modifier(index as i32, *value)?; + } + builder.build() + })() + }; + match kind { + "legacy" => normal_probe( + &mut out, + definition, + LegacyRandom::new(seed), + &points, + parity & 2 != 0, + )?, + "xoroshiro" => normal_probe( + &mut out, + definition, + XoroshiroRandom::new(seed), + &points, + parity & 2 != 0, + )?, + _ => return Err("unknown stream".into()), + } + } + "create" => { + let kind = args.next().ok_or("missing sampler")?; + let stream = args.next().ok_or("missing stream")?; + let seed: i64 = read(&mut args)?; + let skip: i32 = read(&mut args)?; + let scale = double(&mut args)?; + let sampler = match stream { + "legacy" => create(kind, LegacyRandom::new(seed), skip != 0, scale, &mut out)?, + "xoroshiro" => { + create(kind, XoroshiroRandom::new(seed), skip != 0, scale, &mut out)? + } + _ => return Err("unknown stream".into()), + }; + samplers.push(sampler); + } + operation @ ("query" | "local") => { + let id: usize = read(&mut args)?; + let mut point = [double(&mut args)?, double(&mut args)?, double(&mut args)?]; + let mut derivative = [float(&mut args)?, float(&mut args)?, float(&mut args)?]; + let sampler = &samplers[id]; + if operation == "local" { + for (value, offset) in point.iter_mut().zip(sampler.table().offsets()) { + *value -= offset; + } + } + let [x, y, z] = point; + write!( + out, + "query {} {}", + bits(sampler.get2(x, z)), + bits(sampler.get3(x, y, z)) + )?; + let value = match sampler { + Sampler::Perlin(n) => Some(n.noise_with_derivative(x, y, z, &mut derivative)), + Sampler::Smeared(n) => Some(n.noise_with_derivative(x, y, z, &mut derivative)), + Sampler::Simplex(_) | Sampler::Stack(_) => None, + }; + if let Some(value) = value { + write!( + out, + " {} {} {} {}", + bits(value), + bits(derivative[0]), + bits(derivative[1]), + bits(derivative[2]) + )?; + } + writeln!(out)?; + } + "volume" => { + let id: usize = read(&mut args)?; + let sizes = [read(&mut args)?, read(&mut args)?, read(&mut args)?]; + let minimum = [read(&mut args)?, read(&mut args)?, read(&mut args)?]; + let steps = [read(&mut args)?, read(&mut args)?, read(&mut args)?]; + let xz_scale = double(&mut args)?; + let y_scale = double(&mut args)?; + let amplitude = float(&mut args)?; + let seed: i64 = read(&mut args)?; + let repeats: usize = read(&mut args)?; + match DensityVolume::new(sizes, minimum, steps) { + Err(_) => writeln!(out, "volume error")?, + Ok(volume) => { + let mut random = LegacyRandom::new(seed); + let mut values: Vec = (0..volume.size() + 4) + .map(|_| f32::from_bits(random.next_int() as u32)) + .collect(); + let sampler = &samplers[id]; + for _ in 0..repeats { + sampler.as_noise().add_to_volume( + &mut values, + volume, + xz_scale, + y_scale, + amplitude, + )?; + } + let maximum = volume.maximum(); + writeln!( + out, + "volume {} {} {} {}", + volume.size(), + maximum[0], + maximum[1], + maximum[2] + )?; + let [sx, sy, sz] = volume.sizes(); + for z in 0..sz { + for x in 0..sx { + for y in 0..sy { + let index = volume.index([x, y, z]).unwrap(); + writeln!( + out, + "cell {index} {} {} {} {}", + volume.block(Axis::X, x).unwrap(), + volume.block(Axis::Y, y).unwrap(), + volume.block(Axis::Z, z).unwrap(), + bits(values[index]) + )?; + } + } + } + for value in &values[volume.size()..] { + writeln!(out, "tail {}", bits(*value))?; + } + } + } + } + "stack" => { + let count: usize = read(&mut args)?; + let mut builder = NoiseStack::builder(); + for _ in 0..count { + let flatten: i32 = read(&mut args)?; + let id: usize = read(&mut args)?; + let frequency = double(&mut args)?; + let amplitude = float(&mut args)?; + if flatten != 0 { + let Sampler::Stack(stack) = &samplers[id] else { + return Err("flatten expects a stack".into()); + }; + builder.add_stack(stack, frequency, amplitude); + } else { + builder.add(samplers[id].shared_noise(), frequency, amplitude); + } + } + match builder.build() { + Err(_) => writeln!(out, "stack error")?, + Ok(stack) => { + let range = stack.range()?; + writeln!( + out, + "stack {} {} {}", + stack.layers().len(), + bits(range[0]), + bits(range[1]) + )?; + for (index, layer) in stack.layers().iter().enumerate() { + writeln!( + out, + "layer {} {} {}", + dbits(layer.frequency), + bits(layer.amplitude), + bits(stack.get_layer(index).unwrap().get3(0.0, 0.0, 0.0)) + )?; + } + samplers.push(Sampler::Stack(stack)); + } + } + } + "wrap" => writeln!(out, "wrap {}", dbits(wrap(double(&mut args)?)))?, + _ => return Err("unknown operation".into()), + } + if args.next().is_some() { + return Err("extra argument".into()); + } + } + out.flush()?; + Ok(()) +} diff --git a/crates/horizon-core/src/bin/parity.rs b/crates/horizon-core/src/bin/parity.rs new file mode 100644 index 000000000..964391b3f --- /dev/null +++ b/crates/horizon-core/src/bin/parity.rs @@ -0,0 +1,321 @@ +//! Line-based differential probe. Not a game client or server. +use horizon_core::{ + position::{BlockPos, ChunkPos, SectionPos}, + random::{ + LegacyPositionalRandom, LegacyRandom, PositionalRandom, RandomSource, + XoroshiroPositionalRandom, XoroshiroRandom, java_string_hash, position_seed, + seed_from_hash_utf16, + }, + storage::PackedStorage, +}; +use std::io::{self, BufRead, BufWriter, Write}; + +fn random_probe(out: &mut impl Write, mut rng: R, count: usize) -> io::Result<()> { + let bounds = [1, 2, 3, 16, 31, 256, 65_537, 1_073_741_825, i32::MAX, 0, -1]; + for i in 0..count { + let value = match i % 10 { + 0 => rng.next_int().to_string(), + 1 => rng.next_long().to_string(), + 2 => match rng.next_int_bound(bounds[(i / 10) % bounds.len()]) { + Ok(value) => value.to_string(), + Err(_) => "error".to_owned(), + }, + 3 => u8::from(rng.next_boolean()).to_string(), + 4 => rng.next_float().to_bits().to_string(), + 5 => rng.next_double().to_bits().to_string(), + 6 => rng.fork().next_long().to_string(), + 7 => { + rng.consume_count((i % 7) as i32 - 2); + rng.next_long().to_string() + } + 8 => { + if i % 101 == 8 { + let seed = rng.next_long().wrapping_sub(i as i64); + rng.set_seed(seed); + } + rng.next_int_bound(1_073_741_825).unwrap().to_string() + } + _ => rng.next_int().to_string(), + }; + writeln!(out, "rng {i} {value}")?; + } + Ok(()) +} + +fn read(args: &mut std::str::SplitWhitespace<'_>) -> Result { + args.next() + .ok_or_else(|| "missing argument".to_owned())? + .parse() + .map_err(|_| "invalid argument".to_owned()) +} +fn helpers( + out: &mut impl Write, + mut rng: R, + bounds: [i32; 2], + double: [f64; 2], + float: [f32; 2], +) -> io::Result<()> { + for i in 0..32 { + let inclusive = rng + .next_int_between_inclusive(bounds[0], bounds[1]) + .map_or_else(|_| "error".to_owned(), |v| v.to_string()); + let exclusive = rng + .next_int_between(bounds[0], bounds[1]) + .map_or_else(|_| "error".to_owned(), |v| v.to_string()); + let d = rng.triangle(double[0], double[1]); + let f = rng.triangle_float(float[0], float[1]); + let d = if d.is_nan() { + 0x7ff8_0000_0000_0000 + } else { + d.to_bits() + }; + let f = if f.is_nan() { 0x7fc0_0000 } else { f.to_bits() }; + writeln!( + out, + "helpers {i} {inclusive} {exclusive} {d} {f} {}", + rng.next_long() + )?; + } + random_probe(out, rng, 24) +} +fn utf16(token: &str) -> Result, String> { + if token == "-" { + return Ok(Vec::new()); + } + if token.len() % 4 != 0 { + return Err("invalid UTF-16 hex".to_owned()); + } + token + .as_bytes() + .chunks_exact(4) + .map(|part| { + u16::from_str_radix( + std::str::from_utf8(part).map_err(|_| "invalid UTF-16 hex")?, + 16, + ) + .map_err(|_| "invalid UTF-16 hex".to_owned()) + }) + .collect() +} +fn factory_probe( + out: &mut impl Write, + factory: P, + position: BlockPos, + seed: i64, + name: &[u16], + count: usize, +) -> io::Result<()> { + for (label, rng) in [ + ("at", factory.at(position)), + ("seed", factory.from_seed(seed)), + ("hash", factory.from_hash_of_utf16(name)), + ] { + writeln!(out, "factory {label}")?; + random_probe(out, rng, count)?; + } + Ok(()) +} + +fn probe(line: &str, out: &mut impl Write) -> Result<(), Box> { + let mut args = line.split_whitespace(); + match args.next().ok_or("missing operation")? { + "helpers" => { + let kind = args.next().ok_or("missing RNG kind")?; + let seed: i64 = read(&mut args)?; + let bounds = [read(&mut args)?, read(&mut args)?]; + let d = [ + f64::from_bits(u64::from_str_radix( + args.next().ok_or("missing double")?, + 16, + )?), + f64::from_bits(u64::from_str_radix( + args.next().ok_or("missing double")?, + 16, + )?), + ]; + let f = [ + f32::from_bits(u32::from_str_radix( + args.next().ok_or("missing float")?, + 16, + )?), + f32::from_bits(u32::from_str_radix( + args.next().ok_or("missing float")?, + 16, + )?), + ]; + match kind { + "legacy" => helpers(out, LegacyRandom::new(seed), bounds, d, f)?, + "xoroshiro" => helpers(out, XoroshiroRandom::new(seed), bounds, d, f)?, + _ => return Err("unknown RNG kind".into()), + } + } + "factory" => { + let kind = args.next().ok_or("missing RNG kind")?; + let mode: i32 = read(&mut args)?; + let lo: i64 = read(&mut args)?; + let hi: i64 = read(&mut args)?; + let position = BlockPos::new(read(&mut args)?, read(&mut args)?, read(&mut args)?); + let seed: i64 = read(&mut args)?; + let name = utf16(args.next().ok_or("missing name")?)?; + let count: usize = read(&mut args)?; + let hash = seed_from_hash_utf16(&name); + writeln!( + out, + "seeds {} {} {} {}", + position_seed(position), + java_string_hash(name.iter().copied()), + hash[0] as i64, + hash[1] as i64 + )?; + if kind == "legacy" { + let mut source = LegacyRandom::new(lo); + let factory = if mode == 0 { + LegacyPositionalRandom::new(lo) + } else { + source.fork_positional() + }; + factory_probe(out, factory, position, seed, &name, count)?; + if mode != 0 { + writeln!(out, "parent {}", source.next_long())?; + } + } else { + let mut source = XoroshiroRandom::new(lo); + let factory = if mode == 0 { + XoroshiroPositionalRandom::new(lo as u64, hi as u64) + } else { + source.fork_positional() + }; + factory_probe(out, factory, position, seed, &name, count)?; + if mode != 0 { + writeln!(out, "parent {}", source.next_long())?; + } + } + } + "position" => { + let p = BlockPos::new(read(&mut args)?, read(&mut args)?, read(&mut args)?); + let offset = p.offset(read(&mut args)?, read(&mut args)?, read(&mut args)?); + let packed = p.pack(); + let decoded = BlockPos::unpack(packed); + let section = p.section(); + let sp = section.pack(); + let sd = SectionPos::unpack(sp); + let chunk = p.chunk(); + let cp = chunk.pack(); + let cd = ChunkPos::unpack(cp); + let region = chunk.region(); + let (rx, rz) = chunk.region_local(); + let relative = p.section_relative(); + let rebuilt = section.relative_to_block(relative); + writeln!( + out, + "position {packed} {} {} {} {sp} {} {} {} {cp} {} {} {} {} {rx} {rz} {relative} {} {} {} {} {} {} {}", + decoded.x, + decoded.y, + decoded.z, + sd.x, + sd.y, + sd.z, + cd.x, + cd.z, + region.x, + region.z, + p.section_index(), + rebuilt.x, + rebuilt.y, + rebuilt.z, + offset.x, + offset.y, + offset.z + )?; + } + "legacy" => random_probe(out, LegacyRandom::new(read(&mut args)?), read(&mut args)?)?, + "xoroshiro" => random_probe( + out, + XoroshiroRandom::new(read(&mut args)?), + read(&mut args)?, + )?, + "xoroshiro_state" => random_probe( + out, + XoroshiroRandom::from_state( + read::(&mut args)? as u64, + read::(&mut args)? as u64, + ), + read(&mut args)?, + )?, + "storage" => { + let bits: u8 = read(&mut args)?; + let len: usize = read(&mut args)?; + let seed: i64 = read(&mut args)?; + let mut storage = PackedStorage::new(bits, len)?; + let mut rng = LegacyRandom::new(seed); + let mask = ((1_u64 << bits) - 1).min(i32::MAX as u64); + for i in 0..len * 3 { + let index = rng.next_int_bound(len as i32)? as usize; + let value = (rng.next_int() as u32 as u64 & mask) as u32; + let old = storage.set(index, value)?; + writeln!(out, "set {i} {index} {old} {}", storage.get(index)?)?; + } + for (i, &word) in storage.words().iter().enumerate() { + writeln!(out, "word {i} {}", word as i64)?; + } + for (i, value) in storage.unpack().iter().enumerate() { + writeln!(out, "value {i} {}", *value as i32)?; + } + let mut imported = + PackedStorage::from_words(bits, len, vec![u64::MAX; storage.words().len()])?; + for i in 0..len { + writeln!(out, "import {i} {}", imported.get(i)? as i32)?; + } + if len > 0 { + imported.set(len - 1, 0)?; + } + for (i, &word) in imported.words().iter().enumerate() { + writeln!(out, "import_word {i} {}", word as i64)?; + } + for value in [0, 1, mask as u32] { + imported.fill(value)?; + for (i, &word) in imported.words().iter().enumerate() { + writeln!(out, "fill {value} {i} {}", word as i64)?; + } + } + let before = storage.clone(); + writeln!( + out, + "invalid_index {}", + u8::from(storage.set(len, 0).is_err()) + )?; + let invalid_value = if bits == 32 { u32::MAX } else { 1_u32 << bits }; + // An empty storage has no valid index at which to test value errors. + if len > 0 { + writeln!( + out, + "invalid_value {}", + u8::from(storage.set(0, invalid_value).is_err()) + )?; + } + writeln!(out, "unchanged {}", u8::from(storage == before))?; + } + _ => return Err("unknown operation".into()), + } + if args.next().is_some() { + return Err("unexpected trailing argument".into()); + } + Ok(()) +} + +fn main() { + let mut out = BufWriter::new(io::stdout().lock()); + for (i, line) in io::stdin().lock().lines().enumerate() { + let result = line + .map_err(|e| e.to_string()) + .and_then(|line| probe(&line, &mut out).map_err(|e| e.to_string())); + if let Err(error) = result { + eprintln!("line {}: {error}", i + 1); + std::process::exit(2); + } + } + if let Err(error) = out.flush() { + eprintln!("output failed: {error}"); + std::process::exit(2); + } +} diff --git a/crates/horizon-core/src/bin/tick_parity.rs b/crates/horizon-core/src/bin/tick_parity.rs new file mode 100644 index 000000000..e4b8c46ea --- /dev/null +++ b/crates/horizon-core/src/bin/tick_parity.rs @@ -0,0 +1,246 @@ +//! Original trace adapter for pinned vanilla scheduler comparisons. +use horizon_core::{ + position::{BlockPos, ChunkPos}, + ticks::{ + ChunkTicks, LevelTicks, SavedTick, ScheduleResult, ScheduledTick, TickArea, TickPriority, + TickTypeId, + }, +}; +use std::{ + collections::{HashMap, HashSet}, + error::Error, + io::{self, BufRead, Write}, + str::{FromStr, SplitWhitespace}, +}; +struct Input<'a>(SplitWhitespace<'a>); +impl Input<'_> { + fn value(&mut self) -> Result> + where + T::Err: Error + 'static, + { + Ok(self.0.next().ok_or("missing argument")?.parse()?) + } + fn pos(&mut self) -> Result> { + Ok(BlockPos::new(self.value()?, self.value()?, self.value()?)) + } + fn chunk(&mut self) -> Result> { + Ok(ChunkPos::new(self.value()?, self.value()?)) + } + fn area(&mut self) -> Result> { + Ok(TickArea::new(self.pos()?, self.pos()?)) + } +} +fn result(result: ScheduleResult) -> u8 { + match result { + ScheduleResult::Added => 1, + ScheduleResult::Duplicate => 0, + ScheduleResult::MissingChunk => 2, + } +} +fn scheduled(out: &mut impl Write, tick: ScheduledTick) -> io::Result<()> { + writeln!( + out, + "queued {} {} {} {} {} {} {}", + tick.kind.0, + tick.pos.x, + tick.pos.y, + tick.pos.z, + tick.trigger_tick, + tick.priority as i8, + tick.sub_tick_order + ) +} +fn main() -> Result<(), Box> { + let mut level = LevelTicks::default(); + let mut detached = HashMap::::new(); + let mut blocked = HashSet::new(); + let mut out = io::BufWriter::new(io::stdout().lock()); + for (line_number, line) in io::stdin().lock().lines().enumerate() { + let line = line?; + let mut input = Input(line.split_whitespace()); + let operation = input.0.next().ok_or("empty command")?; + writeln!(out, "command {} {}", line_number, operation)?; + match operation { + "reset" => { + level = LevelTicks::default(); + detached.clear(); + blocked.clear(); + } + "add" => { + let pos = input.chunk()?; + if level.chunk(pos).is_none() { + level.add_chunk(pos, ChunkTicks::default())?; + } + } + "load" => { + let pos = input.chunk()?; + let count: usize = input.value()?; + let mut ticks = Vec::with_capacity(count); + for _ in 0..count { + ticks.push(SavedTick { + kind: TickTypeId(input.value()?), + pos: input.pos()?, + delay: input.value()?, + priority: TickPriority::by_value(input.value()?), + }); + } + if level.chunk(pos).is_some() { + level.remove_chunk(pos); + } + level.add_chunk(pos, ChunkTicks::from_saved(ticks))?; + } + "unpack" => { + let pos = input.chunk()?; + level.unpack_chunk(pos, input.value()?); + } + "remove" => { + let pos = input.chunk()?; + if let Some(chunk) = level.remove_chunk(pos) { + detached.insert(pos, chunk); + } + } + "restore" => { + let pos = input.chunk()?; + if level.chunk(pos).is_none() { + if let Some(chunk) = detached.remove(&pos) { + level.add_chunk(pos, chunk)?; + } + } + } + "enable" => { + let pos = input.chunk()?; + if input.value::()? == 0 { + blocked.insert(pos); + } else { + blocked.remove(&pos); + } + } + "schedule" => { + let tick = ScheduledTick { + kind: TickTypeId(input.value()?), + pos: input.pos()?, + trigger_tick: input.value()?, + priority: TickPriority::by_value(input.value()?), + sub_tick_order: input.value()?, + }; + writeln!(out, "schedule {}", result(level.schedule(tick)))?; + } + "query" => { + let kind = TickTypeId(input.value()?); + let pos = input.pos()?; + writeln!( + out, + "query {} {}", + u8::from(level.has_scheduled(pos, kind)), + u8::from(level.will_tick_this_tick(pos, kind)) + )?; + } + "chunk" => { + let pos = input.chunk()?; + if let Some(chunk) = level.chunk(pos) { + writeln!(out, "chunk {}", chunk.count())?; + for &tick in chunk.queued() { + scheduled(&mut out, tick)?; + } + } else { + writeln!(out, "chunk absent")?; + } + } + "save" => { + let pos = input.chunk()?; + let time = input.value()?; + if let Some(chunk) = level.chunk(pos) { + let ticks = chunk.pack(time); + writeln!(out, "saved {}", ticks.len())?; + for tick in ticks { + writeln!( + out, + "saved-value {} {} {} {} {} {}", + tick.kind.0, + tick.pos.x, + tick.pos.y, + tick.pos.z, + tick.delay, + tick.priority as i8 + )?; + } + } else { + writeln!(out, "saved absent")?; + } + } + "reload" => { + let pos = input.chunk()?; + let save_time = input.value()?; + let load_time = input.value()?; + if let Some(old) = level.remove_chunk(pos) { + let mut chunk = ChunkTicks::from_saved(old.pack(save_time)); + chunk.unpack(load_time); + level.add_chunk(pos, chunk)?; + } + } + "clear" => level.clear_area(input.area()?), + "copy" => { + let area = input.area()?; + level.copy_area(area, input.pos()?); + } + "tick" => { + let time: i64 = input.value()?; + let maximum: i32 = input.value()?; + let action: i32 = input.value()?; + let probe_kind = TickTypeId(input.value()?); + let probe = input.pos()?; + let mut order: i64 = input.value()?; + level.begin_tick(time, maximum, |pos| !blocked.contains(&pos))?; + while let Some(tick) = level.next_tick()? { + scheduled(&mut out, tick)?; + writeln!( + out, + "running {} {} {}", + u8::from(level.will_tick_this_tick(tick.pos, tick.kind)), + u8::from(level.has_scheduled(tick.pos, tick.kind)), + u8::from(level.will_tick_this_tick(probe, probe_kind)) + )?; + match action { + 1 => { + let mut next = tick; + next.trigger_tick = time; + next.sub_tick_order = order; + order = order.wrapping_add(1); + writeln!(out, "callback-schedule {}", result(level.schedule(next)))?; + } + 2 => { + level.clear_area(TickArea::new(tick.pos, tick.pos.offset(1, 1, 1))); + writeln!( + out, + "callback-clear {}", + u8::from(level.will_tick_this_tick(probe, probe_kind)) + )?; + } + 3 => level.copy_area( + TickArea::new(tick.pos.offset(-2, -2, -2), tick.pos.offset(2, 2, 2)), + BlockPos::new(16, 0, 0), + ), + 4 => { + let pos = tick.pos.chunk(); + if let Some(chunk) = level.remove_chunk(pos) { + detached.insert(pos, chunk); + } + } + 5 => { + blocked.insert(tick.pos.chunk()); + } + 0 => {} + _ => return Err("unknown callback action".into()), + } + } + level.finish_tick()?; + } + _ => return Err(format!("unknown command {operation}").into()), + } + if input.0.next().is_some() { + return Err("extra arguments".into()); + } + writeln!(out, "count {}", level.count())?; + } + Ok(()) +} diff --git a/crates/horizon-core/src/biome.rs b/crates/horizon-core/src/biome.rs new file mode 100644 index 000000000..4f8c9ff54 --- /dev/null +++ b/crates/horizon-core/src/biome.rs @@ -0,0 +1,74 @@ +//! Block-to-quart biome lookup for Java Edition 26.3. +//! Selection is independent of the provider that stores or generates quart biomes. +mod seed_hash; +use crate::position::BlockPos; + +/// The seed sent to clients: SHA-256 of the little-endian world seed, with the +/// first eight digest bytes interpreted as a little-endian signed long. +pub fn obfuscate_seed(world_seed: i64) -> i64 { + seed_hash::hash(world_seed) +} + +#[derive(Clone, Copy, Debug)] +pub struct BiomeZoom { + seed: i64, +} +impl BiomeZoom { + /// Accepts the obfuscated biome seed, not the original world seed. + pub const fn new(obfuscated_seed: i64) -> Self { + Self { + seed: obfuscated_seed, + } + } + /// Choose the closest of eight jittered quart corners, preserving vanilla's + /// corner order, strict tie comparison and signed coordinate wrapping. + pub fn quart_at_block(self, block: BlockPos) -> [i32; 3] { + let shifted = [block.x, block.y, block.z].map(|v| v.wrapping_sub(2)); + let base = shifted.map(|v| v >> 2); + let fractions = shifted.map(|v| f64::from(v & 3) / 4.); + let mut selected = base; + let mut best = f64::INFINITY; + for corner in 0..8 { + let offsets = [(corner >> 2) & 1, (corner >> 1) & 1, corner & 1]; + let quart = std::array::from_fn(|i| base[i].wrapping_add(offsets[i])); + let delta = std::array::from_fn(|i| fractions[i] - f64::from(offsets[i])); + let distance = fiddled_distance(self.seed, quart, delta); + if best > distance { + best = distance; + selected = quart; + } + } + selected + } +} + +/// Direct noise-biome lookup bypasses the eight-corner zoom. +pub fn noise_quart_at_block(block: BlockPos) -> [i32; 3] { + [block.x, block.y, block.z].map(|v| v >> 2) +} +/// Java floors each double to a saturating int (NaN becomes zero) before shifting. +pub fn noise_quart_at_position(position: [f64; 3]) -> [i32; 3] { + position.map(|v| (v.floor() as i32) >> 2) +} +fn next(seed: i64, salt: i64) -> i64 { + seed.wrapping_mul( + seed.wrapping_mul(6364136223846793005) + .wrapping_add(1442695040888963407), + ) + .wrapping_add(salt) +} +fn fiddle(seed: i64) -> f64 { + (((seed >> 24) & 1023) as f64 / 1024. - 0.5) * 0.9 +} +fn fiddled_distance(seed: i64, quart: [i32; 3], delta: [f64; 3]) -> f64 { + let mut mixed = seed; + for coordinate in quart.into_iter().cycle().take(6) { + mixed = next(mixed, i64::from(coordinate)); + } + let x = delta[0] + fiddle(mixed); + mixed = next(mixed, seed); + let y = delta[1] + fiddle(mixed); + mixed = next(mixed, seed); + let z = delta[2] + fiddle(mixed); + z * z + y * y + x * x +} diff --git a/crates/horizon-core/src/biome/seed_hash.rs b/crates/horizon-core/src/biome/seed_hash.rs new file mode 100644 index 000000000..e88d67ae1 --- /dev/null +++ b/crates/horizon-core/src/biome/seed_hash.rs @@ -0,0 +1,66 @@ +// SHA-256 specialized to one eight-byte input. This is a world-seed compatibility +// transform, not a general-purpose cryptography interface. +const K: [u32; 64] = [ + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2, +]; +pub(super) fn hash(seed: i64) -> i64 { + let bytes = seed.to_le_bytes(); + let mut words = [0_u32; 64]; + words[0] = u32::from_be_bytes(bytes[..4].try_into().unwrap()); + words[1] = u32::from_be_bytes(bytes[4..].try_into().unwrap()); + words[2] = 0x80000000; + words[15] = 64; + for i in 16..64 { + let a = words[i - 15]; + let b = words[i - 2]; + let small0 = a.rotate_right(7) ^ a.rotate_right(18) ^ (a >> 3); + let small1 = b.rotate_right(17) ^ b.rotate_right(19) ^ (b >> 10); + words[i] = words[i - 16] + .wrapping_add(small0) + .wrapping_add(words[i - 7]) + .wrapping_add(small1); + } + let initial = [ + 0x6a09e667_u32, + 0xbb67ae85, + 0x3c6ef372, + 0xa54ff53a, + 0x510e527f, + 0x9b05688c, + 0x1f83d9ab, + 0x5be0cd19, + ]; + let [mut a, mut b, mut c, mut d, mut e, mut f, mut g, mut h] = initial; + for i in 0..64 { + let sum1 = e.rotate_right(6) ^ e.rotate_right(11) ^ e.rotate_right(25); + let choice = (e & f) ^ (!e & g); + let t1 = h + .wrapping_add(sum1) + .wrapping_add(choice) + .wrapping_add(K[i]) + .wrapping_add(words[i]); + let sum0 = a.rotate_right(2) ^ a.rotate_right(13) ^ a.rotate_right(22); + let majority = (a & b) ^ (a & c) ^ (b & c); + let t2 = sum0.wrapping_add(majority); + h = g; + g = f; + f = e; + e = d.wrapping_add(t1); + d = c; + c = b; + b = a; + a = t1.wrapping_add(t2); + } + let first = a.wrapping_add(initial[0]).to_be_bytes(); + let second = b.wrapping_add(initial[1]).to_be_bytes(); + i64::from_le_bytes([ + first[0], first[1], first[2], first[3], second[0], second[1], second[2], second[3], + ]) +} diff --git a/crates/horizon-core/src/carving.rs b/crates/horizon-core/src/carving.rs new file mode 100644 index 000000000..e539203f3 --- /dev/null +++ b/crates/horizon-core/src/carving.rs @@ -0,0 +1,164 @@ +//! Packed carving masks and vanilla's ordered inclusive column segments. +mod ellipsoid; +pub use ellipsoid::{ + CarveError, CarverOutput, can_reach, carve_ellipsoid, carve_ellipsoid_with_budget, +}; + +/// A contiguous carved interval in a local chunk column. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct CarvingColumn { + pub x: i32, + pub z: i32, + pub min_y: i32, + pub max_y: i32, +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum CarvingMaskError { + InvalidBounds, + NegativeIndex, + Capacity, +} +impl std::fmt::Display for CarvingMaskError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(match self { + Self::InvalidBounds => "carving mask height must be between 1 and 4064", + Self::NegativeIndex => "carving mask index is negative", + Self::Capacity => "carving mask exceeds its bounded bit capacity", + }) + } +} +impl std::error::Error for CarvingMaskError {} + +/// Bits are contiguous in Y, then Z, then X. Coordinates retain Java's wrapping +/// index arithmetic and positive out-of-range aliases. Growth is capped at +/// 2^24 bits; valid chunk coordinates use at most 256 * 4064 bits. +#[derive(Clone, Debug)] +pub struct CarvingMask { + min_y: i32, + max_y: i32, + height: i32, + words: Vec, + used_words: usize, +} +impl CarvingMask { + pub fn new(min_y: i32, max_y: i32) -> Result { + let height = i64::from(max_y) - i64::from(min_y) + 1; + if !(1..=4064).contains(&height) { + return Err(CarvingMaskError::InvalidBounds); + } + Ok(Self { + min_y, + max_y, + height: height as i32, + words: vec![0; (height as usize * 256).div_ceil(64)], + used_words: 0, + }) + } + pub fn min_y(&self) -> i32 { + self.min_y + } + pub fn max_y(&self) -> i32 { + self.max_y + } + pub fn is_empty(&self) -> bool { + self.used_words == 0 + } + pub fn carve(&mut self, x: i32, y: i32, z: i32) -> Result<(), CarvingMaskError> { + let index = y + .wrapping_sub(self.min_y) + .wrapping_add(z.wrapping_add(x.wrapping_shl(4)).wrapping_mul(self.height)); + if index < 0 { + return Err(CarvingMaskError::NegativeIndex); + } + if index >= 1 << 24 { + return Err(CarvingMaskError::Capacity); + } + let index = index as usize; + let word = index / 64; + if word >= self.words.len() { + self.words.resize(word + 1, 0); + } + self.words[word] |= 1 << (index & 63); + self.used_words = self.used_words.max(word + 1); + Ok(()) + } + /// Traverse ascending packed runs, splitting each run at column boundaries. + /// No per-cell or per-column allocation is required. + pub fn columns(&self) -> impl Iterator + '_ { + let mut cursor = Cursor::default(); + std::iter::from_fn(move || cursor.next(self)) + } + /// Like vanilla's callback traversal, changes made by the visitor affect the + /// next run search, but do not change the already selected run's boundaries. + /// An error stops traversal immediately and retains visitor mutations. + pub fn try_visit_mut( + &mut self, + mut visitor: impl FnMut(&mut Self, CarvingColumn) -> Result<(), E>, + ) -> Result<(), E> { + let mut cursor = Cursor::default(); + while let Some(column) = cursor.next(self) { + visitor(self, column)?; + } + Ok(()) + } + fn next_set(&self, from: usize) -> Option { + let mut word = from / 64; + if word >= self.used_words { + return None; + } + let mut bits = self.words[word] & (u64::MAX << (from & 63)); + loop { + if bits != 0 { + return Some(word * 64 + bits.trailing_zeros() as usize); + } + word += 1; + if word == self.used_words { + return None; + } + bits = self.words[word]; + } + } + fn next_clear(&self, from: usize) -> usize { + let mut word = from / 64; + let mut bits = !self.words[word] & (u64::MAX << (from & 63)); + loop { + if bits != 0 { + return word * 64 + bits.trailing_zeros() as usize; + } + word += 1; + if word == self.used_words { + return word * 64; + } + bits = !self.words[word]; + } + } +} + +#[derive(Default)] +struct Cursor { + search: usize, + run: Option<(usize, usize, usize)>, +} +impl Cursor { + fn next(&mut self, mask: &CarvingMask) -> Option { + let height = mask.height as usize; + let (start, end, column) = match self.run { + Some(run) => run, + None => { + let start = mask.next_set(self.search)?; + let end = mask.next_clear(start) - 1; + self.search = end + 1; + (start, end, start / height) + } + }; + self.run = (column < end / height).then_some((start, end, column + 1)); + let base = column * height; + Some(CarvingColumn { + x: ((column >> 4) & 15) as i32, + z: (column & 15) as i32, + min_y: mask.min_y.wrapping_add(start.saturating_sub(base) as i32), + max_y: mask.min_y.wrapping_add((end - base).min(height - 1) as i32), + }) + } +} diff --git a/crates/horizon-core/src/carving/ellipsoid.rs b/crates/horizon-core/src/carving/ellipsoid.rs new file mode 100644 index 000000000..49b9d0e3a --- /dev/null +++ b/crates/horizon-core/src/carving/ellipsoid.rs @@ -0,0 +1,124 @@ +//! Shared cave/canyon ellipsoid traversal and path reachability. +use super::{CarvingMask, CarvingMaskError}; +use crate::{geometry::floor_i32, position::ChunkPos}; + +pub trait CarverOutput { + type Error; + fn min_y(&self) -> i32; + fn max_y(&self) -> i32; + fn carve(&mut self, x: i32, y: i32, z: i32) -> Result<(), Self::Error>; +} +impl CarverOutput for CarvingMask { + type Error = CarvingMaskError; + fn min_y(&self) -> i32 { + CarvingMask::min_y(self) + } + fn max_y(&self) -> i32 { + CarvingMask::max_y(self) + } + fn carve(&mut self, x: i32, y: i32, z: i32) -> Result<(), Self::Error> { + CarvingMask::carve(self, x, y, z) + } +} +#[derive(Debug, PartialEq, Eq)] +pub enum CarveError { + Output(E), + IterationLimit, +} +impl std::fmt::Display for CarveError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Output(e) => e.fmt(f), + Self::IterationLimit => f.write_str("carver traversal budget exhausted"), + } + } +} +impl std::error::Error for CarveError {} + +/// Tests a cave/canyon path against the target chunk's center. Thickness math +/// first rounds in float precision, while distances use doubles. +pub fn can_reach(chunk: ChunkPos, x: f64, z: f64, step: i32, end: i32, thickness: f32) -> bool { + let dx = x - f64::from(chunk.x.wrapping_shl(4).wrapping_add(8)); + let dz = z - f64::from(chunk.z.wrapping_shl(4).wrapping_add(8)); + let remaining = f64::from(end.wrapping_sub(step)); + let radius = f64::from((thickness + 2.) + 16.); + dx * dx + dz * dz - remaining * remaining <= radius * radius +} + +/// Visit candidate cells in X/Z/descending-Y order. The lower Y limit is +/// exclusive; normalized vertical coordinates use Y-0.5. The caller supplies +/// the cave/canyon skip predicate, which receives each candidate's absolute Y. +/// Failure retains previous output writes. Work is capped at 2^24 candidates. +pub fn carve_ellipsoid( + chunk: ChunkPos, + center: [f64; 3], + horizontal: f64, + vertical: f64, + output: &mut O, + skip: impl FnMut([f64; 3], i32) -> bool, +) -> Result<(), CarveError> { + carve_ellipsoid_with_budget( + chunk, + center, + horizontal, + vertical, + output, + skip, + &mut (1 << 24), + ) +} + +/// The same traversal with a shared candidate budget for a complete carver path. +/// Each tested cell consumes one unit, including cells rejected by the predicate. +pub fn carve_ellipsoid_with_budget( + chunk: ChunkPos, + [x, y, z]: [f64; 3], + horizontal: f64, + vertical: f64, + output: &mut O, + mut skip: impl FnMut([f64; 3], i32) -> bool, + remaining: &mut usize, +) -> Result<(), CarveError> { + let cx = chunk.x.wrapping_shl(4); + let cz = chunk.z.wrapping_shl(4); + let reach = 16. + horizontal * 2.; + if (x - f64::from(cx.wrapping_add(8))).abs() > reach + || (z - f64::from(cz.wrapping_add(8))).abs() > reach + { + return Ok(()); + } + let min_x = floor_i32(x - horizontal) + .wrapping_sub(cx) + .wrapping_sub(1) + .max(0); + let max_x = floor_i32(x + horizontal).wrapping_sub(cx).min(15); + let min_y = floor_i32(y - vertical).wrapping_sub(1).max(output.min_y()); + let max_y = floor_i32(y + vertical).wrapping_add(1).min(output.max_y()); + let min_z = floor_i32(z - horizontal) + .wrapping_sub(cz) + .wrapping_sub(1) + .max(0); + let max_z = floor_i32(z + horizontal).wrapping_sub(cz).min(15); + for lx in min_x..=max_x { + let nx = (f64::from(cx.wrapping_add(lx)) + 0.5 - x) / horizontal; + for lz in min_z..=max_z { + let nz = (f64::from(cz.wrapping_add(lz)) + 0.5 - z) / horizontal; + if nx * nx + nz * nz >= 1. { + continue; + } + let mut by = max_y; + while by > min_y { + if *remaining == 0 { + return Err(CarveError::IterationLimit); + } + *remaining -= 1; + let ny = (f64::from(by) - 0.5 - y) / vertical; + if !skip([nx, ny, nz], by) { + output.carve(lx, by, lz).map_err(CarveError::Output)?; + } + by -= 1; + } + } + } + Ok(()) +} diff --git a/crates/horizon-core/src/density/arithmetic.rs b/crates/horizon-core/src/density/arithmetic.rs new file mode 100644 index 000000000..296a071e8 --- /dev/null +++ b/crates/horizon-core/src/density/arithmetic.rs @@ -0,0 +1,248 @@ +use super::*; + +pub(super) fn java_power(base: f64, exponent: f64) -> f64 { + // Native libm can propagate a signaling NaN base even for exponent zero; + // Java returns one for every base in this case. + if exponent == 0.0 { + 1.0 + } else if exponent.is_nan() || (base.abs() == 1.0 && exponent.is_infinite()) { + f64::NAN + } else { + base.powf(exponent) + } +} + +pub(super) fn java_min(a: f32, b: f32) -> f32 { + if a.is_nan() || b.is_nan() { + f32::NAN + } else if a == 0.0 && b == 0.0 { + f32::from_bits(a.to_bits() | b.to_bits()) + } else if a <= b { + a + } else { + b + } +} +pub(super) fn java_max(a: f32, b: f32) -> f32 { + if a.is_nan() || b.is_nan() { + f32::NAN + } else if a == 0.0 && b == 0.0 { + f32::from_bits(a.to_bits() & b.to_bits()) + } else if a >= b { + a + } else { + b + } +} +fn clamp(value: f32, min: f32, max: f32) -> f32 { + if value < min { + min + } else { + java_min(value, max) + } +} + +/// Selected compiled unary samplers, including constant-operand specializations. +/// Graph compilation is implemented separately. +#[derive(Clone, Copy, Debug)] +pub enum UnaryOp { + Abs, + Negate, + Square, + Cube, + Sqrt, + Log, + PowerBase(f64), + PowerExponent(f64), + Reciprocal, + Sign, + Squeeze, + LeakyRelu(f32), + Add(f32), + SubtractFrom(f32), + Multiply(f32), + DivideInto(f32), + Minimum(f32), + Maximum(f32), + ConstantRangeChoice { + min_inclusive: f32, + max_exclusive: f32, + inside: f32, + outside: f32, + }, + Clamp { + min: f32, + max: f32, + }, +} +impl UnaryOp { + pub(super) fn apply(self, value: f32, bulk: bool) -> f32 { + match self { + Self::Abs => value.abs(), + Self::Negate => -value, + Self::Square => value * value, + Self::Cube => value * value * value, + Self::Sqrt => (value as f64).sqrt() as f32, + Self::Log => (value as f64).ln() as f32, + Self::PowerBase(base) => java_power(base, value as f64) as f32, + Self::PowerExponent(exponent) => java_power(value as f64, exponent) as f32, + Self::Reciprocal => 1.0 / value, + Self::Sign => { + if value == 0.0 || value.is_nan() { + value + } else { + value.signum() + } + } + Self::Squeeze => { + let v = clamp(value, -1.0, 1.0); + v / 2.0 - v * v * v / 24.0 + } + Self::LeakyRelu(factor) => { + if value > 0.0 { + value + } else { + value * factor + } + } + Self::Add(right) => value + right, + Self::SubtractFrom(left) => left - value, + Self::Multiply(right) => value * right, + Self::DivideInto(left) => left / value, + Self::Minimum(right) => { + if bulk { + if right < value { right } else { value } + } else { + java_min(value, right) + } + } + Self::Maximum(right) => { + if bulk { + if right > value { right } else { value } + } else { + java_max(value, right) + } + } + Self::Clamp { min, max } => clamp(value, min, max), + Self::ConstantRangeChoice { + min_inclusive, + max_exclusive, + inside, + outside, + } => { + if value >= min_inclusive && value < max_exclusive { + inside + } else { + outside + } + } + } + } +} +#[derive(Clone, Debug)] +pub struct UnarySampler { + pub input: Arc, + pub operation: UnaryOp, +} +impl DensitySampler for UnarySampler { + fn sample_value( + &self, + context: &mut SamplerContext, + position: [i32; 3], + ) -> Result { + Ok(self + .operation + .apply(self.input.sample_value(context, position)?, false)) + } + fn sample_volume( + &self, + context: &mut SamplerContext, + buffer: &mut [f32], + volume: DensityVolume, + ) -> Result<(), SampleError> { + check_buffer(buffer, volume)?; + self.input.sample_volume(context, buffer, volume)?; + for value in buffer { + *value = self.operation.apply(*value, true); + } + Ok(()) + } +} + +/// Range bounds are the values baked into vanilla's compiled min/max samplers. +/// Computing those bounds from a density graph is a separate compiler step. +#[derive(Clone, Copy, Debug)] +pub enum BinaryOp { + Add, + Subtract, + Multiply, + Divide, + Minimum { right_min: f32 }, + Maximum { right_max: f32 }, +} +impl BinaryOp { + fn apply(self, left: f32, right: f32, bulk: bool) -> f32 { + match self { + Self::Add => left + right, + Self::Subtract => left - right, + Self::Multiply => left * right, + Self::Divide => left / right, + Self::Minimum { .. } => { + if bulk { + if right < left { right } else { left } + } else { + java_min(left, right) + } + } + Self::Maximum { .. } => { + if bulk { + if right > left { right } else { left } + } else { + java_max(left, right) + } + } + } + } +} +#[derive(Clone, Debug)] +pub struct BinarySampler { + pub left: Arc, + pub right: Arc, + pub operation: BinaryOp, +} +impl DensitySampler for BinarySampler { + fn sample_value( + &self, + context: &mut SamplerContext, + position: [i32; 3], + ) -> Result { + let left = self.left.sample_value(context, position)?; + match self.operation { + BinaryOp::Multiply | BinaryOp::Divide if left == 0.0 => return Ok(0.0), + BinaryOp::Minimum { right_min } if left <= right_min => return Ok(left), + BinaryOp::Maximum { right_max } if left >= right_max => return Ok(left), + _ => {} + } + Ok(self + .operation + .apply(left, self.right.sample_value(context, position)?, false)) + } + fn sample_volume( + &self, + context: &mut SamplerContext, + buffer: &mut [f32], + volume: DensityVolume, + ) -> Result<(), SampleError> { + check_exact_buffer(buffer, volume)?; + // Vanilla reads a volume-sized temporary through every output index. + // Restrict this API to the valid equal-size case before invoking children. + self.left.sample_volume(context, buffer, volume)?; + context.with_buffer(volume.size(), |context, right| { + self.right.sample_volume(context, right, volume)?; + for (left, right) in buffer.iter_mut().zip(right) { + *left = self.operation.apply(*left, *right, true); + } + Ok(()) + }) + } +} diff --git a/crates/horizon-core/src/density/beardifier.rs b/crates/horizon-core/src/density/beardifier.rs new file mode 100644 index 000000000..225f74714 --- /dev/null +++ b/crates/horizon-core/src/density/beardifier.rs @@ -0,0 +1,214 @@ +//! Structure terrain adaptation from ordered rigid pieces and jigsaw junctions. +//! Discovery/filtering of live structure starts is a separate world subsystem. +use super::{DensitySampler, SampleError, SamplerContext, check_buffer}; +use crate::noise::DensityVolume; +use std::sync::OnceLock; + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct StructureBounds { + minimum: [i32; 3], + maximum: [i32; 3], +} +impl StructureBounds { + /// Already normalized inclusive bounds. Invalid inputs are rejected rather + /// than invoking vanilla's development-mode logging/repair path. + pub fn new(minimum: [i32; 3], maximum: [i32; 3]) -> Option { + (0..3) + .all(|axis| minimum[axis] <= maximum[axis]) + .then_some(Self { minimum, maximum }) + } + pub fn minimum(self) -> [i32; 3] { + self.minimum + } + pub fn maximum(self) -> [i32; 3] { + self.maximum + } + pub fn contains(self, position: [i32; 3]) -> bool { + (0..3).all(|i| position[i] >= self.minimum[i] && position[i] <= self.maximum[i]) + } + fn intersects(self, minimum: [i32; 3], maximum: [i32; 3]) -> bool { + (0..3).all(|i| self.maximum[i] >= minimum[i] && self.minimum[i] <= maximum[i]) + } +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum TerrainAdjustment { + None, + Bury, + BeardThin, + BeardBox, + Encapsulate, +} +#[derive(Clone, Copy, Debug)] +pub struct RigidPiece { + pub bounds: StructureBounds, + pub adjustment: TerrainAdjustment, + pub ground_level_delta: i32, +} +#[derive(Clone, Copy, Debug)] +pub struct JigsawJunction { + pub source_x: i32, + pub source_ground_y: i32, + pub source_z: i32, +} + +#[derive(Clone, Debug, Default)] +pub struct Beardifier { + pieces: Vec, + junctions: Vec, + affected: Option, +} +impl Beardifier { + /// Matches the runtime constructor. A missing affected box makes the entire + /// sampler empty, even when the supplied component lists are nonempty. + pub fn new( + pieces: Vec, + junctions: Vec, + affected: Option, + ) -> Self { + Self { + pieces, + junctions, + affected, + } + } + pub fn affected_bounds(&self) -> Option { + self.affected + } + fn sample_unchecked(&self, [x, y, z]: [i32; 3]) -> f32 { + let mut value = 0.; + for piece in &self.pieces { + let low = piece.bounds.minimum; + let high = piece.bounds.maximum; + let dx = 0.max(low[0].wrapping_sub(x).max(x.wrapping_sub(high[0]))); + let dz = 0.max(low[2].wrapping_sub(z).max(z.wrapping_sub(high[2]))); + let ground = low[1].wrapping_add(piece.ground_level_delta); + let dy = y.wrapping_sub(ground); + let distance_y = match piece.adjustment { + TerrainAdjustment::None => 0, + TerrainAdjustment::Bury | TerrainAdjustment::BeardThin => dy, + TerrainAdjustment::BeardBox => { + 0.max(ground.wrapping_sub(y).max(y.wrapping_sub(high[1]))) + } + TerrainAdjustment::Encapsulate => { + 0.max(low[1].wrapping_sub(y).max(y.wrapping_sub(high[1]))) + } + }; + value += match piece.adjustment { + TerrainAdjustment::None => 0., + TerrainAdjustment::Bury => bury(dx as f32, distance_y as f32 / 2., dz as f32), + TerrainAdjustment::BeardThin | TerrainAdjustment::BeardBox => { + beard(dx, distance_y, dz, dy) * 0.8 + } + TerrainAdjustment::Encapsulate => { + bury(dx as f32 / 2., distance_y as f32 / 2., dz as f32 / 2.) * 0.8 + } + }; + } + for junction in &self.junctions { + let dx = x.wrapping_sub(junction.source_x); + let dy = y.wrapping_sub(junction.source_ground_y); + let dz = z.wrapping_sub(junction.source_z); + value += beard(dx, dy, dz, dy) * 0.4; + } + value + } +} +impl DensitySampler for Beardifier { + fn sample_value(&self, _: &mut SamplerContext, position: [i32; 3]) -> Result { + Ok( + if self + .affected + .is_some_and(|bounds| bounds.contains(position)) + { + self.sample_unchecked(position) + } else { + 0. + }, + ) + } + fn sample_volume( + &self, + _: &mut SamplerContext, + buffer: &mut [f32], + volume: DensityVolume, + ) -> Result<(), SampleError> { + check_buffer(buffer, volume)?; + buffer.fill(0.); + let Some(bounds) = self.affected else { + return Ok(()); + }; + let minimum = volume.minimum(); + if !bounds.intersects(minimum, volume.maximum()) { + return Ok(()); + } + let steps = volume.steps(); + let sizes = volume.sizes(); + // Deliberately floor, not ceil: the first bulk lattice sample can lie + // below the affected bounds and is evaluated without the scalar guard. + let low: [i32; 3] = std::array::from_fn(|i| { + bounds.minimum[i] + .wrapping_sub(minimum[i]) + .max(0) + .div_euclid(steps[i]) + }); + let high: [i32; 3] = std::array::from_fn(|i| { + ((sizes[i] - 1) as i32).min( + bounds.maximum[i] + .wrapping_sub(minimum[i]) + .div_euclid(steps[i]), + ) + }); + for z in low[2]..=high[2] { + for x in low[0]..=high[0] { + for y in low[1]..=high[1] { + let index = volume + .index([x as usize, y as usize, z as usize]) + .expect("bounded structure density indices"); + let local = [x, y, z]; + let point = std::array::from_fn(|i| { + minimum[i].wrapping_add(local[i].wrapping_mul(steps[i])) + }); + buffer[index] = self.sample_unchecked(point); + } + } + } + Ok(()) + } +} +fn bury(x: f32, y: f32, z: f32) -> f32 { + let squared = (x * x + y * y) + z * z; + if squared >= 36. { + 0. + } else { + 1. - squared.sqrt() / 6. + } +} +fn beard(x: i32, y: i32, z: i32, ground_delta: i32) -> f32 { + let indices = [x, y, z].map(|v| v.wrapping_add(12)); + if indices.iter().any(|v| !(0..24).contains(v)) { + return 0.; + } + let vertical = ground_delta as f32 + 0.5; + let squared = (x as f32 * x as f32 + vertical * vertical) + z as f32 * z as f32; + let factor = (-vertical * fast_inverse_sqrt(f64::from(squared / 2.)) as f32) / 2.; + factor * kernel()[((indices[2] * 24 + indices[0]) * 24 + indices[1]) as usize] +} +fn fast_inverse_sqrt(value: f64) -> f64 { + let half = 0.5 * value; + let bits = 6_910_469_410_427_058_090i64.wrapping_sub((value.to_bits() as i64) >> 1); + let estimate = f64::from_bits(bits as u64); + estimate * (1.5 - half * estimate * estimate) +} +fn kernel() -> &'static [f32; 13824] { + static KERNEL: OnceLock<[f32; 13824]> = OnceLock::new(); + KERNEL.get_or_init(|| { + std::array::from_fn(|i| { + let z = (i / 576) as f64 - 12.; + let x = ((i / 24) % 24) as f64 - 12.; + let y = (i % 24) as f64 - 12. + 0.5; + let squared = (x * x + y * y) + z * z; + std::f64::consts::E.powf(-squared / 16.) as f32 + }) + }) +} diff --git a/crates/horizon-core/src/density/cache.rs b/crates/horizon-core/src/density/cache.rs new file mode 100644 index 000000000..8e5b46f44 --- /dev/null +++ b/crates/horizon-core/src/density/cache.rs @@ -0,0 +1,128 @@ +use super::*; +use crate::position::BlockPos; + +#[derive(Debug)] +pub(super) struct CacheCell { + volume: Option, + buffer: Vec, + value_key: i64, + value: f32, + active: bool, +} +impl Default for CacheCell { + fn default() -> Self { + Self { + volume: None, + buffer: Vec::new(), + value_key: 0, + value: f32::NAN, + active: false, + } + } +} +impl SamplerContext { + /// Cache cells belong to this evaluation context, never to shared samplers. + pub fn cached() -> Self { + Self { + caches: Some(Vec::new()), + ..Self::default() + } + } + pub fn clear_caches(&mut self) { + if let Some(caches) = &mut self.caches { + caches.clear(); + } + } + fn prepare_cache(&mut self, id: usize) -> Result { + let Some(caches) = &mut self.caches else { + return Ok(false); + }; + if id >= caches.len() { + caches.resize_with((id + 16) & !15, CacheCell::default); + } + if caches[id].active { + return Err(SampleError::RecursiveCache); + } + Ok(true) + } +} + +/// A compiled acyclic cache node. IDs are allocated by the graph compiler and +/// shared only for the same function. The bounded API accepts IDs 0..=65535. +#[derive(Clone, Debug)] +pub struct CachingDensitySampler { + id: usize, + input: Arc, +} +impl CachingDensitySampler { + pub fn new(id: usize, input: Arc) -> Result { + if id > 65535 { + return Err(SampleError::CacheIdOutOfRange); + } + Ok(Self { id, input }) + } + pub fn id(&self) -> usize { + self.id + } +} +impl DensitySampler for CachingDensitySampler { + fn sample_value( + &self, + context: &mut SamplerContext, + position: [i32; 3], + ) -> Result { + if !context.prepare_cache(self.id)? { + return self.input.sample_value(context, position); + } + let key = BlockPos::new(position[0], position[1], position[2]).pack(); + let cell = &mut context.caches.as_mut().unwrap()[self.id]; + if cell.value_key == key && !cell.value.is_nan() { + return Ok(cell.value); + } + if let Some(volume) = cell.volume { + if let Some(index) = volume.index_of_block(position) { + return Ok(cell.buffer[index]); + } + } + cell.active = true; + let result = self.input.sample_value(context, position); + let cell = &mut context.caches.as_mut().unwrap()[self.id]; + cell.active = false; + if let Ok(value) = result { + cell.value_key = key; + cell.value = value; + } + result + } + fn sample_volume( + &self, + context: &mut SamplerContext, + buffer: &mut [f32], + volume: DensityVolume, + ) -> Result<(), SampleError> { + check_buffer(buffer, volume)?; + if !context.prepare_cache(self.id)? { + return self.input.sample_volume(context, buffer, volume); + } + check_exact_buffer(buffer, volume)?; + let cell = &mut context.caches.as_mut().unwrap()[self.id]; + if cell.volume == Some(volume) { + buffer.copy_from_slice(&cell.buffer); + return Ok(()); + } + let mut cached = std::mem::take(&mut cell.buffer); + cached.resize(volume.size(), 0.0); + // Unwritten values after a failed child are deterministic. Differential + // error tests use a reference arena with the same zero-initialization. + cached.fill(0.0); + cell.volume = Some(volume); + cell.active = true; + let result = self.input.sample_volume(context, &mut cached, volume); + let cell = &mut context.caches.as_mut().unwrap()[self.id]; + cell.active = false; + cell.buffer = cached; + result?; + buffer.copy_from_slice(&cell.buffer); + Ok(()) + } +} diff --git a/crates/horizon-core/src/density/end_islands.rs b/crates/horizon-core/src/density/end_islands.rs new file mode 100644 index 000000000..148f3575d --- /dev/null +++ b/crates/horizon-core/src/density/end_islands.rs @@ -0,0 +1,79 @@ +use super::*; +use crate::{ + noise::SimplexNoise, + random::{LegacyRandom, RandomSource}, +}; + +/// Java Edition 26.3's outer End island density. The center island is supplied +/// by the surrounding terrain graph, rather than by this sampler. +#[derive(Clone, Debug)] +pub struct EndIslandSampler { + noise: SimplexNoise, +} +impl EndIslandSampler { + pub fn new(world_seed: i64) -> Self { + let mut random = LegacyRandom::new(world_seed); + random.consume_count(17_292); + Self { + noise: SimplexNoise::with_skipped_offsets(&mut random, true), + } + } + fn height(&self, x: i32, z: i32) -> f32 { + // These divisions and remainders truncate toward zero, including for + // negative coordinates. They are not block/chunk floor conversions. + let center_x = x / 2; + let center_z = z / 2; + let local_x = x % 2; + let local_z = z % 2; + let mut height = -100.0; + for offset_x in -12_i32..=12 { + for offset_z in -12_i32..=12 { + let island_x = i64::from(center_x.wrapping_add(offset_x)); + let island_z = i64::from(center_z.wrapping_add(offset_z)); + if island_x * island_x + island_z * island_z <= 4096 + || self.noise.get2(island_x as f64, island_z as f64) >= -0.9 + { + continue; + } + let scale = ((island_x as f32).abs() * 3439.0 + (island_z as f32).abs() * 147.0) + % 13.0 + + 9.0; + let dx = (local_x - offset_x * 2) as f32; + let dz = (local_z - offset_z * 2) as f32; + let candidate = 100.0 - ((dx * dx + dz * dz) as f64).sqrt() as f32 * scale; + let candidate = super::arithmetic::java_min( + super::arithmetic::java_max(candidate, -100.0), + 80.0, + ); + height = super::arithmetic::java_max(height, candidate); + } + } + height + } + fn density(&self, x: i32, z: i32) -> f32 { + (self.height(x / 8, z / 8) - 8.0) / 128.0 + } +} +impl DensitySampler for EndIslandSampler { + fn sample_value(&self, _: &mut SamplerContext, position: [i32; 3]) -> Result { + Ok(self.density(position[0], position[2])) + } + fn sample_volume( + &self, + _: &mut SamplerContext, + buffer: &mut [f32], + volume: DensityVolume, + ) -> Result<(), SampleError> { + check_buffer(buffer, volume)?; + let [sx, sy, sz] = volume.sizes(); + for z in 0..sz { + let block_z = volume.block(Axis::Z, z).unwrap(); + for x in 0..sx { + let value = self.density(volume.block(Axis::X, x).unwrap(), block_z); + let start = (x + z * sx) * sy; + buffer[start..start + sy].fill(value); + } + } + Ok(()) + } +} diff --git a/crates/horizon-core/src/density/graph/compiler.rs b/crates/horizon-core/src/density/graph/compiler.rs new file mode 100644 index 000000000..53d8fe2eb --- /dev/null +++ b/crates/horizon-core/src/density/graph/compiler.rs @@ -0,0 +1,498 @@ +use super::*; + +/// A compiler and cache-ID namespace for one immutable set of density inputs. +/// Share resulting samplers across workers, with a separate SamplerContext per +/// worker. Context cache cells must not be reused across compiler namespaces. +#[derive(Debug)] +pub struct DensityCompiler { + graph: DensityGraph, + samplers: HashMap>, + prepared: HashMap, + next_cache: usize, + context: Option, +} +impl DensityCompiler { + pub fn new(graph: DensityGraph) -> Self { + Self { + graph, + samplers: HashMap::new(), + prepared: HashMap::new(), + next_cache: 0, + context: None, + } + } + pub fn new_seeded(graph: DensityGraph, seed: i64, use_legacy_random: bool) -> Self { + let mut compiler = Self::new(graph); + compiler.context = Some(seeded::SeededContext::new(seed, use_legacy_random)); + compiler + } + pub fn graph(&self) -> &DensityGraph { + &self.graph + } + pub fn graph_mut(&mut self) -> &mut DensityGraph { + &mut self.graph + } + pub fn cache_count(&self) -> usize { + self.next_cache + } + /// Resolve a registered noise using this compiler's fixed world seed. + /// Ordinary names reuse their sampler; Nether biome compatibility names + /// create a fresh sampler from their dedicated legacy seed on each call. + pub fn get_noise_sampler(&self, noise: NoiseId) -> Result, CompileError> { + self.context + .as_ref() + .ok_or(CompileError::MissingSeededContext)? + .noise(&self.graph, noise) + } + pub fn get_sampler(&mut self, id: FunctionId) -> Result, CompileError> { + if let Some(sampler) = self.samplers.get(&id) { + return Ok(sampler.clone()); + } + let optimized = self.optimize(id)?; + let sampler = self.compile_raw(optimized)?; + self.samplers.insert(id, sampler.clone()); + Ok(sampler) + } + fn rewrite_children( + &mut self, + id: FunctionId, + mut rewrite: impl FnMut(&mut Self, FunctionId) -> Result, + ) -> Result { + let Definition::Node(mut node) = self.graph.entry(id)?.definition.clone() else { + return Ok(id); + }; + if let GraphNode::Reference { input, .. } = node { + let rewritten = rewrite(self, input)?; + return Ok(if rewritten == input { id } else { rewritten }); + } + for child in node.children_mut() { + *child = rewrite(self, *child)?; + } + self.graph.insert(node) + } + fn optimize(&mut self, id: FunctionId) -> Result { + let prepared = self.prepare(id)?; + self.slice_uniform_axes(prepared, 7) + } + fn prepare(&mut self, mut id: FunctionId) -> Result { + // Vanilla INLINE_REFERENCE unwraps one holder before detecting caches. + // Nested holders still follow their own rewriteChildren identity rule. + if let Definition::Node(GraphNode::Reference { input, .. }) = + self.graph.entry(id)?.definition + { + id = input; + } + if let Definition::Node(GraphNode::Cache(input)) = self.graph.entry(id)?.definition.clone() + { + if let Some(prepared) = self.prepared.get(&input) { + return Ok(*prepared); + } + let cache_id = self.next_cache; + self.next_cache += 1; + let optimized = self.optimize(input)?; + let sampler = self.compile_raw(optimized)?; + let sampler = Arc::new(CachingDensitySampler::new(cache_id, sampler)?); + let range = self.graph.range(optimized)?; + let axes = self.graph.domain_axes(optimized)?; + let prepared = self.graph.bind(sampler, range, axes)?; + self.prepared.insert(input, prepared); + return Ok(prepared); + } + self.rewrite_children(id, Self::prepare) + } + fn slice_uniform_axes( + &mut self, + id: FunctionId, + parent_axes: u8, + ) -> Result { + if matches!( + self.graph.entry(id)?.definition, + Definition::Node(GraphNode::Constant(_) | GraphNode::Gradient { .. }) + ) { + return Ok(id); + } + let axes = self.graph.domain_axes(id)?; + let mut result = self.rewrite_children(id, |compiler, child| { + compiler.slice_uniform_axes(child, axes) + })?; + if axes == parent_axes { + return Ok(result); + } + let mut existing = 0; + let mut cursor = result; + while let Definition::Node(GraphNode::Slice { axis, input, .. }) = + self.graph.entry(cursor)?.definition + { + existing |= 1 << axis as u8; + cursor = input; + } + let remove = parent_axes & !axes & !existing; + // X then Z places these slices adjacent for the XZ sampler specialization. + for axis in [Axis::X, Axis::Z, Axis::Y] { + if remove & (1 << axis as u8) != 0 { + result = self.graph.insert(GraphNode::Slice { + axis, + coordinate: 0, + input: result, + })?; + } + } + Ok(result) + } + fn constant(&self, id: FunctionId) -> Option { + match self.graph.entries[id.0].definition { + Definition::Node(GraphNode::Constant(value)) => Some(value), + _ => None, + } + } + /// Compile exactly the supplied definition, without rewriting. Cache nodes + /// require get_sampler's preparation pass and are rejected here. + pub fn compile_raw(&self, id: FunctionId) -> Result, CompileError> { + let node = match &self.graph.entry(id)?.definition { + Definition::Bound { sampler, .. } => return Ok(sampler.clone()), + Definition::Node(node) => node, + }; + let sampler: Arc = match *node { + GraphNode::Constant(value) => Arc::new(ConstantSampler(value)), + GraphNode::Reference { input, .. } => self.compile_raw(input)?, + GraphNode::WorldField(field) => Arc::new(ContextBoundSampler::new(field)), + GraphNode::BlendDensity(input) => Arc::new(BlendDensitySampler { + input: self.compile_raw(input)?, + }), + GraphNode::EndIslands => self + .context + .as_ref() + .ok_or(CompileError::MissingSeededContext)? + .end_islands(), + GraphNode::Noise { + noise, + xz_scale, + y_scale, + shift_x, + shift_y, + shift_z, + } => { + let noise = self + .context + .as_ref() + .ok_or(CompileError::MissingSeededContext)? + .noise(&self.graph, noise)?; + let zero = |id: FunctionId| matches!(self.graph.entries[id.0].definition, Definition::Node(GraphNode::Constant(value)) if value.to_bits() == 0); + if zero(shift_x) && zero(shift_y) && zero(shift_z) { + Arc::new(NoiseSampler { + noise, + xz_scale, + y_scale, + }) + } else { + // Compilation order differs from the XYZ sampler's sampling + // order: vanilla compiles X, then Z, then optional Y. + let x = self.compile_raw(shift_x)?; + let z = self.compile_raw(shift_z)?; + let y = if zero(shift_y) { + None + } else { + Some(self.compile_raw(shift_y)?) + }; + Arc::new(ShiftedNoiseSampler { + source: NoiseSampler { + noise, + xz_scale, + y_scale, + }, + shift_x: x, + shift_y: y, + shift_z: z, + }) + } + } + GraphNode::OffsetNoise { noise, kind } => compile_shift_noise( + self.context + .as_ref() + .ok_or(CompileError::MissingSeededContext)? + .noise(&self.graph, noise)?, + kind, + ), + GraphNode::BlendedNoise(definition) => self + .context + .as_ref() + .ok_or(CompileError::MissingSeededContext)? + .blended(definition)?, + GraphNode::Spline(ref spline) => { + let mut ids = HashMap::new(); + let mut coordinates = Vec::new(); + let compiled = spline.try_map_coordinates(&mut |id| { + if let Some(index) = ids.get(&id) { + return Ok::(*index); + } + let sampler = self.compile_raw(id)?; + // Vanilla validates each unique coordinate range immediately + // after compiling it, even if sampling never selects it. + self.graph.range(id)?; + let index = coordinates.len(); + coordinates.push(sampler); + ids.insert(id, index); + Ok(index) + })?; + Arc::new(SplineSampler::new(&compiled, &coordinates)?) + } + GraphNode::DistanceToPoint { point, metric } => { + Arc::new(DistanceToPointSampler { point, metric }) + } + GraphNode::IntervalSelect { + input, + ref thresholds, + ref branches, + } => { + let input = self.compile_raw(input)?; + let branches = branches + .iter() + .map(|id| self.compile_raw(*id)) + .collect::, _>>()?; + Arc::new( + IntervalSelectSampler::new(input, thresholds.to_vec(), branches) + .map_err(|_| CompileError::InvalidIntervals)?, + ) + } + GraphNode::Gradient { + axis, + tiling, + from, + to, + low, + high, + } => Arc::new(GradientSampler::new(axis, tiling, from, to, low, high)), + GraphNode::Unary { kind, input } => Arc::new(UnarySampler { + input: self.compile_raw(input)?, + operation: kind.operation(), + }), + GraphNode::Round { + mode, + input, + multiple, + } => { + let input = self.compile_raw(input)?; + let multiple = if self.constant(multiple) == Some(1.0) { + None + } else { + Some(self.compile_raw(multiple)?) + }; + Arc::new(RoundSampler { + mode, + input, + multiple, + }) + } + GraphNode::Power { base, exponent } => { + // Both children compile before literal selection, even when one + // compiled child will be discarded by the specialization. + let compiled_base = self.compile_raw(base)?; + let compiled_exponent = self.compile_raw(exponent)?; + if let Some(value) = self.constant(base) { + Arc::new(UnarySampler { + input: compiled_exponent, + operation: UnaryOp::PowerBase(value as f64), + }) + } else if let Some(value) = self.constant(exponent) { + compile_constant_exponent(compiled_base, value) + } else { + Arc::new(PowerSampler { + base: compiled_base, + exponent: compiled_exponent, + }) + } + } + GraphNode::Binary { kind, left, right } => { + return self.compile_binary(kind, left, right); + } + GraphNode::Clamp { input, min, max } => Arc::new(UnarySampler { + input: self.compile_raw(input)?, + operation: UnaryOp::Clamp { min, max }, + }), + GraphNode::Choice { + input, + min, + max, + inside, + outside, + } => { + let input = self.compile_raw(input)?; + if let (Some(inside), Some(outside)) = + (self.constant(inside), self.constant(outside)) + { + Arc::new(UnarySampler { + input, + operation: UnaryOp::ConstantRangeChoice { + min_inclusive: min, + max_exclusive: max, + inside, + outside, + }, + }) + } else { + Arc::new(RangeChoiceSampler { + input, + min_inclusive: min, + max_exclusive: max, + when_in_range: self.compile_raw(inside)?, + when_out_of_range: self.compile_raw(outside)?, + }) + } + } + GraphNode::Lerp { + alpha, + first, + second, + } => { + let alpha = self.compile_raw(alpha)?; + let first_sampler = self.compile_raw(first)?; + let second_sampler = self.compile_raw(second)?; + let (first, second) = if let Some(value) = self.constant(first) { + ( + DensityValue::Constant(value), + DensityValue::Sampler(second_sampler), + ) + } else if let Some(value) = self.constant(second) { + ( + DensityValue::Sampler(first_sampler), + DensityValue::Constant(value), + ) + } else { + ( + DensityValue::Sampler(first_sampler), + DensityValue::Sampler(second_sampler), + ) + }; + Arc::new(LerpSampler { + alpha, + first, + second, + }) + } + GraphNode::Slice { + axis, + coordinate, + input, + } => { + let mut axes = match axis { + Axis::X => SliceAxes::X(coordinate), + Axis::Y => SliceAxes::Y(coordinate), + Axis::Z => SliceAxes::Z(coordinate), + }; + let mut child = input; + if let Definition::Node(GraphNode::Slice { + axis: inner_axis, + coordinate: inner_coordinate, + input: inner, + }) = self.graph.entry(input)?.definition + { + if axis == Axis::X && inner_axis == Axis::Z { + axes = SliceAxes::Xz { + x: coordinate, + z: inner_coordinate, + }; + child = inner; + } else if axis == Axis::Z && inner_axis == Axis::X { + axes = SliceAxes::Xz { + x: inner_coordinate, + z: coordinate, + }; + child = inner; + } + } + Arc::new(SliceSampler { + axes, + input: self.compile_raw(child)?, + }) + } + GraphNode::Cache(_) => return Err(CompileError::UnpreparedCache), + GraphNode::Interpolated { input, xz, y } => { + Arc::new(InterpolatedSampler::new(self.compile_raw(input)?, xz, y)?) + } + GraphNode::Surface { + density, + upper, + lower, + height, + } => Arc::new(compile_surface_search( + self.compile_raw(density)?, + self.compile_raw(upper)?, + lower, + height, + )?), + }; + Ok(sampler) + } + fn compile_binary( + &self, + kind: GraphBinary, + left_id: FunctionId, + right_id: FunctionId, + ) -> Result, CompileError> { + let left = self.compile_raw(left_id)?; + let right = self.compile_raw(right_id)?; + let unary = |input, operation| { + Arc::new(UnarySampler { input, operation }) as Arc + }; + let bounds = if matches!(kind, GraphBinary::Minimum | GraphBinary::Maximum) { + let a = self.graph.range(left_id)?; + let b = self.graph.range(right_id)?; + if (kind == GraphBinary::Minimum && a.max() < b.min()) + || (kind == GraphBinary::Maximum && a.min() > b.max()) + { + return Ok(left); + } + if (kind == GraphBinary::Minimum && b.max() < a.min()) + || (kind == GraphBinary::Maximum && b.min() > a.max()) + { + return Ok(right); + } + Some(b) + } else { + None + }; + if let Some(value) = self.constant(left_id) { + return Ok(unary( + right, + match kind { + GraphBinary::Add => UnaryOp::Add(value), + GraphBinary::Subtract => UnaryOp::SubtractFrom(value), + GraphBinary::Multiply => UnaryOp::Multiply(value), + GraphBinary::Divide => UnaryOp::DivideInto(value), + GraphBinary::Minimum => UnaryOp::Minimum(value), + GraphBinary::Maximum => UnaryOp::Maximum(value), + }, + )); + } + if let Some(value) = self.constant(right_id) { + return Ok(unary( + left, + match kind { + GraphBinary::Add => UnaryOp::Add(value), + GraphBinary::Subtract => UnaryOp::Add(-value), + GraphBinary::Multiply => UnaryOp::Multiply(value), + GraphBinary::Divide => UnaryOp::Multiply(1.0 / value), + GraphBinary::Minimum => UnaryOp::Minimum(value), + GraphBinary::Maximum => UnaryOp::Maximum(value), + }, + )); + } + let operation = match kind { + GraphBinary::Add => BinaryOp::Add, + GraphBinary::Subtract => BinaryOp::Subtract, + GraphBinary::Multiply => BinaryOp::Multiply, + GraphBinary::Divide => BinaryOp::Divide, + GraphBinary::Minimum => BinaryOp::Minimum { + right_min: bounds.unwrap().min(), + }, + GraphBinary::Maximum => BinaryOp::Maximum { + right_max: bounds.unwrap().max(), + }, + }; + Ok(Arc::new(BinarySampler { + left, + right, + operation, + })) + } +} diff --git a/crates/horizon-core/src/density/graph/mod.rs b/crates/horizon-core/src/density/graph/mod.rs new file mode 100644 index 000000000..8eefe2d1d --- /dev/null +++ b/crates/horizon-core/src/density/graph/mod.rs @@ -0,0 +1,712 @@ +//! Immutable density definitions and the first integrated compiler operations. +//! Seeded noise registration is supported; serialized codecs and remaining +//! function kinds are pending. +use super::*; +use std::collections::HashMap; +mod compiler; +mod seeded; +#[cfg(test)] +mod tests; +pub use compiler::DensityCompiler; + +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] +pub struct FunctionId(usize); +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] +pub struct NoiseId(usize); +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] +pub struct HolderId(usize); + +#[derive(Clone, Copy, Debug)] +pub enum GraphUnary { + Abs, + Square, + Cube, + HalfNegative, + QuarterNegative, + Reciprocal, + Negate, + Squeeze, + Sign, + Log, + Sqrt, +} +impl GraphUnary { + fn operation(self) -> UnaryOp { + match self { + Self::Abs => UnaryOp::Abs, + Self::Square => UnaryOp::Square, + Self::Cube => UnaryOp::Cube, + Self::HalfNegative => UnaryOp::LeakyRelu(0.5), + Self::QuarterNegative => UnaryOp::LeakyRelu(0.25), + Self::Reciprocal => UnaryOp::Reciprocal, + Self::Negate => UnaryOp::Negate, + Self::Squeeze => UnaryOp::Squeeze, + Self::Sign => UnaryOp::Sign, + Self::Log => UnaryOp::Log, + Self::Sqrt => UnaryOp::Sqrt, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum GraphBinary { + Add, + Subtract, + Multiply, + Divide, + Minimum, + Maximum, +} + +/// References belong to the graph that creates them. New nodes may refer only +/// to existing immutable nodes, keeping the definition graph acyclic. +#[derive(Clone, Debug)] +pub enum GraphNode { + Constant(f32), + Spline(CubicSpline), + Noise { + noise: NoiseId, + xz_scale: f64, + y_scale: f64, + shift_x: FunctionId, + shift_y: FunctionId, + shift_z: FunctionId, + }, + OffsetNoise { + noise: NoiseId, + kind: ShiftNoiseKind, + }, + BlendedNoise(BlendedNoise), + EndIslands, + WorldField(WorldField), + BlendDensity(FunctionId), + /// A direct holder compares by value; a registry holder by identity. + Reference { + input: FunctionId, + holder: Option, + }, + Gradient { + axis: Axis, + tiling: TilingMode, + from: i32, + to: i32, + low: f32, + high: f32, + }, + Unary { + kind: GraphUnary, + input: FunctionId, + }, + Binary { + kind: GraphBinary, + left: FunctionId, + right: FunctionId, + }, + Round { + mode: RoundMode, + input: FunctionId, + multiple: FunctionId, + }, + Power { + base: FunctionId, + exponent: FunctionId, + }, + Clamp { + input: FunctionId, + min: f32, + max: f32, + }, + Choice { + input: FunctionId, + min: f32, + max: f32, + inside: FunctionId, + outside: FunctionId, + }, + Lerp { + alpha: FunctionId, + first: FunctionId, + second: FunctionId, + }, + Slice { + axis: Axis, + coordinate: i32, + input: FunctionId, + }, + Cache(FunctionId), + Interpolated { + input: FunctionId, + xz: i32, + y: i32, + }, + Surface { + density: FunctionId, + upper: FunctionId, + lower: i32, + height: i32, + }, + IntervalSelect { + input: FunctionId, + thresholds: Arc<[f32]>, + branches: Vec, + }, + DistanceToPoint { + point: [i32; 3], + metric: DistanceMetric, + }, +} +impl GraphNode { + fn children_mut(&mut self) -> Vec<&mut FunctionId> { + match self { + Self::Spline(spline) => spline.coordinates_mut(), + Self::Constant(_) + | Self::Gradient { .. } + | Self::DistanceToPoint { .. } + | Self::OffsetNoise { .. } + | Self::BlendedNoise(_) + | Self::EndIslands + | Self::WorldField(_) => vec![], + Self::Noise { + shift_x, + shift_y, + shift_z, + .. + } => vec![shift_x, shift_y, shift_z], + Self::Reference { input, .. } + | Self::Unary { input, .. } + | Self::Clamp { input, .. } + | Self::Slice { input, .. } + | Self::Cache(input) + | Self::BlendDensity(input) + | Self::Interpolated { input, .. } => vec![input], + Self::Binary { left, right, .. } => vec![left, right], + Self::Round { + input, multiple, .. + } => vec![input, multiple], + Self::Power { base, exponent } => vec![base, exponent], + Self::Choice { + input, + inside, + outside, + .. + } => vec![input, inside, outside], + Self::Lerp { + alpha, + first, + second, + } => vec![alpha, first, second], + Self::Surface { density, upper, .. } => vec![density, upper], + Self::IntervalSelect { + input, branches, .. + } => std::iter::once(input).chain(branches.iter_mut()).collect(), + } + } + fn key(&self) -> Vec { + let f = |v: f32| u64::from(if v.is_nan() { 0x7fc0_0000 } else { v.to_bits() }); + let i = |v: i32| u64::from(v as u32); + let d = |v: f64| { + if v.is_nan() { + 0x7ff8_0000_0000_0000 + } else { + v.to_bits() + } + }; + let id = |v: FunctionId| v.0 as u64; + match *self { + Self::Reference { input, holder } => match holder { + Some(holder) => vec![22, 1, holder.0 as u64], + None => vec![22, 0, id(input)], + }, + Self::EndIslands => vec![17], + Self::WorldField(field) => vec![20, field as u64], + Self::BlendDensity(input) => vec![21, id(input)], + Self::Power { base, exponent } => vec![19, id(base), id(exponent)], + Self::Round { + mode, + input, + multiple, + } => vec![18, mode as u64, id(input), id(multiple)], + Self::Noise { + noise, + xz_scale, + y_scale, + shift_x, + shift_y, + shift_z, + } => vec![ + 14, + noise.0 as u64, + d(xz_scale), + d(y_scale), + id(shift_x), + id(shift_y), + id(shift_z), + ], + Self::OffsetNoise { noise, kind } => vec![15, noise.0 as u64, kind as u64], + Self::BlendedNoise(v) => vec![ + 16, + d(v.xz_scale), + d(v.y_scale), + d(v.xz_factor), + d(v.y_factor), + d(v.smear_scale_multiplier), + ], + Self::Spline(ref spline) => { + fn append(spline: &CubicSpline, key: &mut Vec) { + let bits = + |v: f32| u64::from(if v.is_nan() { 0x7fc0_0000 } else { v.to_bits() }); + match spline { + CubicSpline::Constant(value) => key.extend([0, bits(*value)]), + CubicSpline::Multipoint(node) => { + key.extend([1, node.coordinate.0 as u64, node.points.len() as u64]); + for point in &node.points { + key.extend([bits(point.location), bits(point.derivative)]); + append(&point.value, key); + } + } + } + } + let mut key = vec![13]; + append(spline, &mut key); + key + } + Self::Constant(v) => vec![0, f(v)], + Self::Gradient { + axis, + tiling, + from, + to, + low, + high, + } => vec![ + 1, + axis as u64, + tiling as u64, + i(from), + i(to), + f(low), + f(high), + ], + Self::Unary { kind, input } => vec![2, kind as u64, id(input)], + Self::Binary { kind, left, right } => vec![3, kind as u64, id(left), id(right)], + Self::Clamp { input, min, max } => vec![4, id(input), f(min), f(max)], + Self::Choice { + input, + min, + max, + inside, + outside, + } => vec![5, id(input), f(min), f(max), id(inside), id(outside)], + Self::Lerp { + alpha, + first, + second, + } => vec![6, id(alpha), id(first), id(second)], + Self::Slice { + axis, + coordinate, + input, + } => vec![7, axis as u64, i(coordinate), id(input)], + Self::Cache(input) => vec![8, id(input)], + Self::Interpolated { input, xz, y } => vec![9, id(input), i(xz), i(y)], + Self::Surface { + density, + upper, + lower, + height, + } => vec![10, id(density), id(upper), i(lower), i(height)], + Self::IntervalSelect { + input, + ref thresholds, + ref branches, + } => { + let mut key = vec![11, id(input), thresholds.len() as u64]; + key.push(if thresholds.iter().any(|v| v.is_nan()) { + Arc::as_ptr(thresholds) as *const f32 as usize as u64 + } else { + 0 + }); + key.extend(thresholds.iter().map(|v| if *v == 0.0 { 0 } else { f(*v) })); + key.extend(branches.iter().copied().map(id)); + key + } + Self::DistanceToPoint { point, metric } => { + vec![12, i(point[0]), i(point[1]), i(point[2]), metric as u64] + } + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum CompileError { + UnknownFunction, + NestingTooDeep, + InvalidAxes, + UnpreparedCache, + InvalidIntervals, + UnknownNoise, + DuplicateNoise, + DuplicateFunction, + UnknownHolder, + MissingSeededContext, + PoisonedNoiseCache, + Noise(crate::noise::NoiseBuildError), + Spline(SplineError), + Range(IntervalError), + Sample(SampleError), +} +impl From for CompileError { + fn from(e: IntervalError) -> Self { + Self::Range(e) + } +} +impl From for CompileError { + fn from(e: SampleError) -> Self { + Self::Sample(e) + } +} +impl From for CompileError { + fn from(e: SplineError) -> Self { + Self::Spline(e) + } +} +impl From for CompileError { + fn from(e: crate::noise::NoiseBuildError) -> Self { + Self::Noise(e) + } +} +impl std::fmt::Display for CompileError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "density graph compilation failed: {self:?}") + } +} +impl std::error::Error for CompileError {} + +#[derive(Clone, Debug)] +enum Definition { + Node(GraphNode), + Bound { + sampler: Arc, + range: Interval, + axes: u8, + }, +} +#[derive(Clone, Debug)] +struct Entry { + definition: Definition, + depth: usize, + equality_id: FunctionId, + hash_variant: bool, +} +#[derive(Clone, Debug, Default)] +pub struct DensityGraph { + entries: Vec, + interned: HashMap<(Vec, bool), FunctionId>, + equal: HashMap, FunctionId>, + noises: Vec, + noise_names: HashMap, + holders: Vec, + function_names: HashMap, +} +impl DensityGraph { + pub fn new() -> Self { + Self::default() + } + pub fn insert(&mut self, node: GraphNode) -> Result { + if let GraphNode::Reference { + input, + holder: Some(holder), + } = node + { + if self.holders.get(holder.0) != Some(&input) { + return Err(CompileError::UnknownHolder); + } + } + if let GraphNode::Noise { noise, .. } | GraphNode::OffsetNoise { noise, .. } = node { + self.noise_entry(noise)?; + } + if let GraphNode::IntervalSelect { + thresholds, + branches, + .. + } = &node + { + if branches.len() != thresholds.len().saturating_add(1) || branches.len() > 256 { + return Err(CompileError::InvalidIntervals); + } + } + // Fastutil threshold lists compare zeros numerically but hash their + // signed bits. Among equal definitions, the only possible hash delta + // is 0x80000000. Java record/list hashes use odd (31) multipliers, so + // these deltas XOR through children and cancel in pairs. Keep equality + // classes separate from this hash variant to reproduce Java map reuse, + // including equal parents whose differing child hashes cancel. + let mut hash_variant = match &node { + GraphNode::IntervalSelect { thresholds, .. } => { + thresholds + .iter() + .filter(|v| v.to_bits() == 0x8000_0000) + .count() + % 2 + != 0 + } + _ => false, + }; + let mut canonical = node.clone(); + let mut depth = if let GraphNode::Spline(spline) = &node { + fn spline_depth( + spline: &CubicSpline, + graph: &DensityGraph, + ) -> Result { + Ok(match spline { + CubicSpline::Constant(_) => 0, + CubicSpline::Multipoint(node) => { + let mut depth = graph.entry(node.coordinate)?.depth; + for point in &node.points { + depth = depth.max(spline_depth(&point.value, graph)?); + } + depth + 1 + } + }) + } + spline_depth(spline, self)? + 1 + } else { + 1 + }; + for child in canonical.children_mut() { + let entry = self.entry(*child)?; + depth = depth.max(entry.depth + 1); + // Registry references hash their holder identity, not its value. + if !matches!( + node, + GraphNode::Reference { + holder: Some(_), + .. + } + ) { + hash_variant ^= entry.hash_variant; + } + *child = entry.equality_id; + } + let key = canonical.key(); + if let Some(id) = self.interned.get(&(key.clone(), hash_variant)) { + return Ok(*id); + } + if depth > 256 { + return Err(CompileError::NestingTooDeep); + } + let id = FunctionId(self.entries.len()); + let equality_id = *self.equal.entry(key.clone()).or_insert(id); + self.entries.push(Entry { + definition: Definition::Node(node), + depth, + equality_id, + hash_variant, + }); + self.interned.insert((key, hash_variant), id); + Ok(id) + } + /// Bind a precompiled input with its declared range and axis dependency + /// mask (X=1, Y=2, Z=4). Each binding has distinct function identity. + pub fn bind( + &mut self, + sampler: Arc, + range: Interval, + axes: u8, + ) -> Result { + if axes & !7 != 0 { + return Err(CompileError::InvalidAxes); + } + let id = FunctionId(self.entries.len()); + self.entries.push(Entry { + definition: Definition::Bound { + sampler, + range, + axes, + }, + depth: 1, + equality_id: id, + hash_variant: false, + }); + Ok(id) + } + fn entry(&self, id: FunctionId) -> Result<&Entry, CompileError> { + self.entries.get(id.0).ok_or(CompileError::UnknownFunction) + } + /// Register a noise under its canonical namespaced registry identifier. + /// Definitions and names are immutable after registration. + pub fn register_noise( + &mut self, + name: String, + definition: crate::noise::NormalNoise, + ) -> Result { + if self.noise_names.contains_key(&name) { + return Err(CompileError::DuplicateNoise); + } + let id = NoiseId(self.noises.len()); + self.noise_names.insert(name.clone(), id); + self.noises.push(seeded::NoiseEntry { name, definition }); + Ok(id) + } + /// Register an immutable named density value and return its holder wrapper. + /// Names must already be canonical namespaced registry identifiers. + pub fn register_function( + &mut self, + name: String, + input: FunctionId, + ) -> Result { + if self.function_names.contains_key(&name) { + return Err(CompileError::DuplicateFunction); + } + self.entry(input)?; + let holder = HolderId(self.holders.len()); + self.holders.push(input); + let result = self.insert(GraphNode::Reference { + input, + holder: Some(holder), + }); + match result { + Ok(id) => { + self.function_names.insert(name, id); + Ok(id) + } + Err(error) => { + self.holders.pop(); + Err(error) + } + } + } + pub fn function(&self, name: &str) -> Option { + self.function_names.get(name).copied() + } + fn noise_entry(&self, id: NoiseId) -> Result<&seeded::NoiseEntry, CompileError> { + self.noises.get(id.0).ok_or(CompileError::UnknownNoise) + } + /// Vanilla definition equality, separate from interned identity. Interval + /// threshold lists can compare equal despite having different Java hashes. + pub fn java_equals(&self, left: FunctionId, right: FunctionId) -> Result { + Ok(self.entry(left)?.equality_id == self.entry(right)?.equality_id) + } + pub fn domain_axes(&self, id: FunctionId) -> Result { + let mut node = match &self.entry(id)?.definition { + Definition::Bound { axes, .. } => return Ok(*axes), + Definition::Node(node) => node.clone(), + }; + let mask = match node { + GraphNode::EndIslands => return Ok(5), + GraphNode::WorldField(field) => return Ok(field.domain_axes()), + GraphNode::OffsetNoise { kind, .. } => { + return Ok(if kind == ShiftNoiseKind::Shift { 7 } else { 5 }); + } + GraphNode::BlendedNoise(_) => return Ok(7), + GraphNode::Noise { + xz_scale, y_scale, .. + } => { + let mut axes = if xz_scale == 0.0 { 0 } else { 5 }; + if y_scale != 0.0 { + axes |= 2; + } + for child in node.children_mut() { + axes |= self.domain_axes(*child)?; + } + return Ok(axes); + } + GraphNode::Constant(_) => return Ok(0), + GraphNode::Gradient { axis, .. } => return Ok(1 << axis as u8), + GraphNode::DistanceToPoint { .. } => return Ok(7), + GraphNode::Slice { axis, .. } => !(1 << axis as u8), + GraphNode::Surface { .. } => !2, + _ => 7, + }; + let mut axes = 0; + for child in node.children_mut() { + axes |= self.domain_axes(*child)?; + } + Ok(axes & mask) + } + pub fn range(&self, id: FunctionId) -> Result { + let node = match &self.entry(id)?.definition { + Definition::Bound { range, .. } => return Ok(*range), + Definition::Node(node) => node, + }; + Ok(match *node { + GraphNode::EndIslands => Interval::new(-0.84375, 0.5625)?, + GraphNode::WorldField(field) => field.range(), + GraphNode::Noise { noise, .. } => { + let [min, max] = self.noise_entry(noise)?.definition.range(); + Interval::new(min, max)? + } + GraphNode::OffsetNoise { noise, .. } => { + let [min, max] = self.noise_entry(noise)?.definition.range(); + Interval::new(min, max)?.multiply_range(Interval::exact(4.0)?) + } + GraphNode::BlendedNoise(definition) => definition.range()?, + GraphNode::Spline(ref spline) => spline.try_range(&mut |id| self.range(id))?, + GraphNode::Constant(v) => Interval::exact(v)?, + GraphNode::Gradient { low, high, .. } => Interval::encapsulating_values(low, high), + GraphNode::DistanceToPoint { .. } => Interval::new(0.0, f32::INFINITY)?, + GraphNode::IntervalSelect { ref branches, .. } => { + let ranges = branches + .iter() + .map(|id| self.range(*id)) + .collect::, _>>()?; + Interval::encapsulating(&ranges)? + } + GraphNode::Unary { kind, input } => { + let range = self.range(input)?; + match kind { + GraphUnary::Abs => range.abs(), + GraphUnary::Square => range.square(), + GraphUnary::Reciprocal => range.reciprocal(), + GraphUnary::Sign => range.sign(), + GraphUnary::Negate => Interval::exact(0.0)?.subtract_range(range), + GraphUnary::Log => range.log()?, + GraphUnary::Sqrt => range.power(Interval::exact(0.5)?), + _ => range.map_monotonic(|v| kind.operation().apply(v, false))?, + } + } + GraphNode::Binary { kind, left, right } => { + let left = self.range(left)?; + let right = self.range(right)?; + match kind { + GraphBinary::Add => left.add_range(right), + GraphBinary::Subtract => left.subtract_range(right), + GraphBinary::Multiply => left.multiply_range(right), + GraphBinary::Divide => left.divide_range(right), + GraphBinary::Minimum => left.minimum(right), + GraphBinary::Maximum => left.maximum(right), + } + } + GraphNode::Round { + mode, + input, + multiple, + } => { + let multiple = self.range(multiple)?; + self.range(input)? + .divide_range(multiple) + .map_monotonic(|v| mode.integer(v))? + .multiply_range(multiple) + } + GraphNode::Power { base, exponent } => self.range(base)?.power(self.range(exponent)?), + GraphNode::Clamp { input, min, max } => self.range(input)?.clamp(min, max)?, + GraphNode::Choice { + inside, outside, .. + } => Interval::encapsulating(&[self.range(inside)?, self.range(outside)?])?, + GraphNode::Lerp { + alpha, + first, + second, + } => self + .range(alpha)? + .lerp_ranges(self.range(first)?, self.range(second)?), + GraphNode::Slice { input, .. } + | GraphNode::Cache(input) + | GraphNode::BlendDensity(input) + | GraphNode::Reference { input, .. } + | GraphNode::Interpolated { input, .. } => self.range(input)?, + GraphNode::Surface { upper, lower, .. } => Interval::new( + lower as f32, + super::arithmetic::java_max(lower as f32, self.range(upper)?.max()), + )?, + }) + } +} diff --git a/crates/horizon-core/src/density/graph/seeded.rs b/crates/horizon-core/src/density/graph/seeded.rs new file mode 100644 index 000000000..17d66ce0f --- /dev/null +++ b/crates/horizon-core/src/density/graph/seeded.rs @@ -0,0 +1,97 @@ +use super::*; +use crate::{ + noise::NormalNoise, + random::{ + LegacyPositionalRandom, LegacyRandom, PositionalRandom, RandomSource, + XoroshiroPositionalRandom, XoroshiroRandom, + }, +}; +use std::sync::Mutex; + +#[derive(Debug)] +enum Factory { + Legacy(LegacyPositionalRandom), + Xoroshiro(XoroshiroPositionalRandom), +} + +/// The seed-dependent portion of vanilla's RandomState compile context. +#[derive(Debug)] +pub(super) struct SeededContext { + seed: i64, + factory: Factory, + instances: Mutex>>, +} +impl SeededContext { + pub(super) fn end_islands(&self) -> Arc { + Arc::new(EndIslandSampler::new(self.seed)) + } + pub(super) fn new(seed: i64, legacy: bool) -> Self { + let factory = if legacy { + Factory::Legacy(LegacyRandom::new(seed).fork_positional()) + } else { + Factory::Xoroshiro(XoroshiroRandom::new(seed).fork_positional()) + }; + Self { + seed, + factory, + instances: Mutex::new(HashMap::new()), + } + } + pub(super) fn noise( + &self, + graph: &DensityGraph, + id: NoiseId, + ) -> Result, CompileError> { + let entry = graph.noise_entry(id)?; + // Nether biome compatibility samplers are recreated on every lookup; + // vanilla bypasses its normal named-noise instance map for these keys. + let legacy_offset = match entry.name.as_str() { + "minecraft:nether/temperature" => Some(0), + "minecraft:nether/vegetation" => Some(1), + _ => None, + }; + if let Some(offset) = legacy_offset { + return Ok(Arc::new(entry.definition.create_for_legacy_nether_biome( + &mut LegacyRandom::new(self.seed.wrapping_add(offset)), + )?)); + } + let mut instances = self + .instances + .lock() + .map_err(|_| CompileError::PoisonedNoiseCache)?; + if let Some(noise) = instances.get(&id) { + return Ok(noise.clone()); + } + let noise: Arc = match &self.factory { + Factory::Legacy(factory) => Arc::new( + entry + .definition + .create(&mut factory.from_hash_of(&entry.name))?, + ), + Factory::Xoroshiro(factory) => Arc::new( + entry + .definition + .create(&mut factory.from_hash_of(&entry.name))?, + ), + }; + instances.insert(id, noise.clone()); + Ok(noise) + } + pub(super) fn blended( + &self, + definition: BlendedNoise, + ) -> Result, CompileError> { + Ok(match &self.factory { + Factory::Legacy(_) => Arc::new(definition.compile(&mut LegacyRandom::new(self.seed))?), + Factory::Xoroshiro(factory) => { + Arc::new(definition.compile(&mut factory.from_hash_of("minecraft:terrain"))?) + } + }) + } +} + +#[derive(Clone, Debug)] +pub(super) struct NoiseEntry { + pub(super) name: String, + pub(super) definition: NormalNoise, +} diff --git a/crates/horizon-core/src/density/graph/tests.rs b/crates/horizon-core/src/density/graph/tests.rs new file mode 100644 index 000000000..4f3358460 --- /dev/null +++ b/crates/horizon-core/src/density/graph/tests.rs @@ -0,0 +1,552 @@ +use super::*; +use std::sync::Mutex; + +#[test] +fn power_literal_selection_retains_signed_zeros_and_negative_fallback_behavior() { + let signaling_base = UnarySampler { + input: Arc::new(ConstantSampler(0.0)), + operation: UnaryOp::PowerBase(f64::from_bits(0x7ff4_0000_2000_0000)), + }; + assert_eq!( + signaling_base.sample_value(&mut SamplerContext::default(), [0; 3]), + Ok(1.0) + ); + let mut graph = DensityGraph::new(); + let negative_zero = graph.insert(GraphNode::Constant(-0.0)).unwrap(); + let two = graph.insert(GraphNode::Constant(2.0)).unwrap(); + let half = graph.insert(GraphNode::Constant(0.5)).unwrap(); + let minus_four = graph.insert(GraphNode::Constant(-4.0)).unwrap(); + let bound_zero = graph + .bind( + Arc::new(ConstantSampler(-0.0)), + Interval::exact(-0.0).unwrap(), + 7, + ) + .unwrap(); + let bound_two = graph + .bind( + Arc::new(ConstantSampler(2.0)), + Interval::exact(2.0).unwrap(), + 7, + ) + .unwrap(); + let roots = [ + (negative_zero, half), + (bound_zero, half), + (two, minus_four), + (bound_two, minus_four), + ] + .map(|(base, exponent)| graph.insert(GraphNode::Power { base, exponent }).unwrap()); + let cached_half = graph.insert(GraphNode::Cache(half)).unwrap(); + let invalid_raw = graph + .insert(GraphNode::Power { + base: two, + exponent: cached_half, + }) + .unwrap(); + let compiler = DensityCompiler::new(graph); + assert_eq!( + compiler.compile_raw(invalid_raw).unwrap_err(), + CompileError::UnpreparedCache + ); + for (root, expected) in roots.into_iter().zip([0.0_f32, -0.0, 0.0625, 0.0625]) { + let value = compiler + .compile_raw(root) + .unwrap() + .sample_value(&mut SamplerContext::default(), [0; 3]) + .unwrap(); + assert_eq!(value.to_bits(), expected.to_bits()); + } + let sampler = PowerSampler { + base: Arc::new(ConstantSampler(0.0)), + exponent: Arc::new(FailingSampler), + }; + assert_eq!( + sampler.sample_value(&mut SamplerContext::default(), [0; 3]), + Err(SampleError::ZeroGradientPeriod) + ); + let mut output = [17.0]; + let volume = DensityVolume::new([1; 3], [0; 3], [1; 3]).unwrap(); + assert_eq!( + sampler.sample_volume(&mut SamplerContext::default(), &mut output, volume), + Err(SampleError::ZeroGradientPeriod) + ); + assert_eq!(output, [0.0]); +} + +#[test] +fn rounding_specializes_only_literal_one_and_preserves_input_on_multiple_failure() { + let mut graph = DensityGraph::new(); + let input = graph.insert(GraphNode::Constant(0.5)).unwrap(); + let one = graph.insert(GraphNode::Constant(1.0)).unwrap(); + let bound = graph + .bind( + Arc::new(ConstantSampler(1.0)), + Interval::exact(1.0).unwrap(), + 0, + ) + .unwrap(); + let failing = graph + .bind(Arc::new(FailingSampler), Interval::INFINITE, 7) + .unwrap(); + let roots = [one, bound, failing].map(|multiple| { + graph + .insert(GraphNode::Round { + mode: RoundMode::Round, + input, + multiple, + }) + .unwrap() + }); + let compiler = DensityCompiler::new(graph); + let volume = DensityVolume::new([1; 3], [0; 3], [1; 3]).unwrap(); + let mut output = [17.0; 2]; + compiler + .compile_raw(roots[0]) + .unwrap() + .sample_volume(&mut SamplerContext::default(), &mut output, volume) + .unwrap(); + assert_eq!(output, [1.0; 2]); + assert_eq!( + compiler.compile_raw(roots[1]).unwrap().sample_volume( + &mut SamplerContext::default(), + &mut output, + volume + ), + Err(SampleError::ExactBufferSizeRequired) + ); + assert_eq!( + compiler.compile_raw(roots[2]).unwrap().sample_volume( + &mut SamplerContext::default(), + &mut output[..1], + volume + ), + Err(SampleError::ZeroGradientPeriod) + ); + assert_eq!(output[0], 0.5); +} + +#[test] +fn end_islands_use_the_world_seed_independently_of_the_noise_algorithm() { + let mut graph = DensityGraph::new(); + let root = graph.insert(GraphNode::EndIslands).unwrap(); + assert_eq!(graph.domain_axes(root), Ok(5)); + assert_eq!( + graph.range(root).unwrap(), + Interval::new(-0.84375, 0.5625).unwrap() + ); + assert_eq!( + DensityCompiler::new(graph.clone()) + .compile_raw(root) + .unwrap_err(), + CompileError::MissingSeededContext + ); + let volume = DensityVolume::new([3, 4, 2], [-2049, -64, 4096], [17, 8, 31]).unwrap(); + let mut outputs = Vec::new(); + for legacy in [false, true] { + let mut compiler = DensityCompiler::new_seeded(graph.clone(), i64::MIN, legacy); + let sampler = compiler.get_sampler(root).unwrap(); + let mut output = vec![17.0; volume.size() + 1]; + sampler + .sample_volume(&mut SamplerContext::default(), &mut output, volume) + .unwrap(); + for column in output[..volume.size()].chunks_exact(4) { + assert!(column.iter().all(|&value| value == column[0])); + } + assert_eq!(output[volume.size()], 17.0); + outputs.push(output); + } + assert_eq!(outputs[0], outputs[1]); +} + +#[test] +fn registered_noises_share_ordinary_instances_and_recreate_nether_instances() { + let mut builder = crate::noise::NormalNoise::builder(); + builder.set_base_octave(-3).set_octave_count(3).unwrap(); + let definition = builder.build().unwrap(); + let mut graph = DensityGraph::new(); + let ordinary = graph + .register_noise("horizon:sample".to_owned(), definition.clone()) + .unwrap(); + assert_eq!( + graph.register_noise("horizon:sample".to_owned(), definition.clone()), + Err(CompileError::DuplicateNoise) + ); + let nether = graph + .register_noise("minecraft:nether/vegetation".to_owned(), definition) + .unwrap(); + let unseeded = DensityCompiler::new(graph.clone()); + assert_eq!( + unseeded.get_noise_sampler(ordinary).unwrap_err(), + CompileError::MissingSeededContext + ); + for legacy in [false, true] { + let compiler = DensityCompiler::new_seeded(graph.clone(), i64::MAX, legacy); + let a = compiler.get_noise_sampler(ordinary).unwrap(); + let b = compiler.get_noise_sampler(ordinary).unwrap(); + assert!(Arc::ptr_eq(&a, &b)); + let a = compiler.get_noise_sampler(nether).unwrap(); + let b = compiler.get_noise_sampler(nether).unwrap(); + assert!(!Arc::ptr_eq(&a, &b)); + assert_eq!( + a.get3(-17.25, 64.0, 32.5).to_bits(), + b.get3(-17.25, 64.0, 32.5).to_bits() + ); + } +} + +#[test] +fn noise_specialization_requires_literal_positive_zero_shifts() { + let mut graph = DensityGraph::new(); + let noise = graph + .register_noise( + "horizon:empty".to_owned(), + crate::noise::NormalNoise::builder() + .set_octave_count(0) + .unwrap() + .build() + .unwrap(), + ) + .unwrap(); + let zero = graph.insert(GraphNode::Constant(0.0)).unwrap(); + let negative = graph.insert(GraphNode::Constant(-0.0)).unwrap(); + let roots = [zero, negative].map(|shift_x| { + graph + .insert(GraphNode::Noise { + noise, + xz_scale: 1.0, + y_scale: 1.0, + shift_x, + shift_y: zero, + shift_z: zero, + }) + .unwrap() + }); + let compiler = DensityCompiler::new_seeded(graph, 1, false); + let volume = DensityVolume::new([1; 3], [0; 3], [1; 3]).unwrap(); + let mut buffer = [17.0; 2]; + compiler + .compile_raw(roots[0]) + .unwrap() + .sample_volume(&mut SamplerContext::default(), &mut buffer, volume) + .unwrap(); + assert_eq!(buffer, [0.0; 2]); + compiler + .compile_raw(roots[1]) + .unwrap() + .sample_volume(&mut SamplerContext::default(), &mut buffer, volume) + .unwrap(); + assert_eq!(buffer[0].to_bits(), 0); + assert_eq!(buffer[1].to_bits(), (-0.0_f32).to_bits()); +} + +#[test] +fn spline_range_early_return_does_not_skip_coordinate_validation_during_compilation() { + let mut graph = DensityGraph::new(); + let unavailable = graph + .bind(Arc::new(FailingSampler), Interval::NAI, 2) + .unwrap(); + let invalid = graph.insert(GraphNode::Constant(f32::NAN)).unwrap(); + let nested = CubicSpline::multipoint( + invalid, + vec![SplinePoint { + location: 0.0, + value: CubicSpline::Constant(1.0), + derivative: 0.0, + }], + ) + .unwrap(); + let root = graph + .insert(GraphNode::Spline( + CubicSpline::multipoint( + unavailable, + vec![SplinePoint { + location: 0.0, + value: nested, + derivative: 0.0, + }], + ) + .unwrap(), + )) + .unwrap(); + assert_eq!(graph.range(root), Ok(Interval::NAI)); + let compiler = DensityCompiler::new(graph); + assert!(matches!( + compiler.compile_raw(root), + Err(CompileError::Range(_)) + )); +} + +#[test] +fn spline_coordinates_share_bulk_evaluation_after_graph_rewriting() { + let trace = Arc::new(VerticalTrace::default()); + let mut graph = DensityGraph::new(); + let coordinate = graph + .bind(trace.clone(), Interval::new(-1.0, 1.0).unwrap(), 2) + .unwrap(); + let inner = CubicSpline::multipoint( + coordinate, + vec![SplinePoint { + location: 0.0, + value: CubicSpline::Constant(3.0), + derivative: 1.0, + }], + ) + .unwrap(); + let root = graph + .insert(GraphNode::Spline( + CubicSpline::multipoint( + coordinate, + vec![ + SplinePoint { + location: -1.0, + value: inner.clone(), + derivative: 0.0, + }, + SplinePoint { + location: 1.0, + value: inner, + derivative: 0.0, + }, + ], + ) + .unwrap(), + )) + .unwrap(); + let mut compiler = DensityCompiler::new(graph); + let sampler = compiler.get_sampler(root).unwrap(); + let volume = DensityVolume::new([3, 3, 2], [-1; 3], [1; 3]).unwrap(); + let mut output = vec![0.0; volume.size()]; + sampler + .sample_volume(&mut SamplerContext::default(), &mut output, volume) + .unwrap(); + assert_eq!(trace.0.lock().unwrap().len(), 1); + for column in output.chunks_exact(3) { + assert_eq!(column, [2.0, 3.0, 4.0]); + } +} + +#[test] +fn interval_threshold_equality_and_hashing_preserve_distinct_cache_inputs() { + let mut graph = DensityGraph::new(); + let one = graph.insert(GraphNode::Constant(1.0)).unwrap(); + let zero = graph.insert(GraphNode::Constant(0.0)).unwrap(); + let shared_nan: Arc<[f32]> = Arc::from([f32::NAN]); + let mut ids = Vec::new(); + for thresholds in [ + shared_nan.clone(), + shared_nan, + Arc::from([f32::NAN]), + Arc::from([0.0]), + Arc::from([-0.0]), + ] { + ids.push( + graph + .insert(GraphNode::IntervalSelect { + input: one, + thresholds, + branches: vec![zero, one], + }) + .unwrap(), + ); + } + assert_eq!(ids[0], ids[1]); + assert!(!graph.java_equals(ids[0], ids[2]).unwrap()); + assert!(graph.java_equals(ids[3], ids[4]).unwrap()); + assert_ne!(ids[3], ids[4]); + let doubled_positive = graph + .insert(GraphNode::Binary { + kind: GraphBinary::Add, + left: ids[3], + right: ids[3], + }) + .unwrap(); + let doubled_negative = graph + .insert(GraphNode::Binary { + kind: GraphBinary::Add, + left: ids[4], + right: ids[4], + }) + .unwrap(); + assert_eq!(doubled_positive, doubled_negative); + let caches = ids + .into_iter() + .map(|input| graph.insert(GraphNode::Cache(input)).unwrap()) + .collect::>(); + let mut compiler = DensityCompiler::new(graph); + for cache in caches { + compiler.get_sampler(cache).unwrap(); + } + assert_eq!(compiler.cache_count(), 4); +} + +#[test] +fn structural_identity_preserves_java_float_keys_and_shared_cache_ids() { + let mut graph = DensityGraph::new(); + let positive = graph.insert(GraphNode::Constant(0.0)).unwrap(); + let negative = graph.insert(GraphNode::Constant(-0.0)).unwrap(); + assert_ne!(positive, negative); + let nan = graph.insert(GraphNode::Constant(f32::NAN)).unwrap(); + assert_eq!( + nan, + graph + .insert(GraphNode::Constant(f32::from_bits(0xffa00001))) + .unwrap() + ); + let first = graph.insert(GraphNode::Cache(positive)).unwrap(); + let second = graph.insert(GraphNode::Cache(positive)).unwrap(); + assert_eq!(first, second); + let root = graph + .insert(GraphNode::Binary { + kind: GraphBinary::Add, + left: first, + right: second, + }) + .unwrap(); + let mut compiler = DensityCompiler::new(graph); + assert_eq!( + compiler.compile_raw(first).unwrap_err(), + CompileError::UnpreparedCache + ); + let sampler = compiler.get_sampler(root).unwrap(); + assert_eq!(compiler.cache_count(), 1); + assert!(Arc::ptr_eq(&sampler, &compiler.get_sampler(root).unwrap())); +} + +#[test] +fn failed_parent_preparation_retains_successful_child_and_consumes_new_id_on_retry() { + let mut graph = DensityGraph::new(); + let good = graph.insert(GraphNode::Constant(1.0)).unwrap(); + let child = graph.insert(GraphNode::Cache(good)).unwrap(); + let bad = graph.insert(GraphNode::Constant(f32::NAN)).unwrap(); + let sum = graph + .insert(GraphNode::Binary { + kind: GraphBinary::Add, + left: child, + right: bad, + }) + .unwrap(); + let root = graph.insert(GraphNode::Cache(sum)).unwrap(); + let mut compiler = DensityCompiler::new(graph); + assert!(matches!( + compiler.get_sampler(root), + Err(CompileError::Range(_)) + )); + assert_eq!(compiler.cache_count(), 2); + assert!(matches!( + compiler.get_sampler(root), + Err(CompileError::Range(_)) + )); + assert_eq!(compiler.cache_count(), 3); + let sampler = compiler.get_sampler(child).unwrap(); + assert_eq!(compiler.cache_count(), 3); + assert_eq!( + sampler.sample_value(&mut SamplerContext::default(), [3; 3]), + Ok(1.0) + ); +} + +#[derive(Debug)] +struct FailingSampler; +impl DensitySampler for FailingSampler { + fn sample_value(&self, _: &mut SamplerContext, _: [i32; 3]) -> Result { + Err(SampleError::ZeroGradientPeriod) + } +} + +#[test] +fn min_range_elimination_is_strict_and_does_not_skip_child_compilation() { + let mut graph = DensityGraph::new(); + let one = graph.insert(GraphNode::Constant(1.0)).unwrap(); + let disjoint = graph + .bind( + Arc::new(FailingSampler), + Interval::new(2.0, 3.0).unwrap(), + 7, + ) + .unwrap(); + let touching = graph + .bind( + Arc::new(FailingSampler), + Interval::new(1.0, 3.0).unwrap(), + 7, + ) + .unwrap(); + let cached = graph.insert(GraphNode::Cache(disjoint)).unwrap(); + let roots: Vec<_> = [disjoint, touching, cached] + .into_iter() + .map(|right| { + graph + .insert(GraphNode::Binary { + kind: GraphBinary::Minimum, + left: one, + right, + }) + .unwrap() + }) + .collect(); + let compiler = DensityCompiler::new(graph); + let volume = DensityVolume::new([1; 3], [0; 3], [1; 3]).unwrap(); + let mut context = SamplerContext::default(); + let mut output = [17.0]; + compiler + .compile_raw(roots[0]) + .unwrap() + .sample_volume(&mut context, &mut output, volume) + .unwrap(); + assert_eq!(output, [1.0]); + assert_eq!( + compiler + .compile_raw(roots[1]) + .unwrap() + .sample_volume(&mut context, &mut output, volume), + Err(SampleError::ZeroGradientPeriod) + ); + assert_eq!( + compiler.compile_raw(roots[2]).unwrap_err(), + CompileError::UnpreparedCache + ); +} + +#[derive(Debug, Default)] +struct VerticalTrace(Mutex>); +impl DensitySampler for VerticalTrace { + fn sample_value(&self, _: &mut SamplerContext, position: [i32; 3]) -> Result { + Ok(position[1] as f32) + } + fn sample_volume( + &self, + _: &mut SamplerContext, + buffer: &mut [f32], + volume: DensityVolume, + ) -> Result<(), SampleError> { + self.0.lock().unwrap().push(volume); + visit(volume, |index, position| { + buffer[index] = position[1] as f32; + Ok(()) + }) + } +} + +#[test] +fn compiler_reduces_uniform_axes_and_preserves_strided_vertical_samples() { + let trace = Arc::new(VerticalTrace::default()); + let mut graph = DensityGraph::new(); + let root = graph.bind(trace.clone(), Interval::INFINITE, 2).unwrap(); + let mut compiler = DensityCompiler::new(graph); + let sampler = compiler.get_sampler(root).unwrap(); + let volume = DensityVolume::new([3, 4, 2], [-9, -7, 11], [2, 3, 5]).unwrap(); + let mut output = vec![17.0; volume.size() + 1]; + sampler + .sample_volume(&mut SamplerContext::default(), &mut output, volume) + .unwrap(); + assert_eq!( + *trace.0.lock().unwrap(), + vec![DensityVolume::new([1, 4, 1], [0, -7, 0], [2, 3, 5]).unwrap()] + ); + for column in output[..volume.size()].chunks_exact(4) { + assert_eq!(column, [-7.0, -4.0, -1.0, 2.0]); + } + assert_eq!(output[volume.size()], 17.0); + assert_eq!(compiler.graph().domain_axes(root), Ok(2)); +} diff --git a/crates/horizon-core/src/density/interpolation.rs b/crates/horizon-core/src/density/interpolation.rs new file mode 100644 index 000000000..25a5e826b --- /dev/null +++ b/crates/horizon-core/src/density/interpolation.rs @@ -0,0 +1,207 @@ +use super::*; + +/// Interpolation over a coarse density grid. Scalar queries and volume queries +/// retain vanilla's distinct floating-point paths and child bulk calls. +#[derive(Clone, Debug)] +pub struct InterpolatedSampler { + input: Arc, + cell_size: [i32; 3], + inverse: [f32; 3], +} +impl InterpolatedSampler { + pub fn new( + input: Arc, + cell_size_xz: i32, + cell_size_y: i32, + ) -> Result { + if cell_size_xz <= 0 || cell_size_y <= 0 { + return Err(DensityError::NonpositiveSteps.into()); + } + let cell_size = [cell_size_xz, cell_size_y, cell_size_xz]; + Ok(Self { + input, + cell_size, + inverse: cell_size.map(|size| 1.0 / size as f32), + }) + } + + fn sample_block_volume( + &self, + context: &mut SamplerContext, + output: &mut [f32], + volume: DensityVolume, + ) -> Result<(), SampleError> { + let minimum = volume.minimum(); + let maximum = volume.maximum(); + let first: [i32; 3] = std::array::from_fn(|i| minimum[i].div_euclid(self.cell_size[i])); + let counts: [i32; 3] = std::array::from_fn(|i| { + maximum[i] + .div_euclid(self.cell_size[i]) + .wrapping_sub(first[i]) + .wrapping_add(1) + }); + let sizes = std::array::from_fn(|i| { + counts[i].wrapping_add(i32::from(maximum[i].rem_euclid(self.cell_size[i]) != 0)) + }); + let coarse = DensityVolume::new( + sizes, + std::array::from_fn(|i| first[i].wrapping_mul(self.cell_size[i])), + self.cell_size, + )?; + context.with_buffer(coarse.size(), |context, samples| { + self.input.sample_volume(context, samples, coarse)?; + for z in 0..counts[2] { + for x in 0..counts[0] { + for y in 0..counts[1] { + let cell = [x as usize, y as usize, z as usize]; + let corners = std::array::from_fn(|corner| { + let position = std::array::from_fn(|axis| { + (cell[axis] + ((corner >> axis) & 1)).min(coarse.sizes()[axis] - 1) + }); + samples[coarse.index(position).unwrap()] + }); + self.fill_cell(output, volume, coarse, cell, corners)?; + } + } + } + Ok(()) + }) + } + + fn fill_cell( + &self, + output: &mut [f32], + volume: DensityVolume, + coarse: DensityVolume, + cell: [usize; 3], + corners: [f32; 8], + ) -> Result<(), SampleError> { + let offset: [i32; 3] = std::array::from_fn(|i| { + coarse.minimum()[i] + .wrapping_add((cell[i] as i32).wrapping_mul(self.cell_size[i])) + .wrapping_sub(volume.minimum()[i]) + }); + let start = offset.map(|offset| offset.wrapping_neg().max(0)); + let end: [i32; 3] = std::array::from_fn(|i| { + self.cell_size[i] + .min((volume.sizes()[i] as i32).wrapping_sub(offset[i])) + .wrapping_sub(1) + }); + for z in start[2]..=end[2] { + let alpha_z = z as f32 * self.inverse[2]; + let z00 = lerp(alpha_z, corners[0], corners[4]); + let z01 = lerp(alpha_z, corners[2], corners[6]); + let z10 = lerp(alpha_z, corners[1], corners[5]); + let z11 = lerp(alpha_z, corners[3], corners[7]); + for x in start[0]..=end[0] { + let alpha_x = x as f32 * self.inverse[0]; + let low = lerp(alpha_x, z00, z10); + let high = lerp(alpha_x, z01, z11); + let increment = (high - low) * self.inverse[1]; + let mut value = low + increment * start[1] as f32; + if end[1] < start[1] { + continue; + } + let index = volume + .index([ + offset[0].wrapping_add(x) as usize, + offset[1].wrapping_add(start[1]) as usize, + offset[2].wrapping_add(z) as usize, + ]) + .ok_or(DensityError::VolumeTooLarge)?; + let length = (end[1] - start[1] + 1) as usize; + let end_index = index + .checked_add(length) + .ok_or(DensityError::VolumeTooLarge)?; + let column = output + .get_mut(index..end_index) + .ok_or(DensityError::VolumeTooLarge)?; + for output in column { + *output = value; + // Repeated addition is observable: multiplication by the + // current Y offset does not have the same rounding. + value += increment; + } + } + } + Ok(()) + } +} + +fn lerp(alpha: f32, first: f32, second: f32) -> f32 { + first + alpha * (second - first) +} +impl DensitySampler for InterpolatedSampler { + fn sample_value( + &self, + context: &mut SamplerContext, + position: [i32; 3], + ) -> Result { + let remainder: [i32; 3] = + std::array::from_fn(|i| position[i].rem_euclid(self.cell_size[i])); + if remainder == [0; 3] { + return self.input.sample_value(context, position); + } + let volume = DensityVolume::new( + [2; 3], + std::array::from_fn(|i| position[i].wrapping_sub(remainder[i])), + self.cell_size, + )?; + context.with_buffer(8, |context, corners| { + self.input.sample_volume(context, corners, volume)?; + let alpha: [f32; 3] = + std::array::from_fn(|i| remainder[i] as f32 / self.cell_size[i] as f32); + // Samples use Y-innermost storage; interpolation blends X, Y, Z. + let xy0 = lerp( + alpha[1], + lerp(alpha[0], corners[0], corners[2]), + lerp(alpha[0], corners[1], corners[3]), + ); + let xy1 = lerp( + alpha[1], + lerp(alpha[0], corners[4], corners[6]), + lerp(alpha[0], corners[5], corners[7]), + ); + Ok(lerp(alpha[2], xy0, xy1)) + }) + } + fn sample_volume( + &self, + context: &mut SamplerContext, + output: &mut [f32], + volume: DensityVolume, + ) -> Result<(), SampleError> { + check_buffer(output, volume)?; + if (0..3).all(|i| { + (volume.steps()[i] == self.cell_size[i] || volume.sizes()[i] == 1) + && volume.minimum()[i].rem_euclid(self.cell_size[i]) == 0 + }) { + return self.input.sample_volume(context, output, volume); + } + if volume.steps() == [1; 3] { + return self.sample_block_volume(context, output, volume); + } + // The reference evaluates the complete block-resolution bounding volume + // before selecting strided samples, including trailing unsampled blocks. + let dense = DensityVolume::new( + std::array::from_fn(|i| (volume.sizes()[i] as i32).wrapping_mul(volume.steps()[i])), + volume.minimum(), + [1; 3], + )?; + context.with_buffer(dense.size(), |context, samples| { + self.sample_block_volume(context, samples, dense)?; + let [sx, sy, sz] = volume.sizes(); + for z in 0..sz { + for x in 0..sx { + for y in 0..sy { + let source = dense.index(std::array::from_fn(|i| { + [x, y, z][i] * volume.steps()[i] as usize + })); + output[(x + z * sx) * sy + y] = samples[source.unwrap()]; + } + } + } + Ok(()) + }) + } +} diff --git a/crates/horizon-core/src/density/interval.rs b/crates/horizon-core/src/density/interval.rs new file mode 100644 index 000000000..0375dba6d --- /dev/null +++ b/crates/horizon-core/src/density/interval.rs @@ -0,0 +1,412 @@ +//! Selected vanilla interval operations used for density graph range analysis. +use super::arithmetic::{java_max, java_min}; + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum IntervalError { + NanBound, + InvertedBounds, + EmptyInput, + NanMappedBound, +} +impl std::fmt::Display for IntervalError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(match self { + Self::NanBound => "interval endpoint is NaN", + Self::InvertedBounds => "interval endpoints are reversed", + Self::EmptyInput => "at least one interval is required", + Self::NanMappedBound => "monotonic range operator produced NaN", + }) + } +} +impl std::error::Error for IntervalError {} + +#[derive(Clone, Copy, Debug)] +pub struct Interval { + min: f32, + max: f32, +} +impl PartialEq for Interval { + fn eq(&self, other: &Self) -> bool { + (self.is_nai() && other.is_nai()) || (self.min == other.min && self.max == other.max) + } +} +impl Eq for Interval {} +impl Interval { + pub const NAI: Self = Self { + min: f32::NAN, + max: f32::NAN, + }; + pub const INFINITE: Self = Self { + min: f32::NEG_INFINITY, + max: f32::INFINITY, + }; + pub fn new(min: f32, max: f32) -> Result { + if max < min { + return Err(IntervalError::InvertedBounds); + } + if min.is_nan() || max.is_nan() { + return Err(IntervalError::NanBound); + } + // The reference returns a cached [0, 1], canonicalizing a negative zero. + Ok(Self { + min: if min == 0.0 && max == 1.0 { 0.0 } else { min }, + max, + }) + } + pub fn symmetric(value: f32) -> Result { + Self::new(-value, value) + } + pub fn exact(value: f32) -> Result { + Self::new(value, value) + } + pub fn min(self) -> f32 { + self.min + } + pub fn max(self) -> f32 { + self.max + } + pub fn is_nai(self) -> bool { + self.min.is_nan() + } + pub fn contains(self, value: f32) -> bool { + value >= self.min && value <= self.max + } + pub fn intersects(self, other: Self) -> bool { + self.min <= other.max && self.max >= other.min + } + /// Kept separate from Rust's Hash contract: Java compares signed zeros equal + /// here, but its endpoint-based hash can distinguish them. + pub fn java_hash_code(self) -> i32 { + let bits = |v: f32| { + if v.is_nan() { + 0x7fc0_0000_i32 + } else { + v.to_bits() as i32 + } + }; + bits(self.min).wrapping_mul(31).wrapping_add(bits(self.max)) + } + pub fn encapsulating_values(a: f32, b: f32) -> Self { + if a.is_nan() && b.is_nan() { + Self::NAI + } else if a.is_nan() { + Self::exact(b).unwrap() + } else if b.is_nan() { + Self::exact(a).unwrap() + } else { + Self::new(java_min(a, b), java_max(a, b)).unwrap() + } + } + pub fn encapsulating(intervals: &[Self]) -> Result { + if intervals.is_empty() { + return Err(IntervalError::EmptyInput); + } + let mut min = f32::INFINITY; + let mut max = f32::NEG_INFINITY; + for interval in intervals { + if !interval.is_nai() { + min = java_min(interval.min, min); + max = java_max(interval.max, max); + } + } + if max < min { + Ok(Self::NAI) + } else { + Self::new(min, max) + } + } + fn arithmetic_bounds(min: f32, max: f32) -> Self { + if min.is_nan() || max.is_nan() { + Self::NAI + } else { + Self::new(min, max).expect("ordered interval arithmetic") + } + } + pub fn add_range(self, right: Self) -> Self { + Self::arithmetic_bounds(self.min + right.min, self.max + right.max) + } + pub fn subtract_range(self, right: Self) -> Self { + Self::arithmetic_bounds(self.min - right.max, self.max - right.min) + } + pub fn multiply_range(self, right: Self) -> Self { + if self.is_nai() || right.is_nai() { + return Self::NAI; + } + let a = mul_bound(self.min, right.min); + let b = mul_bound(self.min, right.max); + let c = mul_bound(self.max, right.min); + let d = mul_bound(self.max, right.max); + Self::new( + java_min(java_min(a, b), java_min(c, d)), + java_max(java_max(a, b), java_max(c, d)), + ) + .unwrap() + } + pub fn reciprocal(self) -> Self { + if self.is_nai() || (self.min == 0.0 && self.max == 0.0) { + Self::NAI + } else if !self.contains(0.0) { + Self::new(1.0 / self.max, 1.0 / self.min).unwrap() + } else if self.max == 0.0 { + Self::new(f32::NEG_INFINITY, 1.0 / self.min).unwrap() + } else if self.min == 0.0 { + Self::new(1.0 / self.max, f32::INFINITY).unwrap() + } else { + Self::INFINITE + } + } + pub fn divide_range(self, right: Self) -> Self { + self.multiply_range(right.reciprocal()) + } + pub fn minimum(self, right: Self) -> Self { + Self::arithmetic_bounds(java_min(self.min, right.min), java_min(self.max, right.max)) + } + pub fn maximum(self, right: Self) -> Self { + Self::arithmetic_bounds(java_max(self.min, right.min), java_max(self.max, right.max)) + } + pub fn clamp(self, min: f32, max: f32) -> Result { + if min > max { + return Err(IntervalError::InvertedBounds); + } + if self.is_nai() { + Ok(Self::NAI) + } else if self.min >= max { + Self::exact(max) + } else if self.max <= min { + Self::exact(min) + } else { + Self::new(java_max(self.min, min), java_min(self.max, max)) + } + } + pub fn abs(self) -> Self { + self.even_bounds(f32::abs) + } + pub fn square(self) -> Self { + self.even_bounds(|v| v * v) + } + pub fn log(self) -> Result { + if self.is_nai() || self.max < 0.0 { + Ok(Self::NAI) + } else { + self.maximum(Self::exact(0.0)?) + .map_monotonic(|v| (v as f64).ln() as f32) + } + } + pub fn power(self, exponent: Self) -> Self { + if self.is_nai() || exponent.is_nai() { + return Self::NAI; + } + if self.min == self.max { + return Self::power_base(self.min, exponent); + } + let mut result = Self::encapsulating(&[ + Self::power_base(self.min, exponent), + Self::power_base(self.max, exponent), + ]) + .unwrap(); + if self.contains(0.0) { + if self.max > 0.0 { + result = Self::encapsulating(&[result, Self::power_base(0.0, exponent)]).unwrap(); + } + if self.min < 0.0 { + result = Self::encapsulating(&[result, Self::power_base(-0.0, exponent)]).unwrap(); + } + } + result + } + fn including_value(self, value: f32) -> Self { + if value.is_nan() { + self + } else if self.is_nai() { + Self::exact(value).unwrap() + } else { + Self::new(java_min(self.min, value), java_max(self.max, value)).unwrap() + } + } + fn power_base(base: f32, exponent: Self) -> Self { + if base.is_nan() || exponent.is_nai() { + return Self::NAI; + } + if exponent.min == exponent.max { + let value = java_power(base, exponent.min); + return Self::encapsulating_values(value, value); + } + if base == 0.0 { + let range = if exponent.contains(0.0) { + if exponent.max == 0.0 { + Self::new(1.0, f32::INFINITY).unwrap() + } else if exponent.min == 0.0 { + Self::new(0.0, 1.0).unwrap() + } else { + Self::new(0.0, f32::INFINITY).unwrap() + } + } else if exponent.max < 0.0 { + Self::exact(f32::INFINITY).unwrap() + } else { + Self::exact(0.0).unwrap() + }; + return range.multiply_range(Self::exact(1.0_f32.copysign(base)).unwrap()); + } + if base == 1.0 { + return Self::exact(1.0).unwrap(); + } + if base > 0.0 { + if exponent.min.is_finite() && exponent.max.is_finite() { + return Self::encapsulating_values( + java_power(base, exponent.min), + java_power(base, exponent.max), + ); + } + if exponent.min.is_infinite() && exponent.max.is_infinite() { + return Self::new(0.0, f32::INFINITY).unwrap(); + } + let (min, max) = if exponent.min.is_infinite() { + if base < 1.0 { + (java_power(base, exponent.max), f32::INFINITY) + } else { + (0.0, java_power(base, exponent.max)) + } + } else if base < 1.0 { + (0.0, java_power(base, exponent.min)) + } else { + (java_power(base, exponent.min), f32::INFINITY) + }; + return Self::new(min, max).unwrap(); + } + let first = (exponent.min as f64).ceil() as f32; + let last = (exponent.max as f64).floor() as f32; + if last < first { + return Self::NAI; + } + let a = java_power(base, first); + let b = java_power(base, last); + let mut result = Self::encapsulating_values(a, b); + if first.is_infinite() { + result = result.including_value(-a); + } else if first + 1.0 < last { + result = result.including_value(java_power(base, first + 1.0)); + } + if last.is_infinite() { + result = result.including_value(-b); + } else if last - 1.0 > first { + result = result.including_value(java_power(base, last - 1.0)); + } + result + } + fn even_bounds(self, transform: impl Fn(f32) -> f32) -> Self { + if self.is_nai() { + return self; + } + let a = transform(self.min); + let b = transform(self.max); + Self::new( + if self.contains(0.0) { + 0.0 + } else { + java_min(a, b) + }, + java_max(a, b), + ) + .unwrap() + } + /// The caller supplies a monotonic transformation. As in vanilla, this maps + /// only the endpoints; it does not attempt to prove monotonicity. + pub fn map_monotonic( + self, + mut transform: impl FnMut(f32) -> f32, + ) -> Result { + if self.is_nai() { + return Ok(self); + } + let a = transform(self.min); + let b = transform(self.max); + if a.is_nan() || b.is_nan() { + Err(IntervalError::NanMappedBound) + } else { + Self::new(java_min(a, b), java_max(a, b)) + } + } + pub fn lerp_ranges(self, first: Self, second: Self) -> Self { + if self.is_nai() || first.is_nai() || second.is_nai() { + return Self::NAI; + } + Self::encapsulating(&[ + self.lerp_values(first.min, second.min), + self.lerp_values(first.max, second.min), + self.lerp_values(first.min, second.max), + self.lerp_values(first.max, second.max), + ]) + .unwrap() + } + pub fn lerp_values(self, first: f32, second: f32) -> Self { + if self.is_nai() || first.is_nan() || second.is_nan() { + return Self::NAI; + } + if first.is_finite() && second.is_finite() { + return Self::encapsulating_values( + first + mul_bound(self.min, second - first), + first + mul_bound(self.max, second - first), + ); + } + if first == second { + return Self::exact(first).unwrap(); + } + let a = lerp_infinite_bound(self.min, first, second); + let b = lerp_infinite_bound(self.max, first, second); + if a.is_nan() || b.is_nan() { + Self::NAI + } else { + Self::encapsulating_values(a, b) + } + } + pub fn sign(self) -> Self { + if self.is_nai() { + self + } else if self.min == self.max { + Self::exact(if self.min == 0.0 { + self.min + } else { + self.min.signum() + }) + .unwrap() + } else if self.contains(0.0) { + Self::new( + if self.min == 0.0 { 0.0 } else { -1.0 }, + if self.max == 0.0 { 0.0 } else { 1.0 }, + ) + .unwrap() + } else { + Self::exact(if self.min > 0.0 { 1.0 } else { -1.0 }).unwrap() + } + } +} +fn java_power(base: f32, exponent: f32) -> f32 { + super::arithmetic::java_power(base as f64, exponent as f64) as f32 +} +fn mul_bound(a: f32, b: f32) -> f32 { + if a == 0.0 || b == 0.0 { 0.0 } else { a * b } +} + +fn lerp_infinite_bound(alpha: f32, first: f32, second: f32) -> f32 { + let a = mul_bound(1.0 - alpha, first); + let b = mul_bound(alpha, second); + if a.is_infinite() && b.is_infinite() { + if alpha <= 0.0 { + if second > first { + f32::NEG_INFINITY + } else { + f32::INFINITY + } + } else if alpha >= 1.0 { + if second > first { + f32::INFINITY + } else { + f32::NEG_INFINITY + } + } else { + f32::NAN + } + } else { + a + b + } +} diff --git a/crates/horizon-core/src/density/mod.rs b/crates/horizon-core/src/density/mod.rs new file mode 100644 index 000000000..6bc84a8d1 --- /dev/null +++ b/crates/horizon-core/src/density/mod.rs @@ -0,0 +1,391 @@ +//! Compiled density samplers for Java Edition 26.3. +//! +//! Evaluation primitives and an initial graph compiler; complete terrain +//! generation is pending. Bulk evaluation retains its own floating-point path. +use crate::{ + geometry::Axis, + noise::{DensityError, DensityVolume, Noise}, +}; +use std::sync::Arc; + +mod beardifier; +pub use beardifier::{Beardifier, JigsawJunction, RigidPiece, StructureBounds, TerrainAdjustment}; +mod cache; +mod world_fields; +pub use world_fields::{ + BlendDensitySampler, ContextBoundSampler, DensityBlender, EmptyBlender, WorldField, WorldFields, +}; +mod end_islands; +pub use end_islands::EndIslandSampler; +pub mod graph; +pub use cache::CachingDensitySampler; +mod arithmetic; +mod interpolation; +mod interval; +pub use interpolation::InterpolatedSampler; +pub use interval::{Interval, IntervalError}; +mod rounding; +mod selection; +pub use rounding::{RoundMode, RoundSampler}; +mod power; +pub use power::{PowerSampler, compile_constant_exponent}; +mod slice; +pub use slice::{SliceAxes, SliceSampler}; +mod spline; +pub use spline::{CubicSpline, MultipointSpline, SplineError, SplinePoint, SplineSampler}; +mod surface; +pub use surface::{FindTopSurfaceSampler, compile_surface_search}; +mod terrain_noise; +pub use arithmetic::{BinaryOp, BinarySampler, UnaryOp, UnarySampler}; +pub use selection::{ + DensityValue, IntervalSelectSampler, InvalidIntervals, LerpSampler, RangeChoiceSampler, +}; +pub use terrain_noise::{ + BlendedFbmSet, BlendedNoise, DistanceMetric, DistanceToPointSampler, ShiftNoiseKind, + compile_shift_noise, create_blended_fbm, +}; + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum SampleError { + Volume(DensityError), + ZeroGradientPeriod, + ExactBufferSizeRequired, + CacheIdOutOfRange, + RecursiveCache, + SurfaceRequiresSingleLayer, + SurfaceSearchOverflow, +} +impl From for SampleError { + fn from(value: DensityError) -> Self { + Self::Volume(value) + } +} +impl std::fmt::Display for SampleError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Volume(error) => error.fmt(f), + Self::SurfaceRequiresSingleLayer => { + f.write_str("surface search requires a single Y layer") + } + Self::SurfaceSearchOverflow => { + f.write_str("surface search crossed the integer height domain") + } + Self::CacheIdOutOfRange => f.write_str("density cache id exceeds 65535"), + Self::RecursiveCache => f.write_str("density cache reentered its own evaluation"), + Self::ExactBufferSizeRequired => { + f.write_str("this density sampler requires exactly a volume-sized output") + } + Self::ZeroGradientPeriod => { + f.write_str("repeating gradient has a zero coordinate period") + } + } + } +} +impl std::error::Error for SampleError {} + +/// Worker-owned temporary storage. Samplers can be shared across workers; their +/// scratch buffers cannot. World fields are immutable for an evaluation context. +#[derive(Debug, Default)] +pub struct SamplerContext { + scratch: Vec>, + caches: Option>, + fields: WorldFields, +} +impl SamplerContext { + fn with_buffer( + &mut self, + size: usize, + sample: impl FnOnce(&mut Self, &mut [f32]) -> Result, + ) -> Result { + let mut buffer = self.scratch.pop().unwrap_or_default(); + buffer.resize(size, 0.0); + let result = sample(self, &mut buffer); + self.scratch.push(buffer); + result + } + /// Release retained storage between worlds or after unusually large work. + pub fn clear_scratch(&mut self) { + self.scratch.clear(); + } +} + +pub trait DensitySampler: std::fmt::Debug + Send + Sync { + fn sample_value( + &self, + context: &mut SamplerContext, + position: [i32; 3], + ) -> Result; + + /// The slice length is the logical buffer size. Some samplers fill its tail; + /// others leave it untouched. A short buffer is rejected before any writes. + fn sample_volume( + &self, + context: &mut SamplerContext, + buffer: &mut [f32], + volume: DensityVolume, + ) -> Result<(), SampleError> { + check_buffer(buffer, volume)?; + visit(volume, |index, position| { + buffer[index] = self.sample_value(context, position)?; + Ok(()) + }) + } +} +fn check_buffer(buffer: &[f32], volume: DensityVolume) -> Result<(), SampleError> { + if buffer.len() < volume.size() { + Err(DensityError::BufferTooShort.into()) + } else { + Ok(()) + } +} +fn check_exact_buffer(buffer: &[f32], volume: DensityVolume) -> Result<(), SampleError> { + check_buffer(buffer, volume)?; + if buffer.len() != volume.size() { + Err(SampleError::ExactBufferSizeRequired) + } else { + Ok(()) + } +} +fn visit( + volume: DensityVolume, + mut cell: impl FnMut(usize, [i32; 3]) -> Result<(), SampleError>, +) -> Result<(), SampleError> { + let [sx, sy, sz] = volume.sizes(); + let mut index = 0; + for z in 0..sz { + let bz = volume.block(Axis::Z, z).unwrap(); + for x in 0..sx { + let bx = volume.block(Axis::X, x).unwrap(); + for y in 0..sy { + cell(index, [bx, volume.block(Axis::Y, y).unwrap(), bz])?; + index += 1; + } + } + } + Ok(()) +} + +#[derive(Clone, Copy, Debug)] +pub struct ConstantSampler(pub f32); +impl DensitySampler for ConstantSampler { + fn sample_value(&self, _: &mut SamplerContext, _: [i32; 3]) -> Result { + Ok(self.0) + } + fn sample_volume( + &self, + _: &mut SamplerContext, + buffer: &mut [f32], + volume: DensityVolume, + ) -> Result<(), SampleError> { + check_buffer(buffer, volume)?; + buffer.fill(self.0); + Ok(()) + } +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum TilingMode { + ClampToEdge, + Repeat, + MirroredRepeat, +} + +#[derive(Clone, Copy, Debug)] +pub struct GradientSampler { + axis: Axis, + tiling: TilingMode, + from: i32, + to: i32, + period: i32, + value: f32, + factor: f32, +} +impl GradientSampler { + pub fn new( + axis: Axis, + tiling: TilingMode, + from: i32, + to: i32, + from_value: f32, + to_value: f32, + ) -> Self { + let period = to.wrapping_sub(from); + Self { + axis, + tiling, + from, + to, + period, + value: from_value, + factor: (to_value - from_value) / period as f32, + } + } + pub fn compute(&self, coordinate: i32) -> Result { + let distance = match self.tiling { + TilingMode::ClampToEdge => coordinate + .clamp(self.from.min(self.to), self.from.max(self.to)) + .wrapping_sub(self.from), + TilingMode::Repeat | TilingMode::MirroredRepeat => { + if self.period == 0 { + return Err(SampleError::ZeroGradientPeriod); + } + let delta = coordinate.wrapping_sub(self.from); + // Java floorDiv/floorMod wrap MIN / -1, and round toward -infinity. + let mut cycle = delta.wrapping_div(self.period); + let mut remainder = delta.wrapping_rem(self.period); + if remainder != 0 && (delta ^ self.period) < 0 { + cycle = cycle.wrapping_sub(1); + remainder = remainder.wrapping_add(self.period); + } + if self.tiling == TilingMode::MirroredRepeat && cycle & 1 != 0 { + self.period.wrapping_sub(remainder) + } else { + remainder + } + } + }; + Ok(self.value + distance as f32 * self.factor) + } +} +impl DensitySampler for GradientSampler { + fn sample_value(&self, _: &mut SamplerContext, position: [i32; 3]) -> Result { + self.compute(position[self.axis as usize]) + } + fn sample_volume( + &self, + _: &mut SamplerContext, + buffer: &mut [f32], + volume: DensityVolume, + ) -> Result<(), SampleError> { + check_buffer(buffer, volume)?; + let [sx, sy, sz] = volume.sizes(); + for coordinate in 0..volume.sizes()[self.axis as usize] { + let value = self.compute(volume.block(self.axis, coordinate).unwrap())?; + match self.axis { + Axis::X => { + for z in 0..sz { + let start = (coordinate + z * sx) * sy; + buffer[start..start + sy].fill(value); + } + } + Axis::Y => { + for z in 0..sz { + for x in 0..sx { + buffer[(x + z * sx) * sy + coordinate] = value; + } + } + } + Axis::Z => { + let start = coordinate * sx * sy; + buffer[start..start + sx * sy].fill(value); + } + } + } + Ok(()) + } +} + +#[derive(Clone, Debug)] +pub struct NoiseSampler { + pub noise: Arc, + pub xz_scale: f64, + pub y_scale: f64, +} +impl DensitySampler for NoiseSampler { + fn sample_value( + &self, + _: &mut SamplerContext, + [x, y, z]: [i32; 3], + ) -> Result { + Ok(self.noise.get3( + x as f64 * self.xz_scale, + y as f64 * self.y_scale, + z as f64 * self.xz_scale, + )) + } + fn sample_volume( + &self, + _: &mut SamplerContext, + buffer: &mut [f32], + volume: DensityVolume, + ) -> Result<(), SampleError> { + check_buffer(buffer, volume)?; + buffer.fill(0.0); + Ok(self + .noise + .add_to_volume(buffer, volume, self.xz_scale, self.y_scale, 1.0)?) + } +} + +/// Compiled XZ or XYZ shifted noise. `None` selects vanilla's XZ specialization; +/// it must not add a synthetic zero Y shift (that would change signed zeros). +#[derive(Clone, Debug)] +pub struct ShiftedNoiseSampler { + pub source: NoiseSampler, + pub shift_x: Arc, + pub shift_y: Option>, + pub shift_z: Arc, +} +impl DensitySampler for ShiftedNoiseSampler { + fn sample_value( + &self, + context: &mut SamplerContext, + position: [i32; 3], + ) -> Result { + let x = position[0] as f64 * self.source.xz_scale + + self.shift_x.sample_value(context, position)? as f64; + let mut y = position[1] as f64 * self.source.y_scale; + if let Some(shift) = &self.shift_y { + y += shift.sample_value(context, position)? as f64; + } + let z = position[2] as f64 * self.source.xz_scale + + self.shift_z.sample_value(context, position)? as f64; + Ok(self.source.noise.get3(x, y, z)) + } + fn sample_volume( + &self, + context: &mut SamplerContext, + buffer: &mut [f32], + volume: DensityVolume, + ) -> Result<(), SampleError> { + check_buffer(buffer, volume)?; + self.shift_x.sample_volume(context, buffer, volume)?; + if let Some(shift_y) = &self.shift_y { + context.with_buffer(volume.size(), |context, y| { + shift_y.sample_volume(context, y, volume)?; + context.with_buffer(volume.size(), |context, z| { + self.shift_z.sample_volume(context, z, volume)?; + self.sample_shifted_volume(buffer, volume, Some(y), z) + }) + }) + } else { + context.with_buffer(volume.size(), |context, z| { + self.shift_z.sample_volume(context, z, volume)?; + self.sample_shifted_volume(buffer, volume, None, z) + }) + } + } +} +impl ShiftedNoiseSampler { + fn sample_shifted_volume( + &self, + buffer: &mut [f32], + volume: DensityVolume, + shift_y: Option<&[f32]>, + shift_z: &[f32], + ) -> Result<(), SampleError> { + visit(volume, |index, [x, y, z]| { + let x = x as f64 * self.source.xz_scale + buffer[index] as f64; + let mut y = y as f64 * self.source.y_scale; + if let Some(shift) = shift_y { + y += shift[index] as f64; + } + let z = z as f64 * self.source.xz_scale + shift_z[index] as f64; + buffer[index] = self.source.noise.get3(x, y, z); + Ok(()) + }) + } +} + +#[cfg(test)] +mod tests; diff --git a/crates/horizon-core/src/density/power.rs b/crates/horizon-core/src/density/power.rs new file mode 100644 index 000000000..b400093ae --- /dev/null +++ b/crates/horizon-core/src/density/power.rs @@ -0,0 +1,72 @@ +use super::*; + +/// Both operands evaluate in base/exponent order, including zero and one bases. +#[derive(Clone, Debug)] +pub struct PowerSampler { + pub base: Arc, + pub exponent: Arc, +} +impl DensitySampler for PowerSampler { + fn sample_value( + &self, + context: &mut SamplerContext, + position: [i32; 3], + ) -> Result { + let base = self.base.sample_value(context, position)?; + let exponent = self.exponent.sample_value(context, position)?; + Ok(super::arithmetic::java_power(base as f64, exponent as f64) as f32) + } + fn sample_volume( + &self, + context: &mut SamplerContext, + buffer: &mut [f32], + volume: DensityVolume, + ) -> Result<(), SampleError> { + check_exact_buffer(buffer, volume)?; + self.base.sample_volume(context, buffer, volume)?; + context.with_buffer(volume.size(), |context, scratch| { + self.exponent.sample_volume(context, scratch, volume)?; + for (base, exponent) in buffer.iter_mut().zip(scratch) { + *base = super::arithmetic::java_power(*base as f64, *exponent as f64) as f32; + } + Ok(()) + }) + } +} + +/// Only sqrt/identity/square/cube receive the negative-exponent reciprocal. +/// Other exponents return directly from vanilla's signed fallback sampler. +pub fn compile_constant_exponent( + base: Arc, + exponent: f32, +) -> Arc { + let positive: Arc = match exponent.abs() { + 0.5 => Arc::new(UnarySampler { + input: base, + operation: UnaryOp::Sqrt, + }), + 1.0 => base, + 2.0 => Arc::new(UnarySampler { + input: base, + operation: UnaryOp::Square, + }), + 3.0 => Arc::new(UnarySampler { + input: base, + operation: UnaryOp::Cube, + }), + _ => { + return Arc::new(UnarySampler { + input: base, + operation: UnaryOp::PowerExponent(exponent as f64), + }); + } + }; + if exponent < 0.0 { + Arc::new(UnarySampler { + input: positive, + operation: UnaryOp::Reciprocal, + }) + } else { + positive + } +} diff --git a/crates/horizon-core/src/density/rounding.rs b/crates/horizon-core/src/density/rounding.rs new file mode 100644 index 000000000..4ac9bbe83 --- /dev/null +++ b/crates/horizon-core/src/density/rounding.rs @@ -0,0 +1,98 @@ +use super::*; + +#[derive(Clone, Copy, Debug)] +pub enum RoundMode { + Floor, + Round, + Ceil, + Truncate, +} +impl RoundMode { + pub(super) fn integer(self, value: f32) -> f32 { + match self { + Self::Floor => (value as f64).floor() as f32, + Self::Ceil => (value as f64).ceil() as f32, + Self::Truncate => { + if value > 0.0 { + (value as f64).floor() as f32 + } else { + (value as f64).ceil() as f32 + } + } + Self::Round => { + // Math.round(float): ties go toward positive infinity, NaNs + // become zero, and the result saturates to Java's int domain. + let bits = value.to_bits() as i32; + let shift = 149 - ((bits >> 23) & 0xff); + let rounded = if (0..32).contains(&shift) { + let mut significand = (bits & 0x7f_ffff) | 0x80_0000; + if bits < 0 { + significand = -significand; + } + ((significand >> shift) + 1) >> 1 + } else { + value as i32 + }; + rounded as f32 + } + } + } + fn apply(self, input: f32, multiple: f32) -> f32 { + if multiple == 0.0 { + input + } else { + self.integer(input / multiple) * multiple + } + } +} + +/// A missing multiple selects vanilla's literal-one specialization. A supplied +/// sampler is evaluated even when its value is zero or always one. +#[derive(Clone, Debug)] +pub struct RoundSampler { + pub mode: RoundMode, + pub input: Arc, + pub multiple: Option>, +} +impl DensitySampler for RoundSampler { + fn sample_value( + &self, + context: &mut SamplerContext, + position: [i32; 3], + ) -> Result { + let input = self.input.sample_value(context, position)?; + Ok(if let Some(multiple) = &self.multiple { + self.mode + .apply(input, multiple.sample_value(context, position)?) + } else { + self.mode.integer(input) + }) + } + fn sample_volume( + &self, + context: &mut SamplerContext, + buffer: &mut [f32], + volume: DensityVolume, + ) -> Result<(), SampleError> { + if self.multiple.is_some() { + check_exact_buffer(buffer, volume)?; + } else { + check_buffer(buffer, volume)?; + } + self.input.sample_volume(context, buffer, volume)?; + if let Some(multiple) = &self.multiple { + context.with_buffer(volume.size(), |context, scratch| { + multiple.sample_volume(context, scratch, volume)?; + for (input, multiple) in buffer.iter_mut().zip(scratch) { + *input = self.mode.apply(*input, *multiple); + } + Ok(()) + }) + } else { + for value in buffer { + *value = self.mode.integer(*value); + } + Ok(()) + } + } +} diff --git a/crates/horizon-core/src/density/selection.rs b/crates/horizon-core/src/density/selection.rs new file mode 100644 index 000000000..eed6145ff --- /dev/null +++ b/crates/horizon-core/src/density/selection.rs @@ -0,0 +1,228 @@ +use super::*; + +#[derive(Clone, Debug)] +pub struct RangeChoiceSampler { + pub input: Arc, + pub min_inclusive: f32, + pub max_exclusive: f32, + pub when_in_range: Arc, + pub when_out_of_range: Arc, +} +impl RangeChoiceSampler { + fn contains(&self, value: f32) -> bool { + value >= self.min_inclusive && value < self.max_exclusive + } +} +impl DensitySampler for RangeChoiceSampler { + fn sample_value( + &self, + context: &mut SamplerContext, + position: [i32; 3], + ) -> Result { + if self.contains(self.input.sample_value(context, position)?) { + self.when_in_range.sample_value(context, position) + } else { + self.when_out_of_range.sample_value(context, position) + } + } + fn sample_volume( + &self, + context: &mut SamplerContext, + buffer: &mut [f32], + volume: DensityVolume, + ) -> Result<(), SampleError> { + check_exact_buffer(buffer, volume)?; + // Vanilla evaluates the in-range branch before the selector in bulk. + self.when_in_range.sample_volume(context, buffer, volume)?; + context.with_buffer(volume.size(), |context, input| { + self.input.sample_volume(context, input, volume)?; + context.with_buffer(volume.size(), |context, outside| { + self.when_out_of_range + .sample_volume(context, outside, volume)?; + for i in 0..buffer.len() { + if !self.contains(input[i]) { + buffer[i] = outside[i]; + } + } + Ok(()) + }) + }) + } +} + +/// An explicitly compiled value. Distinguishing literal constants here avoids +/// scratch allocation in the constant-endpoint interpolation specializations. +#[derive(Clone, Debug)] +pub enum DensityValue { + Constant(f32), + Sampler(Arc), +} +impl DensityValue { + fn sample_value( + &self, + context: &mut SamplerContext, + position: [i32; 3], + ) -> Result { + match self { + Self::Constant(value) => Ok(*value), + Self::Sampler(sampler) => sampler.sample_value(context, position), + } + } + fn with_volume( + &self, + context: &mut SamplerContext, + volume: DensityVolume, + use_values: impl FnOnce(&mut SamplerContext, Values<'_>) -> Result, + ) -> Result { + match self { + Self::Constant(value) => use_values(context, Values::Constant(*value)), + Self::Sampler(sampler) => context.with_buffer(volume.size(), |context, buffer| { + sampler.sample_volume(context, buffer, volume)?; + use_values(context, Values::Buffer(buffer)) + }), + } + } +} +#[derive(Clone, Copy)] +enum Values<'a> { + Constant(f32), + Buffer(&'a [f32]), +} +impl Values<'_> { + fn get(self, index: usize) -> f32 { + match self { + Self::Constant(value) => value, + Self::Buffer(buffer) => buffer[index], + } + } +} +#[derive(Clone, Debug)] +pub struct LerpSampler { + pub alpha: Arc, + pub first: DensityValue, + pub second: DensityValue, +} +fn interpolate(alpha: f32, first: f32, second: f32) -> f32 { + if alpha == 0.0 { + first + } else if alpha == 1.0 { + second + } else { + first + alpha * (second - first) + } +} +impl DensitySampler for LerpSampler { + fn sample_value( + &self, + context: &mut SamplerContext, + position: [i32; 3], + ) -> Result { + let alpha = self.alpha.sample_value(context, position)?; + if alpha == 0.0 { + return self.first.sample_value(context, position); + } + if alpha == 1.0 { + return self.second.sample_value(context, position); + } + let first = self.first.sample_value(context, position)?; + let second = self.second.sample_value(context, position)?; + Ok(interpolate(alpha, first, second)) + } + fn sample_volume( + &self, + context: &mut SamplerContext, + buffer: &mut [f32], + volume: DensityVolume, + ) -> Result<(), SampleError> { + check_exact_buffer(buffer, volume)?; + self.alpha.sample_volume(context, buffer, volume)?; + self.first.with_volume(context, volume, |context, first| { + self.second.with_volume(context, volume, |_, second| { + for (index, alpha) in buffer.iter_mut().enumerate() { + *alpha = interpolate(*alpha, first.get(index), second.get(index)); + } + Ok(()) + }) + }) + } +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct InvalidIntervals; +impl std::fmt::Display for InvalidIntervals { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("compiled interval selection requires one more branch than thresholds, at most 256 branches") + } +} +impl std::error::Error for InvalidIntervals {} + +/// Compiled interval selection. Threshold order is preserved, including NaNs +/// and equal thresholds; sorting and codec validation belong to the compiler. +#[derive(Clone, Debug)] +pub struct IntervalSelectSampler { + input: Arc, + thresholds: Vec, + branches: Vec>, +} +impl IntervalSelectSampler { + pub fn new( + input: Arc, + thresholds: Vec, + branches: Vec>, + ) -> Result { + if branches.len() > 256 || thresholds.len().checked_add(1) != Some(branches.len()) { + return Err(InvalidIntervals); + } + Ok(Self { + input, + thresholds, + branches, + }) + } + fn select(&self, value: f32) -> usize { + self.thresholds + .iter() + .position(|threshold| value < *threshold) + .unwrap_or(self.branches.len() - 1) + } +} +impl DensitySampler for IntervalSelectSampler { + fn sample_value( + &self, + context: &mut SamplerContext, + position: [i32; 3], + ) -> Result { + let value = self.input.sample_value(context, position)?; + self.branches[self.select(value)].sample_value(context, position) + } + fn sample_volume( + &self, + context: &mut SamplerContext, + buffer: &mut [f32], + volume: DensityVolume, + ) -> Result<(), SampleError> { + check_exact_buffer(buffer, volume)?; + let total = volume + .size() + .checked_mul(self.branches.len()) + .filter(|count| *count <= isize::MAX as usize / size_of::()) + .ok_or(DensityError::VolumeTooLarge)?; + self.input.sample_volume(context, buffer, volume)?; + // Contiguous retained storage replaces a separate allocation per branch. + // Each child still receives a slice with exactly the logical volume size. + context.with_buffer(total, |context, values| { + for (branch, output) in self + .branches + .iter() + .zip(values.chunks_exact_mut(volume.size())) + { + branch.sample_volume(context, output, volume)?; + } + // Delay every output selection until all child volumes have returned. + for (index, input) in buffer.iter_mut().enumerate() { + *input = values[self.select(*input) * volume.size() + index]; + } + Ok(()) + }) + } +} diff --git a/crates/horizon-core/src/density/slice.rs b/crates/horizon-core/src/density/slice.rs new file mode 100644 index 000000000..e1f6d4ed7 --- /dev/null +++ b/crates/horizon-core/src/density/slice.rs @@ -0,0 +1,85 @@ +use super::*; + +/// Coordinates fixed by the compiled single-axis or combined XZ slice node. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum SliceAxes { + X(i32), + Y(i32), + Z(i32), + Xz { x: i32, z: i32 }, +} +impl SliceAxes { + fn coordinates(self) -> [Option; 3] { + match self { + Self::X(x) => [Some(x), None, None], + Self::Y(y) => [None, Some(y), None], + Self::Z(z) => [None, None, Some(z)], + Self::Xz { x, z } => [Some(x), None, Some(z)], + } + } +} + +#[derive(Clone, Debug)] +pub struct SliceSampler { + pub input: Arc, + pub axes: SliceAxes, +} +impl DensitySampler for SliceSampler { + fn sample_value( + &self, + context: &mut SamplerContext, + mut position: [i32; 3], + ) -> Result { + for (axis, fixed) in self.axes.coordinates().into_iter().enumerate() { + if let Some(coordinate) = fixed { + position[axis] = coordinate; + } + } + self.input.sample_value(context, position) + } + + fn sample_volume( + &self, + context: &mut SamplerContext, + buffer: &mut [f32], + volume: DensityVolume, + ) -> Result<(), SampleError> { + check_buffer(buffer, volume)?; + let fixed = self.axes.coordinates(); + let mut sizes = volume.sizes().map(|size| size as i32); + let mut minimum = volume.minimum(); + for (axis, coordinate) in fixed.into_iter().enumerate() { + if let Some(coordinate) = coordinate { + sizes[axis] = 1; + minimum[axis] = coordinate; + } + } + // Keep the original steps, even on fixed axes: cached children observe + // the complete volume descriptor. An unchanged slice delegates directly + // and therefore retains the child's tail and partial-write behavior. + let reduced = DensityVolume::new(sizes, minimum, volume.steps())?; + if reduced == volume { + return self.input.sample_volume(context, buffer, volume); + } + context.with_buffer(reduced.size(), |context, samples| { + self.input.sample_volume(context, samples, reduced)?; + let [sx, sy, sz] = volume.sizes(); + let [rx, ry, _] = reduced.sizes(); + for z in 0..sz { + let source_z = if fixed[2].is_some() { 0 } else { z }; + for x in 0..sx { + let source_x = if fixed[0].is_some() { 0 } else { x }; + let source = (source_x + source_z * rx) * ry; + let target = (x + z * sx) * sy; + let column = &mut buffer[target..target + sy]; + if fixed[1].is_some() { + column.fill(samples[source]); + } else { + column.copy_from_slice(&samples[source..source + sy]); + } + } + } + Ok(()) + }) + } +} diff --git a/crates/horizon-core/src/density/spline.rs b/crates/horizon-core/src/density/spline.rs new file mode 100644 index 000000000..14eaa0adf --- /dev/null +++ b/crates/horizon-core/src/density/spline.rs @@ -0,0 +1,344 @@ +use super::*; +use std::collections::HashMap; + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum SplineError { + EmptyPoints, + NestingTooDeep, + MissingCoordinate, + NanConstant, +} +impl std::fmt::Display for SplineError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(match self { + Self::NanConstant => "a compiled constant spline cannot be NaN", + Self::EmptyPoints => "a multipoint spline requires at least one point", + Self::NestingTooDeep => "spline nesting exceeds 256 levels", + Self::MissingCoordinate => "spline coordinate has no density sampler", + }) + } +} +impl std::error::Error for SplineError {} + +#[derive(Clone, Debug)] +pub struct SplinePoint { + pub location: f32, + pub value: CubicSpline, + pub derivative: f32, +} +#[derive(Clone, Debug)] +pub struct MultipointSpline { + pub(super) coordinate: C, + pub(super) points: Vec>, + pub(super) depth: usize, +} +/// An immutable spline definition. Coordinate indices are resolved against a +/// sampler table at compilation. Point order is retained, including NaNs and +/// equal locations; codec ordering constraints belong to serialized definitions. +#[derive(Clone, Debug)] +pub enum CubicSpline { + Constant(f32), + Multipoint(Arc>), +} +impl CubicSpline { + pub fn multipoint(coordinate: C, points: Vec>) -> Result { + let depth = points + .iter() + .map(|p| match &p.value { + Self::Constant(_) => 0, + Self::Multipoint(node) => node.depth, + }) + .max() + .ok_or(SplineError::EmptyPoints)? + + 1; + if depth > 256 { + return Err(SplineError::NestingTooDeep); + } + Ok(Self::Multipoint(Arc::new(MultipointSpline { + coordinate, + points, + depth, + }))) + } + fn sample( + &self, + coordinate: &mut impl FnMut(C) -> Result, + ) -> Result { + let node = match self { + Self::Constant(value) => return Ok(*value), + Self::Multipoint(node) => node, + }; + let input = coordinate(node.coordinate)?; + // Vanilla binarySearch finds the first strictly greater location. Keep + // this search even for manually supplied unsorted or NaN locations. + let mut first = 0; + let mut remaining = node.points.len(); + while remaining != 0 { + let half = remaining / 2; + let middle = first + half; + if input < node.points[middle].location { + remaining = half; + } else { + first = middle + 1; + remaining -= half + 1; + } + } + if first == 0 || first == node.points.len() { + let endpoint = if first == 0 { 0 } else { first - 1 }; + let point = &node.points[endpoint]; + let value = point.value.sample(coordinate)?; + return Ok(if point.derivative == 0.0 { + value + } else { + value + point.derivative * (input - point.location) + }); + } + let left = &node.points[first - 1]; + let right = &node.points[first]; + let width = right.location - left.location; + let alpha = (input - left.location) / width; + let left_value = left.value.sample(coordinate)?; + let right_value = right.value.sample(coordinate)?; + let left_correction = left.derivative * width - (right_value - left_value); + let right_correction = -right.derivative * width + (right_value - left_value); + let linear = left_value + alpha * (right_value - left_value); + let correction = left_correction + alpha * (right_correction - left_correction); + Ok(linear + (alpha * (1.0 - alpha)) * correction) + } + /// Vanilla's conservative range analysis, with coordinate ranges supplied + /// by the enclosing graph. Child ranges are evaluated in reference order. + pub fn range( + &self, + coordinate: &mut impl FnMut(C) -> Interval, + ) -> Result { + self.try_range(&mut |id| Ok(coordinate(id))) + } + /// Fallible coordinate range lookup, preserving early returns and error order. + pub fn try_range>( + &self, + coordinate: &mut impl FnMut(C) -> Result, + ) -> Result { + use super::arithmetic::{java_max, java_min}; + let node = match self { + Self::Constant(value) => return Interval::exact(*value).map_err(E::from), + Self::Multipoint(node) => node, + }; + let input = coordinate(node.coordinate)?; + if input.is_nai() { + return Ok(input); + } + let mut minimum = f32::INFINITY; + let mut maximum = f32::NEG_INFINITY; + let first = &node.points[0]; + let last = node.points.last().unwrap(); + let extend = |point: &SplinePoint, input: f32, value: f32| { + if point.derivative == 0.0 { + value + } else { + value + point.derivative * (input - point.location) + } + }; + if input.min() < first.location { + let value = first.value.try_range(coordinate)?; + let low = extend(first, input.min(), value.min()); + let high = extend(first, input.min(), value.max()); + minimum = java_min(minimum, java_min(low, high)); + maximum = java_max(maximum, java_max(low, high)); + } + if input.max() > last.location { + let value = last.value.try_range(coordinate)?; + let low = extend(last, input.max(), value.min()); + let high = extend(last, input.max(), value.max()); + minimum = java_min(minimum, java_min(low, high)); + maximum = java_max(maximum, java_max(low, high)); + } + let ranges = node + .points + .iter() + .map(|point| point.value.try_range(coordinate)) + .collect::, _>>()?; + for range in &ranges { + minimum = java_min(minimum, range.min()); + maximum = java_max(maximum, range.max()); + } + for (points, ranges) in node.points.windows(2).zip(ranges.windows(2)) { + let width = points[1].location - points[0].location; + let left = ranges[0]; + let right = ranges[1]; + let derivative_left = points[0].derivative; + let derivative_right = points[1].derivative; + if derivative_left == 0.0 && derivative_right == 0.0 { + continue; + } + let tangent_left = derivative_left * width; + let tangent_right = derivative_right * width; + let value_min = java_min(left.min(), right.min()); + let value_max = java_max(left.max(), right.max()); + let low_left = tangent_left - right.max() + left.min(); + let high_left = tangent_left - right.min() + left.max(); + let low_right = -tangent_right + right.min() - left.max(); + let high_right = -tangent_right + right.max() - left.min(); + minimum = java_min(minimum, value_min + 0.25 * java_min(low_left, low_right)); + maximum = java_max(maximum, value_max + 0.25 * java_max(high_left, high_right)); + } + Interval::new(minimum, maximum).map_err(E::from) + } + pub(super) fn coordinates_mut(&mut self) -> Vec<&mut C> { + match self { + Self::Constant(_) => Vec::new(), + Self::Multipoint(node) => { + let node = Arc::make_mut(node); + let mut coordinates = vec![&mut node.coordinate]; + for point in &mut node.points { + coordinates.extend(point.value.coordinates_mut()); + } + coordinates + } + } + } + pub(super) fn try_map_coordinates( + &self, + map: &mut impl FnMut(C) -> Result, + ) -> Result, E> { + Ok(match self { + Self::Constant(value) => CubicSpline::Constant(*value), + Self::Multipoint(node) => { + let coordinate = map(node.coordinate)?; + let points = node + .points + .iter() + .map(|point| { + Ok(SplinePoint { + location: point.location, + value: point.value.try_map_coordinates(map)?, + derivative: point.derivative, + }) + }) + .collect::, E>>()?; + CubicSpline::Multipoint(Arc::new(MultipointSpline { + coordinate, + points, + depth: node.depth, + })) + } + }) + } +} +impl CubicSpline { + fn compile( + &self, + inputs: &[Arc], + ids: &mut HashMap, + coordinates: &mut Vec>, + ) -> Result { + match self { + Self::Constant(value) => Ok(Self::Constant(*value)), + Self::Multipoint(node) => { + let coordinate = if let Some(index) = ids.get(&node.coordinate) { + *index + } else { + let input = inputs + .get(node.coordinate) + .ok_or(SplineError::MissingCoordinate)?; + let index = coordinates.len(); + coordinates.push(input.clone()); + ids.insert(node.coordinate, index); + index + }; + let points = node + .points + .iter() + .map(|point| { + Ok(SplinePoint { + location: point.location, + derivative: point.derivative, + value: point.value.compile(inputs, ids, coordinates)?, + }) + }) + .collect::, SplineError>>()?; + Self::multipoint(coordinate, points) + } + } + } +} + +#[derive(Clone, Debug)] +pub struct SplineSampler { + spline: CubicSpline, + coordinates: Vec>, +} +impl SplineSampler { + /// Equal coordinate IDs share evaluation results. Structural function + /// identity and deduplication are supplied by the density graph compiler. + pub fn new( + spline: &CubicSpline, + inputs: &[Arc], + ) -> Result { + if matches!(spline, CubicSpline::Constant(value) if value.is_nan()) { + return Err(SplineError::NanConstant); + } + let mut coordinates = Vec::new(); + let spline = spline.compile(inputs, &mut HashMap::new(), &mut coordinates)?; + Ok(Self { + spline, + coordinates, + }) + } + pub fn coordinate_count(&self) -> usize { + self.coordinates.len() + } +} +impl DensitySampler for SplineSampler { + fn sample_value( + &self, + context: &mut SamplerContext, + position: [i32; 3], + ) -> Result { + context.with_buffer(self.coordinates.len(), |context, values| { + values.fill(f32::NAN); + self.spline.sample(&mut |id| { + if values[id].is_nan() { + values[id] = self.coordinates[id].sample_value(context, position)?; + } + Ok(values[id]) + }) + }) + } + fn sample_volume( + &self, + context: &mut SamplerContext, + output: &mut [f32], + volume: DensityVolume, + ) -> Result<(), SampleError> { + check_buffer(output, volume)?; + if let CubicSpline::Constant(value) = self.spline { + output.fill(value); + return Ok(()); + } + check_exact_buffer(output, volume)?; + let mut buffers: Vec>> = + (0..self.coordinates.len()).map(|_| None).collect(); + let result = (|| { + for (index, value) in output.iter_mut().enumerate() { + *value = self.spline.sample(&mut |id| { + if buffers[id].is_none() { + let mut buffer = context.scratch.pop().unwrap_or_default(); + buffer.resize(volume.size(), 0.0); + if let Err(error) = + self.coordinates[id].sample_volume(context, &mut buffer, volume) + { + context.scratch.push(buffer); + return Err(error); + } + buffers[id] = Some(buffer); + } + Ok(buffers[id].as_ref().unwrap()[index]) + })?; + } + Ok(()) + })(); + // Release in coordinate-ID order, also after a later lazy child fails. + context.scratch.extend(buffers.into_iter().flatten()); + result + } +} diff --git a/crates/horizon-core/src/density/surface.rs b/crates/horizon-core/src/density/surface.rs new file mode 100644 index 000000000..df437bc2b --- /dev/null +++ b/crates/horizon-core/src/density/surface.rs @@ -0,0 +1,99 @@ +use super::*; + +/// The unsliced search primitive. Compiled terrain graphs wrap this in a Y=0 +/// slice through `compile_surface_search`, so their upper bound is horizontal. +#[derive(Clone, Debug)] +pub struct FindTopSurfaceSampler { + density: Arc, + upper_bound: Arc, + lower_bound: i32, + cell_height: i32, +} +impl FindTopSurfaceSampler { + pub fn new( + density: Arc, + upper_bound: Arc, + lower_bound: i32, + cell_height: i32, + ) -> Result { + if cell_height <= 0 { + return Err(DensityError::NonpositiveSteps.into()); + } + Ok(Self { + density, + upper_bound, + lower_bound, + cell_height, + }) + } + fn find_surface_from( + &self, + context: &mut SamplerContext, + x: i32, + z: i32, + upper: f32, + ) -> Result { + let quotient = upper / self.cell_height as f32; + // Java 26.3 Mth.floor(float) widens to double, calls Math.floor, + // then uses a saturating double-to-int conversion (NaN becomes zero). + let floor = (quotient as f64).floor() as i32; + let mut y = floor.wrapping_mul(self.cell_height); + if y <= self.lower_bound { + return Ok(self.lower_bound); + } + while y >= self.lower_bound { + if self.density.sample_value(context, [x, y, z])? > 0.0 { + return Ok(y); + } + // Malformed manually constructed bounds can otherwise wrap and + // loop forever; serialized vanilla terrain bounds do not reach this. + y = y + .checked_sub(self.cell_height) + .ok_or(SampleError::SurfaceSearchOverflow)?; + } + Ok(self.lower_bound) + } +} +impl DensitySampler for FindTopSurfaceSampler { + fn sample_value( + &self, + context: &mut SamplerContext, + [x, y, z]: [i32; 3], + ) -> Result { + let upper = self.upper_bound.sample_value(context, [x, y, z])?; + Ok(self.find_surface_from(context, x, z, upper)? as f32) + } + fn sample_volume( + &self, + context: &mut SamplerContext, + output: &mut [f32], + volume: DensityVolume, + ) -> Result<(), SampleError> { + check_buffer(output, volume)?; + if volume.sizes()[1] != 1 { + return Err(SampleError::SurfaceRequiresSingleLayer); + } + self.upper_bound.sample_volume(context, output, volume)?; + visit(volume, |index, [x, _, z]| { + output[index] = self.find_surface_from(context, x, z, output[index])? as f32; + Ok(()) + }) + } +} + +pub fn compile_surface_search( + density: Arc, + upper_bound: Arc, + lower_bound: i32, + cell_height: i32, +) -> Result { + Ok(SliceSampler { + input: Arc::new(FindTopSurfaceSampler::new( + density, + upper_bound, + lower_bound, + cell_height, + )?), + axes: SliceAxes::Y(0), + }) +} diff --git a/crates/horizon-core/src/density/terrain_noise.rs b/crates/horizon-core/src/density/terrain_noise.rs new file mode 100644 index 000000000..908a06576 --- /dev/null +++ b/crates/horizon-core/src/density/terrain_noise.rs @@ -0,0 +1,220 @@ +use super::*; +use crate::{ + noise::{NoiseBuildError, NoiseStack, SmearedPerlinNoise}, + random::RandomSource, +}; + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum ShiftNoiseKind { + Shift, + ShiftA, + ShiftB, +} + +/// Compile the three offset-noise variants without changing their bulk paths. +pub fn compile_shift_noise(noise: Arc, kind: ShiftNoiseKind) -> Arc { + if kind == ShiftNoiseKind::ShiftB { + return Arc::new(ShiftBSampler { noise }); + } + Arc::new(UnarySampler { + input: Arc::new(NoiseSampler { + noise, + xz_scale: 0.25, + y_scale: if kind == ShiftNoiseKind::ShiftA { + 0.0 + } else { + 0.25 + }, + }), + operation: UnaryOp::Multiply(4.0), + }) +} +#[derive(Clone, Debug)] +struct ShiftBSampler { + noise: Arc, +} +impl DensitySampler for ShiftBSampler { + fn sample_value( + &self, + _: &mut SamplerContext, + [x, _, z]: [i32; 3], + ) -> Result { + Ok(self.noise.get3(z as f64 * 0.25, x as f64 * 0.25, 0.0) * 4.0) + } + fn sample_volume( + &self, + context: &mut SamplerContext, + buffer: &mut [f32], + volume: DensityVolume, + ) -> Result<(), SampleError> { + check_buffer(buffer, volume)?; + let [sx, sy, sz] = volume.sizes(); + let [mx, _, mz] = volume.minimum(); + let [dx, _, dz] = volume.steps(); + let transposed = DensityVolume::new([sz as i32, sx as i32, 1], [mz, mx, 0], [dz, dx, 1])?; + context.with_buffer(transposed.size(), |_, plane| { + plane.fill(0.0); + self.noise + .add_to_volume(plane, transposed, 0.25, 0.25, 4.0)?; + for z in 0..sz { + for x in 0..sx { + let start = (x + z * sx) * sy; + buffer[start..start + sy].fill(plane[x + z * sx]); + } + } + Ok(()) + }) + } +} + +/// Parameters for vanilla's old blended terrain density function. Serialized +/// codec limits and compile-context seed lookup are separate integration work. +#[derive(Clone, Copy, Debug)] +pub struct BlendedNoise { + pub xz_scale: f64, + pub y_scale: f64, + pub xz_factor: f64, + pub y_factor: f64, + pub smear_scale_multiplier: f64, +} +#[derive(Clone, Debug)] +pub struct BlendedFbmSet { + pub min_limit: NoiseStack, + pub max_limit: NoiseStack, + pub main: NoiseStack, +} +impl BlendedNoise { + pub fn create_fbm_set( + &self, + random: &mut impl RandomSource, + ) -> Result { + let smear = (684.412 * self.y_scale) * self.smear_scale_multiplier; + let main_smear = smear / self.y_factor; + Ok(BlendedFbmSet { + min_limit: create_blended_fbm(random, -15, smear, 0.9999847412109375)?, + max_limit: create_blended_fbm(random, -15, smear, 0.9999847412109375)?, + main: create_blended_fbm(random, -7, main_smear, 12.75)?, + }) + } + pub fn compile(&self, random: &mut impl RandomSource) -> Result { + let layers = self.create_fbm_set(random)?; + let xz_scale = 684.412 * self.xz_scale; + let y_scale = 684.412 * self.y_scale; + let min_limit = Arc::new(NoiseSampler { + noise: Arc::new(layers.min_limit), + xz_scale, + y_scale, + }); + let max_limit = Arc::new(NoiseSampler { + noise: Arc::new(layers.max_limit), + xz_scale, + y_scale, + }); + let main = Arc::new(NoiseSampler { + noise: Arc::new(layers.main), + xz_scale: xz_scale / self.xz_factor, + y_scale: y_scale / self.y_factor, + }); + let shifted = Arc::new(UnarySampler { + input: main, + operation: UnaryOp::Add(0.5), + }); + let alpha = Arc::new(UnarySampler { + input: shifted, + operation: UnaryOp::Clamp { min: 0.0, max: 1.0 }, + }); + Ok(LerpSampler { + alpha, + first: DensityValue::Sampler(min_limit), + second: DensityValue::Sampler(max_limit), + }) + } + pub fn range(&self) -> Result { + let smear = (684.412 * self.y_scale) * self.smear_scale_multiplier; + let mut range = Interval::exact(0.0)?; + let mut frequency = 1.0; + let mut amplitude = 0.9999847412109375 / 65535.0; + for _ in 0..16 { + let base = Interval::symmetric(((smear * frequency).abs() + 2.0) as f32)?; + range = range.add_range(base.multiply_range(Interval::exact(amplitude as f32)?)); + frequency /= 2.0; + amplitude *= 2.0; + } + Ok(range) + } +} + +/// Construct high-to-low frequency smeared octaves, consuming the caller's +/// stream directly. The public API caps work at 4096 layers before any draws. +pub fn create_blended_fbm( + random: &mut impl RandomSource, + first_octave: i32, + smear: f64, + amplitude: f64, +) -> Result { + if first_octave > 0 { + return Err(NoiseBuildError::PositiveLegacyOctaves); + } + if first_octave < -4095 { + return Err(NoiseBuildError::TooManyOctaves); + } + let count = 1 - first_octave; + let power = if count > 1023 { + f64::INFINITY + } else { + f64::from_bits(((count + 1023) as u64) << 52) + }; + let mut amplitude = amplitude / (power - 1.0); + let mut frequency = 1.0; + let mut builder = NoiseStack::builder(); + for _ in 0..count { + builder.add( + Arc::new(SmearedPerlinNoise::new(random, smear * frequency)), + frequency, + amplitude as f32, + ); + frequency /= 2.0; + amplitude *= 2.0; + } + Ok(builder.build()?) +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum DistanceMetric { + Euclidean, + EuclideanSquared, + Manhattan, + Chebyshev, +} +impl DistanceMetric { + pub fn compute2(self, x: f32, y: f32) -> f32 { + match self { + Self::Euclidean => ((x * x + y * y) as f64).sqrt() as f32, + Self::EuclideanSquared => x * x + y * y, + Self::Manhattan => x.abs() + y.abs(), + Self::Chebyshev => arithmetic::java_max(x.abs(), y.abs()), + } + } + pub fn compute3(self, x: f32, y: f32, z: f32) -> f32 { + match self { + Self::Euclidean => ((x * x + y * y + z * z) as f64).sqrt() as f32, + Self::EuclideanSquared => x * x + y * y + z * z, + Self::Manhattan => x.abs() + y.abs() + z.abs(), + Self::Chebyshev => { + arithmetic::java_max(arithmetic::java_max(x.abs(), y.abs()), z.abs()) + } + } + } +} +#[derive(Clone, Copy, Debug)] +pub struct DistanceToPointSampler { + pub point: [i32; 3], + pub metric: DistanceMetric, +} +impl DensitySampler for DistanceToPointSampler { + fn sample_value(&self, _: &mut SamplerContext, position: [i32; 3]) -> Result { + let delta: [f32; 3] = + std::array::from_fn(|i| self.point[i].wrapping_sub(position[i]) as f32); + Ok(self.metric.compute3(delta[0], delta[1], delta[2])) + } +} diff --git a/crates/horizon-core/src/density/tests.rs b/crates/horizon-core/src/density/tests.rs new file mode 100644 index 000000000..77a643097 --- /dev/null +++ b/crates/horizon-core/src/density/tests.rs @@ -0,0 +1,757 @@ +use super::*; +use crate::{noise::PerlinNoise, random::LegacyRandom}; + +#[test] +fn tail_writes_follow_the_selected_bulk_sampler() { + let mut context = SamplerContext::default(); + let volume = DensityVolume::new([2, 3, 2], [-3, -4, -5], [1, 2, 1]).unwrap(); + let mut buffer = vec![17.0; volume.size() + 2]; + ConstantSampler(-0.0) + .sample_volume(&mut context, &mut buffer, volume) + .unwrap(); + assert!(buffer.iter().all(|v| v.to_bits() == (-0.0_f32).to_bits())); + GradientSampler::new(Axis::Y, TilingMode::ClampToEdge, -4, 0, -1.0, 1.0) + .sample_volume(&mut context, &mut buffer, volume) + .unwrap(); + assert_eq!(&buffer[..3], &[-1.0, 0.0, 1.0]); + assert_eq!(buffer[volume.size()].to_bits(), (-0.0_f32).to_bits()); + let noise = NoiseSampler { + noise: Arc::new(PerlinNoise::new(&mut LegacyRandom::new(0))), + xz_scale: 0.1, + y_scale: 0.2, + }; + noise + .sample_volume(&mut context, &mut buffer, volume) + .unwrap(); + assert!(buffer[volume.size()..].iter().all(|v| v.to_bits() == 0)); +} + +#[test] +fn invalid_buffer_is_rejected_before_child_evaluation() { + let volume = DensityVolume::new([1, 2, 1], [0; 3], [1; 3]).unwrap(); + let mut context = SamplerContext::default(); + let mut buffer = [19.0]; + let gradient = GradientSampler::new(Axis::X, TilingMode::Repeat, 0, 0, 1.0, 2.0); + assert_eq!( + gradient.sample_volume(&mut context, &mut buffer, volume), + Err(SampleError::Volume(DensityError::BufferTooShort)) + ); + assert_eq!(buffer, [19.0]); +} + +#[test] +fn scratch_returns_to_context_after_nested_sampling_errors() { + let mut context = SamplerContext::default(); + let error = context.with_buffer(16, |context, _| { + context.with_buffer(32, |_, _| Err::<(), _>(SampleError::ZeroGradientPeriod)) + }); + assert_eq!(error, Err(SampleError::ZeroGradientPeriod)); + assert_eq!(context.scratch.len(), 2); + context + .with_buffer(8, |context, outer| { + outer.fill(17.0); + context.with_buffer(8, |_, inner| { + inner.fill(29.0); + Ok(()) + })?; + assert!(outer.iter().all(|v| *v == 17.0)); + Ok(()) + }) + .unwrap(); + assert_eq!(context.scratch.len(), 2); + context.clear_scratch(); + assert!(context.scratch.is_empty()); +} + +#[test] +fn scalar_shortcuts_and_bulk_arithmetic_keep_distinct_results() { + let mut context = SamplerContext::default(); + let volume = DensityVolume::new([1; 3], [0; 3], [1; 3]).unwrap(); + let multiply = BinarySampler { + left: Arc::new(ConstantSampler(-0.0)), + right: Arc::new(ConstantSampler(f32::NAN)), + operation: BinaryOp::Multiply, + }; + assert_eq!( + multiply + .sample_value(&mut context, [0; 3]) + .unwrap() + .to_bits(), + 0 + ); + let mut buffer = [17.0]; + multiply + .sample_volume(&mut context, &mut buffer, volume) + .unwrap(); + assert!(buffer[0].is_nan()); + let minimum = BinarySampler { + left: Arc::new(ConstantSampler(0.0)), + right: Arc::new(ConstantSampler(-0.0)), + operation: BinaryOp::Minimum { + right_min: f32::NEG_INFINITY, + }, + }; + assert_eq!( + minimum + .sample_value(&mut context, [0; 3]) + .unwrap() + .to_bits(), + (-0.0_f32).to_bits() + ); + minimum + .sample_volume(&mut context, &mut buffer, volume) + .unwrap(); + assert_eq!(buffer[0].to_bits(), 0); +} + +#[test] +fn bulk_choice_evaluates_in_range_before_a_failing_selector() { + let mut context = SamplerContext::default(); + let volume = DensityVolume::new([1; 3], [0; 3], [1; 3]).unwrap(); + let choice = RangeChoiceSampler { + input: Arc::new(GradientSampler::new( + Axis::X, + TilingMode::Repeat, + 0, + 0, + 0.0, + 1.0, + )), + min_inclusive: 0.0, + max_exclusive: 1.0, + when_in_range: Arc::new(ConstantSampler(3.0)), + when_out_of_range: Arc::new(ConstantSampler(7.0)), + }; + let mut buffer = [19.0]; + assert_eq!( + choice.sample_volume(&mut context, &mut buffer, volume), + Err(SampleError::ZeroGradientPeriod) + ); + assert_eq!(buffer, [3.0]); + assert_eq!(context.scratch.len(), 1); + let mut too_long = [19.0; 2]; + assert_eq!( + choice.sample_volume(&mut context, &mut too_long, volume), + Err(SampleError::ExactBufferSizeRequired) + ); + assert_eq!(too_long, [19.0; 2]); +} + +#[test] +fn interval_branch_errors_keep_selector_output_and_return_scratch() { + let mut context = SamplerContext::default(); + let volume = DensityVolume::new([1; 3], [0; 3], [1; 3]).unwrap(); + let selector = IntervalSelectSampler::new( + Arc::new(ConstantSampler(-3.0)), + vec![0.0], + vec![ + Arc::new(ConstantSampler(7.0)), + Arc::new(GradientSampler::new( + Axis::X, + TilingMode::Repeat, + 0, + 0, + 0.0, + 1.0, + )), + ], + ) + .unwrap(); + assert_eq!(selector.sample_value(&mut context, [0; 3]), Ok(7.0)); + let mut buffer = [19.0]; + assert_eq!( + selector.sample_volume(&mut context, &mut buffer, volume), + Err(SampleError::ZeroGradientPeriod) + ); + assert_eq!(buffer, [-3.0]); + assert_eq!(context.scratch.len(), 1); + assert_eq!(context.scratch[0].len(), 2); + assert!(IntervalSelectSampler::new(Arc::new(ConstantSampler(0.0)), vec![], vec![]).is_err()); +} + +#[test] +fn range_arithmetic_and_zero_equality_match_reference_special_cases() { + let zero = Interval::exact(0.0).unwrap(); + assert_eq!(zero.multiply_range(Interval::INFINITE), zero); + assert!(zero.reciprocal().is_nai()); + assert!( + Interval::exact(f32::INFINITY) + .unwrap() + .add_range(Interval::exact(f32::NEG_INFINITY).unwrap()) + .is_nai() + ); + let cached = Interval::new(-0.0, 1.0).unwrap(); + assert_eq!(cached.min().to_bits(), 0); + let mixed_zero = Interval::new(-0.0, 0.0).unwrap(); + assert_eq!(mixed_zero, zero); + assert_ne!(mixed_zero.java_hash_code(), zero.java_hash_code()); + assert_eq!(Interval::NAI, Interval::NAI); + assert_eq!( + Interval::encapsulating(&[Interval::NAI, cached]), + Ok(cached) + ); + assert_eq!(Interval::encapsulating(&[]), Err(IntervalError::EmptyInput)); +} + +#[test] +fn monotonic_mapping_skips_nai_and_rejects_nan_after_both_endpoints() { + let mut calls = Vec::new(); + assert_eq!( + Interval::NAI.map_monotonic(|v| { + calls.push(v); + v + }), + Ok(Interval::NAI) + ); + assert!(calls.is_empty()); + assert_eq!( + Interval::new(-1.0, 1.0).unwrap().map_monotonic(|v| { + calls.push(v); + v.sqrt() + }), + Err(IntervalError::NanMappedBound) + ); + assert_eq!(calls, [-1.0, 1.0]); + assert_eq!( + Interval::exact(0.0) + .unwrap() + .lerp_values(f32::INFINITY, f32::NEG_INFINITY), + Interval::exact(f32::INFINITY).unwrap() + ); +} + +#[test] +fn shift_b_repeats_each_horizontal_sample_and_preserves_tail() { + let mut context = SamplerContext::default(); + let volume = DensityVolume::new([2, 3, 4], [-17, -64, 32], [4, 8, 16]).unwrap(); + let source = Arc::new(PerlinNoise::new(&mut LegacyRandom::new(0))); + let sampler = compile_shift_noise(source, ShiftNoiseKind::ShiftB); + let mut buffer = vec![19.0; volume.size() + 2]; + sampler + .sample_volume(&mut context, &mut buffer, volume) + .unwrap(); + for column in buffer[..volume.size()].chunks_exact(3) { + assert!(column.iter().all(|v| v.to_bits() == column[0].to_bits())); + } + assert_eq!(&buffer[volume.size()..], &[19.0, 19.0]); + assert_eq!(context.scratch.len(), 1); + assert_eq!(context.scratch[0].len(), 8); + let mut short = [23.0; 2]; + assert_eq!( + sampler.sample_volume(&mut context, &mut short, volume), + Err(SampleError::Volume(DensityError::BufferTooShort)) + ); + assert_eq!(short, [23.0; 2]); +} + +#[test] +fn blended_fbm_work_bound_rejects_before_random_draws() { + let mut random = LegacyRandom::new(0); + let mut expected = random.clone(); + assert!(matches!( + create_blended_fbm(&mut random, i32::MIN, 1.0, 1.0), + Err(crate::noise::NoiseBuildError::TooManyOctaves) + )); + assert!(matches!( + create_blended_fbm(&mut random, 1, 1.0, 1.0), + Err(crate::noise::NoiseBuildError::PositiveLegacyOctaves) + )); + use crate::random::RandomSource; + assert_eq!(random.next_long(), expected.next_long()); +} + +#[test] +fn volume_lookup_requires_exact_lattice_and_preserves_java_overflow() { + let volume = DensityVolume::new([2, 3, 2], [i32::MAX, -64, 32], [4, 1, 4]).unwrap(); + assert_eq!(volume.index_of_block([i32::MIN + 3, -63, 36]), Some(10)); + assert_eq!(volume.index_of_block([i32::MIN, -64, 32]), None); + let overflow = DensityVolume::new([2, 1, 1], [0; 3], [i32::MAX, 1, 1]).unwrap(); + assert_eq!(overflow.index_of_block([0; 3]), None); +} + +#[test] +fn cache_returns_filled_failure_buffer_on_the_next_volume_request() { + let mut context = SamplerContext::cached(); + let volume = DensityVolume::new([1; 3], [0; 3], [1; 3]).unwrap(); + let input = RangeChoiceSampler { + input: Arc::new(GradientSampler::new( + Axis::X, + TilingMode::Repeat, + 0, + 0, + 0.0, + 1.0, + )), + min_inclusive: 0.0, + max_exclusive: 1.0, + when_in_range: Arc::new(ConstantSampler(7.0)), + when_out_of_range: Arc::new(ConstantSampler(9.0)), + }; + let cached = CachingDensitySampler::new(0, Arc::new(input)).unwrap(); + let mut buffer = [19.0]; + assert_eq!( + cached.sample_volume(&mut context, &mut buffer, volume), + Err(SampleError::ZeroGradientPeriod) + ); + assert_eq!(buffer, [19.0]); + cached + .sample_volume(&mut context, &mut buffer, volume) + .unwrap(); + assert_eq!(buffer, [7.0]); + assert_eq!(cached.sample_value(&mut context, [0; 3]), Ok(7.0)); + context.clear_caches(); + assert_eq!( + cached.sample_value(&mut context, [0; 3]), + Err(SampleError::ZeroGradientPeriod) + ); + assert!(matches!( + CachingDensitySampler::new(65536, Arc::new(ConstantSampler(0.0))), + Err(SampleError::CacheIdOutOfRange) + )); +} + +#[test] +fn slices_delegate_matching_volumes_and_isolate_reduced_child_failures() { + let mut context = SamplerContext::default(); + let slice = SliceSampler { + input: Arc::new(ConstantSampler(-0.0)), + axes: SliceAxes::Xz { x: 7, z: 9 }, + }; + for (sizes, minimum, delegated) in [ + ([1, 2, 1], [7, -64, 9], true), + ([1, 2, 1], [8, -64, 9], false), + ([2, 2, 1], [7, -64, 9], false), + ([1, 2, 2], [7, -64, 9], false), + ] { + let volume = DensityVolume::new(sizes, minimum, [4, 8, 16]).unwrap(); + let mut output = vec![19.0; volume.size() + 2]; + slice + .sample_volume(&mut context, &mut output, volume) + .unwrap(); + assert!( + output[..volume.size()] + .iter() + .all(|v| v.to_bits() == (-0.0_f32).to_bits()) + ); + let expected_tail = if delegated { -0.0_f32 } else { 19.0 }; + assert!( + output[volume.size()..] + .iter() + .all(|v| v.to_bits() == expected_tail.to_bits()) + ); + } + let failing = SliceSampler { + axes: SliceAxes::Y(3), + input: Arc::new(RangeChoiceSampler { + input: Arc::new(GradientSampler::new( + Axis::X, + TilingMode::Repeat, + 0, + 0, + 0.0, + 1.0, + )), + min_inclusive: 0.0, + max_exclusive: 1.0, + when_in_range: Arc::new(ConstantSampler(7.0)), + when_out_of_range: Arc::new(ConstantSampler(9.0)), + }), + }; + for (y, expected) in [(2, 19.0), (3, 7.0)] { + let volume = DensityVolume::new([1; 3], [0, y, 0], [4, 8, 16]).unwrap(); + let mut output = [19.0]; + assert_eq!( + failing.sample_volume(&mut context, &mut output, volume), + Err(SampleError::ZeroGradientPeriod) + ); + assert_eq!(output, [expected]); + } + assert!(!context.scratch.is_empty()); +} + +#[test] +fn slices_preserve_reduced_volume_steps_in_cached_children() { + let input = Arc::new( + CachingDensitySampler::new( + 0, + Arc::new(DistanceToPointSampler { + point: [0; 3], + metric: DistanceMetric::Manhattan, + }), + ) + .unwrap(), + ); + let mut context = SamplerContext::cached(); + let slice = SliceSampler { + input: input.clone(), + axes: SliceAxes::X(7), + }; + let volume = DensityVolume::new([3, 2, 2], [-17, -64, 32], [4, 8, 16]).unwrap(); + let mut output = vec![0.0; volume.size()]; + slice + .sample_volume(&mut context, &mut output, volume) + .unwrap(); + for z in 0..2 { + for x in 0..3 { + assert_eq!( + &output[(x + z * 3) * 2..(x + z * 3) * 2 + 2], + &[103.0 + z as f32 * 16.0, 95.0 + z as f32 * 16.0] + ); + } + } + // The following matching request must hit the cached reduced descriptor. + // A short logical output is still rejected before touching that child. + let reduced = DensityVolume::new([1, 2, 2], [7, -64, 32], [4, 8, 16]).unwrap(); + let mut reduced_output = [0.0; 4]; + input + .sample_volume(&mut context, &mut reduced_output, reduced) + .unwrap(); + assert_eq!(reduced_output, [103.0, 95.0, 119.0, 111.0]); + let mut short = [19.0]; + assert_eq!( + slice.sample_volume(&mut context, &mut short, volume), + Err(SampleError::Volume(DensityError::BufferTooShort)) + ); + assert_eq!(short, [19.0]); +} + +#[test] +fn grid_interpolation_keeps_incremental_bulk_rounding() { + let input = Arc::new(GradientSampler::new( + Axis::Y, + TilingMode::ClampToEdge, + 0, + 10, + 0.0, + 1.0, + )); + let sampler = InterpolatedSampler::new(input, 4, 10).unwrap(); + let mut context = SamplerContext::default(); + let volume = DensityVolume::new([1, 10, 1], [0; 3], [1; 3]).unwrap(); + let mut output = [19.0; 11]; + sampler + .sample_volume(&mut context, &mut output, volume) + .unwrap(); + assert_eq!(output[7].to_bits(), 0x3f333334); + assert_eq!( + sampler + .sample_value(&mut context, [0, 7, 0]) + .unwrap() + .to_bits(), + 0x3f333333 + ); + assert_eq!(output[10], 19.0); + let strided = DensityVolume::new([1, 5, 1], [0; 3], [1, 2, 1]).unwrap(); + let mut selected = [0.0; 5]; + sampler + .sample_volume(&mut context, &mut selected, strided) + .unwrap(); + for (i, value) in selected.iter().enumerate() { + assert_eq!(value.to_bits(), output[i * 2].to_bits()); + } +} + +#[test] +fn grid_interpolation_uses_child_bulk_corners_and_preserves_aligned_delegation() { + #[derive(Debug, Default)] + struct Traced { + volumes: std::sync::Mutex>, + points: std::sync::Mutex>, + } + impl DensitySampler for Traced { + fn sample_value( + &self, + _: &mut SamplerContext, + position: [i32; 3], + ) -> Result { + self.points.lock().unwrap().push(position); + Ok(-0.0) + } + fn sample_volume( + &self, + _: &mut SamplerContext, + buffer: &mut [f32], + volume: DensityVolume, + ) -> Result<(), SampleError> { + self.volumes.lock().unwrap().push(volume); + buffer.fill(-0.0); + Ok(()) + } + } + let traced = Arc::new(Traced::default()); + let sampler = InterpolatedSampler::new(traced.clone(), 4, 8).unwrap(); + let mut context = SamplerContext::default(); + assert_eq!( + sampler + .sample_value(&mut context, [-4, -8, 4]) + .unwrap() + .to_bits(), + (-0.0_f32).to_bits() + ); + sampler.sample_value(&mut context, [-1, -1, -1]).unwrap(); + assert_eq!(*traced.points.lock().unwrap(), [[-4, -8, 4]]); + assert_eq!( + *traced.volumes.lock().unwrap(), + [DensityVolume::new([2; 3], [-4, -8, -4], [4, 8, 4]).unwrap()] + ); + let volume = DensityVolume::new([2, 1, 2], [-4, -8, 4], [4, 1, 4]).unwrap(); + let mut output = [19.0; 6]; + sampler + .sample_volume(&mut context, &mut output, volume) + .unwrap(); + assert!(output.iter().all(|v| v.to_bits() == (-0.0_f32).to_bits())); + assert_eq!(traced.volumes.lock().unwrap()[1], volume); + assert!(InterpolatedSampler::new(traced.clone(), 0, 8).is_err()); + assert!(InterpolatedSampler::new(traced, 4, -1).is_err()); +} + +#[test] +fn surface_search_fixes_upper_bound_y_and_visits_descending_cell_boundaries() { + #[derive(Debug, Default)] + struct DensityTrace(std::sync::Mutex>); + impl DensitySampler for DensityTrace { + fn sample_value( + &self, + _: &mut SamplerContext, + position: [i32; 3], + ) -> Result { + self.0.lock().unwrap().push(position); + Ok(match position[1] { + 12 => f32::NAN, + 8 => -0.0, + _ => 1.0, + }) + } + } + let density = Arc::new(DensityTrace::default()); + let upper = Arc::new(GradientSampler::new( + Axis::Y, + TilingMode::ClampToEdge, + 0, + 10, + 14.0, + 54.0, + )); + let sampler = compile_surface_search(density.clone(), upper, -64, 4).unwrap(); + assert_eq!( + sampler.sample_value(&mut SamplerContext::default(), [7, 1000, -9]), + Ok(4.0) + ); + assert_eq!( + *density.0.lock().unwrap(), + [[7, 12, -9], [7, 8, -9], [7, 4, -9]] + ); + density.0.lock().unwrap().clear(); + let shortcut = + FindTopSurfaceSampler::new(density.clone(), Arc::new(ConstantSampler(-63.0)), -64, 8) + .unwrap(); + assert_eq!( + shortcut.sample_value(&mut SamplerContext::default(), [0; 3]), + Ok(-64.0) + ); + assert!(density.0.lock().unwrap().is_empty()); + let negative_infinity = FindTopSurfaceSampler::new( + density.clone(), + Arc::new(ConstantSampler(f32::NEG_INFINITY)), + -64, + 1, + ) + .unwrap(); + assert_eq!( + negative_infinity.sample_value(&mut SamplerContext::default(), [0; 3]), + Ok(-64.0) + ); + assert!(density.0.lock().unwrap().is_empty()); +} + +#[test] +fn surface_bulk_preserves_upper_bound_writes_and_sliced_error_isolation() { + #[derive(Debug)] + struct FailSecondColumn; + impl DensitySampler for FailSecondColumn { + fn sample_value( + &self, + _: &mut SamplerContext, + position: [i32; 3], + ) -> Result { + if position[0] == 1 { + Err(SampleError::ZeroGradientPeriod) + } else { + Ok(if position[1] <= 4 { 1.0 } else { 0.0 }) + } + } + } + let raw = Arc::new( + FindTopSurfaceSampler::new( + Arc::new(FailSecondColumn), + Arc::new(ConstantSampler(14.0)), + -64, + 4, + ) + .unwrap(), + ); + let mut context = SamplerContext::default(); + let volume = DensityVolume::new([2, 1, 1], [0; 3], [1; 3]).unwrap(); + let mut output = [19.0; 3]; + assert_eq!( + raw.sample_volume(&mut context, &mut output, volume), + Err(SampleError::ZeroGradientPeriod) + ); + assert_eq!(output, [4.0, 14.0, 14.0]); + let volume = DensityVolume::new([2, 2, 1], [0; 3], [1; 3]).unwrap(); + let mut output = [19.0; 5]; + assert_eq!( + raw.sample_volume(&mut context, &mut output, volume), + Err(SampleError::SurfaceRequiresSingleLayer) + ); + assert_eq!(output, [19.0; 5]); + let sliced = SliceSampler { + input: raw, + axes: SliceAxes::Y(0), + }; + assert_eq!( + sliced.sample_volume(&mut context, &mut output, volume), + Err(SampleError::ZeroGradientPeriod) + ); + assert_eq!(output, [19.0; 5]); + assert!(!context.scratch.is_empty()); +} + +#[test] +fn spline_coordinate_cache_retries_nan_scalars_but_reuses_nan_volumes() { + use std::sync::atomic::{AtomicUsize, Ordering}; + #[derive(Debug)] + struct Counted { + value: f32, + scalar: AtomicUsize, + bulk: AtomicUsize, + } + impl DensitySampler for Counted { + fn sample_value(&self, _: &mut SamplerContext, _: [i32; 3]) -> Result { + self.scalar.fetch_add(1, Ordering::Relaxed); + Ok(self.value) + } + fn sample_volume( + &self, + _: &mut SamplerContext, + output: &mut [f32], + _: DensityVolume, + ) -> Result<(), SampleError> { + self.bulk.fetch_add(1, Ordering::Relaxed); + output.fill(self.value); + Ok(()) + } + } + let inner = CubicSpline::multipoint( + 1, + vec![SplinePoint { + location: 0.0, + derivative: -0.0, + value: CubicSpline::Constant(7.0), + }], + ) + .unwrap(); + let root = CubicSpline::multipoint( + 1, + vec![ + SplinePoint { + location: -1.0, + derivative: 0.0, + value: inner.clone(), + }, + SplinePoint { + location: 1.0, + derivative: 0.0, + value: inner, + }, + ], + ) + .unwrap(); + for (value, scalar_calls) in [(0.0, 1), (f32::NAN, 2)] { + let input = Arc::new(Counted { + value, + scalar: AtomicUsize::new(0), + bulk: AtomicUsize::new(0), + }); + let sampler = + SplineSampler::new(&root, &[Arc::new(ConstantSampler(99.0)), input.clone()]).unwrap(); + assert_eq!(sampler.coordinate_count(), 1); + let mut context = SamplerContext::default(); + assert_eq!(sampler.sample_value(&mut context, [0; 3]), Ok(7.0)); + assert_eq!(input.scalar.load(Ordering::Relaxed), scalar_calls); + let volume = DensityVolume::new([2, 3, 2], [0; 3], [1; 3]).unwrap(); + let mut output = [19.0; 12]; + sampler + .sample_volume(&mut context, &mut output, volume) + .unwrap(); + assert_eq!(output, [7.0; 12]); + assert_eq!(input.bulk.load(Ordering::Relaxed), 1); + assert_eq!(input.scalar.load(Ordering::Relaxed), scalar_calls); + } + assert!(matches!( + SplineSampler::new(&root, &[]), + Err(SplineError::MissingCoordinate) + )); + assert!(matches!( + CubicSpline::multipoint(0, vec![]), + Err(SplineError::EmptyPoints) + )); +} + +#[test] +fn spline_lazy_branch_failure_preserves_completed_output_and_returns_scratch() { + let fail = CubicSpline::multipoint( + 1, + vec![SplinePoint { + location: 0.0, + derivative: 0.0, + value: CubicSpline::Constant(11.0), + }], + ) + .unwrap(); + let root = CubicSpline::multipoint( + 0, + vec![ + SplinePoint { + location: -1.0, + derivative: 0.0, + value: CubicSpline::Constant(7.0), + }, + SplinePoint { + location: 1.0, + derivative: 0.0, + value: fail, + }, + ], + ) + .unwrap(); + let inputs: Vec> = vec![ + Arc::new(GradientSampler::new( + Axis::X, + TilingMode::ClampToEdge, + 0, + 1, + -2.0, + 0.0, + )), + Arc::new(GradientSampler::new( + Axis::X, + TilingMode::Repeat, + 0, + 0, + 0.0, + 1.0, + )), + ]; + let sampler = SplineSampler::new(&root, &inputs).unwrap(); + let mut context = SamplerContext::default(); + let volume = DensityVolume::new([2, 1, 1], [0; 3], [1; 3]).unwrap(); + let mut output = [19.0; 2]; + assert_eq!( + sampler.sample_volume(&mut context, &mut output, volume), + Err(SampleError::ZeroGradientPeriod) + ); + assert_eq!(output, [7.0, 19.0]); + assert_eq!(context.scratch.len(), 2); + assert_eq!(sampler.sample_value(&mut context, [0; 3]), Ok(7.0)); +} diff --git a/crates/horizon-core/src/density/world_fields.rs b/crates/horizon-core/src/density/world_fields.rs new file mode 100644 index 000000000..7709de819 --- /dev/null +++ b/crates/horizon-core/src/density/world_fields.rs @@ -0,0 +1,151 @@ +use super::*; + +/// Vanilla's three density fields, resolved at evaluation time rather than +/// during graph compilation. Their declared ranges do not inspect bindings. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum WorldField { + BlendAlpha, + BlendOffset, + Beardifier, +} +impl WorldField { + pub fn domain_axes(self) -> u8 { + match self { + Self::BlendAlpha | Self::BlendOffset => 5, + Self::Beardifier => 7, + } + } + pub fn range(self) -> Interval { + match self { + Self::BlendAlpha => Interval::new(0.0, 1.0).unwrap(), + Self::BlendOffset | Self::Beardifier => Interval::INFINITE, + } + } + fn fallback(self) -> f32 { + match self { + Self::BlendAlpha => 1.0, + Self::BlendOffset | Self::Beardifier => 0.0, + } + } +} + +/// Old-world blending provider. The full vanilla Blender data model and +/// distance-weighting algorithm are a separate, still pending implementation. +pub trait DensityBlender: std::fmt::Debug + Send + Sync { + fn is_empty(&self) -> bool; + fn blend_density(&self, position: [i32; 3], input: f32) -> f32; +} + +#[derive(Debug)] +pub struct EmptyBlender; +impl DensityBlender for EmptyBlender { + fn is_empty(&self) -> bool { + true + } + fn blend_density(&self, _: [i32; 3], input: f32) -> f32 { + input + } +} + +/// Bindings can be assembled and shared between workers. Attaching new +/// bindings consumes the worker context and invalidates its cached densities. +#[derive(Clone, Debug, Default)] +pub struct WorldFields { + samplers: [Option>; 3], + blender: Option>, +} +impl WorldFields { + pub fn with_field(mut self, field: WorldField, sampler: Arc) -> Self { + self.samplers[field as usize] = Some(sampler); + self + } + pub fn with_blender(mut self, blender: Arc) -> Self { + self.blender = Some(blender); + self + } +} +impl SamplerContext { + pub fn with_world_fields(mut self, fields: WorldFields) -> Self { + self.clear_caches(); + self.fields = fields; + self + } +} + +#[derive(Clone, Debug)] +pub struct ContextBoundSampler { + field: WorldField, + fallback: Arc, +} +impl ContextBoundSampler { + pub fn new(field: WorldField) -> Self { + Self::with_fallback(field, Arc::new(ConstantSampler(field.fallback()))) + } + /// The vanilla sampler also permits a fallback supplied by its caller. + pub fn with_fallback(field: WorldField, fallback: Arc) -> Self { + Self { field, fallback } + } + fn resolve(&self, context: &SamplerContext) -> Arc { + context.fields.samplers[self.field as usize] + .as_ref() + .unwrap_or(&self.fallback) + .clone() + } +} +impl DensitySampler for ContextBoundSampler { + fn sample_value( + &self, + context: &mut SamplerContext, + position: [i32; 3], + ) -> Result { + self.resolve(context).sample_value(context, position) + } + fn sample_volume( + &self, + context: &mut SamplerContext, + buffer: &mut [f32], + volume: DensityVolume, + ) -> Result<(), SampleError> { + self.resolve(context).sample_volume(context, buffer, volume) + } +} + +#[derive(Clone, Debug)] +pub struct BlendDensitySampler { + pub input: Arc, +} +impl DensitySampler for BlendDensitySampler { + fn sample_value( + &self, + context: &mut SamplerContext, + position: [i32; 3], + ) -> Result { + let input = self.input.sample_value(context, position)?; + let Some(blender) = &context.fields.blender else { + return Ok(input); + }; + Ok(if blender.is_empty() { + input + } else { + blender.blend_density(position, input) + }) + } + fn sample_volume( + &self, + context: &mut SamplerContext, + buffer: &mut [f32], + volume: DensityVolume, + ) -> Result<(), SampleError> { + self.input.sample_volume(context, buffer, volume)?; + let Some(blender) = &context.fields.blender else { + return Ok(()); + }; + if blender.is_empty() { + return Ok(()); + } + visit(volume, |index, position| { + buffer[index] = blender.blend_density(position, buffer[index]); + Ok(()) + }) + } +} diff --git a/crates/horizon-core/src/geometry/mod.rs b/crates/horizon-core/src/geometry/mod.rs new file mode 100644 index 000000000..b41c36af9 --- /dev/null +++ b/crates/horizon-core/src/geometry/mod.rs @@ -0,0 +1,656 @@ +//! Double-precision simulation geometry for the pinned Java Edition target. +//! +//! Operation order and Java floating-point edge cases are deliberate. These are +//! simulation coordinates; rendering may use a separate camera-relative format. + +mod movement; +mod shape; +mod sweep; +mod traversal; +pub mod trig; +use crate::position::BlockPos; +pub use movement::{ + block_floor_height, candidate_step_heights, entity_collision_bounds, resolve_shape_movement, + resolve_step_movement, +}; +pub use shape::{ShapeError, ShapeOp, VoxelShape}; +pub use sweep::sweep_intersected_blocks; +pub use traversal::{TraversalError, traverse_blocks}; + +pub const COLLISION_EPSILON: f64 = 1.0e-7; + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[repr(usize)] +pub enum Axis { + X, + Y, + Z, +} + +impl Axis { + pub const ALL: [Self; 3] = [Self::X, Self::Y, Self::Z]; + pub fn step_order(movement: Vec3) -> [Self; 3] { + if movement.x.abs() < movement.z.abs() { + [Self::Y, Self::Z, Self::X] + } else { + [Self::Y, Self::X, Self::Z] + } + } +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[repr(u8)] +pub enum Direction { + Down, + Up, + North, + South, + West, + East, +} + +impl Direction { + pub const ALL: [Self; 6] = [ + Self::Down, + Self::Up, + Self::North, + Self::South, + Self::West, + Self::East, + ]; + pub const fn opposite(self) -> Self { + match self { + Self::Down => Self::Up, + Self::Up => Self::Down, + Self::North => Self::South, + Self::South => Self::North, + Self::West => Self::East, + Self::East => Self::West, + } + } + pub const fn normal(self) -> [i32; 3] { + match self { + Self::Down => [0, -1, 0], + Self::Up => [0, 1, 0], + Self::North => [0, 0, -1], + Self::South => [0, 0, 1], + Self::West => [-1, 0, 0], + Self::East => [1, 0, 0], + } + } + pub fn approximate_nearest(vector: Vec3) -> Self { + let [x, y, z] = vector.components().map(|v| v as f32); + let mut best = f32::from_bits(1); + let mut result = Self::North; + for direction in Self::ALL { + let [nx, ny, nz] = direction.normal().map(|v| v as f32); + let dot = x * nx + y * ny + z * nz; + if dot > best { + best = dot; + result = direction; + } + } + result + } +} + +/// Component equality follows Java Double.compare, including NaNs and -0.0. +#[derive(Clone, Copy, Debug, Default)] +pub struct Vec3 { + pub x: f64, + pub y: f64, + pub z: f64, +} + +impl PartialEq for Vec3 { + fn eq(&self, other: &Self) -> bool { + self.components() + .into_iter() + .zip(other.components()) + .all(|(a, b)| canonical_bits(a) == canonical_bits(b)) + } +} +impl Vec3 { + pub const ZERO: Self = Self::new(0.0, 0.0, 0.0); + pub const fn new(x: f64, y: f64, z: f64) -> Self { + Self { x, y, z } + } + pub const fn components(self) -> [f64; 3] { + [self.x, self.y, self.z] + } + pub fn component(self, axis: Axis) -> f64 { + self.components()[axis as usize] + } + pub fn from_block(pos: BlockPos) -> Self { + Self::new(pos.x as f64, pos.y as f64, pos.z as f64) + } + pub fn add_vector(self, other: Self) -> Self { + Self::new(self.x + other.x, self.y + other.y, self.z + other.z) + } + pub fn subtract(self, other: Self) -> Self { + self.add_vector(Self::new(-other.x, -other.y, -other.z)) + } + pub fn vector_to(self, other: Self) -> Self { + Self::new(other.x - self.x, other.y - self.y, other.z - self.z) + } + pub fn multiply(self, other: Self) -> Self { + Self::new(self.x * other.x, self.y * other.y, self.z * other.z) + } + pub fn scale(self, scale: f64) -> Self { + self.multiply(Self::new(scale, scale, scale)) + } + pub fn reverse(self) -> Self { + self.scale(-1.0) + } + pub fn horizontal(self) -> Self { + Self::new(self.x, 0.0, self.z) + } + pub fn dot(self, other: Self) -> f64 { + self.x * other.x + self.y * other.y + self.z * other.z + } + pub fn cross(self, other: Self) -> Self { + Self::new( + self.y * other.z - self.z * other.y, + self.z * other.x - self.x * other.z, + self.x * other.y - self.y * other.x, + ) + } + pub fn length_squared(self) -> f64 { + self.x * self.x + self.y * self.y + self.z * self.z + } + pub fn length(self) -> f64 { + self.length_squared().sqrt() + } + pub fn horizontal_distance_squared(self) -> f64 { + self.x * self.x + self.z * self.z + } + pub fn horizontal_distance(self) -> f64 { + self.horizontal_distance_squared().sqrt() + } + pub fn distance_squared(self, other: Self) -> f64 { + let x = self.x - other.x; + let y = self.y - other.y; + let z = self.z - other.z; + x * x + y * y + z * z + } + pub fn distance(self, other: Self) -> f64 { + self.distance_squared(other).sqrt() + } + pub fn normalize(self) -> Self { + let length = self.length(); + if length < 9.999999747378752e-6 { + Self::ZERO + } else { + Self::new(self.x / length, self.y / length, self.z / length) + } + } + pub fn lerp(self, other: Self, amount: f64) -> Self { + Self::new( + lerp(amount, self.x, other.x), + lerp(amount, self.y, other.y), + lerp(amount, self.z, other.z), + ) + } + pub fn projected_on(self, other: Self) -> Self { + if other.length_squared() == 0.0 { + other + } else { + other + .scale(self.dot(other)) + .scale(1.0 / other.length_squared()) + } + } + pub fn closer_than(self, other: Self, distance: f64) -> bool { + self.distance_squared(other) < distance * distance + } + pub fn is_finite(self) -> bool { + self.x.is_finite() && self.y.is_finite() && self.z.is_finite() + } + pub fn with_component(self, axis: Axis, value: f64) -> Self { + let mut coordinates = self.components(); + coordinates[axis as usize] = value; + Self::new(coordinates[0], coordinates[1], coordinates[2]) + } + pub fn align(self, axes: [bool; 3]) -> Self { + let coordinates = std::array::from_fn::<_, 3, _>(|i| { + if axes[i] { + floor_i32(self.components()[i]) as f64 + } else { + self.components()[i] + } + }); + Self::new(coordinates[0], coordinates[1], coordinates[2]) + } + pub fn relative(self, direction: Direction, distance: f64) -> Self { + let normal = direction.normal(); + Self::new( + self.x + distance * normal[0] as f64, + self.y + distance * normal[1] as f64, + self.z + distance * normal[2] as f64, + ) + } + pub fn rotate_x(self, angle: f32) -> Self { + let c = trig::cos(angle as f64) as f64; + let s = trig::sin(angle as f64) as f64; + Self::new(self.x, self.y * c + self.z * s, self.z * c - self.y * s) + } + pub fn rotate_y(self, angle: f32) -> Self { + let c = trig::cos(angle as f64) as f64; + let s = trig::sin(angle as f64) as f64; + Self::new(self.x * c + self.z * s, self.y, self.z * c - self.x * s) + } + pub fn rotate_z(self, angle: f32) -> Self { + let c = trig::cos(angle as f64) as f64; + let s = trig::sin(angle as f64) as f64; + Self::new(self.x * c + self.y * s, self.y * c - self.x * s, self.z) + } + pub fn rotate_clockwise_90(self) -> Self { + Self::new(-self.z, self.y, self.x) + } + pub fn direction_from_rotation(pitch: f32, yaw: f32) -> Self { + let yaw_radians = -yaw * trig::DEG_TO_RAD - std::f32::consts::PI; + let cy = trig::cos(yaw_radians as f64); + let sy = trig::sin(yaw_radians as f64); + let pitch_radians = -pitch * trig::DEG_TO_RAD; + let cp = -trig::cos(pitch_radians as f64); + let sp = trig::sin(pitch_radians as f64); + Self::new((sy * cp) as f64, sp as f64, (cy * cp) as f64) + } + /// Return vanilla's (pitch, yaw) float pair in degrees. + pub fn rotation(self) -> [f32; 2] { + let yaw = ((-self.x).atan2(self.z) as f32) * trig::RAD_TO_DEG; + let pitch = ((-self.y / self.length()).asin() as f32) * trig::RAD_TO_DEG; + [pitch, yaw] + } +} + +#[derive(Clone, Copy, Debug, PartialEq)] +pub struct Aabb { + min: Vec3, + max: Vec3, +} + +#[derive(Clone, Copy, Debug, PartialEq)] +pub struct BlockHit { + pub location: Vec3, + pub direction: Direction, + pub block: BlockPos, + pub inside: bool, +} + +impl Aabb { + pub fn new(min: Vec3, max: Vec3) -> Self { + Self { + min: Vec3::new( + java_min(min.x, max.x), + java_min(min.y, max.y), + java_min(min.z, max.z), + ), + max: Vec3::new( + java_max(min.x, max.x), + java_max(min.y, max.y), + java_max(min.z, max.z), + ), + } + } + pub fn block(pos: BlockPos) -> Self { + Self::new(Vec3::from_block(pos), Vec3::from_block(pos.offset(1, 1, 1))) + } + pub fn unit_cube(lower: Vec3) -> Self { + Self::new(lower, lower.add_vector(Vec3::new(1.0, 1.0, 1.0))) + } + pub fn of_size(center: Vec3, size: Vec3) -> Self { + Self::new( + Vec3::new( + center.x - size.x / 2.0, + center.y - size.y / 2.0, + center.z - size.z / 2.0, + ), + Vec3::new( + center.x + size.x / 2.0, + center.y + size.y / 2.0, + center.z + size.z / 2.0, + ), + ) + } + pub fn encapsulating_blocks(a: BlockPos, b: BlockPos) -> Self { + Self::new( + Vec3::from_block(BlockPos::new(a.x.min(b.x), a.y.min(b.y), a.z.min(b.z))), + Vec3::from_block(BlockPos::new( + a.x.max(b.x).wrapping_add(1), + a.y.max(b.y).wrapping_add(1), + a.z.max(b.z).wrapping_add(1), + )), + ) + } + pub const fn min_position(self) -> Vec3 { + self.min + } + pub const fn max_position(self) -> Vec3 { + self.max + } + pub fn min(self, axis: Axis) -> f64 { + self.min.component(axis) + } + pub fn max(self, axis: Axis) -> f64 { + self.max.component(axis) + } + pub fn with_min(self, axis: Axis, value: f64) -> Self { + let mut a = self.min.components(); + a[axis as usize] = value; + Self::new(Vec3::new(a[0], a[1], a[2]), self.max) + } + pub fn with_max(self, axis: Axis, value: f64) -> Self { + let mut a = self.max.components(); + a[axis as usize] = value; + Self::new(self.min, Vec3::new(a[0], a[1], a[2])) + } + pub fn size(self) -> Vec3 { + self.min.vector_to(self.max) + } + pub fn average_size(self) -> f64 { + let v = self.size(); + (v.x + v.y + v.z) / 3.0 + } + pub fn center(self) -> Vec3 { + self.min.lerp(self.max, 0.5) + } + pub fn bottom_center(self) -> Vec3 { + let v = self.center(); + Vec3::new(v.x, self.min.y, v.z) + } + pub fn move_by(self, offset: Vec3) -> Self { + Self::new(self.min.add_vector(offset), self.max.add_vector(offset)) + } + pub fn inflate(self, amount: Vec3) -> Self { + Self::new( + Vec3::new( + self.min.x - amount.x, + self.min.y - amount.y, + self.min.z - amount.z, + ), + self.max.add_vector(amount), + ) + } + pub fn deflate(self, amount: Vec3) -> Self { + self.inflate(amount.reverse()) + } + pub fn expand_towards(self, amount: Vec3) -> Self { + self.change_extent(amount, false) + } + pub fn contract(self, amount: Vec3) -> Self { + self.change_extent(amount, true) + } + fn change_extent(self, amount: Vec3, contract: bool) -> Self { + let mut min = self.min.components(); + let mut max = self.max.components(); + for (i, v) in amount.components().into_iter().enumerate() { + if v < 0.0 { + min[i] = if contract { min[i] - v } else { min[i] + v }; + } else if v > 0.0 { + max[i] = if contract { max[i] - v } else { max[i] + v }; + } + } + Self::new( + Vec3::new(min[0], min[1], min[2]), + Vec3::new(max[0], max[1], max[2]), + ) + } + pub fn intersect(self, other: Self) -> Self { + Self::new( + Vec3::new( + java_max(self.min.x, other.min.x), + java_max(self.min.y, other.min.y), + java_max(self.min.z, other.min.z), + ), + Vec3::new( + java_min(self.max.x, other.max.x), + java_min(self.max.y, other.max.y), + java_min(self.max.z, other.max.z), + ), + ) + } + pub fn union_bounds(self, other: Self) -> Self { + Self::new( + Vec3::new( + java_min(self.min.x, other.min.x), + java_min(self.min.y, other.min.y), + java_min(self.min.z, other.min.z), + ), + Vec3::new( + java_max(self.max.x, other.max.x), + java_max(self.max.y, other.max.y), + java_max(self.max.z, other.max.z), + ), + ) + } + pub fn intersects(self, other: Self) -> bool { + self.min.x < other.max.x + && self.max.x > other.min.x + && self.min.y < other.max.y + && self.max.y > other.min.y + && self.min.z < other.max.z + && self.max.z > other.min.z + } + pub fn contains(self, point: Vec3) -> bool { + point.x >= self.min.x + && point.x < self.max.x + && point.y >= self.min.y + && point.y < self.max.y + && point.z >= self.min.z + && point.z < self.max.z + } + pub fn has_nan(self) -> bool { + self.min + .components() + .into_iter() + .chain(self.max.components()) + .any(f64::is_nan) + } + pub fn distance_squared_to_point(self, point: Vec3) -> f64 { + let distances = Axis::ALL.map(|a| { + java_max( + java_max( + self.min(a) - point.component(a), + point.component(a) - self.max(a), + ), + 0.0, + ) + }); + distances[0] * distances[0] + distances[1] * distances[1] + distances[2] * distances[2] + } + pub fn distance_squared_to_box(self, other: Self) -> f64 { + let distances = Axis::ALL.map(|a| { + java_max( + java_max(self.min(a) - other.max(a), other.min(a) - self.max(a)), + 0.0, + ) + }); + distances[0] * distances[0] + distances[1] * distances[1] + distances[2] * distances[2] + } + pub fn next_deflated(self) -> Self { + let lo = self.min.components().map(next_up); + let hi = self.max.components().map(next_down); + Self::new( + Vec3::new(lo[0], lo[1], lo[2]), + Vec3::new(hi[0], hi[1], hi[2]), + ) + } + fn clip_direction(self, start: Vec3, delta: Vec3, best: &mut f64) -> Option { + let mut result = None; + for axis in Axis::ALL { + let i = axis as usize; + let j = (i + 1) % 3; + let k = (i + 2) % 3; + let ds = delta.components(); + let origins = start.components(); + let (plane, face) = if ds[i] > COLLISION_EPSILON { + ( + self.min(axis), + [Direction::West, Direction::Down, Direction::North][i], + ) + } else if ds[i] < -COLLISION_EPSILON { + ( + self.max(axis), + [Direction::East, Direction::Up, Direction::South][i], + ) + } else { + continue; + }; + let t = (plane - origins[i]) / ds[i]; + let u = origins[j] + t * ds[j]; + let v = origins[k] + t * ds[k]; + if 0.0 < t + && t < *best + && self.min.components()[j] - COLLISION_EPSILON < u + && u < self.max.components()[j] + COLLISION_EPSILON + && self.min.components()[k] - COLLISION_EPSILON < v + && v < self.max.components()[k] + COLLISION_EPSILON + { + *best = t; + result = Some(face); + } + } + result + } + pub fn clip(self, start: Vec3, end: Vec3) -> Option { + let delta = start.vector_to(end); + let mut best = 1.0; + self.clip_direction(start, delta, &mut best) + .map(|_| start.add_vector(delta.scale(best))) + } + pub fn clip_boxes( + boxes: impl IntoIterator, + start: Vec3, + end: Vec3, + block: BlockPos, + ) -> Option { + let delta = start.vector_to(end); + let mut best = 1.0; + let mut direction = None; + for aabb in boxes { + if let Some(face) = aabb + .move_by(Vec3::from_block(block)) + .clip_direction(start, delta, &mut best) + { + direction = Some(face); + } + } + direction.map(|face| BlockHit { + location: start.add_vector(delta.scale(best)), + direction: face, + block, + inside: false, + }) + } + pub fn collided_along_vector(self, movement: Vec3, boxes: &[Self]) -> bool { + let start = self.center(); + let end = start.add_vector(movement); + let amount = self.size().scale(0.5).subtract(Vec3::new( + COLLISION_EPSILON, + COLLISION_EPSILON, + COLLISION_EPSILON, + )); + boxes.iter().any(|b| { + let b = b.inflate(amount); + b.contains(end) || b.contains(start) || b.clip(start, end).is_some() + }) + } +} + +pub(crate) fn java_min(a: f64, b: f64) -> f64 { + if a.is_nan() { + a + } else if b.is_nan() { + b + } else if a == 0.0 && b == 0.0 { + f64::from_bits(a.to_bits() | b.to_bits()) + } else if a <= b { + a + } else { + b + } +} +pub(crate) fn java_max(a: f64, b: f64) -> f64 { + if a.is_nan() { + a + } else if b.is_nan() { + b + } else if a == 0.0 && b == 0.0 { + f64::from_bits(a.to_bits() & b.to_bits()) + } else if a >= b { + a + } else { + b + } +} +pub(crate) fn clamp(value: f64, min: f64, max: f64) -> f64 { + if value < min { + min + } else { + java_min(value, max) + } +} +pub(crate) fn floor_i32(value: f64) -> i32 { + value.floor() as i32 +} +fn lerp(amount: f64, start: f64, end: f64) -> f64 { + start + amount * (end - start) +} +fn canonical_bits(value: f64) -> u64 { + if value.is_nan() { + 0x7ff8_0000_0000_0000 + } else { + value.to_bits() + } +} +fn next_up(value: f64) -> f64 { + if value.is_nan() || value == f64::INFINITY { + value + } else if value == 0.0 { + f64::from_bits(1) + } else { + f64::from_bits(if value > 0.0 { + value.to_bits() + 1 + } else { + value.to_bits() - 1 + }) + } +} +fn next_down(value: f64) -> f64 { + -next_up(-value) +} + +#[cfg(test)] +mod tests { + use super::*; + #[test] + fn ray_faces_and_half_open_bounds() { + let b = Aabb::block(BlockPos::new(0, 0, 0)); + assert!(b.contains(Vec3::ZERO)); + assert!(!b.contains(Vec3::new(1.0, 0.0, 0.0))); + assert_eq!( + b.clip(Vec3::new(-1.0, 0.5, 0.5), Vec3::new(2.0, 0.5, 0.5)), + Some(Vec3::new(0.0, 0.5, 0.5)) + ); + assert!( + b.clip(Vec3::new(0.5, 0.5, 0.5), Vec3::new(2.0, 0.5, 0.5)) + .is_none() + ); + assert!( + b.clip(Vec3::new(-1.0, 0.5, 0.5), Vec3::new(0.0, 0.5, 0.5)) + .is_none() + ); + } + #[test] + fn numerical_boundaries() { + assert_eq!(java_min(0.0, -0.0).to_bits(), (-0.0f64).to_bits()); + assert_eq!(java_max(0.0, -0.0).to_bits(), 0.0f64.to_bits()); + assert_eq!(Vec3::new(-0.0, 0.0, 0.0).normalize(), Vec3::ZERO); + assert_ne!(Vec3::new(-0.0, 0.0, 0.0), Vec3::ZERO); + let b = Aabb::block(BlockPos::new(i32::MAX, 0, 0)); + assert_eq!(b.min(Axis::X), i32::MIN as f64); + assert_eq!(b.max(Axis::X), i32::MAX as f64); + assert!(Aabb::new(Vec3::new(f64::NAN, 0.0, 0.0), Vec3::new(1.0, 1.0, 1.0)).has_nan()); + } +} diff --git a/crates/horizon-core/src/geometry/movement.rs b/crates/horizon-core/src/geometry/movement.rs new file mode 100644 index 000000000..e89c77ba0 --- /dev/null +++ b/crates/horizon-core/src/geometry/movement.rs @@ -0,0 +1,208 @@ +//! Entity geometry helpers operating on an already selected collider list. +use super::{Aabb, Axis, Vec3, VoxelShape}; + +/// BlockGetter's floor-height decision for caller-selected collision shapes. +/// The lower block is queried lazily only if the current shape is empty. +pub fn block_floor_height<'s>(shape: &VoxelShape, below: impl FnOnce() -> &'s VoxelShape) -> f64 { + if !shape.is_empty() { + return shape.max(Axis::Y); + } + let height = below().max(Axis::Y); + if height >= 1.0 { + height - 1.0 + } else { + f64::NEG_INFINITY + } +} + +/// Bounds used once by Entity.collide to select entity collisions. The same +/// entity list is reused for both subsequent block/world-border queries. +pub fn entity_collision_bounds(movement: Vec3, aabb: Aabb, max_step: f32) -> Aabb { + aabb.expand_towards(movement) + .expand_towards(Vec3::new(0.0, max_step as f64, 0.0)) +} + +/// Resolve Entity.collide's initial movement and complete step-up decision. +/// +/// `collect` supplies vanilla-equivalent colliders for each requested bound, +/// including the previously selected entity shapes, applicable world border, +/// and context-dependent block shapes in vanilla order. It is called for the +/// initial movement (unless its squared length is zero), then at most once +/// more if stepping is eligible. Entity collision selection and movement's +/// grounding/velocity/inside-block side effects belong to the caller. +pub fn resolve_step_movement<'s>( + movement: Vec3, + aabb: Aabb, + max_step: f32, + on_ground: bool, + mut collect: impl FnMut(Aabb) -> Vec<&'s VoxelShape>, +) -> Vec3 { + let resolved = if movement.length_squared() == 0.0 { + movement + } else { + let shapes = collect(aabb.expand_towards(movement)); + resolve_shape_movement(movement, aabb, &shapes) + }; + let landed = movement.y != resolved.y && movement.y < 0.0; + if max_step > 0.0 + && (landed || on_ground) + && (movement.x != resolved.x || movement.z != resolved.z) + { + let step_box = if landed { + aabb.move_by(Vec3::new(0.0, resolved.y, 0.0)) + } else { + aabb + }; + let mut query = step_box.expand_towards(Vec3::new(movement.x, max_step as f64, movement.z)); + if !landed { + query = query.expand_towards(Vec3::new(0.0, -(1.0e-5_f32 as f64), 0.0)); + } + let shapes = collect(query); + for height in candidate_step_heights(step_box, &shapes, max_step, resolved.y as f32) { + let candidate = resolve_shape_movement( + Vec3::new(movement.x, height as f64, movement.z), + step_box, + &shapes, + ); + if candidate.horizontal_distance_squared() > resolved.horizontal_distance_squared() { + return candidate.subtract(Vec3::new( + 0.0, + aabb.min(Axis::Y) - step_box.min(Axis::Y), + 0.0, + )); + } + } + } + resolved +} + +/// Resolve vanilla's Y-first, magnitude-dependent horizontal axis ordering. +/// +/// The caller must supply vanilla-equivalent block/entity/world-border shapes. +/// This helper does not collect shapes, step up, set grounded flags, modify +/// velocity, or apply inside-block effects. +pub fn resolve_shape_movement(movement: Vec3, aabb: Aabb, shapes: &[&VoxelShape]) -> Vec3 { + if shapes.is_empty() { + return movement; + } + let mut result = [0.0; 3]; + for axis in Axis::step_order(movement) { + let amount = movement.component(axis); + if amount == 0.0 { + continue; + } + let moved = aabb.move_by(Vec3::new(result[0], result[1], result[2])); + result[axis as usize] = + VoxelShape::collide_all(axis, moved, shapes.iter().copied(), amount); + } + Vec3::new(result[0], result[1], result[2]) +} + +/// Candidate heights from Entity.collectCandidateStepUpHeights, including its +/// float narrowing, signed-zero set identity, current-Y exclusion and sorting. +/// Used by the step-up decision after collecting the appropriate world shapes. +pub fn candidate_step_heights( + aabb: Aabb, + shapes: &[&VoxelShape], + max_step: f32, + current_y: f32, +) -> Vec { + let mut heights = Vec::::with_capacity(4); + for shape in shapes { + for coordinate in shape.coordinates(Axis::Y) { + let height = (*coordinate - aabb.min(Axis::Y)) as f32; + if height < 0.0 || height == current_y { + continue; + } + if height > max_step { + break; + } + // FloatArraySet uses Float.floatToIntBits, so NaNs compare equal + // while positive and negative zero remain separate members. + let height = if height.is_nan() { f32::NAN } else { height }; + if !heights.iter().any(|old| old.to_bits() == height.to_bits()) { + heights.push(height); + } + } + } + heights.sort_unstable_by(f32::total_cmp); + heights +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::position::BlockPos; + #[test] + fn movement_slides_after_a_wall_collision() { + let wall = VoxelShape::block(); + let b = Aabb::new(Vec3::new(-0.6, 0.0, 0.2), Vec3::new(-0.2, 1.8, 0.8)); + let requested = Vec3::new(1.0, 0.0, 0.1); + assert_eq!( + resolve_shape_movement(requested, b, &[&wall]), + Vec3::new(0.2, 0.0, 0.1) + ); + assert_eq!( + resolve_shape_movement(Vec3::new(-0.0, -0.0, -0.0), b, &[]), + Vec3::new(-0.0, -0.0, -0.0) + ); + assert_eq!( + resolve_shape_movement(Vec3::new(-0.0, -0.0, -0.0), b, &[&wall]), + Vec3::ZERO + ); + } + #[test] + fn step_heights_deduplicate_and_exclude_current_y() { + let shape = VoxelShape::from_cube([1, 2, 1], &[true, true]).unwrap(); + let b = Aabb::block(BlockPos::default()); + assert_eq!( + candidate_step_heights(b, &[&shape, &shape], 0.6, 0.0), + vec![0.5] + ); + assert_eq!( + candidate_step_heights(b, &[&shape], 1.0, 0.5), + vec![0.0, 1.0] + ); + } + + #[test] + fn stepping_requeries_and_clears_a_half_block() { + let ledge = VoxelShape::from_box(Aabb::new(Vec3::ZERO, Vec3::new(1.0, 0.5, 1.0))).unwrap(); + let b = Aabb::new(Vec3::new(-0.6, 0.0, 0.2), Vec3::new(-0.2, 1.8, 0.8)); + let requested = Vec3::new(1.0, 0.0, 0.0); + let mut queries = Vec::new(); + let result = resolve_step_movement(requested, b, 0.6, true, |query| { + queries.push(query); + vec![&ledge] + }); + assert_eq!(result, Vec3::new(1.0, 0.5, 0.0)); + assert_eq!(queries.len(), 2); + assert_eq!(queries[0], b.expand_towards(requested)); + assert_eq!(queries[1].min(Axis::Y), -(1.0e-5_f32 as f64)); + assert_eq!( + resolve_step_movement(requested, b, 0.6, false, |_| vec![&ledge]), + Vec3::new(0.2, 0.0, 0.0) + ); + } + + #[test] + fn squared_length_underflow_skips_collection_and_keeps_signed_zero() { + let b = Aabb::block(BlockPos::default()); + let requested = Vec3::new(-0.0, 1e-200, -0.0); + assert_eq!( + resolve_step_movement(requested, b, 0.6, true, |_| panic!("unexpected query")), + requested + ); + } + #[test] + fn floor_height_defers_the_lower_lookup_until_empty() { + let empty = VoxelShape::empty(); + let block = VoxelShape::block(); + assert_eq!( + block_floor_height(&block, || panic!("unnecessary lower lookup")), + 1.0 + ); + assert_eq!(block_floor_height(&empty, || &block), 0.0); + assert_eq!(block_floor_height(&empty, || &empty), f64::NEG_INFINITY); + } +} diff --git a/crates/horizon-core/src/geometry/shape.rs b/crates/horizon-core/src/geometry/shape.rs new file mode 100644 index 000000000..62593ebc6 --- /dev/null +++ b/crates/horizon-core/src/geometry/shape.rs @@ -0,0 +1,551 @@ +use super::{ + Aabb, Axis, BlockHit, COLLISION_EPSILON, Direction, Vec3, clamp, floor_i32, java_max, java_min, +}; +use crate::position::BlockPos; +use std::fmt; +use std::sync::{Arc, OnceLock}; +mod create; +mod face; +mod join; +pub use join::ShapeOp; + +#[derive(Clone, Debug, PartialEq, Eq)] +pub enum ShapeError { + InvalidCoordinates, + InvalidOccupancy, + TooLarge, + UnboundedBoolean, + InvalidBounds, +} +impl fmt::Display for ShapeError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "invalid voxel shape: {self:?}") + } +} +impl std::error::Error for ShapeError {} + +/// Immutable discrete occupancy with exact double coordinate boundaries. +/// +/// Greedy boxes are calculated once and reused for ray and proximity queries. +/// Cube shapes retain vanilla's arithmetic cell lookup instead of replacing it +/// with a binary search over coordinates (which differs at rounding boundaries). +#[derive(Clone, Debug)] +pub struct VoxelShape { + identity: Arc, + coords: Arc<[Vec; 3]>, + sizes: [usize; 3], + occupancy: Arc<[u64]>, + cube: bool, + coordinate_cubes: [bool; 3], + boxes: Arc>, + bounds: Option, + discrete_min: [i32; 3], + discrete_max: [i32; 3], +} + +type FaceCache = [OnceLock>; 6]; +#[derive(Debug, Default)] +struct ShapeIdentity { + faces: OnceLock>, +} + +impl VoxelShape { + pub fn from_grid(coords: [Vec; 3], occupied: &[bool]) -> Result { + Self::build(coords, occupied, false, [false; 3]) + } + pub fn from_cube(sizes: [usize; 3], occupied: &[bool]) -> Result { + if sizes.contains(&0) { + return Err(ShapeError::InvalidCoordinates); + } + let volume = volume(sizes)?; + if occupied.len() != volume { + return Err(ShapeError::InvalidOccupancy); + } + let coords = sizes.map(|size| (0..=size).map(|i| i as f64 / size as f64).collect()); + Self::build(coords, occupied, true, [true; 3]) + } + fn build( + coords: [Vec; 3], + occupied: &[bool], + cube: bool, + coordinate_cubes: [bool; 3], + ) -> Result { + if coords.iter().any(|c| { + c.is_empty() + || c.len() > 1_048_577 + || c.iter().any(|v| v.is_nan()) + || c.windows(2).any(|p| p[0] >= p[1]) + }) { + return Err(ShapeError::InvalidCoordinates); + } + let sizes = std::array::from_fn(|i| coords[i].len() - 1); + let count = volume(sizes)?; + if count != occupied.len() { + return Err(ShapeError::InvalidOccupancy); + } + let mut occupancy = vec![0; count.div_ceil(64)]; + let mut discrete_min = sizes.map(|v| v as i32); + let mut discrete_max = [0; 3]; + for (i, full) in occupied.iter().enumerate() { + if *full { + occupancy[i / 64] |= 1 << (i % 64); + let position = [ + (i / (sizes[1] * sizes[2])) as i32, + (i / sizes[2] % sizes[1]) as i32, + (i % sizes[2]) as i32, + ]; + for axis in 0..3 { + discrete_min[axis] = discrete_min[axis].min(position[axis]); + discrete_max[axis] = discrete_max[axis].max(position[axis] + 1); + } + } + } + let mut shape = Self { + identity: Arc::new(ShapeIdentity::default()), + coords: Arc::new(coords), + sizes, + occupancy: occupancy.into(), + cube, + coordinate_cubes, + boxes: Arc::new(Vec::new()), + bounds: None, + discrete_min, + discrete_max, + }; + shape.boxes = Arc::new(shape.decompose()); + shape.bounds = shape.boxes.iter().copied().reduce(Aabb::union_bounds); + Ok(shape) + } + pub fn empty() -> Self { + static EMPTY: OnceLock = OnceLock::new(); + EMPTY + .get_or_init(|| { + Self::from_grid([vec![0.0], vec![0.0], vec![0.0]], &[]).expect("valid empty grid") + }) + .clone() + } + pub fn block() -> Self { + static BLOCK: OnceLock = OnceLock::new(); + BLOCK + .get_or_init(|| Self::from_cube([1, 1, 1], &[true]).expect("valid unit cube")) + .clone() + } + pub fn is_empty(&self) -> bool { + self.bounds.is_none() + } + pub fn bounds(&self) -> Option { + self.bounds + } + pub fn boxes(&self) -> &[Aabb] { + &self.boxes + } + pub fn coordinates(&self, axis: Axis) -> &[f64] { + &self.coords[axis as usize] + } + pub fn sizes(&self) -> [usize; 3] { + self.sizes + } + pub fn is_cube(&self) -> bool { + self.cube + } + /// Clones and operations returning an existing immutable shape preserve its + /// identity. Separately constructed grids remain distinct even if equal. + pub fn same_identity(&self, other: &Self) -> bool { + Arc::ptr_eq(&self.identity, &other.identity) + } + /// A separately constructed shape with the same immutable grid. Storage is + /// shared, while identity-sensitive vanilla join shortcuts remain distinct. + pub fn fresh_identity(&self) -> Self { + let mut shape = self.clone(); + shape.identity = Arc::new(ShapeIdentity::default()); + shape + } + pub fn cube_coordinate_axes(&self) -> [bool; 3] { + self.coordinate_cubes + } + /// An array shape can contain CubePointRange axes after a partial cube + /// merge. Preserve that metadata for subsequent Boolean operations. + pub fn from_mixed_grid( + coords: [Vec; 3], + occupied: &[bool], + coordinate_cubes: [bool; 3], + ) -> Result { + for i in 0..3 { + if coordinate_cubes[i] { + let size = coords[i].len().saturating_sub(1); + if size == 0 + || coords[i] + .iter() + .enumerate() + .any(|(j, v)| v.to_bits() != (j as f64 / size as f64).to_bits()) + { + return Err(ShapeError::InvalidCoordinates); + } + } + } + Self::build(coords, occupied, false, coordinate_cubes) + } + pub fn min(&self, axis: Axis) -> f64 { + let i = axis as usize; + let index = self.discrete_min[i]; + if index >= self.sizes[i] as i32 { + f64::INFINITY + } else { + self.coords[i][index as usize] + } + } + pub fn max(&self, axis: Axis) -> f64 { + let i = axis as usize; + let index = self.discrete_max[i]; + if index <= 0 { + f64::NEG_INFINITY + } else { + self.coords[i][index as usize] + } + } + /// Discrete extrema are separate from occupancy: a quantized empty shape + /// can retain nonempty axis ranges, and empty joins retain Java sentinels. + pub fn discrete_bounds(&self) -> ([i32; 3], [i32; 3]) { + (self.discrete_min, self.discrete_max) + } + /// Import reference extrema. Nonempty shapes must match their occupancy; + /// empty shapes admit bounded ranges or the empty-join sentinel triple. + pub fn with_discrete_bounds( + mut self, + min: [i32; 3], + max: [i32; 3], + ) -> Result { + let in_range = (0..3).all(|i| { + min[i] >= 0 + && min[i] <= self.sizes[i] as i32 + && max[i] >= 0 + && max[i] <= self.sizes[i] as i32 + }); + let join_sentinel = min == [i32::MAX; 3] && max == [i32::MIN + 1; 3]; + if (!in_range && !join_sentinel) + || (!self.is_empty() && (min != self.discrete_min || max != self.discrete_max)) + { + return Err(ShapeError::InvalidBounds); + } + if min != self.discrete_min || max != self.discrete_max { + self.identity = Arc::new(ShapeIdentity::default()); + } + self.discrete_min = min; + self.discrete_max = max; + Ok(self) + } + /// Minimum occupied coordinate along an axis at the two cyclic + /// perpendicular coordinates; an empty/outside column yields +infinity. + pub fn min_at(&self, axis: Axis, first: f64, second: f64) -> f64 { + let mut position = self.column_position(axis, first, second); + for i in 0..self.sizes[axis as usize] { + position[axis as usize] = i as i32; + if self.is_full(position[0], position[1], position[2]) { + return self.coords[axis as usize][i]; + } + } + f64::INFINITY + } + /// Maximum occupied coordinate at the same cyclic column; an empty/outside + /// column yields -infinity. The maximum is the cell's upper face. + pub fn max_at(&self, axis: Axis, first: f64, second: f64) -> f64 { + let mut position = self.column_position(axis, first, second); + for i in (0..self.sizes[axis as usize]).rev() { + position[axis as usize] = i as i32; + if self.is_full(position[0], position[1], position[2]) { + return self.coords[axis as usize][i + 1]; + } + } + f64::NEG_INFINITY + } + fn column_position(&self, axis: Axis, first: f64, second: f64) -> [i32; 3] { + let a = (axis as usize + 1) % 3; + let b = (axis as usize + 2) % 3; + let mut position = [0; 3]; + position[a] = self.find_index(Axis::ALL[a], first); + position[b] = self.find_index(Axis::ALL[b], second); + position + } + /// Vanilla movement converts cube coordinates to an array shape, even for + /// a zero offset. Keep this distinction for subsequent cell lookups. + pub fn moved(&self, offset: Vec3) -> Self { + if self.is_empty() { + return Self::empty(); + } + let mut result = self.clone(); + result.identity = Arc::new(ShapeIdentity::default()); + result.cube = false; + result.coordinate_cubes = [false; 3]; + let mut coords = (*self.coords).clone(); + for axis in Axis::ALL { + for value in &mut coords[axis as usize] { + *value += offset.component(axis); + } + } + result.coords = Arc::new(coords); + result.boxes = Arc::new(result.decompose()); + result.bounds = self.bounds.map(|bounds| bounds.move_by(offset)); + result + } + pub fn is_full(&self, x: i32, y: i32, z: i32) -> bool { + if x < 0 + || y < 0 + || z < 0 + || x as usize >= self.sizes[0] + || y as usize >= self.sizes[1] + || z as usize >= self.sizes[2] + { + return false; + } + full( + &self.occupancy, + index(self.sizes, x as usize, y as usize, z as usize), + ) + } + pub fn find_index(&self, axis: Axis, value: f64) -> i32 { + let i = axis as usize; + if self.cube { + return floor_i32(clamp( + value * self.sizes[i] as f64, + -1.0, + self.sizes[i] as f64, + )); + } + // Upper-bound search, including the final outside cell index. + let coords = &self.coords[i]; + let mut start = 0; + let mut end = coords.len(); + while start < end { + let middle = (start + end) / 2; + if value < coords[middle] { + end = middle; + } else { + start = middle + 1; + } + } + start as i32 - 1 + } + pub fn collide(&self, axis: Axis, aabb: Aabb, amount: f64) -> f64 { + if self.is_empty() { + return amount; + } + if amount.abs() < COLLISION_EPSILON { + return 0.0; + } + let i = axis as usize; + let p = Axis::ALL[(i + 1) % 3]; + let q = Axis::ALL[(i + 2) % 3]; + let p_start = self.find_index(p, aabb.min(p) + COLLISION_EPSILON).max(0); + let p_end = (self.find_index(p, aabb.max(p) - COLLISION_EPSILON) + 1) + .min(self.sizes[p as usize] as i32); + let q_start = self.find_index(q, aabb.min(q) + COLLISION_EPSILON).max(0); + let q_end = (self.find_index(q, aabb.max(q) - COLLISION_EPSILON) + 1) + .min(self.sizes[q as usize] as i32); + let occupied_layer = |layer| { + (p_start..p_end).any(|u| { + (q_start..q_end).any(|v| { + let mut cell = [0; 3]; + cell[i] = layer; + cell[p as usize] = u; + cell[q as usize] = v; + self.is_full(cell[0], cell[1], cell[2]) + }) + }) + }; + if amount > 0.0 { + let start = self.find_index(axis, aabb.max(axis) - COLLISION_EPSILON) + 1; + for layer in start..self.sizes[i] as i32 { + if occupied_layer(layer) { + let distance = self.coords[i][layer as usize] - aabb.max(axis); + return if distance >= -COLLISION_EPSILON { + java_min(amount, distance) + } else { + amount + }; + } + } + } else if amount < 0.0 { + let start = self.find_index(axis, aabb.min(axis) + COLLISION_EPSILON); + for layer in (0..start).rev() { + if occupied_layer(layer) { + let distance = self.coords[i][layer as usize + 1] - aabb.min(axis); + return if distance <= COLLISION_EPSILON { + java_max(amount, distance) + } else { + amount + }; + } + } + } + amount + } + pub fn collide_all<'a>( + axis: Axis, + aabb: Aabb, + shapes: impl IntoIterator, + mut amount: f64, + ) -> f64 { + for shape in shapes { + if amount.abs() < COLLISION_EPSILON { + return 0.0; + } + amount = shape.collide(axis, aabb, amount); + } + amount + } + pub fn clip(&self, start: Vec3, end: Vec3, block: BlockPos) -> Option { + if self.is_empty() { + return None; + } + let delta = end.subtract(start); + if delta.length_squared() < COLLISION_EPSILON { + return None; + } + let nudged = start.add_vector(delta.scale(0.001)); + let x = self.find_index(Axis::X, nudged.x - block.x as f64); + let y = self.find_index(Axis::Y, nudged.y - block.y as f64); + let z = self.find_index(Axis::Z, nudged.z - block.z as f64); + if self.is_full(x, y, z) { + Some(BlockHit { + location: nudged, + direction: Direction::approximate_nearest(delta).opposite(), + block, + inside: true, + }) + } else { + Aabb::clip_boxes(self.boxes.iter().copied(), start, end, block) + } + } + pub fn closest_point(&self, point: Vec3) -> Option { + let mut best = None; + for aabb in self.boxes.iter() { + let candidate = Vec3::new( + clamp(point.x, aabb.min(Axis::X), aabb.max(Axis::X)), + clamp(point.y, aabb.min(Axis::Y), aabb.max(Axis::Y)), + clamp(point.z, aabb.min(Axis::Z), aabb.max(Axis::Z)), + ); + if best + .is_none_or(|old| point.distance_squared(candidate) < point.distance_squared(old)) + { + best = Some(candidate); + } + } + best + } + fn decompose(&self) -> Vec { + let mut remaining = self.occupancy.to_vec(); + let mut boxes = Vec::new(); + let [nx, ny, nz] = self.sizes; + for y in 0..ny { + for x in 0..nx { + let mut run = None; + for z in 0..=nz { + if z < nz && full(&remaining, index(self.sizes, x, y, z)) { + if run.is_none() { + run = Some(z); + } + continue; + } + let Some(z_start) = run.take() else { continue }; + clear_strip(&mut remaining, self.sizes, x, y, z_start, z); + let mut x_end = x + 1; + while x_end < nx && strip_full(&remaining, self.sizes, x_end, y, z_start, z) { + clear_strip(&mut remaining, self.sizes, x_end, y, z_start, z); + x_end += 1; + } + let mut y_end = y + 1; + while y_end < ny + && (x..x_end) + .all(|u| strip_full(&remaining, self.sizes, u, y_end, z_start, z)) + { + for u in x..x_end { + clear_strip(&mut remaining, self.sizes, u, y_end, z_start, z); + } + y_end += 1; + } + boxes.push(Aabb::new( + Vec3::new( + self.coords[0][x], + self.coords[1][y], + self.coords[2][z_start], + ), + Vec3::new( + self.coords[0][x_end], + self.coords[1][y_end], + self.coords[2][z], + ), + )); + } + } + } + boxes + } +} + +fn volume(sizes: [usize; 3]) -> Result { + let count = sizes + .into_iter() + .try_fold(1usize, usize::checked_mul) + .ok_or(ShapeError::TooLarge)?; + if count > 1_048_576 { + Err(ShapeError::TooLarge) + } else { + Ok(count) + } +} +fn index(sizes: [usize; 3], x: usize, y: usize, z: usize) -> usize { + (x * sizes[1] + y) * sizes[2] + z +} +fn full(bits: &[u64], i: usize) -> bool { + bits[i / 64] & (1 << (i % 64)) != 0 +} +fn strip_full(bits: &[u64], sizes: [usize; 3], x: usize, y: usize, min: usize, max: usize) -> bool { + (min..max).all(|z| full(bits, index(sizes, x, y, z))) +} +fn clear_strip(bits: &mut [u64], sizes: [usize; 3], x: usize, y: usize, min: usize, max: usize) { + for z in min..max { + let i = index(sizes, x, y, z); + bits[i / 64] &= !(1 << (i % 64)); + } +} + +#[cfg(test)] +mod tests { + use super::*; + #[test] + fn stop_at_obstacle_and_reuse_boxes() { + let shape = VoxelShape::block(); + let player = Aabb::new(Vec3::new(-0.6, 0.0, 0.2), Vec3::new(-0.2, 1.8, 0.8)); + assert_eq!(shape.collide(Axis::X, player, 1.0), 0.2); + assert_eq!(shape.collide(Axis::Z, player, 1.0), 1.0); + assert_eq!(shape.boxes().len(), 1); + assert!( + shape + .clip( + Vec3::new(0.5, 0.5, 0.5), + Vec3::new(2.0, 0.5, 0.5), + BlockPos::default() + ) + .unwrap() + .inside + ); + assert_eq!( + VoxelShape::empty().collide(Axis::X, player, -0.0).to_bits(), + (-0.0f64).to_bits() + ); + } + #[test] + fn sparse_stair_decomposition() { + let shape = VoxelShape::from_cube( + [2, 2, 2], + &[true, true, false, false, true, true, true, true], + ) + .unwrap(); + assert_eq!(shape.boxes().len(), 2); + assert_eq!( + shape.closest_point(Vec3::new(0.1, 0.9, 0.5)), + Some(Vec3::new(0.1, 0.5, 0.5)) + ); + assert!(VoxelShape::from_grid(std::array::from_fn(|_| vec![0.0, 1.0]), &[]).is_err()); + } +} diff --git a/crates/horizon-core/src/geometry/shape/create.rs b/crates/horizon-core/src/geometry/shape/create.rs new file mode 100644 index 000000000..312e030b3 --- /dev/null +++ b/crates/horizon-core/src/geometry/shape/create.rs @@ -0,0 +1,147 @@ +use super::{ShapeError, ShapeOp, VoxelShape}; +use crate::geometry::{Aabb, Axis, COLLISION_EPSILON}; + +impl VoxelShape { + /// Shapes.create(AABB): thin-box rejection and up to 1/8 cube quantization. + pub fn from_box(aabb: Aabb) -> Result { + if aabb.has_nan() { + return Err(ShapeError::InvalidCoordinates); + } + if Axis::ALL + .into_iter() + .any(|axis| aabb.max(axis) - aabb.min(axis) < COLLISION_EPSILON) + { + return Ok(Self::empty()); + } + let bits = Axis::ALL.map(|axis| find_bits(aabb.min(axis), aabb.max(axis))); + if bits.iter().any(Option::is_none) { + return Self::from_grid( + Axis::ALL.map(|axis| vec![aabb.min(axis), aabb.max(axis)]), + &[true], + ); + } + let bits = bits.map(Option::unwrap); + if bits == [0, 0, 0] { + return Ok(Self::block()); + } + let sizes = bits.map(|bits| 1usize << bits); + let lo = std::array::from_fn::<_, 3, _>(|i| { + round_small(aabb.min(Axis::ALL[i]) * sizes[i] as f64) as usize + }); + let hi = std::array::from_fn::<_, 3, _>(|i| { + round_small(aabb.max(Axis::ALL[i]) * sizes[i] as f64) as usize + }); + let mut occupied = Vec::with_capacity(sizes[0] * sizes[1] * sizes[2]); + for x in 0..sizes[0] { + for y in 0..sizes[1] { + for z in 0..sizes[2] { + occupied.push( + x >= lo[0] + && x < hi[0] + && y >= lo[1] + && y < hi[1] + && z >= lo[2] + && z < hi[2], + ); + } + } + } + Self::from_cube(sizes, &occupied)? + .with_discrete_bounds(lo.map(|v| v as i32), hi.map(|v| v as i32)) + } + /// VoxelShape.optimize, reconstructing greedy boxes in vanilla order. + pub fn optimized(&self) -> Result { + let mut result = Self::empty(); + for aabb in self.boxes.iter() { + let part = Self::from_box(*aabb)?; + result = result.join_unoptimized(&part, ShapeOp::OR)?; + } + Ok(result) + } + pub fn join(&self, other: &Self, operation: ShapeOp) -> Result { + self.join_unoptimized(other, operation)?.optimized() + } +} +fn find_bits(min: f64, max: f64) -> Option { + if min < -COLLISION_EPSILON || max > 1.0000001 { + return None; + } + for bits in 0..=3 { + let size = (1usize << bits) as f64; + let lo = min * size; + let hi = max * size; + if (lo - round_small(lo) as f64).abs() < COLLISION_EPSILON * size + && (hi - round_small(hi) as f64).abs() < COLLISION_EPSILON * size + { + return Some(bits); + } + } + None +} +// Values reach this helper only in the small range admitted by find_bits. +// Avoid floor(value + 0.5): addition can round a value just below a tie upward. +fn round_small(value: f64) -> i64 { + let lower = value.floor(); + (if value - lower >= 0.5 { + lower + 1.0 + } else { + lower + }) as i64 +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::geometry::Vec3; + #[test] + fn quantization_thin_boxes_and_shared_block_identity() { + let full = VoxelShape::from_box(Aabb::new(Vec3::ZERO, Vec3::new(1.0, 1.0, 1.0))).unwrap(); + assert!(full.same_identity(&VoxelShape::block())); + let slab = VoxelShape::from_box(Aabb::new(Vec3::ZERO, Vec3::new(1.0, 0.5, 1.0))).unwrap(); + assert!(slab.is_cube()); + assert_eq!(slab.sizes(), [1, 2, 1]); + assert_eq!(slab.max(Axis::Y), 0.5); + let thin = VoxelShape::from_box(Aabb::new(Vec3::ZERO, Vec3::new(1e-8, 1.0, 1.0))).unwrap(); + assert!(thin.same_identity(&VoxelShape::empty())); + assert_eq!(round_small(f64::from_bits(0.5f64.to_bits() - 1)), 0); + } + #[test] + fn optimization_restores_composite_shapes() { + let a = VoxelShape::from_box(Aabb::new(Vec3::ZERO, Vec3::new(1.0, 0.5, 1.0))).unwrap(); + let b = VoxelShape::from_box(Aabb::new( + Vec3::new(0.5, 0.5, 0.0), + Vec3::new(1.0, 1.0, 1.0), + )) + .unwrap(); + let combined = a.join(&b, ShapeOp::OR).unwrap(); + assert_eq!(combined.boxes().len(), 2); + assert_eq!(combined.max(Axis::Y), 1.0); + assert!( + !combined + .join_is_not_empty(&a.join_unoptimized(&b, ShapeOp::OR).unwrap(), ShapeOp::XOR) + .unwrap() + ); + } + #[test] + fn quantized_empty_boxes_keep_independent_axis_extrema() { + let shape = VoxelShape::from_box(Aabb::new( + crate::geometry::Vec3::new(1e-8, 0.875, -1e-8), + crate::geometry::Vec3::new(0.12500001, 1.0, 9e-8), + )) + .unwrap(); + assert!(shape.is_empty()); + assert_eq!(shape.min(Axis::Y), 0.875); + assert_eq!(shape.max(Axis::Y), 1.0); + assert_eq!(shape.max(Axis::Z), f64::NEG_INFINITY); + assert_eq!( + crate::geometry::block_floor_height(&VoxelShape::empty(), || &shape), + 0.0 + ); + assert!( + shape + .optimized() + .unwrap() + .same_identity(&VoxelShape::empty()) + ); + } +} diff --git a/crates/horizon-core/src/geometry/shape/face.rs b/crates/horizon-core/src/geometry/shape/face.rs new file mode 100644 index 000000000..06a0f95ef --- /dev/null +++ b/crates/horizon-core/src/geometry/shape/face.rs @@ -0,0 +1,123 @@ +use super::{ShapeError, VoxelShape, volume}; +use crate::geometry::{Aabb, Axis, COLLISION_EPSILON, Direction, Vec3}; + +impl VoxelShape { + /// Native face selection samples just inside the unit-block boundary. The + /// result preserves identity on empty/cube-like axes and caches other faces. + pub fn face_shape(&self, direction: Direction) -> Result { + let (axis, _) = face_axis(direction); + if self.is_empty() || self.cube_like_along(axis) { + return Ok(self.clone()); + } + self.identity + .faces + .get_or_init(|| Box::new(std::array::from_fn(|_| std::sync::OnceLock::new()))) + [direction as usize] + .get_or_init(|| self.calculate_face(direction)) + .clone() + } + fn cube_like_along(&self, axis: Axis) -> bool { + let coords = self.coordinates(axis); + coords.len() == 2 + && coords[0].abs() <= COLLISION_EPSILON + && (coords[1] - 1.0).abs() <= COLLISION_EPSILON + } + fn calculate_face(&self, direction: Direction) -> Result { + let (axis, positive) = face_axis(direction); + let a = axis as usize; + let index = self.find_index( + axis, + if positive { + 0.9999999 + } else { + COLLISION_EPSILON + }, + ); + let mut starts = [0; 3]; + starts[a] = index; + let mut ends = self.sizes.map(|v| v as i32); + ends[a] = index + 1; + // SubShape extrema clamp the parent bounds; they are not recomputed + // from the selected occupancy. Sparse slices can therefore be nonempty + // by native metadata even when their decomposition contains no boxes. + let min = + std::array::from_fn(|i| self.discrete_min[i].clamp(starts[i], ends[i]) - starts[i]); + let max = + std::array::from_fn(|i| self.discrete_max[i].clamp(starts[i], ends[i]) - starts[i]); + if (0..3).any(|i| min[i] >= max[i]) { + return Ok(Self::empty()); + } + let mut coords = (*self.coords).clone(); + coords[a] = vec![0.0, 1.0]; + if (0..3).all(|i| { + coords[i].len() == 2 + && coords[i][0].abs() <= COLLISION_EPSILON + && (coords[i][1] - 1.0).abs() <= COLLISION_EPSILON + }) { + return Ok(Self::block()); + } + let sizes = std::array::from_fn(|i| coords[i].len() - 1); + let mut occupied = Vec::with_capacity(volume(sizes)?); + for x in 0..sizes[0] { + for y in 0..sizes[1] { + for z in 0..sizes[2] { + let mut p = [x as i32, y as i32, z as i32]; + p[a] = index; + occupied.push(self.is_full(p[0], p[1], p[2])); + } + } + } + let mut cubes = self.coordinate_cubes; + cubes[a] = true; + let mut result = Self::build(coords, &occupied, false, cubes)?; + result.discrete_min = min; + result.discrete_max = max; + result.bounds = Some(Aabb::new( + Vec3::new( + result.min(Axis::X), + result.min(Axis::Y), + result.min(Axis::Z), + ), + Vec3::new( + result.max(Axis::X), + result.max(Axis::Y), + result.max(Axis::Z), + ), + )); + Ok(result) + } +} +fn face_axis(direction: Direction) -> (Axis, bool) { + match direction { + Direction::Down => (Axis::Y, false), + Direction::Up => (Axis::Y, true), + Direction::North => (Axis::Z, false), + Direction::South => (Axis::Z, true), + Direction::West => (Axis::X, false), + Direction::East => (Axis::X, true), + } +} + +#[cfg(test)] +mod tests { + use super::*; + use std::sync::Arc; + #[test] + fn face_cache_is_lazy_shared_and_does_not_retain_parent() { + let shape = VoxelShape::from_cube( + [2, 2, 2], + &[true, false, false, false, false, false, false, false], + ) + .unwrap(); + assert!(shape.identity.faces.get().is_none()); + let weak = Arc::downgrade(&shape.identity); + let face = shape.face_shape(Direction::Down).unwrap(); + assert!(!face.same_identity(&shape)); + assert!(face.same_identity(&shape.clone().face_shape(Direction::Down).unwrap())); + assert!(shape.fresh_identity().identity.faces.get().is_none()); + assert!(shape.moved(Vec3::ZERO).identity.faces.get().is_none()); + drop(shape); + assert!(weak.upgrade().is_none()); + assert!(!face.is_empty()); + } +} diff --git a/crates/horizon-core/src/geometry/shape/join.rs b/crates/horizon-core/src/geometry/shape/join.rs new file mode 100644 index 000000000..57c981e65 --- /dev/null +++ b/crates/horizon-core/src/geometry/shape/join.rs @@ -0,0 +1,363 @@ +use super::{ShapeError, VoxelShape, volume}; +use crate::geometry::{Axis, COLLISION_EPSILON}; + +/// A four-bit truth table, indexed as (first << 1) | second. +/// True for two empty cells would describe an unbounded volume, which vanilla +/// rejects for shape joins. Typed errors preserve that rejection here. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct ShapeOp(u8); +impl ShapeOp { + pub const FALSE: Self = Self(0); + pub const AND: Self = Self(8); + pub const OR: Self = Self(14); + pub const XOR: Self = Self(6); + pub const ONLY_FIRST: Self = Self(4); + pub const ONLY_SECOND: Self = Self(2); + pub const FIRST: Self = Self(12); + pub const SECOND: Self = Self(10); + pub const fn from_truth_table(bits: u8) -> Self { + Self(bits & 15) + } + pub const fn apply(self, first: bool, second: bool) -> bool { + self.0 & (1 << ((first as u8) * 2 + second as u8)) != 0 + } + fn validate(self) -> Result<(), ShapeError> { + if self.apply(false, false) { + Err(ShapeError::UnboundedBoolean) + } else { + Ok(()) + } + } +} + +struct Merger { + coords: Vec, + first: Vec, + second: Vec, + cube_range: bool, + discrete_cube: bool, +} + +impl VoxelShape { + /// Shapes.joinUnoptimized, preserving merged coordinates and cube metadata. + pub fn join_unoptimized(&self, other: &Self, operation: ShapeOp) -> Result { + operation.validate()?; + if self.same_identity(other) { + return Ok(if operation.apply(true, true) { + self.clone() + } else { + Self::empty() + }); + } + let only_first = operation.apply(true, false); + let only_second = operation.apply(false, true); + if self.is_empty() { + return Ok(if only_second { + other.clone() + } else { + Self::empty() + }); + } + if other.is_empty() { + return Ok(if only_first { + self.clone() + } else { + Self::empty() + }); + } + let mergers = self.mergers(other, only_first, only_second)?; + let sizes = std::array::from_fn(|i| mergers[i].coords.len() - 1); + let count = volume(sizes)?; + let mut occupied = Vec::with_capacity(count); + for x in 0..sizes[0] { + for y in 0..sizes[1] { + for z in 0..sizes[2] { + let a = self.is_full( + mergers[0].first[x], + mergers[1].first[y], + mergers[2].first[z], + ); + let b = other.is_full( + mergers[0].second[x], + mergers[1].second[y], + mergers[2].second[z], + ); + occupied.push(operation.apply(a, b)); + } + } + } + let [x, y, z] = mergers; + let coordinate_cubes = [x.cube_range, y.cube_range, z.cube_range]; + let cube = x.discrete_cube && y.discrete_cube && z.discrete_cube; + let shape = Self::build( + [x.coords, y.coords, z.coords], + &occupied, + cube, + coordinate_cubes, + )?; + if shape.is_empty() { + shape.with_discrete_bounds([i32::MAX; 3], [i32::MIN + 1; 3]) + } else { + Ok(shape) + } + } + /// Shapes.joinIsNotEmpty without allocating the result occupancy or boxes. + pub fn join_is_not_empty(&self, other: &Self, operation: ShapeOp) -> Result { + operation.validate()?; + let a_empty = self.is_empty(); + let b_empty = other.is_empty(); + if a_empty || b_empty { + return Ok(operation.apply(!a_empty, !b_empty)); + } + if self.same_identity(other) { + return Ok(operation.apply(true, true)); + } + let only_first = operation.apply(true, false); + let only_second = operation.apply(false, true); + for axis in Axis::ALL { + if self.max(axis) < other.min(axis) - COLLISION_EPSILON + || other.max(axis) < self.min(axis) - COLLISION_EPSILON + { + return Ok(only_first || only_second); + } + } + let mergers = self.mergers(other, only_first, only_second)?; + let sizes = std::array::from_fn(|i| mergers[i].coords.len() - 1); + volume(sizes)?; + for x in 0..sizes[0] { + for y in 0..sizes[1] { + for z in 0..sizes[2] { + if operation.apply( + self.is_full( + mergers[0].first[x], + mergers[1].first[y], + mergers[2].first[z], + ), + other.is_full( + mergers[0].second[x], + mergers[1].second[y], + mergers[2].second[z], + ), + ) { + return Ok(true); + } + } + } + } + Ok(false) + } + fn mergers( + &self, + other: &Self, + only_first: bool, + only_second: bool, + ) -> Result<[Merger; 3], ShapeError> { + let x = merge( + 1, + &self.coords[0], + &other.coords[0], + self.coordinate_cubes[0], + other.coordinate_cubes[0], + only_first, + only_second, + )?; + let y = merge( + x.coords.len() - 1, + &self.coords[1], + &other.coords[1], + self.coordinate_cubes[1], + other.coordinate_cubes[1], + only_first, + only_second, + )?; + let multiplier = (x.coords.len() - 1) + .checked_mul(y.coords.len() - 1) + .ok_or(ShapeError::TooLarge)?; + let z = merge( + multiplier, + &self.coords[2], + &other.coords[2], + self.coordinate_cubes[2], + other.coordinate_cubes[2], + only_first, + only_second, + )?; + Ok([x, y, z]) + } +} + +#[allow(clippy::too_many_arguments)] // Mirrors the coordinate-merger selection inputs. +fn merge( + multiplier: usize, + a: &[f64], + b: &[f64], + a_cube: bool, + b_cube: bool, + only_first: bool, + only_second: bool, +) -> Result { + let na = a.len() - 1; + let nb = b.len() - 1; + if a_cube && b_cube { + let gcd = gcd(na, nb); + let lcm = (na / gcd).checked_mul(nb).ok_or(ShapeError::TooLarge)?; + if multiplier + .checked_mul(lcm) + .is_some_and(|volume| volume <= 256) + { + return Ok(Merger { + coords: (0..=lcm).map(|i| i as f64 / lcm as f64).collect(), + first: (0..lcm).map(|i| (i / (nb / gcd)) as i32).collect(), + second: (0..lcm).map(|i| (i / (na / gcd)) as i32).collect(), + cube_range: true, + discrete_cube: true, + }); + } + } + if a[na] < b[0] - COLLISION_EPSILON { + return Ok(disjoint(a, b, false)); + } + if b[nb] < a[0] - COLLISION_EPSILON { + return Ok(disjoint(b, a, true)); + } + // Primitive DoubleArrayList equality treats the two signed zeros equally. + if a.len() == b.len() && a.iter().zip(b).all(|(a, b)| a == b) { + return Ok(Merger { + coords: a.to_vec(), + first: (0..na).map(|i| i as i32).collect(), + second: (0..na).map(|i| i as i32).collect(), + cube_range: a_cube, + discrete_cube: false, + }); + } + let mut coords = Vec::with_capacity(a.len() + b.len()); + let mut first = Vec::with_capacity(coords.capacity()); + let mut second = Vec::with_capacity(coords.capacity()); + let (mut i, mut j) = (0usize, 0usize); + let mut last = f64::NAN; + while i < a.len() || j < b.len() { + let a_end = i == a.len(); + let b_end = j == b.len(); + let choose_a = !a_end && (b_end || a[i] < b[j] + COLLISION_EPSILON); + if choose_a { + i += 1; + if !only_first && (j == 0 || b_end) { + continue; + } + } else { + j += 1; + if !only_second && (i == 0 || a_end) { + continue; + } + } + let ai = i as i32 - 1; + let bj = j as i32 - 1; + let value = if choose_a { a[i - 1] } else { b[j - 1] }; + if !matches!( + last.partial_cmp(&(value - COLLISION_EPSILON)), + Some(std::cmp::Ordering::Greater | std::cmp::Ordering::Equal) + ) { + coords.push(value); + first.push(ai); + second.push(bj); + last = value; + } else { + let n = coords.len() - 1; + first[n] = ai; + second[n] = bj; + } + } + if coords.len() <= 1 { + coords = vec![0.0]; + first.clear(); + second.clear(); + } else { + first.pop(); + second.pop(); + } + Ok(Merger { + coords, + first, + second, + cube_range: false, + discrete_cube: false, + }) +} +fn disjoint(lower: &[f64], upper: &[f64], swap: bool) -> Merger { + let nl = lower.len(); + let nu = upper.len(); + let mut first = Vec::with_capacity(nl + nu - 1); + let mut second = Vec::with_capacity(nl + nu - 1); + for i in 0..nl { + first.push(i as i32); + second.push(-1); + } + for i in 0..nu - 1 { + first.push(nl as i32 - 1); + second.push(i as i32); + } + if swap { + std::mem::swap(&mut first, &mut second); + } + Merger { + coords: lower.iter().chain(upper).copied().collect(), + first, + second, + cube_range: false, + discrete_cube: false, + } +} +fn gcd(mut a: usize, mut b: usize) -> usize { + while b != 0 { + let r = a % b; + a = b; + b = r; + } + a +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::geometry::Vec3; + #[test] + fn signed_zero_list_equality_preserves_first_coordinates() { + let a = VoxelShape::from_grid([vec![0.0, 1.0], vec![0.0, 1.0], vec![0.0, 1.0]], &[true]) + .unwrap(); + let b = VoxelShape::from_grid([vec![-0.0, 1.0], vec![0.0, 1.0], vec![0.0, 1.0]], &[true]) + .unwrap(); + let joined = a.join_unoptimized(&b, ShapeOp::FALSE).unwrap(); + assert!(joined.is_empty()); + assert_eq!(joined.coordinates(Axis::X)[0].to_bits(), 0.0f64.to_bits()); + assert_eq!(joined.coordinates(Axis::X).len(), 2); + } + #[test] + fn returned_shapes_preserve_alias_identity() { + let a = VoxelShape::block().moved(Vec3::new(2.0, 0.0, 0.0)); + let alias = VoxelShape::empty() + .join_unoptimized(&a, ShapeOp::OR) + .unwrap(); + assert!(a.same_identity(&alias)); + let result = a.join_unoptimized(&alias, ShapeOp::FALSE).unwrap(); + assert!(result.same_identity(&VoxelShape::empty())); + assert_eq!(result.coordinates(Axis::X), &[0.0]); + assert!(!a.same_identity(&a.moved(Vec3::ZERO))); + } + #[test] + fn unions_intersections_difference_and_rejection() { + let a = VoxelShape::block(); + let b = a.moved(Vec3::new(0.5, 0.0, 0.0)); + let union = a.join_unoptimized(&b, ShapeOp::OR).unwrap(); + assert_eq!(union.max(Axis::X), 1.5); + let intersection = a.join_unoptimized(&b, ShapeOp::AND).unwrap(); + assert_eq!(intersection.min(Axis::X), 0.5); + assert_eq!(intersection.max(Axis::X), 1.0); + let difference = a.join_unoptimized(&b, ShapeOp::ONLY_FIRST).unwrap(); + assert_eq!(difference.max(Axis::X), 0.5); + assert!(!a.join_is_not_empty(&a, ShapeOp::XOR).unwrap()); + assert!( + a.join_unoptimized(&b, ShapeOp::from_truth_table(1)) + .is_err() + ); + } +} diff --git a/crates/horizon-core/src/geometry/sweep.rs b/crates/horizon-core/src/geometry/sweep.rs new file mode 100644 index 000000000..e90ee5634 --- /dev/null +++ b/crates/horizon-core/src/geometry/sweep.rs @@ -0,0 +1,224 @@ +//! BlockGetter.forEachBlockIntersectedBetween's ordered movement-path visits. +use super::{Aabb, TraversalError, Vec3, clamp, floor_i32}; +use crate::position::BlockPos; +use std::collections::HashSet; + +struct Sweep<'v, V> { + visitor: &'v mut V, + visited: HashSet, + work: usize, + limit: usize, +} +impl bool> Sweep<'_, V> { + fn spend(&mut self) -> Result<(), TraversalError> { + if self.work == self.limit { + return Err(TraversalError::VisitLimit); + } + self.work += 1; + Ok(()) + } + fn visit( + &mut self, + positions: impl Iterator, + step: i32, + deduplicate: bool, + ) -> Result { + for pos in positions { + self.spend()?; + if deduplicate && !self.visited.insert(pos.pack()) { + continue; + } + if !(self.visitor)(pos, step) { + return Ok(false); + } + if !deduplicate { + self.visited.insert(pos.pack()); + } + } + Ok(true) + } +} + +/// Visit blocks and step indices for a moving box, stopping if the callback +/// returns false. `final_box` is the box at `end`, not at `start`. +/// +/// Only finite inputs/computed geometry and positive Java-int-sized block boxes +/// are supported. `max_work` limits iterator candidates and ray steps, including +/// suppressed duplicate visits. Prior callbacks remain applied on an error. +/// Block/entity effects and their state transitions are separate from visitation. +pub fn sweep_intersected_blocks( + start: Vec3, + end: Vec3, + final_box: Aabb, + max_work: usize, + mut visitor: impl FnMut(BlockPos, i32) -> bool, +) -> Result { + if !start.is_finite() + || !end.is_finite() + || !final_box.min_position().is_finite() + || !final_box.max_position().is_finite() + { + return Err(TraversalError::NonFinite); + } + let movement = end.subtract(start); + if !movement.is_finite() { + return Err(TraversalError::NonFinite); + } + if movement.length_squared() < (1.0e-5_f32 * 1.0e-5_f32) as f64 { + let blocks = + BlockPos::between_closed_box(final_box).map_err(|_| TraversalError::InvalidBounds)?; + // This branch has no deduplication in vanilla. Avoid allocating a set + // or copying visited positions for stationary/tiny movements. + for (work, pos) in blocks.enumerate() { + if work == max_work { + return Err(TraversalError::VisitLimit); + } + if !visitor(pos, 0) { + return Ok(false); + } + } + return Ok(true); + } + let mut sweep = Sweep { + visitor: &mut visitor, + visited: HashSet::new(), + work: 0, + limit: max_work, + }; + let initial_box = final_box.move_by(movement.scale(-1.0)); + if !initial_box.min_position().is_finite() || !initial_box.max_position().is_finite() { + return Err(TraversalError::NonFinite); + } + let initial = BlockPos::between_box_corners_in_direction(initial_box, movement) + .map_err(|_| TraversalError::InvalidBounds)?; + if !sweep.visit(initial, 0, false)? { + return Ok(false); + } + let size = final_box.size().components(); + let corner = furthest_corner(movement); + let center = final_box.center().components(); + let finish = Vec3::new( + center[0] + size[0] * 0.5 * corner[0] as f64, + center[1] + size[1] * 0.5 * corner[1] as f64, + center[2] + size[2] * 0.5 * corner[2] as f64, + ); + let origin = finish.subtract(movement); + if !origin.is_finite() || !finish.is_finite() || size.iter().any(|v| !v.is_finite()) { + return Err(TraversalError::NonFinite); + } + let mut position = origin.components().map(floor_i32); + let delta = movement.components(); + let sign = delta.map(|v| { + if v == 0.0 { + 0i32 + } else if v > 0.0 { + 1 + } else { + -1 + } + }); + let increment = std::array::from_fn::<_, 3, _>(|i| { + if sign[i] == 0 { + f64::MAX + } else { + sign[i] as f64 / delta[i] + } + }); + let mut boundary = std::array::from_fn::<_, 3, _>(|i| { + let value = origin.components()[i]; + let fraction = value - (value.floor() as i64) as f64; + increment[i] + * if sign[i] > 0 { + 1.0 - fraction + } else { + fraction + } + }); + let mut step = 0i32; + while boundary.iter().any(|v| *v <= 1.0) { + sweep.spend()?; + let axis = if boundary[0] < boundary[1] { + if boundary[0] < boundary[2] { 0 } else { 2 } + } else if boundary[1] < boundary[2] { + 1 + } else { + 2 + }; + position[axis] = position[axis].wrapping_add(sign[axis]); + boundary[axis] += increment[axis]; + let pos = BlockPos::new(position[0], position[1], position[2]); + // The static Java clip takes raw endpoints, including wrapped +1 ints. + let block_box = Aabb { + min: Vec3::from_block(pos), + max: Vec3::from_block(pos.offset(1, 1, 1)), + }; + let Some(point) = block_box.clip(origin, finish) else { + continue; + }; + step = step.wrapping_add(1); + let clamped = std::array::from_fn::<_, 3, _>(|i| { + clamp( + point.components()[i], + position[i] as f64 + 1.0e-5_f32 as f64, + (position[i] as f64 + 1.0) - 1.0e-5_f32 as f64, + ) + }); + let opposite = + std::array::from_fn::<_, 3, _>(|i| floor_i32(clamped[i] - size[i] * corner[i] as f64)); + let blocks = BlockPos::between_corners_in_direction( + pos, + BlockPos::new(opposite[0], opposite[1], opposite[2]), + movement, + ) + .map_err(|_| TraversalError::InvalidBounds)?; + if !sweep.visit(blocks, step, true)? { + return Ok(false); + } + } + let final_blocks = BlockPos::between_box_corners_in_direction(final_box, movement) + .map_err(|_| TraversalError::InvalidBounds)?; + sweep.visit(final_blocks, step.wrapping_add(1), true) +} + +fn furthest_corner(movement: Vec3) -> [i32; 3] { + let abs = [ + Vec3::new(1.0, 0.0, 0.0).dot(movement).abs(), + Vec3::new(0.0, 1.0, 0.0).dot(movement).abs(), + Vec3::new(0.0, 0.0, 1.0).dot(movement).abs(), + ]; + let [x, y, z] = movement.components().map(|v| if v >= 0.0 { 1 } else { -1 }); + if abs[0] <= abs[1] && abs[0] <= abs[2] { + [-x, -z, y] + } else if abs[1] <= abs[2] { + [z, -y, -x] + } else { + [-y, x, -z] + } +} + +#[cfg(test)] +mod tests { + use super::*; + #[test] + fn tiny_movement_includes_maximum_faces_and_stops_immediately() { + let box_ = Aabb::unit_cube(Vec3::ZERO); + let mut visits = Vec::new(); + assert_eq!( + sweep_intersected_blocks(Vec3::ZERO, Vec3::ZERO, box_, 20, |p, step| { + visits.push((p, step)); + true + }), + Ok(true) + ); + assert_eq!(visits.len(), 8); + assert!(visits.iter().all(|(_, step)| *step == 0)); + assert_eq!( + sweep_intersected_blocks(Vec3::ZERO, Vec3::ZERO, box_, 20, |_, _| false), + Ok(false) + ); + assert_eq!( + sweep_intersected_blocks(Vec3::ZERO, Vec3::ZERO, box_, 1, |_, _| true), + Err(TraversalError::VisitLimit) + ); + } +} diff --git a/crates/horizon-core/src/geometry/traversal.rs b/crates/horizon-core/src/geometry/traversal.rs new file mode 100644 index 000000000..6dee29f6e --- /dev/null +++ b/crates/horizon-core/src/geometry/traversal.rs @@ -0,0 +1,155 @@ +//! Ordered block visits for a finite ray, as in BlockGetter.traverseBlocks. +use super::{Vec3, floor_i32}; +use crate::position::BlockPos; +use std::fmt; + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum TraversalError { + NonFinite, + VisitLimit, + InvalidBounds, +} +impl fmt::Display for TraversalError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "block traversal failed: {self:?}") + } +} +impl std::error::Error for TraversalError {} + +/// Visit blocks in vanilla ray order until the visitor returns Some, or the +/// segment is exhausted. `None` corresponds to vanilla's miss callback. +/// +/// Non-finite geometry and exceeding the caller's visit budget return typed +/// errors. Previously invoked callbacks are not rolled back on a budget error. +pub fn traverse_blocks( + start: Vec3, + end: Vec3, + max_visits: usize, + mut visitor: impl FnMut(BlockPos) -> Option, +) -> Result, TraversalError> { + if !start.is_finite() || !end.is_finite() { + return Err(TraversalError::NonFinite); + } + if start == end { + return Ok(None); + } + let finish = end.lerp(start, -1e-7); + let origin = start.lerp(end, -1e-7); + let delta = origin.vector_to(finish).components(); + if !origin.is_finite() || !finish.is_finite() || delta.iter().any(|v| !v.is_finite()) { + return Err(TraversalError::NonFinite); + } + let mut position = origin.components().map(floor_i32); + let sign = delta.map(|v| { + if v == 0.0 { + 0i32 + } else if v > 0.0 { + 1 + } else { + -1 + } + }); + let step = std::array::from_fn::<_, 3, _>(|i| { + if sign[i] == 0 { + f64::MAX + } else { + sign[i] as f64 / delta[i] + } + }); + let mut boundary = std::array::from_fn::<_, 3, _>(|i| { + let value = origin.components()[i]; + let fraction = value - (value.floor() as i64) as f64; + step[i] + * if sign[i] > 0 { + 1.0 - fraction + } else { + fraction + } + }); + let mut visited = 0; + loop { + if visited == max_visits { + return Err(TraversalError::VisitLimit); + } + visited += 1; + if let Some(result) = visitor(BlockPos::new(position[0], position[1], position[2])) { + return Ok(Some(result)); + } + if !(boundary[0] <= 1.0 || boundary[1] <= 1.0 || boundary[2] <= 1.0) { + return Ok(None); + } + // Strict comparisons give Z priority on a three-way corner tie. + let axis = if boundary[0] < boundary[1] { + if boundary[0] < boundary[2] { 0 } else { 2 } + } else if boundary[1] < boundary[2] { + 1 + } else { + 2 + }; + position[axis] = position[axis].wrapping_add(sign[axis]); + boundary[axis] += step[axis]; + } +} + +#[cfg(test)] +mod tests { + use super::*; + #[test] + fn corner_order_and_early_exit() { + let mut visited = Vec::new(); + assert_eq!( + traverse_blocks::<()>( + Vec3::new(0.5, 0.5, 0.5), + Vec3::new(1.5, 1.5, 1.5), + 10, + |pos| { + visited.push(pos); + None + } + ), + Ok(None) + ); + assert_eq!( + visited, + vec![ + BlockPos::new(0, 0, 0), + BlockPos::new(0, 0, 1), + BlockPos::new(0, 1, 1), + BlockPos::new(1, 1, 1) + ] + ); + let result = traverse_blocks( + Vec3::new(0.5, 0.5, 0.5), + Vec3::new(1.5, 1.5, 1.5), + 10, + |pos| (pos.z == 1).then_some(pos), + ); + assert_eq!(result, Ok(Some(BlockPos::new(0, 0, 1)))); + } + #[test] + fn miss_zero_identity_and_budget_errors() { + let mut count = 0; + assert_eq!( + traverse_blocks::<()>(Vec3::ZERO, Vec3::ZERO, 0, |_| panic!( + "no visits for equal endpoints" + )), + Ok(None) + ); + assert_eq!( + traverse_blocks::<()>(Vec3::new(-0.0, 0.0, 0.0), Vec3::ZERO, 10, |_| { + count += 1; + None + }), + Ok(None) + ); + assert_eq!(count, 4); + assert_eq!( + traverse_blocks::<()>(Vec3::ZERO, Vec3::new(1.0, 1.0, 1.0), 1, |_| None), + Err(TraversalError::VisitLimit) + ); + assert_eq!( + traverse_blocks::<()>(Vec3::ZERO, Vec3::new(f64::NAN, 1.0, 1.0), 1, |_| None), + Err(TraversalError::NonFinite) + ); + } +} diff --git a/crates/horizon-core/src/geometry/trig.rs b/crates/horizon-core/src/geometry/trig.rs new file mode 100644 index 000000000..988f05177 --- /dev/null +++ b/crates/horizon-core/src/geometry/trig.rs @@ -0,0 +1,38 @@ +//! Vanilla's quantized float sine table with Java double-to-long indexing. +use std::sync::OnceLock; + +pub const DEG_TO_RAD: f32 = f32::from_bits(0x3c8e_fa35); +pub const RAD_TO_DEG: f32 = f32::from_bits(0x4265_2ee0); +const SCALE: f64 = 10430.378350470453; +static SINE: OnceLock> = OnceLock::new(); + +/// Generated from the 26.3 table formula, with no bundled vanilla artifact. +/// Differential validation checks all 65,536 entries on the tested platform. +pub fn sine_table() -> &'static [f32] { + SINE.get_or_init(|| { + (0..65536) + .map(|i| (i as f64 / SCALE).sin() as f32) + .collect::>() + .into_boxed_slice() + }) +} +pub fn sin(angle: f64) -> f32 { + sine_table()[((angle * SCALE) as i64 & 65535) as usize] +} +pub fn cos(angle: f64) -> f32 { + sine_table()[((angle * SCALE + 16384.0) as i64 & 65535) as usize] +} + +#[cfg(test)] +mod tests { + use super::*; + #[test] + fn long_narrowing_and_quadrants() { + assert_eq!(sin(0.0).to_bits(), 0.0f32.to_bits()); + assert_eq!(sin(f64::NAN), sin(0.0)); + assert_eq!(sin(f64::INFINITY), sine_table()[65535]); + assert_eq!(sin(f64::NEG_INFINITY), sine_table()[0]); + assert_eq!(cos(0.0), 1.0); + assert_eq!(sin(std::f64::consts::FRAC_PI_2), 1.0); + } +} diff --git a/crates/horizon-core/src/lib.rs b/crates/horizon-core/src/lib.rs new file mode 100644 index 000000000..19c75bc60 --- /dev/null +++ b/crates/horizon-core/src/lib.rs @@ -0,0 +1,17 @@ +//! Horizon's initial simulation primitives, targeting Minecraft Java Edition 26.3. +//! +//! This is not a playable game. Differential checks cover only the operations +//! listed in docs/rust-parity.md; the rest of vanilla remains unimplemented. +#![forbid(unsafe_code)] + +pub mod biome; +pub mod carving; +pub mod density; +pub mod geometry; +pub mod noise; +pub mod position; +pub mod random; +pub mod storage; +pub mod ticks; + +pub const VANILLA_VERSION: &str = "26.3"; diff --git a/crates/horizon-core/src/noise/mod.rs b/crates/horizon-core/src/noise/mod.rs new file mode 100644 index 000000000..cb255fbe5 --- /dev/null +++ b/crates/horizon-core/src/noise/mod.rs @@ -0,0 +1,289 @@ +//! Base noise samplers for the pinned 26.3 target. +//! +//! Coordinates use double precision; Perlin interpolation and its derivatives +//! use single precision. Keep operation order: algebraic rearrangement changes +//! world generation. Complete density graphs and terrain generation remain absent. +mod normal; +mod perlin; +mod simplex; +mod stack; +mod volume; + +pub use normal::{ + NoiseBuildError, NormalNoise, NormalNoiseBuilder, Normalization, OctaveInfo, create_legacy_fbm, +}; +pub use perlin::{PerlinNoise, SmearedPerlinNoise}; +pub use simplex::SimplexNoise; +pub use stack::{Noise, NoiseLayer, NoiseStack, NoiseStackBuilder}; +pub use volume::{DensityError, DensityVolume}; + +use crate::random::RandomSource; + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct NanRange; +impl std::fmt::Display for NanRange { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("noise interval bounds cannot include NaN") + } +} +impl std::error::Error for NanRange {} + +/// The immutable offsets and permutation table shared by gradient samplers. +#[derive(Clone, Debug)] +pub struct GradientTable { + offsets: [f64; 3], + permutations: [u8; 256], +} + +impl GradientTable { + pub fn new(random: &mut impl RandomSource, offset_scale: f64) -> Self { + // Zero scale still consumes all three draws. + let offsets = std::array::from_fn(|_| random.next_double() * offset_scale); + let mut permutations = std::array::from_fn(|i| i as u8); + for i in 0..256 { + let other = i + random.next_int_bound((256 - i) as i32).unwrap() as usize; + permutations.swap(i, other); + } + Self { + offsets, + permutations, + } + } + + pub fn offsets(&self) -> &[f64; 3] { + &self.offsets + } + pub fn permutations(&self) -> &[u8; 256] { + &self.permutations + } + + fn permute(&self, index: i32) -> i32 { + i32::from(self.permutations[(index & 255) as usize]) + } + + fn gradient(&self, index: i32) -> [i32; 3] { + GRADIENTS[(self.permute(index) & 15) as usize] + } +} + +// Perlin's 16-direction table includes four repeated directions. Simplex uses +// the first twelve directions, selecting them with remainder instead of masking. +const GRADIENTS: [[i32; 3]; 16] = [ + [1, 1, 0], + [-1, 1, 0], + [1, -1, 0], + [-1, -1, 0], + [1, 0, 1], + [-1, 0, 1], + [1, 0, -1], + [-1, 0, -1], + [0, 1, 1], + [0, -1, 1], + [0, 1, -1], + [0, -1, -1], + [1, 1, 0], + [0, -1, 1], + [-1, 1, 0], + [0, -1, -1], +]; + +fn dot(gradient: [i32; 3], point: [f32; 3]) -> f32 { + gradient[0] as f32 * point[0] + gradient[1] as f32 * point[1] + gradient[2] as f32 * point[2] +} + +/// Vanilla's periodic coordinate reduction with the normal Far Lands flag off. +/// The fast-path boundary is the double immediately below 2^24. +pub fn wrap(value: f64) -> f64 { + let half = f64::from_bits(16_777_216.0_f64.to_bits() - 1); + if value >= -half && value < half { + value + } else { + value - (value / 33_554_432.0 + 0.5).floor() * 33_554_432.0 + } +} + +fn smoothstep(value: f32) -> f32 { + value * value * value * (value * (value * 6.0 - 15.0) + 10.0) +} +fn smoothstep_derivative(value: f32) -> f32 { + 30.0 * value * value * (value - 1.0) * (value - 1.0) +} +fn lerp(delta: f32, start: f32, end: f32) -> f32 { + start + delta * (end - start) +} +fn lerp2(a: f32, b: f32, values: [f32; 4]) -> f32 { + lerp( + b, + lerp(a, values[0], values[1]), + lerp(a, values[2], values[3]), + ) +} +fn lerp3(fade: [f32; 3], values: [f32; 8]) -> f32 { + lerp( + fade[2], + lerp2(fade[0], fade[1], values[..4].try_into().unwrap()), + lerp2(fade[0], fade[1], values[4..].try_into().unwrap()), + ) +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::{geometry::Axis, random::LegacyRandom}; + + #[test] + fn vanilla_seed_zero_samples_and_derivatives() { + // Values captured by the original adapter from the pinned server JAR. + let mut random = LegacyRandom::new(0); + let noise = PerlinNoise::new(&mut random); + assert_eq!(random.next_long(), -6_819_959_017_335_327_829); + let mut derivative = [0.0; 3]; + assert_eq!( + noise + .noise_with_derivative(0.0, 0.0, 0.0, &mut derivative) + .to_bits(), + 3_183_733_582 + ); + assert_eq!( + derivative.map(f32::to_bits), + [3_189_117_465, 3_214_556_526, 1_017_326_887] + ); + let mut random = LegacyRandom::new(0); + let simplex = SimplexNoise::with_skipped_offsets(&mut random, true); + assert_eq!(simplex.table().offsets(), &[0.0; 3]); + assert_eq!(simplex.table().permutations(), noise.table().permutations()); + assert_eq!(random.next_long(), -6_819_959_017_335_327_829); + assert_eq!(simplex.get2(0.25, 0.75).to_bits(), 3_146_180_247); + assert_eq!(simplex.get3(0.25, 0.5, 0.75).to_bits(), 1_062_011_824); + assert!(simplex.get3(f64::NAN, 0.0, 0.0).is_nan()); + assert_eq!( + SmearedPerlinNoise::new(&mut random, f64::NAN).range(), + Err(NanRange) + ); + } + + #[test] + fn bulk_accumulation_preserves_tail_and_rejects_short_buffers_before_writes() { + let noise = PerlinNoise::new(&mut LegacyRandom::new(0)); + let volume = DensityVolume::new([1; 3], [0; 3], [1; 3]).unwrap(); + let mut random = LegacyRandom::new(0); + let mut values = + std::array::from_fn::<_, 5, _>(|_| f32::from_bits(random.next_int() as u32)); + let tail = values[1..].iter().map(|v| v.to_bits()).collect::>(); + noise + .add_to_volume(&mut values, volume, 1.0, 1.0, 1.0) + .unwrap(); + assert_eq!(values[0].to_bits(), 3_184_062_705); + assert_eq!( + values[1..].iter().map(|v| v.to_bits()).collect::>(), + tail + ); + let before = values.map(f32::to_bits); + let too_large = DensityVolume::new([2; 3], [0; 3], [1; 3]).unwrap(); + assert_eq!( + noise.add_to_volume(&mut values, too_large, 1.0, 1.0, 1.0), + Err(DensityError::BufferTooShort) + ); + assert_eq!(values.map(f32::to_bits), before); + } + + #[test] + fn density_dimensions_are_bounded_and_coordinates_wrap() { + assert_eq!( + DensityVolume::new([0, 1, 1], [0; 3], [1; 3]), + Err(DensityError::NonpositiveDimensions) + ); + assert_eq!( + DensityVolume::new([1; 3], [0; 3], [1, 0, 1]), + Err(DensityError::NonpositiveSteps) + ); + assert_eq!( + DensityVolume::new([i32::MAX; 3], [0; 3], [1; 3]), + Err(DensityError::VolumeTooLarge) + ); + let volume = DensityVolume::new([2, 3, 4], [i32::MAX, 0, -1], [2, 4, 8]).unwrap(); + assert_eq!(volume.block(Axis::X, 1), Some(i32::MIN + 1)); + assert_eq!(volume.block(Axis::X, 2), None); + assert_eq!(volume.index([1, 2, 3]), Some(23)); + assert_eq!(volume.index([1, 3, 3]), None); + } + + #[test] + fn normal_noise_reference_values_and_legacy_failure_draws() { + let mut builder = NormalNoise::builder(); + builder.set_base_octave(-3); + assert_eq!( + builder.set_amplitude_modifier(-1, 0.0).unwrap_err(), + NoiseBuildError::ModifierIndex + ); + builder.set_octave_count(3).unwrap(); + builder.set_amplitude_modifier(1, 0.0).unwrap(); + assert_eq!( + builder.set_octave_count(4).unwrap_err(), + NoiseBuildError::CountAfterModifiers + ); + let definition = builder.build().unwrap(); + assert_eq!( + definition.normalization_factor().to_bits(), + 4_607_442_513_526_237_848 + ); + assert_eq!( + definition + .octaves() + .iter() + .map(|o| o.octave_index) + .collect::>(), + [-3, -1] + ); + let mut random = LegacyRandom::new(0); + let modern = definition.create(&mut random).unwrap(); + assert_eq!(modern.get3(0.0, 0.0, 0.0).to_bits(), 1_042_650_710); + assert_eq!(random.next_long(), -6_688_467_811_848_818_630); + let mut random = LegacyRandom::new(0); + let legacy = definition + .create_for_legacy_nether_biome(&mut random) + .unwrap(); + assert_eq!(legacy.get3(0.0, 0.0, 0.0).to_bits(), 3_199_632_936); + assert_eq!(random.next_long(), 4_966_550_093_728_345_520); + let mut empty = NormalNoise::builder(); + empty.set_base_octave(2).set_octave_count(0).unwrap(); + let mut random = LegacyRandom::new(0); + assert_eq!( + empty + .build() + .unwrap() + .create_for_legacy_nether_biome(&mut random) + .unwrap_err(), + NoiseBuildError::PositiveLegacyOctaves + ); + assert_eq!(random.next_long(), -6_819_959_017_335_327_829); + let mut random = LegacyRandom::new(0); + assert_eq!( + create_legacy_fbm(&mut random, i32::MIN, &[1.0]).unwrap_err(), + NoiseBuildError::LegacyWorkLimit + ); + assert_eq!(random.next_long(), LegacyRandom::new(0).next_long()); + } + + #[test] + fn stack_snapshots_share_layers_and_preserve_zero_amplitude_semantics() { + use std::sync::Arc; + let sampler: Arc = Arc::new(PerlinNoise::new(&mut LegacyRandom::new(0))); + let mut builder = NoiseStack::builder(); + builder.add(Arc::clone(&sampler), 1.0, 0.0); + let zero = builder.build().unwrap(); + builder.add(Arc::clone(&sampler), 2.0, 1.0); + assert_eq!(zero.layers().len(), 1); + assert!(Arc::ptr_eq(zero.get_layer(0).unwrap(), &sampler)); + assert!(zero.get_layer(1).is_none()); + let mut flattened = NoiseStack::builder(); + flattened.add_stack(&zero, 1.0, f32::INFINITY); + assert_eq!(flattened.build().unwrap_err(), NanRange); + let nested = NoiseStack::builder() + .add(Arc::new(zero), 1.0, f32::INFINITY) + .build() + .unwrap(); + assert_eq!(nested.range().unwrap(), [0.0; 2]); + assert!(nested.get3(1.0, 2.0, 3.0).is_nan()); + } +} diff --git a/crates/horizon-core/src/noise/normal.rs b/crates/horizon-core/src/noise/normal.rs new file mode 100644 index 000000000..1a0b8b853 --- /dev/null +++ b/crates/horizon-core/src/noise/normal.rs @@ -0,0 +1,387 @@ +use super::{NanRange, NoiseStack, PerlinNoise}; +use crate::random::{PositionalRandom, RandomSource}; +use std::sync::Arc; + +/// An allocation bound for the builder API (the vanilla data codec allows 32). +const MAX_BUILDER_OCTAVES: i32 = 4096; + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum NoiseBuildError { + NegativeOctaveCount, + TooManyOctaves, + CountAfterModifiers, + ModifierIndex, + EmptyAmplitudes, + NanRange, + InvertedRange, + MissingNoiseLevels, + PositiveLegacyOctaves, + LegacyWorkLimit, +} +impl std::fmt::Display for NoiseBuildError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(match self { + Self::NegativeOctaveCount => "octave count cannot be negative", + Self::TooManyOctaves => "octave count exceeds the 4096-layer allocation bound", + Self::CountAfterModifiers => { + "cannot change octave count after setting amplitude modifiers" + } + Self::ModifierIndex => "amplitude modifier index is outside the octave range", + Self::EmptyAmplitudes => "at least one amplitude is required", + Self::NanRange => "noise interval bounds cannot include NaN", + Self::InvertedRange => "noise interval lower bound exceeds its upper bound", + Self::MissingNoiseLevels => "legacy initializer could not create all nonzero octaves", + Self::PositiveLegacyOctaves => "positive legacy octaves are disabled", + Self::LegacyWorkLimit => "legacy initializer exceeds the 4096-octave work bound", + }) + } +} +impl std::error::Error for NoiseBuildError {} +impl From for NoiseBuildError { + fn from(_: NanRange) -> Self { + Self::NanRange + } +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum Normalization { + Enabled, + Disabled, + Legacy, +} + +#[derive(Clone, Copy, Debug)] +pub struct OctaveInfo { + pub octave_index: i32, + pub frequency: f64, + pub amplitude: f64, +} +impl OctaveInfo { + pub fn seed(&self) -> String { + format!("octave_{}", self.octave_index) + } +} + +#[derive(Clone, Debug)] +pub struct NormalNoise { + parameters: NormalNoiseBuilder, + octaves: Vec, + normalization_factor: f64, + range: [f32; 2], +} +impl NormalNoise { + pub fn builder() -> NormalNoiseBuilder { + NormalNoiseBuilder::default() + } + pub fn octaves(&self) -> &[OctaveInfo] { + &self.octaves + } + pub fn normalization_factor(&self) -> f64 { + self.normalization_factor + } + pub fn range(&self) -> [f32; 2] { + self.range + } + + pub fn create(&self, random: &mut impl RandomSource) -> Result { + // Even an empty stack consumes both positional forks. + let first = random.fork_positional(); + let second = random.fork_positional(); + let mut builder = NoiseStack::builder(); + for octave in &self.octaves { + let name = octave.seed(); + let a = PerlinNoise::new(&mut first.from_hash_of(&name)); + let b = PerlinNoise::new(&mut second.from_hash_of(&name)); + let amplitude = (self.normalization_factor * octave.amplitude) as f32; + builder.add(Arc::new(a), octave.frequency, amplitude); + builder.add( + Arc::new(b), + octave.frequency * 1.018_126_888_217_522_7, + amplitude, + ); + } + Ok(builder.build()?) + } + + pub fn create_for_legacy_nether_biome( + &self, + random: &mut impl RandomSource, + ) -> Result { + let defaults; + let modifiers = if self.parameters.modifiers.is_empty() { + defaults = vec![1.0; self.parameters.octave_count as usize]; + &defaults + } else { + &self.parameters.modifiers + }; + let first = create_legacy_fbm(random, self.parameters.base_octave, modifiers)?; + let second = create_legacy_fbm(random, self.parameters.base_octave, modifiers)?; + let amplitude = (self.normalization_factor * self.parameters.base_amplitude) as f32; + Ok(NoiseStack::builder() + .add_stack(&first, 1.0, amplitude) + .add_stack(&second, 1.018_126_888_217_522_7, amplitude) + .build()?) + } + + pub fn create_parity(base_octave: i32, amplitudes: &[f64]) -> Result { + if amplitudes.is_empty() { + return Err(NoiseBuildError::EmptyAmplitudes); + } + if amplitudes.len() > MAX_BUILDER_OCTAVES as usize { + return Err(NoiseBuildError::TooManyOctaves); + } + let count = amplitudes.len() as i32; + let octaves = build_octaves(base_octave, 1.0, count, true, amplitudes); + let factor = normalization_factor(sum_abs(&octaves), &octaves); + let base_amplitude = if factor == 0.0 { + 1.0 + } else { + parity_factor(1.0, count, amplitudes) / factor + }; + NormalNoiseBuilder { + base_octave, + base_amplitude, + octave_count: count, + normalization: Normalization::Enabled, + modifiers: amplitudes.to_vec(), + } + .build() + } +} + +#[derive(Clone, Debug)] +pub struct NormalNoiseBuilder { + base_amplitude: f64, + base_octave: i32, + octave_count: i32, + normalization: Normalization, + modifiers: Vec, +} +impl Default for NormalNoiseBuilder { + fn default() -> Self { + Self { + base_amplitude: 1.0, + base_octave: 0, + octave_count: 1, + normalization: Normalization::Enabled, + modifiers: Vec::new(), + } + } +} +impl NormalNoiseBuilder { + pub fn set_base_amplitude(&mut self, amplitude: f64) -> &mut Self { + self.base_amplitude = amplitude; + self + } + pub fn set_base_octave(&mut self, octave: i32) -> &mut Self { + self.base_octave = octave; + self + } + pub fn set_normalization(&mut self, normalization: Normalization) -> &mut Self { + self.normalization = normalization; + self + } + pub fn set_octave_count(&mut self, count: i32) -> Result<&mut Self, NoiseBuildError> { + if !self.modifiers.is_empty() { + return Err(NoiseBuildError::CountAfterModifiers); + } + self.octave_count = count; + Ok(self) + } + pub fn set_amplitude_modifier( + &mut self, + index: i32, + value: f64, + ) -> Result<&mut Self, NoiseBuildError> { + if index < 0 || index >= self.octave_count { + return Err(NoiseBuildError::ModifierIndex); + } + if self.octave_count > MAX_BUILDER_OCTAVES { + return Err(NoiseBuildError::TooManyOctaves); + } + if self.modifiers.is_empty() { + self.modifiers.resize(self.octave_count as usize, 1.0); + } + self.modifiers[index as usize] = value; + Ok(self) + } + pub fn build(&self) -> Result { + if self.octave_count < 0 { + return Err(NoiseBuildError::NegativeOctaveCount); + } + if self.octave_count > MAX_BUILDER_OCTAVES { + return Err(NoiseBuildError::TooManyOctaves); + } + let octaves = build_octaves( + self.base_octave, + self.base_amplitude, + self.octave_count, + self.normalization != Normalization::Disabled, + &self.modifiers, + ); + let mut sum = sum_abs(&octaves); + let mut factor = normalization_factor(sum, &octaves); + if self.normalization == Normalization::Legacy && factor != 0.0 { + let legacy = parity_factor(self.base_amplitude, self.octave_count, &self.modifiers); + sum *= legacy / factor; + factor = legacy; + } + let bound = (sum * (1.0 / 3.0) * 6.0) as f32; + if bound.is_nan() { + return Err(NoiseBuildError::NanRange); + } + if bound < 0.0 { + return Err(NoiseBuildError::InvertedRange); + } + Ok(NormalNoise { + parameters: self.clone(), + octaves, + normalization_factor: factor, + range: [-bound, bound], + }) + } +} + +/// The legacy initializer consumes the caller's stream in reverse octave order. +/// Missing and zero-amplitude octaves consume exactly 262 integer draws. +/// Requests outside the documented allocation/work bounds fail before drawing. +pub fn create_legacy_fbm( + random: &mut impl RandomSource, + base_octave: i32, + amplitudes: &[f64], +) -> Result { + if amplitudes.len() > MAX_BUILDER_OCTAVES as usize { + return Err(NoiseBuildError::TooManyOctaves); + } + let zero_index = base_octave.wrapping_neg(); + if zero_index.wrapping_sub(1) >= MAX_BUILDER_OCTAVES { + return Err(NoiseBuildError::LegacyWorkLimit); + } + let count = amplitudes.len() as i32; + let mut levels = vec![None; amplitudes.len()]; + let zero_noise = PerlinNoise::new(random); + if zero_index >= 0 && zero_index < count && amplitudes[zero_index as usize] != 0.0 { + levels[zero_index as usize] = Some(zero_noise); + } + for index in (0..zero_index).rev() { + if index < count && amplitudes[index as usize] != 0.0 { + levels[index as usize] = Some(PerlinNoise::new(random)); + } else { + random.consume_count(262); + } + } + if levels.iter().filter(|v| v.is_some()).count() + != amplitudes.iter().filter(|v| **v != 0.0).count() + { + return Err(NoiseBuildError::MissingNoiseLevels); + } + if zero_index < count - 1 { + return Err(NoiseBuildError::PositiveLegacyOctaves); + } + let mut frequency = power_of_two(zero_index.wrapping_neg()); + let mut amplitude = power_of_two(count - 1) / (power_of_two(count) - 1.0); + let mut builder = NoiseStack::builder(); + for (index, noise) in levels.into_iter().enumerate() { + if let Some(noise) = noise { + builder.add( + Arc::new(noise), + frequency, + (amplitude * amplitudes[index]) as f32, + ); + } + frequency *= 2.0; + amplitude /= 2.0; + } + Ok(builder.build()?) +} + +fn modifier(modifiers: &[f64], index: usize) -> f64 { + if modifiers.is_empty() { + 1.0 + } else { + modifiers[index] + } +} + +fn build_octaves( + base: i32, + amplitude: f64, + count: i32, + normalize: bool, + modifiers: &[f64], +) -> Vec { + let mut frequency = power_of_two(base); + let mut amplitude = amplitude; + if normalize { + amplitude *= power_of_two(count - 1) / (power_of_two(count) - 1.0); + } + let mut result = Vec::with_capacity(count as usize); + for index in 0..count { + let multiplier = modifier(modifiers, index as usize); + if multiplier != 0.0 { + result.push(OctaveInfo { + octave_index: base.wrapping_add(index), + frequency, + amplitude: amplitude * multiplier, + }); + } + frequency *= 2.0; + amplitude *= 0.5; + } + result +} + +// Math.pow(2, integer), including exact subnormal powers and saturation, without +// a platform libm approximation. Frequencies subsequently double iteratively. +fn power_of_two(exponent: i32) -> f64 { + match exponent { + ..=-1075 => 0.0, + -1074..=-1023 => f64::from_bits(1_u64 << (exponent + 1074)), + -1022..=1023 => f64::from_bits(((exponent + 1023) as u64) << 52), + _ => f64::INFINITY, + } +} + +fn sum_abs(octaves: &[OctaveInfo]) -> f64 { + // Sequential DoubleStream.sum uses compensated summation and an uncorrected + // sum to recover infinity when compensation arithmetic produces NaN. + let (mut sum, mut correction, mut simple) = (0.0, 0.0, 0.0); + for octave in octaves { + let value = octave.amplitude.abs(); + let adjusted = value - correction; + let next = sum + adjusted; + correction = (next - sum) - adjusted; + sum = next; + simple += value; + } + let result = sum - correction; + if result.is_nan() && simple.is_infinite() { + simple + } else { + result + } +} +fn normalization_factor(sum: f64, octaves: &[OctaveInfo]) -> f64 { + let mut variance = 0.0; + for octave in octaves { + let deviation = 0.270_224_783_124_521_1 * octave.amplitude.abs(); + variance += deviation * deviation; + } + let deviation = variance.sqrt(); + if deviation == 0.0 { + 0.0 + } else { + (sum * (1.0 / 3.0)) / (deviation * 2.0_f64.sqrt()) + } +} +fn parity_factor(base_amplitude: f64, count: i32, modifiers: &[f64]) -> f64 { + let (mut first, mut last) = (i32::MAX, i32::MIN); + for index in 0..count { + if modifier(modifiers, index as usize) != 0.0 { + first = first.min(index); + last = last.max(index); + } + } + let distance = last.wrapping_sub(first).wrapping_add(1); + base_amplitude * 0.5 * (1.0 / 3.0) / (0.1 * (1.0 + 1.0 / f64::from(distance))) +} diff --git a/crates/horizon-core/src/noise/perlin.rs b/crates/horizon-core/src/noise/perlin.rs new file mode 100644 index 000000000..101ded427 --- /dev/null +++ b/crates/horizon-core/src/noise/perlin.rs @@ -0,0 +1,273 @@ +use super::{ + DensityError, DensityVolume, GradientTable, dot, lerp2, lerp3, smoothstep, + smoothstep_derivative, wrap, +}; +use crate::{geometry::floor_i32, random::RandomSource}; + +#[derive(Clone, Debug)] +pub struct PerlinNoise { + table: GradientTable, +} + +impl PerlinNoise { + pub fn new(random: &mut impl RandomSource) -> Self { + Self { + table: GradientTable::new(random, 256.0), + } + } + pub fn table(&self) -> &GradientTable { + &self.table + } + pub fn range(&self) -> [f32; 2] { + [-2.0, 2.0] + } + pub fn get2(&self, x: f64, z: f64) -> f32 { + self.get3(wrap(x), 0.0, wrap(z)) + } + pub fn get3(&self, x: f64, y: f64, z: f64) -> f32 { + let (cell, relative) = self.coordinates([x, y, z]); + let point = relative.map(|v| v as f32); + self.sample(cell, point, point[1]) + } + + fn coordinates(&self, point: [f64; 3]) -> ([i32; 3], [f64; 3]) { + let shifted: [f64; 3] = std::array::from_fn(|i| wrap(point[i]) + self.table.offsets[i]); + let cell = shifted.map(floor_i32); + ( + cell, + std::array::from_fn(|i| shifted[i] - f64::from(cell[i])), + ) + } + + fn gradients(&self, cell: [i32; 3]) -> [[i32; 3]; 8] { + let p = self.table.permute(cell[0]); + let q = self.table.permute(cell[0].wrapping_add(1)); + let lower = self.table.permute(p.wrapping_add(cell[1])); + let upper = self.table.permute(p.wrapping_add(cell[1]).wrapping_add(1)); + let lower_x = self.table.permute(q.wrapping_add(cell[1])); + let upper_x = self.table.permute(q.wrapping_add(cell[1]).wrapping_add(1)); + let rows = [ + lower, lower_x, upper, upper_x, lower, lower_x, upper, upper_x, + ]; + std::array::from_fn(|i| { + self.table + .gradient(rows[i].wrapping_add(cell[2]).wrapping_add((i / 4) as i32)) + }) + } + + fn corner_values(gradients: [[i32; 3]; 8], point: [f32; 3]) -> [f32; 8] { + std::array::from_fn(|i| { + dot( + gradients[i], + [ + point[0] - (i & 1) as f32, + point[1] - ((i >> 1) & 1) as f32, + point[2] - ((i >> 2) & 1) as f32, + ], + ) + }) + } + + fn sample(&self, cell: [i32; 3], point: [f32; 3], interpolation_y: f32) -> f32 { + let values = Self::corner_values(self.gradients(cell), point); + lerp3( + [ + smoothstep(point[0]), + smoothstep(interpolation_y), + smoothstep(point[2]), + ], + values, + ) + } + + /// Returns the sampled value and adds its gradient into the supplied array. + pub fn noise_with_derivative(&self, x: f64, y: f64, z: f64, derivative: &mut [f32; 3]) -> f32 { + let (cell, relative) = self.coordinates([x, y, z]); + let point = relative.map(|v| v as f32); + let gradients = self.gradients(cell); + let values = Self::corner_values(gradients, point); + let fade = point.map(smoothstep); + let gradient = + std::array::from_fn::<_, 3, _>(|axis| lerp3(fade, gradients.map(|g| g[axis] as f32))); + let changes = [ + lerp2( + fade[1], + fade[2], + [ + values[1] - values[0], + values[3] - values[2], + values[5] - values[4], + values[7] - values[6], + ], + ), + lerp2( + fade[2], + fade[0], + [ + values[2] - values[0], + values[6] - values[4], + values[3] - values[1], + values[7] - values[5], + ], + ), + lerp2( + fade[0], + fade[1], + [ + values[4] - values[0], + values[5] - values[1], + values[6] - values[2], + values[7] - values[3], + ], + ), + ]; + for axis in 0..3 { + derivative[axis] += gradient[axis] + smoothstep_derivative(point[axis]) * changes[axis]; + } + lerp3(fade, values) + } + + /// Adds a scaled volume using vanilla's cached X/Z dot products and Y loop. + /// Extra buffer elements are untouched; short buffers are rejected up front. + pub fn add_to_volume( + &self, + buffer: &mut [f32], + volume: DensityVolume, + xz_scale: f64, + y_scale: f64, + amplitude: f32, + ) -> Result<(), DensityError> { + self.add_volume(buffer, volume, xz_scale, y_scale, amplitude, None) + } + + fn add_volume( + &self, + buffer: &mut [f32], + volume: DensityVolume, + xz_scale: f64, + y_scale: f64, + amplitude: f32, + fudge_y_scale: Option, + ) -> Result<(), DensityError> { + if buffer.len() < volume.size() { + return Err(DensityError::BufferTooShort); + } + let [size_x, size_y, size_z] = volume.sizes(); + let mut index = 0; + for z in 0..size_z { + let shifted_z = + wrap(f64::from(volume.coordinate(2, z)) * xz_scale) + self.table.offsets[2]; + let cell_z = floor_i32(shifted_z); + let dz = (shifted_z - f64::from(cell_z)) as f32; + let fade_z = smoothstep(dz); + for x in 0..size_x { + let shifted_x = + wrap(f64::from(volume.coordinate(0, x)) * xz_scale) + self.table.offsets[0]; + let cell_x = floor_i32(shifted_x); + let dx = (shifted_x - f64::from(cell_x)) as f32; + let fade_x = smoothstep(dx); + let mut previous_y = i32::MIN; + let mut xz_dots = [0.0_f32; 8]; + let mut y_gradients = [0.0_f32; 8]; + for y in 0..size_y { + let input_y = f64::from(volume.coordinate(1, y)) * y_scale; + let shifted_y = wrap(input_y) + self.table.offsets[1]; + let cell_y = floor_i32(shifted_y); + let dy = shifted_y - f64::from(cell_y); + let fade_y = smoothstep(dy as f32); + if previous_y != cell_y { + let gradients = self.gradients([cell_x, cell_y, cell_z]); + for i in 0..8 { + xz_dots[i] = gradients[i][0] as f32 * (dx - (i & 1) as f32) + + gradients[i][2] as f32 * (dz - ((i >> 2) & 1) as f32); + y_gradients[i] = gradients[i][1] as f32; + } + previous_y = cell_y; + } + let dy = match fudge_y_scale { + Some(scale) => (dy - compute_fudge_y(input_y, dy, scale)) as f32, + None => dy as f32, + }; + let values = std::array::from_fn(|i| { + xz_dots[i] + y_gradients[i] * (dy - ((i >> 1) & 1) as f32) + }); + buffer[index] += amplitude * lerp3([fade_x, fade_y, fade_z], values); + index += 1; + } + } + } + Ok(()) + } +} + +#[derive(Clone, Debug)] +pub struct SmearedPerlinNoise { + base: PerlinNoise, + fudge_y_scale: f64, +} + +impl SmearedPerlinNoise { + pub fn new(random: &mut impl RandomSource, fudge_y_scale: f64) -> Self { + Self { + base: PerlinNoise::new(random), + fudge_y_scale, + } + } + pub fn table(&self) -> &GradientTable { + self.base.table() + } + pub fn range(&self) -> Result<[f32; 2], super::NanRange> { + let bound = (self.fudge_y_scale.abs() + 2.0) as f32; + if bound.is_nan() { + Err(super::NanRange) + } else { + Ok([-bound, bound]) + } + } + pub fn get2(&self, x: f64, z: f64) -> f32 { + self.get3(wrap(x), 0.0, wrap(z)) + } + pub fn get3(&self, x: f64, y: f64, z: f64) -> f32 { + let (cell, relative) = self.base.coordinates([x, y, z]); + let fudge = compute_fudge_y(y, relative[1], self.fudge_y_scale); + self.base.sample( + cell, + [ + relative[0] as f32, + (relative[1] - fudge) as f32, + relative[2] as f32, + ], + relative[1] as f32, + ) + } + // This inherited method samples the unsmeared field, just as vanilla does. + pub fn noise_with_derivative(&self, x: f64, y: f64, z: f64, derivative: &mut [f32; 3]) -> f32 { + self.base.noise_with_derivative(x, y, z, derivative) + } + pub fn add_to_volume( + &self, + buffer: &mut [f32], + volume: DensityVolume, + xz_scale: f64, + y_scale: f64, + amplitude: f32, + ) -> Result<(), DensityError> { + self.base.add_volume( + buffer, + volume, + xz_scale, + y_scale, + amplitude, + Some(self.fudge_y_scale), + ) + } +} + +fn compute_fudge_y(input_y: f64, relative_y: f64, scale: f64) -> f64 { + let limited_y = if input_y >= 0.0 && input_y < relative_y { + input_y + } else { + relative_y + }; + f64::from(floor_i32(limited_y / scale + f64::from(1e-7_f32))) * scale +} diff --git a/crates/horizon-core/src/noise/simplex.rs b/crates/horizon-core/src/noise/simplex.rs new file mode 100644 index 000000000..8dcb56f85 --- /dev/null +++ b/crates/horizon-core/src/noise/simplex.rs @@ -0,0 +1,121 @@ +use super::{GRADIENTS, GradientTable}; +use crate::{geometry::floor_i32, random::RandomSource}; + +#[derive(Clone, Debug)] +pub struct SimplexNoise { + table: GradientTable, +} + +impl SimplexNoise { + pub fn new(random: &mut impl RandomSource) -> Self { + Self::with_skipped_offsets(random, false) + } + pub fn with_skipped_offsets(random: &mut impl RandomSource, skip_offsets: bool) -> Self { + Self { + table: GradientTable::new(random, if skip_offsets { 0.0 } else { 256.0 }), + } + } + pub fn table(&self) -> &GradientTable { + &self.table + } + pub fn range(&self) -> [f32; 2] { + [-2.0, 2.0] + } + + fn corner(gradient: usize, point: [f64; 3], radius: f64) -> f64 { + let attenuation = radius - point[0] * point[0] - point[1] * point[1] - point[2] * point[2]; + // Negative attenuation contributes zero; NaN follows the arithmetic path. + if attenuation < 0.0 { + 0.0 + } else { + let squared = attenuation * attenuation; + let g = GRADIENTS[gradient]; + squared + * squared + * (f64::from(g[0]) * point[0] + + f64::from(g[1]) * point[1] + + f64::from(g[2]) * point[2]) + } + } + + pub fn get2(&self, x: f64, y: f64) -> f32 { + let x = x + self.table.offsets[0]; + let y = y + self.table.offsets[1]; + let root3 = 3.0_f64.sqrt(); + let skew = 0.5 * (root3 - 1.0); + let unskew = (3.0 - root3) / 6.0; + let shift = (x + y) * skew; + let i = floor_i32(x + shift); + let j = floor_i32(y + shift); + let shift = f64::from(i.wrapping_add(j)) * unskew; + let dx = x - (f64::from(i) - shift); + let dy = y - (f64::from(j) - shift); + let (a, b) = if dx > dy { (1, 0) } else { (0, 1) }; + let i = i & 255; + let j = j & 255; + let grad = |a, b| (self.table.permute(i + a + self.table.permute(j + b)) % 12) as usize; + let first = Self::corner(grad(0, 0), [dx, dy, 0.0], 0.5); + let second = Self::corner( + grad(a, b), + [dx - f64::from(a) + unskew, dy - f64::from(b) + unskew, 0.0], + 0.5, + ); + let third = Self::corner( + grad(1, 1), + [dx - 1.0 + 2.0 * unskew, dy - 1.0 + 2.0 * unskew, 0.0], + 0.5, + ); + (70.0 * (first + second + third)) as f32 + } + + pub fn get3(&self, x: f64, y: f64, z: f64) -> f32 { + let shifted = [ + x + self.table.offsets[0], + y + self.table.offsets[1], + z + self.table.offsets[2], + ]; + let skew = (shifted[0] + shifted[1] + shifted[2]) * (1.0 / 3.0); + let cell = shifted.map(|v| floor_i32(v + skew)); + let unskew = f64::from(cell[0].wrapping_add(cell[1]).wrapping_add(cell[2])) * (1.0 / 6.0); + let point: [f64; 3] = std::array::from_fn(|i| shifted[i] - (f64::from(cell[i]) - unskew)); + let [x, y, z] = point; + let (a, b) = if x >= y { + if y >= z { + ([1, 0, 0], [1, 1, 0]) + } else if x >= z { + ([1, 0, 0], [1, 0, 1]) + } else { + ([0, 0, 1], [1, 0, 1]) + } + } else if y < z { + ([0, 0, 1], [0, 1, 1]) + } else if x < z { + ([0, 1, 0], [0, 1, 1]) + } else { + ([0, 1, 0], [1, 1, 0]) + }; + let cell = cell.map(|v| v & 255); + let grad = |delta: [i32; 3]| { + (self.table.permute( + cell[0] + + delta[0] + + self + .table + .permute(cell[1] + delta[1] + self.table.permute(cell[2] + delta[2])), + ) % 12) as usize + }; + let first = Self::corner(grad([0; 3]), point, 0.6); + let second = Self::corner( + grad(a), + std::array::from_fn(|i| point[i] - f64::from(a[i]) + (1.0 / 6.0)), + 0.6, + ); + let third = Self::corner( + grad(b), + std::array::from_fn(|i| point[i] - f64::from(b[i]) + (1.0 / 3.0)), + 0.6, + ); + let fourth = Self::corner(grad([1; 3]), point.map(|v| v - 1.0 + 0.5), 0.6); + (32.0 * (first + second + third + fourth)) as f32 + } +} diff --git a/crates/horizon-core/src/noise/stack.rs b/crates/horizon-core/src/noise/stack.rs new file mode 100644 index 000000000..9cfe093d5 --- /dev/null +++ b/crates/horizon-core/src/noise/stack.rs @@ -0,0 +1,233 @@ +use super::{DensityError, DensityVolume, NanRange, PerlinNoise, SimplexNoise, SmearedPerlinNoise}; +use std::sync::Arc; + +/// Immutable noise sampling. Implementations may override the default scalar +/// volume traversal when vanilla has a distinct bulk arithmetic path. +pub trait Noise: std::fmt::Debug + Send + Sync { + fn range(&self) -> Result<[f32; 2], NanRange>; + fn get2(&self, x: f64, z: f64) -> f32; + fn get3(&self, x: f64, y: f64, z: f64) -> f32; + fn add_to_volume( + &self, + buffer: &mut [f32], + volume: DensityVolume, + xz_scale: f64, + y_scale: f64, + amplitude: f32, + ) -> Result<(), DensityError> { + if buffer.len() < volume.size() { + return Err(DensityError::BufferTooShort); + } + let [sx, sy, sz] = volume.sizes(); + let mut index = 0; + for z in 0..sz { + let z = f64::from(volume.coordinate(2, z)) * xz_scale; + for x in 0..sx { + let x = f64::from(volume.coordinate(0, x)) * xz_scale; + for y in 0..sy { + let y = f64::from(volume.coordinate(1, y)) * y_scale; + buffer[index] += amplitude * self.get3(x, y, z); + index += 1; + } + } + } + Ok(()) + } +} + +impl Noise for PerlinNoise { + fn range(&self) -> Result<[f32; 2], NanRange> { + Ok(PerlinNoise::range(self)) + } + fn get2(&self, x: f64, z: f64) -> f32 { + PerlinNoise::get2(self, x, z) + } + fn get3(&self, x: f64, y: f64, z: f64) -> f32 { + PerlinNoise::get3(self, x, y, z) + } + fn add_to_volume( + &self, + buffer: &mut [f32], + volume: DensityVolume, + xz_scale: f64, + y_scale: f64, + amplitude: f32, + ) -> Result<(), DensityError> { + PerlinNoise::add_to_volume(self, buffer, volume, xz_scale, y_scale, amplitude) + } +} +impl Noise for SmearedPerlinNoise { + fn range(&self) -> Result<[f32; 2], NanRange> { + SmearedPerlinNoise::range(self) + } + fn get2(&self, x: f64, z: f64) -> f32 { + SmearedPerlinNoise::get2(self, x, z) + } + fn get3(&self, x: f64, y: f64, z: f64) -> f32 { + SmearedPerlinNoise::get3(self, x, y, z) + } + fn add_to_volume( + &self, + buffer: &mut [f32], + volume: DensityVolume, + xz_scale: f64, + y_scale: f64, + amplitude: f32, + ) -> Result<(), DensityError> { + SmearedPerlinNoise::add_to_volume(self, buffer, volume, xz_scale, y_scale, amplitude) + } +} +impl Noise for SimplexNoise { + fn range(&self) -> Result<[f32; 2], NanRange> { + Ok(SimplexNoise::range(self)) + } + fn get2(&self, x: f64, z: f64) -> f32 { + SimplexNoise::get2(self, x, z) + } + fn get3(&self, x: f64, y: f64, z: f64) -> f32 { + SimplexNoise::get3(self, x, y, z) + } +} + +#[derive(Clone, Debug)] +pub struct NoiseLayer { + pub noise: Arc, + pub frequency: f64, + pub amplitude: f32, +} + +#[derive(Clone, Debug)] +pub struct NoiseStack { + layers: Vec, + range: [f32; 2], +} + +impl NoiseStack { + pub fn builder() -> NoiseStackBuilder { + NoiseStackBuilder::default() + } + pub fn layers(&self) -> &[NoiseLayer] { + &self.layers + } + pub fn get_layer(&self, index: usize) -> Option<&Arc> { + self.layers.get(index).map(|layer| &layer.noise) + } +} +impl Noise for NoiseStack { + fn range(&self) -> Result<[f32; 2], NanRange> { + Ok(self.range) + } + fn get2(&self, x: f64, z: f64) -> f32 { + let mut value = 0.0; + for layer in &self.layers { + value += layer.amplitude * layer.noise.get2(x * layer.frequency, z * layer.frequency); + } + value + } + fn get3(&self, x: f64, y: f64, z: f64) -> f32 { + let mut value = 0.0; + for layer in &self.layers { + value += layer.amplitude + * layer.noise.get3( + x * layer.frequency, + y * layer.frequency, + z * layer.frequency, + ); + } + value + } + fn add_to_volume( + &self, + buffer: &mut [f32], + volume: DensityVolume, + xz_scale: f64, + y_scale: f64, + amplitude: f32, + ) -> Result<(), DensityError> { + if buffer.len() < volume.size() { + return Err(DensityError::BufferTooShort); + } + for layer in &self.layers { + layer.noise.add_to_volume( + buffer, + volume, + xz_scale * layer.frequency, + y_scale * layer.frequency, + amplitude * layer.amplitude, + )?; + } + Ok(()) + } +} + +#[derive(Clone, Debug, Default)] +pub struct NoiseStackBuilder { + layers: Vec, +} +impl NoiseStackBuilder { + pub fn add(&mut self, noise: Arc, frequency: f64, amplitude: f32) -> &mut Self { + self.layers.push(NoiseLayer { + noise, + frequency, + amplitude, + }); + self + } + /// Flattening rescales each existing layer before subsequent sampling. + pub fn add_stack(&mut self, stack: &NoiseStack, frequency: f64, amplitude: f32) -> &mut Self { + self.layers + .extend(stack.layers.iter().map(|layer| NoiseLayer { + noise: Arc::clone(&layer.noise), + frequency: layer.frequency * frequency, + amplitude: layer.amplitude * amplitude, + })); + self + } + pub fn build(&self) -> Result { + let mut range = [0.0; 2]; + for layer in &self.layers { + let bounds = layer.noise.range()?; + if layer.amplitude.is_nan() { + return Err(NanRange); + } + let scaled = if bounds[0].is_nan() || bounds[1].is_nan() { + [f32::NAN; 2] + } else { + // Interval.mulBound defines zero times infinity as positive zero. + let product = |v: f32| { + if v == 0.0 || layer.amplitude == 0.0 { + 0.0 + } else { + v * layer.amplitude + } + }; + let a = product(bounds[0]); + let b = product(bounds[1]); + if a < b { + [a, b] + } else if a > b { + [b, a] + } else if a == 0.0 { + [ + f32::from_bits(a.to_bits() | b.to_bits()), + f32::from_bits(a.to_bits() & b.to_bits()), + ] + } else { + [a, b] + } + }; + range = [range[0] + scaled[0], range[1] + scaled[1]]; + if range[0].is_nan() || range[1].is_nan() { + range = [f32::NAN; 2]; + } + // Interval.of interns [0,1], including a supplied negative zero. + if range[0] == 0.0 && range[1] == 1.0 { + range[0] = 0.0; + } + } + Ok(NoiseStack { + layers: self.layers.clone(), + range, + }) + } +} diff --git a/crates/horizon-core/src/noise/volume.rs b/crates/horizon-core/src/noise/volume.rs new file mode 100644 index 000000000..d0362ee1b --- /dev/null +++ b/crates/horizon-core/src/noise/volume.rs @@ -0,0 +1,94 @@ +use crate::geometry::Axis; + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum DensityError { + NonpositiveDimensions, + NonpositiveSteps, + VolumeTooLarge, + BufferTooShort, +} +impl std::fmt::Display for DensityError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(match self { + Self::NonpositiveDimensions => "density dimensions must be positive", + Self::NonpositiveSteps => "density coordinate steps must be positive", + Self::VolumeTooLarge => "density volume exceeds the Java array index domain", + Self::BufferTooShort => "density buffer is smaller than its volume", + }) + } +} +impl std::error::Error for DensityError {} + +/// A bounded strided density volume. The flat layout is Z, X, Y (Y innermost). +/// Block coordinate multiplication and addition retain Java's i32 wrapping. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct DensityVolume { + sizes: [usize; 3], + minimum: [i32; 3], + steps: [i32; 3], + size: usize, +} +impl DensityVolume { + pub fn new(sizes: [i32; 3], minimum: [i32; 3], steps: [i32; 3]) -> Result { + if sizes.iter().any(|v| *v <= 0) { + return Err(DensityError::NonpositiveDimensions); + } + if steps.iter().any(|v| *v <= 0) { + return Err(DensityError::NonpositiveSteps); + } + let sizes = sizes.map(|v| v as usize); + let size = sizes + .into_iter() + .try_fold(1_usize, |n, v| n.checked_mul(v)) + .filter(|n| *n <= i32::MAX as usize) + .ok_or(DensityError::VolumeTooLarge)?; + Ok(Self { + sizes, + minimum, + steps, + size, + }) + } + pub fn sizes(self) -> [usize; 3] { + self.sizes + } + pub fn minimum(self) -> [i32; 3] { + self.minimum + } + pub fn steps(self) -> [i32; 3] { + self.steps + } + pub fn size(self) -> usize { + self.size + } + pub fn maximum(self) -> [i32; 3] { + std::array::from_fn(|axis| self.coordinate(axis, self.sizes[axis]).wrapping_sub(1)) + } + pub fn index(self, position: [usize; 3]) -> Option { + if (0..3).any(|i| position[i] >= self.sizes[i]) { + return None; + } + Some(position[1] + (position[0] + position[2] * self.sizes[0]) * self.sizes[1]) + } + pub fn block(self, axis: Axis, index: usize) -> Option { + let axis = axis as usize; + (index < self.sizes[axis]).then(|| self.coordinate(axis, index)) + } + /// Find an exact lattice sample, retaining Java's wrapped subtraction and + /// extent multiplication. Coordinates between samples are cache misses. + pub fn index_of_block(self, position: [i32; 3]) -> Option { + let relative: [i32; 3] = std::array::from_fn(|i| position[i].wrapping_sub(self.minimum[i])); + for (axis, value) in relative.iter().enumerate() { + let extent = (self.sizes[axis] as i32).wrapping_mul(self.steps[axis]); + if *value < 0 || *value >= extent || *value % self.steps[axis] != 0 { + return None; + } + } + self.index(std::array::from_fn(|i| { + (relative[i] / self.steps[i]) as usize + })) + } + pub(super) fn coordinate(self, axis: usize, index: usize) -> i32 { + self.minimum[axis].wrapping_add((index as i32).wrapping_mul(self.steps[axis])) + } +} diff --git a/crates/horizon-core/src/position.rs b/crates/horizon-core/src/position.rs new file mode 100644 index 000000000..2c657ca41 --- /dev/null +++ b/crates/horizon-core/src/position.rs @@ -0,0 +1,184 @@ +//! Integer coordinates and vanilla's packed position formats. +mod iter; +pub use iter::{BlockBoxIter, BlockIterationTooLarge}; + +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)] +pub struct BlockPos { + pub x: i32, + pub y: i32, + pub z: i32, +} + +impl BlockPos { + pub const fn new(x: i32, y: i32, z: i32) -> Self { + Self { x, y, z } + } + + /// Values outside the signed 26/12/26-bit ranges are truncated as in vanilla. + pub const fn pack(self) -> i64 { + (((self.x as u64 & 0x3ff_ffff) << 38) + | ((self.z as u64 & 0x3ff_ffff) << 12) + | (self.y as u64 & 0xfff)) as i64 + } + + pub const fn unpack(value: i64) -> Self { + Self::new( + (value >> 38) as i32, + (value << 52 >> 52) as i32, + (value << 26 >> 38) as i32, + ) + } + + pub const fn offset(self, dx: i32, dy: i32, dz: i32) -> Self { + Self::new( + self.x.wrapping_add(dx), + self.y.wrapping_add(dy), + self.z.wrapping_add(dz), + ) + } + + pub const fn section(self) -> SectionPos { + // Arithmetic shift floors negative coordinates; integer / 16 does not. + SectionPos::new(self.x >> 4, self.y >> 4, self.z >> 4) + } + + pub const fn chunk(self) -> ChunkPos { + ChunkPos::new(self.x >> 4, self.z >> 4) + } + + /// Section update packet coordinate: X in bits 8..11, Z in 4..7, Y in 0..3. + pub const fn section_relative(self) -> u16 { + (((self.x & 15) << 8) | ((self.z & 15) << 4) | (self.y & 15)) as u16 + } + + /// Block-state container index. This is a different layout from packets. + pub const fn section_index(self) -> usize { + (((self.y & 15) << 8) | ((self.z & 15) << 4) | (self.x & 15)) as usize + } +} + +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)] +pub struct SectionPos { + pub x: i32, + pub y: i32, + pub z: i32, +} + +impl SectionPos { + pub const fn new(x: i32, y: i32, z: i32) -> Self { + Self { x, y, z } + } + + pub const fn pack(self) -> i64 { + (((self.x as u64 & 0x3f_ffff) << 42) + | ((self.z as u64 & 0x3f_ffff) << 20) + | (self.y as u64 & 0xf_ffff)) as i64 + } + + pub const fn unpack(value: i64) -> Self { + Self::new( + (value >> 42) as i32, + (value << 44 >> 44) as i32, + (value << 22 >> 42) as i32, + ) + } + + pub const fn relative_to_block(self, relative: u16) -> BlockPos { + BlockPos::new( + self.x + .wrapping_shl(4) + .wrapping_add(((relative >> 8) & 15) as i32), + self.y.wrapping_shl(4).wrapping_add((relative & 15) as i32), + self.z + .wrapping_shl(4) + .wrapping_add(((relative >> 4) & 15) as i32), + ) + } +} + +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)] +pub struct ChunkPos { + pub x: i32, + pub z: i32, +} + +impl ChunkPos { + pub const fn new(x: i32, z: i32) -> Self { + Self { x, z } + } + + pub const fn pack(self) -> i64 { + ((self.x as u32 as u64) | ((self.z as u32 as u64) << 32)) as i64 + } + + pub const fn unpack(value: i64) -> Self { + Self::new(value as i32, (value >> 32) as i32) + } + + pub const fn region(self) -> Self { + Self::new(self.x >> 5, self.z >> 5) + } + + pub const fn region_local(self) -> (u8, u8) { + ((self.x & 31) as u8, (self.z & 31) as u8) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn negative_boundaries_use_floor_division() { + for (block, section, local) in [ + (-17, -2, 15), + (-16, -1, 0), + (-1, -1, 15), + (0, 0, 0), + (16, 1, 0), + ] { + let p = BlockPos::new(block, block, block); + assert_eq!(p.section(), SectionPos::new(section, section, section)); + assert_eq!(p.section_relative(), local * 0x111); + assert_eq!(p.section().relative_to_block(p.section_relative()), p); + } + assert_eq!(ChunkPos::new(-1, -33).region(), ChunkPos::new(-1, -2)); + assert_eq!(ChunkPos::new(-1, -33).region_local(), (31, 31)); + } + + #[test] + fn coordinate_formats_are_distinct_and_bijective_in_range() { + let mut packet_indices = [false; 4096]; + let mut storage_indices = [false; 4096]; + for y in 0..16 { + for z in 0..16 { + for x in 0..16 { + let p = BlockPos::new(x, y, z); + packet_indices[p.section_relative() as usize] = true; + storage_indices[p.section_index()] = true; + assert_eq!( + SectionPos::default().relative_to_block(p.section_relative()), + p + ); + } + } + } + assert!(packet_indices.into_iter().all(|x| x)); + assert!(storage_indices.into_iter().all(|x| x)); + assert_ne!( + BlockPos::new(1, 2, 3).section_relative() as usize, + BlockPos::new(1, 2, 3).section_index() + ); + } + + #[test] + fn packed_signed_limits_and_java_overflow() { + let block = BlockPos::new(-33_554_432, -2048, 33_554_431); + assert_eq!(BlockPos::unpack(block.pack()), block); + let section = SectionPos::new(-2_097_152, -524_288, 2_097_151); + assert_eq!(SectionPos::unpack(section.pack()), section); + let chunk = ChunkPos::new(i32::MIN, i32::MAX); + assert_eq!(ChunkPos::unpack(chunk.pack()), chunk); + assert_eq!(BlockPos::new(i32::MAX, 0, 0).offset(1, 0, 0).x, i32::MIN); + } +} diff --git a/crates/horizon-core/src/position/iter.rs b/crates/horizon-core/src/position/iter.rs new file mode 100644 index 000000000..980df68c6 --- /dev/null +++ b/crates/horizon-core/src/position/iter.rs @@ -0,0 +1,159 @@ +//! Inclusive block boxes in vanilla's fixed and movement-dependent visit orders. +use super::BlockPos; +use crate::geometry::{Aabb, Axis, Vec3, floor_i32}; + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct BlockIterationTooLarge; +impl std::fmt::Display for BlockIterationTooLarge { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("block box exceeds the positive Java-int iteration domain") + } +} +impl std::error::Error for BlockIterationTooLarge {} + +/// Value iterator; each position is independent of later cursor updates. +/// +/// Bounds are inclusive, including an AABB's floored maximum face. Boxes whose +/// true volume exceeds i32::MAX are rejected instead of reproducing Java's +/// overflowed counts. A caller can lazily limit a supported box with `take`. +#[derive(Clone, Debug)] +pub struct BlockBoxIter { + start: [i32; 3], + steps: [i32; 3], + sizes: [usize; 3], + // Innermost axis first. + axes: [Axis; 3], + index: usize, + count: usize, +} +impl BlockBoxIter { + fn new( + a: BlockPos, + b: BlockPos, + direction: Option, + ) -> Result { + let a = [a.x, a.y, a.z]; + let b = [b.x, b.y, b.z]; + let min = std::array::from_fn::<_, 3, _>(|i| a[i].min(b[i])); + let max = std::array::from_fn::<_, 3, _>(|i| a[i].max(b[i])); + let sizes = std::array::from_fn::<_, 3, _>(|i| (max[i] as i64 - min[i] as i64 + 1) as u64); + let count = sizes + .into_iter() + .try_fold(1u64, |total, size| { + total.checked_mul(size).filter(|v| *v <= i32::MAX as u64) + }) + .ok_or(BlockIterationTooLarge)?; + let mut start = min; + let mut steps = [1; 3]; + let axes = if let Some(direction) = direction { + for axis in Axis::ALL { + let i = axis as usize; + // NaN takes the negative direction in Java's dcmpl branch. + let forward = direction.component(axis) >= 0.0; + if !forward { + start[i] = max[i]; + steps[i] = -1; + } + } + let [first, second, third] = Axis::step_order(direction); + [third, second, first] + } else { + [Axis::X, Axis::Y, Axis::Z] + }; + Ok(Self { + start, + steps, + sizes: sizes.map(|v| v as usize), + axes, + index: 0, + count: count as usize, + }) + } +} +impl Iterator for BlockBoxIter { + type Item = BlockPos; + fn next(&mut self) -> Option { + if self.index == self.count { + return None; + } + let mut index = self.index; + let mut point = self.start; + for axis in self.axes { + let i = axis as usize; + let offset = index % self.sizes[i]; + index /= self.sizes[i]; + point[i] = point[i].wrapping_add(self.steps[i].wrapping_mul(offset as i32)); + } + self.index += 1; + Some(BlockPos::new(point[0], point[1], point[2])) + } + fn size_hint(&self) -> (usize, Option) { + let remaining = self.count - self.index; + (remaining, Some(remaining)) + } +} +impl ExactSizeIterator for BlockBoxIter {} +impl std::iter::FusedIterator for BlockBoxIter {} + +impl BlockPos { + pub fn containing(point: Vec3) -> Self { + Self::new(floor_i32(point.x), floor_i32(point.y), floor_i32(point.z)) + } + pub fn between_closed(a: Self, b: Self) -> Result { + BlockBoxIter::new(a, b, None) + } + pub fn between_closed_box(b: Aabb) -> Result { + Self::between_closed( + Self::containing(b.min_position()), + Self::containing(b.max_position()), + ) + } + pub fn between_corners_in_direction( + a: Self, + b: Self, + direction: Vec3, + ) -> Result { + BlockBoxIter::new(a, b, Some(direction)) + } + pub fn between_box_corners_in_direction( + b: Aabb, + direction: Vec3, + ) -> Result { + Self::between_corners_in_direction( + Self::containing(b.min_position()), + Self::containing(b.max_position()), + direction, + ) + } +} + +#[cfg(test)] +mod tests { + use super::*; + #[test] + fn ordering_inclusive_faces_and_value_independence() { + let a = BlockPos::new(-1, 0, 0); + let b = BlockPos::new(0, 1, 0); + assert_eq!( + BlockPos::between_closed(b, a).unwrap().collect::>(), + vec![a, BlockPos::new(0, 0, 0), BlockPos::new(-1, 1, 0), b] + ); + assert_eq!( + BlockPos::between_corners_in_direction(a, b, Vec3::new(-1.0, 0.0, 0.0)) + .unwrap() + .collect::>(), + vec![BlockPos::new(0, 0, 0), a, b, BlockPos::new(-1, 1, 0)] + ); + assert_eq!( + BlockPos::between_closed_box(Aabb::unit_cube(Vec3::ZERO)) + .unwrap() + .len(), + 8 + ); + assert_eq!( + BlockPos::between_closed(BlockPos::new(i32::MIN, 0, 0), BlockPos::new(i32::MAX, 0, 0)) + .unwrap_err(), + BlockIterationTooLarge + ); + } +} diff --git a/crates/horizon-core/src/random.rs b/crates/horizon-core/src/random.rs new file mode 100644 index 000000000..309d48124 --- /dev/null +++ b/crates/horizon-core/src/random.rs @@ -0,0 +1,263 @@ +//! Vanilla's two seeded random streams. No platform/default Rust RNG is used. +mod hash; +mod positional; +mod worldgen; +pub use hash::{seed_from_hash, seed_from_hash_utf16}; +pub use positional::{ + LegacyPositionalRandom, PositionalRandom, XoroshiroPositionalRandom, java_string_hash, + position_seed, +}; +pub use worldgen::{WorldgenPositional, WorldgenRandom, WorldgenSource, slime_chunk_random}; + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct InvalidBound; + +impl std::fmt::Display for InvalidBound { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("bound must be positive") + } +} + +impl std::error::Error for InvalidBound {} + +pub trait RandomSource: Sized { + type Positional: PositionalRandom; + fn set_seed(&mut self, seed: i64); + fn next_int(&mut self) -> i32; + fn next_int_bound(&mut self, bound: i32) -> Result; + fn next_long(&mut self) -> i64; + fn next_boolean(&mut self) -> bool; + fn next_float(&mut self) -> f32; + fn next_double(&mut self) -> f64; + fn fork_positional(&mut self) -> Self::Positional; + fn fork(&mut self) -> Self + where + Self: Sized; + + fn consume_count(&mut self, count: i32) { + for _ in 0..count { + self.next_int(); + } + } + fn next_int_between_inclusive(&mut self, min: i32, max: i32) -> Result { + self.next_int_bound(max.wrapping_sub(min).wrapping_add(1)) + .map(|v| v.wrapping_add(min)) + } + fn next_int_between(&mut self, origin: i32, bound: i32) -> Result { + if origin >= bound { + return Err(InvalidBound); + } + self.next_int_bound(bound.wrapping_sub(origin)) + .map(|v| v.wrapping_add(origin)) + } + fn triangle(&mut self, mean: f64, deviation: f64) -> f64 { + mean + deviation * (self.next_double() - self.next_double()) + } + fn triangle_float(&mut self, mean: f32, deviation: f32) -> f32 { + mean + deviation * (self.next_float() - self.next_float()) + } +} + +#[derive(Clone, Debug)] +pub struct LegacyRandom { + state: u64, +} + +impl LegacyRandom { + const MULTIPLIER: u64 = 0x5_deec_e66d; + const MASK: u64 = (1 << 48) - 1; + + pub fn new(seed: i64) -> Self { + Self { + state: (seed as u64 ^ Self::MULTIPLIER) & Self::MASK, + } + } + + fn bits(&mut self, count: u32) -> i32 { + self.state = self.state.wrapping_mul(Self::MULTIPLIER).wrapping_add(11) & Self::MASK; + (self.state >> (48 - count)) as i32 + } +} + +impl RandomSource for LegacyRandom { + type Positional = LegacyPositionalRandom; + fn fork_positional(&mut self) -> Self::Positional { + LegacyPositionalRandom::new(self.next_long()) + } + fn set_seed(&mut self, seed: i64) { + *self = Self::new(seed); + } + + fn next_int(&mut self) -> i32 { + self.bits(32) + } + + fn next_int_bound(&mut self, bound: i32) -> Result { + if bound <= 0 { + return Err(InvalidBound); + } + if bound & (bound - 1) == 0 { + return Ok(((i64::from(bound) * i64::from(self.bits(31))) >> 31) as i32); + } + loop { + let bits = self.bits(31); + let value = bits % bound; + // Java's signed overflow is part of the rejection rule. + if bits.wrapping_sub(value).wrapping_add(bound - 1) >= 0 { + return Ok(value); + } + } + } + + fn next_long(&mut self) -> i64 { + let high = i64::from(self.bits(32)) << 32; + // Java sign-extends the low int before addition; concatenation differs. + high.wrapping_add(i64::from(self.bits(32))) + } + + fn next_boolean(&mut self) -> bool { + self.bits(1) != 0 + } + fn next_float(&mut self) -> f32 { + self.bits(24) as f32 * (1.0 / 16_777_216.0) + } + fn next_double(&mut self) -> f64 { + let value = (i64::from(self.bits(26)) << 27) + i64::from(self.bits(27)); + value as f64 * (1.0 / 9_007_199_254_740_992.0) + } + + fn fork(&mut self) -> Self { + Self::new(self.next_long()) + } +} + +#[derive(Clone, Debug)] +pub struct XoroshiroRandom { + lo: u64, + hi: u64, +} + +impl XoroshiroRandom { + const GOLDEN_RATIO: u64 = 0x9e37_79b9_7f4a_7c15; + const SILVER_RATIO: u64 = 0x6a09_e667_f3bc_c909; + + pub fn new(seed: i64) -> Self { + let lo = seed as u64 ^ Self::SILVER_RATIO; + Self::from_state( + mix_stafford13(lo), + mix_stafford13(lo.wrapping_add(Self::GOLDEN_RATIO)), + ) + } + + pub fn from_state(lo: u64, hi: u64) -> Self { + if lo | hi == 0 { + Self { + lo: Self::GOLDEN_RATIO, + hi: Self::SILVER_RATIO, + } + } else { + Self { lo, hi } + } + } +} + +impl RandomSource for XoroshiroRandom { + type Positional = XoroshiroPositionalRandom; + fn fork_positional(&mut self) -> Self::Positional { + let lo = self.next_long() as u64; + let hi = self.next_long() as u64; + XoroshiroPositionalRandom::new(lo, hi) + } + fn set_seed(&mut self, seed: i64) { + *self = Self::new(seed); + } + fn next_int(&mut self) -> i32 { + self.next_long() as i32 + } + + fn next_int_bound(&mut self, bound: i32) -> Result { + if bound <= 0 { + return Err(InvalidBound); + } + let bound = bound as u32; + let threshold = bound.wrapping_neg() % bound; + loop { + let product = u64::from(self.next_int() as u32) * u64::from(bound); + if product as u32 >= threshold { + return Ok((product >> 32) as i32); + } + } + } + + fn next_long(&mut self) -> i64 { + let lo = self.lo; + let hi = self.hi ^ lo; + let result = lo.wrapping_add(self.hi).rotate_left(17).wrapping_add(lo); + self.lo = lo.rotate_left(49) ^ hi ^ (hi << 21); + self.hi = hi.rotate_left(28); + result as i64 + } + + fn next_boolean(&mut self) -> bool { + self.next_long() & 1 != 0 + } + fn next_float(&mut self) -> f32 { + ((self.next_long() as u64) >> 40) as f32 * (1.0 / 16_777_216.0) + } + fn next_double(&mut self) -> f64 { + ((self.next_long() as u64) >> 11) as f64 * (1.0 / 9_007_199_254_740_992.0) + } + fn fork(&mut self) -> Self { + let lo = self.next_long() as u64; + let hi = self.next_long() as u64; + Self::from_state(lo, hi) + } +} + +pub const fn mix_stafford13(mut value: u64) -> u64 { + value = (value ^ (value >> 30)).wrapping_mul(0xbf58_476d_1ce4_e5b9); + value = (value ^ (value >> 27)).wrapping_mul(0x94d0_49bb_1331_11eb); + value ^ (value >> 31) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn legacy_jdk_sequence_and_sign_extended_low_word() { + let mut rng = LegacyRandom::new(0); + assert_eq!(rng.next_int(), -1_155_484_576); + assert_eq!(rng.next_int(), -723_955_400); + assert_eq!(LegacyRandom::new(0).next_long(), -4_962_768_465_676_381_896); + } + + fn invalid_bounds_do_not_consume_state(mut rng: R) { + let mut reference = rng.clone(); + for bound in [0, -1, i32::MIN] { + assert_eq!(rng.next_int_bound(bound), Err(InvalidBound)); + } + rng.consume_count(-1); + assert_eq!(rng.next_long(), reference.next_long()); + } + + #[test] + fn invalid_inputs_preserve_both_streams() { + invalid_bounds_do_not_consume_state(LegacyRandom::new(0)); + invalid_bounds_do_not_consume_state(XoroshiroRandom::new(0)); + } + + #[test] + fn zero_state_fallback_and_reseed() { + let mut a = XoroshiroRandom::from_state(0, 0); + let mut b = XoroshiroRandom::from_state( + XoroshiroRandom::GOLDEN_RATIO, + XoroshiroRandom::SILVER_RATIO, + ); + for _ in 0..100 { + assert_eq!(a.next_long(), b.next_long()); + } + a.set_seed(-1); + assert_eq!(a.next_long(), XoroshiroRandom::new(-1).next_long()); + } +} diff --git a/crates/horizon-core/src/random/hash.rs b/crates/horizon-core/src/random/hash.rs new file mode 100644 index 000000000..15cd50174 --- /dev/null +++ b/crates/horizon-core/src/random/hash.rs @@ -0,0 +1,157 @@ +//! Original MD5 implementation for vanilla's deterministic name-derived seeds. +//! Integer algorithm and vectors: https://www.rfc-editor.org/rfc/rfc1321 +//! This is an internal seed transform, not an authentication API. +const K: [u32; 64] = [ + 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee, 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501, + 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be, 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821, + 0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa, 0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8, + 0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed, 0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a, + 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c, 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70, + 0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05, 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665, + 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039, 0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1, + 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1, 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391, +]; +const SHIFT: [[u32; 4]; 4] = [ + [7, 12, 17, 22], + [5, 9, 14, 20], + [4, 11, 16, 23], + [6, 10, 15, 21], +]; +struct Md5 { + state: [u32; 4], + buffer: [u8; 64], + used: usize, + bytes: u64, +} +impl Md5 { + fn new() -> Self { + Self { + state: [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476], + buffer: [0; 64], + used: 0, + bytes: 0, + } + } + fn block(&mut self, block: &[u8; 64]) { + let words = std::array::from_fn::<_, 16, _>(|i| { + u32::from_le_bytes(block[i * 4..i * 4 + 4].try_into().unwrap()) + }); + let [mut a, mut b, mut c, mut d] = self.state; + for (i, constant) in K.iter().enumerate() { + let (mix, index) = match i / 16 { + 0 => ((b & c) | (!b & d), i), + 1 => ((d & b) | (!d & c), (5 * i + 1) % 16), + 2 => (b ^ c ^ d, (3 * i + 5) % 16), + _ => (c ^ (b | !d), (7 * i) % 16), + }; + let next = b.wrapping_add( + a.wrapping_add(mix) + .wrapping_add(*constant) + .wrapping_add(words[index]) + .rotate_left(SHIFT[i / 16][i % 4]), + ); + a = d; + d = c; + c = b; + b = next; + } + for (old, value) in self.state.iter_mut().zip([a, b, c, d]) { + *old = old.wrapping_add(value); + } + } + fn update(&mut self, mut input: &[u8]) { + self.bytes = self.bytes.wrapping_add(input.len() as u64); + if self.used != 0 { + let count = (64 - self.used).min(input.len()); + self.buffer[self.used..self.used + count].copy_from_slice(&input[..count]); + self.used += count; + input = &input[count..]; + if self.used != 64 { + return; + } + let block = self.buffer; + self.block(&block); + self.used = 0; + } + while input.len() >= 64 { + self.block(input[..64].try_into().unwrap()); + input = &input[64..]; + } + self.buffer[..input.len()].copy_from_slice(input); + self.used = input.len(); + } + fn finish(mut self) -> [u8; 16] { + let length = self.bytes.wrapping_mul(8).to_le_bytes(); + let count = if self.used < 56 { + 56 - self.used + } else { + 120 - self.used + }; + let mut padding = [0; 64]; + padding[0] = 0x80; + self.update(&padding[..count]); + self.update(&length); + std::array::from_fn(|i| self.state[i / 4].to_le_bytes()[i % 4]) + } +} +fn seed(digest: [u8; 16]) -> [u64; 2] { + [ + u64::from_be_bytes(digest[..8].try_into().unwrap()), + u64::from_be_bytes(digest[8..].try_into().unwrap()), + ] +} +pub fn seed_from_hash(name: &str) -> [u64; 2] { + let mut digest = Md5::new(); + digest.update(name.as_bytes()); + seed(digest.finish()) +} +pub fn seed_from_hash_utf16(name: &[u16]) -> [u64; 2] { + let mut digest = Md5::new(); + for point in char::decode_utf16(name.iter().copied()) { + let mut bytes = [0; 4]; + // Java UTF-8 encoding replaces each malformed surrogate with '?'. + digest.update(point.unwrap_or('?').encode_utf8(&mut bytes).as_bytes()); + } + seed(digest.finish()) +} + +#[cfg(test)] +mod tests { + use super::*; + #[test] + fn rfc_vectors_and_streaming_padding_boundaries() { + for (input, expected) in [ + ("", "d41d8cd98f00b204e9800998ecf8427e"), + ("a", "0cc175b9c0f1b6a831c399e269772661"), + ("abc", "900150983cd24fb0d6963f7d28e17f72"), + ("message digest", "f96b697d7cb7938d525a2f31aaf161d0"), + ( + "abcdefghijklmnopqrstuvwxyz", + "c3fcd3d76192e4007dfb496cca67e13b", + ), + ( + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", + "d174ab98d277d9f5a5611c2c9f419d9f", + ), + ( + "12345678901234567890123456789012345678901234567890123456789012345678901234567890", + "57edf4a22be3c955ac49da2e2107b67a", + ), + ] { + let mut digest = Md5::new(); + for chunk in input.as_bytes().chunks(3) { + digest.update(chunk); + } + let actual: String = digest.finish().iter().map(|v| format!("{v:02x}")).collect(); + assert_eq!(actual, expected); + } + assert_eq!( + seed_from_hash_utf16(&[0xd800, 0x61, 0xdc00]), + seed_from_hash("?a?") + ); + assert_eq!( + seed_from_hash_utf16(&[0xd83d, 0xde00]), + seed_from_hash("😀") + ); + } +} diff --git a/crates/horizon-core/src/random/positional.rs b/crates/horizon-core/src/random/positional.rs new file mode 100644 index 000000000..e7d629185 --- /dev/null +++ b/crates/horizon-core/src/random/positional.rs @@ -0,0 +1,79 @@ +use super::{LegacyRandom, RandomSource, XoroshiroRandom, seed_from_hash, seed_from_hash_utf16}; +use crate::position::BlockPos; + +#[allow(clippy::wrong_self_convention)] // These are seeded factories, matching Java's fromSeed/fromHashOf. +pub trait PositionalRandom { + type Source: RandomSource; + fn at(&self, position: BlockPos) -> Self::Source; + fn from_seed(&self, seed: i64) -> Self::Source; + fn from_hash_of(&self, name: &str) -> Self::Source; + fn from_hash_of_utf16(&self, name: &[u16]) -> Self::Source; +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct LegacyPositionalRandom { + seed: i64, +} +impl LegacyPositionalRandom { + pub const fn new(seed: i64) -> Self { + Self { seed } + } +} +impl PositionalRandom for LegacyPositionalRandom { + type Source = LegacyRandom; + fn at(&self, position: BlockPos) -> Self::Source { + LegacyRandom::new(position_seed(position) ^ self.seed) + } + fn from_seed(&self, seed: i64) -> Self::Source { + LegacyRandom::new(seed) + } + fn from_hash_of(&self, name: &str) -> Self::Source { + LegacyRandom::new(java_string_hash(name.encode_utf16()) as i64 ^ self.seed) + } + fn from_hash_of_utf16(&self, name: &[u16]) -> Self::Source { + LegacyRandom::new(java_string_hash(name.iter().copied()) as i64 ^ self.seed) + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct XoroshiroPositionalRandom { + lo: u64, + hi: u64, +} +impl XoroshiroPositionalRandom { + pub const fn new(lo: u64, hi: u64) -> Self { + Self { lo, hi } + } +} +impl PositionalRandom for XoroshiroPositionalRandom { + type Source = XoroshiroRandom; + fn at(&self, position: BlockPos) -> Self::Source { + XoroshiroRandom::from_state(position_seed(position) as u64 ^ self.lo, self.hi) + } + fn from_seed(&self, seed: i64) -> Self::Source { + XoroshiroRandom::from_state(seed as u64 ^ self.lo, seed as u64 ^ self.hi) + } + fn from_hash_of(&self, name: &str) -> Self::Source { + let [lo, hi] = seed_from_hash(name); + XoroshiroRandom::from_state(lo ^ self.lo, hi ^ self.hi) + } + fn from_hash_of_utf16(&self, name: &[u16]) -> Self::Source { + let [lo, hi] = seed_from_hash_utf16(name); + XoroshiroRandom::from_state(lo ^ self.lo, hi ^ self.hi) + } +} +pub fn java_string_hash(name: impl IntoIterator) -> i32 { + name.into_iter().fold(0i32, |hash, unit| { + hash.wrapping_mul(31).wrapping_add(unit as i32) + }) +} +/// Mth.getSeed's signed Java arithmetic, including the initial int product. +pub const fn position_seed(position: BlockPos) -> i64 { + let mixed = position.x.wrapping_mul(3_129_871) as i64 + ^ (position.z as i64).wrapping_mul(116_129_781) + ^ position.y as i64; + mixed + .wrapping_mul(mixed) + .wrapping_mul(42_317_861) + .wrapping_add(mixed.wrapping_mul(11)) + >> 16 +} diff --git a/crates/horizon-core/src/random/worldgen.rs b/crates/horizon-core/src/random/worldgen.rs new file mode 100644 index 000000000..70c88b0e2 --- /dev/null +++ b/crates/horizon-core/src/random/worldgen.rs @@ -0,0 +1,190 @@ +//! Legacy bit-sampling adapter used by vanilla's world-generation random stream. +use super::{InvalidBound, LegacyRandom, PositionalRandom, RandomSource, XoroshiroRandom}; +use crate::position::BlockPos; + +mod sealed { + pub trait Sealed {} +} +pub trait WorldgenSource: RandomSource + sealed::Sealed { + #[doc(hidden)] + fn worldgen_bits(&mut self, count: i32) -> i32; +} +impl sealed::Sealed for LegacyRandom {} +impl WorldgenSource for LegacyRandom { + fn worldgen_bits(&mut self, count: i32) -> i32 { + self.state = self.state.wrapping_mul(Self::MULTIPLIER).wrapping_add(11) & Self::MASK; + self.state.wrapping_shr(48_i32.wrapping_sub(count) as u32) as i32 + } +} +impl sealed::Sealed for XoroshiroRandom {} +impl WorldgenSource for XoroshiroRandom { + fn worldgen_bits(&mut self, count: i32) -> i32 { + (self.next_long() as u64).wrapping_shr(64_i32.wrapping_sub(count) as u32) as i32 + } +} + +#[derive(Clone, Debug)] +pub struct WorldgenRandom { + source: R, + count: i32, + wrapped: bool, +} +impl WorldgenRandom { + pub fn new(source: R) -> Self { + Self { + source, + count: 0, + wrapped: true, + } + } + fn plain(source: R) -> Self { + Self { + source, + count: 0, + wrapped: false, + } + } + pub fn count(&self) -> i32 { + self.count + } + pub fn next_bits(&mut self, bits: i32) -> i32 { + if self.wrapped { + self.count = self.count.wrapping_add(1); + } + self.source.worldgen_bits(bits) + } + pub fn set_decoration_seed(&mut self, seed: i64, x: i32, z: i32) -> i64 { + self.set_seed(seed); + let a = self.next_long() | 1; + let b = self.next_long() | 1; + let mixed = (x as i64) + .wrapping_mul(a) + .wrapping_add((z as i64).wrapping_mul(b)) + ^ seed; + self.set_seed(mixed); + mixed + } + pub fn set_feature_seed(&mut self, seed: i64, index: i32, step: i32) { + self.set_seed( + seed.wrapping_add(index as i64) + .wrapping_add(step.wrapping_mul(10000) as i64), + ); + } + pub fn set_large_feature_seed(&mut self, seed: i64, x: i32, z: i32) { + self.set_seed(seed); + let a = self.next_long(); + let b = self.next_long(); + self.set_seed((x as i64).wrapping_mul(a) ^ (z as i64).wrapping_mul(b) ^ seed); + } + pub fn set_large_feature_with_salt(&mut self, seed: i64, x: i32, z: i32, salt: i32) { + self.set_seed( + (x as i64) + .wrapping_mul(341873128712) + .wrapping_add((z as i64).wrapping_mul(132897987541)) + .wrapping_add(seed) + .wrapping_add(salt as i64), + ); + } +} +impl sealed::Sealed for WorldgenRandom {} +impl WorldgenSource for WorldgenRandom { + fn worldgen_bits(&mut self, count: i32) -> i32 { + self.next_bits(count) + } +} +impl RandomSource for WorldgenRandom { + type Positional = WorldgenPositional; + fn set_seed(&mut self, seed: i64) { + self.source.set_seed(seed); + } + fn next_int(&mut self) -> i32 { + if self.wrapped { + self.next_bits(32) + } else { + self.source.next_int() + } + } + fn next_int_bound(&mut self, bound: i32) -> Result { + if !self.wrapped { + return self.source.next_int_bound(bound); + } + if bound <= 0 { + return Err(InvalidBound); + } + if bound & (bound - 1) == 0 { + return Ok(((bound as i64 * self.next_bits(31) as i64) >> 31) as i32); + } + loop { + let bits = self.next_bits(31); + let value = bits % bound; + if bits.wrapping_sub(value).wrapping_add(bound - 1) >= 0 { + return Ok(value); + } + } + } + fn next_long(&mut self) -> i64 { + if !self.wrapped { + return self.source.next_long(); + } + let high = (self.next_bits(32) as i64) << 32; + high.wrapping_add(self.next_bits(32) as i64) + } + fn next_boolean(&mut self) -> bool { + if self.wrapped { + self.next_bits(1) != 0 + } else { + self.source.next_boolean() + } + } + fn next_float(&mut self) -> f32 { + if self.wrapped { + self.next_bits(24) as f32 * (1.0 / 16777216.0) + } else { + self.source.next_float() + } + } + fn next_double(&mut self) -> f64 { + if !self.wrapped { + return self.source.next_double(); + } + let bits = ((self.next_bits(26) as i64) << 27) + self.next_bits(27) as i64; + bits as f64 * (1.0 / 9007199254740992.0) + } + /// Native forks return the underlying source, not another bit adapter. + /// The returned value keeps that behavior through a transparent variant. + fn fork(&mut self) -> Self { + Self::plain(self.source.fork()) + } + fn fork_positional(&mut self) -> Self::Positional { + WorldgenPositional(self.source.fork_positional()) + } +} +#[derive(Clone, Debug)] +pub struct WorldgenPositional(P); +impl PositionalRandom for WorldgenPositional

+where + P::Source: WorldgenSource, +{ + type Source = WorldgenRandom; + fn at(&self, position: BlockPos) -> Self::Source { + WorldgenRandom::plain(self.0.at(position)) + } + fn from_seed(&self, seed: i64) -> Self::Source { + WorldgenRandom::plain(self.0.from_seed(seed)) + } + fn from_hash_of(&self, name: &str) -> Self::Source { + WorldgenRandom::plain(self.0.from_hash_of(name)) + } + fn from_hash_of_utf16(&self, name: &[u16]) -> Self::Source { + WorldgenRandom::plain(self.0.from_hash_of_utf16(name)) + } +} +pub fn slime_chunk_random(x: i32, z: i32, seed: i64, salt: i64) -> LegacyRandom { + let mixed = seed + .wrapping_add(x.wrapping_mul(x).wrapping_mul(4987142) as i64) + .wrapping_add(x.wrapping_mul(5947611) as i64) + .wrapping_add((z.wrapping_mul(z) as i64).wrapping_mul(4392871)) + .wrapping_add(z.wrapping_mul(389711) as i64) + ^ salt; + LegacyRandom::new(mixed) +} diff --git a/crates/horizon-core/src/storage.rs b/crates/horizon-core/src/storage.rs new file mode 100644 index 000000000..61f8c505f --- /dev/null +++ b/crates/horizon-core/src/storage.rs @@ -0,0 +1,172 @@ +//! Palette indices packed into padded 64-bit words, not a continuous bitstream. + +#[derive(Clone, Debug, PartialEq, Eq)] +pub enum StorageError { + InvalidBits(u8), + InvalidLength { expected: usize, actual: usize }, + OutOfBounds { index: usize, len: usize }, + ValueTooLarge(u32), +} + +impl std::fmt::Display for StorageError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{self:?}") + } +} + +impl std::error::Error for StorageError {} + +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct PackedStorage { + bits: u8, + len: usize, + per_word: usize, + mask: u64, + words: Vec, +} + +impl PackedStorage { + pub fn new(bits: u8, len: usize) -> Result { + let per_word = Self::per_word(bits)?; + Self::from_words(bits, len, vec![0; len.div_ceil(per_word)]) + } + + /// Retains padding and unused tail bits from input, as the Java long[] does. + pub fn from_words(bits: u8, len: usize, words: Vec) -> Result { + let per_word = Self::per_word(bits)?; + let expected = len.div_ceil(per_word); + if words.len() != expected { + return Err(StorageError::InvalidLength { + expected, + actual: words.len(), + }); + } + Ok(Self { + bits, + len, + per_word, + mask: (1_u64 << bits) - 1, + words, + }) + } + + fn per_word(bits: u8) -> Result { + if !(1..=32).contains(&bits) { + return Err(StorageError::InvalidBits(bits)); + } + Ok(64 / usize::from(bits)) + } + + pub fn bits(&self) -> u8 { + self.bits + } + pub fn len(&self) -> usize { + self.len + } + pub fn is_empty(&self) -> bool { + self.len == 0 + } + pub fn words(&self) -> &[u64] { + &self.words + } + + fn location(&self, index: usize) -> Result<(usize, usize), StorageError> { + if index >= self.len { + return Err(StorageError::OutOfBounds { + index, + len: self.len, + }); + } + Ok(( + index / self.per_word, + (index % self.per_word) * usize::from(self.bits), + )) + } + + pub fn get(&self, index: usize) -> Result { + let (word, shift) = self.location(index)?; + Ok(((self.words[word] >> shift) & self.mask) as u32) + } + + /// Validation fails before mutation. Writes accept nonnegative Java ints; + /// imported 32-bit words may still decode to any u32 bit pattern. + pub fn set(&mut self, index: usize, value: u32) -> Result { + let (word, shift) = self.location(index)?; + if u64::from(value) > self.mask || value > i32::MAX as u32 { + return Err(StorageError::ValueTooLarge(value)); + } + let old = ((self.words[word] >> shift) & self.mask) as u32; + self.words[word] = (self.words[word] & !(self.mask << shift)) | (u64::from(value) << shift); + Ok(old) + } + + /// Vanilla's doubling fill also writes padding and unused tail slots. + pub fn fill(&mut self, value: u32) -> Result<(), StorageError> { + if u64::from(value) > self.mask || value > i32::MAX as u32 { + return Err(StorageError::ValueTooLarge(value)); + } + let mut word = u64::from(value); + let mut shift = u32::from(self.bits); + while shift < 64 { + word |= word << shift; + shift *= 2; + } + self.words.fill(word); + Ok(()) + } + + pub fn unpack(&self) -> Vec { + let mut values = Vec::with_capacity(self.len); + for &word in &self.words { + for slot in 0..self.per_word.min(self.len - values.len()) { + values.push(((word >> (slot * usize::from(self.bits))) & self.mask) as u32); + } + } + values + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn padded_words_never_split_entries() { + let mut storage = PackedStorage::new(5, 13).unwrap(); + assert_eq!(storage.words().len(), 2); + storage.set(11, 31).unwrap(); + storage.set(12, 7).unwrap(); + assert_eq!(storage.words(), &[31 << 55, 7]); + } + + #[test] + fn all_widths_survive_overwrites_and_unpack() { + for bits in 1..=32 { + let mut storage = PackedStorage::new(bits, 4096).unwrap(); + let mut expected = vec![0; 4096]; + for pass in 0..3 { + for (i, item) in expected.iter_mut().enumerate() { + let value = ((i as u64 * 7 + pass) & storage.mask) as u32; + assert_eq!(storage.set(i, value).unwrap(), *item); + *item = value; + } + assert_eq!(storage.unpack(), expected); + } + } + } + + #[test] + fn imported_padding_is_preserved_and_invalid_writes_are_atomic() { + let mut storage = PackedStorage::from_words(5, 1, vec![u64::MAX]).unwrap(); + assert_eq!(storage.set(0, 0).unwrap(), 31); + assert_eq!(storage.words(), &[u64::MAX << 5]); + let unchanged = storage.clone(); + assert!(storage.set(1, 0).is_err()); + assert!(storage.set(0, 32).is_err()); + assert_eq!(storage, unchanged); + assert!(PackedStorage::new(0, 1).is_err()); + assert!(PackedStorage::new(33, 1).is_err()); + assert!(PackedStorage::from_words(5, 13, vec![0]).is_err()); + assert!(PackedStorage::new(1, 0).unwrap().unpack().is_empty()); + } +} diff --git a/crates/horizon-core/src/ticks/heap.rs b/crates/horizon-core/src/ticks/heap.rs new file mode 100644 index 000000000..262105392 --- /dev/null +++ b/crates/horizon-core/src/ticks/heap.rs @@ -0,0 +1,101 @@ +//! Array heap with the pinned JDK PriorityQueue's equal-key and iterator-removal +//! behavior. Equal comparator keys are observable in saved and loaded ticks. +use std::{cmp::Ordering, collections::VecDeque}; + +#[derive(Clone, Debug)] +pub(super) struct Heap { + pub(super) values: Vec, +} +impl Default for Heap { + fn default() -> Self { + Self { values: Vec::new() } + } +} +impl Heap { + pub(super) fn peek(&self) -> Option { + self.values.first().copied() + } + pub(super) fn push(&mut self, value: T, compare: impl Fn(T, T) -> Ordering) { + self.values.push(value); + self.up(self.values.len() - 1, value, &compare); + } + fn up(&mut self, mut index: usize, value: T, compare: &impl Fn(T, T) -> Ordering) -> usize { + while index > 0 { + let parent = (index - 1) / 2; + if compare(value, self.values[parent]) != Ordering::Less { + break; + } + self.values[index] = self.values[parent]; + index = parent; + } + self.values[index] = value; + index + } + fn down(&mut self, mut index: usize, value: T, compare: &impl Fn(T, T) -> Ordering) -> usize { + let half = self.values.len() / 2; + while index < half { + let mut child = index * 2 + 1; + let right = child + 1; + if right < self.values.len() + && compare(self.values[child], self.values[right]) == Ordering::Greater + { + child = right; + } + if compare(value, self.values[child]) != Ordering::Greater { + break; + } + self.values[index] = self.values[child]; + index = child; + } + self.values[index] = value; + index + } + pub(super) fn pop(&mut self, compare: impl Fn(T, T) -> Ordering) -> Option { + let first = self.peek()?; + let last = self.values.pop().unwrap(); + if !self.values.is_empty() { + self.down(0, last, &compare); + } + Some(first) + } + fn remove_at(&mut self, index: usize, compare: &impl Fn(T, T) -> Ordering) -> Option { + let last = self.values.pop().unwrap(); + if index == self.values.len() { + return None; + } + if self.down(index, last, compare) == index && self.up(index, last, compare) != index { + Some(last) + } else { + None + } + } + pub(super) fn remove_if( + &mut self, + mut predicate: impl FnMut(T) -> bool, + compare: impl Fn(T, T) -> Ordering, + ) { + let mut cursor = 0; + let mut moved = VecDeque::new(); + while cursor < self.values.len() { + let value = self.values[cursor]; + cursor += 1; + if predicate(value) { + if let Some(value) = self.remove_at(cursor - 1, &compare) { + moved.push_back(value); + } else { + cursor -= 1; + } + } + } + while let Some(value) = moved.pop_front() { + if predicate(value) { + let index = self + .values + .iter() + .position(|&candidate| candidate == value) + .unwrap(); + self.remove_at(index, &compare); + } + } + } +} diff --git a/crates/horizon-core/src/ticks/index.rs b/crates/horizon-core/src/ticks/index.rs new file mode 100644 index 000000000..6f88cf701 --- /dev/null +++ b/crates/horizon-core/src/ticks/index.rs @@ -0,0 +1,159 @@ +//! Deadline index whose traversal matches the pinned fastutil long map. Heap +//! insertion order decides exact ties between chunk heads after save loading. +#[derive(Clone, Debug)] +pub(super) struct DeadlineIndex { + keys: Vec, + values: Vec, + zero: bool, + size: usize, +} +fn mix(key: i64) -> usize { + let mut value = (key as u64).wrapping_mul(0x9e3779b97f4a7c15); + value ^= value >> 32; + (value ^ (value >> 16)) as usize +} +impl Default for DeadlineIndex { + fn default() -> Self { + Self { + keys: vec![0; 33], + values: vec![0; 33], + zero: false, + size: 0, + } + } +} +impl DeadlineIndex { + fn capacity(&self) -> usize { + self.keys.len() - 1 + } + fn find(&self, key: i64) -> usize { + if key == 0 { + return self.capacity(); + } + let mask = self.capacity() - 1; + let mut slot = mix(key) & mask; + while self.keys[slot] != 0 && self.keys[slot] != key { + slot = (slot + 1) & mask; + } + slot + } + pub(super) fn put(&mut self, key: i64, value: i64) { + let slot = self.find(key); + let exists = if key == 0 { + self.zero + } else { + self.keys[slot] != 0 + }; + self.values[slot] = value; + if exists { + return; + } + self.keys[slot] = key; + if key == 0 { + self.zero = true; + } + let old_size = self.size; + self.size += 1; + if old_size >= self.capacity() * 3 / 4 { + self.rehash(self.capacity() * 2); + } + } + fn rehash(&mut self, capacity: usize) { + let old_keys = std::mem::replace(&mut self.keys, vec![0; capacity + 1]); + let old_values = std::mem::replace(&mut self.values, vec![0; capacity + 1]); + for slot in (0..old_keys.len() - 1).rev() { + if old_keys[slot] == 0 { + continue; + } + let destination = self.find(old_keys[slot]); + self.keys[destination] = old_keys[slot]; + self.values[destination] = old_values[slot]; + } + self.values[capacity] = *old_values.last().unwrap(); + } + fn shift_keys(&mut self, mut hole: usize, wrapped: &mut Vec) { + let mask = self.capacity() - 1; + loop { + let mut slot = (hole + 1) & mask; + loop { + let key = self.keys[slot]; + if key == 0 { + self.keys[hole] = 0; + return; + } + let home = mix(key) & mask; + let crosses = if hole <= slot { + hole >= home || home > slot + } else { + hole >= home && home > slot + }; + if crosses { + break; + } + slot = (slot + 1) & mask; + } + if slot < hole { + wrapped.push(self.keys[slot]); + } + self.keys[hole] = self.keys[slot]; + self.values[hole] = self.values[slot]; + hole = slot; + } + } + pub(super) fn remove(&mut self, key: i64) { + let slot = self.find(key); + if key == 0 { + if !self.zero { + return; + } + self.zero = false; + } else { + if self.keys[slot] == 0 { + return; + } + self.shift_keys(slot, &mut Vec::new()); + } + self.size -= 1; + if self.capacity() > 32 && self.size < self.capacity() * 3 / 16 { + self.rehash(self.capacity() / 2); + } + } + /// Visit in vanilla iterator order. The callback updates the deadline and + /// returns true to remove the entry. Regular iterator removal does not shrink. + pub(super) fn visit(&mut self, mut action: impl FnMut(i64, &mut i64) -> bool) { + let mut remaining = self.size; + let mut position = self.capacity() as isize; + let mut wrapped = Vec::new(); + let mut zero = self.zero; + while remaining > 0 { + remaining -= 1; + let slot = if zero { + zero = false; + self.capacity() + } else { + loop { + position -= 1; + if position < 0 { + break self.find(wrapped[(-position - 1) as usize]); + } + if self.keys[position as usize] != 0 { + break position as usize; + } + } + }; + let key = self.keys[slot]; + if !action(key, &mut self.values[slot]) { + continue; + } + if slot == self.capacity() { + self.zero = false; + self.size -= 1; + } else if position >= 0 { + self.shift_keys(slot, &mut wrapped); + self.size -= 1; + } else { + self.remove(key); + } + } + } +} diff --git a/crates/horizon-core/src/ticks/mod.rs b/crates/horizon-core/src/ticks/mod.rs new file mode 100644 index 000000000..38fcef4db --- /dev/null +++ b/crates/horizon-core/src/ticks/mod.rs @@ -0,0 +1,638 @@ +//! Scheduled block/fluid tick machinery for Java Edition 26.3. Type IDs identify +//! registry-owned types; each block/fluid registry uses its own LevelTicks. +mod heap; +mod index; +use crate::position::{BlockPos, ChunkPos}; +use heap::Heap; +use index::DeadlineIndex; +use std::{ + cmp::Ordering, + collections::{HashMap, HashSet, VecDeque}, +}; + +#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct TickTypeId(pub u32); + +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)] +#[repr(i8)] +pub enum TickPriority { + ExtremelyHigh = -3, + VeryHigh = -2, + High = -1, + #[default] + Normal = 0, + Low = 1, + VeryLow = 2, + ExtremelyLow = 3, +} +impl TickPriority { + pub const fn by_value(value: i32) -> Self { + match value { + i32::MIN..=-3 => Self::ExtremelyHigh, + -2 => Self::VeryHigh, + -1 => Self::High, + 0 => Self::Normal, + 1 => Self::Low, + 2 => Self::VeryLow, + 3..=i32::MAX => Self::ExtremelyLow, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct ScheduledTick { + pub kind: TickTypeId, + pub pos: BlockPos, + pub trigger_tick: i64, + pub priority: TickPriority, + pub sub_tick_order: i64, +} +impl ScheduledTick { + pub fn drain_cmp(self, other: Self) -> Ordering { + self.trigger_tick + .cmp(&other.trigger_tick) + .then_with(|| self.intra_cmp(other)) + } + pub fn intra_cmp(self, other: Self) -> Ordering { + self.priority + .cmp(&other.priority) + .then_with(|| self.sub_tick_order.cmp(&other.sub_tick_order)) + } + pub fn saved(self, game_time: i64) -> SavedTick { + SavedTick { + kind: self.kind, + pos: self.pos, + delay: self.trigger_tick.wrapping_sub(game_time) as i32, + priority: self.priority, + } + } + fn key(self) -> (TickTypeId, BlockPos) { + (self.kind, self.pos) + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct SavedTick { + pub kind: TickTypeId, + pub pos: BlockPos, + pub delay: i32, + pub priority: TickPriority, +} +impl SavedTick { + pub fn unpack(self, game_time: i64, sub_tick_order: i64) -> ScheduledTick { + ScheduledTick { + kind: self.kind, + pos: self.pos, + trigger_tick: game_time.wrapping_add(i64::from(self.delay)), + priority: self.priority, + sub_tick_order, + } + } +} + +#[derive(Clone, Debug, Default)] +pub struct ChunkTicks { + queue: Heap, + pending: Option>, + positions: HashSet<(TickTypeId, BlockPos)>, +} +impl ChunkTicks { + pub fn from_saved(ticks: Vec) -> Self { + Self { + positions: ticks.iter().map(|t| (t.kind, t.pos)).collect(), + pending: Some(ticks), + ..Self::default() + } + } + pub fn peek(&self) -> Option { + self.queue.peek() + } + pub fn poll(&mut self) -> Option { + let tick = self.queue.pop(ScheduledTick::drain_cmp)?; + self.positions.remove(&tick.key()); + Some(tick) + } + /// First schedule wins for a type/position, irrespective of timing/priority. + pub fn schedule(&mut self, tick: ScheduledTick) -> bool { + if !self.positions.insert(tick.key()) { + return false; + } + self.queue.push(tick, ScheduledTick::drain_cmp); + true + } + pub fn has_scheduled(&self, pos: BlockPos, kind: TickTypeId) -> bool { + self.positions.contains(&(kind, pos)) + } + pub fn count(&self) -> usize { + self.queue.values.len() + self.pending.as_ref().map_or(0, Vec::len) + } + /// Heap traversal order, as exposed by vanilla getAll, rather than sorted order. + pub fn queued(&self) -> &[ScheduledTick] { + &self.queue.values + } + pub fn remove_if(&mut self, mut predicate: impl FnMut(ScheduledTick) -> bool) { + self.queue.remove_if( + |tick| { + if !predicate(tick) { + return false; + } + self.positions.remove(&tick.key()); + true + }, + ScheduledTick::drain_cmp, + ); + } + pub fn pack(&self, game_time: i64) -> Vec { + let mut saved = self.pending.clone().unwrap_or_default(); + let mut queued = self.queue.values.clone(); + queued.sort_by_key(|t| t.sub_tick_order); + saved.extend(queued.into_iter().map(|t| t.saved(game_time))); + saved + } + pub fn unpack(&mut self, game_time: i64) { + if let Some(pending) = self.pending.take() { + let mut order = (pending.len() as i32).wrapping_neg() as i64; + for saved in pending { + // Vanilla does not deduplicate a saved list during unpack. + self.queue + .push(saved.unpack(game_time, order), ScheduledTick::drain_cmp); + order = order.wrapping_add(1); + } + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + fn tick(kind: u32, x: i32, time: i64, priority: i32, order: i64) -> ScheduledTick { + ScheduledTick { + kind: TickTypeId(kind), + pos: BlockPos::new(x, 64, 0), + trigger_tick: time, + priority: TickPriority::by_value(priority), + sub_tick_order: order, + } + } + fn level() -> LevelTicks { + let mut level = LevelTicks::default(); + for x in -1..=2 { + level + .add_chunk(ChunkPos::new(x, 0), ChunkTicks::default()) + .unwrap(); + } + level + } + #[test] + fn due_chunks_compete_by_priority_not_trigger_time() { + let mut level = level(); + for tick in [ + tick(0, 0, 1, 3, 10), + tick(1, 1, 2, -3, 11), + tick(2, 16, 3, 0, 12), + ] { + assert_eq!(level.schedule(tick), ScheduleResult::Added); + } + assert_eq!( + level.schedule(tick(0, 0, -100, -3, -10)), + ScheduleResult::Duplicate + ); + let mut ran = Vec::new(); + level + .tick(10, 10, |_| true, |_, tick| ran.push(tick.kind.0)) + .unwrap(); + assert_eq!(ran, [2, 0, 1]); + assert_eq!(level.count(), 0); + } + #[test] + fn callback_scheduling_waits_until_the_next_collection() { + let mut level = level(); + let original = tick(0, 0, 0, 0, 0); + level.schedule(original); + let mut ran = 0; + level + .tick( + 0, + 100, + |_| true, + |level, tick| { + ran += 1; + assert!(!level.will_tick_this_tick(tick.pos, tick.kind)); + assert_eq!(level.schedule(tick), ScheduleResult::Added); + assert!(level.has_scheduled(tick.pos, tick.kind)); + }, + ) + .unwrap(); + assert_eq!(ran, 1); + assert_eq!(level.count(), 1); + level.tick(0, 100, |_| true, |_, _| ran += 1).unwrap(); + assert_eq!(ran, 2); + assert_eq!(level.count(), 0); + } + #[test] + fn pending_ticks_keep_list_order_and_java_time_overflow() { + let a = tick(0, 0, i64::MAX, -9, 10).saved(i64::MIN); + assert_eq!(a.delay, -1); + let b = SavedTick { + delay: 1, + kind: TickTypeId(1), + ..a + }; + let mut chunk = ChunkTicks::from_saved(vec![a, b, a]); + assert_eq!(chunk.count(), 3); + assert!(chunk.peek().is_none()); + assert!(!chunk.schedule(tick(0, 0, 100, 0, 0))); + chunk.unpack(i64::MAX); + assert_eq!(chunk.count(), 3); + assert_eq!(chunk.poll().unwrap().trigger_tick, i64::MIN); + assert_eq!(chunk.poll().unwrap().sub_tick_order, -3); + assert_eq!(chunk.poll().unwrap().sub_tick_order, -1); + chunk.unpack(0); + assert_eq!(chunk.count(), 0); + } + #[test] + fn disabled_and_removed_chunks_retain_their_queue() { + let mut level = level(); + level.schedule(tick(0, 0, 0, 0, 0)); + level + .tick(10, 10, |_| false, |_, _| panic!("disabled chunk ran")) + .unwrap(); + let chunk = level.remove_chunk(ChunkPos::new(0, 0)).unwrap(); + assert_eq!(chunk.count(), 1); + assert_eq!( + level.schedule(tick(1, 0, 0, 0, 0)), + ScheduleResult::MissingChunk + ); + level.add_chunk(ChunkPos::new(0, 0), chunk).unwrap(); + let mut ran = Vec::new(); + level + .tick(10, 1, |_| true, |_, tick| ran.push(tick)) + .unwrap(); + assert_eq!(ran, [tick(0, 0, 0, 0, 0)]); + } + #[test] + fn collection_guards_and_membership_survive_area_mutation() { + let mut level = level(); + level.schedule(tick(0, 0, 0, 0, 0)); + level.schedule(tick(1, 1, 0, 0, 1)); + level.begin_tick(0, 10, |_| true).unwrap(); + assert_eq!( + level.begin_tick(0, 10, |_| true), + Err(TickError::AlreadyCollecting) + ); + assert_eq!(level.finish_tick(), Err(TickError::TicksRemain)); + assert_eq!(level.next_tick().unwrap().unwrap().kind, TickTypeId(0)); + let probe = BlockPos::new(1, 64, 0); + assert!(level.will_tick_this_tick(probe, TickTypeId(1))); + level.clear_area(TickArea::new(probe, probe)); + // Preserve vanilla's stale lazily built set until cleanup. + assert!(level.will_tick_this_tick(probe, TickTypeId(1))); + assert!(level.next_tick().unwrap().is_none()); + level.finish_tick().unwrap(); + assert!(!level.will_tick_this_tick(probe, TickTypeId(1))); + assert_eq!(level.next_tick(), Err(TickError::NotCollecting)); + } + #[test] + fn copying_active_ticks_preserves_relative_order_and_wraps() { + let mut level = level(); + level.schedule(tick(0, 0, 0, 0, i64::MAX - 1)); + level.schedule(tick(1, 1, 0, 0, i64::MAX)); + level.begin_tick(0, 10, |_| true).unwrap(); + level.next_tick().unwrap(); + level.copy_area( + TickArea::new(BlockPos::new(0, 64, 0), BlockPos::new(1, 64, 0)), + BlockPos::new(16, 0, 0), + ); + let copied = level.chunk(ChunkPos::new(1, 0)).unwrap().queued(); + assert_eq!(copied.len(), 2); + assert_eq!(copied[0].sub_tick_order, i64::MIN); + assert_eq!(copied[1].sub_tick_order, i64::MIN + 1); + while level.next_tick().unwrap().is_some() {} + level.finish_tick().unwrap(); + } +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct TickArea { + pub min: BlockPos, + pub max: BlockPos, +} +impl TickArea { + pub fn new(a: BlockPos, b: BlockPos) -> Self { + Self { + min: BlockPos::new(a.x.min(b.x), a.y.min(b.y), a.z.min(b.z)), + max: BlockPos::new(a.x.max(b.x), a.y.max(b.y), a.z.max(b.z)), + } + } + pub fn contains(self, pos: BlockPos) -> bool { + (self.min.x..=self.max.x).contains(&pos.x) + && (self.min.y..=self.max.y).contains(&pos.y) + && (self.min.z..=self.max.z).contains(&pos.z) + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum ScheduleResult { + Added, + Duplicate, + MissingChunk, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum TickError { + AlreadyCollecting, + NotCollecting, + TicksRemain, + ChunkAlreadyAdded, + WrongChunk, +} +impl std::fmt::Display for TickError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "scheduled tick invariant: {self:?}") + } +} +impl std::error::Error for TickError {} + +#[derive(Default)] +pub struct LevelTicks { + chunks: HashMap, + deadlines: DeadlineIndex, + containers_to_tick: Heap, + to_run: VecDeque, + already_run: Vec, + to_run_set: HashSet<(TickTypeId, BlockPos)>, + collecting: bool, +} +impl LevelTicks { + pub fn add_chunk(&mut self, pos: ChunkPos, ticks: ChunkTicks) -> Result<(), TickError> { + let key = pos.pack(); + if self.chunks.contains_key(&key) { + return Err(TickError::ChunkAlreadyAdded); + } + if ticks.queue.values.iter().any(|t| t.pos.chunk() != pos) + || ticks + .pending + .as_ref() + .is_some_and(|p| p.iter().any(|t| t.pos.chunk() != pos)) + { + return Err(TickError::WrongChunk); + } + if let Some(tick) = ticks.peek() { + self.deadlines.put(key, tick.trigger_tick); + } + self.chunks.insert(key, ticks); + Ok(()) + } + pub fn remove_chunk(&mut self, pos: ChunkPos) -> Option { + self.deadlines.remove(pos.pack()); + self.chunks.remove(&pos.pack()) + } + pub fn chunk(&self, pos: ChunkPos) -> Option<&ChunkTicks> { + self.chunks.get(&pos.pack()) + } + pub fn unpack_chunk(&mut self, pos: ChunkPos, game_time: i64) { + if let Some(chunk) = self.chunks.get_mut(&pos.pack()) { + chunk.unpack(game_time); + if let Some(tick) = chunk.peek() { + self.deadlines.put(pos.pack(), tick.trigger_tick); + } + } + } + pub fn schedule(&mut self, tick: ScheduledTick) -> ScheduleResult { + let key = tick.pos.chunk().pack(); + let Some(chunk) = self.chunks.get_mut(&key) else { + return ScheduleResult::MissingChunk; + }; + if !chunk.schedule(tick) { + return ScheduleResult::Duplicate; + } + if chunk.peek() == Some(tick) { + self.deadlines.put(key, tick.trigger_tick); + } + ScheduleResult::Added + } + pub fn has_scheduled(&self, pos: BlockPos, kind: TickTypeId) -> bool { + self.chunk(pos.chunk()) + .is_some_and(|c| c.has_scheduled(pos, kind)) + } + pub fn will_tick_this_tick(&mut self, pos: BlockPos, kind: TickTypeId) -> bool { + if self.to_run_set.is_empty() && !self.to_run.is_empty() { + self.to_run_set.extend(self.to_run.iter().map(|t| t.key())); + } + self.to_run_set.contains(&(kind, pos)) + } + pub fn count(&self) -> usize { + self.chunks.values().map(ChunkTicks::count).sum() + } + pub fn begin_tick( + &mut self, + game_time: i64, + maximum: i32, + mut can_tick: impl FnMut(ChunkPos) -> bool, + ) -> Result<(), TickError> { + if self.collecting { + return Err(TickError::AlreadyCollecting); + } + self.collecting = true; + let mut containers = std::mem::take(&mut self.containers_to_tick); + let chunks = &mut self.chunks; + let compare = |a: i64, b: i64| { + chunks[&a] + .peek() + .unwrap() + .intra_cmp(chunks[&b].peek().unwrap()) + }; + self.deadlines.visit(|key, deadline| { + if *deadline > game_time { + return false; + } + let Some(head) = chunks.get(&key).and_then(ChunkTicks::peek) else { + return true; + }; + if head.trigger_tick > game_time { + *deadline = head.trigger_tick; + return false; + } + if !can_tick(ChunkPos::unpack(key)) { + return false; + } + containers.push(key, compare); + true + }); + let maximum = maximum.max(0) as usize; + while self.to_run.len() < maximum { + let Some(key) = containers.pop(|a, b| { + self.chunks[&a] + .peek() + .unwrap() + .intra_cmp(self.chunks[&b].peek().unwrap()) + }) else { + break; + }; + let chunk = self.chunks.get_mut(&key).unwrap(); + self.to_run.push_back(chunk.poll().unwrap()); + let competing = containers.peek().and_then(|key| self.chunks[&key].peek()); + let chunk = self.chunks.get_mut(&key).unwrap(); + while self.to_run.len() < maximum { + let Some(head) = chunk.peek() else { + break; + }; + if head.trigger_tick > game_time + || competing.is_some_and(|other| head.intra_cmp(other) == Ordering::Greater) + { + break; + } + self.to_run.push_back(chunk.poll().unwrap()); + } + if let Some(head) = chunk.peek() { + if head.trigger_tick <= game_time && self.to_run.len() < maximum { + containers.push(key, |a, b| { + self.chunks[&a] + .peek() + .unwrap() + .intra_cmp(self.chunks[&b].peek().unwrap()) + }); + } else { + self.deadlines.put(key, head.trigger_tick); + } + } + } + for &key in &containers.values { + self.deadlines + .put(key, self.chunks[&key].peek().unwrap().trigger_tick); + } + containers.values.clear(); + self.containers_to_tick = containers; + Ok(()) + } + /// Pop immediately before invoking block/fluid behavior. The current tick is + /// already-run, absent from will_tick, and available to area copying. + pub fn next_tick(&mut self) -> Result, TickError> { + if !self.collecting { + return Err(TickError::NotCollecting); + } + let Some(tick) = self.to_run.pop_front() else { + return Ok(None); + }; + if !self.to_run_set.is_empty() { + self.to_run_set.remove(&tick.key()); + } + self.already_run.push(tick); + Ok(Some(tick)) + } + pub fn finish_tick(&mut self) -> Result<(), TickError> { + if !self.collecting { + return Err(TickError::NotCollecting); + } + if !self.to_run.is_empty() { + return Err(TickError::TicksRemain); + } + self.already_run.clear(); + self.to_run_set.clear(); + self.collecting = false; + Ok(()) + } + pub fn tick( + &mut self, + game_time: i64, + maximum: i32, + can_tick: impl FnMut(ChunkPos) -> bool, + mut run: impl FnMut(&mut Self, ScheduledTick), + ) -> Result<(), TickError> { + self.begin_tick(game_time, maximum, can_tick)?; + while let Some(tick) = self.next_tick()? { + run(self, tick); + } + self.finish_tick() + } + fn chunks_in_area(&self, area: TickArea) -> Vec { + let min = area.min.chunk(); + let max = area.max.chunk(); + if min.x > max.x || min.z > max.z { + return Vec::new(); + } + let width = (i64::from(max.x) - i64::from(min.x) + 1) as u64; + let depth = (i64::from(max.z) - i64::from(min.z) + 1) as u64; + // Small edits should probe their grid rather than scan every loaded chunk. + // Large empty areas should visit loaded chunks rather than the empty grid. + if width * depth <= self.chunks.len() as u64 { + let mut keys = Vec::new(); + for x in min.x..=max.x { + for z in min.z..=max.z { + let key = ChunkPos::new(x, z).pack(); + if self.chunks.contains_key(&key) { + keys.push(key); + } + } + } + return keys; + } + let mut keys: Vec<_> = self + .chunks + .keys() + .copied() + .filter(|key| { + let pos = ChunkPos::unpack(*key); + (min.x..=max.x).contains(&pos.x) && (min.z..=max.z).contains(&pos.z) + }) + .collect(); + keys.sort_by_key(|key| { + let p = ChunkPos::unpack(*key); + (p.x, p.z) + }); + keys + } + pub fn clear_area(&mut self, area: TickArea) { + for key in self.chunks_in_area(area) { + let chunk = self.chunks.get_mut(&key).unwrap(); + let old = chunk.peek(); + chunk.remove_if(|tick| area.contains(tick.pos)); + if chunk.peek() != old { + if let Some(tick) = chunk.peek() { + self.deadlines.put(key, tick.trigger_tick); + } else { + self.deadlines.remove(key); + } + } + } + self.already_run.retain(|tick| !area.contains(tick.pos)); + self.to_run.retain(|tick| !area.contains(tick.pos)); + // Vanilla clearArea leaves its lazily computed membership set intact. + } + fn area_ticks(&self, area: TickArea) -> Vec { + let mut ticks: Vec<_> = self + .already_run + .iter() + .chain(self.to_run.iter()) + .copied() + .filter(|t| area.contains(t.pos)) + .collect(); + for key in self.chunks_in_area(area) { + ticks.extend( + self.chunks[&key] + .queued() + .iter() + .copied() + .filter(|t| area.contains(t.pos)), + ); + } + ticks + } + fn schedule_copy(&mut self, ticks: Vec, offset: BlockPos) { + let Some(min) = ticks.iter().map(|t| t.sub_tick_order).min() else { + return; + }; + let max = ticks.iter().map(|t| t.sub_tick_order).max().unwrap(); + for mut tick in ticks { + tick.pos = tick.pos.offset(offset.x, offset.y, offset.z); + tick.sub_tick_order = tick + .sub_tick_order + .wrapping_sub(min) + .wrapping_add(max) + .wrapping_add(1); + self.schedule(tick); + } + } + pub fn copy_area(&mut self, area: TickArea, offset: BlockPos) { + self.schedule_copy(self.area_ticks(area), offset); + } + pub fn copy_area_from(&mut self, source: &Self, area: TickArea, offset: BlockPos) { + self.schedule_copy(source.area_ticks(area), offset); + } +} diff --git a/crates/horizon-core/tests/carving_bounds.rs b/crates/horizon-core/tests/carving_bounds.rs new file mode 100644 index 000000000..0eae83caa --- /dev/null +++ b/crates/horizon-core/tests/carving_bounds.rs @@ -0,0 +1,58 @@ +use horizon_core::carving::{CarvingMask, CarvingMaskError}; + +#[test] +fn invalid_bounds_and_growth_fail_without_changing_existing_cells() { + for (min, max) in [(0, -1), (0, 4064), (i32::MIN, i32::MAX)] { + assert!(matches!( + CarvingMask::new(min, max), + Err(CarvingMaskError::InvalidBounds) + )); + } + let mut mask = CarvingMask::new(-64, 319).unwrap(); + mask.carve(0, -64, 0).unwrap(); + mask.carve(15, 319, 15).unwrap(); + let previous: Vec<_> = mask.columns().collect(); + assert_eq!(mask.carve(0, -65, 0), Err(CarvingMaskError::NegativeIndex)); + assert_eq!( + mask.carve(0, (1 << 24) - 64, 0), + Err(CarvingMaskError::Capacity) + ); + assert_eq!(mask.columns().collect::>(), previous); +} + +#[test] +fn shared_candidate_budget_counts_skipped_cells_and_stops_before_the_next_callback() { + use horizon_core::{ + carving::{CarveError, carve_ellipsoid_with_budget}, + position::ChunkPos, + }; + let mut mask = CarvingMask::new(0, 15).unwrap(); + let mut remaining = 2; + let mut calls = 0; + let result = carve_ellipsoid_with_budget( + ChunkPos::new(0, 0), + [8., 8., 8.], + 4., + 4., + &mut mask, + |_, _| { + calls += 1; + true + }, + &mut remaining, + ); + assert_eq!(result, Err(CarveError::IterationLimit)); + assert_eq!(calls, 2); + assert_eq!(remaining, 0); + assert!(mask.is_empty()); + let result = carve_ellipsoid_with_budget( + ChunkPos::new(0, 0), + [1000., 8., 1000.], + 1., + 1., + &mut mask, + |_, _| panic!("culled shape queried its predicate"), + &mut remaining, + ); + assert!(result.is_ok()); +} diff --git a/crates/horizon-core/tests/density_world_fields.rs b/crates/horizon-core/tests/density_world_fields.rs new file mode 100644 index 000000000..7bc9ed6dd --- /dev/null +++ b/crates/horizon-core/tests/density_world_fields.rs @@ -0,0 +1,202 @@ +use horizon_core::{ + density::{ + BlendDensitySampler, CachingDensitySampler, ConstantSampler, ContextBoundSampler, + DensityBlender, DensitySampler, SampleError, SamplerContext, WorldField, WorldFields, + graph::{DensityCompiler, DensityGraph, GraphNode}, + }, + noise::DensityVolume, +}; +use std::sync::{Arc, Mutex}; + +#[derive(Debug)] +struct SpatialBlender { + calls: Mutex>>, +} +impl DensityBlender for SpatialBlender { + fn is_empty(&self) -> bool { + self.calls.lock().unwrap().push(None); + false + } + fn blend_density(&self, [x, y, z]: [i32; 3], input: f32) -> f32 { + self.calls.lock().unwrap().push(Some([x, y, z])); + input + (x * 100 + y * 10 + z) as f32 + } +} + +#[test] +fn fields_resolve_through_the_same_context_and_replace_cached_values() { + let alpha: Arc = Arc::new(ContextBoundSampler::new(WorldField::BlendAlpha)); + let beard = ContextBoundSampler::new(WorldField::Beardifier); + let fields = WorldFields::default() + .with_field(WorldField::Beardifier, alpha) + .with_field(WorldField::BlendAlpha, Arc::new(ConstantSampler(0.25))); + let mut context = SamplerContext::cached().with_world_fields(fields); + let cached = CachingDensitySampler::new(0, Arc::new(beard)).unwrap(); + assert_eq!(cached.sample_value(&mut context, [0; 3]).unwrap(), 0.25); + context = context.with_world_fields( + WorldFields::default().with_field(WorldField::Beardifier, Arc::new(ConstantSampler(0.75))), + ); + assert_eq!(cached.sample_value(&mut context, [0; 3]).unwrap(), 0.75); +} + +#[test] +fn absent_fields_use_vanilla_defaults_including_buffer_tails() { + let volume = DensityVolume::new([1; 3], [0; 3], [1; 3]).unwrap(); + let mut context = SamplerContext::default(); + for (field, expected) in [ + (WorldField::BlendAlpha, 1.0), + (WorldField::BlendOffset, 0.0), + (WorldField::Beardifier, 0.0), + ] { + let mut buffer = [9.0; 3]; + ContextBoundSampler::new(field) + .sample_volume(&mut context, &mut buffer, volume) + .unwrap(); + assert_eq!(buffer, [expected; 3]); + } +} + +#[test] +fn blending_visits_z_x_y_and_preserves_the_input_tail() { + let blender = Arc::new(SpatialBlender { + calls: Mutex::new(Vec::new()), + }); + let mut context = SamplerContext::default() + .with_world_fields(WorldFields::default().with_blender(blender.clone())); + let sampler = BlendDensitySampler { + input: Arc::new(ConstantSampler(0.5)), + }; + let volume = DensityVolume::new([2; 3], [1, 2, 3], [2, 3, 4]).unwrap(); + let mut buffer = [9.0; 10]; + sampler + .sample_volume(&mut context, &mut buffer, volume) + .unwrap(); + assert_eq!( + *blender.calls.lock().unwrap(), + vec![ + None, + Some([1, 2, 3]), + Some([1, 5, 3]), + Some([3, 2, 3]), + Some([3, 5, 3]), + Some([1, 2, 7]), + Some([1, 5, 7]), + Some([3, 2, 7]), + Some([3, 5, 7]) + ] + ); + assert_eq!( + buffer, + [ + 123.5, 153.5, 323.5, 353.5, 127.5, 157.5, 327.5, 357.5, 0.5, 0.5 + ] + ); +} + +#[derive(Debug)] +struct FailedInput; +impl DensitySampler for FailedInput { + fn sample_value(&self, _: &mut SamplerContext, _: [i32; 3]) -> Result { + Err(SampleError::ZeroGradientPeriod) + } + fn sample_volume( + &self, + _: &mut SamplerContext, + buffer: &mut [f32], + _: DensityVolume, + ) -> Result<(), SampleError> { + buffer[0] = 0.25; + Err(SampleError::ZeroGradientPeriod) + } +} +#[test] +fn failed_input_prevents_blender_lookup_and_preserves_partial_writes() { + let blender = Arc::new(SpatialBlender { + calls: Mutex::new(Vec::new()), + }); + let mut context = SamplerContext::default() + .with_world_fields(WorldFields::default().with_blender(blender.clone())); + let sampler = BlendDensitySampler { + input: Arc::new(FailedInput), + }; + assert!(sampler.sample_value(&mut context, [0; 3]).is_err()); + let mut buffer = [9.0; 2]; + assert!( + sampler + .sample_volume( + &mut context, + &mut buffer, + DensityVolume::new([1; 3], [0; 3], [1; 3]).unwrap() + ) + .is_err() + ); + assert_eq!(buffer, [0.25, 9.0]); + assert!(blender.calls.lock().unwrap().is_empty()); +} + +#[test] +fn blending_range_and_axes_follow_input_even_for_spatial_providers() { + let mut graph = DensityGraph::default(); + let constant = graph.insert(GraphNode::Constant(0.5)).unwrap(); + let root = graph.insert(GraphNode::BlendDensity(constant)).unwrap(); + assert_eq!(graph.domain_axes(root).unwrap(), 0); + assert_eq!(graph.range(root).unwrap(), graph.range(constant).unwrap()); + let mut compiler = DensityCompiler::new(graph); + let raw = compiler.compile_raw(root).unwrap(); + let optimized = compiler.get_sampler(root).unwrap(); + let blender = Arc::new(SpatialBlender { + calls: Mutex::new(Vec::new()), + }); + let mut context = + SamplerContext::default().with_world_fields(WorldFields::default().with_blender(blender)); + assert_eq!(raw.sample_value(&mut context, [1, 2, 3]).unwrap(), 123.5); + assert_eq!( + optimized.sample_value(&mut context, [1, 2, 3]).unwrap(), + 0.5 + ); +} + +#[test] +fn named_reference_identity_differs_from_direct_value_equality() { + let mut graph = DensityGraph::new(); + let value = graph.insert(GraphNode::Constant(-0.0)).unwrap(); + let direct = graph + .insert(GraphNode::Reference { + input: value, + holder: None, + }) + .unwrap(); + let a = graph + .register_function("minecraft:a".into(), value) + .unwrap(); + let b = graph + .register_function("minecraft:b".into(), value) + .unwrap(); + assert!(!graph.java_equals(a, b).unwrap()); + assert!(!graph.java_equals(a, direct).unwrap()); + assert_eq!(graph.function("minecraft:a"), Some(a)); + assert!( + graph + .register_function("minecraft:a".into(), value) + .is_err() + ); + let exponent = graph.insert(GraphNode::Constant(0.5)).unwrap(); + let power = graph + .insert(GraphNode::Power { base: a, exponent }) + .unwrap(); + let mut compiler = DensityCompiler::new(graph); + let raw = compiler.compile_raw(power).unwrap(); + let optimized = compiler.get_sampler(power).unwrap(); + let mut context = SamplerContext::default(); + assert_eq!( + raw.sample_value(&mut context, [0; 3]).unwrap().to_bits(), + 0x8000_0000 + ); + assert_eq!( + optimized + .sample_value(&mut context, [0; 3]) + .unwrap() + .to_bits(), + 0 + ); +} diff --git a/crates/horizon-world/Cargo.toml b/crates/horizon-world/Cargo.toml new file mode 100644 index 000000000..4c8c4f43a --- /dev/null +++ b/crates/horizon-world/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "horizon-world" +version = "0.1.0" +edition.workspace = true +license.workspace = true +rust-version.workspace = true +description = "Horizon vanilla world data, NBT, regions and chunk storage" + +[dependencies] +serde_json = { version = "1.0.151", features = ["raw_value"] } +horizon-core = { path = "../horizon-core" } +flate2 = { version = "1.1.10", default-features = false, features = ["rust_backend"] } +lz4_flex = { version = "0.14", default-features = false, features = ["std", "safe-encode", "safe-decode", "checked-decode"] } +xxhash-rust = { version = "0.8.19", features = ["xxh32"] } + +[[bin]] +name = "horizon-world" +path = "src/main.rs" + +[[bin]] +name = "horizon-worldgen-parity" +path = "src/bin/worldgen_parity.rs" diff --git a/crates/horizon-world/examples/anchor_fixture.rs b/crates/horizon-world/examples/anchor_fixture.rs new file mode 100644 index 000000000..c6c15e65e --- /dev/null +++ b/crates/horizon-world/examples/anchor_fixture.rs @@ -0,0 +1,71 @@ +//! Original comparison transport for generation bounds and vertical anchors. +use horizon_world::worldgen::anchor::{VerticalAnchor, WorldGenerationContext}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn anchor( + a: VerticalAnchor, + context: WorldGenerationContext, + out: &mut impl Write, +) -> io::Result<()> { + writeln!( + out, + "anchor {} {}", + a.resolve(context), + a.to_json().unwrap_or_else(|_| "error".to_owned()) + ) +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let [min, height, sea] = std::array::from_fn(|i| f["context"][i].as_i64().unwrap() as i32); + let context = if let Some(g) = f.get("generator") { + WorldGenerationContext::with_generator( + min, + height, + g[0].as_i64().unwrap() as i32, + g[1].as_i64().unwrap() as i32, + g[2].as_i64().unwrap() as i32, + ) + } else { + WorldGenerationContext::new(min, height, sea) + }; + writeln!( + out, + "context {} {} {}", + context.min_y, context.height, context.sea_level + )?; + for a in [ + VerticalAnchor::BOTTOM, + VerticalAnchor::TOP, + VerticalAnchor::SEA_LEVEL, + ] { + anchor(a, context, &mut out)?; + } + for e in f["values"].as_array().unwrap() { + let v = e.as_i64().unwrap() as i32; + for a in [ + VerticalAnchor::Absolute(v), + VerticalAnchor::AboveBottom(v), + VerticalAnchor::BelowTop(v), + VerticalAnchor::RelativeToSeaLevel(v), + ] { + anchor(a, context, &mut out)?; + } + } + for e in f["json"].as_array().unwrap() { + match VerticalAnchor::from_json(e.as_str().unwrap()) { + Ok(a) => anchor(a, context, &mut out)?, + Err(_) => writeln!(out, "error")?, + } + } + } + out.flush()?; + Ok(()) +} diff --git a/crates/horizon-world/examples/basic_feature_fixture.rs b/crates/horizon-world/examples/basic_feature_fixture.rs new file mode 100644 index 000000000..f8ec7f53c --- /dev/null +++ b/crates/horizon-world/examples/basic_feature_fixture.rs @@ -0,0 +1,175 @@ +//! Feature world transport retaining ordered mutations and partial failures. +use horizon_core::random::{LegacyRandom, RandomSource, XoroshiroRandom}; +use horizon_world::{ + heightmap::HeightmapType, + registry::BlockStateId, + worldgen::{ + anchor::WorldGenerationContext, + feature::{BasicFeature, FeatureBlocks, FeatureWorld}, + placement::{FeaturePlacer, PlacementContext, PlacementModifier, PlacementQueryError}, + }, +}; +use serde_json::Value; +use std::{ + collections::BTreeMap, + fs, + io::{self, Write}, + path::Path, +}; +struct World<'a, W> { + states: BTreeMap<[i32; 3], BlockStateId>, + blocks: [BlockStateId; 5], + calls: i32, + fail: i32, + reject: i32, + out: &'a mut W, +} +impl PlacementContext for World<'_, W> { + fn generation(&self) -> WorldGenerationContext { + WorldGenerationContext::new(-64, 384, 63) + } + fn min_y(&mut self) -> Result { + Ok(-64) + } + fn height(&mut self, _: HeightmapType, _: i32, _: i32) -> Result { + Err(PlacementQueryError::Unavailable) + } +} +impl FeatureWorld for World<'_, W> { + type Error = io::Error; + fn block(&mut self, p: [i32; 3]) -> Result { + let call = self.calls; + self.calls += 1; + writeln!(self.out, "get {} {} {}", p[0], p[1], p[2])?; + if call == self.fail { + return Err(io::Error::other("world failure")); + } + let hash = p[0] + .wrapping_mul(31) + .wrapping_add(p[1].wrapping_mul(7)) + .wrapping_add(p[2].wrapping_mul(17)) + .rem_euclid(5) as usize; + let state = self.states.get(&p).copied().unwrap_or(self.blocks[hash]); + writeln!(self.out, "state {}", state.0)?; + Ok(state) + } + fn set_block( + &mut self, + p: [i32; 3], + state: BlockStateId, + flags: i32, + ) -> Result { + let call = self.calls; + self.calls += 1; + writeln!( + self.out, + "set {} {} {} {} {flags}", + p[0], p[1], p[2], state.0 + )?; + if call == self.fail { + return Err(io::Error::other("world failure")); + } + let result = self.reject == 0 || call % self.reject != 0; + if result { + self.states.insert(p, state); + } + writeln!(self.out, "written {result}")?; + Ok(result) + } +} +fn fixture( + f: &Value, + mut random: impl RandomSource, + blocks: [BlockStateId; 5], + out: &mut impl Write, +) -> Result<(), Box> { + let decoded = BasicFeature::from_json(f["definition"].as_str().unwrap()).and_then(|feature| { + let modifiers = f + .get("placement") + .map(|v| { + v.as_array() + .unwrap() + .iter() + .map(|v| PlacementModifier::from_json(&v.to_string())) + .collect::, _>>() + }) + .transpose()?; + Ok((feature, modifiers)) + }); + match decoded { + Err(_) => writeln!(out, "decode error")?, + Ok((feature, modifiers)) => { + writeln!(out, "decode ok")?; + let mut world = World { + states: BTreeMap::new(), + blocks, + calls: 0, + fail: f["fail"].as_i64().unwrap() as i32, + reject: f["reject"].as_i64().unwrap() as i32, + out, + }; + let blocks = FeatureBlocks { + air: blocks[0], + stone: blocks[1], + cobblestone: blocks[2], + end_stone: blocks[3], + obsidian: blocks[4], + }; + let p = &f["origin"]; + let origin = [ + p[0].as_i64().unwrap() as i32, + p[1].as_i64().unwrap() as i32, + p[2].as_i64().unwrap() as i32, + ]; + let mut placer = FeaturePlacer::new(); + for _ in 0..f["repeats"].as_u64().unwrap() { + world.calls = 0; + let result = if let Some(modifiers) = &modifiers { + placer + .place_with_context( + modifiers, + &mut world, + &mut random, + origin, + |world, random, position| { + feature.place(world, random, position, blocks) + }, + ) + .map_err(|_| ()) + } else { + feature + .place(&mut world, &mut random, origin, blocks) + .map_err(|_| ()) + }; + match result { + Ok(value) => writeln!(world.out, "place {value}")?, + Err(_) => writeln!(world.out, "place error")?, + } + writeln!(world.out, "next {}", random.next_long())?; + for (p, state) in &world.states { + writeln!(world.out, "stored {} {} {} {}", p[0], p[1], p[2], state.0)?; + } + writeln!(world.out, "end")?; + } + } + } + writeln!(out, "tail {}", random.next_long())?; + Ok(()) +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let ids: [u32; 5] = serde_json::from_str(&fs::read_to_string(dir.join("facts-server.json"))?)?; + let blocks = ids.map(BlockStateId); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let seed = f["seed"].as_i64().unwrap(); + if f["legacy"].as_bool().unwrap() { + fixture(&f, LegacyRandom::new(seed), blocks, &mut out)?; + } else { + fixture(&f, XoroshiroRandom::new(seed), blocks, &mut out)?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/examples/biome_chunk_fixture.rs b/crates/horizon-world/examples/biome_chunk_fixture.rs new file mode 100644 index 000000000..4adbd0a1f --- /dev/null +++ b/crates/horizon-world/examples/biome_chunk_fixture.rs @@ -0,0 +1,62 @@ +//! Original transport for native chunk biome fill order and failure state. +use horizon_core::position::ChunkPos; +use horizon_world::worldgen::biome_chunk::BiomeChunk; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn n(v: &Value) -> i32 { + v.as_i64().unwrap() as i32 +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let height = n(&f["height"]); + let mut chunk = BiomeChunk::new( + ChunkPos::new(n(&f["cx"]), n(&f["cz"])), + n(&f["min"]), + height, + n(&f["default"]), + )?; + for op in f["ops"].as_array().unwrap() { + let mut calls = 0; + let result = chunk.fill(n(&op[3]), n(&op[4]), |[x, y, z]| { + writeln!(out, "resolve {x} {y} {z}").unwrap(); + let previous = calls; + calls += 1; + if previous == n(&op[2]) { + return Err(()); + } + Ok(x.wrapping_mul(31) + .wrapping_add(y.wrapping_mul(7)) + .wrapping_add(z.wrapping_mul(17)) + .wrapping_add(n(&op[0])) + .rem_euclid(n(&op[1]))) + }); + writeln!( + out, + "fill {} {calls}", + if result.is_ok() { "ok" } else { "error" } + )?; + for index in 0..height as usize / 16 { + writeln!(out, "section {index}")?; + for row in chunk.section(index).unwrap().chunks(4) { + writeln!(out, "biomes {} {} {} {}", row[0], row[1], row[2], row[3])?; + } + } + for q in f["queries"].as_array().unwrap() { + writeln!( + out, + "query {}", + chunk.noise_biome([n(&q[0]), n(&q[1]), n(&q[2])]) + )?; + } + } + } + Ok(()) +} diff --git a/crates/horizon-world/examples/biome_generation_fixture.rs b/crates/horizon-world/examples/biome_generation_fixture.rs new file mode 100644 index 000000000..4c41b7ca5 --- /dev/null +++ b/crates/horizon-world/examples/biome_generation_fixture.rs @@ -0,0 +1,106 @@ +//! Chunk biome generation from bundled climate routers and imported preset tables. +use horizon_core::{ + biome::{BiomeZoom, obfuscate_seed}, + density::{SamplerContext, graph::DensityCompiler}, + position::{BlockPos, ChunkPos}, +}; +use horizon_world::worldgen::{ + biome_chunk::BiomeChunk, + biome_source::{BiomeSet, BiomeSourceDefinition}, + density::DensityRegistry, + router::{NoiseRouter, RouterField}, +}; +use serde_json::Value; +use std::{ + collections::BTreeMap, + fs, + io::{self, Write}, + path::Path, +}; +fn n(v: &Value) -> i32 { + v.as_i64().unwrap() as i32 +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let bundle: Value = serde_json::from_str(&fs::read_to_string(dir.join("registries.json"))?)?; + let noises: BTreeMap = serde_json::from_value(bundle["noises"].clone())?; + let densities: BTreeMap = serde_json::from_value(bundle["densities"].clone())?; + let presets: BTreeMap = serde_json::from_value(bundle["presets"].clone())?; + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let settings: Value = serde_json::from_str( + bundle["settings"][f["setting"].as_str().unwrap()] + .as_str() + .unwrap(), + )?; + let mut definitions = DensityRegistry::from_json(&noises, &densities)?; + let router = + NoiseRouter::from_json(&settings["noise_router"].to_string(), &mut definitions)?; + let seed = f["seed"].as_i64().unwrap(); + let mut compiler = DensityCompiler::new_seeded( + definitions.into_graph(), + seed, + f["legacy"].as_bool().unwrap(), + ); + let climate = router.compile_climate(&mut compiler)?; + let definition = match f["source"].as_str().unwrap_or("multi") { + "fixed" => BiomeSourceDefinition::Fixed("minecraft:plains".into()), + "checkerboard" => BiomeSourceDefinition::Checkerboard { + biomes: BiomeSet::Direct(vec![ + "minecraft:plains".into(), + "minecraft:the_end".into(), + "minecraft:nether_wastes".into(), + ]), + scale: n(&f["scale"]), + }, + "end" => BiomeSourceDefinition::End, + "multi" => BiomeSourceDefinition::Preset { + name: f["preset"].as_str().unwrap().into(), + inline: false, + }, + _ => panic!("unknown source"), + }; + let source = definition.resolve(&presets)?; + let erosion = compiler.get_sampler(router.function(RouterField::Erosion))?; + let mut resolver = source.resolver(&climate, erosion.as_ref()); + let (cx, cz, min, height) = (n(&f["cx"]), n(&f["cz"]), n(&f["min"]), n(&f["height"])); + let mut chunk = BiomeChunk::new( + ChunkPos::new(cx, cz), + min, + height, + "minecraft:plains".to_owned(), + )?; + for repeat in 0..n(&f["repeats"]) { + let mut context = SamplerContext::cached(); + let volume = resolver.prepare_volume( + &mut context, + [cx.wrapping_shl(4) >> 2, min >> 2, cz.wrapping_shl(4) >> 2], + [4, height >> 2, 4], + )?; + chunk.fill(n(&f["write_min"]), n(&f["write_max"]), |quart| { + resolver + .sample_prepared(&mut context, volume.as_ref(), quart) + .map(str::to_owned) + })?; + writeln!(out, "fill {repeat}")?; + for section in 0..height as usize / 16 { + writeln!(out, "section {section}")?; + for name in chunk.section(section).unwrap() { + writeln!(out, "biome {name}")?; + } + } + let zoom = BiomeZoom::new(obfuscate_seed(seed)); + for q in f["queries"].as_array().unwrap() { + let block = BlockPos::new(n(&q[0]), n(&q[1]), n(&q[2])); + writeln!( + out, + "query {}", + chunk.noise_biome(zoom.quart_at_block(block)) + )?; + } + } + } + Ok(()) +} diff --git a/crates/horizon-world/examples/biome_placement_fixture.rs b/crates/horizon-world/examples/biome_placement_fixture.rs new file mode 100644 index 000000000..a412b9924 --- /dev/null +++ b/crates/horizon-world/examples/biome_placement_fixture.rs @@ -0,0 +1,175 @@ +use horizon_core::random::{LegacyRandom, RandomSource, WorldgenRandom, XoroshiroRandom}; +use horizon_world::{ + heightmap::HeightmapType, + worldgen::{ + anchor::WorldGenerationContext, + feature_sort::FeatureIdentity, + placement::{FeaturePlacer, PlacementContext, PlacementModifier, PlacementQueryError}, + }, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn n(v: &Value) -> i32 { + v.as_i64().unwrap() as i32 +} +struct World<'a, W> { + out: &'a mut W, + f: &'a Value, + queries: i32, + calls: i32, +} +impl PlacementContext for World<'_, W> { + fn top_feature(&self) -> Option { + self.f["top"] + .as_bool() + .unwrap() + .then_some(FeatureIdentity(42)) + } + fn generation(&self) -> WorldGenerationContext { + WorldGenerationContext::new(-64, 384, 63) + } + fn min_y(&mut self) -> Result { + Ok(-64) + } + fn height(&mut self, _: HeightmapType, _: i32, _: i32) -> Result { + Err(PlacementQueryError::Unavailable) + } + fn biome_allows_feature( + &mut self, + p: [i32; 3], + feature: FeatureIdentity, + ) -> Result { + assert_eq!(feature, FeatureIdentity(42)); + let error = |e: io::Error| PlacementQueryError::Failed(e.to_string()); + writeln!(self.out, "biome {} {} {}", p[0], p[1], p[2]).map_err(error)?; + let call = self.queries; + self.queries += 1; + if call == n(&self.f["query_fail"]) { + return Err(PlacementQueryError::Unavailable); + } + let index = p[0] + .wrapping_mul(31) + .wrapping_add(p[1].wrapping_mul(7)) + .wrapping_add(p[2].wrapping_mul(17)) + .rem_euclid(2) as usize; + writeln!(self.out, "selected {index}").map_err(error)?; + writeln!(self.out, "settings {index}").map_err(error)?; + let call = self.queries; + self.queries += 1; + if call == n(&self.f["query_fail"]) { + return Err(PlacementQueryError::Unavailable); + } + Ok(matches!(n(&self.f["membership"][index]), 1 | 2)) + } +} +fn feature( + world: &mut World<'_, W>, + random: &mut impl RandomSource, + p: [i32; 3], +) -> Result { + writeln!(world.out, "feature {} {} {}", p[0], p[1], p[2]).map_err(|_| ())?; + if world.f["draw"].as_bool().unwrap() { + writeln!(world.out, "draw {}", random.next_long()).map_err(|_| ())?; + } + let call = world.calls; + world.calls += 1; + if call == n(&world.f["feature_fail"]) { + return Err(()); + } + if world.f["nested"].as_bool().unwrap() { + return FeaturePlacer::new() + .place_with_context(&[PlacementModifier::Biome], world, random, p, feature) + .map_err(|_| ()); + } + Ok(n(&world.f["return_mode"]) == 0 + || (n(&world.f["return_mode"]) == 2 + && p[0].wrapping_add(p[1]).wrapping_add(p[2]).rem_euclid(2) == 0)) +} +fn fixture( + f: &Value, + mut random: impl RandomSource, + out: &mut impl Write, +) -> Result<(), Box> { + let modifiers = f["placement"] + .as_array() + .unwrap() + .iter() + .map(|v| PlacementModifier::from_json(&v.to_string())) + .collect::, _>>()?; + let origin = std::array::from_fn(|i| n(&f["origin"][i])); + let mut world = World { + out, + f, + queries: 0, + calls: 0, + }; + let mut placer = FeaturePlacer::new(); + for _ in 0..3 { + world.queries = 0; + world.calls = 0; + let result = if f["direct"].as_bool().unwrap() { + // Direct modifier callbacks share their query world through a local + // emitted-position list; this corpus uses only the unit biome filter. + let mut positions = Vec::new(); + let result = modifiers[0].modify_in(&mut world, &mut random, origin, |_, p| { + positions.push(p); + Ok::<_, ()>(()) + }); + result.map_err(|_| ()).and_then(|()| { + for p in positions { + feature(&mut world, &mut random, p)?; + } + Ok(true) + }) + } else if f["top"].as_bool().unwrap() { + placer + .place_with_biome_check( + &modifiers, + &mut world, + &mut random, + origin, + FeatureIdentity(42), + feature, + ) + .map_err(|_| ()) + } else { + placer + .place_with_context(&modifiers, &mut world, &mut random, origin, feature) + .map_err(|_| ()) + }; + match result { + Ok(value) => writeln!(world.out, "place {value}")?, + Err(()) => writeln!(world.out, "place error")?, + } + writeln!(world.out, "next {}", random.next_long())?; + } + writeln!(world.out, "tail {}", random.next_long())?; + Ok(()) +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let seed = f["seed"].as_i64().unwrap(); + match ( + f["legacy"].as_bool().unwrap(), + f["worldgen"].as_bool().unwrap(), + ) { + (true, false) => fixture(&f, LegacyRandom::new(seed), &mut out)?, + (true, true) => fixture(&f, WorldgenRandom::new(LegacyRandom::new(seed)), &mut out)?, + (false, false) => fixture(&f, XoroshiroRandom::new(seed), &mut out)?, + (false, true) => fixture( + &f, + WorldgenRandom::new(XoroshiroRandom::new(seed)), + &mut out, + )?, + } + } + Ok(()) +} diff --git a/crates/horizon-world/examples/biome_source_codec_fixture.rs b/crates/horizon-world/examples/biome_source_codec_fixture.rs new file mode 100644 index 000000000..d45dcdd3a --- /dev/null +++ b/crates/horizon-world/examples/biome_source_codec_fixture.rs @@ -0,0 +1,79 @@ +//! Registry-aware codec transport for biome-source definitions. +use horizon_core::density::{ConstantSampler, SamplerContext}; +use horizon_world::worldgen::{ + biome_source::BiomeSourceCatalog, climate::ClimateSampler, tags::TagDefinitions, +}; +use serde_json::Value; +use std::{ + collections::{BTreeMap, BTreeSet}, + fs, + io::{self, Write}, + path::Path, + sync::Arc, +}; +fn normalized(value: Value) -> Value { + match value { + Value::Number(n) => { + serde_json::json!({"float64_bits":format!("{:016x}",n.as_f64().unwrap().to_bits())}) + } + Value::Array(values) => Value::Array(values.into_iter().map(normalized).collect()), + Value::Object(values) => Value::Object( + values + .into_iter() + .map(|(k, v)| (k, normalized(v))) + .collect(), + ), + value => value, + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let read = |name: &str| -> Result, Box> { + Ok(serde_json::from_str(&fs::read_to_string( + dir.join(format!("{name}.json")), + )?)?) + }; + let biomes: BTreeSet<_> = read("biomes")?.into_keys().collect(); + let presets = read("presets")?; + let mut tags = TagDefinitions::default(); + for (name, raw) in read("biome_tags")? { + tags.apply_json(&name, "vanilla", &raw)?; + } + let tags = tags.build(|name, _| biomes.contains(name).then(|| name.to_owned()))?; + assert!(tags.missing.is_empty()); + let catalog = BiomeSourceCatalog::new(&biomes, &tags.tags, &presets.keys().cloned().collect())?; + let positions: Vec<[i32; 3]> = + serde_json::from_str(&fs::read_to_string(dir.join("positions.json"))?)?; + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for json in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let definition = match catalog.decode(json) { + Ok(v) => v, + Err(_) => { + writeln!(out, "codec error")?; + continue; + } + }; + let encoded = catalog.encode(&definition)?; + writeln!(out, "codec {}", normalized(serde_json::from_str(&encoded)?))?; + let source = definition.resolve(&presets)?; + writeln!( + out, + "possible {}", + serde_json::to_string(&source.possible_biomes())? + )?; + let climate = + ClimateSampler::new(std::array::from_fn(|_| Arc::new(ConstantSampler(0.)) as _)); + let erosion = ConstantSampler(0.); + let mut resolver = source.resolver(&climate, &erosion); + let mut context = SamplerContext::cached(); + for &pos in &positions { + writeln!( + out, + "biome {}", + resolver.sample(&mut context, pos).unwrap_or("error") + )?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/examples/biome_source_fixture.rs b/crates/horizon-world/examples/biome_source_fixture.rs new file mode 100644 index 000000000..cbf262a7c --- /dev/null +++ b/crates/horizon-world/examples/biome_source_fixture.rs @@ -0,0 +1,79 @@ +//! Original transport for fixed, checkerboard and End biome-source queries. +use horizon_core::density::{DensitySampler, SampleError, SamplerContext}; +use horizon_world::worldgen::biome_source::{ + CheckerboardBiomeSource, EndBiomeSource, FixedBiomeSource, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, + sync::{Arc, Mutex}, +}; +fn n(v: &Value) -> i32 { + v.as_i64().unwrap() as i32 +} +#[derive(Debug)] +struct Erosion { + value: f32, + fail: bool, + trace: Arc>>, +} +impl DensitySampler for Erosion { + fn sample_value(&self, _: &mut SamplerContext, pos: [i32; 3]) -> Result { + self.trace.lock().unwrap().push(pos); + if self.fail { + Err(SampleError::RecursiveCache) + } else { + Ok(self.value) + } + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let kind = f["kind"].as_str().unwrap(); + let fixed = FixedBiomeSource { biome: 7 }; + let checker = CheckerboardBiomeSource::new( + f["biomes"] + .as_array() + .map(|v| v.iter().map(n).collect()) + .unwrap_or_default(), + f["scale"].as_i64().unwrap_or(0) as i32, + )?; + let end = EndBiomeSource { + center: 0, + highlands: 1, + midlands: 2, + islands: 3, + barrens: 4, + }; + let trace = Arc::new(Mutex::new(Vec::new())); + let erosion = Erosion { + value: f32::from_bits(u32::from_str_radix(f["bits"].as_str().unwrap_or("0"), 16)?), + fail: f["fail"].as_bool().unwrap_or(false), + trace: trace.clone(), + }; + let mut context = SamplerContext::cached(); + for pos in f["positions"].as_array().unwrap() { + let q = [n(&pos[0]), n(&pos[1]), n(&pos[2])]; + let value = match kind { + "fixed" => Some(*fixed.noise_biome(q)), + "checkerboard" => checker.noise_biome(q).ok().copied(), + "end" => end.noise_biome(q, &erosion, &mut context).ok().copied(), + _ => panic!("invalid source"), + }; + for [x, y, z] in trace.lock().unwrap().drain(..) { + writeln!(out, "sample {x} {y} {z}")?; + } + match value { + Some(id) => writeln!(out, "biome {id}")?, + None => writeln!(out, "error")?, + } + } + } + Ok(()) +} diff --git a/crates/horizon-world/examples/biome_temperature_fixture.rs b/crates/horizon-world/examples/biome_temperature_fixture.rs new file mode 100644 index 000000000..86b1393ce --- /dev/null +++ b/crates/horizon-world/examples/biome_temperature_fixture.rs @@ -0,0 +1,119 @@ +//! Original comparison transport for biome temperatures and ordered caches. +use horizon_core::position::BlockPos; +use horizon_world::worldgen::biome_temperature::{ + BiomeTemperature, BiomeTemperatureSettings, Precipitation, TemperatureModifier, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn bits(value: f32) -> u32 { + if value.is_nan() { + 0x7fc00000 + } else { + value.to_bits() + } +} +fn operations(worker: &mut BiomeTemperature, ops: &Value, out: &mut impl Write) -> io::Result<()> { + for op in ops.as_array().unwrap() { + match op[0].as_str().unwrap() { + "query" => { + let p = BlockPos::new( + op[1].as_i64().unwrap() as i32, + op[2].as_i64().unwrap() as i32, + op[3].as_i64().unwrap() as i32, + ); + let sea = op[4].as_i64().unwrap() as i32; + writeln!( + out, + "adjusted {:x}", + bits(worker.settings().height_adjusted(p, sea)) + )?; + writeln!(out, "cached {:x}", bits(worker.temperature(p, sea)))?; + let warm = worker.warm_enough_to_rain(p, sea); + let cold = worker.cold_enough_to_snow(p, sea); + let melt = worker.should_melt_frozen_ocean_iceberg_slightly(p, sea); + let precipitation = match worker.precipitation_at(p, sea) { + Precipitation::None => "NONE", + Precipitation::Rain => "RAIN", + Precipitation::Snow => "SNOW", + }; + writeln!(out, "weather {warm} {cold} {melt} {precipitation}")?; + } + "fill" => { + for i in 0..op[1].as_i64().unwrap() as i32 { + let p = BlockPos::new( + (op[2].as_i64().unwrap() as i32).wrapping_add(i), + i & 255, + i.wrapping_mul(31), + ); + writeln!( + out, + "fill {:x}", + bits(worker.temperature(p, op[3].as_i64().unwrap() as i32)) + )?; + } + } + "dump" => { + writeln!(out, "cache {}", worker.cached_temperatures().len())?; + for (key, value) in worker.cached_temperatures() { + writeln!(out, "{:x} {:x}", key as u64, bits(value))?; + } + } + "thread" => operations(&mut BiomeTemperature::new(worker.settings()), &op[1], out)?, + _ => panic!("unknown operation"), + } + } + Ok(()) +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let settings = if let Some(json) = f.get("json") { + match BiomeTemperatureSettings::from_json(json.as_str().unwrap()) { + Ok(value) => value, + Err(_) => { + writeln!(out, "decode error")?; + continue; + } + } + } else { + BiomeTemperatureSettings { + base_temperature: f32::from_bits(u32::from_str_radix( + f["base"].as_str().unwrap(), + 16, + )?), + downfall: f32::from_bits(u32::from_str_radix( + f.get("downfall").and_then(Value::as_str).unwrap_or("0"), + 16, + )?), + modifier: if f["modifier"].as_str().unwrap() == "FROZEN" { + TemperatureModifier::Frozen + } else { + TemperatureModifier::None + }, + has_precipitation: f["precipitation"].as_bool().unwrap(), + } + }; + writeln!( + out, + "settings {} {:x} {} {:x}", + settings.has_precipitation, + bits(settings.base_temperature), + if settings.modifier == TemperatureModifier::Frozen { + "FROZEN" + } else { + "NONE" + }, + bits(settings.downfall) + )?; + operations(&mut BiomeTemperature::new(settings), &f["ops"], &mut out)?; + } + out.flush()?; + Ok(()) +} diff --git a/crates/horizon-world/examples/block_properties_fixture.rs b/crates/horizon-world/examples/block_properties_fixture.rs new file mode 100644 index 000000000..35aef48e9 --- /dev/null +++ b/crates/horizon-world/examples/block_properties_fixture.rs @@ -0,0 +1,142 @@ +use horizon_core::geometry::{Aabb, Axis, ShapeOp, Vec3, VoxelShape}; +use horizon_world::{ + block_properties::{BlockDefinitionProperties, BlockPropertiesRegistry, BlockProperty}, + collision::CachedCollisionRegistry, + nbt::{self, Limits, Tag}, + registry::{BlockRegistry, BlockStateId}, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn bbox(v: &Value) -> Aabb { + let v = v + .as_array() + .unwrap() + .iter() + .map(|v| f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap())) + .collect::>(); + Aabb::new(Vec3::new(v[0], v[1], v[2]), Vec3::new(v[3], v[4], v[5])) +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let read = |name: &str| -> Result> { + Ok( + nbt::read_named(&fs::read(dir.join(name))?, Limits::default())? + .0 + .tag, + ) + }; + let registry = BlockRegistry::from_nbt(&read("block-registry.nbt")?)?; + let collisions = CachedCollisionRegistry::from_nbt(&read("cached-collision.nbt")?, ®istry)?; + let data = read("block-properties.nbt")?; + let properties = BlockPropertiesRegistry::from_nbt(&data, &collisions)?; + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + let solid = properties.bind(BlockProperty::Solid); + let replaceable = properties.bind(BlockProperty::Replaceable); + for id in 0..registry.len() { + let state = BlockStateId(id as u32); + let definition = properties + .definition(®istry.state(state).unwrap().name) + .unwrap(); + let s = properties.property(state, BlockProperty::Solid)?; + let r = properties.property(state, BlockProperty::Replaceable)?; + assert_eq!(s, solid.contains(state)); + assert_eq!(r, replaceable.contains(state)); + writeln!( + out, + "state {id} {} {} {r} {s}", + definition.force_solid_on, definition.force_solid_off + )?; + writeln!( + out, + "render {} {} {}", + properties.property(state, BlockProperty::Liquid)?, + definition.can_occlude, + properties.property(state, BlockProperty::SolidRender)? + )?; + assert_eq!( + properties.property(state, BlockProperty::Liquid)?, + properties.bind(BlockProperty::Liquid).contains(state) + ); + assert_eq!( + properties.property(state, BlockProperty::SolidRender)?, + properties.bind(BlockProperty::SolidRender).contains(state) + ); + match collisions.cached_shape(state)? { + None => writeln!(out, "cache none")?, + Some(shape) => match shape.bounds() { + None => writeln!(out, "cache empty")?, + Some(b) => { + let v = [ + b.min(Axis::X), + b.min(Axis::Y), + b.min(Axis::Z), + b.max(Axis::X), + b.max(Axis::Y), + b.max(Axis::Z), + ] + .map(f64::to_bits); + writeln!( + out, + "cache {:016x} {:016x} {:016x} {:016x} {:016x} {:016x}", + v[0], v[1], v[2], v[3], v[4], v[5] + )?; + } + }, + } + } + assert!( + properties + .property(BlockStateId(registry.len() as u32), BlockProperty::Solid) + .is_err() + ); + for (name, value) in [ + ("DataVersion", Tag::Int(0)), + ("states", Tag::List(vec![])), + ("blocks", Tag::compound([] as [(&str, Tag); 0])), + ("occlusion", Tag::compound([] as [(&str, Tag); 0])), + ] { + let mut bad = data.clone(); + *bad.get_mut(name).unwrap() = value; + assert!(BlockPropertiesRegistry::from_nbt(&bad, &collisions).is_err()); + } + for flags in [-1, 32] { + let mut bad = data.clone(); + *bad.get_mut("blocks") + .unwrap() + .get_mut("minecraft:stone") + .unwrap() = Tag::Byte(flags); + assert!(BlockPropertiesRegistry::from_nbt(&bad, &collisions).is_err()); + } + let mut bad = data.clone(); + let Some(Tag::List(states)) = bad.get_mut("states") else { + unreachable!() + }; + states.swap(0, 1); + assert!(BlockPropertiesRegistry::from_nbt(&bad, &collisions).is_err()); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut shape = VoxelShape::empty(); + for v in f["shape"].as_array().unwrap() { + shape = shape.join(&VoxelShape::from_box(bbox(v))?, ShapeOp::OR)?; + } + let properties = BlockDefinitionProperties { + force_solid_on: f["on"].as_bool().unwrap(), + force_solid_off: f["off"].as_bool().unwrap(), + replaceable: false, + liquid: false, + can_occlude: f["occludes"].as_bool().unwrap(), + }; + writeln!( + out, + "solid {}", + properties.calculate_solid(f["cached"].as_bool().unwrap().then_some(&shape)) + )?; + writeln!(out, "render {}", properties.calculate_solid_render(&shape)?)?; + } + Ok(()) +} diff --git a/crates/horizon-world/examples/block_state_codec_fixture.rs b/crates/horizon-world/examples/block_state_codec_fixture.rs new file mode 100644 index 000000000..d0632ae86 --- /dev/null +++ b/crates/horizon-world/examples/block_state_codec_fixture.rs @@ -0,0 +1,70 @@ +//! Original JSON block-state codec comparison transport. +use horizon_world::{ + DATA_VERSION, + nbt::Tag, + registry::{BlockRegistry, BlockStateId, BlockStateJsonCodec}, +}; +use serde_json::Value; +use std::{ + collections::BTreeSet, + fs, + io::{self, Write}, + path::Path, +}; +fn tag(v: &Value) -> Tag { + match v { + Value::String(s) => Tag::String(s.as_str().into()), + Value::Number(n) => Tag::Int(n.as_i64().unwrap() as i32), + Value::Array(a) => Tag::List(a.iter().map(tag).collect()), + Value::Object(m) => { + Tag::Compound(m.iter().map(|(k, v)| (k.as_str().into(), tag(v))).collect()) + } + _ => panic!("invalid registry metadata"), + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let facts: Value = serde_json::from_str(&fs::read_to_string(dir.join("facts-server.json"))?)?; + let registry = BlockRegistry::from_nbt(&Tag::compound([ + ("DataVersion", Tag::Int(DATA_VERSION)), + ("states", tag(&facts["states"])), + ("defaults", tag(&facts["defaults"])), + ]))?; + let integers: BTreeSet<_> = facts["integers"] + .as_array() + .unwrap() + .iter() + .map(|v| { + ( + v[0].as_str().unwrap().to_owned(), + v[1].as_str().unwrap().to_owned(), + ) + }) + .collect(); + let codec = BlockStateJsonCodec::new(®istry, integers)?; + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for i in 0..registry.len() { + let id = BlockStateId(i as u32); + writeln!( + out, + "state {i} {} {}", + codec.encode(id, false)?, + codec.encode(id, true)? + )?; + } + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let input: Value = serde_json::from_str(line)?; + match codec.decode(input[1].as_str().unwrap(), input[0].as_bool().unwrap()) { + Err(_) => writeln!(out, "decode error")?, + Ok(id) => writeln!( + out, + "decode {} {} {}", + id.0, + codec.encode(id, false)?, + codec.encode(id, true)? + )?, + } + } + Ok(()) +} diff --git a/crates/horizon-world/examples/block_support_fixture.rs b/crates/horizon-world/examples/block_support_fixture.rs new file mode 100644 index 000000000..9c43d5798 --- /dev/null +++ b/crates/horizon-world/examples/block_support_fixture.rs @@ -0,0 +1,69 @@ +use horizon_core::geometry::Direction; +use horizon_world::{ + block_support::{CachedBlockSupportRegistry, SupportType}, + nbt::{self, Limits, Tag}, + registry::{BlockRegistry, BlockStateId}, +}; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let read = |name: &str| -> Result> { + Ok( + nbt::read_named(&fs::read(dir.join(name))?, Limits::default())? + .0 + .tag, + ) + }; + let registry = BlockRegistry::from_nbt(&read("block-registry.nbt")?)?; + let tag = read("cached-support.nbt")?; + let support = CachedBlockSupportRegistry::from_nbt(&tag, ®istry)?; + assert_eq!(registry.len(), 35723); + assert_eq!(support.cached_state_count(), 35524); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for id in 0..registry.len() { + let state = BlockStateId(id as u32); + if support.cached_shape(state)?.is_none() { + writeln!(out, "state {id} uncached")?; + for d in Direction::ALL { + assert!( + support + .is_face_sturdy(state, d, SupportType::Full)? + .is_none() + ); + } + continue; + } + writeln!(out, "state {id} cached")?; + for d in Direction::ALL { + write!(out, "support {}", d as u8)?; + for t in [SupportType::Full, SupportType::Center, SupportType::Rigid] { + write!(out, " {}", support.is_face_sturdy(state, d, t)?.unwrap())?; + } + writeln!( + out, + " {}", + support + .is_face_sturdy(state, d, SupportType::Full)? + .unwrap() + )?; + } + } + let mut bad = tag.clone(); + *bad.get_mut("Kind").unwrap() = Tag::String("collision".into()); + assert!(CachedBlockSupportRegistry::from_nbt(&bad, ®istry).is_err()); + assert!( + support + .is_face_sturdy( + BlockStateId(registry.len() as u32), + Direction::Down, + SupportType::Full + ) + .is_err() + ); + Ok(()) +} diff --git a/crates/horizon-world/examples/block_survival_fixture.rs b/crates/horizon-world/examples/block_survival_fixture.rs new file mode 100644 index 000000000..e062eb8da --- /dev/null +++ b/crates/horizon-world/examples/block_survival_fixture.rs @@ -0,0 +1,279 @@ +use horizon_core::geometry::VoxelShape; +use horizon_world::{ + block_collision::{BlockCollisionRegistry, DynamicCollisionWorld, ShulkerCollisionState}, + block_properties::BlockPropertiesRegistry, + block_support::BlockSupportRegistry, + block_survival::{BlockSurvivalRegistry, SurvivalDefinitions, SurvivalRule, SurvivalWorld}, + collision::CachedCollisionRegistry, + dynamic_support::DynamicSupportWorld, + fluid::{FluidKind, FluidState, FluidStateTable}, + nbt::{self, Limits, Tag}, + registry::{BlockRegistry, BlockStateId}, + worldgen::tags::TagDefinitions, +}; +use serde_json::Value; +use std::{ + collections::BTreeMap, + fs, + io::{self, BufRead, Write}, + path::Path, + sync::Arc, +}; +struct World<'a, W> { + out: &'a mut W, + neighbors: Vec, + fluids: &'a FluidStateTable, + fluid_states: Vec, + fluid_calls: i32, + fluid_fail: i32, + entity: &'a str, + shulker: ShulkerCollisionState, + reads: i32, + lights: i32, + light_fail: i32, + brightness: i32, + entities: i32, + fail: i32, + entity_fail: i32, +} +impl World<'_, W> { + fn entity(&mut self, p: [i32; 3]) -> io::Result<()> { + writeln!(self.out, "entity {} {} {}", p[0], p[1], p[2])?; + let old = self.entities; + self.entities += 1; + if old == self.entity_fail { + return Err(io::Error::other("injected entity query failure")); + } + Ok(()) + } +} +impl DynamicSupportWorld for World<'_, W> { + type Error = io::Error; + fn shulker_is_closed(&mut self, p: [i32; 3]) -> io::Result> { + self.entity(p)?; + Ok(match self.entity { + "none" => None, + "closed" => Some(true), + "opened" => Some(false), + _ => unreachable!(), + }) + } + fn moving_piston_shape(&mut self, p: [i32; 3]) -> io::Result> { + self.entity(p)?; + Ok(None) + } +} +impl DynamicCollisionWorld for World<'_, W> { + fn shulker_collision_state( + &mut self, + p: [i32; 3], + ) -> io::Result> { + self.entity(p)?; + Ok((self.entity != "none").then_some(self.shulker)) + } +} +impl SurvivalWorld for World<'_, W> { + fn fluid_state(&mut self, p: [i32; 3]) -> io::Result { + writeln!(self.out, "fluid {} {} {}", p[0], p[1], p[2])?; + let old = self.fluid_calls; + self.fluid_calls += 1; + if old == self.fluid_fail { + return Err(io::Error::other("injected fluid query failure")); + } + self.fluids + .get(self.fluid_states[old as usize % self.fluid_states.len()]) + .ok_or_else(|| io::Error::other("unknown fixture fluid state")) + } + fn raw_brightness(&mut self, p: [i32; 3], sky_darken: i32) -> io::Result { + writeln!(self.out, "light {} {} {} {sky_darken}", p[0], p[1], p[2])?; + let old = self.lights; + self.lights += 1; + if old == self.light_fail { + return Err(io::Error::other("injected light query failure")); + } + Ok(self.brightness) + } + fn block_state(&mut self, p: [i32; 3]) -> io::Result { + writeln!(self.out, "read {} {} {}", p[0], p[1], p[2])?; + let old = self.reads; + self.reads += 1; + if old == self.fail { + return Err(io::Error::other("injected block query failure")); + } + Ok(self.neighbors[old as usize % self.neighbors.len()]) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let read = |name: &str| -> Result> { + Ok( + nbt::read_named(&fs::read(dir.join(name))?, Limits::default())? + .0 + .tag, + ) + }; + let registry = BlockRegistry::from_nbt(&read("block-registry.nbt")?)?; + let collisions = CachedCollisionRegistry::from_nbt(&read("cached-collision.nbt")?, ®istry)?; + let properties = + BlockPropertiesRegistry::from_nbt(&read("block-properties.nbt")?, &collisions)?; + let support = Arc::new(BlockSupportRegistry::from_nbt( + &read("cached-support.nbt")?, + ®istry, + )?); + let resources: BTreeMap = + serde_json::from_str(&fs::read_to_string(dir.join("tags.json"))?)?; + let mut tags = TagDefinitions::default(); + for (name, text) in resources { + tags.apply_json(&name, "vanilla", &text)?; + } + let tags = tags.build(|name, _| registry.default_state(name).map(|_| name.to_owned()))?; + assert!(tags.missing.is_empty()); + let definitions: BTreeMap = + serde_json::from_str(&fs::read_to_string(dir.join("survival-rules.json"))?)?; + let definitions = definitions + .into_iter() + .map(|(name, rule)| { + use SurvivalRule::*; + let rule = match rule.as_str() { + value if value.starts_with("TagBelow:") => TagBelow(value[9..].to_owned()), + "CactusFlower" => CactusFlower, + "Seagrass" => Seagrass, + "BubbleColumn" => BubbleColumn, + "RedstoneWire" => RedstoneWire, + "DoublePlant" => DoublePlant, + "Door" => Door, + "BigDripleaf" => BigDripleaf, + "BigDripleafStem" => BigDripleafStem, + "Farmland" => Farmland, + "Cocoa" => Cocoa, + "Crop" => Crop, + "GrowingPlant" => GrowingPlant, + "MangrovePropagule" => MangrovePropagule, + "Speleothem" => Speleothem, + "Scaffolding" => Scaffolding, + "PistonHead" => PistonHead, + "ChorusPlant" => ChorusPlant, + "ChorusFlower" => ChorusFlower, + "PitcherCrop" => PitcherCrop, + "Multiface" => Multiface, + "Vine" => Vine, + "HangingMoss" => HangingMoss, + "SnowLayer" => SnowLayer, + "SeaPickle" => SeaPickle, + "Fire" => Fire, + "Cactus" => Cactus, + "Path" => Path, + "Mushroom" => Mushroom, + "Bell" => Bell, + "SugarCane" => SugarCane, + "LilyPad" => LilyPad, + "Frogspawn" => Frogspawn, + "SporeBlossom" => SporeBlossom, + "SmallDripleaf" => SmallDripleaf, + "TallSeagrass" => TallSeagrass, + "Always" => Always, + "SolidBelow" => SolidBelow, + "SolidBehind" => SolidBehind, + "NonAirBelow" => NonAirBelow, + "MossCarpet" => MossCarpet, + "CenterBelow" => CenterBelow, + "Lantern" => Lantern, + "FullAbove" => FullAbove, + "FullBehind" => FullBehind, + "RigidOrCenterBelow" => RigidOrCenterBelow, + "RigidBelow" => RigidBelow, + "FullBelow" => FullBelow, + "CenterAbove" => CenterAbove, + "FaceAttached" => FaceAttached, + "SupportsBamboo" => SupportsBamboo, + _ => panic!("unknown rule {rule}"), + }; + (name, rule) + }) + .collect(); + let fluid_resources: BTreeMap = + serde_json::from_str(&fs::read_to_string(dir.join("fluid-tags.json"))?)?; + let mut fluid_tags = TagDefinitions::default(); + for (name, text) in fluid_resources { + fluid_tags.apply_json(&name, "vanilla", &text)?; + } + let fluid_tags = + fluid_tags.build(|name, _| FluidKind::from_name(name).map(|_| name.to_owned()))?; + assert!(fluid_tags.missing.is_empty()); + let fluids = FluidStateTable::new(®istry)?; + let collision = Arc::new(BlockCollisionRegistry::new(Arc::new(collisions))?); + let extra: Value = serde_json::from_str(&fs::read_to_string( + dir.join("survival-extra-definitions.json"), + )?)?; + let definitions = SurvivalDefinitions { + rules: definitions, + ignition_odds: serde_json::from_value(extra["ignition_odds"].clone())?, + fence_gates: serde_json::from_value(extra["fence_gates"].clone())?, + }; + let survival = BlockSurvivalRegistry::new( + ®istry, + &properties, + support, + collision, + &definitions, + &tags.tags, + &fluid_tags.tags, + )?; + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in io::BufReader::new(fs::File::open(dir.join("inputs.txt"))?).lines() { + let f: Value = serde_json::from_str(&line?)?; + let mut world = World { + out: &mut out, + fluids: &fluids, + fluid_states: f + .get("fluid_states") + .unwrap_or(&f["neighbors"]) + .as_array() + .unwrap() + .iter() + .map(|v| BlockStateId(v.as_u64().unwrap() as u32)) + .collect(), + fluid_calls: 0, + fluid_fail: f["fluid_fail"].as_i64().unwrap_or(-1) as i32, + neighbors: f["neighbors"] + .as_array() + .unwrap() + .iter() + .map(|v| BlockStateId(v.as_u64().unwrap() as u32)) + .collect(), + entity: f["entity"].as_str().unwrap(), + shulker: ShulkerCollisionState { + previous_progress: f.get("shulker_progress").map_or(0.0, |v| { + f32::from_bits(u32::from_str_radix(v[0].as_str().unwrap(), 16).unwrap()) + }), + progress: f.get("shulker_progress").map_or(0.0, |v| { + f32::from_bits(u32::from_str_radix(v[1].as_str().unwrap(), 16).unwrap()) + }), + }, + reads: 0, + lights: 0, + brightness: f["brightness"].as_i64().unwrap_or(15) as i32, + light_fail: f["light_fail"].as_i64().unwrap_or(-1) as i32, + entities: 0, + fail: f["fail"].as_i64().unwrap() as i32, + entity_fail: f["entity_fail"].as_i64().unwrap() as i32, + }; + let p = std::array::from_fn(|i| f["position"][i].as_i64().unwrap() as i32); + match survival.can_survive( + &mut world, + BlockStateId(f["state"].as_u64().unwrap() as u32), + p, + ) { + Ok(value) => writeln!(world.out, "survive {value}")?, + Err(_) => writeln!(world.out, "survive error")?, + } + writeln!( + world.out, + "counts {} {} {} {}", + world.reads, world.entities, world.lights, world.fluid_calls + )?; + } + out.flush()?; + Ok(()) +} diff --git a/crates/horizon-world/examples/bulk_section_fixture.rs b/crates/horizon-world/examples/bulk_section_fixture.rs new file mode 100644 index 000000000..b9be692a7 --- /dev/null +++ b/crates/horizon-world/examples/bulk_section_fixture.rs @@ -0,0 +1,209 @@ +use horizon_world::worldgen::{ + anchor::WorldGenerationContext, bulk_section::TerrainBulkAccess, feature_region::TerrainRegion, +}; +// Feature chains against a resident multi-chunk region. +use horizon_core::position::ChunkPos; +use horizon_world::{ + DATA_VERSION, + heightmap::{HeightmapState, HeightmapType}, + nbt::Tag, + registry::{BlockRegistry, BlockStateId}, + worldgen::{ + tags::TagDefinitions, + terrain::{PreLightChunkStage, TerrainBlockStates, TerrainChunk}, + }, +}; +use serde_json::Value; +use std::{ + collections::BTreeSet, + fs, + io::{self, Write}, + path::Path, +}; +#[derive(Clone, Copy)] +struct State { + air: bool, + air_block: bool, + fluid: bool, + motion: bool, + no_leaves: bool, +} +impl HeightmapState for State { + fn is_air(self) -> bool { + self.air + } + fn is_air_block(self) -> bool { + self.air_block + } + fn has_fluid(self) -> bool { + self.fluid + } + fn blocks_motion_in_heightmap(self) -> bool { + self.motion + } + fn blocks_motion_in_heightmap_no_leaves(self) -> bool { + self.no_leaves + } +} +struct Properties<'a>(&'a [State]); +impl TerrainBlockStates for Properties<'_> { + type State = State; + fn heightmap_state(&self, id: BlockStateId) -> State { + self.0[id.0 as usize] + } +} +fn n(v: &Value) -> i32 { + v.as_i64().unwrap() as i32 +} +fn tag(v: &Value) -> Tag { + match v { + Value::String(s) => Tag::String(s.as_str().into()), + Value::Number(i) => Tag::Int(i.as_i64().unwrap() as i32), + Value::Object(m) => { + Tag::Compound(m.iter().map(|(k, v)| (k.as_str().into(), tag(v))).collect()) + } + Value::Array(a) => Tag::List(a.iter().map(tag).collect()), + _ => panic!("unsupported registry fixture value"), + } +} +fn fixture( + f: &Value, + registry: &BlockRegistry, + states: &[State], + out: &mut impl Write, +) -> Result<(), Box> { + let minimum = n(&f["min"]); + let height = n(&f["height"]); + let mut chunks = Vec::new(); + for p in f["chunks"].as_array().unwrap() { + let mut chunk = TerrainChunk::new( + ChunkPos::new(n(&p[0]), n(&p[1])), + minimum, + height, + registry, + Properties(states), + )?; + chunk.set_generation_stage(PreLightChunkStage::Terrain); + if f["prime"].as_bool().unwrap() { + chunk.prime_heightmaps(&HeightmapType::ALL)?; + } + chunks.push(chunk); + } + let mut region = TerrainRegion::new(chunks, WorldGenerationContext::new(minimum, height, 0))?; + let mut bulk = TerrainBulkAccess::new(&mut region)?; + for op in f["ops"].as_array().unwrap() { + if op[0].as_str() == Some("reset") { + drop(bulk); + bulk = TerrainBulkAccess::new(&mut region)?; + writeln!(out, "reset")?; + writeln!(out, "cache 0")?; + continue; + } + let result = (|| -> Result<(), Box> { + match op[0].as_str().unwrap() { + "height" => { + let kind = HeightmapType::ALL + .into_iter() + .find(|k| k.name() == op[1].as_str().unwrap()) + .unwrap(); + writeln!(out, "height {}", bulk.height(kind, n(&op[2]), n(&op[3]))?)?; + } + kind => { + let p = [n(&op[1]), n(&op[2]), n(&op[3])]; + match kind { + "get" => writeln!(out, "get {}", bulk.block(p)?.0)?, + "world" => writeln!(out, "world {}", bulk.world_block(p)?.0)?, + "has" => writeln!(out, "has {}", bulk.has_section(p)?)?, + "set" => match bulk.set_block(p, BlockStateId(n(&op[4]) as u32))? { + Some(old) => writeln!(out, "set {}", old.0)?, + None => writeln!(out, "set none")?, + }, + _ => panic!("unknown operation"), + } + } + } + Ok(()) + })(); + if result.is_err() { + writeln!(out, "error")?; + } + writeln!(out, "cache {}", bulk.acquired_section_count())?; + } + drop(bulk); + for chunk in region.chunks() { + writeln!(out, "chunk {} {}", chunk.position().x, chunk.position().z)?; + for kind in HeightmapType::ALL { + if let Some(map) = chunk.heightmap(kind) { + writeln!(out, "map {}", kind.name())?; + for word in map.raw_data() { + writeln!(out, "{word:x}")?; + } + } else { + writeln!(out, "missing {}", kind.name())?; + } + } + for i in 0..height / 16 { + writeln!(out, "section {i}")?; + for index in 0..4096 { + writeln!(out, "{}", chunk.section(i as usize).unwrap().get(index)?.0)?; + } + } + } + Ok(()) +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let facts: Value = serde_json::from_str(&fs::read_to_string(dir.join("facts-server.json"))?)?; + let bundle: Value = serde_json::from_str(&fs::read_to_string(dir.join("tags.json"))?)?; + let registry = BlockRegistry::from_nbt(&Tag::compound([ + ("DataVersion", Tag::Int(DATA_VERSION)), + ( + "states", + Tag::List( + facts["states"] + .as_array() + .unwrap() + .iter() + .map(|s| tag(&s[4])) + .collect(), + ), + ), + ("defaults", tag(&facts["defaults"])), + ]))?; + let mut definitions = TagDefinitions::default(); + for (name, text) in bundle.as_object().unwrap() { + definitions.apply_json(name, "vanilla", text.as_str().unwrap())?; + } + let built = definitions.build(|id, _| facts["defaults"].get(id).map(|_| id.to_owned()))?; + assert!(built.missing.is_empty()); + let motion: BTreeSet<_> = built.tags["minecraft:blocks_motion_in_heightmap"] + .iter() + .map(String::as_str) + .collect(); + let no_leaves: BTreeSet<_> = built.tags["minecraft:blocks_motion_in_heightmap_no_leaves"] + .iter() + .map(String::as_str) + .collect(); + let states: Vec<_> = facts["states"] + .as_array() + .unwrap() + .iter() + .map(|a| { + let name = a[0].as_str().unwrap(); + State { + air: a[1].as_bool().unwrap(), + air_block: name == "minecraft:air", + fluid: a[2].as_bool().unwrap(), + motion: motion.contains(name), + no_leaves: no_leaves.contains(name), + } + }) + .collect(); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + fixture(&serde_json::from_str(line)?, ®istry, &states, &mut out)?; + } + out.flush()?; + Ok(()) +} diff --git a/crates/horizon-world/examples/canyon_carver_fixture.rs b/crates/horizon-world/examples/canyon_carver_fixture.rs new file mode 100644 index 000000000..023ffa356 --- /dev/null +++ b/crates/horizon-world/examples/canyon_carver_fixture.rs @@ -0,0 +1,99 @@ +//! Transport for decoded canyon paths, ordered mask writes and RNG continuation. +use horizon_core::{ + carving::{CarverOutput, CarvingMask}, + position::ChunkPos, + random::{LegacyRandom, RandomSource, XoroshiroRandom}, +}; +use horizon_world::worldgen::{anchor::WorldGenerationContext, carver::CanyonCarver}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn n(v: &Value) -> i32 { + v.as_i64().unwrap() as i32 +} +struct Output<'a, W: Write> { + mask: &'a mut CarvingMask, + out: &'a mut W, + calls: i32, + fail: i32, +} +impl CarverOutput for Output<'_, W> { + type Error = (); + fn min_y(&self) -> i32 { + self.mask.min_y() + } + fn max_y(&self) -> i32 { + self.mask.max_y() + } + fn carve(&mut self, x: i32, y: i32, z: i32) -> Result<(), ()> { + writeln!(self.out, "cell {x} {y} {z}").unwrap(); + let previous = self.calls; + self.calls += 1; + if previous == self.fail { + return Err(()); + } + self.mask.carve(x, y, z).unwrap(); + Ok(()) + } +} +fn fixture( + f: &Value, + mut random: impl RandomSource, + out: &mut impl Write, +) -> Result<(), Box> { + let c = &f["context"]; + let context = WorldGenerationContext::new(n(&c[0]), n(&c[1]), n(&c[2])); + match CanyonCarver::from_json(f["definition"].as_str().unwrap()) { + Ok(carver) => { + writeln!(out, "decode ok")?; + let mut mask = CarvingMask::new(context.min_y + 1, context.min_y + context.height - 8)?; + let target = ChunkPos::new(n(&f["target"][0]), n(&f["target"][1])); + let origin = ChunkPos::new(n(&f["origin"][0]), n(&f["origin"][1])); + for _ in 0..n(&f["repeats"]) { + writeln!(out, "start {}", carver.is_start_chunk(&mut random))?; + let mut output = Output { + mask: &mut mask, + out, + calls: 0, + fail: n(&f["fail"]), + }; + let result = carver.carve(context, &mut random, target, origin, &mut output); + let calls = output.calls; + writeln!( + out, + "carve {} {calls}", + match result { + Ok(true) => "true", + Ok(false) => "false", + Err(_) => "error", + } + )?; + for c in mask.columns() { + writeln!(out, "column {} {} {} {}", c.x, c.z, c.min_y, c.max_y)?; + } + writeln!(out, "next {}", random.next_long())?; + } + } + Err(_) => writeln!(out, "decode error")?, + } + writeln!(out, "tail {}", random.next_long())?; + Ok(()) +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let seed = f["seed"].as_i64().unwrap(); + if f["legacy"].as_bool().unwrap() { + fixture(&f, LegacyRandom::new(seed), &mut out)?; + } else { + fixture(&f, XoroshiroRandom::new(seed), &mut out)?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/examples/carving_geometry_fixture.rs b/crates/horizon-world/examples/carving_geometry_fixture.rs new file mode 100644 index 000000000..1f0ce0ea2 --- /dev/null +++ b/crates/horizon-world/examples/carving_geometry_fixture.rs @@ -0,0 +1,119 @@ +//! Transport for shared cave/canyon geometry and ordered output failures. +use horizon_core::{ + carving::{CarverOutput, CarvingMask, can_reach, carve_ellipsoid}, + position::ChunkPos, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn n(v: &Value) -> i32 { + v.as_i64().unwrap() as i32 +} +fn d(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn bits(v: f64) -> u64 { + if v.is_nan() { + 0x7ff8000000000000 + } else { + v.to_bits() + } +} +struct Output<'a> { + mask: &'a mut CarvingMask, + trace: &'a std::cell::RefCell>, + calls: i32, + fail: i32, +} +impl CarverOutput for Output<'_> { + type Error = (); + fn min_y(&self) -> i32 { + self.mask.min_y() + } + fn max_y(&self) -> i32 { + self.mask.max_y() + } + fn carve(&mut self, x: i32, y: i32, z: i32) -> Result<(), ()> { + self.trace.borrow_mut().push(format!("cell {x} {y} {z}")); + let previous = self.calls; + self.calls += 1; + if previous == self.fail { + return Err(()); + } + self.mask.carve(x, y, z).unwrap(); + Ok(()) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let chunk = ChunkPos::new(n(&f["chunk"][0]), n(&f["chunk"][1])); + let mut mask = CarvingMask::new(n(&f["min"]), n(&f["max"]))?; + for e in f["ellipsoids"].as_array().unwrap() { + let trace = std::cell::RefCell::new(Vec::new()); + let mut output = Output { + mask: &mut mask, + trace: &trace, + calls: 0, + fail: n(&e["fail"]), + }; + let result = carve_ellipsoid( + chunk, + [d(&e["center"][0]), d(&e["center"][1]), d(&e["center"][2])], + d(&e["horizontal"]), + d(&e["vertical"]), + &mut output, + |[x, y, z], by| { + let skip = match n(&e["skip"]) { + 0 => x * x + y * y + z * z >= 1., + 1 => y <= -0.7 || x * x + y * y + z * z >= 1., + 2 => by.rem_euclid(3) == 0, + _ => false, + }; + trace.borrow_mut().push(format!( + "skip {:x} {:x} {:x} {by} {skip}", + bits(x), + bits(y), + bits(z) + )); + skip + }, + ); + let calls = output.calls; + for event in trace.into_inner() { + writeln!(out, "{event}")?; + } + writeln!( + out, + "ellipsoid {} {calls}", + if result.is_ok() { "ok" } else { "error" } + )?; + for c in mask.columns() { + writeln!(out, "column {} {} {} {}", c.x, c.z, c.min_y, c.max_y)?; + } + } + } + for line in fs::read_to_string(dir.join("reach.txt"))?.lines() { + let q: Value = serde_json::from_str(line)?; + let thickness = f32::from_bits(u32::from_str_radix(q[6].as_str().unwrap(), 16)?); + writeln!( + out, + "reach {}", + can_reach( + ChunkPos::new(n(&q[0]), n(&q[1])), + d(&q[2]), + d(&q[3]), + n(&q[4]), + n(&q[5]), + thickness + ) + )?; + } + Ok(()) +} diff --git a/crates/horizon-world/examples/carving_mask_fixture.rs b/crates/horizon-world/examples/carving_mask_fixture.rs new file mode 100644 index 000000000..c7675ce47 --- /dev/null +++ b/crates/horizon-world/examples/carving_mask_fixture.rs @@ -0,0 +1,76 @@ +//! Transport for native carving-mask traversal and callback mutation behavior. +use horizon_core::carving::CarvingMask; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn n(v: &Value) -> i32 { + v.as_i64().unwrap() as i32 +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut mask = CarvingMask::new(n(&f["min"]), n(&f["max"]))?; + writeln!(out, "mask {} {}", mask.min_y(), mask.max_y())?; + for op in f["ops"].as_array().unwrap() { + match op["kind"].as_str().unwrap() { + "carve" => { + let q = &op["pos"]; + let ok = mask.carve(n(&q[0]), n(&q[1]), n(&q[2])).is_ok(); + writeln!(out, "carve {}", if ok { "ok" } else { "error" })?; + } + "fill" => { + let b = &op["box"]; + let mut calls = 0; + for x in n(&b[0])..=n(&b[1]) { + for z in n(&b[4])..=n(&b[5]) { + for y in n(&b[2])..=n(&b[3]) { + mask.carve(x, y, z)?; + calls += 1; + } + } + } + writeln!(out, "fill {calls}")?; + } + "visit" => { + let mut calls = 0; + let result = mask.try_visit_mut(|mask, c| { + writeln!(out, "column {} {} {} {}", c.x, c.z, c.min_y, c.max_y).unwrap(); + let previous = calls; + calls += 1; + if let Some(points) = op["add"].get(previous.to_string()) { + for q in points.as_array().unwrap() { + let ok = mask.carve(n(&q[0]), n(&q[1]), n(&q[2])).is_ok(); + writeln!(out, "add {}", if ok { "ok" } else { "error" }).unwrap(); + } + } + if previous == n(&op["fail"]) { + Err(()) + } else { + Ok(()) + } + }); + writeln!( + out, + "visit {} {calls}", + if result.is_ok() { "ok" } else { "error" } + )?; + } + "read" => { + for c in mask.columns() { + writeln!(out, "column {} {} {} {}", c.x, c.z, c.min_y, c.max_y)?; + } + writeln!(out, "read")?; + } + _ => unreachable!(), + } + writeln!(out, "empty {}", mask.is_empty())?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/examples/cave_carver_fixture.rs b/crates/horizon-world/examples/cave_carver_fixture.rs new file mode 100644 index 000000000..ad0d37612 --- /dev/null +++ b/crates/horizon-world/examples/cave_carver_fixture.rs @@ -0,0 +1,99 @@ +//! Transport for decoded cave paths, ordered mask writes and RNG continuation. +use horizon_core::{ + carving::{CarverOutput, CarvingMask}, + position::ChunkPos, + random::{LegacyRandom, RandomSource, XoroshiroRandom}, +}; +use horizon_world::worldgen::{anchor::WorldGenerationContext, carver::CaveCarver}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn n(v: &Value) -> i32 { + v.as_i64().unwrap() as i32 +} +struct Output<'a, W: Write> { + mask: &'a mut CarvingMask, + out: &'a mut W, + calls: i32, + fail: i32, +} +impl CarverOutput for Output<'_, W> { + type Error = (); + fn min_y(&self) -> i32 { + self.mask.min_y() + } + fn max_y(&self) -> i32 { + self.mask.max_y() + } + fn carve(&mut self, x: i32, y: i32, z: i32) -> Result<(), ()> { + writeln!(self.out, "cell {x} {y} {z}").unwrap(); + let previous = self.calls; + self.calls += 1; + if previous == self.fail { + return Err(()); + } + self.mask.carve(x, y, z).unwrap(); + Ok(()) + } +} +fn fixture( + f: &Value, + mut random: impl RandomSource, + out: &mut impl Write, +) -> Result<(), Box> { + let c = &f["context"]; + let context = WorldGenerationContext::new(n(&c[0]), n(&c[1]), n(&c[2])); + match CaveCarver::from_json(f["definition"].as_str().unwrap()) { + Ok(carver) => { + writeln!(out, "decode ok")?; + let mut mask = CarvingMask::new(context.min_y + 1, context.min_y + context.height - 8)?; + let target = ChunkPos::new(n(&f["target"][0]), n(&f["target"][1])); + let origin = ChunkPos::new(n(&f["origin"][0]), n(&f["origin"][1])); + for _ in 0..n(&f["repeats"]) { + writeln!(out, "start {}", carver.is_start_chunk(&mut random))?; + let mut output = Output { + mask: &mut mask, + out, + calls: 0, + fail: n(&f["fail"]), + }; + let result = carver.carve(context, &mut random, target, origin, &mut output); + let calls = output.calls; + writeln!( + out, + "carve {} {calls}", + match result { + Ok(true) => "true", + Ok(false) => "false", + Err(_) => "error", + } + )?; + for c in mask.columns() { + writeln!(out, "column {} {} {} {}", c.x, c.z, c.min_y, c.max_y)?; + } + writeln!(out, "next {}", random.next_long())?; + } + } + Err(_) => writeln!(out, "decode error")?, + } + writeln!(out, "tail {}", random.next_long())?; + Ok(()) +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let seed = f["seed"].as_i64().unwrap(); + if f["legacy"].as_bool().unwrap() { + fixture(&f, LegacyRandom::new(seed), &mut out)?; + } else { + fixture(&f, XoroshiroRandom::new(seed), &mut out)?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/examples/chunk_stage_fixture.rs b/crates/horizon-world/examples/chunk_stage_fixture.rs new file mode 100644 index 000000000..874b84f5f --- /dev/null +++ b/crates/horizon-world/examples/chunk_stage_fixture.rs @@ -0,0 +1,212 @@ +//! Test transport for pre-light ProtoChunk writes and stage heightmap transitions. +use horizon_core::position::ChunkPos; +use horizon_world::{ + DATA_VERSION, + heightmap::{HeightmapState, HeightmapType}, + nbt::Tag, + registry::{BlockRegistry, BlockStateId}, + worldgen::{ + tags::TagDefinitions, + terrain::{PreLightChunkStage, TerrainBlockStates, TerrainChunk}, + }, +}; +use serde_json::Value; +use std::{ + collections::BTreeSet, + fs, + io::{self, Write}, + path::Path, +}; +#[derive(Clone, Copy)] +struct State { + air: bool, + air_block: bool, + fluid: bool, + motion: bool, + no_leaves: bool, +} +impl HeightmapState for State { + fn is_air(self) -> bool { + self.air + } + fn is_air_block(self) -> bool { + self.air_block + } + fn has_fluid(self) -> bool { + self.fluid + } + fn blocks_motion_in_heightmap(self) -> bool { + self.motion + } + fn blocks_motion_in_heightmap_no_leaves(self) -> bool { + self.no_leaves + } +} +struct Properties<'a>(&'a [State]); +impl TerrainBlockStates for Properties<'_> { + type State = State; + fn heightmap_state(&self, id: BlockStateId) -> State { + self.0[id.0 as usize] + } +} +fn n(v: &Value) -> i32 { + v.as_i64().unwrap() as i32 +} +fn tag(v: &Value) -> Tag { + match v { + Value::String(s) => Tag::String(s.as_str().into()), + Value::Number(i) => Tag::Int(i.as_i64().unwrap() as i32), + Value::Object(m) => { + Tag::Compound(m.iter().map(|(k, v)| (k.as_str().into(), tag(v))).collect()) + } + Value::Array(a) => Tag::List(a.iter().map(tag).collect()), + _ => panic!("unsupported registry fixture value"), + } +} +fn fixture( + f: &Value, + registry: &BlockRegistry, + states: &[State], + out: &mut impl Write, +) -> Result<(), Box> { + let mut chunk = TerrainChunk::new( + ChunkPos::new(n(&f["chunk"][0]), n(&f["chunk"][1])), + n(&f["min"]), + n(&f["height"]), + registry, + Properties(states), + )?; + writeln!( + out, + "chunk {} {} {} {}", + n(&f["chunk"][0]), + n(&f["chunk"][1]), + chunk.min_y(), + chunk.height() + )?; + for op in f["ops"].as_array().unwrap() { + match op[0].as_str().unwrap() { + "stage" => { + let stage = PreLightChunkStage::ALL + .into_iter() + .find(|s| s.name() == op[1].as_str().unwrap()) + .unwrap(); + chunk.set_generation_stage(stage); + writeln!(out, "stage {}", chunk.generation_stage().name())?; + } + "set" => { + let previous = chunk.set_block_worldgen( + n(&op[1]), + n(&op[2]), + n(&op[3]), + BlockStateId(n(&op[4]) as u32), + )?; + writeln!(out, "set {}", previous.0)?; + } + "get" => writeln!( + out, + "get {}", + chunk.block(n(&op[1]), n(&op[2]), n(&op[3])).0 + )?, + "prime" => { + let kinds: Vec<_> = HeightmapType::ALL + .into_iter() + .enumerate() + .filter_map(|(i, k)| (n(&op[1]) & (1 << i) != 0).then_some(k)) + .collect(); + chunk.prime_heightmaps(&kinds)?; + writeln!(out, "prime {}", n(&op[1]))?; + } + "query" => { + for kind in HeightmapType::ALL { + if let Some(map) = chunk.heightmap(kind) { + writeln!( + out, + "height {} {}", + kind.name(), + map.first_available(n(&op[1]) & 15, n(&op[2]) & 15)? + )?; + } else { + writeln!(out, "missing {}", kind.name())?; + } + } + } + "dump" => { + for kind in HeightmapType::ALL { + if let Some(map) = chunk.heightmap(kind) { + writeln!(out, "map {}", kind.name())?; + for word in map.raw_data() { + writeln!(out, "{word:x}")?; + } + } else { + writeln!(out, "missing {}", kind.name())?; + } + } + for i in 0..chunk.height() / 16 { + writeln!(out, "section {i}")?; + for index in 0..4096 { + writeln!(out, "{}", chunk.section(i as usize).unwrap().get(index)?.0)?; + } + } + } + _ => panic!("unknown operation"), + } + } + Ok(()) +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let facts: Value = serde_json::from_str(&fs::read_to_string(dir.join("facts-server.json"))?)?; + let bundle: Value = serde_json::from_str(&fs::read_to_string(dir.join("tags.json"))?)?; + let registry = BlockRegistry::from_nbt(&Tag::compound([ + ("DataVersion", Tag::Int(DATA_VERSION)), + ( + "states", + Tag::List( + facts["states"] + .as_array() + .unwrap() + .iter() + .map(|s| tag(&s[4])) + .collect(), + ), + ), + ("defaults", tag(&facts["defaults"])), + ]))?; + let mut definitions = TagDefinitions::default(); + for (name, text) in bundle.as_object().unwrap() { + definitions.apply_json(name, "vanilla", text.as_str().unwrap())?; + } + let built = definitions.build(|id, _| facts["defaults"].get(id).map(|_| id.to_owned()))?; + assert!(built.missing.is_empty()); + let motion: BTreeSet<_> = built.tags["minecraft:blocks_motion_in_heightmap"] + .iter() + .map(String::as_str) + .collect(); + let no_leaves: BTreeSet<_> = built.tags["minecraft:blocks_motion_in_heightmap_no_leaves"] + .iter() + .map(String::as_str) + .collect(); + let states: Vec<_> = facts["states"] + .as_array() + .unwrap() + .iter() + .map(|a| { + let name = a[0].as_str().unwrap(); + State { + air: a[1].as_bool().unwrap(), + air_block: name == "minecraft:air", + fluid: a[2].as_bool().unwrap(), + motion: motion.contains(name), + no_leaves: no_leaves.contains(name), + } + }) + .collect(); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + fixture(&serde_json::from_str(line)?, ®istry, &states, &mut out)?; + } + out.flush()?; + Ok(()) +} diff --git a/crates/horizon-world/examples/collision_fixture.rs b/crates/horizon-world/examples/collision_fixture.rs new file mode 100644 index 000000000..95c7ad73c --- /dev/null +++ b/crates/horizon-world/examples/collision_fixture.rs @@ -0,0 +1,199 @@ +//! Queries imported cached shapes through resident section state IDs. +use horizon_core::{ + geometry::{Aabb, Axis, Vec3}, + position::BlockPos, +}; +use horizon_world::{ + chunk::BlockSection, + collision::CachedCollisionRegistry, + nbt::{self, Limits, Tag}, + registry::{BlockRegistry, BlockStateId}, +}; +use std::{ + error::Error, + fs, + io::{BufRead, Write}, + path::PathBuf, +}; + +fn bits(value: f64) -> u64 { + if value.is_nan() { + 0x7ff8_0000_0000_0000 + } else { + value.to_bits() + } +} +fn values( + out: &mut impl Write, + label: &str, + numbers: impl IntoIterator, +) -> std::io::Result<()> { + write!(out, "{label}")?; + for value in numbers { + write!(out, " {:016x}", bits(value))?; + } + writeln!(out) +} +fn box_values(out: &mut impl Write, label: &str, b: Aabb) -> std::io::Result<()> { + values( + out, + label, + b.min_position() + .components() + .into_iter() + .chain(b.max_position().components()), + ) +} +struct Input<'a>(std::str::SplitWhitespace<'a>); +impl Input<'_> { + fn integer(&mut self) -> i32 { + self.0.next().unwrap().parse().unwrap() + } + fn number(&mut self) -> f64 { + f64::from_bits(u64::from_str_radix(self.0.next().unwrap(), 16).unwrap()) + } + fn vector(&mut self) -> Vec3 { + Vec3::new(self.number(), self.number(), self.number()) + } +} +fn main() -> Result<(), Box> { + let base = PathBuf::from( + std::env::args() + .nth(1) + .ok_or("fixture directory required")?, + ); + let (registry_root, _) = nbt::read_named( + &fs::read(base.join("block-registry.nbt"))?, + Limits::default(), + )?; + let registry = BlockRegistry::from_nbt(®istry_root.tag)?; + let (root, _) = nbt::read_named( + &fs::read(base.join("cached-collision.nbt"))?, + Limits::default(), + )?; + let collisions = CachedCollisionRegistry::from_nbt(&root.tag, ®istry)?; + let mut section = BlockSection::uniform(BlockStateId(0), ®istry)?; + let mut out = std::io::BufWriter::new(fs::File::create(base.join("rust.txt"))?); + let mut identities = std::collections::HashMap::new(); + for id in 0..registry.len() { + let index = id % 4096; + section.set(index, BlockStateId(id as u32))?; + match collisions.section_shape(§ion, index)? { + None => writeln!(out, "state {id} uncached")?, + Some(shape) => { + writeln!(out, "state {id} cached {}", shape.boxes().len())?; + let count = identities.len(); + let identity = *identities.entry(std::ptr::from_ref(shape)).or_insert(count); + writeln!(out, "identity {identity}")?; + let flags = shape.cube_coordinate_axes(); + writeln!( + out, + "cube {} {}", + u8::from(shape.is_cube()), + u8::from(flags[0]) + 2 * u8::from(flags[1]) + 4 * u8::from(flags[2]) + )?; + values( + &mut out, + "axis-extrema", + Axis::ALL + .map(|axis| shape.min(axis)) + .into_iter() + .chain(Axis::ALL.map(|axis| shape.max(axis))), + )?; + if let Some(b) = shape.bounds() { + box_values(&mut out, "bounds", b)?; + } else { + writeln!(out, "bounds none")?; + } + for b in shape.boxes() { + box_values(&mut out, "part", *b)?; + } + } + } + } + let other_registry = BlockRegistry::from_nbt(®istry_root.tag)?; + let other_section = BlockSection::uniform(BlockStateId(0), &other_registry)?; + assert!(collisions.section_shape(&other_section, 0).is_err()); + assert!( + collisions + .cached_shape(BlockStateId(registry.len() as u32)) + .is_err() + ); + assert!(collisions.section_shape(§ion, 4096).is_err()); + // Import failures must not create a usable partial collision registry. + let mut corrupt = root.tag.clone(); + *corrupt.get_mut("DataVersion").unwrap() = Tag::Int(0); + assert!(CachedCollisionRegistry::from_nbt(&corrupt, ®istry).is_err()); + let mut corrupt = root.tag.clone(); + let Some(Tag::IntArray(mapping)) = corrupt.get_mut("cached_shapes") else { + unreachable!() + }; + mapping[0] = -2; + assert!(CachedCollisionRegistry::from_nbt(&corrupt, ®istry).is_err()); + let mut corrupt = root.tag.clone(); + let Some(Tag::List(states)) = corrupt.get_mut("states") else { + unreachable!() + }; + states.swap(0, 1); + assert!(CachedCollisionRegistry::from_nbt(&corrupt, ®istry).is_err()); + let mut count = 0; + for line in std::io::BufReader::new(fs::File::open(base.join("inputs.txt"))?).lines() { + let line = line?; + let mut input = Input(line.split_whitespace()); + let id = input.integer(); + let block = BlockPos::new(input.integer(), input.integer(), input.integer()); + let b = Aabb::new(input.vector(), input.vector()); + let start = input.vector(); + let end = input.vector(); + let point = input.vector(); + let amount = input.number(); + section.set(count % 4096, BlockStateId(id as u32))?; + let shape = collisions + .section_shape(§ion, count % 4096)? + .ok_or("query used uncached state")?; + let moved = shape.moved(Vec3::from_block(block)); + values( + &mut out, + "collide", + Axis::ALL.map(|axis| moved.collide(axis, b, amount)), + )?; + if let Some(h) = shape.clip(start, end, block) { + writeln!( + out, + "hit {} {} {:016x} {:016x} {:016x}", + h.direction as u8, + u8::from(h.inside), + bits(h.location.x), + bits(h.location.y), + bits(h.location.z) + )?; + } else { + writeln!(out, "hit none")?; + } + if let Some(p) = moved.closest_point(point) { + values(&mut out, "closest", p.components())?; + } else { + writeln!(out, "closest none")?; + } + writeln!( + out, + "index {} {} {}", + moved.find_index(Axis::X, point.x), + moved.find_index(Axis::Y, point.y), + moved.find_index(Axis::Z, point.z) + )?; + assert!(input.0.next().is_none()); + count += 1; + } + out.flush()?; + println!( + "HORIZON_COLLISION_RESULT {{\"registry_states\":{},\"cached_states\":{},\"uncached_states\":{},\"unique_shapes\":{},\"unique_grids\":{},\"queries\":{}}}", + registry.len(), + collisions.cached_state_count(), + registry.len() - collisions.cached_state_count(), + collisions.shape_count(), + collisions.unique_grid_count(), + count + ); + Ok(()) +} diff --git a/crates/horizon-world/examples/decoration_fixture.rs b/crates/horizon-world/examples/decoration_fixture.rs new file mode 100644 index 000000000..57c33d24b --- /dev/null +++ b/crates/horizon-world/examples/decoration_fixture.rs @@ -0,0 +1,211 @@ +use horizon_core::{position::ChunkPos, random::RandomSource}; +use horizon_world::{ + heightmap::HeightmapType, + worldgen::{ + anchor::WorldGenerationContext, + decoration::{DecorationBiome, DecorationWorld, FeatureDecorationPlan}, + feature_sort::FeatureIdentity, + placement::{PlacementContext, PlacementModifier, PlacementQueryError}, + }, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn n(v: &Value) -> i32 { + v.as_i64().unwrap() as i32 +} +struct World<'a, W> { + f: &'a Value, + out: &'a mut W, + biomes: &'a [Vec>], + calls: i32, + queries: i32, + notifications: i32, + chunks_read: i32, +} +impl DecorationWorld for World<'_, W> { + type Error = (); + fn min_section_y(&mut self) -> Result { + Ok(n(&self.f["min"]) >> 4) + } + fn chunk_biomes(&mut self, chunk: ChunkPos) -> Result, ()> { + writeln!(self.out, "chunk {} {}", chunk.x, chunk.z).map_err(|_| ())?; + let call = self.chunks_read; + self.chunks_read += 1; + if call == n(&self.f["chunk_fail"]) { + return Err(()); + } + let dx = chunk.x.wrapping_sub(n(&self.f["cx"])); + let dz = chunk.z.wrapping_sub(n(&self.f["cz"])); + let values = self.f["palettes"][((dz + 1) * 3 + dx + 1) as usize] + .as_array() + .unwrap(); + // The native fixture fills every quart cell from this repeating sequence. + // Only cells actually present in the chunk count as resident biomes. + Ok((0..n(&self.f["height"]) * 4) + .map(|i| DecorationBiome(n(&values[i as usize % values.len()]) as u32)) + .collect()) + } + fn set_currently_generating(&mut self, feature: Option) -> Result<(), ()> { + match feature { + Some(id) => writeln!( + self.out, + "generating ResourceKey[minecraft:worldgen/placed_feature / horizon:f{}]", + id.0 + ), + None => writeln!(self.out, "generating none"), + } + .map_err(|_| ())?; + let call = self.notifications; + self.notifications += 1; + if call == n(&self.f["notify_fail"]) { + Err(()) + } else { + Ok(()) + } + } +} +impl PlacementContext for World<'_, W> { + fn generation(&self) -> WorldGenerationContext { + WorldGenerationContext::new(-64, 384, 63) + } + fn min_y(&mut self) -> Result { + Ok(n(&self.f["min"])) + } + fn height(&mut self, _: HeightmapType, _: i32, _: i32) -> Result { + Err(PlacementQueryError::Unavailable) + } + fn biome_allows_feature( + &mut self, + p: [i32; 3], + feature: FeatureIdentity, + ) -> Result { + let index = p[0] + .wrapping_mul(31) + .wrapping_add(p[1].wrapping_mul(7)) + .wrapping_add(p[2].wrapping_mul(17)) + .wrapping_add(n(&self.f["biome_offset"])) + .rem_euclid(self.biomes.len() as i32 + 1) as usize; + writeln!(self.out, "biome {} {} {} {}", p[0], p[1], p[2], index) + .map_err(|e| PlacementQueryError::Failed(e.to_string()))?; + let call = self.queries; + self.queries += 1; + if call == n(&self.f["query_fail"]) { + return Err(PlacementQueryError::Unavailable); + } + Ok(self + .biomes + .get(index) + .is_some_and(|steps| steps.iter().flatten().any(|id| *id == feature))) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let biomes = f["biomes"] + .as_array() + .unwrap() + .iter() + .map(|b| { + b.as_array() + .unwrap() + .iter() + .map(|s| { + s.as_array() + .unwrap() + .iter() + .map(|id| FeatureIdentity(n(id) as u32)) + .collect::>() + }) + .collect::>() + }) + .collect::>(); + let plan = FeatureDecorationPlan::new( + biomes + .iter() + .enumerate() + .map(|(i, b)| (DecorationBiome(i as u32), b.clone())) + .collect(), + ); + let Ok(plan) = plan else { + writeln!(out, "plan error")?; + continue; + }; + writeln!(out, "plan ok")?; + let placements = f["placements"] + .as_array() + .unwrap() + .iter() + .map(|p| { + p.as_array() + .unwrap() + .iter() + .map(|m| PlacementModifier::from_json(&m.to_string())) + .collect::, _>>() + }) + .collect::, _>>()?; + let mut world = World { + f: &f, + out: &mut out, + biomes: &biomes, + calls: 0, + queries: 0, + notifications: 0, + chunks_read: 0, + }; + for _ in 0..2 { + world.calls = 0; + world.queries = 0; + world.notifications = 0; + world.chunks_read = 0; + let result = plan.decorate_features( + &mut world, + ChunkPos::new(n(&f["cx"]), n(&f["cz"])), + f["seed"].as_i64().unwrap(), + |w, placer, rng, id, origin| { + placer + .place_with_biome_check( + &placements[id.0 as usize], + w, + rng, + origin, + id, + |w, r, p| { + writeln!(w.out, "feature {} {} {} {}", id.0, p[0], p[1], p[2]) + .map_err(|_| ())?; + writeln!( + w.out, + "draw {} {} {:x} {:x}", + r.next_long(), + r.next_int_bound(17).unwrap(), + r.next_float().to_bits(), + r.next_double().to_bits() + ) + .map_err(|_| ())?; + let call = w.calls; + w.calls += 1; + if call == n(&w.f["feature_fail"]) { + return Err(()); + } + Ok(n(&w.f["return_mode"]) == 0 + || (n(&w.f["return_mode"]) == 2 && id.0 % 2 == 0)) + }, + ) + .map_err(|_| ()) + }, + ); + writeln!( + world.out, + "decorate {}", + if result.is_ok() { "ok" } else { "error" } + )?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/examples/decoration_region_fixture.rs b/crates/horizon-world/examples/decoration_region_fixture.rs new file mode 100644 index 000000000..db1fb4206 --- /dev/null +++ b/crates/horizon-world/examples/decoration_region_fixture.rs @@ -0,0 +1,304 @@ +#[path = "support/decoration_storage.rs"] +mod storage; +use horizon_core::{ + biome::obfuscate_seed, + position::{BlockPos, ChunkPos}, +}; +use horizon_world::{ + heightmap::HeightmapType, + registry::{BlockRegistry, BlockStateId}, + worldgen::{ + anchor::WorldGenerationContext, + biome_chunk::{BiomeChunk, BiomeRegion}, + biome_predicate::BiomePredicateBindings, + block_feature::FeatureBlockBindings, + decoration::{DecorationBiome, DecorationWorld, FeatureDecorationPlan}, + feature::{FeatureBlocks, FeatureWorld}, + feature_graph::FeatureDefinition, + feature_region::TerrainRegion, + feature_sort::FeatureIdentity, + placement::{LayerBlock, PlacementContext, PlacementModifier, PlacementQueryError}, + terrain::{PreLightChunkStage, TerrainChunk}, + }, +}; +use serde_json::Value; +use std::{ + collections::{BTreeMap, BTreeSet}, + fs, + io::{self, Write}, + path::Path, + sync::Arc, +}; +use storage::{Properties, State}; +fn n(v: &Value) -> i32 { + v.as_i64().unwrap() as i32 +} +struct World<'a, W> { + out: &'a mut W, + f: &'a Value, + region: TerrainRegion<'a, Properties<'a>>, + biomes: BiomeRegion, + settings: Vec>>, + writes: i32, +} +impl DecorationWorld for World<'_, W> { + type Error = (); + fn min_section_y(&mut self) -> Result { + Ok(n(&self.f["min"]) >> 4) + } + fn chunk_biomes(&mut self, p: ChunkPos) -> Result, ()> { + writeln!(self.out, "chunk {} {}", p.x, p.z).map_err(|_| ())?; + self.biomes.present_in_chunk(p).map_err(|_| ()) + } + fn set_currently_generating(&mut self, feature: Option) -> Result<(), ()> { + match feature { + Some(id) => writeln!( + self.out, + "generating ResourceKey[minecraft:worldgen/placed_feature / horizon:f{}]", + id.0 + ), + None => writeln!(self.out, "generating none"), + } + .map_err(|_| ()) + } +} +impl FeatureWorld for World<'_, W> { + type Error = (); + fn block(&mut self, p: [i32; 3]) -> Result { + self.region.block(p).map_err(|_| ()) + } + fn set_block(&mut self, p: [i32; 3], state: BlockStateId, flags: i32) -> Result { + writeln!( + self.out, + "write {} {} {} {} {flags}", + p[0], p[1], p[2], state.0 + ) + .map_err(|_| ())?; + let call = self.writes; + self.writes += 1; + if call == n(&self.f["write_fail"]) { + return Err(()); + } + let reject = n(&self.f["reject"]); + let result = reject == 0 || call % reject != 0; + if result { + self.region.set_block_worldgen(p, state).map_err(|_| ())?; + } + writeln!(self.out, "written {result}").map_err(|_| ())?; + Ok(result) + } +} +impl PlacementContext for World<'_, W> { + fn biome_identity(&mut self, p: [i32; 3]) -> Result { + let id = *self + .region + .biome_at(&self.biomes, BlockPos::new(p[0], p[1], p[2])) + .map_err(|e| PlacementQueryError::Failed(e.to_string()))?; + writeln!(self.out, "biome {} {} {} {}", p[0], p[1], p[2], id.0) + .map_err(|e| PlacementQueryError::Failed(e.to_string()))?; + Ok(id) + } + fn generation(&self) -> WorldGenerationContext { + self.region.generation() + } + fn min_y(&mut self) -> Result { + self.region.min_y() + } + fn max_y(&mut self) -> Result { + self.region.max_y() + } + fn height(&mut self, kind: HeightmapType, x: i32, z: i32) -> Result { + self.region.height(kind, x, z) + } + fn layer_block(&mut self, p: [i32; 3]) -> Result { + self.region.layer_block(p) + } + fn biome_allows_feature( + &mut self, + p: [i32; 3], + feature: FeatureIdentity, + ) -> Result { + let id = self.biome_identity(p)?; + Ok(self + .settings + .get(id.0 as usize) + .is_some_and(|b| b.iter().flatten().any(|v| *v == feature))) + } +} +fn fixture( + f: &Value, + registry: &BlockRegistry, + states: &[State], + out: &mut impl Write, +) -> Result<(), Box> { + let settings = f["biomes"] + .as_array() + .unwrap() + .iter() + .map(|b| { + b.as_array() + .unwrap() + .iter() + .map(|s| { + s.as_array() + .unwrap() + .iter() + .map(|id| FeatureIdentity(n(id) as u32)) + .collect::>() + }) + .collect::>() + }) + .collect::>(); + let plan = FeatureDecorationPlan::new( + settings + .iter() + .enumerate() + .map(|(i, b)| (DecorationBiome(i as u32), b.clone())) + .collect(), + )?; + writeln!(out, "plan ok")?; + let names = (0..=settings.len()) + .map(|i| (format!("horizon:b{i}"), DecorationBiome(i as u32))) + .collect::>(); + let biomes = Arc::new(BiomePredicateBindings::new(&names, &BTreeMap::new())?); + let bindings = FeatureBlockBindings::new(registry, BTreeSet::new())?.with_biomes(biomes); + let features = f["features"] + .as_array() + .unwrap() + .iter() + .map(|v| FeatureDefinition::from_json_with_blocks(&v.to_string(), &bindings)) + .collect::, _>>()?; + let placements = f["placements"] + .as_array() + .unwrap() + .iter() + .map(|p| { + p.as_array() + .unwrap() + .iter() + .map(|m| PlacementModifier::from_json_with_blocks(&m.to_string(), &bindings)) + .collect::, _>>() + }) + .collect::, _>>()?; + let blocks = FeatureBlocks::from_registry(registry)?; + let min = n(&f["min"]); + let height = n(&f["height"]); + let cp = ChunkPos::new(n(&f["cx"]), n(&f["cz"])); + let stage = PreLightChunkStage::ALL + .into_iter() + .find(|s| s.name() == f["stage"].as_str().unwrap()) + .unwrap(); + let mut chunks = Vec::new(); + let mut biome_chunks = Vec::new(); + for dz in -1..=1 { + for dx in -1..=1 { + let p = ChunkPos::new(cp.x + dx, cp.z + dz); + let mut chunk = TerrainChunk::new(p, min, height, registry, Properties(states))?; + chunk.set_generation_stage(stage); + for x in 0..16 { + for z in 0..16 { + chunk.set_block_worldgen( + (p.x << 4) + x, + -56, + (p.z << 4) + z, + registry.default_state("minecraft:stone").unwrap(), + )?; + if (x + z) % 3 != 0 { + chunk.set_block_worldgen( + (p.x << 4) + x, + -48, + (p.z << 4) + z, + registry.default_state("minecraft:dirt").unwrap(), + )?; + } + } + } + chunks.push(chunk); + let values = f["palettes"][((dz + 1) * 3 + dx + 1) as usize] + .as_array() + .unwrap(); + let mut biomes = + BiomeChunk::new(p, min, height, DecorationBiome(settings.len() as u32))?; + biomes.fill(min, min + height - 1, |[x, y, z]| { + let index = ((y - (min >> 2)) * 16 + (z & 3) * 4 + (x & 3)) + .rem_euclid(values.len() as i32) as usize; + Ok::<_, std::convert::Infallible>(DecorationBiome(n(&values[index]) as u32)) + })?; + biome_chunks.push(biomes); + } + } + let mut world = World { + out, + f, + region: TerrainRegion::new(chunks, WorldGenerationContext::new(-64, 384, 63))?, + biomes: BiomeRegion::new(biome_chunks, obfuscate_seed(f["seed"].as_i64().unwrap()))?, + settings, + writes: 0, + }; + for _ in 0..2 { + world.writes = 0; + let result = plan.decorate_features( + &mut world, + cp, + f["seed"].as_i64().unwrap(), + |w, placer, rng, id, origin| { + placer + .place_with_biome_check( + &placements[id.0 as usize], + w, + rng, + origin, + id, + |w, r, p| features[id.0 as usize].place(w, r, p, blocks), + ) + .map_err(|_| ()) + }, + ); + writeln!( + world.out, + "decorate {}", + if result.is_ok() { "ok" } else { "error" } + )?; + for [x, z] in [[0, 0], [15, 15], [16, 16], [-1, -1]] { + for kind in HeightmapType::ALL { + writeln!( + world.out, + "height {} {x} {z} {}", + kind.name(), + world.region.height(kind, x, z)? + )?; + } + } + } + for chunk in world.region.chunks() { + let p = chunk.position(); + writeln!(world.out, "stored {} {}", p.x, p.z)?; + for kind in HeightmapType::ALL { + if let Some(map) = chunk.heightmap(kind) { + writeln!(world.out, "map {}", kind.name())?; + for word in map.raw_data() { + writeln!(world.out, "{word:x}")?; + } + } else { + writeln!(world.out, "missing {}", kind.name())?; + } + } + for i in 0..height as usize / 16 { + writeln!(world.out, "section {i}")?; + for index in 0..4096 { + writeln!(world.out, "{}", chunk.section(i).unwrap().get(index)?.0)?; + } + } + } + Ok(()) +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let (registry, states) = storage::load(dir)?; + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + fixture(&serde_json::from_str(line)?, ®istry, &states, &mut out)?; + } + Ok(()) +} diff --git a/crates/horizon-world/examples/dynamic_support_fixture.rs b/crates/horizon-world/examples/dynamic_support_fixture.rs new file mode 100644 index 000000000..a321f97d0 --- /dev/null +++ b/crates/horizon-world/examples/dynamic_support_fixture.rs @@ -0,0 +1,252 @@ +use horizon_core::geometry::{Aabb, Axis, Direction, VoxelShape}; +use horizon_world::{ + block_collision::{DynamicCollisionWorld, ShulkerCollisionState}, + block_support::SupportType, + chunk::BlockState, + collision::CachedCollisionRegistry, + dynamic_support::{DynamicSupport, DynamicSupportWorld}, + nbt::{self, Limits, Tag}, + piston_shape::{MovingPistonState, PistonBlockBindings, PistonCollisionWorld}, + registry::{BlockRegistry, BlockStateId}, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn values( + out: &mut impl Write, + label: &str, + values: impl IntoIterator, +) -> io::Result<()> { + write!(out, "{label}")?; + for v in values { + let bits = if v.is_nan() { + 0x7ff8_0000_0000_0000 + } else { + v.to_bits() + }; + write!(out, " {bits:016x}")?; + } + writeln!(out) +} +fn box_values(out: &mut impl Write, label: &str, b: Aabb) -> io::Result<()> { + values( + out, + label, + [ + b.min(Axis::X), + b.min(Axis::Y), + b.min(Axis::Z), + b.max(Axis::X), + b.max(Axis::Y), + b.max(Axis::Z), + ], + ) +} +fn emit(out: &mut impl Write, shape: &VoxelShape) -> io::Result<()> { + writeln!( + out, + "shape {} {} {}", + shape.is_empty(), + shape.boxes().len(), + shape.is_cube() + )?; + for (axis, name) in Axis::ALL.into_iter().zip(["x", "y", "z"]) { + values(out, name, shape.coordinates(axis).iter().copied())?; + } + let axes = shape.cube_coordinate_axes(); + writeln!( + out, + "axes {}", + u8::from(axes[0]) + 2 * u8::from(axes[1]) + 4 * u8::from(axes[2]) + )?; + values( + out, + "extrema", + Axis::ALL + .map(|a| shape.min(a)) + .into_iter() + .chain(Axis::ALL.map(|a| shape.max(a))), + )?; + match shape.bounds() { + Some(b) => box_values(out, "bounds", b)?, + None => writeln!(out, "bounds none")?, + } + for b in shape.boxes() { + box_values(out, "box", *b)?; + } + Ok(()) +} +struct World<'a, W> { + collisions: &'a CachedCollisionRegistry<'a>, + pistons: &'a PistonBlockBindings<'a>, + dynamic: &'a [Option], + active: Option, + noclip: Option, + out: &'a mut W, + entity: &'a str, + shulker: ShulkerCollisionState, + fail: i32, + calls: i32, +} +impl World<'_, W> { + fn query(&mut self, p: [i32; 3]) -> io::Result<()> { + writeln!(self.out, "entity {} {} {}", p[0], p[1], p[2])?; + let count = self.calls; + self.calls += 1; + if count == self.fail { + return Err(io::Error::other("injected block entity failure")); + } + Ok(()) + } +} +impl DynamicSupportWorld for World<'_, W> { + type Error = io::Error; + fn shulker_is_closed(&mut self, p: [i32; 3]) -> io::Result> { + self.query(p)?; + Ok(match self.entity { + "none" | "other" | "piston" => None, + "closed" => Some(true), + _ => Some(false), + }) + } + fn moving_piston_shape(&mut self, p: [i32; 3]) -> io::Result> { + self.query(p)?; + match self.active { + None => Ok(None), + Some(active) => { + let bindings = self.pistons; + bindings + .collision_shape(self, p, active, self.noclip) + .map(Some) + .map_err(io::Error::other) + } + } + } +} +impl DynamicCollisionWorld for World<'_, W> { + fn shulker_collision_state( + &mut self, + p: [i32; 3], + ) -> io::Result> { + self.query(p)?; + Ok(match self.entity { + "none" | "other" | "piston" => None, + _ => Some(self.shulker), + }) + } +} +impl PistonCollisionWorld for World<'_, W> { + type Error = io::Error; + fn collision_shape(&mut self, state: BlockStateId, p: [i32; 3]) -> io::Result { + if let Some(shape) = self.collisions.cached_shape(state)? { + return Ok(shape.clone()); + } + self.dynamic[state.0 as usize] + .as_ref() + .expect("known empty-context dynamic collision") + .clone() + .collision_shape(self, p) + .map_err(io::Error::other) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let facts: Value = serde_json::from_str(&fs::read_to_string(dir.join("facts.json"))?)?; + let states = facts["states"] + .as_array() + .unwrap() + .iter() + .map(|value| BlockState { + name: value["id"].as_str().unwrap().to_owned(), + properties: value + .get("properties") + .and_then(Value::as_object) + .map(|p| { + p.iter() + .map(|(k, v)| (k.clone(), v.as_str().unwrap().to_owned())) + .collect() + }) + .unwrap_or_default(), + }) + .collect::>(); + let read = |name: &str| -> Result> { + Ok( + nbt::read_named(&fs::read(dir.join(name))?, Limits::default())? + .0 + .tag, + ) + }; + let registry = BlockRegistry::from_nbt(&read("block-registry.nbt")?)?; + let collisions = CachedCollisionRegistry::from_nbt(&read("cached-collision.nbt")?, ®istry)?; + let pistons = PistonBlockBindings::new(®istry)?; + let dynamic = states + .iter() + .map(DynamicSupport::from_state) + .collect::>>()?; + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let support = DynamicSupport::from_state(&states[f["state"].as_u64().unwrap() as usize])? + .ok_or("missing dynamic support selection")?; + let p = std::array::from_fn(|i| f["position"][i].as_i64().unwrap() as i32); + values(&mut out, "offset", support.offset(p).components())?; + let active = f.get("piston").map(|v| MovingPistonState { + moved_state: BlockStateId(v["state"].as_u64().unwrap() as u32), + direction: Direction::ALL[v["direction"].as_u64().unwrap() as usize], + extending: v["extending"].as_bool().unwrap(), + source: v["source"].as_bool().unwrap(), + progress: f32::from_bits( + u32::from_str_radix(v["progress"].as_str().unwrap(), 16).unwrap(), + ), + previous_progress: 0.0, + }); + let clip = f + .get("piston") + .map(|v| v["noclip"].as_i64().unwrap()) + .unwrap_or(-1); + let mut world = World { + collisions: &collisions, + pistons: &pistons, + dynamic: &dynamic, + active, + noclip: (clip >= 0).then(|| Direction::ALL[clip as usize]), + out: &mut out, + entity: f["entity"].as_str().unwrap(), + shulker: ShulkerCollisionState { + previous_progress: f.get("shulker_progress").map_or(0.0, |v| { + f32::from_bits(u32::from_str_radix(v[0].as_str().unwrap(), 16).unwrap()) + }), + progress: f.get("shulker_progress").map_or(0.0, |v| { + f32::from_bits(u32::from_str_radix(v[1].as_str().unwrap(), 16).unwrap()) + }), + }, + calls: 0, + fail: f["fail"].as_i64().unwrap() as i32, + }; + match if f.get("collision").and_then(Value::as_bool).unwrap_or(false) { + support.collision_shape(&mut world, p) + } else { + support.shape(&mut world, p) + } { + Ok(shape) => emit(world.out, &shape)?, + Err(_) => writeln!(world.out, "shape error")?, + } + for direction in Direction::ALL { + for (i, kind) in [SupportType::Full, SupportType::Center, SupportType::Rigid] + .into_iter() + .enumerate() + { + match support.is_face_sturdy(&mut world, p, direction, kind) { + Ok(value) => writeln!(world.out, "support {} {i} {value}", direction as u8)?, + Err(_) => writeln!(world.out, "support {} {i} error", direction as u8)?, + } + } + } + writeln!(world.out, "queries {}", world.calls)?; + } + Ok(()) +} diff --git a/crates/horizon-world/examples/entity_obstruction_fixture.rs b/crates/horizon-world/examples/entity_obstruction_fixture.rs new file mode 100644 index 000000000..ef8f0acc8 --- /dev/null +++ b/crates/horizon-world/examples/entity_obstruction_fixture.rs @@ -0,0 +1,115 @@ +use horizon_core::geometry::{Aabb, Axis, ShapeOp, Vec3, VoxelShape}; +use horizon_world::entity_obstruction::{ + EntityIdentity, EntityObstructionWorld, ObstructionEntity, is_unobstructed, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +struct World<'a, W> { + entities: Vec, + out: &'a mut W, + fail: bool, + calls: usize, +} +impl EntityObstructionWorld for World<'_, W> { + type Error = io::Error; + fn obstruction_candidates( + &mut self, + excluded: Option, + bounds: Aabb, + ) -> io::Result> { + let values = [ + bounds.min(Axis::X), + bounds.min(Axis::Y), + bounds.min(Axis::Z), + bounds.max(Axis::X), + bounds.max(Axis::Y), + bounds.max(Axis::Z), + ] + .map(f64::to_bits); + writeln!( + self.out, + "query {} {:016x} {:016x} {:016x} {:016x} {:016x} {:016x}", + excluded.map(|id| id.0 as i64).unwrap_or(-1), + values[0], + values[1], + values[2], + values[3], + values[4], + values[5] + )?; + self.calls += 1; + if self.fail { + return Err(io::Error::other("injected entity query failure")); + } + let selected = self + .entities + .iter() + .filter(|e| Some(e.identity) != excluded && e.bounds.intersects(bounds) && !e.spectator) + .copied() + .collect::>(); + for entity in &selected { + writeln!(self.out, "picked {}", entity.identity.0)?; + } + Ok(selected) + } +} +fn bbox(v: &Value) -> Aabb { + let values = v + .as_array() + .unwrap() + .iter() + .map(|v| f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap())) + .collect::>(); + Aabb::new( + Vec3::new(values[0], values[1], values[2]), + Vec3::new(values[3], values[4], values[5]), + ) +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut entities = Vec::::new(); + for value in f["entities"].as_array().unwrap() { + let identity = EntityIdentity(entities.len() as u64 + 1); + let parent = value["parent"].as_i64().unwrap(); + let root_vehicle = if parent < 0 { + identity + } else { + entities[parent as usize].root_vehicle + }; + entities.push(ObstructionEntity { + identity, + root_vehicle, + bounds: bbox(&value["box"]), + spectator: value["spectator"].as_bool().unwrap(), + removed: value["removed"].as_bool().unwrap(), + blocks_building: value["building"].as_bool().unwrap(), + }); + } + let mut shape = VoxelShape::empty(); + for value in f["shape"].as_array().unwrap() { + shape = shape.join(&VoxelShape::from_box(bbox(value))?, ShapeOp::OR)?; + } + let excluded = f["exclude"].as_i64().unwrap(); + let excluded = (excluded >= 0).then(|| entities[excluded as usize]); + let mut world = World { + entities, + out: &mut out, + fail: f["fail"].as_bool().unwrap(), + calls: 0, + }; + match is_unobstructed(&mut world, excluded.as_ref(), &shape) { + Ok(value) => writeln!(world.out, "clear {value}")?, + Err(_) => writeln!(world.out, "clear error")?, + } + writeln!(world.out, "queries {}", world.calls)?; + } + Ok(()) +} diff --git a/crates/horizon-world/examples/face_support_fixture.rs b/crates/horizon-world/examples/face_support_fixture.rs new file mode 100644 index 000000000..e6bee0e7a --- /dev/null +++ b/crates/horizon-world/examples/face_support_fixture.rs @@ -0,0 +1,147 @@ +use horizon_core::geometry::{Aabb, Axis, Direction, ShapeOp, Vec3, VoxelShape}; +use horizon_world::block_support::SupportType; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn numbers(v: &Value) -> Vec { + v.as_array() + .unwrap() + .iter() + .map(|v| f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap())) + .collect() +} +fn values( + out: &mut impl Write, + label: &str, + values: impl IntoIterator, +) -> io::Result<()> { + write!(out, "{label}")?; + for v in values { + let bits = if v.is_nan() { + 0x7ff8_0000_0000_0000 + } else { + v.to_bits() + }; + write!(out, " {bits:016x}")?; + } + writeln!(out) +} +fn box_values(out: &mut impl Write, label: &str, b: Aabb) -> io::Result<()> { + values( + out, + label, + [ + b.min(Axis::X), + b.min(Axis::Y), + b.min(Axis::Z), + b.max(Axis::X), + b.max(Axis::Y), + b.max(Axis::Z), + ], + ) +} +fn emit(out: &mut impl Write, shape: &VoxelShape) -> io::Result<()> { + writeln!( + out, + "shape {} {} {}", + shape.is_empty(), + shape.boxes().len(), + shape.is_cube() + )?; + for (axis, name) in Axis::ALL.into_iter().zip(["x", "y", "z"]) { + values(out, name, shape.coordinates(axis).iter().copied())?; + } + let axes = shape.cube_coordinate_axes(); + writeln!( + out, + "axes {}", + u8::from(axes[0]) + 2 * u8::from(axes[1]) + 4 * u8::from(axes[2]) + )?; + values( + out, + "extrema", + Axis::ALL + .map(|a| shape.min(a)) + .into_iter() + .chain(Axis::ALL.map(|a| shape.max(a))), + )?; + match shape.bounds() { + Some(b) => box_values(out, "bounds", b)?, + None => writeln!(out, "bounds none")?, + } + for b in shape.boxes() { + box_values(out, "box", *b)?; + } + Ok(()) +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut shape = if f.get("coords").is_some() { + let coords = std::array::from_fn(|i| numbers(&f["coords"][i])); + let occupied = f["occupied"] + .as_array() + .unwrap() + .iter() + .map(|v| v.as_bool().unwrap()) + .collect::>(); + if f["cube"].as_bool().unwrap() { + VoxelShape::from_cube(coords.map(|v| v.len() - 1), &occupied)? + } else { + VoxelShape::from_grid(coords, &occupied)? + } + } else { + let mut s = VoxelShape::empty(); + for v in f["boxes"].as_array().unwrap() { + let v = numbers(v); + s = s.join( + &VoxelShape::from_box(Aabb::new( + Vec3::new(v[0], v[1], v[2]), + Vec3::new(v[3], v[4], v[5]), + ))?, + ShapeOp::OR, + )?; + } + s + }; + if let Some(v) = f.get("move") { + let v = numbers(v); + shape = shape.moved(Vec3::new(v[0], v[1], v[2])); + } + for direction in Direction::ALL { + let face = shape.face_shape(direction)?; + writeln!( + out, + "face {} {} {}", + direction as u8, + face.same_identity(&shape), + face.same_identity(&shape.face_shape(direction)?) + )?; + emit(&mut out, &face)?; + writeln!( + out, + "support {} {} {} 3", + SupportType::Full.is_supporting(&shape, direction)?, + SupportType::Center.is_supporting(&shape, direction)?, + SupportType::Rigid.is_supporting(&shape, direction)? + )?; + for nested in Direction::ALL { + let second = face.face_shape(nested)?; + writeln!( + out, + "nested {} {}", + nested as u8, + second.same_identity(&face) + )?; + emit(&mut out, &second)?; + } + } + } + Ok(()) +} diff --git a/crates/horizon-world/examples/feature_catalog_fixture.rs b/crates/horizon-world/examples/feature_catalog_fixture.rs new file mode 100644 index 000000000..c12b9c1a0 --- /dev/null +++ b/crates/horizon-world/examples/feature_catalog_fixture.rs @@ -0,0 +1,276 @@ +//! Feature world transport retaining ordered mutations and partial failures. +use horizon_core::random::{LegacyRandom, RandomSource, WorldgenRandom, XoroshiroRandom}; +use horizon_world::{ + DATA_VERSION, + heightmap::HeightmapType, + nbt::Tag, + registry::{BlockRegistry, BlockStateId}, + worldgen::{ + anchor::WorldGenerationContext, + block_feature::FeatureBlockBindings, + feature::{FeatureBlocks, FeatureWorld}, + feature_catalog::FeatureCatalog, + feature_graph::FeatureDefinition, + placement::{FeaturePlacer, PlacementContext, PlacementModifier, PlacementQueryError}, + tags::TagDefinitions, + }, +}; +use serde_json::Value; +use std::{ + collections::BTreeMap, + fs, + io::{self, Write}, + path::Path, +}; +struct World<'a, W> { + states: BTreeMap<[i32; 3], BlockStateId>, + blocks: [BlockStateId; 5], + calls: i32, + fail: i32, + reject: i32, + out: &'a mut W, +} +impl PlacementContext for World<'_, W> { + fn block_state(&mut self, position: [i32; 3]) -> Result { + self.block(position) + .map_err(|e| PlacementQueryError::Failed(e.to_string())) + } + fn max_y(&mut self) -> Result { + Ok(319) + } + fn generation(&self) -> WorldGenerationContext { + WorldGenerationContext::new(-64, 384, 63) + } + fn min_y(&mut self) -> Result { + Ok(-64) + } + fn height(&mut self, _: HeightmapType, _: i32, _: i32) -> Result { + Err(PlacementQueryError::Unavailable) + } +} +impl FeatureWorld for World<'_, W> { + type Error = io::Error; + fn block(&mut self, p: [i32; 3]) -> Result { + let call = self.calls; + self.calls += 1; + writeln!(self.out, "get {} {} {}", p[0], p[1], p[2])?; + if call == self.fail { + return Err(io::Error::other("world failure")); + } + let hash = p[0] + .wrapping_mul(31) + .wrapping_add(p[1].wrapping_mul(7)) + .wrapping_add(p[2].wrapping_mul(17)) + .rem_euclid(5) as usize; + let state = self.states.get(&p).copied().unwrap_or(self.blocks[hash]); + writeln!(self.out, "state {}", state.0)?; + Ok(state) + } + fn set_block( + &mut self, + p: [i32; 3], + state: BlockStateId, + flags: i32, + ) -> Result { + let call = self.calls; + self.calls += 1; + writeln!( + self.out, + "set {} {} {} {} {flags}", + p[0], p[1], p[2], state.0 + )?; + if call == self.fail { + return Err(io::Error::other("world failure")); + } + let result = self.reject == 0 || call % self.reject != 0; + if result { + self.states.insert(p, state); + } + writeln!(self.out, "written {result}")?; + Ok(result) + } +} +fn fixture( + f: &Value, + catalog: &FeatureCatalog, + bindings: &FeatureBlockBindings<'_>, + mut random: impl RandomSource, + blocks: [BlockStateId; 5], + out: &mut impl Write, +) -> Result<(), Box> { + let root = if f["placed_root"].as_bool().unwrap_or(false) { + catalog + .placed_feature_with_blocks(f["definition"].as_str().unwrap(), bindings) + .map(|placed| FeatureDefinition::Sequence(vec![placed])) + } else { + catalog.feature_with_blocks(f["definition"].as_str().unwrap(), bindings) + }; + let decoded = root.and_then(|feature| { + let modifiers = f + .get("placement") + .map(|v| { + v.as_array() + .unwrap() + .iter() + .map(|v| PlacementModifier::from_json_with_blocks(&v.to_string(), bindings)) + .collect::, _>>() + }) + .transpose()?; + Ok((feature, modifiers)) + }); + match decoded { + Err(_) => writeln!(out, "decode error")?, + Ok((feature, modifiers)) => { + writeln!(out, "decode ok")?; + let mut world = World { + states: BTreeMap::new(), + blocks, + calls: 0, + fail: f["fail"].as_i64().unwrap() as i32, + reject: f["reject"].as_i64().unwrap() as i32, + out, + }; + let blocks = FeatureBlocks { + air: blocks[0], + stone: blocks[1], + cobblestone: blocks[2], + end_stone: blocks[3], + obsidian: blocks[4], + }; + let p = &f["origin"]; + let origin = [ + p[0].as_i64().unwrap() as i32, + p[1].as_i64().unwrap() as i32, + p[2].as_i64().unwrap() as i32, + ]; + let mut placer = FeaturePlacer::new(); + for _ in 0..f["repeats"].as_u64().unwrap() { + world.calls = 0; + let result = if let Some(modifiers) = &modifiers { + placer + .place_with_context( + modifiers, + &mut world, + &mut random, + origin, + |world, random, position| { + feature.place(world, random, position, blocks) + }, + ) + .map_err(|_| ()) + } else { + feature + .place(&mut world, &mut random, origin, blocks) + .map_err(|_| ()) + }; + match result { + Ok(value) => writeln!(world.out, "place {value}")?, + Err(_) => writeln!(world.out, "place error")?, + } + writeln!(world.out, "next {}", random.next_long())?; + for (p, state) in &world.states { + writeln!(world.out, "stored {} {} {} {}", p[0], p[1], p[2], state.0)?; + } + writeln!(world.out, "end")?; + } + } + } + writeln!(out, "tail {}", random.next_long())?; + Ok(()) +} +fn tag(v: &Value) -> Tag { + match v { + Value::String(s) => Tag::String(s.as_str().into()), + Value::Number(n) => Tag::Int(n.as_i64().unwrap() as i32), + Value::Array(a) => Tag::List(a.iter().map(tag).collect()), + Value::Object(m) => { + Tag::Compound(m.iter().map(|(k, v)| (k.as_str().into(), tag(v))).collect()) + } + _ => panic!("invalid registry metadata"), + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let resources: Value = serde_json::from_str(&fs::read_to_string(dir.join("catalog.json"))?)?; + let definitions = |name: &str| { + resources[name] + .as_object() + .unwrap() + .iter() + .map(|(k, v)| (k.clone(), v.as_str().unwrap().to_owned())) + .collect() + }; + let mut tags = TagDefinitions::default(); + for (name, value) in resources["tags"].as_object().unwrap() { + tags.apply_json(name, "fixture", value.as_str().unwrap())?; + } + let catalog = + FeatureCatalog::from_resources(&definitions("features"), &definitions("placed"), &tags)?; + let facts: Value = serde_json::from_str(&fs::read_to_string(dir.join("facts-server.json"))?)?; + let registry = BlockRegistry::from_nbt(&Tag::compound([ + ("DataVersion", Tag::Int(DATA_VERSION)), + ("states", tag(&facts["states"])), + ("defaults", tag(&facts["defaults"])), + ]))?; + let integers = facts["integers"] + .as_array() + .unwrap() + .iter() + .map(|v| { + ( + v[0].as_str().unwrap().to_owned(), + v[1].as_str().unwrap().to_owned(), + ) + }) + .collect(); + let bindings = FeatureBlockBindings::new(®istry, integers)?; + let blocks = ["air", "stone", "cobblestone", "end_stone", "obsidian"].map(|name| { + registry + .default_state(&format!("minecraft:{name}")) + .unwrap() + }); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let seed = f["seed"].as_i64().unwrap(); + match ( + f["legacy"].as_bool().unwrap(), + f["worldgen"].as_bool().unwrap(), + ) { + (true, false) => fixture( + &f, + &catalog, + &bindings, + LegacyRandom::new(seed), + blocks, + &mut out, + )?, + (true, true) => fixture( + &f, + &catalog, + &bindings, + WorldgenRandom::new(LegacyRandom::new(seed)), + blocks, + &mut out, + )?, + (false, false) => fixture( + &f, + &catalog, + &bindings, + XoroshiroRandom::new(seed), + blocks, + &mut out, + )?, + (false, true) => fixture( + &f, + &catalog, + &bindings, + WorldgenRandom::new(XoroshiroRandom::new(seed)), + blocks, + &mut out, + )?, + } + } + Ok(()) +} diff --git a/crates/horizon-world/examples/feature_graph_fixture.rs b/crates/horizon-world/examples/feature_graph_fixture.rs new file mode 100644 index 000000000..fae5b6e2e --- /dev/null +++ b/crates/horizon-world/examples/feature_graph_fixture.rs @@ -0,0 +1,180 @@ +//! Feature world transport retaining ordered mutations and partial failures. +use horizon_core::random::{LegacyRandom, RandomSource, XoroshiroRandom}; +use horizon_world::{ + heightmap::HeightmapType, + registry::BlockStateId, + worldgen::{ + anchor::WorldGenerationContext, + feature::{FeatureBlocks, FeatureWorld}, + feature_graph::FeatureDefinition, + placement::{FeaturePlacer, PlacementContext, PlacementModifier, PlacementQueryError}, + }, +}; +use serde_json::Value; +use std::{ + collections::BTreeMap, + fs, + io::{self, Write}, + path::Path, +}; +struct World<'a, W> { + states: BTreeMap<[i32; 3], BlockStateId>, + blocks: [BlockStateId; 5], + calls: i32, + fail: i32, + reject: i32, + out: &'a mut W, +} +impl PlacementContext for World<'_, W> { + fn max_y(&mut self) -> Result { + Ok(319) + } + fn generation(&self) -> WorldGenerationContext { + WorldGenerationContext::new(-64, 384, 63) + } + fn min_y(&mut self) -> Result { + Ok(-64) + } + fn height(&mut self, _: HeightmapType, _: i32, _: i32) -> Result { + Err(PlacementQueryError::Unavailable) + } +} +impl FeatureWorld for World<'_, W> { + type Error = io::Error; + fn block(&mut self, p: [i32; 3]) -> Result { + let call = self.calls; + self.calls += 1; + writeln!(self.out, "get {} {} {}", p[0], p[1], p[2])?; + if call == self.fail { + return Err(io::Error::other("world failure")); + } + let hash = p[0] + .wrapping_mul(31) + .wrapping_add(p[1].wrapping_mul(7)) + .wrapping_add(p[2].wrapping_mul(17)) + .rem_euclid(5) as usize; + let state = self.states.get(&p).copied().unwrap_or(self.blocks[hash]); + writeln!(self.out, "state {}", state.0)?; + Ok(state) + } + fn set_block( + &mut self, + p: [i32; 3], + state: BlockStateId, + flags: i32, + ) -> Result { + let call = self.calls; + self.calls += 1; + writeln!( + self.out, + "set {} {} {} {} {flags}", + p[0], p[1], p[2], state.0 + )?; + if call == self.fail { + return Err(io::Error::other("world failure")); + } + let result = self.reject == 0 || call % self.reject != 0; + if result { + self.states.insert(p, state); + } + writeln!(self.out, "written {result}")?; + Ok(result) + } +} +fn fixture( + f: &Value, + mut random: impl RandomSource, + blocks: [BlockStateId; 5], + out: &mut impl Write, +) -> Result<(), Box> { + let decoded = + FeatureDefinition::from_json(f["definition"].as_str().unwrap()).and_then(|feature| { + let modifiers = f + .get("placement") + .map(|v| { + v.as_array() + .unwrap() + .iter() + .map(|v| PlacementModifier::from_json(&v.to_string())) + .collect::, _>>() + }) + .transpose()?; + Ok((feature, modifiers)) + }); + match decoded { + Err(_) => writeln!(out, "decode error")?, + Ok((feature, modifiers)) => { + writeln!(out, "decode ok")?; + let mut world = World { + states: BTreeMap::new(), + blocks, + calls: 0, + fail: f["fail"].as_i64().unwrap() as i32, + reject: f["reject"].as_i64().unwrap() as i32, + out, + }; + let blocks = FeatureBlocks { + air: blocks[0], + stone: blocks[1], + cobblestone: blocks[2], + end_stone: blocks[3], + obsidian: blocks[4], + }; + let p = &f["origin"]; + let origin = [ + p[0].as_i64().unwrap() as i32, + p[1].as_i64().unwrap() as i32, + p[2].as_i64().unwrap() as i32, + ]; + let mut placer = FeaturePlacer::new(); + for _ in 0..f["repeats"].as_u64().unwrap() { + world.calls = 0; + let result = if let Some(modifiers) = &modifiers { + placer + .place_with_context( + modifiers, + &mut world, + &mut random, + origin, + |world, random, position| { + feature.place(world, random, position, blocks) + }, + ) + .map_err(|_| ()) + } else { + feature + .place(&mut world, &mut random, origin, blocks) + .map_err(|_| ()) + }; + match result { + Ok(value) => writeln!(world.out, "place {value}")?, + Err(_) => writeln!(world.out, "place error")?, + } + writeln!(world.out, "next {}", random.next_long())?; + for (p, state) in &world.states { + writeln!(world.out, "stored {} {} {} {}", p[0], p[1], p[2], state.0)?; + } + writeln!(world.out, "end")?; + } + } + } + writeln!(out, "tail {}", random.next_long())?; + Ok(()) +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let ids: [u32; 5] = serde_json::from_str(&fs::read_to_string(dir.join("facts-server.json"))?)?; + let blocks = ids.map(BlockStateId); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let seed = f["seed"].as_i64().unwrap(); + if f["legacy"].as_bool().unwrap() { + fixture(&f, LegacyRandom::new(seed), blocks, &mut out)?; + } else { + fixture(&f, XoroshiroRandom::new(seed), blocks, &mut out)?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/examples/feature_placement_fixture.rs b/crates/horizon-world/examples/feature_placement_fixture.rs new file mode 100644 index 000000000..c7500fa4f --- /dev/null +++ b/crates/horizon-world/examples/feature_placement_fixture.rs @@ -0,0 +1,91 @@ +//! Transport for native modifier chains and a feature callback sharing the RNG. +#[path = "support/placement_queries.rs"] +mod queries; +use horizon_core::random::{LegacyRandom, RandomSource, XoroshiroRandom}; +use horizon_world::worldgen::{ + anchor::WorldGenerationContext, + placement::{FeaturePlacer, PlacementModifier}, +}; +use serde_json::Value; +use std::cell::RefCell; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn n(v: &Value) -> i32 { + v.as_i64().unwrap() as i32 +} +fn fixture( + f: &Value, + mut random: impl RandomSource, + out: &mut impl Write, +) -> Result<(), Box> { + let c = &f["context"]; + let context = WorldGenerationContext::new(n(&c[0]), n(&c[1]), n(&c[2])); + let out = RefCell::new(out); + let mut context = queries::Queries::new(f, context, &out); + let modifiers = f["modifiers"] + .as_array() + .unwrap() + .iter() + .map(|v| PlacementModifier::from_json(&v.to_string())) + .collect::, _>>(); + match modifiers { + Err(_) => writeln!(out.borrow_mut(), "decode error")?, + Ok(modifiers) => { + writeln!(out.borrow_mut(), "decode ok")?; + let mut placer = FeaturePlacer::new(); + for p in f["positions"].as_array().unwrap() { + let mut count = 0; + let fail = n(&f["fail"]); + let draw = f["draw"].as_bool().unwrap(); + let mode = n(&f["result"]); + let result = placer.place_in( + &modifiers, + &mut context, + &mut random, + [n(&p[0]), n(&p[1]), n(&p[2])], + |random, p| { + let previous = count; + count += 1; + if previous == fail { + return Err(io::Error::other("feature failure")); + } + writeln!(out.borrow_mut(), "feature {} {} {}", p[0], p[1], p[2])?; + let mut value = i64::from(p[0].wrapping_add(p[1]).wrapping_add(p[2])); + if draw { + value = random.next_long(); + writeln!(out.borrow_mut(), "consumer {value}")?; + } + let result = mode == 1 || (mode == 2 && value & 1 == 0); + writeln!(out.borrow_mut(), "result {result}")?; + Ok(result) + }, + ); + match result { + Ok(result) => writeln!(out.borrow_mut(), "place {result}")?, + Err(_) => writeln!(out.borrow_mut(), "place error")?, + } + writeln!(out.borrow_mut(), "next {}", random.next_long())?; + } + } + } + writeln!(out.borrow_mut(), "tail {}", random.next_long())?; + Ok(()) +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let seed = f["seed"].as_i64().unwrap(); + if f["legacy"].as_bool().unwrap() { + fixture(&f, LegacyRandom::new(seed), &mut out)?; + } else { + fixture(&f, XoroshiroRandom::new(seed), &mut out)?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/examples/feature_region_fixture.rs b/crates/horizon-world/examples/feature_region_fixture.rs new file mode 100644 index 000000000..2b3918be3 --- /dev/null +++ b/crates/horizon-world/examples/feature_region_fixture.rs @@ -0,0 +1,294 @@ +use horizon_core::random::{LegacyRandom, RandomSource, WorldgenRandom, XoroshiroRandom}; +use horizon_world::worldgen::{ + anchor::WorldGenerationContext, + block_feature::FeatureBlockBindings, + feature::FeatureBlocks, + feature_graph::FeatureDefinition, + feature_region::{RegionError, TerrainFeatureAccess, TerrainRegion}, + placement::{FeaturePlacer, PlacementContext, PlacementModifier}, + terrain::TerrainError, +}; +// Feature chains against a resident multi-chunk region. +use horizon_core::position::ChunkPos; +use horizon_world::{ + DATA_VERSION, + heightmap::{HeightmapState, HeightmapType}, + nbt::Tag, + registry::{BlockRegistry, BlockStateId}, + worldgen::{ + tags::TagDefinitions, + terrain::{PreLightChunkStage, TerrainBlockStates, TerrainChunk}, + }, +}; +use serde_json::Value; +use std::{ + collections::BTreeSet, + fs, + io::{self, Write}, + path::Path, +}; +#[derive(Clone, Copy)] +struct State { + air: bool, + air_block: bool, + fluid: bool, + motion: bool, + no_leaves: bool, +} +impl HeightmapState for State { + fn is_air(self) -> bool { + self.air + } + fn is_air_block(self) -> bool { + self.air_block + } + fn has_fluid(self) -> bool { + self.fluid + } + fn blocks_motion_in_heightmap(self) -> bool { + self.motion + } + fn blocks_motion_in_heightmap_no_leaves(self) -> bool { + self.no_leaves + } +} +struct Properties<'a>(&'a [State]); +impl TerrainBlockStates for Properties<'_> { + type State = State; + fn heightmap_state(&self, id: BlockStateId) -> State { + self.0[id.0 as usize] + } +} +fn n(v: &Value) -> i32 { + v.as_i64().unwrap() as i32 +} +fn tag(v: &Value) -> Tag { + match v { + Value::String(s) => Tag::String(s.as_str().into()), + Value::Number(i) => Tag::Int(i.as_i64().unwrap() as i32), + Value::Object(m) => { + Tag::Compound(m.iter().map(|(k, v)| (k.as_str().into(), tag(v))).collect()) + } + Value::Array(a) => Tag::List(a.iter().map(tag).collect()), + _ => panic!("unsupported registry fixture value"), + } +} +fn fixture( + f: &Value, + registry: &BlockRegistry, + states: &[State], + out: &mut impl Write, +) -> Result<(), Box> { + let seed = f["seed"].as_i64().unwrap(); + match ( + f["legacy"].as_bool().unwrap(), + f["worldgen"].as_bool().unwrap(), + ) { + (true, false) => run(f, registry, states, out, LegacyRandom::new(seed)), + (true, true) => run( + f, + registry, + states, + out, + WorldgenRandom::new(LegacyRandom::new(seed)), + ), + (false, false) => run(f, registry, states, out, XoroshiroRandom::new(seed)), + (false, true) => run( + f, + registry, + states, + out, + WorldgenRandom::new(XoroshiroRandom::new(seed)), + ), + } +} +fn run( + f: &Value, + registry: &BlockRegistry, + states: &[State], + out: &mut impl Write, + mut random: impl RandomSource, +) -> Result<(), Box> { + let stage = PreLightChunkStage::ALL + .into_iter() + .find(|s| s.name() == f["stage"].as_str().unwrap()) + .unwrap(); + let mut chunks = Vec::new(); + for cx in -1..=1 { + for cz in -1..=1 { + let mut chunk = + TerrainChunk::new(ChunkPos::new(cx, cz), -64, 64, registry, Properties(states))?; + chunk.set_generation_stage(stage); + for x in 0..16 { + for z in 0..16 { + chunk.set_block_worldgen( + (cx << 4) + x, + -56, + (cz << 4) + z, + registry.default_state("minecraft:stone").unwrap(), + )?; + if (x + z) % 3 != 0 { + chunk.set_block_worldgen( + (cx << 4) + x, + -48, + (cz << 4) + z, + registry.default_state("minecraft:dirt").unwrap(), + )?; + } + } + } + chunks.push(chunk); + } + } + let mut region = TerrainRegion::new(chunks, WorldGenerationContext::new(-64, 64, 0))?; + let blocks = FeatureBlocks::from_registry(registry)?; + // These configured fixture states use compact names and an enum property; + // no integer-property parsing is requested by this region corpus. + let bindings = FeatureBlockBindings::new(registry, BTreeSet::new())?; + let features = f["features"] + .as_array() + .unwrap() + .iter() + .map(|v| FeatureDefinition::from_json_with_blocks(&v.to_string(), &bindings)) + .collect::, _>>()?; + let modifiers = f["placement"] + .as_array() + .unwrap() + .iter() + .map(|v| PlacementModifier::from_json(&v.to_string())) + .collect::, _>>()?; + let mut placer = FeaturePlacer::new(); + let fail = n(&f["fail"]); + let reject = n(&f["reject"]); + for repeat in 0..2 { + for feature in &features { + let mut calls = 0; + let result = { + let write = |region: &mut TerrainRegion<'_, Properties<'_>>, + p: [i32; 3], + state: BlockStateId, + flags: i32| + -> Result { + writeln!(out, "write {} {} {} {} {flags}", p[0], p[1], p[2], state.0) + .map_err(TerrainError::from)?; + let call = calls; + calls += 1; + if call == fail { + return Err(TerrainError::Storage(io::Error::other( + "injected write failure", + )) + .into()); + } + let result = reject == 0 || call % reject != 0; + if result { + region.set_block_worldgen(p, state)?; + } + writeln!(out, "written {result}").map_err(TerrainError::from)?; + Ok(result) + }; + let mut world = TerrainFeatureAccess::new(&mut region, write); + placer.place_with_context( + &modifiers, + &mut world, + &mut random, + [15, -40, 15], + |world, random, p| feature.place(world, random, p, blocks), + ) + }; + match result { + Ok(result) => writeln!(out, "place {result}")?, + Err(_) => writeln!(out, "place error")?, + } + writeln!(out, "next {}", random.next_long())?; + for [x, z] in [[0, 0], [15, 15], [16, 16], [-1, -1]] { + for kind in HeightmapType::ALL { + writeln!( + out, + "height {} {x} {z} {}", + kind.name(), + region.height(kind, x, z)? + )?; + } + } + } + writeln!(out, "repeat {repeat}")?; + } + for chunk in region.chunks() { + let p = chunk.position(); + writeln!(out, "chunk {} {}", p.x, p.z)?; + for kind in HeightmapType::ALL { + if let Some(map) = chunk.heightmap(kind) { + writeln!(out, "map {}", kind.name())?; + for word in map.raw_data() { + writeln!(out, "{word:x}")?; + } + } else { + writeln!(out, "missing {}", kind.name())?; + } + } + for i in 0..4 { + writeln!(out, "section {i}")?; + for index in 0..4096 { + writeln!(out, "{}", chunk.section(i).unwrap().get(index)?.0)?; + } + } + } + writeln!(out, "tail {}", random.next_long())?; + Ok(()) +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let facts: Value = serde_json::from_str(&fs::read_to_string(dir.join("facts-server.json"))?)?; + let bundle: Value = serde_json::from_str(&fs::read_to_string(dir.join("tags.json"))?)?; + let registry = BlockRegistry::from_nbt(&Tag::compound([ + ("DataVersion", Tag::Int(DATA_VERSION)), + ( + "states", + Tag::List( + facts["states"] + .as_array() + .unwrap() + .iter() + .map(|s| tag(&s[4])) + .collect(), + ), + ), + ("defaults", tag(&facts["defaults"])), + ]))?; + let mut definitions = TagDefinitions::default(); + for (name, text) in bundle.as_object().unwrap() { + definitions.apply_json(name, "vanilla", text.as_str().unwrap())?; + } + let built = definitions.build(|id, _| facts["defaults"].get(id).map(|_| id.to_owned()))?; + assert!(built.missing.is_empty()); + let motion: BTreeSet<_> = built.tags["minecraft:blocks_motion_in_heightmap"] + .iter() + .map(String::as_str) + .collect(); + let no_leaves: BTreeSet<_> = built.tags["minecraft:blocks_motion_in_heightmap_no_leaves"] + .iter() + .map(String::as_str) + .collect(); + let states: Vec<_> = facts["states"] + .as_array() + .unwrap() + .iter() + .map(|a| { + let name = a[0].as_str().unwrap(); + State { + air: a[1].as_bool().unwrap(), + air_block: name == "minecraft:air", + fluid: a[2].as_bool().unwrap(), + motion: motion.contains(name), + no_leaves: no_leaves.contains(name), + } + }) + .collect(); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + fixture(&serde_json::from_str(line)?, ®istry, &states, &mut out)?; + } + out.flush()?; + Ok(()) +} diff --git a/crates/horizon-world/examples/feature_sort_fixture.rs b/crates/horizon-world/examples/feature_sort_fixture.rs new file mode 100644 index 000000000..6e645601c --- /dev/null +++ b/crates/horizon-world/examples/feature_sort_fixture.rs @@ -0,0 +1,50 @@ +use horizon_world::worldgen::feature_sort::{ + FeatureIdentity, FeatureSortError, build_features_per_step, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let biomes: Vec>> = serde_json::from_value(f["biomes"].clone())?; + let biomes = biomes + .into_iter() + .map(|steps| { + steps + .into_iter() + .map(|step| step.into_iter().map(FeatureIdentity).collect()) + .collect() + }) + .collect::>(); + match build_features_per_step(&biomes) { + Err(FeatureSortError::Cycle) => writeln!(out, "cycle")?, + Err(error) => return Err(error.into()), + Ok(steps) => { + writeln!(out, "steps {}", steps.len())?; + for (index, step) in steps.iter().enumerate() { + writeln!(out, "step {index} {}", step.features().len())?; + for feature in step.features() { + writeln!(out, "feature {}", feature.0)?; + } + for id in f["queries"].as_array().unwrap() { + let id = FeatureIdentity(id.as_u64().unwrap() as u32); + writeln!( + out, + "index {} {}", + id.0, + step.index(id).map_or(-1, |i| i as i32) + )?; + } + } + } + } + } + Ok(()) +} diff --git a/crates/horizon-world/examples/fill_layer_fixture.rs b/crates/horizon-world/examples/fill_layer_fixture.rs new file mode 100644 index 000000000..d10cd2b72 --- /dev/null +++ b/crates/horizon-world/examples/fill_layer_fixture.rs @@ -0,0 +1,195 @@ +//! Feature world transport retaining ordered mutations and partial failures. +use horizon_core::random::{LegacyRandom, RandomSource, XoroshiroRandom}; +use horizon_world::{ + DATA_VERSION, + heightmap::HeightmapType, + nbt::Tag, + registry::{BlockRegistry, BlockStateId}, + worldgen::{ + anchor::WorldGenerationContext, + block_feature::{FeatureBlockBindings, FillLayerFeature}, + feature::FeatureWorld, + placement::{PlacementContext, PlacementQueryError}, + }, +}; +use serde_json::Value; +use std::{ + collections::BTreeMap, + fs, + io::{self, Write}, + path::Path, +}; +struct World<'a, W> { + states: BTreeMap<[i32; 3], BlockStateId>, + blocks: Vec, + minimum: i32, + calls: i32, + fail: i32, + reject: i32, + out: &'a mut W, +} +impl PlacementContext for World<'_, W> { + fn generation(&self) -> WorldGenerationContext { + WorldGenerationContext::new(self.minimum, 384, 63) + } + fn min_y(&mut self) -> Result { + writeln!(self.out, "min").map_err(|e| PlacementQueryError::Failed(e.to_string()))?; + let call = self.calls; + self.calls += 1; + if call == self.fail { + return Err(PlacementQueryError::Failed("minimum query failure".into())); + } + writeln!(self.out, "minimum {}", self.minimum) + .map_err(|e| PlacementQueryError::Failed(e.to_string()))?; + Ok(self.minimum) + } + fn height(&mut self, _: HeightmapType, _: i32, _: i32) -> Result { + Err(PlacementQueryError::Unavailable) + } +} +impl FeatureWorld for World<'_, W> { + type Error = io::Error; + fn block(&mut self, p: [i32; 3]) -> Result { + let call = self.calls; + self.calls += 1; + writeln!(self.out, "get {} {} {}", p[0], p[1], p[2])?; + if call == self.fail { + return Err(io::Error::other("world failure")); + } + let hash = p[0] + .wrapping_mul(31) + .wrapping_add(p[1].wrapping_mul(7)) + .wrapping_add(p[2].wrapping_mul(17)) + .rem_euclid(7) as usize; + let state = self.states.get(&p).copied().unwrap_or(self.blocks[hash]); + writeln!(self.out, "state {}", state.0)?; + Ok(state) + } + fn set_block( + &mut self, + p: [i32; 3], + state: BlockStateId, + flags: i32, + ) -> Result { + let call = self.calls; + self.calls += 1; + writeln!( + self.out, + "set {} {} {} {} {flags}", + p[0], p[1], p[2], state.0 + )?; + if call == self.fail { + return Err(io::Error::other("world failure")); + } + let result = self.reject == 0 || call % self.reject != 0; + if result { + self.states.insert(p, state); + } + writeln!(self.out, "written {result}")?; + Ok(result) + } +} +fn fixture( + f: &Value, + mut random: impl RandomSource, + blocks: &[BlockStateId], + bindings: &FeatureBlockBindings<'_>, + out: &mut impl Write, +) -> Result<(), Box> { + let decoded = FillLayerFeature::from_json(f["definition"].as_str().unwrap(), bindings); + match decoded { + Err(_) => writeln!(out, "decode error")?, + Ok(feature) => { + writeln!(out, "decode ok")?; + let mut world = World { + states: BTreeMap::new(), + blocks: blocks.to_vec(), + minimum: f["world_min"].as_i64().unwrap() as i32, + calls: 0, + fail: f["fail"].as_i64().unwrap() as i32, + reject: f["reject"].as_i64().unwrap() as i32, + out, + }; + let p = &f["origin"]; + let origin = [ + p[0].as_i64().unwrap() as i32, + p[1].as_i64().unwrap() as i32, + p[2].as_i64().unwrap() as i32, + ]; + for _ in 0..f["repeats"].as_u64().unwrap() { + world.calls = 0; + let result = feature.place(&mut world, origin); + match result { + Ok(value) => writeln!(world.out, "place {value}")?, + Err(_) => writeln!(world.out, "place error")?, + } + writeln!(world.out, "next {}", random.next_long())?; + for (p, state) in &world.states { + writeln!(world.out, "stored {} {} {} {}", p[0], p[1], p[2], state.0)?; + } + writeln!(world.out, "end")?; + } + } + } + writeln!(out, "tail {}", random.next_long())?; + Ok(()) +} +fn tag(v: &Value) -> Tag { + match v { + Value::String(s) => Tag::String(s.as_str().into()), + Value::Number(n) => Tag::Int(n.as_i64().unwrap() as i32), + Value::Array(a) => Tag::List(a.iter().map(tag).collect()), + Value::Object(m) => { + Tag::Compound(m.iter().map(|(k, v)| (k.as_str().into(), tag(v))).collect()) + } + _ => panic!("invalid registry metadata"), + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let facts: Value = serde_json::from_str(&fs::read_to_string(dir.join("facts-server.json"))?)?; + let registry = BlockRegistry::from_nbt(&Tag::compound([ + ("DataVersion", Tag::Int(DATA_VERSION)), + ("states", tag(&facts["states"])), + ("defaults", tag(&facts["defaults"])), + ]))?; + let integers = facts["integers"] + .as_array() + .unwrap() + .iter() + .map(|v| { + ( + v[0].as_str().unwrap().to_owned(), + v[1].as_str().unwrap().to_owned(), + ) + }) + .collect(); + let bindings = FeatureBlockBindings::new(®istry, integers)?; + let blocks: Vec<_> = [ + "air", + "cave_air", + "void_air", + "stone", + "water", + "oak_leaves", + "dirt", + ] + .map(|name| { + registry + .default_state(&format!("minecraft:{name}")) + .unwrap() + }) + .to_vec(); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let seed = f["seed"].as_i64().unwrap(); + if f["legacy"].as_bool().unwrap() { + fixture(&f, LegacyRandom::new(seed), &blocks, &bindings, &mut out)?; + } else { + fixture(&f, XoroshiroRandom::new(seed), &blocks, &bindings, &mut out)?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/examples/fluid_fixture.rs b/crates/horizon-world/examples/fluid_fixture.rs new file mode 100644 index 000000000..e874077eb --- /dev/null +++ b/crates/horizon-world/examples/fluid_fixture.rs @@ -0,0 +1,121 @@ +use horizon_world::{ + DATA_VERSION, + fluid::{FluidBlockBindings, FluidHeightWorld, FluidKind, FluidState, FluidStateTable}, + nbt::Tag, + registry::{BlockRegistry, BlockStateId}, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +struct World<'a, W> { + out: &'a mut W, + above: FluidState, + sturdy: bool, + calls: i32, + fail: i32, +} +impl World<'_, W> { + fn query(&mut self, kind: &str, p: [i32; 3]) -> io::Result<()> { + writeln!(self.out, "{kind} {} {} {}", p[0], p[1], p[2])?; + let call = self.calls; + self.calls += 1; + if call == self.fail { + Err(io::Error::other("injected fluid query failure")) + } else { + Ok(()) + } + } +} +impl FluidHeightWorld for World<'_, W> { + type Error = io::Error; + fn fluid(&mut self, p: [i32; 3]) -> io::Result { + self.query("fluid", p)?; + Ok(self.above) + } + fn sturdy_down(&mut self, p: [i32; 3]) -> io::Result { + self.query("block", p)?; + Ok(self.sturdy) + } +} +fn tag(v: &Value) -> Tag { + match v { + Value::String(s) => Tag::String(s.as_str().into()), + Value::Number(n) => Tag::Int(n.as_i64().unwrap() as i32), + Value::Array(a) => Tag::List(a.iter().map(tag).collect()), + Value::Object(m) => { + Tag::Compound(m.iter().map(|(k, v)| (k.as_str().into(), tag(v))).collect()) + } + _ => panic!("invalid registry metadata"), + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let facts: Value = serde_json::from_str(&fs::read_to_string(dir.join("facts-server.json"))?)?; + let registry = BlockRegistry::from_nbt(&Tag::compound([ + ("DataVersion", Tag::Int(DATA_VERSION)), + ("states", tag(&facts["states"])), + ("defaults", tag(&facts["defaults"])), + ]))?; + let fluids = FluidStateTable::new(®istry)?; + let blocks = FluidBlockBindings::new(®istry)?; + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for first in FluidKind::ALL { + for second in FluidKind::ALL { + writeln!( + out, + "family {} {} {}", + first.name(), + second.name(), + first.same_family(second) + )?; + } + } + for i in 0..registry.len() { + let fluid = fluids.get(BlockStateId(i as u32)).unwrap(); + writeln!( + out, + "state {i} {} {} {} {} {} {} {}", + fluid.kind().name(), + fluid.amount(), + fluid.falling(), + fluid.is_full(), + fluid.is_source(), + fluid.own_height().to_bits(), + blocks.block(fluid).0 + )?; + } + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let fluid = fluids + .get(BlockStateId(f["state"].as_u64().unwrap() as u32)) + .unwrap(); + let above = fluids + .get(BlockStateId(f["above"].as_u64().unwrap() as u32)) + .unwrap(); + let p = std::array::from_fn(|i| f["position"][i].as_i64().unwrap() as i32); + let mut world = World { + out: &mut out, + above, + sturdy: f["sturdy"].as_bool().unwrap(), + calls: 0, + fail: f["fail"].as_i64().unwrap() as i32, + }; + for camera in [false, true] { + let result = if camera { + fluid.camera_height_at(&mut world, p) + } else { + fluid.height_at(&mut world, p) + }; + match result { + Ok(value) => writeln!(world.out, "height {}", value.to_bits())?, + Err(_) => writeln!(world.out, "height error")?, + } + } + writeln!(world.out, "calls {}", world.calls)?; + } + Ok(()) +} diff --git a/crates/horizon-world/examples/height_provider_fixture.rs b/crates/horizon-world/examples/height_provider_fixture.rs new file mode 100644 index 000000000..7ada87a18 --- /dev/null +++ b/crates/horizon-world/examples/height_provider_fixture.rs @@ -0,0 +1,50 @@ +//! Transport for anchored provider samples and subsequent random state. +use horizon_core::random::{LegacyRandom, RandomSource, XoroshiroRandom}; +use horizon_world::worldgen::{anchor::WorldGenerationContext, height_provider::HeightProvider}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn n(v: &Value) -> i32 { + v.as_i64().unwrap() as i32 +} +fn fixture( + f: &Value, + mut random: impl RandomSource, + out: &mut impl Write, +) -> Result<(), Box> { + let c = &f["context"]; + let context = WorldGenerationContext::new(n(&c[0]), n(&c[1]), n(&c[2])); + match HeightProvider::from_json(f["definition"].as_str().unwrap()) { + Ok(provider) => { + writeln!(out, "decode ok")?; + for _ in 0..f["samples"].as_u64().unwrap() { + match provider.sample(&mut random, context) { + Ok(value) => writeln!(out, "sample {value}")?, + Err(_) => writeln!(out, "sample error")?, + } + writeln!(out, "next {}", random.next_long())?; + } + } + Err(_) => writeln!(out, "decode error")?, + } + writeln!(out, "tail {}", random.next_long())?; + Ok(()) +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let seed = f["seed"].as_i64().unwrap(); + if f["legacy"].as_bool().unwrap() { + fixture(&f, LegacyRandom::new(seed), &mut out)?; + } else { + fixture(&f, XoroshiroRandom::new(seed), &mut out)?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/examples/heightmap_fixture.rs b/crates/horizon-world/examples/heightmap_fixture.rs new file mode 100644 index 000000000..35d7bc5c2 --- /dev/null +++ b/crates/horizon-world/examples/heightmap_fixture.rs @@ -0,0 +1,253 @@ +//! Original differential-test transport. State air/fluid facts are private inputs; +//! tag predicates are resolved by the Rust loader, not imported oracle results. +use horizon_world::heightmap::{Heightmap, HeightmapChunk, HeightmapState, HeightmapType}; +use horizon_world::worldgen::tags::TagDefinitions; +use serde_json::Value; +use std::{ + cell::RefCell, + collections::BTreeSet, + fs, + io::{self, Write}, + path::Path, +}; + +#[derive(Clone, Copy)] +struct State { + air: bool, + air_block: bool, + fluid: bool, + motion: bool, + no_leaves: bool, +} +impl HeightmapState for State { + fn is_air(self) -> bool { + self.air + } + fn is_air_block(self) -> bool { + self.air_block + } + fn has_fluid(self) -> bool { + self.fluid + } + fn blocks_motion_in_heightmap(self) -> bool { + self.motion + } + fn blocks_motion_in_heightmap_no_leaves(self) -> bool { + self.no_leaves + } +} +struct Chunk<'a> { + min: i32, + height: i32, + blocks: Vec, + counts: Vec, + states: &'a [State], + air: usize, + void_air: usize, + trace: bool, + reads: RefCell>, +} +impl Chunk<'_> { + fn index(&self, x: i32, y: i32, z: i32) -> usize { + ((y - self.min) * 256 + (z & 15) * 16 + (x & 15)) as usize + } + fn write(&mut self, x: i32, y: i32, z: i32, id: usize) { + let index = self.index(x, y, z); + let old = self.blocks[index]; + self.counts[((y - self.min) >> 4) as usize] += + i32::from(!self.states[id].air) - i32::from(!self.states[old].air); + self.blocks[index] = id; + } +} +impl HeightmapChunk for Chunk<'_> { + type State = State; + fn min_y(&self) -> i32 { + self.min + } + fn height(&self) -> i32 { + self.height + } + fn highest_section_y(&self) -> i32 { + self.counts + .iter() + .rposition(|&n| n != 0) + .map_or(self.min, |i| self.min + i as i32 * 16) + } + fn block_state(&self, x: i32, y: i32, z: i32) -> State { + let id = if y < self.min || y >= self.min + self.height { + self.void_air + } else if self.counts[((y - self.min) >> 4) as usize] == 0 { + self.air + } else { + self.blocks[self.index(x, y, z)] + }; + if self.trace { + self.reads + .borrow_mut() + .push(format!("read {x} {y} {z} {id}")); + } + self.states[id] + } +} +fn num(value: &Value) -> i32 { + value.as_i64().unwrap() as i32 +} +fn fixture( + input: Value, + states: &[State], + defaults: &Value, + out: &mut impl Write, +) -> io::Result<()> { + let min = num(&input["min"]); + let height = num(&input["height"]); + let air = num(&defaults["minecraft:air"]) as usize; + let mut chunk = Chunk { + min, + height, + blocks: vec![air; (height * 256) as usize], + counts: vec![0; (height / 16) as usize], + states, + air, + void_air: num(&defaults["minecraft:void_air"]) as usize, + trace: input["trace"].as_bool().unwrap(), + reads: RefCell::default(), + }; + writeln!(out, "chunk {min} {height}")?; + for a in input["initial"].as_array().unwrap() { + chunk.write(num(&a[0]), num(&a[1]), num(&a[2]), num(&a[3]) as usize); + } + let mut maps = HeightmapType::ALL.map(|kind| Heightmap::new(kind, min, height).unwrap()); + for a in input["ops"].as_array().unwrap() { + match a[0].as_str().unwrap() { + "set" | "update" => { + let (x, y, z, id) = (num(&a[1]), num(&a[2]), num(&a[3]), num(&a[4]) as usize); + let mask = if a[0] == "set" { + chunk.write(x, y, z, id); + num(&a[5]) + } else { + 1 << num(&a[5]) + }; + for (t, map) in maps.iter_mut().enumerate() { + if mask & (1 << t) != 0 { + match map.update(&chunk, x, y, z, states[id]) { + Ok(changed) => writeln!(out, "update {t} {changed}")?, + Err(_) => writeln!(out, "update {t} error")?, + } + } + } + } + "prime" => { + let mask = num(&a[1]); + let mut selected: Vec<_> = maps + .iter_mut() + .enumerate() + .filter_map(|(t, map)| (mask & (1 << t) != 0).then_some(map)) + .collect(); + Heightmap::prime(&chunk, &mut selected).unwrap(); + writeln!(out, "prime {mask}")?; + } + "raw" => { + let t = num(&a[1]) as usize; + let words: Vec<_> = a[2] + .as_array() + .unwrap() + .iter() + .map(|word| u64::from_str_radix(word.as_str().unwrap(), 16).unwrap()) + .collect(); + maps[t].set_raw_data(&chunk, &words).unwrap(); + writeln!(out, "raw {t}")?; + } + "query" => { + let (x, z) = (num(&a[1]), num(&a[2])); + for (t, map) in maps.iter().enumerate() { + match map.first_available(x, z) { + Ok(first) => writeln!( + out, + "height {t} {x} {z} {first} {}", + map.highest_taken(x, z).unwrap() + )?, + Err(_) => writeln!(out, "height {t} {x} {z} error")?, + } + } + } + "dump" => { + writeln!(out, "highest_section {}", chunk.highest_section_y())?; + for (t, map) in maps.iter().enumerate() { + writeln!(out, "words {t} {}", map.raw_data().len())?; + for word in map.raw_data() { + writeln!(out, "{word:x}")?; + } + } + } + _ => panic!("unknown fixture operation"), + } + for read in chunk.reads.borrow_mut().drain(..) { + writeln!(out, "{read}")?; + } + } + Ok(()) +} +fn main() -> Result<(), Box> { + let directory = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&directory); + let facts: Value = serde_json::from_str(&fs::read_to_string(dir.join("facts-server.json"))?)?; + let tags: Value = serde_json::from_str(&fs::read_to_string(dir.join("tags.json"))?)?; + let mut definitions = TagDefinitions::default(); + for (name, text) in tags.as_object().unwrap() { + definitions.apply_json(name, "vanilla", text.as_str().unwrap())?; + } + let built = definitions.build(|id, _| facts["defaults"].get(id).map(|_| id.to_owned()))?; + assert!(built.missing.is_empty()); + let motion: BTreeSet<_> = built.tags["minecraft:blocks_motion_in_heightmap"] + .iter() + .map(String::as_str) + .collect(); + let no_leaves: BTreeSet<_> = built.tags["minecraft:blocks_motion_in_heightmap_no_leaves"] + .iter() + .map(String::as_str) + .collect(); + let states: Vec<_> = facts["states"] + .as_array() + .unwrap() + .iter() + .map(|a| { + let name = a[0].as_str().unwrap(); + State { + air: a[1].as_bool().unwrap(), + air_block: name == "minecraft:air", + fluid: a[2].as_bool().unwrap(), + motion: motion.contains(name), + no_leaves: no_leaves.contains(name), + } + }) + .collect(); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for (t, kind) in HeightmapType::ALL.iter().enumerate() { + writeln!( + out, + "type {t} {} {} {}", + kind.name(), + kind.send_to_client(), + kind.keep_after_worldgen() + )?; + } + for (id, &state) in states.iter().enumerate() { + let mask = HeightmapType::ALL + .iter() + .enumerate() + .fold(0, |mask, (t, kind)| { + mask | if kind.is_opaque(state) { 1 << t } else { 0 } + }); + writeln!(out, "predicate {id} {mask}")?; + } + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + fixture( + serde_json::from_str(line)?, + &states, + &facts["defaults"], + &mut out, + )?; + } + out.flush()?; + Ok(()) +} diff --git a/crates/horizon-world/examples/material_condition_fixture.rs b/crates/horizon-world/examples/material_condition_fixture.rs new file mode 100644 index 000000000..0cbb03168 --- /dev/null +++ b/crates/horizon-world/examples/material_condition_fixture.rs @@ -0,0 +1,735 @@ +//! Original comparison transport for material conditions and cache behavior. +use horizon_core::{ + density::{ConstantSampler, DensitySampler, SampleError, SamplerContext}, + noise::{DensityVolume, NanRange, Noise}, + position::BlockPos, + random::{LegacyRandom, PositionalRandom, RandomSource, XoroshiroRandom}, +}; +use horizon_world::worldgen::{ + anchor::{VerticalAnchor, WorldGenerationContext}, + biome_temperature::{BiomeTemperature, BiomeTemperatureSettings}, + decode_noise, + density::DensityRegistry, + material_condition::{ + MaterialCondition, MaterialConditionRegistry, MaterialConditions, MaterialDensitySources, + MaterialNoiseSources, MaterialRule, MaterialRuleError, MaterialRuleLibrary, + MaterialSurfaceQueries, + }, + material_surface::{ClayBandBlocks, MaterialSurface}, + tags::TagDefinitions, +}; +use horizon_world::{ + DATA_VERSION, + nbt::Tag, + registry::{BlockRegistry, BlockStateId, BlockStateJsonCodec}, +}; +use serde_json::Value; +use std::{ + collections::{BTreeMap, BTreeSet}, + fs, + io::{self, Write}, + path::Path, + sync::{Arc, Mutex}, +}; +// Canonicalize numeric values as double bits, avoiding differences in JSON +// number formatting while preserving every encoded int32/double value. +fn encoded(value: &MaterialCondition) -> String { + let Ok(text) = value.to_json() else { + return "error".to_owned(); + }; + let bytes = text.as_bytes(); + let mut transformed = Vec::new(); + let mut i = 0; + let mut quoted = false; + let mut escaped = false; + while i < bytes.len() { + if !quoted { + let special = [ + ("-Infinity", 0xfff0000000000000u64), + ("Infinity", 0x7ff0000000000000), + ("NaN", 0x7ff8000000000000), + ] + .into_iter() + .find(|(token, _)| bytes[i..].starts_with(token.as_bytes())); + if let Some((token, bits)) = special { + transformed.extend_from_slice(format!("\"number:{bits:x}\"").as_bytes()); + i += token.len(); + continue; + } + } + let c = bytes[i]; + transformed.push(c); + i += 1; + if escaped { + escaped = false; + } else if quoted && c == b'\\' { + escaped = true; + } else if c == b'"' { + quoted = !quoted; + } + } + fn normalize(value: &mut Value) { + match value { + Value::Number(n) => { + let v = n.as_f64().unwrap(); + *value = Value::String(format!("number:{:x}", v.to_bits())); + } + Value::Array(a) => a.iter_mut().for_each(normalize), + Value::Object(o) => o.values_mut().for_each(normalize), + _ => {} + } + } + let mut value: Value = serde_json::from_slice(&transformed).unwrap(); + normalize(&mut value); + serde_json::to_string(&value).unwrap() +} +fn anchor(v: &Value) -> VerticalAnchor { + let n = v[1].as_i64().unwrap() as i32; + match v[0].as_u64().unwrap() { + 0 => VerticalAnchor::Absolute(n), + 1 => VerticalAnchor::AboveBottom(n), + 2 => VerticalAnchor::BelowTop(n), + 3 => VerticalAnchor::RelativeToSeaLevel(n), + _ => panic!("unknown anchor"), + } +} +fn condition(v: &Value, registry: &MaterialConditionRegistry) -> MaterialCondition { + match v[0].as_str().unwrap() { + "json" => registry.decode(v[1].as_str().unwrap()).unwrap(), + "noise" => MaterialCondition::NoiseThreshold { + noise: v[1].as_str().unwrap().to_owned(), + min: f64::from_bits(u64::from_str_radix(v[2].as_str().unwrap(), 16).unwrap()), + max: f64::from_bits(u64::from_str_radix(v[3].as_str().unwrap(), 16).unwrap()), + is_3d: v[4].as_bool().unwrap(), + }, + "temperature" => MaterialCondition::Temperature, + "above" => MaterialCondition::AbovePreliminarySurface, + "biome" => MaterialCondition::Biome( + v[1].as_array() + .unwrap() + .iter() + .map(|name| name.as_str().unwrap().to_owned()) + .collect(), + ), + "hole" => MaterialCondition::Hole, + "steep" => MaterialCondition::Steep, + "y" => MaterialCondition::YAbove { + anchor: anchor(&v[1]), + surface_depth_multiplier: v[2].as_i64().unwrap() as i32, + add_stone_depth: v[3].as_bool().unwrap(), + }, + "water" => MaterialCondition::Water { + offset: v[1].as_i64().unwrap() as i32, + surface_depth_multiplier: v[2].as_i64().unwrap() as i32, + add_stone_depth: v[3].as_bool().unwrap(), + }, + "stone" => MaterialCondition::StoneDepth { + offset: v[1].as_i64().unwrap() as i32, + add_surface_depth: v[2].as_bool().unwrap(), + secondary_depth_range: v[3].as_i64().unwrap() as i32, + ceiling: v[4].as_bool().unwrap(), + }, + "gradient" => MaterialCondition::VerticalGradient { + random_name: v[1].as_str().unwrap().to_owned(), + true_at_and_below: anchor(&v[2]), + false_at_and_above: anchor(&v[3]), + }, + "not" => MaterialCondition::Not(Box::new(condition(&v[1], registry))), + _ => panic!("unknown condition"), + } +} +#[derive(Default, Debug)] +struct Inputs { + depth: i32, + secondary: f32, + queries: Vec, + biome: Option, + density: f32, + density_remaining: i32, + ore_values: [f32; 3], + ore_remaining: [i32; 3], +} +#[derive(Debug)] +struct TracedDensity { + inputs: Arc>, + channel: Option, +} +impl TracedDensity { + fn label(&self) -> String { + self.channel + .map(|i| format!("ore {i}")) + .unwrap_or_else(|| "density".to_owned()) + } +} +impl DensitySampler for TracedDensity { + fn sample_value(&self, _: &mut SamplerContext, position: [i32; 3]) -> Result { + let [x, y, z] = position; + let mut inputs = self.inputs.lock().unwrap(); + inputs + .queries + .push(format!("{} query {x} {y} {z}", self.label())); + let remaining = match self.channel { + Some(i) => &mut inputs.ore_remaining[i], + None => &mut inputs.density_remaining, + }; + if *remaining == 0 { + return Err(SampleError::SurfaceSearchOverflow); + } + if *remaining > 0 { + *remaining -= 1; + } + Ok(self + .channel + .map(|i| inputs.ore_values[i]) + .unwrap_or(inputs.density)) + } + fn sample_volume( + &self, + context: &mut SamplerContext, + buffer: &mut [f32], + volume: DensityVolume, + ) -> Result<(), SampleError> { + let [sx, sy, sz] = volume.sizes(); + let [x, y, z] = volume.minimum(); + let [dx, dy, dz] = volume.steps(); + self.inputs.lock().unwrap().queries.push(format!( + "{} volume {sx} {sy} {sz} {x} {y} {z} {dx} {dy} {dz}", + self.label() + )); + for iz in 0..sz { + for ix in 0..sx { + for iy in 0..sy { + buffer[iy + (ix + iz * sx) * sy] = self.sample_value( + context, + [ + x.wrapping_add((ix as i32).wrapping_mul(dx)), + y.wrapping_add((iy as i32).wrapping_mul(dy)), + z.wrapping_add((iz as i32).wrapping_mul(dz)), + ], + )?; + } + } + } + Ok(()) + } +} +struct Surface { + inputs: Arc>, + noises: MaterialNoiseSources>, + real_noise: bool, + biomes: Arc>>, + possible: Option>, +} +#[derive(Debug)] +struct TracedNoise { + name: String, + inputs: Arc>, +} +impl Noise for TracedNoise { + fn range(&self) -> Result<[f32; 2], NanRange> { + Ok([f32::NEG_INFINITY, f32::INFINITY]) + } + fn get2(&self, _: f64, _: f64) -> f32 { + panic!("unexpected 2D noise call") + } + fn get3(&self, x: f64, y: f64, z: f64) -> f32 { + let mut inputs = self.inputs.lock().unwrap(); + inputs.queries.push(format!( + "noise query {} {} {} {}", + self.name, x as i32, y as i32, z as i32 + )); + inputs.secondary + } +} +impl MaterialSurfaceQueries for Surface

{ + fn possible_biomes(&self) -> Option> { + self.possible.clone() + } + fn biome(&mut self, p: BlockPos) -> Result>, MaterialRuleError> { + let mut inputs = self.inputs.lock().unwrap(); + inputs + .queries + .push(format!("biome query {} {} {}", p.x, p.y, p.z)); + if inputs.biome.as_deref() == Some("#throw") { + return Err(MaterialRuleError::BiomeQueryFailed); + } + Ok(inputs.biome.as_deref().map(Arc::from)) + } + fn cold_enough_to_snow( + &mut self, + name: &str, + p: BlockPos, + sea: i32, + ) -> Result { + Ok(self + .biomes + .lock() + .unwrap() + .get_mut(name) + .ok_or(MaterialRuleError::MissingBiome)? + .cold_enough_to_snow(p, sea)) + } + fn bind_noise( + &mut self, + name: &str, + ) -> Result, horizon_world::worldgen::DecodeError> { + let real = self.noises.bind_noise(name)?; + if self.real_noise { + Ok(real) + } else { + Ok(Arc::new(TracedNoise { + name: name.to_owned(), + inputs: self.inputs.clone(), + })) + } + } + fn band(&mut self, position: BlockPos) -> Result { + self.noises.band(position) + } + fn surface_depth(&mut self, _: i32, _: i32) -> i32 { + self.inputs.lock().unwrap().depth + } + fn surface_secondary(&mut self, x: i32, z: i32) -> f64 { + let mut i = self.inputs.lock().unwrap(); + i.queries.push(format!("secondary query {x} {z}")); + f64::from(i.secondary) + } +} +fn rule( + v: &Value, + registry: &MaterialConditionRegistry, + inputs: &Arc>, +) -> MaterialRule { + match v[0].as_str().unwrap() { + "block" => MaterialRule::Block(BlockStateId(v[1].as_u64().unwrap() as u32)), + "band" => MaterialRule::Bandlands, + "ore" => MaterialRule::OreVein { + ore: BlockStateId(7), + raw_ore: BlockStateId(8), + filler: BlockStateId(9), + raw_ore_chance: f32::from_bits( + u32::from_str_radix(v[1].as_str().unwrap(), 16).unwrap(), + ), + density: Arc::new(TracedDensity { + inputs: inputs.clone(), + channel: Some(0), + }), + richness: Arc::new(TracedDensity { + inputs: inputs.clone(), + channel: Some(1), + }), + filler_gap: Arc::new(TracedDensity { + inputs: inputs.clone(), + channel: Some(2), + }), + }, + "if" => MaterialRule::Condition { + if_true: condition(&v[1], registry), + then_run: Box::new(rule(&v[2], registry, inputs)), + }, + "sequence" => MaterialRule::Sequence( + v[1].as_array() + .unwrap() + .iter() + .map(|v| rule(v, registry, inputs)) + .collect(), + ), + _ => panic!("unknown rule"), + } +} +fn queries(inputs: &Mutex, out: &mut impl Write) -> io::Result<()> { + for query in inputs.lock().unwrap().queries.drain(..) { + writeln!(out, "{query}")?; + } + Ok(()) +} +struct RuleData { + blocks: BlockRegistry, + integers: BTreeSet<(String, String)>, + densities: BTreeMap, + definitions: BTreeMap, +} +fn metadata_tag(v: &Value) -> Tag { + match v { + Value::String(s) => Tag::String(s.as_str().into()), + Value::Number(n) => Tag::Int(n.as_i64().unwrap() as i32), + Value::Array(a) => Tag::List(a.iter().map(metadata_tag).collect()), + Value::Object(o) => Tag::Compound( + o.iter() + .map(|(k, v)| (k.as_str().into(), metadata_tag(v))) + .collect(), + ), + _ => panic!("invalid registry metadata"), + } +} +impl RuleData { + fn library( + &self, + f: &Value, + conditions: &MaterialConditionRegistry, + noises: &BTreeMap, + query: Option<&str>, + ) -> Result> { + let mut definitions = self.definitions.clone(); + if let Some(query) = query { + definitions.insert("horizon:query".to_owned(), query.to_owned()); + } + let blocks = BlockStateJsonCodec::new(&self.blocks, self.integers.clone())?; + let densities = DensityRegistry::from_json(noises, &self.densities)?; + Ok(MaterialRuleLibrary::from_json( + &definitions, + conditions, + &blocks, + densities, + f["seed"].as_i64().unwrap(), + f["legacy"].as_bool().unwrap(), + )?) + } +} +fn fixture( + f: &Value, + registry: &MaterialConditionRegistry, + noises: &BTreeMap, + biomes: Arc>>, + rules_data: Option<&RuleData>, + mut random: R, + out: &mut impl Write, +) -> Result<(), Box> +where + R::Positional: Clone, +{ + let [min, height, sea] = std::array::from_fn(|i| f["context"][i].as_i64().unwrap() as i32); + let generation = WorldGenerationContext::new(min, height, sea); + let inputs = Arc::new(Mutex::new(Inputs { + biome: Some("minecraft:plains".to_owned()), + density_remaining: -1, + ore_values: f + .get("ore_values") + .map(|v| { + std::array::from_fn(|i| { + f32::from_bits(u32::from_str_radix(v[i].as_str().unwrap(), 16).unwrap()) + }) + }) + .unwrap_or([1.0, 1.0, -1.0]), + ore_remaining: [-1; 3], + ..Inputs::default() + })); + let root = random.fork_positional(); + let mut samplers: Vec> = Vec::new(); + for name in ["clay_bands_offset", "surface", "surface_secondary"] { + let id = format!("minecraft:{name}"); + samplers.push(Arc::new( + decode_noise(&noises[&id])?.create(&mut root.from_hash_of(&id))?, + )); + } + let mut library = rules_data + .map(|data| data.library(f, registry, noises, None)) + .transpose()?; + if let Some(data) = rules_data { + if let Some(values) = f.get("library_json") { + for value in values.as_array().unwrap() { + let result = data.library(f, registry, noises, Some(value.as_str().unwrap())); + writeln!( + out, + "rule decode {}", + if result.is_ok() { "ok" } else { "error" } + )?; + } + } + } + let block_id = |name: &str, fallback| { + rules_data + .map(|data| { + data.blocks + .default_state(&format!("minecraft:{name}")) + .unwrap() + }) + .unwrap_or(BlockStateId(fallback)) + }; + let blocks = ClayBandBlocks { + terracotta: block_id("terracotta", 0), + orange: block_id("orange_terracotta", 1), + yellow: block_id("yellow_terracotta", 2), + brown: block_id("brown_terracotta", 3), + red: block_id("red_terracotta", 4), + white: block_id("white_terracotta", 5), + light_gray: block_id("light_gray_terracotta", 6), + }; + let surface = MaterialSurface::new( + root.clone(), + blocks, + samplers[0].clone(), + samplers[1].clone(), + samplers[2].clone(), + ); + let sources = MaterialNoiseSources::from_json(root.clone(), surface, noises)?; + let surface = Surface { + inputs: inputs.clone(), + noises: sources, + real_noise: f["real_noise"].as_bool().unwrap_or(false), + biomes, + possible: f.get("possible_biomes").filter(|v| !v.is_null()).map(|v| { + v.as_array() + .unwrap() + .iter() + .map(|v| v.as_str().unwrap().to_owned()) + .collect() + }), + }; + let dims: [i32; 9] = f + .get("volume") + .map(|v| std::array::from_fn(|i| v[i].as_i64().unwrap() as i32)) + .unwrap_or([16, 1, 16, 0, 0, 0, 1, 1, 1]); + let expected = DensityVolume::new( + dims[..3].try_into().unwrap(), + dims[3..6].try_into().unwrap(), + dims[6..].try_into().unwrap(), + )?; + let surface = MaterialDensitySources::new( + surface, + expected, + if library.is_some() { + Arc::new(ConstantSampler(0.0)) + } else { + Arc::new(TracedDensity { + inputs: inputs.clone(), + channel: None, + }) + }, + if library.is_some() { + SamplerContext::cached() + } else { + SamplerContext::default() + }, + )?; + let mut worker = MaterialConditions::::new(generation, root, surface); + let mut count = 0; + for c in f["conditions"].as_array().unwrap() { + let value = condition(c, registry); + writeln!(out, "runtime {}", encoded(&value))?; + worker.add(value)?; + count += 1; + } + if let Some(values) = f.get("json") { + for value in values.as_array().unwrap() { + match registry.decode(value.as_str().unwrap()) { + Err(_) => writeln!(out, "decode error")?, + Ok(condition) => { + writeln!(out, "decode {}", encoded(&condition))?; + match worker.add(condition) { + Ok(_) => count += 1, + Err(_) => writeln!(out, "compile error")?, + } + } + } + } + } + let mut rule_count = 0; + if let Some(values) = f.get("rules") { + for value in values.as_array().unwrap() { + worker.add_rule(rule(value, registry, &inputs))?; + queries(&inputs, out)?; + rule_count += 1; + } + } + if let Some(library) = &mut library { + for name in f["library_rules"].as_array().unwrap() { + worker.add_rule(library.rule(name.as_str().unwrap())?)?; + queries(&inputs, out)?; + rule_count += 1; + } + } + for op in f["ops"].as_array().unwrap() { + match op[0].as_str().unwrap() { + "ore_input" => { + let mut i = inputs.lock().unwrap(); + let channel = op[1].as_u64().unwrap() as usize; + i.ore_values[channel] = + f32::from_bits(u32::from_str_radix(op[2].as_str().unwrap(), 16)?); + i.ore_remaining[channel] = op[3].as_i64().unwrap() as i32; + } + "density" => { + let mut i = inputs.lock().unwrap(); + i.density = f32::from_bits(u32::from_str_radix(op[1].as_str().unwrap(), 16)?); + i.density_remaining = op[2].as_i64().unwrap() as i32; + } + "minimum" => { + let value = worker.minimum_surface_level(); + queries(&inputs, out)?; + match value { + Ok(v) => writeln!(out, "minimum {v}")?, + Err(_) => writeln!(out, "minimum error")?, + } + } + "biome" => inputs.lock().unwrap().biome = op[1].as_str().map(str::to_owned), + "rule" => { + let result = worker.add_rule(rule(&op[1], registry, &inputs)); + queries(&inputs, out)?; + match result { + Ok(index) => { + rule_count += 1; + writeln!(out, "rule added {index}")?; + } + Err(_) => writeln!(out, "rule compile error")?, + } + } + "apply" => { + let position = BlockPos::new( + op[1].as_i64().unwrap() as i32, + op[2].as_i64().unwrap() as i32, + op[3].as_i64().unwrap() as i32, + ); + for index in 0..rule_count { + let result = worker.try_apply(index, position); + queries(&inputs, out)?; + match result { + Ok(Some(block)) => writeln!(out, "rule {index} {}", block.0)?, + Ok(None) => writeln!(out, "rule {index} none")?, + Err(_) => writeln!(out, "rule {index} error")?, + } + } + } + "input" => { + let mut i = inputs.lock().unwrap(); + i.depth = op[1].as_i64().unwrap() as i32; + i.secondary = f32::from_bits(u32::from_str_radix(op[2].as_str().unwrap(), 16)?); + } + "xz" => worker.update_xz( + op[1].as_i64().unwrap() as i32, + op[2].as_i64().unwrap() as i32, + op[3].as_i64().unwrap() as i32, + op[4].as_i64().unwrap() as i32, + ), + "y" => worker.update_y( + op[1].as_i64().unwrap() as i32, + op[2].as_i64().unwrap() as i32, + op[3].as_i64().unwrap() as i32, + op[4].as_i64().unwrap() as i32, + ), + "add" => { + let index = worker.add(condition(&op[1], registry))?; + writeln!(out, "added {index}")?; + count += 1; + } + "eval" => { + let indices = if op.as_array().unwrap().len() == 1 { + (0..count).collect() + } else { + op[1] + .as_array() + .unwrap() + .iter() + .map(|i| i.as_u64().unwrap() as usize) + .collect::>() + }; + for index in indices { + let result = worker.test(index); + queries(&inputs, out)?; + match result { + Ok(value) => writeln!(out, "eval {index} {value}")?, + Err(_) => writeln!(out, "eval {index} error")?, + } + } + } + "secondary" => { + let value = worker.surface_secondary(); + queries(&inputs, out)?; + let bits = if value.is_nan() { + 0x7ff8000000000000 + } else { + value.to_bits() + }; + writeln!(out, "secondary {bits:x}")?; + } + _ => panic!("unknown operation"), + } + } + Ok(()) +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + let definitions = serde_json::from_str(&fs::read_to_string(dir.join("conditions.json"))?)?; + let biome_definitions: BTreeMap = + serde_json::from_str(&fs::read_to_string(dir.join("biomes.json"))?)?; + let mut temperatures = BTreeMap::new(); + for (name, json) in &biome_definitions { + temperatures.insert( + name.clone(), + BiomeTemperature::new(BiomeTemperatureSettings::from_json(json)?), + ); + } + let biomes = Arc::new(Mutex::new(temperatures)); + let tag_json: BTreeMap = + serde_json::from_str(&fs::read_to_string(dir.join("biome_tags.json"))?)?; + let mut tag_definitions = TagDefinitions::default(); + for (name, json) in tag_json { + tag_definitions.apply_json(&name, "vanilla", &json)?; + } + let tags = tag_definitions + .build(|id, _required| biome_definitions.contains_key(id).then(|| id.to_owned()))?; + assert!(tags.missing.is_empty()); + let registry = MaterialConditionRegistry::from_json_with_biome_tags( + &definitions, + &biome_definitions.keys().cloned().collect(), + &tags.tags, + )?; + let noises = serde_json::from_str(&fs::read_to_string(dir.join("noises.json"))?)?; + let rules_data = if dir.join("rules.json").exists() { + let facts: Value = + serde_json::from_str(&fs::read_to_string(dir.join("facts-server.json"))?)?; + Some(RuleData { + blocks: BlockRegistry::from_nbt(&Tag::compound([ + ("DataVersion", Tag::Int(DATA_VERSION)), + ("states", metadata_tag(&facts["states"])), + ("defaults", metadata_tag(&facts["defaults"])), + ]))?, + integers: facts["integers"] + .as_array() + .unwrap() + .iter() + .map(|v| { + ( + v[0].as_str().unwrap().to_owned(), + v[1].as_str().unwrap().to_owned(), + ) + }) + .collect(), + densities: serde_json::from_str(&fs::read_to_string(dir.join("densities.json"))?)?, + definitions: serde_json::from_str(&fs::read_to_string(dir.join("rules.json"))?)?, + }) + } else { + None + }; + for (name, value) in registry.entries() { + writeln!(out, "registry {name} {}", encoded(value))?; + } + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let seed = f["seed"].as_i64().unwrap(); + if f["legacy"].as_bool().unwrap() { + fixture( + &f, + ®istry, + &noises, + biomes.clone(), + rules_data.as_ref(), + LegacyRandom::new(seed), + &mut out, + )? + } else { + fixture( + &f, + ®istry, + &noises, + biomes.clone(), + rules_data.as_ref(), + XoroshiroRandom::new(seed), + &mut out, + )? + } + } + out.flush()?; + Ok(()) +} diff --git a/crates/horizon-world/examples/material_extension_fixture.rs b/crates/horizon-world/examples/material_extension_fixture.rs new file mode 100644 index 000000000..a48943723 --- /dev/null +++ b/crates/horizon-world/examples/material_extension_fixture.rs @@ -0,0 +1,208 @@ +//! Original column-extension comparison transport. +use horizon_core::{ + noise::{NanRange, Noise}, + random::{LegacyRandom, PositionalRandom, RandomSource, XoroshiroRandom}, +}; +use horizon_world::{ + registry::BlockStateId, + worldgen::{ + biome_temperature::{BiomeTemperature, BiomeTemperatureSettings}, + decode_noise, + material_extensions::{ + ExtensionBlocks, ExtensionNoises, MaterialColumn, MaterialExtensions, + }, + }, +}; +use serde_json::Value; +use std::{ + collections::BTreeMap, + fs, + io::{self, Write}, + path::Path, + sync::{Arc, Mutex}, +}; +const NAMES: [&str; 6] = [ + "badlands_surface", + "badlands_pillar", + "badlands_pillar_roof", + "iceberg_surface", + "iceberg_pillar", + "iceberg_pillar_roof", +]; +#[derive(Debug)] +struct TracedNoise { + name: &'static str, + real: Arc, + constant: Option, + trace: Arc>>, +} +impl Noise for TracedNoise { + fn range(&self) -> Result<[f32; 2], NanRange> { + Ok([f32::NEG_INFINITY, f32::INFINITY]) + } + fn get2(&self, _: f64, _: f64) -> f32 { + panic!("unexpected 2D noise query") + } + fn get3(&self, x: f64, y: f64, z: f64) -> f32 { + self.trace.lock().unwrap().push(format!( + "noise {} {:x} {:x} {:x}", + self.name, + x.to_bits(), + y.to_bits(), + z.to_bits() + )); + self.constant.unwrap_or_else(|| self.real.get3(x, y, z)) + } +} +struct Column { + min: i32, + values: Vec, + remaining: i32, + trace: Arc>>, +} +impl Column { + fn index(&self, y: i32) -> Option { + let i = i64::from(y) - i64::from(self.min); + (i >= 0 && i < self.values.len() as i64).then_some(i as usize) + } +} +impl MaterialColumn for Column { + type Error = io::Error; + fn block(&mut self, y: i32) -> io::Result { + if self.remaining == 0 { + self.trace.lock().unwrap().push(format!("read error {y}")); + return Err(io::Error::other("fixture read limit")); + } + self.remaining -= 1; + let id = self + .index(y) + .map(|i| self.values[i]) + .unwrap_or(BlockStateId(2)); + self.trace + .lock() + .unwrap() + .push(format!("read {y} {}", id.0)); + Ok(id) + } + fn set_block(&mut self, y: i32, state: BlockStateId) -> io::Result<()> { + self.trace + .lock() + .unwrap() + .push(format!("write {y} {}", state.0)); + if let Some(i) = self.index(y) { + self.values[i] = state; + } + Ok(()) + } + fn is_air(&self, state: BlockStateId) -> bool { + state.0 <= 2 + } + fn same_block(&self, a: BlockStateId, b: BlockStateId) -> bool { + let kind = |id: BlockStateId| match id.0 { + 5 => 4, + 9 => 8, + other => other, + }; + kind(a) == kind(b) + } +} +fn fixture( + f: &Value, + noises: &BTreeMap, + biomes: &BTreeMap, + mut random: R, + out: &mut impl Write, +) -> Result<(), Box> +where + R::Positional: Clone, +{ + let root = random.fork_positional(); + let trace = Arc::new(Mutex::new(Vec::new())); + let mut sources = Vec::>::new(); + for (i, name) in NAMES.iter().enumerate() { + let id = format!("minecraft:{name}"); + sources.push(Arc::new(TracedNoise { + name, + real: Arc::new(decode_noise(&noises[&id])?.create(&mut root.from_hash_of(&id))?), + constant: f + .get("noise_bits") + .map(|v| f32::from_bits(u32::from_str_radix(v[i].as_str().unwrap(), 16).unwrap())), + trace: trace.clone(), + })); + } + let system = MaterialExtensions::new( + root, + ExtensionBlocks { + default: BlockStateId(f["default"].as_u64().unwrap() as u32), + water: BlockStateId(4), + packed_ice: BlockStateId(7), + snow: BlockStateId(6), + }, + ExtensionNoises { + badlands_surface: sources[0].clone(), + badlands_pillar: sources[1].clone(), + badlands_roof: sources[2].clone(), + iceberg_surface: sources[3].clone(), + iceberg_pillar: sources[4].clone(), + iceberg_roof: sources[5].clone(), + }, + f["sea"].as_i64().unwrap() as i32, + ); + let mut biome = BiomeTemperature::new(BiomeTemperatureSettings::from_json( + &biomes[f["biome"].as_str().unwrap()], + )?); + let mut column = Column { + min: f["min"].as_i64().unwrap() as i32, + values: f["initial"] + .as_array() + .unwrap() + .iter() + .map(|v| BlockStateId(v.as_u64().unwrap() as u32)) + .collect(), + remaining: 0, + trace: trace.clone(), + }; + for op in f["ops"].as_array().unwrap() { + column.remaining = f["limit"].as_i64().unwrap() as i32; + let x = op[1].as_i64().unwrap() as i32; + let z = op[2].as_i64().unwrap() as i32; + let surface = op[3].as_i64().unwrap() as i32; + let minimum = op[4].as_i64().unwrap() as i32; + let result = match op[0].as_str().unwrap() { + "badlands" => system.eroded_badlands(&mut column, x, z, surface, minimum), + "frozen" => system.frozen_ocean(&mut column, &mut biome, [x, z], surface, minimum), + _ => panic!("unknown extension"), + }; + for event in trace.lock().unwrap().drain(..) { + writeln!(out, "{event}")?; + } + writeln!( + out, + "result {}", + if result.is_ok() { "ok" } else { "error" } + )?; + write!(out, "column")?; + for id in &column.values { + write!(out, " {}", id.0)?; + } + writeln!(out)?; + } + Ok(()) +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let noises = serde_json::from_str(&fs::read_to_string(dir.join("noises.json"))?)?; + let biomes = serde_json::from_str(&fs::read_to_string(dir.join("biomes.json"))?)?; + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let seed = f["seed"].as_i64().unwrap(); + if f["legacy"].as_bool().unwrap() { + fixture(&f, &noises, &biomes, LegacyRandom::new(seed), &mut out)?; + } else { + fixture(&f, &noises, &biomes, XoroshiroRandom::new(seed), &mut out)?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/examples/material_stage_fixture.rs b/crates/horizon-world/examples/material_stage_fixture.rs new file mode 100644 index 000000000..6682b04b7 --- /dev/null +++ b/crates/horizon-world/examples/material_stage_fixture.rs @@ -0,0 +1,838 @@ +//! Original transport for complete surface-stage chunk comparison. +use horizon_core::{ + biome::{BiomeZoom, obfuscate_seed}, + carving::CarvingMask, + density::{ConstantSampler, SamplerContext}, + noise::{DensityVolume, Noise}, + position::{BlockPos, ChunkPos}, + random::{LegacyRandom, PositionalRandom, RandomSource, XoroshiroRandom}, +}; +use horizon_world::{ + DATA_VERSION, + heightmap::{HeightmapState, HeightmapType}, + nbt::Tag, + registry::{BlockRegistry, BlockStateId, BlockStateJsonCodec}, + worldgen::{ + DecodeError, + anchor::WorldGenerationContext, + aquifer::{ + AquiferConfig, AquiferError, DisabledAquifer, GlobalFluidPicker, NoiseBasedAquifer, + RegistryAquiferBlockStates, + }, + biome_chunk::BiomeChunk, + biome_source::{BiomeSourceCatalog, BiomeSourceResolver}, + biome_temperature::{BiomeTemperature, BiomeTemperatureSettings}, + carver::{CarverCatalog, WorldCarver, generate_carving_mask}, + carving::{CarvingBlocks, apply_carving_mask}, + decode_noise, + density::DensityRegistry, + material_condition::{ + MaterialConditionRegistry, MaterialNoiseSources, MaterialRuleError, + MaterialRuleLibrary, MaterialSurfaceQueries, + }, + material_extensions::{ExtensionBlocks, ExtensionNoises, MaterialExtensions}, + material_stage::{SurfaceInputs, TopMaterialInputs, build_surface, top_material}, + material_surface::{ClayBandBlocks, MaterialSurface}, + router::{NoiseRouter, RouterField}, + tags::TagDefinitions, + terrain::{TerrainAquifer, TerrainBlockStates, TerrainChunk, fill_noise}, + }, +}; +use serde_json::Value; +use std::{ + collections::{BTreeMap, BTreeSet}, + fs, + io::{self, Write}, + path::Path, + sync::{Arc, Mutex}, +}; +#[derive(Clone, Copy)] +struct State { + air: bool, + air_block: bool, + fluid: bool, + motion: bool, + no_leaves: bool, +} +impl HeightmapState for State { + fn is_air(self) -> bool { + self.air + } + fn is_air_block(self) -> bool { + self.air_block + } + fn has_fluid(self) -> bool { + self.fluid + } + fn blocks_motion_in_heightmap(self) -> bool { + self.motion + } + fn blocks_motion_in_heightmap_no_leaves(self) -> bool { + self.no_leaves + } +} +struct Properties<'a>(&'a [State]); +impl TerrainBlockStates for Properties<'_> { + type State = State; + fn heightmap_state(&self, id: BlockStateId) -> State { + self.0[id.0 as usize] + } +} +fn tag(v: &Value) -> Tag { + match v { + Value::String(s) => Tag::String(s.as_str().into()), + Value::Number(n) => Tag::Int(n.as_i64().unwrap() as i32), + Value::Array(a) => Tag::List(a.iter().map(tag).collect()), + Value::Object(o) => { + Tag::Compound(o.iter().map(|(k, v)| (k.as_str().into(), tag(v))).collect()) + } + _ => panic!("invalid registry metadata"), + } +} +fn n(v: &Value) -> i32 { + v.as_i64().unwrap() as i32 +} +type BiomeNeighborhood = BTreeMap<(i32, i32), BiomeChunk>>; +type Temperatures = Arc>>; +struct Surface { + noises: MaterialNoiseSources>, + choices: Vec>, + zoom: Option, + neighborhood: Option, + possible: Option>, + temperatures: Temperatures, + trace: Arc>>, +} +impl MaterialSurfaceQueries for Surface

{ + fn surface_depth(&mut self, x: i32, z: i32) -> i32 { + self.noises.surface_depth(x, z) + } + fn surface_secondary(&mut self, x: i32, z: i32) -> f64 { + self.noises.surface_secondary(x, z) + } + fn band(&mut self, p: BlockPos) -> Result { + self.noises.band(p) + } + fn bind_noise(&mut self, name: &str) -> Result, DecodeError> { + self.noises.bind_noise(name) + } + fn possible_biomes(&self) -> Option> { + self.possible.clone() + } + fn biome(&mut self, p: BlockPos) -> Result>, MaterialRuleError> { + let [x, y, z] = self + .zoom + .map_or([p.x, p.y, p.z], |zoom| zoom.quart_at_block(p)); + let hash = x + .wrapping_mul(31) + .wrapping_add(y.wrapping_mul(7)) + .wrapping_add(z.wrapping_mul(17)); + let name = if let Some(chunks) = &self.neighborhood { + chunks + .get(&(x >> 2, z >> 2)) + .ok_or(MaterialRuleError::MissingBiome)? + .noise_biome([x, y, z]) + .clone() + } else { + self.choices[hash.rem_euclid(self.choices.len() as i32) as usize].clone() + }; + if self.zoom.is_some() { + self.trace + .lock() + .unwrap() + .push(format!("quart {x} {y} {z} {name}")); + } + self.trace + .lock() + .unwrap() + .push(format!("biome {} {} {} {name}", p.x, p.y, p.z)); + Ok(Some(name)) + } + fn cold_enough_to_snow( + &mut self, + name: &str, + p: BlockPos, + sea: i32, + ) -> Result { + Ok(self + .temperatures + .lock() + .unwrap() + .get_mut(name) + .unwrap() + .cold_enough_to_snow(p, sea)) + } + fn melts_frozen_ocean( + &mut self, + name: &str, + p: BlockPos, + sea: i32, + ) -> Result { + Ok(self + .temperatures + .lock() + .unwrap() + .get_mut(name) + .unwrap() + .should_melt_frozen_ocean_iceberg_slightly(p, sea)) + } +} +struct Data { + registry: BlockRegistry, + integers: BTreeSet<(String, String)>, + properties: Vec, + carving_blocks: CarvingBlocks, + biome_carvers: BTreeMap>>, + conditions: MaterialConditionRegistry, + noises: BTreeMap, + densities: BTreeMap, + rules: BTreeMap, + presets: BTreeMap, + source_catalog: BiomeSourceCatalog, + temperatures: Temperatures, +} +fn biome_neighborhood( + f: &Value, + resolver: Option<&mut BiomeSourceResolver<'_>>, + out: &mut impl Write, +) -> Result, Box> { + let Some(resolver) = resolver else { + return Ok(None); + }; + let (cx, cz, min, height) = (n(&f["cx"]), n(&f["cz"]), n(&f["min"]), n(&f["height"])); + let mut chunks = BTreeMap::new(); + for dx in -1..=1 { + for dz in -1..=1 { + let (x, z) = (cx.wrapping_add(dx), cz.wrapping_add(dz)); + let mut chunk = BiomeChunk::new( + ChunkPos::new(x, z), + min, + height, + Arc::::from("minecraft:plains"), + )?; + let mut context = SamplerContext::cached(); + let volume = resolver.prepare_volume( + &mut context, + [x.wrapping_shl(4) >> 2, min >> 2, z.wrapping_shl(4) >> 2], + [4, height >> 2, 4], + )?; + chunk.fill(min, min + height - 1, |quart| { + resolver + .sample_prepared(&mut context, volume.as_ref(), quart) + .map(Arc::from) + })?; + writeln!(out, "biomechunk {x} {z}")?; + for section in 0..height as usize / 16 { + for name in chunk.section(section).unwrap() { + writeln!(out, "stored {name}")?; + } + } + chunks.insert((x, z), chunk); + } + } + Ok(Some(chunks)) +} +fn fixture( + f: &Value, + data: &Data, + mut random: R, + out: &mut impl Write, +) -> Result<(), Box> +where + R::Positional: Clone, +{ + let root = random.fork_positional(); + let seed = f["seed"].as_i64().unwrap(); + let legacy = f["legacy"].as_bool().unwrap(); + let codec = BlockStateJsonCodec::new(&data.registry, data.integers.clone())?; + let mut densities = DensityRegistry::from_json(&data.noises, &data.densities)?; + let router = f + .get("router") + .map(|value| NoiseRouter::from_json(&value.to_string(), &mut densities)) + .transpose()?; + let aquifers = f + .get("aquifers") + .filter(|value| !value.is_null()) + .map(|value| AquiferConfig::from_json(&value.to_string(), &mut densities)) + .transpose()?; + let mut library = MaterialRuleLibrary::from_json( + &data.rules, + &data.conditions, + &codec, + densities, + seed, + legacy, + )?; + let router = router + .map(|value| library.compile_router(value)) + .transpose()?; + let aquifers = aquifers + .map(|value| library.compile_aquifer(value)) + .transpose()?; + let rule = library.rule(f["rule"].as_str().unwrap())?; + let preliminary = if let Some(ref router) = router { + router.get(RouterField::ChunkSurfaceLevel).clone() + } else if let Some(name) = f["preliminary"].as_str() { + library.named_density(name)? + } else { + Arc::new(ConstantSampler(f["preliminary"].as_f64().unwrap() as f32)) + }; + let source = f + .get("biome_source_json") + .map(|json| { + data.source_catalog + .decode(&json.to_string())? + .resolve(&data.presets) + }) + .transpose()?; + let climate = router.as_ref().map(|r| r.climate_sampler()); + let mut biome_resolver = source.as_ref().map(|source| { + source.resolver( + climate.as_ref().unwrap(), + router.as_ref().unwrap().get(RouterField::Erosion).as_ref(), + ) + }); + let neighborhood = biome_neighborhood(f, biome_resolver.as_mut(), out)?; + let sampler = |name: &str| -> Result, DecodeError> { + let id = format!("minecraft:{name}"); + Ok(Arc::new( + decode_noise(&data.noises[&id])?.create(&mut root.from_hash_of(&id))?, + )) + }; + let surface = MaterialSurface::new( + root.clone(), + ClayBandBlocks::from_registry(&data.registry).unwrap(), + sampler("clay_bands_offset")?, + sampler("surface")?, + sampler("surface_secondary")?, + ); + let trace = Arc::new(Mutex::new(Vec::new())); + let mut surface = Surface { + noises: MaterialNoiseSources::from_json(root.clone(), surface, &data.noises)?, + neighborhood, + zoom: f["biome_zoom"] + .as_bool() + .unwrap_or(false) + .then(|| BiomeZoom::new(obfuscate_seed(seed))), + choices: f["biome_choices"] + .as_array() + .unwrap() + .iter() + .map(|v| Arc::from(v.as_str().unwrap())) + .collect(), + possible: f["possible"] + .as_array() + .map(|v| v.iter().map(|v| v.as_str().unwrap().to_owned()).collect()), + temperatures: data.temperatures.clone(), + trace: trace.clone(), + }; + let extensions = MaterialExtensions::new( + root.clone(), + ExtensionBlocks { + default: BlockStateId(f["default"].as_u64().unwrap() as u32), + water: data.registry.default_state("minecraft:water").unwrap(), + packed_ice: data.registry.default_state("minecraft:packed_ice").unwrap(), + snow: data.registry.default_state("minecraft:snow_block").unwrap(), + }, + ExtensionNoises { + badlands_surface: sampler("badlands_surface")?, + badlands_pillar: sampler("badlands_pillar")?, + badlands_roof: sampler("badlands_pillar_roof")?, + iceberg_surface: sampler("iceberg_surface")?, + iceberg_pillar: sampler("iceberg_pillar")?, + iceberg_roof: sampler("iceberg_pillar_roof")?, + }, + n(&f["sea"]), + ); + let (cx, cz, min, height) = (n(&f["cx"]), n(&f["cz"]), n(&f["min"]), n(&f["height"])); + let mut chunk = TerrainChunk::new( + ChunkPos::new(cx, cz), + min, + height, + &data.registry, + Properties(&data.properties), + )?; + for span in f["initial"].as_array().unwrap() { + for y in n(&span[1])..=n(&span[3]) { + chunk.set_block_raw( + n(&span[0]), + y, + n(&span[2]), + BlockStateId(span[4].as_u64().unwrap() as u32), + )?; + } + } + if f["prime"].as_bool().unwrap() { + chunk.prime_heightmaps(&[HeightmapType::WorldSurfaceWg, HeightmapType::OceanFloorWg])?; + } + let mut context = SamplerContext::cached(); + let volume = DensityVolume::new( + [16, n(&f["noise_height"]), 16], + [cx.wrapping_shl(4), n(&f["noise_min"]), cz.wrapping_shl(4)], + [1; 3], + )?; + let air = data.registry.default_state("minecraft:air").unwrap(); + let picker = GlobalFluidPicker::new( + n(&f["sea"]), + f.get("fluid").map_or_else( + || data.registry.default_state("minecraft:water").unwrap(), + |v| BlockStateId(v.as_u64().unwrap() as u32), + ), + data.registry.default_state("minecraft:lava").unwrap(), + air, + ); + let mut aquifer: Box = if let Some(samplers) = aquifers { + Box::new(NoiseBasedAquifer::new( + samplers, + picker, + root.from_hash_of("minecraft:aquifer").fork_positional(), + RegistryAquiferBlockStates::new(&data.registry)?, + volume, + &mut context, + )?) + } else { + Box::new(DisabledAquifer::new(picker, air)) + }; + if let Some(ref router) = router { + fill_noise( + &mut chunk, + volume, + router.get(RouterField::FinalDensity).as_ref(), + &mut context, + aquifer.as_mut(), + BlockStateId(f["default"].as_u64().unwrap() as u32), + )?; + writeln!(out, "terrain {}", aquifer.should_schedule_fluid_update())?; + dump(&mut chunk, height, out)?; + } + for repeat in 0..n(&f["repeats"]) { + let inputs = SurfaceInputs:: { + generation: WorldGenerationContext::new(min, height, n(&f["sea"])), + noise_volume: volume, + root: root.clone(), + surface: &mut surface, + preliminary_surface: preliminary.clone(), + density_context: &mut context, + write_min_y: n(&f["write_min"]), + write_max_y: n(&f["write_max"]), + }; + let result = build_surface(&mut chunk, rule.clone(), inputs, &extensions); + for event in trace.lock().unwrap().drain(..) { + writeln!(out, "{event}")?; + } + writeln!( + out, + "surface {repeat} {}", + if result.is_ok() { "ok" } else { "error" } + )?; + if let Err(error) = result { + eprintln!("surface failure: {error}"); + } + dump(&mut chunk, height, out)?; + } + for query in f["top_queries"].as_array().unwrap() { + let position = BlockPos::new(n(&query[0]), n(&query[1]), n(&query[2])); + let result = top_material( + &mut chunk, + rule.clone(), + TopMaterialInputs:: { + generation: WorldGenerationContext::new(min, height, n(&f["sea"])), + root: root.clone(), + surface: &mut surface, + preliminary_surface: preliminary.clone(), + density_context: &mut context, + }, + position, + query[3].as_bool().unwrap(), + ); + for event in trace.lock().unwrap().drain(..) { + writeln!(out, "{event}")?; + } + match result { + Ok(Some(state)) => writeln!(out, "top {}", state.0)?, + Ok(None) => writeln!(out, "top none")?, + Err(error) => { + writeln!(out, "top error")?; + eprintln!("top failure: {error}"); + } + } + } + if let Some(resolver) = biome_resolver.as_mut() { + let mut biome_context = SamplerContext::default(); + let generation = WorldGenerationContext::new(min, height, n(&f["sea"])); + let generated = + generate_carving_mask(seed, ChunkPos::new(cx, cz), generation, false, |origin| { + let quart = [ + origin.x.wrapping_shl(4) >> 2, + 0, + origin.z.wrapping_shl(4) >> 2, + ]; + let name = raw_biome(resolver, &mut biome_context, quart, &trace)?; + data.biome_carvers + .get(name.as_ref()) + .map(Vec::as_slice) + .ok_or(MaterialRuleError::MissingBiome) + })?; + let mut traced = TracedAquifer { + inner: aquifer.as_mut(), + trace: trace.clone(), + }; + let result = if generated.is_empty() { + Ok(()) + } else { + apply_carving_mask( + &mut chunk, + &generated, + rule.clone(), + TopMaterialInputs:: { + generation, + root: root.clone(), + surface: CarverSurface { + surface: &mut surface, + resolver, + context: &mut biome_context, + zoom: BiomeZoom::new(obfuscate_seed(seed)), + trace: trace.clone(), + }, + preliminary_surface: preliminary.clone(), + density_context: &mut context, + }, + &mut traced, + &data.carving_blocks, + |_| true, + ) + }; + for event in trace.lock().unwrap().drain(..) { + writeln!(out, "{event}")?; + } + writeln!( + out, + "generatedcarving {}", + if result.is_ok() { "ok" } else { "error" } + )?; + if let Err(error) = result { + eprintln!("generated carving failure: {error}"); + } + dump(&mut chunk, height, out)?; + } + let carving = &f["carving"]; + for q in carving["initial"].as_array().unwrap() { + chunk.set_block_worldgen( + n(&q[0]), + n(&q[1]), + n(&q[2]), + BlockStateId(q[3].as_u64().unwrap() as u32), + )?; + } + let mut mask = CarvingMask::new(min + 1, min + height - 8)?; + for q in carving["spans"].as_array().unwrap() { + for y in n(&q[2])..=n(&q[3]) { + mask.carve(n(&q[0]), y, n(&q[1]))?; + } + } + let mut traced = TracedAquifer { + inner: aquifer.as_mut(), + trace: trace.clone(), + }; + for mode in carving["filters"].as_array().unwrap() { + let mode = n(mode); + let result = apply_carving_mask( + &mut chunk, + &mask, + rule.clone(), + TopMaterialInputs:: { + generation: WorldGenerationContext::new(min, height, n(&f["sea"])), + root: root.clone(), + surface: &mut surface, + preliminary_surface: preliminary.clone(), + density_context: &mut context, + }, + &mut traced, + &data.carving_blocks, + |[x, y, z]| { + if mode == 0 { + return true; + } + let keep = mode == 1 + && x.wrapping_mul(31) + .wrapping_add(y.wrapping_mul(7)) + .wrapping_add(z.wrapping_mul(17)) + .rem_euclid(5) + != 0; + trace + .lock() + .unwrap() + .push(format!("filter {x} {y} {z} {keep}")); + keep + }, + ); + for event in trace.lock().unwrap().drain(..) { + writeln!(out, "{event}")?; + } + writeln!( + out, + "carving {mode} {}", + if result.is_ok() { "ok" } else { "error" } + )?; + if let Err(error) = result { + eprintln!("carving failure: {error}"); + } + dump(&mut chunk, height, out)?; + } + Ok(()) +} +fn raw_biome( + resolver: &mut BiomeSourceResolver<'_>, + context: &mut SamplerContext, + [x, y, z]: [i32; 3], + trace: &Arc>>, +) -> Result, MaterialRuleError> { + let name = resolver + .sample(context, [x, y, z]) + .map_err(|_| MaterialRuleError::BiomeQueryFailed)?; + trace + .lock() + .unwrap() + .push(format!("rawquart {x} {y} {z} {name}")); + Ok(Arc::from(name)) +} +struct CarverSurface<'a, 'b, P: PositionalRandom> { + surface: &'a mut Surface

, + resolver: &'a mut BiomeSourceResolver<'b>, + context: &'a mut SamplerContext, + zoom: BiomeZoom, + trace: Arc>>, +} +impl MaterialSurfaceQueries for CarverSurface<'_, '_, P> { + fn surface_depth(&mut self, x: i32, z: i32) -> i32 { + self.surface.surface_depth(x, z) + } + fn surface_secondary(&mut self, x: i32, z: i32) -> f64 { + self.surface.surface_secondary(x, z) + } + fn band(&mut self, p: BlockPos) -> Result { + self.surface.band(p) + } + fn bind_noise(&mut self, name: &str) -> Result, DecodeError> { + self.surface.bind_noise(name) + } + fn biome(&mut self, p: BlockPos) -> Result>, MaterialRuleError> { + raw_biome( + self.resolver, + self.context, + self.zoom.quart_at_block(p), + &self.trace, + ) + .map(Some) + } + fn cold_enough_to_snow( + &mut self, + name: &str, + p: BlockPos, + sea: i32, + ) -> Result { + self.surface.cold_enough_to_snow(name, p, sea) + } + fn melts_frozen_ocean( + &mut self, + name: &str, + p: BlockPos, + sea: i32, + ) -> Result { + self.surface.melts_frozen_ocean(name, p, sea) + } +} +struct TracedAquifer<'a> { + inner: &'a mut dyn TerrainAquifer, + trace: Arc>>, +} +impl TerrainAquifer for TracedAquifer<'_> { + fn compute_substance( + &mut self, + context: &mut SamplerContext, + [x, y, z]: [i32; 3], + density: f64, + ) -> Result, AquiferError> { + self.trace + .lock() + .unwrap() + .push(format!("aquifer {x} {y} {z} {:x}", density.to_bits())); + let result = self.inner.compute_substance(context, [x, y, z], density)?; + self.trace.lock().unwrap().push(format!( + "substance {}", + result.map_or_else(|| "none".to_owned(), |v| v.0.to_string()) + )); + Ok(result) + } + fn should_schedule_fluid_update(&self) -> bool { + let result = self.inner.should_schedule_fluid_update(); + self.trace + .lock() + .unwrap() + .push(format!("fluid_schedule {result}")); + result + } +} +fn dump( + chunk: &mut TerrainChunk<'_, B>, + height: i32, + out: &mut impl Write, +) -> Result<(), Box> { + for section in 0..height as usize / 16 { + writeln!(out, "section {section}")?; + let data = chunk.section(section).unwrap(); + for y in 0..16 { + for z in 0..16 { + write!(out, "blocks")?; + for x in 0..16 { + write!(out, " {}", data.get((y << 8) | (z << 4) | x)?.0)?; + } + writeln!(out)?; + } + } + } + for kind in [HeightmapType::WorldSurfaceWg, HeightmapType::OceanFloorWg] { + writeln!(out, "heightmap {}", kind.name())?; + for word in chunk.ensure_heightmap(kind).raw_data() { + writeln!(out, "{word:x}")?; + } + } + for (section, offsets) in chunk.postprocessing().iter().enumerate() { + writeln!(out, "post {section} {}", offsets.len())?; + for offset in offsets { + writeln!(out, "{offset}")?; + } + } + Ok(()) +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let read = |name: &str| -> Result, Box> { + Ok(serde_json::from_str(&fs::read_to_string( + dir.join(format!("{name}.json")), + )?)?) + }; + let facts: Value = serde_json::from_str(&fs::read_to_string(dir.join("facts-server.json"))?)?; + let registry = BlockRegistry::from_nbt(&Tag::compound([ + ("DataVersion", Tag::Int(DATA_VERSION)), + ( + "states", + Tag::List( + facts["states"] + .as_array() + .unwrap() + .iter() + .map(|v| tag(&v[4])) + .collect(), + ), + ), + ("defaults", tag(&facts["defaults"])), + ]))?; + let biomes = read("biomes")?; + let mut temperatures = BTreeMap::new(); + for (name, raw) in &biomes { + temperatures.insert( + name.clone(), + BiomeTemperature::new(BiomeTemperatureSettings::from_json(raw)?), + ); + } + let mut biome_tags = TagDefinitions::default(); + for (name, raw) in read("biome_tags")? { + biome_tags.apply_json(&name, "vanilla", &raw)?; + } + let biome_tags = biome_tags.build(|id, _| biomes.contains_key(id).then(|| id.to_owned()))?; + assert!(biome_tags.missing.is_empty()); + let conditions = MaterialConditionRegistry::from_json_with_biome_tags( + &read("conditions")?, + &biomes.keys().cloned().collect(), + &biome_tags.tags, + )?; + let mut block_tags = TagDefinitions::default(); + for (name, raw) in read("block_tags")? { + block_tags.apply_json(&name, "vanilla", &raw)?; + } + let block_tags = block_tags.build(|id, _| facts["defaults"].get(id).map(|_| id.to_owned()))?; + assert!(block_tags.missing.is_empty()); + let motion: BTreeSet<_> = block_tags.tags["minecraft:blocks_motion_in_heightmap"] + .iter() + .map(String::as_str) + .collect(); + let no_leaves: BTreeSet<_> = block_tags.tags["minecraft:blocks_motion_in_heightmap_no_leaves"] + .iter() + .map(String::as_str) + .collect(); + let properties = facts["states"] + .as_array() + .unwrap() + .iter() + .map(|v| { + let name = v[0].as_str().unwrap(); + State { + air: v[1].as_bool().unwrap(), + air_block: name == "minecraft:air", + fluid: v[2].as_bool().unwrap(), + motion: motion.contains(name), + no_leaves: no_leaves.contains(name), + } + }) + .collect(); + let integers = facts["integers"] + .as_array() + .unwrap() + .iter() + .map(|v| { + ( + v[0].as_str().unwrap().to_owned(), + v[1].as_str().unwrap().to_owned(), + ) + }) + .collect(); + let presets = read("presets")?; + let source_catalog = BiomeSourceCatalog::new( + &biomes.keys().cloned().collect(), + &biome_tags.tags, + &presets.keys().cloned().collect(), + )?; + let carving_blocks = CarvingBlocks::from_registry( + ®istry, + &block_tags.tags["minecraft:uncarvable"] + .iter() + .cloned() + .collect(), + )?; + let carvers = CarverCatalog::from_json(&read("carvers")?)?; + let mut biome_carvers = BTreeMap::new(); + for (name, json) in &biomes { + let value: Value = serde_json::from_str(json)?; + biome_carvers.insert( + name.clone(), + carvers.decode_set(&value["carvers"].to_string())?, + ); + } + let data = Data { + biome_carvers, + carving_blocks, + registry, + integers, + properties, + conditions, + noises: read("noises")?, + densities: read("densities")?, + rules: read("rules")?, + presets, + source_catalog, + temperatures: Arc::new(Mutex::new(temperatures)), + }; + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let seed = f["seed"].as_i64().unwrap(); + if f["legacy"].as_bool().unwrap() { + fixture(&f, &data, LegacyRandom::new(seed), &mut out)?; + } else { + fixture(&f, &data, XoroshiroRandom::new(seed), &mut out)?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/examples/material_surface_fixture.rs b/crates/horizon-world/examples/material_surface_fixture.rs new file mode 100644 index 000000000..c7cb93bbd --- /dev/null +++ b/crates/horizon-world/examples/material_surface_fixture.rs @@ -0,0 +1,137 @@ +//! Original comparison transport for terracotta bands and surface queries. +use horizon_core::{ + noise::{NanRange, Noise}, + random::{LegacyRandom, PositionalRandom, RandomSource, XoroshiroRandom}, +}; +use horizon_world::{ + registry::BlockStateId, + worldgen::{ + decode_noise, + material_surface::{ClayBandBlocks, ClayBands, MaterialSurface}, + }, +}; +use serde_json::Value; +use std::{ + collections::BTreeMap, + fs, + io::{self, Write}, + path::Path, + sync::Arc, +}; +#[derive(Debug)] +struct ConstantNoise(f32); +impl Noise for ConstantNoise { + fn range(&self) -> Result<[f32; 2], NanRange> { + Ok([f32::NEG_INFINITY, f32::INFINITY]) + } + fn get2(&self, _: f64, _: f64) -> f32 { + panic!("unexpected 2d noise query") + } + fn get3(&self, _: f64, y: f64, _: f64) -> f32 { + assert_eq!(y, 0.); + self.0 + } +} +fn blocks() -> ClayBandBlocks { + ClayBandBlocks { + terracotta: BlockStateId(0), + orange: BlockStateId(1), + yellow: BlockStateId(2), + brown: BlockStateId(3), + red: BlockStateId(4), + white: BlockStateId(5), + light_gray: BlockStateId(6), + } +} +fn fixture( + f: &Value, + mut direct: R, + root: R::Positional, + noises: &BTreeMap, + out: &mut impl Write, +) -> Result<(), Box> { + if f["child"].as_bool().unwrap() { + direct = direct + .fork_positional() + .from_hash_of("minecraft:clay_bands"); + } + direct.consume_count(f["consume"].as_i64().unwrap() as i32); + let bands = ClayBands::generate(&mut direct, blocks()); + writeln!(out, "bands {}", bands.states().len())?; + for state in bands.states() { + writeln!(out, "{}", state.0)?; + } + writeln!(out, "next {} {}", direct.next_long(), direct.next_int())?; + let mut samplers: Vec> = Vec::new(); + for (i, name) in ["clay_bands_offset", "surface", "surface_secondary"] + .iter() + .enumerate() + { + let sampler: Arc = if let Some(bits) = f["overrides"][i].as_str() { + Arc::new(ConstantNoise(f32::from_bits(u32::from_str_radix( + bits, 16, + )?))) + } else { + let id = format!("minecraft:{name}"); + Arc::new(decode_noise(&noises[&id])?.create(&mut root.from_hash_of(&id))?) + }; + samplers.push(sampler); + } + let surface = MaterialSurface::new( + root, + blocks(), + samplers[0].clone(), + samplers[1].clone(), + samplers[2].clone(), + ); + writeln!(out, "system bands")?; + for state in surface.bands().states() { + writeln!(out, "{}", state.0)?; + } + for p in f["points"].as_array().unwrap() { + let [x, y, z] = std::array::from_fn(|i| p[i].as_i64().unwrap() as i32); + match surface.band([x, y, z]) { + Some(state) => writeln!(out, "band {}", state.0)?, + None => writeln!(out, "band error")?, + } + writeln!(out, "depth {}", surface.surface_depth(x, z))?; + let value = surface.surface_secondary(x, z); + let bits = if value.is_nan() { + 0x7ff8000000000000 + } else { + value.to_bits() + }; + writeln!(out, "secondary {bits:x}")?; + } + Ok(()) +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private directory"); + let dir = Path::new(&arg); + let noises: BTreeMap = + serde_json::from_str(&fs::read_to_string(dir.join("noises.json"))?)?; + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let seed = f["seed"].as_i64().unwrap(); + if f["legacy"].as_bool().unwrap() { + fixture( + &f, + LegacyRandom::new(seed), + LegacyRandom::new(seed).fork_positional(), + &noises, + &mut out, + )?; + } else { + fixture( + &f, + XoroshiroRandom::new(seed), + XoroshiroRandom::new(seed).fork_positional(), + &noises, + &mut out, + )?; + } + } + out.flush()?; + Ok(()) +} diff --git a/crates/horizon-world/examples/piston_shape_fixture.rs b/crates/horizon-world/examples/piston_shape_fixture.rs new file mode 100644 index 000000000..06c62803b --- /dev/null +++ b/crates/horizon-world/examples/piston_shape_fixture.rs @@ -0,0 +1,190 @@ +use horizon_core::geometry::{Aabb, Axis, Direction, VoxelShape}; +use horizon_world::{ + collision::CachedCollisionRegistry, + dynamic_support::{DynamicSupport, DynamicSupportWorld}, + nbt::{self, Limits, Tag}, + piston_shape::{MovingPistonState, PistonBlockBindings, PistonCollisionWorld}, + registry::{BlockRegistry, BlockStateId}, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn values( + out: &mut impl Write, + label: &str, + values: impl IntoIterator, +) -> io::Result<()> { + write!(out, "{label}")?; + for v in values { + let bits = if v.is_nan() { + 0x7ff8_0000_0000_0000 + } else { + v.to_bits() + }; + write!(out, " {bits:016x}")?; + } + writeln!(out) +} +fn box_values(out: &mut impl Write, label: &str, b: Aabb) -> io::Result<()> { + values( + out, + label, + [ + b.min(Axis::X), + b.min(Axis::Y), + b.min(Axis::Z), + b.max(Axis::X), + b.max(Axis::Y), + b.max(Axis::Z), + ], + ) +} +fn emit(out: &mut impl Write, shape: &VoxelShape) -> io::Result<()> { + writeln!( + out, + "shape {} {} {}", + shape.is_empty(), + shape.boxes().len(), + shape.is_cube() + )?; + for (axis, name) in Axis::ALL.into_iter().zip(["x", "y", "z"]) { + values(out, name, shape.coordinates(axis).iter().copied())?; + } + let axes = shape.cube_coordinate_axes(); + writeln!( + out, + "axes {}", + u8::from(axes[0]) + 2 * u8::from(axes[1]) + 4 * u8::from(axes[2]) + )?; + values( + out, + "extrema", + Axis::ALL + .map(|a| shape.min(a)) + .into_iter() + .chain(Axis::ALL.map(|a| shape.max(a))), + )?; + match shape.bounds() { + Some(b) => box_values(out, "bounds", b)?, + None => writeln!(out, "bounds none")?, + } + for b in shape.boxes() { + box_values(out, "box", *b)?; + } + Ok(()) +} +struct World<'a, 'r, W> { + collisions: &'a CachedCollisionRegistry<'r>, + dynamic: &'a [Option], + out: &'a mut W, + fail: i32, + calls: i32, +} +impl World<'_, '_, W> { + fn query(&mut self, p: [i32; 3]) -> io::Result<()> { + writeln!(self.out, "entity {} {} {}", p[0], p[1], p[2])?; + let count = self.calls; + self.calls += 1; + if count == self.fail { + Err(io::Error::other("injected block entity failure")) + } else { + Ok(()) + } + } +} +impl DynamicSupportWorld for World<'_, '_, W> { + type Error = io::Error; + fn shulker_is_closed(&mut self, p: [i32; 3]) -> io::Result> { + self.query(p)?; + Ok(None) + } + fn moving_piston_shape(&mut self, p: [i32; 3]) -> io::Result> { + self.query(p)?; + Ok(None) + } +} +impl PistonCollisionWorld for World<'_, '_, W> { + type Error = io::Error; + fn collision_shape(&mut self, state: BlockStateId, p: [i32; 3]) -> io::Result { + if let Some(shape) = self.collisions.cached_shape(state)? { + return Ok(shape.clone()); + } + let dynamic = self.dynamic[state.0 as usize] + .as_ref() + .expect("known empty-context dynamic collision") + .clone(); + dynamic.shape(self, p).map_err(io::Error::other) + } +} +fn number(v: &Value) -> f32 { + f32::from_bits(u32::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn float_bits(v: f32) -> u32 { + if v.is_nan() { 0x7fc0_0000 } else { v.to_bits() } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let read = |name: &str| -> Result> { + Ok( + nbt::read_named(&fs::read(dir.join(name))?, Limits::default())? + .0 + .tag, + ) + }; + let registry = BlockRegistry::from_nbt(&read("block-registry.nbt")?)?; + let collisions = CachedCollisionRegistry::from_nbt(&read("cached-collision.nbt")?, ®istry)?; + let bindings = PistonBlockBindings::new(®istry)?; + let dynamic = (0..registry.len()) + .map(|id| DynamicSupport::from_state(registry.state(BlockStateId(id as u32)).unwrap())) + .collect::>>()?; + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let p = std::array::from_fn(|i| f["position"][i].as_i64().unwrap() as i32); + let piston = MovingPistonState { + moved_state: BlockStateId(f["state"].as_u64().unwrap() as u32), + direction: Direction::ALL[f["direction"].as_u64().unwrap() as usize], + extending: f["extending"].as_bool().unwrap(), + source: f["source"].as_bool().unwrap(), + progress: number(&f["progress"]), + previous_progress: number(&f["previous"]), + }; + let partial = number(&f["partial"]); + let offset = piston.interpolated_offset(partial).map(float_bits); + writeln!( + out, + "motion {} {:08x} {:08x} {:08x} {:08x}", + piston.movement_direction() as u8, + float_bits(piston.interpolated_progress(partial)), + offset[0], + offset[1], + offset[2] + )?; + writeln!( + out, + "related {}", + bindings.collision_related_state(piston)?.0 + )?; + let mut world = World { + collisions: &collisions, + dynamic: &dynamic, + out: &mut out, + fail: f["fail"].as_i64().unwrap() as i32, + calls: 0, + }; + let clip = f["noclip"].as_i64().unwrap(); + let noclip = (clip >= 0).then(|| Direction::ALL[clip as usize]); + if !f["kinematic"].as_bool().unwrap() { + match bindings.collision_shape(&mut world, p, piston, noclip) { + Ok(shape) => emit(world.out, &shape)?, + Err(_) => writeln!(world.out, "shape error")?, + } + } + writeln!(world.out, "queries {}", world.calls)?; + } + Ok(()) +} diff --git a/crates/horizon-world/examples/placement_fixture.rs b/crates/horizon-world/examples/placement_fixture.rs new file mode 100644 index 000000000..b3e6c4747 --- /dev/null +++ b/crates/horizon-world/examples/placement_fixture.rs @@ -0,0 +1,84 @@ +//! Transport for placement decoding, emissions, failures and random state. +#[path = "support/placement_queries.rs"] +mod queries; +use horizon_core::random::{LegacyRandom, RandomSource, XoroshiroRandom}; +use horizon_world::worldgen::{anchor::WorldGenerationContext, placement::PlacementModifier}; +use serde_json::Value; +use std::cell::RefCell; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn n(v: &Value) -> i32 { + v.as_i64().unwrap() as i32 +} +fn fixture( + f: &Value, + mut random: impl RandomSource, + out: &mut impl Write, +) -> Result<(), Box> { + let c = &f["context"]; + let context = WorldGenerationContext::new(n(&c[0]), n(&c[1]), n(&c[2])); + let out = RefCell::new(out); + let mut context = queries::Queries::new(f, context, &out); + match PlacementModifier::from_json(f["definition"].as_str().unwrap()) { + Err(_) => writeln!(out.borrow_mut(), "decode error")?, + Ok(modifier) => { + writeln!(out.borrow_mut(), "decode ok")?; + for p in f["positions"].as_array().unwrap() { + if f["count_only"].as_bool().unwrap_or(false) { + match modifier.repetitions(&mut random, [n(&p[0]), n(&p[1]), n(&p[2])]) { + Ok(Some(count)) => writeln!(out.borrow_mut(), "count {count}")?, + _ => writeln!(out.borrow_mut(), "count error")?, + } + writeln!(out.borrow_mut(), "next {}", random.next_long())?; + continue; + } + let mut count = 0; + let fail = n(&f["fail"]); + let draw = f["draw"].as_bool().unwrap(); + let result = modifier.modify_in( + &mut context, + &mut random, + [n(&p[0]), n(&p[1]), n(&p[2])], + |random, p| { + let previous = count; + count += 1; + if previous == fail { + return Err(io::Error::other("consumer failure")); + } + writeln!(out.borrow_mut(), "position {} {} {}", p[0], p[1], p[2])?; + if draw { + writeln!(out.borrow_mut(), "consumer {}", random.next_long())?; + } + Ok(()) + }, + ); + writeln!( + out.borrow_mut(), + "modify {}", + if result.is_ok() { "ok" } else { "error" } + )?; + writeln!(out.borrow_mut(), "next {}", random.next_long())?; + } + } + } + writeln!(out.borrow_mut(), "tail {}", random.next_long())?; + Ok(()) +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let seed = f["seed"].as_i64().unwrap(); + if f["legacy"].as_bool().unwrap() { + fixture(&f, LegacyRandom::new(seed), &mut out)?; + } else { + fixture(&f, XoroshiroRandom::new(seed), &mut out)?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/examples/replace_block_fixture.rs b/crates/horizon-world/examples/replace_block_fixture.rs new file mode 100644 index 000000000..7a8d00363 --- /dev/null +++ b/crates/horizon-world/examples/replace_block_fixture.rs @@ -0,0 +1,204 @@ +//! Feature world transport retaining ordered mutations and partial failures. +use horizon_core::random::{LegacyRandom, RandomSource, XoroshiroRandom}; +use horizon_world::{ + DATA_VERSION, + heightmap::HeightmapType, + nbt::Tag, + registry::{BlockRegistry, BlockStateId}, + worldgen::{ + anchor::WorldGenerationContext, + block_feature::{FeatureBlockBindings, ReplaceBlockFeature}, + feature::FeatureWorld, + placement::{PlacementContext, PlacementQueryError}, + tags::TagDefinitions, + }, +}; +use serde_json::Value; +use std::{ + collections::BTreeMap, + fs, + io::{self, Write}, + path::Path, +}; +struct World<'a, W> { + states: BTreeMap<[i32; 3], BlockStateId>, + blocks: Vec, + minimum: i32, + calls: i32, + fail: i32, + reject: i32, + out: &'a mut W, +} +impl PlacementContext for World<'_, W> { + fn generation(&self) -> WorldGenerationContext { + WorldGenerationContext::new(self.minimum, 384, 63) + } + fn min_y(&mut self) -> Result { + writeln!(self.out, "min").map_err(|e| PlacementQueryError::Failed(e.to_string()))?; + let call = self.calls; + self.calls += 1; + if call == self.fail { + return Err(PlacementQueryError::Failed("minimum query failure".into())); + } + writeln!(self.out, "minimum {}", self.minimum) + .map_err(|e| PlacementQueryError::Failed(e.to_string()))?; + Ok(self.minimum) + } + fn height(&mut self, _: HeightmapType, _: i32, _: i32) -> Result { + Err(PlacementQueryError::Unavailable) + } +} +impl FeatureWorld for World<'_, W> { + type Error = io::Error; + fn block(&mut self, p: [i32; 3]) -> Result { + let call = self.calls; + self.calls += 1; + writeln!(self.out, "get {} {} {}", p[0], p[1], p[2])?; + if call == self.fail { + return Err(io::Error::other("world failure")); + } + let hash = p[0] + .wrapping_mul(31) + .wrapping_add(p[1].wrapping_mul(7)) + .wrapping_add(p[2].wrapping_mul(17)) + .rem_euclid(7) as usize; + let state = self.states.get(&p).copied().unwrap_or(self.blocks[hash]); + writeln!(self.out, "state {}", state.0)?; + Ok(state) + } + fn set_block( + &mut self, + p: [i32; 3], + state: BlockStateId, + flags: i32, + ) -> Result { + let call = self.calls; + self.calls += 1; + writeln!( + self.out, + "set {} {} {} {} {flags}", + p[0], p[1], p[2], state.0 + )?; + if call == self.fail { + return Err(io::Error::other("world failure")); + } + let result = self.reject == 0 || call % self.reject != 0; + if result { + self.states.insert(p, state); + } + writeln!(self.out, "written {result}")?; + Ok(result) + } +} +fn fixture( + f: &Value, + mut random: impl RandomSource, + blocks: &[BlockStateId], + bindings: &FeatureBlockBindings<'_>, + out: &mut impl Write, +) -> Result<(), Box> { + let decoded = ReplaceBlockFeature::from_json(f["definition"].as_str().unwrap(), bindings); + match decoded { + Err(_) => writeln!(out, "decode error")?, + Ok(feature) => { + writeln!(out, "decode ok")?; + let mut world = World { + states: BTreeMap::new(), + blocks: blocks.to_vec(), + minimum: f["world_min"].as_i64().unwrap() as i32, + calls: 0, + fail: f["fail"].as_i64().unwrap() as i32, + reject: f["reject"].as_i64().unwrap() as i32, + out, + }; + let p = &f["origin"]; + let origin = [ + p[0].as_i64().unwrap() as i32, + p[1].as_i64().unwrap() as i32, + p[2].as_i64().unwrap() as i32, + ]; + for _ in 0..f["repeats"].as_u64().unwrap() { + world.calls = 0; + let result = feature.place(&mut world, &mut random, origin); + match result { + Ok(value) => writeln!(world.out, "place {value}")?, + Err(_) => writeln!(world.out, "place error")?, + } + writeln!(world.out, "next {}", random.next_long())?; + for (p, state) in &world.states { + writeln!(world.out, "stored {} {} {} {}", p[0], p[1], p[2], state.0)?; + } + writeln!(world.out, "end")?; + } + } + } + writeln!(out, "tail {}", random.next_long())?; + Ok(()) +} +fn tag(v: &Value) -> Tag { + match v { + Value::String(s) => Tag::String(s.as_str().into()), + Value::Number(n) => Tag::Int(n.as_i64().unwrap() as i32), + Value::Array(a) => Tag::List(a.iter().map(tag).collect()), + Value::Object(m) => { + Tag::Compound(m.iter().map(|(k, v)| (k.as_str().into(), tag(v))).collect()) + } + _ => panic!("invalid registry metadata"), + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let facts: Value = serde_json::from_str(&fs::read_to_string(dir.join("facts-server.json"))?)?; + let registry = BlockRegistry::from_nbt(&Tag::compound([ + ("DataVersion", Tag::Int(DATA_VERSION)), + ("states", tag(&facts["states"])), + ("defaults", tag(&facts["defaults"])), + ]))?; + let integers = facts["integers"] + .as_array() + .unwrap() + .iter() + .map(|v| { + ( + v[0].as_str().unwrap().to_owned(), + v[1].as_str().unwrap().to_owned(), + ) + }) + .collect(); + let resources: Value = serde_json::from_str(&fs::read_to_string(dir.join("tags.json"))?)?; + let mut definitions = TagDefinitions::default(); + for (name, text) in resources.as_object().unwrap() { + definitions.apply_json(name, "vanilla", text.as_str().unwrap())?; + } + let built = + definitions.build(|name, _| registry.default_state(name).map(|_| name.to_owned()))?; + assert!(built.missing.is_empty()); + let bindings = FeatureBlockBindings::with_tags(®istry, integers, &built.tags)?; + let blocks: Vec<_> = [ + "air", + "cave_air", + "void_air", + "stone", + "water", + "oak_leaves", + "dirt", + ] + .map(|name| { + registry + .default_state(&format!("minecraft:{name}")) + .unwrap() + }) + .to_vec(); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let seed = f["seed"].as_i64().unwrap(); + if f["legacy"].as_bool().unwrap() { + fixture(&f, LegacyRandom::new(seed), &blocks, &bindings, &mut out)?; + } else { + fixture(&f, XoroshiroRandom::new(seed), &blocks, &bindings, &mut out)?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/examples/rule_test_fixture.rs b/crates/horizon-world/examples/rule_test_fixture.rs new file mode 100644 index 000000000..31fa4c436 --- /dev/null +++ b/crates/horizon-world/examples/rule_test_fixture.rs @@ -0,0 +1,95 @@ +//! Differential transport for replacement rules over pinned block identities. +use horizon_core::random::{LegacyRandom, RandomSource, XoroshiroRandom}; +use horizon_world::{ + DATA_VERSION, + nbt::Tag, + registry::{BlockRegistry, BlockStateId}, + worldgen::{block_feature::FeatureBlockBindings, rule_test::RuleTest, tags::TagDefinitions}, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn fixture( + f: &Value, + bindings: &FeatureBlockBindings<'_>, + mut random: impl RandomSource, + out: &mut impl Write, +) -> Result<(), Box> { + match RuleTest::from_json(f["definition"].as_str().unwrap(), bindings) { + Err(_) => writeln!(out, "decode error")?, + Ok(rule) => { + writeln!(out, "decode ok")?; + let mut index = 0; + let heights = f["heights"].as_array().unwrap(); + for _ in 0..f["repeats"].as_u64().unwrap() { + for state in f["states"].as_array().unwrap() { + let y = heights[index % heights.len()].as_i64().unwrap() as i32; + index += 1; + let result = rule.test( + BlockStateId(state.as_u64().unwrap() as u32), + [17, y, -33], + &mut random, + ); + writeln!(out, "test {result} {}", random.next_long())?; + } + } + } + } + writeln!(out, "tail {}", random.next_long())?; + Ok(()) +} +fn tag(v: &Value) -> Tag { + match v { + Value::String(s) => Tag::String(s.as_str().into()), + Value::Number(n) => Tag::Int(n.as_i64().unwrap() as i32), + Value::Array(a) => Tag::List(a.iter().map(tag).collect()), + Value::Object(m) => { + Tag::Compound(m.iter().map(|(k, v)| (k.as_str().into(), tag(v))).collect()) + } + _ => panic!("invalid registry metadata"), + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let facts: Value = serde_json::from_str(&fs::read_to_string(dir.join("facts-server.json"))?)?; + let registry = BlockRegistry::from_nbt(&Tag::compound([ + ("DataVersion", Tag::Int(DATA_VERSION)), + ("states", tag(&facts["states"])), + ("defaults", tag(&facts["defaults"])), + ]))?; + let integers = facts["integers"] + .as_array() + .unwrap() + .iter() + .map(|v| { + ( + v[0].as_str().unwrap().to_owned(), + v[1].as_str().unwrap().to_owned(), + ) + }) + .collect(); + let resources: Value = serde_json::from_str(&fs::read_to_string(dir.join("tags.json"))?)?; + let mut definitions = TagDefinitions::default(); + for (name, text) in resources.as_object().unwrap() { + definitions.apply_json(name, "vanilla", text.as_str().unwrap())?; + } + let built = + definitions.build(|name, _| registry.default_state(name).map(|_| name.to_owned()))?; + assert!(built.missing.is_empty()); + let bindings = FeatureBlockBindings::with_tags(®istry, integers, &built.tags)?; + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let seed = f["seed"].as_i64().unwrap(); + if f["legacy"].as_bool().unwrap() { + fixture(&f, &bindings, LegacyRandom::new(seed), &mut out)?; + } else { + fixture(&f, &bindings, XoroshiroRandom::new(seed), &mut out)?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/examples/scattered_ore_fixture.rs b/crates/horizon-world/examples/scattered_ore_fixture.rs new file mode 100644 index 000000000..bc9dd9200 --- /dev/null +++ b/crates/horizon-world/examples/scattered_ore_fixture.rs @@ -0,0 +1,228 @@ +//! Feature world transport retaining ordered mutations and partial failures. +use horizon_core::random::{LegacyRandom, RandomSource, XoroshiroRandom}; +use horizon_world::{ + DATA_VERSION, + heightmap::HeightmapType, + nbt::Tag, + registry::{BlockRegistry, BlockStateId}, + worldgen::{ + anchor::WorldGenerationContext, + block_feature::FeatureBlockBindings, + feature::FeatureWorld, + ore_feature::ScatteredOreFeature, + placement::{PlacementContext, PlacementQueryError}, + tags::TagDefinitions, + }, +}; +use serde_json::Value; +use std::{ + collections::BTreeMap, + fs, + io::{self, Write}, + path::Path, +}; +struct World<'a, W> { + states: BTreeMap<[i32; 3], BlockStateId>, + blocks: Vec, + minimum: i32, + mode: usize, + center: [i32; 3], + calls: i32, + fail: i32, + reject: i32, + out: &'a mut W, +} +impl PlacementContext for World<'_, W> { + fn generation(&self) -> WorldGenerationContext { + WorldGenerationContext::new(self.minimum, 384, 63) + } + fn min_y(&mut self) -> Result { + writeln!(self.out, "min").map_err(|e| PlacementQueryError::Failed(e.to_string()))?; + let call = self.calls; + self.calls += 1; + if call == self.fail { + return Err(PlacementQueryError::Failed("minimum query failure".into())); + } + writeln!(self.out, "minimum {}", self.minimum) + .map_err(|e| PlacementQueryError::Failed(e.to_string()))?; + Ok(self.minimum) + } + fn height(&mut self, _: HeightmapType, _: i32, _: i32) -> Result { + Err(PlacementQueryError::Unavailable) + } +} +impl FeatureWorld for World<'_, W> { + type Error = io::Error; + fn block(&mut self, p: [i32; 3]) -> Result { + let call = self.calls; + self.calls += 1; + writeln!(self.out, "get {} {} {}", p[0], p[1], p[2])?; + if call == self.fail { + return Err(io::Error::other("world failure")); + } + let hash = p[0] + .wrapping_mul(31) + .wrapping_add(p[1].wrapping_mul(7)) + .wrapping_add(p[2].wrapping_mul(17)) + .rem_euclid(7) as usize; + let mut fallback = if self.mode == 0 { + self.blocks[hash] + } else { + self.blocks[3] + }; + if self.mode >= 2 { + let delta = [ + [0, -1, 0], + [0, 1, 0], + [0, 0, -1], + [0, 0, 1], + [-1, 0, 0], + [1, 0, 0], + ][self.mode - 2]; + let adjacent = std::array::from_fn(|i| self.center[i].wrapping_add(delta[i])); + if p == adjacent { + fallback = self.blocks[1]; + } + } + let state = self.states.get(&p).copied().unwrap_or(fallback); + writeln!(self.out, "state {}", state.0)?; + Ok(state) + } + fn set_block( + &mut self, + p: [i32; 3], + state: BlockStateId, + flags: i32, + ) -> Result { + let call = self.calls; + self.calls += 1; + writeln!( + self.out, + "set {} {} {} {} {flags}", + p[0], p[1], p[2], state.0 + )?; + if call == self.fail { + return Err(io::Error::other("world failure")); + } + let result = self.reject == 0 || call % self.reject != 0; + if result { + self.states.insert(p, state); + } + writeln!(self.out, "written {result}")?; + Ok(result) + } +} +fn fixture( + f: &Value, + mut random: impl RandomSource, + blocks: &[BlockStateId], + bindings: &FeatureBlockBindings<'_>, + out: &mut impl Write, +) -> Result<(), Box> { + let decoded = ScatteredOreFeature::from_json(f["definition"].as_str().unwrap(), bindings); + match decoded { + Err(_) => writeln!(out, "decode error")?, + Ok(feature) => { + writeln!(out, "decode ok")?; + let mut world = World { + states: BTreeMap::new(), + blocks: blocks.to_vec(), + minimum: f["world_min"].as_i64().unwrap() as i32, + mode: f["mode"].as_u64().unwrap() as usize, + center: std::array::from_fn(|i| f["origin"][i].as_i64().unwrap() as i32), + calls: 0, + fail: f["fail"].as_i64().unwrap() as i32, + reject: f["reject"].as_i64().unwrap() as i32, + out, + }; + let p = &f["origin"]; + let origin = [ + p[0].as_i64().unwrap() as i32, + p[1].as_i64().unwrap() as i32, + p[2].as_i64().unwrap() as i32, + ]; + for _ in 0..f["repeats"].as_u64().unwrap() { + world.calls = 0; + let result = feature.place(&mut world, &mut random, origin); + match result { + Ok(value) => writeln!(world.out, "place {value}")?, + Err(_) => writeln!(world.out, "place error")?, + } + writeln!(world.out, "next {}", random.next_long())?; + for (p, state) in &world.states { + writeln!(world.out, "stored {} {} {} {}", p[0], p[1], p[2], state.0)?; + } + writeln!(world.out, "end")?; + } + } + } + writeln!(out, "tail {}", random.next_long())?; + Ok(()) +} +fn tag(v: &Value) -> Tag { + match v { + Value::String(s) => Tag::String(s.as_str().into()), + Value::Number(n) => Tag::Int(n.as_i64().unwrap() as i32), + Value::Array(a) => Tag::List(a.iter().map(tag).collect()), + Value::Object(m) => { + Tag::Compound(m.iter().map(|(k, v)| (k.as_str().into(), tag(v))).collect()) + } + _ => panic!("invalid registry metadata"), + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let facts: Value = serde_json::from_str(&fs::read_to_string(dir.join("facts-server.json"))?)?; + let registry = BlockRegistry::from_nbt(&Tag::compound([ + ("DataVersion", Tag::Int(DATA_VERSION)), + ("states", tag(&facts["states"])), + ("defaults", tag(&facts["defaults"])), + ]))?; + let integers = facts["integers"] + .as_array() + .unwrap() + .iter() + .map(|v| { + ( + v[0].as_str().unwrap().to_owned(), + v[1].as_str().unwrap().to_owned(), + ) + }) + .collect(); + let resources: Value = serde_json::from_str(&fs::read_to_string(dir.join("tags.json"))?)?; + let mut definitions = TagDefinitions::default(); + for (name, text) in resources.as_object().unwrap() { + definitions.apply_json(name, "vanilla", text.as_str().unwrap())?; + } + let built = + definitions.build(|name, _| registry.default_state(name).map(|_| name.to_owned()))?; + assert!(built.missing.is_empty()); + let bindings = FeatureBlockBindings::with_tags(®istry, integers, &built.tags)?; + let blocks: Vec<_> = [ + "air", + "cave_air", + "void_air", + "stone", + "water", + "oak_leaves", + "dirt", + ] + .map(|name| { + registry + .default_state(&format!("minecraft:{name}")) + .unwrap() + }) + .to_vec(); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let seed = f["seed"].as_i64().unwrap(); + if f["legacy"].as_bool().unwrap() { + fixture(&f, LegacyRandom::new(seed), &blocks, &bindings, &mut out)?; + } else { + fixture(&f, XoroshiroRandom::new(seed), &blocks, &bindings, &mut out)?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/examples/state_provider_fixture.rs b/crates/horizon-world/examples/state_provider_fixture.rs new file mode 100644 index 000000000..e8a8f9f5a --- /dev/null +++ b/crates/horizon-world/examples/state_provider_fixture.rs @@ -0,0 +1,540 @@ +use horizon_core::random::{LegacyRandom, RandomSource, WorldgenRandom, XoroshiroRandom}; +use horizon_world::{ + DATA_VERSION, + block_collision::{BlockCollisionRegistry, DynamicCollisionWorld, ShulkerCollisionState}, + block_support::{BlockSupportRegistry, SupportType}, + block_survival::{BlockSurvivalRegistry, SurvivalDefinitions, SurvivalRule, SurvivalWorld}, + fluid::{FluidKind, FluidStateTable}, + heightmap::HeightmapType, + nbt::Tag, + registry::{BlockRegistry, BlockStateId}, + worldgen::{ + anchor::WorldGenerationContext, + biome::BiomeId, + biome_predicate::BiomePredicateBindings, + feature::FeatureWorld, + placement::{PlacementContext, PlacementQueryError}, + state_provider::{StateProviderBindings, StateProviderCatalog}, + tags::TagDefinitions, + }, +}; +use serde_json::Value; +use std::{ + collections::{BTreeMap, BTreeSet}, + fs, + io::{self, Write}, + path::Path, + sync::Arc, +}; +struct World<'a, W> { + support: &'a BlockSupportRegistry<'a>, + survival: &'a BlockSurvivalRegistry<'a>, + out: &'a mut W, + fallback: BlockStateId, + biome: BiomeId, + unobstructed: bool, + brightness: i32, + tags: &'a BTreeMap>, + calls: i32, + fail: i32, + queries: i32, + query_fail: i32, + bounds: [i32; 3], +} +impl FeatureWorld for World<'_, W> { + type Error = (); + fn block(&mut self, p: [i32; 3]) -> Result { + writeln!(self.out, "read {} {} {}", p[0], p[1], p[2]).map_err(|_| ())?; + let call = self.calls; + self.calls += 1; + if call == self.fail { + Err(()) + } else { + Ok(self.fallback) + } + } + fn set_block(&mut self, _: [i32; 3], _: BlockStateId, _: i32) -> Result { + panic!("providers must not write blocks") + } +} +impl World<'_, W> { + fn query(&mut self, name: &str, value: i32) -> Result { + writeln!(self.out, "{name}").map_err(|_| PlacementQueryError::Unavailable)?; + let call = self.queries; + self.queries += 1; + if call == self.query_fail { + Err(PlacementQueryError::Unavailable) + } else { + Ok(value) + } + } +} +impl horizon_world::dynamic_support::DynamicSupportWorld for World<'_, W> { + type Error = PlacementQueryError; + fn shulker_is_closed(&mut self, p: [i32; 3]) -> Result, Self::Error> { + self.query(&format!("entity {} {} {}", p[0], p[1], p[2]), 0)?; + Ok(None) + } + fn moving_piston_shape( + &mut self, + p: [i32; 3], + ) -> Result, Self::Error> { + self.query(&format!("entity {} {} {}", p[0], p[1], p[2]), 0)?; + Ok(None) + } +} +impl DynamicCollisionWorld for World<'_, W> { + fn shulker_collision_state( + &mut self, + p: [i32; 3], + ) -> Result, Self::Error> { + self.query(&format!("entity {} {} {}", p[0], p[1], p[2]), 0)?; + Ok(None) + } +} +impl SurvivalWorld for World<'_, W> { + fn fluid_state( + &mut self, + p: [i32; 3], + ) -> Result { + self.query(&format!("fluid {} {} {}", p[0], p[1], p[2]), 0)?; + horizon_world::fluid::FluidState::from_block( + self.support.registry().state(self.fallback).unwrap(), + ) + .map_err(|_| PlacementQueryError::Unavailable) + } + fn raw_brightness(&mut self, p: [i32; 3], sky_darken: i32) -> Result { + self.query( + &format!("light {} {} {} {sky_darken}", p[0], p[1], p[2]), + self.brightness, + ) + } + fn block_state(&mut self, position: [i32; 3]) -> Result { + self.block(position) + .map_err(|_| PlacementQueryError::Unavailable) + } +} +impl PlacementContext for World<'_, W> { + fn block_survives( + &mut self, + state: BlockStateId, + position: [i32; 3], + ) -> Result { + let survival = self.survival; + survival + .can_survive(self, state, position) + .map_err(|_| PlacementQueryError::Unavailable) + } + fn face_sturdy( + &mut self, + p: [i32; 3], + direction: horizon_core::geometry::Direction, + ) -> Result { + let state = self + .block(p) + .map_err(|_| PlacementQueryError::Unavailable)?; + let support = self.support; + support + .is_face_sturdy(self, state, p, direction, SupportType::Full) + .map_err(|_| PlacementQueryError::Unavailable) + } + + fn unobstructed_block(&mut self, p: [i32; 3]) -> Result { + let min = p.map(f64::from); + let max = min.map(|v| v + 1.0); + let label = format!( + "clear {:016x} {:016x} {:016x} {:016x} {:016x} {:016x}", + min[0].to_bits(), + min[1].to_bits(), + min[2].to_bits(), + max[0].to_bits(), + max[1].to_bits(), + max[2].to_bits() + ); + self.query(&label, i32::from(self.unobstructed)) + .map(|value| value != 0) + } + fn biome_identity(&mut self, p: [i32; 3]) -> Result { + self.query( + &format!("biome {} {} {}", p[0], p[1], p[2]), + self.biome.0 as i32, + ) + .map(|id| BiomeId(id as u32)) + } + fn generation(&self) -> WorldGenerationContext { + WorldGenerationContext { + min_y: self.bounds[0], + height: self.bounds[1], + sea_level: self.bounds[2], + } + } + fn predicate_generation(&mut self) -> Result { + let min_y = self.min_y()?; + let height = self.query("height", self.bounds[1])?; + let sea_level = self.query("sea", self.bounds[2])?; + Ok(WorldGenerationContext { + min_y, + height, + sea_level, + }) + } + fn block_state(&mut self, position: [i32; 3]) -> Result { + self.block(position) + .map_err(|_| PlacementQueryError::Unavailable) + } + fn block_matches_tag( + &mut self, + position: [i32; 3], + tag: &str, + ) -> Result { + let state = self + .block(position) + .map_err(|_| PlacementQueryError::Unavailable)?; + Ok(self + .tags + .get(tag) + .is_some_and(|states| states.contains(&state))) + } + fn min_y(&mut self) -> Result { + self.query("min", self.bounds[0]) + } + fn max_y(&mut self) -> Result { + Ok(self + .min_y()? + .wrapping_add(self.query("height", self.bounds[1])?) + .wrapping_sub(1)) + } + fn height(&mut self, _: HeightmapType, _: i32, _: i32) -> Result { + Err(PlacementQueryError::Unavailable) + } +} +fn fixture( + f: &Value, + bindings: &StateProviderBindings<'_>, + catalog: &StateProviderCatalog, + tags: &BTreeMap>, + support: (&BlockSupportRegistry<'_>, &BlockSurvivalRegistry<'_>), + mut random: impl RandomSource, + out: &mut impl Write, +) -> Result<(), Box> { + let json = f["definition"].as_str().unwrap(); + let decoded = if f["holder"].as_bool().unwrap_or(false) { + catalog.provider(json, bindings) + } else if f["typed"].as_bool().unwrap() { + catalog.typed_provider(json, bindings) + } else { + catalog.direct_provider(json, bindings) + }; + match decoded { + Err(_) => writeln!(out, "decode error")?, + Ok(provider) => { + writeln!(out, "decode ok")?; + let mut world = World { + support: support.0, + survival: support.1, + out, + tags, + fallback: BlockStateId(0), + biome: BiomeId(0), + unobstructed: f["unobstructed"].as_bool().unwrap_or(true), + brightness: f["brightness"].as_i64().unwrap_or(15) as i32, + calls: 0, + queries: 0, + query_fail: f["query_fail"].as_i64().unwrap_or(-1) as i32, + bounds: f + .get("bounds") + .map(|v| std::array::from_fn(|i| v[i].as_i64().unwrap() as i32)) + .unwrap_or([-64, 384, 63]), + fail: f["fail"].as_i64().unwrap() as i32, + }; + let mut position_index = 0usize; + let mut sample_index = 0usize; + for repeat in 0..f["repeats"].as_i64().unwrap() as i32 { + for state in f["states"].as_array().unwrap() { + world.fallback = BlockStateId(state.as_u64().unwrap() as u32); + world.biome = f + .get("biomes") + .map(|values| { + let values = values.as_array().unwrap(); + BiomeId(values[sample_index % values.len()].as_u64().unwrap() as u32) + }) + .unwrap_or(BiomeId(0)); + sample_index += 1; + let p = if let Some(positions) = f.get("positions") { + let positions = positions.as_array().unwrap(); + let p = &positions[position_index % positions.len()]; + position_index += 1; + std::array::from_fn(|i| p[i].as_i64().unwrap() as i32) + } else { + [17, repeat - 64, -33] + }; + for optional in [false, true] { + let result = if optional { + provider.get_optional_state(&mut world, &mut random, p) + } else { + provider.get_state(&mut world, &mut random, p).map(Some) + }; + match result { + Ok(Some(state)) => writeln!(world.out, "state {}", state.0)?, + Ok(None) => writeln!(world.out, "state none")?, + Err(_) => writeln!(world.out, "state error")?, + } + writeln!(world.out, "next {}", random.next_long())?; + } + } + } + } + } + writeln!(out, "tail {}", random.next_long())?; + Ok(()) +} +fn tag(v: &Value) -> Tag { + match v { + Value::String(s) => Tag::String(s.as_str().into()), + Value::Number(n) => Tag::Int(n.as_i64().unwrap() as i32), + Value::Array(a) => Tag::List(a.iter().map(tag).collect()), + Value::Object(m) => { + Tag::Compound(m.iter().map(|(k, v)| (k.as_str().into(), tag(v))).collect()) + } + _ => panic!("invalid registry metadata"), + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let facts: Value = serde_json::from_str(&fs::read_to_string(dir.join("facts-server.json"))?)?; + let registry = BlockRegistry::from_nbt(&Tag::compound([ + ("DataVersion", Tag::Int(DATA_VERSION)), + ("states", tag(&facts["states"])), + ("defaults", tag(&facts["defaults"])), + ]))?; + let integers = facts["integers"] + .as_array() + .unwrap() + .iter() + .map(|v| { + ( + v[0].as_str().unwrap().to_owned(), + v[1].as_str().unwrap().to_owned(), + ) + }) + .collect(); + let resources: Value = serde_json::from_str(&fs::read_to_string(dir.join("tags.json"))?)?; + let mut definitions = TagDefinitions::default(); + for (name, text) in resources.as_object().unwrap() { + definitions.apply_json(name, "vanilla", text.as_str().unwrap())?; + } + let built = + definitions.build(|name, _| registry.default_state(name).map(|_| name.to_owned()))?; + assert!(built.missing.is_empty()); + let tag_states: BTreeMap> = built + .tags + .iter() + .map(|(tag, names)| { + let states = (0..registry.len()) + .map(|i| BlockStateId(i as u32)) + .filter(|id| names.contains(®istry.state(*id).unwrap().name)) + .collect(); + (tag.clone(), states) + }) + .collect(); + let fluid_resources: BTreeMap = + serde_json::from_str(&fs::read_to_string(dir.join("fluid-tags.json"))?)?; + let mut fluid_tags = TagDefinitions::default(); + for (name, text) in fluid_resources { + fluid_tags.apply_json(&name, "vanilla", &text)?; + } + let fluid_tags = + fluid_tags.build(|name, _| FluidKind::from_name(name).map(|_| name.to_owned()))?; + assert!(fluid_tags.missing.is_empty()); + let biome_resources: BTreeMap = + serde_json::from_str(&fs::read_to_string(dir.join("biomes.json"))?)?; + let biome_names: BTreeMap = biome_resources + .keys() + .enumerate() + .map(|(i, name)| (name.clone(), BiomeId(i as u32))) + .collect(); + let biome_tags: BTreeMap = + serde_json::from_str(&fs::read_to_string(dir.join("biome_tags.json"))?)?; + let mut definitions = TagDefinitions::default(); + for (name, text) in biome_tags { + definitions.apply_json(&name, "vanilla", &text)?; + } + let biome_tags = + definitions.build(|name, _| biome_names.contains_key(name).then(|| name.to_owned()))?; + assert!(biome_tags.missing.is_empty()); + let biomes = Arc::new(BiomePredicateBindings::new(&biome_names, &biome_tags.tags)?); + let collision_tag = horizon_world::nbt::read_named( + &fs::read(dir.join("cached-collision.nbt"))?, + horizon_world::nbt::Limits::default(), + )? + .0 + .tag; + let collision = + horizon_world::collision::CachedCollisionRegistry::from_nbt(&collision_tag, ®istry)?; + let properties_tag = horizon_world::nbt::read_named( + &fs::read(dir.join("block-properties.nbt"))?, + horizon_world::nbt::Limits::default(), + )? + .0 + .tag; + let properties = horizon_world::block_properties::BlockPropertiesRegistry::from_nbt( + &properties_tag, + &collision, + )?; + let support_tag = horizon_world::nbt::read_named( + &fs::read(dir.join("cached-support.nbt"))?, + horizon_world::nbt::Limits::default(), + )? + .0 + .tag; + let support = Arc::new(BlockSupportRegistry::from_nbt(&support_tag, ®istry)?); + let survival_definitions: BTreeMap = + serde_json::from_str(&fs::read_to_string(dir.join("survival-rules.json"))?)?; + let survival_definitions = survival_definitions + .into_iter() + .map(|(name, rule)| { + use SurvivalRule::*; + let rule = match rule.as_str() { + value if value.starts_with("TagBelow:") => TagBelow(value[9..].to_owned()), + "CactusFlower" => CactusFlower, + "Seagrass" => Seagrass, + "BubbleColumn" => BubbleColumn, + "RedstoneWire" => RedstoneWire, + "DoublePlant" => DoublePlant, + "Door" => Door, + "BigDripleaf" => BigDripleaf, + "BigDripleafStem" => BigDripleafStem, + "Farmland" => Farmland, + "Cocoa" => Cocoa, + "Crop" => Crop, + "GrowingPlant" => GrowingPlant, + "MangrovePropagule" => MangrovePropagule, + "Speleothem" => Speleothem, + "Scaffolding" => Scaffolding, + "PistonHead" => PistonHead, + "ChorusPlant" => ChorusPlant, + "ChorusFlower" => ChorusFlower, + "PitcherCrop" => PitcherCrop, + "Multiface" => Multiface, + "Vine" => Vine, + "HangingMoss" => HangingMoss, + "SnowLayer" => SnowLayer, + "SeaPickle" => SeaPickle, + "Fire" => Fire, + "Cactus" => Cactus, + "Path" => Path, + "Mushroom" => Mushroom, + "Bell" => Bell, + "SugarCane" => SugarCane, + "LilyPad" => LilyPad, + "Frogspawn" => Frogspawn, + "SporeBlossom" => SporeBlossom, + "SmallDripleaf" => SmallDripleaf, + "TallSeagrass" => TallSeagrass, + "Always" => Always, + "SolidBelow" => SolidBelow, + "SolidBehind" => SolidBehind, + "NonAirBelow" => NonAirBelow, + "MossCarpet" => MossCarpet, + "CenterBelow" => CenterBelow, + "Lantern" => Lantern, + "FullAbove" => FullAbove, + "FullBehind" => FullBehind, + "RigidOrCenterBelow" => RigidOrCenterBelow, + "RigidBelow" => RigidBelow, + "FullBelow" => FullBelow, + "CenterAbove" => CenterAbove, + "FaceAttached" => FaceAttached, + "SupportsBamboo" => SupportsBamboo, + _ => panic!("unknown survival rule {rule}"), + }; + (name, rule) + }) + .collect(); + let collision = Arc::new(BlockCollisionRegistry::new(Arc::new(collision))?); + let extra: Value = serde_json::from_str(&fs::read_to_string( + dir.join("survival-extra-definitions.json"), + )?)?; + let survival_definitions = SurvivalDefinitions { + rules: survival_definitions, + ignition_odds: serde_json::from_value(extra["ignition_odds"].clone())?, + fence_gates: serde_json::from_value(extra["fence_gates"].clone())?, + }; + let survival = BlockSurvivalRegistry::new( + ®istry, + &properties, + Arc::clone(&support), + collision, + &survival_definitions, + &built.tags, + &fluid_tags.tags, + )?; + let bindings = StateProviderBindings::new(®istry, integers, &built.tags)? + .with_block_properties(&properties)? + .with_fluid_tags(&fluid_tags.tags)? + .with_biomes(biomes); + let resources: BTreeMap = + serde_json::from_str(&fs::read_to_string(dir.join("catalog.json"))?)?; + let catalog = StateProviderCatalog::from_resources(&resources)?; + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + let fluids = FluidStateTable::new(®istry)?; + for i in 0..registry.len() { + let fluid = fluids.get(BlockStateId(i as u32)).unwrap(); + writeln!( + out, + "fluid {i} {} {} {} {} {}", + fluid.kind().name(), + fluid.amount(), + fluid.falling(), + fluid.is_source(), + fluid.own_height().to_bits() + )?; + } + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let seed = f["seed"].as_i64().unwrap(); + match ( + f["legacy"].as_bool().unwrap(), + f["worldgen"].as_bool().unwrap(), + ) { + (true, false) => fixture( + &f, + &bindings, + &catalog, + &tag_states, + (&support, &survival), + LegacyRandom::new(seed), + &mut out, + )?, + (false, false) => fixture( + &f, + &bindings, + &catalog, + &tag_states, + (&support, &survival), + XoroshiroRandom::new(seed), + &mut out, + )?, + (true, true) => fixture( + &f, + &bindings, + &catalog, + &tag_states, + (&support, &survival), + WorldgenRandom::new(LegacyRandom::new(seed)), + &mut out, + )?, + (false, true) => fixture( + &f, + &bindings, + &catalog, + &tag_states, + (&support, &survival), + WorldgenRandom::new(XoroshiroRandom::new(seed)), + &mut out, + )?, + } + } + Ok(()) +} diff --git a/crates/horizon-world/examples/structure_density_fixture.rs b/crates/horizon-world/examples/structure_density_fixture.rs new file mode 100644 index 000000000..55ef66f83 --- /dev/null +++ b/crates/horizon-world/examples/structure_density_fixture.rs @@ -0,0 +1,97 @@ +//! Original JSON transport for structure-density comparison. +use horizon_core::{ + density::{ + Beardifier, DensitySampler, JigsawJunction, RigidPiece, SamplerContext, StructureBounds, + TerrainAdjustment, + }, + noise::DensityVolume, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, +}; +fn n(v: &Value) -> i32 { + v.as_i64().unwrap() as i32 +} +fn bounds(v: &Value) -> Option { + if v.is_null() { + None + } else { + StructureBounds::new( + std::array::from_fn(|i| n(&v[i])), + std::array::from_fn(|i| n(&v[i + 3])), + ) + } +} +fn bits(value: f32) -> u32 { + if value.is_nan() { + 0x7fc00000 + } else { + value.to_bits() + } +} +fn main() -> Result<(), Box> { + let args: Vec<_> = std::env::args().collect(); + let mut out = io::BufWriter::new(fs::File::create(&args[2])?); + for line in fs::read_to_string(&args[1])?.lines() { + let f: Value = serde_json::from_str(line)?; + let pieces = f["pieces"] + .as_array() + .unwrap() + .iter() + .map(|a| RigidPiece { + bounds: bounds(&a[0]).unwrap(), + adjustment: match a[1].as_str().unwrap() { + "NONE" => TerrainAdjustment::None, + "BURY" => TerrainAdjustment::Bury, + "BEARD_THIN" => TerrainAdjustment::BeardThin, + "BEARD_BOX" => TerrainAdjustment::BeardBox, + "ENCAPSULATE" => TerrainAdjustment::Encapsulate, + _ => panic!("unknown adjustment"), + }, + ground_level_delta: n(&a[2]), + }) + .collect(); + let junctions = f["junctions"] + .as_array() + .unwrap() + .iter() + .map(|a| JigsawJunction { + source_x: n(&a[0]), + source_ground_y: n(&a[1]), + source_z: n(&a[2]), + }) + .collect(); + let sampler = Beardifier::new(pieces, junctions, bounds(&f["affected"])); + let mut context = SamplerContext::default(); + writeln!( + out, + "beardifier {} {}", + f["pieces"].as_array().unwrap().len(), + f["junctions"].as_array().unwrap().len() + )?; + for p in f["points"].as_array().unwrap() { + writeln!( + out, + "value {:x}", + bits(sampler.sample_value(&mut context, std::array::from_fn(|i| n(&p[i])))?) + )?; + } + for a in f["volumes"].as_array().unwrap() { + let volume = DensityVolume::new( + std::array::from_fn(|i| n(&a[i])), + std::array::from_fn(|i| n(&a[i + 3])), + std::array::from_fn(|i| n(&a[i + 6])), + )?; + let mut buffer = vec![-123.5; volume.size() + n(&a[9]) as usize]; + sampler.sample_volume(&mut context, &mut buffer, volume)?; + writeln!(out, "volume {}", buffer.len())?; + for value in buffer { + writeln!(out, "{:x}", bits(value))?; + } + } + } + out.flush()?; + Ok(()) +} diff --git a/crates/horizon-world/examples/support/decoration_storage.rs b/crates/horizon-world/examples/support/decoration_storage.rs new file mode 100644 index 000000000..43afdc1fc --- /dev/null +++ b/crates/horizon-world/examples/support/decoration_storage.rs @@ -0,0 +1,101 @@ +use horizon_world::{ + DATA_VERSION, + heightmap::HeightmapState, + nbt::Tag, + registry::{BlockRegistry, BlockStateId}, + worldgen::{tags::TagDefinitions, terrain::TerrainBlockStates}, +}; +use serde_json::Value; +use std::{collections::BTreeSet, fs, path::Path}; +#[derive(Clone, Copy)] +pub struct State { + air: bool, + air_block: bool, + fluid: bool, + motion: bool, + no_leaves: bool, +} +impl HeightmapState for State { + fn is_air(self) -> bool { + self.air + } + fn is_air_block(self) -> bool { + self.air_block + } + fn has_fluid(self) -> bool { + self.fluid + } + fn blocks_motion_in_heightmap(self) -> bool { + self.motion + } + fn blocks_motion_in_heightmap_no_leaves(self) -> bool { + self.no_leaves + } +} +pub struct Properties<'a>(pub &'a [State]); +impl TerrainBlockStates for Properties<'_> { + type State = State; + fn heightmap_state(&self, id: BlockStateId) -> State { + self.0[id.0 as usize] + } +} +fn tag(v: &Value) -> Tag { + match v { + Value::String(s) => Tag::String(s.as_str().into()), + Value::Number(i) => Tag::Int(i.as_i64().unwrap() as i32), + Value::Object(m) => { + Tag::Compound(m.iter().map(|(k, v)| (k.as_str().into(), tag(v))).collect()) + } + Value::Array(a) => Tag::List(a.iter().map(tag).collect()), + _ => panic!("unsupported registry fixture value"), + } +} +pub fn load(dir: &Path) -> Result<(BlockRegistry, Vec), Box> { + let facts: Value = serde_json::from_str(&fs::read_to_string(dir.join("facts-server.json"))?)?; + let bundle: Value = serde_json::from_str(&fs::read_to_string(dir.join("tags.json"))?)?; + let registry = BlockRegistry::from_nbt(&Tag::compound([ + ("DataVersion", Tag::Int(DATA_VERSION)), + ( + "states", + Tag::List( + facts["states"] + .as_array() + .unwrap() + .iter() + .map(|s| tag(&s[4])) + .collect(), + ), + ), + ("defaults", tag(&facts["defaults"])), + ]))?; + let mut definitions = TagDefinitions::default(); + for (name, text) in bundle.as_object().unwrap() { + definitions.apply_json(name, "vanilla", text.as_str().unwrap())?; + } + let built = definitions.build(|id, _| facts["defaults"].get(id).map(|_| id.to_owned()))?; + assert!(built.missing.is_empty()); + let motion: BTreeSet<_> = built.tags["minecraft:blocks_motion_in_heightmap"] + .iter() + .map(String::as_str) + .collect(); + let no_leaves: BTreeSet<_> = built.tags["minecraft:blocks_motion_in_heightmap_no_leaves"] + .iter() + .map(String::as_str) + .collect(); + let states: Vec<_> = facts["states"] + .as_array() + .unwrap() + .iter() + .map(|a| { + let name = a[0].as_str().unwrap(); + State { + air: a[1].as_bool().unwrap(), + air_block: name == "minecraft:air", + fluid: a[2].as_bool().unwrap(), + motion: motion.contains(name), + no_leaves: no_leaves.contains(name), + } + }) + .collect(); + Ok((registry, states)) +} diff --git a/crates/horizon-world/examples/support/placement_queries.rs b/crates/horizon-world/examples/support/placement_queries.rs new file mode 100644 index 000000000..eacb36cd6 --- /dev/null +++ b/crates/horizon-world/examples/support/placement_queries.rs @@ -0,0 +1,149 @@ +use horizon_world::{ + heightmap::HeightmapType, + worldgen::{ + anchor::WorldGenerationContext, + placement::{LayerBlock, PlacementContext, PlacementQueryError}, + }, +}; +use serde_json::Value; +use std::{cell::RefCell, io::Write}; +pub struct Queries<'a, W> { + generation: WorldGenerationContext, + world_min: i32, + height_base: i32, + mode: i32, + layer_world: bool, + fail: i32, + calls: i32, + out: &'a RefCell, +} +impl<'a, W: Write> Queries<'a, W> { + pub fn new(f: &Value, generation: WorldGenerationContext, out: &'a RefCell) -> Self { + let height_base = generation.min_y; + let world_min = f["world_min"] + .as_i64() + .map(|v| v as i32) + .unwrap_or(generation.min_y); + let generation = WorldGenerationContext::new( + generation.min_y.max(world_min), + generation.height, + generation.sea_level, + ); + Self { + generation, + world_min, + height_base, + layer_world: f["layer_world"].as_bool().unwrap_or(false), + mode: f["height_mode"].as_i64().unwrap_or(0) as i32, + fail: f["query_fail"].as_i64().unwrap_or(-1) as i32, + calls: 0, + out, + } + } +} +impl PlacementContext for Queries<'_, W> { + fn max_y(&mut self) -> Result { + Ok(self + .world_min + .wrapping_add(self.generation.height) + .wrapping_sub(1)) + } + fn inside_build_height(&mut self, [x, y, z]: [i32; 3]) -> Result { + writeln!(self.out.borrow_mut(), "inside {x} {y} {z}") + .map_err(|e| PlacementQueryError::Failed(e.to_string()))?; + let call = self.calls; + self.calls += 1; + if call == self.fail { + return Err(PlacementQueryError::Failed("bounds query failure".into())); + } + let result = y >= self.world_min && y <= self.max_y()?; + writeln!(self.out.borrow_mut(), "bounds_result {result}") + .map_err(|e| PlacementQueryError::Failed(e.to_string()))?; + Ok(result) + } + fn outside_build_height(&mut self, y: i32) -> Result { + writeln!(self.out.borrow_mut(), "outside {y}") + .map_err(|e| PlacementQueryError::Failed(e.to_string()))?; + let call = self.calls; + self.calls += 1; + if call == self.fail { + return Err(PlacementQueryError::Failed("bounds query failure".into())); + } + let result = y < self.world_min || y > self.max_y()?; + writeln!(self.out.borrow_mut(), "bounds_result {result}") + .map_err(|e| PlacementQueryError::Failed(e.to_string()))?; + Ok(result) + } + fn layer_block(&mut self, [x, y, z]: [i32; 3]) -> Result { + let mut out = self.out.borrow_mut(); + writeln!(out, "block {x} {y} {z}") + .map_err(|e| PlacementQueryError::Failed(e.to_string()))?; + let call = self.calls; + self.calls += 1; + if call == self.fail { + return Err(PlacementQueryError::Failed("block query failure".into())); + } + let names = [ + "bedrock", + "stone", + "air", + "water", + "dirt", + "cave_air", + "lava", + "bubble_column", + "void_air", + "grass_block", + "air", + "water", + ]; + let index = if y <= self.height_base { + 0 + } else { + y.wrapping_sub(self.height_base) + .wrapping_add(x.wrapping_mul(31).wrapping_add(z.wrapping_mul(17)) & 3) + .rem_euclid(12) as usize + }; + writeln!(out, "block_result minecraft:{}", names[index]) + .map_err(|e| PlacementQueryError::Failed(e.to_string()))?; + Ok(match index { + 0 => LayerBlock::Bedrock, + 1 | 4 | 7 | 9 => LayerBlock::Ground, + _ => LayerBlock::Empty, + }) + } + fn generation(&self) -> WorldGenerationContext { + self.generation + } + fn min_y(&mut self) -> Result { + Ok(self.world_min) + } + fn height(&mut self, kind: HeightmapType, x: i32, z: i32) -> Result { + let mut out = self.out.borrow_mut(); + writeln!(out, "height {} {x} {z}", kind.name()) + .map_err(|e| PlacementQueryError::Failed(e.to_string()))?; + let call = self.calls; + self.calls += 1; + if call == self.fail { + return Err(PlacementQueryError::Failed("height query failure".into())); + } + let min = self.height_base; + let result = if self.layer_world { + min.wrapping_add(24).wrapping_add((x ^ z) & 3) + } else if self.mode == 0 { + min.wrapping_add( + x.wrapping_mul(31) + .wrapping_add(z.wrapping_mul(17)) + .wrapping_add((kind as i32) * 7) + .rem_euclid(129), + ) + .wrapping_sub(64) + } else { + [i32::MIN, i32::MAX, 0, -1, min, min.wrapping_add(1)] + [(kind as usize + ((x ^ z) & 3) as usize) % 6] + }; + writeln!(out, "height_result {result}") + .map_err(|e| PlacementQueryError::Failed(e.to_string()))?; + Ok(result) + } +} diff --git a/crates/horizon-world/examples/terrain_fixture.rs b/crates/horizon-world/examples/terrain_fixture.rs new file mode 100644 index 000000000..09868a340 --- /dev/null +++ b/crates/horizon-world/examples/terrain_fixture.rs @@ -0,0 +1,303 @@ +//! Test transport for registry-backed noise-stage filling against vanilla doFill. +use horizon_core::{ + density::{ + Beardifier, JigsawJunction, RigidPiece, SamplerContext, StructureBounds, TerrainAdjustment, + WorldField, WorldFields, graph::DensityCompiler, + }, + noise::DensityVolume, + position::ChunkPos, + random::{LegacyRandom, PositionalRandom, RandomSource, XoroshiroRandom}, +}; +use horizon_world::{ + DATA_VERSION, + heightmap::{HeightmapState, HeightmapType}, + nbt::Tag, + registry::{BlockRegistry, BlockStateId}, + worldgen::{ + aquifer::{ + AquiferConfig, DisabledAquifer, GlobalFluidPicker, NoiseBasedAquifer, + RegistryAquiferBlockStates, + }, + density::DensityRegistry, + router::{NoiseRouter, RouterField}, + tags::TagDefinitions, + terrain::{TerrainAquifer, TerrainBlockStates, TerrainChunk, fill_noise}, + }, +}; +use serde_json::Value; +use std::{ + collections::{BTreeMap, BTreeSet}, + fs, + io::{self, Write}, + path::Path, + sync::Arc, +}; +#[derive(Clone, Copy)] +struct State { + air: bool, + air_block: bool, + fluid: bool, + motion: bool, + no_leaves: bool, +} +impl HeightmapState for State { + fn is_air(self) -> bool { + self.air + } + fn is_air_block(self) -> bool { + self.air_block + } + fn has_fluid(self) -> bool { + self.fluid + } + fn blocks_motion_in_heightmap(self) -> bool { + self.motion + } + fn blocks_motion_in_heightmap_no_leaves(self) -> bool { + self.no_leaves + } +} +struct Properties<'a>(&'a [State]); +impl TerrainBlockStates for Properties<'_> { + type State = State; + fn heightmap_state(&self, id: BlockStateId) -> State { + self.0[id.0 as usize] + } +} +fn n(v: &Value) -> i32 { + v.as_i64().unwrap() as i32 +} +fn tag(v: &Value) -> Tag { + match v { + Value::String(s) => Tag::String(s.as_str().into()), + Value::Number(i) => Tag::Int(i.as_i64().unwrap() as i32), + Value::Object(m) => { + Tag::Compound(m.iter().map(|(k, v)| (k.as_str().into(), tag(v))).collect()) + } + Value::Array(a) => Tag::List(a.iter().map(tag).collect()), + _ => panic!("unsupported registry fixture value"), + } +} +fn structure(v: &Value) -> Beardifier { + let bounds = |v: &Value| { + StructureBounds::new( + std::array::from_fn(|i| n(&v[i])), + std::array::from_fn(|i| n(&v[i + 3])), + ) + .unwrap() + }; + let pieces = v["pieces"] + .as_array() + .unwrap() + .iter() + .map(|a| RigidPiece { + bounds: bounds(&a[0]), + ground_level_delta: n(&a[2]), + adjustment: match a[1].as_str().unwrap() { + "NONE" => TerrainAdjustment::None, + "BURY" => TerrainAdjustment::Bury, + "BEARD_THIN" => TerrainAdjustment::BeardThin, + "BEARD_BOX" => TerrainAdjustment::BeardBox, + "ENCAPSULATE" => TerrainAdjustment::Encapsulate, + _ => panic!("unknown adjustment"), + }, + }) + .collect(); + let junctions = v["junctions"] + .as_array() + .unwrap() + .iter() + .map(|a| JigsawJunction { + source_x: n(&a[0]), + source_ground_y: n(&a[1]), + source_z: n(&a[2]), + }) + .collect(); + Beardifier::new(pieces, junctions, Some(bounds(&v["affected"]))) +} +fn fixture( + f: Value, + registry: &BlockRegistry, + states: &[State], + bundle: &Value, + out: &mut impl Write, +) -> Result<(), Box> { + let min = n(&f["min"]); + let height = n(&f["height"]); + let cx = n(&f["cx"]); + let cz = n(&f["cz"]); + let seed = f["seed"].as_i64().unwrap(); + let legacy = f["legacy"].as_bool().unwrap(); + let volume = DensityVolume::new( + [16, n(&f["noise_height"]), 16], + [cx.wrapping_shl(4), n(&f["noise_min"]), cz.wrapping_shl(4)], + [1; 3], + )?; + let mut chunk = TerrainChunk::new( + ChunkPos { x: cx, z: cz }, + min, + height, + registry, + Properties(states), + )?; + for a in f["initial"].as_array().unwrap() { + chunk.set_block_raw(n(&a[0]), n(&a[1]), n(&a[2]), BlockStateId(n(&a[3]) as u32))?; + } + let noises: BTreeMap = serde_json::from_value(bundle["noises"].clone())?; + let densities: BTreeMap = serde_json::from_value(bundle["densities"].clone())?; + let mut definitions = DensityRegistry::from_json(&noises, &densities)?; + let router = NoiseRouter::from_json(&f["router"].to_string(), &mut definitions)?; + let config = if f["aquifers"].is_null() { + None + } else { + Some(AquiferConfig::from_json( + &f["aquifers"].to_string(), + &mut definitions, + )?) + }; + let mut compiler = DensityCompiler::new_seeded(definitions.into_graph(), seed, legacy); + let mut context = SamplerContext::cached(); + if let Some(source) = f.get("structure") { + context = context.with_world_fields( + WorldFields::default().with_field(WorldField::Beardifier, Arc::new(structure(source))), + ); + } + let air = registry.default_state("minecraft:air").unwrap(); + let picker = GlobalFluidPicker::new( + n(&f["sea"]), + BlockStateId(n(&f["fluid"]) as u32), + registry.default_state("minecraft:lava").unwrap(), + air, + ); + let mut aquifer: Box = if let Some(config) = config { + let samplers = config.compile(&mut compiler)?; + let blocks = RegistryAquiferBlockStates::new(registry)?; + if legacy { + let random = LegacyRandom::new(seed) + .fork_positional() + .from_hash_of("minecraft:aquifer") + .fork_positional(); + Box::new(NoiseBasedAquifer::new( + samplers, + picker, + random, + blocks, + volume, + &mut context, + )?) + } else { + let random = XoroshiroRandom::new(seed) + .fork_positional() + .from_hash_of("minecraft:aquifer") + .fork_positional(); + Box::new(NoiseBasedAquifer::new( + samplers, + picker, + random, + blocks, + volume, + &mut context, + )?) + } + } else { + Box::new(DisabledAquifer::new(picker, air)) + }; + let density = compiler.get_sampler(router.function(RouterField::FinalDensity))?; + writeln!(out, "chunk {cx} {cz} {min} {height}")?; + for repeat in 0..n(&f["repeats"]) { + fill_noise( + &mut chunk, + volume, + density.as_ref(), + &mut context, + aquifer.as_mut(), + BlockStateId(n(&f["block"]) as u32), + )?; + writeln!( + out, + "fill {repeat} {}", + aquifer.should_schedule_fluid_update() + )?; + for section in 0..(height / 16) as usize { + writeln!(out, "section {section}")?; + for index in 0..4096 { + writeln!(out, "{}", chunk.section(section).unwrap().get(index)?.0)?; + } + } + for kind in [HeightmapType::OceanFloorWg, HeightmapType::WorldSurfaceWg] { + writeln!(out, "heightmap {}", kind.name())?; + for word in chunk.heightmap(kind).unwrap().raw_data() { + writeln!(out, "{word:x}")?; + } + } + for (section, list) in chunk.postprocessing().iter().enumerate() { + writeln!(out, "post {section} {}", list.len())?; + for offset in list { + writeln!(out, "{offset}")?; + } + } + } + Ok(()) +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let facts: Value = serde_json::from_str(&fs::read_to_string(dir.join("facts-server.json"))?)?; + let bundle: Value = serde_json::from_str(&fs::read_to_string(dir.join("registries.json"))?)?; + let registry = BlockRegistry::from_nbt(&Tag::compound([ + ("DataVersion", Tag::Int(DATA_VERSION)), + ( + "states", + Tag::List( + facts["states"] + .as_array() + .unwrap() + .iter() + .map(|s| tag(&s[4])) + .collect(), + ), + ), + ("defaults", tag(&facts["defaults"])), + ]))?; + let mut definitions = TagDefinitions::default(); + for (name, text) in bundle["tags"].as_object().unwrap() { + definitions.apply_json(name, "vanilla", text.as_str().unwrap())?; + } + let built = definitions.build(|id, _| facts["defaults"].get(id).map(|_| id.to_owned()))?; + assert!(built.missing.is_empty()); + let motion: BTreeSet<_> = built.tags["minecraft:blocks_motion_in_heightmap"] + .iter() + .map(String::as_str) + .collect(); + let no_leaves: BTreeSet<_> = built.tags["minecraft:blocks_motion_in_heightmap_no_leaves"] + .iter() + .map(String::as_str) + .collect(); + let states: Vec<_> = facts["states"] + .as_array() + .unwrap() + .iter() + .map(|a| { + let name = a[0].as_str().unwrap(); + State { + air: a[1].as_bool().unwrap(), + air_block: name == "minecraft:air", + fluid: a[2].as_bool().unwrap(), + motion: motion.contains(name), + no_leaves: no_leaves.contains(name), + } + }) + .collect(); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + fixture( + serde_json::from_str(line)?, + ®istry, + &states, + &bundle, + &mut out, + )?; + } + out.flush()?; + Ok(()) +} diff --git a/crates/horizon-world/examples/tick_fixture.rs b/crates/horizon-world/examples/tick_fixture.rs new file mode 100644 index 000000000..7b5bfa8ed --- /dev/null +++ b/crates/horizon-world/examples/tick_fixture.rs @@ -0,0 +1,71 @@ +//! Process vanilla saved block/fluid ticks through Horizon's storage and queues. +use horizon_core::{ + position::ChunkPos, + ticks::{ScheduledTick, TickPriority, TickTypeId}, +}; +use horizon_world::{ + chunk::ChunkData, + compression::Compression, + nbt::{self, Limits, Tag}, + region::{ChunkRecord, RegionFile, RegionWriter}, + tick_data::TickKind, +}; +use std::{collections::BTreeMap, error::Error, fs, path::PathBuf}; +fn main() -> Result<(), Box> { + let base = PathBuf::from( + std::env::args() + .nth(1) + .ok_or("expected fixture directory")?, + ); + let bytes = fs::read(base.join("ticks-input.nbt"))?; + let (root, used) = nbt::read_named(&bytes, Limits::default())?; + assert_eq!(used, bytes.len()); + let mut chunk = ChunkData::new(root)?; + for (kind, ids_field, time) in [ + (TickKind::Block, "block_ids", 1000), + (TickKind::Fluid, "fluid_ids", i64::MAX - 8), + ] { + let Some(Tag::Compound(entries)) = chunk.root().tag.get(ids_field) else { + return Err("missing type IDs".into()); + }; + let mut ids = BTreeMap::new(); + let mut names = BTreeMap::new(); + for (name, id) in entries { + let Tag::Int(id) = id else { + return Err("invalid ID".into()); + }; + let name = name.to_string()?; + ids.insert(name.clone(), TickTypeId(*id as u32)); + names.insert(TickTypeId(*id as u32), name); + } + let mut ticks = chunk.saved_ticks(kind, |name| ids.get(name).copied())?; + assert!(ticks.peek().is_none()); + assert_eq!(ticks.count(), 251); + ticks.unpack(time); + if let Some(first) = ticks.poll() { + assert!(ticks.schedule(ScheduledTick { + trigger_tick: time.wrapping_add(123), + priority: TickPriority::High, + sub_tick_order: 77, + ..first + })); + } + let saved = ticks.pack(time); + chunk.set_saved_ticks(kind, &saved, |id| names.get(&id).cloned())?; + } + let root = chunk.into_nbt(); + fs::write( + base.join("ticks-output.nbt"), + nbt::write_named(&root, Limits::default())?, + )?; + let path = base.join("tick-region/r.0.0.mca"); + let record = ChunkRecord::from_nbt(&root, Compression::Zlib, 123, Limits::default())?; + let mut writer = RegionWriter::create(&path)?; + writer.write(ChunkPos::new(0, 0), &record)?; + writer.finish()?; + let record = RegionFile::open(path)? + .read(ChunkPos::new(0, 0))? + .ok_or("missing region chunk")?; + assert_eq!(record.nbt(Limits::default())?, root); + Ok(()) +} diff --git a/crates/horizon-world/examples/value_provider_fixture.rs b/crates/horizon-world/examples/value_provider_fixture.rs new file mode 100644 index 000000000..be7bf8afe --- /dev/null +++ b/crates/horizon-world/examples/value_provider_fixture.rs @@ -0,0 +1,68 @@ +//! Transport for decoded scalar provider samples and subsequent random state. +use horizon_core::random::{LegacyRandom, RandomSource, XoroshiroRandom}; +use horizon_world::worldgen::value_provider::{FloatProvider, IntProvider}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn bits(value: f32) -> u32 { + if value.is_nan() { + 0x7fc00000 + } else { + value.to_bits() + } +} +fn fixture( + f: &Value, + mut random: impl RandomSource, + out: &mut impl Write, +) -> Result<(), Box> { + let json = f["definition"].as_str().unwrap(); + match f["kind"].as_str().unwrap() { + "float" => match FloatProvider::from_json(json) { + Ok(provider) => { + let [min, max] = provider.bounds(); + writeln!(out, "float {:x} {:x}", bits(min), bits(max))?; + for _ in 0..f["samples"].as_u64().unwrap() { + writeln!(out, "sample {:x}", bits(provider.sample(&mut random)))?; + writeln!(out, "next {}", random.next_long())?; + } + } + Err(_) => writeln!(out, "decode error")?, + }, + "int" => match IntProvider::from_json(json) { + Ok(provider) => { + let [min, max] = provider.bounds(); + writeln!(out, "int {min} {max}")?; + for _ in 0..f["samples"].as_u64().unwrap() { + match provider.sample(&mut random) { + Ok(value) => writeln!(out, "sample {value}")?, + Err(_) => writeln!(out, "sample error")?, + } + writeln!(out, "next {}", random.next_long())?; + } + } + Err(_) => writeln!(out, "decode error")?, + }, + _ => unreachable!(), + } + writeln!(out, "tail {}", random.next_long())?; + Ok(()) +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let seed = f["seed"].as_i64().unwrap(); + if f["legacy"].as_bool().unwrap() { + fixture(&f, LegacyRandom::new(seed), &mut out)?; + } else { + fixture(&f, XoroshiroRandom::new(seed), &mut out)?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/examples/world_fixture.rs b/crates/horizon-world/examples/world_fixture.rs new file mode 100644 index 000000000..d972643cc --- /dev/null +++ b/crates/horizon-world/examples/world_fixture.rs @@ -0,0 +1,154 @@ +//! Exercises world primitives using local vanilla-generated fixtures. +use horizon_world::{ + chunk::{BlockSection, BlockState, PalettedContainer}, + nbt::{self, JavaString, Limits, NamedTag, Tag}, + registry::{BlockRegistry, BlockStateId}, +}; +use std::{error::Error, fs, path::PathBuf}; + +fn main() -> Result<(), Box> { + let base = PathBuf::from( + std::env::args() + .nth(1) + .ok_or("expected fixture directory")?, + ); + let output = base.join("rust/palettes"); + fs::create_dir_all(&output)?; + for entry in fs::read_dir(base.join("palettes"))? { + let entry = entry?; + let filename = entry + .file_name() + .into_string() + .map_err(|_| "invalid filename")?; + let biome = filename.starts_with("biome-"); + let count: usize = filename + .split_once('-') + .unwrap() + .1 + .trim_end_matches(".nbt") + .parse()?; + let len = if biome { 64 } else { 4096 }; + let (root, _) = nbt::read_named(&fs::read(entry.path())?, Limits::default())?; + let mut palette = PalettedContainer::from_nbt(&root.tag, len, if biome { 1 } else { 4 })?; + for i in 0..len { + assert_eq!( + palette.get(i)?, + &Tag::String(JavaString::from(format!("state{}", i % count).as_str())) + ); + } + palette.set(len - 1, Tag::String(JavaString::from("state4096")))?; + for kind in ["edited", "compact"] { + if kind == "compact" { + palette.compact()?; + } + let root = NamedTag { + name: root.name.clone(), + tag: palette.to_nbt(), + }; + fs::write( + output.join(format!("{kind}-{filename}")), + nbt::write_named(&root, Limits::default())?, + )?; + } + } + let (registry_root, _) = nbt::read_named( + &fs::read(base.join("block-registry.nbt"))?, + Limits::default(), + )?; + let registry = BlockRegistry::from_nbt(®istry_root.tag)?; + let Some(Tag::List(states)) = registry_root.tag.get("states") else { + return Err("missing states".into()); + }; + for (i, tag) in states.iter().enumerate() { + let state = BlockState::from_nbt(tag)?; + assert_eq!(registry.id(&state), Some(BlockStateId(i as u32))); + assert_eq!(registry.state(BlockStateId(i as u32)), Some(&state)); + assert_eq!(registry.resolve(&state)?, BlockStateId(i as u32)); + let descriptor = BlockState { + name: state.name.clone(), + properties: Default::default(), + }; + assert_eq!( + registry.resolve(&descriptor)?, + registry.default_state(&state.name).unwrap() + ); + } + fs::write( + base.join("rust/block-registry.nbt"), + nbt::write_named(®istry_root, Limits::default())?, + )?; + let mut section = BlockSection::uniform(BlockStateId(0), ®istry)?; + for i in 0..4096 { + section.set(i, BlockStateId(((i * 7) % registry.len()) as u32))?; + } + assert_eq!(section.bits(), 12); + let root = NamedTag { + name: "".into(), + tag: section.to_nbt()?, + }; + fs::write( + base.join("rust/runtime-section.nbt"), + nbt::write_named(&root, Limits::default())?, + )?; + let loaded = BlockSection::from_nbt(&root.tag, ®istry)?; + for i in 0..4096 { + assert_eq!(loaded.get(i)?, section.get(i)?); + } + assert!(section.set(4096, BlockStateId(0)).is_err()); + assert!(section.set(0, BlockStateId(registry.len() as u32)).is_err()); + // Rotate every registered state through one slot to exercise slot reuse. + for i in 0..registry.len() { + section.set(0, BlockStateId(i as u32))?; + } + for i in 1..4096 { + assert_eq!( + section.get(i)?, + BlockStateId(((i * 7) % registry.len()) as u32) + ); + } + for i in 0..4096 { + section.set(i, BlockStateId(0))?; + } + assert_eq!(section.bits(), 0); + // Mixed replacement, sharing, and compaction must preserve every block. + let mut expected = vec![BlockStateId(0); 4096]; + let mut random = 0x31415926u64; + for step in 0..100_000 { + random = random.wrapping_mul(6364136223846793005).wrapping_add(1); + let index = (random >> 32) as usize % 4096; + let state = BlockStateId(if step % 3 == 0 { + 0 + } else { + (random >> 16) as u32 % registry.len() as u32 + }); + assert_eq!(section.set(index, state)?, expected[index]); + expected[index] = state; + if step % 8192 == 0 { + section.compact()?; + for (index, state) in expected.iter().enumerate() { + assert_eq!(section.get(index)?, *state); + } + } + } + let mutated = NamedTag { + name: "".into(), + tag: section.to_nbt()?, + }; + fs::write( + base.join("rust/runtime-mutated.nbt"), + nbt::write_named(&mutated, Limits::default())?, + )?; + let loaded = BlockSection::from_nbt(&mutated.tag, ®istry)?; + for (index, state) in expected.iter().enumerate() { + assert_eq!(loaded.get(index)?, *state); + section.set(index, BlockStateId(0))?; + } + section.compact()?; + assert_eq!(section.bits(), 0); + assert!(section.to_nbt()?.get("data").is_none()); + println!( + "Rust registry: {} states and default-state resolutions checked", + registry.len() + ); + Ok(()) +} diff --git a/crates/horizon-world/examples/worldgen_random_fixture.rs b/crates/horizon-world/examples/worldgen_random_fixture.rs new file mode 100644 index 000000000..1cf37b1f9 --- /dev/null +++ b/crates/horizon-world/examples/worldgen_random_fixture.rs @@ -0,0 +1,134 @@ +use horizon_core::{ + position::BlockPos, + random::{ + LegacyRandom, PositionalRandom, RandomSource, WorldgenRandom, WorldgenSource, + XoroshiroRandom, slime_chunk_random, + }, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn n(v: &Value) -> i32 { + v.as_i64().unwrap() as i32 +} +fn l(v: &Value) -> i64 { + v.as_i64().unwrap() +} +fn fixture(f: &Value, source: impl WorldgenSource, out: &mut impl Write) -> io::Result<()> { + let mut root = WorldgenRandom::new(source); + let mut child = None; + for op in f["ops"].as_array().unwrap() { + match op[0].as_str().unwrap() { + "root" => { + child = None; + writeln!(out, "root")?; + } + "bits" => writeln!(out, "bits {}", root.next_bits(n(&op[1])))?, + "decoration" => writeln!( + out, + "decoration {}", + root.set_decoration_seed(l(&op[1]), n(&op[2]), n(&op[3])) + )?, + "feature" => { + root.set_feature_seed(l(&op[1]), n(&op[2]), n(&op[3])); + writeln!(out, "feature")?; + } + "large" => { + root.set_large_feature_seed(l(&op[1]), n(&op[2]), n(&op[3])); + writeln!(out, "large")?; + } + "salt" => { + root.set_large_feature_with_salt(l(&op[1]), n(&op[2]), n(&op[3]), n(&op[4])); + writeln!(out, "salt")?; + } + "slime" => { + let mut r = slime_chunk_random(n(&op[1]), n(&op[2]), l(&op[3]), l(&op[4])); + writeln!( + out, + "slime {} {}", + r.next_long(), + r.next_int_bound(10).unwrap() + )?; + } + kind => { + let random = child.as_mut().unwrap_or(&mut root); + match kind { + "int" => writeln!(out, "int {}", random.next_int())?, + "long" => writeln!(out, "long {}", random.next_long())?, + "bool" => writeln!(out, "bool {}", random.next_boolean())?, + "float" => writeln!(out, "float {:x}", random.next_float().to_bits())?, + "double" => writeln!(out, "double {:x}", random.next_double().to_bits())?, + "bound" => match random.next_int_bound(n(&op[1])) { + Ok(v) => writeln!(out, "bound {v}")?, + Err(_) => writeln!(out, "bound error")?, + }, + "seed" => { + random.set_seed(l(&op[1])); + writeln!(out, "seed")?; + } + "consume" => { + random.consume_count(n(&op[1])); + writeln!(out, "consume")?; + } + "fork" => { + child = Some(random.fork()); + writeln!(out, "fork")?; + } + "pos" => { + child = Some(random.fork_positional().at(BlockPos::new( + n(&op[1]), + n(&op[2]), + n(&op[3]), + ))); + writeln!(out, "pos")?; + } + "pos_seed" => { + child = Some(random.fork_positional().from_seed(l(&op[1]))); + writeln!(out, "pos_seed")?; + } + "pos_hash" => { + let units = op[1] + .as_array() + .unwrap() + .iter() + .map(|v| n(v) as u16) + .collect::>(); + child = Some(random.fork_positional().from_hash_of_utf16(&units)); + writeln!(out, "pos_hash")?; + } + _ => panic!("unknown operation"), + } + } + } + writeln!(out, "count {}", root.count())?; + } + writeln!(out, "tail {}", root.next_long())?; + writeln!(out, "count {}", root.count())?; + Ok(()) +} +fn layers(f: &Value, mut source: impl WorldgenSource, out: &mut impl Write) -> io::Result<()> { + source.consume_count(n(&f["warmup"])); + match n(&f["layers"]) { + 1 => fixture(f, source, out), + 2 => fixture(f, WorldgenRandom::new(source), out), + 3 => fixture(f, WorldgenRandom::new(WorldgenRandom::new(source)), out), + _ => panic!("unsupported layer count"), + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + if f["legacy"].as_bool().unwrap() { + layers(&f, LegacyRandom::new(l(&f["seed"])), &mut out)?; + } else { + layers(&f, XoroshiroRandom::new(l(&f["seed"])), &mut out)?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/src/bin/worldgen_parity.rs b/crates/horizon-world/src/bin/worldgen_parity.rs new file mode 100644 index 000000000..eaf585023 --- /dev/null +++ b/crates/horizon-world/src/bin/worldgen_parity.rs @@ -0,0 +1,915 @@ +//! Original transport for version-specific JSON decoding comparisons. +use horizon_core::{ + density::{ + SamplerContext, + graph::{DensityCompiler, FunctionId}, + }, + noise::DensityVolume, + noise::{Noise, NormalNoise}, + random::{LegacyRandom, RandomSource, XoroshiroRandom}, +}; +use horizon_world::worldgen::{ + decode_noise, + density::DensityRegistry, + router::{NoiseRouter, RouterField}, +}; +use std::io::{self, BufRead, Write}; + +fn bits(value: f32) -> u32 { + if value.is_nan() { + 0x7fc0_0000 + } else { + value.to_bits() + } +} +fn probe( + noise: &NormalNoise, + random: &mut impl RandomSource, + nether: bool, + out: &mut impl Write, +) -> Result<(), Box> { + let sampler = match if nether { + noise.create_for_legacy_nether_biome(random) + } else { + noise.create(random) + } { + Ok(sampler) => sampler, + Err(_) => { + writeln!(out, "sample error {}", random.next_long())?; + return Ok(()); + } + }; + for [x, y, z] in [ + [0., 0., 0.], + [-17.25, 64.125, 32.5], + [30e6, -64., -30e6], + [1.25, -0.5, -3.75], + [33554432., -2048., -33554433.], + ] { + writeln!( + out, + "query {} {}", + bits(sampler.get2(x, z)), + bits(sampler.get3(x, y, z)) + )?; + } + writeln!(out, "parent {}", random.next_long())?; + Ok(()) +} +fn registry_probe( + path: &str, + seed: i64, + legacy: bool, + optimized: bool, + out: &mut impl Write, +) -> Result<(), Box> { + let bundle: std::collections::BTreeMap> = + serde_json::from_str(&std::fs::read_to_string(path)?)?; + let registry = DensityRegistry::from_json(&bundle["noises"], &bundle["densities"])?; + let entries: Vec<_> = registry + .entries() + .map(|(name, id)| (name.to_owned(), id)) + .collect(); + let mut compiler = DensityCompiler::new_seeded(registry.into_graph(), seed, legacy); + writeln!(out, "registry {}", entries.len())?; + for (name, id) in entries { + sample_root( + &mut compiler, + id, + &name, + optimized, + false, + &mut SamplerContext::cached(), + out, + )?; + } + Ok(()) +} +fn sample_root( + compiler: &mut DensityCompiler, + id: FunctionId, + name: &str, + optimized: bool, + router: bool, + context: &mut SamplerContext, + out: &mut impl Write, +) -> Result<(), Box> { + let range = compiler.graph().range(id)?; + writeln!( + out, + "entry {name} {} {} {}", + bits(range.min()), + bits(range.max()), + compiler.graph().domain_axes(id)? + )?; + let sampler = match if optimized { + compiler.get_sampler(id) + } else { + compiler.compile_raw(id) + } { + Ok(sampler) => sampler, + Err(_) => { + writeln!(out, "compile error")?; + return Ok(()); + } + }; + writeln!(out, "compile ok {}", compiler.cache_count())?; + for position in [ + [0, 0, 0], + [-17, -64, 32], + [30000000, 319, -30000000], + [1, -1, -1], + ] { + writeln!( + out, + "density {}", + bits(sampler.sample_value(context, position)?) + )?; + } + let mut volumes = vec![ + ([2, 9, 2], [-17, -64, 32], [1, 1, 1]), + ([2, 9, 2], [-16, -64, 32], [4, 8, 4]), + ]; + if router { + volumes.push(([3, 1, 2], [-17, 0, 32], [4, 1, 4])); + } + for (extents, minimum, steps) in volumes { + let volume = DensityVolume::new(extents, minimum, steps)?; + let mut buffer = vec![0.; volume.size()]; + for _ in 0..2 { + let result = sampler.sample_volume(context, &mut buffer, volume); + writeln!( + out, + "volume {}", + if result.is_ok() { "ok" } else { "error" } + )?; + for value in &buffer { + writeln!(out, "cell {}", bits(*value))?; + } + } + } + Ok(()) +} +fn router_probe( + path: &str, + setting: &str, + seed: i64, + legacy: bool, + optimized: bool, + out: &mut impl Write, +) -> Result<(), Box> { + let bundle: std::collections::BTreeMap> = + serde_json::from_str(&std::fs::read_to_string(path)?)?; + let mut registry = DensityRegistry::from_json(&bundle["noises"], &bundle["densities"])?; + let settings: std::collections::BTreeMap> = + serde_json::from_str(&bundle["settings"][setting])?; + let router = NoiseRouter::from_json(settings["noise_router"].get(), &mut registry)?; + let mut compiler = DensityCompiler::new_seeded(registry.into_graph(), seed, legacy); + let mut context = SamplerContext::cached(); + writeln!(out, "router {setting} 8")?; + for field in RouterField::ALL { + sample_root( + &mut compiler, + router.function(field), + field.name(), + optimized, + true, + &mut context, + out, + )?; + } + let climate = router.compile_climate(&mut compiler)?; + writeln!(out, "climate caches {}", compiler.cache_count())?; + for position in [ + [0, 0, 0], + [-5, -16, 8], + [7500000, 79, -7500000], + [i32::MIN, i32::MAX, -1], + [536870912, -536870913, 17], + [-4, 0, 8], + ] { + write!(out, "climate")?; + for value in climate.sample(&mut context, position)?.parameters() { + write!(out, " {value}")?; + } + writeln!(out)?; + } + for (preset, json) in &bundle["presets"] { + let source = + horizon_world::worldgen::biome::MultiNoiseBiomeSource::from_quantized_json(json)?; + writeln!( + out, + "biomes {preset} {}", + source.parameters().entries().len() + )?; + let mut resolver = source.resolver(&climate); + for position in [ + [0, 0, 0], + [-5, -16, 8], + [7500000, 79, -7500000], + [i32::MIN, i32::MAX, -1], + [536870912, -536870913, 17], + [-4, 0, 8], + ] { + writeln!(out, "biome {}", resolver.sample(&mut context, position)?)?; + } + for (minimum, extents) in [ + ([-5, -16, 8], [3, 4, 2]), + ([-4, -16, 8], [3, 4, 2]), + ([i32::MAX - 1, i32::MIN, -1], [2, 2, 2]), + ] { + let volume = resolver.prepare_volume(&mut context, minimum, extents)?; + let mut positions = Vec::new(); + for z in 0..extents[2] { + for x in 0..extents[0] { + for y in 0..extents[1] { + positions.push([ + minimum[0].wrapping_add(x), + minimum[1].wrapping_add(y), + minimum[2].wrapping_add(z), + ]); + } + } + } + for position in positions + .iter() + .chain(positions.iter().rev()) + .chain(positions.iter().take(3)) + { + writeln!( + out, + "biomecell {}", + resolver.sample_prepared(&volume, *position)? + )?; + } + } + } + Ok(()) +} +fn index_probe( + branching: usize, + json: &str, + out: &mut impl Write, +) -> Result<(), Box> { + use horizon_world::worldgen::climate::{ClimateIndex, Parameter, ParameterPoint, TargetPoint}; + let input: serde_json::Value = serde_json::from_str(json)?; + let mut entries = Vec::new(); + for (id, entry) in input["entries"] + .as_array() + .ok_or("entries")? + .iter() + .enumerate() + { + let coords = entry["coordinates"].as_array().ok_or("coordinates")?; + let mut coordinates = [Parameter::new(0, 0); 6]; + for (coordinate, value) in coordinates.iter_mut().zip(coords) { + *coordinate = Parameter::new( + value[0].as_i64().ok_or("minimum")?, + value[1].as_i64().ok_or("maximum")?, + ); + } + entries.push(( + ParameterPoint { + coordinates, + offset: entry["offset"].as_i64().ok_or("offset")?, + }, + id, + )); + } + let index = match ClimateIndex::with_branching(entries, branching) { + Ok(index) => index, + Err(_) => { + writeln!(out, "index error")?; + return Ok(()); + } + }; + writeln!(out, "index ok {}", index.entries().len())?; + for id in index.leaf_order() { + writeln!(out, "leaf {id}")?; + } + let mut cached = index.searcher(); + for target in input["targets"].as_array().ok_or("targets")? { + let values = target.as_array().ok_or("target")?; + let point = TargetPoint { + temperature: values[0].as_i64().ok_or("temperature")?, + humidity: values[1].as_i64().ok_or("humidity")?, + continentalness: values[2].as_i64().ok_or("continentalness")?, + erosion: values[3].as_i64().ok_or("erosion")?, + depth: values[4].as_i64().ok_or("depth")?, + weirdness: values[5].as_i64().ok_or("weirdness")?, + }; + let brute = index.brute_force(point); + writeln!( + out, + "brute {brute} {}", + index.entries()[*brute].0.fitness(point) + )?; + for (label, result) in [ + ("cached", cached.find(point)), + ("fresh", index.searcher().find(point)), + ] { + match result { + Ok(id) => writeln!( + out, + "{label} {id} {}", + index.entries()[*id].0.fitness(point) + )?, + Err(_) => writeln!(out, "{label} error")?, + } + } + } + Ok(()) +} +fn settings_probe( + settings: horizon_world::worldgen::settings::NoiseSettings, + out: &mut impl Write, +) -> Result<(), Box> { + writeln!(out, "settings {} {}", settings.min_y, settings.height)?; + for (minimum, height) in [ + (-64, 384), + (0, 128), + (-2032, 4064), + (17, 15), + (2048, 16), + (i32::MAX, 1), + (i32::MIN, i32::MAX), + ] { + let clamped = settings.clamp_to_height(minimum, height); + writeln!(out, "clamped {} {}", clamped.min_y, clamped.height)?; + } + Ok(()) +} +fn aquifer_probe(line: &str, out: &mut impl Write) -> Result<(), Box> { + use horizon_world::{ + registry::BlockStateId, + worldgen::aquifer::{DisabledAquifer, FluidPicker, FluidStatus, GlobalFluidPicker}, + }; + use std::sync::atomic::{AtomicUsize, Ordering}; + #[derive(Debug)] + struct Counted { + picker: GlobalFluidPicker, + calls: AtomicUsize, + } + impl FluidPicker for Counted { + fn compute(&self, position: [i32; 3]) -> FluidStatus { + self.calls.fetch_add(1, Ordering::Relaxed); + self.picker.compute(position) + } + } + let args: Vec<_> = line.split_whitespace().collect(); + let sea = args[1].parse::()?; + let fluid = BlockStateId(args[2].parse::()?); + let position = [args[3].parse()?, args[4].parse()?, args[5].parse()?]; + let density = f64::from_bits(u64::from_str_radix(args[6], 16)?); + // Local labels correspond to actual reference default block states. They + // exercise identity-based selection independently of numeric registry IDs. + let picker = GlobalFluidPicker::new(sea, fluid, BlockStateId(1), BlockStateId(2)); + let status = picker.compute(position); + writeln!( + out, + "fluid {} {} {}", + status.level, + status.state.0, + status.at(position[1], BlockStateId(2)).0 + )?; + let counted = Counted { + picker, + calls: AtomicUsize::new(0), + }; + let aquifer = DisabledAquifer::new(&counted, BlockStateId(2)); + let substance = aquifer.compute_substance(position, density); + let label = substance.map_or_else(|| "default_solid".to_string(), |id| id.0.to_string()); + writeln!( + out, + "substance {label} {} {}", + aquifer.should_schedule_fluid_update(), + counted.calls.load(Ordering::Relaxed) + )?; + Ok(()) +} +fn noise_aquifer_probe(line: &str, out: &mut impl Write) -> Result<(), Box> { + use horizon_core::{ + density::{ConstantSampler, DensitySampler, SampleError}, + random::PositionalRandom, + }; + use horizon_world::{ + registry::BlockStateId, + worldgen::aquifer::{ + AquiferBlockStates, AquiferConfig, AquiferField, AquiferSamplers, FluidPicker, + FluidStatus, GlobalFluidPicker, NoiseBasedAquifer, + }, + }; + use std::sync::{Arc, Mutex}; + #[derive(Debug)] + struct Traced { + sampler: Arc, + field: usize, + events: Arc>>, + calls: Mutex, + fail: Option, + } + impl Traced { + fn enter(&self, event: String) -> Result<(), SampleError> { + self.events.lock().unwrap().push(event); + let mut calls = self.calls.lock().unwrap(); + *calls += 1; + if self.fail == Some(*calls) { + self.events + .lock() + .unwrap() + .push(format!("sample failure {}", self.field)); + Err(SampleError::ZeroGradientPeriod) + } else { + Ok(()) + } + } + } + impl DensitySampler for Traced { + fn sample_value( + &self, + context: &mut SamplerContext, + position: [i32; 3], + ) -> Result { + self.enter(format!( + "sample {} value {} {} {}", + self.field, position[0], position[1], position[2] + ))?; + let result = self.sampler.sample_value(context, position); + self.events.lock().unwrap().push(match result { + Ok(value) => format!("value {}", bits(value)), + Err(_) => "value error".into(), + }); + result + } + fn sample_volume( + &self, + context: &mut SamplerContext, + buffer: &mut [f32], + volume: DensityVolume, + ) -> Result<(), SampleError> { + let size = volume.sizes(); + let min = volume.minimum(); + let steps = volume.steps(); + self.enter(format!( + "sample {} volume {} {} {} {} {} {} {} {} {}", + self.field, + size[0], + size[1], + size[2], + min[0], + min[1], + min[2], + steps[0], + steps[1], + steps[2] + ))?; + let result = self.sampler.sample_volume(context, buffer, volume); + let mut events = self.events.lock().unwrap(); + events.push(format!( + "sample volume {}", + if result.is_ok() { "ok" } else { "error" } + )); + events.extend( + buffer + .iter() + .map(|value| format!("sample cell {}", bits(*value))), + ); + result + } + } + #[derive(Debug)] + struct Picker { + inner: GlobalFluidPicker, + events: Arc>>, + } + impl FluidPicker for Picker { + fn compute(&self, position: [i32; 3]) -> FluidStatus { + let status = self.inner.compute(position); + self.events.lock().unwrap().push(format!( + "pick {} {} {} {} {}", + position[0], position[1], position[2], status.level, status.state.0 + )); + status + } + } + struct Blocks; + impl AquiferBlockStates for Blocks { + fn air(&self) -> BlockStateId { + BlockStateId(2) + } + fn lava(&self) -> BlockStateId { + BlockStateId(1) + } + fn is_air(&self, s: BlockStateId) -> bool { + matches!(s.0, 2 | 4 | 5) + } + fn is_lava(&self, s: BlockStateId) -> bool { + matches!(s.0, 1 | 7) + } + fn is_water(&self, s: BlockStateId) -> bool { + matches!(s.0, 0 | 6) + } + } + fn flush(events: &Mutex>, out: &mut impl Write) -> io::Result<()> { + for event in events.lock().unwrap().drain(..) { + writeln!(out, "{event}")?; + } + Ok(()) + } + fn run( + samplers: AquiferSamplers, + picker: Picker, + random: F, + volume: DensityVolume, + queries: &serde_json::Value, + events: Arc>>, + out: &mut impl Write, + ) -> Result<(), Box> { + let mut context = SamplerContext::cached(); + let created = + NoiseBasedAquifer::new(samplers, picker, random, Blocks, volume, &mut context); + flush(&events, out)?; + let mut aquifer = match created { + Ok(value) => value, + Err(_) => { + writeln!(out, "aquifer create error")?; + return Ok(()); + } + }; + writeln!(out, "aquifer ready {}", aquifer.skip_sampling_above_y())?; + for query in queries.as_array().ok_or("queries")? { + let position = [ + query[0].as_i64().ok_or("x")? as i32, + query[1].as_i64().ok_or("y")? as i32, + query[2].as_i64().ok_or("z")? as i32, + ]; + let density = f64::from_bits(u64::from_str_radix( + query[3].as_str().ok_or("density")?, + 16, + )?); + let result = aquifer.compute_substance(&mut context, position, density); + flush(&events, out)?; + let result = match result { + Ok(Some(state)) => state.0.to_string(), + Ok(None) => "default_solid".into(), + Err(_) => "error".into(), + }; + writeln!( + out, + "aquifer result {result} {}", + aquifer.should_schedule_fluid_update() + )?; + } + for (index, (location, status)) in aquifer.cached_cells().enumerate() { + let status = status.map_or("none".into(), |s| format!("{} {}", s.level, s.state.0)); + writeln!(out, "aquifer cell {index} {location} {status}")?; + } + let mut surfaces: Vec<_> = aquifer.cached_surfaces().collect(); + surfaces.sort_by_key(|entry| entry.0); + for (key, value) in surfaces { + writeln!(out, "aquifer surface {key} {value}")?; + } + Ok(()) + } + let fields: Vec<_> = line.splitn(6, ' ').collect(); + let seed: i64 = fields[1].parse()?; + let legacy = fields[2] == "1"; + let bundle: std::collections::BTreeMap> = + serde_json::from_str(&std::fs::read_to_string(fields[3])?)?; + let fixture: serde_json::Value = serde_json::from_str(fields[5])?; + let mut registry = DensityRegistry::from_json(&bundle["noises"], &bundle["densities"])?; + let settings: std::collections::BTreeMap> = + serde_json::from_str(&bundle["settings"][fields[4]])?; + let config_text = fixture + .get("config") + .map(|c| c.as_str().ok_or("config string")) + .transpose()? + .unwrap_or_else(|| settings.get("aquifers").map_or("null", |v| v.get())); + let config = match AquiferConfig::from_json(config_text, &mut registry) { + Ok(config) => config, + Err(_) => { + writeln!(out, "aquifer config error")?; + return Ok(()); + } + }; + let mut compiler = DensityCompiler::new_seeded(registry.into_graph(), seed, legacy); + let samplers = match config.compile(&mut compiler) { + Ok(s) => s, + Err(_) => { + writeln!(out, "aquifer compile error")?; + return Ok(()); + } + }; + writeln!(out, "aquifer compile ok {}", compiler.cache_count())?; + let events = Arc::new(Mutex::new(Vec::new())); + let mut traced = Vec::new(); + for field in AquiferField::ALL { + let i = field as usize; + let sampler = if let Some(value) = fixture + .get("overrides") + .and_then(|v| v.get(i)) + .and_then(|v| v.as_str()) + { + Arc::new(ConstantSampler(f32::from_bits(u32::from_str_radix( + value, 16, + )?))) as Arc + } else { + samplers.get(field).clone() + }; + let fail = fixture + .get("fail") + .filter(|f| f[0].as_u64() == Some(i as u64)) + .and_then(|f| f[1].as_u64()) + .map(|n| n as usize); + traced.push(Arc::new(Traced { + sampler, + field: i, + events: events.clone(), + calls: Mutex::new(0), + fail, + }) as Arc); + } + let samplers = AquiferSamplers::new(traced.try_into().unwrap()); + let array = |name: &str| -> Result<[i32; 3], Box> { + Ok(std::array::from_fn(|i| { + fixture[name][i].as_i64().unwrap() as i32 + })) + }; + let volume = DensityVolume::new(array("sizes")?, array("minimum")?, array("steps")?)?; + let picker = Picker { + inner: GlobalFluidPicker::new( + fixture["sea"].as_i64().ok_or("sea")? as i32, + BlockStateId(fixture["fluid"].as_u64().ok_or("fluid")? as u32), + BlockStateId(1), + BlockStateId(2), + ), + events: events.clone(), + }; + if legacy { + let random = LegacyRandom::new(seed) + .fork_positional() + .from_hash_of("minecraft:aquifer") + .fork_positional(); + run( + samplers, + picker, + random, + volume, + &fixture["queries"], + events, + out, + ) + } else { + let random = XoroshiroRandom::new(seed) + .fork_positional() + .from_hash_of("minecraft:aquifer") + .fork_positional(); + run( + samplers, + picker, + random, + volume, + &fixture["queries"], + events, + out, + ) + } +} + +fn tags_probe( + fixture: &serde_json::Value, + out: &mut impl Write, +) -> Result<(), Box> { + use horizon_world::worldgen::tags::TagDefinitions; + writeln!( + out, + "tags resources {}", + fixture["files"].as_array().ok_or("files")?.len() + )?; + let mut definitions = TagDefinitions::default(); + for file in fixture["files"].as_array().ok_or("files")? { + let name = file[0].as_str().ok_or("name")?; + let source = file[1].as_str().ok_or("source")?; + if definitions + .apply_json(name, source, file[2].as_str().ok_or("json")?) + .is_err() + { + // Fixture names are valid. Codec errors can introduce empty tags. + let canonical = definitions + .definitions() + .keys() + .find(|key| key.as_str() == name || key.as_str() == format!("minecraft:{name}")) + .ok_or("tag name")?; + writeln!(out, "tag resource error {canonical} {source}")?; + } + } + let mut trace = Vec::new(); + let result = definitions.build(|id, required| { + trace.push(format!("tag lookup {id} {required}")); + fixture["elements"] + .get(id) + .and_then(|v| v.as_str()) + .map(str::to_owned) + })?; + for event in trace { + writeln!(out, "{event}")?; + } + writeln!(out, "tags built {}", result.tags.len())?; + for (name, values) in result.tags { + writeln!(out, "tag members {name} {}", values.len())?; + for value in values { + writeln!(out, "tag member {value}")?; + } + } + for name in result.missing.keys() { + writeln!(out, "tag missing {name}")?; + } + Ok(()) +} +fn tag_registry_probe(path: &str, out: &mut impl Write) -> Result<(), Box> { + let bundle: std::collections::BTreeMap> = + serde_json::from_str(&std::fs::read_to_string(path)?)?; + let files: Vec<_> = bundle["tags"] + .iter() + .map(|(name, json)| serde_json::json!([name, "vanilla", json])) + .collect(); + tags_probe( + &serde_json::json!({"files":files,"elements":bundle["block_elements"]}), + out, + ) +} + +fn main() -> Result<(), Box> { + let mut out = io::BufWriter::new(io::stdout().lock()); + for line in io::stdin().lock().lines() { + let line = line?; + let mut args = line.splitn(5, ' '); + let command = args.next().ok_or("command")?; + if command == "tag_entry" { + match horizon_world::worldgen::tags::TagEntry::from_json( + line.strip_prefix("tag_entry ").ok_or("entry")?, + ) { + Ok(e) => writeln!(out, "tag entry {}", e.display())?, + Err(_) => writeln!(out, "tag entry error")?, + } + continue; + } + if command == "tag_file" { + match horizon_world::worldgen::tags::TagFile::from_json( + line.strip_prefix("tag_file ").ok_or("file")?, + ) { + Ok(file) => { + writeln!(out, "tag file {} {}", file.replace, file.entries.len())?; + for e in file.entries { + writeln!(out, "tag entry {}", e.display())?; + } + } + Err(_) => writeln!(out, "tag file error")?, + } + continue; + } + if command == "tag_registry" { + tag_registry_probe( + line.strip_prefix("tag_registry ").ok_or("registry")?, + &mut out, + )?; + continue; + } + if command == "tags" { + tags_probe( + &serde_json::from_str(line.strip_prefix("tags ").ok_or("tags")?)?, + &mut out, + )?; + continue; + } + if command == "noise_aquifer" { + noise_aquifer_probe(&line, &mut out)?; + continue; + } + if command == "aquifer" { + aquifer_probe(&line, &mut out)?; + continue; + } + if command == "noise_settings" { + match horizon_world::worldgen::settings::NoiseSettings::from_json( + line.strip_prefix("noise_settings ") + .ok_or("settings json")?, + ) { + Ok(settings) => settings_probe(settings, &mut out)?, + Err(_) => writeln!(out, "settings error")?, + } + continue; + } + if command == "settings_create" { + let values: Vec = line + .split_whitespace() + .skip(1) + .map(str::parse) + .collect::>()?; + match horizon_world::worldgen::settings::NoiseSettings::create(values[0], values[1]) { + Ok(settings) => settings_probe(settings, &mut out)?, + Err(_) => writeln!(out, "settings error")?, + } + continue; + } + if command == "climate_parameter" { + match horizon_world::worldgen::climate::decode_parameter( + line.strip_prefix("climate_parameter ") + .ok_or("parameter json")?, + ) { + Ok(p) => writeln!(out, "parameter {} {}", p.min, p.max)?, + Err(_) => writeln!(out, "parameter error")?, + } + continue; + } + if command == "climate_point" { + match horizon_world::worldgen::climate::decode_parameter_point( + line.strip_prefix("climate_point ").ok_or("point json")?, + ) { + Ok(p) => { + write!(out, "parameterpoint")?; + for coordinate in p.coordinates { + write!(out, " {} {}", coordinate.min, coordinate.max)?; + } + writeln!(out, " {}", p.offset)?; + } + Err(_) => writeln!(out, "parameterpoint error")?, + } + continue; + } + if command == "index" { + let mut args = line.splitn(3, ' '); + args.next(); + let branching = args.next().ok_or("branching")?.parse::()?; + index_probe(branching, args.next().ok_or("index json")?, &mut out)?; + continue; + } + if command == "quantize" { + let mut values = line.split_whitespace().skip(1); + write!(out, "quantized")?; + for _ in 0..6 { + let value = f32::from_bits(u32::from_str_radix(values.next().ok_or("float")?, 16)?); + write!( + out, + " {}", + horizon_world::worldgen::climate::quantize(value) + )?; + } + writeln!(out)?; + let value = values.next().ok_or("long")?.parse::()?; + writeln!( + out, + "unquantized {}", + bits(horizon_world::worldgen::climate::unquantize(value)) + )?; + continue; + } + let seed = args.next().ok_or("seed")?.parse::()?; + let legacy = args.next().ok_or("stream")? == "1"; + let nether = args.next().ok_or("nether")? == "1"; + let json = args.next().ok_or("json")?; + if command == "router" { + let (path, setting) = json.split_once(' ').ok_or("router setting")?; + router_probe(path, setting, seed, legacy, nether, &mut out)?; + continue; + } + if command == "registry" { + registry_probe(json, seed, legacy, nether, &mut out)?; + continue; + } + if command != "noise" { + return Err("unknown command".into()); + } + let noise = match decode_noise(json) { + Ok(noise) => noise, + Err(_) => { + writeln!(out, "decode error")?; + continue; + } + }; + let [min, max] = noise.range(); + writeln!( + out, + "decode {} {} {} {}", + noise.octaves().len(), + noise.normalization_factor().to_bits(), + bits(min), + bits(max) + )?; + for octave in noise.octaves() { + writeln!( + out, + "octave {} {} {}", + octave.octave_index, + octave.frequency.to_bits(), + octave.amplitude.to_bits() + )?; + } + if legacy { + probe(&noise, &mut LegacyRandom::new(seed), nether, &mut out)?; + } else { + probe(&noise, &mut XoroshiroRandom::new(seed), nether, &mut out)?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/src/block_collision.rs b/crates/horizon-world/src/block_collision.rs new file mode 100644 index 000000000..965e63512 --- /dev/null +++ b/crates/horizon-world/src/block_collision.rs @@ -0,0 +1,112 @@ +//! No-entity-context block collision queries over cached and dynamic definitions. +//! Entity movement contexts select different shapes and are separate queries. +use crate::{ + collision::CachedCollisionRegistry, + dynamic_support::{DynamicSupport, DynamicSupportError, DynamicSupportWorld}, + registry::{BlockRegistry, BlockStateId}, +}; +use horizon_core::geometry::{Aabb, Direction, Vec3, VoxelShape}; +use std::{collections::HashMap, io, sync::Arc}; + +#[derive(Clone, Copy, Debug)] +pub struct ShulkerCollisionState { + pub previous_progress: f32, + pub progress: f32, +} +impl ShulkerCollisionState { + pub fn bounding_box(self, direction: Direction) -> Aabb { + // Native getProgress(1) retains this interpolation, including rounding. + let progress = 0.5f32 * (self.previous_progress + (self.progress - self.previous_progress)); + let maximum = if progress.is_nan() { + progress + } else { + (-1.0f32).max(progress) + } as f64; + let minimum = if progress.is_nan() { + progress + } else { + (-1.0f32).min(progress) + } as f64; + let [x, y, z] = direction.normal(); + Aabb::new(Vec3::new(-0.5, 0.0, -0.5), Vec3::new(0.5, 1.0, 0.5)) + .expand_towards(Vec3::new( + f64::from(x) * maximum, + f64::from(y) * maximum, + f64::from(z) * maximum, + )) + .contract(Vec3::new( + f64::from(-x) * (1.0 + minimum), + f64::from(-y) * (1.0 + minimum), + f64::from(-z) * (1.0 + minimum), + )) + .move_by(Vec3::new(0.5, 0.0, 0.5)) + } +} + +pub trait DynamicCollisionWorld: DynamicSupportWorld { + /// One block-entity lookup. None denotes absence or another entity type. + fn shulker_collision_state( + &mut self, + position: [i32; 3], + ) -> Result, Self::Error>; +} + +#[derive(Debug)] +pub enum CollisionQueryError { + Data(io::Error), + Dynamic(DynamicSupportError), + Unsupported(BlockStateId), +} +impl std::fmt::Display for CollisionQueryError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Data(error) => error.fmt(f), + Self::Dynamic(error) => error.fmt(f), + Self::Unsupported(state) => write!(f, "unsupported block collision state {}", state.0), + } + } +} +impl std::error::Error for CollisionQueryError {} + +pub struct BlockCollisionRegistry<'r> { + cached: Arc>, + dynamic: HashMap, +} +impl<'r> BlockCollisionRegistry<'r> { + pub fn new(cached: Arc>) -> io::Result { + let mut dynamic = HashMap::new(); + for index in 0..cached.registry().len() { + let id = BlockStateId(index as u32); + if cached.cached_shape(id)?.is_none() { + if let Some(rule) = + DynamicSupport::from_state(cached.registry().state(id).unwrap())? + { + dynamic.insert(id, rule); + } + } + } + Ok(Self { cached, dynamic }) + } + pub fn registry(&self) -> &'r BlockRegistry { + self.cached.registry() + } + pub fn collision_shape( + &self, + world: &mut W, + state: BlockStateId, + position: [i32; 3], + ) -> Result> { + if let Some(shape) = self + .cached + .cached_shape(state) + .map_err(CollisionQueryError::Data)? + { + return Ok(shape.clone()); + } + self.dynamic + .get(&state) + .ok_or(CollisionQueryError::Unsupported(state))? + .collision_shape(world, position) + .map_err(CollisionQueryError::Dynamic) + } +} diff --git a/crates/horizon-world/src/block_properties.rs b/crates/horizon-world/src/block_properties.rs new file mode 100644 index 000000000..4ec7498bc --- /dev/null +++ b/crates/horizon-world/src/block_properties.rs @@ -0,0 +1,171 @@ +//! Immutable block-definition flags and legacy solidity calculated from cached +//! collision shapes. Replacement with an item/fluid context is separate behavior. +use crate::{ + DATA_VERSION, + chunk::BlockState, + collision::CachedCollisionRegistry, + compression::invalid, + nbt::Tag, + registry::{BlockRegistry, BlockStateId}, +}; +use horizon_core::geometry::{ShapeError, ShapeOp, VoxelShape}; +use std::{collections::BTreeMap, io, sync::Arc}; + +#[derive(Clone, Copy, Debug)] +pub struct BlockDefinitionProperties { + pub force_solid_on: bool, + pub force_solid_off: bool, + pub replaceable: bool, + pub liquid: bool, + pub can_occlude: bool, +} +impl BlockDefinitionProperties { + pub fn calculate_solid_render(self, occlusion: &VoxelShape) -> Result { + Ok(self.can_occlude && !occlusion.join_is_not_empty(&VoxelShape::block(), ShapeOp::XOR)?) + } + + /// Force-on wins even if both definition flags are set. A missing cache + /// counts as non-solid; it is distinct from a missing collision implementation. + pub fn calculate_solid(self, cached_shape: Option<&VoxelShape>) -> bool { + if self.force_solid_on { + return true; + } + if self.force_solid_off { + return false; + } + cached_shape + .and_then(VoxelShape::bounds) + .is_some_and(|bounds| { + bounds.average_size() >= 0.7291666666666666 || bounds.size().y >= 1.0 + }) + } +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum BlockProperty { + Solid, + Replaceable, + Liquid, + SolidRender, +} +impl BlockProperty { + fn mask(self) -> u8 { + match self { + Self::Solid => 1, + Self::Replaceable => 2, + Self::Liquid => 4, + Self::SolidRender => 8, + } + } +} +/// An immutable property selection, shared by decoded block predicates. +#[derive(Clone, Debug)] +pub struct BoundBlockProperty { + states: Arc<[u8]>, + property: BlockProperty, +} +impl BoundBlockProperty { + pub fn contains(&self, id: BlockStateId) -> bool { + self.states + .get(id.0 as usize) + .is_some_and(|flags| flags & self.property.mask() != 0) + } +} + +pub struct BlockPropertiesRegistry<'r> { + registry: &'r BlockRegistry, + definitions: BTreeMap, + states: Arc<[u8]>, +} +impl<'r> BlockPropertiesRegistry<'r> { + pub fn from_nbt(tag: &Tag, collisions: &CachedCollisionRegistry<'r>) -> io::Result { + let registry = collisions.registry(); + if tag.get("DataVersion") != Some(&Tag::Int(DATA_VERSION)) { + return Err(invalid("block properties DataVersion mismatch")); + } + let Some(Tag::List(states)) = tag.get("states") else { + return Err(invalid("missing block property state identities")); + }; + if states.len() != registry.len() { + return Err(invalid("block property registry size mismatch")); + } + for (id, state) in states.iter().enumerate() { + if registry.state(BlockStateId(id as u32)) != Some(&BlockState::from_nbt(state)?) { + return Err(invalid("block property state identities differ")); + } + } + let Some(Tag::Compound(blocks)) = tag.get("blocks") else { + return Err(invalid("missing block definition properties")); + }; + let mut definitions = BTreeMap::new(); + for (name, flags) in blocks { + let name = name.to_string().map_err(|e| invalid(e.to_string()))?; + let Tag::Byte(flags @ 0..=31) = flags else { + return Err(invalid("invalid block definition flags")); + }; + if registry.default_state(&name).is_none() { + return Err(invalid("unknown block definition properties")); + } + definitions.insert( + name, + BlockDefinitionProperties { + force_solid_on: flags & 1 != 0, + force_solid_off: flags & 2 != 0, + replaceable: flags & 4 != 0, + liquid: flags & 8 != 0, + can_occlude: flags & 16 != 0, + }, + ); + } + let occlusion = CachedCollisionRegistry::from_nbt( + tag.get("occlusion") + .ok_or_else(|| invalid("missing block occlusion shapes"))?, + registry, + )?; + let mut result = Vec::with_capacity(registry.len()); + for id in 0..registry.len() { + let id = BlockStateId(id as u32); + let state = registry.state(id).unwrap(); + let properties = definitions + .get(&state.name) + .ok_or_else(|| invalid("missing block definition properties"))?; + result.push( + u8::from(properties.calculate_solid(collisions.cached_shape(id)?)) + | (u8::from(properties.replaceable) << 1) + | (u8::from(properties.liquid) << 2) + | (u8::from( + properties + .calculate_solid_render( + occlusion + .cached_shape(id)? + .ok_or_else(|| invalid("missing block occlusion shape"))?, + ) + .map_err(|error| invalid(error.to_string()))?, + ) << 3), + ); + } + Ok(Self { + registry, + definitions, + states: result.into(), + }) + } + pub fn registry(&self) -> &'r BlockRegistry { + self.registry + } + pub fn definition(&self, name: &str) -> Option { + self.definitions.get(name).copied() + } + pub fn property(&self, id: BlockStateId, property: BlockProperty) -> io::Result { + self.states + .get(id.0 as usize) + .map(|flags| flags & property.mask() != 0) + .ok_or_else(|| invalid("block property state outside registry")) + } + pub fn bind(&self, property: BlockProperty) -> BoundBlockProperty { + BoundBlockProperty { + states: Arc::clone(&self.states), + property, + } + } +} diff --git a/crates/horizon-world/src/block_support.rs b/crates/horizon-world/src/block_support.rs new file mode 100644 index 000000000..2c7a9aecc --- /dev/null +++ b/crates/horizon-world/src/block_support.rs @@ -0,0 +1,221 @@ +//! Native support tests over an already-selected block support shape. Selecting +//! that shape from block/world/entity behavior is the caller's responsibility. +use horizon_core::geometry::{Aabb, Direction, ShapeError, ShapeOp, Vec3, VoxelShape}; +use std::sync::OnceLock; +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum SupportType { + Full, + Center, + Rigid, +} +impl SupportType { + pub fn is_supporting( + self, + shape: &VoxelShape, + direction: Direction, + ) -> Result { + let face = shape.face_shape(direction)?; + let (required, operation) = match self { + Self::Full => (VoxelShape::block(), ShapeOp::XOR), + Self::Center => { + static CENTER: OnceLock = OnceLock::new(); + ( + CENTER + .get_or_init(|| { + VoxelShape::from_box(Aabb::new( + Vec3::new(0.4375, 0.0, 0.4375), + Vec3::new(0.5625, 0.625, 0.5625), + )) + .expect("valid support shape") + }) + .clone(), + ShapeOp::ONLY_SECOND, + ) + } + Self::Rigid => { + static RIGID: OnceLock = OnceLock::new(); + ( + RIGID + .get_or_init(|| { + VoxelShape::block() + .join( + &VoxelShape::from_box(Aabb::new( + Vec3::new(0.125, 0.0, 0.125), + Vec3::new(0.875, 1.0, 0.875), + )) + .expect("valid support inset"), + ShapeOp::ONLY_FIRST, + ) + .expect("valid support ring") + }) + .clone(), + ShapeOp::ONLY_SECOND, + ) + } + }; + Ok(!face.join_is_not_empty(&required, operation)?) + } +} + +use crate::{ + collision::CachedCollisionRegistry, + compression::invalid, + nbt::Tag, + registry::{BlockRegistry, BlockStateId}, +}; +use std::{collections::HashMap, io}; +/// Cached branch of BlockState.isFaceSturdy. Dynamic support-shape selection +/// stays explicit as None, even when a context-free approximation looks obvious. +pub struct CachedBlockSupportRegistry<'r> { + shapes: CachedCollisionRegistry<'r>, + states: Vec>, +} +impl<'r> CachedBlockSupportRegistry<'r> { + pub fn from_nbt(tag: &Tag, registry: &'r BlockRegistry) -> io::Result { + if tag.get("Kind") != Some(&Tag::String("block_support".into())) { + return Err(invalid("wrong cached support data kind")); + } + let shapes = CachedCollisionRegistry::from_nbt(tag, registry)?; + let mut cache = HashMap::new(); + let mut states = Vec::with_capacity(registry.len()); + for id in 0..registry.len() { + let Some(shape) = shapes.cached_shape(BlockStateId(id as u32))? else { + states.push(None); + continue; + }; + let identity = std::ptr::from_ref(shape); + let flags = if let Some(flags) = cache.get(&identity) { + *flags + } else { + let mut flags = [0; 3]; + for (i, support) in [SupportType::Full, SupportType::Center, SupportType::Rigid] + .into_iter() + .enumerate() + { + for direction in Direction::ALL { + if support + .is_supporting(shape, direction) + .map_err(|e| invalid(e.to_string()))? + { + flags[i] |= 1 << direction as u8; + } + } + } + cache.insert(identity, flags); + flags + }; + states.push(Some(flags)); + } + Ok(Self { shapes, states }) + } + pub fn registry(&self) -> &'r BlockRegistry { + self.shapes.registry() + } + pub fn cached_state_count(&self) -> usize { + self.shapes.cached_state_count() + } + pub fn cached_shape(&self, state: BlockStateId) -> io::Result> { + self.shapes.cached_shape(state) + } + pub fn is_face_sturdy( + &self, + state: BlockStateId, + direction: Direction, + support: SupportType, + ) -> io::Result> { + let flags = self + .states + .get(state.0 as usize) + .ok_or_else(|| invalid("support state outside registry"))?; + Ok(flags.map(|flags| { + flags[match support { + SupportType::Full => 0, + SupportType::Center => 1, + SupportType::Rigid => 2, + }] & (1 << direction as u8) + != 0 + })) + } +} + +use crate::dynamic_support::{DynamicSupport, DynamicSupportError, DynamicSupportWorld}; +/// Unified cached/dynamic support dispatch. Block-entity queries remain owned by +/// the world, including the moving-piston entity's collision calculation. +pub struct BlockSupportRegistry<'r> { + cached: CachedBlockSupportRegistry<'r>, + dynamic: HashMap, +} +#[derive(Debug)] +pub enum SupportQueryError { + Data(io::Error), + Dynamic(DynamicSupportError), + Unsupported(BlockStateId), +} +impl std::fmt::Display for SupportQueryError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Data(e) => e.fmt(f), + Self::Dynamic(e) => e.fmt(f), + Self::Unsupported(state) => write!(f, "unsupported block support state {}", state.0), + } + } +} +impl std::error::Error for SupportQueryError {} +impl<'r> BlockSupportRegistry<'r> { + pub fn from_nbt(tag: &Tag, registry: &'r BlockRegistry) -> io::Result { + let cached = CachedBlockSupportRegistry::from_nbt(tag, registry)?; + let mut dynamic = HashMap::new(); + for id in 0..registry.len() { + let id = BlockStateId(id as u32); + if cached.cached_shape(id)?.is_none() { + if let Some(behavior) = DynamicSupport::from_state(registry.state(id).unwrap())? { + dynamic.insert(id, behavior); + } + } + } + Ok(Self { cached, dynamic }) + } + pub fn registry(&self) -> &'r BlockRegistry { + self.cached.registry() + } + pub fn support_shape( + &self, + world: &mut W, + state: BlockStateId, + position: [i32; 3], + ) -> Result> { + if let Some(shape) = self + .cached + .cached_shape(state) + .map_err(SupportQueryError::Data)? + { + return Ok(shape.clone()); + } + self.dynamic + .get(&state) + .ok_or(SupportQueryError::Unsupported(state))? + .shape(world, position) + .map_err(SupportQueryError::Dynamic) + } + pub fn is_face_sturdy( + &self, + world: &mut W, + state: BlockStateId, + position: [i32; 3], + direction: Direction, + support: SupportType, + ) -> Result> { + if let Some(result) = self + .cached + .is_face_sturdy(state, direction, support) + .map_err(SupportQueryError::Data)? + { + return Ok(result); + } + self.dynamic + .get(&state) + .ok_or(SupportQueryError::Unsupported(state))? + .is_face_sturdy(world, position, direction, support) + .map_err(SupportQueryError::Dynamic) + } +} diff --git a/crates/horizon-world/src/block_survival.rs b/crates/horizon-world/src/block_survival.rs new file mode 100644 index 000000000..0140729a2 --- /dev/null +++ b/crates/horizon-world/src/block_survival.rs @@ -0,0 +1,1215 @@ +//! Initial block-survival rules over version-bound definitions and world queries. +//! Unsupported definitions remain explicit; survival is not inferred from shape. +use crate::{ + block_collision::{BlockCollisionRegistry, CollisionQueryError, DynamicCollisionWorld}, + block_properties::{BlockPropertiesRegistry, BlockProperty, BoundBlockProperty}, + block_support::{BlockSupportRegistry, SupportQueryError, SupportType}, + compression::invalid, + fluid::{FluidKind, FluidState}, + registry::{BlockRegistry, BlockStateId}, +}; +use horizon_core::geometry::Direction; +use std::{ + collections::{BTreeMap, BTreeSet}, + io, + sync::Arc, +}; +#[derive(Clone, Debug, PartialEq, Eq)] +pub enum SurvivalRule { + Fire, + Cactus, + Path, + Mushroom, + Multiface, + Vine, + HangingMoss, + SnowLayer, + SeaPickle, + Bell, + GrowingPlant, + MangrovePropagule, + Speleothem, + Scaffolding, + PistonHead, + ChorusPlant, + ChorusFlower, + PitcherCrop, + SugarCane, + LilyPad, + Frogspawn, + SporeBlossom, + SmallDripleaf, + TallSeagrass, + BigDripleaf, + BigDripleafStem, + Farmland, + Cocoa, + Crop, + DoublePlant, + Door, + TagBelow(String), + CactusFlower, + Seagrass, + BubbleColumn, + RedstoneWire, + Always, + SolidBelow, + SolidBehind, + NonAirBelow, + MossCarpet, + CenterBelow, + Lantern, + FullAbove, + FullBehind, + RigidOrCenterBelow, + RigidBelow, + FullBelow, + CenterAbove, + FaceAttached, + SupportsBamboo, +} +/// Version-specific definition inputs, independent of evaluated survival results. +#[derive(Clone, Debug, Default)] +pub struct SurvivalDefinitions { + pub rules: BTreeMap, + pub ignition_odds: BTreeMap, + pub fence_gates: BTreeSet, +} +#[derive(Clone, Copy)] +enum Rule { + Fire, + Cactus, + Path, + Mushroom, + Multiface(u8), + Vine(u8), + HangingMoss, + SnowLayer, + SeaPickle, + GrowingPlant { + head: BlockStateId, + body: BlockStateId, + direction: Direction, + kelp: bool, + }, + MangrovePropagule(bool), + Speleothem(Direction), + Scaffolding, + PistonHead { + direction: Direction, + sticky: bool, + }, + ChorusPlant, + ChorusFlower, + PitcherCrop(bool), + SugarCane, + LilyPad, + Frogspawn, + SporeBlossom, + SmallDripleaf(bool), + TallSeagrass(bool), + BigDripleaf, + BigDripleafStem, + Farmland, + Cocoa(Direction), + Crop, + DoublePlant(bool), + Door(bool), + TagBelow(usize), + CactusFlower, + Seagrass, + BubbleColumn, + RedstoneWire, + Always, + Solid(Direction), + NonAirBelow, + MossCarpet(bool), + Support { + face: Direction, + kind: SupportType, + center_restriction: bool, + }, + RigidOrCenterBelow, + SupportsBamboo, +} +pub trait SurvivalWorld: DynamicCollisionWorld { + fn fluid_state(&mut self, position: [i32; 3]) -> Result; + fn raw_brightness(&mut self, position: [i32; 3], sky_darken: i32) -> Result; + fn block_state(&mut self, position: [i32; 3]) -> Result; +} +#[derive(Debug)] +pub enum SurvivalError { + World(E), + Support(SupportQueryError), + Collision(CollisionQueryError), + Registry(io::Error), + Unsupported(BlockStateId), +} +impl std::fmt::Display for SurvivalError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::World(e) => e.fmt(f), + Self::Support(e) => e.fmt(f), + Self::Collision(e) => e.fmt(f), + Self::Registry(e) => e.fmt(f), + Self::Unsupported(id) => write!(f, "unsupported block survival state {}", id.0), + } + } +} +impl std::error::Error for SurvivalError {} +pub struct BlockSurvivalRegistry<'r> { + registry: &'r BlockRegistry, + support: Arc>, + collision: Arc>, + solid: BoundBlockProperty, + liquid: BoundBlockProperty, + solid_render: BoundBlockProperty, + flammable: BTreeSet, + fence_gates: BTreeSet, + cactus_support: BTreeSet, + mushroom_light_override: BTreeSet, + rules: Vec>, + unstable_bottom_center: BTreeSet, + supports_bamboo: BTreeSet, + bound_tags: Vec>, + cactus_flower: BTreeSet, + no_seagrass: BTreeSet, + vegetation: BTreeSet, + dripleaf: BTreeSet, + maintains_farmland: BTreeSet, + cocoa: BTreeSet, + crops: BTreeSet, + no_snow: BTreeSet, + snow_override: BTreeSet, + mangrove: BTreeSet, + hanging_mangrove: BTreeSet, + no_kelp: BTreeSet, + chorus_plant: BTreeSet, + chorus_flower: BTreeSet, + lily_pad: BTreeSet, + frogspawn: BTreeSet, + small_dripleaf: BTreeSet, + sugar_cane: BTreeSet, + sugar_cane_adjacent: BTreeSet, + fluid_tags: [u8; 5], + bubble_up: BTreeSet, + bubble_down: BTreeSet, +} +impl<'r> BlockSurvivalRegistry<'r> { + pub fn new( + registry: &'r BlockRegistry, + properties: &BlockPropertiesRegistry<'r>, + support: Arc>, + collision: Arc>, + definitions: &SurvivalDefinitions, + tags: &BTreeMap>, + fluid_tags: &BTreeMap>, + ) -> io::Result { + if !std::ptr::eq(registry, properties.registry()) + || !std::ptr::eq(registry, support.registry()) + || !std::ptr::eq(registry, collision.registry()) + { + return Err(invalid("survival inputs use different registries")); + } + for name in definitions + .rules + .keys() + .chain(definitions.ignition_odds.keys()) + .chain(definitions.fence_gates.iter()) + { + if registry.default_state(name).is_none() { + return Err(invalid("unknown block survival definition")); + } + } + let mut rules = Vec::with_capacity(registry.len()); + let mut tag_names = Vec::::new(); + let mut tag_indices = BTreeMap::::new(); + for id in 0..registry.len() { + let state = registry.state(BlockStateId(id as u32)).unwrap(); + let Some(rule) = definitions.rules.get(&state.name) else { + rules.push(None); + continue; + }; + let property = |name: &str| { + state + .properties + .get(name) + .map(String::as_str) + .ok_or_else(|| invalid("missing survival property")) + }; + let facing = || -> io::Result { + match property("facing")? { + "down" => Ok(Direction::Down), + "up" => Ok(Direction::Up), + "north" => Ok(Direction::North), + "south" => Ok(Direction::South), + "west" => Ok(Direction::West), + "east" => Ok(Direction::East), + _ => Err(invalid("invalid survival facing")), + } + }; + let boolean = |name: &str| -> io::Result { + match property(name)? { + "true" => Ok(true), + "false" => Ok(false), + _ => Err(invalid("invalid survival boolean")), + } + }; + let upper_half = || -> io::Result { + match property("half")? { + "upper" => Ok(true), + "lower" => Ok(false), + _ => Err(invalid("invalid survival half")), + } + }; + let full = |face| Rule::Support { + face, + kind: SupportType::Full, + center_restriction: false, + }; + let faces = || -> io::Result { + let mut mask = 0; + for direction in Direction::ALL { + if state.properties.contains_key(direction_name(direction)) + && boolean(direction_name(direction))? + { + mask |= 1 << direction as u8; + } + } + Ok(mask) + }; + rules.push(Some(match rule { + SurvivalRule::Fire => Rule::Fire, + SurvivalRule::Cactus => Rule::Cactus, + SurvivalRule::Path => Rule::Path, + SurvivalRule::Mushroom => Rule::Mushroom, + SurvivalRule::Multiface => Rule::Multiface(faces()?), + SurvivalRule::Vine => Rule::Vine(faces()?), + SurvivalRule::HangingMoss => Rule::HangingMoss, + SurvivalRule::SnowLayer => Rule::SnowLayer, + SurvivalRule::SeaPickle => Rule::SeaPickle, + SurvivalRule::Bell => { + let (face, kind, center_restriction) = match property("attachment")? { + "floor" => (Direction::Up, SupportType::Full, false), + "ceiling" => (Direction::Down, SupportType::Center, true), + "single_wall" | "double_wall" => { + (facing()?.opposite(), SupportType::Full, false) + } + _ => return Err(invalid("invalid bell attachment")), + }; + Rule::Support { + face, + kind, + center_restriction, + } + } + SurvivalRule::GrowingPlant => { + let (head, body, direction, kelp) = match state.name.as_str() { + "minecraft:kelp" | "minecraft:kelp_plant" => ( + "minecraft:kelp", + "minecraft:kelp_plant", + Direction::Up, + true, + ), + "minecraft:cave_vines" | "minecraft:cave_vines_plant" => ( + "minecraft:cave_vines", + "minecraft:cave_vines_plant", + Direction::Down, + false, + ), + "minecraft:twisting_vines" | "minecraft:twisting_vines_plant" => ( + "minecraft:twisting_vines", + "minecraft:twisting_vines_plant", + Direction::Up, + false, + ), + "minecraft:weeping_vines" | "minecraft:weeping_vines_plant" => ( + "minecraft:weeping_vines", + "minecraft:weeping_vines_plant", + Direction::Down, + false, + ), + _ => return Err(invalid("unknown growing plant family")), + }; + Rule::GrowingPlant { + head: registry + .default_state(head) + .ok_or_else(|| invalid("missing growing plant head"))?, + body: registry + .default_state(body) + .ok_or_else(|| invalid("missing growing plant body"))?, + direction, + kelp, + } + } + SurvivalRule::MangrovePropagule => Rule::MangrovePropagule(boolean("hanging")?), + SurvivalRule::Speleothem => { + Rule::Speleothem(match property("vertical_direction")? { + "up" => Direction::Up, + "down" => Direction::Down, + _ => return Err(invalid("invalid speleothem direction")), + }) + } + SurvivalRule::Scaffolding => Rule::Scaffolding, + SurvivalRule::PistonHead => Rule::PistonHead { + direction: facing()?, + sticky: match property("type")? { + "normal" => false, + "sticky" => true, + _ => return Err(invalid("invalid piston head type")), + }, + }, + SurvivalRule::ChorusPlant => Rule::ChorusPlant, + SurvivalRule::ChorusFlower => Rule::ChorusFlower, + SurvivalRule::PitcherCrop => Rule::PitcherCrop(upper_half()?), + SurvivalRule::SugarCane => Rule::SugarCane, + SurvivalRule::LilyPad => Rule::LilyPad, + SurvivalRule::Frogspawn => Rule::Frogspawn, + SurvivalRule::SporeBlossom => Rule::SporeBlossom, + SurvivalRule::SmallDripleaf => Rule::SmallDripleaf(upper_half()?), + SurvivalRule::TallSeagrass => Rule::TallSeagrass(upper_half()?), + SurvivalRule::BigDripleaf => Rule::BigDripleaf, + SurvivalRule::BigDripleafStem => Rule::BigDripleafStem, + SurvivalRule::Farmland => Rule::Farmland, + SurvivalRule::Cocoa => Rule::Cocoa(facing()?), + SurvivalRule::Crop => Rule::Crop, + SurvivalRule::DoublePlant => Rule::DoublePlant(upper_half()?), + SurvivalRule::Door => Rule::Door(upper_half()?), + SurvivalRule::TagBelow(name) => { + Rule::TagBelow(*tag_indices.entry(name.clone()).or_insert_with(|| { + let index = tag_names.len(); + tag_names.push(name.clone()); + index + })) + } + SurvivalRule::CactusFlower => Rule::CactusFlower, + SurvivalRule::Seagrass => Rule::Seagrass, + SurvivalRule::BubbleColumn => Rule::BubbleColumn, + SurvivalRule::RedstoneWire => Rule::RedstoneWire, + SurvivalRule::Always => Rule::Always, + SurvivalRule::SolidBelow => Rule::Solid(Direction::Down), + SurvivalRule::SolidBehind => Rule::Solid(facing()?.opposite()), + SurvivalRule::NonAirBelow => Rule::NonAirBelow, + SurvivalRule::MossCarpet => Rule::MossCarpet(boolean("bottom")?), + SurvivalRule::CenterBelow => Rule::Support { + face: Direction::Up, + kind: SupportType::Center, + center_restriction: true, + }, + SurvivalRule::Lantern => Rule::Support { + face: if boolean("hanging")? { + Direction::Down + } else { + Direction::Up + }, + kind: SupportType::Center, + center_restriction: true, + }, + SurvivalRule::FullAbove => full(Direction::Down), + SurvivalRule::FullBehind => full(facing()?), + SurvivalRule::RigidOrCenterBelow => Rule::RigidOrCenterBelow, + SurvivalRule::RigidBelow => Rule::Support { + face: Direction::Up, + kind: SupportType::Rigid, + center_restriction: false, + }, + SurvivalRule::FullBelow => full(Direction::Up), + SurvivalRule::CenterAbove => Rule::Support { + face: Direction::Down, + kind: SupportType::Center, + center_restriction: false, + }, + SurvivalRule::FaceAttached => full(match property("face")? { + "floor" => Direction::Up, + "ceiling" => Direction::Down, + "wall" => facing()?, + _ => return Err(invalid("invalid attachment face")), + }), + SurvivalRule::SupportsBamboo => Rule::SupportsBamboo, + })); + } + let tag_states = |name: &str| -> io::Result> { + let names = tags + .get(name) + .into_iter() + .flatten() + .collect::>(); + for name in &names { + if registry.default_state(name).is_none() { + return Err(invalid("unknown survival tag member")); + } + } + Ok((0..registry.len()) + .map(|i| BlockStateId(i as u32)) + .filter(|id| names.contains(®istry.state(*id).unwrap().name)) + .collect()) + }; + let fluid_tag = |name: &str| -> io::Result { + fluid_tags + .get(name) + .into_iter() + .flatten() + .try_fold(0, |mask, name| { + Ok(mask + | FluidKind::from_name(name) + .ok_or_else(|| invalid("unknown survival fluid tag member"))? + .mask()) + }) + }; + Ok(Self { + registry, + support, + collision, + solid: properties.bind(BlockProperty::Solid), + liquid: properties.bind(BlockProperty::Liquid), + solid_render: properties.bind(BlockProperty::SolidRender), + flammable: (0..registry.len()) + .map(|i| BlockStateId(i as u32)) + .filter(|id| { + let state = registry.state(*id).unwrap(); + definitions + .ignition_odds + .get(&state.name) + .is_some_and(|value| *value > 0) + && !state + .properties + .get("waterlogged") + .is_some_and(|value| value == "true") + }) + .collect(), + fence_gates: (0..registry.len()) + .map(|i| BlockStateId(i as u32)) + .filter(|id| { + definitions + .fence_gates + .contains(®istry.state(*id).unwrap().name) + }) + .collect(), + cactus_support: tag_states("minecraft:supports_cactus")?, + mushroom_light_override: tag_states("minecraft:overrides_mushroom_light_requirement")?, + rules, + unstable_bottom_center: tag_states("minecraft:unstable_bottom_center")?, + supports_bamboo: tag_states("minecraft:supports_bamboo")?, + bound_tags: tag_names + .iter() + .map(|name| tag_states(name)) + .collect::>()?, + cactus_flower: tag_states("minecraft:support_override_cactus_flower")?, + no_seagrass: tag_states("minecraft:cannot_support_seagrass")?, + vegetation: tag_states("minecraft:supports_vegetation")?, + dripleaf: tag_states("minecraft:supports_big_dripleaf")?, + maintains_farmland: tag_states("minecraft:maintains_farmland")?, + cocoa: tag_states("minecraft:supports_cocoa")?, + crops: tag_states("minecraft:supports_crops")?, + no_snow: tag_states("minecraft:cannot_support_snow_layer")?, + snow_override: tag_states("minecraft:support_override_snow_layer")?, + mangrove: tag_states("minecraft:supports_mangrove_propagule")?, + hanging_mangrove: tag_states("minecraft:supports_hanging_mangrove_propagule")?, + no_kelp: tag_states("minecraft:cannot_support_kelp")?, + chorus_plant: tag_states("minecraft:supports_chorus_plant")?, + chorus_flower: tag_states("minecraft:supports_chorus_flower")?, + lily_pad: tag_states("minecraft:supports_lily_pad")?, + frogspawn: tag_states("minecraft:supports_frogspawn")?, + small_dripleaf: tag_states("minecraft:supports_small_dripleaf")?, + sugar_cane: tag_states("minecraft:supports_sugar_cane")?, + sugar_cane_adjacent: tag_states("minecraft:supports_sugar_cane_adjacently")?, + fluid_tags: [ + fluid_tag("minecraft:water")?, + fluid_tag("minecraft:supports_lily_pad")?, + fluid_tag("minecraft:supports_frogspawn")?, + fluid_tag("minecraft:supports_sugar_cane_adjacently")?, + fluid_tag("minecraft:lava")?, + ], + bubble_up: tag_states("minecraft:enables_bubble_column_push_up")?, + bubble_down: tag_states("minecraft:enables_bubble_column_drag_down")?, + }) + } + pub fn supported_states(&self) -> usize { + self.rules.iter().filter(|r| r.is_some()).count() + } + pub fn supports_state(&self, state: BlockStateId) -> bool { + self.rules + .get(state.0 as usize) + .is_some_and(Option::is_some) + } + fn read( + &self, + world: &mut W, + position: [i32; 3], + ) -> Result> { + let state = world.block_state(position).map_err(SurvivalError::World)?; + if self.registry.state(state).is_none() { + return Err(SurvivalError::Registry(invalid( + "world survival state outside registry", + ))); + } + Ok(state) + } + fn support( + &self, + world: &mut W, + position: [i32; 3], + face: Direction, + kind: SupportType, + center_restriction: bool, + ) -> Result> { + let state = self.read(world, position)?; + if center_restriction + && face == Direction::Down + && self.unstable_bottom_center.contains(&state) + { + return Ok(false); + } + self.support + .is_face_sturdy(world, state, position, face, kind) + .map_err(SurvivalError::Support) + } + fn is_air(&self, state: BlockStateId) -> bool { + matches!( + self.registry.state(state).unwrap().name.as_str(), + "minecraft:air" | "minecraft:cave_air" | "minecraft:void_air" + ) + } + fn face_property(&self, state: BlockStateId, direction: Direction) -> bool { + self.registry + .state(state) + .unwrap() + .properties + .get(direction_name(direction)) + .is_some_and(|value| value == "true") + } + fn can_attach( + &self, + world: &mut W, + neighbor: BlockStateId, + at: [i32; 3], + direction: Direction, + ) -> Result> { + let face = direction.opposite(); + if self + .support + .is_face_sturdy(world, neighbor, at, face, SupportType::Full) + .map_err(SurvivalError::Support)? + { + return Ok(true); + } + let shape = self + .collision + .collision_shape(world, neighbor, at) + .map_err(SurvivalError::Collision)?; + SupportType::Full + .is_supporting(&shape, face) + .map_err(|error| SurvivalError::Registry(invalid(error.to_string()))) + } + fn is_named(&self, state: BlockStateId, name: &str) -> bool { + self.registry.state(state).unwrap().name == name + } + fn same_block(&self, first: BlockStateId, second: BlockStateId) -> bool { + self.registry.state(first).unwrap().name == self.registry.state(second).unwrap().name + } + fn scaffold_distance(&self, state: BlockStateId) -> io::Result> { + if !self.is_named(state, "minecraft:scaffolding") { + return Ok(None); + } + self.registry + .state(state) + .unwrap() + .properties + .get("distance") + .and_then(|v| v.parse::().ok()) + .filter(|v| (0..=7).contains(v)) + .map(Some) + .ok_or_else(|| invalid("invalid scaffolding distance")) + } + fn is_lower_half(&self, below: BlockStateId, candidate: BlockStateId) -> bool { + let neighbor = self.registry.state(below).unwrap(); + neighbor.name == self.registry.state(candidate).unwrap().name + && neighbor + .properties + .get("half") + .is_some_and(|v| v == "lower") + } + fn fluid_matches(&self, tag: usize, fluid: FluidState) -> bool { + self.fluid_tags[tag] & fluid.kind().mask() != 0 + } + pub fn can_survive( + &self, + world: &mut W, + state: BlockStateId, + position: [i32; 3], + ) -> Result> { + let rule = self + .rules + .get(state.0 as usize) + .ok_or_else(|| SurvivalError::Registry(invalid("survival candidate outside registry")))? + .ok_or(SurvivalError::Unsupported(state))?; + match rule { + Rule::Fire => { + let below = relative(position, Direction::Down); + let neighbor = self.read(world, below)?; + if self + .support + .is_face_sturdy(world, neighbor, below, Direction::Up, SupportType::Full) + .map_err(SurvivalError::Support)? + { + return Ok(true); + } + for direction in Direction::ALL { + let neighbor = self.read(world, relative(position, direction))?; + if self.flammable.contains(&neighbor) { + return Ok(true); + } + } + Ok(false) + } + Rule::Cactus => { + for direction in [ + Direction::North, + Direction::East, + Direction::South, + Direction::West, + ] { + let at = relative(position, direction); + let neighbor = self.read(world, at)?; + if self.solid.contains(neighbor) + || self + .fluid_matches(4, world.fluid_state(at).map_err(SurvivalError::World)?) + { + return Ok(false); + } + } + let neighbor = self.read(world, relative(position, Direction::Down))?; + if !self.same_block(neighbor, state) && !self.cactus_support.contains(&neighbor) { + return Ok(false); + } + let above = self.read(world, relative(position, Direction::Up))?; + Ok(!self.liquid.contains(above)) + } + Rule::Path => { + let above = self.read(world, relative(position, Direction::Up))?; + Ok(!self.solid.contains(above) || self.fence_gates.contains(&above)) + } + Rule::Mushroom => { + let below = self.read(world, relative(position, Direction::Down))?; + if self.mushroom_light_override.contains(&below) { + return Ok(true); + } + Ok(world + .raw_brightness(position, 0) + .map_err(SurvivalError::World)? + < 13 + && self.solid_render.contains(below)) + } + Rule::Multiface(faces) => { + for direction in Direction::ALL { + if faces & (1 << direction as u8) != 0 { + let at = relative(position, direction); + let neighbor = self.read(world, at)?; + if !self.can_attach(world, neighbor, at, direction)? { + return Ok(false); + } + } + } + Ok(faces != 0) + } + Rule::HangingMoss => { + let at = relative(position, Direction::Up); + let neighbor = self.read(world, at)?; + Ok(self.can_attach(world, neighbor, at, Direction::Up)? + || self.same_block(neighbor, state)) + } + Rule::Vine(faces) => { + let above = relative(position, Direction::Up); + let mut any = false; + let mut cached_above = None; + if faces & (1 << Direction::Up as u8) != 0 { + let neighbor = self.read(world, above)?; + // getUpdatedState passes DOWN here, unlike canSupportAtFace. + any = self.can_attach(world, neighbor, above, Direction::Down)?; + } + for direction in [ + Direction::North, + Direction::East, + Direction::South, + Direction::West, + ] { + if faces & (1 << direction as u8) == 0 { + continue; + } + let at = relative(position, direction); + let neighbor = self.read(world, at)?; + let mut valid = self.can_attach(world, neighbor, at, direction)?; + if !valid { + let neighbor = self.read(world, above)?; + valid = self.same_block(neighbor, state) + && self.face_property(neighbor, direction); + } + if !valid { + let neighbor = match cached_above { + Some(neighbor) => neighbor, + None => { + let neighbor = self.read(world, above)?; + cached_above = Some(neighbor); + neighbor + } + }; + valid = self.same_block(neighbor, state) + && self.face_property(neighbor, direction); + } + any |= valid; + } + Ok(any) + } + Rule::SnowLayer => { + let at = relative(position, Direction::Down); + let neighbor = self.read(world, at)?; + if self.no_snow.contains(&neighbor) { + return Ok(false); + } + if self.snow_override.contains(&neighbor) { + return Ok(true); + } + let shape = self + .collision + .collision_shape(world, neighbor, at) + .map_err(SurvivalError::Collision)?; + Ok(SupportType::Full + .is_supporting(&shape, Direction::Up) + .map_err(|error| SurvivalError::Registry(invalid(error.to_string())))? + || (self.same_block(neighbor, state) + && self + .registry + .state(neighbor) + .unwrap() + .properties + .get("layers") + .is_some_and(|value| value == "8"))) + } + Rule::SeaPickle => { + let at = relative(position, Direction::Down); + let neighbor = self.read(world, at)?; + let shape = self + .collision + .collision_shape(world, neighbor, at) + .map_err(SurvivalError::Collision)?; + Ok(!shape + .face_shape(Direction::Up) + .map_err(|error| SurvivalError::Registry(invalid(error.to_string())))? + .is_empty() + || self + .support + .is_face_sturdy(world, neighbor, at, Direction::Up, SupportType::Full) + .map_err(SurvivalError::Support)?) + } + Rule::GrowingPlant { + head, + body, + direction, + kelp, + } => { + let at = relative(position, direction.opposite()); + let neighbor = self.read(world, at)?; + if kelp && self.no_kelp.contains(&neighbor) { + return Ok(false); + } + Ok(self.same_block(neighbor, head) + || self.same_block(neighbor, body) + || self + .support + .is_face_sturdy(world, neighbor, at, direction, SupportType::Full) + .map_err(SurvivalError::Support)?) + } + Rule::MangrovePropagule(hanging) => { + let neighbor = self.read( + world, + relative( + position, + if hanging { + Direction::Up + } else { + Direction::Down + }, + ), + )?; + Ok(if hanging { + self.hanging_mangrove.contains(&neighbor) + } else { + self.mangrove.contains(&neighbor) + }) + } + Rule::Speleothem(direction) => { + let at = relative(position, direction.opposite()); + let neighbor = self.read(world, at)?; + Ok(self + .support + .is_face_sturdy(world, neighbor, at, direction, SupportType::Full) + .map_err(SurvivalError::Support)? + || (self.same_block(neighbor, state) + && self + .registry + .state(neighbor) + .unwrap() + .properties + .get("vertical_direction") + == self + .registry + .state(state) + .unwrap() + .properties + .get("vertical_direction"))) + } + Rule::Scaffolding => { + let below = relative(position, Direction::Down); + let neighbor = self.read(world, below)?; + let mut distance = if let Some(distance) = self + .scaffold_distance(neighbor) + .map_err(SurvivalError::Registry)? + { + distance + } else { + if self + .support + .is_face_sturdy(world, neighbor, below, Direction::Up, SupportType::Full) + .map_err(SurvivalError::Support)? + { + return Ok(true); + } + 7 + }; + for direction in [ + Direction::North, + Direction::East, + Direction::South, + Direction::West, + ] { + let neighbor = self.read(world, relative(position, direction))?; + if let Some(adjacent) = self + .scaffold_distance(neighbor) + .map_err(SurvivalError::Registry)? + { + distance = distance.min(adjacent + 1); + if distance == 1 { + break; + } + } + } + Ok(distance < 7) + } + Rule::PistonHead { direction, sticky } => { + let neighbor = self.read(world, relative(position, direction.opposite()))?; + let definition = self.registry.state(neighbor).unwrap(); + let base = if sticky { + "minecraft:sticky_piston" + } else { + "minecraft:piston" + }; + Ok(((definition.name == base + && definition + .properties + .get("extended") + .is_some_and(|v| v == "true")) + || definition.name == "minecraft:moving_piston") + && definition.properties.get("facing") + == self.registry.state(state).unwrap().properties.get("facing")) + } + Rule::ChorusPlant => { + let below = self.read(world, relative(position, Direction::Down))?; + let above = self.read(world, relative(position, Direction::Up))?; + let crowded = !self.is_air(above) && !self.is_air(below); + for direction in [ + Direction::North, + Direction::East, + Direction::South, + Direction::West, + ] { + let at = relative(position, direction); + let neighbor = self.read(world, at)?; + if self.same_block(neighbor, state) { + if crowded { + return Ok(false); + } + let support = self.read(world, relative(at, Direction::Down))?; + if self.same_block(support, state) || self.chorus_plant.contains(&support) { + return Ok(true); + } + } + } + Ok(self.same_block(below, state) || self.chorus_plant.contains(&below)) + } + Rule::ChorusFlower => { + let below = self.read(world, relative(position, Direction::Down))?; + if self.is_named(below, "minecraft:chorus_plant") + || self.chorus_flower.contains(&below) + { + return Ok(true); + } + if !self.is_air(below) { + return Ok(false); + } + let mut found = false; + for direction in [ + Direction::North, + Direction::East, + Direction::South, + Direction::West, + ] { + let neighbor = self.read(world, relative(position, direction))?; + if self.is_named(neighbor, "minecraft:chorus_plant") { + if found { + return Ok(false); + } + found = true; + } else if !self.is_air(neighbor) { + return Ok(false); + } + } + Ok(found) + } + Rule::PitcherCrop(upper) => { + if !upper + && world + .raw_brightness(position, 0) + .map_err(SurvivalError::World)? + < 8 + { + return Ok(false); + } + let below = self.read(world, relative(position, Direction::Down))?; + Ok(if upper { + self.is_lower_half(below, state) + } else { + self.crops.contains(&below) + }) + } + Rule::SugarCane => { + let below = relative(position, Direction::Down); + let neighbor = self.read(world, below)?; + if self.registry.state(neighbor).unwrap().name + == self.registry.state(state).unwrap().name + { + return Ok(true); + } + if !self.sugar_cane.contains(&neighbor) { + return Ok(false); + } + for direction in [ + Direction::North, + Direction::East, + Direction::South, + Direction::West, + ] { + let at = relative(below, direction); + let adjacent = self.read(world, at)?; + let fluid = world.fluid_state(at).map_err(SurvivalError::World)?; + if self.fluid_matches(3, fluid) || self.sugar_cane_adjacent.contains(&adjacent) + { + return Ok(true); + } + } + Ok(false) + } + Rule::LilyPad => { + let below = relative(position, Direction::Down); + let neighbor = self.read(world, below)?; + let fluid_below = world.fluid_state(below).map_err(SurvivalError::World)?; + let fluid_here = world.fluid_state(position).map_err(SurvivalError::World)?; + Ok( + (self.fluid_matches(1, fluid_below) || self.lily_pad.contains(&neighbor)) + && fluid_here.kind() == FluidKind::Empty, + ) + } + Rule::Frogspawn => { + let below = relative(position, Direction::Down); + let fluid_below = world.fluid_state(below).map_err(SurvivalError::World)?; + let fluid_here = world.fluid_state(position).map_err(SurvivalError::World)?; + Ok((self.fluid_matches(2, fluid_below) + || self.frogspawn.contains(&self.read(world, below)?)) + && fluid_here.kind() == FluidKind::Empty) + } + Rule::SporeBlossom => Ok(self.support( + world, + relative(position, Direction::Up), + Direction::Down, + SupportType::Center, + true, + )? && !self.fluid_matches( + 0, + world.fluid_state(position).map_err(SurvivalError::World)?, + )), + Rule::SmallDripleaf(upper) => { + let neighbor = self.read(world, relative(position, Direction::Down))?; + if upper { + return Ok(self.is_lower_half(neighbor, state)); + } + Ok(self.small_dripleaf.contains(&neighbor) + || (world + .fluid_state(position) + .map_err(SurvivalError::World)? + .kind() + == FluidKind::Water + && self.vegetation.contains(&neighbor))) + } + Rule::TallSeagrass(upper) => { + let below = relative(position, Direction::Down); + if upper { + return Ok(self.is_lower_half(self.read(world, below)?, state)); + } + let fluid = world.fluid_state(position).map_err(SurvivalError::World)?; + let neighbor = self.read(world, below)?; + Ok(self + .support + .is_face_sturdy(world, neighbor, below, Direction::Up, SupportType::Full) + .map_err(SurvivalError::Support)? + && !self.no_seagrass.contains(&neighbor) + && self.fluid_matches(0, fluid) + && fluid.is_full()) + } + Rule::BigDripleaf => { + let below = self.read(world, relative(position, Direction::Down))?; + Ok(matches!( + self.registry.state(below).unwrap().name.as_str(), + "minecraft:big_dripleaf" | "minecraft:big_dripleaf_stem" + ) || self.dripleaf.contains(&below)) + } + Rule::BigDripleafStem => { + let below = self.read(world, relative(position, Direction::Down))?; + let above = self.read(world, relative(position, Direction::Up))?; + Ok( + (self.registry.state(below).unwrap().name == "minecraft:big_dripleaf_stem" + || self.dripleaf.contains(&below)) + && matches!( + self.registry.state(above).unwrap().name.as_str(), + "minecraft:big_dripleaf" | "minecraft:big_dripleaf_stem" + ), + ) + } + Rule::Farmland => { + let above = relative(position, Direction::Up); + Ok(!self.solid.contains(self.read(world, above)?) + || self.maintains_farmland.contains(&self.read(world, above)?)) + } + Rule::Cocoa(direction) => Ok(self + .cocoa + .contains(&self.read(world, relative(position, direction))?)), + Rule::Crop => Ok(world + .raw_brightness(position, 0) + .map_err(SurvivalError::World)? + >= 8 + && self + .crops + .contains(&self.read(world, relative(position, Direction::Down))?)), + Rule::DoublePlant(upper) => { + let below = self.read(world, relative(position, Direction::Down))?; + if !upper { + return Ok(self.vegetation.contains(&below)); + } + let neighbor = self.registry.state(below).unwrap(); + Ok(neighbor.name == self.registry.state(state).unwrap().name + && neighbor + .properties + .get("half") + .is_some_and(|v| v == "lower")) + } + Rule::Door(upper) => { + let below = relative(position, Direction::Down); + let neighbor = self.read(world, below)?; + if upper { + return Ok(self.registry.state(neighbor).unwrap().name + == self.registry.state(state).unwrap().name); + } + self.support + .is_face_sturdy(world, neighbor, below, Direction::Up, SupportType::Full) + .map_err(SurvivalError::Support) + } + Rule::TagBelow(index) => Ok(self.bound_tags[index] + .contains(&self.read(world, relative(position, Direction::Down))?)), + Rule::CactusFlower => { + let below = relative(position, Direction::Down); + self.read(world, below)?; + let neighbor = self.read(world, below)?; + Ok(self.cactus_flower.contains(&neighbor) + || self + .support + .is_face_sturdy(world, neighbor, below, Direction::Up, SupportType::Center) + .map_err(SurvivalError::Support)?) + } + Rule::Seagrass => { + let below = relative(position, Direction::Down); + let neighbor = self.read(world, below)?; + Ok(self + .support + .is_face_sturdy(world, neighbor, below, Direction::Up, SupportType::Full) + .map_err(SurvivalError::Support)? + && !self.no_seagrass.contains(&neighbor)) + } + Rule::BubbleColumn => { + let below = self.read(world, relative(position, Direction::Down))?; + Ok(self.registry.state(below).unwrap().name + == self.registry.state(state).unwrap().name + || self.bubble_up.contains(&below) + || self.bubble_down.contains(&below)) + } + Rule::RedstoneWire => { + let below = relative(position, Direction::Down); + let neighbor = self.read(world, below)?; + Ok(self + .support + .is_face_sturdy(world, neighbor, below, Direction::Up, SupportType::Full) + .map_err(SurvivalError::Support)? + || self.registry.state(neighbor).unwrap().name == "minecraft:hopper") + } + Rule::Always => Ok(true), + Rule::Solid(direction) => Ok(self + .solid + .contains(self.read(world, relative(position, direction))?)), + Rule::NonAirBelow => { + Ok(!self.is_air(self.read(world, relative(position, Direction::Down))?)) + } + Rule::MossCarpet(base) => { + let below = self.read(world, relative(position, Direction::Down))?; + if base { + return Ok(!self.is_air(below)); + } + let below = self.registry.state(below).unwrap(); + Ok(below.name == self.registry.state(state).unwrap().name + && below.properties.get("bottom").is_some_and(|v| v == "true")) + } + Rule::Support { + face, + kind, + center_restriction, + } => self.support( + world, + relative(position, face.opposite()), + face, + kind, + center_restriction, + ), + Rule::RigidOrCenterBelow => { + let below = relative(position, Direction::Down); + Ok( + self.support(world, below, Direction::Up, SupportType::Rigid, false)? + || self.support(world, below, Direction::Up, SupportType::Center, true)?, + ) + } + Rule::SupportsBamboo => Ok(self + .supports_bamboo + .contains(&self.read(world, relative(position, Direction::Down))?)), + } + } +} +fn relative(position: [i32; 3], direction: Direction) -> [i32; 3] { + let normal = direction.normal(); + std::array::from_fn(|i| position[i].wrapping_add(normal[i])) +} + +fn direction_name(direction: Direction) -> &'static str { + match direction { + Direction::Down => "down", + Direction::Up => "up", + Direction::North => "north", + Direction::South => "south", + Direction::West => "west", + Direction::East => "east", + } +} diff --git a/crates/horizon-world/src/chunk.rs b/crates/horizon-world/src/chunk.rs new file mode 100644 index 000000000..600113b32 --- /dev/null +++ b/crates/horizon-world/src/chunk.rs @@ -0,0 +1,556 @@ +//! Saved section palettes and storage-level chunk access. Changes here do not +//! run block behavior, lighting, heightmaps, neighbor updates or scheduled ticks. +use crate::{ + DATA_VERSION, + compression::invalid, + nbt::{Compound, JavaString, NamedTag, Tag}, + registry::{BlockRegistry, BlockStateId}, + tick_data::{self, TickKind}, +}; +use horizon_core::{ + position::{BlockPos, ChunkPos}, + storage::PackedStorage, + ticks::{ChunkTicks, SavedTick, TickTypeId}, +}; +use std::{collections::BTreeMap, io}; + +fn key(value: &str) -> JavaString { + JavaString::from(value) +} +fn bits_for_palette(len: usize, min: u8) -> u8 { + if len <= 1 { + 0 + } else { + ((usize::BITS - (len - 1).leading_zeros()) as u8).max(min) + } +} + +#[derive(Clone, Debug)] +pub struct PalettedContainer { + palette: Vec, + storage: Option, + entries: usize, + min_bits: u8, + extra: Compound, +} +impl PalettedContainer { + pub fn uniform(value: Tag, entries: usize, min_bits: u8) -> io::Result { + if entries == 0 || !(1..=32).contains(&min_bits) { + return Err(invalid("invalid palette dimensions")); + } + if matches!(value, Tag::End) { + return Err(invalid("End cannot be a palette entry")); + } + Ok(Self { + palette: vec![value], + storage: None, + entries, + min_bits, + extra: Compound::new(), + }) + } + + pub fn from_nbt(tag: &Tag, entries: usize, min_bits: u8) -> io::Result { + let Tag::Compound(map) = tag else { + return Err(invalid("palette container is not a compound")); + }; + let Some(Tag::List(palette)) = map.get(&key("palette")) else { + return Err(invalid("missing palette list")); + }; + let first = palette.first().ok_or_else(|| invalid("empty palette"))?; + let mut result = Self::uniform(first.clone(), entries, min_bits)?; + if palette.len() > i32::MAX as usize || palette.iter().any(|t| matches!(t, Tag::End)) { + return Err(invalid("invalid palette")); + } + result.palette = palette.clone(); + let bits = bits_for_palette(palette.len(), min_bits); + if bits > 0 { + let Some(Tag::LongArray(words)) = map.get(&key("data")) else { + return Err(invalid("nonuniform palette is missing data")); + }; + let storage = + PackedStorage::from_words(bits, entries, words.iter().map(|&w| w as u64).collect()) + .map_err(|e| invalid(e.to_string()))?; + for index in 0..entries { + if storage.get(index).unwrap() as usize >= palette.len() { + return Err(invalid("palette index outside palette")); + } + } + result.storage = Some(storage); + } + result.extra = map.clone(); + result.extra.remove(&key("palette")); + result.extra.remove(&key("data")); + Ok(result) + } + + pub fn bits(&self) -> u8 { + self.storage.as_ref().map_or(0, PackedStorage::bits) + } + pub fn palette_len(&self) -> usize { + self.palette.len() + } + pub fn get(&self, index: usize) -> io::Result<&Tag> { + if index >= self.entries { + return Err(invalid("section index out of bounds")); + } + let palette_index = self.storage.as_ref().map_or(0, |s| s.get(index).unwrap()) as usize; + Ok(&self.palette[palette_index]) + } + + pub fn set(&mut self, index: usize, value: Tag) -> io::Result { + let old = self.get(index)?.clone(); + if matches!(value, Tag::End) { + return Err(invalid("End cannot be a palette entry")); + } + let id = if let Some(id) = self.palette.iter().position(|v| *v == value) { + id + } else { + if self.palette.len() >= i32::MAX as usize { + return Err(invalid("palette too large")); + } + let next_bits = bits_for_palette(self.palette.len() + 1, self.min_bits); + if next_bits != self.bits() { + let mut next = PackedStorage::new(next_bits, self.entries) + .map_err(|e| invalid(e.to_string()))?; + if let Some(previous) = &self.storage { + for i in 0..self.entries { + next.set(i, previous.get(i).unwrap()).unwrap(); + } + } + self.storage = Some(next); + } + self.palette.push(value); + self.palette.len() - 1 + }; + if let Some(storage) = &mut self.storage { + storage + .set(index, id as u32) + .map_err(|e| invalid(e.to_string()))?; + } + Ok(old) + } + + /// Rebuild a minimal palette in first-use order, preserving every entry. + pub fn compact(&mut self) -> io::Result<()> { + let values = (0..self.entries) + .map(|i| self.get(i).cloned()) + .collect::>>()?; + let mut compact = Self::uniform(values[0].clone(), self.entries, self.min_bits)?; + for (i, value) in values.into_iter().enumerate() { + compact.set(i, value)?; + } + compact.extra = std::mem::take(&mut self.extra); + *self = compact; + Ok(()) + } + + pub fn to_nbt(&self) -> Tag { + let mut map = self.extra.clone(); + map.insert(key("palette"), Tag::List(self.palette.clone())); + if let Some(storage) = &self.storage { + map.insert( + key("data"), + Tag::LongArray(storage.words().iter().map(|&v| v as i64).collect()), + ); + } + Tag::Compound(map) + } +} + +#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] +pub struct BlockState { + pub name: String, + pub properties: BTreeMap, +} +impl BlockState { + pub fn to_nbt(&self) -> Tag { + let mut map = Compound::new(); + map.insert(key("id"), Tag::String(key(&self.name))); + if !self.properties.is_empty() { + map.insert( + key("properties"), + Tag::Compound( + self.properties + .iter() + .map(|(k, v)| (key(k), Tag::String(key(v)))) + .collect(), + ), + ); + } + Tag::Compound(map) + } + pub fn from_nbt(tag: &Tag) -> io::Result { + if let Tag::String(name) = tag { + return Ok(Self { + name: name.to_string().map_err(|e| invalid(e.to_string()))?, + properties: BTreeMap::new(), + }); + } + let Some(Tag::String(name)) = tag.get("id") else { + return Err(invalid("block state is missing id")); + }; + let mut properties = BTreeMap::new(); + if let Some(tag) = tag.get("properties") { + let Tag::Compound(map) = tag else { + return Err(invalid("block properties are not a compound")); + }; + for (k, v) in map { + let Tag::String(v) = v else { + return Err(invalid("block property is not a string")); + }; + properties.insert( + k.to_string().map_err(|e| invalid(e.to_string()))?, + v.to_string().map_err(|e| invalid(e.to_string()))?, + ); + } + } + Ok(Self { + name: name.to_string().map_err(|e| invalid(e.to_string()))?, + properties, + }) + } +} + +#[derive(Clone, Debug)] +pub struct ChunkData { + root: NamedTag, + position: ChunkPos, +} +impl ChunkData { + pub fn new(root: NamedTag) -> io::Result { + let Some(Tag::Int(x)) = root.tag.get("xPos") else { + return Err(invalid("chunk is missing xPos")); + }; + let Some(Tag::Int(z)) = root.tag.get("zPos") else { + return Err(invalid("chunk is missing zPos")); + }; + let position = ChunkPos::new(*x, *z); + let Some(Tag::Int(version)) = root.tag.get("DataVersion") else { + return Err(invalid("chunk is missing DataVersion")); + }; + if *version != DATA_VERSION { + return Err(invalid(format!( + "expected DataVersion {DATA_VERSION}, got {version}; data fixing is not implemented" + ))); + } + let Some(Tag::List(sections)) = root.tag.get("sections") else { + return Err(invalid("chunk is missing sections")); + }; + let mut seen = std::collections::BTreeSet::new(); + for section in sections { + let Some(Tag::Byte(y)) = section.get("Y") else { + return Err(invalid("section is missing byte Y")); + }; + if !seen.insert(*y) { + return Err(invalid("duplicate section Y")); + } + } + Ok(Self { root, position }) + } + pub fn position(&self) -> ChunkPos { + self.position + } + pub fn into_nbt(self) -> NamedTag { + self.root + } + pub fn root(&self) -> &NamedTag { + &self.root + } + + pub fn saved_ticks( + &self, + kind: TickKind, + resolve: impl FnMut(&str) -> Option, + ) -> io::Result { + let Some(tag) = self.root.tag.get(kind.field()) else { + return Ok(ChunkTicks::default()); + }; + let mut ticks = tick_data::read_list(tag, resolve)?; + ticks.retain(|tick| tick.pos.chunk() == self.position); + Ok(ChunkTicks::from_saved(ticks)) + } + + pub fn set_saved_ticks( + &mut self, + kind: TickKind, + ticks: &[SavedTick], + name: impl FnMut(TickTypeId) -> Option, + ) -> io::Result<()> { + if ticks.iter().any(|tick| tick.pos.chunk() != self.position) { + return Err(invalid("saved tick is outside this chunk")); + } + let tag = tick_data::write_list(ticks, name)?; + let Tag::Compound(map) = &mut self.root.tag else { + unreachable!() + }; + map.insert(key(kind.field()), tag); + Ok(()) + } + + fn section_index(&self, block: BlockPos) -> io::Result> { + if block.chunk() != self.position { + return Err(invalid("block is outside this chunk")); + } + let section_y = i8::try_from(block.y >> 4) + .map_err(|_| invalid("block height outside saved section range"))?; + let Tag::List(sections) = self.root.tag.get("sections").unwrap() else { + unreachable!() + }; + Ok(sections + .iter() + .position(|s| s.get("Y") == Some(&Tag::Byte(section_y)))) + } + + pub fn block(&self, block: BlockPos) -> io::Result> { + let Some(index) = self.section_index(block)? else { + return Ok(None); + }; + let Tag::List(sections) = self.root.tag.get("sections").unwrap() else { + unreachable!() + }; + let Some(container) = sections[index].get("block_states") else { + return Ok(None); + }; + let palette = PalettedContainer::from_nbt(container, 4096, 4)?; + Ok(Some(BlockState::from_nbt( + palette.get(block.section_index())?, + )?)) + } + + pub fn load_block_section<'r>( + &self, + block: BlockPos, + registry: &'r BlockRegistry, + ) -> io::Result>> { + let Some(index) = self.section_index(block)? else { + return Ok(None); + }; + let Tag::List(sections) = self.root.tag.get("sections").unwrap() else { + unreachable!() + }; + sections[index] + .get("block_states") + .map(|tag| BlockSection::from_nbt(tag, registry)) + .transpose() + } + + /// Storage-only mutation. The caller must arrange simulation-derived updates + /// before treating this as a gameplay block placement. + pub fn set_block_data(&mut self, block: BlockPos, state: BlockState) -> io::Result { + let index = self + .section_index(block)? + .ok_or_else(|| invalid("section is not present"))?; + let Tag::List(sections) = self.root.tag.get_mut("sections").unwrap() else { + unreachable!() + }; + let container = sections[index] + .get_mut("block_states") + .ok_or_else(|| invalid("section has no block-state data"))?; + let mut palette = PalettedContainer::from_nbt(container, 4096, 4)?; + let old = BlockState::from_nbt(palette.get(block.section_index())?)?; + palette.set(block.section_index(), state.to_nbt())?; + *container = palette.to_nbt(); + Ok(old) + } +} + +/// Resident section: 4,096 blocks stored as numeric palette entries. Uniform +/// sections have no word array; property strings live in the shared registry. +pub struct BlockSection<'r> { + palette: Vec, + local_ids: std::collections::HashMap, + counts: Vec, + free: Vec, + storage: Option, + registry: &'r BlockRegistry, + extra: Compound, +} +impl<'r> BlockSection<'r> { + pub fn registry(&self) -> &'r BlockRegistry { + self.registry + } + pub fn uniform(state: BlockStateId, registry: &'r BlockRegistry) -> io::Result { + if registry.state(state).is_none() { + return Err(invalid("state ID outside registry")); + } + Ok(Self { + palette: vec![state], + local_ids: [(state, 0)].into(), + counts: vec![4096], + free: Vec::new(), + storage: None, + registry, + extra: Compound::new(), + }) + } + pub fn from_nbt(tag: &Tag, registry: &'r BlockRegistry) -> io::Result { + let container = PalettedContainer::from_nbt(tag, 4096, 4)?; + let resolved = container + .palette + .iter() + .map(|tag| registry.resolve(&BlockState::from_nbt(tag)?)) + .collect::>>()?; + let first_index = container.storage.as_ref().map_or(0, |s| s.get(0).unwrap()) as usize; + let mut section = Self::uniform(resolved[first_index], registry)?; + for index in 0..4096 { + let id = container + .storage + .as_ref() + .map_or(0, |s| s.get(index).unwrap()) as usize; + section.set(index, resolved[id])?; + } + section.extra = container.extra; + Ok(section) + } + pub fn bits(&self) -> u8 { + self.storage.as_ref().map_or(0, PackedStorage::bits) + } + pub fn get(&self, index: usize) -> io::Result { + if index >= 4096 { + return Err(invalid("section index out of bounds")); + } + let id = self.storage.as_ref().map_or(0, |s| s.get(index).unwrap()); + Ok(self.palette[id as usize]) + } + pub fn set(&mut self, index: usize, state: BlockStateId) -> io::Result { + let old = self.get(index)?; + if state.0 as usize >= self.registry.len() { + return Err(invalid("state ID outside registry")); + } + if old == state { + return Ok(old); + } + let old_id = self.local_ids[&old]; + if self.counts[old_id as usize] == 1 && !self.local_ids.contains_key(&state) { + // Replacing the last occurrence can reuse its slot without repacking. + self.palette[old_id as usize] = state; + self.local_ids.remove(&old); + self.local_ids.insert(state, old_id); + return Ok(old); + } + let id = if let Some(id) = self.local_ids.get(&state) { + *id + } else if let Some(id) = self.free.pop() { + self.palette[id as usize] = state; + self.local_ids.insert(state, id); + id + } else { + let id = self.palette.len() as u32; + let next_bits = bits_for_palette(self.palette.len() + 1, 4); + if next_bits != self.bits() { + let mut storage = + PackedStorage::new(next_bits, 4096).map_err(|e| invalid(e.to_string()))?; + if let Some(old) = &self.storage { + for i in 0..4096 { + storage.set(i, old.get(i).unwrap()).unwrap(); + } + } + self.storage = Some(storage); + } + self.palette.push(state); + self.counts.push(0); + self.local_ids.insert(state, id); + id + }; + self.storage + .as_mut() + .unwrap() + .set(index, id) + .map_err(|e| invalid(e.to_string()))?; + self.counts[old_id as usize] -= 1; + self.counts[id as usize] += 1; + if self.counts[old_id as usize] == 0 { + self.local_ids.remove(&old); + self.free.push(old_id); + } + if self.counts[id as usize] == 4096 { + self.palette = vec![state]; + self.local_ids = [(state, 0)].into(); + self.counts = vec![4096]; + self.free.clear(); + self.storage = None; + } + Ok(old) + } + pub fn compact(&mut self) -> io::Result<()> { + let values: Vec<_> = (0..4096).map(|i| self.get(i).unwrap()).collect(); + self.palette.clear(); + self.local_ids.clear(); + self.counts.clear(); + self.free.clear(); + for state in &values { + if !self.local_ids.contains_key(state) { + self.local_ids.insert(*state, self.palette.len() as u32); + self.palette.push(*state); + self.counts.push(0); + } + self.counts[self.local_ids[state] as usize] += 1; + } + let bits = bits_for_palette(self.palette.len(), 4); + self.storage = if bits == 0 { + None + } else { + let mut storage = PackedStorage::new(bits, 4096).map_err(|e| invalid(e.to_string()))?; + for (i, state) in values.iter().enumerate() { + storage.set(i, self.local_ids[state]).unwrap(); + } + Some(storage) + }; + Ok(()) + } + pub fn to_nbt(&self) -> io::Result { + let mut map = self.extra.clone(); + let palette = self + .palette + .iter() + .map(|id| { + self.registry + .state(*id) + .map(BlockState::to_nbt) + .ok_or_else(|| invalid("state ID outside registry")) + }) + .collect::>>()?; + map.insert(key("palette"), Tag::List(palette)); + if let Some(storage) = &self.storage { + map.insert( + key("data"), + Tag::LongArray(storage.words().iter().map(|&w| w as i64).collect()), + ); + } + Ok(Tag::Compound(map)) + } +} + +#[cfg(test)] +mod tests { + use super::*; + #[test] + fn palette_grows_across_word_widths_and_compacts_to_uniform() { + let mut palette = PalettedContainer::uniform(Tag::Int(0), 4096, 4).unwrap(); + for i in 0..4096 { + palette.set(i, Tag::Int(i as i32)).unwrap(); + } + assert_eq!(palette.bits(), 12); + let mut loaded = PalettedContainer::from_nbt(&palette.to_nbt(), 4096, 4).unwrap(); + for i in 0..4096 { + assert_eq!(loaded.get(i).unwrap(), &Tag::Int(i as i32)); + loaded.set(i, Tag::Int(7)).unwrap(); + } + loaded.compact().unwrap(); + assert_eq!(loaded.bits(), 0); + assert_eq!(loaded.palette_len(), 1); + assert!(loaded.to_nbt().get("data").is_none()); + assert_eq!(loaded.get(4095).unwrap(), &Tag::Int(7)); + } + #[test] + fn invalid_palette_data_fails_before_access() { + let mut tag = Tag::compound([("palette", Tag::List(vec![Tag::Int(0), Tag::Int(1)]))]); + assert!(PalettedContainer::from_nbt(&tag, 4096, 4).is_err()); + let Tag::Compound(map) = &mut tag else { + unreachable!() + }; + map.insert(key("data"), Tag::LongArray(vec![-1; 256])); + assert!(PalettedContainer::from_nbt(&tag, 4096, 4).is_err()); + } +} diff --git a/crates/horizon-world/src/collision.rs b/crates/horizon-world/src/collision.rs new file mode 100644 index 000000000..b5e27c11b --- /dev/null +++ b/crates/horizon-world/src/collision.rs @@ -0,0 +1,190 @@ +//! Version-pinned cached block collision data, without entity-context behavior. +//! +//! Java's no-context BlockState.getCollisionShape uses its cache when present. +//! The overload taking CollisionContext always calls block behavior instead. +//! This module covers the cached branch only; uncached states remain explicit. +use crate::{ + DATA_VERSION, + chunk::{BlockSection, BlockState}, + compression::invalid, + nbt::Tag, + registry::{BlockRegistry, BlockStateId}, +}; +use horizon_core::geometry::{Axis, VoxelShape}; +use std::{collections::HashMap, io}; + +#[derive(PartialEq, Eq, Hash)] +struct GridKey { + coords: [Vec; 3], + occupied: Vec, + cube: bool, + axes: u8, + min: [i32; 3], + max: [i32; 3], +} + +pub struct CachedCollisionRegistry<'r> { + registry: &'r BlockRegistry, + shapes: Vec, + state_shapes: Vec, + grid_count: usize, +} +impl<'r> CachedCollisionRegistry<'r> { + pub fn registry(&self) -> &'r BlockRegistry { + self.registry + } + pub fn from_nbt(tag: &Tag, registry: &'r BlockRegistry) -> io::Result { + if tag.get("DataVersion") != Some(&Tag::Int(DATA_VERSION)) { + return Err(invalid("collision DataVersion mismatch")); + } + let Some(Tag::List(states)) = tag.get("states") else { + return Err(invalid("missing collision state identities")); + }; + if states.len() != registry.len() { + return Err(invalid("collision registry size mismatch")); + } + for (id, state) in states.iter().enumerate() { + if registry.state(BlockStateId(id as u32)) != Some(&BlockState::from_nbt(state)?) { + return Err(invalid("collision state identities differ")); + } + } + let Some(Tag::List(entries)) = tag.get("shapes") else { + return Err(invalid("missing collision shapes")); + }; + if entries.len() > registry.len() { + return Err(invalid("too many cached collision shapes")); + } + let mut shapes = Vec::with_capacity(entries.len()); + let mut grids = HashMap::::new(); + for entry in entries { + let mut coords: [Vec; 3] = std::array::from_fn(|_| Vec::new()); + for (i, axis) in ["x", "y", "z"].into_iter().enumerate() { + let Some(Tag::LongArray(bits)) = entry.get(axis) else { + return Err(invalid("missing collision coordinates")); + }; + coords[i] = bits.iter().map(|b| f64::from_bits(*b as u64)).collect(); + } + let Some(Tag::ByteArray(bits)) = entry.get("occupied") else { + return Err(invalid("missing collision occupancy")); + }; + if bits.iter().any(|b| *b != 0 && *b != 1) { + return Err(invalid("invalid collision occupancy")); + } + let occupied = bits.iter().map(|b| *b != 0).collect::>(); + let Some(Tag::Byte(cube_axes)) = entry.get("cube_axes") else { + return Err(invalid("missing cube-coordinate metadata")); + }; + if *cube_axes < 0 || *cube_axes > 7 { + return Err(invalid("invalid cube-coordinate metadata")); + } + let coordinate_cubes = [cube_axes & 1 != 0, cube_axes & 2 != 0, cube_axes & 4 != 0]; + let discrete_bounds = |name| -> io::Result<[i32; 3]> { + let Some(Tag::IntArray(values)) = entry.get(name) else { + return Err(invalid("missing collision discrete extrema")); + }; + values + .as_slice() + .try_into() + .map_err(|_| invalid("invalid collision discrete extrema length")) + }; + let min = discrete_bounds("discrete_min")?; + let max = discrete_bounds("discrete_max")?; + let cube = match entry.get("cube") { + Some(Tag::Byte(0)) => false, + Some(Tag::Byte(1)) => true, + _ => return Err(invalid("invalid collision cube flag")), + }; + let key = GridKey { + coords: std::array::from_fn(|i| coords[i].iter().map(|v| v.to_bits()).collect()), + occupied: bits.clone(), + cube, + axes: *cube_axes as u8, + min, + max, + }; + if let Some(existing) = grids.get(&key) { + shapes.push(existing.fresh_identity()); + continue; + } + let shape = match entry.get("cube") { + Some(Tag::Byte(0)) => { + VoxelShape::from_mixed_grid(coords, &occupied, coordinate_cubes) + } + Some(Tag::Byte(1)) => { + if *cube_axes != 7 { + return Err(invalid("cube shape has array-coordinate metadata")); + } + let sizes = std::array::from_fn(|i| coords[i].len().saturating_sub(1)); + let shape = VoxelShape::from_cube(sizes, &occupied) + .map_err(|e| invalid(e.to_string()))?; + for axis in Axis::ALL { + if shape + .coordinates(axis) + .iter() + .map(|v| v.to_bits()) + .ne(coords[axis as usize].iter().map(|v| v.to_bits())) + { + return Err(invalid("cube collision coordinates differ")); + } + } + Ok(shape) + } + _ => return Err(invalid("invalid collision cube flag")), + } + .map_err(|e| invalid(e.to_string()))?; + let shape = shape + .with_discrete_bounds(min, max) + .map_err(|e| invalid(e.to_string()))?; + grids.insert(key, shape.clone()); + shapes.push(shape); + } + let Some(Tag::IntArray(state_shapes)) = tag.get("cached_shapes") else { + return Err(invalid("missing cached shape mapping")); + }; + if state_shapes.len() != registry.len() + || state_shapes + .iter() + .any(|id| *id < -1 || *id >= shapes.len() as i32) + { + return Err(invalid("invalid cached shape mapping")); + } + Ok(Self { + registry, + shapes, + state_shapes: state_shapes.clone(), + grid_count: grids.len(), + }) + } + pub fn shape_count(&self) -> usize { + self.shapes.len() + } + pub fn unique_grid_count(&self) -> usize { + self.grid_count + } + pub fn cached_state_count(&self) -> usize { + self.state_shapes.iter().filter(|id| **id >= 0).count() + } + /// None means vanilla must call block behavior for this state. It does not + /// mean air, an empty shape, or permission to ignore a collision. + pub fn cached_shape(&self, state: BlockStateId) -> io::Result> { + let id = *self + .state_shapes + .get(state.0 as usize) + .ok_or_else(|| invalid("collision state outside registry"))?; + Ok(if id < 0 { + None + } else { + Some(&self.shapes[id as usize]) + }) + } + pub fn section_shape( + &self, + section: &BlockSection<'_>, + index: usize, + ) -> io::Result> { + if !std::ptr::eq(section.registry(), self.registry) { + return Err(invalid("section uses a different collision registry")); + } + self.cached_shape(section.get(index)?) + } +} diff --git a/crates/horizon-world/src/compression.rs b/crates/horizon-world/src/compression.rs new file mode 100644 index 000000000..0bdfb6091 --- /dev/null +++ b/crates/horizon-world/src/compression.rs @@ -0,0 +1,227 @@ +//! Region codecs, including lz4-java's block framing (not the LZ4 frame format). +use flate2::{Compression as Level, Decompress, FlushDecompress, Status}; +use std::io::{self, Read, Write}; + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[repr(u8)] +pub enum Compression { + Gzip = 1, + Zlib = 2, + None = 3, + Lz4 = 4, +} + +pub(crate) fn invalid(message: impl Into) -> io::Error { + io::Error::new(io::ErrorKind::InvalidData, message.into()) +} + +impl TryFrom for Compression { + type Error = io::Error; + fn try_from(value: u8) -> io::Result { + match value { + 1 => Ok(Self::Gzip), + 2 => Ok(Self::Zlib), + 3 => Ok(Self::None), + 4 => Ok(Self::Lz4), + _ => Err(invalid(format!( + "unsupported region compression ID {value}" + ))), + } + } +} + +impl Compression { + pub fn decode(self, bytes: &[u8], max_output: usize) -> io::Result> { + match self { + Self::None => { + if bytes.len() > max_output { + return Err(invalid("decompression limit exceeded")); + } + Ok(bytes.to_vec()) + } + Self::Gzip => { + let decoder = flate2::read::MultiGzDecoder::new(bytes); + let mut output = Vec::new(); + decoder + .take((max_output as u64).saturating_add(1)) + .read_to_end(&mut output)?; + if output.len() > max_output { + return Err(invalid("decompression limit exceeded")); + } + Ok(output) + } + Self::Zlib => { + let mut decoder = Decompress::new(true); + let mut output = Vec::new(); + let mut block = [0; 8192]; + loop { + let before_in = decoder.total_in(); + let before_out = decoder.total_out(); + let status = decoder + .decompress( + &bytes[before_in as usize..], + &mut block, + FlushDecompress::None, + ) + .map_err(|e| invalid(e.to_string()))?; + let produced = (decoder.total_out() - before_out) as usize; + if produced > max_output.saturating_sub(output.len()) { + return Err(invalid("decompression limit exceeded")); + } + output.extend_from_slice(&block[..produced]); + if status == Status::StreamEnd { + return Ok(output); + } + if decoder.total_in() == before_in && produced == 0 { + return Err(invalid("truncated zlib stream")); + } + } + } + Self::Lz4 => decode_lz4(bytes, max_output), + } + } + + pub fn encode(self, bytes: &[u8]) -> io::Result> { + match self { + Self::None => Ok(bytes.to_vec()), + Self::Gzip => { + let mut encoder = flate2::write::GzEncoder::new(Vec::new(), Level::default()); + encoder.write_all(bytes)?; + encoder.finish() + } + Self::Zlib => { + let mut encoder = flate2::write::ZlibEncoder::new(Vec::new(), Level::default()); + encoder.write_all(bytes)?; + encoder.finish() + } + Self::Lz4 => Ok(encode_lz4(bytes)), + } + } +} + +const MAGIC: &[u8; 8] = b"LZ4Block"; +fn checksum(bytes: &[u8]) -> u32 { + // The Checksum adapter used by the pinned Java library masks to 28 bits. + xxhash_rust::xxh32::xxh32(bytes, 0x9747_b28c) & 0x0fff_ffff +} + +fn decode_lz4(mut bytes: &[u8], max_output: usize) -> io::Result> { + let mut output = Vec::new(); + loop { + let header = bytes + .get(..21) + .ok_or_else(|| invalid("truncated LZ4 header"))?; + if &header[..8] != MAGIC { + return Err(invalid("invalid LZ4 block magic")); + } + let method = header[8] & 0xf0; + if !matches!(method, 0x10 | 0x20) { + return Err(invalid("invalid LZ4 block method")); + } + let compressed = u32::from_le_bytes(header[9..13].try_into().unwrap()) as usize; + let raw = u32::from_le_bytes(header[13..17].try_into().unwrap()) as usize; + let expected = u32::from_le_bytes(header[17..21].try_into().unwrap()); + if raw > (1 << (10 + (header[8] & 15))) + || (raw == 0) != (compressed == 0) + || (method == 0x10 && raw != compressed) + { + return Err(invalid("invalid LZ4 block lengths")); + } + bytes = &bytes[21..]; + if raw == 0 { + if expected != 0 { + return Err(invalid("invalid LZ4 terminator checksum")); + } + return Ok(output); + } + if raw > max_output.saturating_sub(output.len()) { + return Err(invalid("decompression limit exceeded")); + } + let block = bytes + .get(..compressed) + .ok_or_else(|| invalid("truncated LZ4 payload"))?; + let start = output.len(); + if method == 0x10 { + output.extend_from_slice(block); + } else { + output.resize(start + raw, 0); + let actual = lz4_flex::block::decompress_into(block, &mut output[start..]) + .map_err(|e| invalid(e.to_string()))?; + if actual != raw { + return Err(invalid("LZ4 decoded length mismatch")); + } + } + if checksum(&output[start..]) != expected { + return Err(invalid("LZ4 checksum mismatch")); + } + bytes = &bytes[compressed..]; + } +} + +fn encode_lz4(bytes: &[u8]) -> Vec { + let mut output = Vec::new(); + for block in bytes.chunks(65536) { + let compressed = lz4_flex::block::compress(block); + let (token, payload) = if compressed.len() < block.len() { + (0x26, compressed.as_slice()) + } else { + (0x16, block) + }; + output.extend_from_slice(MAGIC); + output.push(token); + output.extend_from_slice(&(payload.len() as u32).to_le_bytes()); + output.extend_from_slice(&(block.len() as u32).to_le_bytes()); + output.extend_from_slice(&checksum(block).to_le_bytes()); + output.extend_from_slice(payload); + } + output.extend_from_slice(MAGIC); + output.push(0x16); + output.extend_from_slice(&[0; 12]); + output +} + +#[cfg(test)] +mod tests { + use super::*; + #[test] + fn all_codecs_roundtrip_and_enforce_limits() { + for codec in [ + Compression::Gzip, + Compression::Zlib, + Compression::None, + Compression::Lz4, + ] { + for bytes in [ + vec![], + vec![0; 131073], + (0..262144).map(|i| (i * 37) as u8).collect(), + ] { + let encoded = codec.encode(&bytes).unwrap(); + assert_eq!(codec.decode(&encoded, bytes.len()).unwrap(), bytes); + if !bytes.is_empty() { + assert!(codec.decode(&encoded, bytes.len() - 1).is_err()); + } + if codec != Compression::None { + assert!( + codec + .decode(&encoded[..encoded.len() - 1], bytes.len()) + .is_err() + ); + } + } + } + } + #[test] + fn checksums_reject_corruption() { + for codec in [Compression::Gzip, Compression::Zlib, Compression::Lz4] { + let mut encoded = codec.encode(b"Horizon world data").unwrap(); + let i = if codec == Compression::Lz4 { + 17 + } else { + encoded.len() - 5 + }; + encoded[i] ^= 1; + assert!(codec.decode(&encoded, 1000).is_err()); + } + } +} diff --git a/crates/horizon-world/src/dynamic_support.rs b/crates/horizon-world/src/dynamic_support.rs new file mode 100644 index 000000000..835ac4817 --- /dev/null +++ b/crates/horizon-world/src/dynamic_support.rs @@ -0,0 +1,251 @@ +//! Uncached support-shape selection. Block entities are queried through snapshots; +//! their lifecycle and active moving-piston collision generation are separate. +use crate::{block_support::SupportType, chunk::BlockState, compression::invalid}; +use horizon_core::{ + geometry::{Aabb, Direction, ShapeError, ShapeOp, Vec3, VoxelShape}, + position::BlockPos, + random::position_seed, +}; +use std::{io, sync::OnceLock}; + +pub trait DynamicSupportWorld { + type Error; + /// None represents a missing block entity or a different block-entity type. + fn shulker_is_closed(&mut self, position: [i32; 3]) -> Result, Self::Error>; + /// Invoke the active moving-piston entity's collision calculation when it + /// exists. None represents a missing entity or a different entity type. + fn moving_piston_shape( + &mut self, + position: [i32; 3], + ) -> Result, Self::Error>; +} +#[derive(Debug)] +pub enum DynamicSupportError { + World(E), + Shape(ShapeError), +} +impl std::fmt::Display for DynamicSupportError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::World(e) => e.fmt(f), + Self::Shape(e) => e.fmt(f), + } + } +} +impl std::error::Error for DynamicSupportError {} +#[derive(Clone, Debug)] +pub struct DynamicSupport { + kind: Kind, +} +#[derive(Clone, Debug)] +enum Kind { + Bamboo, + Speleothem(usize), + Scaffolding, + PowderSnow, + Shulker(Direction), + MovingPiston, +} +impl DynamicSupport { + /// Select behavior from a validated registry descriptor. None requests a + /// different implementation (usually the immutable cached-support branch). + pub fn from_state(state: &BlockState) -> io::Result> { + let property = |name: &str| { + state + .properties + .get(name) + .map(String::as_str) + .ok_or_else(|| invalid("missing dynamic support property")) + }; + let kind = match state.name.as_str() { + "minecraft:bamboo" => Kind::Bamboo, + "minecraft:pointed_dripstone" | "minecraft:sulfur_spike" => { + let down = match property("vertical_direction")? { + "down" => true, + "up" => false, + _ => return Err(invalid("invalid speleothem direction")), + }; + let shape = match property("thickness")? { + "tip_merge" => 0, + "tip" => { + if down { + 2 + } else { + 1 + } + } + "frustum" => 3, + "middle" => 4, + "base" => 5, + _ => return Err(invalid("invalid speleothem thickness")), + }; + Kind::Speleothem(shape) + } + "minecraft:scaffolding" => Kind::Scaffolding, + "minecraft:powder_snow" => Kind::PowderSnow, + "minecraft:moving_piston" => Kind::MovingPiston, + name if shulker(name) => Kind::Shulker(match property("facing")? { + "down" => Direction::Down, + "up" => Direction::Up, + "north" => Direction::North, + "south" => Direction::South, + "west" => Direction::West, + "east" => Direction::East, + _ => return Err(invalid("invalid shulker facing")), + }), + _ => return Ok(None), + }; + Ok(Some(Self { kind })) + } + pub fn offset(&self, position: [i32; 3]) -> Vec3 { + let maximum = match self.kind { + Kind::Bamboo => 0.25f32, + Kind::Speleothem(_) => 0.125f32, + _ => return Vec3::ZERO, + }; + let seed = position_seed(BlockPos::new(position[0], 0, position[2])); + let component = |shift: u32| { + let fraction = ((seed >> shift) & 15i64) as f32 / 15.0f32; + ((f64::from(fraction) - 0.5) * 0.5).clamp(-f64::from(maximum), f64::from(maximum)) + }; + Vec3::new(component(0), 0.0, component(8)) + } + pub fn shape( + &self, + world: &mut W, + position: [i32; 3], + ) -> Result> { + Ok(match self.kind { + Kind::Bamboo => { + static SHAPE: OnceLock = OnceLock::new(); + SHAPE + .get_or_init(|| column(3.0, 0.0, 16.0)) + .moved(self.offset(position)) + } + Kind::Speleothem(index) => { + static SHAPES: OnceLock<[VoxelShape; 6]> = OnceLock::new(); + SHAPES.get_or_init(|| { + [ + column(6.0, 0.0, 16.0), + column(6.0, 0.0, 11.0), + column(6.0, 5.0, 16.0), + column(8.0, 0.0, 16.0), + column(10.0, 0.0, 16.0), + column(12.0, 0.0, 16.0), + ] + })[index] + .moved(self.offset(position)) + } + Kind::Scaffolding => { + static SHAPE: OnceLock = OnceLock::new(); + SHAPE + .get_or_init(|| { + let mut legs = VoxelShape::empty(); + for [x, z] in [[0.0, 0.0], [0.875, 0.0], [0.875, 0.875], [0.0, 0.875]] { + let leg = box_shape([x, 0.0, z], [x + 0.125, 1.0, z + 0.125]); + legs = legs.join(&leg, ShapeOp::OR).expect("bounded scaffold legs"); + } + column(16.0, 14.0, 16.0) + .join(&legs, ShapeOp::OR) + .expect("bounded scaffold support") + }) + .clone() + } + Kind::PowderSnow => VoxelShape::empty(), + Kind::Shulker(facing) => { + if world + .shulker_is_closed(position) + .map_err(DynamicSupportError::World)? + == Some(false) + { + static SHAPES: OnceLock<[VoxelShape; 6]> = OnceLock::new(); + SHAPES.get_or_init(|| { + Direction::ALL.map(|direction| { + let mut min = [0.0; 3]; + let mut max = [1.0; 3]; + for (i, n) in direction.normal().into_iter().enumerate() { + if n < 0 { + max[i] = 0.0625; + } else if n > 0 { + min[i] = 0.9375; + } + } + box_shape(min, max) + }) + })[facing.opposite() as usize] + .clone() + } else { + VoxelShape::block() + } + } + Kind::MovingPiston => world + .moving_piston_shape(position) + .map_err(DynamicSupportError::World)? + .unwrap_or_else(VoxelShape::empty), + }) + } + pub fn collision_shape( + &self, + world: &mut W, + position: [i32; 3], + ) -> Result> { + if let Kind::Shulker(direction) = self.kind { + return match world + .shulker_collision_state(position) + .map_err(DynamicSupportError::World)? + { + Some(snapshot) => VoxelShape::from_box(snapshot.bounding_box(direction)) + .map_err(DynamicSupportError::Shape), + None => Ok(VoxelShape::block()), + }; + } + // Empty collision context uses the stable scaffolding shape, empty + // powder snow, and the same bamboo/speleothem/piston geometry as support. + self.shape(world, position) + } + pub fn is_face_sturdy( + &self, + world: &mut W, + position: [i32; 3], + direction: Direction, + support: SupportType, + ) -> Result> { + support + .is_supporting(&self.shape(world, position)?, direction) + .map_err(DynamicSupportError::Shape) + } +} +fn box_shape(min: [f64; 3], max: [f64; 3]) -> VoxelShape { + VoxelShape::from_box(Aabb::new( + Vec3::new(min[0], min[1], min[2]), + Vec3::new(max[0], max[1], max[2]), + )) + .expect("bounded support shape") +} +fn column(width: f64, min_y: f64, max_y: f64) -> VoxelShape { + let min = (8.0 - width / 2.0) / 16.0; + let max = (8.0 + width / 2.0) / 16.0; + box_shape([min, min_y / 16.0, min], [max, max_y / 16.0, max]) +} +fn shulker(name: &str) -> bool { + matches!( + name, + "minecraft:shulker_box" + | "minecraft:white_shulker_box" + | "minecraft:orange_shulker_box" + | "minecraft:magenta_shulker_box" + | "minecraft:light_blue_shulker_box" + | "minecraft:yellow_shulker_box" + | "minecraft:lime_shulker_box" + | "minecraft:pink_shulker_box" + | "minecraft:gray_shulker_box" + | "minecraft:light_gray_shulker_box" + | "minecraft:cyan_shulker_box" + | "minecraft:purple_shulker_box" + | "minecraft:blue_shulker_box" + | "minecraft:brown_shulker_box" + | "minecraft:green_shulker_box" + | "minecraft:red_shulker_box" + | "minecraft:black_shulker_box" + ) +} diff --git a/crates/horizon-world/src/entity_obstruction.rs b/crates/horizon-world/src/entity_obstruction.rs new file mode 100644 index 000000000..89f7f586b --- /dev/null +++ b/crates/horizon-world/src/entity_obstruction.rs @@ -0,0 +1,89 @@ +//! Entity obstruction against a voxel shape. Entity storage, lifecycle and +//! vehicle-tree maintenance supply the immutable candidate snapshots here. +use horizon_core::geometry::{Aabb, ShapeError, ShapeOp, VoxelShape}; + +/// Object identity within the caller's entity snapshot, including its generation. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct EntityIdentity(pub u64); +#[derive(Clone, Copy, Debug)] +pub struct ObstructionEntity { + pub identity: EntityIdentity, + pub root_vehicle: EntityIdentity, + pub bounds: Aabb, + pub removed: bool, + pub spectator: bool, + pub blocks_building: bool, +} +pub trait EntityObstructionWorld { + type Error; + /// Preserve native query order. Implementations may return a broad-phase + /// superset: exclusion, spectator and exact AABB filters are enforced below. + fn obstruction_candidates( + &mut self, + excluded: Option, + bounds: Aabb, + ) -> Result, Self::Error>; +} +#[derive(Debug)] +pub enum ObstructionError { + World(E), + Shape(ShapeError), +} +impl std::fmt::Display for ObstructionError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::World(e) => e.fmt(f), + Self::Shape(e) => e.fmt(f), + } + } +} +impl std::error::Error for ObstructionError {} + +pub fn is_unobstructed( + world: &mut W, + excluded: Option<&ObstructionEntity>, + shape: &VoxelShape, +) -> Result> { + let Some(bounds) = shape.bounds() else { + return Ok(true); + }; + let candidates = world + .obstruction_candidates(excluded.map(|e| e.identity), bounds) + .map_err(ObstructionError::World)?; + for entity in candidates { + if excluded.is_some_and(|e| e.identity == entity.identity) + || entity.spectator + || !entity.bounds.intersects(bounds) + { + continue; + } + if entity.removed + || !entity.blocks_building + || excluded.is_some_and(|e| e.root_vehicle == entity.root_vehicle) + { + continue; + } + let other = VoxelShape::from_box(entity.bounds).map_err(ObstructionError::Shape)?; + if shape + .join_is_not_empty(&other, ShapeOp::AND) + .map_err(ObstructionError::Shape)? + { + return Ok(false); + } + } + Ok(true) +} + +/// Entity obstruction for the unit cube used by the vanilla block predicate. +/// Translate the voxel shape in floating point: integer MAX + 1 must not wrap. +pub fn is_block_unobstructed( + world: &mut W, + position: [i32; 3], +) -> Result> { + let shape = VoxelShape::block().moved(horizon_core::geometry::Vec3::new( + f64::from(position[0]), + f64::from(position[1]), + f64::from(position[2]), + )); + is_unobstructed(world, None, &shape) +} diff --git a/crates/horizon-world/src/fluid.rs b/crates/horizon-world/src/fluid.rs new file mode 100644 index 000000000..f0472709c --- /dev/null +++ b/crates/horizon-world/src/fluid.rs @@ -0,0 +1,252 @@ +//! Fluid states carried by the pinned vanilla block-state registry. +//! Flow updates, spreading and entity interaction are separate simulation work. +use crate::{ + chunk::BlockState, + compression::invalid, + registry::{BlockRegistry, BlockStateId}, +}; +use std::io; + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[repr(u8)] +pub enum FluidKind { + Empty, + FlowingWater, + Water, + FlowingLava, + Lava, +} +impl FluidKind { + pub const ALL: [Self; 5] = [ + Self::Empty, + Self::FlowingWater, + Self::Water, + Self::FlowingLava, + Self::Lava, + ]; + pub const fn name(self) -> &'static str { + match self { + Self::Empty => "minecraft:empty", + Self::FlowingWater => "minecraft:flowing_water", + Self::Water => "minecraft:water", + Self::FlowingLava => "minecraft:flowing_lava", + Self::Lava => "minecraft:lava", + } + } + pub fn from_name(name: &str) -> Option { + Self::ALL.into_iter().find(|kind| kind.name() == name) + } + pub const fn same_family(self, other: Self) -> bool { + matches!( + (self, other), + (Self::Empty, Self::Empty) + | ( + Self::Water | Self::FlowingWater, + Self::Water | Self::FlowingWater + ) + | ( + Self::Lava | Self::FlowingLava, + Self::Lava | Self::FlowingLava + ) + ) + } + pub const fn mask(self) -> u8 { + 1 << self as u8 + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct FluidState { + kind: FluidKind, + amount: u8, + falling: bool, +} +impl FluidState { + pub const EMPTY: Self = Self { + kind: FluidKind::Empty, + amount: 0, + falling: false, + }; + pub const WATER: Self = Self { + kind: FluidKind::Water, + amount: 8, + falling: false, + }; + pub const fn kind(self) -> FluidKind { + self.kind + } + pub const fn amount(self) -> u8 { + self.amount + } + pub const fn falling(self) -> bool { + self.falling + } + pub const fn is_source(self) -> bool { + matches!(self.kind, FluidKind::Water | FluidKind::Lava) + } + pub const fn is_full(self) -> bool { + self.amount == 8 + } + pub fn height_at( + self, + world: &mut W, + position: [i32; 3], + ) -> Result { + if self.kind == FluidKind::Empty { + return Ok(0.0); + } + let above = [position[0], position[1].wrapping_add(1), position[2]]; + Ok(if self.kind.same_family(world.fluid(above)?.kind) { + 1.0 + } else { + self.own_height() + }) + } + pub fn camera_height_at( + self, + world: &mut W, + position: [i32; 3], + ) -> Result { + if self.is_source() { + let above = [position[0], position[1].wrapping_add(1), position[2]]; + if world.sturdy_down(above)? { + return Ok(1.0); + } + } + self.height_at(world, position) + } + pub fn own_height(self) -> f32 { + f32::from(self.amount) / 9.0 + } + pub fn from_block(state: &BlockState) -> io::Result { + let water = state.name == "minecraft:water"; + if water || state.name == "minecraft:lava" { + let level = state + .properties + .get("level") + .and_then(|v| v.parse::().ok()) + .filter(|v| *v <= 15) + .ok_or_else(|| invalid("invalid liquid block level"))?; + let kind = match (water, level == 0) { + (true, true) => FluidKind::Water, + (true, false) => FluidKind::FlowingWater, + (false, true) => FluidKind::Lava, + (false, false) => FluidKind::FlowingLava, + }; + return Ok(Self { + kind, + amount: if level == 0 || level >= 8 { + 8 + } else { + 8 - level + }, + falling: level >= 8, + }); + } + if matches!( + state.name.as_str(), + "minecraft:kelp" + | "minecraft:kelp_plant" + | "minecraft:seagrass" + | "minecraft:tall_seagrass" + | "minecraft:bubble_column" + ) { + return Ok(Self::WATER); + } + match state.properties.get("waterlogged").map(String::as_str) { + Some("true") => { + // The pinned copper-grate blocks use falling source water. + let falling = matches!( + state.name.as_str(), + "minecraft:copper_grate" + | "minecraft:exposed_copper_grate" + | "minecraft:weathered_copper_grate" + | "minecraft:oxidized_copper_grate" + | "minecraft:waxed_copper_grate" + | "minecraft:waxed_exposed_copper_grate" + | "minecraft:waxed_weathered_copper_grate" + | "minecraft:waxed_oxidized_copper_grate" + ); + Ok(Self { + falling, + ..Self::WATER + }) + } + None | Some("false") => Ok(Self::EMPTY), + _ => Err(invalid("invalid waterlogged block property")), + } + } +} +/// Queries required by fluid surface height and camera immersion. The caller +/// owns block shape/support behavior and world-query failures. +pub trait FluidHeightWorld { + type Error; + fn fluid(&mut self, position: [i32; 3]) -> Result; + fn sturdy_down(&mut self, position: [i32; 3]) -> Result; +} +#[derive(Debug)] +pub struct FluidStateTable(Vec); +impl FluidStateTable { + pub fn new(registry: &BlockRegistry) -> io::Result { + (0..registry.len()) + .map(|i| FluidState::from_block(registry.state(BlockStateId(i as u32)).unwrap())) + .collect::>>() + .map(Self) + } + pub fn get(&self, state: BlockStateId) -> Option { + self.0.get(state.0 as usize).copied() + } + pub fn matching_states(&self, mask: u8) -> impl Iterator + '_ { + self.0 + .iter() + .enumerate() + .filter(move |(_, state)| state.kind.mask() & mask != 0) + .map(|(i, _)| BlockStateId(i as u32)) + } +} + +/// Bound identities for converting fluid states into their legacy liquid blocks. +pub struct FluidBlockBindings { + air: BlockStateId, + water: [BlockStateId; 16], + lava: [BlockStateId; 16], +} +impl FluidBlockBindings { + pub fn new(registry: &BlockRegistry) -> io::Result { + let levels = |name: &str| -> io::Result<[BlockStateId; 16]> { + let default = registry + .default_state(name) + .ok_or_else(|| invalid("missing liquid block"))?; + let mut state = registry.state(default).unwrap().clone(); + let mut result = [default; 16]; + for (level, id) in result.iter_mut().enumerate() { + state.properties.insert("level".into(), level.to_string()); + *id = registry + .id(&state) + .ok_or_else(|| invalid("missing liquid block level"))?; + } + Ok(result) + }; + Ok(Self { + air: registry + .default_state("minecraft:air") + .ok_or_else(|| invalid("missing air block"))?, + water: levels("minecraft:water")?, + lava: levels("minecraft:lava")?, + }) + } + pub fn block(&self, state: FluidState) -> BlockStateId { + if state.kind == FluidKind::Empty { + return self.air; + } + let level = if state.is_source() { + 0 + } else { + 8 - state.amount.min(8) + if state.falling { 8 } else { 0 } + } as usize; + if state.kind.same_family(FluidKind::Water) { + self.water[level] + } else { + self.lava[level] + } + } +} diff --git a/crates/horizon-world/src/heightmap.rs b/crates/horizon-world/src/heightmap.rs new file mode 100644 index 000000000..4cc7df058 --- /dev/null +++ b/crates/horizon-world/src/heightmap.rs @@ -0,0 +1,249 @@ +//! Packed column heights and the six Java 26.3 heightmap predicates. +//! +//! Block behavior supplies air/fluid facts and resolved block-tag membership. +//! Heightmaps do not infer those facts from collision shapes or block names. +use horizon_core::storage::{PackedStorage, StorageError}; + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[repr(u8)] +pub enum HeightmapType { + WorldSurfaceWg, + WorldSurface, + OceanFloorWg, + OceanFloor, + MotionBlocking, + MotionBlockingNoLeaves, +} + +impl HeightmapType { + pub const ALL: [Self; 6] = [ + Self::WorldSurfaceWg, + Self::WorldSurface, + Self::OceanFloorWg, + Self::OceanFloor, + Self::MotionBlocking, + Self::MotionBlockingNoLeaves, + ]; + + pub fn name(self) -> &'static str { + match self { + Self::WorldSurfaceWg => "WORLD_SURFACE_WG", + Self::WorldSurface => "WORLD_SURFACE", + Self::OceanFloorWg => "OCEAN_FLOOR_WG", + Self::OceanFloor => "OCEAN_FLOOR", + Self::MotionBlocking => "MOTION_BLOCKING", + Self::MotionBlockingNoLeaves => "MOTION_BLOCKING_NO_LEAVES", + } + } + + pub fn send_to_client(self) -> bool { + matches!( + self, + Self::WorldSurface | Self::MotionBlocking | Self::MotionBlockingNoLeaves + ) + } + + pub fn keep_after_worldgen(self) -> bool { + !matches!(self, Self::WorldSurfaceWg | Self::OceanFloorWg) + } + + pub fn is_opaque(self, state: impl HeightmapState) -> bool { + match self { + Self::WorldSurfaceWg | Self::WorldSurface => !state.is_air(), + Self::OceanFloorWg | Self::OceanFloor => state.blocks_motion_in_heightmap(), + Self::MotionBlocking => state.blocks_motion_in_heightmap() || state.has_fluid(), + Self::MotionBlockingNoLeaves => { + state.blocks_motion_in_heightmap_no_leaves() || state.has_fluid() + } + } + } +} + +pub trait HeightmapState: Copy { + fn is_air(self) -> bool; + /// Exact AIR block identity, distinct from cave/void air. + fn is_air_block(self) -> bool; + fn has_fluid(self) -> bool; + fn blocks_motion_in_heightmap(self) -> bool; + fn blocks_motion_in_heightmap_no_leaves(self) -> bool; +} + +pub trait HeightmapChunk { + type State: HeightmapState; + fn min_y(&self) -> i32; + fn height(&self) -> i32; + fn highest_section_y(&self) -> i32; + fn block_state(&self, x: i32, y: i32, z: i32) -> Self::State; +} + +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum HeightmapError { + InvalidBounds, + MismatchedChunk, + Storage(StorageError), +} +impl From for HeightmapError { + fn from(value: StorageError) -> Self { + Self::Storage(value) + } +} +impl std::fmt::Display for HeightmapError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{self:?}") + } +} +impl std::error::Error for HeightmapError {} + +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct Heightmap { + kind: HeightmapType, + min_y: i32, + height: i32, + data: PackedStorage, +} + +impl Heightmap { + /// Bounded to the vanilla codec's positive, aligned vertical ranges. + pub fn new(kind: HeightmapType, min_y: i32, height: i32) -> Result { + if !(-2032..=2031).contains(&min_y) + || !(16..=4064).contains(&height) + || min_y % 16 != 0 + || height % 16 != 0 + || min_y + height > 2032 + { + return Err(HeightmapError::InvalidBounds); + } + let bits = (32 - (height as u32).leading_zeros()) as u8; + Ok(Self { + kind, + min_y, + height, + data: PackedStorage::new(bits, 256)?, + }) + } + + pub fn kind(&self) -> HeightmapType { + self.kind + } + pub fn raw_data(&self) -> &[u64] { + self.data.words() + } + + fn index(x: i32, z: i32) -> usize { + x.wrapping_add(z.wrapping_mul(16)) as usize + } + + pub fn first_available(&self, x: i32, z: i32) -> Result { + Ok((self.data.get(Self::index(x, z))? as i32).wrapping_add(self.min_y)) + } + + pub fn highest_taken(&self, x: i32, z: i32) -> Result { + Ok(self.first_available(x, z)?.wrapping_sub(1)) + } + + fn set_height(&mut self, x: i32, z: i32, y: i32) -> Result<(), HeightmapError> { + self.data + .set(Self::index(x, z), y.wrapping_sub(self.min_y) as u32)?; + Ok(()) + } + + fn check_chunk(&self, chunk: &impl HeightmapChunk) -> Result<(), HeightmapError> { + if chunk.min_y() != self.min_y || chunk.height() != self.height { + return Err(HeightmapError::MismatchedChunk); + } + Ok(()) + } + + /// The caller writes the new state to the chunk before updating its maps. + pub fn update( + &mut self, + chunk: &C, + x: i32, + y: i32, + z: i32, + state: C::State, + ) -> Result { + self.check_chunk(chunk)?; + let first = self.first_available(x, z)?; + if y <= first.wrapping_sub(2) { + return Ok(false); + } + if self.kind.is_opaque(state) { + if y >= first { + self.set_height(x, z, y.wrapping_add(1))?; + return Ok(true); + } + } else if y == first.wrapping_sub(1) { + let mut scan_y = y.wrapping_sub(1); + while scan_y >= self.min_y { + if self.kind.is_opaque(chunk.block_state(x, scan_y, z)) { + self.set_height(x, z, scan_y.wrapping_add(1))?; + return Ok(true); + } + scan_y -= 1; + } + self.set_height(x, z, self.min_y)?; + return Ok(true); + } + Ok(false) + } + + /// Matching lengths preserve all bits, including padding and unused slots. + /// A length mismatch primes this registered map from the chunk instead. + pub fn set_raw_data( + &mut self, + chunk: &impl HeightmapChunk, + words: &[u64], + ) -> Result<(), HeightmapError> { + self.check_chunk(chunk)?; + if words.len() == self.data.words().len() { + self.data = PackedStorage::from_words(self.data.bits(), 256, words.to_vec())?; + Ok(()) + } else { + Self::prime(chunk, &mut [self]) + } + } + + /// Preserves caller map order and scans X, then Z, then descending Y. + /// An unfound column retains its previous value, including during re-priming. + pub fn prime( + chunk: &impl HeightmapChunk, + maps: &mut [&mut Self], + ) -> Result<(), HeightmapError> { + if maps.is_empty() { + return Ok(()); + } + for map in maps.iter() { + map.check_chunk(chunk)?; + } + let upper = chunk.highest_section_y().wrapping_add(16); + let mut remaining = Vec::with_capacity(maps.len()); + for x in 0..16 { + for z in 0..16 { + remaining.clear(); + remaining.extend(0..maps.len()); + let mut y = upper.wrapping_sub(1); + while y >= chunk.min_y() { + let state = chunk.block_state(x, y, z); + if !state.is_air_block() { + let mut i = 0; + while i < remaining.len() { + let map = &mut maps[remaining[i]]; + if map.kind.is_opaque(state) { + map.set_height(x, z, y.wrapping_add(1))?; + remaining.remove(i); + } else { + i += 1; + } + } + if remaining.is_empty() { + break; + } + } + y -= 1; + } + } + } + Ok(()) + } +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs new file mode 100644 index 000000000..f3cea7028 --- /dev/null +++ b/crates/horizon-world/src/lib.rs @@ -0,0 +1,22 @@ +//! Vanilla-compatible world data for Horizon. This crate does not run gameplay. +#![forbid(unsafe_code)] + +pub mod block_collision; +pub mod block_properties; +pub mod block_support; +pub mod block_survival; +pub mod chunk; +pub mod collision; +pub mod compression; +pub mod dynamic_support; +pub mod entity_obstruction; +pub mod fluid; +pub mod heightmap; +pub mod nbt; +pub mod piston_shape; +pub mod region; +pub mod registry; +pub mod tick_data; +pub mod worldgen; + +pub const DATA_VERSION: i32 = 5023; diff --git a/crates/horizon-world/src/main.rs b/crates/horizon-world/src/main.rs new file mode 100644 index 000000000..ff61c99dd --- /dev/null +++ b/crates/horizon-world/src/main.rs @@ -0,0 +1,197 @@ +use horizon_core::position::BlockPos; +use horizon_world::{ + chunk::{BlockState, ChunkData}, + compression::Compression, + nbt::{self, Limits}, + region::{ChunkRecord, RegionFile, RegionWriter}, +}; +use std::{ + collections::BTreeMap, + error::Error, + fs::{File, OpenOptions}, + io::{Read, Write}, + path::Path, +}; + +fn codec(name: &str) -> Result> { + match name { + "gzip" | "1" => Ok(Compression::Gzip), + "zlib" | "2" => Ok(Compression::Zlib), + "none" | "3" => Ok(Compression::None), + "lz4" | "4" => Ok(Compression::Lz4), + _ => Err(format!("unknown codec {name}; choose gzip, zlib, none or lz4").into()), + } +} + +fn read_bounded(path: &str) -> Result, Box> { + let max = Limits::default().max_bytes; + let mut bytes = Vec::new(); + File::open(path)? + .take((max + 1) as u64) + .read_to_end(&mut bytes)?; + if bytes.len() > max { + return Err("input exceeds 64 MiB limit".into()); + } + Ok(bytes) +} + +fn write_new(path: &str, bytes: &[u8]) -> Result<(), Box> { + let mut file = OpenOptions::new().write(true).create_new(true).open(path)?; + if let Err(error) = file.write_all(bytes).and_then(|_| file.sync_all()) { + drop(file); + let _ = std::fs::remove_file(path); + return Err(error.into()); + } + Ok(()) +} + +fn run(args: &[String]) -> Result<(), Box> { + let Some(command) = args.first().map(String::as_str) else { + return Err("use --help for commands".into()); + }; + match command { + "--help" | "-h" if args.len() == 1 => println!( + "Horizon world data tools — Java Edition 26.3\n\ + inspect \n\ + copy-region [gzip|zlib|none|lz4]\n\ + get-block \n\ + edit-block-data [property=value ...]\n\ + nbt-copy \n\ + nbt-network-copy \n\ + Existing output files are refused. edit-block-data changes saved block data only;\n\ + it does not run lighting, heightmaps, ticks or neighbor updates." + ), + "nbt-copy" | "nbt-network-copy" if args.len() == 5 => { + let bytes = + codec(&args[3])?.decode(&read_bounded(&args[1])?, Limits::default().max_bytes)?; + let encoded = if command == "nbt-copy" { + let (root, used) = nbt::read_named(&bytes, Limits::default())?; + if used != bytes.len() { + return Err("trailing bytes after NBT root".into()); + } + nbt::write_named(&root, Limits::default())? + } else { + let (root, used) = nbt::read_network(&bytes, Limits::default())?; + if used != bytes.len() { + return Err("trailing bytes after NBT root".into()); + } + nbt::write_network(&root, Limits::default())? + }; + write_new(&args[2], &codec(&args[4])?.encode(&encoded)?)?; + println!("Wrote {}", args[2]); + } + "inspect" if args.len() == 2 => { + let mut region = RegionFile::open(&args[1])?; + let chunks: Vec<_> = region.chunks().collect(); + println!( + "Horizon region {},{}: {} chunks", + region.position().x, + region.position().z, + chunks.len() + ); + for (pos, timestamp) in chunks { + let record = region.read(pos)?.unwrap(); + let root = record.nbt(Limits::default())?; + println!( + "chunk {},{} timestamp={} codec={:?} compressed={} root_type={}", + pos.x, + pos.z, + timestamp, + record.compression, + record.compressed.len(), + root.tag.id() + ); + } + } + "copy-region" if args.len() == 3 || args.len() == 4 => { + let mut region = RegionFile::open(&args[1])?; + if args.len() == 3 { + region.export(&args[2], &[])?; + } else { + let compression = codec(&args[3])?; + if horizon_world::region::position_from_path(Path::new(&args[2]))? + != region.position() + { + return Err("export region coordinates differ".into()); + } + let mut writer = RegionWriter::create(&args[2])?; + let positions: Vec<_> = region.chunks().map(|(p, _)| p).collect(); + for pos in positions { + let old = region.read(pos)?.unwrap(); + let record = ChunkRecord::from_nbt( + &old.nbt(Limits::default())?, + compression, + old.timestamp, + Limits::default(), + )?; + writer.write(pos, &record)?; + } + writer.finish()?; + } + println!("Wrote {}", args[2]); + } + "get-block" if args.len() == 5 => { + let block = BlockPos::new(args[2].parse()?, args[3].parse()?, args[4].parse()?); + let record = RegionFile::open(&args[1])? + .read(block.chunk())? + .ok_or("chunk is absent")?; + let chunk = ChunkData::new(record.nbt(Limits::default())?)?; + let state = chunk + .block(block)? + .ok_or("section has no block-state data")?; + print!("{}", state.name); + for (name, value) in state.properties { + print!(" {name}={value}"); + } + println!(); + } + "edit-block-data" if args.len() >= 7 => { + let block = BlockPos::new(args[3].parse()?, args[4].parse()?, args[5].parse()?); + let mut properties = BTreeMap::new(); + for arg in &args[7..] { + let (key, value) = arg.split_once('=').ok_or("expected property=value")?; + if key.is_empty() + || value.is_empty() + || properties + .insert(key.to_owned(), value.to_owned()) + .is_some() + { + return Err("invalid or duplicate block property".into()); + } + } + let mut region = RegionFile::open(&args[1])?; + let old = region.read(block.chunk())?.ok_or("chunk is absent")?; + let mut chunk = ChunkData::new(old.nbt(Limits::default())?)?; + chunk.set_block_data( + block, + BlockState { + name: args[6].clone(), + properties, + }, + )?; + let timestamp = std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH)? + .as_secs() as u32; + let next = ChunkRecord::from_nbt( + &chunk.into_nbt(), + old.compression, + timestamp, + Limits::default(), + )?; + region.export(&args[2], &[(block.chunk(), Some(next))])?; + println!( + "Wrote saved block data to {}; simulation-derived data has not been updated.", + args[2] + ); + } + _ => return Err("invalid command or arguments; use --help".into()), + } + Ok(()) +} + +fn main() { + if let Err(error) = run(&std::env::args().skip(1).collect::>()) { + eprintln!("Horizon: {error}"); + std::process::exit(2); + } +} diff --git a/crates/horizon-world/src/nbt.rs b/crates/horizon-world/src/nbt.rs new file mode 100644 index 000000000..b271c6567 --- /dev/null +++ b/crates/horizon-world/src/nbt.rs @@ -0,0 +1,606 @@ +//! Java Edition NBT with lossless UTF-16 strings and 26.3 mixed-list wrappers. +use std::collections::BTreeMap; + +/// Java strings can contain unpaired surrogates, which Rust UTF-8 strings cannot. +#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct JavaString(pub Vec); + +impl From<&str> for JavaString { + fn from(value: &str) -> Self { + Self(value.encode_utf16().collect()) + } +} +impl JavaString { + pub fn to_string(&self) -> Result { + String::from_utf16(&self.0) + } + pub fn to_string_lossy(&self) -> String { + String::from_utf16_lossy(&self.0) + } +} + +pub type Compound = BTreeMap; + +/// Float and double variants hold their IEEE bit patterns. Java canonicalizes +/// NaNs on binary output. Loading, like vanilla's valueOf factories, normalizes +/// negative zero to positive zero. +#[derive(Clone, Debug, PartialEq, Eq)] +pub enum Tag { + End, + Byte(i8), + Short(i16), + Int(i32), + Long(i64), + Float(u32), + Double(u64), + ByteArray(Vec), + String(JavaString), + List(Vec), + Compound(Compound), + IntArray(Vec), + LongArray(Vec), +} + +impl Tag { + pub fn id(&self) -> u8 { + match self { + Self::End => 0, + Self::Byte(_) => 1, + Self::Short(_) => 2, + Self::Int(_) => 3, + Self::Long(_) => 4, + Self::Float(_) => 5, + Self::Double(_) => 6, + Self::ByteArray(_) => 7, + Self::String(_) => 8, + Self::List(_) => 9, + Self::Compound(_) => 10, + Self::IntArray(_) => 11, + Self::LongArray(_) => 12, + } + } + pub fn get(&self, key: &str) -> Option<&Tag> { + match self { + Self::Compound(map) => map.get(&JavaString::from(key)), + _ => None, + } + } + pub fn get_mut(&mut self, key: &str) -> Option<&mut Tag> { + match self { + Self::Compound(map) => map.get_mut(&JavaString::from(key)), + _ => None, + } + } + pub fn compound(entries: impl IntoIterator, Tag)>) -> Self { + Self::Compound(entries.into_iter().map(|(k, v)| (k.into(), v)).collect()) + } +} + +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct NamedTag { + pub name: JavaString, + pub tag: Tag, +} + +#[derive(Clone, Copy, Debug)] +pub struct Limits { + pub max_bytes: usize, + pub max_nodes: usize, + pub max_depth: usize, +} +impl Default for Limits { + fn default() -> Self { + Self { + max_bytes: 64 * 1024 * 1024, + max_nodes: 1_000_000, + max_depth: 512, + } + } +} + +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct Error { + pub offset: usize, + pub reason: &'static str, +} +impl std::fmt::Display for Error { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "NBT at byte {}: {}", self.offset, self.reason) + } +} +impl std::error::Error for Error {} + +struct Reader<'a> { + bytes: &'a [u8], + offset: usize, + limits: Limits, + nodes: usize, +} +impl<'a> Reader<'a> { + fn error(&self, reason: &'static str) -> Error { + Error { + offset: self.offset, + reason, + } + } + fn take(&mut self, len: usize) -> Result<&'a [u8], Error> { + let end = self + .offset + .checked_add(len) + .ok_or_else(|| self.error("length overflow"))?; + if end > self.limits.max_bytes { + return Err(self.error("byte limit exceeded")); + } + let value = self + .bytes + .get(self.offset..end) + .ok_or_else(|| self.error("truncated input"))?; + self.offset = end; + Ok(value) + } + fn number(&mut self) -> Result<[u8; N], Error> { + Ok(self.take(N)?.try_into().unwrap()) + } + fn byte(&mut self) -> Result { + Ok(self.take(1)?[0]) + } + fn count(&mut self, element_bytes: usize) -> Result { + let count = i32::from_be_bytes(self.number()?); + if count < 0 { + return Err(self.error("negative collection length")); + } + let count = count as usize; + let size = count + .checked_mul(element_bytes) + .ok_or_else(|| self.error("length overflow"))?; + if size > self.bytes.len().saturating_sub(self.offset) + || size > self.limits.max_bytes.saturating_sub(self.offset) + { + return Err(self.error("collection exceeds available bytes")); + } + Ok(count) + } + fn string(&mut self) -> Result { + let len = u16::from_be_bytes(self.number()?) as usize; + let bytes = self.take(len)?; + let mut units = Vec::with_capacity(len); + let mut i = 0; + while i < bytes.len() { + let b = bytes[i]; + let (unit, size) = match b { + 0..=127 => (u16::from(b), 1), + 192..=223 if i + 1 < len && bytes[i + 1] & 0xc0 == 0x80 => { + ((u16::from(b & 31) << 6) | u16::from(bytes[i + 1] & 63), 2) + } + 224..=239 + if i + 2 < len + && bytes[i + 1] & 0xc0 == 0x80 + && bytes[i + 2] & 0xc0 == 0x80 => + { + ( + (u16::from(b & 15) << 12) + | (u16::from(bytes[i + 1] & 63) << 6) + | u16::from(bytes[i + 2] & 63), + 3, + ) + } + _ => return Err(self.error("invalid Java modified UTF-8")), + }; + // Match DataInput.readUTF, including accepted overlong sequences. + units.push(unit); + i += size; + } + Ok(JavaString(units)) + } + fn payload(&mut self, id: u8, depth: usize) -> Result { + if self.nodes >= self.limits.max_nodes { + return Err(self.error("node limit exceeded")); + } + self.nodes += 1; + if matches!(id, 9 | 10) && depth >= self.limits.max_depth { + return Err(self.error("depth limit exceeded")); + } + Ok(match id { + 0 => Tag::End, + 1 => Tag::Byte(self.byte()? as i8), + 2 => Tag::Short(i16::from_be_bytes(self.number()?)), + 3 => Tag::Int(i32::from_be_bytes(self.number()?)), + 4 => Tag::Long(i64::from_be_bytes(self.number()?)), + 5 => { + let bits = u32::from_be_bytes(self.number()?); + Tag::Float(if f32::from_bits(bits) == 0.0 { 0 } else { bits }) + } + 6 => { + let bits = u64::from_be_bytes(self.number()?); + Tag::Double(if f64::from_bits(bits) == 0.0 { 0 } else { bits }) + } + 7 => { + let len = self.count(1)?; + Tag::ByteArray(self.take(len)?.to_vec()) + } + 8 => Tag::String(self.string()?), + 9 => { + let element_id = self.byte()?; + let len = self.count(0)?; + if len > 0 && (element_id == 0 || element_id > 12) { + return Err(self.error("invalid list element type")); + } + if len > self.limits.max_nodes.saturating_sub(self.nodes) { + return Err(self.error("node limit exceeded")); + } + // At least one byte per valid non-End payload; do not allocate from an unchecked count. + if len > self.bytes.len().saturating_sub(self.offset) { + return Err(self.error("truncated list")); + } + let mut values = Vec::with_capacity(len); + for _ in 0..len { + let mut value = self.payload(element_id, depth + 1)?; + if let Tag::Compound(map) = &mut value { + if map.len() == 1 && map.contains_key(&JavaString::default()) { + value = map.remove(&JavaString::default()).unwrap(); + } + } + values.push(value); + } + Tag::List(values) + } + 10 => { + let mut map = Compound::new(); + loop { + let id = self.byte()?; + if id == 0 { + break; + } + let name = self.string()?; + let value = self.payload(id, depth + 1)?; + map.insert(name, value); // Java maps retain the last duplicate key. + } + Tag::Compound(map) + } + 11 => { + let len = self.count(4)?; + let mut values = Vec::with_capacity(len); + for _ in 0..len { + values.push(i32::from_be_bytes(self.number()?)); + } + Tag::IntArray(values) + } + 12 => { + let len = self.count(8)?; + let mut values = Vec::with_capacity(len); + for _ in 0..len { + values.push(i64::from_be_bytes(self.number()?)); + } + Tag::LongArray(values) + } + _ => return Err(self.error("unknown tag type")), + }) + } +} + +/// Read a file root (type, modified-UTF name, payload), returning bytes consumed. +pub fn read_named(bytes: &[u8], limits: Limits) -> Result<(NamedTag, usize), Error> { + let mut reader = Reader { + bytes, + offset: 0, + limits, + nodes: 0, + }; + let id = reader.byte()?; + let name = if id == 0 { + JavaString::default() + } else { + reader.string()? + }; + let tag = reader.payload(id, 0)?; + Ok((NamedTag { name, tag }, reader.offset)) +} + +/// Read a network root (type and payload, without the file name field). +pub fn read_network(bytes: &[u8], limits: Limits) -> Result<(Tag, usize), Error> { + let mut reader = Reader { + bytes, + offset: 0, + limits, + nodes: 0, + }; + let id = reader.byte()?; + let tag = reader.payload(id, 0)?; + Ok((tag, reader.offset)) +} + +struct Writer { + bytes: Vec, + limits: Limits, + nodes: usize, +} +impl Writer { + fn error(&self, reason: &'static str) -> Error { + Error { + offset: self.bytes.len(), + reason, + } + } + fn put(&mut self, bytes: &[u8]) -> Result<(), Error> { + if bytes.len() > self.limits.max_bytes.saturating_sub(self.bytes.len()) { + return Err(self.error("byte limit exceeded")); + } + self.bytes.extend_from_slice(bytes); + Ok(()) + } + fn count(&mut self, len: usize) -> Result<(), Error> { + let len = i32::try_from(len).map_err(|_| self.error("collection too long"))?; + self.put(&len.to_be_bytes()) + } + fn string(&mut self, string: &JavaString) -> Result<(), Error> { + let len: usize = string + .0 + .iter() + .map(|&c| match c { + 1..=127 => 1, + 0..=2047 => 2, + _ => 3, + }) + .sum(); + let len = + u16::try_from(len).map_err(|_| self.error("modified UTF-8 exceeds 65535 bytes"))?; + self.put(&len.to_be_bytes())?; + for &c in &string.0 { + match c { + 1..=127 => self.put(&[c as u8])?, + 0..=2047 => self.put(&[0xc0 | (c >> 6) as u8, 0x80 | (c & 63) as u8])?, + _ => self.put(&[ + 0xe0 | (c >> 12) as u8, + 0x80 | ((c >> 6) & 63) as u8, + 0x80 | (c & 63) as u8, + ])?, + } + } + Ok(()) + } + fn payload(&mut self, tag: &Tag, depth: usize) -> Result<(), Error> { + if self.nodes >= self.limits.max_nodes { + return Err(self.error("node limit exceeded")); + } + self.nodes += 1; + if matches!(tag, Tag::List(_) | Tag::Compound(_)) && depth >= self.limits.max_depth { + return Err(self.error("depth limit exceeded")); + } + match tag { + Tag::End => {} + Tag::Byte(v) => self.put(&[*v as u8])?, + Tag::Short(v) => self.put(&v.to_be_bytes())?, + Tag::Int(v) => self.put(&v.to_be_bytes())?, + Tag::Long(v) => self.put(&v.to_be_bytes())?, + Tag::Float(v) => self.put( + &if f32::from_bits(*v).is_nan() { + 0x7fc0_0000_u32 + } else { + *v + } + .to_be_bytes(), + )?, + Tag::Double(v) => self.put( + &if f64::from_bits(*v).is_nan() { + 0x7ff8_0000_0000_0000_u64 + } else { + *v + } + .to_be_bytes(), + )?, + Tag::ByteArray(v) => { + self.count(v.len())?; + self.put(v)?; + } + Tag::String(v) => self.string(v)?, + Tag::List(values) => { + if values.iter().any(|v| matches!(v, Tag::End)) { + return Err(self.error("End cannot be a list element")); + } + let first = values.first().map_or(0, Tag::id); + let id = if values.iter().any(|v| v.id() != first) { + 10 + } else { + first + }; + self.put(&[id])?; + self.count(values.len())?; + for value in values { + let wrapper = matches!(value, Tag::Compound(c) if c.len() == 1 && c.contains_key(&JavaString::default())); + if id == 10 && (value.id() != 10 || wrapper) { + // Emit one synthetic compound layer without cloning the tree. + if depth + 1 >= self.limits.max_depth { + return Err(self.error("depth limit exceeded")); + } + if self.nodes >= self.limits.max_nodes { + return Err(self.error("node limit exceeded")); + } + self.nodes += 1; + self.put(&[value.id()])?; + self.string(&JavaString::default())?; + self.payload(value, depth + 2)?; + self.put(&[0])?; + } else { + self.payload(value, depth + 1)?; + } + } + } + Tag::Compound(values) => { + for (name, value) in values { + if matches!(value, Tag::End) { + return Err(self.error("End cannot be a named value")); + } + self.put(&[value.id()])?; + self.string(name)?; + self.payload(value, depth + 1)?; + } + self.put(&[0])?; + } + Tag::IntArray(v) => { + self.count(v.len())?; + for item in v { + self.put(&item.to_be_bytes())?; + } + } + Tag::LongArray(v) => { + self.count(v.len())?; + for item in v { + self.put(&item.to_be_bytes())?; + } + } + } + Ok(()) + } +} + +pub fn write_named(root: &NamedTag, limits: Limits) -> Result, Error> { + let mut writer = Writer { + bytes: Vec::new(), + limits, + nodes: 0, + }; + writer.put(&[root.tag.id()])?; + if root.tag.id() != 0 { + writer.string(&root.name)?; + } + writer.payload(&root.tag, 0)?; + Ok(writer.bytes) +} + +pub fn write_network(tag: &Tag, limits: Limits) -> Result, Error> { + let mut writer = Writer { + bytes: Vec::new(), + limits, + nodes: 0, + }; + writer.put(&[tag.id()])?; + writer.payload(tag, 0)?; + Ok(writer.bytes) +} + +#[cfg(test)] +mod tests { + use super::*; + #[test] + fn wire_node_budget_includes_mixed_list_wrappers() { + let tag = Tag::List(vec![Tag::Int(1), Tag::Byte(2)]); + let limits = Limits { + max_nodes: 5, + ..Limits::default() + }; + let bytes = write_network(&tag, limits).unwrap(); + assert_eq!(read_network(&bytes, limits).unwrap().0, tag); + let limits = Limits { + max_nodes: 4, + ..limits + }; + assert!(write_network(&tag, limits).is_err()); + assert!(read_network(&bytes, limits).is_err()); + } + #[test] + fn depth_boundary_and_every_truncated_prefix() { + let mut tag = Tag::Int(1); + for _ in 0..512 { + tag = Tag::List(vec![tag]); + } + let bytes = write_network(&tag, Limits::default()).unwrap(); + assert_eq!(read_network(&bytes, Limits::default()).unwrap().0, tag); + tag = Tag::List(vec![tag]); + assert!(write_network(&tag, Limits::default()).is_err()); + let deeper = write_network( + &tag, + Limits { + max_depth: 513, + ..Limits::default() + }, + ) + .unwrap(); + assert!(read_network(&deeper, Limits::default()).is_err()); + let short = Tag::compound([( + "list", + Tag::List(vec![Tag::Long(42), Tag::ByteArray(vec![1, 2, 3])]), + )]); + let bytes = write_network(&short, Limits::default()).unwrap(); + for end in 0..bytes.len() { + assert!(read_network(&bytes[..end], Limits::default()).is_err()); + } + } + #[test] + fn modified_utf_and_mixed_lists_preserve_java_values() { + let tag = Tag::List(vec![ + Tag::Int(3), + Tag::String(JavaString(vec![0, 0xd800, 0xdc00, 0xdfff])), + Tag::compound([("", Tag::Int(9))]), + Tag::compound([("x", Tag::Byte(1))]), + ]); + let data = write_network(&tag, Limits::default()).unwrap(); + assert_eq!(data[1], 10); + assert_eq!( + read_network(&data, Limits::default()).unwrap(), + (tag, data.len()) + ); + } + #[test] + fn malformed_lengths_truncation_limits_and_utf_are_rejected() { + for data in [ + &[7, 0xff, 0xff, 0xff, 0xff][..], + &[9, 0, 0, 0, 0, 1], + &[8, 0, 1, 0xc0], + &[13], + &[4, 0], + ] { + assert!(read_network(data, Limits::default()).is_err()); + } + let tag = Tag::List(vec![Tag::List(vec![Tag::Int(1)])]); + let bytes = write_network(&tag, Limits::default()).unwrap(); + assert!( + read_network( + &bytes, + Limits { + max_depth: 1, + ..Limits::default() + } + ) + .is_err() + ); + assert!( + read_network( + &bytes, + Limits { + max_nodes: 2, + ..Limits::default() + } + ) + .is_err() + ); + assert!( + read_network( + &bytes, + Limits { + max_bytes: bytes.len() - 1, + ..Limits::default() + } + ) + .is_err() + ); + assert!( + write_network(&Tag::String(JavaString(vec![0; 32768])), Limits::default()).is_err() + ); + } + #[test] + fn duplicate_keys_last_wins_and_nan_output_is_canonical() { + let bytes = [10, 1, 0, 1, b'x', 1, 1, 0, 1, b'x', 2, 0]; + assert_eq!( + read_network(&bytes, Limits::default()).unwrap().0.get("x"), + Some(&Tag::Byte(2)) + ); + assert_eq!( + write_network(&Tag::Float(0xff80_0001), Limits::default()).unwrap(), + [5, 0x7f, 0xc0, 0, 0] + ); + assert_eq!( + write_network(&Tag::Double((-0.0_f64).to_bits()), Limits::default()).unwrap()[1], + 0x80 + ); + } +} diff --git a/crates/horizon-world/src/piston_shape.rs b/crates/horizon-world/src/piston_shape.rs new file mode 100644 index 000000000..d14f8f301 --- /dev/null +++ b/crates/horizon-world/src/piston_shape.rs @@ -0,0 +1,196 @@ +//! Moving-piston collision selection and interpolation over immutable state IDs. +//! Tick progression, entity pushing and world mutation belong to the world loop. +use crate::{ + compression::invalid, + registry::{BlockRegistry, BlockStateId}, +}; +use horizon_core::geometry::{Direction, ShapeError, ShapeOp, Vec3, VoxelShape}; +use std::{collections::BTreeMap, io}; +#[derive(Clone, Copy, Debug)] +pub struct MovingPistonState { + pub moved_state: BlockStateId, + pub direction: Direction, + pub extending: bool, + pub source: bool, + pub progress: f32, + pub previous_progress: f32, +} +impl MovingPistonState { + pub fn movement_direction(self) -> Direction { + if self.extending { + self.direction + } else { + self.direction.opposite() + } + } + pub fn interpolated_progress(self, partial: f32) -> f32 { + let partial = if partial > 1.0 { 1.0 } else { partial }; + self.previous_progress + partial * (self.progress - self.previous_progress) + } + pub fn interpolated_offset(self, partial: f32) -> [f32; 3] { + self.offset(self.interpolated_progress(partial)) + } + fn offset(self, progress: f32) -> [f32; 3] { + let extended = if self.extending { + progress - 1.0 + } else { + 1.0 - progress + }; + self.direction.normal().map(|step| step as f32 * extended) + } +} +pub trait PistonCollisionWorld { + type Error; + /// The no-entity-context BlockState collision query at the supplied position. + fn collision_shape( + &mut self, + state: BlockStateId, + position: [i32; 3], + ) -> Result; +} +#[derive(Debug)] +pub enum PistonShapeError { + World(E), + Shape(ShapeError), + Registry(io::Error), +} +impl std::fmt::Display for PistonShapeError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::World(e) => e.fmt(f), + Self::Shape(e) => e.fmt(f), + Self::Registry(e) => e.fmt(f), + } + } +} +impl std::error::Error for PistonShapeError {} +struct Base { + extended: BlockStateId, + facing: Direction, + sticky: bool, +} +pub struct PistonBlockBindings<'r> { + registry: &'r BlockRegistry, + bases: BTreeMap, + heads: [[[BlockStateId; 2]; 6]; 2], +} +const DIRECTION_NAMES: [&str; 6] = ["down", "up", "north", "south", "west", "east"]; +impl<'r> PistonBlockBindings<'r> { + pub fn new(registry: &'r BlockRegistry) -> io::Result { + let mut bases = BTreeMap::new(); + for id in 0..registry.len() { + let id = BlockStateId(id as u32); + let state = registry.state(id).unwrap(); + if !matches!( + state.name.as_str(), + "minecraft:piston" | "minecraft:sticky_piston" + ) { + continue; + } + let facing = state + .properties + .get("facing") + .and_then(|name| DIRECTION_NAMES.iter().position(|v| v == name)) + .ok_or_else(|| invalid("invalid piston facing"))?; + let mut extended = state.clone(); + extended.properties.insert("extended".into(), "true".into()); + bases.insert( + id, + Base { + extended: registry + .id(&extended) + .ok_or_else(|| invalid("missing extended piston state"))?, + facing: Direction::ALL[facing], + sticky: state.name == "minecraft:sticky_piston", + }, + ); + } + let default = registry + .default_state("minecraft:piston_head") + .and_then(|id| registry.state(id)) + .ok_or_else(|| invalid("missing piston head"))?; + let mut heads = [[[BlockStateId(0); 2]; 6]; 2]; + for (kind, type_heads) in heads.iter_mut().enumerate() { + for (direction, variants) in type_heads.iter_mut().enumerate() { + for (short, id) in variants.iter_mut().enumerate() { + let mut state = default.clone(); + state.properties.insert( + "type".into(), + if kind == 0 { "normal" } else { "sticky" }.into(), + ); + state + .properties + .insert("facing".into(), DIRECTION_NAMES[direction].into()); + state + .properties + .insert("short".into(), (short != 0).to_string()); + *id = registry + .id(&state) + .ok_or_else(|| invalid("missing piston head variant"))?; + } + } + } + Ok(Self { + registry, + bases, + heads, + }) + } + fn validate(&self, state: BlockStateId) -> io::Result<()> { + if self.registry.state(state).is_none() { + Err(invalid("piston moved state outside registry")) + } else { + Ok(()) + } + } + /// The collision-related state used by the native entity-pushing path. + /// Its sticky/short/facing rules differ from the entity's own collision head. + pub fn collision_related_state(&self, piston: MovingPistonState) -> io::Result { + self.validate(piston.moved_state)?; + if !piston.extending && piston.source { + if let Some(base) = self.bases.get(&piston.moved_state) { + return Ok(self.heads[usize::from(base.sticky)][base.facing as usize] + [usize::from(piston.progress > 0.25)]); + } + } + Ok(piston.moved_state) + } + pub fn collision_shape( + &self, + world: &mut W, + position: [i32; 3], + piston: MovingPistonState, + noclip: Option, + ) -> Result> { + self.validate(piston.moved_state) + .map_err(PistonShapeError::Registry)?; + let base = if !piston.extending && piston.source { + if let Some(base) = self.bases.get(&piston.moved_state) { + world + .collision_shape(base.extended, position) + .map_err(PistonShapeError::World)? + } else { + VoxelShape::empty() + } + } else { + VoxelShape::empty() + }; + // The stationary base is queried before this native noclip shortcut. + if piston.progress < 1.0 && noclip == Some(piston.movement_direction()) { + return Ok(base); + } + let state = if piston.source { + let short = piston.extending != (1.0f32 - piston.progress < 0.25f32); + self.heads[0][piston.direction as usize][usize::from(short)] + } else { + piston.moved_state + }; + let offset = piston.offset(piston.progress).map(f64::from); + let moving = world + .collision_shape(state, position) + .map_err(PistonShapeError::World)? + .moved(Vec3::new(offset[0], offset[1], offset[2])); + base.join(&moving, ShapeOp::OR) + .map_err(PistonShapeError::Shape) + } +} diff --git a/crates/horizon-world/src/region.rs b/crates/horizon-world/src/region.rs new file mode 100644 index 000000000..48b6e132e --- /dev/null +++ b/crates/horizon-world/src/region.rs @@ -0,0 +1,376 @@ +//! Anvil region reading and export to a new region. Existing files are never +//! overwritten. Use a separate directory for offline edits and copied .mcc data. +use crate::{ + compression::{Compression, invalid}, + nbt::{self, Limits, NamedTag}, +}; +use horizon_core::position::ChunkPos; +use std::{ + fs::{self, File, OpenOptions}, + io::{self, Read, Seek, SeekFrom, Write}, + path::{Path, PathBuf}, + sync::atomic::{AtomicU64, Ordering}, +}; + +const SECTOR: usize = 4096; +const HEADER: usize = SECTOR * 2; +const MAX_COMPRESSED: usize = 64 * 1024 * 1024; + +#[derive(Clone, Debug)] +pub struct ChunkRecord { + pub compression: Compression, + pub compressed: Vec, + pub timestamp: u32, +} +impl ChunkRecord { + pub fn from_nbt( + root: &NamedTag, + compression: Compression, + timestamp: u32, + limits: Limits, + ) -> io::Result { + let bytes = nbt::write_named(root, limits).map_err(|e| invalid(e.to_string()))?; + Ok(Self { + compression, + compressed: compression.encode(&bytes)?, + timestamp, + }) + } + pub fn nbt(&self, limits: Limits) -> io::Result { + let bytes = self + .compression + .decode(&self.compressed, limits.max_bytes)?; + let (root, used) = nbt::read_named(&bytes, limits).map_err(|e| invalid(e.to_string()))?; + if used != bytes.len() { + return Err(invalid("trailing bytes after region chunk NBT")); + } + Ok(root) + } +} + +pub struct RegionFile { + file: File, + path: PathBuf, + position: ChunkPos, + offsets: [u32; 1024], + timestamps: [u32; 1024], +} + +pub fn position_from_path(path: &Path) -> io::Result { + let name = path + .file_name() + .and_then(|s| s.to_str()) + .ok_or_else(|| invalid("invalid region filename"))?; + let parts: Vec<_> = name.split('.').collect(); + if parts.len() != 4 || parts[0] != "r" || parts[3] != "mca" { + return Err(invalid("expected r...mca")); + } + let x: i32 = parts[1] + .parse() + .map_err(|_| invalid("invalid region x coordinate"))?; + let z: i32 = parts[2] + .parse() + .map_err(|_| invalid("invalid region z coordinate"))?; + // Regions outside this range cannot be addressed with signed chunk coordinates. + if !(-67_108_864..=67_108_863).contains(&x) || !(-67_108_864..=67_108_863).contains(&z) { + return Err(invalid("region coordinate outside chunk coordinate range")); + } + Ok(ChunkPos::new(x, z)) +} + +fn slot(region: ChunkPos, chunk: ChunkPos) -> io::Result { + if chunk.region() != region { + return Err(invalid("chunk does not belong to this region")); + } + let (x, z) = chunk.region_local(); + Ok(usize::from(x) + usize::from(z) * 32) +} +fn position(region: ChunkPos, index: usize) -> ChunkPos { + ChunkPos::new( + region.x * 32 + (index % 32) as i32, + region.z * 32 + (index / 32) as i32, + ) +} +fn external_path(directory: &Path, chunk: ChunkPos) -> PathBuf { + directory.join(format!("c.{}.{}.mcc", chunk.x, chunk.z)) +} + +impl RegionFile { + pub fn position(&self) -> ChunkPos { + self.position + } + pub fn open(path: impl AsRef) -> io::Result { + let path = path.as_ref().to_owned(); + let position = position_from_path(&path)?; + let mut file = File::open(&path)?; + let len = file.metadata()?.len(); + if len < HEADER as u64 { + return Err(invalid("truncated region header")); + } + let mut header = [0; HEADER]; + file.read_exact(&mut header)?; + let mut offsets = [0; 1024]; + let mut timestamps = [0; 1024]; + let mut ranges = Vec::new(); + for i in 0..1024 { + offsets[i] = u32::from_be_bytes(header[i * 4..i * 4 + 4].try_into().unwrap()); + timestamps[i] = u32::from_be_bytes( + header[SECTOR + i * 4..SECTOR + i * 4 + 4] + .try_into() + .unwrap(), + ); + if offsets[i] == 0 { + continue; + } + let start = offsets[i] >> 8; + let count = offsets[i] & 255; + if start < 2 || count == 0 || u64::from(start + count) > len.div_ceil(SECTOR as u64) { + return Err(invalid(format!( + "invalid sector allocation at region slot {i}" + ))); + } + ranges.push((start, start + count)); + } + ranges.sort_unstable(); + if ranges.windows(2).any(|r| r[0].1 > r[1].0) { + return Err(invalid("overlapping region sector allocations")); + } + Ok(Self { + file, + path, + position, + offsets, + timestamps, + }) + } + + pub fn chunks(&self) -> impl Iterator + '_ { + self.offsets + .iter() + .enumerate() + .filter(|(_, value)| **value != 0) + .map(|(i, _)| (position(self.position, i), self.timestamps[i])) + } + + pub fn read(&mut self, chunk: ChunkPos) -> io::Result> { + let i = slot(self.position, chunk)?; + let offset = self.offsets[i]; + if offset == 0 { + return Ok(None); + } + self.file + .seek(SeekFrom::Start(u64::from(offset >> 8) * SECTOR as u64))?; + let mut header = [0; 5]; + self.file.read_exact(&mut header)?; + let len = u32::from_be_bytes(header[..4].try_into().unwrap()) as usize; + if len < 1 || len as u64 + 4 > (u64::from(offset & 255) * SECTOR as u64) { + return Err(invalid("invalid chunk payload length")); + } + let compression = Compression::try_from(header[4] & 127)?; + let compressed = if header[4] & 128 != 0 { + if len != 1 { + return Err(invalid("external chunk stub has inline data")); + } + let path = external_path(self.path.parent().unwrap_or(Path::new(".")), chunk); + let file = File::open(path)?; + let mut data = Vec::new(); + file.take((MAX_COMPRESSED + 1) as u64) + .read_to_end(&mut data)?; + if data.len() > MAX_COMPRESSED { + return Err(invalid("external chunk compressed limit exceeded")); + } + data + } else { + let mut data = vec![0; len - 1]; + self.file.read_exact(&mut data)?; + data + }; + Ok(Some(ChunkRecord { + compression, + compressed, + timestamp: self.timestamps[i], + })) + } + + /// Export all chunks, preserving untouched compressed bytes and timestamps. + /// Overrides are keyed by chunk position; None deletes a chunk in the export. + pub fn export( + &mut self, + destination: impl AsRef, + changes: &[(ChunkPos, Option)], + ) -> io::Result<()> { + let destination = destination.as_ref(); + if position_from_path(destination)? != self.position { + return Err(invalid("export region coordinates differ")); + } + let mut replacements = BTreeChanges::new(); + for (chunk, record) in changes { + let i = slot(self.position, *chunk)?; + if replacements.insert(i, record.as_ref()).is_some() { + return Err(invalid("duplicate chunk override")); + } + } + let mut writer = RegionWriter::create(destination)?; + for i in 0..1024 { + let chunk = position(self.position, i); + if let Some(record) = replacements.get(&i) { + if let Some(record) = record { + writer.write(chunk, record)?; + } + } else if let Some(record) = self.read(chunk)? { + writer.write(chunk, &record)?; + } + } + writer.finish() + } +} +type BTreeChanges<'a> = std::collections::BTreeMap>; + +static NEXT_TEMP: AtomicU64 = AtomicU64::new(0); + +/// Writes a complete new region to a temporary sibling, then publishes it with +/// an atomic, non-overwriting hard link. Drop rolls back unpublished files. +pub struct RegionWriter { + file: File, + temporary: PathBuf, + destination: PathBuf, + position: ChunkPos, + offsets: [u32; 1024], + timestamps: [u32; 1024], + next_sector: u32, + externals: Vec, + committed: bool, + failed: bool, +} +impl RegionWriter { + pub fn create(destination: impl AsRef) -> io::Result { + let destination = destination.as_ref().to_owned(); + let position = position_from_path(&destination)?; + if destination.try_exists()? { + return Err(io::Error::new( + io::ErrorKind::AlreadyExists, + "destination region already exists", + )); + } + let parent = destination + .parent() + .filter(|p| !p.as_os_str().is_empty()) + .unwrap_or(Path::new(".")); + fs::create_dir_all(parent)?; + let (temporary, file) = loop { + let path = parent.join(format!( + ".horizon-{}-{}.tmp", + std::process::id(), + NEXT_TEMP.fetch_add(1, Ordering::Relaxed) + )); + match OpenOptions::new() + .read(true) + .write(true) + .create_new(true) + .open(&path) + { + Ok(file) => break (path, file), + Err(e) if e.kind() == io::ErrorKind::AlreadyExists => continue, + Err(e) => return Err(e), + } + }; + let mut writer = Self { + file, + temporary, + destination, + position, + offsets: [0; 1024], + timestamps: [0; 1024], + next_sector: 2, + externals: Vec::new(), + committed: false, + failed: false, + }; + writer.file.write_all(&[0; HEADER])?; + Ok(writer) + } + + pub fn write(&mut self, chunk: ChunkPos, record: &ChunkRecord) -> io::Result<()> { + if self.failed { + return Err(invalid("region writer failed previously")); + } + let result = self.write_record(chunk, record); + if result.is_err() { + self.failed = true; + } + result + } + + fn write_record(&mut self, chunk: ChunkPos, record: &ChunkRecord) -> io::Result<()> { + let i = slot(self.position, chunk)?; + if self.offsets[i] != 0 { + return Err(invalid("chunk already written")); + } + if record.compressed.len() > MAX_COMPRESSED { + return Err(invalid("compressed chunk limit exceeded")); + } + let required = (record.compressed.len() + 5).div_ceil(SECTOR); + let external = required >= 256; + let sectors = if external { 1 } else { required as u32 }; + if self.next_sector + sectors > 0x100_0000 { + return Err(invalid("region sector address limit exceeded")); + } + if external { + let path = external_path(self.destination.parent().unwrap_or(Path::new(".")), chunk); + let mut file = OpenOptions::new() + .write(true) + .create_new(true) + .open(&path)?; + self.externals.push(path); + file.write_all(&record.compressed)?; + file.sync_all()?; + } + self.file + .seek(SeekFrom::Start(u64::from(self.next_sector) * SECTOR as u64))?; + let len = if external { + 1 + } else { + record.compressed.len() as u32 + 1 + }; + self.file.write_all(&len.to_be_bytes())?; + self.file + .write_all(&[record.compression as u8 | if external { 128 } else { 0 }])?; + if !external { + self.file.write_all(&record.compressed)?; + } + self.offsets[i] = self.next_sector << 8 | sectors; + self.timestamps[i] = record.timestamp; + self.next_sector += sectors; + Ok(()) + } + + pub fn finish(mut self) -> io::Result<()> { + if self.failed { + return Err(invalid("cannot publish a failed region writer")); + } + self.file + .set_len(u64::from(self.next_sector) * SECTOR as u64)?; + self.file.seek(SeekFrom::Start(0))?; + for value in self.offsets { + self.file.write_all(&value.to_be_bytes())?; + } + for value in self.timestamps { + self.file.write_all(&value.to_be_bytes())?; + } + self.file.sync_all()?; + // Hard-link publication fails atomically if another writer won the name. + fs::hard_link(&self.temporary, &self.destination)?; + self.committed = true; + Ok(()) + } +} +impl Drop for RegionWriter { + fn drop(&mut self) { + let _ = fs::remove_file(&self.temporary); + if !self.committed { + for path in &self.externals { + let _ = fs::remove_file(path); + } + } + } +} diff --git a/crates/horizon-world/src/registry.rs b/crates/horizon-world/src/registry.rs new file mode 100644 index 000000000..d5e4acce6 --- /dev/null +++ b/crates/horizon-world/src/registry.rs @@ -0,0 +1,106 @@ +//! Runtime block-state IDs imported from a version-pinned registry data export. +//! This supplies identities and default properties, not block behavior. +mod json; +use crate::{DATA_VERSION, chunk::BlockState, compression::invalid, nbt::Tag}; +pub use json::BlockStateJsonCodec; +use std::{ + collections::{BTreeMap, BTreeSet}, + io, +}; + +#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct BlockStateId(pub u32); + +pub struct BlockRegistry { + states: Vec, + ids: BTreeMap, + defaults: BTreeMap, +} +impl BlockRegistry { + pub fn from_nbt(tag: &Tag) -> io::Result { + if tag.get("DataVersion") != Some(&Tag::Int(DATA_VERSION)) { + return Err(invalid("block registry DataVersion mismatch")); + } + let Some(Tag::List(entries)) = tag.get("states") else { + return Err(invalid("missing registry states")); + }; + let Some(Tag::Compound(defaults)) = tag.get("defaults") else { + return Err(invalid("missing registry defaults")); + }; + if entries.is_empty() || entries.len() > i32::MAX as usize { + return Err(invalid("invalid registry size")); + } + let mut result = Self { + states: Vec::with_capacity(entries.len()), + ids: BTreeMap::new(), + defaults: BTreeMap::new(), + }; + for (i, entry) in entries.iter().enumerate() { + let state = BlockState::from_nbt(entry)?; + if result + .ids + .insert(state.clone(), BlockStateId(i as u32)) + .is_some() + { + return Err(invalid("duplicate block registry state")); + } + result.states.push(state); + } + for (name, id) in defaults { + let name = name.to_string().map_err(|e| invalid(e.to_string()))?; + let Tag::Int(id) = id else { + return Err(invalid("default state ID is not an int")); + }; + if *id < 0 + || result + .states + .get(*id as usize) + .is_none_or(|s| s.name != name) + { + return Err(invalid("invalid default block state ID")); + } + result.defaults.insert(name, BlockStateId(*id as u32)); + } + let names: BTreeSet<_> = result.states.iter().map(|s| &s.name).collect(); + if names.len() != result.defaults.len() + || names + .iter() + .any(|name| !result.defaults.contains_key(*name)) + { + return Err(invalid("registry is missing block defaults")); + } + Ok(result) + } + pub fn len(&self) -> usize { + self.states.len() + } + pub fn is_empty(&self) -> bool { + self.states.is_empty() + } + pub fn state(&self, id: BlockStateId) -> Option<&BlockState> { + self.states.get(id.0 as usize) + } + pub fn id(&self, state: &BlockState) -> Option { + self.ids.get(state).copied() + } + pub fn default_state(&self, name: &str) -> Option { + self.defaults.get(name).copied() + } + + /// Resolve a saved descriptor, supplying omitted default properties. Unlike + /// vanilla's lenient logging paths, invalid properties return a typed error. + pub fn resolve(&self, descriptor: &BlockState) -> io::Result { + let default = self + .default_state(&descriptor.name) + .ok_or_else(|| invalid("unknown block name"))?; + let mut state = self.state(default).unwrap().clone(); + for (key, value) in &descriptor.properties { + if !state.properties.contains_key(key) { + return Err(invalid("unknown block property")); + } + state.properties.insert(key.clone(), value.clone()); + } + self.id(&state) + .ok_or_else(|| invalid("invalid block property value")) + } +} diff --git a/crates/horizon-world/src/registry/json.rs b/crates/horizon-world/src/registry/json.rs new file mode 100644 index 000000000..664a7e1d9 --- /dev/null +++ b/crates/horizon-world/src/registry/json.rs @@ -0,0 +1,135 @@ +//! Java 26.3 compact/full block-state JSON codecs over a pinned registry. +use super::{BlockRegistry, BlockStateId}; +use crate::compression::invalid; +use serde_json::Value; +use std::{ + collections::{BTreeMap, BTreeSet}, + io, +}; + +/// Property kinds accompany the imported state registry. Integer properties +/// parse Java decimal strings; enum and boolean properties use exact names. +pub struct BlockStateJsonCodec<'a> { + registry: &'a BlockRegistry, + integers: BTreeSet<(String, String)>, + counts: BTreeMap, +} +impl<'a> BlockStateJsonCodec<'a> { + pub fn new( + registry: &'a BlockRegistry, + integers: BTreeSet<(String, String)>, + ) -> io::Result { + for (block, property) in &integers { + let state = registry + .default_state(block) + .and_then(|id| registry.state(id)); + if !state.is_some_and(|state| state.properties.contains_key(property)) { + return Err(invalid("integer property is absent from block registry")); + } + } + let mut counts = BTreeMap::new(); + for state in ®istry.states { + *counts.entry(state.name.clone()).or_insert(0) += 1; + } + Ok(Self { + registry, + integers, + counts, + }) + } + /// `full` selects FULL_CODEC, which requires the object representation. + /// Invalid/missing properties keep their defaults, as vanilla's codec does. + pub fn decode(&self, json: &str, full: bool) -> io::Result { + let value: Value = serde_json::from_str(json).map_err(|e| invalid(e.to_string()))?; + let name = if !full && value.is_string() { + value.as_str() + } else { + value.get("id").and_then(Value::as_str) + } + .ok_or_else(|| invalid("missing block identifier"))?; + let (namespace, path) = name.split_once(':').unwrap_or(("minecraft", name)); + let name = format!( + "{}:{path}", + if namespace.is_empty() { + "minecraft" + } else { + namespace + } + ); + let default = self + .registry + .default_state(&name) + .ok_or_else(|| invalid("unknown block identifier"))?; + let mut state = self.registry.state(default).unwrap().clone(); + if let Some(properties) = value.get("properties").and_then(Value::as_object) { + for (key, raw) in properties { + if !state.properties.contains_key(key) { + continue; + } + let Some(value) = raw.as_str() else { + continue; + }; + let candidate = if self.integers.contains(&(name.clone(), key.clone())) { + let Some(value) = java_integer(value) else { + continue; + }; + value.to_string() + } else { + value.to_owned() + }; + let previous = state.properties.insert(key.clone(), candidate).unwrap(); + if self.registry.id(&state).is_none() { + state.properties.insert(key.clone(), previous); + } + } + } + self.registry + .id(&state) + .ok_or_else(|| invalid("block state is absent from registry")) + } + pub fn encode(&self, id: BlockStateId, full: bool) -> io::Result { + let state = self + .registry + .state(id) + .ok_or_else(|| invalid("unknown block state ID"))?; + let value = if !full && self.registry.default_state(&state.name) == Some(id) { + Value::String(state.name.clone()) + } else if self.counts[&state.name] == 1 { + serde_json::json!({"id":state.name}) + } else { + serde_json::json!({"id":state.name,"properties":state.properties}) + }; + serde_json::to_string(&value).map_err(|e| invalid(e.to_string())) + } +} + +fn java_integer(text: &str) -> Option { + let (negative, text) = if let Some(text) = text.strip_prefix('-') { + (true, text) + } else { + (false, text.strip_prefix('+').unwrap_or(text)) + }; + if text.is_empty() { + return None; + } + // BMP decimal digit runs accepted by Character.digit(char, 10) in JDK 25. + const ZEROES: [u32; 37] = [ + 0x30, 0x660, 0x6f0, 0x7c0, 0x966, 0x9e6, 0xa66, 0xae6, 0xb66, 0xbe6, 0xc66, 0xce6, 0xd66, + 0xde6, 0xe50, 0xed0, 0xf20, 0x1040, 0x1090, 0x17e0, 0x1810, 0x1946, 0x19d0, 0x1a80, 0x1a90, + 0x1b50, 0x1bb0, 0x1c40, 0x1c50, 0xa620, 0xa8d0, 0xa900, 0xa9d0, 0xa9f0, 0xaa50, 0xabf0, + 0xff10, + ]; + let mut value = 0i64; + for c in text.chars() { + let c = c as u32; + let zero = ZEROES + .iter() + .copied() + .find(|zero| c >= *zero && c < *zero + 10)?; + value = value * 10 + i64::from(c - zero); + if value > i64::from(i32::MAX) + i64::from(negative) { + return None; + } + } + Some(if negative { -value } else { value } as i32) +} diff --git a/crates/horizon-world/src/tick_data.rs b/crates/horizon-world/src/tick_data.rs new file mode 100644 index 000000000..e316f7a79 --- /dev/null +++ b/crates/horizon-world/src/tick_data.rs @@ -0,0 +1,81 @@ +//! Save-format bridge for scheduled block/fluid ticks. Registry identity is +//! supplied by the caller; this module does not implement either type's behavior. +use crate::{compression::invalid, nbt::Tag}; +use horizon_core::{ + position::BlockPos, + ticks::{SavedTick, TickPriority, TickTypeId}, +}; +use std::io; + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum TickKind { + Block, + Fluid, +} +impl TickKind { + pub const fn field(self) -> &'static str { + match self { + Self::Block => "block_ticks", + Self::Fluid => "fluid_ticks", + } + } +} + +pub fn read_list( + tag: &Tag, + mut resolve: impl FnMut(&str) -> Option, +) -> io::Result> { + let Tag::List(entries) = tag else { + return Err(invalid("saved ticks are not a list")); + }; + entries + .iter() + .map(|entry| { + let Some(Tag::String(name)) = entry.get("i") else { + return Err(invalid("saved tick is missing type name")); + }; + let name = name.to_string().map_err(|e| invalid(e.to_string()))?; + let kind = resolve(&name).ok_or_else(|| invalid("unknown saved tick type"))?; + let int = |key| { + // NbtOps/Codec.INT use Number.intValue, including narrowing + // longs and Java's saturating float conversion. + match entry.get(key) { + Some(Tag::Byte(v)) => Ok(i32::from(*v)), + Some(Tag::Short(v)) => Ok(i32::from(*v)), + Some(Tag::Int(v)) => Ok(*v), + Some(Tag::Long(v)) => Ok(*v as i32), + Some(Tag::Float(v)) => Ok(f32::from_bits(*v) as i32), + Some(Tag::Double(v)) => Ok(f64::from_bits(*v) as i32), + _ => Err(invalid(format!("saved tick is missing number {key}"))), + } + }; + Ok(SavedTick { + kind, + pos: BlockPos::new(int("x")?, int("y")?, int("z")?), + delay: int("t")?, + priority: TickPriority::by_value(int("p")?), + }) + }) + .collect() +} + +pub fn write_list( + ticks: &[SavedTick], + mut name: impl FnMut(TickTypeId) -> Option, +) -> io::Result { + let entries = ticks + .iter() + .map(|tick| { + let name = name(tick.kind).ok_or_else(|| invalid("unknown saved tick type ID"))?; + Ok(Tag::compound([ + ("i", Tag::String(name.as_str().into())), + ("x", Tag::Int(tick.pos.x)), + ("y", Tag::Int(tick.pos.y)), + ("z", Tag::Int(tick.pos.z)), + ("t", Tag::Int(tick.delay)), + ("p", Tag::Int(tick.priority as i32)), + ])) + }) + .collect::>>()?; + Ok(Tag::List(entries)) +} diff --git a/crates/horizon-world/src/worldgen.rs b/crates/horizon-world/src/worldgen.rs new file mode 100644 index 000000000..8642bdc08 --- /dev/null +++ b/crates/horizon-world/src/worldgen.rs @@ -0,0 +1,258 @@ +//! Version-specific noise, density registry and terrain-router JSON decoding. +//! Complete terrain generation remains pending. +pub mod anchor; +pub mod aquifer; +pub mod biome; +pub mod biome_chunk; +pub mod biome_predicate; +pub mod biome_source; +pub mod biome_temperature; +pub mod block_feature; +pub mod block_predicate; +pub mod bulk_section; +pub mod carver; +pub mod carving; +pub mod climate; +pub mod decoration; +pub mod density; +pub mod feature; +pub mod feature_catalog; +pub mod feature_graph; +pub mod feature_region; +pub mod feature_sort; +pub mod fluid_predicate; +pub mod height_provider; +pub mod material_condition; +pub mod material_extensions; +pub mod material_stage; +pub mod material_surface; +pub mod ore_feature; +pub mod placement; +pub mod router; +pub mod rule_test; +pub mod settings; +pub mod state_provider; +pub mod tags; +pub mod terrain; +pub mod value_provider; +pub mod weighted; +use horizon_core::noise::{NoiseBuildError, NormalNoise, Normalization}; +use serde_json::value::RawValue; +use std::collections::BTreeMap; + +#[derive(Debug)] +pub enum DecodeError { + Json(serde_json::Error), + Field(&'static str), + Noise(NoiseBuildError), + Graph(horizon_core::density::graph::CompileError), + Sample(horizon_core::density::SampleError), + Registry(String), +} +impl std::fmt::Display for DecodeError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Json(error) => error.fmt(f), + Self::Field(field) => write!(f, "invalid world generation field: {field}"), + Self::Noise(error) => error.fmt(f), + Self::Graph(error) => error.fmt(f), + Self::Sample(error) => error.fmt(f), + Self::Registry(error) => f.write_str(error), + } + } +} +impl std::error::Error for DecodeError {} +impl From for DecodeError { + fn from(value: serde_json::Error) -> Self { + Self::Json(value) + } +} +impl From for DecodeError { + fn from(value: NoiseBuildError) -> Self { + Self::Noise(value) + } +} + +impl From for DecodeError { + fn from(value: horizon_core::density::graph::CompileError) -> Self { + Self::Graph(value) + } +} + +impl From for DecodeError { + fn from(value: horizon_core::density::SampleError) -> Self { + Self::Sample(value) + } +} + +type Object = BTreeMap>; +fn optional<'a>(object: &'a Object, name: &str) -> Option<&'a RawValue> { + object + .get(name) + .map(AsRef::as_ref) + .filter(|raw| raw.get() != "null") +} +fn required<'a>(object: &'a Object, name: &'static str) -> Result<&'a RawValue, DecodeError> { + optional(object, name).ok_or(DecodeError::Field(name)) +} +fn number_text(raw: &RawValue) -> Result<&str, DecodeError> { + let text = raw.get(); + if text.starts_with('-') || text.starts_with(|c: char| c.is_ascii_digit()) { + Ok(text) + } else { + Err(DecodeError::Field("number")) + } +} +fn double(raw: &RawValue) -> Result { + number_text(raw)? + .parse() + .map_err(|_| DecodeError::Field("number")) +} + +// Gson's lazily parsed numbers use BigDecimal.intValue for decimal/exponent +// forms: truncate toward zero, then retain the low 32 bits. Converting through +// f64 would both round large integers and saturate rather than wrap. +fn integer(raw: &RawValue) -> Result { + let text = number_text(raw)?; + let negative = text.starts_with('-'); + let text = text.strip_prefix('-').unwrap_or(text); + let (mantissa, exponent) = match text.split_once(['e', 'E']) { + Some((mantissa, exponent)) => ( + mantissa, + exponent + .parse::() + .map_err(|_| DecodeError::Field("integer exponent"))? as i64, + ), + None => (text, 0), + }; + let (whole, fraction) = mantissa.split_once('.').unwrap_or((mantissa, "")); + let digits = whole.bytes().chain(fraction.bytes()); + let length = whole.len() as i64 + exponent; + if length <= 0 { + return Ok(0); + } + let available = whole.len() as i64 + fraction.len() as i64; + let zeroes = (length - available).max(0); + if zeroes >= 32 { + return Ok(0); + } + let mut result = 0u32; + for digit in digits.take(length as usize) { + result = result + .wrapping_mul(10) + .wrapping_add(u32::from(digit - b'0')); + } + for _ in 0..zeroes { + result = result.wrapping_mul(10); + } + Ok(if negative { + result.wrapping_neg() + } else { + result + } as i32) +} +fn int_range(raw: &RawValue, name: &'static str, low: i32, high: i32) -> Result { + let value = integer(raw)?; + if (low..=high).contains(&value) { + Ok(value) + } else { + Err(DecodeError::Field(name)) + } +} +fn double_range( + raw: &RawValue, + name: &'static str, + low: f64, + high: f64, +) -> Result { + let value = double(raw)?; + if value.total_cmp(&low).is_ge() && value.total_cmp(&high).is_le() { + Ok(value) + } else { + Err(DecodeError::Field(name)) + } +} + +/// Decode Java Edition 26.3's direct normal-noise parameters from strict JSON. +/// Numeric tokens retain their decimal text; all rounding occurs at the target +/// numeric width. Unknown object fields are ignored, as in vanilla's codec. +pub fn decode_noise(json: &str) -> Result { + let object: Object = serde_json::from_str(json)?; + let base = int_range(required(&object, "base_octave")?, "base_octave", -32, 32)?; + let count = optional(&object, "octave_count") + .map(|raw| int_range(raw, "octave_count", 1, 32)) + .transpose()? + .unwrap_or(1); + let amplitude = optional(&object, "base_amplitude") + .map(|raw| double_range(raw, "base_amplitude", 1e-5f32 as f64, 1e6)) + .transpose()? + .unwrap_or(1.0); + let normalize = match optional(&object, "normalize") { + None => Normalization::Enabled, + Some(raw) => match raw.get() { + "true" => Normalization::Enabled, + "false" => Normalization::Disabled, + text if text.starts_with('"') && serde_json::from_str::(text)? == "legacy" => { + Normalization::Legacy + } + _ => return Err(DecodeError::Field("normalize")), + }, + }; + let modifiers: Vec> = optional(&object, "amplitude_modifiers") + .map(|raw| serde_json::from_str(raw.get())) + .transpose()? + .unwrap_or_default(); + if modifiers.len() > 32 || (!modifiers.is_empty() && modifiers.len() != count as usize) { + return Err(DecodeError::Field("amplitude_modifiers")); + } + let mut builder = NormalNoise::builder(); + builder + .set_base_octave(base) + .set_base_amplitude(amplitude) + .set_normalization(normalize); + builder.set_octave_count(count)?; + for (index, modifier) in modifiers.iter().enumerate() { + builder.set_amplitude_modifier( + index as i32, + double_range(modifier, "amplitude_modifiers", 0.0, 1e6)?, + )?; + } + Ok(builder.build()?) +} + +#[cfg(test)] +mod tests { + use super::*; + #[test] + fn decimal_integers_wrap_without_floating_point_conversion() { + for (text, expected) in [ + ("4294967295", -1), + ("4294967296.5", 0), + ("-4294967297.9", -1), + ("1.9999999999999999999", 1), + ("12e1", 120), + ("123e-1", 12), + ("-123e-3", 0), + ("123e99", 0), + ] { + let raw: Box = serde_json::from_str(text).unwrap(); + assert_eq!(integer(&raw).unwrap(), expected, "{text}"); + } + } + #[test] + fn codec_defaults_and_empty_modifiers_match_explicit_parameters() { + let a = decode_noise(r#"{"base_octave":-7}"#).unwrap(); + let b = decode_noise(r#"{"base_octave":-7,"base_amplitude":1,"octave_count":1,"normalize":true,"amplitude_modifiers":[],"unknown":42}"#).unwrap(); + assert_eq!(a.range(), b.range()); + assert_eq!(a.normalization_factor(), b.normalization_factor()); + assert_eq!(a.octaves().len(), b.octaves().len()); + assert!(decode_noise(r#"{"base_octave":-7,"octave_count":0}"#).is_err()); + assert!(decode_noise(r#"{"base_octave":-7,"normalize":0}"#).is_err()); + assert!(decode_noise(r#"{"base_octave":-7,"amplitude_modifiers":[-0]}"#).is_err()); + assert!(decode_noise(r#"{"base_octave":-7,"amplitude_modifiers":[-0.0]}"#).is_err()); + assert!( + decode_noise(r#"{"base_octave":-7,"octave_count":2,"amplitude_modifiers":[1]}"#) + .is_err() + ); + } +} diff --git a/crates/horizon-world/src/worldgen/anchor.rs b/crates/horizon-world/src/worldgen/anchor.rs new file mode 100644 index 000000000..741a57dd0 --- /dev/null +++ b/crates/horizon-world/src/worldgen/anchor.rs @@ -0,0 +1,102 @@ +//! Vertical anchors and their generation bounds in Java Edition 26.3. +use super::{DecodeError, Object, int_range, required}; + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct WorldGenerationContext { + pub min_y: i32, + pub height: i32, + pub sea_level: i32, +} +impl WorldGenerationContext { + pub const fn new(min_y: i32, height: i32, sea_level: i32) -> Self { + Self { + min_y, + height, + sea_level, + } + } + + /// Vanilla combines the two minima and heights independently. This is + /// deliberately different from intersecting the two vertical intervals. + pub fn with_generator( + level_min: i32, + level_height: i32, + generator_min: i32, + generator_height: i32, + generator_sea_level: i32, + ) -> Self { + Self::new( + level_min.max(generator_min), + level_height.min(generator_height), + generator_sea_level, + ) + } +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum VerticalAnchor { + Absolute(i32), + AboveBottom(i32), + BelowTop(i32), + RelativeToSeaLevel(i32), +} +impl VerticalAnchor { + pub const BOTTOM: Self = Self::AboveBottom(0); + pub const TOP: Self = Self::BelowTop(0); + pub const SEA_LEVEL: Self = Self::RelativeToSeaLevel(0); + + /// Runtime anchors accept every signed integer, with Java wrapping. + pub fn resolve(self, context: WorldGenerationContext) -> i32 { + match self { + Self::Absolute(y) => y, + Self::AboveBottom(offset) => context.min_y.wrapping_add(offset), + Self::BelowTop(offset) => context + .height + .wrapping_sub(1) + .wrapping_add(context.min_y) + .wrapping_sub(offset), + Self::RelativeToSeaLevel(offset) => context.sea_level.wrapping_add(offset), + } + } + + pub fn from_json(json: &str) -> Result { + let object: Object = serde_json::from_str(json)?; + let field = |name| { + required(&object, name) + .and_then(|raw| int_range(raw, name, -2032, 2031)) + .ok() + }; + // The codec nests exclusive alternatives. An ambiguous inner choice + // fails that branch, allowing a valid outer branch to succeed. + let exclusive = |left, right| match (left, right) { + (Some(value), None) | (None, Some(value)) => Some(value), + _ => None, + }; + exclusive( + field("absolute").map(Self::Absolute), + exclusive( + field("above_bottom").map(Self::AboveBottom), + exclusive( + field("below_top").map(Self::BelowTop), + field("relative_to_sea_level").map(Self::RelativeToSeaLevel), + ), + ), + ) + .ok_or(DecodeError::Field("vertical anchor")) + } + + /// Encode through the same field bounds as the vanilla codec. Constructed + /// runtime anchors can resolve successfully while failing this validation. + pub fn to_json(self) -> Result { + let (name, value) = match self { + Self::Absolute(y) => ("absolute", y), + Self::AboveBottom(offset) => ("above_bottom", offset), + Self::BelowTop(offset) => ("below_top", offset), + Self::RelativeToSeaLevel(offset) => ("relative_to_sea_level", offset), + }; + if !(-2032..=2031).contains(&value) { + return Err(DecodeError::Field("vertical anchor")); + } + Ok(format!("{{\"{name}\":{value}}}")) + } +} diff --git a/crates/horizon-world/src/worldgen/aquifer.rs b/crates/horizon-world/src/worldgen/aquifer.rs new file mode 100644 index 000000000..2b4f6e7c3 --- /dev/null +++ b/crates/horizon-world/src/worldgen/aquifer.rs @@ -0,0 +1,100 @@ +//! Global fluid selection and the 26.3 aquifer terrain paths. +mod config; +mod noise_based; +use crate::registry::BlockStateId; +pub use config::{AquiferConfig, AquiferField, AquiferSamplers}; +pub use noise_based::{ + AquiferBlockStates, AquiferError, NoiseBasedAquifer, RegistryAquiferBlockStates, +}; + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct FluidStatus { + pub level: i32, + pub state: BlockStateId, +} +impl FluidStatus { + pub const fn at(self, y: i32, air: BlockStateId) -> BlockStateId { + if y < self.level { self.state } else { air } + } +} +pub trait FluidPicker: std::fmt::Debug + Send + Sync { + fn compute(&self, position: [i32; 3]) -> FluidStatus; +} +impl FluidPicker for &P { + fn compute(&self, position: [i32; 3]) -> FluidStatus { + P::compute(self, position) + } +} +/// State IDs must come from one immutable block registry. Default fluid can be +/// any registered block state; vanilla does not validate its material here. +#[derive(Clone, Copy, Debug)] +pub struct GlobalFluidPicker { + sea_level: i32, + default_fluid: BlockStateId, + lava: BlockStateId, + air: BlockStateId, + disabled: bool, +} +impl GlobalFluidPicker { + pub const fn new( + sea_level: i32, + default_fluid: BlockStateId, + lava: BlockStateId, + air: BlockStateId, + ) -> Self { + Self { + sea_level, + default_fluid, + lava, + air, + disabled: false, + } + } + /// Matches the vanilla developer flag. Regular gameplay keeps this false. + pub const fn with_disabled(mut self, disabled: bool) -> Self { + self.disabled = disabled; + self + } +} +impl FluidPicker for GlobalFluidPicker { + fn compute(&self, [_, y, _]: [i32; 3]) -> FluidStatus { + if self.disabled { + FluidStatus { + level: -4064, + state: self.air, + } + } else if y < (-54).min(self.sea_level) { + FluidStatus { + level: -54, + state: self.lava, + } + } else { + FluidStatus { + level: self.sea_level, + state: self.default_fluid, + } + } + } +} +#[derive(Debug)] +pub struct DisabledAquifer

{ + picker: P, + air: BlockStateId, +} +impl DisabledAquifer

{ + pub const fn new(picker: P, air: BlockStateId) -> Self { + Self { picker, air } + } + /// None selects the generator's default solid block. Java DCMPL treats NaN + /// as -1, so NaN and density <= zero call the picker; density > zero does not. + pub fn compute_substance(&self, position: [i32; 3], density: f64) -> Option { + if density > 0. { + None + } else { + Some(self.picker.compute(position).at(position[1], self.air)) + } + } + pub const fn should_schedule_fluid_update(&self) -> bool { + false + } +} diff --git a/crates/horizon-world/src/worldgen/aquifer/config.rs b/crates/horizon-world/src/worldgen/aquifer/config.rs new file mode 100644 index 000000000..984fe59e8 --- /dev/null +++ b/crates/horizon-world/src/worldgen/aquifer/config.rs @@ -0,0 +1,127 @@ +//! The six density roots in the 26.3 aquifer configuration. +use super::super::{DecodeError, Object, density::DensityRegistry, required}; +use horizon_core::density::{ + DensitySampler, + graph::{CompileError, DensityCompiler, FunctionId}, +}; +use std::sync::Arc; + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[repr(usize)] +pub enum AquiferField { + Barrier, + Floodedness, + Spread, + Lava, + Exclusion, + SurfaceLevel, +} +impl AquiferField { + pub const ALL: [Self; 6] = [ + Self::Barrier, + Self::Floodedness, + Self::Spread, + Self::Lava, + Self::Exclusion, + Self::SurfaceLevel, + ]; + pub const fn name(self) -> &'static str { + match self { + Self::Barrier => "barrier", + Self::Floodedness => "fluid_level_floodedness", + Self::Spread => "fluid_level_spread", + Self::Lava => "lava", + Self::Exclusion => "exclusion", + Self::SurfaceLevel => "surface_level", + } + } +} +#[derive(Clone, Copy, Debug)] +pub struct AquiferConfig { + functions: [FunctionId; 6], +} +impl AquiferConfig { + /// Decode all roots atomically into the caller's registry graph. + pub fn from_json(json: &str, registry: &mut DensityRegistry) -> Result { + let object: Object = serde_json::from_str(json)?; + let inputs = AquiferField::ALL + .iter() + .map(|f| required(&object, f.name()).map(|v| v.get())) + .collect::, _>>()?; + let functions = registry + .decode_functions(&inputs)? + .try_into() + .map_err(|_| DecodeError::Field("aquifer field count"))?; + Ok(Self { functions }) + } + pub fn function(self, field: AquiferField) -> FunctionId { + self.functions[field as usize] + } + /// Preserve vanilla's binding order and the shared compiler cache namespace. + pub fn compile(self, compiler: &mut DensityCompiler) -> Result { + let samplers = self + .functions + .iter() + .map(|id| compiler.get_sampler(*id)) + .collect::, _>>()? + .try_into() + .expect("six aquifer roots"); + Ok(AquiferSamplers { samplers }) + } +} +#[derive(Debug)] +pub struct AquiferSamplers { + samplers: [Arc; 6], +} +impl AquiferSamplers { + /// Bind already compiled roots in AquiferField::ALL order. + pub fn new(samplers: [Arc; 6]) -> Self { + Self { samplers } + } + pub fn get(&self, field: AquiferField) -> &Arc { + &self.samplers[field as usize] + } +} + +#[cfg(test)] +mod tests { + use super::*; + use horizon_core::density::{SamplerContext, graph::GraphNode}; + use std::collections::BTreeMap; + #[test] + fn bindings_share_named_cache_and_failed_decode_is_atomic() { + let mut registry = DensityRegistry::from_json(&BTreeMap::new(), &BTreeMap::from([("minecraft:shared".into(), r#"{"type":"cache","input":{"type":"gradient","axis":"x","from_coordinate":0,"to_coordinate":16,"from_value":0,"to_value":1}}"#.into())])).unwrap(); + let roots: BTreeMap<_, _> = AquiferField::ALL + .iter() + .map(|f| (f.name(), "minecraft:shared")) + .collect(); + let json = serde_json::to_string(&roots).unwrap(); + let expected = registry + .graph() + .clone() + .insert(GraphNode::Constant(123.)) + .unwrap(); + let invalid = json + .replace("\"barrier\":\"minecraft:shared\"", "\"barrier\":123") + .replace( + "\"surface_level\":\"minecraft:shared\"", + "\"surface_level\":{}", + ); + assert!(AquiferConfig::from_json(&invalid, &mut registry).is_err()); + assert_eq!(registry.decode_functions(&["123"]).unwrap()[0], expected); + let config = AquiferConfig::from_json(&json, &mut registry).unwrap(); + let mut compiler = DensityCompiler::new_seeded(registry.into_graph(), 0, false); + let samplers = config.compile(&mut compiler).unwrap(); + assert_eq!(compiler.cache_count(), 1); + let mut context = SamplerContext::cached(); + for field in AquiferField::ALL { + assert_eq!( + samplers + .get(field) + .sample_value(&mut context, [4, -54, 0]) + .unwrap(), + 0.25 + ); + } + } +} diff --git a/crates/horizon-world/src/worldgen/aquifer/noise_based.rs b/crates/horizon-world/src/worldgen/aquifer/noise_based.rs new file mode 100644 index 000000000..30181686b --- /dev/null +++ b/crates/horizon-world/src/worldgen/aquifer/noise_based.rs @@ -0,0 +1,578 @@ +//! Stateful 26.3 underground fluid and pressure selection. +use super::{AquiferField, AquiferSamplers, FluidPicker, FluidStatus}; +use crate::registry::{BlockRegistry, BlockStateId}; +use horizon_core::{ + density::{SampleError, SamplerContext}, + noise::{DensityError, DensityVolume}, + position::{BlockPos, ChunkPos}, + random::{PositionalRandom, RandomSource}, +}; +use std::collections::HashMap; + +const WAY_BELOW_MIN_Y: i32 = -32512; +const FLOWING_UPDATE_SIMILARITY: f64 = 1.0 - 44.0 / 25.0; +const SURFACE_OFFSETS: [[i32; 2]; 13] = [ + [0, 0], + [-2, -1], + [-1, -1], + [0, -1], + [1, -1], + [-3, 0], + [-2, 0], + [-1, 0], + [1, 0], + [-2, 1], + [-1, 1], + [0, 1], + [1, 1], +]; + +/// All IDs and block classifications must refer to the same immutable registry. +/// Lava/water tests classify the block, whereas default-lava equality tests the +/// exact state. Air tests include cave air and void air. +pub trait AquiferBlockStates { + fn air(&self) -> BlockStateId; + fn lava(&self) -> BlockStateId; + fn is_air(&self, state: BlockStateId) -> bool; + fn is_lava(&self, state: BlockStateId) -> bool; + fn is_water(&self, state: BlockStateId) -> bool; +} +pub struct RegistryAquiferBlockStates<'a> { + registry: &'a BlockRegistry, + air: BlockStateId, + lava: BlockStateId, +} +impl<'a> RegistryAquiferBlockStates<'a> { + pub fn new(registry: &'a BlockRegistry) -> Result { + Ok(Self { + registry, + air: registry + .default_state("minecraft:air") + .ok_or(AquiferError::MissingBlock)?, + lava: registry + .default_state("minecraft:lava") + .ok_or(AquiferError::MissingBlock)?, + }) + } + fn name(&self, state: BlockStateId) -> Option<&str> { + self.registry.state(state).map(|s| s.name.as_str()) + } +} +impl AquiferBlockStates for RegistryAquiferBlockStates<'_> { + fn air(&self) -> BlockStateId { + self.air + } + fn lava(&self) -> BlockStateId { + self.lava + } + fn is_air(&self, state: BlockStateId) -> bool { + matches!( + self.name(state), + Some("minecraft:air" | "minecraft:cave_air" | "minecraft:void_air") + ) + } + fn is_lava(&self, state: BlockStateId) -> bool { + self.name(state) == Some("minecraft:lava") + } + fn is_water(&self, state: BlockStateId) -> bool { + self.name(state) == Some("minecraft:water") + } +} +#[derive(Debug)] +pub enum AquiferError { + Sample(SampleError), + InvalidGrid, + OutsideGrid, + Allocation, + MissingBlock, +} +impl From for AquiferError { + fn from(value: SampleError) -> Self { + Self::Sample(value) + } +} +impl From for AquiferError { + fn from(value: DensityError) -> Self { + Self::Sample(value.into()) + } +} +impl std::fmt::Display for AquiferError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Sample(e) => e.fmt(f), + Self::InvalidGrid => f.write_str("aquifer grid is invalid or exceeds 16777216 cells"), + Self::OutsideGrid => f.write_str("aquifer query lies outside its grid"), + Self::Allocation => f.write_str("aquifer allocation failed"), + Self::MissingBlock => f.write_str("aquifer registry lacks default air or lava"), + } + } +} +impl std::error::Error for AquiferError {} + +pub struct NoiseBasedAquifer { + samplers: AquiferSamplers, + picker: P, + random: F, + blocks: B, + minimum: [i32; 3], + size_x: i32, + size_z: i32, + statuses: Vec>, + locations: Vec, + surfaces: HashMap, + skip_above_y: i32, + schedule: bool, +} +impl NoiseBasedAquifer { + /// The positional factory is the caller's aquifer factory, not the world's + /// unmodified factory. Every sampler uses the caller's shared context. + pub fn new( + samplers: AquiferSamplers, + picker: P, + random: F, + blocks: B, + volume: DensityVolume, + context: &mut SamplerContext, + ) -> Result { + let low = volume.minimum(); + let high = volume.maximum(); + let minimum = [ + low[0].wrapping_sub(5) >> 4, + low[1].wrapping_add(1).div_euclid(12).wrapping_sub(1), + low[2].wrapping_sub(5) >> 4, + ]; + let maximum = [ + (high[0].wrapping_sub(5) >> 4).wrapping_add(1), + high[1].wrapping_add(1).div_euclid(12).wrapping_add(1), + (high[2].wrapping_sub(5) >> 4).wrapping_add(1), + ]; + let sizes: [i32; 3] = + std::array::from_fn(|i| maximum[i].wrapping_sub(minimum[i]).wrapping_add(1)); + let count = sizes + .into_iter() + .try_fold(1usize, |n, s| { + if s > 0 { + n.checked_mul(s as usize) + } else { + None + } + }) + .filter(|n| *n <= 16_777_216) + .ok_or(AquiferError::InvalidGrid)?; + let mut statuses = Vec::new(); + statuses + .try_reserve_exact(count) + .map_err(|_| AquiferError::Allocation)?; + statuses.resize(count, None); + let mut locations = Vec::new(); + locations + .try_reserve_exact(count) + .map_err(|_| AquiferError::Allocation)?; + locations.resize(count, i64::MAX); + let mut result = Self { + samplers, + picker, + random, + blocks, + minimum, + size_x: sizes[0], + size_z: sizes[2], + statuses, + locations, + surfaces: HashMap::new(), + skip_above_y: 0, + schedule: false, + }; + let max_surface = result + .max_surface_level( + context, + [minimum[0].wrapping_shl(4), minimum[2].wrapping_shl(4)], + [ + maximum[0].wrapping_shl(4).wrapping_add(9), + maximum[2].wrapping_shl(4).wrapping_add(9), + ], + )? + .wrapping_add(8); + let skip_grid = max_surface.wrapping_add(12).div_euclid(12).wrapping_add(1); + result.skip_above_y = skip_grid.wrapping_mul(12).wrapping_add(11).wrapping_sub(1); + Ok(result) + } + /// Read-only diagnostic state; enumeration never populates a cache. + pub fn cached_cells(&self) -> impl Iterator)> + '_ { + self.locations + .iter() + .copied() + .zip(self.statuses.iter().copied()) + } + pub fn cached_surfaces(&self) -> impl Iterator + '_ { + self.surfaces.iter().map(|(key, value)| (*key, *value)) + } + pub fn should_schedule_fluid_update(&self) -> bool { + self.schedule + } + pub fn skip_sampling_above_y(&self) -> i32 { + self.skip_above_y + } + fn sample( + &self, + field: AquiferField, + context: &mut SamplerContext, + position: [i32; 3], + ) -> Result { + Ok(self.samplers.get(field).sample_value(context, position)? as f64) + } + fn surface_level( + &mut self, + context: &mut SamplerContext, + x: i32, + z: i32, + ) -> Result { + let x = (x >> 2).wrapping_shl(2); + let z = (z >> 2).wrapping_shl(2); + let key = ChunkPos::new(x, z).pack(); + if let Some(level) = self.surfaces.get(&key) { + return Ok(*level); + } + let level = self + .sample(AquiferField::SurfaceLevel, context, [x, 0, z])? + .floor() as i32; + self.surfaces.insert(key, level); + Ok(level) + } + fn max_surface_level( + &mut self, + context: &mut SamplerContext, + minimum: [i32; 2], + maximum: [i32; 2], + ) -> Result { + let low = minimum.map(|v| v >> 2); + let high = maximum.map(|v| v >> 2); + let sizes: [i32; 2] = std::array::from_fn(|i| high[i].wrapping_sub(low[i]).wrapping_add(1)); + let volume = DensityVolume::new( + [sizes[0], 1, sizes[1]], + [low[0].wrapping_shl(2), 0, low[1].wrapping_shl(2)], + [4, 1, 4], + )?; + if volume.size() > 2_097_152 { + return Err(AquiferError::InvalidGrid); + } + let mut buffer = Vec::new(); + buffer + .try_reserve_exact(volume.size()) + .map_err(|_| AquiferError::Allocation)?; + buffer.resize(volume.size(), 0.); + self.samplers + .get(AquiferField::SurfaceLevel) + .sample_volume(context, &mut buffer, volume)?; + self.surfaces + .try_reserve(volume.size()) + .map_err(|_| AquiferError::Allocation)?; + let mut maximum = i32::MIN; + let mut index = 0; + for z in 0..sizes[1] { + for x in 0..sizes[0] { + let value = (buffer[index] as f64).floor() as i32; + index += 1; + self.surfaces.insert( + ChunkPos::new( + low[0].wrapping_add(x).wrapping_shl(2), + low[1].wrapping_add(z).wrapping_shl(2), + ) + .pack(), + value, + ); + maximum = maximum.max(value); + } + } + Ok(maximum) + } + fn grid_index(&self, position: [i32; 3]) -> Result { + let relative: [i32; 3] = std::array::from_fn(|i| position[i].wrapping_sub(self.minimum[i])); + // Vanilla checks the final array index, rather than each coordinate. + let index = relative[1] + .wrapping_mul(self.size_z) + .wrapping_add(relative[2]) + .wrapping_mul(self.size_x) + .wrapping_add(relative[0]); + if index < 0 || index as usize >= self.locations.len() { + return Err(AquiferError::OutsideGrid); + } + Ok(index as usize) + } + fn status( + &mut self, + context: &mut SamplerContext, + index: usize, + ) -> Result { + if let Some(status) = self.statuses[index] { + return Ok(status); + } + let pos = BlockPos::unpack(self.locations[index]); + let status = self.compute_fluid(context, [pos.x, pos.y, pos.z])?; + self.statuses[index] = Some(status); + Ok(status) + } + fn compute_fluid( + &mut self, + context: &mut SamplerContext, + [x, y, z]: [i32; 3], + ) -> Result { + let global = self.picker.compute([x, y, z]); + let upper = y.wrapping_add(12); + let lower = y.wrapping_sub(12); + let mut minimum = i32::MAX; + let mut center_fluid = false; + for [dx, dz] in SURFACE_OFFSETS { + let sx = x.wrapping_add(dx.wrapping_mul(16)); + let sz = z.wrapping_add(dz.wrapping_mul(16)); + let surface = self.surface_level(context, sx, sz)?; + let adjusted = surface.wrapping_add(8); + let center = dx == 0 && dz == 0; + if center && lower > adjusted { + return Ok(global); + } + let above = upper > adjusted; + if above || center { + let status = self.picker.compute([sx, adjusted, sz]); + if !self.blocks.is_air(status.at(adjusted, self.blocks.air())) { + if center { + center_fluid = true; + } + if above { + return Ok(status); + } + } + } + minimum = minimum.min(surface); + } + let level = + self.compute_surface_level(context, [x, y, z], global, minimum, center_fluid)?; + let mut state = global.state; + if level <= -10 + && level != WAY_BELOW_MIN_Y + && state != self.blocks.lava() + && self + .sample( + AquiferField::Lava, + context, + [x.div_euclid(64), y.div_euclid(40), z.div_euclid(64)], + )? + .abs() + > 0.3 + { + state = self.blocks.lava(); + } + Ok(FluidStatus { level, state }) + } + fn compute_surface_level( + &self, + context: &mut SamplerContext, + position: [i32; 3], + global: FluidStatus, + minimum: i32, + center_fluid: bool, + ) -> Result { + let [x, y, z] = position; + let (dry, flooded) = if self.sample(AquiferField::Exclusion, context, position)? > 0. { + (-1., -1.) + } else { + let distance = minimum.wrapping_add(8).wrapping_sub(y); + let factor = if center_fluid { + let alpha = (distance as f64 - 0.) / (64. - 0.); + if alpha < 0. { + 1. + } else if alpha > 1. { + 0. + } else { + 1. + alpha * (0. - 1.) + } + } else { + 0. + }; + let value = self + .sample(AquiferField::Floodedness, context, position)? + .clamp(-1., 1.); + let alpha = (factor - 1.) / (0. - 1.); + let threshold_flooded = -0.3 + alpha * (0.8 - -0.3); + let threshold_dry = -0.8 + alpha * (0.4 - -0.8); + (value - threshold_dry, value - threshold_flooded) + }; + if flooded > 0. { + return Ok(global.level); + } + if dry > 0. { + let spread = self.samplers.get(AquiferField::Spread).sample_value( + context, + [x.div_euclid(16), y.div_euclid(40), z.div_euclid(16)], + )? * 10.; + let offset = ((spread as f64 / 3.).floor() as i32).wrapping_mul(3); + return Ok(minimum.min( + y.div_euclid(40) + .wrapping_mul(40) + .wrapping_add(20) + .wrapping_add(offset), + )); + } + Ok(WAY_BELOW_MIN_Y) + } + fn pressure( + &self, + context: &mut SamplerContext, + position: [i32; 3], + memo: &mut f64, + a: FluidStatus, + b: FluidStatus, + ) -> Result { + let y = position[1]; + let sa = a.at(y, self.blocks.air()); + let sb = b.at(y, self.blocks.air()); + if (self.blocks.is_lava(sa) && self.blocks.is_water(sb)) + || (self.blocks.is_water(sa) && self.blocks.is_lava(sb)) + { + return Ok(2.); + } + let gap = a.level.wrapping_sub(b.level).wrapping_abs(); + if gap == 0 { + return Ok(0.); + } + let midpoint = 0.5 * a.level.wrapping_add(b.level) as f64; + let dy = y as f64 + 0.5 - midpoint; + let edge = gap as f64 / 2. - dy.abs(); + let q = if dy > 0. { + let n = 0. + edge; + if n > 0. { n / 1.5 } else { n / 2.5 } + } else { + let n = 3. + edge; + if n > 0. { n / 3. } else { n / 10. } + }; + let barrier = if q < -2. || q > 2. { + 0. + } else { + if memo.is_nan() { + *memo = self.sample(AquiferField::Barrier, context, position)?; + } + *memo + }; + Ok(2. * (barrier + q)) + } + pub fn compute_substance( + &mut self, + context: &mut SamplerContext, + [x, y, z]: [i32; 3], + density: f64, + ) -> Result, AquiferError> { + if density > 0. { + self.schedule = false; + return Ok(None); + } + let global = self.picker.compute([x, y, z]); + if y > self.skip_above_y { + self.schedule = false; + return Ok(Some(global.at(y, self.blocks.air()))); + } + if self.blocks.is_lava(global.at(y, self.blocks.air())) { + self.schedule = false; + return Ok(Some(self.blocks.lava())); + } + let grid = [ + x.wrapping_sub(5) >> 4, + y.wrapping_add(1).div_euclid(12), + z.wrapping_sub(5) >> 4, + ]; + let mut distances = [i32::MAX; 4]; + let mut indices = [0usize; 4]; + for dx in 0..=1i32 { + for dy in -1..=1i32 { + for dz in 0..=1i32 { + let cell = [ + grid[0].wrapping_add(dx), + grid[1].wrapping_add(dy), + grid[2].wrapping_add(dz), + ]; + let index = self.grid_index(cell)?; + if self.locations[index] == i64::MAX { + let mut random = self.random.at(BlockPos::new(cell[0], cell[1], cell[2])); + let px = cell[0] + .wrapping_shl(4) + .wrapping_add(random.next_int_bound(10).expect("positive bound")); + let py = cell[1] + .wrapping_mul(12) + .wrapping_add(random.next_int_bound(9).expect("positive bound")); + let pz = cell[2] + .wrapping_shl(4) + .wrapping_add(random.next_int_bound(10).expect("positive bound")); + self.locations[index] = BlockPos::new(px, py, pz).pack(); + } + let point = BlockPos::unpack(self.locations[index]); + let ax = point.x.wrapping_sub(x); + let ay = point.y.wrapping_sub(y); + let az = point.z.wrapping_sub(z); + let distance = ax + .wrapping_mul(ax) + .wrapping_add(ay.wrapping_mul(ay)) + .wrapping_add(az.wrapping_mul(az)); + if let Some(slot) = distances.iter().position(|old| distance <= *old) { + for i in (slot + 1..4).rev() { + distances[i] = distances[i - 1]; + indices[i] = indices[i - 1]; + } + distances[slot] = distance; + indices[slot] = index; + } + } + } + } + let a = self.status(context, indices[0])?; + let s01 = similarity(distances[0], distances[1]); + let candidate = a.at(y, self.blocks.air()); + if s01 <= 0. { + self.schedule = if s01 >= FLOWING_UPDATE_SIMILARITY { + a != self.status(context, indices[1])? + } else { + false + }; + return Ok(Some(candidate)); + } + if self.blocks.is_water(candidate) + && self.blocks.is_lava( + self.picker + .compute([x, y.wrapping_sub(1), z]) + .at(y.wrapping_sub(1), self.blocks.air()), + ) + { + self.schedule = true; + return Ok(Some(candidate)); + } + let mut memo = f64::NAN; + let b = self.status(context, indices[1])?; + if density + s01 * self.pressure(context, [x, y, z], &mut memo, a, b)? > 0. { + self.schedule = false; + return Ok(None); + } + let c = self.status(context, indices[2])?; + let s02 = similarity(distances[0], distances[2]); + if s02 > 0. + && density + s01 * s02 * self.pressure(context, [x, y, z], &mut memo, a, c)? > 0. + { + self.schedule = false; + return Ok(None); + } + let s12 = similarity(distances[1], distances[2]); + if s12 > 0. + && density + s01 * s12 * self.pressure(context, [x, y, z], &mut memo, b, c)? > 0. + { + self.schedule = false; + return Ok(None); + } + self.schedule = a != b + || (s12 >= FLOWING_UPDATE_SIMILARITY && b != c) + || (s02 >= FLOWING_UPDATE_SIMILARITY && a != c) + || (s02 >= FLOWING_UPDATE_SIMILARITY + && similarity(distances[0], distances[3]) >= FLOWING_UPDATE_SIMILARITY + && a != self.status(context, indices[3])?); + Ok(Some(candidate)) + } +} +fn similarity(a: i32, b: i32) -> f64 { + 1. - b.wrapping_sub(a) as f64 / 25. +} diff --git a/crates/horizon-world/src/worldgen/biome.rs b/crates/horizon-world/src/worldgen/biome.rs new file mode 100644 index 000000000..7847d679b --- /dev/null +++ b/crates/horizon-world/src/worldgen/biome.rs @@ -0,0 +1,153 @@ +//! Multi-noise biome resolution over an imported immutable parameter table. +//! Vanilla biome JSON codecs and built-in preset builders remain separate work. +use super::{ + DecodeError, + climate::{ + ClimateIndex, ClimateSampler, ClimateSearch, ClimateVolume, IndexError, Parameter, + ParameterPoint, + }, + density::identifier, +}; +use horizon_core::density::{SampleError, SamplerContext}; + +/// Identity within an immutable biome registry snapshot. +#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct BiomeId(pub u32); + +#[derive(Debug)] +pub enum BiomeError { + Decode(DecodeError), + Index(IndexError), + Sample(SampleError), + OutsideVolume, +} +impl std::fmt::Display for BiomeError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Decode(e) => e.fmt(f), + Self::Index(e) => e.fmt(f), + Self::Sample(e) => e.fmt(f), + Self::OutsideVolume => f.write_str("biome query is outside the prepared quart volume"), + } + } +} +impl std::error::Error for BiomeError {} +impl From for BiomeError { + fn from(e: DecodeError) -> Self { + Self::Decode(e) + } +} +impl From for BiomeError { + fn from(e: IndexError) -> Self { + Self::Index(e) + } +} +impl From for BiomeError { + fn from(e: SampleError) -> Self { + Self::Sample(e) + } +} + +#[derive(Debug)] +pub struct MultiNoiseBiomeSource { + parameters: ClimateIndex, +} +impl MultiNoiseBiomeSource { + pub fn new(entries: Vec<(ParameterPoint, String)>) -> Result { + let entries = entries + .into_iter() + .map(|(point, name)| Ok((point, identifier(&name)?))) + .collect::>()?; + Ok(Self { + parameters: ClimateIndex::new(entries)?, + }) + } + /// Horizon's quantized import format, not the vanilla biome definition + /// codec: [{"coordinates":[[min,max]; six],"offset":long,"biome":id}]. + /// Built-in numeric tables stay private and are authenticated by the runner. + pub fn from_quantized_json(json: &str) -> Result { + let input: serde_json::Value = serde_json::from_str(json).map_err(DecodeError::from)?; + let mut entries = Vec::new(); + for entry in input + .as_array() + .ok_or(DecodeError::Field("biome parameter list"))? + { + let raw = entry["coordinates"] + .as_array() + .filter(|v| v.len() == 6) + .ok_or(DecodeError::Field("climate coordinates"))?; + let mut coordinates = [Parameter::new(0, 0); 6]; + for (coordinate, raw) in coordinates.iter_mut().zip(raw) { + let raw = raw + .as_array() + .filter(|v| v.len() == 2) + .ok_or(DecodeError::Field("climate interval"))?; + *coordinate = Parameter::new( + raw[0] + .as_i64() + .ok_or(DecodeError::Field("climate minimum"))?, + raw[1] + .as_i64() + .ok_or(DecodeError::Field("climate maximum"))?, + ); + } + let offset = entry["offset"] + .as_i64() + .ok_or(DecodeError::Field("climate offset"))?; + let biome = entry["biome"] + .as_str() + .ok_or(DecodeError::Field("biome identifier"))?; + entries.push(( + ParameterPoint { + coordinates, + offset, + }, + biome.to_owned(), + )); + } + Self::new(entries) + } + pub fn parameters(&self) -> &ClimateIndex { + &self.parameters + } + pub fn resolver<'a>(&'a self, climate: &'a ClimateSampler) -> BiomeResolver<'a> { + BiomeResolver { + climate, + search: self.parameters.searcher(), + } + } +} +#[derive(Debug)] +pub struct BiomeResolver<'a> { + climate: &'a ClimateSampler, + search: ClimateSearch<'a, String>, +} +impl<'a> BiomeResolver<'a> { + pub fn sample( + &mut self, + context: &mut SamplerContext, + quart: [i32; 3], + ) -> Result<&'a str, BiomeError> { + Ok(self + .search + .find(self.climate.sample(context, quart)?)? + .as_str()) + } + pub fn prepare_volume( + &self, + context: &mut SamplerContext, + minimum: [i32; 3], + extents: [i32; 3], + ) -> Result { + Ok(self.climate.sample_volume(context, minimum, extents)?) + } + /// Query order shares the same previous-leaf state as scalar resolution. + pub fn sample_prepared( + &mut self, + volume: &ClimateVolume, + quart: [i32; 3], + ) -> Result<&'a str, BiomeError> { + let target = volume.target(quart).ok_or(BiomeError::OutsideVolume)?; + Ok(self.search.find(target)?.as_str()) + } +} diff --git a/crates/horizon-world/src/worldgen/biome_chunk.rs b/crates/horizon-world/src/worldgen/biome_chunk.rs new file mode 100644 index 000000000..3d7e903f4 --- /dev/null +++ b/crates/horizon-world/src/worldgen/biome_chunk.rs @@ -0,0 +1,178 @@ +//! Quart-resolution biome storage and section-atomic noise-biome filling. +use crate::heightmap::{Heightmap, HeightmapError, HeightmapType}; +use horizon_core::{ + biome::BiomeZoom, + position::{BlockPos, ChunkPos}, +}; +use std::collections::{BTreeMap, BTreeSet}; + +#[derive(Clone, Debug)] +pub struct BiomeChunk { + position: ChunkPos, + min_y: i32, + height: i32, + sections: Vec<[T; 64]>, +} +#[derive(Debug, PartialEq, Eq)] +pub enum BiomeFillError { + InvalidBounds, + Resolve(E), +} +impl std::fmt::Display for BiomeFillError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::InvalidBounds => f.write_str("biome generation bounds are outside the chunk"), + Self::Resolve(error) => error.fmt(f), + } + } +} +impl std::error::Error for BiomeFillError {} +impl BiomeChunk { + /// A chunk's biome values use the same supported vertical bounds as terrain. + /// Each section stores a dense 4×4×4 array; palette/network codecs are separate. + pub fn new( + position: ChunkPos, + min_y: i32, + height: i32, + default: T, + ) -> Result { + Heightmap::new(HeightmapType::WorldSurfaceWg, min_y, height)?; + Ok(Self { + position, + min_y, + height, + sections: (0..height / 16) + .map(|_| std::array::from_fn(|_| default.clone())) + .collect(), + }) + } + pub fn section(&self, index: usize) -> Option<&[T; 64]> { + self.sections.get(index) + } + /// Vanilla clamps quart Y to the chunk and wraps X/Z to the local 4×4 grid. + /// The caller is responsible for selecting the chunk containing X/Z. + pub fn noise_biome(&self, quart: [i32; 3]) -> &T { + let bottom = self.min_y >> 2; + let y = quart[1].clamp(bottom, bottom + (self.height >> 2) - 1); + let section = ((y - bottom) >> 2) as usize; + &self.sections[section][index(quart[0], y, quart[2])] + } + /// Fill the sections intersecting inclusive generation bounds. Sections are + /// visited bottom to top; each resolver sees X/Y/Z loop order. A failed + /// section retains its previous values while earlier sections stay committed. + /// This does not decorate the resolver with blending or below-zero retrogen. + pub fn fill( + &mut self, + min_y: i32, + max_y: i32, + mut resolve: impl FnMut([i32; 3]) -> Result, + ) -> Result<(), BiomeFillError> { + if min_y < self.min_y || max_y >= self.min_y + self.height || min_y > max_y { + return Err(BiomeFillError::InvalidBounds); + } + let x = self.position.x.wrapping_shl(4) >> 2; + let z = self.position.z.wrapping_shl(4) >> 2; + for section_y in (min_y >> 4)..=(max_y >> 4) { + let section = (section_y - (self.min_y >> 4)) as usize; + let mut values = self.sections[section].clone(); + for dx in 0..4 { + for dy in 0..4 { + for dz in 0..4 { + let quart = [ + x.wrapping_add(dx), + section_y.wrapping_shl(2).wrapping_add(dy), + z.wrapping_add(dz), + ]; + values[index(dx, dy, dz)] = + resolve(quart).map_err(BiomeFillError::Resolve)?; + } + } + } + self.sections[section] = values; + } + Ok(()) + } +} +fn index(x: i32, y: i32, z: i32) -> usize { + (((y & 3) << 4) | ((z & 3) << 2) | (x & 3)) as usize +} + +/// Resident biome sections shared by decoration selection and block biome zoom. +/// The seed is already obfuscated, as for `BiomeZoom` and the client protocol. +pub struct BiomeRegion { + chunks: BTreeMap<(i32, i32), BiomeChunk>, + zoom: BiomeZoom, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum BiomeRegionError { + InvalidChunks, + MissingChunk(ChunkPos), +} +impl std::fmt::Display for BiomeRegionError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{self:?}") + } +} +impl std::error::Error for BiomeRegionError {} +impl BiomeRegion { + pub fn new(chunks: Vec>, obfuscated_seed: i64) -> Result { + if chunks.is_empty() || chunks.len() > 4096 { + return Err(BiomeRegionError::InvalidChunks); + } + let min = chunks[0].min_y; + let height = chunks[0].height; + let mut stored = BTreeMap::new(); + for chunk in chunks { + if chunk.min_y != min || chunk.height != height { + return Err(BiomeRegionError::InvalidChunks); + } + if stored + .insert((chunk.position.x, chunk.position.z), chunk) + .is_some() + { + return Err(BiomeRegionError::InvalidChunks); + } + } + Ok(Self { + chunks: stored, + zoom: BiomeZoom::new(obfuscated_seed), + }) + } + pub fn chunk(&self, p: ChunkPos) -> Result<&BiomeChunk, BiomeRegionError> { + self.chunks + .get(&(p.x, p.z)) + .ok_or(BiomeRegionError::MissingChunk(p)) + } + pub fn chunk_mut(&mut self, p: ChunkPos) -> Result<&mut BiomeChunk, BiomeRegionError> { + self.chunks + .get_mut(&(p.x, p.z)) + .ok_or(BiomeRegionError::MissingChunk(p)) + } + pub fn noise_biome(&self, quart: [i32; 3]) -> Result<&T, BiomeRegionError> { + Ok(self + .chunk(ChunkPos::new(quart[0] >> 2, quart[2] >> 2))? + .noise_biome(quart)) + } + pub fn biome(&self, block: BlockPos) -> Result<&T, BiomeRegionError> { + self.noise_biome(self.zoom.quart_at_block(block)) + } + pub fn quart_at_block(&self, block: BlockPos) -> [i32; 3] { + self.zoom.quart_at_block(block) + } + /// Distinct values currently stored anywhere in the chunk. The result is + /// sorted by biome identity; callers must not use this order as registry order. + pub fn present_in_chunk(&self, p: ChunkPos) -> Result, BiomeRegionError> + where + T: Ord, + { + Ok(self + .chunk(p)? + .sections + .iter() + .flatten() + .cloned() + .collect::>() + .into_iter() + .collect()) + } +} diff --git a/crates/horizon-world/src/worldgen/biome_predicate.rs b/crates/horizon-world/src/worldgen/biome_predicate.rs new file mode 100644 index 000000000..46554e1a9 --- /dev/null +++ b/crates/horizon-world/src/worldgen/biome_predicate.rs @@ -0,0 +1,81 @@ +//! Immutable biome identities and resolved holder sets for world predicates. +use super::{DecodeError, biome::BiomeId, density::identifier}; +use std::{ + collections::{BTreeMap, BTreeSet}, + sync::Arc, +}; +pub struct BiomePredicateBindings { + names: BTreeMap, + tags: BTreeMap>>, +} +impl BiomePredicateBindings { + /// IDs must belong to the same registry snapshot as the world's biome query. + pub fn new( + names: &BTreeMap, + tags: &BTreeMap>, + ) -> Result { + if names.len() > 8192 || tags.len() > 8192 { + return Err(DecodeError::Field("predicate biome registry size")); + } + let mut canonical = BTreeMap::new(); + let mut ids = BTreeSet::new(); + for (name, id) in names { + if canonical.insert(identifier(name)?, *id).is_some() || !ids.insert(*id) { + return Err(DecodeError::Field("duplicate predicate biome identity")); + } + } + let mut bound_tags = BTreeMap::new(); + for (name, entries) in tags { + if entries.len() > 8192 { + return Err(DecodeError::Field("predicate biome tag size")); + } + let values = entries + .iter() + .map(|entry| { + canonical + .get(&identifier(entry)?) + .copied() + .ok_or_else(|| DecodeError::Registry(format!("unknown biome {entry}"))) + }) + .collect::, _>>()?; + if bound_tags + .insert(super::tags::identifier(name)?, Arc::new(values)) + .is_some() + { + return Err(DecodeError::Field("duplicate predicate biome tag")); + } + } + Ok(Self { + names: canonical, + tags: bound_tags, + }) + } + pub fn resolve(&self, json: &str) -> Result>, DecodeError> { + if let Ok(name) = serde_json::from_str::(json) { + if let Some(tag) = name.strip_prefix('#') { + return self + .tags + .get(&super::tags::identifier(tag)?) + .cloned() + .ok_or_else(|| DecodeError::Registry(format!("unknown biome tag {tag}"))); + } + return Ok(Arc::new(BTreeSet::from([self.biome(&name)?]))); + } + let names: Vec = serde_json::from_str(json)?; + if names.len() > 8192 { + return Err(DecodeError::Field("predicate biome holder list")); + } + Ok(Arc::new( + names + .iter() + .map(|name| self.biome(name)) + .collect::>()?, + )) + } + fn biome(&self, name: &str) -> Result { + self.names + .get(&identifier(name)?) + .copied() + .ok_or_else(|| DecodeError::Registry(format!("unknown biome {name}"))) + } +} diff --git a/crates/horizon-world/src/worldgen/biome_source.rs b/crates/horizon-world/src/worldgen/biome_source.rs new file mode 100644 index 000000000..bb2cf8990 --- /dev/null +++ b/crates/horizon-world/src/worldgen/biome_source.rs @@ -0,0 +1,92 @@ +//! Fixed, checkerboard and End biome-source queries. Registry codecs are separate. +mod codec; +mod runtime; +pub use codec::{BiomeSet, BiomeSourceCatalog, BiomeSourceDefinition}; +use horizon_core::density::{DensitySampler, SampleError, SamplerContext}; +pub use runtime::{BiomeSourceError, BiomeSourceResolver, ResolvedBiomeSource}; + +#[derive(Clone, Debug)] +pub struct FixedBiomeSource { + pub biome: T, +} +impl FixedBiomeSource { + pub fn noise_biome(&self, _quart: [i32; 3]) -> &T { + &self.biome + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum CheckerboardError { + TooManyBiomes, + EmptyBiomes, +} +impl std::fmt::Display for CheckerboardError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{self:?}") + } +} +impl std::error::Error for CheckerboardError {} +#[derive(Clone, Debug)] +pub struct CheckerboardBiomeSource { + biomes: Vec, + scale: i32, +} +impl CheckerboardBiomeSource { + /// Runtime scale is unrestricted, including Java's masked shift distances. + /// The vanilla JSON codec separately limits scale to 0..=62. + pub fn new(biomes: Vec, scale: i32) -> Result { + if biomes.len() > 8192 { + return Err(CheckerboardError::TooManyBiomes); + } + Ok(Self { biomes, scale }) + } + pub fn noise_biome(&self, quart: [i32; 3]) -> Result<&T, CheckerboardError> { + if self.biomes.is_empty() { + return Err(CheckerboardError::EmptyBiomes); + } + let shift = self.scale.wrapping_add(2) as u32; + let cell = quart[0] + .wrapping_shr(shift) + .wrapping_add(quart[2].wrapping_shr(shift)); + Ok(&self.biomes[cell.rem_euclid(self.biomes.len() as i32) as usize]) + } +} +#[derive(Clone, Debug)] +pub struct EndBiomeSource { + pub center: T, + pub highlands: T, + pub midlands: T, + pub islands: T, + pub barrens: T, +} +impl EndBiomeSource { + /// The central 64-chunk circle bypasses erosion. Outside it, sample erosion + /// at the containing chunk's center with the original wrapped block Y. + pub fn noise_biome( + &self, + quart: [i32; 3], + erosion: &dyn DensitySampler, + context: &mut SamplerContext, + ) -> Result<&T, SampleError> { + let block = quart.map(|v| v.wrapping_shl(2)); + let x = block[0] >> 4; + let z = block[2] >> 4; + if i64::from(x) * i64::from(x) + i64::from(z) * i64::from(z) <= 4096 { + return Ok(&self.center); + } + let position = [ + x.wrapping_mul(2).wrapping_add(1).wrapping_mul(8), + block[1], + z.wrapping_mul(2).wrapping_add(1).wrapping_mul(8), + ]; + let value = erosion.sample_value(context, position)?; + Ok(if value > 0.25 { + &self.highlands + } else if value >= -0.0625 { + &self.midlands + } else if value < -0.21875 { + &self.islands + } else { + &self.barrens + }) + } +} diff --git a/crates/horizon-world/src/worldgen/biome_source/codec.rs b/crates/horizon-world/src/worldgen/biome_source/codec.rs new file mode 100644 index 000000000..ab78f4588 --- /dev/null +++ b/crates/horizon-world/src/worldgen/biome_source/codec.rs @@ -0,0 +1,262 @@ +//! Registry-bound biome-source definitions. Inline full biome objects are separate. +use crate::worldgen::{ + DecodeError, Object, RawValue, + climate::{ParameterPoint, decode_parameter_point, unquantize}, + density::identifier, + int_range, optional, required, +}; +use std::collections::{BTreeMap, BTreeSet}; + +#[derive(Clone, Debug, PartialEq, Eq)] +pub enum BiomeSet { + Direct(Vec), + Tag { name: String, members: Vec }, +} +impl BiomeSet { + pub fn members(&self) -> &[String] { + match self { + Self::Direct(values) => values, + Self::Tag { members, .. } => members, + } + } +} +#[derive(Clone, Debug, PartialEq, Eq)] +pub enum BiomeSourceDefinition { + Fixed(String), + Checkerboard { biomes: BiomeSet, scale: i32 }, + End, + MultiNoise(Vec<(ParameterPoint, String)>), + Preset { name: String, inline: bool }, +} +#[derive(Clone, Debug)] +pub struct BiomeSourceCatalog { + biomes: BTreeSet, + tags: BTreeMap>, + presets: BTreeSet, +} +impl BiomeSourceCatalog { + pub fn new( + biomes: &BTreeSet, + tags: &BTreeMap>, + presets: &BTreeSet, + ) -> Result { + if biomes.len() > 8192 + || tags.len() > 8192 + || presets.len() > 8192 + || tags.values().map(Vec::len).sum::() > 65536 + { + return Err(DecodeError::Field("biome source catalog size")); + } + let biomes = biomes + .iter() + .map(|v| identifier(v)) + .collect::, _>>()?; + let presets = presets + .iter() + .map(|v| identifier(v)) + .collect::, _>>()?; + let mut resolved = BTreeMap::new(); + for (name, members) in tags { + let members = members + .iter() + .map(|v| identifier(v)) + .collect::, _>>()?; + if members.iter().any(|v| !biomes.contains(v)) { + return Err(DecodeError::Field("unknown biome tag member")); + } + if resolved.insert(identifier(name)?, members).is_some() { + return Err(DecodeError::Field("duplicate biome tag")); + } + } + Ok(Self { + biomes, + tags: resolved, + presets, + }) + } + fn biome(&self, raw: &RawValue) -> Result { + let name = identifier(&serde_json::from_str::(raw.get())?)?; + if !self.biomes.contains(&name) { + return Err(DecodeError::Field("unknown biome")); + } + Ok(name) + } + fn set(&self, raw: &RawValue) -> Result { + if raw.get().starts_with('"') { + let name: String = serde_json::from_str(raw.get())?; + if let Some(name) = name.strip_prefix('#') { + let name = identifier(name)?; + let members = self + .tags + .get(&name) + .ok_or(DecodeError::Field("unknown biome tag"))? + .clone(); + return Ok(BiomeSet::Tag { name, members }); + } + return Ok(BiomeSet::Direct(vec![self.biome(raw)?])); + } + let values: Vec> = serde_json::from_str(raw.get())?; + if values.len() > 8192 { + return Err(DecodeError::Field("biome holder set size")); + } + Ok(BiomeSet::Direct( + values + .iter() + .map(|v| self.biome(v)) + .collect::>()?, + )) + } + fn inline(&self, raw: &RawValue) -> Result { + let entries: Vec = serde_json::from_str(raw.get())?; + if entries.is_empty() || entries.len() > 65536 { + return Err(DecodeError::Field("multi-noise entry count")); + } + let mut result = Vec::with_capacity(entries.len()); + for entry in entries { + result.push(( + decode_parameter_point(required(&entry, "parameters")?.get())?, + self.biome(required(&entry, "biome")?)?, + )); + } + Ok(BiomeSourceDefinition::MultiNoise(result)) + } + pub fn decode(&self, json: &str) -> Result { + let object: Object = serde_json::from_str(json)?; + let kind = identifier(&serde_json::from_str::( + required(&object, "type")?.get(), + )?)?; + Ok(match kind.as_str() { + "minecraft:fixed" => { + BiomeSourceDefinition::Fixed(self.biome(required(&object, "biome")?)?) + } + "minecraft:checkerboard" => BiomeSourceDefinition::Checkerboard { + biomes: self.set(required(&object, "biomes")?)?, + scale: optional(&object, "scale") + .map_or(Ok(2), |v| int_range(v, "biome scale", 0, 62))?, + }, + "minecraft:the_end" => { + for name in [ + "the_end", + "end_highlands", + "end_midlands", + "small_end_islands", + "end_barrens", + ] { + if !self.biomes.contains(&format!("minecraft:{name}")) { + return Err(DecodeError::Field("missing End biome")); + } + } + BiomeSourceDefinition::End + } + "minecraft:multi_noise" => { + // mapEither prefers a successful inline list, then tries preset. + if let Some(raw) = optional(&object, "biomes") { + if let Ok(value) = self.inline(raw) { + return Ok(value); + } + } + let raw = required(&object, "preset")?; + if raw.get().starts_with('"') { + let name = identifier(&serde_json::from_str::(raw.get())?)?; + if !self.presets.contains(&name) { + return Err(DecodeError::Field("unknown biome preset holder")); + } + BiomeSourceDefinition::Preset { + name, + inline: false, + } + } else { + let preset: Object = serde_json::from_str(raw.get())?; + let name = identifier(&serde_json::from_str::( + required(&preset, "preset")?.get(), + )?)?; + if !matches!(name.as_str(), "minecraft:overworld" | "minecraft:nether") { + return Err(DecodeError::Field("unknown built-in biome preset")); + } + BiomeSourceDefinition::Preset { name, inline: true } + } + } + _ => return Err(DecodeError::Field("unknown biome source")), + }) + } + /// Encode definitions in the vanilla canonical shape; decoding the result + /// validates registry references and bounds before publishing JSON. + pub fn encode(&self, definition: &BiomeSourceDefinition) -> Result { + let (kind, fields) = match definition { + BiomeSourceDefinition::Fixed(name) => ("fixed", format!(",\"biome\":{}", quoted(name))), + BiomeSourceDefinition::End => ("the_end", String::new()), + BiomeSourceDefinition::Checkerboard { biomes, scale } => { + let values = match biomes { + BiomeSet::Tag { name, .. } => quoted(&format!("#{name}")), + BiomeSet::Direct(values) if values.len() == 1 => quoted(&values[0]), + BiomeSet::Direct(values) => serde_json::to_string(values)?, + }; + ( + "checkerboard", + format!( + ",\"biomes\":{values}{}", + if *scale == 2 { + String::new() + } else { + format!(",\"scale\":{scale}") + } + ), + ) + } + BiomeSourceDefinition::MultiNoise(entries) => { + let values = entries + .iter() + .map(|(point, name)| { + format!( + "{{\"parameters\":{},\"biome\":{}}}", + point_json(point), + quoted(name) + ) + }) + .collect::>() + .join(","); + ("multi_noise", format!(",\"biomes\":[{values}]")) + } + BiomeSourceDefinition::Preset { name, inline } => { + let value = if *inline { + format!("{{\"preset\":{}}}", quoted(name)) + } else { + quoted(name) + }; + ("multi_noise", format!(",\"preset\":{value}")) + } + }; + let json = format!("{{\"type\":\"minecraft:{kind}\"{fields}}}"); + self.decode(&json)?; + Ok(json) + } +} +fn quoted(value: &str) -> String { + serde_json::to_string(value).expect("string serializes") +} +fn point_json(point: &ParameterPoint) -> String { + let names = [ + "temperature", + "humidity", + "continentalness", + "erosion", + "depth", + "weirdness", + ]; + let mut fields = Vec::with_capacity(7); + for (name, p) in names.into_iter().zip(point.coordinates) { + let min = serde_json::to_string(&unquantize(p.min)).expect("finite coordinate"); + let max = serde_json::to_string(&unquantize(p.max)).expect("finite coordinate"); + let value = if min == max { + min + } else { + format!("[{min},{max}]") + }; + fields.push(format!("{}:{value}", quoted(name))); + } + fields.push(format!( + "\"offset\":{}", + serde_json::to_string(&unquantize(point.offset)).expect("finite offset") + )); + format!("{{{}}}", fields.join(",")) +} diff --git a/crates/horizon-world/src/worldgen/biome_source/runtime.rs b/crates/horizon-world/src/worldgen/biome_source/runtime.rs new file mode 100644 index 000000000..5d78fd835 --- /dev/null +++ b/crates/horizon-world/src/worldgen/biome_source/runtime.rs @@ -0,0 +1,170 @@ +//! World-bound biome sources and per-worker resolver state. +use super::{ + BiomeSourceDefinition, CheckerboardBiomeSource, CheckerboardError, EndBiomeSource, + FixedBiomeSource, +}; +use crate::worldgen::{ + DecodeError, + biome::{BiomeError, BiomeResolver, MultiNoiseBiomeSource}, + climate::{ClimateSampler, ClimateVolume}, +}; +use horizon_core::density::{DensitySampler, SampleError, SamplerContext}; +use std::collections::{BTreeMap, BTreeSet}; + +#[derive(Debug)] +pub enum BiomeSourceError { + Decode(DecodeError), + Biome(BiomeError), + Checkerboard(CheckerboardError), + Sample(SampleError), + MissingPreset, +} +impl std::fmt::Display for BiomeSourceError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{self:?}") + } +} +impl std::error::Error for BiomeSourceError {} +impl From for BiomeSourceError { + fn from(e: DecodeError) -> Self { + Self::Decode(e) + } +} +impl From for BiomeSourceError { + fn from(e: BiomeError) -> Self { + Self::Biome(e) + } +} +impl From for BiomeSourceError { + fn from(e: CheckerboardError) -> Self { + Self::Checkerboard(e) + } +} +impl From for BiomeSourceError { + fn from(e: SampleError) -> Self { + Self::Sample(e) + } +} + +#[derive(Debug)] +pub enum ResolvedBiomeSource { + Fixed(FixedBiomeSource), + Checkerboard(CheckerboardBiomeSource), + End(EndBiomeSource), + MultiNoise(MultiNoiseBiomeSource), +} +impl BiomeSourceDefinition { + /// Resolve a decoded definition using immutable, authenticated quantized + /// preset tables. This does not execute vanilla's built-in preset builders. + pub fn resolve( + &self, + presets: &BTreeMap, + ) -> Result { + Ok(match self { + Self::Fixed(biome) => ResolvedBiomeSource::Fixed(FixedBiomeSource { + biome: biome.clone(), + }), + Self::Checkerboard { biomes, scale } => ResolvedBiomeSource::Checkerboard( + CheckerboardBiomeSource::new(biomes.members().to_vec(), *scale)?, + ), + Self::End => ResolvedBiomeSource::End(EndBiomeSource { + center: "minecraft:the_end".into(), + highlands: "minecraft:end_highlands".into(), + midlands: "minecraft:end_midlands".into(), + islands: "minecraft:small_end_islands".into(), + barrens: "minecraft:end_barrens".into(), + }), + Self::MultiNoise(entries) => { + ResolvedBiomeSource::MultiNoise(MultiNoiseBiomeSource::new(entries.clone())?) + } + Self::Preset { name, .. } => { + ResolvedBiomeSource::MultiNoise(MultiNoiseBiomeSource::from_quantized_json( + presets.get(name).ok_or(BiomeSourceError::MissingPreset)?, + )?) + } + }) + } +} +impl ResolvedBiomeSource { + pub fn possible_biomes(&self) -> BTreeSet<&str> { + match self { + Self::Fixed(source) => [source.biome.as_str()].into(), + Self::Checkerboard(source) => source.biomes.iter().map(String::as_str).collect(), + Self::End(source) => [ + source.center.as_str(), + source.highlands.as_str(), + source.midlands.as_str(), + source.islands.as_str(), + source.barrens.as_str(), + ] + .into(), + Self::MultiNoise(source) => source + .parameters() + .entries() + .iter() + .map(|(_, name)| name.as_str()) + .collect(), + } + } + /// Keep one resolver per worker to retain native previous-leaf tie behavior. + /// Climate and erosion roots must share the worker's compiler/context namespace. + pub fn resolver<'a>( + &'a self, + climate: &'a ClimateSampler, + erosion: &'a dyn DensitySampler, + ) -> BiomeSourceResolver<'a> { + match self { + Self::Fixed(source) => BiomeSourceResolver::Fixed(source), + Self::Checkerboard(source) => BiomeSourceResolver::Checkerboard(source), + Self::End(source) => BiomeSourceResolver::End(source, erosion), + Self::MultiNoise(source) => BiomeSourceResolver::MultiNoise(source.resolver(climate)), + } + } +} +#[derive(Debug)] +pub enum BiomeSourceResolver<'a> { + Fixed(&'a FixedBiomeSource), + Checkerboard(&'a CheckerboardBiomeSource), + End(&'a EndBiomeSource, &'a dyn DensitySampler), + MultiNoise(BiomeResolver<'a>), +} +impl<'a> BiomeSourceResolver<'a> { + pub fn sample( + &mut self, + context: &mut SamplerContext, + quart: [i32; 3], + ) -> Result<&'a str, BiomeSourceError> { + Ok(match self { + Self::Fixed(source) => source.biome.as_str(), + Self::Checkerboard(source) => source.noise_biome(quart)?.as_str(), + Self::End(source, erosion) => source.noise_biome(quart, *erosion, context)?.as_str(), + Self::MultiNoise(source) => source.sample(context, quart)?, + }) + } + /// Native fixed/checkerboard/End sources do not pre-sample a climate volume. + /// Multi-noise preparation samples the full supplied quart extent once. + pub fn prepare_volume( + &self, + context: &mut SamplerContext, + minimum: [i32; 3], + extents: [i32; 3], + ) -> Result, BiomeSourceError> { + match self { + Self::MultiNoise(source) => Ok(Some(source.prepare_volume(context, minimum, extents)?)), + _ => Ok(None), + } + } + pub fn sample_prepared( + &mut self, + context: &mut SamplerContext, + volume: Option<&ClimateVolume>, + quart: [i32; 3], + ) -> Result<&'a str, BiomeSourceError> { + if let Self::MultiNoise(source) = self { + if let Some(volume) = volume { + return Ok(source.sample_prepared(volume, quart)?); + } + } + self.sample(context, quart) + } +} diff --git a/crates/horizon-world/src/worldgen/biome_temperature.rs b/crates/horizon-world/src/worldgen/biome_temperature.rs new file mode 100644 index 000000000..c7e22c985 --- /dev/null +++ b/crates/horizon-world/src/worldgen/biome_temperature.rs @@ -0,0 +1,193 @@ +//! Biome temperature sampling and a worker-local vanilla temperature cache. +use super::{DecodeError, Object, number_text, optional, required}; +use horizon_core::{ + noise::{Noise, NoiseStack, SimplexNoise}, + position::BlockPos, + random::LegacyRandom, +}; +use std::{ + collections::{HashMap, VecDeque, hash_map::Entry}, + sync::{Arc, OnceLock}, +}; + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum TemperatureModifier { + None, + Frozen, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum Precipitation { + None, + Rain, + Snow, +} +#[derive(Clone, Copy, Debug)] +pub struct BiomeTemperatureSettings { + pub base_temperature: f32, + pub modifier: TemperatureModifier, + pub has_precipitation: bool, + pub downfall: f32, +} +struct TemperatureNoises { + height: SimplexNoise, + frozen: NoiseStack, + info: SimplexNoise, +} +fn noises() -> &'static TemperatureNoises { + static NOISES: OnceLock = OnceLock::new(); + NOISES.get_or_init(|| { + let mut random = LegacyRandom::new(3456); + let mut frozen = NoiseStack::builder(); + for (frequency, amplitude) in [ + (1.0, 1.0f32 / 7.0), + (0.5, 2.0f32 / 7.0), + (0.25, 4.0f32 / 7.0), + ] { + frozen.add( + Arc::new(SimplexNoise::with_skipped_offsets(&mut random, true)), + frequency, + amplitude, + ); + } + TemperatureNoises { + height: SimplexNoise::with_skipped_offsets(&mut LegacyRandom::new(1234), true), + frozen: frozen.build().expect("fixed finite noise layers"), + info: SimplexNoise::with_skipped_offsets(&mut LegacyRandom::new(2345), true), + } + }) +} +impl TemperatureModifier { + pub fn modify(self, position: BlockPos, base: f32) -> f32 { + if self == Self::Frozen { + let sources = noises(); + let x = f64::from(position.x); + let z = f64::from(position.z); + let frozen = f64::from(sources.frozen.get2(x * 0.05, z * 0.05) * 7.0); + let info = f64::from(sources.info.get2(x * 0.2, z * 0.2)); + if frozen + info < 0.3 && f64::from(sources.info.get2(x * 0.09, z * 0.09)) < 0.8 { + return 0.2; + } + } + base + } +} +impl BiomeTemperatureSettings { + /// Decode the climate fields of a biome. Other biome fields are ignored, + /// matching the native ClimateSettings map codec rather than the full biome. + pub fn from_json(json: &str) -> Result { + let object: Object = serde_json::from_str(json)?; + let float = |name| { + number_text(required(&object, name)?)? + .parse::() + .map_err(|_| DecodeError::Field(name)) + }; + let modifier = match optional(&object, "temperature_modifier") { + None => TemperatureModifier::None, + Some(raw) => match serde_json::from_str::(raw.get())?.as_str() { + "none" => TemperatureModifier::None, + "frozen" => TemperatureModifier::Frozen, + _ => return Err(DecodeError::Field("temperature_modifier")), + }, + }; + Ok(Self { + base_temperature: float("temperature")?, + downfall: float("downfall")?, + has_precipitation: serde_json::from_str(required(&object, "has_precipitation")?.get())?, + modifier, + }) + } + + pub fn height_adjusted(self, position: BlockPos, sea_level: i32) -> f32 { + let base = self.modifier.modify(position, self.base_temperature); + let start = sea_level.wrapping_add(17); + if position.y > start { + let variation = noises().height.get2( + f64::from(position.x as f32 / 8.0), + f64::from(position.z as f32 / 8.0), + ) * 8.0; + base - ((variation + position.y as f32 - start as f32) * 0.05 / 40.0) + } else { + base + } + } +} + +/// Keep one instance per biome per worker, matching vanilla's thread-local map. +/// Hits do not reorder entries. The packed-position key deliberately omits sea +/// level, so a cached value survives queries with a different sea level. +#[derive(Debug)] +pub struct BiomeTemperature { + settings: BiomeTemperatureSettings, + values: HashMap, + order: VecDeque, +} +impl BiomeTemperature { + pub fn new(settings: BiomeTemperatureSettings) -> Self { + Self { + settings, + values: HashMap::with_capacity(1024), + order: VecDeque::with_capacity(1024), + } + } + pub fn settings(&self) -> BiomeTemperatureSettings { + self.settings + } + pub fn temperature(&mut self, position: BlockPos, sea_level: i32) -> f32 { + let key = position.pack(); + if let Some(value) = self + .values + .get(&key) + .copied() + .filter(|value| !value.is_nan()) + { + return value; + } + let value = self.settings.height_adjusted(position, sea_level); + // NaN is both the missing-value sentinel and a possible stored value. + // Recomputing an existing NaN at capacity still evicts the oldest key. + if self.values.len() == 1024 { + let first = self.order.pop_front().expect("full cache has entries"); + self.values.remove(&first); + } + match self.values.entry(key) { + Entry::Occupied(mut entry) => { + entry.insert(value); + } + Entry::Vacant(entry) => { + entry.insert(value); + self.order.push_back(key); + } + } + value + } + pub fn warm_enough_to_rain(&mut self, position: BlockPos, sea_level: i32) -> bool { + self.temperature(position, sea_level) >= 0.15 + } + pub fn cold_enough_to_snow(&mut self, position: BlockPos, sea_level: i32) -> bool { + !self.warm_enough_to_rain(position, sea_level) + } + pub fn should_melt_frozen_ocean_iceberg_slightly( + &mut self, + position: BlockPos, + sea_level: i32, + ) -> bool { + self.temperature(position, sea_level) > 0.1 + } + pub fn precipitation_at(&mut self, position: BlockPos, sea_level: i32) -> Precipitation { + if !self.settings.has_precipitation { + Precipitation::None + } else if self.cold_enough_to_snow(position, sea_level) { + Precipitation::Snow + } else { + Precipitation::Rain + } + } + pub fn cached_temperatures(&self) -> impl ExactSizeIterator + '_ { + self.order.iter().map(|key| (*key, self.values[key])) + } +} + +/// Fixed biome-information noise shared by temperature and placement rules. +pub fn biome_info_noise(x: f64, z: f64) -> f32 { + noises().info.get2(x, z) +} diff --git a/crates/horizon-world/src/worldgen/block_feature.rs b/crates/horizon-world/src/worldgen/block_feature.rs new file mode 100644 index 000000000..4684a4eb4 --- /dev/null +++ b/crates/horizon-world/src/worldgen/block_feature.rs @@ -0,0 +1,333 @@ +//! Registry-bound block-writing features and their state codec bindings. +use super::{ + DecodeError, Object, + density::identifier, + feature::FeatureWorld, + int_range, + placement::{PlacementContext, PlacementQueryError}, + required, +}; +use crate::block_properties::{BlockPropertiesRegistry, BlockProperty, BoundBlockProperty}; +use crate::registry::{BlockRegistry, BlockStateId, BlockStateJsonCodec}; +use std::{ + collections::{BTreeMap, BTreeSet}, + sync::Arc, +}; + +pub struct FeatureBlockBindings<'r> { + registry: &'r BlockRegistry, + physical_properties: Option<[BoundBlockProperty; 4]>, + biomes: Option>, + fluids: super::fluid_predicate::FluidPredicateBindings, + pub(crate) codec: BlockStateJsonCodec<'r>, + pub(crate) blocks: BTreeMap>>, + pub(crate) tags: BTreeMap>>, + pub(crate) air: [BlockStateId; 3], +} +impl<'r> FeatureBlockBindings<'r> { + pub fn with_block_properties( + mut self, + properties: &BlockPropertiesRegistry<'r>, + ) -> Result { + if !std::ptr::eq(self.registry, properties.registry()) { + return Err(DecodeError::Field( + "block properties use a different registry", + )); + } + self.physical_properties = Some([ + properties.bind(BlockProperty::Solid), + properties.bind(BlockProperty::Replaceable), + properties.bind(BlockProperty::Liquid), + properties.bind(BlockProperty::SolidRender), + ]); + Ok(self) + } + pub fn with_biomes( + mut self, + biomes: Arc, + ) -> Self { + self.biomes = Some(biomes); + self + } + + pub fn with_fluid_tags( + mut self, + tags: &BTreeMap>, + ) -> Result { + self.fluids = self.fluids.with_resolved_tags(tags)?; + Ok(self) + } + pub fn new( + registry: &'r BlockRegistry, + integers: BTreeSet<(String, String)>, + ) -> Result { + Self::with_tags(registry, integers, &BTreeMap::new()) + } + /// Bind an immutable snapshot of already-resolved block tags. + pub fn with_tags( + registry: &'r BlockRegistry, + integers: BTreeSet<(String, String)>, + tags: &BTreeMap>, + ) -> Result { + let codec = BlockStateJsonCodec::new(registry, integers) + .map_err(|e| DecodeError::Registry(e.to_string()))?; + let mut blocks = BTreeMap::>::new(); + for id in 0..registry.len() { + let id = BlockStateId(id as u32); + blocks + .entry(registry.state(id).unwrap().name.clone()) + .or_default() + .insert(id); + } + let mut bound_tags = BTreeMap::new(); + for (name, entries) in tags { + let mut states = BTreeSet::new(); + for name in entries { + states.extend( + blocks + .get(&identifier(name)?) + .ok_or_else(|| DecodeError::Registry(format!("unknown block {name}")))?, + ); + } + if bound_tags + .insert(super::tags::identifier(name)?, Arc::new(states)) + .is_some() + { + return Err(DecodeError::Field("duplicate block tag")); + } + } + let get = |name| { + registry + .default_state(name) + .ok_or_else(|| DecodeError::Registry(format!("unknown air block {name}"))) + }; + Ok(Self { + registry, + codec, + biomes: None, + physical_properties: None, + fluids: super::fluid_predicate::FluidPredicateBindings::new(registry)?, + blocks: blocks + .into_iter() + .map(|(name, states)| (name, Arc::new(states))) + .collect(), + tags: bound_tags, + air: [ + get("minecraft:air")?, + get("minecraft:cave_air")?, + get("minecraft:void_air")?, + ], + }) + } +} +impl super::block_predicate::PredicateBlockResolver for FeatureBlockBindings<'_> { + fn predicate_state(&self, json: &str) -> Result { + self.codec + .decode(json, false) + .map_err(|e| DecodeError::Registry(e.to_string())) + } + fn predicate_property( + &self, + property: BlockProperty, + ) -> Result { + let values = self + .physical_properties + .as_ref() + .ok_or(DecodeError::Field("predicate block property registry"))?; + Ok(values[match property { + BlockProperty::Solid => 0, + BlockProperty::Replaceable => 1, + BlockProperty::Liquid => 2, + BlockProperty::SolidRender => 3, + }] + .clone()) + } + fn predicate_biome_set( + &self, + json: &str, + ) -> Result>, DecodeError> { + self.biomes + .as_ref() + .ok_or(DecodeError::Field("predicate biome registry"))? + .resolve(json) + } + + fn predicate_fluid_set( + &self, + json: &str, + ) -> Result { + self.fluids.resolve(json) + } + fn predicate_block_set(&self, json: &str) -> Result>, DecodeError> { + if let Ok(name) = serde_json::from_str::(json) { + if let Some(tag) = name.strip_prefix('#') { + return self + .tags + .get(&super::tags::identifier(tag)?) + .cloned() + .ok_or_else(|| { + DecodeError::Registry(format!("unknown predicate block tag {tag}")) + }); + } + return self + .blocks + .get(&identifier(&name)?) + .cloned() + .ok_or_else(|| DecodeError::Registry(format!("unknown predicate block {name}"))); + } + let names: Vec = serde_json::from_str(json)?; + if names.len() > 8192 { + return Err(DecodeError::Field("predicate block list size")); + } + let mut states = BTreeSet::new(); + for name in names { + states.extend( + self.blocks + .get(&identifier(&name)?) + .ok_or_else(|| { + DecodeError::Registry(format!("unknown predicate block {name}")) + })? + .iter() + .copied(), + ); + } + Ok(Arc::new(states)) + } +} +#[derive(Clone, Debug)] +pub struct FillLayerFeature { + height: i32, + state: BlockStateId, + air: [BlockStateId; 3], +} +#[derive(Debug)] +pub enum BlockFeatureError { + World(E), + Query(PlacementQueryError), +} +impl std::fmt::Display for BlockFeatureError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::World(e) => e.fmt(f), + Self::Query(e) => e.fmt(f), + } + } +} +impl std::error::Error for BlockFeatureError {} +impl FillLayerFeature { + pub fn from_json(json: &str, bindings: &FeatureBlockBindings<'_>) -> Result { + let object: Object = serde_json::from_str(json)?; + let kind = identifier(&serde_json::from_str::( + required(&object, "type")?.get(), + )?)?; + if kind != "minecraft:fill_layer" { + return Err(DecodeError::Field("fill-layer feature type")); + } + Ok(Self { + height: int_range(required(&object, "height")?, "fill-layer height", 0, 4064)?, + state: bindings + .codec + .decode(required(&object, "state")?.get(), false) + .map_err(|e| DecodeError::Registry(e.to_string()))?, + air: bindings.air, + }) + } + pub fn place( + &self, + world: &mut W, + origin: [i32; 3], + ) -> Result> { + for dx in 0..16 { + for dz in 0..16 { + // Vanilla re-queries the world minimum for each column. + let y = world + .min_y() + .map_err(BlockFeatureError::Query)? + .wrapping_add(self.height); + let position = [origin[0].wrapping_add(dx), y, origin[2].wrapping_add(dz)]; + let state = world.block(position).map_err(BlockFeatureError::World)?; + if self.air.contains(&state) { + world + .set_block(position, self.state, 2) + .map_err(BlockFeatureError::World)?; + } + } + } + Ok(true) + } +} + +#[derive(Clone, Debug)] +pub struct ReplaceBlockFeature { + targets: Vec<(super::rule_test::RuleTest, BlockStateId)>, +} +impl ReplaceBlockFeature { + pub fn from_json(json: &str, bindings: &FeatureBlockBindings<'_>) -> Result { + Self::decode(json, bindings, 0, &mut 65536) + } + pub(crate) fn decode( + json: &str, + bindings: &FeatureBlockBindings<'_>, + depth: usize, + remaining: &mut usize, + ) -> Result { + let object: Object = serde_json::from_str(json)?; + let kind = identifier(&serde_json::from_str::( + required(&object, "type")?.get(), + )?)?; + if kind != "minecraft:replace_single_block" { + return Err(DecodeError::Field("replace-block feature type")); + } + let targets = decode_targets(&object, bindings, depth, remaining)?; + Ok(Self { targets }) + } + pub fn place( + &self, + world: &mut W, + random: &mut impl horizon_core::random::RandomSource, + origin: [i32; 3], + ) -> Result> { + for (rule, state) in &self.targets { + let current = world.block(origin).map_err(BlockFeatureError::World)?; + if rule.test(current, origin, random) { + world + .set_block(origin, *state, 2) + .map_err(BlockFeatureError::World)?; + break; + } + } + Ok(true) + } +} + +pub(crate) type BlockReplacements = Vec<(super::rule_test::RuleTest, BlockStateId)>; +pub(crate) fn decode_targets( + object: &Object, + bindings: &FeatureBlockBindings<'_>, + depth: usize, + remaining: &mut usize, +) -> Result { + let values: Vec> = + serde_json::from_str(required(object, "targets")?.get())?; + if values.len() > 8192 { + return Err(DecodeError::Field("replacement targets")); + } + values + .iter() + .map(|value| { + let object: Object = serde_json::from_str(value.get())?; + Ok(( + super::rule_test::RuleTest::decode( + required(&object, "target")?.get(), + bindings, + depth + 1, + remaining, + )?, + bindings + .codec + .decode(required(&object, "state")?.get(), false) + .map_err(|e| DecodeError::Registry(e.to_string()))?, + )) + }) + .collect::>() +} diff --git a/crates/horizon-world/src/worldgen/block_predicate.rs b/crates/horizon-world/src/worldgen/block_predicate.rs new file mode 100644 index 000000000..a4709abc2 --- /dev/null +++ b/crates/horizon-world/src/worldgen/block_predicate.rs @@ -0,0 +1,360 @@ +//! Initial world-position predicates with ordered short-circuit evaluation. +use super::anchor::VerticalAnchor; +use super::placement::{PlacementContext, PlacementQueryError}; +use super::{DecodeError, Object, density::identifier, integer, optional, required}; +use crate::{ + block_properties::{BlockProperty, BoundBlockProperty}, + registry::BlockStateId, +}; +use horizon_core::geometry::Direction; +use serde_json::value::RawValue; +use std::{collections::BTreeSet, sync::Arc}; + +/// Resolve a block holder set against the same immutable registry used by world +/// queries. Unknown blocks/tags fail during decoding, even in unused branches. +pub trait PredicateBlockResolver { + fn predicate_state(&self, _json: &str) -> Result { + Err(DecodeError::Field("predicate block state registry")) + } + fn predicate_property( + &self, + _property: BlockProperty, + ) -> Result { + Err(DecodeError::Field("predicate block property registry")) + } + fn predicate_biome_set( + &self, + _json: &str, + ) -> Result>, DecodeError> { + Err(DecodeError::Field("predicate biome registry")) + } + fn predicate_fluid_set( + &self, + _json: &str, + ) -> Result { + Err(DecodeError::Field("predicate fluid registry")) + } + fn predicate_block_set(&self, json: &str) -> Result>, DecodeError>; +} + +#[derive(Clone, Debug)] +pub enum BlockPredicate { + True, + Unobstructed, + WouldSurvive { + state: BlockStateId, + offset: [i32; 3], + }, + HasSturdyFace { + direction: Direction, + offset: [i32; 3], + }, + Property { + property: BoundBlockProperty, + offset: [i32; 3], + }, + MatchingBiomes(Arc>), + MatchingFluids { + fluids: super::fluid_predicate::BoundFluidSet, + offset: [i32; 3], + }, + MatchingBlocks { + states: Arc>, + offset: [i32; 3], + }, + MatchingBlockTag { + tag: String, + offset: [i32; 3], + }, + HeightRange { + min: VerticalAnchor, + max: VerticalAnchor, + }, + Volume { + min: [i32; 3], + max: [i32; 3], + predicate: Box, + }, + Not(Box), + All(Vec), + Any(Vec), + InsideWorldBounds([i32; 3]), +} +impl BlockPredicate { + pub fn from_json(json: &str) -> Result { + Self::decode(json, 0, &mut 65536) + } + pub(crate) fn decode( + json: &str, + depth: usize, + remaining: &mut usize, + ) -> Result { + Self::decode_with_blocks(json, depth, remaining, None) + } + pub fn from_json_with_blocks( + json: &str, + blocks: &impl PredicateBlockResolver, + ) -> Result { + Self::decode_with_blocks(json, 0, &mut 65536, Some(blocks)) + } + pub(crate) fn decode_with_blocks( + json: &str, + depth: usize, + remaining: &mut usize, + blocks: Option<&dyn PredicateBlockResolver>, + ) -> Result { + if depth > 256 || *remaining == 0 { + return Err(DecodeError::Field("block predicate depth or node count")); + } + *remaining -= 1; + let object: Object = serde_json::from_str(json)?; + let kind = identifier(&serde_json::from_str::( + required(&object, "type")?.get(), + )?)?; + match kind.as_str() { + "minecraft:would_survive" => Ok(Self::WouldSurvive { + state: blocks + .ok_or(DecodeError::Field("predicate block state registry"))? + .predicate_state(required(&object, "state")?.get())?, + offset: optional(&object, "offset") + .map(offset) + .transpose()? + .unwrap_or([0; 3]), + }), + "minecraft:has_sturdy_face" => { + let name: String = serde_json::from_str(required(&object, "direction")?.get())?; + let direction = match name.as_str() { + "down" => Direction::Down, + "up" => Direction::Up, + "north" => Direction::North, + "south" => Direction::South, + "west" => Direction::West, + "east" => Direction::East, + _ => return Err(DecodeError::Field("predicate direction")), + }; + Ok(Self::HasSturdyFace { + direction, + offset: optional(&object, "offset") + .map(offset) + .transpose()? + .unwrap_or([0; 3]), + }) + } + + "minecraft:solid" | "minecraft:replaceable" => Ok(Self::Property { + property: blocks + .ok_or(DecodeError::Field("predicate block property registry"))? + .predicate_property(if kind == "minecraft:solid" { + BlockProperty::Solid + } else { + BlockProperty::Replaceable + })?, + offset: optional(&object, "offset") + .map(offset) + .transpose()? + .unwrap_or([0; 3]), + }), + "minecraft:unobstructed" => { + if let Some(raw) = optional(&object, "offset") { + vector(raw)?; + } + // The pinned evaluator deliberately ignores its decoded offset. + Ok(Self::Unobstructed) + } + "minecraft:matching_biomes" => Ok(Self::MatchingBiomes( + blocks + .ok_or(DecodeError::Field("predicate biome registry"))? + .predicate_biome_set(required(&object, "biomes")?.get())?, + )), + "minecraft:matching_fluids" => Ok(Self::MatchingFluids { + fluids: blocks + .ok_or(DecodeError::Field("predicate fluid registry"))? + .predicate_fluid_set(required(&object, "fluids")?.get())?, + offset: optional(&object, "offset") + .map(offset) + .transpose()? + .unwrap_or([0; 3]), + }), + "minecraft:matching_blocks" => Ok(Self::MatchingBlocks { + states: blocks + .ok_or(DecodeError::Field("predicate block registry"))? + .predicate_block_set(required(&object, "blocks")?.get())?, + offset: optional(&object, "offset") + .map(offset) + .transpose()? + .unwrap_or([0; 3]), + }), + "minecraft:matching_block_tag" => Ok(Self::MatchingBlockTag { + tag: super::tags::identifier(&serde_json::from_str::( + required(&object, "tag")?.get(), + )?)?, + offset: optional(&object, "offset") + .map(offset) + .transpose()? + .unwrap_or([0; 3]), + }), + "minecraft:height_range" => Ok(Self::HeightRange { + min: VerticalAnchor::from_json(required(&object, "min_inclusive")?.get())?, + max: VerticalAnchor::from_json(required(&object, "max_inclusive")?.get())?, + }), + "minecraft:volume_match" => { + let min = offset(required(&object, "min")?)?; + let max = offset(required(&object, "max")?)?; + if (0..3).any(|i| min[i] > max[i]) { + return Err(DecodeError::Field("predicate volume bounds")); + } + Ok(Self::Volume { + min, + max, + predicate: Box::new(Self::decode_with_blocks( + required(&object, "match")?.get(), + depth + 1, + remaining, + blocks, + )?), + }) + } + "minecraft:true" => Ok(Self::True), + "minecraft:not" => Ok(Self::Not(Box::new(Self::decode_with_blocks( + required(&object, "predicate")?.get(), + depth + 1, + remaining, + blocks, + )?))), + "minecraft:all_of" | "minecraft:any_of" => { + let values: Vec> = + serde_json::from_str(required(&object, "predicates")?.get())?; + if values.len() > 8192 { + return Err(DecodeError::Field("predicate list")); + } + let values = values + .iter() + .map(|v| Self::decode_with_blocks(v.get(), depth + 1, remaining, blocks)) + .collect::>()?; + Ok(if kind == "minecraft:all_of" { + Self::All(values) + } else { + Self::Any(values) + }) + } + "minecraft:inside_world_bounds" => Ok(Self::InsideWorldBounds( + optional(&object, "offset") + .map(offset) + .transpose()? + .unwrap_or([0; 3]), + )), + _ => Err(DecodeError::Field("block predicate type")), + } + } + pub fn test( + &self, + world: &mut impl PlacementContext, + position: [i32; 3], + ) -> Result { + self.test_inner(world, position, 0, &mut 65536) + } + pub(crate) fn test_inner( + &self, + world: &mut impl PlacementContext, + position: [i32; 3], + depth: usize, + remaining: &mut usize, + ) -> Result { + if depth > 256 || *remaining == 0 { + return Err(PlacementQueryError::WorkLimit); + } + *remaining -= 1; + match self { + Self::WouldSurvive { state, offset } => world.block_survives( + *state, + std::array::from_fn(|i| position[i].wrapping_add(offset[i])), + ), + Self::Property { property, offset } => { + let state = world + .block_state(std::array::from_fn(|i| position[i].wrapping_add(offset[i])))?; + Ok(property.contains(state)) + } + Self::HasSturdyFace { direction, offset } => world.face_sturdy( + std::array::from_fn(|i| position[i].wrapping_add(offset[i])), + *direction, + ), + Self::Unobstructed => world.unobstructed_block(position), + Self::MatchingBiomes(biomes) => Ok(biomes.contains(&world.biome_identity(position)?)), + Self::MatchingFluids { fluids, offset } => { + let state = world + .block_state(std::array::from_fn(|i| position[i].wrapping_add(offset[i])))?; + Ok(fluids.contains(state)) + } + Self::MatchingBlocks { states, offset } => { + let state = world + .block_state(std::array::from_fn(|i| position[i].wrapping_add(offset[i])))?; + Ok(states.contains(&state)) + } + Self::MatchingBlockTag { tag, offset } => world.block_matches_tag( + std::array::from_fn(|i| position[i].wrapping_add(offset[i])), + tag, + ), + Self::HeightRange { min, max } => { + let context = world.predicate_generation()?; + let min = min.resolve(context); + let max = max.resolve(context); + Ok(position[1] >= min && position[1] <= max) + } + Self::Volume { + min, + max, + predicate, + } => { + // Native order is X, Z, Y. Each child shares the evaluation + // budget, including nested volumes and early-failing queries. + for x in min[0]..=max[0] { + for z in min[2]..=max[2] { + for y in min[1]..=max[1] { + let offset = [x, y, z]; + let p = std::array::from_fn(|i| position[i].wrapping_add(offset[i])); + if !predicate.test_inner(world, p, depth + 1, remaining)? { + return Ok(false); + } + } + } + } + Ok(true) + } + Self::True => Ok(true), + Self::Not(value) => Ok(!value.test_inner(world, position, depth + 1, remaining)?), + Self::All(values) | Self::Any(values) => { + let all = matches!(self, Self::All(_)); + for value in values { + let result = value.test_inner(world, position, depth + 1, remaining)?; + if result != all { + return Ok(result); + } + } + Ok(all) + } + Self::InsideWorldBounds(offset) => world + .inside_build_height(std::array::from_fn(|i| position[i].wrapping_add(offset[i]))), + } + } +} + +fn vector(raw: &RawValue) -> Result<[i32; 3], DecodeError> { + let values: Vec> = serde_json::from_str(raw.get())?; + if values.len() != 3 { + return Err(DecodeError::Field("predicate offset")); + } + let mut result = [0; 3]; + for (out, value) in result.iter_mut().zip(values.iter()) { + *out = integer(value)?; + } + Ok(result) +} + +fn offset(raw: &RawValue) -> Result<[i32; 3], DecodeError> { + let result = vector(raw)?; + // Native Math.abs(MIN_VALUE) wraps and passes this codec. + if result.iter().any(|v| v.wrapping_abs() > 16) { + return Err(DecodeError::Field("predicate offset")); + } + Ok(result) +} diff --git a/crates/horizon-world/src/worldgen/bulk_section.rs b/crates/horizon-world/src/worldgen/bulk_section.rs new file mode 100644 index 000000000..9628ac510 --- /dev/null +++ b/crates/horizon-world/src/worldgen/bulk_section.rs @@ -0,0 +1,113 @@ +//! Exclusive bulk access to resident sections, bypassing chunk heightmap writes. +use super::{ + feature_region::{RegionError, TerrainRegion}, + placement::{PlacementContext, PlacementQueryError}, + terrain::{TerrainBlockStates, TerrainError}, +}; +use crate::{heightmap::HeightmapType, registry::BlockStateId}; +use horizon_core::position::{BlockPos, SectionPos}; +use std::collections::BTreeMap; + +pub struct TerrainBulkAccess<'a, 'r, B: TerrainBlockStates> { + region: &'a mut TerrainRegion<'r, B>, + min_section: i32, + section_count: i32, + air: BlockStateId, + acquired: BTreeMap, + last: Option<(i64, SectionPos)>, +} +impl<'a, 'r, B: TerrainBlockStates> TerrainBulkAccess<'a, 'r, B> { + pub fn new(region: &'a mut TerrainRegion<'r, B>) -> Result { + let first = region.chunks().next().ok_or(RegionError::InvalidChunks)?; + let min_section = first.min_y() >> 4; + let section_count = first.height() / 16; + let air = first + .registry() + .default_state("minecraft:air") + .ok_or(RegionError::InvalidChunks)?; + Ok(Self { + region, + min_section, + section_count, + air, + acquired: BTreeMap::new(), + last: None, + }) + } + fn resolve(&mut self, p: [i32; 3]) -> Result, RegionError> { + let section = BlockPos::new(p[0], p[1], p[2]).section(); + let index = section.y.wrapping_sub(self.min_section); + if index < 0 || index >= self.section_count { + return Ok(None); + } + let key = section.pack(); + if let Some((last, section)) = self.last { + if last == key { + return Ok(Some(section)); + } + } + let cached = if let Some(cached) = self.acquired.get(&key) { + *cached + } else { + // Missing chunks do not enter the cache. Preserve packed-key aliasing + // at coordinates beyond the signed section-coordinate bit width. + self.region.chunk(section.x, section.z)?; + self.acquired.insert(key, section); + section + }; + self.last = Some((key, cached)); + Ok(Some(cached)) + } + pub fn has_section(&mut self, position: [i32; 3]) -> Result { + Ok(self.resolve(position)?.is_some()) + } + pub fn acquired_section_count(&self) -> usize { + self.acquired.len() + } + /// Direct section reads retain cave/void air in otherwise all-air sections. + /// Positions outside the vertical range return AIR without a chunk lookup. + pub fn block(&mut self, position: [i32; 3]) -> Result { + let Some(section) = self.resolve(position)? else { + return Ok(self.air); + }; + let index = section.y.wrapping_sub(self.min_section) as usize; + let p = BlockPos::new(position[0], position[1], position[2]); + self.region + .chunk(section.x, section.z)? + .section(index) + .ok_or(RegionError::InvalidChunks)? + .get(p.section_index()) + .map_err(|e| TerrainError::from(e).into()) + } + /// Raw section mutation: no chunk heightmap, POI, light or neighbor effects. + /// The caller is responsible for checking the region's write permissions. + pub fn set_block( + &mut self, + position: [i32; 3], + state: BlockStateId, + ) -> Result, RegionError> { + let Some(section) = self.resolve(position)? else { + return Ok(None); + }; + let y = section.y.wrapping_shl(4).wrapping_add(position[1] & 15); + Ok(Some( + self.region.chunk_mut(section.x, section.z)?.set_block_raw( + position[0], + y, + position[2], + state, + )?, + )) + } + pub fn world_block(&self, position: [i32; 3]) -> Result { + self.region.block(position) + } + pub fn height( + &mut self, + kind: HeightmapType, + x: i32, + z: i32, + ) -> Result { + self.region.height(kind, x, z) + } +} diff --git a/crates/horizon-world/src/worldgen/carver.rs b/crates/horizon-world/src/worldgen/carver.rs new file mode 100644 index 000000000..6ca5feb3e --- /dev/null +++ b/crates/horizon-world/src/worldgen/carver.rs @@ -0,0 +1,296 @@ +//! Seeded carver paths using pinned scalar providers and shared mask geometry. +mod canyon; +mod generation; +use super::{ + DecodeError, Object, + anchor::WorldGenerationContext, + density::identifier, + height_provider::HeightProvider, + number_text, optional, required, + value_provider::{FloatProvider, IntProvider}, +}; +pub use canyon::{CanyonCarver, CanyonShape}; +pub use generation::{ + CarverCatalog, MaskGenerationError, WorldCarver, generate_carving_mask, large_feature_random, +}; +use horizon_core::{ + carving::{CarveError, CarverOutput, can_reach, carve_ellipsoid_with_budget}, + geometry::trig::{cos, sin}, + position::ChunkPos, + random::{InvalidBound, LegacyRandom, RandomSource}, +}; + +#[derive(Clone, Debug)] +pub struct CaveCarver { + pub probability: f32, + pub y: HeightProvider, + pub count: IntProvider, + pub thickness: FloatProvider, + pub weird_thickness_bias: bool, + pub room_vertical_radius_multiplier: FloatProvider, + pub horizontal_radius_multiplier: FloatProvider, + pub vertical_radius_multiplier: FloatProvider, + pub start_vertical_radius_multiplier: FloatProvider, + pub floor_level: FloatProvider, +} +#[derive(Debug)] +pub enum CarverError { + Random(InvalidBound), + Geometry(CarveError), + IterationLimit, + InvalidBounds, +} +impl std::fmt::Display for CarverError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Random(e) => e.fmt(f), + Self::Geometry(e) => e.fmt(f), + Self::IterationLimit => f.write_str("carver work limit exceeded"), + Self::InvalidBounds => f.write_str("carver output or generation bounds are invalid"), + } + } +} +impl std::error::Error for CarverError {} +impl From for CarverError { + fn from(e: InvalidBound) -> Self { + Self::Random(e) + } +} +impl From> for CarverError { + fn from(e: CarveError) -> Self { + Self::Geometry(e) + } +} +impl CaveCarver { + pub fn from_json(json: &str) -> Result { + let object: Object = serde_json::from_str(json)?; + let kind = identifier(&serde_json::from_str::( + required(&object, "type")?.get(), + )?)?; + if kind != "minecraft:cave" { + return Err(DecodeError::Field("cave carver type")); + } + let probability: f32 = number_text(required(&object, "probability")?)? + .parse() + .map_err(|_| DecodeError::Field("carver probability"))?; + if !(0.0..=1.0).contains(&probability) || probability.is_sign_negative() { + return Err(DecodeError::Field("carver probability")); + } + let count = IntProvider::from_json(required(&object, "count")?.get())?; + if count.bounds()[0] < 0 { + return Err(DecodeError::Field("carver count")); + } + let provider = |name| FloatProvider::from_json(required(&object, name)?.get()); + let thickness = provider("thickness")?; + if thickness.bounds()[0] < 0. { + return Err(DecodeError::Field("carver thickness")); + } + let floor_level = provider("floor_level")?; + if floor_level.bounds()[0] < -1. || floor_level.bounds()[1] > 1. { + return Err(DecodeError::Field("carver floor")); + } + Ok(Self { + probability, + y: HeightProvider::from_json(required(&object, "y")?.get())?, + count, + thickness, + weird_thickness_bias: optional(&object, "weird_thickness_bias") + .map(|v| serde_json::from_str(v.get())) + .transpose()? + .unwrap_or(false), + room_vertical_radius_multiplier: provider("room_vertical_radius_multiplier")?, + horizontal_radius_multiplier: provider("horizontal_radius_multiplier")?, + vertical_radius_multiplier: provider("vertical_radius_multiplier")?, + start_vertical_radius_multiplier: optional(&object, "start_vertical_radius_multiplier") + .map(|v| FloatProvider::from_json(v.get())) + .transpose()? + .unwrap_or(FloatProvider::Constant(1.)), + floor_level, + }) + } + pub fn is_start_chunk(&self, random: &mut impl RandomSource) -> bool { + random.next_float() <= self.probability + } + /// Carve one origin chunk's paths into the target output. The caller performs + /// start-chunk selection separately. Local tunnel RNGs always use the legacy + /// algorithm, regardless of the caller's RNG. At most 4096 starts and 2^24 + /// candidate cells are allowed; errors preserve random draws and prior output. + pub fn carve( + &self, + context: WorldGenerationContext, + random: &mut impl RandomSource, + target: ChunkPos, + origin: ChunkPos, + output: &mut O, + ) -> Result> { + let count = self.count.sample(random)?; + if count > 4096 { + return Err(CarverError::IterationLimit); + } + let mut budget = 1 << 24; + for _ in 0..count { + let x = f64::from( + origin + .x + .wrapping_shl(4) + .wrapping_add(random.next_int_bound(16)?), + ); + let y = f64::from(self.y.sample(random, context)?); + let z = f64::from( + origin + .z + .wrapping_shl(4) + .wrapping_add(random.next_int_bound(16)?), + ); + let horizontal = f64::from(self.horizontal_radius_multiplier.sample(random)); + let vertical = f64::from(self.vertical_radius_multiplier.sample(random)); + let start_vertical = f64::from(self.start_vertical_radius_multiplier.sample(random)); + let floor = f64::from(self.floor_level.sample(random)); + let mut run = CaveRun { + target, + output, + budget: &mut budget, + horizontal, + vertical, + floor, + }; + let mut tunnels = 1; + if random.next_int_bound(4)? == 0 { + let multiplier = f64::from(self.room_vertical_radius_multiplier.sample(random)); + let thickness = 1. + random.next_float() * 6.; + let radius = + 1.5 + f64::from(sin(f64::from(std::f32::consts::FRAC_PI_2)) * thickness); + run.ellipsoid([x + 1., y, z], radius, radius * multiplier)?; + tunnels += random.next_int_bound(4)?; + } + for _ in 0..tunnels { + let yaw = random.next_float() * std::f32::consts::TAU; + let pitch = (random.next_float() - 0.5) / 4.; + let mut thickness = self.thickness.sample(random); + if self.weird_thickness_bias && random.next_int_bound(10)? == 0 { + thickness *= random.next_float() * random.next_float() * 3. + 1.; + } + let end = 112 - random.next_int_bound(28)?; + run.tunnel(Tunnel { + seed: random.next_long(), + position: [x, y, z], + thickness, + yaw, + pitch, + start: 0, + end, + vertical_scale: start_vertical, + })?; + } + } + Ok(true) + } +} +struct CaveRun<'a, O: CarverOutput> { + target: ChunkPos, + output: &'a mut O, + budget: &'a mut usize, + horizontal: f64, + vertical: f64, + floor: f64, +} +#[derive(Clone, Copy)] +struct Tunnel { + seed: i64, + position: [f64; 3], + thickness: f32, + yaw: f32, + pitch: f32, + start: i32, + end: i32, + vertical_scale: f64, +} +impl CaveRun<'_, O> { + fn ellipsoid( + &mut self, + position: [f64; 3], + horizontal: f64, + vertical: f64, + ) -> Result<(), CarverError> { + let floor = self.floor; + Ok(carve_ellipsoid_with_budget( + self.target, + position, + horizontal, + vertical, + self.output, + |[x, y, z], _| y <= floor || x * x + y * y + z * z >= 1., + self.budget, + )?) + } + fn tunnel(&mut self, mut path: Tunnel) -> Result<(), CarverError> { + let mut random = LegacyRandom::new(path.seed); + let split = random.next_int_bound(path.end / 2)? + path.end / 4; + let gentle = random.next_int_bound(6)? == 0; + let (mut yaw_change, mut pitch_change) = (0f32, 0f32); + for step in path.start..path.end { + let radius = 1.5 + + f64::from( + sin(f64::from( + std::f32::consts::PI * step as f32 / path.end as f32, + )) * path.thickness, + ); + let vertical = radius * path.vertical_scale; + let cos_pitch = cos(f64::from(path.pitch)); + path.position[0] += f64::from(cos(f64::from(path.yaw)) * cos_pitch); + path.position[1] += f64::from(sin(f64::from(path.pitch))); + path.position[2] += f64::from(sin(f64::from(path.yaw)) * cos_pitch); + path.pitch *= if gentle { 0.92 } else { 0.7 }; + path.pitch += pitch_change * 0.1; + path.yaw += yaw_change * 0.1; + pitch_change *= 0.9; + yaw_change *= 0.75; + pitch_change += (random.next_float() - random.next_float()) * random.next_float() * 2.; + yaw_change += (random.next_float() - random.next_float()) * random.next_float() * 4.; + if step == split && path.thickness > 1. { + let seed = random.next_long(); + let thickness = random.next_float() * 0.5 + 0.5; + self.tunnel(Tunnel { + seed, + thickness, + yaw: path.yaw - std::f32::consts::FRAC_PI_2, + pitch: path.pitch / 3., + start: step, + vertical_scale: 1., + ..path + })?; + let seed = random.next_long(); + let thickness = random.next_float() * 0.5 + 0.5; + self.tunnel(Tunnel { + seed, + thickness, + yaw: path.yaw + std::f32::consts::FRAC_PI_2, + pitch: path.pitch / 3., + start: step, + vertical_scale: 1., + ..path + })?; + return Ok(()); + } + if random.next_int_bound(4)? == 0 { + continue; + } + if !can_reach( + self.target, + path.position[0], + path.position[2], + step, + path.end, + path.thickness, + ) { + return Ok(()); + } + self.ellipsoid( + path.position, + radius * self.horizontal, + vertical * self.vertical, + )?; + } + Ok(()) + } +} diff --git a/crates/horizon-world/src/worldgen/carver/canyon.rs b/crates/horizon-world/src/worldgen/carver/canyon.rs new file mode 100644 index 000000000..33f745f54 --- /dev/null +++ b/crates/horizon-world/src/worldgen/carver/canyon.rs @@ -0,0 +1,161 @@ +use super::*; +use crate::worldgen::int_range; + +#[derive(Clone, Debug)] +pub struct CanyonShape { + pub distance_factor: FloatProvider, + pub thickness: FloatProvider, + pub width_smoothness: i32, + pub horizontal_radius_factor: FloatProvider, + pub vertical_radius_default_factor: f32, + pub vertical_radius_center_factor: f32, + pub y_scale: FloatProvider, +} +#[derive(Clone, Debug)] +pub struct CanyonCarver { + pub probability: f32, + pub y: HeightProvider, + pub vertical_rotation: FloatProvider, + pub shape: CanyonShape, +} +impl CanyonCarver { + pub fn from_json(json: &str) -> Result { + let object: Object = serde_json::from_str(json)?; + let kind = identifier(&serde_json::from_str::( + required(&object, "type")?.get(), + )?)?; + if kind != "minecraft:canyon" { + return Err(DecodeError::Field("canyon carver type")); + } + let probability = scalar(&object, "probability")?; + if !(0.0..=1.0).contains(&probability) || probability.is_sign_negative() { + return Err(DecodeError::Field("carver probability")); + } + let shape: Object = serde_json::from_str(required(&object, "shape")?.get())?; + let provider = |name| FloatProvider::from_json(required(&shape, name)?.get()); + Ok(Self { + probability, + y: HeightProvider::from_json(required(&object, "y")?.get())?, + vertical_rotation: FloatProvider::from_json( + required(&object, "vertical_rotation")?.get(), + )?, + shape: CanyonShape { + distance_factor: provider("distance_factor")?, + thickness: provider("thickness")?, + width_smoothness: int_range( + required(&shape, "width_smoothness")?, + "width_smoothness", + 1, + i32::MAX, + )?, + horizontal_radius_factor: provider("horizontal_radius_factor")?, + vertical_radius_default_factor: scalar(&shape, "vertical_radius_default_factor")?, + vertical_radius_center_factor: scalar(&shape, "vertical_radius_center_factor")?, + y_scale: provider("y_scale")?, + }, + }) + } + pub fn is_start_chunk(&self, random: &mut impl RandomSource) -> bool { + random.next_float() <= self.probability + } + /// Generate a canyon from one origin chunk. Width factors cover the entire + /// generation height and use a separate legacy random stream. Output bounds + /// must lie within that height; paths are bounded to 4096 steps, 4064 width + /// entries and 2^24 candidate cells. Earlier output survives errors. + pub fn carve( + &self, + context: WorldGenerationContext, + random: &mut impl RandomSource, + target: ChunkPos, + origin: ChunkPos, + output: &mut O, + ) -> Result> { + let mut x = f64::from( + origin + .x + .wrapping_shl(4) + .wrapping_add(random.next_int_bound(16)?), + ); + let mut y = f64::from(self.y.sample(random, context)?); + let mut z = f64::from( + origin + .z + .wrapping_shl(4) + .wrapping_add(random.next_int_bound(16)?), + ); + let mut yaw = random.next_float() * std::f32::consts::TAU; + let mut pitch = self.vertical_rotation.sample(random); + let y_scale = f64::from(self.shape.y_scale.sample(random)); + let thickness = self.shape.thickness.sample(random); + let end = (112f32 * self.shape.distance_factor.sample(random)) as i32; + let mut local = LegacyRandom::new(random.next_long()); + if !(1..=4064).contains(&context.height) + || output.min_y() < context.min_y + || i64::from(output.max_y()) > i64::from(context.min_y) + i64::from(context.height) + { + return Err(CarverError::InvalidBounds); + } + if end > 4096 { + return Err(CarverError::IterationLimit); + } + let mut width = Vec::with_capacity(context.height as usize); + let mut factor = 1f32; + for index in 0..context.height { + if index == 0 || local.next_int_bound(self.shape.width_smoothness)? == 0 { + factor = 1. + local.next_float() * local.next_float(); + } + width.push(factor * factor); + } + let (mut yaw_change, mut pitch_change) = (0f32, 0f32); + let mut budget = 1 << 24; + for step in 0..end { + let mut horizontal = 1.5 + + f64::from( + sin(f64::from(step as f32 * std::f32::consts::PI / end as f32)) * thickness, + ); + let mut vertical = horizontal * y_scale; + horizontal *= f64::from(self.shape.horizontal_radius_factor.sample(&mut local)); + let center = 1. - (0.5 - step as f32 / end as f32).abs() * 2.; + let multiplier = self.shape.vertical_radius_default_factor + + self.shape.vertical_radius_center_factor * center; + vertical = (f64::from(multiplier) * vertical) + * f64::from(local.next_float() * (1. - 0.75) + 0.75); + let cos_pitch = cos(f64::from(pitch)); + let sin_pitch = sin(f64::from(pitch)); + x += f64::from(cos(f64::from(yaw)) * cos_pitch); + y += f64::from(sin_pitch); + z += f64::from(sin(f64::from(yaw)) * cos_pitch); + pitch *= 0.7; + pitch += pitch_change * 0.05; + yaw += yaw_change * 0.05; + pitch_change *= 0.8; + yaw_change *= 0.5; + pitch_change += (local.next_float() - local.next_float()) * local.next_float() * 2.; + yaw_change += (local.next_float() - local.next_float()) * local.next_float() * 4.; + if local.next_int_bound(4)? == 0 { + continue; + } + if !can_reach(target, x, z, step, end, thickness) { + return Ok(true); + } + carve_ellipsoid_with_budget( + target, + [x, y, z], + horizontal, + vertical, + output, + |[nx, ny, nz], by| { + let factor = width[by.wrapping_sub(context.min_y).wrapping_sub(1) as usize]; + (nx * nx + nz * nz) * f64::from(factor) + ny * ny / 6. >= 1. + }, + &mut budget, + )?; + } + Ok(true) + } +} +fn scalar(object: &Object, name: &'static str) -> Result { + number_text(required(object, name)?)? + .parse() + .map_err(|_| DecodeError::Field(name)) +} diff --git a/crates/horizon-world/src/worldgen/carver/generation.rs b/crates/horizon-world/src/worldgen/carver/generation.rs new file mode 100644 index 000000000..40cd5cfd3 --- /dev/null +++ b/crates/horizon-world/src/worldgen/carver/generation.rs @@ -0,0 +1,167 @@ +//! Biome-selected neighboring carvers and their per-entry legacy seeds. +use super::{CanyonCarver, CarverError, CaveCarver}; +use crate::worldgen::{ + DecodeError, Object, anchor::WorldGenerationContext, density::identifier, required, +}; +use horizon_core::{ + carving::{CarverOutput, CarvingMask, CarvingMaskError}, + position::ChunkPos, + random::{LegacyRandom, RandomSource}, +}; +use std::{collections::BTreeMap, sync::Arc}; + +#[derive(Clone, Debug)] +pub enum WorldCarver { + Cave(CaveCarver), + Canyon(CanyonCarver), +} +impl WorldCarver { + pub fn from_json(json: &str) -> Result { + let object: Object = serde_json::from_str(json)?; + match identifier(&serde_json::from_str::( + required(&object, "type")?.get(), + )?)? + .as_str() + { + "minecraft:cave" => Ok(Self::Cave(CaveCarver::from_json(json)?)), + "minecraft:canyon" => Ok(Self::Canyon(CanyonCarver::from_json(json)?)), + _ => Err(DecodeError::Field("world carver type")), + } + } + pub fn is_start_chunk(&self, random: &mut impl RandomSource) -> bool { + match self { + Self::Cave(c) => c.is_start_chunk(random), + Self::Canyon(c) => c.is_start_chunk(random), + } + } + pub fn carve( + &self, + context: WorldGenerationContext, + random: &mut impl RandomSource, + target: ChunkPos, + origin: ChunkPos, + output: &mut O, + ) -> Result> { + match self { + Self::Cave(c) => c.carve(context, random, target, origin, output), + Self::Canyon(c) => c.carve(context, random, target, origin, output), + } + } +} +/// Immutable named carvers. Inline definitions and direct holder lists are +/// supported; tagged sets and live registry reloads remain separate work. +pub struct CarverCatalog { + definitions: BTreeMap>, +} +impl CarverCatalog { + pub fn from_json(definitions: &BTreeMap) -> Result { + if definitions.len() > 8192 { + return Err(DecodeError::Field("carver registry size")); + } + let mut result = BTreeMap::new(); + for (name, json) in definitions { + let name = identifier(name)?; + if result + .insert(name, Arc::new(WorldCarver::from_json(json)?)) + .is_some() + { + return Err(DecodeError::Field("duplicate carver name")); + } + } + Ok(Self { + definitions: result, + }) + } + pub fn decode_set(&self, json: &str) -> Result>, DecodeError> { + use serde_json::value::RawValue; + let raw: Box = serde_json::from_str(json)?; + let entries: Vec> = if raw.get().starts_with('[') { + serde_json::from_str(raw.get())? + } else { + vec![raw] + }; + if entries.len() > 1024 { + return Err(DecodeError::Field("biome carver count")); + } + entries + .iter() + .map(|raw| { + if let Ok(name) = serde_json::from_str::(raw.get()) { + let name = identifier(&name)?; + self.definitions + .get(&name) + .cloned() + .ok_or_else(|| DecodeError::Registry(format!("unknown carver {name}"))) + } else { + Ok(Arc::new(WorldCarver::from_json(raw.get())?)) + } + }) + .collect() + } +} +#[derive(Debug)] +pub enum MaskGenerationError { + Source(E), + Mask(CarvingMaskError), + Carver(CarverError), + TooManyCarvers, +} +impl std::fmt::Display for MaskGenerationError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Source(e) => e.fmt(f), + Self::Mask(e) => e.fmt(f), + Self::Carver(e) => e.fmt(f), + Self::TooManyCarvers => f.write_str("biome carver count exceeds 1024"), + } + } +} +impl std::error::Error for MaskGenerationError {} + +/// Build the union mask from a 17×17 origin neighborhood, X then Z. The provider +/// selects each origin's ordered biome carvers using its uncached biome resolver +/// at the origin's minimum quart X/Z and quart Y=0. Repeated entries keep their +/// individual ordinal seeds. The caller applies a successfully returned mask. +pub fn generate_carving_mask<'a, E>( + world_seed: i64, + target: ChunkPos, + context: WorldGenerationContext, + upgrading: bool, + mut carvers: impl FnMut(ChunkPos) -> Result<&'a [Arc], E>, +) -> Result> { + let min = context.min_y.wrapping_add(1); + let max = context + .min_y + .wrapping_add(context.height) + .wrapping_sub(1) + .wrapping_sub(if upgrading { 0 } else { 7 }); + let mut mask = CarvingMask::new(min, max).map_err(MaskGenerationError::Mask)?; + for dx in -8..=8 { + for dz in -8..=8 { + let origin = ChunkPos::new(target.x.wrapping_add(dx), target.z.wrapping_add(dz)); + let selected = carvers(origin).map_err(MaskGenerationError::Source)?; + if selected.len() > 1024 { + return Err(MaskGenerationError::TooManyCarvers); + } + for (index, carver) in selected.iter().enumerate() { + let mut random = + large_feature_random(world_seed.wrapping_add(index as i64), origin); + if carver.is_start_chunk(&mut random) { + carver + .carve(context, &mut random, target, origin, &mut mask) + .map_err(MaskGenerationError::Carver)?; + } + } + } + } + Ok(mask) +} +/// The legacy `WorldgenRandom.setLargeFeatureSeed` stream used by carving. +pub fn large_feature_random(seed: i64, origin: ChunkPos) -> LegacyRandom { + let mut random = LegacyRandom::new(seed); + let x = random.next_long(); + let z = random.next_long(); + random + .set_seed(i64::from(origin.x).wrapping_mul(x) ^ i64::from(origin.z).wrapping_mul(z) ^ seed); + random +} diff --git a/crates/horizon-world/src/worldgen/carving.rs b/crates/horizon-world/src/worldgen/carving.rs new file mode 100644 index 000000000..bb19df9d3 --- /dev/null +++ b/crates/horizon-world/src/worldgen/carving.rs @@ -0,0 +1,122 @@ +//! Apply ordered carving-mask intervals to pre-lighting terrain. +use super::{ + material_condition::{MaterialRule, MaterialSurfaceQueries}, + material_stage::{SurfaceError, TopMaterialInputs, top_material}, + terrain::{TerrainAquifer, TerrainBlockStates, TerrainChunk, TerrainError}, +}; +use crate::{ + heightmap::HeightmapState, + registry::{BlockRegistry, BlockStateId}, +}; +use horizon_core::{carving::CarvingMask, position::BlockPos, random::RandomSource}; +use std::collections::BTreeSet; + +/// Per-state predicates resolved once from the world's block registry and +/// `minecraft:uncarvable` tag. Keep these bound to the same registry as the chunk. +pub struct CarvingBlocks { + flags: Vec, +} +impl CarvingBlocks { + pub fn from_registry( + registry: &BlockRegistry, + uncarvable: &BTreeSet, + ) -> Result { + for name in uncarvable.iter().map(String::as_str).chain([ + "minecraft:grass_block", + "minecraft:mycelium", + "minecraft:dirt", + ]) { + if registry.default_state(name).is_none() { + return Err(TerrainError::InvalidState); + } + } + let flags = (0..registry.len()) + .map(|index| { + let name = ®istry.state(BlockStateId(index as u32)).unwrap().name; + u8::from(uncarvable.contains(name)) + | (u8::from(matches!( + name.as_str(), + "minecraft:grass_block" | "minecraft:mycelium" + )) << 1) + | (u8::from(name == "minecraft:dirt") << 2) + }) + .collect(); + Ok(Self { flags }) + } + fn flags(&self, state: BlockStateId) -> Result { + self.flags + .get(state.0 as usize) + .copied() + .ok_or(TerrainError::InvalidState) + } +} + +/// Visit mask runs in packed order and each interval top to bottom. The filter +/// receives local X/Z and absolute Y before any block or aquifer lookup. A run +/// remembers grass/mycelium even if its aquifer returns no replacement. Exposed +/// dirt below subsequent carved cells is restored through `top_material`. +/// Earlier writes, aquifer state and fluid postprocessing survive later errors. +pub fn apply_carving_mask( + chunk: &mut TerrainChunk<'_, B>, + mask: &CarvingMask, + rule: MaterialRule, + mut inputs: TopMaterialInputs<'_, R, S>, + aquifer: &mut (impl TerrainAquifer + ?Sized), + blocks: &CarvingBlocks, + mut filter: impl FnMut([i32; 3]) -> bool, +) -> Result<(), SurfaceError> +where + R::Positional: Clone, +{ + let cx = chunk.position().x.wrapping_shl(4); + let cz = chunk.position().z.wrapping_shl(4); + for column in mask.columns() { + let mut found_surface = false; + let x = cx.wrapping_add(column.x); + let z = cz.wrapping_add(column.z); + for y in (column.min_y..=column.max_y).rev() { + if !filter([column.x, y, column.z]) { + continue; + } + let flags = blocks.flags(chunk.block(x, y, z))?; + if flags & 1 != 0 { + continue; + } + found_surface |= flags & 2 != 0; + let Some(state) = aquifer + .compute_substance(inputs.density_context, [x, y, z], 0.) + .map_err(TerrainError::from)? + else { + continue; + }; + chunk.set_block_worldgen(x, y, z, state)?; + if aquifer.should_schedule_fluid_update() && chunk.block_properties(state).has_fluid() { + chunk.mark_postprocessing(x, y, z); + } + let below = y.wrapping_sub(1); + if found_surface && blocks.flags(chunk.block(x, below, z))? & 4 != 0 { + let submerged = chunk.block_properties(state).has_fluid(); + let replacement = top_material( + chunk, + rule.clone(), + TopMaterialInputs:: { + generation: inputs.generation, + root: inputs.root.clone(), + surface: &mut inputs.surface, + preliminary_surface: inputs.preliminary_surface.clone(), + density_context: inputs.density_context, + }, + BlockPos::new(x, below, z), + submerged, + )?; + if let Some(replacement) = replacement { + chunk.set_block_worldgen(x, below, z, replacement)?; + if chunk.block_properties(replacement).has_fluid() { + chunk.mark_postprocessing(x, below, z); + } + } + } + } + } + Ok(()) +} diff --git a/crates/horizon-world/src/worldgen/climate.rs b/crates/horizon-world/src/worldgen/climate.rs new file mode 100644 index 000000000..92c8bb080 --- /dev/null +++ b/crates/horizon-world/src/worldgen/climate.rs @@ -0,0 +1,118 @@ +//! Climate coordinates derived from the six terrain-router climate fields. +use horizon_core::density::{DensitySampler, SampleError, SamplerContext}; +use horizon_core::noise::DensityVolume; +use std::sync::Arc; +mod codec; +mod index; +pub use codec::{decode_parameter, decode_parameter_point}; +pub use index::{ClimateIndex, ClimateSearch, IndexError, Parameter, ParameterPoint}; + +/// Vanilla multiplies in float precision before the saturating Java long cast. +pub fn quantize(value: f32) -> i64 { + (value * 10_000.0) as i64 +} +pub fn unquantize(value: i64) -> f32 { + value as f32 / 10_000.0 +} +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct TargetPoint { + pub temperature: i64, + pub humidity: i64, + pub continentalness: i64, + pub erosion: i64, + pub depth: i64, + pub weirdness: i64, +} +impl TargetPoint { + pub fn from_values(values: [f32; 6]) -> Self { + let [ + temperature, + humidity, + continentalness, + erosion, + depth, + weirdness, + ] = values.map(quantize); + Self { + temperature, + humidity, + continentalness, + erosion, + depth, + weirdness, + } + } + /// The seventh parameter is the zero offset used by biome nearest searches. + pub const fn parameters(self) -> [i64; 7] { + [ + self.temperature, + self.humidity, + self.continentalness, + self.erosion, + self.depth, + self.weirdness, + 0, + ] + } +} +#[derive(Clone, Debug)] +pub struct ClimateSampler { + samplers: [Arc; 6], +} +impl ClimateSampler { + /// Temperature, humidity, continentalness, erosion, depth, weirdness. + pub fn new(samplers: [Arc; 6]) -> Self { + Self { samplers } + } + /// Coordinates are biome quart positions, converted with wrapped << 2. + /// Every child uses the same context and runs in field declaration order. + pub fn sample( + &self, + context: &mut SamplerContext, + quart: [i32; 3], + ) -> Result { + let position = quart.map(|coordinate| coordinate.wrapping_shl(2)); + let mut values = [0.; 6]; + for (sampler, value) in self.samplers.iter().zip(&mut values) { + *value = sampler.sample_value(context, position)?; + } + Ok(TargetPoint::from_values(values)) + } + /// Prepare all six field buffers in declaration order on the quart lattice. + /// Lookup quantizes the retained bulk values rather than resampling scalars. + pub fn sample_volume( + &self, + context: &mut SamplerContext, + quart_minimum: [i32; 3], + extents: [i32; 3], + ) -> Result { + let volume = DensityVolume::new(extents, quart_minimum.map(|v| v.wrapping_shl(2)), [4; 3])?; + let mut fields = std::array::from_fn(|_| vec![0.; volume.size()]); + for (sampler, field) in self.samplers.iter().zip(&mut fields) { + sampler.sample_volume(context, field, volume)?; + } + Ok(ClimateVolume { + quart_minimum, + volume, + fields, + }) + } +} +#[derive(Debug)] +pub struct ClimateVolume { + quart_minimum: [i32; 3], + volume: DensityVolume, + fields: [Vec; 6], +} +impl ClimateVolume { + /// Coordinates must be inside the prepared quart volume. The bounded Rust + /// API rejects invalid coordinates instead of Java's unchecked buffer alias. + pub fn target(&self, quart: [i32; 3]) -> Option { + let relative = + std::array::from_fn(|i| quart[i].wrapping_sub(self.quart_minimum[i]) as usize); + let index = self.volume.index(relative)?; + Some(TargetPoint::from_values(std::array::from_fn(|i| { + self.fields[i][index] + }))) + } +} diff --git a/crates/horizon-world/src/worldgen/climate/codec.rs b/crates/horizon-world/src/worldgen/climate/codec.rs new file mode 100644 index 000000000..8ea0d00d6 --- /dev/null +++ b/crates/horizon-world/src/worldgen/climate/codec.rs @@ -0,0 +1,59 @@ +use super::super::{DecodeError, Object, RawValue, number_text, required}; +use super::{Parameter, ParameterPoint, quantize}; + +fn float(raw: &RawValue, min: f32, max: f32) -> Result { + let value: f32 = number_text(raw)? + .parse() + .map_err(|_| DecodeError::Field("climate float"))?; + if value.total_cmp(&min).is_lt() || value.total_cmp(&max).is_gt() { + return Err(DecodeError::Field("climate float bounds")); + } + Ok(value) +} +fn parameter(raw: &RawValue) -> Result { + let (min, max) = if raw.get().starts_with('[') { + let values: Vec> = serde_json::from_str(raw.get())?; + if values.len() != 2 { + return Err(DecodeError::Field("climate interval length")); + } + (float(&values[0], -2., 2.)?, float(&values[1], -2., 2.)?) + } else if raw.get().starts_with('{') { + let object: Object = serde_json::from_str(raw.get())?; + ( + float(required(&object, "min")?, -2., 2.)?, + float(required(&object, "max")?, -2., 2.)?, + ) + } else { + let value = float(raw, -2., 2.)?; + (value, value) + }; + if min.total_cmp(&max).is_gt() { + return Err(DecodeError::Field("climate interval order")); + } + Ok(Parameter::new(quantize(min), quantize(max))) +} +/// Vanilla's scalar, two-element list or min/max object climate interval codec. +pub fn decode_parameter(json: &str) -> Result { + let raw: Box = serde_json::from_str(json)?; + parameter(&raw) +} +/// Six required climate intervals and a required offset in [0,1]. +pub fn decode_parameter_point(json: &str) -> Result { + let object: Object = serde_json::from_str(json)?; + let mut coordinates = [Parameter::new(0, 0); 6]; + for (coordinate, name) in coordinates.iter_mut().zip([ + "temperature", + "humidity", + "continentalness", + "erosion", + "depth", + "weirdness", + ]) { + *coordinate = parameter(required(&object, name)?)?; + } + let offset = quantize(float(required(&object, "offset")?, 0., 1.)?); + Ok(ParameterPoint { + coordinates, + offset, + }) +} diff --git a/crates/horizon-world/src/worldgen/climate/index.rs b/crates/horizon-world/src/worldgen/climate/index.rs new file mode 100644 index 000000000..3e9b50f51 --- /dev/null +++ b/crates/horizon-world/src/worldgen/climate/index.rs @@ -0,0 +1,325 @@ +//! Immutable climate search tree with an explicit per-worker previous result. +use super::{TargetPoint, quantize}; +use std::cmp::Ordering; + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct Parameter { + pub min: i64, + pub max: i64, +} +impl Parameter { + /// The record constructor does not validate endpoint order. + pub const fn new(min: i64, max: i64) -> Self { + Self { min, max } + } + pub fn point(value: f32) -> Self { + let value = quantize(value); + Self::new(value, value) + } + pub fn span(min: f32, max: f32) -> Result { + if min > max { + return Err(IndexError::InvertedSpan); + } + Ok(Self::new(quantize(min), quantize(max))) + } + pub fn distance(self, value: i64) -> i64 { + let above = value.wrapping_sub(self.max); + if above > 0 { + above + } else { + self.min.wrapping_sub(value).max(0) + } + } + fn union(self, other: Self) -> Self { + Self::new(self.min.min(other.min), self.max.max(other.max)) + } + fn center(self) -> i64 { + self.min.wrapping_add(self.max) / 2 + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct ParameterPoint { + /// Temperature, humidity, continentalness, erosion, depth, weirdness. + pub coordinates: [Parameter; 6], + pub offset: i64, +} +impl ParameterPoint { + pub fn fitness(self, target: TargetPoint) -> i64 { + self.coordinates.iter().zip(target.parameters()).fold( + self.offset.wrapping_mul(self.offset), + |sum, (parameter, value)| { + let distance = parameter.distance(value); + sum.wrapping_add(distance.wrapping_mul(distance)) + }, + ) + } + pub fn parameter_space(self) -> [Parameter; 7] { + std::array::from_fn(|i| { + if i < 6 { + self.coordinates[i] + } else { + Parameter::new(self.offset, self.offset) + } + }) + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum IndexError { + Empty, + TooManyEntries, + InvalidBranching, + InvertedSpan, + NoSplit, + NoResult, +} +impl std::fmt::Display for IndexError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(match self { + Self::Empty => "climate search requires at least one entry", + Self::TooManyEntries => "climate search is limited to 65536 entries", + Self::InvalidBranching => "climate branching must be in 2..=32", + Self::InvertedSpan => "climate interval endpoints are inverted", + Self::NoSplit => "climate tree could not select a split", + Self::NoResult => "climate search found no result", + }) + } +} +impl std::error::Error for IndexError {} + +#[derive(Debug)] +enum Children { + Leaf(usize), + Branch(Vec), +} +#[derive(Debug)] +struct Node { + space: [Parameter; 7], + children: Children, +} +fn distance(space: &[Parameter; 7], values: &[i64; 7]) -> i64 { + space + .iter() + .zip(values) + .fold(0i64, |sum, (parameter, value)| { + let distance = parameter.distance(*value); + sum.wrapping_add(distance.wrapping_mul(distance)) + }) +} +fn compare_space(a: &[Parameter; 7], b: &[Parameter; 7], axis: usize, absolute: bool) -> Ordering { + for i in 0..7 { + let coordinate = (axis + i) % 7; + let key = |p: Parameter| { + if absolute { + p.center().wrapping_abs() + } else { + p.center() + } + }; + let result = key(a[coordinate]).cmp(&key(b[coordinate])); + if result != Ordering::Equal { + return result; + } + } + Ordering::Equal +} +#[derive(Debug)] +struct Bucket { + space: [Parameter; 7], + children: Vec, +} +fn space(nodes: &[Node], children: &[usize]) -> [Parameter; 7] { + let mut space = nodes[children[0]].space; + for child in &children[1..] { + for (parameter, other) in space.iter_mut().zip(nodes[*child].space) { + *parameter = parameter.union(other); + } + } + space +} +fn build( + nodes: &mut Vec, + mut children: Vec, + branching: usize, +) -> Result { + if children.len() == 1 { + return Ok(children[0]); + } + if children.len() <= branching { + // Stable sorting matters when centers and total center distance tie. + children.sort_by_key(|id| { + nodes[*id] + .space + .iter() + .fold(0i64, |sum, p| sum.wrapping_add(p.center().wrapping_abs())) + }); + } else { + // For this bounded domain this is the same bucket size as vanilla's + // pow(branching,floor(log(length-0.01)/log(branching))). Integer powers + // avoid depending on platform double logarithms during construction. + let mut bucket_size = 1; + while bucket_size * branching < children.len() { + bucket_size *= branching; + } + let mut best_cost = i64::MAX; + let mut best = None; + for axis in 0..7 { + children.sort_by(|a, b| compare_space(&nodes[*a].space, &nodes[*b].space, axis, false)); + let buckets: Vec<_> = children + .chunks(bucket_size) + .map(|children| Bucket { + space: space(nodes, children), + children: children.to_vec(), + }) + .collect(); + let cost = buckets.iter().fold(0i64, |sum, bucket| { + bucket.space.iter().fold(sum, |sum, p| { + sum.wrapping_add(p.max.wrapping_sub(p.min).wrapping_abs()) + }) + }); + if best_cost > cost { + best_cost = cost; + best = Some((axis, buckets)); + } + } + let (axis, mut buckets) = best.ok_or(IndexError::NoSplit)?; + buckets.sort_by(|a, b| compare_space(&a.space, &b.space, axis, true)); + children = buckets + .into_iter() + .map(|bucket| build(nodes, bucket.children, branching)) + .collect::>()?; + } + let space = space(nodes, &children); + let id = nodes.len(); + nodes.push(Node { + space, + children: Children::Branch(children), + }); + Ok(id) +} + +/// The index is immutable and can be shared; each searcher owns its cache. +/// Entry count and branching are explicit limits of this bounded Rust API. +#[derive(Debug)] +pub struct ClimateIndex { + entries: Vec<(ParameterPoint, T)>, + nodes: Vec, + root: usize, +} +impl ClimateIndex { + pub fn new(entries: Vec<(ParameterPoint, T)>) -> Result { + Self::with_branching(entries, 19) + } + pub fn with_branching( + entries: Vec<(ParameterPoint, T)>, + branching: usize, + ) -> Result { + if entries.is_empty() { + return Err(IndexError::Empty); + } + if entries.len() > 65536 { + return Err(IndexError::TooManyEntries); + } + if !(2..=32).contains(&branching) { + return Err(IndexError::InvalidBranching); + } + let mut nodes: Vec<_> = entries + .iter() + .enumerate() + .map(|(id, (point, _))| Node { + space: point.parameter_space(), + children: Children::Leaf(id), + }) + .collect(); + let children = (0..nodes.len()).collect(); + let root = build(&mut nodes, children, branching)?; + Ok(Self { + entries, + nodes, + root, + }) + } + pub fn entries(&self) -> &[(ParameterPoint, T)] { + &self.entries + } + pub fn searcher(&self) -> ClimateSearch<'_, T> { + ClimateSearch { + index: self, + last: None, + } + } + /// Vanilla's separate reference path: ties retain input-list order and do + /// not consult or update the searcher's previous indexed result. + pub fn brute_force(&self, target: TargetPoint) -> &T { + let mut best = 0; + let mut fitness = self.entries[0].0.fitness(target); + for (id, (point, _)) in self.entries.iter().enumerate().skip(1) { + let next = point.fitness(target); + if next < fitness { + fitness = next; + best = id; + } + } + &self.entries[best].1 + } + /// Preorder leaf entry indices expose stable tree layout for comparison. + pub fn leaf_order(&self) -> Vec { + fn walk(nodes: &[Node], id: usize, out: &mut Vec) { + match &nodes[id].children { + Children::Leaf(entry) => out.push(*entry), + Children::Branch(children) => { + for child in children { + walk(nodes, *child, out); + } + } + } + } + let mut result = Vec::with_capacity(self.entries.len()); + walk(&self.nodes, self.root, &mut result); + result + } + fn search( + &self, + id: usize, + values: &[i64; 7], + previous: Option, + ) -> Result { + let Children::Branch(children) = &self.nodes[id].children else { + return Ok(id); + }; + let mut best = previous; + let mut fitness = previous.map_or(i64::MAX, |id| distance(&self.nodes[id].space, values)); + for child in children { + let lower = distance(&self.nodes[*child].space, values); + if fitness > lower { + let result = self.search(*child, values, best)?; + let next = if result == *child { + lower + } else { + distance(&self.nodes[result].space, values) + }; + if fitness > next { + fitness = next; + best = Some(result); + } + } + } + best.ok_or(IndexError::NoResult) + } +} +#[derive(Debug)] +pub struct ClimateSearch<'a, T> { + index: &'a ClimateIndex, + last: Option, +} +impl<'a, T> ClimateSearch<'a, T> { + pub fn find(&mut self, target: TargetPoint) -> Result<&'a T, IndexError> { + let result = self + .index + .search(self.index.root, &target.parameters(), self.last)?; + self.last = Some(result); + let Children::Leaf(entry) = self.index.nodes[result].children else { + unreachable!("search returns a leaf"); + }; + Ok(&self.index.entries[entry].1) + } +} diff --git a/crates/horizon-world/src/worldgen/decoration.rs b/crates/horizon-world/src/worldgen/decoration.rs new file mode 100644 index 000000000..0963e3f8b --- /dev/null +++ b/crates/horizon-world/src/worldgen/decoration.rs @@ -0,0 +1,141 @@ +//! Biome-selected feature scheduling. Structure decoration is a separate stage. +use super::{ + feature_sort::{FeatureIdentity, FeatureSortError, StepFeatureData, build_features_per_step}, + placement::FeaturePlacer, +}; +use horizon_core::{ + position::ChunkPos, + random::{WorldgenRandom, XoroshiroRandom}, +}; +use std::collections::{BTreeMap, BTreeSet}; + +pub use super::biome::BiomeId as DecorationBiome; + +/// Transport for resident section palettes and generation progress. +pub trait DecorationWorld { + type Error; + fn min_section_y(&mut self) -> Result; + /// Return values present in every section's biome palette, including values + /// outside the generator's possible-biome set. Duplicates are allowed. + fn chunk_biomes(&mut self, chunk: ChunkPos) -> Result, Self::Error>; + fn set_currently_generating( + &mut self, + feature: Option, + ) -> Result<(), Self::Error>; +} + +#[derive(Debug)] +pub enum DecorationError { + World(E), + Feature { feature: FeatureIdentity, error: E }, + WorkLimit, +} +impl std::fmt::Display for DecorationError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::World(e) => e.fmt(f), + Self::Feature { feature, error } => write!(f, "feature {}: {error}", feature.0), + Self::WorkLimit => f.write_str("decoration work limit exceeded"), + } + } +} +impl std::error::Error for DecorationError {} + +#[derive(Clone, Debug)] +pub struct FeatureDecorationPlan { + biomes: BTreeMap>>, + steps: Vec, +} +impl FeatureDecorationPlan { + /// The list must preserve the generator's possible-biome encounter order. + /// Each biome identity occurs once; feature identity is allocation identity. + pub fn new( + biomes: Vec<(DecorationBiome, Vec>)>, + ) -> Result { + let ordered = biomes + .iter() + .map(|(_, steps)| steps.clone()) + .collect::>(); + let steps = build_features_per_step(&ordered)?; + let count = biomes.len(); + let biomes = biomes.into_iter().collect::>(); + if biomes.len() != count { + return Err(FeatureSortError::DuplicateBiome); + } + Ok(Self { biomes, steps }) + } + + /// Execute the feature branch of chunk decoration with structures disabled. + /// The callback must place the identified root with a biome-check context. + /// It receives one shared placer and the correctly reseeded random stream; + /// false results are ignored. Errors stop immediately without clearing the + /// current-feature marker. A subsequent call starts with fresh placer state. + pub fn decorate_features( + &self, + world: &mut W, + chunk: ChunkPos, + world_seed: i64, + mut place: impl FnMut( + &mut W, + &mut FeaturePlacer, + &mut WorldgenRandom, + FeatureIdentity, + [i32; 3], + ) -> Result, + ) -> Result<(), DecorationError> { + let origin = [ + chunk.x.wrapping_shl(4), + world + .min_section_y() + .map_err(DecorationError::World)? + .wrapping_shl(4), + chunk.z.wrapping_shl(4), + ]; + let mut random = WorldgenRandom::new(XoroshiroRandom::new(0)); + let seed = random.set_decoration_seed(world_seed, origin[0], origin[2]); + // ChunkPos.rangeClosed overflows into a huge reversed traversal at the + // extreme i32 chunk coordinates. Bound that unsupported work explicitly. + if [chunk.x, chunk.z] + .iter() + .any(|v| *v == i32::MIN || *v == i32::MAX) + { + return Err(DecorationError::WorkLimit); + } + let mut present = BTreeSet::new(); + for z in chunk.z - 1..=chunk.z + 1 { + for x in chunk.x - 1..=chunk.x + 1 { + let values = world + .chunk_biomes(ChunkPos::new(x, z)) + .map_err(DecorationError::World)?; + if values.len() > 65536 { + return Err(DecorationError::WorkLimit); + } + present.extend(values.into_iter().filter(|id| self.biomes.contains_key(id))); + } + } + let mut placer = FeaturePlacer::new(); + for (step, data) in self.steps.iter().enumerate() { + let mut selected = BTreeSet::new(); + for biome in &present { + if let Some(features) = self.biomes[biome].get(step) { + selected.extend(features.iter().map(|feature| { + data.index(*feature) + .expect("plan owns complete biome feature lists") + })); + } + } + for index in selected { + let feature = data.features()[index]; + random.set_feature_seed(seed, index as i32, step as i32); + world + .set_currently_generating(Some(feature)) + .map_err(|error| DecorationError::Feature { feature, error })?; + place(world, &mut placer, &mut random, feature, origin) + .map_err(|error| DecorationError::Feature { feature, error })?; + } + } + world + .set_currently_generating(None) + .map_err(DecorationError::World) + } +} diff --git a/crates/horizon-world/src/worldgen/density.rs b/crates/horizon-world/src/worldgen/density.rs new file mode 100644 index 000000000..6cd2c7df7 --- /dev/null +++ b/crates/horizon-world/src/worldgen/density.rs @@ -0,0 +1,578 @@ +//! Bounded decoding of density registries into the immutable core graph. +//! Named registry holders and raw numeric tokens preserve compilation behavior. +use super::*; +use horizon_core::{ + density::{ + BlendedNoise, CubicSpline, DistanceMetric, RoundMode, ShiftNoiseKind, SplinePoint, + TilingMode, WorldField, + graph::{DensityGraph, FunctionId, GraphBinary, GraphNode, GraphUnary, NoiseId}, + }, + geometry::Axis, +}; +use std::{collections::BTreeSet, sync::Arc}; + +pub(super) fn identifier(name: &str) -> Result { + let (namespace, path) = name.split_once(':').unwrap_or(("minecraft", name)); + let namespace = if namespace.is_empty() { + "minecraft" + } else { + namespace + }; + let valid = |c: u8| c.is_ascii_lowercase() || c.is_ascii_digit() || b"_.-".contains(&c); + if !namespace.bytes().all(valid) + || !path.bytes().all(|c| valid(c) || c == b'/') + || path.is_empty() + { + return Err(DecodeError::Registry(format!( + "invalid registry identifier: {name}" + ))); + } + Ok(format!("{namespace}:{path}")) +} +fn string(raw: &RawValue) -> Result { + Ok(serde_json::from_str(raw.get())?) +} +fn float(raw: &RawValue) -> Result { + number_text(raw)? + .parse() + .map_err(|_| DecodeError::Field("float")) +} +fn noise_value(raw: &RawValue) -> Result { + let value = float(raw)?; + if (-1e6..=1e6).contains(&value) { + Ok(value) + } else { + Err(DecodeError::Field("density value")) + } +} +fn axis(raw: &RawValue) -> Result { + match string(raw)?.as_str() { + "x" => Ok(Axis::X), + "y" => Ok(Axis::Y), + "z" => Ok(Axis::Z), + _ => Err(DecodeError::Field("axis")), + } +} + +/// All entries are loaded atomically. Named child references resolve through +/// distinct registry holders; returned entry values are their direct graphs. +#[derive(Debug)] +pub struct DensityRegistry { + graph: DensityGraph, + values: BTreeMap, + noises: BTreeMap, +} +impl DensityRegistry { + /// Input keys are registry identifiers, and values contain original JSON. + /// This API accepts acyclic registries, at most 256 nested graph levels and + /// at most 256 interval branches. Inline noise holders are not yet supported. + pub fn from_json( + noises: &BTreeMap, + densities: &BTreeMap, + ) -> Result { + let mut loader = Loader { + graph: DensityGraph::new(), + noises: BTreeMap::new(), + definitions: BTreeMap::new(), + values: BTreeMap::new(), + active: BTreeSet::new(), + }; + for (name, json) in noises { + let name = identifier(name)?; + let noise = loader + .graph + .register_noise(name.clone(), decode_noise(json)?)?; + loader.noises.insert(name, noise); + } + for (name, json) in densities { + let name = identifier(name)?; + let raw: Box = serde_json::from_str(json)?; + if loader.definitions.insert(name.clone(), raw).is_some() { + return Err(DecodeError::Registry(format!( + "duplicate density identifier: {name}" + ))); + } + } + let names: Vec<_> = loader.definitions.keys().cloned().collect(); + for name in names { + loader.resolve(&name, 0)?; + } + Ok(Self { + graph: loader.graph, + values: loader.values, + noises: loader.noises, + }) + } + pub fn graph(&self) -> &DensityGraph { + &self.graph + } + pub fn into_graph(self) -> DensityGraph { + self.graph + } + pub fn entries(&self) -> impl Iterator { + self.values.iter().map(|(name, id)| (name.as_str(), *id)) + } + pub fn value(&self, name: &str) -> Option { + self.values.get(name).copied() + } + pub fn reference(&self, name: &str) -> Option { + self.graph.function(name) + } + /// Decode direct roots against this registry, retaining shared named holders. + /// All roots are added atomically; a failure leaves existing IDs and graphs + /// intact. Roots are not registered as additional named density entries. + pub fn decode_functions(&mut self, json: &[&str]) -> Result, DecodeError> { + let mut loader = Loader { + graph: self.graph.clone(), + noises: self.noises.clone(), + definitions: BTreeMap::new(), + values: BTreeMap::new(), + active: BTreeSet::new(), + }; + let roots = json + .iter() + .map(|json| { + let raw: Box = serde_json::from_str(json)?; + loader.decode(&raw, 0) + }) + .collect::>()?; + self.graph = loader.graph; + Ok(roots) + } +} +struct Loader { + graph: DensityGraph, + noises: BTreeMap, + definitions: BTreeMap>, + values: BTreeMap, + active: BTreeSet, +} +impl Loader { + fn resolve(&mut self, name: &str, depth: usize) -> Result { + if let Some(id) = self.graph.function(name) { + return Ok(id); + } + if depth > 256 { + return Err(DecodeError::Field("density nesting")); + } + if !self.active.insert(name.to_owned()) { + return Err(DecodeError::Registry(format!( + "cyclic density reference: {name}" + ))); + } + let raw = self + .definitions + .get(name) + .ok_or_else(|| DecodeError::Registry(format!("unknown density reference: {name}")))? + .clone(); + let value = self.decode(&raw, depth + 1)?; + let reference = self.graph.register_function(name.to_owned(), value)?; + self.values.insert(name.to_owned(), value); + self.active.remove(name); + Ok(reference) + } + fn input( + &mut self, + object: &Object, + name: &'static str, + depth: usize, + ) -> Result { + self.decode(required(object, name)?, depth + 1) + } + fn optional_input( + &mut self, + object: &Object, + name: &'static str, + fallback: f32, + depth: usize, + ) -> Result { + match optional(object, name) { + Some(raw) => self.decode(raw, depth + 1), + None => Ok(self.graph.insert(GraphNode::Constant(fallback))?), + } + } + fn noise(&self, object: &Object) -> Result { + let raw = required(object, "noise")?; + if !raw.get().starts_with('"') { + return Err(DecodeError::Field("inline noise holder unsupported")); + } + let name = identifier(&string(raw)?)?; + self.noises + .get(&name) + .copied() + .ok_or_else(|| DecodeError::Registry(format!("unknown noise reference: {name}"))) + } + fn decode(&mut self, raw: &RawValue, depth: usize) -> Result { + if depth > 256 { + return Err(DecodeError::Field("density nesting")); + } + if raw.get().starts_with('"') { + return self.resolve(&identifier(&string(raw)?)?, depth); + } + if !raw.get().starts_with('{') { + return Ok(self.graph.insert(GraphNode::Constant(noise_value(raw)?))?); + } + let object: Object = serde_json::from_str(raw.get())?; + let kind = identifier(&string(required(&object, "type")?)?)?; + let unary = match kind.as_str() { + "minecraft:abs" => Some(GraphUnary::Abs), + "minecraft:square" => Some(GraphUnary::Square), + "minecraft:cube" => Some(GraphUnary::Cube), + "minecraft:sqrt" => Some(GraphUnary::Sqrt), + "minecraft:half_negative" => Some(GraphUnary::HalfNegative), + "minecraft:quarter_negative" => Some(GraphUnary::QuarterNegative), + "minecraft:reciprocal" => Some(GraphUnary::Reciprocal), + "minecraft:negate" => Some(GraphUnary::Negate), + "minecraft:squeeze" => Some(GraphUnary::Squeeze), + "minecraft:log" => Some(GraphUnary::Log), + "minecraft:sign" => Some(GraphUnary::Sign), + _ => None, + }; + let binary = match kind.as_str() { + "minecraft:add" => Some(GraphBinary::Add), + "minecraft:sub" => Some(GraphBinary::Subtract), + "minecraft:mul" => Some(GraphBinary::Multiply), + "minecraft:div" => Some(GraphBinary::Divide), + "minecraft:min" => Some(GraphBinary::Minimum), + "minecraft:max" => Some(GraphBinary::Maximum), + _ => None, + }; + let node = if let Some(kind) = unary { + GraphNode::Unary { + kind, + input: self.input(&object, "input", depth)?, + } + } else if let Some(kind) = binary { + GraphNode::Binary { + kind, + left: self.input(&object, "left", depth)?, + right: self.input(&object, "right", depth)?, + } + } else { + match kind.as_str() { + "minecraft:constant" => { + GraphNode::Constant(noise_value(required(&object, "value")?)?) + } + "minecraft:blend_alpha" => GraphNode::WorldField(WorldField::BlendAlpha), + "minecraft:blend_offset" => GraphNode::WorldField(WorldField::BlendOffset), + "minecraft:beardifier" => GraphNode::WorldField(WorldField::Beardifier), + "minecraft:end_outer_islands" => GraphNode::EndIslands, + "minecraft:cache" => GraphNode::Cache(self.input(&object, "input", depth)?), + "minecraft:blend_density" => { + GraphNode::BlendDensity(self.input(&object, "input", depth)?) + } + "minecraft:pow" => GraphNode::Power { + base: self.input(&object, "base", depth)?, + exponent: self.input(&object, "exponent", depth)?, + }, + "minecraft:floor" | "minecraft:round" | "minecraft:ceil" | "minecraft:truncate" => { + GraphNode::Round { + mode: match kind.as_str() { + "minecraft:floor" => RoundMode::Floor, + "minecraft:round" => RoundMode::Round, + "minecraft:ceil" => RoundMode::Ceil, + _ => RoundMode::Truncate, + }, + input: self.input(&object, "input", depth)?, + multiple: self.optional_input(&object, "multiple", 1.0, depth)?, + } + } + "minecraft:gradient" => { + let from = integer(required(&object, "from_coordinate")?)?; + let to = integer(required(&object, "to_coordinate")?)?; + if from == to { + return Err(DecodeError::Field("gradient coordinates")); + } + GraphNode::Gradient { + axis: axis(required(&object, "axis")?)?, + tiling: match optional(&object, "tiling") + .map(string) + .transpose()? + .as_deref() + .unwrap_or("clamp_to_edge") + { + "clamp_to_edge" => TilingMode::ClampToEdge, + "repeat" => TilingMode::Repeat, + "mirrored_repeat" => TilingMode::MirroredRepeat, + _ => return Err(DecodeError::Field("tiling")), + }, + from, + to, + low: noise_value(required(&object, "from_value")?)?, + high: noise_value(required(&object, "to_value")?)?, + } + } + "minecraft:noise" => GraphNode::Noise { + noise: self.noise(&object)?, + xz_scale: double(required(&object, "xz_scale")?)?, + y_scale: double(required(&object, "y_scale")?)?, + shift_x: self.optional_input(&object, "shift_x", 0.0, depth)?, + shift_y: self.optional_input(&object, "shift_y", 0.0, depth)?, + shift_z: self.optional_input(&object, "shift_z", 0.0, depth)?, + }, + "minecraft:shift" | "minecraft:shift_a" | "minecraft:shift_b" => { + GraphNode::OffsetNoise { + noise: self.noise(&object)?, + kind: match kind.as_str() { + "minecraft:shift" => ShiftNoiseKind::Shift, + "minecraft:shift_a" => ShiftNoiseKind::ShiftA, + _ => ShiftNoiseKind::ShiftB, + }, + } + } + "minecraft:old_blended_noise" => GraphNode::BlendedNoise(BlendedNoise { + xz_scale: double_range( + required(&object, "xz_scale")?, + "xz_scale", + 0.001, + 1000.0, + )?, + y_scale: double_range(required(&object, "y_scale")?, "y_scale", 0.001, 1000.0)?, + xz_factor: double_range( + required(&object, "xz_factor")?, + "xz_factor", + 0.001, + 1000.0, + )?, + y_factor: double_range( + required(&object, "y_factor")?, + "y_factor", + 0.001, + 1000.0, + )?, + smear_scale_multiplier: double_range( + required(&object, "smear_scale_multiplier")?, + "smear_scale_multiplier", + 1.0, + 8.0, + )?, + }), + "minecraft:slice" => GraphNode::Slice { + axis: axis(required(&object, "axis")?)?, + coordinate: integer(required(&object, "coordinate")?)?, + input: self.input(&object, "input", depth)?, + }, + "minecraft:interpolated" => GraphNode::Interpolated { + input: self.input(&object, "input", depth)?, + xz: int_range( + required(&object, "cell_size_xz")?, + "cell_size_xz", + 1, + i32::MAX, + )?, + y: int_range( + required(&object, "cell_size_y")?, + "cell_size_y", + 1, + i32::MAX, + )?, + }, + "minecraft:find_top_surface" => GraphNode::Surface { + density: self.input(&object, "density", depth)?, + upper: self.input(&object, "upper_bound", depth)?, + lower: int_range( + required(&object, "lower_bound")?, + "lower_bound", + -4064, + 4062, + )?, + height: int_range( + required(&object, "cell_height")?, + "cell_height", + 1, + i32::MAX, + )?, + }, + "minecraft:clamp" => { + let min = noise_value(required(&object, "min")?)?; + let max = noise_value(required(&object, "max")?)?; + if max < min { + return Err(DecodeError::Field("clamp bounds")); + } + GraphNode::Clamp { + input: self.input(&object, "input", depth)?, + min, + max, + } + } + "minecraft:range_choice" => GraphNode::Choice { + input: self.input(&object, "input", depth)?, + min: noise_value(required(&object, "min_inclusive")?)?, + max: noise_value(required(&object, "max_exclusive")?)?, + inside: self.input(&object, "when_in_range", depth)?, + outside: self.input(&object, "when_out_of_range", depth)?, + }, + "minecraft:lerp" => GraphNode::Lerp { + alpha: self.input(&object, "alpha", depth)?, + first: self.input(&object, "first", depth)?, + second: self.input(&object, "second", depth)?, + }, + "minecraft:interval_select" => { + let thresholds: Vec> = + serde_json::from_str(required(&object, "thresholds")?.get())?; + let thresholds: Vec = thresholds + .iter() + .map(|raw| noise_value(raw)) + .collect::>()?; + let functions: Vec> = + serde_json::from_str(required(&object, "functions")?.get())?; + if functions.len() < 2 + || functions.len() > 256 + || functions.len() != thresholds.len() + 1 + || thresholds + .windows(2) + .any(|pair| pair[0].total_cmp(&pair[1]).is_gt()) + { + return Err(DecodeError::Field("interval selection")); + } + let input = self.input(&object, "input", depth)?; + let branches = functions + .iter() + .map(|raw| self.decode(raw, depth + 1)) + .collect::>()?; + GraphNode::IntervalSelect { + input, + thresholds: Arc::from(thresholds), + branches, + } + } + "minecraft:distance_to_point" => { + let raw: Vec> = + serde_json::from_str(required(&object, "point")?.get())?; + if raw.len() != 3 { + return Err(DecodeError::Field("point")); + } + let point = [integer(&raw[0])?, integer(&raw[1])?, integer(&raw[2])?]; + let metric = match string(required(&object, "metric")?)?.as_str() { + "euclidean" => DistanceMetric::Euclidean, + "euclidean_squared" => DistanceMetric::EuclideanSquared, + "manhattan" => DistanceMetric::Manhattan, + "chebyshev" => DistanceMetric::Chebyshev, + _ => return Err(DecodeError::Field("metric")), + }; + GraphNode::DistanceToPoint { point, metric } + } + "minecraft:spline" => { + GraphNode::Spline(self.spline(required(&object, "spline")?, depth + 1)?) + } + _ => { + return Err(DecodeError::Registry(format!( + "unknown density type: {kind}" + ))); + } + } + }; + Ok(self.graph.insert(node)?) + } + fn spline( + &mut self, + raw: &RawValue, + depth: usize, + ) -> Result, DecodeError> { + if depth > 256 { + return Err(DecodeError::Field("spline nesting")); + } + if !raw.get().starts_with('{') { + return Ok(CubicSpline::Constant(float(raw)?)); + } + let object: Object = serde_json::from_str(raw.get())?; + let coordinate = self.input(&object, "coordinate", depth)?; + let points: Vec> = serde_json::from_str(required(&object, "points")?.get())?; + let points = points + .iter() + .map(|raw| { + let point: Object = serde_json::from_str(raw.get())?; + Ok(SplinePoint { + location: float(required(&point, "location")?)?, + derivative: float(required(&point, "derivative")?)?, + value: self.spline(required(&point, "value")?, depth + 1)?, + }) + }) + .collect::>()?; + CubicSpline::multipoint(coordinate, points) + .map_err(|error| DecodeError::Graph(error.into())) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use horizon_core::density::{SamplerContext, graph::DensityCompiler}; + #[test] + fn numeric_tokens_keep_negative_zero_and_avoid_double_rounding() { + let densities = BTreeMap::from([ + ("minecraft:negative_zero".into(), "-0".into()), + ( + "minecraft:rounded".into(), + "1.0000000596046447753906250000000001".into(), + ), + ]); + let registry = DensityRegistry::from_json(&BTreeMap::new(), &densities).unwrap(); + let zero = registry.value("minecraft:negative_zero").unwrap(); + let rounded = registry.value("minecraft:rounded").unwrap(); + let compiler = DensityCompiler::new(registry.into_graph()); + let mut context = SamplerContext::default(); + assert_eq!( + compiler + .compile_raw(zero) + .unwrap() + .sample_value(&mut context, [0; 3]) + .unwrap() + .to_bits(), + 0x8000_0000 + ); + assert_eq!( + compiler + .compile_raw(rounded) + .unwrap() + .sample_value(&mut context, [0; 3]) + .unwrap() + .to_bits(), + 0x3f80_0001 + ); + } + #[test] + fn forward_references_share_named_holders_and_reject_cycles_or_missing_values() { + let mut densities = BTreeMap::from([ + ( + "minecraft:a".into(), + r#"{"type":"add","left":"z","right":"minecraft:z"}"#.into(), + ), + ("minecraft:z".into(), "0.5".into()), + ]); + let registry = DensityRegistry::from_json(&BTreeMap::new(), &densities).unwrap(); + let root = registry.value("minecraft:a").unwrap(); + let compiler = DensityCompiler::new(registry.into_graph()); + assert_eq!( + compiler + .compile_raw(root) + .unwrap() + .sample_value(&mut SamplerContext::default(), [0; 3]) + .unwrap(), + 1.0 + ); + densities.insert("minecraft:z".into(), r#""a""#.into()); + assert!(DensityRegistry::from_json(&BTreeMap::new(), &densities).is_err()); + densities.remove("minecraft:z"); + assert!(DensityRegistry::from_json(&BTreeMap::new(), &densities).is_err()); + } + #[test] + fn codec_validation_rejects_invalid_gradients_intervals_and_splines() { + for json in [ + r#"{"type":"gradient","axis":"y","from_coordinate":0,"to_coordinate":0,"from_value":0,"to_value":1}"#, + r#"{"type":"interval_select","input":0,"thresholds":[0,-0],"functions":[0,1,2]}"#, + r#"{"type":"interpolated","input":0,"cell_size_xz":0,"cell_size_y":8}"#, + r#"{"type":"spline","spline":{"coordinate":0,"points":[]}}"#, + r#"{"type":"clamp","input":0,"min":1,"max":-1}"#, + ] { + assert!( + DensityRegistry::from_json( + &BTreeMap::new(), + &BTreeMap::from([("minecraft:a".into(), json.into())]) + ) + .is_err(), + "{json}" + ); + } + } +} diff --git a/crates/horizon-world/src/worldgen/feature.rs b/crates/horizon-world/src/worldgen/feature.rs new file mode 100644 index 000000000..1dac307e8 --- /dev/null +++ b/crates/horizon-world/src/worldgen/feature.rs @@ -0,0 +1,162 @@ +//! Initial block-writing features. Full feature registries and block behavior +//! remain separate work; world access supplies mutation and update semantics. +use super::{DecodeError, Object, density::identifier, required}; +use crate::registry::{BlockRegistry, BlockStateId}; +use horizon_core::random::{InvalidBound, RandomSource}; +#[derive(Clone, Copy, Debug)] +pub struct FeatureBlocks { + pub air: BlockStateId, + pub stone: BlockStateId, + pub cobblestone: BlockStateId, + pub end_stone: BlockStateId, + pub obsidian: BlockStateId, +} +impl FeatureBlocks { + pub fn from_registry(registry: &BlockRegistry) -> Result { + let get = |name| { + registry + .default_state(name) + .ok_or_else(|| DecodeError::Registry(format!("unknown feature block {name}"))) + }; + Ok(Self { + air: get("minecraft:air")?, + stone: get("minecraft:stone")?, + cobblestone: get("minecraft:cobblestone")?, + end_stone: get("minecraft:end_stone")?, + obsidian: get("minecraft:obsidian")?, + }) + } +} +pub trait FeatureWorld { + type Error; + fn block(&mut self, position: [i32; 3]) -> Result; + fn set_block( + &mut self, + position: [i32; 3], + state: BlockStateId, + flags: i32, + ) -> Result; +} +#[derive(Debug)] +pub enum FeatureError { + Random(InvalidBound), + World(E), +} +impl std::fmt::Display for FeatureError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Random(e) => e.fmt(f), + Self::World(e) => e.fmt(f), + } + } +} +impl std::error::Error for FeatureError {} +impl From for FeatureError { + fn from(e: InvalidBound) -> Self { + Self::Random(e) + } +} +#[derive(Clone, Copy, Debug)] +pub enum BasicFeature { + VoidStartPlatform, + EndIsland, + EndPlatform, +} +impl BasicFeature { + pub fn from_json(json: &str) -> Result { + let object: Object = serde_json::from_str(json)?; + match identifier(&serde_json::from_str::( + required(&object, "type")?.get(), + )?)? + .as_str() + { + "minecraft:void_start_platform" => Ok(Self::VoidStartPlatform), + "minecraft:end_island" => Ok(Self::EndIsland), + "minecraft:end_platform" => Ok(Self::EndPlatform), + _ => Err(DecodeError::Field("basic feature type")), + } + } + pub fn place( + &self, + world: &mut W, + random: &mut impl RandomSource, + origin: [i32; 3], + blocks: FeatureBlocks, + ) -> Result> { + let [x, y, z] = origin; + match self { + Self::VoidStartPlatform => { + let (cx, cz) = (x >> 4, z >> 4); + if cx.wrapping_abs().max(cz.wrapping_abs()) > 1 { + return Ok(true); + } + let y = y.wrapping_add(3); + for z in cz.wrapping_shl(4)..=cz.wrapping_shl(4).wrapping_add(15) { + for x in cx.wrapping_shl(4)..=cx.wrapping_shl(4).wrapping_add(15) { + if 8_i32 + .wrapping_sub(x) + .wrapping_abs() + .max(8_i32.wrapping_sub(z).wrapping_abs()) + <= 16 + { + let state = if x == 8 && z == 8 { + blocks.cobblestone + } else { + blocks.stone + }; + world + .set_block([x, y, z], state, 2) + .map_err(FeatureError::World)?; + } + } + } + } + Self::EndIsland => { + let mut radius = random.next_int_bound(3)? as f32 + 4.; + let mut dy = 0_i32; + while radius > 0.5 { + let low = (-radius).floor() as i32; + let high = radius.ceil() as i32; + for dx in low..=high { + for dz in low..=high { + if (dx * dx + dz * dz) as f32 <= (radius + 1.) * (radius + 1.) { + world + .set_block( + [ + x.wrapping_add(dx), + y.wrapping_add(dy), + z.wrapping_add(dz), + ], + blocks.end_stone, + 3, + ) + .map_err(FeatureError::World)?; + } + } + } + radius -= random.next_int_bound(2)? as f32 + 0.5; + dy -= 1; + } + } + Self::EndPlatform => { + for dz in -2..=2 { + for dx in -2..=2 { + for dy in -1..3 { + let p = [x.wrapping_add(dx), y.wrapping_add(dy), z.wrapping_add(dz)]; + let state = if dy == -1 { + blocks.obsidian + } else { + blocks.air + }; + // Both target blocks have one state in the pinned registry. + if world.block(p).map_err(FeatureError::World)? != state { + world.set_block(p, state, 3).map_err(FeatureError::World)?; + } + } + } + } + } + } + Ok(true) + } +} diff --git a/crates/horizon-world/src/worldgen/feature_catalog.rs b/crates/horizon-world/src/worldgen/feature_catalog.rs new file mode 100644 index 000000000..ebdf29c4f --- /dev/null +++ b/crates/horizon-world/src/worldgen/feature_catalog.rs @@ -0,0 +1,266 @@ +//! Immutable feature resource snapshots. Requested roots resolve named feature +//! and placed-feature holders and tags into bounded executable inline trees. +//! This is not a complete datapack registry loader or live-reload implementation. +use super::{ + DecodeError, Object, + block_feature::FeatureBlockBindings, + density::identifier, + feature_graph::{FeatureDefinition, PlacedFeatureDefinition}, + required, + tags::TagDefinitions, +}; +use serde_json::value::RawValue; +use std::collections::{BTreeMap, BTreeSet}; + +pub struct FeatureCatalog { + features: BTreeMap>, + placed: BTreeMap>, + tags: BTreeMap>, + empty_tags: BTreeSet, +} +struct Expansion { + remaining: usize, + active: Vec<(bool, String)>, +} +impl Expansion { + fn visit(&mut self, depth: usize) -> Result<(), DecodeError> { + if depth > 128 || self.remaining == 0 { + return Err(DecodeError::Field("feature resource expansion limit")); + } + self.remaining -= 1; + Ok(()) + } +} +fn resources( + source: &BTreeMap, +) -> Result>, DecodeError> { + if source.len() > 8192 { + return Err(DecodeError::Field("feature resource count")); + } + let mut result = BTreeMap::new(); + for (name, json) in source { + if result + .insert(identifier(name)?, serde_json::from_str(json)?) + .is_some() + { + return Err(DecodeError::Field("duplicate feature resource")); + } + } + Ok(result) +} +fn raw(json: String) -> Result, DecodeError> { + Ok(RawValue::from_string(json)?) +} +fn entries(value: &RawValue) -> Result>, DecodeError> { + let values: Vec> = serde_json::from_str(value.get())?; + if values.len() > 8192 { + return Err(DecodeError::Field("feature resource list")); + } + Ok(values) +} +impl FeatureCatalog { + /// Stores source JSON without validating unused feature algorithms. Resolving + /// a root validates its entire reachable tree, including unselected children. + pub fn from_resources( + features: &BTreeMap, + placed: &BTreeMap, + tags: &TagDefinitions, + ) -> Result { + let features = resources(features)?; + let placed = resources(placed)?; + let built = tags + .build(|name, _| placed.contains_key(name).then(|| name.to_owned())) + .map_err(|e| DecodeError::Registry(e.to_string()))?; + Ok(Self { + features, + placed, + empty_tags: built + .tags + .iter() + .filter_map(|(name, values)| values.is_empty().then_some(name.clone())) + .collect(), + tags: built.tags, + }) + } + pub fn feature(&self, json: &str) -> Result { + self.feature_with_optional_blocks(json, None) + } + pub fn feature_with_blocks( + &self, + json: &str, + blocks: &FeatureBlockBindings<'_>, + ) -> Result { + self.feature_with_optional_blocks(json, Some(blocks)) + } + fn feature_with_optional_blocks( + &self, + json: &str, + blocks: Option<&FeatureBlockBindings<'_>>, + ) -> Result { + let value: Box = serde_json::from_str(json)?; + let expanded = self.expand_feature( + &value, + 0, + &mut Expansion { + remaining: 65536, + active: vec![], + }, + )?; + FeatureDefinition::from_catalog_json(&expanded, &self.empty_tags, blocks) + } + pub fn placed_feature(&self, json: &str) -> Result { + self.placed_with_optional_blocks(json, None) + } + pub fn placed_feature_with_blocks( + &self, + json: &str, + blocks: &FeatureBlockBindings<'_>, + ) -> Result { + self.placed_with_optional_blocks(json, Some(blocks)) + } + fn placed_with_optional_blocks( + &self, + json: &str, + blocks: Option<&FeatureBlockBindings<'_>>, + ) -> Result { + let value: Box = serde_json::from_str(json)?; + let expanded = self.expand_placed( + &value, + 0, + &mut Expansion { + remaining: 65536, + active: vec![], + }, + )?; + PlacedFeatureDefinition::from_catalog_json(&expanded, &self.empty_tags, blocks) + } + fn named( + &self, + name: &str, + placed: bool, + depth: usize, + work: &mut Expansion, + ) -> Result { + let name = identifier(name)?; + let key = (placed, name.clone()); + if work.active.contains(&key) { + return Err(DecodeError::Registry(format!( + "cyclic feature reference {name}" + ))); + } + let value = if placed { &self.placed } else { &self.features } + .get(&name) + .ok_or_else(|| DecodeError::Registry(format!("unknown feature reference {name}")))?; + work.active.push(key); + let result = if placed { + self.expand_placed(value, depth + 1, work) + } else { + self.expand_feature(value, depth + 1, work) + }; + work.active.pop(); + result + } + fn expand_placed( + &self, + value: &RawValue, + depth: usize, + work: &mut Expansion, + ) -> Result { + work.visit(depth)?; + if let Ok(name) = serde_json::from_str::(value.get()) { + return self.named(&name, true, depth, work); + } + let mut object: Object = serde_json::from_str(value.get())?; + let feature = self.expand_feature(required(&object, "feature")?, depth + 1, work)?; + object.insert("feature".into(), raw(feature)?); + Ok(serde_json::to_string(&object)?) + } + fn expand_set( + &self, + value: &RawValue, + depth: usize, + work: &mut Expansion, + ) -> Result { + let values = if let Ok(name) = serde_json::from_str::(value.get()) { + if let Some(tag) = name.strip_prefix('#') { + let tag = identifier(tag)?; + let names = self.tags.get(&tag).ok_or_else(|| { + DecodeError::Registry(format!("unknown placed-feature tag {tag}")) + })?; + // Native nonEmptyHolderSet validates direct lists, but permits + // a named tag whose bound contents are empty. + if names.is_empty() { + return Ok(serde_json::to_string(&format!("#{tag}"))?); + } + if names.len() > 8192 { + return Err(DecodeError::Field("placed-feature tag size")); + } + names + .iter() + .map(|name| raw(serde_json::to_string(name)?)) + .collect::, DecodeError>>()? + } else { + vec![value.to_owned()] + } + } else if value.get().trim_start().starts_with('[') { + entries(value)? + } else { + vec![value.to_owned()] + }; + let expanded = values + .iter() + .map(|v| raw(self.expand_placed(v, depth + 1, work)?)) + .collect::, _>>()?; + Ok(serde_json::to_string(&expanded)?) + } + fn expand_feature( + &self, + value: &RawValue, + depth: usize, + work: &mut Expansion, + ) -> Result { + work.visit(depth)?; + if let Ok(name) = serde_json::from_str::(value.get()) { + return self.named(&name, false, depth, work); + } + let mut object: Object = serde_json::from_str(value.get())?; + let kind = identifier(&serde_json::from_str::( + required(&object, "type")?.get(), + )?)?; + match kind.as_str() { + "minecraft:sequence" | "minecraft:simple_random_selector" => { + let expanded = self.expand_set(required(&object, "features")?, depth + 1, work)?; + object.insert("features".into(), raw(expanded)?); + } + "minecraft:random_boolean_selector" => { + for name in ["feature_true", "feature_false"] { + let expanded = self.expand_placed(required(&object, name)?, depth + 1, work)?; + object.insert(name.into(), raw(expanded)?); + } + } + "minecraft:random_selector" | "minecraft:weighted_random_selector" => { + let key = if kind == "minecraft:random_selector" { + "feature" + } else { + "data" + }; + let values = entries(required(&object, "features")?)?; + let mut expanded = Vec::with_capacity(values.len()); + for value in values { + let mut entry: Object = serde_json::from_str(value.get())?; + let child = self.expand_placed(required(&entry, key)?, depth + 1, work)?; + entry.insert(key.into(), raw(child)?); + expanded.push(entry); + } + object.insert("features".into(), raw(serde_json::to_string(&expanded)?)?); + if kind == "minecraft:random_selector" { + let child = + self.expand_placed(required(&object, "default")?, depth + 1, work)?; + object.insert("default".into(), raw(child)?); + } + } + _ => {} + } + Ok(serde_json::to_string(&object)?) + } +} diff --git a/crates/horizon-world/src/worldgen/feature_graph.rs b/crates/horizon-world/src/worldgen/feature_graph.rs new file mode 100644 index 000000000..5b2d48c94 --- /dev/null +++ b/crates/horizon-world/src/worldgen/feature_graph.rs @@ -0,0 +1,441 @@ +//! Inline feature composition. Named holders, tags and registry reloads remain +//! separate from this bounded executable tree. +use super::{ + DecodeError, Object, + block_feature::{ + BlockFeatureError, FeatureBlockBindings, FillLayerFeature, ReplaceBlockFeature, + }, + density::identifier, + feature::{BasicFeature, FeatureBlocks, FeatureError, FeatureWorld}, + number_text, + ore_feature::ScatteredOreFeature, + placement::{ + FeaturePlacementError, FeaturePlacer, PlacementContext, PlacementModifier, + PlacementQueryError, + }, + required, + weighted::OptionalWeightedList, +}; +use horizon_core::random::{InvalidBound, RandomSource}; +use serde_json::value::RawValue; +use std::{cell::Cell, collections::BTreeSet}; + +#[derive(Clone, Debug)] +pub struct PlacedFeatureDefinition { + pub feature: Box, + pub placement: Vec, +} +#[derive(Clone, Debug)] +pub enum FeatureDefinition { + Basic(BasicFeature), + FillLayer(FillLayerFeature), + ReplaceBlock(ReplaceBlockFeature), + ScatteredOre(ScatteredOreFeature), + NoOp, + WeightedChoice(OptionalWeightedList), + Sequence(Vec), + BooleanChoice(Box<[PlacedFeatureDefinition; 2]>), + RandomChoice(Vec), + ChanceChoice { + features: Vec<(f32, PlacedFeatureDefinition)>, + fallback: Box, + }, +} +#[derive(Debug)] +pub enum FeatureExecutionError { + Basic(FeatureError), + Random(InvalidBound), + Query(PlacementQueryError), + WorkLimit, + InvalidPendingIndex, +} +impl std::fmt::Display for FeatureExecutionError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Basic(e) => e.fmt(f), + Self::Random(e) => e.fmt(f), + Self::Query(e) => e.fmt(f), + Self::WorkLimit => f.write_str("feature graph work limit exceeded"), + Self::InvalidPendingIndex => f.write_str("invalid pending modifier index"), + } + } +} +impl std::error::Error for FeatureExecutionError {} +impl From for FeatureExecutionError { + fn from(error: InvalidBound) -> Self { + Self::Random(error) + } +} +impl From> for FeatureExecutionError { + fn from(error: FeaturePlacementError) -> Self { + match error { + FeaturePlacementError::Feature(e) => e, + FeaturePlacementError::Random(e) => Self::Random(e), + FeaturePlacementError::World(e) => Self::Query(e), + FeaturePlacementError::WorkLimit => Self::WorkLimit, + FeaturePlacementError::InvalidPendingIndex => Self::InvalidPendingIndex, + } + } +} +struct Run { + blocks: FeatureBlocks, + depth: Cell, + remaining: Cell, +} +fn visit(depth: usize, remaining: &mut usize) -> Result<(), DecodeError> { + if depth > 128 || *remaining == 0 { + return Err(DecodeError::Field("feature graph depth or node count")); + } + *remaining -= 1; + Ok(()) +} +fn list(raw: &RawValue) -> Result>, DecodeError> { + let values: Vec> = serde_json::from_str(raw.get())?; + if values.len() > 8192 { + return Err(DecodeError::Field("feature list")); + } + Ok(values) +} +impl PlacedFeatureDefinition { + pub fn from_json(json: &str) -> Result { + Self::decode(json, 0, &mut 65536, &BTreeSet::new(), None) + } + pub fn from_json_with_blocks( + json: &str, + blocks: &FeatureBlockBindings<'_>, + ) -> Result { + Self::decode(json, 0, &mut 65536, &BTreeSet::new(), Some(blocks)) + } + pub(crate) fn from_catalog_json( + json: &str, + empty_tags: &BTreeSet, + blocks: Option<&FeatureBlockBindings<'_>>, + ) -> Result { + Self::decode(json, 0, &mut 65536, empty_tags, blocks) + } + fn decode( + json: &str, + depth: usize, + remaining: &mut usize, + empty_tags: &BTreeSet, + blocks: Option<&FeatureBlockBindings<'_>>, + ) -> Result { + visit(depth, remaining)?; + let object: Object = serde_json::from_str(json)?; + let feature = Box::new(FeatureDefinition::decode( + required(&object, "feature")?.get(), + depth + 1, + remaining, + empty_tags, + blocks, + )?); + let values = list(required(&object, "placement")?)?; + if values.len() > 1024 { + return Err(DecodeError::Field("feature modifier chain")); + } + let placement = values + .iter() + .map(|raw| { + PlacementModifier::decode_with_blocks( + raw.get(), + depth + 1, + remaining, + blocks.map(|b| b as &dyn super::block_predicate::PredicateBlockResolver), + ) + }) + .collect::>()?; + Ok(Self { feature, placement }) + } + pub fn place( + &self, + world: &mut W, + random: &mut impl RandomSource, + origin: [i32; 3], + blocks: FeatureBlocks, + ) -> Result> { + self.place_in( + &mut FeaturePlacer::new(), + world, + random, + origin, + &Run { + blocks, + depth: Cell::new(0), + remaining: Cell::new(65536), + }, + ) + } + fn place_in( + &self, + placer: &mut FeaturePlacer, + world: &mut W, + random: &mut impl RandomSource, + origin: [i32; 3], + run: &Run, + ) -> Result> { + if run.remaining.get() == 0 { + return Err(FeatureExecutionError::WorkLimit); + } + run.remaining.set(run.remaining.get() - 1); + Ok(placer.place_with_budget( + &self.placement, + world, + random, + origin, + &run.remaining, + |world, random, p| self.feature.place_inner(world, random, p, run), + )?) + } +} +impl FeatureDefinition { + pub fn from_json(json: &str) -> Result { + Self::decode(json, 0, &mut 65536, &BTreeSet::new(), None) + } + pub fn from_json_with_blocks( + json: &str, + blocks: &FeatureBlockBindings<'_>, + ) -> Result { + Self::decode(json, 0, &mut 65536, &BTreeSet::new(), Some(blocks)) + } + pub(crate) fn from_catalog_json( + json: &str, + empty_tags: &BTreeSet, + blocks: Option<&FeatureBlockBindings<'_>>, + ) -> Result { + Self::decode(json, 0, &mut 65536, empty_tags, blocks) + } + fn decode( + json: &str, + depth: usize, + remaining: &mut usize, + empty_tags: &BTreeSet, + blocks: Option<&FeatureBlockBindings<'_>>, + ) -> Result { + visit(depth, remaining)?; + let object: Object = serde_json::from_str(json)?; + let kind = identifier(&serde_json::from_str::( + required(&object, "type")?.get(), + )?)?; + match kind.as_str() { + "minecraft:no_op" => Ok(Self::NoOp), + "minecraft:fill_layer" => FillLayerFeature::from_json( + json, + blocks.ok_or_else(|| { + DecodeError::Registry("feature block bindings unavailable".into()) + })?, + ) + .map(Self::FillLayer), + "minecraft:replace_single_block" => ReplaceBlockFeature::decode( + json, + blocks.ok_or_else(|| { + DecodeError::Registry("feature block bindings unavailable".into()) + })?, + depth, + remaining, + ) + .map(Self::ReplaceBlock), + "minecraft:scattered_ore" => ScatteredOreFeature::decode( + json, + blocks.ok_or_else(|| { + DecodeError::Registry("feature block bindings unavailable".into()) + })?, + depth, + remaining, + ) + .map(Self::ScatteredOre), + "minecraft:weighted_random_selector" => Ok(Self::WeightedChoice( + OptionalWeightedList::decode(required(&object, "features")?, |raw| { + PlacedFeatureDefinition::decode( + raw.get(), + depth + 1, + remaining, + empty_tags, + blocks, + ) + })?, + )), + "minecraft:sequence" | "minecraft:simple_random_selector" => { + let raw = required(&object, "features")?; + let name = serde_json::from_str::(raw.get()).ok(); + let named_empty = name + .as_deref() + .and_then(|s| s.strip_prefix('#')) + .map(identifier) + .transpose()? + .is_some_and(|name| empty_tags.contains(&name)); + if named_empty { + return Ok(if kind == "minecraft:sequence" { + Self::Sequence(vec![]) + } else { + Self::RandomChoice(vec![]) + }); + } + let values = if raw.get().trim_start().starts_with('[') { + list(raw)? + } else { + vec![raw.to_owned()] + }; + if values.is_empty() { + return Err(DecodeError::Field("empty feature list")); + } + let features = values + .iter() + .map(|raw| { + PlacedFeatureDefinition::decode( + raw.get(), + depth + 1, + remaining, + empty_tags, + blocks, + ) + }) + .collect::>()?; + Ok(if kind == "minecraft:sequence" { + Self::Sequence(features) + } else { + Self::RandomChoice(features) + }) + } + "minecraft:random_boolean_selector" => Ok(Self::BooleanChoice(Box::new([ + PlacedFeatureDefinition::decode( + required(&object, "feature_true")?.get(), + depth + 1, + remaining, + empty_tags, + blocks, + )?, + PlacedFeatureDefinition::decode( + required(&object, "feature_false")?.get(), + depth + 1, + remaining, + empty_tags, + blocks, + )?, + ]))), + "minecraft:random_selector" => { + let values = list(required(&object, "features")?)?; + let mut features = Vec::with_capacity(values.len()); + for raw in values { + let entry: Object = serde_json::from_str(raw.get())?; + let feature = PlacedFeatureDefinition::decode( + required(&entry, "feature")?.get(), + depth + 1, + remaining, + empty_tags, + blocks, + )?; + let chance: f32 = number_text(required(&entry, "chance")?)? + .parse() + .map_err(|_| DecodeError::Field("feature chance"))?; + if !(0. ..=1.).contains(&chance) || chance.is_sign_negative() { + return Err(DecodeError::Field("feature chance")); + } + features.push((chance, feature)); + } + Ok(Self::ChanceChoice { + features, + fallback: Box::new(PlacedFeatureDefinition::decode( + required(&object, "default")?.get(), + depth + 1, + remaining, + empty_tags, + blocks, + )?), + }) + } + _ => BasicFeature::from_json(json).map(Self::Basic), + } + } + pub fn place( + &self, + world: &mut W, + random: &mut impl RandomSource, + origin: [i32; 3], + blocks: FeatureBlocks, + ) -> Result> { + self.place_inner( + world, + random, + origin, + &Run { + blocks, + depth: Cell::new(0), + remaining: Cell::new(65536), + }, + ) + } + fn place_inner( + &self, + world: &mut W, + random: &mut impl RandomSource, + origin: [i32; 3], + run: &Run, + ) -> Result> { + if run.depth.get() >= 128 || run.remaining.get() == 0 { + return Err(FeatureExecutionError::WorkLimit); + } + run.depth.set(run.depth.get() + 1); + run.remaining.set(run.remaining.get() - 1); + let result = self.evaluate(world, random, origin, run); + run.depth.set(run.depth.get() - 1); + result + } + fn evaluate( + &self, + world: &mut W, + random: &mut impl RandomSource, + origin: [i32; 3], + run: &Run, + ) -> Result> { + let mut placer = FeaturePlacer::new(); + match self { + Self::Basic(feature) => feature + .place(world, random, origin, run.blocks) + .map_err(FeatureExecutionError::Basic), + Self::NoOp => Ok(true), + Self::ScatteredOre(feature) => feature + .place(world, random, origin) + .map_err(FeatureExecutionError::Basic), + Self::FillLayer(feature) => feature.place(world, origin).map_err(|e| match e { + BlockFeatureError::World(e) => FeatureExecutionError::Basic(FeatureError::World(e)), + BlockFeatureError::Query(e) => FeatureExecutionError::Query(e), + }), + Self::ReplaceBlock(feature) => { + feature.place(world, random, origin).map_err(|e| match e { + BlockFeatureError::World(e) => { + FeatureExecutionError::Basic(FeatureError::World(e)) + } + BlockFeatureError::Query(e) => FeatureExecutionError::Query(e), + }) + } + Self::WeightedChoice(features) => match features.sample(random)? { + Some(feature) => feature.place_in(&mut placer, world, random, origin, run), + None => Ok(false), + }, + Self::Sequence(features) => { + for feature in features { + if !feature.place_in(&mut placer, world, random, origin, run)? { + return Ok(false); + } + } + Ok(true) + } + Self::BooleanChoice(features) => { + let index = if random.next_boolean() { 0 } else { 1 }; + features[index].place_in(&mut placer, world, random, origin, run) + } + Self::RandomChoice(features) => { + let index = random.next_int_bound(features.len() as i32)? as usize; + features[index].place_in(&mut placer, world, random, origin, run) + } + Self::ChanceChoice { features, fallback } => { + for (chance, feature) in features { + if random.next_float() < *chance { + return feature.place_in(&mut placer, world, random, origin, run); + } + } + fallback.place_in(&mut placer, world, random, origin, run) + } + } + } +} diff --git a/crates/horizon-world/src/worldgen/feature_region.rs b/crates/horizon-world/src/worldgen/feature_region.rs new file mode 100644 index 000000000..242e61d73 --- /dev/null +++ b/crates/horizon-world/src/worldgen/feature_region.rs @@ -0,0 +1,231 @@ +//! Resident pre-light chunks shared by modifier queries and feature mutations. +//! The caller supplies world write policy/effects; storage alone cannot implement +//! neighbor updates, block entities, POIs or lighting. +use super::{ + anchor::WorldGenerationContext, + biome_chunk::{BiomeRegion, BiomeRegionError}, + feature::FeatureWorld, + placement::{LayerBlock, PlacementContext, PlacementQueryError}, + terrain::{PreLightChunkStage, TerrainBlockStates, TerrainChunk, TerrainError}, +}; +use crate::{ + heightmap::{HeightmapState, HeightmapType}, + registry::BlockStateId, +}; +use horizon_core::position::BlockPos; +use std::collections::BTreeMap; + +#[derive(Debug)] +pub enum RegionError { + InvalidChunks, + MissingChunk([i32; 2]), + Terrain(TerrainError), + Biome(BiomeRegionError), + BiomesNotGenerated([i32; 2]), +} +impl std::fmt::Display for RegionError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{self:?}") + } +} +impl std::error::Error for RegionError {} +impl From for RegionError { + fn from(error: TerrainError) -> Self { + Self::Terrain(error) + } +} +impl From for PlacementQueryError { + fn from(error: RegionError) -> Self { + Self::Failed(error.to_string()) + } +} +pub struct TerrainRegion<'r, B: TerrainBlockStates> { + chunks: BTreeMap<(i32, i32), TerrainChunk<'r, B>>, + min_y: i32, + height: i32, + generation: WorldGenerationContext, +} +impl<'r, B: TerrainBlockStates> TerrainRegion<'r, B> { + pub fn new( + chunks: Vec>, + generator: WorldGenerationContext, + ) -> Result { + if chunks.is_empty() || chunks.len() > 4096 { + return Err(RegionError::InvalidChunks); + } + let first = &chunks[0]; + let (min_y, height, registry) = (first.min_y(), first.height(), first.registry()); + if chunks.iter().any(|c| { + c.min_y() != min_y || c.height() != height || !std::ptr::eq(c.registry(), registry) + }) { + return Err(RegionError::InvalidChunks); + } + let mut stored = BTreeMap::new(); + for chunk in chunks { + let p = chunk.position(); + if stored.insert((p.x, p.z), chunk).is_some() { + return Err(RegionError::InvalidChunks); + } + } + Ok(Self { + chunks: stored, + min_y, + height, + generation: WorldGenerationContext::with_generator( + min_y, + height, + generator.min_y, + generator.height, + generator.sea_level, + ), + }) + } + pub fn chunks(&self) -> impl Iterator> { + self.chunks.values() + } + pub fn chunk(&self, x: i32, z: i32) -> Result<&TerrainChunk<'r, B>, RegionError> { + self.chunks + .get(&(x, z)) + .ok_or(RegionError::MissingChunk([x, z])) + } + pub fn chunk_mut(&mut self, x: i32, z: i32) -> Result<&mut TerrainChunk<'r, B>, RegionError> { + self.chunks + .get_mut(&(x, z)) + .ok_or(RegionError::MissingChunk([x, z])) + } + pub fn block(&self, [x, y, z]: [i32; 3]) -> Result { + Ok(self.chunk(x >> 4, z >> 4)?.block(x, y, z)) + } + /// Level-style biome lookup checks the selected chunk's generation status + /// before reading its palette. Raw biome storage remains independently + /// accessible for generation itself. Below-zero retrogen is not modeled. + pub fn biome_at<'b, T: Clone>( + &self, + biomes: &'b BiomeRegion, + position: BlockPos, + ) -> Result<&'b T, RegionError> { + self.noise_biome(biomes, biomes.quart_at_block(position)) + } + pub fn noise_biome<'b, T: Clone>( + &self, + biomes: &'b BiomeRegion, + quart: [i32; 3], + ) -> Result<&'b T, RegionError> { + let chunk = self.chunk(quart[0] >> 2, quart[2] >> 2)?; + if !matches!( + chunk.generation_stage(), + PreLightChunkStage::Biomes | PreLightChunkStage::Terrain | PreLightChunkStage::Features + ) { + return Err(RegionError::BiomesNotGenerated([ + quart[0] >> 2, + quart[2] >> 2, + ])); + } + biomes.noise_biome(quart).map_err(RegionError::Biome) + } + /// Storage mutation only. World code must apply its write permissions, + /// block-entity/POI effects and postprocessing around this operation. + pub fn set_block_worldgen( + &mut self, + [x, y, z]: [i32; 3], + state: BlockStateId, + ) -> Result { + Ok(self + .chunk_mut(x >> 4, z >> 4)? + .set_block_worldgen(x, y, z, state)?) + } +} +impl PlacementContext for TerrainRegion<'_, B> { + fn generation(&self) -> WorldGenerationContext { + self.generation + } + fn block_state(&mut self, position: [i32; 3]) -> Result { + self.block(position).map_err(Into::into) + } + fn min_y(&mut self) -> Result { + Ok(self.min_y) + } + fn max_y(&mut self) -> Result { + Ok(self.min_y.wrapping_add(self.height).wrapping_sub(1)) + } + fn height(&mut self, kind: HeightmapType, x: i32, z: i32) -> Result { + let chunk = self.chunk_mut(x >> 4, z >> 4)?; + if chunk.heightmap(kind).is_none() { + chunk.prime_heightmaps(&[kind]).map_err(RegionError::from)?; + } + chunk + .heightmap(kind) + .unwrap() + .first_available(x & 15, z & 15) + .map_err(|e| RegionError::from(TerrainError::from(e)).into()) + } + fn layer_block(&mut self, position: [i32; 3]) -> Result { + let chunk = self.chunk(position[0] >> 4, position[2] >> 4)?; + let state = chunk.block(position[0], position[1], position[2]); + let name = &chunk + .registry() + .state(state) + .expect("registered chunk state") + .name; + Ok( + if chunk.block_properties(state).is_air() + || name == "minecraft:water" + || name == "minecraft:lava" + { + LayerBlock::Empty + } else if name == "minecraft:bedrock" { + LayerBlock::Bedrock + } else { + LayerBlock::Ground + }, + ) + } +} +/// Gives feature algorithms and placement queries one region. All update flags +/// reach the supplied write function, which owns world mutation policy/effects. +pub struct TerrainFeatureAccess<'a, 'r, B: TerrainBlockStates, F> { + region: &'a mut TerrainRegion<'r, B>, + write: F, +} +impl<'a, 'r, B: TerrainBlockStates, F> TerrainFeatureAccess<'a, 'r, B, F> { + pub fn new(region: &'a mut TerrainRegion<'r, B>, write: F) -> Self { + Self { region, write } + } +} +impl PlacementContext for TerrainFeatureAccess<'_, '_, B, F> { + fn generation(&self) -> WorldGenerationContext { + self.region.generation() + } + fn block_state(&mut self, position: [i32; 3]) -> Result { + self.region.block_state(position) + } + fn min_y(&mut self) -> Result { + self.region.min_y() + } + fn max_y(&mut self) -> Result { + self.region.max_y() + } + fn height(&mut self, kind: HeightmapType, x: i32, z: i32) -> Result { + self.region.height(kind, x, z) + } + fn layer_block(&mut self, position: [i32; 3]) -> Result { + self.region.layer_block(position) + } +} +impl<'r, B: TerrainBlockStates, F> FeatureWorld for TerrainFeatureAccess<'_, 'r, B, F> +where + F: FnMut(&mut TerrainRegion<'r, B>, [i32; 3], BlockStateId, i32) -> Result, +{ + type Error = RegionError; + fn block(&mut self, position: [i32; 3]) -> Result { + self.region.block(position) + } + fn set_block( + &mut self, + position: [i32; 3], + state: BlockStateId, + flags: i32, + ) -> Result { + (self.write)(self.region, position, state, flags) + } +} diff --git a/crates/horizon-world/src/worldgen/feature_sort.rs b/crates/horizon-world/src/worldgen/feature_sort.rs new file mode 100644 index 000000000..82d4ef6a0 --- /dev/null +++ b/crates/horizon-world/src/worldgen/feature_sort.rs @@ -0,0 +1,116 @@ +//! Deterministic feature ordering across biome generation steps. +use std::collections::{BTreeMap, BTreeSet}; + +/// A placed-feature object identity, assigned by the owning registry snapshot. +/// Structurally equal but separately allocated features need distinct IDs. +#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct FeatureIdentity(pub u32); + +#[derive(Clone, Debug)] +pub struct StepFeatureData { + features: Vec, + indices: BTreeMap, +} +impl StepFeatureData { + pub fn features(&self) -> &[FeatureIdentity] { + &self.features + } + pub fn index(&self, feature: FeatureIdentity) -> Option { + self.indices.get(&feature).copied() + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum FeatureSortError { + Cycle, + WorkLimit, + DuplicateBiome, +} +impl std::fmt::Display for FeatureSortError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(match self { + Self::Cycle => "feature order cycle found", + Self::WorkLimit => "feature ordering input limit exceeded", + Self::DuplicateBiome => "duplicate biome identity in decoration plan", + }) + } +} +impl std::error::Error for FeatureSortError {} + +/// Inputs preserve biome order, step order and each holder set's encounter order. +pub fn build_features_per_step( + biomes: &[Vec>], +) -> Result, FeatureSortError> { + if biomes.len() > 8192 { + return Err(FeatureSortError::WorkLimit); + } + type Node = (usize, usize); // Native comparator: step, then first identity index. + let mut identities = BTreeMap::new(); + let mut encountered = Vec::new(); + let mut graph = BTreeMap::>::new(); + let mut steps = 0; + let mut remaining = 65536usize; + for biome in biomes { + if biome.len() > 8192 { + return Err(FeatureSortError::WorkLimit); + } + steps = steps.max(biome.len()); + let mut previous = None; + for (step, features) in biome.iter().enumerate() { + remaining = remaining + .checked_sub(1) + .ok_or(FeatureSortError::WorkLimit)?; + for feature in features { + remaining = remaining + .checked_sub(1) + .ok_or(FeatureSortError::WorkLimit)?; + let index = *identities.entry(*feature).or_insert_with(|| { + encountered.push(*feature); + encountered.len() - 1 + }); + let node = (step, index); + graph.entry(node).or_default(); + if let Some(previous) = previous { + graph.entry(previous).or_default().insert(node); + } + previous = Some(node); + } + } + } + let mut colors = BTreeMap::::new(); + let mut ordered = Vec::with_capacity(graph.len()); + let mut stack = Vec::new(); + for &root in graph.keys() { + if colors.get(&root) == Some(&2) { + continue; + } + stack.push((root, false)); + while let Some((node, finish)) = stack.pop() { + if finish { + colors.insert(node, 2); + ordered.push(node); + continue; + } + match colors.get(&node) { + Some(2) => continue, + Some(1) => return Err(FeatureSortError::Cycle), + _ => {} + } + colors.insert(node, 1); + stack.push((node, true)); + stack.extend(graph[&node].iter().rev().map(|&next| (next, false))); + } + } + let mut result = (0..steps) + .map(|_| StepFeatureData { + features: Vec::new(), + indices: BTreeMap::new(), + }) + .collect::>(); + for (step, index) in ordered.into_iter().rev() { + let feature = encountered[index]; + let data = &mut result[step]; + data.indices.insert(feature, data.features.len()); + data.features.push(feature); + } + Ok(result) +} diff --git a/crates/horizon-world/src/worldgen/fluid_predicate.rs b/crates/horizon-world/src/worldgen/fluid_predicate.rs new file mode 100644 index 000000000..bc227d577 --- /dev/null +++ b/crates/horizon-world/src/worldgen/fluid_predicate.rs @@ -0,0 +1,92 @@ +//! Resolved fluid holder sets bound to immutable vanilla block-state identities. +use super::{DecodeError, density::identifier}; +use crate::{ + fluid::{FluidKind, FluidStateTable}, + registry::{BlockRegistry, BlockStateId}, +}; +use std::{collections::BTreeMap, sync::Arc}; +pub struct FluidPredicateBindings { + table: Arc, + tags: BTreeMap, +} +impl FluidPredicateBindings { + pub fn new(registry: &BlockRegistry) -> Result { + Ok(Self { + table: Arc::new( + FluidStateTable::new(registry).map_err(|e| DecodeError::Registry(e.to_string()))?, + ), + tags: BTreeMap::new(), + }) + } + pub fn with_resolved_tags( + mut self, + tags: &BTreeMap>, + ) -> Result { + if tags.len() > 8192 { + return Err(DecodeError::Field("fluid tag count")); + } + let mut resolved = BTreeMap::new(); + for (tag, names) in tags { + if names.len() > 8192 { + return Err(DecodeError::Field("fluid tag size")); + } + let mut mask = 0; + for name in names { + mask |= fluid(name)?.mask(); + } + if resolved + .insert(super::tags::identifier(tag)?, mask) + .is_some() + { + return Err(DecodeError::Field("duplicate fluid tag")); + } + } + self.tags = resolved; + Ok(self) + } + pub fn resolve(&self, json: &str) -> Result { + let mask = if let Ok(name) = serde_json::from_str::(json) { + if let Some(tag) = name.strip_prefix('#') { + *self + .tags + .get(&super::tags::identifier(tag)?) + .ok_or_else(|| DecodeError::Registry(format!("unknown fluid tag {tag}")))? + } else { + fluid(&name)?.mask() + } + } else { + let names: Vec = serde_json::from_str(json)?; + if names.len() > 8192 { + return Err(DecodeError::Field("fluid holder list")); + } + let mut mask = 0; + for name in names { + mask |= fluid(&name)?.mask(); + } + mask + }; + Ok(BoundFluidSet { + table: self.table.clone(), + mask, + }) + } +} +fn fluid(name: &str) -> Result { + FluidKind::from_name(&identifier(name)?) + .ok_or_else(|| DecodeError::Registry(format!("unknown fluid {name}"))) +} + +/// A fluid-family mask over one shared immutable state table. Membership needs +/// one indexed lookup and avoids allocating large sets of equivalent states. +#[derive(Clone, Debug)] +pub struct BoundFluidSet { + table: Arc, + mask: u8, +} +impl BoundFluidSet { + pub fn contains(&self, state: BlockStateId) -> bool { + self.table + .get(state) + .is_some_and(|value| value.kind().mask() & self.mask != 0) + } +} diff --git a/crates/horizon-world/src/worldgen/height_provider.rs b/crates/horizon-world/src/worldgen/height_provider.rs new file mode 100644 index 000000000..6849f3a3a --- /dev/null +++ b/crates/horizon-world/src/worldgen/height_provider.rs @@ -0,0 +1,149 @@ +//! Anchored scalar height distributions used by cave and canyon generation. +//! Codec encoding remains separate work. +use super::{ + DecodeError, Object, + anchor::{VerticalAnchor, WorldGenerationContext}, + density::identifier, + int_range, integer, optional, required, + weighted::WeightedList, +}; +use horizon_core::random::{InvalidBound, RandomSource}; + +#[derive(Clone, Debug)] +pub enum HeightProvider { + Weighted(WeightedList), + Constant(VerticalAnchor), + Uniform { + min: VerticalAnchor, + max: VerticalAnchor, + }, + BiasedToBottom { + min: VerticalAnchor, + max: VerticalAnchor, + inner: i32, + }, + VeryBiasedToBottom { + min: VerticalAnchor, + max: VerticalAnchor, + inner: i32, + }, + Trapezoid { + min: VerticalAnchor, + max: VerticalAnchor, + plateau: i32, + }, +} +impl HeightProvider { + pub fn from_json(json: &str) -> Result { + Self::decode(json, 0, &mut 65536) + } + fn decode(json: &str, depth: usize, remaining: &mut usize) -> Result { + if depth > 256 || *remaining == 0 { + return Err(DecodeError::Field("height provider depth or node count")); + } + *remaining -= 1; + if let Ok(anchor) = VerticalAnchor::from_json(json) { + return Ok(Self::Constant(anchor)); + } + let object: Object = serde_json::from_str(json)?; + let kind = identifier(&serde_json::from_str::( + required(&object, "type")?.get(), + )?)?; + let anchor = |name| VerticalAnchor::from_json(required(&object, name)?.get()); + if kind == "minecraft:constant" { + return Ok(Self::Constant(anchor("value")?)); + } + if kind == "minecraft:weighted_list" { + return Ok(Self::Weighted(WeightedList::decode( + required(&object, "distribution")?, + |raw| Self::decode(raw.get(), depth + 1, remaining), + )?)); + } + let min = anchor("min_inclusive")?; + let max = anchor("max_inclusive")?; + match kind.as_str() { + "minecraft:uniform" => Ok(Self::Uniform { min, max }), + "minecraft:biased_to_bottom" | "minecraft:very_biased_to_bottom" => { + let inner = optional(&object, "inner") + .map(|raw| int_range(raw, "inner", 1, i32::MAX)) + .transpose()? + .unwrap_or(1); + Ok(if kind == "minecraft:biased_to_bottom" { + Self::BiasedToBottom { min, max, inner } + } else { + Self::VeryBiasedToBottom { min, max, inner } + }) + } + "minecraft:trapezoid" => Ok(Self::Trapezoid { + min, + max, + plateau: optional(&object, "plateau") + .map(integer) + .transpose()? + .unwrap_or(0), + }), + _ => Err(DecodeError::Field("height provider type")), + } + } + pub fn sample( + &self, + random: &mut impl RandomSource, + context: WorldGenerationContext, + ) -> Result { + let (min, max) = match self { + Self::Weighted(list) => return list.sample(random)?.sample(random, context), + Self::Constant(anchor) => return Ok(anchor.resolve(context)), + Self::Uniform { min, max } + | Self::BiasedToBottom { min, max, .. } + | Self::VeryBiasedToBottom { min, max, .. } + | Self::Trapezoid { min, max, .. } => (min.resolve(context), max.resolve(context)), + }; + match self { + Self::Constant(_) | Self::Weighted(_) => unreachable!(), + Self::Uniform { .. } => { + if min > max { + Ok(min) + } else { + random.next_int_between_inclusive(min, max) + } + } + Self::BiasedToBottom { inner, .. } | Self::VeryBiasedToBottom { inner, .. } => { + let range = max.wrapping_sub(min).wrapping_sub(*inner).wrapping_add(1); + if range <= 0 { + return Ok(min); + } + if matches!(self, Self::BiasedToBottom { .. }) { + let first = random.next_int_bound(range)?; + Ok(random + .next_int_bound(first.wrapping_add(*inner))? + .wrapping_add(min)) + } else { + let first = next_int(random, min.wrapping_add(*inner), max)?; + let second = next_int(random, min, first.wrapping_sub(1))?; + next_int(random, min, second.wrapping_sub(1).wrapping_add(*inner)) + } + } + Self::Trapezoid { plateau, .. } => { + if min > max { + return Ok(min); + } + let range = max.wrapping_sub(min); + if *plateau >= range { + return random.next_int_between_inclusive(min, max); + } + let slope = range.wrapping_sub(*plateau) / 2; + let middle = range.wrapping_sub(slope); + let left = random.next_int_between_inclusive(0, middle)?; + let right = random.next_int_between_inclusive(0, slope)?; + Ok(min.wrapping_add(left).wrapping_add(right)) + } + } + } +} +fn next_int(random: &mut impl RandomSource, min: i32, max: i32) -> Result { + if min >= max { + Ok(min) + } else { + random.next_int_between_inclusive(min, max) + } +} diff --git a/crates/horizon-world/src/worldgen/material_condition.rs b/crates/horizon-world/src/worldgen/material_condition.rs new file mode 100644 index 000000000..30eb26ec8 --- /dev/null +++ b/crates/horizon-world/src/worldgen/material_condition.rs @@ -0,0 +1,611 @@ +//! Numeric material conditions and their column/block evaluation caches. +//! +//! This worker owns its condition caches so they cannot be reused accidentally +//! against a different column context. +mod codec; +mod density; +mod library; +mod noise; +mod rule; +use super::{ + DecodeError, + anchor::{VerticalAnchor, WorldGenerationContext}, + material_surface::MaterialSurface, +}; +use crate::registry::BlockStateId; +pub use codec::{MaterialBiomeTag, MaterialConditionReference, MaterialConditionRegistry}; +pub use density::MaterialDensitySources; +use horizon_core::noise::Noise; +use horizon_core::{ + position::BlockPos, + random::{PositionalRandom, RandomSource}, +}; +pub use library::MaterialRuleLibrary; +pub use noise::MaterialNoiseSources; +use rule::CompiledRule; +pub use rule::{MaterialRule, MaterialRuleError}; +use std::{ + collections::{BTreeMap, BTreeSet}, + sync::Arc, +}; + +/// Surface inputs come from the material system. Implementations should keep +/// world configuration fixed for the lifetime of a condition worker. +pub trait MaterialSurfaceQueries { + /// Bind a compiled density root, optionally sampling the expected chunk now. + fn bind_density( + &mut self, + _sampler: Arc, + _eager: bool, + ) -> Result { + Err(DecodeError::Field("missing material density provider")) + } + fn density(&mut self, _index: usize, _position: BlockPos) -> Result { + Err(MaterialRuleError::MissingDensityProvider) + } + fn preliminary_surface(&mut self, _position: BlockPos) -> Result { + Err(MaterialRuleError::MissingDensityProvider) + } + fn possible_biomes(&self) -> Option> { + None + } + fn biome(&mut self, _position: BlockPos) -> Result>, MaterialRuleError> { + Err(MaterialRuleError::MissingBiomeProvider) + } + fn melts_frozen_ocean( + &mut self, + _biome: &str, + _position: BlockPos, + _sea_level: i32, + ) -> Result { + Err(MaterialRuleError::MissingBiomeProvider) + } + fn cold_enough_to_snow( + &mut self, + _biome: &str, + _position: BlockPos, + _sea_level: i32, + ) -> Result { + Err(MaterialRuleError::MissingBiomeProvider) + } + fn bind_noise(&mut self, _name: &str) -> Result, DecodeError> { + Err(DecodeError::Field("missing material noise provider")) + } + fn surface_depth(&mut self, x: i32, z: i32) -> i32; + fn surface_secondary(&mut self, x: i32, z: i32) -> f64; + fn band(&mut self, _position: BlockPos) -> Result { + Err(MaterialRuleError::MissingBandProvider) + } +} +impl MaterialSurfaceQueries for &mut T { + fn bind_density( + &mut self, + sampler: Arc, + eager: bool, + ) -> Result { + (**self).bind_density(sampler, eager) + } + fn density(&mut self, index: usize, position: BlockPos) -> Result { + (**self).density(index, position) + } + fn preliminary_surface(&mut self, position: BlockPos) -> Result { + (**self).preliminary_surface(position) + } + fn possible_biomes(&self) -> Option> { + (**self).possible_biomes() + } + fn biome(&mut self, position: BlockPos) -> Result>, MaterialRuleError> { + (**self).biome(position) + } + fn cold_enough_to_snow( + &mut self, + biome: &str, + position: BlockPos, + sea: i32, + ) -> Result { + (**self).cold_enough_to_snow(biome, position, sea) + } + fn melts_frozen_ocean( + &mut self, + biome: &str, + position: BlockPos, + sea: i32, + ) -> Result { + (**self).melts_frozen_ocean(biome, position, sea) + } + fn bind_noise(&mut self, name: &str) -> Result, DecodeError> { + (**self).bind_noise(name) + } + fn surface_depth(&mut self, x: i32, z: i32) -> i32 { + (**self).surface_depth(x, z) + } + fn surface_secondary(&mut self, x: i32, z: i32) -> f64 { + (**self).surface_secondary(x, z) + } + fn band(&mut self, position: BlockPos) -> Result { + (**self).band(position) + } +} +impl MaterialSurfaceQueries for MaterialSurface

{ + fn band(&mut self, position: BlockPos) -> Result { + MaterialSurface::band(self, [position.x, position.y, position.z]) + .ok_or(MaterialRuleError::InvalidBandIndex) + } + fn surface_depth(&mut self, x: i32, z: i32) -> i32 { + MaterialSurface::surface_depth(self, x, z) + } + fn surface_secondary(&mut self, x: i32, z: i32) -> f64 { + MaterialSurface::surface_secondary(self, x, z) + } +} + +#[derive(Clone, Debug)] +pub enum MaterialCondition { + Hole, + Steep, + Biome(Vec), + BiomeTag(MaterialBiomeTag), + Temperature, + AbovePreliminarySurface, + NoiseThreshold { + noise: String, + min: f64, + max: f64, + is_3d: bool, + }, + YAbove { + anchor: VerticalAnchor, + surface_depth_multiplier: i32, + add_stone_depth: bool, + }, + Water { + offset: i32, + surface_depth_multiplier: i32, + add_stone_depth: bool, + }, + StoneDepth { + offset: i32, + add_surface_depth: bool, + secondary_depth_range: i32, + ceiling: bool, + }, + VerticalGradient { + random_name: String, + true_at_and_below: VerticalAnchor, + false_at_and_above: VerticalAnchor, + }, + Not(Box), + Reference(MaterialConditionReference), +} + +struct Context { + surface: S, + generation: WorldGenerationContext, + column_revision: i64, + block_revision: i64, + position: BlockPos, + gradient: [i32; 2], + depth: i32, + water_height: i32, + stone_above: i32, + stone_below: i32, + secondary_revision: i64, + secondary: f64, + minimum_revision: i64, + minimum: i32, + noises: Vec, + noise_indices: BTreeMap<(String, bool), usize>, + possible_biomes: Option>, + biome: Option>, +} +struct CachedNoise { + sampler: Arc, + is_3d: bool, + revision: i64, + value: f64, +} +impl Context { + fn minimum_surface_level(&mut self) -> Result { + if self.minimum_revision != self.column_revision { + // Vanilla stamps before sampling, including when sampling fails. + self.minimum_revision = self.column_revision; + let value = self.surface.preliminary_surface(BlockPos::new( + self.position.x, + 0, + self.position.z, + ))?; + // 26.3 floors before the saturating Java numeric conversion. + let floor = value.floor() as i32; + self.minimum = floor.wrapping_add(self.depth).wrapping_sub(8); + } + Ok(self.minimum) + } + fn biome(&mut self) -> Result>, MaterialRuleError> { + if self.biome.is_none() { + self.biome = self.surface.biome(self.position)?; + } + Ok(self.biome.clone()) + } + fn bind_noise(&mut self, name: &str, is_3d: bool) -> Result { + let key = (name.to_owned(), is_3d); + if let Some(index) = self.noise_indices.get(&key) { + return Ok(*index); + } + let sampler = self.surface.bind_noise(name)?; + let index = self.noises.len(); + self.noises.push(CachedNoise { + sampler, + is_3d, + revision: if is_3d { + self.block_revision + } else { + self.column_revision + } + .wrapping_sub(1), + value: 0.0, + }); + self.noise_indices.insert(key, index); + Ok(index) + } + fn noise(&mut self, index: usize) -> f64 { + let noise = &mut self.noises[index]; + let revision = if noise.is_3d { + self.block_revision + } else { + self.column_revision + }; + if noise.revision != revision { + noise.value = f64::from(noise.sampler.get3( + f64::from(self.position.x), + if noise.is_3d { + f64::from(self.position.y) + } else { + 0.0 + }, + f64::from(self.position.z), + )); + noise.revision = revision; + } + noise.value + } + fn secondary(&mut self) -> f64 { + if self.secondary_revision != self.column_revision { + self.secondary_revision = self.column_revision; + self.secondary = self + .surface + .surface_secondary(self.position.x, self.position.z); + } + self.secondary + } +} +struct Compiled { + kind: Kind, + revision: i64, + result: Option, +} +enum Kind { + Simple(MaterialCondition), + Biome(BTreeSet), + Constant(bool), + Noise { + sampler: usize, + min: f64, + max: f64, + }, + Gradient { + low: i32, + high: i32, + random: R::Positional, + }, + Not(Box>), +} +impl Compiled { + fn compile( + condition: MaterialCondition, + root: &R::Positional, + context: &mut Context, + depth: usize, + ) -> Result { + if depth >= 256 { + return Err(DecodeError::Field("material condition depth")); + } + let column = matches!( + condition, + MaterialCondition::Hole | MaterialCondition::Steep + ); + let kind = match condition { + MaterialCondition::BiomeTag(tag) => { + return Self::compile( + MaterialCondition::Biome(tag.members().to_vec()), + root, + context, + depth + 1, + ); + } + MaterialCondition::Biome(names) => { + if names.len() > 8192 { + return Err(DecodeError::Field("biome condition size")); + } + let names = names + .iter() + .map(|name| codec::identifier(name)) + .collect::, _>>()?; + match &context.possible_biomes { + Some(possible) if names.is_disjoint(possible) => Kind::Constant(false), + Some(possible) if possible.is_subset(&names) => Kind::Constant(true), + _ => Kind::Biome(names), + } + } + MaterialCondition::NoiseThreshold { + noise, + min, + max, + is_3d, + } => Kind::Noise { + sampler: context.bind_noise(&codec::identifier(&noise)?, is_3d)?, + min, + max, + }, + MaterialCondition::Reference(reference) => { + return Self::compile(reference.value().clone(), root, context, depth + 1); + } + MaterialCondition::Not(child) => { + Kind::Not(Box::new(Self::compile(*child, root, context, depth + 1)?)) + } + MaterialCondition::VerticalGradient { + random_name, + true_at_and_below, + false_at_and_above, + } => { + let random_name = codec::identifier(&random_name)?; + Kind::Gradient { + low: true_at_and_below.resolve(context.generation), + high: false_at_and_above.resolve(context.generation), + random: root.from_hash_of(&random_name).fork_positional(), + } + } + other => Kind::Simple(other), + }; + Ok(Self { + kind, + revision: if column { + context.column_revision + } else { + context.block_revision + } + .wrapping_sub(1), + result: None, + }) + } + fn test( + &mut self, + context: &mut Context, + ) -> Result { + if let Kind::Constant(value) = self.kind { + return Ok(value); + } + if matches!( + self.kind, + Kind::Simple(MaterialCondition::AbovePreliminarySurface) + ) { + return Ok(context.position.y >= context.minimum_surface_level()?); + } + if matches!(self.kind, Kind::Simple(MaterialCondition::Temperature)) { + let biome = context.biome()?.ok_or(MaterialRuleError::MissingBiome)?; + return context.surface.cold_enough_to_snow( + &biome, + context.position, + context.generation.sea_level, + ); + } + if let Kind::Noise { sampler, min, max } = &self.kind { + let value = context.noise(*sampler); + return Ok(value >= *min && value <= *max); + } + if let Kind::Not(child) = &mut self.kind { + return child.test(context).map(|value| !value); + } + let column = matches!( + self.kind, + Kind::Simple(MaterialCondition::Hole | MaterialCondition::Steep) + ); + let revision = if column { + context.column_revision + } else { + context.block_revision + }; + if self.revision == revision { + return self + .result + .ok_or(MaterialRuleError::CachedConditionUnavailable); + } + self.revision = revision; + let result = match &self.kind { + Kind::Biome(names) => names.contains( + context + .biome()? + .ok_or(MaterialRuleError::MissingBiome)? + .as_ref(), + ), + Kind::Simple(MaterialCondition::Hole) => context.depth <= 0, + Kind::Simple(MaterialCondition::Steep) => { + context.gradient[0] <= -4 || context.gradient[1] >= 4 + } + Kind::Simple(MaterialCondition::YAbove { + anchor, + surface_depth_multiplier, + add_stone_depth, + }) => { + let y = context.position.y.wrapping_add(if *add_stone_depth { + context.stone_above + } else { + 0 + }); + y >= anchor + .resolve(context.generation) + .wrapping_add(context.depth.wrapping_mul(*surface_depth_multiplier)) + } + Kind::Simple(MaterialCondition::Water { + offset, + surface_depth_multiplier, + add_stone_depth, + }) => { + context.water_height == i32::MIN + || context.position.y.wrapping_add(if *add_stone_depth { + context.stone_above + } else { + 0 + }) >= context + .water_height + .wrapping_add(*offset) + .wrapping_add(context.depth.wrapping_mul(*surface_depth_multiplier)) + } + Kind::Simple(MaterialCondition::StoneDepth { + offset, + add_surface_depth, + secondary_depth_range, + ceiling, + }) => { + let stone = if *ceiling { + context.stone_below + } else { + context.stone_above + }; + let surface = if *add_surface_depth { context.depth } else { 0 }; + let secondary = if *secondary_depth_range == 0 { + 0 + } else { + (0.0 + ((context.secondary() - -1.0) / (1.0 - -1.0)) + * (f64::from(*secondary_depth_range) - 0.0)) as i32 + }; + stone + <= 1i32 + .wrapping_add(*offset) + .wrapping_add(surface) + .wrapping_add(secondary) + } + Kind::Gradient { low, high, random } => { + let y = context.position.y; + if y <= *low { + true + } else if y >= *high { + false + } else { + let probability = 1.0 + + ((f64::from(y) - f64::from(*low)) / (f64::from(*high) - f64::from(*low))) + * (0.0 - 1.0); + f64::from(random.at(context.position).next_float()) < probability + } + } + _ => unreachable!("all recursive and gradient definitions are compiled"), + }; + self.result = Some(result); + Ok(result) + } +} + +/// A thread-local material-condition worker. Surface state and evaluations are +/// owned together; updates invalidate exactly the corresponding vanilla caches. +pub struct MaterialConditions { + root: R::Positional, + context: Context, + conditions: Vec>, + rules: Vec>, +} +impl MaterialConditions { + pub fn new(generation: WorldGenerationContext, root: R::Positional, surface: S) -> Self { + let possible_biomes = surface.possible_biomes(); + Self::with_possible_biomes(generation, root, surface, possible_biomes) + } + pub(crate) fn with_possible_biomes( + generation: WorldGenerationContext, + root: R::Positional, + surface: S, + possible_biomes: Option>, + ) -> Self { + Self { + root, + context: Context { + surface, + generation, + column_revision: i64::MIN + 1, + block_revision: i64::MIN + 1, + position: BlockPos::new(0, 0, 0), + gradient: [0, 0], + depth: 0, + water_height: 0, + stone_above: 0, + stone_below: 0, + secondary_revision: i64::MIN, + secondary: 0.0, + minimum_revision: i64::MIN, + minimum: 0, + noises: Vec::new(), + noise_indices: BTreeMap::new(), + possible_biomes, + biome: None, + }, + conditions: Vec::new(), + rules: Vec::new(), + } + } + /// Compile a condition at the current context revision. Gradient bounds and + /// named random factories are bound now, before the first evaluation. + pub fn add(&mut self, condition: MaterialCondition) -> Result { + if self.conditions.len() >= 8192 { + return Err(DecodeError::Field("material condition count")); + } + let compiled = Compiled::compile(condition, &self.root, &mut self.context, 0)?; + let index = self.conditions.len(); + self.conditions.push(compiled); + Ok(index) + } + pub fn update_xz(&mut self, x: i32, z: i32, gradient_x: i32, gradient_z: i32) { + self.context.column_revision = self.context.column_revision.wrapping_add(1); + self.context.block_revision = self.context.block_revision.wrapping_add(1); + self.context.position.x = x; + self.context.position.z = z; + self.context.gradient = [gradient_x, gradient_z]; + self.context.depth = self.context.surface.surface_depth(x, z); + } + pub fn update_y(&mut self, stone_above: i32, stone_below: i32, water_height: i32, y: i32) { + self.context.block_revision = self.context.block_revision.wrapping_add(1); + self.context.biome = None; + self.context.position.y = y; + self.context.stone_above = stone_above; + self.context.stone_below = stone_below; + self.context.water_height = water_height; + } + pub fn test(&mut self, index: usize) -> Result { + self.conditions + .get_mut(index) + .ok_or(MaterialRuleError::UnknownCondition)? + .test(&mut self.context) + } + /// Direct biome lookup for the outer column scan, independent of condition caching. + pub fn biome_at(&mut self, position: BlockPos) -> Result>, MaterialRuleError> { + self.context.surface.biome(position) + } + pub fn melts_frozen_ocean( + &mut self, + biome: &str, + position: BlockPos, + sea_level: i32, + ) -> Result { + self.context + .surface + .melts_frozen_ocean(biome, position, sea_level) + } + pub fn minimum_surface_level(&mut self) -> Result { + self.context.minimum_surface_level() + } + pub fn into_surface(self) -> S { + self.context.surface + } + pub fn surface_depth(&self) -> i32 { + self.context.depth + } + pub fn surface_secondary(&mut self) -> f64 { + self.context.secondary() + } +} diff --git a/crates/horizon-world/src/worldgen/material_condition/codec.rs b/crates/horizon-world/src/worldgen/material_condition/codec.rs new file mode 100644 index 000000000..ec646697e --- /dev/null +++ b/crates/horizon-world/src/worldgen/material_condition/codec.rs @@ -0,0 +1,474 @@ +//! Bounded numeric-condition registry loading and direct/holder JSON codecs. +use super::MaterialCondition; +use crate::worldgen::{ + DecodeError, Object, anchor::VerticalAnchor, double, int_range, integer, optional, required, +}; +use serde_json::{Value, value::RawValue}; +use std::{ + collections::{BTreeMap, BTreeSet}, + sync::Arc, +}; + +pub(super) fn identifier(name: &str) -> Result { + let (namespace, path) = name.split_once(':').unwrap_or(("minecraft", name)); + let namespace = if namespace.is_empty() { + "minecraft" + } else { + namespace + }; + let valid = |c: u8| c.is_ascii_lowercase() || c.is_ascii_digit() || b"_.-".contains(&c); + if !namespace.bytes().all(valid) || !path.bytes().all(|c| valid(c) || c == b'/') { + return Err(DecodeError::Field("material identifier")); + } + Ok(format!("{namespace}:{path}")) +} +#[derive(Clone, Debug)] +pub struct MaterialConditionReference { + name: String, + value: Arc, +} +impl MaterialConditionReference { + pub fn name(&self) -> &str { + &self.name + } + pub fn value(&self) -> &MaterialCondition { + &self.value + } +} +/// A named biome-tag snapshot for a fixed world-generation configuration. +#[derive(Clone, Debug)] +pub struct MaterialBiomeTag { + name: String, + members: Arc<[String]>, +} +impl MaterialBiomeTag { + pub fn name(&self) -> &str { + &self.name + } + pub fn members(&self) -> &[String] { + &self.members + } +} +#[derive(Debug)] +struct BiomeCatalog { + names: BTreeSet, + tags: BTreeMap>, +} +#[derive(Clone, Debug, Default)] +pub struct MaterialConditionRegistry { + values: BTreeMap>, + biomes: Option>, +} +impl MaterialConditionRegistry { + /// Load an immutable set atomically, including forward references. Cycles, + /// unresolved references and resource-limit violations are typed errors. + pub fn from_json(definitions: &BTreeMap) -> Result { + Self::load(definitions, None) + } + pub fn from_json_with_biomes( + definitions: &BTreeMap, + biomes: &BTreeSet, + ) -> Result { + Self::from_json_with_biome_tags(definitions, biomes, &BTreeMap::new()) + } + /// Bind resolved biome tags, such as `TagDefinitions::build().tags`. + /// Names and memberships remain immutable for the lifetime of this registry. + pub fn from_json_with_biome_tags( + definitions: &BTreeMap, + biomes: &BTreeSet, + tags: &BTreeMap>, + ) -> Result { + if biomes.len() > 8192 || tags.len() > 8192 { + return Err(DecodeError::Field("material biome catalog size")); + } + let names: BTreeSet<_> = biomes + .iter() + .map(|name| identifier(name)) + .collect::>()?; + let mut values = BTreeMap::new(); + let mut count = 0usize; + for (name, members) in tags { + count = count.saturating_add(members.len()); + if count > 65536 { + return Err(DecodeError::Field("material biome tag size")); + } + let mut bound = Vec::with_capacity(members.len()); + for member in members { + let member = identifier(member)?; + if !names.contains(&member) { + return Err(DecodeError::Field("unknown tagged biome")); + } + bound.push(member); + } + if values.insert(identifier(name)?, Arc::from(bound)).is_some() { + return Err(DecodeError::Field("duplicate biome tag")); + } + } + Self::load( + definitions, + Some(Arc::new(BiomeCatalog { + names, + tags: values, + })), + ) + } + fn load( + definitions: &BTreeMap, + biomes: Option>, + ) -> Result { + if definitions.len() > 8192 { + return Err(DecodeError::Field("material registry size")); + } + let mut loader = Loader { + biomes, + ..Loader::default() + }; + for (name, json) in definitions { + if loader + .definitions + .insert(identifier(name)?, serde_json::from_str(json)?) + .is_some() + { + return Err(DecodeError::Field("duplicate material condition")); + } + } + let names: Vec<_> = loader.definitions.keys().cloned().collect(); + for name in names { + loader.resolve(&name, 0)?; + } + Ok(Self { + values: loader.values, + biomes: loader.biomes, + }) + } + pub fn decode(&self, json: &str) -> Result { + let raw: Box = serde_json::from_str(json)?; + Loader { + values: self.values.clone(), + biomes: self.biomes.clone(), + ..Loader::default() + } + .node(&raw, 0) + } + pub fn get(&self, name: &str) -> Option { + let name = identifier(name).ok()?; + self.values + .get(&name) + .map(|value| MaterialConditionReference { + name, + value: value.clone(), + }) + } + pub fn entries(&self) -> impl Iterator { + self.values + .iter() + .map(|(name, value)| (name.as_str(), value.as_ref())) + } +} +#[derive(Default)] +struct Loader { + definitions: BTreeMap>, + values: BTreeMap>, + active: BTreeSet, + biomes: Option>, + nodes: usize, +} +impl Loader { + fn resolve(&mut self, name: &str, depth: usize) -> Result, DecodeError> { + if depth >= 256 { + return Err(DecodeError::Field("material condition depth")); + } + if let Some(value) = self.values.get(name) { + return Ok(value.clone()); + } + if !self.active.insert(name.to_owned()) { + return Err(DecodeError::Field("cyclic material condition")); + } + let json = self + .definitions + .get(name) + .ok_or(DecodeError::Field("missing material condition"))? + .clone(); + if !json.get().starts_with('{') { + return Err(DecodeError::Field("material definition must be direct")); + } + let value = Arc::new(self.node(&json, depth + 1)?); + self.active.remove(name); + self.values.insert(name.to_owned(), value.clone()); + Ok(value) + } + fn node(&mut self, raw: &RawValue, depth: usize) -> Result { + self.nodes += 1; + if depth >= 256 || self.nodes > 65536 { + return Err(DecodeError::Field("material condition size")); + } + if raw.get().starts_with('"') { + let name = identifier(&serde_json::from_str::(raw.get())?)?; + let value = self.resolve(&name, depth + 1)?; + return Ok(MaterialCondition::Reference(MaterialConditionReference { + name, + value, + })); + } + let object: Object = serde_json::from_str(raw.get())?; + let kind = identifier(&serde_json::from_str::( + required(&object, "type")?.get(), + )?)?; + let number = |name| integer(required(&object, name)?); + let boolean = |name| { + serde_json::from_str::(required(&object, name)?.get()).map_err(DecodeError::from) + }; + let anchor = |name| VerticalAnchor::from_json(required(&object, name)?.get()); + let multiplier = || { + int_range( + required(&object, "surface_depth_multiplier")?, + "surface_depth_multiplier", + -20, + 20, + ) + }; + Ok(match kind.as_str() { + "minecraft:noise_threshold" => MaterialCondition::NoiseThreshold { + noise: identifier(&serde_json::from_str::( + required(&object, "noise")?.get(), + )?)?, + min: double(required(&object, "min_threshold")?)?, + max: double(required(&object, "max_threshold")?)?, + is_3d: optional(&object, "is_3d") + .map(|raw| serde_json::from_str(raw.get())) + .transpose()? + .unwrap_or(false), + }, + "minecraft:temperature" => MaterialCondition::Temperature, + "minecraft:above_preliminary_surface" => MaterialCondition::AbovePreliminarySurface, + "minecraft:biome" => { + let catalog = self + .biomes + .as_ref() + .ok_or(DecodeError::Field("missing biome catalog"))?; + let raw = required(&object, "biome_is")?; + let names: Vec = if raw.get().starts_with('"') { + let name: String = serde_json::from_str(raw.get())?; + if let Some(tag) = name.strip_prefix('#') { + let name = identifier(tag)?; + let members = catalog + .tags + .get(&name) + .ok_or(DecodeError::Field("unknown biome tag"))? + .clone(); + return Ok(MaterialCondition::BiomeTag(MaterialBiomeTag { + name, + members, + })); + } + vec![name] + } else { + serde_json::from_str(raw.get())? + }; + if names.len() > 8192 { + return Err(DecodeError::Field("biome condition size")); + } + let mut resolved = Vec::with_capacity(names.len()); + for name in names { + let name = identifier(&name)?; + if !catalog.names.contains(&name) { + return Err(DecodeError::Field("unknown material biome")); + } + resolved.push(name); + } + MaterialCondition::Biome(resolved) + } + "minecraft:hole" => MaterialCondition::Hole, + "minecraft:steep" => MaterialCondition::Steep, + "minecraft:y_above" => MaterialCondition::YAbove { + anchor: anchor("anchor")?, + surface_depth_multiplier: multiplier()?, + add_stone_depth: boolean("add_stone_depth")?, + }, + "minecraft:water" => MaterialCondition::Water { + offset: number("offset")?, + surface_depth_multiplier: multiplier()?, + add_stone_depth: boolean("add_stone_depth")?, + }, + "minecraft:stone_depth" => { + let surface: String = + serde_json::from_str(required(&object, "surface_type")?.get())?; + let ceiling = match surface.as_str() { + "ceiling" => true, + "floor" => false, + _ => return Err(DecodeError::Field("surface_type")), + }; + MaterialCondition::StoneDepth { + offset: number("offset")?, + add_surface_depth: boolean("add_surface_depth")?, + secondary_depth_range: number("secondary_depth_range")?, + ceiling, + } + } + "minecraft:vertical_gradient" => MaterialCondition::VerticalGradient { + random_name: identifier(&serde_json::from_str::( + required(&object, "random_name")?.get(), + )?)?, + true_at_and_below: anchor("true_at_and_below")?, + false_at_and_above: anchor("false_at_and_above")?, + }, + "minecraft:not" => MaterialCondition::Not(Box::new( + self.node(required(&object, "invert")?, depth + 1)?, + )), + _ => return Err(DecodeError::Field("unsupported material condition type")), + }) + } +} +impl MaterialCondition { + pub fn from_json(json: &str) -> Result { + MaterialConditionRegistry::default().decode(json) + } + /// Encode the vanilla codec value. Nonfinite double thresholds use the + /// same NaN/Infinity tokens as Gson; strict JSON decoding rejects those tokens. + pub fn to_json(&self) -> Result { + self.encoded(0) + } + fn encoded(&self, depth: usize) -> Result { + if depth >= 256 { + return Err(DecodeError::Field("material condition depth")); + } + match self { + Self::Not(child) => Ok(format!( + "{{\"type\":\"minecraft:not\",\"invert\":{}}}", + child.encoded(depth + 1)? + )), + Self::NoiseThreshold { + noise, + min, + max, + is_3d, + } => { + let number = |v: f64| { + if v.is_nan() { + "NaN".to_owned() + } else if v == f64::INFINITY { + "Infinity".to_owned() + } else if v == f64::NEG_INFINITY { + "-Infinity".to_owned() + } else { + serde_json::to_string(&v).unwrap() + } + }; + Ok(format!( + "{{\"type\":\"minecraft:noise_threshold\",\"noise\":{},\"min_threshold\":{},\"max_threshold\":{}{}}}", + serde_json::to_string(&identifier(noise)?)?, + number(*min), + number(*max), + if *is_3d { ",\"is_3d\":true" } else { "" } + )) + } + _ => Ok(serde_json::to_string(&self.json_value(depth)?)?), + } + } + fn json_value(&self, depth: usize) -> Result { + if depth >= 256 { + return Err(DecodeError::Field("material condition depth")); + } + let multiplier = |value: i32| { + if (-20..=20).contains(&value) { + Ok(value) + } else { + Err(DecodeError::Field("surface_depth_multiplier")) + } + }; + let anchor = |value: VerticalAnchor| -> Result { + Ok(serde_json::from_str(&value.to_json()?)?) + }; + Ok(match self { + Self::Temperature => serde_json::json!({"type":"minecraft:temperature"}), + Self::AbovePreliminarySurface => { + serde_json::json!({"type":"minecraft:above_preliminary_surface"}) + } + Self::BiomeTag(tag) => { + serde_json::json!({"type":"minecraft:biome","biome_is":format!("#{}",tag.name)}) + } + Self::Biome(names) => { + let names = names + .iter() + .map(|name| identifier(name)) + .collect::, _>>()?; + let value = if names.len() == 1 { + Value::String(names[0].clone()) + } else { + serde_json::to_value(names)? + }; + serde_json::json!({"type":"minecraft:biome","biome_is":value}) + } + Self::Hole => serde_json::json!({"type":"minecraft:hole"}), + Self::Steep => serde_json::json!({"type":"minecraft:steep"}), + Self::YAbove { + anchor: a, + surface_depth_multiplier, + add_stone_depth, + } => { + serde_json::json!({"type":"minecraft:y_above","anchor":anchor(*a)?,"surface_depth_multiplier":multiplier(*surface_depth_multiplier)?,"add_stone_depth":add_stone_depth}) + } + Self::Water { + offset, + surface_depth_multiplier, + add_stone_depth, + } => { + serde_json::json!({"type":"minecraft:water","offset":offset,"surface_depth_multiplier":multiplier(*surface_depth_multiplier)?,"add_stone_depth":add_stone_depth}) + } + Self::StoneDepth { + offset, + add_surface_depth, + secondary_depth_range, + ceiling, + } => { + serde_json::json!({"type":"minecraft:stone_depth","offset":offset,"add_surface_depth":add_surface_depth,"secondary_depth_range":secondary_depth_range,"surface_type":if *ceiling{"ceiling"}else{"floor"}}) + } + Self::VerticalGradient { + random_name, + true_at_and_below, + false_at_and_above, + } => { + serde_json::json!({"type":"minecraft:vertical_gradient","random_name":identifier(random_name)?,"true_at_and_below":anchor(*true_at_and_below)?,"false_at_and_above":anchor(*false_at_and_above)?}) + } + Self::Not(_) | Self::NoiseThreshold { .. } => { + return Err(DecodeError::Field("condition requires direct encoding")); + } + Self::Reference(reference) => Value::String(reference.name.clone()), + }) + } +} + +#[cfg(test)] +mod tests { + use super::*; + #[test] + fn forward_references_are_stable_and_invalid_graphs_fail_atomically() { + let definitions = BTreeMap::from([ + ("a".to_owned(), r#"{"type":"not","invert":"z"}"#.to_owned()), + ("z".to_owned(), r#"{"type":"hole"}"#.to_owned()), + ]); + let registry = MaterialConditionRegistry::from_json(&definitions).unwrap(); + let reference = registry.decode(r#""a""#).unwrap(); + assert_eq!(reference.to_json().unwrap(), r#""minecraft:a""#); + assert!( + registry + .decode(r#"{"type":"not","invert":"missing"}"#) + .is_err() + ); + assert_eq!(registry.entries().count(), 2); + assert_eq!( + registry.get("z").unwrap().value().to_json().unwrap(), + r#"{"type":"minecraft:hole"}"# + ); + let mut cyclic = definitions.clone(); + cyclic.insert("z".to_owned(), r#"{"type":"not","invert":"a"}"#.to_owned()); + assert!(MaterialConditionRegistry::from_json(&cyclic).is_err()); + let mut alias = definitions.clone(); + alias.insert("z".to_owned(), r#""a""#.to_owned()); + assert!(MaterialConditionRegistry::from_json(&alias).is_err()); + let mut duplicate = definitions; + duplicate.insert("minecraft:z".to_owned(), r#"{"type":"steep"}"#.to_owned()); + assert!(MaterialConditionRegistry::from_json(&duplicate).is_err()); + assert_eq!(reference.to_json().unwrap(), r#""minecraft:a""#); + } +} diff --git a/crates/horizon-world/src/worldgen/material_condition/density.rs b/crates/horizon-world/src/worldgen/material_condition/density.rs new file mode 100644 index 000000000..5c98c75e0 --- /dev/null +++ b/crates/horizon-world/src/worldgen/material_condition/density.rs @@ -0,0 +1,147 @@ +//! Preliminary surface density sampling scoped to one material context. +use super::{MaterialRuleError, MaterialSurfaceQueries}; +use crate::{registry::BlockStateId, worldgen::DecodeError}; +use horizon_core::{ + density::{DensitySampler, SamplerContext}, + noise::{DensityVolume, Noise}, + position::BlockPos, +}; +use std::{collections::BTreeSet, sync::Arc}; + +/// A lazy unit-spaced XZ plane and scalar fallback for preliminary heights. +/// Construct a fresh provider for each material context, with that world's +/// compiled preliminary-surface density root and bound sampler context. +pub struct MaterialDensitySources { + surface: S, + expected: DensityVolume, + densities: Vec, + retained_samples: usize, + plane: DensityVolume, + sampler: Arc, + context: SamplerContext, + buffer: Option>, +} +struct BoundDensity { + sampler: Arc, + buffer: Option>, +} +impl MaterialDensitySources { + pub fn sampler_context_mut(&mut self) -> &mut SamplerContext { + &mut self.context + } + pub fn into_parts(self) -> (S, SamplerContext) { + (self.surface, self.context) + } + pub fn new( + surface: S, + expected: DensityVolume, + sampler: Arc, + context: SamplerContext, + ) -> Result { + let [sx, _, sz] = expected.sizes(); + // Bound retained allocation. Normal chunk planes contain 256 samples. + if sx * sz > 1 << 20 { + return Err(DecodeError::Field("material preliminary plane size")); + } + let [x, _, z] = expected.minimum(); + let plane = DensityVolume::new([sx as i32, 1, sz as i32], [x, 0, z], [1; 3]) + .map_err(|_| DecodeError::Field("material preliminary plane"))?; + Ok(Self { + surface, + expected, + densities: Vec::new(), + retained_samples: 0, + plane, + sampler, + context, + buffer: None, + }) + } +} +impl MaterialSurfaceQueries for MaterialDensitySources { + fn bind_density( + &mut self, + sampler: Arc, + eager: bool, + ) -> Result { + if self.densities.len() >= 32768 + || (eager + && (self.expected.size() > 1 << 20 + || self.retained_samples + self.expected.size() > 1 << 24)) + { + return Err(DecodeError::Field("material density storage bound")); + } + let buffer = if eager { + let mut buffer = vec![0.0; self.expected.size()]; + sampler.sample_volume(&mut self.context, &mut buffer, self.expected)?; + self.retained_samples += buffer.len(); + Some(buffer) + } else { + None + }; + let index = self.densities.len(); + self.densities.push(BoundDensity { sampler, buffer }); + Ok(index) + } + fn density(&mut self, index: usize, position: BlockPos) -> Result { + let source = self + .densities + .get(index) + .ok_or(MaterialRuleError::MissingDensityProvider)?; + let position = [position.x, position.y, position.z]; + if let Some(buffer) = &source.buffer { + if let Some(index) = self.expected.index_of_block(position) { + return Ok(buffer[index]); + } + } + Ok(source.sampler.sample_value(&mut self.context, position)?) + } + fn preliminary_surface(&mut self, position: BlockPos) -> Result { + let position = [position.x, 0, position.z]; + if let Some(index) = self.plane.index_of_block(position) { + if self.buffer.is_none() { + // Retain the allocation and partial writes if sampling fails. + let buffer = self.buffer.insert(vec![0.0; self.plane.size()]); + self.sampler + .sample_volume(&mut self.context, buffer, self.plane)?; + } + Ok(self.buffer.as_ref().unwrap()[index]) + } else { + Ok(self.sampler.sample_value(&mut self.context, position)?) + } + } + fn possible_biomes(&self) -> Option> { + self.surface.possible_biomes() + } + fn biome(&mut self, position: BlockPos) -> Result>, MaterialRuleError> { + self.surface.biome(position) + } + fn melts_frozen_ocean( + &mut self, + biome: &str, + position: BlockPos, + sea_level: i32, + ) -> Result { + self.surface.melts_frozen_ocean(biome, position, sea_level) + } + fn cold_enough_to_snow( + &mut self, + biome: &str, + position: BlockPos, + sea_level: i32, + ) -> Result { + self.surface.cold_enough_to_snow(biome, position, sea_level) + } + fn bind_noise(&mut self, name: &str) -> Result, DecodeError> { + self.surface.bind_noise(name) + } + fn surface_depth(&mut self, x: i32, z: i32) -> i32 { + self.surface.surface_depth(x, z) + } + fn surface_secondary(&mut self, x: i32, z: i32) -> f64 { + self.surface.surface_secondary(x, z) + } + fn band(&mut self, position: BlockPos) -> Result { + self.surface.band(position) + } +} diff --git a/crates/horizon-world/src/worldgen/material_condition/library.rs b/crates/horizon-world/src/worldgen/material_condition/library.rs new file mode 100644 index 000000000..9debd7307 --- /dev/null +++ b/crates/horizon-world/src/worldgen/material_condition/library.rs @@ -0,0 +1,359 @@ +//! Immutable material-rule definitions with a world-seeded density compiler. +use super::{MaterialCondition, MaterialConditionRegistry, MaterialRule, codec::identifier}; +use crate::{ + registry::{BlockStateId, BlockStateJsonCodec}, + worldgen::{ + DecodeError, Object, + aquifer::{AquiferConfig, AquiferSamplers}, + density::DensityRegistry, + number_text, required, + router::{NoiseRouter, RouterSamplers}, + }, +}; +use horizon_core::density::{ + DensitySampler, + graph::{DensityCompiler, FunctionId}, +}; +use serde_json::value::RawValue; +use std::{ + collections::{BTreeMap, BTreeSet}, + sync::Arc, +}; + +#[derive(Debug)] +enum Definition { + Block(BlockStateId), + Bandlands, + Sequence(Vec>), + Condition(MaterialCondition, Arc), + Reference(Arc), + Ore { + blocks: [BlockStateId; 3], + chance: f32, + roots: [usize; 3], + }, +} + +/// Definitions are decoded atomically. Density samplers are compiled lazily for +/// this world's seed; create workers with the same seed/random mode and a fresh +/// cached SamplerContext per worker. The library does not own mutable chunk data. +#[derive(Debug)] +pub struct MaterialRuleLibrary { + definitions: BTreeMap>, + roots: Vec, + compiler: DensityCompiler, + compiled: BTreeMap>, +} +impl MaterialRuleLibrary { + pub fn from_json( + definitions: &BTreeMap, + conditions: &MaterialConditionRegistry, + blocks: &BlockStateJsonCodec<'_>, + mut densities: DensityRegistry, + seed: i64, + legacy: bool, + ) -> Result { + if definitions.len() > 8192 { + return Err(DecodeError::Field("material rule registry size")); + } + let mut raw = BTreeMap::new(); + for (name, json) in definitions { + let value: Box = serde_json::from_str(json)?; + if raw.insert(identifier(name)?, value).is_some() { + return Err(DecodeError::Field("duplicate material rule")); + } + } + let mut loader = Loader { + raw, + values: BTreeMap::new(), + active: BTreeSet::new(), + conditions, + blocks, + roots: Vec::new(), + nodes: 0, + }; + for name in loader.raw.keys().cloned().collect::>() { + loader.resolve(&name, 0)?; + } + let roots = densities + .decode_functions(&loader.roots.iter().map(String::as_str).collect::>())?; + Ok(Self { + definitions: loader.values, + roots, + compiler: DensityCompiler::new_seeded(densities.into_graph(), seed, legacy), + compiled: BTreeMap::new(), + }) + } + pub fn names(&self) -> impl Iterator { + self.definitions.keys().map(String::as_str) + } + /// Resolve a named rule without sampling chunk densities yet. Binding the + /// returned rule to MaterialConditions performs eager per-chunk sampling. + pub fn rule(&mut self, name: &str) -> Result { + let definition = self + .definitions + .get(&identifier(name)?) + .ok_or(DecodeError::Field("unknown material rule"))? + .clone(); + Ok(MaterialRule::Reference(self.compile(&definition)?)) + } + /// Share this compiler's cache namespace with preliminary surface sampling. + pub fn named_density(&mut self, name: &str) -> Result, DecodeError> { + let id = self + .compiler + .graph() + .function(&identifier(name)?) + .ok_or(DecodeError::Field("unknown material density"))?; + Ok(self.compiler.get_sampler(id)?) + } + /// Compile a router decoded into the density registry passed to `from_json`. + /// Its roots share cache IDs with all material and aquifer samplers. + pub fn compile_router(&mut self, router: NoiseRouter) -> Result { + Ok(router.compile(&mut self.compiler)?) + } + /// Compile an aquifer decoded into the same density registry as this library. + /// Reuse the returned roots and the router in one worker's sampler context. + pub fn compile_aquifer( + &mut self, + config: AquiferConfig, + ) -> Result { + Ok(config.compile(&mut self.compiler)?) + } + fn compile(&mut self, definition: &Arc) -> Result, DecodeError> { + let key = Arc::as_ptr(definition) as usize; + if let Some(value) = self.compiled.get(&key) { + return Ok(value.clone()); + } + let value = Arc::new(match definition.as_ref() { + Definition::Block(id) => MaterialRule::Block(*id), + Definition::Bandlands => MaterialRule::Bandlands, + Definition::Reference(value) => MaterialRule::Reference(self.compile(value)?), + Definition::Sequence(children) => MaterialRule::Sequence( + children + .iter() + .map(|child| self.compile(child).map(MaterialRule::Reference)) + .collect::>()?, + ), + Definition::Condition(condition, child) => MaterialRule::Condition { + if_true: condition.clone(), + then_run: Box::new(MaterialRule::Reference(self.compile(child)?)), + }, + Definition::Ore { + blocks, + chance, + roots, + } => MaterialRule::OreVein { + ore: blocks[0], + raw_ore: blocks[1], + filler: blocks[2], + raw_ore_chance: *chance, + density: self.compiler.get_sampler(self.roots[roots[0]])?, + richness: self.compiler.get_sampler(self.roots[roots[1]])?, + filler_gap: self.compiler.get_sampler(self.roots[roots[2]])?, + }, + }); + self.compiled.insert(key, value.clone()); + Ok(value) + } +} +struct Loader<'a, 'b> { + raw: BTreeMap>, + values: BTreeMap>, + active: BTreeSet, + conditions: &'a MaterialConditionRegistry, + blocks: &'a BlockStateJsonCodec<'b>, + roots: Vec, + nodes: usize, +} +impl Loader<'_, '_> { + fn resolve(&mut self, name: &str, depth: usize) -> Result, DecodeError> { + if depth >= 256 { + return Err(DecodeError::Field("material rule depth")); + } + if let Some(value) = self.values.get(name) { + return Ok(value.clone()); + } + if !self.active.insert(name.to_owned()) { + return Err(DecodeError::Field("cyclic material rule")); + } + let raw = self + .raw + .get(name) + .ok_or(DecodeError::Field("missing material rule"))? + .clone(); + if !raw.get().starts_with('{') { + return Err(DecodeError::Field( + "material rule definition must be direct", + )); + } + let value = self.node(&raw, depth + 1)?; + self.active.remove(name); + self.values.insert(name.to_owned(), value.clone()); + Ok(value) + } + fn node(&mut self, raw: &RawValue, depth: usize) -> Result, DecodeError> { + self.nodes += 1; + if depth >= 256 || self.nodes > 65536 { + return Err(DecodeError::Field("material rule size")); + } + if raw.get().starts_with('"') { + let name = identifier(&serde_json::from_str::(raw.get())?)?; + return Ok(Arc::new(Definition::Reference( + self.resolve(&name, depth + 1)?, + ))); + } + let object: Object = serde_json::from_str(raw.get())?; + let kind = identifier(&serde_json::from_str::( + required(&object, "type")?.get(), + )?)?; + let block = |name| { + self.blocks + .decode(required(&object, name)?.get(), false) + .map_err(|e| DecodeError::Registry(e.to_string())) + }; + let value = match kind.as_str() { + "minecraft:block" => Definition::Block(block("result_state")?), + "minecraft:bandlands" => Definition::Bandlands, + "minecraft:sequence" => { + let children: Vec> = + serde_json::from_str(required(&object, "sequence")?.get())?; + Definition::Sequence( + children + .iter() + .map(|child| self.node(child, depth + 1)) + .collect::>()?, + ) + } + "minecraft:condition" => Definition::Condition( + self.conditions + .decode(required(&object, "if_true")?.get())?, + self.node(required(&object, "then_run")?, depth + 1)?, + ), + "minecraft:ore_vein" => { + let blocks = [ + block("ore_block")?, + block("raw_ore_block")?, + block("filler_block")?, + ]; + let chance = number_text(required(&object, "raw_ore_chance")?)? + .parse::() + .map_err(|_| DecodeError::Field("raw ore chance"))?; + if !(0.0..=1.0).contains(&chance) { + return Err(DecodeError::Field("raw ore chance")); + } + let base = self.roots.len(); + for name in ["density", "richness", "filler_gap"] { + self.roots.push(required(&object, name)?.get().to_owned()); + } + Definition::Ore { + blocks, + chance, + roots: [base, base + 1, base + 2], + } + } + _ => return Err(DecodeError::Field("material rule type")), + }; + Ok(Arc::new(value)) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::{ + DATA_VERSION, + nbt::Tag, + registry::BlockRegistry, + worldgen::{ + anchor::WorldGenerationContext, + material_condition::{MaterialConditions, MaterialSurfaceQueries}, + }, + }; + use horizon_core::{ + position::BlockPos, + random::{LegacyRandom, RandomSource}, + }; + struct Surface; + impl MaterialSurfaceQueries for Surface { + fn surface_depth(&mut self, _: i32, _: i32) -> i32 { + 0 + } + fn surface_secondary(&mut self, _: i32, _: i32) -> f64 { + 0.0 + } + } + #[test] + fn forward_rule_holders_and_invalid_graphs_are_atomic() { + let registry = BlockRegistry::from_nbt(&Tag::compound([ + ("DataVersion", Tag::Int(DATA_VERSION)), + ( + "states", + Tag::List(vec![Tag::compound([( + "id", + Tag::String("minecraft:stone".into()), + )])]), + ), + ( + "defaults", + Tag::compound([("minecraft:stone", Tag::Int(0))]), + ), + ])) + .unwrap(); + let blocks = BlockStateJsonCodec::new(®istry, BTreeSet::new()).unwrap(); + let conditions = MaterialConditionRegistry::default(); + let definitions = BTreeMap::from([ + ( + "horizon:a".to_owned(), + r#"{"type":"condition","if_true":{"type":"hole"},"then_run":"horizon:z"}"# + .to_owned(), + ), + ( + "horizon:z".to_owned(), + r#"{"type":"block","result_state":"stone"}"#.to_owned(), + ), + ]); + let load = |definitions: &BTreeMap| { + MaterialRuleLibrary::from_json( + definitions, + &conditions, + &blocks, + DensityRegistry::from_json(&BTreeMap::new(), &BTreeMap::new()).unwrap(), + 0, + false, + ) + }; + let mut valid = load(&definitions).unwrap(); + for bad in [ + r#"{"type":"condition","if_true":{"type":"hole"},"then_run":"horizon:a"}"#, + r#"{"type":"condition","if_true":{"type":"hole"},"then_run":"horizon:missing"}"#, + r#""horizon:z""#, + r#"{"type":"ore_vein","ore_block":"stone","raw_ore_block":"stone","filler_block":"stone","raw_ore_chance":0.1,"density":"horizon:missing","richness":0,"filler_gap":0}"#, + ] { + let mut invalid = definitions.clone(); + invalid.insert("horizon:z".to_owned(), bad.to_owned()); + assert!(load(&invalid).is_err()); + } + let mut duplicate = definitions; + duplicate.insert("z".to_owned(), r#"{"type":"bandlands"}"#.to_owned()); + duplicate.insert( + "minecraft:z".to_owned(), + r#"{"type":"bandlands"}"#.to_owned(), + ); + assert!(load(&duplicate).is_err()); + assert_eq!( + valid.names().collect::>(), + vec!["horizon:a", "horizon:z"] + ); + let mut random = LegacyRandom::new(0); + let mut worker = MaterialConditions::::new( + WorldGenerationContext::new(-64, 384, 63), + random.fork_positional(), + Surface, + ); + let index = worker.add_rule(valid.rule("horizon:a").unwrap()).unwrap(); + assert_eq!( + worker.try_apply(index, BlockPos::new(0, 64, 0)).unwrap(), + Some(BlockStateId(0)) + ); + } +} diff --git a/crates/horizon-world/src/worldgen/material_condition/noise.rs b/crates/horizon-world/src/worldgen/material_condition/noise.rs new file mode 100644 index 000000000..9ec6a4074 --- /dev/null +++ b/crates/horizon-world/src/worldgen/material_condition/noise.rs @@ -0,0 +1,112 @@ +//! Named material-noise sources derived from the world's positional factory. +use super::{MaterialRuleError, MaterialSurfaceQueries, codec::identifier}; +use crate::{ + registry::BlockStateId, + worldgen::{DecodeError, decode_noise}, +}; +use horizon_core::{ + noise::{Noise, NormalNoise}, + position::BlockPos, + random::PositionalRandom, +}; +use std::{ + collections::{BTreeMap, BTreeSet}, + sync::Arc, +}; + +/// Add lazy, shared named noise sources to a material surface provider. +/// Both providers must be configured for the same world seed and random mode. +pub struct MaterialNoiseSources { + root: P, + surface: S, + definitions: BTreeMap, + samplers: BTreeMap>, +} +impl MaterialNoiseSources { + pub fn from_json( + root: P, + surface: S, + definitions: &BTreeMap, + ) -> Result { + if definitions.len() > 8192 { + return Err(DecodeError::Field("material noise registry size")); + } + let mut noises = BTreeMap::new(); + for (name, json) in definitions { + if noises + .insert(identifier(name)?, decode_noise(json)?) + .is_some() + { + return Err(DecodeError::Field("duplicate material noise")); + } + } + Ok(Self { + root, + surface, + definitions: noises, + samplers: BTreeMap::new(), + }) + } +} +impl MaterialSurfaceQueries + for MaterialNoiseSources +{ + fn bind_density( + &mut self, + sampler: Arc, + eager: bool, + ) -> Result { + self.surface.bind_density(sampler, eager) + } + fn density(&mut self, index: usize, position: BlockPos) -> Result { + self.surface.density(index, position) + } + fn preliminary_surface(&mut self, position: BlockPos) -> Result { + self.surface.preliminary_surface(position) + } + fn possible_biomes(&self) -> Option> { + self.surface.possible_biomes() + } + fn biome(&mut self, position: BlockPos) -> Result>, MaterialRuleError> { + self.surface.biome(position) + } + fn melts_frozen_ocean( + &mut self, + biome: &str, + position: BlockPos, + sea_level: i32, + ) -> Result { + self.surface.melts_frozen_ocean(biome, position, sea_level) + } + fn cold_enough_to_snow( + &mut self, + biome: &str, + position: BlockPos, + sea_level: i32, + ) -> Result { + self.surface.cold_enough_to_snow(biome, position, sea_level) + } + fn surface_depth(&mut self, x: i32, z: i32) -> i32 { + self.surface.surface_depth(x, z) + } + fn surface_secondary(&mut self, x: i32, z: i32) -> f64 { + self.surface.surface_secondary(x, z) + } + fn band(&mut self, position: BlockPos) -> Result { + self.surface.band(position) + } + fn bind_noise(&mut self, name: &str) -> Result, DecodeError> { + let name = identifier(name)?; + if let Some(noise) = self.samplers.get(&name) { + return Ok(noise.clone()); + } + let definition = self + .definitions + .get(&name) + .ok_or(DecodeError::Field("unknown material noise"))?; + let noise: Arc = + Arc::new(definition.create(&mut self.root.from_hash_of(&name))?); + self.samplers.insert(name, noise.clone()); + Ok(noise) + } +} diff --git a/crates/horizon-world/src/worldgen/material_condition/rule.rs b/crates/horizon-world/src/worldgen/material_condition/rule.rs new file mode 100644 index 000000000..9dfc2ff1e --- /dev/null +++ b/crates/horizon-world/src/worldgen/material_condition/rule.rs @@ -0,0 +1,222 @@ +//! Compiled material rule composition, sharing the condition worker's context. +use super::{Compiled, Context, MaterialCondition, MaterialConditions, MaterialSurfaceQueries}; +use crate::{registry::BlockStateId, worldgen::DecodeError}; +use horizon_core::{ + density::DensitySampler, + position::BlockPos, + random::{PositionalRandom, RandomSource}, +}; +use std::sync::Arc; + +#[derive(Clone, Debug)] +pub enum MaterialRule { + Block(BlockStateId), + Reference(Arc), + /// Density roots must be compiled for the same world and sampler context. + OreVein { + ore: BlockStateId, + raw_ore: BlockStateId, + filler: BlockStateId, + raw_ore_chance: f32, + density: Arc, + richness: Arc, + filler_gap: Arc, + }, + Sequence(Vec), + Condition { + if_true: MaterialCondition, + then_run: Box, + }, + /// Vanilla calls this rule "bandlands"; it queries terracotta bands. + Bandlands, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum MaterialRuleError { + UnknownRule, + UnknownCondition, + MissingBiomeProvider, + BiomeQueryFailed, + MissingBiome, + CachedConditionUnavailable, + MissingBandProvider, + MissingDensityProvider, + Density(horizon_core::density::SampleError), + InvalidBandIndex, +} +impl std::fmt::Display for MaterialRuleError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + if let Self::Density(error) = self { + return error.fmt(f); + } + f.write_str(match self { + Self::Density(_) => unreachable!(), + Self::MissingDensityProvider => "missing material density provider", + Self::UnknownRule => "unknown material rule", + Self::UnknownCondition => "unknown material condition", + Self::MissingBiomeProvider => "missing material biome provider", + Self::BiomeQueryFailed => "material biome lookup failed", + Self::MissingBiome => "material position has no biome", + Self::CachedConditionUnavailable => "condition was updated without a cached result", + Self::MissingBandProvider => "missing material band provider", + Self::InvalidBandIndex => "negative material band index", + }) + } +} +impl std::error::Error for MaterialRuleError {} +impl From for MaterialRuleError { + fn from(error: horizon_core::density::SampleError) -> Self { + Self::Density(error) + } +} + +pub(super) enum CompiledRule { + Block(BlockStateId), + OreVein { + blocks: [BlockStateId; 3], + raw_ore_chance: f32, + densities: [usize; 3], + random: R::Positional, + }, + Sequence(Vec), + Condition { + condition: Compiled, + rule: Box, + }, + Bandlands, +} +impl CompiledRule { + fn compile( + rule: MaterialRule, + root: &R::Positional, + context: &mut Context, + depth: usize, + nodes: &mut usize, + ) -> Result { + *nodes += 1; + if depth >= 256 || *nodes > 65536 { + return Err(DecodeError::Field("material rule size")); + } + Ok(match rule { + MaterialRule::Block(block) => Self::Block(block), + MaterialRule::Reference(value) => { + return Self::compile((*value).clone(), root, context, depth + 1, nodes); + } + MaterialRule::OreVein { + ore, + raw_ore, + filler, + raw_ore_chance, + density, + richness, + filler_gap, + } => { + let density = context.surface.bind_density(density, true)?; + let richness = context.surface.bind_density(richness, true)?; + let gap = context.surface.bind_density(filler_gap, false)?; + let random = root.from_hash_of("minecraft:ore").fork_positional(); + Self::OreVein { + blocks: [ore, raw_ore, filler], + raw_ore_chance, + densities: [density, richness, gap], + random, + } + } + MaterialRule::Bandlands => Self::Bandlands, + MaterialRule::Condition { if_true, then_run } => { + // Compile the predicate before the nested rule, regardless of + // whether the predicate will match any subsequent position. + let condition = Compiled::compile(if_true, root, context, depth + 1)?; + let rule = Box::new(Self::compile(*then_run, root, context, depth + 1, nodes)?); + Self::Condition { condition, rule } + } + MaterialRule::Sequence(mut children) => { + if children.len() == 1 { + return Self::compile(children.pop().unwrap(), root, context, depth + 1, nodes); + } + let mut result = Vec::with_capacity(children.len()); + for child in children { + result.push(Self::compile(child, root, context, depth + 1, nodes)?); + } + Self::Sequence(result) + } + }) + } + fn apply( + &mut self, + position: BlockPos, + context: &mut Context, + ) -> Result, MaterialRuleError> { + match self { + Self::Block(block) => Ok(Some(*block)), + Self::OreVein { + blocks, + raw_ore_chance, + densities, + random, + } => { + // Densities use the context; randomness uses application coordinates. + let density = context.surface.density(densities[0], context.position)?; + if density <= 0.0 { + return Ok(None); + } + let mut random = random.at(position); + if random.next_float() > density { + return Ok(None); + } + let richness = context.surface.density(densities[1], context.position)?; + if random.next_float() < richness + && context.surface.density(densities[2], context.position)? < 0.0 + { + Ok(Some(if random.next_float() < *raw_ore_chance { + blocks[1] + } else { + blocks[0] + })) + } else { + Ok(Some(blocks[2])) + } + } + Self::Bandlands => context.surface.band(position).map(Some), + Self::Condition { condition, rule } => { + if condition.test(context)? { + rule.apply(position, context) + } else { + Ok(None) + } + } + Self::Sequence(children) => { + for child in children { + if let Some(block) = child.apply(position, context)? { + return Ok(Some(block)); + } + } + Ok(None) + } + } + } +} +impl MaterialConditions { + /// Compile all children in order, even after an unconditional block rule. + /// Failed compilation never adds a partial rule to this worker. + pub fn add_rule(&mut self, rule: MaterialRule) -> Result { + if self.rules.len() >= 8192 { + return Err(DecodeError::Field("material rule count")); + } + let compiled = CompiledRule::compile(rule, &self.root, &mut self.context, 0, &mut 0)?; + let index = self.rules.len(); + self.rules.push(compiled); + Ok(index) + } + /// Predicates read the worker's updated context. Position arguments are + /// forwarded to block-producing rules independently, as in vanilla. + pub fn try_apply( + &mut self, + index: usize, + position: BlockPos, + ) -> Result, MaterialRuleError> { + self.rules + .get_mut(index) + .ok_or(MaterialRuleError::UnknownRule)? + .apply(position, &mut self.context) + } +} diff --git a/crates/horizon-world/src/worldgen/material_extensions.rs b/crates/horizon-world/src/worldgen/material_extensions.rs new file mode 100644 index 000000000..8fb5735ac --- /dev/null +++ b/crates/horizon-world/src/worldgen/material_extensions.rs @@ -0,0 +1,229 @@ +//! Eroded-badlands pillars and frozen-ocean icebergs, before chunk integration. +use super::biome_temperature::BiomeTemperature; +use crate::registry::BlockStateId; +use horizon_core::{ + noise::Noise, + position::BlockPos, + random::{PositionalRandom, RandomSource}, +}; +use std::sync::Arc; + +/// Reads and writes retain provider order. The chunk adapter supplies vanilla +/// out-of-height reads and generation-height write clipping. +pub trait MaterialColumn { + type Error; + fn block(&mut self, y: i32) -> Result; + fn set_block(&mut self, y: i32, state: BlockStateId) -> Result<(), Self::Error>; + fn is_air(&self, state: BlockStateId) -> bool; + fn same_block(&self, left: BlockStateId, right: BlockStateId) -> bool; +} +#[derive(Clone, Copy, Debug)] +pub struct ExtensionBlocks { + pub default: BlockStateId, + pub water: BlockStateId, + pub packed_ice: BlockStateId, + pub snow: BlockStateId, +} +#[derive(Clone, Debug)] +pub struct ExtensionNoises { + pub badlands_surface: Arc, + pub badlands_pillar: Arc, + pub badlands_roof: Arc, + pub iceberg_surface: Arc, + pub iceberg_pillar: Arc, + pub iceberg_roof: Arc, +} +#[derive(Debug)] +pub enum ExtensionError { + Column(E), + IterationLimit, +} +impl std::fmt::Display for ExtensionError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Column(error) => error.fmt(f), + Self::IterationLimit => f.write_str("material column iteration bound exceeded"), + } + } +} +impl std::error::Error for ExtensionError {} +impl From for ExtensionError { + fn from(error: E) -> Self { + Self::Column(error) + } +} + +/// Random is the world's root positional factory. Noises and biome temperatures +/// must be configured for the same immutable world-generation settings. +pub struct MaterialExtensions

{ + random: P, + blocks: ExtensionBlocks, + noises: ExtensionNoises, + sea_level: i32, +} +impl MaterialExtensions

{ + pub fn new( + random: P, + blocks: ExtensionBlocks, + noises: ExtensionNoises, + sea_level: i32, + ) -> Self { + Self { + random, + blocks, + noises, + sea_level, + } + } + pub fn eroded_badlands( + &self, + column: &mut C, + x: i32, + z: i32, + surface_y: i32, + min_y: i32, + ) -> Result<(), ExtensionError> { + let x = f64::from(x); + let z = f64::from(z); + let amplitude = java_min( + (f64::from(self.noises.badlands_surface.get3(x, 0.0, z)) * 8.25).abs(), + f64::from(self.noises.badlands_pillar.get3(x * 0.2, 0.0, z * 0.2) * 15.0), + ); + if amplitude <= 0.0 { + return Ok(()); + } + let roof = (f64::from(self.noises.badlands_roof.get3(x * 0.75, 0.0, z * 0.75)) * 1.5).abs(); + let top = (64.0 + java_min(amplitude * amplitude * 2.5, (roof * 50.0).ceil() + 24.0)) + .floor() as i32; + if surface_y > top { + return Ok(()); + } + let mut budget = 1 << 20; + let mut y = top; + while y >= min_y { + tick(&mut budget)?; + let state = column.block(y)?; + if column.same_block(state, self.blocks.default) { + break; + } + if column.same_block(state, self.blocks.water) { + return Ok(()); + } + y = y.wrapping_sub(1); + } + y = top; + while y >= min_y { + tick(&mut budget)?; + let state = column.block(y)?; + if !column.is_air(state) { + break; + } + column.set_block(y, self.blocks.default)?; + y = y.wrapping_sub(1); + } + Ok(()) + } + pub fn frozen_ocean( + &self, + column: &mut C, + biome: &mut BiomeTemperature, + position: [i32; 2], + surface_y: i32, + minimum_surface_y: i32, + ) -> Result<(), ExtensionError> { + self.frozen_ocean_with_melt( + column, + position, + surface_y, + minimum_surface_y, + |position, sea| Ok(biome.should_melt_frozen_ocean_iceberg_slightly(position, sea)), + ) + } + /// Defer the biome lookup until the native noise/height checks reach it. + pub fn frozen_ocean_with_melt( + &self, + column: &mut C, + position: [i32; 2], + surface_y: i32, + minimum_surface_y: i32, + melt: impl FnOnce(BlockPos, i32) -> Result, + ) -> Result<(), ExtensionError> { + let [x, z] = position; + let dx = f64::from(x); + let dz = f64::from(z); + let amplitude = java_min( + (f64::from(self.noises.iceberg_surface.get3(dx, 0.0, dz)) * 8.25).abs(), + f64::from(self.noises.iceberg_pillar.get3(dx * 1.28, 0.0, dz * 1.28) * 15.0), + ); + if amplitude <= 1.8 { + return Ok(()); + } + let roof = + (f64::from(self.noises.iceberg_roof.get3(dx * 1.17, 0.0, dz * 1.17)) * 1.5).abs(); + let mut height = java_min(amplitude * amplitude * 1.2, (roof * 40.0).ceil() + 14.0); + if melt(BlockPos::new(x, self.sea_level, z), self.sea_level)? { + height -= 2.0; + } + if height <= 2.0 { + return Ok(()); + } + let bottom = f64::from(self.sea_level) - height - 7.0; + let top = height + f64::from(self.sea_level); + let mut random = self.random.at(BlockPos::new(x, 0, z)); + let snow_limit = 2 + random.next_int_bound(4).unwrap(); + let snow_height = self + .sea_level + .wrapping_add(18) + .wrapping_add(random.next_int_bound(10).unwrap()); + let mut snow_count = 0; + let mut y = surface_y.max((top as i32).wrapping_add(1)); + let mut budget = 1 << 20; + while y >= minimum_surface_y { + tick(&mut budget)?; + let state = column.block(y)?; + let air = column.is_air(state) && y < (top as i32) && random.next_double() > 0.01; + let fill = if air { + true + } else { + // The second getBlock is observable even when the first read + // found air but failed its height or random test. + let state = column.block(y)?; + column.same_block(state, self.blocks.water) + && y > (bottom as i32) + && y < self.sea_level + && random.next_double() > 0.15 + }; + if fill { + let state = if snow_count <= snow_limit && y > snow_height { + snow_count += 1; + self.blocks.snow + } else { + self.blocks.packed_ice + }; + column.set_block(y, state)?; + } + y = y.wrapping_sub(1); + } + Ok(()) + } +} +fn tick(remaining: &mut usize) -> Result<(), ExtensionError> { + if *remaining == 0 { + return Err(ExtensionError::IterationLimit); + } + *remaining -= 1; + Ok(()) +} +fn java_min(a: f64, b: f64) -> f64 { + if a.is_nan() { + a + } else if b.is_nan() { + b + } else if a == 0.0 && b == 0.0 { + f64::from_bits(a.to_bits() | b.to_bits()) + } else if a <= b { + a + } else { + b + } +} diff --git a/crates/horizon-world/src/worldgen/material_stage.rs b/crates/horizon-world/src/worldgen/material_stage.rs new file mode 100644 index 000000000..0763c4e63 --- /dev/null +++ b/crates/horizon-world/src/worldgen/material_stage.rs @@ -0,0 +1,351 @@ +//! Surface-stage column traversal and pre-lighting chunk writes. +use super::{ + DecodeError, + anchor::WorldGenerationContext, + material_condition::{ + MaterialConditions, MaterialDensitySources, MaterialRule, MaterialRuleError, + MaterialSurfaceQueries, + }, + material_extensions::{ExtensionError, MaterialColumn, MaterialExtensions}, + terrain::{TerrainBlockStates, TerrainChunk, TerrainError}, +}; +use crate::{ + heightmap::{HeightmapState, HeightmapType}, + registry::BlockStateId, +}; +use horizon_core::{ + density::{DensitySampler, SamplerContext}, + noise::DensityVolume, + position::BlockPos, + random::RandomSource, +}; +use std::sync::Arc; + +pub struct SurfaceInputs<'a, R: RandomSource, S: MaterialSurfaceQueries> { + pub generation: WorldGenerationContext, + pub noise_volume: DensityVolume, + pub root: R::Positional, + pub surface: S, + pub preliminary_surface: Arc, + pub density_context: &'a mut SamplerContext, + /// Inclusive generation write bounds, contained within the chunk. + pub write_min_y: i32, + pub write_max_y: i32, +} +pub struct TopMaterialInputs<'a, R: RandomSource, S: MaterialSurfaceQueries> { + pub generation: WorldGenerationContext, + pub root: R::Positional, + pub surface: S, + pub preliminary_surface: Arc, + pub density_context: &'a mut SamplerContext, +} +#[derive(Debug)] +pub enum SurfaceError { + Terrain(TerrainError), + Rule(MaterialRuleError), + Decode(DecodeError), + InvalidBounds, + InvalidVolume, + IterationLimit, +} +impl std::fmt::Display for SurfaceError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{self:?}") + } +} +impl std::error::Error for SurfaceError {} +impl From for SurfaceError { + fn from(e: TerrainError) -> Self { + Self::Terrain(e) + } +} +impl From for SurfaceError { + fn from(e: MaterialRuleError) -> Self { + Self::Rule(e) + } +} +impl From for SurfaceError { + fn from(e: DecodeError) -> Self { + Self::Decode(e) + } +} +impl From> for SurfaceError { + fn from(e: ExtensionError) -> Self { + match e { + ExtensionError::Column(e) => e, + ExtensionError::IterationLimit => Self::IterationLimit, + } + } +} + +struct Column<'a, 'r, B: TerrainBlockStates> { + chunk: &'a mut TerrainChunk<'r, B>, + x: i32, + z: i32, + min: i32, + max: i32, +} +impl MaterialColumn for Column<'_, '_, B> { + type Error = SurfaceError; + fn block(&mut self, y: i32) -> Result { + Ok(self.chunk.block(self.x, y, self.z)) + } + fn set_block(&mut self, y: i32, state: BlockStateId) -> Result<(), SurfaceError> { + if y >= self.min && y <= self.max { + self.chunk.set_block_worldgen(self.x, y, self.z, state)?; + if self.chunk.block_properties(state).has_fluid() { + self.chunk.mark_postprocessing(self.x, y, self.z); + } + } + Ok(()) + } + fn is_air(&self, state: BlockStateId) -> bool { + self.chunk.block_properties(state).is_air() + } + fn same_block(&self, left: BlockStateId, right: BlockStateId) -> bool { + self.chunk.same_block(left, right) + } +} +fn first_available( + chunk: &mut TerrainChunk<'_, B>, + x: i32, + z: i32, +) -> Result { + if chunk.heightmap(HeightmapType::WorldSurfaceWg).is_none() { + chunk.prime_heightmaps(&[HeightmapType::WorldSurfaceWg])?; + } + chunk + .heightmap(HeightmapType::WorldSurfaceWg) + .unwrap() + .first_available(x, z) + .map_err(TerrainError::from) + .map_err(SurfaceError::from) +} +fn tick(remaining: &mut usize) -> Result<(), SurfaceError> { + if *remaining == 0 { + return Err(SurfaceError::IterationLimit); + } + *remaining -= 1; + Ok(()) +} + +/// Evaluate the replacement surface under a carved block. Each call binds a +/// fresh one-cell material context, without restricting possible biomes, and +/// uses one stone block above/below. The caller applies the returned state. +/// Required heightmaps may be primed; block values are not changed here. +/// The caller's density context is retained on successful and failed evaluation. +pub fn top_material( + chunk: &mut TerrainChunk<'_, B>, + rule: MaterialRule, + inputs: TopMaterialInputs<'_, R, S>, + position: BlockPos, + submerged: bool, +) -> Result, SurfaceError> { + let volume = DensityVolume::new([1; 3], [position.x, position.y, position.z], [1; 3]) + .map_err(|_| SurfaceError::InvalidVolume)?; + let mut sources = MaterialDensitySources::new( + inputs.surface, + volume, + inputs.preliminary_surface, + SamplerContext::default(), + )?; + std::mem::swap(sources.sampler_context_mut(), inputs.density_context); + let mut worker = MaterialConditions::::with_possible_biomes( + inputs.generation, + inputs.root, + sources, + None, + ); + let result = (|| { + let rule = worker.add_rule(rule)?; + let (lx, lz) = (position.x & 15, position.z & 15); + let gx = first_available(chunk, (lx + 1).min(15), lz)?.wrapping_sub(first_available( + chunk, + (lx - 1).max(0), + lz, + )?); + let gz = first_available(chunk, lx, (lz + 1).min(15))?.wrapping_sub(first_available( + chunk, + lx, + (lz - 1).max(0), + )?); + worker.update_xz(position.x, position.z, gx, gz); + worker.update_y( + 1, + 1, + if submerged { + position.y.wrapping_add(1) + } else { + i32::MIN + }, + position.y, + ); + worker.try_apply(rule, position).map_err(SurfaceError::from) + })(); + let (_, mut context) = worker.into_surface().into_parts(); + std::mem::swap(&mut context, inputs.density_context); + result +} + +/// Build one chunk's surface in vanilla X/Z/descending-Y order. Required heightmaps +/// are updated during writes, so later columns observe earlier modifications. +/// Providers, rule roots, extensions and random settings must belong to one world. +/// Failures retain prior chunk writes and fluid postprocessing entries. +pub fn build_surface( + chunk: &mut TerrainChunk<'_, B>, + rule: MaterialRule, + inputs: SurfaceInputs<'_, R, S>, + extensions: &MaterialExtensions, +) -> Result<(), SurfaceError> { + let min = chunk.min_y(); + let max = min + chunk.height() - 1; + if inputs.write_min_y < min + || inputs.write_max_y > max + || inputs.write_min_y > inputs.write_max_y + { + return Err(SurfaceError::InvalidBounds); + } + let highest = chunk + .highest_filled_section_index() + .map_or(min - 1, |i| min + (i as i32) * 16 + 15); + let sizes = inputs.noise_volume.sizes(); + let origin = inputs.noise_volume.minimum(); + let height = highest.wrapping_sub(origin[1]).wrapping_add(1).max(1); + let expected = DensityVolume::new([sizes[0] as i32, height, sizes[2] as i32], origin, [1; 3]) + .map_err(|_| SurfaceError::InvalidVolume)?; + let mut sources = MaterialDensitySources::new( + inputs.surface, + expected, + inputs.preliminary_surface, + SamplerContext::default(), + )?; + std::mem::swap(sources.sampler_context_mut(), inputs.density_context); + let mut worker = MaterialConditions::::new(inputs.generation, inputs.root, sources); + let result = build_columns( + chunk, + rule, + &mut worker, + extensions, + inputs.write_min_y, + inputs.write_max_y, + ); + let (_, mut context) = worker.into_surface().into_parts(); + std::mem::swap(&mut context, inputs.density_context); + result +} +fn build_columns( + chunk: &mut TerrainChunk<'_, B>, + rule: MaterialRule, + worker: &mut MaterialConditions, + extensions: &MaterialExtensions, + write_min_y: i32, + write_max_y: i32, +) -> Result<(), SurfaceError> { + let min = chunk.min_y(); + let rule = worker.add_rule(rule)?; + let cx = chunk.position().x.wrapping_shl(4); + let cz = chunk.position().z.wrapping_shl(4); + for lx in 0..16 { + for lz in 0..16 { + let x = cx.wrapping_add(lx); + let z = cz.wrapping_add(lz); + let original_top = first_available(chunk, lx, lz)?; + let biome = worker + .biome_at(BlockPos::new(x, original_top, z))? + .ok_or(MaterialRuleError::MissingBiome)?; + if biome.as_ref() == "minecraft:eroded_badlands" { + extensions.eroded_badlands( + &mut Column { + chunk, + x, + z, + min: write_min_y, + max: write_max_y, + }, + x, + z, + original_top, + min, + )?; + } + let top = first_available(chunk, lx, lz)?; + let gx = first_available(chunk, (lx + 1).min(15), lz)?.wrapping_sub(first_available( + chunk, + (lx - 1).max(0), + lz, + )?); + let gz = first_available(chunk, lx, (lz + 1).min(15))?.wrapping_sub(first_available( + chunk, + lx, + (lz - 1).max(0), + )?); + worker.update_xz(x, z, gx, gz); + let mut above = 0i32; + let mut water = i32::MIN; + let mut bottom = i32::MAX; + let mut y = top; + let mut budget = 1 << 20; + let mut column = Column { + chunk, + x, + z, + min: write_min_y, + max: write_max_y, + }; + while y >= min { + tick(&mut budget)?; + let state = column.block(y)?; + let properties = column.chunk.block_properties(state); + if properties.is_air() { + above = 0; + water = i32::MIN; + } else if properties.has_fluid() { + if water == i32::MIN { + water = y.wrapping_add(1); + } + } else { + if bottom >= y { + bottom = -32512; // DimensionType.MIN_Y << 4 for 26.3. + let mut below = y.wrapping_sub(1); + while below >= min - 1 { + tick(&mut budget)?; + let state = column.block(below)?; + let properties = column.chunk.block_properties(state); + if properties.is_air() || properties.has_fluid() { + bottom = below.wrapping_add(1); + break; + } + below = below.wrapping_sub(1); + } + } + above = above.wrapping_add(1); + worker.update_y(above, y.wrapping_sub(bottom).wrapping_add(1), water, y); + if y >= write_min_y && y <= write_max_y { + if let Some(state) = worker.try_apply(rule, BlockPos::new(x, y, z))? { + column.set_block(y, state)?; + } + } + } + y = y.wrapping_sub(1); + } + if matches!( + biome.as_ref(), + "minecraft:frozen_ocean" | "minecraft:deep_frozen_ocean" + ) { + let minimum = worker.minimum_surface_level()?; + extensions.frozen_ocean_with_melt( + &mut column, + [x, z], + original_top, + minimum, + |position, sea| { + worker + .melts_frozen_ocean(&biome, position, sea) + .map_err(SurfaceError::from) + }, + )?; + } + } + } + Ok(()) +} diff --git a/crates/horizon-world/src/worldgen/material_surface.rs b/crates/horizon-world/src/worldgen/material_surface.rs new file mode 100644 index 000000000..c463ec063 --- /dev/null +++ b/crates/horizon-world/src/worldgen/material_surface.rs @@ -0,0 +1,142 @@ +//! Seeded terracotta bands and the material system's surface-noise queries. +use crate::registry::{BlockRegistry, BlockStateId}; +use horizon_core::{ + noise::Noise, + random::{PositionalRandom, RandomSource}, +}; +use std::sync::Arc; + +#[derive(Clone, Copy, Debug)] +pub struct ClayBandBlocks { + pub terracotta: BlockStateId, + pub orange: BlockStateId, + pub yellow: BlockStateId, + pub brown: BlockStateId, + pub red: BlockStateId, + pub white: BlockStateId, + pub light_gray: BlockStateId, +} +impl ClayBandBlocks { + pub fn from_registry(registry: &BlockRegistry) -> Option { + Some(Self { + terracotta: registry.default_state("minecraft:terracotta")?, + orange: registry.default_state("minecraft:orange_terracotta")?, + yellow: registry.default_state("minecraft:yellow_terracotta")?, + brown: registry.default_state("minecraft:brown_terracotta")?, + red: registry.default_state("minecraft:red_terracotta")?, + white: registry.default_state("minecraft:white_terracotta")?, + light_gray: registry.default_state("minecraft:light_gray_terracotta")?, + }) + } +} +#[derive(Clone, Debug)] +pub struct ClayBands([BlockStateId; 192]); +impl ClayBands { + /// The input is MaterialSystem's clay_bands child stream. Every conditional + /// random draw and overwrite retains vanilla order. + pub fn generate(random: &mut impl RandomSource, blocks: ClayBandBlocks) -> Self { + let mut bands = [blocks.terracotta; 192]; + let mut i = 0; + while i < bands.len() { + i += random.next_int_bound(5).unwrap() as usize + 1; + if i < bands.len() { + bands[i] = blocks.orange; + } + i += 1; + } + Self::make_bands(random, &mut bands, 1, blocks.yellow); + Self::make_bands(random, &mut bands, 2, blocks.brown); + Self::make_bands(random, &mut bands, 1, blocks.red); + let count = random.next_int_between_inclusive(9, 15).unwrap(); + let mut position = 0; + for _ in 0..count { + if position >= bands.len() { + break; + } + bands[position] = blocks.white; + if position > 1 && random.next_boolean() { + bands[position - 1] = blocks.light_gray; + } + if position + 1 < bands.len() && random.next_boolean() { + bands[position + 1] = blocks.light_gray; + } + position += random.next_int_bound(16).unwrap() as usize + 4; + } + Self(bands) + } + fn make_bands( + random: &mut impl RandomSource, + bands: &mut [BlockStateId; 192], + base_width: usize, + state: BlockStateId, + ) { + let count = random.next_int_between_inclusive(6, 15).unwrap(); + for _ in 0..count { + let width = base_width + random.next_int_bound(3).unwrap() as usize; + let start = random.next_int_bound(192).unwrap() as usize; + let end = (start + width).min(bands.len()); + bands[start..end].fill(state); + } + } + pub fn states(&self) -> &[BlockStateId; 192] { + &self.0 + } + /// Preserve Java's signed remainder. Extreme or unsupported negative heights + /// can produce an invalid index, which returns None instead of an exception. + pub fn at_noise(&self, y: i32, noise: f32) -> Option { + let offset = round_float(noise * 4.); + let index = y.wrapping_add(offset).wrapping_add(192) % 192; + self.0.get(index as usize).copied() + } +} +fn round_float(value: f32) -> i32 { + // f64 retains every relevant half-integer boundary of a float that fits an + // int. Rust's cast supplies Java's NaN-to-zero and saturating endpoints. + (f64::from(value) + 0.5).floor() as i32 +} +#[derive(Debug)] +pub struct MaterialSurface

{ + bands: ClayBands, + random: P, + clay_offset: Arc, + surface: Arc, + secondary: Arc, +} +impl MaterialSurface

{ + /// `random` is the world's root positional factory, not a surface child. + pub fn new( + random: P, + blocks: ClayBandBlocks, + clay_offset: Arc, + surface: Arc, + secondary: Arc, + ) -> Self { + let bands = ClayBands::generate(&mut random.from_hash_of("minecraft:clay_bands"), blocks); + Self { + bands, + random, + clay_offset, + surface, + secondary, + } + } + pub fn bands(&self) -> &ClayBands { + &self.bands + } + pub fn band(&self, [x, y, z]: [i32; 3]) -> Option { + self.bands + .at_noise(y, self.clay_offset.get3(f64::from(x), 0., f64::from(z))) + } + pub fn surface_depth(&self, x: i32, z: i32) -> i32 { + let noise = f64::from(self.surface.get3(f64::from(x), 0., f64::from(z))); + ((noise * 2.75 + 3.) + + self + .random + .at(horizon_core::position::BlockPos::new(x, 0, z)) + .next_double() + * 0.25) as i32 + } + pub fn surface_secondary(&self, x: i32, z: i32) -> f64 { + f64::from(self.secondary.get3(f64::from(x), 0., f64::from(z))) + } +} diff --git a/crates/horizon-world/src/worldgen/ore_feature.rs b/crates/horizon-world/src/worldgen/ore_feature.rs new file mode 100644 index 000000000..a6a6f4006 --- /dev/null +++ b/crates/horizon-world/src/worldgen/ore_feature.rs @@ -0,0 +1,101 @@ +//! Ore placement with ordered replacement rules and air-exposure checks. +use super::{ + DecodeError, Object, + block_feature::{BlockReplacements, FeatureBlockBindings, decode_targets}, + density::identifier, + feature::{FeatureError, FeatureWorld}, + int_range, number_text, required, +}; +use crate::registry::BlockStateId; +use horizon_core::{geometry::Direction, random::RandomSource}; + +#[derive(Clone, Debug)] +pub struct ScatteredOreFeature { + targets: BlockReplacements, + size: i32, + discard: f32, + air: [BlockStateId; 3], +} +impl ScatteredOreFeature { + pub fn from_json(json: &str, bindings: &FeatureBlockBindings<'_>) -> Result { + Self::decode(json, bindings, 0, &mut 65536) + } + pub(crate) fn decode( + json: &str, + bindings: &FeatureBlockBindings<'_>, + depth: usize, + remaining: &mut usize, + ) -> Result { + let object: Object = serde_json::from_str(json)?; + let kind = identifier(&serde_json::from_str::( + required(&object, "type")?.get(), + )?)?; + if kind != "minecraft:scattered_ore" { + return Err(DecodeError::Field("scattered ore type")); + } + let targets = decode_targets(&object, bindings, depth, remaining)?; + let size = int_range(required(&object, "size")?, "ore size", 0, 64)?; + let discard: f32 = number_text(required(&object, "discard_chance_on_air_exposure")?)? + .parse() + .map_err(|_| DecodeError::Field("ore air exposure"))?; + if !(0.0..=1.0).contains(&discard) || discard.is_sign_negative() { + return Err(DecodeError::Field("ore air exposure")); + } + Ok(Self { + targets, + size, + discard, + air: bindings.air, + }) + } + pub fn place( + &self, + world: &mut W, + random: &mut impl RandomSource, + origin: [i32; 3], + ) -> Result> { + let count = random + .next_int_bound(self.size + 1) + .map_err(FeatureError::Random)?; + for attempt in 0..count { + let spread = attempt.min(7) as f32; + let position = origin.map(|component| { + let offset = (random.next_float() - random.next_float()) * spread; + // Widen before adding 0.5 so a float just below a tie cannot + // round up during addition. Values are bounded by +/-7. + let offset = (f64::from(offset) + 0.5).floor() as i32; + component.wrapping_add(offset) + }); + let current = world.block(position).map_err(FeatureError::World)?; + for (rule, state) in &self.targets { + if !rule.test(current, position, random) { + continue; + } + let skip_air = self.discard <= 0.0 + || (self.discard < 1.0 && random.next_float() >= self.discard); + if !skip_air { + let mut exposed = false; + for direction in Direction::ALL { + let delta = direction.normal(); + let neighbor = std::array::from_fn(|i| position[i].wrapping_add(delta[i])); + if self + .air + .contains(&world.block(neighbor).map_err(FeatureError::World)?) + { + exposed = true; + break; + } + } + if exposed { + continue; + } + } + world + .set_block(position, *state, 2) + .map_err(FeatureError::World)?; + break; + } + } + Ok(true) + } +} diff --git a/crates/horizon-world/src/worldgen/placement.rs b/crates/horizon-world/src/worldgen/placement.rs new file mode 100644 index 000000000..0c4ed8223 --- /dev/null +++ b/crates/horizon-world/src/worldgen/placement.rs @@ -0,0 +1,505 @@ +//! Placement modifiers that depend on random state and generation bounds. +//! Block-query modifiers and actual configured features remain separate work. +mod chain; +mod layer; +use super::block_predicate::{BlockPredicate, PredicateBlockResolver}; +use super::{ + DecodeError, Object, anchor::WorldGenerationContext, biome_temperature::biome_info_noise, + density::identifier, double, height_provider::HeightProvider, int_range, integer, number_text, + optional, required, value_provider::IntProvider, +}; +use crate::heightmap::HeightmapType; +pub use chain::{FeaturePlacementError, FeaturePlacer}; +use horizon_core::random::{InvalidBound, RandomSource}; +use serde_json::value::RawValue; +mod context; +pub use context::{LayerBlock, PlacementContext, PlacementQueryError}; + +#[derive(Clone, Debug)] +pub enum PlacementModifier { + Biome, + BlockPredicate(BlockPredicate), + EnvironmentScan { + upwards: bool, + target: BlockPredicate, + allowed: BlockPredicate, + max_steps: i32, + }, + Heightmap(HeightmapType), + SurfaceRelative { + heightmap: HeightmapType, + min: i32, + max: i32, + }, + SurfaceWaterDepth(i32), + Count(IntProvider), + CountOnEveryLayer(IntProvider), + NoiseBasedCount { + ratio: i32, + factor: f64, + offset: f64, + }, + NoiseThresholdCount { + level: f64, + below: i32, + above: i32, + }, + InSquare, + Cuboid { + xz_size: IntProvider, + y_size: IntProvider, + include_edges: bool, + include_interior: bool, + }, + Offset([IntProvider; 3]), + HeightRange(HeightProvider), + Rarity(i32), + RandomChance(f32), + Fixed(Vec<[i32; 3]>), + RandomlySelected(Vec), +} +#[derive(Debug)] +pub enum PlacementError { + Random(InvalidBound), + World(PlacementQueryError), + Output(E), + WorkLimit, +} +impl std::fmt::Display for PlacementError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Random(e) => e.fmt(f), + Self::World(e) => e.fmt(f), + Self::Output(e) => e.fmt(f), + Self::WorkLimit => f.write_str("placement work limit exceeded"), + } + } +} +impl std::error::Error for PlacementError {} +impl From for PlacementError { + fn from(value: InvalidBound) -> Self { + Self::Random(value) + } +} +impl From for PlacementError { + fn from(value: PlacementQueryError) -> Self { + Self::World(value) + } +} +impl PlacementModifier { + pub fn from_json(json: &str) -> Result { + Self::decode(json, 0, &mut 65536) + } + pub(crate) fn decode( + json: &str, + depth: usize, + remaining: &mut usize, + ) -> Result { + Self::decode_with_blocks(json, depth, remaining, None) + } + pub fn from_json_with_blocks( + json: &str, + blocks: &impl PredicateBlockResolver, + ) -> Result { + Self::decode_with_blocks(json, 0, &mut 65536, Some(blocks)) + } + pub(crate) fn decode_with_blocks( + json: &str, + depth: usize, + remaining: &mut usize, + blocks: Option<&dyn PredicateBlockResolver>, + ) -> Result { + if depth > 256 || *remaining == 0 { + return Err(DecodeError::Field("placement depth or node count")); + } + *remaining -= 1; + let object: Object = serde_json::from_str(json)?; + let kind = identifier(&serde_json::from_str::( + required(&object, "type")?.get(), + )?)?; + let provider = |name, min, max| { + let value = IntProvider::from_json(required(&object, name)?.get())?; + let bounds = value.bounds(); + if bounds[0] < min || bounds[1] > max { + return Err(DecodeError::Field("placement provider bounds")); + } + Ok(value) + }; + let heightmap = || { + let name: String = serde_json::from_str(required(&object, "heightmap")?.get())?; + HeightmapType::ALL + .into_iter() + .find(|kind| kind.name() == name) + .ok_or(DecodeError::Field("heightmap")) + }; + match kind.as_str() { + "minecraft:biome" => Ok(Self::Biome), + "minecraft:block_predicate_filter" => { + Ok(Self::BlockPredicate(BlockPredicate::decode_with_blocks( + required(&object, "predicate")?.get(), + depth + 1, + remaining, + blocks, + )?)) + } + "minecraft:environment_scan" => { + let direction: String = + serde_json::from_str(required(&object, "direction_of_search")?.get())?; + let upwards = match direction.as_str() { + "up" => true, + "down" => false, + _ => return Err(DecodeError::Field("scan direction")), + }; + Ok(Self::EnvironmentScan { + upwards, + target: BlockPredicate::decode_with_blocks( + required(&object, "target_condition")?.get(), + depth + 1, + remaining, + blocks, + )?, + allowed: optional(&object, "allowed_search_condition") + .map(|v| { + BlockPredicate::decode_with_blocks( + v.get(), + depth + 1, + remaining, + blocks, + ) + }) + .transpose()? + .unwrap_or(BlockPredicate::True), + max_steps: int_range(required(&object, "max_steps")?, "scan steps", 1, 32)?, + }) + } + "minecraft:heightmap" => Ok(Self::Heightmap(heightmap()?)), + "minecraft:surface_relative_threshold_filter" => Ok(Self::SurfaceRelative { + heightmap: heightmap()?, + min: optional(&object, "min_inclusive") + .map(integer) + .transpose()? + .unwrap_or(i32::MIN), + max: optional(&object, "max_inclusive") + .map(integer) + .transpose()? + .unwrap_or(i32::MAX), + }), + "minecraft:surface_water_depth_filter" => Ok(Self::SurfaceWaterDepth(integer( + required(&object, "max_water_depth")?, + )?)), + "minecraft:noise_based_count" => Ok(Self::NoiseBasedCount { + ratio: integer(required(&object, "noise_to_count_ratio")?)?, + factor: double(required(&object, "noise_factor")?)?, + offset: optional(&object, "noise_offset") + .map(double) + .transpose()? + .unwrap_or(0.), + }), + "minecraft:noise_threshold_count" => Ok(Self::NoiseThresholdCount { + level: double(required(&object, "noise_level")?)?, + below: integer(required(&object, "below_noise")?)?, + above: integer(required(&object, "above_noise")?)?, + }), + "minecraft:count_on_every_layer" => { + Ok(Self::CountOnEveryLayer(provider("count", 0, 256)?)) + } + "minecraft:count" => Ok(Self::Count(provider("count", 0, 4096)?)), + "minecraft:in_square" => Ok(Self::InSquare), + "minecraft:cuboid" => Ok(Self::Cuboid { + xz_size: provider("xz_size", 1, 16)?, + y_size: provider("y_size", 1, 16)?, + include_edges: optional(&object, "include_edges") + .map(|raw| serde_json::from_str(raw.get())) + .transpose()? + .unwrap_or(true), + include_interior: optional(&object, "include_interior") + .map(|raw| serde_json::from_str(raw.get())) + .transpose()? + .unwrap_or(true), + }), + "minecraft:offset" => Ok(Self::Offset([ + provider("x", -16, 16)?, + provider("y", -16, 16)?, + provider("z", -16, 16)?, + ])), + "minecraft:height_range" => Ok(Self::HeightRange(HeightProvider::from_json( + required(&object, "height")?.get(), + )?)), + "minecraft:rarity_filter" => Ok(Self::Rarity(int_range( + required(&object, "chance")?, + "chance", + 1, + i32::MAX, + )?)), + "minecraft:random_chance" => { + let chance: f32 = number_text(required(&object, "chance")?)? + .parse() + .map_err(|_| DecodeError::Field("chance"))?; + if !(0. ..=1.).contains(&chance) || chance.is_sign_negative() { + return Err(DecodeError::Field("chance")); + } + Ok(Self::RandomChance(chance)) + } + "minecraft:fixed_placement" => { + let values: Vec> = + serde_json::from_str(required(&object, "positions")?.get())?; + if values.len() > 8192 { + return Err(DecodeError::Field("fixed positions")); + } + let mut positions = Vec::with_capacity(values.len()); + for raw in values { + let coords: Vec> = serde_json::from_str(raw.get())?; + if coords.len() != 3 { + return Err(DecodeError::Field("block position")); + } + positions.push([ + integer(&coords[0])?, + integer(&coords[1])?, + integer(&coords[2])?, + ]); + } + Ok(Self::Fixed(positions)) + } + "minecraft:randomly_selected" => { + let values: Vec> = + serde_json::from_str(required(&object, "placements")?.get())?; + if values.is_empty() || values.len() > 8192 { + return Err(DecodeError::Field("selected placements")); + } + Ok(Self::RandomlySelected( + values + .iter() + .map(|v| Self::decode_with_blocks(v.get(), depth + 1, remaining, blocks)) + .collect::>()?, + )) + } + _ => Err(DecodeError::Field("placement modifier type")), + } + } + /// Return the count for repeating modifiers without allocating or emitting + /// positions. Sampling still consumes the count provider's random draws. + pub fn repetitions( + &self, + random: &mut impl RandomSource, + position: [i32; 3], + ) -> Result, InvalidBound> { + let [x, _, z] = position; + Ok(match self { + Self::Count(provider) => Some(provider.sample(random)?), + Self::NoiseBasedCount { + ratio, + factor, + offset, + } => { + let noise = f64::from(biome_info_noise( + f64::from(x) / factor, + f64::from(z) / factor, + )); + Some(((noise + offset) * f64::from(*ratio)).ceil() as i32) + } + Self::NoiseThresholdCount { + level, + below, + above, + } => { + let noise = f64::from(biome_info_noise(f64::from(x) / 200., f64::from(z) / 200.)); + Some(if noise < *level { *below } else { *above }) + } + _ => None, + }) + } + /// Emit positions in native callback order. The callback shares the random + /// stream; failures retain prior emissions and consumed draws. + pub fn modify( + &self, + mut context: WorldGenerationContext, + random: &mut R, + position: [i32; 3], + emit: impl FnMut(&mut R, [i32; 3]) -> Result<(), E>, + ) -> Result<(), PlacementError> { + self.modify_in(&mut context, random, position, emit) + } + pub fn modify_in( + &self, + context: &mut impl PlacementContext, + random: &mut R, + position: [i32; 3], + mut emit: impl FnMut(&mut R, [i32; 3]) -> Result<(), E>, + ) -> Result<(), PlacementError> { + self.modify_inner(context, random, position, &mut emit, &mut 65536) + } + fn modify_inner( + &self, + context: &mut impl PlacementContext, + random: &mut R, + position: [i32; 3], + emit: &mut impl FnMut(&mut R, [i32; 3]) -> Result<(), E>, + remaining: &mut usize, + ) -> Result<(), PlacementError> { + if *remaining == 0 { + return Err(PlacementError::WorkLimit); + } + *remaining -= 1; + let [x, y, z] = position; + match self { + Self::Biome => { + let feature = context + .top_feature() + .ok_or(PlacementQueryError::Unavailable)?; + if context.biome_allows_feature(position, feature)? { + emit(random, position).map_err(PlacementError::Output)?; + } + } + Self::BlockPredicate(predicate) => { + if predicate.test_inner(context, position, 0, remaining)? { + emit(random, position).map_err(PlacementError::Output)?; + } + } + Self::EnvironmentScan { + upwards, + target, + allowed, + max_steps, + } => { + let mut position = position; + if !allowed.test_inner(context, position, 0, remaining)? { + return Ok(()); + } + for _ in 0..*max_steps { + if target.test_inner(context, position, 0, remaining)? { + return emit(random, position).map_err(PlacementError::Output); + } + position[1] = position[1].wrapping_add(if *upwards { 1 } else { -1 }); + if context.outside_build_height(position[1])? { + return Ok(()); + } + if !allowed.test_inner(context, position, 0, remaining)? { + break; + } + } + if target.test_inner(context, position, 0, remaining)? { + emit(random, position).map_err(PlacementError::Output)?; + } + } + Self::CountOnEveryLayer(count) => { + layer::modify(count, context, random, position, emit, remaining)? + } + Self::Heightmap(kind) => { + let height = context.height(*kind, x, z)?; + if height > context.min_y()? { + emit(random, [x, height, z]).map_err(PlacementError::Output)?; + } + } + Self::SurfaceRelative { + heightmap, + min, + max, + } => { + let height = i64::from(context.height(*heightmap, x, z)?); + if height + i64::from(*min) <= i64::from(y) + && i64::from(y) <= height + i64::from(*max) + { + emit(random, position).map_err(PlacementError::Output)?; + } + } + Self::SurfaceWaterDepth(max) => { + let floor = context.height(HeightmapType::OceanFloor, x, z)?; + let surface = context.height(HeightmapType::WorldSurface, x, z)?; + if surface.wrapping_sub(floor) <= *max { + emit(random, position).map_err(PlacementError::Output)?; + } + } + Self::Count(_) | Self::NoiseBasedCount { .. } | Self::NoiseThresholdCount { .. } => { + let count = self + .repetitions(random, position)? + .expect("repeating modifier"); + if count > 4096 { + return Err(PlacementError::WorkLimit); + } + for _ in 0..count { + emit(random, position).map_err(PlacementError::Output)?; + } + } + Self::Cuboid { + xz_size, + y_size, + include_edges, + include_interior, + } => { + let ny = y_size.sample(random)?; + let nx = xz_size.sample(random)?; + let nz = xz_size.sample(random)?; + if nx < 0 || ny < 0 || nz < 0 { + return Ok(()); + } + for dx in 0..=nx { + for dy in 0..=ny { + for dz in 0..=nz { + if *remaining == 0 { + return Err(PlacementError::WorkLimit); + } + *remaining -= 1; + let bx = dx == 0 || dx == nx; + let by = dy == 0 || dy == ny; + let bz = dz == 0 || dz == nz; + if !include_edges && (u8::from(bx) + u8::from(by) + u8::from(bz)) >= 2 { + continue; + } + if !include_interior && !(bx || by || bz) { + continue; + } + emit( + random, + [x.wrapping_add(dx), y.wrapping_add(dy), z.wrapping_add(dz)], + ) + .map_err(PlacementError::Output)?; + } + } + } + } + Self::InSquare => { + let x = x.wrapping_add(random.next_int_bound(16)?); + let z = z.wrapping_add(random.next_int_bound(16)?); + emit(random, [x, y, z]).map_err(PlacementError::Output)?; + } + Self::Offset(offsets) => { + let x = x.wrapping_add(offsets[0].sample(random)?); + let y = y.wrapping_add(offsets[1].sample(random)?); + let z = z.wrapping_add(offsets[2].sample(random)?); + emit(random, [x, y, z]).map_err(PlacementError::Output)?; + } + Self::HeightRange(height) => { + let y = height.sample(random, context.generation())?; + emit(random, [x, y, z]).map_err(PlacementError::Output)?; + } + Self::Rarity(chance) => { + if random.next_float() < 1. / *chance as f32 { + emit(random, position).map_err(PlacementError::Output)?; + } + } + Self::RandomChance(chance) => { + if random.next_float() < *chance { + emit(random, position).map_err(PlacementError::Output)?; + } + } + Self::Fixed(positions) => { + if positions.len() > 8192 { + return Err(PlacementError::WorkLimit); + } + for p in positions { + if p[0] >> 4 == x >> 4 && p[2] >> 4 == z >> 4 { + emit(random, *p).map_err(PlacementError::Output)?; + } + } + } + Self::RandomlySelected(placements) => { + if placements.len() > 8192 { + return Err(PlacementError::WorkLimit); + } + let index = random.next_int_bound(placements.len() as i32)? as usize; + placements[index].modify_inner(context, random, position, emit, remaining)?; + } + } + Ok(()) + } +} diff --git a/crates/horizon-world/src/worldgen/placement/chain.rs b/crates/horizon-world/src/worldgen/placement/chain.rs new file mode 100644 index 000000000..63d526256 --- /dev/null +++ b/crates/horizon-world/src/worldgen/placement/chain.rs @@ -0,0 +1,270 @@ +//! Ordered modifier-chain execution with reusable native-style pending buffers. +use super::{PlacementContext, PlacementError, PlacementModifier, PlacementQueryError}; +use crate::worldgen::anchor::WorldGenerationContext; +use crate::{heightmap::HeightmapType, worldgen::feature_sort::FeatureIdentity}; +use horizon_core::random::{InvalidBound, RandomSource}; +use std::cell::Cell; + +struct Queries<'a, C> { + world: &'a mut C, + top: Option, +} +impl PlacementContext for Queries<'_, C> { + fn block_survives( + &mut self, + state: crate::registry::BlockStateId, + position: [i32; 3], + ) -> Result { + self.world.block_survives(state, position) + } + fn face_sturdy( + &mut self, + position: [i32; 3], + direction: horizon_core::geometry::Direction, + ) -> Result { + self.world.face_sturdy(position, direction) + } + fn unobstructed_block(&mut self, position: [i32; 3]) -> Result { + self.world.unobstructed_block(position) + } + fn biome_identity( + &mut self, + position: [i32; 3], + ) -> Result { + self.world.biome_identity(position) + } + fn top_feature(&self) -> Option { + self.top + } + fn biome_allows_feature( + &mut self, + p: [i32; 3], + feature: FeatureIdentity, + ) -> Result { + self.world.biome_allows_feature(p, feature) + } + fn generation(&self) -> WorldGenerationContext { + self.world.generation() + } + fn predicate_generation(&mut self) -> Result { + self.world.predicate_generation() + } + fn block_state( + &mut self, + position: [i32; 3], + ) -> Result { + self.world.block_state(position) + } + fn block_matches_tag( + &mut self, + position: [i32; 3], + tag: &str, + ) -> Result { + self.world.block_matches_tag(position, tag) + } + fn min_y(&mut self) -> Result { + self.world.min_y() + } + fn max_y(&mut self) -> Result { + self.world.max_y() + } + fn height(&mut self, kind: HeightmapType, x: i32, z: i32) -> Result { + self.world.height(kind, x, z) + } + fn layer_block(&mut self, p: [i32; 3]) -> Result { + self.world.layer_block(p) + } + fn inside_build_height(&mut self, p: [i32; 3]) -> Result { + self.world.inside_build_height(p) + } + fn outside_build_height(&mut self, y: i32) -> Result { + self.world.outside_build_height(y) + } +} + +#[derive(Debug)] +pub enum FeaturePlacementError { + Random(InvalidBound), + World(PlacementQueryError), + Feature(E), + WorkLimit, + InvalidPendingIndex, +} +impl std::fmt::Display for FeaturePlacementError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Random(e) => e.fmt(f), + Self::World(e) => e.fmt(f), + Self::Feature(e) => e.fmt(f), + Self::WorkLimit => f.write_str("feature placement work limit exceeded"), + Self::InvalidPendingIndex => { + f.write_str("pending modifier index is outside the current chain") + } + } + } +} +impl std::error::Error for FeaturePlacementError {} + +/// Processes one modifier completely before running its descendants. Siblings +/// retain emitted order. The reusable buffers also retain partial state after +/// errors, like vanilla; a fresh placer starts without that state. +#[derive(Default, Debug)] +pub struct FeaturePlacer { + pending: Vec<([i32; 3], usize)>, + modified: Vec<[i32; 3]>, +} +impl FeaturePlacer { + pub fn new() -> Self { + Self::default() + } + pub fn place( + &mut self, + modifiers: &[PlacementModifier], + mut context: WorldGenerationContext, + random: &mut R, + origin: [i32; 3], + feature: impl FnMut(&mut R, [i32; 3]) -> Result, + ) -> Result> { + self.place_in(modifiers, &mut context, random, origin, feature) + } + pub fn place_in( + &mut self, + modifiers: &[PlacementModifier], + context: &mut impl PlacementContext, + random: &mut R, + origin: [i32; 3], + mut feature: impl FnMut(&mut R, [i32; 3]) -> Result, + ) -> Result> { + self.place_with_context(modifiers, context, random, origin, |_, random, position| { + feature(random, position) + }) + } + /// Shares the mutable world and random stream between modifier queries and + /// feature writes. Later siblings observe earlier feature mutations. + pub fn place_with_context( + &mut self, + modifiers: &[PlacementModifier], + context: &mut C, + random: &mut R, + origin: [i32; 3], + feature: impl FnMut(&mut C, &mut R, [i32; 3]) -> Result, + ) -> Result> { + self.place_with_budget( + modifiers, + context, + random, + origin, + &Cell::new(1 << 20), + feature, + ) + } + /// Set the root placed feature only for this invocation's modifier queries. + /// Nested feature callbacks receive the original world, so their own plain + /// placers do not inherit this root's biome-check context. + pub fn place_with_biome_check( + &mut self, + modifiers: &[PlacementModifier], + context: &mut C, + random: &mut R, + origin: [i32; 3], + top_feature: FeatureIdentity, + feature: impl FnMut(&mut C, &mut R, [i32; 3]) -> Result, + ) -> Result> { + self.place_control( + modifiers, + context, + random, + origin, + (&Cell::new(1 << 20), Some(top_feature)), + feature, + ) + } + pub(crate) fn place_with_budget( + &mut self, + modifiers: &[PlacementModifier], + context: &mut C, + random: &mut R, + origin: [i32; 3], + remaining: &Cell, + feature: impl FnMut(&mut C, &mut R, [i32; 3]) -> Result, + ) -> Result> { + self.place_control( + modifiers, + context, + random, + origin, + (remaining, None), + feature, + ) + } + fn place_control( + &mut self, + modifiers: &[PlacementModifier], + context: &mut C, + random: &mut R, + origin: [i32; 3], + control: (&Cell, Option), + mut feature: impl FnMut(&mut C, &mut R, [i32; 3]) -> Result, + ) -> Result> { + let (remaining, top) = control; + const LIMIT: usize = 1 << 20; + if modifiers.len() > 1024 || self.pending.len() >= LIMIT { + return Err(FeaturePlacementError::WorkLimit); + } + if modifiers.is_empty() { + return feature(context, random, origin).map_err(FeaturePlacementError::Feature); + } + self.pending.push((origin, 0)); + let mut any = false; + while let Some((position, index)) = self.pending.pop() { + if remaining.get() == 0 { + return Err(FeaturePlacementError::WorkLimit); + } + remaining.set(remaining.get() - 1); + let modifier = modifiers + .get(index) + .ok_or(FeaturePlacementError::InvalidPendingIndex)?; + modifier + .modify_in( + &mut Queries { + world: context, + top, + }, + random, + position, + |_, p| { + if self.modified.len() >= LIMIT { + return Err(()); + } + self.modified.push(p); + Ok(()) + }, + ) + .map_err(|e| match e { + PlacementError::Random(e) => FeaturePlacementError::Random(e), + PlacementError::World(e) => FeaturePlacementError::World(e), + PlacementError::Output(()) | PlacementError::WorkLimit => { + FeaturePlacementError::WorkLimit + } + })?; + let next = index + 1; + if next < modifiers.len() { + if self.pending.len() + self.modified.len() > LIMIT { + return Err(FeaturePlacementError::WorkLimit); + } + self.pending + .extend(self.modified.iter().rev().map(|p| (*p, next))); + } else { + for p in &self.modified { + if remaining.get() == 0 { + return Err(FeaturePlacementError::WorkLimit); + } + remaining.set(remaining.get() - 1); + any |= feature(context, random, *p).map_err(FeaturePlacementError::Feature)?; + } + } + self.modified.clear(); + } + Ok(any) + } +} diff --git a/crates/horizon-world/src/worldgen/placement/context.rs b/crates/horizon-world/src/worldgen/placement/context.rs new file mode 100644 index 000000000..695f0bde6 --- /dev/null +++ b/crates/horizon-world/src/worldgen/placement/context.rs @@ -0,0 +1,117 @@ +//! Query interface for placement against a generated world. +use crate::worldgen::feature_sort::FeatureIdentity; +use crate::{heightmap::HeightmapType, worldgen::anchor::WorldGenerationContext}; +#[derive(Clone, Debug, PartialEq, Eq)] +pub enum PlacementQueryError { + Unavailable, + WorkLimit, + Failed(String), +} +impl std::fmt::Display for PlacementQueryError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::WorkLimit => f.write_str("predicate work limit exceeded"), + Self::Unavailable => f.write_str("placement world query is unavailable"), + Self::Failed(message) => f.write_str(message), + } + } +} +impl std::error::Error for PlacementQueryError {} +/// Classification for layered placement: air states and exact WATER/LAVA blocks +/// are empty; exact BEDROCK is excluded from ground; every other block is ground. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum LayerBlock { + Empty, + Bedrock, + Ground, +} +pub trait PlacementContext { + /// Evaluate this candidate state's survival without placing it. + fn block_survives( + &mut self, + _state: crate::registry::BlockStateId, + _position: [i32; 3], + ) -> Result { + Err(PlacementQueryError::Unavailable) + } + /// Read the block state and evaluate FULL support on the requested face. + fn face_sturdy( + &mut self, + _position: [i32; 3], + _direction: horizon_core::geometry::Direction, + ) -> Result { + Err(PlacementQueryError::Unavailable) + } + /// Test entity obstruction of a unit-block shape with no excluded entity. + fn unobstructed_block(&mut self, _position: [i32; 3]) -> Result { + Err(PlacementQueryError::Unavailable) + } + fn biome_identity( + &mut self, + _position: [i32; 3], + ) -> Result { + Err(PlacementQueryError::Unavailable) + } + fn top_feature(&self) -> Option { + None + } + /// Resolve the biome at this position and test its generation settings for + /// the supplied placed feature. Registry equality/ownership belongs here. + fn biome_allows_feature( + &mut self, + _position: [i32; 3], + _feature: FeatureIdentity, + ) -> Result { + Err(PlacementQueryError::Unavailable) + } + fn block_state( + &mut self, + _position: [i32; 3], + ) -> Result { + Err(PlacementQueryError::Unavailable) + } + /// Read the state at the requested position and test its block-tag identity. + fn block_matches_tag( + &mut self, + _position: [i32; 3], + _tag: &str, + ) -> Result { + Err(PlacementQueryError::Unavailable) + } + fn max_y(&mut self) -> Result { + Err(PlacementQueryError::Unavailable) + } + fn inside_build_height(&mut self, position: [i32; 3]) -> Result { + Ok(position[1] >= self.min_y()? && position[1] <= self.max_y()?) + } + fn outside_build_height(&mut self, y: i32) -> Result { + Ok(y < self.min_y()? || y > self.max_y()?) + } + fn layer_block(&mut self, _position: [i32; 3]) -> Result { + Err(PlacementQueryError::Unavailable) + } + fn generation(&self) -> WorldGenerationContext; + /// Recreate the generation bounds for a block-predicate invocation. World + /// adapters may perform fallible level/generator queries here; ordinary + /// placement retains its already-created immutable generation context. + fn predicate_generation(&mut self) -> Result { + Ok(self.generation()) + } + /// World minimum, which can differ from the generator's minimum. + fn min_y(&mut self) -> Result; + fn height(&mut self, kind: HeightmapType, x: i32, z: i32) -> Result; +} +impl PlacementContext for WorldGenerationContext { + fn max_y(&mut self) -> Result { + Ok(self.min_y.wrapping_add(self.height).wrapping_sub(1)) + } + fn generation(&self) -> WorldGenerationContext { + *self + } + fn min_y(&mut self) -> Result { + Ok(self.min_y) + } + fn height(&mut self, _: HeightmapType, _: i32, _: i32) -> Result { + Err(PlacementQueryError::Unavailable) + } +} diff --git a/crates/horizon-world/src/worldgen/placement/layer.rs b/crates/horizon-world/src/worldgen/placement/layer.rs new file mode 100644 index 000000000..ac794bc55 --- /dev/null +++ b/crates/horizon-world/src/worldgen/placement/layer.rs @@ -0,0 +1,68 @@ +//! Layer scanning and its interleaved count-provider sampling. +use super::{LayerBlock, PlacementContext, PlacementError}; +use crate::{heightmap::HeightmapType, worldgen::value_provider::IntProvider}; +use horizon_core::random::RandomSource; + +pub(super) fn modify( + count: &IntProvider, + context: &mut impl PlacementContext, + random: &mut R, + position: [i32; 3], + emit: &mut impl FnMut(&mut R, [i32; 3]) -> Result<(), E>, + remaining: &mut usize, +) -> Result<(), PlacementError> { + let mut layer = 0_i32; + loop { + let mut found = false; + let mut attempt = 0_i32; + loop { + take(remaining)?; + // Native samples on every loop condition, including the final check. + if attempt >= count.sample(random)? { + break; + } + let x = position[0].wrapping_add(random.next_int_bound(16)?); + let z = position[2].wrapping_add(random.next_int_bound(16)?); + let y = context.height(HeightmapType::MotionBlocking, x, z)?; + if let Some(y) = ground(context, [x, y, z], layer, remaining)? { + emit(random, [x, y, z]).map_err(PlacementError::Output)?; + found = true; + } + attempt = attempt.wrapping_add(1); + } + layer = layer.wrapping_add(1); + if !found { + return Ok(()); + } + } +} +fn ground( + context: &mut impl PlacementContext, + position: [i32; 3], + layer: i32, + remaining: &mut usize, +) -> Result, PlacementError> { + let [x, mut y, z] = position; + let mut above = context.layer_block(position)?; + let mut found = 0_i32; + while y >= context.min_y()?.wrapping_add(1) { + take(remaining)?; + let below = context.layer_block([x, y.wrapping_sub(1), z])?; + if below == LayerBlock::Ground && above == LayerBlock::Empty { + if found == layer { + return Ok((y != i32::MAX).then_some(y)); + } + found = found.wrapping_add(1); + } + above = below; + y = y.wrapping_sub(1); + } + Ok(None) +} +fn take(remaining: &mut usize) -> Result<(), PlacementError> { + if *remaining == 0 { + return Err(PlacementError::WorkLimit); + } + *remaining -= 1; + Ok(()) +} diff --git a/crates/horizon-world/src/worldgen/router.rs b/crates/horizon-world/src/worldgen/router.rs new file mode 100644 index 000000000..aed50353d --- /dev/null +++ b/crates/horizon-world/src/worldgen/router.rs @@ -0,0 +1,168 @@ +//! The eight terrain-router fields used by Java Edition 26.3. +use super::{DecodeError, Object, climate::ClimateSampler, density::DensityRegistry, required}; +use horizon_core::density::{ + DensitySampler, + graph::{CompileError, DensityCompiler, FunctionId}, +}; +use std::sync::Arc; + +/// Declaration and compilation order: the six climate fields, surface, density. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[repr(usize)] +pub enum RouterField { + Temperature, + Vegetation, + Continents, + Erosion, + Depth, + Ridges, + ChunkSurfaceLevel, + FinalDensity, +} +impl RouterField { + pub const ALL: [Self; 8] = [ + Self::Temperature, + Self::Vegetation, + Self::Continents, + Self::Erosion, + Self::Depth, + Self::Ridges, + Self::ChunkSurfaceLevel, + Self::FinalDensity, + ]; + pub const fn name(self) -> &'static str { + match self { + Self::Temperature => "temperature", + Self::Vegetation => "vegetation", + Self::Continents => "continents", + Self::Erosion => "erosion", + Self::Depth => "depth", + Self::Ridges => "ridges", + Self::ChunkSurfaceLevel => "chunk_surface_level", + Self::FinalDensity => "final_density", + } + } +} + +/// Root IDs belong to the registry graph used to decode this router. +#[derive(Clone, Copy, Debug)] +pub struct NoiseRouter { + functions: [FunctionId; 8], +} +impl NoiseRouter { + /// Decode the router object itself. Noise settings, aquifer and material + /// configuration are separate codecs and are not parsed by this method. + /// Missing/null fields or any invalid root leave the registry unchanged. + pub fn from_json(json: &str, registry: &mut DensityRegistry) -> Result { + let object: Object = serde_json::from_str(json)?; + let inputs = RouterField::ALL + .iter() + .map(|field| required(&object, field.name()).map(|raw| raw.get())) + .collect::, _>>()?; + let functions = registry + .decode_functions(&inputs)? + .try_into() + .map_err(|_| DecodeError::Field("router field count"))?; + Ok(Self { functions }) + } + pub fn function(self, field: RouterField) -> FunctionId { + self.functions[field as usize] + } + /// One compiler owns the cache namespace for every router field. Existing + /// compiler samplers and cache IDs are reused rather than reset per root. + pub fn compile(self, compiler: &mut DensityCompiler) -> Result { + let samplers = self + .functions + .iter() + .map(|id| compiler.get_sampler(*id)) + .collect::, _>>()? + .try_into() + .expect("one sampler for each of eight router fields"); + Ok(RouterSamplers { samplers }) + } + /// Compile only the six climate roots, in vanilla's sampler-binding order. + pub fn compile_climate( + self, + compiler: &mut DensityCompiler, + ) -> Result { + let samplers = self.functions[..6] + .iter() + .map(|id| compiler.get_sampler(*id)) + .collect::, _>>()? + .try_into() + .expect("one sampler for each of six climate fields"); + Ok(ClimateSampler::new(samplers)) + } +} +#[derive(Debug)] +pub struct RouterSamplers { + samplers: [Arc; 8], +} +impl RouterSamplers { + pub fn get(&self, field: RouterField) -> &Arc { + &self.samplers[field as usize] + } + pub fn climate_sampler(&self) -> ClimateSampler { + ClimateSampler::new(std::array::from_fn(|i| self.samplers[i].clone())) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use horizon_core::density::SamplerContext; + use std::collections::BTreeMap; + + #[test] + fn roots_share_holder_cache_and_failed_router_leaves_graph_unchanged() { + let mut registry = DensityRegistry::from_json( + &BTreeMap::new(), + &BTreeMap::from([( + "minecraft:shared".into(), + r#"{"type":"cache","input":{"type":"gradient","axis":"x","from_coordinate":0,"to_coordinate":16,"from_value":-1,"to_value":1}}"#.into(), + )]), + ) + .unwrap(); + let object: BTreeMap<_, _> = RouterField::ALL + .iter() + .map(|field| (field.name(), "minecraft:shared")) + .collect(); + let json = serde_json::to_string(&object).unwrap(); + let expected = registry + .graph() + .clone() + .insert(horizon_core::density::graph::GraphNode::Constant(123.0)) + .unwrap(); + let invalid = json + .replace( + "\"temperature\":\"minecraft:shared\"", + "\"temperature\":123", + ) + .replace( + "\"final_density\":\"minecraft:shared\"", + "\"final_density\":{\"type\":\"missing\"}", + ); + assert!(NoiseRouter::from_json(&invalid, &mut registry).is_err()); + assert_eq!(registry.decode_functions(&["123"]).unwrap()[0], expected); + let router = NoiseRouter::from_json(&json, &mut registry).unwrap(); + for field in RouterField::ALL { + assert_eq!( + router.function(field), + registry.reference("minecraft:shared").unwrap() + ); + } + let mut compiler = DensityCompiler::new_seeded(registry.into_graph(), 0, false); + let samplers = router.compile(&mut compiler).unwrap(); + assert_eq!(compiler.cache_count(), 1); + let mut context = SamplerContext::cached(); + for field in RouterField::ALL { + assert_eq!( + samplers + .get(field) + .sample_value(&mut context, [4, 99, -32]) + .unwrap(), + -0.5 + ); + } + } +} diff --git a/crates/horizon-world/src/worldgen/rule_test.rs b/crates/horizon-world/src/worldgen/rule_test.rs new file mode 100644 index 000000000..d9f836961 --- /dev/null +++ b/crates/horizon-world/src/worldgen/rule_test.rs @@ -0,0 +1,133 @@ +//! Registry-bound replacement predicates with ordered short-circuit evaluation. +use super::{ + DecodeError, Object, block_feature::FeatureBlockBindings, density::identifier, integer, + number_text, required, +}; +use crate::registry::BlockStateId; +use horizon_core::random::RandomSource; +use serde_json::value::RawValue; +use std::{collections::BTreeSet, sync::Arc}; + +#[derive(Clone, Debug)] +pub struct RuleTest(Node); +#[derive(Clone, Debug)] +enum Node { + True, + Not(Box), + All(Vec), + Any(Vec), + States(Arc>), + State(BlockStateId), + RandomStates(Arc>, f32), + RandomState(BlockStateId, f32), + Height(i32, i32), +} +impl RuleTest { + pub fn from_json(json: &str, bindings: &FeatureBlockBindings<'_>) -> Result { + Self::decode(json, bindings, 0, &mut 65536) + } + pub(crate) fn decode( + json: &str, + bindings: &FeatureBlockBindings<'_>, + depth: usize, + remaining: &mut usize, + ) -> Result { + if depth > 128 || *remaining == 0 { + return Err(DecodeError::Field("replacement rule depth or node count")); + } + *remaining -= 1; + let object: Object = serde_json::from_str(json)?; + let name = |field| -> Result { + identifier(&serde_json::from_str::( + required(&object, field)?.get(), + )?) + }; + let state = || { + bindings + .codec + .decode(required(&object, "block_state")?.get(), false) + .map_err(|e| DecodeError::Registry(e.to_string())) + }; + let block = || { + let name = name("block")?; + bindings + .blocks + .get(&name) + .cloned() + .ok_or_else(|| DecodeError::Registry(format!("unknown block {name}"))) + }; + // These native codecs use unrestricted FLOAT, including out-of-range + // probabilities. Matching the state still consumes a draw at zero/one. + let probability = || { + number_text(required(&object, "probability")?)? + .parse::() + .map_err(|_| DecodeError::Field("probability")) + }; + let node = match name("predicate_type")?.as_str() { + "minecraft:always_true" => Node::True, + "minecraft:block_match" => Node::States(block()?), + "minecraft:blockstate_match" => Node::State(state()?), + "minecraft:tag_match" => Node::States( + bindings + .tags + .get(&super::tags::identifier(&serde_json::from_str::( + required(&object, "tag")?.get(), + )?)?) + .cloned() + .unwrap_or_default(), + ), + "minecraft:random_block_match" => Node::RandomStates(block()?, probability()?), + "minecraft:random_blockstate_match" => Node::RandomState(state()?, probability()?), + "minecraft:height_match" => Node::Height( + integer(required(&object, "min_inclusive")?)?, + integer(required(&object, "max_inclusive")?)?, + ), + "minecraft:not" => Node::Not(Box::new(Self::decode( + required(&object, "rule")?.get(), + bindings, + depth + 1, + remaining, + )?)), + kind @ ("minecraft:all_of" | "minecraft:any_of") => { + let values: Vec> = + serde_json::from_str(required(&object, "rules")?.get())?; + if values.len() > 8192 { + return Err(DecodeError::Field("replacement rule list")); + } + let values = values + .iter() + .map(|v| Self::decode(v.get(), bindings, depth + 1, remaining)) + .collect::>()?; + if kind == "minecraft:all_of" { + Node::All(values) + } else { + Node::Any(values) + } + } + _ => return Err(DecodeError::Field("replacement rule type")), + }; + Ok(Self(node)) + } + pub fn test( + &self, + state: BlockStateId, + position: [i32; 3], + random: &mut impl RandomSource, + ) -> bool { + match &self.0 { + Node::True => true, + Node::Not(rule) => !rule.test(state, position, random), + Node::All(rules) => rules.iter().all(|rule| rule.test(state, position, random)), + Node::Any(rules) => rules.iter().any(|rule| rule.test(state, position, random)), + Node::States(states) => states.contains(&state), + Node::State(expected) => state == *expected, + Node::RandomStates(states, probability) => { + states.contains(&state) && random.next_float() < *probability + } + Node::RandomState(expected, probability) => { + state == *expected && random.next_float() < *probability + } + Node::Height(min, max) => *min <= position[1] && position[1] <= *max, + } + } +} diff --git a/crates/horizon-world/src/worldgen/settings.rs b/crates/horizon-world/src/worldgen/settings.rs new file mode 100644 index 000000000..770f12bd6 --- /dev/null +++ b/crates/horizon-world/src/worldgen/settings.rs @@ -0,0 +1,45 @@ +//! Vertical terrain bounds used by Java Edition 26.3. +use super::{DecodeError, Object, int_range, required}; + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct NoiseSettings { + pub min_y: i32, + pub height: i32, +} +impl NoiseSettings { + /// The record constructor itself does not check bounds or alignment. + pub const fn new(min_y: i32, height: i32) -> Self { + Self { min_y, height } + } + /// Vanilla's create helper checks the wrapped upper bound, then height + /// alignment, then minimum alignment. JSON adds stricter field bounds. + pub fn create(min_y: i32, height: i32) -> Result { + if min_y.wrapping_add(height) > 2032 { + return Err(DecodeError::Field("noise upper bound")); + } + if height % 16 != 0 { + return Err(DecodeError::Field("noise height alignment")); + } + if min_y % 16 != 0 { + return Err(DecodeError::Field("noise minimum alignment")); + } + Ok(Self::new(min_y, height)) + } + pub fn from_json(json: &str) -> Result { + let object: Object = serde_json::from_str(json)?; + let min_y = int_range(required(&object, "min_y")?, "noise minimum", -2032, 2031)?; + let height = int_range(required(&object, "height")?, "noise height", 0, 4064)?; + Self::create(min_y, height) + } + /// Accessor maximum is minimum + height - 1 with Java integer wrapping. + /// Disjoint ranges can produce negative heights; vanilla does not clamp + /// those to zero or reapply codec alignment constraints to the result. + pub fn clamp_to_height(self, accessor_minimum: i32, accessor_height: i32) -> Self { + let min_y = self.min_y.max(accessor_minimum); + let upper = self + .min_y + .wrapping_add(self.height) + .min(accessor_minimum.wrapping_add(accessor_height)); + Self::new(min_y, upper.wrapping_sub(min_y)) + } +} diff --git a/crates/horizon-world/src/worldgen/state_provider.rs b/crates/horizon-world/src/worldgen/state_provider.rs new file mode 100644 index 000000000..be1901a44 --- /dev/null +++ b/crates/horizon-world/src/worldgen/state_provider.rs @@ -0,0 +1,601 @@ +//! Initial block-state providers, bound to immutable block and tag identities. +mod catalog; +mod noise; +pub use catalog::StateProviderCatalog; +mod properties; +use super::{ + DecodeError, Object, + block_predicate::{BlockPredicate, PredicateBlockResolver}, + density::identifier, + feature::FeatureWorld, + optional, + placement::{PlacementContext, PlacementQueryError}, + required, + value_provider::IntProvider, + weighted::WeightedList, +}; +use crate::block_properties::{BlockPropertiesRegistry, BlockProperty, BoundBlockProperty}; +use crate::registry::{BlockRegistry, BlockStateId, BlockStateJsonCodec}; +use horizon_core::random::{InvalidBound, RandomSource}; +use noise::NoiseProvider; +use properties::StateProperties; +use serde_json::value::RawValue; +use std::{ + collections::{BTreeMap, BTreeSet}, + sync::{Arc, OnceLock}, +}; +const DIRECTIONS: [&str; 6] = ["down", "up", "north", "south", "west", "east"]; +type Rotations = Arc>; + +pub struct StateProviderBindings<'r> { + physical_properties: Option<[BoundBlockProperty; 4]>, + biomes: Option>, + fluids: super::fluid_predicate::FluidPredicateBindings, + codec: BlockStateJsonCodec<'r>, + blocks: BTreeMap, + tags: BTreeMap>>, + registry: &'r BlockRegistry, + rotations: OnceLock>, + integers: BTreeSet<(String, String)>, + properties: OnceLock, String>>, + predicate_states: OnceLock>>>, +} +impl<'r> StateProviderBindings<'r> { + pub fn with_block_properties( + mut self, + properties: &BlockPropertiesRegistry<'r>, + ) -> Result { + if !std::ptr::eq(self.registry, properties.registry()) { + return Err(DecodeError::Field( + "block properties use a different registry", + )); + } + self.physical_properties = Some([ + properties.bind(BlockProperty::Solid), + properties.bind(BlockProperty::Replaceable), + properties.bind(BlockProperty::Liquid), + properties.bind(BlockProperty::SolidRender), + ]); + Ok(self) + } + pub fn with_biomes( + mut self, + biomes: Arc, + ) -> Self { + self.biomes = Some(biomes); + self + } + + pub fn with_fluid_tags( + mut self, + tags: &BTreeMap>, + ) -> Result { + self.fluids = self.fluids.with_resolved_tags(tags)?; + Ok(self) + } + /// Resolved tag lists preserve holder order, including an empty named set. + pub fn new( + registry: &'r BlockRegistry, + integers: BTreeSet<(String, String)>, + tags: &BTreeMap>, + ) -> Result { + let codec = BlockStateJsonCodec::new(registry, integers.clone()) + .map_err(|e| DecodeError::Registry(e.to_string()))?; + let mut blocks = BTreeMap::new(); + for index in 0..registry.len() { + let name = ®istry.state(BlockStateId(index as u32)).unwrap().name; + blocks + .entry(name.clone()) + .or_insert_with(|| registry.default_state(name).unwrap()); + } + let mut bound_tags = BTreeMap::new(); + for (name, entries) in tags { + if entries.len() > 8192 { + return Err(DecodeError::Field("provider tag size")); + } + let values = entries + .iter() + .map(|name| { + blocks + .get(&identifier(name)?) + .copied() + .ok_or_else(|| DecodeError::Registry(format!("unknown block {name}"))) + }) + .collect::, _>>()?; + if bound_tags + .insert(super::tags::identifier(name)?, Arc::new(values)) + .is_some() + { + return Err(DecodeError::Field("duplicate provider block tag")); + } + } + Ok(Self { + codec, + biomes: None, + physical_properties: None, + fluids: super::fluid_predicate::FluidPredicateBindings::new(registry)?, + blocks, + tags: bound_tags, + registry, + rotations: OnceLock::new(), + integers, + properties: OnceLock::new(), + predicate_states: OnceLock::new(), + }) + } + fn state(&self, json: &str, full: bool) -> Result { + self.codec + .decode(json, full) + .map_err(|e| DecodeError::Registry(e.to_string())) + } + fn rotations(&self) -> Result { + self.rotations + .get_or_init(|| rotation_table(self.registry)) + .clone() + .map_err(DecodeError::Registry) + } + fn properties(&self) -> Result, DecodeError> { + self.properties + .get_or_init(|| StateProperties::build(self.registry, &self.integers).map(Arc::new)) + .clone() + .map_err(DecodeError::Registry) + } + fn block_set(&self, raw: &RawValue) -> Result>, DecodeError> { + if let Ok(name) = serde_json::from_str::(raw.get()) { + if let Some(tag) = name.strip_prefix('#') { + return self + .tags + .get(&super::tags::identifier(tag)?) + .cloned() + .ok_or_else(|| { + DecodeError::Registry(format!("unknown provider block tag {tag}")) + }); + } + let state = self + .blocks + .get(&identifier(&name)?) + .copied() + .ok_or_else(|| DecodeError::Registry(format!("unknown block {name}")))?; + return Ok(Arc::new(vec![state])); + } + let names: Vec = serde_json::from_str(raw.get())?; + if names.len() > 8192 { + return Err(DecodeError::Field("provider block list size")); + } + Ok(Arc::new( + names + .iter() + .map(|name| { + self.blocks + .get(&identifier(name)?) + .copied() + .ok_or_else(|| DecodeError::Registry(format!("unknown block {name}"))) + }) + .collect::, _>>()?, + )) + } +} +impl PredicateBlockResolver for StateProviderBindings<'_> { + fn predicate_state(&self, json: &str) -> Result { + self.state(json, false) + } + fn predicate_property( + &self, + property: BlockProperty, + ) -> Result { + let values = self + .physical_properties + .as_ref() + .ok_or(DecodeError::Field("predicate block property registry"))?; + Ok(values[match property { + BlockProperty::Solid => 0, + BlockProperty::Replaceable => 1, + BlockProperty::Liquid => 2, + BlockProperty::SolidRender => 3, + }] + .clone()) + } + fn predicate_biome_set( + &self, + json: &str, + ) -> Result>, DecodeError> { + self.biomes + .as_ref() + .ok_or(DecodeError::Field("predicate biome registry"))? + .resolve(json) + } + + fn predicate_fluid_set( + &self, + json: &str, + ) -> Result { + self.fluids.resolve(json) + } + fn predicate_block_set(&self, json: &str) -> Result>, DecodeError> { + let raw: Box = serde_json::from_str(json)?; + let defaults = self.block_set(&raw)?; + let states = self.predicate_states.get_or_init(|| { + let mut states = BTreeMap::>::new(); + for id in 0..self.registry.len() { + let id = BlockStateId(id as u32); + let default = self.blocks[&self.registry.state(id).unwrap().name]; + states.entry(default).or_default().insert(id); + } + states + .into_iter() + .map(|(id, values)| (id, Arc::new(values))) + .collect() + }); + if defaults.len() == 1 { + return Ok(states[&defaults[0]].clone()); + } + Ok(Arc::new( + defaults + .iter() + .flat_map(|id| states[id].iter().copied()) + .collect(), + )) + } +} +#[derive(Clone, Debug)] +pub struct BlockStateProvider(Node); +#[derive(Clone, Debug)] +enum Node { + RuleBased { + fallback: Option>, + rules: Vec<(BlockPredicate, BlockStateProvider)>, + }, + Noise(Box), + Simple(BlockStateId), + Weighted(WeightedList), + RandomBlock(Arc>), + Rotated { + source: Box, + direction: Option, + rotations: Rotations, + }, + CopyProperties(Box, Arc), + RandomizedInt { + source: Box, + property: String, + values: IntProvider, + properties: Arc, + }, +} +#[derive(Debug)] +pub enum StateProviderError { + Random(InvalidBound), + World(E), + Query(PlacementQueryError), + InvalidState, + InvalidPropertyValue, + EmptyNoiseSelection, +} +impl std::fmt::Display for StateProviderError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Random(e) => e.fmt(f), + Self::World(e) => e.fmt(f), + Self::Query(e) => e.fmt(f), + Self::InvalidState => f.write_str("unregistered provider source state"), + Self::InvalidPropertyValue => f.write_str("invalid randomized property value"), + Self::EmptyNoiseSelection => f.write_str("empty dual-noise state selection"), + } + } +} +impl std::error::Error for StateProviderError {} +impl From for StateProviderError { + fn from(e: InvalidBound) -> Self { + Self::Random(e) + } +} +impl BlockStateProvider { + /// Native DIRECT_CODEC is an exclusive choice: exactly one of a full state + /// object and a typed provider must decode. Compact state strings are not + /// direct providers; named provider holders are a separate registry layer. + pub fn from_json( + json: &str, + bindings: &StateProviderBindings<'_>, + ) -> Result { + Self::decode(json, bindings, 0, &mut 65536, None) + } + fn decode_holder( + json: &str, + bindings: &StateProviderBindings<'_>, + depth: usize, + remaining: &mut usize, + catalog: Option<&StateProviderCatalog>, + ) -> Result { + if depth > 128 || *remaining == 0 { + return Err(DecodeError::Field( + "state provider resource expansion limit", + )); + } + if let Ok(name) = serde_json::from_str::(json) { + let name = identifier(&name)?; + let resource = catalog + .and_then(|c| c.lookup(&name)) + .ok_or_else(|| DecodeError::Registry(format!("unknown state provider {name}")))?; + *remaining -= 1; + Self::decode(resource, bindings, depth + 1, remaining, catalog) + } else { + Self::decode(json, bindings, depth, remaining, catalog) + } + } + fn decode( + json: &str, + bindings: &StateProviderBindings<'_>, + depth: usize, + remaining: &mut usize, + catalog: Option<&StateProviderCatalog>, + ) -> Result { + if depth > 128 || *remaining == 0 { + return Err(DecodeError::Field("state provider depth")); + } + match ( + bindings.state(json, true), + Self::decode_typed(json, bindings, depth, remaining, catalog), + ) { + (Ok(state), Err(_)) => Ok(Self(Node::Simple(state))), + (Err(_), Ok(provider)) => Ok(provider), + _ => Err(DecodeError::Field("exclusive state or provider")), + } + } + pub fn from_typed_json( + json: &str, + bindings: &StateProviderBindings<'_>, + ) -> Result { + Self::decode_typed(json, bindings, 0, &mut 65536, None) + } + fn decode_typed( + json: &str, + bindings: &StateProviderBindings<'_>, + depth: usize, + remaining: &mut usize, + catalog: Option<&StateProviderCatalog>, + ) -> Result { + if depth > 128 || *remaining == 0 { + return Err(DecodeError::Field("state provider depth")); + } + *remaining -= 1; + let object: Object = serde_json::from_str(json)?; + let kind = identifier(&serde_json::from_str::( + required(&object, "type")?.get(), + )?)?; + Ok(Self(match kind.as_str() { + "minecraft:rule_based" => { + let fallback = optional(&object, "fallback") + .map(|raw| { + Self::decode_holder(raw.get(), bindings, depth + 1, remaining, catalog) + .map(Box::new) + }) + .transpose()?; + let raw_rules: Vec> = + serde_json::from_str(required(&object, "rules")?.get())?; + if raw_rules.len() > 8192 { + return Err(DecodeError::Field("provider rule count")); + } + let mut rules = Vec::with_capacity(raw_rules.len()); + for raw in raw_rules { + if *remaining == 0 { + return Err(DecodeError::Field("provider node count")); + } + *remaining -= 1; + let rule: Object = serde_json::from_str(raw.get())?; + let predicate = BlockPredicate::decode_with_blocks( + required(&rule, "if_true")?.get(), + depth + 1, + remaining, + Some(bindings), + )?; + let provider = Self::decode_holder( + required(&rule, "then")?.get(), + bindings, + depth + 1, + remaining, + catalog, + )?; + rules.push((predicate, provider)); + } + Node::RuleBased { fallback, rules } + } + "minecraft:noise" | "minecraft:noise_threshold" | "minecraft:dual_noise" => { + Node::Noise(Box::new(NoiseProvider::decode(&object, bindings, &kind)?)) + } + "minecraft:simple" => { + Node::Simple(bindings.state(required(&object, "state")?.get(), false)?) + } + "minecraft:weighted" => { + Node::Weighted(WeightedList::decode(required(&object, "entries")?, |v| { + bindings.state(v.get(), false) + })?) + } + "minecraft:random_block" => { + Node::RandomBlock(bindings.block_set(required(&object, "blocks")?)?) + } + "minecraft:rotated" => { + let direction = optional(&object, "direction") + .map(|v| { + let name: String = serde_json::from_str(v.get())?; + DIRECTIONS + .iter() + .position(|v| *v == name) + .ok_or(DecodeError::Field("provider direction")) + }) + .transpose()?; + Node::Rotated { + source: Box::new(Self::decode_holder( + required(&object, "state")?.get(), + bindings, + depth + 1, + remaining, + catalog, + )?), + direction, + rotations: bindings.rotations()?, + } + } + "minecraft:copy_properties" => Node::CopyProperties( + Box::new(Self::decode_holder( + required(&object, "source")?.get(), + bindings, + depth + 1, + remaining, + catalog, + )?), + bindings.properties()?, + ), + "minecraft:randomized_int" => Node::RandomizedInt { + source: Box::new(Self::decode_holder( + required(&object, "source")?.get(), + bindings, + depth + 1, + remaining, + catalog, + )?), + property: serde_json::from_str(required(&object, "property")?.get())?, + values: IntProvider::decode(required(&object, "values")?, depth + 1, remaining)?, + properties: bindings.properties()?, + }, + _ => return Err(DecodeError::Field("block state provider type")), + })) + } + pub fn get_optional_state( + &self, + world: &mut W, + random: &mut impl RandomSource, + position: [i32; 3], + ) -> Result, StateProviderError> { + Ok(match &self.0 { + Node::RuleBased { fallback, rules } => { + for (predicate, provider) in rules { + if predicate + .test(world, position) + .map_err(StateProviderError::Query)? + { + if let Some(state) = provider.get_optional_state(world, random, position)? { + return Ok(Some(state)); + } + } + } + match fallback { + Some(provider) => provider.get_optional_state(world, random, position)?, + None => None, + } + } + Node::Noise(provider) => Some(provider.sample(random, position)?), + Node::Simple(state) => Some(*state), + Node::Weighted(states) => Some(*states.sample(random)?), + Node::RandomBlock(states) => { + if states.is_empty() { + None + } else { + Some(states[random.next_int_bound(states.len() as i32)? as usize]) + } + } + Node::Rotated { + source, + direction, + rotations, + } => { + // Native orientation selection precedes the nested state draw. + let direction = match direction { + Some(value) => *value, + None => random.next_int_bound(6)? as usize, + }; + let state = source.get_state(world, random, position)?; + Some( + rotations + .get(state.0 as usize) + .ok_or(StateProviderError::InvalidState)?[direction], + ) + } + Node::CopyProperties(source, properties) => { + let target = source.get_state(world, random, position)?; + let source = world.block(position).map_err(StateProviderError::World)?; + Some( + properties + .copy(target, source) + .ok_or(StateProviderError::InvalidState)?, + ) + } + Node::RandomizedInt { + source, + property, + values, + properties, + } => { + let state = source.get_state(world, random, position)?; + if properties + .has_integer(state, property) + .ok_or(StateProviderError::InvalidState)? + { + let value = values.sample(random)?; + Some( + properties + .set_integer(state, property, value) + .ok_or(StateProviderError::InvalidPropertyValue)?, + ) + } else { + Some(state) + } + } + }) + } + pub fn get_state( + &self, + world: &mut W, + random: &mut impl RandomSource, + position: [i32; 3], + ) -> Result> { + match self.get_optional_state(world, random, position)? { + Some(state) => Ok(state), + None => world.block(position).map_err(StateProviderError::World), + } + } +} + +/// Bind the pinned registry's full-axis/full-facing/horizontal-facing property +/// families. A five-way facing or two-axis property is a different property and +/// is intentionally left unchanged. Unrelated properties retain their values. +fn rotation_table(registry: &BlockRegistry) -> Result { + let mut values = BTreeMap::<(String, String), BTreeSet>::new(); + for index in 0..registry.len() { + let state = registry.state(BlockStateId(index as u32)).unwrap(); + for name in ["axis", "facing"] { + if let Some(value) = state.properties.get(name) { + values + .entry((state.name.clone(), name.into())) + .or_default() + .insert(value.clone()); + } + } + } + let axis = ["x", "y", "z"].map(str::to_owned).into_iter().collect(); + let facing = DIRECTIONS.map(str::to_owned).into_iter().collect(); + let horizontal = DIRECTIONS[2..].iter().map(|s| (*s).to_owned()).collect(); + let mut result = Vec::with_capacity(registry.len()); + for index in 0..registry.len() { + let state = registry.state(BlockStateId(index as u32)).unwrap(); + let full_axis = values.get(&(state.name.clone(), "axis".into())) == Some(&axis); + let directions = values.get(&(state.name.clone(), "facing".into())); + let mut rotated = [BlockStateId(index as u32); 6]; + for (direction, name) in DIRECTIONS.iter().enumerate() { + let mut value = state.clone(); + if full_axis { + value.properties.insert( + "axis".into(), + ["y", "y", "z", "z", "x", "x"][direction].into(), + ); + } + if directions == Some(&facing) || (direction >= 2 && directions == Some(&horizontal)) { + value.properties.insert("facing".into(), (*name).into()); + } + rotated[direction] = registry + .id(&value) + .ok_or_else(|| "incomplete rotation state registry".to_owned())?; + } + result.push(rotated); + } + Ok(Arc::new(result)) +} diff --git a/crates/horizon-world/src/worldgen/state_provider/catalog.rs b/crates/horizon-world/src/worldgen/state_provider/catalog.rs new file mode 100644 index 000000000..0cda3d1e8 --- /dev/null +++ b/crates/horizon-world/src/worldgen/state_provider/catalog.rs @@ -0,0 +1,55 @@ +//! Immutable resource snapshots for named state-provider holders. +use super::{BlockStateProvider, DecodeError, StateProviderBindings, identifier}; +use serde_json::value::RawValue; +use std::collections::BTreeMap; + +pub struct StateProviderCatalog { + resources: BTreeMap>, +} +impl StateProviderCatalog { + /// Store resources without evaluating unused definitions. Resolving a root + /// validates its reachable providers, including branches not sampled at run + /// time. Cycles and excessive expansion fail the shared depth/work budget. + pub fn from_resources(resources: &BTreeMap) -> Result { + if resources.len() > 8192 { + return Err(DecodeError::Field("state provider resource count")); + } + let mut result = BTreeMap::new(); + for (name, json) in resources { + if result + .insert(identifier(name)?, serde_json::from_str(json)?) + .is_some() + { + return Err(DecodeError::Field("duplicate state provider resource")); + } + } + Ok(Self { resources: result }) + } + pub(super) fn lookup(&self, name: &str) -> Option<&str> { + self.resources.get(name).map(|v| v.get()) + } + /// Decode the holder codec: an inline direct provider or a registry name. + pub fn provider( + &self, + json: &str, + bindings: &StateProviderBindings<'_>, + ) -> Result { + BlockStateProvider::decode_holder(json, bindings, 0, &mut 65536, Some(self)) + } + /// Decode DIRECT_CODEC while allowing nested named holder references. + pub fn direct_provider( + &self, + json: &str, + bindings: &StateProviderBindings<'_>, + ) -> Result { + BlockStateProvider::decode(json, bindings, 0, &mut 65536, Some(self)) + } + /// Decode TYPED_CODEC while allowing nested named holder references. + pub fn typed_provider( + &self, + json: &str, + bindings: &StateProviderBindings<'_>, + ) -> Result { + BlockStateProvider::decode_typed(json, bindings, 0, &mut 65536, Some(self)) + } +} diff --git a/crates/horizon-world/src/worldgen/state_provider/noise.rs b/crates/horizon-world/src/worldgen/state_provider/noise.rs new file mode 100644 index 000000000..ee8b7c460 --- /dev/null +++ b/crates/horizon-world/src/worldgen/state_provider/noise.rs @@ -0,0 +1,231 @@ +use super::{StateProviderBindings, StateProviderError}; +use crate::registry::BlockStateId; +use crate::worldgen::{ + DecodeError, Object, decode_noise, int_range, integer, number_text, required, +}; +use horizon_core::{ + noise::{Noise, NoiseStack}, + random::{LegacyRandom, RandomSource, WorldgenRandom}, +}; +use serde_json::value::RawValue; +#[derive(Clone, Debug)] +pub(super) struct NoiseProvider { + noise: NoiseStack, + scale: f32, + choice: Choice, +} +#[derive(Clone, Debug)] +enum Choice { + States(Vec), + Threshold { + threshold: f32, + chance: f32, + default: BlockStateId, + low: Vec, + high: Vec, + }, + Dual { + states: Vec, + variety: [i32; 2], + slow: NoiseStack, + scale: f32, + }, +} +impl NoiseProvider { + pub fn decode( + object: &Object, + bindings: &StateProviderBindings<'_>, + kind: &str, + ) -> Result { + let seed = long(required(object, "seed")?)?; + let noise = decode_noise(required(object, "noise")?.get())? + .create(&mut WorldgenRandom::new(LegacyRandom::new(seed)))?; + let scale = positive(required(object, "scale")?)?; + let choice = match kind { + "minecraft:noise" => Choice::States(states(required(object, "states")?, bindings)?), + "minecraft:noise_threshold" => Choice::Threshold { + threshold: range(required(object, "threshold")?, -1., 1.)?, + chance: range(required(object, "high_chance")?, 0., 1.)?, + default: bindings.state(required(object, "default_state")?.get(), false)?, + low: states(required(object, "low_states")?, bindings)?, + high: states(required(object, "high_states")?, bindings)?, + }, + "minecraft:dual_noise" => Choice::Dual { + states: states(required(object, "states")?, bindings)?, + variety: variety(required(object, "variety")?)?, + slow: decode_noise(required(object, "slow_noise")?.get())? + .create(&mut WorldgenRandom::new(LegacyRandom::new(seed)))?, + scale: positive(required(object, "slow_scale")?)?, + }, + _ => return Err(DecodeError::Field("noise state provider type")), + }; + Ok(Self { + noise, + scale, + choice, + }) + } + pub fn sample( + &self, + random: &mut impl RandomSource, + p: [i32; 3], + ) -> Result> { + let fast = || { + self.noise.get3( + f64::from(p[0]) * f64::from(self.scale), + f64::from(p[1]) * f64::from(self.scale), + f64::from(p[2]) * f64::from(self.scale), + ) + }; + Ok(match &self.choice { + Choice::States(states) => states[index(fast(), states.len())], + Choice::Threshold { + threshold, + chance, + default, + low, + high, + } => { + if fast() < *threshold { + low[random.next_int_bound(low.len() as i32)? as usize] + } else if random.next_float() < *chance { + high[random.next_int_bound(high.len() as i32)? as usize] + } else { + *default + } + } + Choice::Dual { + states, + variety, + slow, + scale, + } => { + // The slow path intentionally multiplies at float precision. + let sample = |p: [i32; 3]| { + slow.get3( + f64::from(p[0] as f32 * *scale), + f64::from(p[1] as f32 * *scale), + f64::from(p[2] as f32 * *scale), + ) + }; + let fraction = (f64::from(sample(p)) - -1.) / 2.; + let low = f64::from(variety[0]); + let high = f64::from(variety[1] + 1); + let count = (if fraction < 0. { + low + } else if fraction > 1. { + high + } else { + low + fraction * (high - low) + }) as i32; + if count <= 0 { + return Err(StateProviderError::EmptyNoiseSelection); + } + // Every candidate is a pure noise query. Compute just the one + // the final fast-noise lookup selects, avoiding a temporary list. + let selected = index(fast(), count as usize) as i32; + let offset = [ + p[0].wrapping_add(selected.wrapping_mul(54545)), + p[1], + p[2].wrapping_add(selected.wrapping_mul(34234)), + ]; + states[index(sample(offset), states.len())] + } + }) + } +} +fn index(noise: f32, count: usize) -> usize { + (((1.0f32 + noise) / 2.0f32).clamp(0., 0.9999) * count as f32) as usize +} +fn states( + raw: &RawValue, + bindings: &StateProviderBindings<'_>, +) -> Result, DecodeError> { + let values: Vec> = serde_json::from_str(raw.get())?; + if values.is_empty() || values.len() > 8192 { + return Err(DecodeError::Field("noise provider states")); + } + values + .iter() + .map(|v| bindings.state(v.get(), false)) + .collect() +} +fn float(raw: &RawValue) -> Result { + number_text(raw)? + .parse() + .map_err(|_| DecodeError::Field("provider float")) +} +fn positive(raw: &RawValue) -> Result { + let value = float(raw)?; + if value > 0. && value <= f32::MAX { + Ok(value) + } else { + Err(DecodeError::Field("positive provider scale")) + } +} +fn range(raw: &RawValue, low: f32, high: f32) -> Result { + let value = float(raw)?; + if value.total_cmp(&low).is_ge() && value.total_cmp(&high).is_le() { + Ok(value) + } else { + Err(DecodeError::Field("provider float range")) + } +} +fn variety(raw: &RawValue) -> Result<[i32; 2], DecodeError> { + let range = if let Ok(value) = integer(raw) { + [value, value] + } else if let Ok(values) = serde_json::from_str::>>(raw.get()) { + if values.len() != 2 { + return Err(DecodeError::Field("provider variety")); + } + [integer(&values[0])?, integer(&values[1])?] + } else { + let object: Object = serde_json::from_str(raw.get())?; + [ + int_range(required(&object, "min_inclusive")?, "variety", 1, 64)?, + int_range(required(&object, "max_inclusive")?, "variety", 1, 64)?, + ] + }; + if range[0] < 1 || range[1] > 64 || range[0] > range[1] { + Err(DecodeError::Field("provider variety")) + } else { + Ok(range) + } +} +// Gson's LONG codec truncates decimal tokens and retains the low 64 bits. +fn long(raw: &RawValue) -> Result { + let text = number_text(raw)?; + let negative = text.starts_with('-'); + let text = text.strip_prefix('-').unwrap_or(text); + let (mantissa, exponent) = match text.split_once(['e', 'E']) { + Some((m, e)) => ( + m, + e.parse::() + .map_err(|_| DecodeError::Field("long exponent"))? as i64, + ), + None => (text, 0), + }; + let (whole, fraction) = mantissa.split_once('.').unwrap_or((mantissa, "")); + let length = whole.len() as i64 + exponent; + if length <= 0 { + return Ok(0); + } + let zeroes = (length - (whole.len() + fraction.len()) as i64).max(0); + if zeroes >= 64 { + return Ok(0); + } + let mut result = 0u64; + for digit in whole.bytes().chain(fraction.bytes()).take(length as usize) { + result = result + .wrapping_mul(10) + .wrapping_add(u64::from(digit - b'0')); + } + for _ in 0..zeroes { + result = result.wrapping_mul(10); + } + Ok(if negative { + result.wrapping_neg() + } else { + result + } as i64) +} diff --git a/crates/horizon-world/src/worldgen/state_provider/properties.rs b/crates/horizon-world/src/worldgen/state_provider/properties.rs new file mode 100644 index 000000000..ee8389401 --- /dev/null +++ b/crates/horizon-world/src/worldgen/state_provider/properties.rs @@ -0,0 +1,178 @@ +//! Compact property transitions derived from the pinned Cartesian state tables. +use crate::registry::{BlockRegistry, BlockStateId}; +use std::collections::{BTreeMap, BTreeSet}; +#[derive(Clone, Copy, Debug)] +struct Address { + block: usize, + local: usize, +} +#[derive(Debug)] +struct Property { + identity: usize, + name: String, + values: Vec, + lookup: BTreeMap, + numeric: Option>, + stride: usize, +} +#[derive(Debug)] +struct Block { + states: Vec, + properties: Vec, +} +#[derive(Debug)] +pub(super) struct StateProperties { + blocks: Vec, + addresses: Vec

, +} +impl StateProperties { + pub fn build( + registry: &BlockRegistry, + integers: &BTreeSet<(String, String)>, + ) -> Result { + let mut grouped = BTreeMap::>::new(); + for index in 0..registry.len() { + let id = BlockStateId(index as u32); + grouped + .entry(registry.state(id).unwrap().name.clone()) + .or_default() + .push(id); + } + let mut identities = BTreeMap::new(); + let mut result = Self { + blocks: Vec::new(), + addresses: vec![Address { block: 0, local: 0 }; registry.len()], + }; + for (name, states) in grouped { + let mut properties = Vec::new(); + let first = registry.state(states[0]).unwrap(); + for (property, initial) in &first.properties { + let mut values = Vec::new(); + let mut lookup = BTreeMap::new(); + let mut stride = None; + for (index, id) in states.iter().enumerate() { + let state = registry.state(*id).unwrap(); + if state.properties.len() != first.properties.len() { + return Err("inconsistent block properties".into()); + } + let value = state + .properties + .get(property) + .ok_or("missing block property")?; + if value != initial && stride.is_none() { + stride = Some(index); + } + if !lookup.contains_key(value) { + lookup.insert(value.clone(), values.len()); + values.push(value.clone()); + } + } + let stride = stride.unwrap_or(1); + for (index, id) in states.iter().enumerate() { + if registry.state(*id).unwrap().properties[property] + != values[(index / stride) % values.len()] + { + return Err("non-Cartesian property state order".into()); + } + } + let integer = integers.contains(&(name.clone(), property.clone())); + // In the pinned registry these signatures uniquely identify + // Java Property.equals families; the native harness checks this. + let signature = ( + property.clone(), + integer, + lookup.keys().cloned().collect::>(), + ); + let next = identities.len(); + let identity = *identities.entry(signature).or_insert(next); + let numeric = if integer { + Some( + values + .iter() + .enumerate() + .map(|(i, s)| { + s.parse::() + .map(|v| (v, i)) + .map_err(|_| "invalid integer property".to_owned()) + }) + .collect::>()?, + ) + } else { + None + }; + properties.push(Property { + identity, + name: property.clone(), + values, + lookup, + numeric, + stride, + }); + } + let mut dimensions = properties + .iter() + .filter(|p| p.values.len() > 1) + .collect::>(); + dimensions.sort_by_key(|p| p.stride); + let mut size = 1usize; + for p in dimensions { + if p.stride != size { + return Err("overlapping property state dimensions".into()); + } + size = size + .checked_mul(p.values.len()) + .ok_or("property state size overflow")?; + } + if size != states.len() { + return Err("incomplete Cartesian state table".into()); + } + for (local, id) in states.iter().enumerate() { + result.addresses[id.0 as usize] = Address { + block: result.blocks.len(), + local, + }; + } + result.blocks.push(Block { states, properties }); + } + Ok(result) + } + pub fn copy(&self, target: BlockStateId, source: BlockStateId) -> Option { + let mut target = *self.addresses.get(target.0 as usize)?; + let source = *self.addresses.get(source.0 as usize)?; + let block = &self.blocks[target.block]; + for source_property in &self.blocks[source.block].properties { + if let Some(property) = block + .properties + .iter() + .find(|p| p.identity == source_property.identity) + { + let value = &source_property.values + [(source.local / source_property.stride) % source_property.values.len()]; + let index = *property.lookup.get(value)?; + let previous = (target.local / property.stride) % property.values.len(); + target.local = target.local - previous * property.stride + index * property.stride; + } + } + block.states.get(target.local).copied() + } + pub fn has_integer(&self, state: BlockStateId, name: &str) -> Option { + let address = self.addresses.get(state.0 as usize)?; + Some( + self.blocks[address.block] + .properties + .iter() + .any(|p| p.name == name && p.numeric.is_some()), + ) + } + pub fn set_integer(&self, state: BlockStateId, name: &str, value: i32) -> Option { + let address = self.addresses.get(state.0 as usize)?; + let block = &self.blocks[address.block]; + let property = block.properties.iter().find(|p| p.name == name)?; + let index = property.numeric.as_ref()?.get(&value)?; + let previous = (address.local / property.stride) % property.values.len(); + block + .states + .get(address.local - previous * property.stride + index * property.stride) + .copied() + } +} diff --git a/crates/horizon-world/src/worldgen/tags.rs b/crates/horizon-world/src/worldgen/tags.rs new file mode 100644 index 000000000..6cc94a467 --- /dev/null +++ b/crates/horizon-world/src/worldgen/tags.rs @@ -0,0 +1,369 @@ +//! Version-pinned tag codecs, resource-stack merging and dependency resolution. +use super::{DecodeError, Object, optional, required}; +use horizon_core::random::java_string_hash; +use serde_json::value::RawValue; +use std::collections::{BTreeMap, BTreeSet}; + +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct TagEntry { + pub id: String, + pub tag: bool, + pub required: bool, +} +impl TagEntry { + pub fn from_json(json: &str) -> Result { + let raw: Box = serde_json::from_str(json)?; + let (name, mandatory) = if raw.get().starts_with('"') { + (serde_json::from_str::(raw.get())?, true) + } else { + let object: Object = serde_json::from_str(raw.get())?; + ( + serde_json::from_str(required(&object, "id")?.get())?, + optional(&object, "required") + .map(|v| serde_json::from_str(v.get())) + .transpose()? + .unwrap_or(true), + ) + }; + let (tag, name) = name + .strip_prefix('#') + .map_or((false, name.as_str()), |s| (true, s)); + Ok(Self { + id: identifier(name)?, + tag, + required: mandatory, + }) + } + pub fn display(&self) -> String { + format!( + "{}{}{}", + if self.tag { "#" } else { "" }, + self.id, + if self.required { "" } else { "?" } + ) + } +} +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct TagFile { + pub entries: Vec, + pub replace: bool, +} +impl TagFile { + pub fn from_json(json: &str) -> Result { + let object: Object = serde_json::from_str(json)?; + let values: Vec> = serde_json::from_str(required(&object, "values")?.get())?; + let entries = values + .iter() + .map(|v| TagEntry::from_json(v.get())) + .collect::>()?; + let replace = optional(&object, "replace") + .map(|v| serde_json::from_str(v.get())) + .transpose()? + .unwrap_or(false); + Ok(Self { entries, replace }) + } +} +// Identifier.CODEC permits the empty path as well as an omitted namespace. +pub(super) fn identifier(name: &str) -> Result { + let (namespace, path) = name.split_once(':').unwrap_or(("minecraft", name)); + let namespace = if namespace.is_empty() { + "minecraft" + } else { + namespace + }; + let valid = |c: u8| c.is_ascii_lowercase() || c.is_ascii_digit() || b"_.-".contains(&c); + if !namespace.bytes().all(valid) || !path.bytes().all(|c| valid(c) || c == b'/') { + return Err(DecodeError::Registry(format!( + "invalid tag identifier: {name}" + ))); + } + Ok(format!("{namespace}:{path}")) +} +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct TagEntryWithSource { + pub entry: TagEntry, + pub source: String, +} +#[derive(Clone, Debug, Default)] +pub struct TagDefinitions { + entries: BTreeMap>, + insertion_order: Vec, +} +#[derive(Clone, Debug)] +pub struct BuiltTags { + pub tags: BTreeMap>, + pub missing: BTreeMap>, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum TagBuildError { + TooManyTags, + DependencyDepth, + HashTreeBucket, +} +impl std::fmt::Display for TagBuildError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(match self { + Self::TooManyTags => "tag definitions exceed 8192 entries", + Self::DependencyDepth => { + "tag dependency depth exceeds 256 or cyclic reachability does not terminate" + } + Self::HashTreeBucket => "tag identifiers require an unsupported Java hash tree bucket", + }) + } +} +impl std::error::Error for TagBuildError {} +impl TagDefinitions { + /// Apply resources in their pack priority order. A successfully decoded + /// replace file clears earlier entries; a rejected file changes nothing. + pub fn add(&mut self, name: &str, source: &str, file: TagFile) -> Result<(), DecodeError> { + let name = identifier(name)?; + if !self.entries.contains_key(&name) { + self.insertion_order.push(name.clone()); + } + let entries = self.entries.entry(name).or_default(); + if file.replace { + entries.clear(); + } + entries.extend(file.entries.into_iter().map(|entry| TagEntryWithSource { + entry, + source: source.into(), + })); + Ok(()) + } + /// A valid JSON resource with a codec error still creates an empty tag in + /// vanilla's resource loader; existing entries are retained on that error. + pub fn apply_json(&mut self, name: &str, source: &str, json: &str) -> Result<(), DecodeError> { + let _: Box = serde_json::from_str(json)?; + let name = identifier(name)?; + if !self.entries.contains_key(&name) { + self.insertion_order.push(name.clone()); + self.entries.insert(name.clone(), Vec::new()); + } + self.add(&name, source, TagFile::from_json(json)?) + } + pub fn definitions(&self) -> &BTreeMap> { + &self.entries + } + /// Missing required references invalidate their own tags, not unrelated tags. + /// Element lookup receives the entry's required flag, as in vanilla. + pub fn build( + &self, + mut lookup: impl FnMut(&str, bool) -> Option, + ) -> Result, TagBuildError> { + if self.entries.len() > 8192 { + return Err(TagBuildError::TooManyTags); + } + // DependencySorter owns a fresh default-sized HashMap. Required edges + // are inserted for every tag before any optional edge is considered. + // The resource loader creates keys with HashMap.computeIfAbsent, + // which inserts at the head of a bucket. DependencySorter then copies + // that map with put (tail insertion), retaining the reversed order of + // colliding resource keys. Resizing preserves each split chain's order. + let order = java_bucket_order(self.insertion_order.iter().rev().map(String::as_str), 16)?; + let mut edges: BTreeMap<&str, Vec<&str>> = BTreeMap::new(); + for mandatory in [true, false] { + for &name in &order { + for entry in &self.entries[name] { + let e = &entry.entry; + if e.tag && e.required == mandatory && !reaches(&edges, &e.id, name, 0)? { + let children = edges.entry(name).or_default(); + if !children.contains(&e.id.as_str()) { + children.push(&e.id); + } + } + } + } + } + // Guava HashMultimap value sets start with capacity four (two expected + // values). Their native bucket order matters when cycles are pruned. + let edges = edges + .into_iter() + .map(|(key, children)| Ok((key, java_bucket_order(children, 4)?))) + .collect::, TagBuildError>>()?; + let mut visited = BTreeSet::new(); + let mut sorted = Vec::new(); + for name in order { + visit(name, &edges, &mut visited, &mut sorted, 0)?; + } + let mut result: BuiltTags = BuiltTags { + tags: BTreeMap::new(), + missing: BTreeMap::new(), + }; + for name in sorted { + let Some(entries) = self.entries.get(name) else { + continue; + }; + let mut seen = BTreeSet::new(); + let mut values = Vec::new(); + let mut missing = Vec::new(); + for sourced in entries { + let entry = &sourced.entry; + if entry.tag { + if let Some(children) = result.tags.get(&entry.id) { + for value in children { + if seen.insert(value.clone()) { + values.push(value.clone()); + } + } + } else if entry.required { + missing.push(sourced.clone()); + } + } else if let Some(value) = lookup(&entry.id, entry.required) { + if seen.insert(value.clone()) { + values.push(value); + } + } else if entry.required { + missing.push(sourced.clone()); + } + } + if missing.is_empty() { + result.tags.insert(name.into(), values); + } else { + result.missing.insert(name.into(), missing); + } + } + Ok(result) + } +} +fn reaches( + edges: &BTreeMap<&str, Vec<&str>>, + from: &str, + target: &str, + depth: usize, +) -> Result { + if depth > 256 { + return Err(TagBuildError::DependencyDepth); + } + if let Some(children) = edges.get(from) { + if children.contains(&target) { + return Ok(true); + } + for child in children { + if reaches(edges, child, target, depth + 1)? { + return Ok(true); + } + } + } + Ok(false) +} +fn visit<'a>( + name: &'a str, + edges: &BTreeMap<&'a str, Vec<&'a str>>, + visited: &mut BTreeSet<&'a str>, + sorted: &mut Vec<&'a str>, + depth: usize, +) -> Result<(), TagBuildError> { + if !visited.insert(name) { + return Ok(()); + } + if depth > 256 { + return Err(TagBuildError::DependencyDepth); + } + if let Some(children) = edges.get(name) { + for child in children { + visit(child, edges, visited, sorted, depth + 1)?; + } + } + sorted.push(name); + Ok(()) +} +fn hash(name: &str) -> u32 { + let (namespace, path) = name.split_once(':').expect("canonical tag identifier"); + let raw = java_string_hash(namespace.encode_utf16()) + .wrapping_mul(31) + .wrapping_add(java_string_hash(path.encode_utf16())) as u32; + raw ^ (raw >> 16) +} +fn java_bucket_order<'a>( + names: impl IntoIterator, + initial: usize, +) -> Result, TagBuildError> { + let names: Vec<_> = names.into_iter().collect(); + let mut capacity = initial; + for count in 1..=names.len() { + let bucket = hash(names[count - 1]) as usize & (capacity - 1); + let collisions = names[..count] + .iter() + .filter(|name| hash(name) as usize & (capacity - 1) == bucket) + .count(); + if collisions >= 9 { + if capacity < 64 { + capacity *= 2; + } else { + return Err(TagBuildError::HashTreeBucket); + } + } + if count > capacity * 3 / 4 { + capacity *= 2; + } + } + let mut ordered = names; + ordered.sort_by_key(|name| hash(name) as usize & (capacity - 1)); + Ok(ordered) +} + +#[cfg(test)] +mod tests { + use super::*; + #[test] + fn invalid_replacement_keeps_entries_and_codec_error_can_create_empty_tag() { + let mut definitions = TagDefinitions::default(); + definitions + .apply_json("a", "first", r##"{"values":["one","two","one"]}"##) + .unwrap(); + assert!( + definitions + .apply_json("a", "bad", r##"{"replace":true,"values":[false]}"##) + .is_err() + ); + assert!(definitions.apply_json("empty", "bad", "{}").is_err()); + assert!(definitions.apply_json("syntax", "bad", "{").is_err()); + let built = definitions.build(|id, _| Some(id.to_owned())).unwrap(); + assert_eq!( + built.tags["minecraft:a"], + vec!["minecraft:one", "minecraft:two"] + ); + assert_eq!(built.tags["minecraft:empty"], Vec::::new()); + assert!(!built.tags.contains_key("minecraft:syntax")); + definitions + .apply_json( + "a", + "replacement", + r##"{"replace":true,"values":["three"]}"##, + ) + .unwrap(); + let built = definitions.build(|id, _| Some(id.to_owned())).unwrap(); + assert_eq!(built.tags["minecraft:a"], vec!["minecraft:three"]); + } + #[test] + fn required_edges_precede_optional_edges_and_missing_tags_do_not_poison_siblings() { + let mut definitions = TagDefinitions::default(); + for (name, json) in [ + ("a", r##"{"values":[{"id":"#b","required":false},"one"]}"##), + ("b", r##"{"values":["#a","two"]}"##), + ("bad", r##"{"values":["absent","also_absent"]}"##), + ( + "c", + r##"{"values":[{"id":"#bad","required":false},"two"]}"##, + ), + ] { + definitions.apply_json(name, "fixture", json).unwrap(); + } + let built = definitions + .build(|id, _| (!id.ends_with("absent")).then(|| id.to_owned())) + .unwrap(); + assert_eq!(built.tags["minecraft:a"], vec!["minecraft:one"]); + assert_eq!( + built.tags["minecraft:b"], + vec!["minecraft:one", "minecraft:two"] + ); + assert_eq!(built.tags["minecraft:c"], vec!["minecraft:two"]); + assert_eq!( + built.missing["minecraft:bad"] + .iter() + .map(|e| e.entry.id.as_str()) + .collect::>(), + vec!["minecraft:absent", "minecraft:also_absent"] + ); + } +} diff --git a/crates/horizon-world/src/worldgen/terrain.rs b/crates/horizon-world/src/worldgen/terrain.rs new file mode 100644 index 000000000..9daf04cb7 --- /dev/null +++ b/crates/horizon-world/src/worldgen/terrain.rs @@ -0,0 +1,479 @@ +//! Noise-stage chunk filling. Material rules, structures and chunk lifecycle are +//! separate stages; this module does not produce a complete generated chunk. +use super::aquifer::{ + AquiferBlockStates, AquiferError, DisabledAquifer, FluidPicker, NoiseBasedAquifer, +}; +use crate::{ + chunk::BlockSection, + heightmap::{Heightmap, HeightmapChunk, HeightmapError, HeightmapState, HeightmapType}, + registry::{BlockRegistry, BlockStateId}, +}; +use horizon_core::{ + density::{DensitySampler, SampleError, SamplerContext}, + noise::DensityVolume, + position::ChunkPos, + random::PositionalRandom, +}; +use std::io; + +/// Behavior and resolved tags for every state in the chunk's immutable registry. +pub trait TerrainBlockStates { + type State: HeightmapState; + fn heightmap_state(&self, id: BlockStateId) -> Self::State; +} + +pub trait TerrainAquifer { + fn compute_substance( + &mut self, + context: &mut SamplerContext, + position: [i32; 3], + density: f64, + ) -> Result, AquiferError>; + fn should_schedule_fluid_update(&self) -> bool; +} +impl TerrainAquifer for DisabledAquifer

{ + fn compute_substance( + &mut self, + _: &mut SamplerContext, + position: [i32; 3], + density: f64, + ) -> Result, AquiferError> { + Ok(DisabledAquifer::compute_substance(self, position, density)) + } + fn should_schedule_fluid_update(&self) -> bool { + false + } +} +impl TerrainAquifer + for NoiseBasedAquifer +{ + fn compute_substance( + &mut self, + context: &mut SamplerContext, + position: [i32; 3], + density: f64, + ) -> Result, AquiferError> { + NoiseBasedAquifer::compute_substance(self, context, position, density) + } + fn should_schedule_fluid_update(&self) -> bool { + NoiseBasedAquifer::should_schedule_fluid_update(self) + } +} + +#[derive(Debug)] +pub enum TerrainError { + Storage(io::Error), + Heightmap(HeightmapError), + Sample(SampleError), + Aquifer(AquiferError), + MissingAir, + InvalidState, + InvalidVolume, + OutsideBuildHeight, +} +impl std::fmt::Display for TerrainError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{self:?}") + } +} +impl std::error::Error for TerrainError {} +impl From for TerrainError { + fn from(value: io::Error) -> Self { + Self::Storage(value) + } +} +impl From for TerrainError { + fn from(value: HeightmapError) -> Self { + Self::Heightmap(value) + } +} +impl From for TerrainError { + fn from(value: SampleError) -> Self { + Self::Sample(value) + } +} +impl From for TerrainError { + fn from(value: AquiferError) -> Self { + Self::Aquifer(value) + } +} + +/// Resident registry-backed sections, optional heightmaps and ordered per-section +/// fluid postprocessing offsets for the noise and surface generation stages. +pub struct TerrainChunk<'r, B: TerrainBlockStates> { + stage: PreLightChunkStage, + position: ChunkPos, + blocks: TerrainBlocks<'r, B>, + heightmaps: [Option; 6], + postprocessing: Vec>, +} +/// The persisted generation statuses before lighting initialization. This models +/// their block-write heightmap selection, not scheduling or persisted metadata. +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +pub enum PreLightChunkStage { + #[default] + Empty, + StructureStarts, + StructureReferences, + Biomes, + Terrain, + Features, +} +impl PreLightChunkStage { + pub const ALL: [Self; 6] = [ + Self::Empty, + Self::StructureStarts, + Self::StructureReferences, + Self::Biomes, + Self::Terrain, + Self::Features, + ]; + pub fn name(self) -> &'static str { + match self { + Self::Empty => "empty", + Self::StructureStarts => "structure_starts", + Self::StructureReferences => "structure_references", + Self::Biomes => "biomes", + Self::Terrain => "terrain", + Self::Features => "features", + } + } + pub fn heightmaps(self) -> &'static [HeightmapType] { + if matches!(self, Self::Terrain | Self::Features) { + &[ + HeightmapType::WorldSurface, + HeightmapType::OceanFloor, + HeightmapType::MotionBlocking, + HeightmapType::MotionBlockingNoLeaves, + ] + } else { + &[HeightmapType::WorldSurfaceWg, HeightmapType::OceanFloorWg] + } + } +} +struct TerrainBlocks<'r, B: TerrainBlockStates> { + min_y: i32, + height: i32, + sections: Vec>, + non_air: Vec, + registry: &'r BlockRegistry, + properties: B, + air: BlockStateId, + void_air: BlockStateId, +} +impl HeightmapChunk for TerrainBlocks<'_, B> { + type State = B::State; + fn min_y(&self) -> i32 { + self.min_y + } + fn height(&self) -> i32 { + self.height + } + fn highest_section_y(&self) -> i32 { + self.non_air + .iter() + .rposition(|&count| count != 0) + .map_or(self.min_y, |i| self.min_y + i as i32 * 16) + } + fn block_state(&self, x: i32, y: i32, z: i32) -> B::State { + self.properties.heightmap_state(self.block(x, y, z)) + } +} +impl TerrainBlocks<'_, B> { + fn section_index(&self, y: i32) -> Option { + let dy = i64::from(y) - i64::from(self.min_y); + (dy >= 0 && dy < i64::from(self.height)).then_some((dy >> 4) as usize) + } + fn block(&self, x: i32, y: i32, z: i32) -> BlockStateId { + let Some(section) = self.section_index(y) else { + return self.void_air; + }; + if self.non_air[section] == 0 { + return self.air; + } + self.sections[section] + .get(local_index(x, y, z)) + .expect("valid section coordinates") + } +} +fn local_index(x: i32, y: i32, z: i32) -> usize { + (((y & 15) << 8) | ((z & 15) << 4) | (x & 15)) as usize +} + +impl<'r, B: TerrainBlockStates> TerrainChunk<'r, B> { + pub fn new( + position: ChunkPos, + min_y: i32, + height: i32, + registry: &'r BlockRegistry, + properties: B, + ) -> Result { + // Share the heightmap's supported range and fail before allocating sections. + Heightmap::new(HeightmapType::WorldSurfaceWg, min_y, height)?; + let air = registry + .default_state("minecraft:air") + .ok_or(TerrainError::MissingAir)?; + let void_air = registry + .default_state("minecraft:void_air") + .ok_or(TerrainError::MissingAir)?; + let section_count = (height / 16) as usize; + let sections = (0..section_count) + .map(|_| BlockSection::uniform(air, registry)) + .collect::>>()?; + Ok(Self { + stage: PreLightChunkStage::Empty, + position, + blocks: TerrainBlocks { + min_y, + height, + sections, + non_air: vec![0; section_count], + registry, + properties, + air, + void_air, + }, + heightmaps: std::array::from_fn(|_| None), + postprocessing: vec![Vec::new(); section_count], + }) + } + pub(crate) fn registry(&self) -> &BlockRegistry { + self.blocks.registry + } + pub fn highest_filled_section_index(&self) -> Option { + self.blocks.non_air.iter().rposition(|&count| count != 0) + } + pub fn block_properties(&self, state: BlockStateId) -> B::State { + self.blocks.properties.heightmap_state(state) + } + pub fn same_block(&self, left: BlockStateId, right: BlockStateId) -> bool { + self.blocks + .registry + .state(left) + .zip(self.blocks.registry.state(right)) + .is_some_and(|(left, right)| left.name == right.name) + } + pub fn generation_stage(&self) -> PreLightChunkStage { + self.stage + } + /// Changing status alone does not prime or clear any heightmaps. Native + /// persisted-status assignment also permits earlier statuses. + pub fn set_generation_stage(&mut self, stage: PreLightChunkStage) { + self.stage = stage; + } + /// ProtoChunk writes before lighting. The current stage selects heightmaps; + /// missing maps are primed after existing maps are updated. + pub fn set_block_worldgen( + &mut self, + x: i32, + y: i32, + z: i32, + state: BlockStateId, + ) -> Result { + let Some(section) = self.blocks.section_index(y) else { + return Ok(self.blocks.void_air); + }; + if self.blocks.non_air[section] == 0 && state == self.blocks.air { + return Ok(state); + } + let previous = self.set_block_raw(x, y, z, state)?; + let mut missing = Vec::new(); + for &kind in self.stage.heightmaps() { + if self.heightmap(kind).is_some() { + self.update_heightmap(kind, x & 15, y, z & 15, state)?; + } else { + missing.push(kind); + } + } + if !missing.is_empty() { + self.prime_heightmaps(&missing)?; + } + Ok(previous) + } + pub fn position(&self) -> ChunkPos { + self.position + } + pub fn min_y(&self) -> i32 { + self.blocks.min_y + } + pub fn height(&self) -> i32 { + self.blocks.height + } + pub fn highest_section_y(&self) -> i32 { + self.blocks.highest_section_y() + } + /// ProtoChunk reads collapse an all-air section to its default AIR state. + pub fn block(&self, x: i32, y: i32, z: i32) -> BlockStateId { + self.blocks.block(x, y, z) + } + pub fn section(&self, index: usize) -> Option<&BlockSection<'r>> { + self.blocks.sections.get(index) + } + pub fn heightmap(&self, kind: HeightmapType) -> Option<&Heightmap> { + self.heightmaps[kind as usize].as_ref() + } + pub fn postprocessing(&self) -> &[Vec] { + &self.postprocessing + } + + pub fn ensure_heightmap(&mut self, kind: HeightmapType) -> &mut Heightmap { + self.heightmaps[kind as usize].get_or_insert_with(|| { + Heightmap::new(kind, self.blocks.min_y, self.blocks.height) + .expect("validated chunk range") + }) + } + /// Section write only. The caller chooses which generation-stage maps to update. + pub fn set_block_raw( + &mut self, + x: i32, + y: i32, + z: i32, + state: BlockStateId, + ) -> Result { + let section = self + .blocks + .section_index(y) + .ok_or(TerrainError::OutsideBuildHeight)?; + let old = self.blocks.sections[section].set(local_index(x, y, z), state)?; + let old_air = self.blocks.properties.heightmap_state(old).is_air(); + let new_air = self.blocks.properties.heightmap_state(state).is_air(); + if old_air && !new_air { + self.blocks.non_air[section] += 1; + } else if !old_air && new_air { + self.blocks.non_air[section] -= 1; + } + Ok(old) + } + pub fn update_heightmap( + &mut self, + kind: HeightmapType, + x: i32, + y: i32, + z: i32, + state: BlockStateId, + ) -> Result { + if self.blocks.registry.state(state).is_none() { + return Err(TerrainError::InvalidState); + } + self.ensure_heightmap(kind); + let state = self.blocks.properties.heightmap_state(state); + Ok(self.heightmaps[kind as usize] + .as_mut() + .unwrap() + .update(&self.blocks, x, y, z, state)?) + } + pub fn prime_heightmaps(&mut self, kinds: &[HeightmapType]) -> Result<(), TerrainError> { + let mut order = Vec::new(); + for &kind in kinds { + self.ensure_heightmap(kind); + if !order.contains(&(kind as usize)) { + order.push(kind as usize); + } + } + // Split references preserve the supplied set's iteration order. + let mut maps: Vec<_> = self + .heightmaps + .iter_mut() + .enumerate() + .filter_map(|(i, map)| { + order + .iter() + .position(|&key| key == i) + .map(|position| (position, map.as_mut().unwrap())) + }) + .collect(); + maps.sort_by_key(|(position, _)| *position); + Heightmap::prime( + &self.blocks, + &mut maps.into_iter().map(|(_, map)| map).collect::>(), + )?; + Ok(()) + } + pub fn set_heightmap_raw( + &mut self, + kind: HeightmapType, + words: &[u64], + ) -> Result<(), TerrainError> { + self.ensure_heightmap(kind); + self.heightmaps[kind as usize] + .as_mut() + .unwrap() + .set_raw_data(&self.blocks, words)?; + Ok(()) + } + /// Preserves duplicates and insertion order, as ProtoChunk does. + pub fn mark_postprocessing(&mut self, x: i32, y: i32, z: i32) { + if let Some(section) = self.blocks.section_index(y) { + self.postprocessing[section] + .push(((x & 15) | ((y & 15) << 4) | ((z & 15) << 8)) as u16); + } + } +} + +/// Evaluate final density in bulk before writes, then visit Z/X/descending Y. +/// The aquifer and final density must share this already prepared sampler context. +/// Failures retain earlier writes and aquifer/cache state; there is no rollback. +/// Regular gameplay only: developer preliminary-surface markers are not applied. +pub fn fill_noise( + chunk: &mut TerrainChunk<'_, B>, + volume: DensityVolume, + final_density: &dyn DensitySampler, + context: &mut SamplerContext, + aquifer: &mut (impl TerrainAquifer + ?Sized), + default_block: BlockStateId, +) -> Result<(), TerrainError> { + let [sx, sy, sz] = volume.sizes(); + let [bx, by, bz] = volume.minimum(); + if sx != 16 + || sz != 16 + || volume.steps() != [1; 3] + || bx != chunk.position.x.wrapping_shl(4) + || bz != chunk.position.z.wrapping_shl(4) + || by < chunk.min_y() + || i64::from(by) + sy as i64 > i64::from(chunk.min_y()) + i64::from(chunk.height()) + || chunk.blocks.registry.state(default_block).is_none() + { + return Err(TerrainError::InvalidVolume); + } + chunk.ensure_heightmap(HeightmapType::OceanFloorWg); + chunk.ensure_heightmap(HeightmapType::WorldSurfaceWg); + let mut density = vec![0.; volume.size()]; + final_density.sample_volume(context, &mut density, volume)?; + for z in 0..sz { + let world_z = bz.wrapping_add(z as i32); + for x in 0..sx { + let world_x = bx.wrapping_add(x as i32); + for y in (0..sy).rev() { + let world_y = by.wrapping_add(y as i32); + let value = density[volume.index([x, y, z]).expect("valid density coordinates")]; + let state = aquifer + .compute_substance(context, [world_x, world_y, world_z], f64::from(value))? + .unwrap_or(default_block); + if state == chunk.blocks.air { + continue; + } + chunk.set_block_raw(x as i32, world_y, z as i32, state)?; + chunk.update_heightmap( + HeightmapType::OceanFloorWg, + x as i32, + world_y, + z as i32, + state, + )?; + chunk.update_heightmap( + HeightmapType::WorldSurfaceWg, + x as i32, + world_y, + z as i32, + state, + )?; + if aquifer.should_schedule_fluid_update() + && chunk.blocks.properties.heightmap_state(state).has_fluid() + { + chunk.mark_postprocessing(world_x, world_y, world_z); + } + } + } + } + Ok(()) +} diff --git a/crates/horizon-world/src/worldgen/value_provider.rs b/crates/horizon-world/src/worldgen/value_provider.rs new file mode 100644 index 000000000..27bc8d4ae --- /dev/null +++ b/crates/horizon-world/src/worldgen/value_provider.rs @@ -0,0 +1,215 @@ +//! Scalar distributions used by cave/canyon definitions. Gaussian providers +//! remain separate work; this module does not yet cover every provider. +use super::weighted::WeightedList; +use super::{DecodeError, Object, density::identifier, integer, number_text, required}; +use horizon_core::random::{InvalidBound, RandomSource}; +use serde_json::value::RawValue; + +#[derive(Clone, Debug)] +pub enum FloatProvider { + Constant(f32), + Uniform { min: f32, max: f32 }, + Trapezoid { min: f32, max: f32, plateau: f32 }, +} +impl FloatProvider { + pub fn from_json(json: &str) -> Result { + let raw: Box = serde_json::from_str(json)?; + if let Ok(value) = float(&raw) { + return Ok(Self::Constant(if value == 0. { 0. } else { value })); + } + let object: Object = serde_json::from_str(raw.get())?; + let field = |name| required(&object, name).and_then(float); + match kind(&object)?.as_str() { + "minecraft:constant" => { + let value = field("value")?; + Ok(Self::Constant(if value == 0. { 0. } else { value })) + } + "minecraft:uniform" => { + let (min, max) = (field("min_inclusive")?, field("max_exclusive")?); + if max <= min { + return Err(DecodeError::Field("uniform float bounds")); + } + Ok(Self::Uniform { min, max }) + } + "minecraft:trapezoid" => { + let (min, max, plateau) = (field("min")?, field("max")?, field("plateau")?); + if max < min || plateau > max - min { + return Err(DecodeError::Field("trapezoid float bounds")); + } + Ok(Self::Trapezoid { min, max, plateau }) + } + _ => Err(DecodeError::Field("float provider type")), + } + } + pub fn bounds(&self) -> [f32; 2] { + match *self { + Self::Constant(value) => [value; 2], + Self::Uniform { min, max } | Self::Trapezoid { min, max, .. } => [min, max], + } + } + pub fn sample(&self, random: &mut impl RandomSource) -> f32 { + match *self { + Self::Constant(value) => value, + Self::Uniform { min, max } => random.next_float() * (max - min) + min, + Self::Trapezoid { min, max, plateau } => { + let range = max - min; + let slope = (range - plateau) / 2.; + let middle = range - slope; + (min + random.next_float() * middle) + random.next_float() * slope + } + } + } +} + +#[derive(Clone, Debug)] +pub enum IntProvider { + Weighted(WeightedList), + Constant(i32), + Uniform { + min: i32, + max: i32, + }, + BiasedToBottom { + min: i32, + max: i32, + }, + VeryBiasedToBottom { + min: i32, + max: i32, + }, + Trapezoid { + min: i32, + max: i32, + plateau: i32, + }, + Clamped { + source: Box, + min: i32, + max: i32, + }, +} +impl IntProvider { + pub fn from_json(json: &str) -> Result { + let raw: Box = serde_json::from_str(json)?; + Self::decode(&raw, 0, &mut 65536) + } + pub(crate) fn decode( + raw: &RawValue, + depth: usize, + remaining: &mut usize, + ) -> Result { + if depth > 256 || *remaining == 0 { + return Err(DecodeError::Field("integer provider depth")); + } + *remaining -= 1; + if let Ok(value) = integer(raw) { + return Ok(Self::Constant(value)); + } + let object: Object = serde_json::from_str(raw.get())?; + let kind = kind(&object)?; + let field = |name| required(&object, name).and_then(integer); + if kind == "minecraft:constant" { + return Ok(Self::Constant(field("value")?)); + } + if kind == "minecraft:weighted_list" { + return Ok(Self::Weighted(WeightedList::decode( + required(&object, "distribution")?, + |raw| Self::decode(raw, depth + 1, remaining), + )?)); + } + let trapezoid = kind == "minecraft:trapezoid"; + let min = field(if trapezoid { "min" } else { "min_inclusive" })?; + let max = field(if trapezoid { "max" } else { "max_inclusive" })?; + if max < min { + return Err(DecodeError::Field("integer provider bounds")); + } + match kind.as_str() { + "minecraft:uniform" => Ok(Self::Uniform { min, max }), + "minecraft:biased_to_bottom" => Ok(Self::BiasedToBottom { min, max }), + "minecraft:very_biased_to_bottom" => Ok(Self::VeryBiasedToBottom { min, max }), + "minecraft:trapezoid" => { + let plateau = field("plateau")?; + if plateau > max.wrapping_sub(min) { + return Err(DecodeError::Field("integer provider plateau")); + } + Ok(Self::Trapezoid { min, max, plateau }) + } + "minecraft:clamped" => Ok(Self::Clamped { + source: Box::new(Self::decode( + required(&object, "source")?, + depth + 1, + remaining, + )?), + min, + max, + }), + _ => Err(DecodeError::Field("integer provider type")), + } + } + pub fn bounds(&self) -> [i32; 2] { + match self { + Self::Weighted(list) => { + list.entries() + .iter() + .fold([i32::MAX, i32::MIN], |bounds, (provider, _)| { + let next = provider.bounds(); + [bounds[0].min(next[0]), bounds[1].max(next[1])] + }) + } + Self::Constant(value) => [*value; 2], + Self::Uniform { min, max } + | Self::BiasedToBottom { min, max } + | Self::VeryBiasedToBottom { min, max } + | Self::Trapezoid { min, max, .. } => [*min, *max], + Self::Clamped { source, min, max } => { + let bounds = source.bounds(); + [(*min).max(bounds[0]), (*max).min(bounds[1])] + } + } + } + pub fn sample(&self, random: &mut impl RandomSource) -> Result { + match self { + Self::Weighted(list) => list.sample(random)?.sample(random), + Self::Constant(value) => Ok(*value), + Self::Uniform { min, max } => random.next_int_between_inclusive(*min, *max), + Self::BiasedToBottom { min, max } | Self::VeryBiasedToBottom { min, max } => { + let mut value = random.next_int_bound(max.wrapping_sub(*min).wrapping_add(1))?; + value = random.next_int_bound(value.wrapping_add(1))?; + if matches!(self, Self::VeryBiasedToBottom { .. }) { + value = random.next_int_bound(value.wrapping_add(1))?; + } + Ok(min.wrapping_add(value)) + } + Self::Trapezoid { min, max, plateau } => { + if *plateau == 0 && *max == min.wrapping_neg() { + let left = random.next_int_bound(max.wrapping_add(1))?; + let right = random.next_int_bound(max.wrapping_add(1))?; + return Ok(left.wrapping_sub(right)); + } + let range = max.wrapping_sub(*min); + if *plateau == range { + return random.next_int_between_inclusive(*min, *max); + } + let slope = range.wrapping_sub(*plateau) / 2; + let middle = range.wrapping_sub(slope); + let left = random.next_int_between_inclusive(0, middle)?; + let right = random.next_int_between_inclusive(0, slope)?; + Ok(min.wrapping_add(left).wrapping_add(right)) + } + Self::Clamped { source, min, max } => { + let value = source.sample(random)?; + Ok(if value < *min { *min } else { value.min(*max) }) + } + } + } +} +fn float(raw: &RawValue) -> Result { + number_text(raw)? + .parse() + .map_err(|_| DecodeError::Field("float provider number")) +} +fn kind(object: &Object) -> Result { + identifier(&serde_json::from_str::( + required(object, "type")?.get(), + )?) +} diff --git a/crates/horizon-world/src/worldgen/weighted.rs b/crates/horizon-world/src/worldgen/weighted.rs new file mode 100644 index 000000000..c5149c8dc --- /dev/null +++ b/crates/horizon-world/src/worldgen/weighted.rs @@ -0,0 +1,105 @@ +//! Weighted choices with vanilla draw consumption and ordered entries. +use super::{DecodeError, Object, int_range, required}; +use horizon_core::random::{InvalidBound, RandomSource}; +use serde_json::value::RawValue; + +#[derive(Clone, Debug)] +pub struct WeightedList { + entries: Vec<(T, i32)>, + cumulative: Vec, + total: i32, +} +impl WeightedList { + /// Zero weights are retained. A positive total no greater than i32::MAX is + /// required, and lists are bounded to 8192 entries. + pub fn new(entries: Vec<(T, i32)>) -> Result { + Self::build(entries, false) + } + fn build(entries: Vec<(T, i32)>, allow_empty: bool) -> Result { + if entries.len() > 8192 { + return Err(DecodeError::Field("weighted list size")); + } + let mut total = 0_i32; + let mut cumulative = Vec::with_capacity(entries.len()); + for (_, weight) in &entries { + if *weight < 0 { + return Err(DecodeError::Field("negative weight")); + } + total = total + .checked_add(*weight) + .ok_or(DecodeError::Field("total weight"))?; + cumulative.push(total); + } + if total == 0 && !allow_empty { + return Err(DecodeError::Field("empty weighted list")); + } + Ok(Self { + entries, + cumulative, + total, + }) + } + pub fn entries(&self) -> &[(T, i32)] { + &self.entries + } + pub fn sample(&self, random: &mut impl RandomSource) -> Result<&T, InvalidBound> { + // Even a singleton with total weight one consumes a bounded draw. + let index = random.next_int_bound(self.total)?; + let entry = self.cumulative.partition_point(|end| *end <= index); + Ok(&self.entries[entry].0) + } + pub(crate) fn decode( + raw: &RawValue, + decode: impl FnMut(&RawValue) -> Result, + ) -> Result { + Self::decode_inner(raw, decode, false) + } + fn decode_inner( + raw: &RawValue, + mut decode: impl FnMut(&RawValue) -> Result, + allow_empty: bool, + ) -> Result { + let entries: Vec> = serde_json::from_str(raw.get())?; + if entries.len() > 8192 { + return Err(DecodeError::Field("weighted list size")); + } + Self::build( + entries + .iter() + .map(|raw| { + let object: Object = serde_json::from_str(raw.get())?; + let data = decode(required(&object, "data")?)?; + let weight = int_range(required(&object, "weight")?, "weight", 0, i32::MAX)?; + Ok((data, weight)) + }) + .collect::>()?, + allow_empty, + ) + } +} + +/// Optional choices preserve zero-weight entries without weakening the positive +/// total invariant required by integer and height providers. +#[derive(Clone, Debug)] +pub struct OptionalWeightedList(WeightedList); +impl OptionalWeightedList { + pub fn new(entries: Vec<(T, i32)>) -> Result { + WeightedList::build(entries, true).map(Self) + } + pub fn entries(&self) -> &[(T, i32)] { + self.0.entries() + } + pub fn sample(&self, random: &mut impl RandomSource) -> Result, InvalidBound> { + if self.0.total == 0 { + Ok(None) + } else { + self.0.sample(random).map(Some) + } + } + pub(crate) fn decode( + raw: &RawValue, + decode: impl FnMut(&RawValue) -> Result, + ) -> Result { + WeightedList::decode_inner(raw, decode, true).map(Self) + } +} diff --git a/crates/horizon-world/tests/biome_data.rs b/crates/horizon-world/tests/biome_data.rs new file mode 100644 index 000000000..51be40cfc --- /dev/null +++ b/crates/horizon-world/tests/biome_data.rs @@ -0,0 +1,91 @@ +use horizon_core::{ + density::{ConstantSampler, DensitySampler, GradientSampler, SamplerContext, TilingMode}, + geometry::Axis, +}; +use horizon_world::worldgen::{ + biome::{BiomeError, MultiNoiseBiomeSource}, + climate::ClimateSampler, +}; +use std::sync::Arc; + +fn fixture() -> MultiNoiseBiomeSource { + MultiNoiseBiomeSource::from_quantized_json( + r#"[ + {"coordinates":[[-10,-10],[0,0],[0,0],[0,0],[0,0],[0,0]],"offset":0,"biome":"left"}, + {"coordinates":[[10,10],[0,0],[0,0],[0,0],[0,0],[0,0]],"offset":0,"biome":"right"} + ]"#, + ) + .unwrap() +} + +#[test] +fn scalar_and_prepared_queries_share_ties_and_reject_outside_volume() { + let fields: [Arc; 6] = + std::array::from_fn(|i| -> Arc { + if i == 0 { + Arc::new(GradientSampler::new( + Axis::X, + TilingMode::ClampToEdge, + -4, + 4, + -0.001, + 0.001, + )) + } else { + Arc::new(ConstantSampler(0.)) + } + }); + let climate = ClimateSampler::new(fields); + let source = fixture(); + let mut resolver = source.resolver(&climate); + let mut context = SamplerContext::cached(); + assert_eq!( + resolver.sample(&mut context, [1, 0, 0]).unwrap(), + "minecraft:right" + ); + let volume = resolver + .prepare_volume(&mut context, [-1, 0, 0], [3, 2, 2]) + .unwrap(); + assert_eq!( + resolver.sample_prepared(&volume, [0, 0, 0]).unwrap(), + "minecraft:right" + ); + assert_eq!( + source + .resolver(&climate) + .sample_prepared(&volume, [0, 0, 0]) + .unwrap(), + "minecraft:left" + ); + assert!(matches!( + resolver.sample_prepared(&volume, [-2, 1, 1]), + Err(BiomeError::OutsideVolume) + )); + assert!(matches!( + resolver.sample_prepared(&volume, [2, 0, 0]), + Err(BiomeError::OutsideVolume) + )); + assert_eq!( + resolver.sample_prepared(&volume, [-1, 1, 1]).unwrap(), + "minecraft:left" + ); + assert_eq!( + resolver.sample(&mut context, [0, 0, 0]).unwrap(), + "minecraft:left" + ); +} + +#[test] +fn quantized_import_rejects_malformed_dimensions_numbers_and_identifiers() { + for json in [ + "[]", + r#"[{"coordinates":[[0,0]],"offset":0,"biome":"left"}]"#, + r#"[{"coordinates":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"offset":0.5,"biome":"left"}]"#, + r#"[{"coordinates":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"offset":0,"biome":"UPPER"}]"#, + ] { + assert!( + MultiNoiseBiomeSource::from_quantized_json(json).is_err(), + "{json}" + ); + } +} diff --git a/crates/horizon-world/tests/biome_predicate_bounds.rs b/crates/horizon-world/tests/biome_predicate_bounds.rs new file mode 100644 index 000000000..5910ebbcf --- /dev/null +++ b/crates/horizon-world/tests/biome_predicate_bounds.rs @@ -0,0 +1,39 @@ +use horizon_world::worldgen::{biome::BiomeId, biome_predicate::BiomePredicateBindings}; +use std::collections::BTreeMap; +#[test] +fn biome_registry_identity_and_holder_set_bounds() { + let names = BTreeMap::from([ + ("minecraft:plains".into(), BiomeId(0)), + ("minecraft:desert".into(), BiomeId(1)), + ]); + let tags = BTreeMap::from([ + ("horizon:empty".into(), vec![]), + ( + "horizon:both".into(), + vec!["plains".into(), "desert".into(), "plains".into()], + ), + ]); + let bindings = BiomePredicateBindings::new(&names, &tags).unwrap(); + assert!( + bindings + .resolve(r##""#horizon:empty""##) + .unwrap() + .is_empty() + ); + assert_eq!(bindings.resolve(r##""#horizon:both""##).unwrap().len(), 2); + assert!(bindings.resolve(r##"["#horizon:both"]"##).is_err()); + assert!( + bindings + .resolve(&serde_json::to_string(&vec!["plains"; 8193]).unwrap()) + .is_err() + ); + let duplicate = BTreeMap::from([("plains".into(), BiomeId(0)), ("desert".into(), BiomeId(0))]); + assert!(BiomePredicateBindings::new(&duplicate, &tags).is_err()); + let duplicate = BTreeMap::from([ + ("plains".into(), BiomeId(0)), + ("minecraft:plains".into(), BiomeId(1)), + ]); + assert!(BiomePredicateBindings::new(&duplicate, &BTreeMap::new()).is_err()); + let unknown = BTreeMap::from([("tag".into(), vec!["missing".into()])]); + assert!(BiomePredicateBindings::new(&names, &unknown).is_err()); +} diff --git a/crates/horizon-world/tests/biome_region.rs b/crates/horizon-world/tests/biome_region.rs new file mode 100644 index 000000000..13afd9533 --- /dev/null +++ b/crates/horizon-world/tests/biome_region.rs @@ -0,0 +1,40 @@ +use horizon_core::position::ChunkPos; +use horizon_world::worldgen::biome_chunk::{BiomeChunk, BiomeRegion, BiomeRegionError}; +#[test] +fn resident_biomes_track_replacement_fills_and_reject_ambiguous_chunks() { + let p = ChunkPos::new(-1, 1); + let mut chunk = BiomeChunk::new(p, -64, 32, 7).unwrap(); + chunk + .fill(-64, -33, |[x, y, z]| { + Ok::<_, ()>(x.wrapping_add(y).wrapping_add(z).rem_euclid(3)) + }) + .unwrap(); + assert!(matches!( + BiomeRegion::new(vec![chunk.clone(), chunk.clone()], 0), + Err(BiomeRegionError::InvalidChunks) + )); + assert!(matches!( + BiomeRegion::new( + vec![ + chunk.clone(), + BiomeChunk::new(ChunkPos::new(0, 0), 0, 32, 0).unwrap() + ], + 0 + ), + Err(BiomeRegionError::InvalidChunks) + )); + let mut region = BiomeRegion::new(vec![chunk], 0).unwrap(); + assert_eq!(region.present_in_chunk(p).unwrap(), vec![0, 1, 2]); + region + .chunk_mut(p) + .unwrap() + .fill(-64, -33, |_| Ok::<_, ()>(9)) + .unwrap(); + assert_eq!(region.present_in_chunk(p).unwrap(), vec![9]); + assert_eq!(region.noise_biome([-1, i32::MIN, 4]).unwrap(), &9); + assert_eq!(region.noise_biome([-1, i32::MAX, 4]).unwrap(), &9); + assert!(matches!( + region.noise_biome([0, 0, 4]), + Err(BiomeRegionError::MissingChunk(_)) + )); +} diff --git a/crates/horizon-world/tests/block_predicate_bounds.rs b/crates/horizon-world/tests/block_predicate_bounds.rs new file mode 100644 index 000000000..fc7e07ef6 --- /dev/null +++ b/crates/horizon-world/tests/block_predicate_bounds.rs @@ -0,0 +1,92 @@ +use horizon_core::random::{LegacyRandom, RandomSource}; +use horizon_world::{ + heightmap::HeightmapType, + worldgen::{ + anchor::WorldGenerationContext, + block_predicate::BlockPredicate, + placement::{PlacementContext, PlacementError, PlacementModifier, PlacementQueryError}, + }, +}; +struct UnboundedWorld(usize); +impl PlacementContext for UnboundedWorld { + fn generation(&self) -> WorldGenerationContext { + WorldGenerationContext::new(0, 16, 8) + } + fn min_y(&mut self) -> Result { + Ok(i32::MIN) + } + fn max_y(&mut self) -> Result { + Ok(i32::MAX) + } + fn height(&mut self, _: HeightmapType, _: i32, _: i32) -> Result { + unreachable!() + } + fn outside_build_height(&mut self, _: i32) -> Result { + self.0 += 1; + Ok(false) + } +} +#[test] +fn directly_constructed_scans_share_predicate_work_budget() { + let scan = PlacementModifier::EnvironmentScan { + upwards: true, + target: BlockPredicate::Not(Box::new(BlockPredicate::True)), + allowed: BlockPredicate::True, + max_steps: i32::MAX, + }; + let mut world = UnboundedWorld(0); + let mut random = LegacyRandom::new(1); + let mut expected = random.clone(); + let result = scan.modify_in( + &mut world, + &mut random, + [0, i32::MAX, 0], + |_, _| -> Result<(), ()> { panic!("false target must not emit") }, + ); + assert!(matches!( + result, + Err(PlacementError::World(PlacementQueryError::WorkLimit)) + )); + assert!(world.0 > 0 && world.0 < 65536); + assert_eq!(random.next_long(), expected.next_long()); +} +#[test] +fn predicate_trees_share_decode_and_evaluation_budgets() { + let leaf = r#"{"type":"true"}"#; + let branch = format!( + r#"{{"type":"all_of","predicates":[{}]}}"#, + vec![leaf; 256].join(",") + ); + let tree = format!( + r#"{{"type":"all_of","predicates":[{}]}}"#, + vec![branch; 256].join(",") + ); + assert!(BlockPredicate::from_json(&tree).is_err()); + let tree = BlockPredicate::All(vec![ + BlockPredicate::All(vec![BlockPredicate::True; 256]); + 256 + ]); + assert!(matches!( + tree.test(&mut UnboundedWorld(0), [0; 3]), + Err(PlacementQueryError::WorkLimit) + )); +} + +#[test] +fn oversized_volume_keeps_early_exit_and_bounds_total_work() { + let mut world = UnboundedWorld(0); + let volume = |predicate| BlockPredicate::Volume { + min: [i32::MIN; 3], + max: [i32::MAX; 3], + predicate: Box::new(predicate), + }; + assert!( + !volume(BlockPredicate::Not(Box::new(BlockPredicate::True))) + .test(&mut world, [0; 3]) + .unwrap() + ); + assert!(matches!( + volume(BlockPredicate::True).test(&mut world, [0; 3]), + Err(PlacementQueryError::WorkLimit) + )); +} diff --git a/crates/horizon-world/tests/carver_generation.rs b/crates/horizon-world/tests/carver_generation.rs new file mode 100644 index 000000000..688daea45 --- /dev/null +++ b/crates/horizon-world/tests/carver_generation.rs @@ -0,0 +1,89 @@ +use horizon_core::position::ChunkPos; +use horizon_world::worldgen::{ + anchor::WorldGenerationContext, + carver::{CarverCatalog, MaskGenerationError, generate_carving_mask}, +}; +use std::{collections::BTreeMap, sync::Arc}; + +#[test] +fn origin_order_wraps_coordinates_and_upgrading_changes_the_ceiling() { + let target = ChunkPos::new(i32::MAX, i32::MIN); + for upgrading in [false, true] { + let mut visited = Vec::new(); + let mask = generate_carving_mask( + 0, + target, + WorldGenerationContext::new(-64, 384, 63), + upgrading, + |origin| { + visited.push(origin); + Ok::<_, ()>(&[]) + }, + ) + .unwrap(); + assert!(mask.is_empty()); + assert_eq!(mask.min_y(), -63); + assert_eq!(mask.max_y(), if upgrading { 319 } else { 312 }); + let expected: Vec<_> = (-8..=8) + .flat_map(|dx| { + (-8..=8).map(move |dz| { + ChunkPos::new(target.x.wrapping_add(dx), target.z.wrapping_add(dz)) + }) + }) + .collect(); + assert_eq!(visited, expected); + } +} + +#[test] +fn invalid_bounds_skip_the_source_and_source_failures_stop_immediately() { + let target = ChunkPos::new(0, 0); + let invalid = generate_carving_mask( + 0, + target, + WorldGenerationContext::new(0, 8, 0), + false, + |_| -> Result<_, ()> { panic!("invalid bounds must precede biome queries") }, + ); + assert!(matches!(invalid, Err(MaskGenerationError::Mask(_)))); + let mut calls = 0; + let failed = generate_carving_mask( + 0, + target, + WorldGenerationContext::new(0, 16, 0), + false, + |_| { + calls += 1; + if calls == 19 { + Err("biome failure") + } else { + Ok(&[]) + } + }, + ); + assert!(matches!( + failed, + Err(MaskGenerationError::Source("biome failure")) + )); + assert_eq!(calls, 19); +} + +#[test] +fn holder_lists_preserve_duplicate_identity_and_reject_unknown_names() { + let definition = r#"{"type":"cave","probability":1,"y":{"absolute":8},"count":0,"thickness":1,"room_vertical_radius_multiplier":1,"horizontal_radius_multiplier":1,"vertical_radius_multiplier":1,"floor_level":-1}"#; + let catalog = + CarverCatalog::from_json(&BTreeMap::from([("test".into(), definition.into())])).unwrap(); + let entries = catalog.decode_set(r#"["test","minecraft:test"]"#).unwrap(); + assert_eq!(entries.len(), 2); + assert!(Arc::ptr_eq(&entries[0], &entries[1])); + assert_eq!(catalog.decode_set(definition).unwrap().len(), 1); + assert!(catalog.decode_set("[]").unwrap().is_empty()); + assert!(catalog.decode_set(r#"["test","missing"]"#).is_err()); + assert!( + CarverCatalog::from_json(&BTreeMap::from([ + ("test".into(), definition.into()), + ("minecraft:test".into(), definition.into()), + ])) + .is_err() + ); +} diff --git a/crates/horizon-world/tests/carving_stage.rs b/crates/horizon-world/tests/carving_stage.rs new file mode 100644 index 000000000..3af6d4570 --- /dev/null +++ b/crates/horizon-world/tests/carving_stage.rs @@ -0,0 +1,172 @@ +use horizon_core::{ + carving::CarvingMask, + density::{ConstantSampler, SamplerContext}, + position::ChunkPos, + random::{RandomSource, XoroshiroRandom}, +}; +use horizon_world::{ + DATA_VERSION, + heightmap::HeightmapState, + nbt::Tag, + registry::{BlockRegistry, BlockStateId}, + worldgen::{ + anchor::WorldGenerationContext, + aquifer::AquiferError, + carving::{CarvingBlocks, apply_carving_mask}, + material_condition::{MaterialRule, MaterialSurfaceQueries}, + material_stage::TopMaterialInputs, + terrain::{TerrainAquifer, TerrainBlockStates, TerrainChunk}, + }, +}; +use std::{collections::BTreeSet, sync::Arc}; +#[derive(Clone, Copy)] +struct State(u32); +impl HeightmapState for State { + fn is_air(self) -> bool { + self.0 < 2 + } + fn is_air_block(self) -> bool { + self.0 == 0 + } + fn has_fluid(self) -> bool { + self.0 == 3 + } + fn blocks_motion_in_heightmap(self) -> bool { + self.0 >= 2 && self.0 != 3 + } + fn blocks_motion_in_heightmap_no_leaves(self) -> bool { + self.blocks_motion_in_heightmap() + } +} +struct Properties; +impl TerrainBlockStates for Properties { + type State = State; + fn heightmap_state(&self, id: BlockStateId) -> State { + State(id.0) + } +} +struct Surface; +impl MaterialSurfaceQueries for Surface { + fn surface_depth(&mut self, _: i32, _: i32) -> i32 { + 1 + } + fn surface_secondary(&mut self, _: i32, _: i32) -> f64 { + 0. + } +} +struct Aquifer(Vec); +impl TerrainAquifer for Aquifer { + fn compute_substance( + &mut self, + _: &mut SamplerContext, + [_x, y, _z]: [i32; 3], + density: f64, + ) -> Result, AquiferError> { + assert_eq!(density.to_bits(), 0); + self.0.push(y); + match y { + 8 => Ok(None), + 7 => Ok(Some(BlockStateId(0))), + _ => Err(AquiferError::OutsideGrid), + } + } + fn should_schedule_fluid_update(&self) -> bool { + false + } +} +fn registry() -> BlockRegistry { + let names = [ + "minecraft:air", + "minecraft:void_air", + "minecraft:stone", + "minecraft:water", + "minecraft:grass_block", + "minecraft:mycelium", + "minecraft:dirt", + ]; + BlockRegistry::from_nbt(&Tag::compound([ + ("DataVersion", Tag::Int(DATA_VERSION)), + ( + "states", + Tag::List( + names + .iter() + .map(|name| Tag::compound([("id", Tag::String((*name).into()))])) + .collect(), + ), + ), + ( + "defaults", + Tag::Compound( + names + .iter() + .enumerate() + .map(|(id, name)| ((*name).into(), Tag::Int(id as i32))) + .collect(), + ), + ), + ])) + .unwrap() +} +#[test] +fn filters_and_uncarvable_blocks_precede_aquifers_and_failures_keep_surface_restoration() { + let registry = registry(); + for scenario in 0..3 { + let uncarvable = if scenario == 2 { + BTreeSet::from(["minecraft:grass_block".to_owned()]) + } else { + BTreeSet::new() + }; + let blocks = CarvingBlocks::from_registry(®istry, &uncarvable).unwrap(); + let mut chunk = + TerrainChunk::new(ChunkPos::new(-1, 2), 0, 16, ®istry, Properties).unwrap(); + for (y, state) in [(8, 4), (7, 2), (6, 6)] { + chunk.set_block_raw(0, y, 0, BlockStateId(state)).unwrap(); + } + let mut mask = CarvingMask::new(0, 15).unwrap(); + for y in 6..=8 { + mask.carve(0, y, 0).unwrap(); + } + let mut context = SamplerContext::cached(); + let mut aquifer = Aquifer(Vec::new()); + let mut filtered = Vec::new(); + let result = apply_carving_mask( + &mut chunk, + &mask, + MaterialRule::Block(BlockStateId(3)), + TopMaterialInputs:: { + generation: WorldGenerationContext::new(0, 16, 8), + root: XoroshiroRandom::new(0).fork_positional(), + surface: Surface, + preliminary_surface: Arc::new(ConstantSampler(0.)), + density_context: &mut context, + }, + &mut aquifer, + &blocks, + |position| { + filtered.push(position); + scenario != 1 || position[1] != 8 + }, + ); + assert!(result.is_err()); + assert_eq!(filtered, [[0, 8, 0], [0, 7, 0], [0, 6, 0]]); + assert_eq!( + aquifer.0, + if scenario == 0 { + vec![8, 7, 6] + } else { + vec![7, 6] + } + ); + assert_eq!(chunk.block(0, 8, 0), BlockStateId(4)); + assert_eq!(chunk.block(0, 7, 0), BlockStateId(0)); + assert_eq!( + chunk.block(0, 6, 0), + BlockStateId(if scenario == 0 { 3 } else { 6 }) + ); + assert_eq!( + chunk.postprocessing()[0], + if scenario == 0 { vec![6 << 4] } else { vec![] } + ); + } +} diff --git a/crates/horizon-world/tests/collision_data.rs b/crates/horizon-world/tests/collision_data.rs new file mode 100644 index 000000000..35ec3c569 --- /dev/null +++ b/crates/horizon-world/tests/collision_data.rs @@ -0,0 +1,157 @@ +use horizon_world::{ + DATA_VERSION, + chunk::BlockSection, + collision::CachedCollisionRegistry, + nbt::Tag, + registry::{BlockRegistry, BlockStateId}, +}; + +fn fixture() -> (Tag, Tag) { + let states = vec![ + Tag::String("minecraft:air".into()), + Tag::String("minecraft:stone".into()), + Tag::String("minecraft:context".into()), + ]; + let registry = Tag::compound([ + ("DataVersion", Tag::Int(DATA_VERSION)), + ("states", Tag::List(states.clone())), + ( + "defaults", + Tag::compound([ + ("minecraft:air", Tag::Int(0)), + ("minecraft:stone", Tag::Int(1)), + ("minecraft:context", Tag::Int(2)), + ]), + ), + ]); + let empty = Tag::compound([ + ("x", Tag::LongArray(vec![0])), + ("y", Tag::LongArray(vec![0])), + ("z", Tag::LongArray(vec![0])), + ("occupied", Tag::ByteArray(vec![])), + ("cube", Tag::Byte(0)), + ("cube_axes", Tag::Byte(0)), + ("discrete_min", Tag::IntArray(vec![0; 3])), + ("discrete_max", Tag::IntArray(vec![0; 3])), + ]); + let coords = Tag::LongArray(vec![0, 1.0f64.to_bits() as i64]); + let block = Tag::compound([ + ("x", coords.clone()), + ("y", coords.clone()), + ("z", coords), + ("occupied", Tag::ByteArray(vec![1])), + ("cube", Tag::Byte(1)), + ("cube_axes", Tag::Byte(7)), + ("discrete_min", Tag::IntArray(vec![0; 3])), + ("discrete_max", Tag::IntArray(vec![1; 3])), + ]); + let collision = Tag::compound([ + ("DataVersion", Tag::Int(DATA_VERSION)), + ("states", Tag::List(states)), + ("shapes", Tag::List(vec![empty, block])), + ("cached_shapes", Tag::IntArray(vec![0, 1, -1])), + ]); + (registry, collision) +} + +#[test] +fn empty_cached_and_context_states_are_distinct() { + let (registry_tag, collision_tag) = fixture(); + let registry = BlockRegistry::from_nbt(®istry_tag).unwrap(); + let collision = CachedCollisionRegistry::from_nbt(&collision_tag, ®istry).unwrap(); + assert_eq!(collision.cached_state_count(), 2); + assert_eq!(collision.shape_count(), 2); + assert!( + collision + .cached_shape(BlockStateId(0)) + .unwrap() + .unwrap() + .is_empty() + ); + assert!( + !collision + .cached_shape(BlockStateId(1)) + .unwrap() + .unwrap() + .is_empty() + ); + assert!(collision.cached_shape(BlockStateId(2)).unwrap().is_none()); + assert!(collision.cached_shape(BlockStateId(3)).is_err()); + let mut section = BlockSection::uniform(BlockStateId(0), ®istry).unwrap(); + section.set(4095, BlockStateId(1)).unwrap(); + assert!( + !collision + .section_shape(§ion, 4095) + .unwrap() + .unwrap() + .is_empty() + ); + assert!(collision.section_shape(§ion, 4096).is_err()); + let different = BlockRegistry::from_nbt(®istry_tag).unwrap(); + let foreign_section = BlockSection::uniform(BlockStateId(0), &different).unwrap(); + assert!(collision.section_shape(&foreign_section, 0).is_err()); +} + +#[test] +fn invalid_imports_fail_before_collision_queries() { + let (registry_tag, valid) = fixture(); + let registry = BlockRegistry::from_nbt(®istry_tag).unwrap(); + for (field, tag) in [ + ("DataVersion", Tag::Int(0)), + ("cached_shapes", Tag::IntArray(vec![0, 1])), + ("cached_shapes", Tag::IntArray(vec![0, 2, -1])), + ("cached_shapes", Tag::IntArray(vec![0, 1, -2])), + ] { + let mut bad = valid.clone(); + *bad.get_mut(field).unwrap() = tag; + assert!(CachedCollisionRegistry::from_nbt(&bad, ®istry).is_err()); + } + let mut bad = valid.clone(); + let Some(Tag::List(states)) = bad.get_mut("states") else { + unreachable!() + }; + states.swap(0, 1); + assert!(CachedCollisionRegistry::from_nbt(&bad, ®istry).is_err()); + for (field, tag) in [ + ("cube", Tag::Byte(2)), + ("cube_axes", Tag::Byte(8)), + ("cube_axes", Tag::Byte(0)), + ("occupied", Tag::ByteArray(vec![2])), + ("discrete_min", Tag::IntArray(vec![0, 0])), + ("discrete_min", Tag::IntArray(vec![-1, 0, 0])), + ("discrete_max", Tag::IntArray(vec![1, 0, 1])), + ("occupied", Tag::ByteArray(vec![])), + ("x", Tag::LongArray(vec![0, 0])), + ("x", Tag::LongArray(vec![0, f64::NAN.to_bits() as i64])), + ("x", Tag::LongArray(vec![0, 0.5f64.to_bits() as i64])), + ] { + let mut bad = valid.clone(); + let Some(Tag::List(shapes)) = bad.get_mut("shapes") else { + unreachable!() + }; + *shapes[1].get_mut(field).unwrap() = tag; + assert!(CachedCollisionRegistry::from_nbt(&bad, ®istry).is_err()); + } +} + +#[test] +fn equal_grids_share_storage_without_collapsing_shape_identities() { + let (registry_tag, mut collision_tag) = fixture(); + let registry = BlockRegistry::from_nbt(®istry_tag).unwrap(); + let Some(Tag::List(shapes)) = collision_tag.get_mut("shapes") else { + unreachable!() + }; + shapes.push(shapes[1].clone()); + *collision_tag.get_mut("cached_shapes").unwrap() = Tag::IntArray(vec![0, 1, 2]); + let collision = CachedCollisionRegistry::from_nbt(&collision_tag, ®istry).unwrap(); + assert_eq!(collision.shape_count(), 3); + assert_eq!(collision.unique_grid_count(), 2); + let first = collision.cached_shape(BlockStateId(1)).unwrap().unwrap(); + let second = collision.cached_shape(BlockStateId(2)).unwrap().unwrap(); + assert!(!first.same_identity(second)); + assert!(std::ptr::eq( + first.boxes().as_ptr(), + second.boxes().as_ptr() + )); + assert!(first.same_identity(collision.cached_shape(BlockStateId(1)).unwrap().unwrap())); +} diff --git a/crates/horizon-world/tests/decoration_bounds.rs b/crates/horizon-world/tests/decoration_bounds.rs new file mode 100644 index 000000000..2ba2eb885 --- /dev/null +++ b/crates/horizon-world/tests/decoration_bounds.rs @@ -0,0 +1,35 @@ +use horizon_core::position::ChunkPos; +use horizon_world::worldgen::{ + decoration::{DecorationBiome, DecorationError, DecorationWorld, FeatureDecorationPlan}, + feature_sort::{FeatureIdentity, FeatureSortError}, +}; +struct NoChunks; +impl DecorationWorld for NoChunks { + type Error = (); + fn min_section_y(&mut self) -> Result { + Ok(-4) + } + fn chunk_biomes(&mut self, _: ChunkPos) -> Result, ()> { + panic!("unbounded neighborhood must be rejected before reading chunks") + } + fn set_currently_generating(&mut self, _: Option) -> Result<(), ()> { + panic!("invalid neighborhood must not start or finish decoration") + } +} +#[test] +fn invalid_registry_identity_and_unbounded_neighborhood_are_rejected() { + assert!(matches!( + FeatureDecorationPlan::new(vec![ + (DecorationBiome(0), vec![]), + (DecorationBiome(0), vec![]) + ]), + Err(FeatureSortError::DuplicateBiome) + )); + let plan = FeatureDecorationPlan::new(vec![]).unwrap(); + for chunk in [ChunkPos::new(i32::MIN, 0), ChunkPos::new(0, i32::MAX)] { + let result = plan.decorate_features(&mut NoChunks, chunk, 0, |_, _, _, _, _| { + panic!("invalid neighborhood must not place features") + }); + assert!(matches!(result, Err(DecorationError::WorkLimit))); + } +} diff --git a/crates/horizon-world/tests/feature_catalog.rs b/crates/horizon-world/tests/feature_catalog.rs new file mode 100644 index 000000000..769ce8bbe --- /dev/null +++ b/crates/horizon-world/tests/feature_catalog.rs @@ -0,0 +1,62 @@ +use horizon_world::worldgen::{feature_catalog::FeatureCatalog, tags::TagDefinitions}; +use std::collections::BTreeMap; +fn map(values: &[(&str, &str)]) -> BTreeMap { + values + .iter() + .map(|(k, v)| (k.to_string(), v.to_string())) + .collect() +} +#[test] +fn canonical_duplicates_cycles_and_unknown_unselected_children_fail() { + let tags = TagDefinitions::default(); + assert!( + FeatureCatalog::from_resources( + &map(&[ + ("a", r#"{"type":"no_op"}"#), + ("minecraft:a", r#"{"type":"no_op"}"#) + ]), + &BTreeMap::new(), + &tags + ) + .is_err() + ); + let features = map(&[ + ( + "horizon:loop", + r#"{"type":"sequence","features":["horizon:loop"]}"#, + ), + ("horizon:unused", r#"{"type":"not_implemented"}"#), + ]); + let placed = map(&[( + "horizon:loop", + r#"{"feature":"horizon:loop","placement":[]}"#, + )]); + let catalog = FeatureCatalog::from_resources(&features, &placed, &tags).unwrap(); + assert!(catalog.feature(r#""horizon:loop""#).is_err()); + assert!(catalog.placed_feature(r#""horizon:loop""#).is_err()); + assert!(catalog.feature(r#"{"type":"no_op"}"#).is_ok()); + assert!(catalog.feature(r#"{"type":"weighted_random_selector","features":[{"data":"horizon:missing","weight":0}]}"#).is_err()); +} +#[test] +fn shared_reference_expansion_is_bounded_before_building_a_large_tree() { + let leaf = r#"{"feature":{"type":"no_op"},"placement":[]}"#; + let branch = format!( + r#"{{"type":"sequence","features":[{}]}}"#, + vec![r#""horizon:leaf""#; 8192].join(",") + ); + let features = BTreeMap::from([("horizon:branch".into(), branch)]); + let placed = map(&[ + ("horizon:leaf", leaf), + ( + "horizon:branch", + r#"{"feature":"horizon:branch","placement":[]}"#, + ), + ]); + let catalog = + FeatureCatalog::from_resources(&features, &placed, &TagDefinitions::default()).unwrap(); + let root = format!( + r#"{{"type":"sequence","features":[{}]}}"#, + [r#""horizon:branch""#; 9].join(",") + ); + assert!(catalog.feature(&root).is_err()); +} diff --git a/crates/horizon-world/tests/feature_graph_bounds.rs b/crates/horizon-world/tests/feature_graph_bounds.rs new file mode 100644 index 000000000..63da02b19 --- /dev/null +++ b/crates/horizon-world/tests/feature_graph_bounds.rs @@ -0,0 +1,89 @@ +use horizon_core::random::{LegacyRandom, RandomSource}; +use horizon_world::{ + heightmap::HeightmapType, + registry::BlockStateId, + worldgen::{ + anchor::WorldGenerationContext, + feature::{FeatureBlocks, FeatureWorld}, + feature_graph::{FeatureDefinition, FeatureExecutionError, PlacedFeatureDefinition}, + placement::{PlacementContext, PlacementQueryError}, + }, +}; +struct World; +impl PlacementContext for World { + fn generation(&self) -> WorldGenerationContext { + WorldGenerationContext::new(0, 16, 8) + } + fn min_y(&mut self) -> Result { + Ok(0) + } + fn height(&mut self, _: HeightmapType, _: i32, _: i32) -> Result { + panic!("no-op graph queried height") + } +} +impl FeatureWorld for World { + type Error = std::convert::Infallible; + fn block(&mut self, _: [i32; 3]) -> Result { + panic!("no-op graph read blocks") + } + fn set_block(&mut self, _: [i32; 3], _: BlockStateId, _: i32) -> Result { + panic!("no-op graph wrote blocks") + } +} +fn blocks() -> FeatureBlocks { + FeatureBlocks { + air: BlockStateId(0), + stone: BlockStateId(1), + cobblestone: BlockStateId(2), + end_stone: BlockStateId(3), + obsidian: BlockStateId(4), + } +} +#[test] +fn large_graphs_fail_at_a_shared_visit_bound_without_drawing_randomness() { + let leaf = PlacedFeatureDefinition { + feature: Box::new(FeatureDefinition::NoOp), + placement: vec![], + }; + let branch = PlacedFeatureDefinition { + feature: Box::new(FeatureDefinition::Sequence(vec![leaf; 8192])), + placement: vec![], + }; + let tree = FeatureDefinition::Sequence(vec![branch; 9]); + let mut random = LegacyRandom::new(5); + let mut expected = random.clone(); + assert!(matches!( + tree.place(&mut World, &mut random, [0; 3], blocks()), + Err(FeatureExecutionError::WorkLimit) + )); + assert_eq!(random.next_long(), expected.next_long()); +} +#[test] +fn nested_inline_decoding_rejects_excessive_depth() { + let mut value = String::from(r#"{"type":"no_op"}"#); + for _ in 0..70 { + value = + format!(r#"{{"type":"sequence","features":[{{"feature":{value},"placement":[]}}]}}"#); + } + assert!(FeatureDefinition::from_json(&value).is_err()); +} + +#[test] +fn modifier_expansion_without_leaf_calls_uses_the_shared_graph_budget() { + use horizon_world::worldgen::{placement::PlacementModifier, value_provider::IntProvider}; + let feature = PlacedFeatureDefinition { + feature: Box::new(FeatureDefinition::NoOp), + placement: vec![ + PlacementModifier::Count(IntProvider::Constant(4096)), + PlacementModifier::Count(IntProvider::Constant(4096)), + PlacementModifier::Count(IntProvider::Constant(0)), + ], + }; + let mut random = LegacyRandom::new(5); + let mut expected = random.clone(); + assert!(matches!( + feature.place(&mut World, &mut random, [0; 3], blocks()), + Err(FeatureExecutionError::WorkLimit) + )); + assert_eq!(random.next_long(), expected.next_long()); +} diff --git a/crates/horizon-world/tests/feature_placement.rs b/crates/horizon-world/tests/feature_placement.rs new file mode 100644 index 000000000..8eb9c1af6 --- /dev/null +++ b/crates/horizon-world/tests/feature_placement.rs @@ -0,0 +1,41 @@ +use horizon_core::random::{LegacyRandom, RandomSource}; +use horizon_world::worldgen::{ + anchor::WorldGenerationContext, + placement::{FeaturePlacementError, FeaturePlacer, PlacementModifier}, + value_provider::IntProvider, +}; + +#[test] +fn oversized_chains_fail_before_random_draws_or_feature_calls() { + let mut random = LegacyRandom::new(17); + let mut expected = random.clone(); + let mut placer = FeaturePlacer::new(); + let result = placer.place( + &vec![PlacementModifier::InSquare; 1025], + WorldGenerationContext::new(-64, 384, 63), + &mut random, + [0, 0, 0], + |_, _| -> Result { panic!("oversized chain reached feature") }, + ); + assert!(matches!(result, Err(FeaturePlacementError::WorkLimit))); + assert_eq!(random.next_long(), expected.next_long()); +} + +#[test] +fn multiplicative_counts_stop_at_the_shared_work_bound() { + let mut random = LegacyRandom::new(17); + let mut placer = FeaturePlacer::new(); + let mut calls = 0; + let result = placer.place( + &vec![PlacementModifier::Count(IntProvider::Constant(4096)); 2], + WorldGenerationContext::new(-64, 384, 63), + &mut random, + [0, 0, 0], + |_, _| { + calls += 1; + Ok::<_, ()>(true) + }, + ); + assert!(matches!(result, Err(FeaturePlacementError::WorkLimit))); + assert!(calls > 0 && calls < 1 << 20); +} diff --git a/crates/horizon-world/tests/feature_region.rs b/crates/horizon-world/tests/feature_region.rs new file mode 100644 index 000000000..1209a5282 --- /dev/null +++ b/crates/horizon-world/tests/feature_region.rs @@ -0,0 +1,148 @@ +use horizon_core::position::ChunkPos; +use horizon_world::{ + DATA_VERSION, + heightmap::{HeightmapState, HeightmapType}, + nbt::Tag, + registry::{BlockRegistry, BlockStateId}, + worldgen::{ + anchor::WorldGenerationContext, + feature::FeatureWorld, + feature_region::{RegionError, TerrainFeatureAccess, TerrainRegion}, + placement::PlacementContext, + terrain::{PreLightChunkStage, TerrainBlockStates, TerrainChunk}, + }, +}; +#[derive(Clone, Copy)] +struct State(u32); +impl HeightmapState for State { + fn is_air(self) -> bool { + self.0 < 2 + } + fn is_air_block(self) -> bool { + self.0 == 0 + } + fn has_fluid(self) -> bool { + self.0 == 3 + } + fn blocks_motion_in_heightmap(self) -> bool { + self.0 >= 2 && self.0 != 3 + } + fn blocks_motion_in_heightmap_no_leaves(self) -> bool { + self.blocks_motion_in_heightmap() + } +} +struct Properties; +impl TerrainBlockStates for Properties { + type State = State; + fn heightmap_state(&self, id: BlockStateId) -> State { + State(id.0) + } +} +fn registry() -> BlockRegistry { + let names = [ + "minecraft:air", + "minecraft:void_air", + "minecraft:stone", + "minecraft:water", + "minecraft:grass_block", + "minecraft:mycelium", + "minecraft:dirt", + ]; + BlockRegistry::from_nbt(&Tag::compound([ + ("DataVersion", Tag::Int(DATA_VERSION)), + ( + "states", + Tag::List( + names + .iter() + .map(|name| Tag::compound([("id", Tag::String((*name).into()))])) + .collect(), + ), + ), + ( + "defaults", + Tag::Compound( + names + .iter() + .enumerate() + .map(|(id, name)| ((*name).into(), Tag::Int(id as i32))) + .collect(), + ), + ), + ])) + .unwrap() +} +#[test] +fn rejects_incompatible_regions_and_routes_negative_chunk_coordinates() { + let other_registry = registry(); + let registry = registry(); + let context = WorldGenerationContext::new(0, 16, 8); + let chunk = + |x, min, reg| TerrainChunk::new(ChunkPos::new(x, 0), min, 16, reg, Properties).unwrap(); + assert!(TerrainRegion::::new(vec![], context).is_err()); + assert!( + TerrainRegion::new( + vec![chunk(0, 0, ®istry), chunk(0, 0, ®istry)], + context + ) + .is_err() + ); + assert!( + TerrainRegion::new( + vec![chunk(0, 0, ®istry), chunk(1, 16, ®istry)], + context + ) + .is_err() + ); + assert!( + TerrainRegion::new( + vec![chunk(0, 0, ®istry), chunk(1, 0, &other_registry)], + context + ) + .is_err() + ); + let mut region = TerrainRegion::new( + vec![chunk(-1, 0, ®istry), chunk(0, 0, ®istry)], + context, + ) + .unwrap(); + region + .set_block_worldgen([-1, 7, 0], BlockStateId(2)) + .unwrap(); + assert_eq!(region.block([-1, 7, 0]).unwrap(), BlockStateId(2)); + assert_eq!(region.block([15, 7, 0]).unwrap(), BlockStateId(0)); + assert!(matches!( + region.set_block_worldgen([16, 7, 0], BlockStateId(2)), + Err(RegionError::MissingChunk([1, 0])) + )); + assert_eq!(region.block([0, 7, 0]).unwrap(), BlockStateId(0)); +} +#[test] +fn write_callback_controls_mutation_and_receives_all_flags() { + let registry = registry(); + let mut chunk = TerrainChunk::new(ChunkPos::new(0, 0), 0, 16, ®istry, Properties).unwrap(); + chunk.set_generation_stage(PreLightChunkStage::Terrain); + let mut region = + TerrainRegion::new(vec![chunk], WorldGenerationContext::new(-16, 32, 8)).unwrap(); + assert_eq!(region.generation(), WorldGenerationContext::new(0, 16, 8)); + assert_eq!(region.height(HeightmapType::WorldSurface, 0, 0).unwrap(), 0); + let mut flags = Vec::new(); + { + let mut world = TerrainFeatureAccess::new( + &mut region, + |region: &mut TerrainRegion<'_, Properties>, p, state, flag| { + flags.push(flag); + if flag == 2 { + return Ok(false); + } + region.set_block_worldgen(p, state)?; + Ok(true) + }, + ); + assert!(!world.set_block([0, 7, 0], BlockStateId(2), 2).unwrap()); + assert_eq!(world.height(HeightmapType::WorldSurface, 0, 0).unwrap(), 0); + assert!(world.set_block([0, 7, 0], BlockStateId(2), 3).unwrap()); + assert_eq!(world.height(HeightmapType::WorldSurface, 0, 0).unwrap(), 8); + } + assert_eq!(flags, [2, 3]); +} diff --git a/crates/horizon-world/tests/feature_sort_bounds.rs b/crates/horizon-world/tests/feature_sort_bounds.rs new file mode 100644 index 000000000..84bbfb05e --- /dev/null +++ b/crates/horizon-world/tests/feature_sort_bounds.rs @@ -0,0 +1,34 @@ +use horizon_world::worldgen::feature_sort::{ + FeatureIdentity, FeatureSortError, build_features_per_step, +}; + +#[test] +fn long_dependency_chains_use_bounded_iterative_traversal() { + let features = (0..50000).map(FeatureIdentity).collect::>(); + let result = build_features_per_step(&[vec![features.clone()]]).unwrap(); + assert_eq!(result[0].features(), features); + assert_eq!(result[0].index(FeatureIdentity(49999)), Some(49999)); + assert_eq!(result[0].index(FeatureIdentity(50000)), None); + assert!(matches!( + build_features_per_step(&[vec![vec![FeatureIdentity(0); 65536]]]), + Err(FeatureSortError::WorkLimit) + )); +} + +#[test] +fn opposite_biome_orders_and_repeated_identity_form_cycles() { + let a = FeatureIdentity(91); + let b = FeatureIdentity(7); + assert!(matches!( + build_features_per_step(&[vec![vec![a, b]], vec![vec![b, a]]]), + Err(FeatureSortError::Cycle) + )); + assert!(matches!( + build_features_per_step(&[vec![vec![a, a]]]), + Err(FeatureSortError::Cycle) + )); + let result = build_features_per_step(&[vec![vec![a], vec![], vec![a, b]]]).unwrap(); + assert_eq!(result[0].features(), [a]); + assert!(result[1].features().is_empty()); + assert_eq!(result[2].features(), [a, b]); +} diff --git a/crates/horizon-world/tests/material_stage.rs b/crates/horizon-world/tests/material_stage.rs new file mode 100644 index 000000000..fa17bf0e9 --- /dev/null +++ b/crates/horizon-world/tests/material_stage.rs @@ -0,0 +1,295 @@ +use horizon_core::{ + density::{ + CachingDensitySampler, ConstantSampler, ContextBoundSampler, DensitySampler, SampleError, + SamplerContext, WorldField, WorldFields, + }, + noise::{DensityVolume, NanRange, Noise}, + position::{BlockPos, ChunkPos}, + random::{RandomSource, XoroshiroRandom}, +}; +use horizon_world::{ + DATA_VERSION, + heightmap::HeightmapState, + nbt::Tag, + registry::{BlockRegistry, BlockStateId}, + worldgen::{ + anchor::WorldGenerationContext, + material_condition::{ + MaterialCondition, MaterialRule, MaterialRuleError, MaterialSurfaceQueries, + }, + material_extensions::{ExtensionBlocks, ExtensionNoises, MaterialExtensions}, + material_stage::{SurfaceInputs, TopMaterialInputs, build_surface, top_material}, + terrain::{TerrainBlockStates, TerrainChunk}, + }, +}; +use std::sync::{ + Arc, + atomic::{AtomicUsize, Ordering}, +}; + +#[derive(Clone, Copy)] +struct State(u32); +impl HeightmapState for State { + fn is_air(self) -> bool { + self.0 < 2 + } + fn is_air_block(self) -> bool { + self.0 == 0 + } + fn has_fluid(self) -> bool { + self.0 == 3 + } + fn blocks_motion_in_heightmap(self) -> bool { + self.0 == 2 + } + fn blocks_motion_in_heightmap_no_leaves(self) -> bool { + self.0 == 2 + } +} +struct Properties; +impl TerrainBlockStates for Properties { + type State = State; + fn heightmap_state(&self, id: BlockStateId) -> State { + State(id.0) + } +} +#[derive(Debug)] +struct Zero; +impl Noise for Zero { + fn range(&self) -> Result<[f32; 2], NanRange> { + Ok([0.; 2]) + } + fn get2(&self, _: f64, _: f64) -> f32 { + 0. + } + fn get3(&self, _: f64, _: f64, _: f64) -> f32 { + 0. + } +} +struct Surface { + calls: usize, + fail_at: Option, +} +impl MaterialSurfaceQueries for Surface { + fn surface_depth(&mut self, _: i32, _: i32) -> i32 { + 1 + } + fn surface_secondary(&mut self, _: i32, _: i32) -> f64 { + 0. + } + fn biome(&mut self, _: BlockPos) -> Result>, MaterialRuleError> { + self.calls += 1; + if self.fail_at == Some(self.calls) { + Err(MaterialRuleError::MissingBiome) + } else { + Ok(Some(Arc::from("minecraft:plains"))) + } + } +} +#[derive(Debug)] +struct Count(Arc); +impl DensitySampler for Count { + fn sample_value(&self, _: &mut SamplerContext, _: [i32; 3]) -> Result { + self.0.fetch_add(1, Ordering::SeqCst); + Ok(42.) + } +} +#[derive(Debug)] +struct Fails; +impl DensitySampler for Fails { + fn sample_value(&self, _: &mut SamplerContext, _: [i32; 3]) -> Result { + Err(SampleError::RecursiveCache) + } +} +fn registry() -> BlockRegistry { + let names = [ + "minecraft:air", + "minecraft:void_air", + "minecraft:stone", + "minecraft:water", + ]; + BlockRegistry::from_nbt(&Tag::compound([ + ("DataVersion", Tag::Int(DATA_VERSION)), + ( + "states", + Tag::List( + names + .iter() + .map(|name| Tag::compound([("id", Tag::String((*name).into()))])) + .collect(), + ), + ), + ( + "defaults", + Tag::Compound( + names + .iter() + .enumerate() + .map(|(id, name)| ((*name).into(), Tag::Int(id as i32))) + .collect(), + ), + ), + ])) + .unwrap() +} + +#[test] +fn density_context_survives_success_binding_failure_and_partial_chunk_failure() { + let registry = registry(); + for scenario in 0..3 { + let mut chunk = + TerrainChunk::new(ChunkPos::new(0, 0), 0, 16, ®istry, Properties).unwrap(); + chunk.set_block_raw(0, 5, 0, BlockStateId(2)).unwrap(); + chunk.set_block_raw(0, 5, 1, BlockStateId(2)).unwrap(); + let count = Arc::new(AtomicUsize::new(0)); + let cached = CachingDensitySampler::new(0, Arc::new(Count(count.clone()))).unwrap(); + let mut context = SamplerContext::cached().with_world_fields( + WorldFields::default() + .with_field(WorldField::BlendOffset, Arc::new(ConstantSampler(73.))), + ); + assert_eq!(cached.sample_value(&mut context, [100, 2, 3]).unwrap(), 42.); + let root = XoroshiroRandom::new(0).fork_positional(); + let extensions = MaterialExtensions::new( + root, + ExtensionBlocks { + default: BlockStateId(2), + water: BlockStateId(3), + packed_ice: BlockStateId(2), + snow: BlockStateId(2), + }, + ExtensionNoises { + badlands_surface: Arc::new(Zero), + badlands_pillar: Arc::new(Zero), + badlands_roof: Arc::new(Zero), + iceberg_surface: Arc::new(Zero), + iceberg_pillar: Arc::new(Zero), + iceberg_roof: Arc::new(Zero), + }, + 8, + ); + let mut surface = Surface { + calls: 0, + fail_at: (scenario == 1).then_some(2), + }; + let rule = if scenario == 2 { + MaterialRule::OreVein { + ore: BlockStateId(2), + raw_ore: BlockStateId(2), + filler: BlockStateId(2), + raw_ore_chance: 0.5, + density: Arc::new(Fails), + richness: Arc::new(ConstantSampler(1.)), + filler_gap: Arc::new(ConstantSampler(-1.)), + } + } else { + MaterialRule::Block(BlockStateId(3)) + }; + let result = build_surface( + &mut chunk, + rule, + SurfaceInputs:: { + generation: WorldGenerationContext::new(0, 16, 8), + noise_volume: DensityVolume::new([16; 3], [0; 3], [1; 3]).unwrap(), + root, + surface: &mut surface, + preliminary_surface: Arc::new(ConstantSampler(0.)), + density_context: &mut context, + write_min_y: 0, + write_max_y: 15, + }, + &extensions, + ); + assert_eq!(result.is_ok(), scenario == 0); + assert_eq!(cached.sample_value(&mut context, [100, 2, 3]).unwrap(), 42.); + assert_eq!( + count.load(Ordering::SeqCst), + 1, + "the caller's cache was lost" + ); + assert_eq!( + ContextBoundSampler::new(WorldField::BlendOffset) + .sample_value(&mut context, [0; 3]) + .unwrap(), + 73. + ); + assert_eq!( + chunk.block(0, 5, 0), + BlockStateId(if scenario == 2 { 2 } else { 3 }) + ); + assert_eq!( + chunk.block(0, 5, 1), + BlockStateId(if scenario == 0 { 3 } else { 2 }) + ); + assert_eq!(chunk.postprocessing()[0].len(), [2, 1, 0][scenario]); + assert_eq!(surface.calls, [256, 2, 0][scenario]); + } +} + +#[test] +fn top_material_retains_context_on_failure_and_ignores_possible_biome_shortcuts() { + struct Restricted(Surface); + impl MaterialSurfaceQueries for Restricted { + fn possible_biomes(&self) -> Option> { + Some(std::collections::BTreeSet::new()) + } + fn surface_depth(&mut self, _: i32, _: i32) -> i32 { + 1 + } + fn surface_secondary(&mut self, _: i32, _: i32) -> f64 { + 0. + } + fn biome(&mut self, p: BlockPos) -> Result>, MaterialRuleError> { + self.0.biome(p) + } + } + let registry = registry(); + for fail in [false, true] { + let mut chunk = + TerrainChunk::new(ChunkPos::new(0, 0), 0, 16, ®istry, Properties).unwrap(); + chunk.set_block_raw(0, 5, 0, BlockStateId(2)).unwrap(); + let count = Arc::new(AtomicUsize::new(0)); + let cached = CachingDensitySampler::new(0, Arc::new(Count(count.clone()))).unwrap(); + let mut context = SamplerContext::cached().with_world_fields( + WorldFields::default() + .with_field(WorldField::BlendOffset, Arc::new(ConstantSampler(73.))), + ); + assert_eq!(cached.sample_value(&mut context, [100, 2, 3]).unwrap(), 42.); + let mut surface = Restricted(Surface { + calls: 0, + fail_at: fail.then_some(1), + }); + let rule = MaterialRule::Condition { + if_true: MaterialCondition::Biome(vec!["minecraft:plains".to_owned()]), + then_run: Box::new(MaterialRule::Block(BlockStateId(3))), + }; + let result = top_material( + &mut chunk, + rule, + TopMaterialInputs:: { + generation: WorldGenerationContext::new(0, 16, 8), + root: XoroshiroRandom::new(0).fork_positional(), + surface: &mut surface, + preliminary_surface: Arc::new(ConstantSampler(0.)), + density_context: &mut context, + }, + BlockPos::new(0, 5, 0), + true, + ); + if fail { + assert!(result.is_err()); + } else { + assert_eq!(result.unwrap(), Some(BlockStateId(3))); + } + assert_eq!(surface.0.calls, 1); + assert_eq!(cached.sample_value(&mut context, [100, 2, 3]).unwrap(), 42.); + assert_eq!(count.load(Ordering::SeqCst), 1); + assert_eq!( + ContextBoundSampler::new(WorldField::BlendOffset) + .sample_value(&mut context, [0; 3]) + .unwrap(), + 73. + ); + assert_eq!(chunk.block(0, 5, 0), BlockStateId(2)); + assert!(chunk.postprocessing()[0].is_empty()); + } +} diff --git a/crates/horizon-world/tests/placement_bounds.rs b/crates/horizon-world/tests/placement_bounds.rs new file mode 100644 index 000000000..ca9610ceb --- /dev/null +++ b/crates/horizon-world/tests/placement_bounds.rs @@ -0,0 +1,58 @@ +use horizon_core::random::LegacyRandom; +use horizon_world::{ + heightmap::HeightmapType, + worldgen::{ + anchor::WorldGenerationContext, + placement::{ + LayerBlock, PlacementContext, PlacementError, PlacementModifier, PlacementQueryError, + }, + value_provider::IntProvider, + }, +}; + +#[test] +fn negative_cuboid_extent_skips_empty_loops_even_with_huge_other_extents() { + let modifier = PlacementModifier::Cuboid { + xz_size: IntProvider::Constant(i32::MAX), + y_size: IntProvider::Constant(-1), + include_edges: true, + include_interior: true, + }; + let result = modifier.modify( + WorldGenerationContext::new(0, 16, 8), + &mut LegacyRandom::new(0), + [0, 0, 0], + |_, _| -> Result<(), ()> { panic!("empty cuboid emitted") }, + ); + assert!(result.is_ok()); +} +struct UnboundedColumn { + reads: usize, +} +impl PlacementContext for UnboundedColumn { + fn generation(&self) -> WorldGenerationContext { + WorldGenerationContext::new(-64, 384, 63) + } + fn min_y(&mut self) -> Result { + Ok(-64) + } + fn height(&mut self, _: HeightmapType, _: i32, _: i32) -> Result { + Ok(i32::MAX) + } + fn layer_block(&mut self, _: [i32; 3]) -> Result { + self.reads += 1; + Ok(LayerBlock::Empty) + } +} +#[test] +fn layered_scans_bound_work_when_world_queries_return_extreme_heights() { + let mut context = UnboundedColumn { reads: 0 }; + let result = PlacementModifier::CountOnEveryLayer(IntProvider::Constant(1)).modify_in( + &mut context, + &mut LegacyRandom::new(0), + [0, 0, 0], + |_, _| -> Result<(), ()> { panic!("empty column emitted") }, + ); + assert!(matches!(result, Err(PlacementError::WorkLimit))); + assert!(context.reads > 0 && context.reads <= 65536); +} diff --git a/crates/horizon-world/tests/placement_queries.rs b/crates/horizon-world/tests/placement_queries.rs new file mode 100644 index 000000000..e49bfd8ae --- /dev/null +++ b/crates/horizon-world/tests/placement_queries.rs @@ -0,0 +1,45 @@ +use horizon_core::random::{LegacyRandom, RandomSource}; +use horizon_world::{ + heightmap::HeightmapType, + worldgen::{ + anchor::WorldGenerationContext, + placement::{PlacementContext, PlacementError, PlacementModifier, PlacementQueryError}, + }, +}; +struct Context { + queries: Vec, +} +impl PlacementContext for Context { + fn generation(&self) -> WorldGenerationContext { + WorldGenerationContext::new(0, 16, 8) + } + fn min_y(&mut self) -> Result { + panic!("water depth does not query the world minimum") + } + fn height(&mut self, kind: HeightmapType, _: i32, _: i32) -> Result { + self.queries.push(kind); + if kind == HeightmapType::OceanFloor { + Ok(7) + } else { + Err(PlacementQueryError::Failed("surface unavailable".into())) + } + } +} +#[test] +fn second_height_query_failure_preserves_order_without_emission_or_random_draws() { + let mut context = Context { queries: vec![] }; + let mut random = LegacyRandom::new(17); + let mut expected = random.clone(); + let result = PlacementModifier::SurfaceWaterDepth(7).modify_in( + &mut context, + &mut random, + [1, 9, 2], + |_, _| -> Result<(), ()> { panic!("failed query emitted a position") }, + ); + assert!(matches!(result, Err(PlacementError::World(_)))); + assert_eq!( + context.queries, + [HeightmapType::OceanFloor, HeightmapType::WorldSurface] + ); + assert_eq!(random.next_long(), expected.next_long()); +} diff --git a/crates/horizon-world/tests/rule_test_bounds.rs b/crates/horizon-world/tests/rule_test_bounds.rs new file mode 100644 index 000000000..de4862f54 --- /dev/null +++ b/crates/horizon-world/tests/rule_test_bounds.rs @@ -0,0 +1,69 @@ +use horizon_world::{ + DATA_VERSION, + nbt::Tag, + registry::BlockRegistry, + worldgen::{block_feature::FeatureBlockBindings, rule_test::RuleTest}, +}; +use std::collections::{BTreeMap, BTreeSet}; +fn registry() -> BlockRegistry { + let names = [ + "minecraft:air", + "minecraft:cave_air", + "minecraft:void_air", + "minecraft:stone", + ]; + BlockRegistry::from_nbt(&Tag::compound([ + ("DataVersion", Tag::Int(DATA_VERSION)), + ( + "states", + Tag::List( + names + .iter() + .map(|name| Tag::compound([("id", Tag::String((*name).into()))])) + .collect(), + ), + ), + ( + "defaults", + Tag::Compound( + names + .iter() + .enumerate() + .map(|(id, name)| ((*name).into(), Tag::Int(id as i32))) + .collect(), + ), + ), + ])) + .unwrap() +} +#[test] +fn rule_decoding_bounds_nested_and_branching_data() { + let registry = registry(); + let bindings = FeatureBlockBindings::new(®istry, BTreeSet::new()).unwrap(); + let leaf = r#"{"predicate_type":"always_true"}"#; + let mut nested = leaf.to_owned(); + for _ in 0..130 { + nested = format!(r#"{{"predicate_type":"not","rule":{nested}}}"#); + } + assert!(RuleTest::from_json(&nested, &bindings).is_err()); + let branch = format!( + r#"{{"predicate_type":"all_of","rules":[{}]}}"#, + vec![leaf; 8192].join(",") + ); + let tree = format!( + r#"{{"predicate_type":"all_of","rules":[{}]}}"#, + [branch.as_str(); 9].join(",") + ); + assert!(RuleTest::from_json(&tree, &bindings).is_err()); +} +#[test] +fn binding_rejects_unknown_tag_blocks_and_duplicate_canonical_tags() { + let registry = registry(); + let tags = BTreeMap::from([("horizon:test".into(), vec!["missing".into()])]); + assert!(FeatureBlockBindings::with_tags(®istry, BTreeSet::new(), &tags).is_err()); + let tags = BTreeMap::from([ + ("test".into(), vec!["stone".into()]), + ("minecraft:test".into(), vec!["air".into()]), + ]); + assert!(FeatureBlockBindings::with_tags(®istry, BTreeSet::new(), &tags).is_err()); +} diff --git a/crates/horizon-world/tests/state_provider_bounds.rs b/crates/horizon-world/tests/state_provider_bounds.rs new file mode 100644 index 000000000..033d4675c --- /dev/null +++ b/crates/horizon-world/tests/state_provider_bounds.rs @@ -0,0 +1,81 @@ +use horizon_world::{ + DATA_VERSION, + nbt::Tag, + registry::BlockRegistry, + worldgen::state_provider::{BlockStateProvider, StateProviderBindings, StateProviderCatalog}, +}; +use std::collections::{BTreeMap, BTreeSet}; +#[test] +fn bound_recursive_providers_and_registry_lists_before_sampling() { + let registry = BlockRegistry::from_nbt(&Tag::compound([ + ("DataVersion", Tag::Int(DATA_VERSION)), + ( + "states", + Tag::List(vec![Tag::compound([( + "id", + Tag::String("minecraft:stone".into()), + )])]), + ), + ( + "defaults", + Tag::compound([("minecraft:stone", Tag::Int(0))]), + ), + ])) + .unwrap(); + let bindings = + StateProviderBindings::new(®istry, BTreeSet::new(), &BTreeMap::new()).unwrap(); + let mut source = r#"{"id":"stone"}"#.to_owned(); + for _ in 0..140 { + source = format!(r#"{{"type":"rotated","state":{source}}}"#); + } + assert!(BlockStateProvider::from_json(&source, &bindings).is_err()); + let source = serde_json::json!({"type":"random_block","blocks":vec!["stone";8193]}).to_string(); + assert!(BlockStateProvider::from_json(&source, &bindings).is_err()); + let rule = serde_json::json!({"if_true":{"type":"true"},"then":{"id":"stone"}}); + let valid = serde_json::json!({"type":"rule_based","rules":vec![rule.clone();8192]}); + assert!(BlockStateProvider::from_json(&valid.to_string(), &bindings).is_ok()); + let oversized = serde_json::json!({"type":"rule_based","rules":vec![rule;8193]}); + assert!(BlockStateProvider::from_json(&oversized.to_string(), &bindings).is_err()); + // Every individual list fits, but the aggregate predicate/provider tree + // must share a work budget rather than resetting it for each rule. + let branching = serde_json::json!({"if_true":{"type":"all_of","predicates":vec![serde_json::json!({"type":"true"});7]},"then":{"id":"stone"}}); + let oversized = serde_json::json!({"type":"rule_based","rules":vec![branching;8192]}); + assert!(BlockStateProvider::from_json(&oversized.to_string(), &bindings).is_err()); + let tags = BTreeMap::from([("horizon:oversized".into(), vec!["stone".into(); 8193])]); + assert!(StateProviderBindings::new(®istry, BTreeSet::new(), &tags).is_err()); + let tags = BTreeMap::from([("tag".into(), vec![]), ("minecraft:tag".into(), vec![])]); + assert!(StateProviderBindings::new(®istry, BTreeSet::new(), &tags).is_err()); + let definitions = BTreeMap::from([ + ( + "horizon:cycle".into(), + r#"{"type":"copy_properties","source":"horizon:cycle"}"#.into(), + ), + ("horizon:valid".into(), r#"{"id":"stone"}"#.into()), + ("horizon:invalid".into(), r#"{"type":"missing"}"#.into()), + ("horizon:alias".into(), r#""horizon:valid""#.into()), + ]); + let catalog = StateProviderCatalog::from_resources(&definitions).unwrap(); + assert!(catalog.provider(r#""horizon:valid""#, &bindings).is_ok()); + for name in [ + "horizon:cycle", + "horizon:invalid", + "horizon:alias", + "horizon:missing", + ] { + assert!( + catalog + .provider(&serde_json::to_string(name).unwrap(), &bindings) + .is_err() + ); + } + assert!( + catalog + .direct_provider(r#""horizon:valid""#, &bindings) + .is_err() + ); + let duplicate = BTreeMap::from([ + ("stone".into(), "{}".into()), + ("minecraft:stone".into(), "{}".into()), + ]); + assert!(StateProviderCatalog::from_resources(&duplicate).is_err()); +} diff --git a/crates/horizon-world/tests/tick_data.rs b/crates/horizon-world/tests/tick_data.rs new file mode 100644 index 000000000..7060b57a4 --- /dev/null +++ b/crates/horizon-world/tests/tick_data.rs @@ -0,0 +1,117 @@ +use horizon_core::{ + position::BlockPos, + ticks::{SavedTick, TickPriority, TickTypeId}, +}; +use horizon_world::{ + DATA_VERSION, + chunk::ChunkData, + nbt::{NamedTag, Tag}, + tick_data::{self, TickKind}, +}; + +fn saved(pos: BlockPos) -> SavedTick { + SavedTick { + kind: TickTypeId(7), + pos, + delay: -1, + priority: TickPriority::High, + } +} +fn root() -> NamedTag { + NamedTag { + name: "".into(), + tag: Tag::compound([ + ("DataVersion", Tag::Int(DATA_VERSION)), + ("xPos", Tag::Int(-1)), + ("zPos", Tag::Int(-1)), + ("sections", Tag::List(vec![])), + ("unknown", Tag::Long(42)), + ]), + } +} +#[test] +fn numeric_codec_narrowing_and_malformed_data() { + let tag = Tag::List(vec![Tag::compound([ + ("i", Tag::String("minecraft:stone".into())), + ("x", Tag::Double((-1.5f64).to_bits())), + ("y", Tag::Float(f32::NAN.to_bits())), + ("z", Tag::Byte(-1)), + ("t", Tag::Long(i64::MAX)), + ("p", Tag::Double(f64::NEG_INFINITY.to_bits())), + ])]); + let ticks = tick_data::read_list(&tag, |_| Some(TickTypeId(7))).unwrap(); + assert_eq!( + ticks, + [SavedTick { + pos: BlockPos::new(-1, 0, -1), + priority: TickPriority::ExtremelyHigh, + ..saved(BlockPos::default()) + }] + ); + assert!(tick_data::read_list(&tag, |_| None).is_err()); + assert!(tick_data::read_list(&Tag::List(vec![Tag::Int(1)]), |_| Some(TickTypeId(0))).is_err()); + assert!(tick_data::read_list(&Tag::Int(0), |_| Some(TickTypeId(0))).is_err()); + assert!(tick_data::write_list(&ticks, |_| None).is_err()); +} +#[test] +fn saved_chunk_ticks_filter_coordinates_and_write_atomically() { + let mut root = root(); + let Tag::Compound(map) = &mut root.tag else { + unreachable!() + }; + map.insert( + "block_ticks".into(), + tick_data::write_list( + &[ + saved(BlockPos::new(-1, 64, -1)), + saved(BlockPos::new(0, 64, -1)), + ], + |_| Some("minecraft:stone".to_owned()), + ) + .unwrap(), + ); + let mut chunk = ChunkData::new(root).unwrap(); + let mut ticks = chunk + .saved_ticks(TickKind::Block, |_| Some(TickTypeId(7))) + .unwrap(); + assert_eq!(ticks.count(), 1); + assert!(ticks.has_scheduled(BlockPos::new(-1, 64, -1), TickTypeId(7))); + assert!(!ticks.has_scheduled(BlockPos::new(0, 64, -1), TickTypeId(7))); + assert!( + chunk + .saved_ticks(TickKind::Fluid, |_| None) + .unwrap() + .peek() + .is_none() + ); + ticks.unpack(100); + let packed = ticks.pack(100); + let before = chunk.root().clone(); + assert!( + chunk + .set_saved_ticks(TickKind::Block, &packed, |_| None) + .is_err() + ); + assert_eq!(chunk.root(), &before); + assert!( + chunk + .set_saved_ticks(TickKind::Block, &[saved(BlockPos::new(0, 64, -1))], |_| { + Some("minecraft:stone".to_owned()) + }) + .is_err() + ); + assert_eq!(chunk.root(), &before); + chunk + .set_saved_ticks(TickKind::Block, &packed, |_| { + Some("minecraft:stone".to_owned()) + }) + .unwrap(); + assert_eq!(chunk.root().tag.get("unknown"), Some(&Tag::Long(42))); + assert_eq!( + chunk + .saved_ticks(TickKind::Block, |_| Some(TickTypeId(7))) + .unwrap() + .count(), + 1 + ); +} diff --git a/crates/horizon-world/tests/weighted_provider.rs b/crates/horizon-world/tests/weighted_provider.rs new file mode 100644 index 000000000..574e1bb4c --- /dev/null +++ b/crates/horizon-world/tests/weighted_provider.rs @@ -0,0 +1,53 @@ +use horizon_world::worldgen::{ + height_provider::HeightProvider, value_provider::IntProvider, weighted::WeightedList, +}; + +#[test] +fn weighted_lists_reject_invalid_totals_and_bound_entry_allocations() { + assert!(WeightedList::<()>::new(vec![]).is_err()); + assert!(WeightedList::new(vec![((), 0)]).is_err()); + assert!(WeightedList::new(vec![((), -1), ((), 2)]).is_err()); + assert!(WeightedList::new(vec![((), i32::MAX), ((), 1)]).is_err()); + assert!(WeightedList::new(vec![((), i32::MAX)]).is_ok()); + assert!(WeightedList::new(vec![((), 1); 8192]).is_ok()); + assert!(WeightedList::new(vec![((), 1); 8193]).is_err()); +} + +#[test] +fn branching_provider_decoders_share_a_total_node_budget() { + for height in [false, true] { + let leaf = if height { r#"{"absolute":0}"# } else { "0" }; + let entry = format!(r#"{{"data":{leaf},"weight":1}}"#); + let branch = format!( + r#"{{"type":"weighted_list","distribution":[{}]}}"#, + vec![entry; 256].join(",") + ); + let entry = format!(r#"{{"data":{branch},"weight":1}}"#); + let tree = format!( + r#"{{"type":"weighted_list","distribution":[{}]}}"#, + vec![entry; 256].join(",") + ); + // Each list is below its own limit, but the whole tree exceeds 65536 nodes. + if height { + assert!(HeightProvider::from_json(&tree).is_err()); + } else { + assert!(IntProvider::from_json(&tree).is_err()); + } + } +} + +#[test] +fn optional_weighted_choices_retain_zero_entries_and_skip_empty_draws() { + use horizon_core::random::{LegacyRandom, RandomSource}; + use horizon_world::worldgen::weighted::OptionalWeightedList; + let mut random = LegacyRandom::new(12); + let mut expected = random.clone(); + let empty = OptionalWeightedList::<()>::new(vec![]).unwrap(); + assert_eq!(empty.sample(&mut random).unwrap(), None); + let zero = OptionalWeightedList::new(vec![(1, 0), (2, 0)]).unwrap(); + assert_eq!(zero.entries(), &[(1, 0), (2, 0)]); + assert_eq!(zero.sample(&mut random).unwrap(), None); + assert_eq!(random.next_long(), expected.next_long()); + assert!(WeightedList::new(vec![(1, 0), (2, 0)]).is_err()); + assert!(OptionalWeightedList::new(vec![(1, i32::MAX), (2, 1)]).is_err()); +} diff --git a/crates/horizon-world/tests/world_io.rs b/crates/horizon-world/tests/world_io.rs new file mode 100644 index 000000000..bbbfab360 --- /dev/null +++ b/crates/horizon-world/tests/world_io.rs @@ -0,0 +1,199 @@ +use horizon_core::position::{BlockPos, ChunkPos}; +use horizon_world::{ + DATA_VERSION, + chunk::{BlockState, ChunkData, PalettedContainer}, + compression::Compression, + nbt::{JavaString, Limits, NamedTag, Tag}, + region::{ChunkRecord, RegionFile, RegionWriter}, +}; +use std::{ + fs, + io::{Seek, SeekFrom, Write}, + path::{Path, PathBuf}, + sync::atomic::{AtomicU64, Ordering}, +}; + +static NEXT: AtomicU64 = AtomicU64::new(0); +struct Directory(PathBuf); +impl Directory { + fn new() -> Self { + let stamp = std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .unwrap() + .as_nanos(); + let path = std::env::temp_dir().join(format!( + "horizon-world-test-{}-{stamp}-{}", + std::process::id(), + NEXT.fetch_add(1, Ordering::Relaxed) + )); + fs::create_dir(&path).unwrap(); + Self(path) + } + fn region(&self) -> PathBuf { + self.0.join("r.-1.0.mca") + } +} +impl Drop for Directory { + fn drop(&mut self) { + let _ = fs::remove_dir_all(&self.0); + } +} + +fn record(len: usize) -> ChunkRecord { + ChunkRecord { + compression: Compression::None, + compressed: vec![37; len], + timestamp: 0x8000_0001, + } +} + +#[test] +fn external_threshold_negative_coordinates_and_timestamps_roundtrip() { + let dir = Directory::new(); + let a = ChunkPos::new(-32, 0); + let b = ChunkPos::new(-1, 31); + let inline = record(255 * 4096 - 5); + let external = record(255 * 4096 - 4); + let mut writer = RegionWriter::create(dir.region()).unwrap(); + writer.write(a, &inline).unwrap(); + writer.write(b, &external).unwrap(); + writer.finish().unwrap(); + assert!(!dir.0.join("c.-32.0.mcc").exists()); + assert!(dir.0.join("c.-1.31.mcc").exists()); + let mut reader = RegionFile::open(dir.region()).unwrap(); + assert_eq!( + reader.chunks().collect::>(), + [(a, inline.timestamp), (b, external.timestamp)] + ); + for (pos, expected) in [(a, inline), (b, external)] { + let actual = reader.read(pos).unwrap().unwrap(); + assert_eq!(actual.compressed, expected.compressed); + assert_eq!(actual.timestamp, expected.timestamp); + } + assert!(reader.read(ChunkPos::new(-31, 0)).unwrap().is_none()); + assert!(reader.read(ChunkPos::new(0, 0)).is_err()); +} + +#[test] +fn failed_writer_cannot_commit_and_removes_its_own_external_files() { + let dir = Directory::new(); + let mut writer = RegionWriter::create(dir.region()).unwrap(); + writer + .write(ChunkPos::new(-1, 0), &record(1_100_000)) + .unwrap(); + assert!(dir.0.join("c.-1.0.mcc").exists()); + assert!(writer.write(ChunkPos::new(0, 0), &record(4)).is_err()); + assert!(writer.finish().is_err()); + assert!(!dir.region().exists()); + assert_eq!(fs::read_dir(&dir.0).unwrap().count(), 0); +} + +#[test] +fn existing_external_and_concurrent_destination_are_preserved() { + let dir = Directory::new(); + let external = dir.0.join("c.-1.0.mcc"); + fs::write(&external, b"owned by someone else").unwrap(); + let mut writer = RegionWriter::create(dir.region()).unwrap(); + assert!( + writer + .write(ChunkPos::new(-1, 0), &record(1_100_000)) + .is_err() + ); + drop(writer); + assert_eq!(fs::read(&external).unwrap(), b"owned by someone else"); + let mut writer = RegionWriter::create(dir.region()).unwrap(); + writer.write(ChunkPos::new(-32, 0), &record(3)).unwrap(); + fs::write(dir.region(), b"another writer won").unwrap(); + assert!(writer.finish().is_err()); + assert_eq!(fs::read(dir.region()).unwrap(), b"another writer won"); + assert!(RegionWriter::create(dir.region()).is_err()); +} + +fn malformed_region(path: &Path, first: u32, second: u32, payload_len: u32, codec: u8) { + let mut file = fs::File::create(path).unwrap(); + file.set_len(12288).unwrap(); + file.write_all(&first.to_be_bytes()).unwrap(); + file.write_all(&second.to_be_bytes()).unwrap(); + file.seek(SeekFrom::Start(8192)).unwrap(); + file.write_all(&payload_len.to_be_bytes()).unwrap(); + file.write_all(&[codec]).unwrap(); +} + +#[test] +fn corrupt_allocations_lengths_codecs_and_missing_external_files_fail() { + let dir = Directory::new(); + for (first, second) in [(257, 0), (512, 0), (1025, 0), (513, 513)] { + malformed_region(&dir.region(), first, second, 1, 3); + assert!(RegionFile::open(dir.region()).is_err()); + } + for (len, codec) in [ + (0, 3), + (4093, 3), + (u32::MAX, 3), + (1, 127), + (2, 131), + (1, 131), + ] { + malformed_region(&dir.region(), 513, 0, len, codec); + let mut reader = RegionFile::open(dir.region()).unwrap(); + assert!(reader.read(ChunkPos::new(-32, 0)).is_err()); + } +} + +#[test] +fn chunk_storage_edit_preserves_unknown_fields_and_other_blocks() { + let palette = + PalettedContainer::uniform(Tag::String(JavaString::from("minecraft:air")), 4096, 4) + .unwrap(); + let root = NamedTag { + name: "".into(), + tag: Tag::compound([ + ("DataVersion", Tag::Int(DATA_VERSION)), + ("xPos", Tag::Int(-1)), + ("zPos", Tag::Int(-1)), + ("extra", Tag::ByteArray(vec![1, 2, 3])), + ( + "sections", + Tag::List(vec![Tag::compound([ + ("Y", Tag::Byte(-4)), + ("block_states", palette.to_nbt()), + ("unknown", Tag::Long(99)), + ])]), + ), + ]), + }; + let mut chunk = ChunkData::new(root).unwrap(); + let p = BlockPos::new(-1, -64, -1); + let state = BlockState { + name: "minecraft:oak_log".to_owned(), + properties: [("axis".to_owned(), "x".to_owned())].into(), + }; + assert_eq!( + chunk.set_block_data(p, state.clone()).unwrap().name, + "minecraft:air" + ); + assert_eq!(chunk.block(p).unwrap(), Some(state)); + assert_eq!( + chunk.block(p.offset(-1, 0, 0)).unwrap().unwrap().name, + "minecraft:air" + ); + assert!( + chunk + .set_block_data( + p.offset(1, 0, 0), + BlockState { + name: "minecraft:stone".into(), + properties: Default::default() + } + ) + .is_err() + ); + let root = chunk.into_nbt(); + assert_eq!(root.tag.get("extra"), Some(&Tag::ByteArray(vec![1, 2, 3]))); + let Some(Tag::List(sections)) = root.tag.get("sections") else { + panic!() + }; + assert_eq!(sections[0].get("unknown"), Some(&Tag::Long(99))); + let record = ChunkRecord::from_nbt(&root, Compression::Lz4, 17, Limits::default()).unwrap(); + assert_eq!(record.nbt(Limits::default()).unwrap(), root); +} diff --git a/docs/biome-lookup.md b/docs/biome-lookup.md new file mode 100644 index 000000000..a1d069b34 --- /dev/null +++ b/docs/biome-lookup.md @@ -0,0 +1,133 @@ +# Biome lookup + +Horizon implements Java Edition **26.3** block-to-quart biome lookup. `BiomeZoom` +accepts the obfuscated biome seed and chooses among eight jittered quart corners +in vanilla order, retaining strict distance ties and signed coordinate wrapping. +The caller resolves the selected quart coordinate through its biome provider. +Direct noise-biome queries bypass this selection and shift block coordinates; +floating-point positions are floored with Java's saturating integer conversion. + +`obfuscate_seed` computes the vanilla SHA-256 transform of the little-endian world +seed and reads the first eight digest bytes as a little-endian signed long. The +core keeps a fixed-input implementation without adding runtime dependencies. + +Run `python3 tools/test_biome_zoom_parity.py`. The +[local report](../benchmarks/rust-biome-zoom-2026-10-06/scoped-parity.json) records +**256,933 matching lines per reference JAR**: **4,104 seed hashes**, **169,408 block +queries** and **83,421 floating-position queries**. Actual vanilla `BiomeManager` +methods call a traced resolver; the suite compares selected quart coordinates, +direct queries and source replacement retaining the same zoom seed. Seed hashes +also match Python `hashlib` independently. + +The corpus includes dense neighborhoods, negative quart boundaries, both signed +integer extremes, distant coordinates, randomized seeds/positions, and double +NaNs, infinities and subnormals. Source and fixture hashes are captured, changes +during validation invalidate the result, and reference artifacts stay private. +CI includes the comparison; remote outcomes have not been observed. + +This validates coordinate selection, not biome storage, biome-source generation, +chunk blending, or complete generated worlds. + + +## Chunk biome storage + +`BiomeChunk` stores each section's 64 quart-resolution biome values. Reads clamp +quart Y to the chunk and wrap quart X/Z into its local grid. Fills visit sections +bottom to top and query each section in X/Y/Z order. Each completed section is +committed; a resolver failure retains the failing section's previous values. +Inclusive generation bounds select all intersecting sections. + +Run `python3 tools/test_biome_chunk_parity.py`. The +[local chunk report](../benchmarks/rust-biome-chunk-2026-10-06/scoped-parity.json) +records **478,340 matching lines per reference JAR** across **20 fixtures** and +**160 fills**, including **21,120 quart-biome queries**. Native `ProtoChunk` and +`LevelChunkSection` methods supply the reference behavior. Tests use synthetic +holder identities, up to 512 distinct values, repeated fills, provider failures +at calls 0/63/64/65, generation bounds cutting through sections, and the complete +supported aligned vertical range. The reference chunk is at BIOMES status. + +This storage uses dense arrays and compares biome values rather than vanilla's +internal palette layout. Packet/save integration and chunk lifecycle transitions +remain separate work. Clipped generation bounds must remain within the chunk; +invalid bounds return an error before mutation. + + +## Chunk biome generation + +The [generation report](../benchmarks/rust-biome-generation-2026-10-06/scoped-parity.json) +records **383,072 matching lines per JAR** across **252 fixtures**, **322 fills**, +**341,504 stored biome values** and **35,910 subsequent block-position lookups**. +Run `python3 tools/test_biome_generation_parity.py` to compare against actual +`ChunkGenerator.doCreateBiomes`, invoked through `NoiseBasedChunkGenerator`. + +Rust compiles the climate fields of all seven bundled terrain routers, samples +the chunk's quart volume, searches its multi-noise parameter table and fills +biome sections. The suite pairs each router with both Overworld and Nether +presets, both random modes and three seed/coordinate combinations. Repeated +fills create fresh density contexts while retaining nearest-search state. +Generation bounds also exercise omitted top and bottom sections. Subsequent +block lookups use seeded fuzzy selection and clamped chunk reads. + +Both JARs independently export the preset tables and must agree: **7,594 Overworld +entries** and **5 Nether entries**. Rust imports those quantized tables; preset +builders remain unported. Registry-bound source codecs are described below. Reference holders +supply identities without evaluating biome properties. The comparison uses empty +blending and no below-zero retrogen. An additional 168 fixtures generate chunks through fixed, checkerboard and End +sources using every bundled terrain router. They cover real seeded End erosion, +the central-island boundary and wrapped checkerboard shifts. The [surface-stage integration](material-surfaces.md#chunk-surface-stage) now +links a 3×3 biome neighborhood to terrain filling and surface application, using +stored neighbor biome lookups. Saved biome palettes and complete world generation +remain pending. + + +## Fixed, checkerboard and End sources + +`FixedBiomeSource` always returns its configured value. `CheckerboardBiomeSource` +preserves masked Java shifts, wrapped addition and floor-modulo selection, +including duplicate values and unrestricted constructor scales. It supports up to +8,192 values; an empty list returns a typed lookup error. Its vanilla JSON codec +has the narrower scale range 0–62, with a default of 2. + +`EndBiomeSource` returns the central biome without querying erosion inside the +64-chunk radius. Outside that circle it samples erosion at the containing chunk's +center and wrapped block Y, then applies vanilla's highlands/midlands/islands/ +barrens thresholds. Sampler errors propagate without substituting a biome. + +Run `python3 tools/test_biome_source_parity.py`. The +[local source report](../benchmarks/rust-biome-source-2026-10-06/scoped-parity.json) +records **1,306,096 matching lines per JAR**, covering **457 fixtures** and +**1,147,984 queries**. Actual native source methods supply the results. The corpus +includes all 63 codec-valid checkerboard scales, unrestricted runtime scales, +empty/duplicate/512-value lists, extreme coordinates, exact End threshold +neighbors, NaN/infinity samples and failing erosion providers. Ordered erosion +sampling coordinates are compared. This source-level suite supplies constant +End density values; seeded density and chunk generation are validated separately. + + +## Registry-bound source codecs + +`BiomeSourceCatalog` decodes and canonically encodes fixed, checkerboard, End and +multi-noise definitions against known biome, tag and preset registries. Named +biomes, direct or tagged biome sets, inline climate lists, and named or inline +preset holders retain vanilla selection and fallback behavior. The catalog +validates references before returning a definition. + +`BiomeSourceDefinition::resolve` builds a `ResolvedBiomeSource` using imported +quantized preset tables. A worker resolver retains multi-noise search state, +prepares climate volumes only for multi-noise sources, and exposes one query API +for all four source kinds. Chunk generation and the surface-stage neighborhood +now use this API; surface integration decodes the source configuration itself. + +Run `python3 tools/test_biome_source_codec_parity.py`. The +[local codec report](../benchmarks/rust-biome-source-codec-2026-10-06/scoped-parity.json) +records **363,121 matching lines per JAR** across **40,481 inputs**, using all +**67 biome definitions** and **86 biome tags**. The native `BiomeSource.CODEC` +supplies parsing, canonical encoding, possible-biome sets and queries at seven +positions. The corpus covers every quantized climate step from −2 to 2, scale +bounds and numeric narrowing, malformed fields, duplicate keys, holder sets, +and inline-list preference and fallback to presets. Encoding comparisons use +serialized JSON numeric values, rather than Java's widened float values. + +Full inline biome definitions, native preset builders, live registry ownership +and reloads, biome-search helpers, blending, and complete generated worlds remain +pending. The bounded catalog is not a complete registry lifecycle implementation. diff --git a/docs/biome-temperatures.md b/docs/biome-temperatures.md new file mode 100644 index 000000000..b27e91edc --- /dev/null +++ b/docs/biome-temperatures.md @@ -0,0 +1,33 @@ +# Biome temperatures + +Horizon implements Java Edition **26.3** biome temperature sampling, including the +frozen modifier, height adjustment, rain/snow thresholds, precipitation selection +and the small frozen-ocean iceberg melt predicate. The fixed seeded simplex and +noise-stack sources use the existing Rust noise implementation. + +`BiomeTemperatureSettings` supplies the immutable inputs. `BiomeTemperature` is a +per-biome, per-worker cache, corresponding to vanilla's thread-local cache. Its +1,024-entry insertion order does not change on hits. Keys use packed block +positions and omit sea level, preserving both coordinate aliases and cached +results across sea-level changes. NaN values are recomputed, including vanilla's +eviction behavior when a cached NaN is queried at capacity. + +Run `python3 tools/test_biome_temperature_parity.py`. The +[local report](../benchmarks/rust-biome-temperature-2026-10-06/scoped-parity.json) +records **836,659 matching output lines per reference JAR** over **387 fixtures**, +including **12 thread-isolation fixtures**. The original Java transport invokes +actual biome methods and inspects native ordered cache contents. Test inputs +include arbitrary base-temperature bits, threshold neighbors, both modifiers, +precipitation enabled/disabled, extreme coordinates, sea-level overflow, packed +aliases, cache hits/eviction and actual native threads with separate Rust workers. + +The oracle constructs native climate settings and biomes with only the fields +these methods use. Climate-setting parsing now covers all **67 bundled biome definitions** and +**183 codec inputs**, including float rounding, overflow, field validation and +modifier defaults. Full biome codecs, climate encoding, world-dependent snow/ice placement, +automatic thread-local ownership for a shared +Rust biome object remain pending. Source/fixture hashes guard the comparison; +raw reference artifacts stay private under `.local`. + +[Material temperature and biome conditions](material-conditions.md) now use these +climate settings and cached temperature calculations in a separate integration suite. diff --git a/docs/block-state-codecs.md b/docs/block-state-codecs.md new file mode 100644 index 000000000..f56e48403 --- /dev/null +++ b/docs/block-state-codecs.md @@ -0,0 +1,25 @@ +# Block-state JSON codecs + +`BlockStateJsonCodec` implements compact and full Java Edition **26.3** block-state +JSON forms over the imported `BlockRegistry`, with integer property kinds supplied +alongside the registry. Compact encoding uses a block name for the default state; +full encoding uses an `id` object and properties for blocks with multiple states. + +Missing or invalid properties retain their defaults. Unknown property names are +ignored. Integer properties accept Java decimal strings, including signs, leading +zeroes and JDK 25 BMP decimal digits; enum and boolean properties use exact names. +This codec is separate from `BlockRegistry::resolve`, whose descriptor validation +continues to reject invalid properties. + +Run `python3 tools/test_block_state_codec_parity.py`. The +[local report](../benchmarks/rust-block-state-codec-2026-10-06/scoped-parity.json) +records **221,261 matching output lines per reference JAR**, covering all +**35,723 states**, **1,286 blocks**, **146 integer properties** and **185,538 decoding +inputs**. Tests exercise default/full encoding, namespaces, invalid types, +property fallback, integer overflow and duplicate fields. + +The two authenticated JARs must export identical state metadata. Exports and raw +comparison traces remain private under `.local`. The public report contains +metadata and hashes. This validates codec behavior over imported identities; +block gameplay, registry lifecycle, warning messages and arbitrary malformed +JSON/unpaired-surrogate text remain outside the tested scope. diff --git a/docs/carving.md b/docs/carving.md new file mode 100644 index 000000000..9dfcde8e6 --- /dev/null +++ b/docs/carving.md @@ -0,0 +1,126 @@ +# Carving + +Horizon implements Java Edition **26.3** carving-mask storage and traversal. +`CarvingMask` packs cells in Y/Z/X order into 64-bit words. Its column iterator +finds contiguous marked runs and splits them into inclusive vertical intervals, +using word scans without allocating a list of individual cells or columns. + +`try_visit_mut` retains vanilla callback behavior: adding cells during traversal +changes subsequent run searches, while an already selected run keeps its original +boundaries. Callback failures stop immediately and retain prior mutations. +Coordinate arithmetic wraps like Java, including positive out-of-range aliases; +negative indices return an error. Rust bounds height to 1–4,064 and positive growth +to 2^24 bits. Invalid construction and allocation limits are explicit errors. + +Run `python3 tools/test_carving_mask_parity.py`. The +[local report](../benchmarks/rust-carving-mask-2026-10-06/scoped-parity.json) +records **45,742 matching output lines per reference JAR**, across **28 fixtures** +and **6,988 operations**. The native `CarvingMask` supplies all reference results. +The corpus includes sparse and fully filled masks, duplicate insertions, word and +column boundaries, extreme signed coordinates, positive aliases, negative-index +failures, and successful or failing callbacks that add cells during traversal. +All corpus indices remain below 2^20. Reference artifacts remain private and +source/fixture hashes guard validation. + +This comparison covers masks. The combined generation check below also covers +neighbor biome selection and carver seeding; complete generated worlds remain pending. + +## Applying masks to terrain + +`apply_carving_mask` traverses each marked interval from top to bottom, applying +an optional caller-supplied predicate before block or aquifer queries. The +resolved `minecraft:uncarvable` tag prevents replacement. Grass and mycelium mark +a surface encountered within the current interval, including when the aquifer +returns no replacement. Subsequent exposed dirt beneath carved cells is restored +through `top_material`. Block changes update WG heightmaps; fluid postprocessing +retains vanilla order and duplicates. Later errors preserve prior effects. + +The [combined surface-stage report](../benchmarks/rust-material-stage-2026-10-06/scoped-parity.json) +records **6,733,382 matching lines per JAR**, including **158 carving passes** and +**21,757,952 block values** across noise filling, surface building and carving. +Actual `NoiseBasedChunkGenerator.applyCarvingMask` supplies the reference results; +its existing aquifer is wrapped to trace ordered requests, results and fluid +scheduling decisions. The test applies explicit masks, filtered and unfiltered, +with grass/mycelium/dirt and uncarvable blocks, repeated writes and disjoint runs. +The filter is synthetic; native blending-filter generation remains pending. + +Run `python3 tools/test_material_stage_parity.py`. Unit tests additionally verify +that filters and uncarvable tags skip aquifer calls, a surface observation survives +an absent aquifer result, and later aquifer failure preserves earlier surface +restoration and its fluid postprocessing even when aquifer scheduling is disabled. + + + +## Shared shape primitives + +`carve_ellipsoid` visits candidate cells in X/Z/descending-Y order, retaining +vanilla's exclusive lower Y bound, Y−0.5 normalization, chunk clipping and ordered +skip callbacks. Output failures preserve earlier marked cells. `can_reach` uses +wrapped step differences and float-rounded thickness before double-distance math. +Traversal has a 2^24-candidate work bound. + +Run `python3 tools/test_carving_geometry_parity.py`. The +[geometry report](../benchmarks/rust-carving-geometry-2026-10-06/scoped-parity.json) +records **106,699 matching lines per JAR**, across **690 ellipsoids** and **5,536 +reachability queries**. Actual `WorldCarver.carveEllipsoid` and `canReach` supply +the reference results. Tests compare normalized skip inputs, marked-cell order, +partial failures and final mask intervals, with distant/overflowing coordinates, +clipped bounds, degenerate radii, NaNs, infinities and subnormals. NaN trace values +are canonicalized. The seeded cave/canyon paths below use these primitives. Gaussian provider codecs remain separate work. + + +## Seeded cave and canyon paths + +`CaveCarver` decodes cave definitions and reproduces start selection, rooms, +thickness bias, randomized tunnel movement and branching. `CanyonCarver` decodes +canyon definitions and reproduces height-dependent width factors, varying radii +and randomized path movement. Both preserve float/double operation order and +vanilla's quantized trigonometry. Their local path RNG is always the legacy +algorithm, independently of the caller's outer random mode. + +Run `python3 tools/test_cave_carver_parity.py` and +`python3 tools/test_canyon_carver_parity.py`. The +[cave report](../benchmarks/rust-cave-carver-2026-10-06/scoped-parity.json) records +**882,005 matching lines per JAR** across **415 fixtures** and **739 requested +carve invocations**. All three bundled cave definitions are independently +imported from both JARs. The +[canyon report](../benchmarks/rust-canyon-carver-2026-10-06/scoped-parity.json) +records **1,094,517 matching lines per JAR** for the bundled canyon and custom +shapes across four generation heights. + +The native `WorldCarver.DIRECT_CODEC` and actual cave/canyon methods supply +reference results. Comparisons include ordered cell writes with duplicates, +mask intervals, partial output failures and subsequent random longs. Both random +modes, repeated invocation, distant/overflowing coordinates and neighboring/far +origins are covered. Custom shapes force branching, floor and width variation, +degenerate radii and failure boundaries; malformed selected fields are tested. + +Rust bounds a cave call to 4,096 starts, a canyon to 4,096 steps and 4,064 width +entries, and either call to 2^24 candidate cells through a shared traversal budget. +Budget exhaustion retains prior mask writes. Gaussian provider codecs, +encoding, blending and complete worlds remain pending; these suites invoke +individual carvers directly. The combined stage check covers neighbor selection and seeding. + + +## Biome-selected neighboring carvers + +`CarverCatalog` resolves named and inline carvers while preserving ordered holder +lists and repeated references. `generate_carving_mask` visits the 17×17 origin +neighborhood in X/Z order. Each carver receives a legacy random stream initialized +from the world seed plus its list ordinal and the origin chunk coordinates, then +runs its native start-selection and shape path. The mask clips below the ceiling +with vanilla's seven-block allowance, or without that allowance for upgrading +chunks. Source errors stop generation before mask application. + +The combined stage report includes **42 procedural carving passes** through actual +`NoiseBasedChunkGenerator.generateCarvers`, after noise filling and surface work +and before the explicit-mask stress passes. Biome selection uses uncached quart +queries and retains the source's prior search state from biome filling. Carved +surface restoration switches fuzzy lookup to that raw source. All four bundled +carvers and all seven terrain settings are available to biome selection; the +native biome settings retain actual carver lists with empty placed-feature lists. + +Unit tests cover origin order with coordinate overflow, upgrading bounds, +invalid bounds before source calls, early source failure and duplicate holder +identity. Tagged carver sets, region-neighbor caching, nonempty blending, +retrogen integration, placed features and complete generated worlds remain pending. diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md new file mode 100644 index 000000000..fa39e7000 --- /dev/null +++ b/docs/collision-geometry.md @@ -0,0 +1,283 @@ +# Horizon collision geometry + +The version target is Minecraft Java Edition **26.3**. Geometry is a simulation +foundation; Horizon still has no Rust client, live world, or entity simulation. + +`horizon-core::geometry` provides `Vec3`, `Aabb`, `Axis`, `Direction`, `BlockHit`, +and immutable `VoxelShape` values. Coordinates are doubles. Arithmetic keeps +vanilla's operation order, signed zero, NaN comparisons, normalization threshold, +and collision epsilon. It does not enable approximate or fused simulation math. + +Implemented vector operations include addition/subtraction, vector-to, component +products, scaling, normalization, dot/cross products, interpolation, projection, +distance/length, horizontal vectors and finite/equality checks. Rotations, look +directions, alignment, axis replacement, direction offsets, and pitch/yaw extraction +are also implemented. The full Vec3 API and entity integration remain absent. + +Trig uses vanilla's 65,536-entry float sine table with double angle scaling and +Java long narrowing. The table is generated from the pinned formula in Rust; +the geometry suite compares every generated entry against the runtime table. +Inverse trig narrows to float at vanilla's conversion points. These comparisons +validate the tested platform; other platforms need the same bit comparisons. + +Bounding boxes normalize endpoints with Java-compatible min/max. Queries include +half-open containment, strict intersection, transforms, distances, ray clipping, +block-coordinate construction with wrapping integer endpoints, setters, next-value +deflation, and swept-box collision tests. A disjoint `intersect` preserves vanilla's +constructor normalization rather than introducing a different empty-box rule. + +Shapes keep exact coordinate arrays and a packed occupancy grid. Greedy boxes are +cached once in vanilla order. Collision-distance queries use occupied grid cells; +ray and closest-point queries reuse the cached boxes. Column minima/maxima use +vanilla's cyclic perpendicular coordinates and infinity for empty/outside cells. +Cube shapes retain arithmetic +lookup; moved shapes use array lookup even for a zero offset. Ray hits preserve +face tie ordering, endpoint exclusion, tolerances, and the 0.001 inside-hit nudge. +Boolean shape joins and overlap predicates preserve cube, identical, +disjoint and epsilon-merger behavior. Shape operations reject truth tables that +fill two empty cells, as vanilla does. Per-axis cube-coordinate metadata survives +partial merges and is checked when importing cached shapes. Box construction +preserves thin-box rejection and up to 1/8 cube quantization. Optimized joins +reconstruct greedy boxes in vanilla order. Face/edge extraction and shape rotations remain absent. + +Discrete axis extrema are retained separately from occupied cells. A box can +quantize to no occupied cells while retaining a finite minimum/maximum on other +axes. That state affects vanilla's lower-block floor-height lookup. Empty joins +also preserve their integer sentinel extrema; optimization and moving an empty +shape return the canonical empty shape. + +Shape clones preserve identity and share immutable coordinate, occupancy and box +storage. New shapes keep separate identities even when their grids are equal. +This preserves alias-sensitive join shortcuts and avoids copying large grids +when an operation returns an existing shape. The cache importer shares equal +grid storage while retaining the distinct vanilla shape identities. + +`resolve_shape_movement` ports vanilla's movement resolver over a supplied shape +list: Y first, then horizontal axes in movement-magnitude order, translating the +box by resolved motion before each axis query. `candidate_step_heights` preserves +float narrowing, duplicate identity, current-Y exclusion, and sorted candidate +heights. `resolve_step_movement` adds the initial collision and step-up decision, +including landing-height adjustment, a second collider query, and the first +candidate improving horizontal movement. `entity_collision_bounds` preserves +the initial entity query bounds. These helpers take caller-selected colliders; +they do not choose world/entity shapes, set grounding, change velocity, or apply +inside-block effects. + +The step-up corpus calls the actual private `Entity.collide` method for **17,680 +cases** per JAR. Reference fixtures supply entity inputs and controlled +block/entity/border shape lists; vanilla performs the movement decisions. Query +bounds and results are compared bit for bit. This verifies the decision with +those inputs, not live world selection or entity state transitions. + +`block_floor_height` returns the selected shape's maximum Y, or lazily queries +the lower shape only when the current one is empty. Its 12,000-case corpus also +checks the lower supplier's invocation count against `BlockGetter`. + +`traverse_blocks` visits blocks in vanilla ray order, including its endpoint nudge, +strict corner comparisons, early callback return, integer wrap and signed-zero +endpoint equality. It accepts finite rays and an explicit visit budget. Invalid +geometry or exceeding that budget returns a typed error; earlier callbacks remain +applied. Actual block/fluid ray selection is a separate integration task. + +Inclusive block-box iterators preserve X/Y/Z order, while directional iterators +preserve vanilla's movement-dependent axis order and corner signs. AABB iteration +includes floored maximum faces. They return independent position values and +reject true volumes above the positive Java-int domain, instead of reproducing +overflowed Java iteration counts. + +`sweep_intersected_blocks` ports movement-path visits from +`BlockGetter.forEachBlockIntersectedBetween`: tiny movement, the initial box, +ray-clipped footprints, packed-position deduplication, final box, step indices, +and early callback stops. Stationary/tiny movement avoids a deduplication-set +allocation. Inputs and computed geometry must be finite; a caller-selected work +budget counts ray steps and iterator candidates, including suppressed duplicates. +Earlier callbacks are not rolled back on an error. Block effects still need +their own implementations and integration with entity movement. + +`horizon-world::collision::CachedCollisionRegistry` imports a private local export +of vanilla cache data. The export includes DataVersion, all state descriptors, +deduplicated shapes, coordinate-kind metadata, discrete extrema, and a per-state +cache index. Import verifies every state ID +against the block registry. Section lookup also requires the same borrowed registry. +Imported nonempty extrema must agree with occupancy; empty extrema must be in +the grid's domain or match vanilla's empty-join sentinel triple. Extrema form part +of the grid-sharing key, so equal occupancy does not erase different metadata. +There is no fallback shape for an unsupported state: `None` means block behavior +must select it, while a cached empty shape is a valid `Some` value. + +This covers the cached branch of the **no-context** `BlockState.getCollisionShape` +method. Vanilla's overload taking `CollisionContext` always calls block behavior; +the cache cannot establish entity collision parity. Dynamic and entity-dependent +selection, neighboring blocks, world borders, movement integration, fluids, block +effects, and live collision broad-phase queries still need implementation. + +Run the comparisons after preparing the pinned artifacts: + +```sh +python3 tools/test_geometry_parity.py +python3 tools/test_collision_parity.py +``` + +Both suites invoke actual vanilla methods from the authenticated client and server +JARs. They compare canonical double bits, including infinities/NaNs, rather than +using a numerical tolerance. The geometry corpus includes empty and sparse grids, +greedy decomposition, overlapping boxes, rays, tiny movements and IEEE boundaries. +It compares **1,320,187 output lines per JAR**, including **2,400 integer-box +iterator cases**, **2,400 AABB iterator cases**, and **9,022 movement-path traces**. +The registry suite exercises cached shape queries through resident section IDs, +translation at negative and world-border coordinates, and invalid import rejection. +Its export records **35,524 cached states**, **199 uncached states**, **6,093 +shape identities**, and **330 distinct grids**. The comparison runs **213,144 queries** plus state/box/identity checks, +producing **1,097,456 matching output lines per JAR**. These counts describe this +branch and corpus; they are not a gameplay coverage percentage. + +Raw grids admit at most 1,048,576 cells with strictly increasing, non-NaN +coordinates. Oversized or malformed imports/joins return typed errors. This +bounded library API does not reproduce Java's complete exception/object surface. + +All exported data, test inputs, reference output, and compiled adapters remain +under gitignored `.local/`. Success reports record exact sources, inputs, outputs, +and reference hashes. A runner removes its prior success report before running +and rejects edits to the captured sources during validation. Passing these suites +does not prove whole-game parity or any FPS/render-distance improvement. + +Checked-in [geometry metadata](../benchmarks/rust-geometry-2026-10-05/scoped-parity.json) +and [cached-collision metadata](../benchmarks/rust-collision-2026-10-05/scoped-parity.json) +identify their tested source versions. Reports cover their recorded snapshots; +later changes require fresh validation. + +Entity obstruction now evaluates ordered candidate snapshots, excluded entity +identity, spectator/removal/building flags, shared root-vehicle identity and +voxel-shape intersection. Empty shapes skip the query; candidate collection +finishes before obstruction evaluation. Unit-block queries translate in floating +point, including integer-coordinate boundaries. Run +`python3 tools/test_entity_obstruction_parity.py` to compare against the actual +vanilla `EntityGetter` default methods and entity metadata queries. + +The [entity-obstruction report](../benchmarks/rust-entity-obstruction-2026-10-06/scoped-parity.json) +records **15,121 matching output lines per JAR** over composite shapes, boundary +contacts, thin boxes, metadata filters, vehicle roots and injected query failures. +The Java fixture privately allocates entity snapshots without running their +constructors. Entity lifecycle, spatial indexing and vehicle-tree maintenance +remain separate implementation work. Workspace tests, warning-free Clippy and +**138 Python tests** passed at this snapshot. + +Legacy block solidity now uses explicit definition overrides and cached collision +bounds, with force-on precedence and native mean-size/height thresholds. The +no-context replaceable and liquid flags are kept independently. Solid rendering +uses the occlusion definition flag and a full-shape test over imported raw +occlusion geometry. Import validates the pinned +DataVersion, full state identities and complete block definitions before building +a shared property table. Predicates query this table in constant time. + +`python3 tools/test_block_properties_parity.py` compares all **35,723 states** and +**18,096 synthetic cache/flag/shape cases**, including adjacent floating-point values +around solidity thresholds and both occlusion flag values. The [block-properties report](../benchmarks/rust-block-properties-2026-10-06/scoped-parity.json) +records **143,361 matching lines per JAR**. Definition flags, collision and raw +occlusion data are private runtime inputs; Rust calculates solidity and solid +rendering. The report was produced in an isolated staging copy and archived only +after the integrated sources and copied fixtures matched every recorded hash. +Item/fluid-context replacement and collision with live entities remain separate work. + +Face selection now preserves native cube-axis shortcuts, epsilon sample points, +slice coordinates and clamped parent extrema, including sparse slices whose +native bounds differ from occupied boxes. Repeated queries share face identities. +The FULL, CENTER and RIGID support tests execute against the selected shape. +`python3 tools/test_face_support_parity.py` compares **1,615 input shapes** and +nested faces, producing **595,686 matching lines per JAR** in the +[face-support report](../benchmarks/rust-face-support-2026-10-06/scoped-parity.json). +The [refreshed geometry report](../benchmarks/rust-geometry-2026-10-06/scoped-parity.json) +also retains **1,320,187 matching lines per JAR** after face slicing was added. +Block-specific support-shape selection is a separate layer. + +Registered support caches now derive FULL/CENTER/RIGID masks from privately +imported support geometry and share results by shape identity. The importer +checks the data kind and full state identities. `None` explicitly requests +uncached behavior; it never becomes an assumed unsupported face. +`python3 tools/test_block_support_parity.py` compares **35,524 cached states** +across six directions and three support kinds, while retaining **199 uncached +states**. The [cached-support report](../benchmarks/rust-block-support-2026-10-06/scoped-parity.json) +records **248,867 matching lines per JAR**. + +Face-cache storage is now lazy and attached to shape identity. Clones share it; +new identities and moved shapes start with an empty cache. A regression test +checks that cached faces do not retain their parent after it is dropped. The +face and geometry differential suites passed again after this allocation change, +as did workspace tests, Clippy and **140 Python tests**. No FPS claim is inferred +from these library checks. + +Dynamic support selection now handles bamboo collision offsets, dripstone and +sulfur-spike thickness/direction, the empty-context scaffolding support shape, +powder snow, and shulker animation-state support faces. Moving-piston lookup +preserves missing/wrong block-entity behavior and delegates active entity shape +calculation to the world. The [dynamic-support report](../benchmarks/rust-dynamic-support-2026-10-06/scoped-parity.json) +records **4,867,780 matching lines per JAR** over **107,308 fixtures** covering all +**199 uncached states**, coordinate boundaries, block-entity snapshots and query +failures. Run `python3 tools/test_dynamic_support_parity.py` to reproduce it. +The current suite also compares no-entity-context collision geometry in **60,161 +fixtures**, including **13,014 shulker progress fixtures**. Shulker collision +bounds retain native float interpolation and differ from animation-state support +faces. `BlockCollisionRegistry` dispatches cached and dynamic collision queries; +entity movement contexts and block-entity lifecycle remain separate work. +Workspace tests, warning-free Clippy and seven focused Python tests passed. + +Moving-piston collision now selects stationary extended bases and moving heads, +translates shapes using native float progress arithmetic, and honors the +movement-direction collision exclusion. Interpolation preserves float operation +order, including negative partial ticks and IEEE edge cases. The separate +collision-related state used for entity pushing retains its own sticky/head +rules; entity pushing itself is not implemented by this module. + +`python3 tools/test_piston_shape_parity.py` compares **102,315 fixtures**, +including every registered moved state and **10,000 raw float interpolation +cases**. The [piston-shape report](../benchmarks/rust-piston-shape-2026-10-06/scoped-parity.json) +records **1,096,811 matching lines per JAR**. This corpus uses absent block +entities for moved-block collision selection. Workspace tests, warning-free +Clippy and **142 Python tests** passed. Tick progression and live world mutation +remain separate work. + +The refreshed dynamic-support corpus also includes **9,216 active piston +snapshots**, composing block-entity lookup with piston collision generation and +all support tests. It compares extension/retraction, source heads, progress +boundaries, collision exclusions and query failures. These snapshots do not +exercise piston ticks, pushed entities or chunk updates. + +The archived block-survival snapshot executes 42 rule kinds with 54 distinct rule/tag +bindings over registry-bound solid flags, air identity, support tags and +FULL/CENTER/RIGID geometry. The verified snapshot covers **1,274 block definitions +and 34,758 states**; unsupported definitions return an explicit error. Candidate +properties select attachment direction, hanging state, door/plant halves and +pale moss carpet's serialized `bottom` property. Pressure plates and cactus +flowers preserve repeated neighbor reads. Downward center support applies the +unstable-bottom-center tag only where native helpers do. Upper doors require the +same block below; upper double plants also require its lower half. Crop survival +checks brightness against 8 before querying support; farmland preserves its +conditional second read above, and dripleaf stems read both neighbors. Sugar cane, +lily pads, frogspawn, spore blossoms, small dripleaves and tall seagrass preserve +their independent fluid queries, source/full-water requirements and tag checks. +Growing plants preserve head/body identity and kelp support restrictions. +Scaffolding recomputes neighbor distance in native order; chorus plants and flowers +preserve branching reads and early exits. Piston heads validate base type, facing +and extension. Mangrove propagules, speleothems, pitcher crops, bells and shelf +mushrooms use their version-specific attachment rules. + +Interrupted runs can be resumed with `python3 tools/test_block_survival_parity.py --resume`. +The runner verifies source, environment, fixture and compiled-artifact hashes +before reusing completed stages. A changed output is regenerated; changed inputs +require a fresh run without `--resume`. Checkpoints stay under `.local`, and +a parity report is written only after both native comparisons pass. + +`python3 tools/test_block_survival_parity.py` compares actual native `canSurvive` +calls in both pinned JARs. The [block-survival report](../benchmarks/rust-block-survival-2026-10-06/scoped-parity.json) +records **14,574,905 matching output lines per JAR** across **4,501,019 fixtures**. +Each supported candidate state is exercised; behavior representatives are tested +against every neighbor state, changing repeated reads, integer-coordinate +wrapping, absent/closed/open shulker snapshots and injected block/entity query +failures, plus light thresholds, independent fluid sequences and fluid-query +failures. Native method ownership +and support-tag fields supply private +definition metadata; survival results are calculated in Rust. Workspace tests, +Clippy, the prior **145-test Python suite**, and five focused harness tests passed. +This establishes the recorded survival +scope, not full placement, neighbor updates, unsupported plant rules or complete +block gameplay. diff --git a/docs/compact-headers.md b/docs/compact-headers.md index f9601c5e0..932d90a0a 100644 --- a/docs/compact-headers.md +++ b/docs/compact-headers.md @@ -52,7 +52,7 @@ measurements yielded the same medians: | Plain `Object` | 16 | 8 | [Raw platform results](../benchmarks/object-headers-2026-10-03) come from -[CI run 37153955462](https://github.com/ludovic111/minecraft-optimization-lab/actions/runs/37153955462). +[CI run 37153955462](https://github.com/ludovic111/Horizon/actions/runs/37153955462). Each platform has nine measured batches per type/mode across three JVM forks. The hosted ARM Mac has three logical CPUs and is not the user's M2 Pro. diff --git a/docs/debounce-queue.md b/docs/debounce-queue.md index 1707957f3..a22760e0c 100644 --- a/docs/debounce-queue.md +++ b/docs/debounce-queue.md @@ -59,7 +59,7 @@ Hosted medians and nearest-rank p95 over 20 measured trials: The upstream Mac maximum was 108.892 ms; its requested 50 ms sleep overshot. The wakeable Mac maximum also shows scheduler variability. The hosted ARM Mac has three logical CPUs and is not the user's M2 Pro. [Raw trials](../benchmarks/idle-queue-2026-10-03) -are from [CI run 37155695460](https://github.com/ludovic111/minecraft-optimization-lab/actions/runs/37155695460). +are from [CI run 37155695460](https://github.com/ludovic111/Horizon/actions/runs/37155695460). This isolates idle wakeup, including enqueue/pop overhead. It does not simulate the existing 250 ms debounce, preprocessing, chunk generation, meshing, network diff --git a/docs/density-functions.md b/docs/density-functions.md new file mode 100644 index 000000000..5357abeb3 --- /dev/null +++ b/docs/density-functions.md @@ -0,0 +1,502 @@ +# Compiled density evaluation + +Horizon targets the repository-pinned Minecraft Java Edition **26.3**. The +`horizon_core::density` module implements selected compiled samplers and an initial +integrated graph compiler. Complete graph coverage and terrain generation remain pending. + +Implemented samplers: + +- Constants, including signed zero and nonfinite values. +- Context-bound blend alpha, blend offset and structure density; blend-density wrappers. +- Axis gradients with clamped, repeating and mirrored repeating coordinates. +- Unshifted noise and both XZ and XYZ shifted-noise specializations. +- Shift, shift-A and shift-B offset noise; old blended terrain noise; outer End + island density. +- Euclidean, squared Euclidean, Manhattan and Chebyshev distance metrics and + distance-to-point evaluation. +- X/Y/Z coordinate slices and the combined XZ bulk specialization. +- Coarse-grid interpolation with positive horizontal and vertical cell sizes. +- Surface-height searches and their compiled horizontal slice. +- Nested cubic splines, lazy coordinate evaluation and spline range analysis. +- Absolute value, negation, square, cube, square root, logarithm, reciprocal, sign, squeeze + and leaky ReLU. +- Floor, nearest, ceiling and truncation to integer or sampled multiples. +- Addition, subtraction, multiplication, division, minimum and maximum, including + their constant-operand specializations; clamping. +- Powers with general, constant-base and constant-exponent samplers. +- Range choice with general or constant branches, and linear interpolation with + general or constant endpoints; single- and multi-threshold interval selection. + +Immutable samplers share children and noise sources through `Arc`. A worker owns +its `SamplerContext`, which retains temporary vectors for nested bulk evaluation +and returns them on typed errors. `clear_scratch` releases the retained buffers. +This avoids allocating a temporary vector for each repeated evaluation after +warm-up; no whole-game performance improvement has been measured. + +## World fields and references + +`WorldFields` stores immutable sampler bindings for blend alpha, blend offset and +structure density, plus an optional `DensityBlender` provider. A worker attaches +these with `SamplerContext::with_world_fields`; changing them clears its cached +densities. Context-bound samplers resolve the binding on each scalar or bulk call +and delegate with the same context. Missing bindings use constants 1, 0 and 0, +respectively, including constant bulk tail writes. Custom fallbacks are supported. +Declared metadata remains independent of the bindings: alpha has range `[0,1]`, +offset and structure density have infinite ranges, and their axis masks are X/Z, +X/Z and X/Y/Z. Uniform-axis rewriting follows that metadata even for synthetic +bindings which vary along omitted axes. + +`BlendDensitySampler` evaluates its input first. Absent or empty providers return +that result unchanged; other providers transform the logical volume in Z/X/Y +order while preserving the input's tail writes. Graph range and axes come solely +from the input. Differential checks cover absent and actual vanilla EMPTY Blender +contexts. Provider delegation/order tests do **not** validate the still missing +nonempty old-world blending algorithm or structure-density producer. + +Direct reference holders compare by their value; registered holders compare by +holder identity. `register_function` creates an immutable named holder and +`function` retrieves it. Raw compilation delegates through its value. Optimization +inlines one holder layer before detecting cache nodes, preserving vanilla's +ordering and nested-wrapper behavior. A holder whose child changes during +rewriting is replaced by that child directly. These choices affect constant +specializations and cache allocation, and are checked against actual vanilla +holder records, named registries and the compiler. + +## Graph compilation + +`density::graph` defines immutable constants, gradients, eleven unary operations, +six binary operations, powers, rounding, clamps, range choices, lerps, interval selection, +distance-to-point, slices, caches, interpolation, surface searches, nested splines, +registered normal/shifted noise, offset noise, old blended noise and outer End +island density, context-bound world fields, blend-density wrappers and direct/named +reference holders. +Definitions reference earlier nodes in the same graph; +construction rejects nesting beyond 256 nodes. For ordinary float fields, +structural interning distinguishes signed zeros and canonicalizes NaN payloads, +matching Java record equality. +Precompiled input bindings carry caller-supplied ranges and axis dependencies; +the compiler trusts this metadata. Bindings have distinct identities. + +`DensityCompiler::get_sampler` prepares shared caches, slices uniform axes, then +compiles and memoizes the root. Cache IDs belong to that compiler: worker contexts +must not reuse cache cells across compiler instances. Failed preparation consumes +its allocated ID and retains any successfully prepared children; retrying a failed +root does not return a cached failure. `compile_raw` bypasses rewriting and rejects +unprepared cache definitions. + +Compilation integrates range propagation with min/max specialization and scalar +short-circuit bounds. Strictly disjoint min/max ranges can eliminate a sampler, +but both children compile before that decision. Touching ranges retain the branch. +Literal operands select dedicated arithmetic paths, including reciprocal +multiplication for a literal right-hand divisor. These choices affect float bits, +child evaluation and buffer tails. Uniform-axis rewriting introduces zero slices +in X/Z/Y order, combines adjacent X/Z slices, and reduces child volumes while +retaining coordinate strides. + +The differential suite compares these passes with vanilla's actual +`DensityFunctionCompiler` across 368 independent unseeded graphs, 64 mixed seeded +graphs and six seeded failure cases, with 18,282 successful root compilation +requests. It checks declared ranges and axes, structural equality, cache-ID counts, +memoized sampler identity, failure state, scalar/bulk values and child call counts. +Some bound inputs deliberately use synthetic metadata to exercise compiler +decisions; those cases do not validate terrain metadata or seeded terrain output. +Serialized codecs, concrete world-field producers and complete terrain integration +remain pending. + +`DensityCompiler::new_seeded` fixes the world seed and random algorithm for the +compiler's lifetime. Registered noise definitions use canonical namespaced registry +identifiers; duplicate names are rejected. Ordinary noise instances reuse a sampler +created from the world positional factory and the identifier's hash. The +`minecraft:nether/temperature` and `minecraft:nether/vegetation` keys bypass that +map and create legacy Nether biome samplers from the world seed and seed plus one, +respectively. The addition wraps as Java `long`. `get_noise_sampler` exposes this +lookup for callers needing the same registered sources. + +Old blended terrain noise uses the world seed directly in legacy mode and the +positional `minecraft:terrain` stream in modern mode. Noise compilation retains +literal positive-zero tests when choosing unshifted, XZ and XYZ implementations; +negative-zero shifts retain the shifted path. Shift functions compile in X/Z/Y +order, while the XYZ sampler evaluates them in X/Y/Z order. Declared noise ranges +come from their registered definitions; axis dependencies combine nonzero scales +with all shift functions. + +The seeded oracle constructs vanilla's actual `RandomState` with a frozen test +noise registry, then uses its compiler and compile context. Constructor-only +material inputs use zero-noise fixtures; this does not validate material rules or +surface generation. The corpus includes extreme signed seeds, both algorithms, +instance identity, special Nether failures, offsets, blended noise and mixed +cached/interpolated/spline graphs. The graph API still expects registered, +canonical identifiers. The [world-generation codec suite](world-generation.md) +now loads and compares all bundled noise and density registry definitions against +the actual registry-aware codecs. Complete chunk generation remains pending. + +`EndIslandSampler` uses a legacy stream initialized directly from the world seed, +regardless of the world noise algorithm. It discards 17,292 random draws before +constructing simplex noise with skipped offsets. The island search retains +vanilla's strict noise threshold, float arithmetic, integer wrapping and division +toward zero for negative coordinates. Its declared range is `[-0.84375, 0.5625]`, +and its dependency mask is X/Z. Bulk sampling computes each horizontal column +once, repeats the result over Y and preserves the output tail. The center island +is supplied by the surrounding terrain graph; this source supplies outer islands. + +Spline coordinates can reference graph functions directly through +`CubicSpline`. Graph rewriting visits parent coordinates before nested +values, retaining repeated coordinate occurrences and point order. Compilation +shares structurally identical coordinate inputs, validates each unique coordinate +range immediately after compiling it, and then creates the existing spline +sampler. Graph range analysis remains lazy: a NaI coordinate can stop range lookup +before visiting a nested value even when compilation later rejects that value's +coordinate. Errors follow their respective traversal paths. Spline point arrays +use Java's bit-based equality, including canonical NaNs and distinct signed zeros. +The graph nesting bound includes paths through nested spline values and coordinate +definitions. + +Interval-selection definitions retain threshold order, duplicates and nonfinite +values. Their declared range covers all branches without asking for the selector's +range; their axis dependencies include both the selector and every branch. The +Rust definition API requires one more branch than thresholds and limits the list +to 256 branches. The JSON decoder separately requires ordered thresholds and a +minimum of two branches. Its ordering retains Java's float comparator, including +distinct signed zeros; equal consecutive thresholds are allowed. +Threshold lists retain vanilla's separate equality and hashing rules: opposite +zeros compare equal but hash differently; separate lists containing NaN compare +unequal. Thresholds use an immutable `Arc` so rewritten definitions preserve list +identity. Interning tracks equality classes and signed-zero hash differences, +including cancellation through parent definitions. `DensityGraph::java_equals` +exposes equality separately from interned IDs and compiler cache reuse. +Distance-to-point definitions declare all three axes and `[0, infinity]`, and +compile to the checked wrapping-coordinate metric sampler. + +## Scalar and bulk behavior + +Power graphs compile both children in base/exponent order before selecting a +specialization. A literal base takes precedence over a literal exponent. Otherwise, +literal exponents with absolute values one half, one, two or three select square +root, identity, square or cube. Negative exponents wrap those specialized samplers +in a reciprocal. Other exponents return directly from the fallback power sampler, +which uses the original signed exponent. These paths retain distinct float +arithmetic and signed-zero behavior. +General samplers evaluate both operands without zero/one shortcuts and retain +base writes if exponent evaluation fails. Constant-operand bulk samplers also +transform buffer tails. + +`RoundSampler` implements floor, nearest, ceiling and truncation to integer or +sampled multiples. Nearest uses Java's float-to-int rounding: ties go toward +positive infinity, NaNs become zero, and extreme values saturate to the signed +32-bit integer domain before conversion back to float. Floor, ceiling and +truncation retain nonfinite float values. A zero multiple returns the input, +preserving its signed zero and NaN behavior; the multiple still evaluates after +the input. Other multiples use float division, integer rounding and float +multiplication in that order. + +Only a literal-one graph multiple selects the integer specialization. It modifies +the input buffer, including its tail. A sampled multiple uses a volume-sized +temporary after the input and requires an exactly volume-sized output through +this Rust API. Failure in the multiple leaves input writes visible. Range +propagation evaluates the multiple's range first, divides the input range, maps +the rounding operation over the endpoints and multiplies by the multiple range. + +All densities are `f32`; noise coordinates and scales are `f64`. Gradient +coordinate arithmetic wraps as Java `int`, including overflow of the endpoint +difference and `MIN / -1`. Repeating gradients use floor division, not truncation. +A zero repeating period returns a typed error at evaluation time. Clamped +zero-width gradients retain the reference floating-point behavior. + +Scalar and bulk evaluation deliberately remain separate. Unshifted noise bulk +sampling calls the noise source's bulk kernel, whose arithmetic can differ from +scalar Perlin evaluation. Shifted noise evaluates child volumes first and then +samples its source using those values. XYZ evaluates shifts in X, Y, Z order; +XZ omits the Y addition entirely. Inserting a synthetic zero would change signed +zero behavior. + +Scalar multiplication and division return positive zero without evaluating the +right child when the left child is zero. Scalar minimum and maximum can skip the +right child using their supplied compiled range bounds. Bulk binary operations +evaluate both child volumes. Bulk minimum and maximum replace a value only on a +strict comparison; their handling of NaNs and equal signed zeros therefore differs +from scalar `Math.min` and `Math.max`. Constant-operand min/max retain that same +scalar/bulk distinction. Constant multiplication and division do not inherit the +generic scalar zero shortcut. + +Range choice samples its selector first and evaluates only the selected branch +for a scalar query. Bulk range choice evaluates the in-range branch first, then +the selector, then the out-of-range branch, retaining earlier output writes when +a later child fails. Interpolation evaluates only the selected endpoint at alpha +zero or one in scalar queries; bulk interpolation evaluates its dynamic endpoint +volumes before selecting or blending values. Constant endpoints avoid allocating +a scratch vector. Neither path clamps alpha to the unit interval. + +Interval selection preserves threshold order and chooses the first strictly +higher threshold, or the last branch. NaN comparisons fall through. Scalar +queries run only the selected branch; bulk queries evaluate the selector and +then every branch in order before replacing output values. A contiguous scratch +vector holds branch volumes, with an exact-volume slice passed to each child. +The Rust constructor requires one more branch than thresholds and caps the +number of branches at 256. The JSON decoder validates threshold order; it does +not sort the list. + +A slice's length is its logical density-buffer size. Constants fill that whole +slice. Unshifted noise clears it before accumulation. Gradients overwrite only +the volume's cells; shifted noise retains whatever its X child wrote outside the +volume. Unary operators transform the whole logical buffer after their child +returns. Binary, general range-choice, interval selection and interpolation bulk evaluation require exactly a volume-sized buffer, +matching the valid size of its temporary right-hand buffer. Horizon rejects an +oversized multi-input output before evaluating children; Java's accidental reads beyond +the temporary array and backing-pool capacity are outside this bounded API. +Short buffers are always rejected before writes. Errors from evaluated children +retain earlier writes, and scratch storage is returned for reuse. + +## Coordinate slicing + +`SliceSampler` fixes an X, Y or Z coordinate, or both X and Z. Scalar requests +replace those coordinates before calling the child. Bulk requests sample a +reduced volume once, then copy its samples into the repeated columns or planes. +The reduced descriptor retains the original steps on all axes, including fixed +axes, so cached children see the same descriptor as vanilla. Expansion uses +column copies or fills and does not repeat child sampling. + +When every fixed axis already has size one and the requested minimum coordinate, +the sampler passes the original output directly to its child. This distinction +preserves child writes outside the volume and partial writes on errors. Otherwise +the child receives scratch storage; its failure leaves the caller's output +untouched, and successful expansion writes only the volume's cells. Graph-level +slice insertion and combining adjacent X/Z slice definitions remain compiler work. +The corpus checks all four compiled forms, nested slices, cached children, +unchanged and reduced volumes, call counts, buffer tails and integer boundaries. + +## Grid interpolation + +`InterpolatedSampler` accepts positive XZ and Y cell sizes. A scalar request at +an exact grid point delegates to the child's scalar method. Other points sample +a `2 × 2 × 2` corner volume through the child's bulk method, then interpolate X, +Y and Z in that order. Negative positions use floor division and remainders; +corner coordinates retain Java integer wrapping. + +An aligned bulk volume whose steps equal the cell sizes delegates directly to +the child; size-one axes may have other steps. Other volumes sample a coarse +grid covering the requested block extent. The bulk path blends Z, then X, and +advances each Y column through repeated float additions. Scalar interpolation +uses division for its fractions; bulk interpolation uses precomputed reciprocal +multiplication. These differences can change low bits even with simple linear +input and are retained intentionally. End corners are clamped to the last coarse +sample when the output ends exactly on a grid point. + +For strided output, vanilla first evaluates a full block-resolution volume with +sizes equal to output sizes times steps, then selects the strided cells. Horizon +preserves that extent, including trailing blocks, the child's volume descriptor, +and the repeated-addition rounding. Scratch vectors are retained in the context. +The interpolating paths write only volume cells; direct delegation retains the +child's tail behavior. A failed coarse-grid child leaves the caller unchanged. +Invalid derived volumes are rejected through the bounded volume API; accidental +Java array behavior for overflowing or unallocatable extents is outside this +scope. The JSON decoder loads interpolation nodes with positive cell sizes. +Automatic insertion by the chunk-generation pipeline remains pending. + +## Surface-height search + +`FindTopSurfaceSampler` evaluates its upper bound, rounds it downward onto the +cell-height grid using the pinned float-to-integer floor behavior, then samples +density at descending grid heights. It returns the first strictly positive +sample, or the lower bound. Zero and NaN densities do not stop the search. When +the aligned upper height is at or below the lower bound, it returns immediately +without sampling density, including at the equal-height boundary. + +`compile_surface_search` adds the Y=0 slice used by vanilla's function compiler. +This forces the upper bound to be evaluated at Y=0 and repeats horizontal results +through the requested volume. The raw sampler accepts only one Y layer for bulk +requests. It first samples all upper bounds into the output, then searches columns +in Z/X order, replacing each successful result. A later child failure preserves +earlier results and the remaining upper-bound values. The surrounding slice can +instead isolate those partial writes in scratch storage. + +The constructor requires positive cell height. Manually constructed searches +whose descending height overflows return a typed error; wrapped nonterminating +searches are outside this bounded API. The differential corpus covers ordinary +finite bounds, exceptional float bounds with immediate crossings, grid alignment, +Y slicing, invalid multi-layer raw calls, cached children, NaN/zero crossings, +short circuits, buffer tails and child failures. + +## Cubic splines + +`CubicSpline` represents a constant or an immutable set of points. Each point has +a location, derivative and nested spline value. `SplineSampler::new` resolves +coordinate IDs against a density-sampler table and assigns compact local IDs in +parent-first traversal order. Repeated IDs share one coordinate cache. Structural +deduplication of equivalent density definitions remains graph-compiler work. + +Evaluation retains vanilla's binary interval search, including behavior for +manually supplied equal, unsorted or NaN locations. An endpoint extends linearly; +a zero derivative returns the endpoint value without multiplying a possibly +nonfinite coordinate. Interior evaluation samples the left nested value before +the right, then performs the float cubic correction in the reference order. +A constant NaN may occur as a nested value, but vanilla rejects it as the root of +a compiled constant sampler; Horizon preserves that distinction. + +Scalar queries compute coordinates lazily and retain non-NaN values for the +remainder of that query. NaN results are queried again when the same coordinate +is needed. Bulk evaluation walks output cells, evaluating a coordinate's entire +child volume only when a selected branch first needs it. Those buffers remain +available through the call, including NaN cells. Unselected coordinates are not +evaluated. A later lazy child failure retains completed output cells, and Horizon +returns acquired buffers to the context on both success and error. + +Constant roots fill the entire logical output slice. Nonconstant splines use an +exact-volume output; oversized output would read beyond coordinate buffers in +the reference and is rejected by the bounded Rust API. Spline nesting is bounded +to 256 levels, and empty point lists or unresolved coordinate IDs are rejected. + +Range analysis accepts coordinate ranges from the enclosing graph. It preserves +endpoint extension, child range evaluation order, all-point bounds and the +conservative derivative correction used by vanilla. A NaI coordinate stops +analysis before child ranges are evaluated. Invalid finite/nonfinite arithmetic +returns an interval error; the implementation does not substitute tighter bounds +or a numerically different cubic-extrema calculation. The JSON decoder loads +nested spline graphs, preserves their point order and requires explicit +derivatives. Spline builders and complete terrain integration remain pending. + +## Cached evaluation + +`SamplerContext::cached()` enables context-owned cache cells; the default context +continues to evaluate cache wrappers directly. `CachingDensitySampler` shares +immutable child samplers while keeping cached data in the context. IDs are +bounded to `0..=65535`, and the API rejects recursive evaluation of the same cache +cell. `DensityCompiler` allocates IDs for supported graph definitions. Callers +constructing cache samplers directly must supply consistent IDs themselves. + +A scalar request first checks its last-value cache, using vanilla's packed block +position as the key. This intentionally retains key collisions for coordinates +outside the packed domain. A NaN value is never a last-value hit. Next, a request +may read an exact lattice sample from the cached volume. Off-lattice positions +miss; lookup retains Java's wrapped relative coordinates and extent products. +A volume hit does not update the last scalar key, and replacing a volume does not +invalidate that scalar entry. These details matter because bulk noise can round +differently from a fresh scalar sample. + +A bulk request reuses its cached buffer when every volume descriptor field +matches. Otherwise it evaluates the child into a private retained buffer and +copies to the caller only on success. Vanilla installs that cache entry before +calling the child: a failed child can leave a partially written cached volume +that a later request reads without recomputation. Horizon preserves the writes +and the entry. Unwritten values are initialized to zero; failure comparisons use +a vanilla context with a zero-initializing arena. Unwritten data from vanilla's +global recycling pool is not claimed to match. Cached bulk output must have +exactly the volume's size; invalid lengths are rejected before child evaluation. +`clear_caches()` releases stored values and buffers for context lifecycle use. + +The differential corpus tests enabled and disabled caches, nested nodes, scalar +key collisions, NaN misses, repeated volumes, replacing volumes, on/off-lattice +queries and child failures. Counting wrappers report actual child scalar and +bulk calls as well as output bits, so a correct value produced through the wrong +cache path cannot silently pass the trace comparison. + +## Terrain noise composition + +The offset-noise compilers preserve the pinned version's evaluation paths. Shift +and shift-A use a noise sampler with quarter-scale coordinates followed by a +separate multiplication by four. Shift-A sets the vertical scale to zero. +Shift-B samples `(z / 4, x / 4, 0)` in scalar calls. Its bulk path constructs a +transposed horizontal plane, accumulates noise into that plane with amplitude +four, then repeats each result through its Y column. It leaves the output tail +untouched. These paths are checked with Perlin, simplex, smeared and modern +normal-noise stacks, from both random streams. + +`BlendedNoise` creates the minimum-limit, maximum-limit and main stacks in that +order from the caller's random stream. The two limit stacks contain 16 smeared +layers each; the main stack contains eight. Layers are created from high to low +frequency, retaining the version's double-precision amplitude calculation before +the float conversion. The compiled sampler adds `0.5` to the main result, clamps +it to `[0, 1]`, then interpolates the limit samplers. This composition reuses the +checked scalar/bulk sampler implementations, including their evaluation order. +Its declared range is computed separately from the limit-stack parameters. + +The public `create_blended_fbm` helper also supports first octaves from `-4095` +through zero. It rejects requests outside that work bound before consuming RNG +state. Invalid ranges are rejected at stack build time after layer construction, +matching vanilla's draw consumption within the supported bound. Serialized +parameter restrictions remain integration work; the graph compiler now supplies +the compile context's `terrain` seed lookup. The comparison corpus includes the bundled overworld/nether +and End parameter sets, valid random parameters, nonfinite inputs, constructor +failures, post-construction RNG state, octave metadata and scalar/bulk outputs. + +Distance-to-point evaluation subtracts coordinates as wrapping Java integers +before converting to floats. It retains the reference float arithmetic and +square-root conversion order, rather than using a double-precision hypot. +Metric tests also exercise arbitrary float inputs, including NaNs and infinities. + +## Interval analysis + +`Interval` implements checked exact, symmetric and general bounds; NaI and +infinite ranges; endpoint and interval hulls; addition, subtraction, +multiplication, division, min/max, reciprocal, absolute value, square, sign, +powers, logarithms, clamp, monotonic endpoint mapping and linear interpolation. + +Power propagation handles exact and interval exponents separately, including +signed-zero bases, negative bases with integer exponent bounds, infinite +exponents and NaI endpoint hulls. Negative-base ranges preserve vanilla's +floating-point neighbor checks when probing odd/even integer exponents. +Logarithmic ranges intersect the valid nonnegative domain before endpoint +mapping. A fully negative range becomes NaI. Square-root graph ranges use the +power interval with exponent one half, retaining valid endpoints even when +some input values produce NaN. + +These operations preserve vanilla's special rules. Multiplication treats a zero +bound times infinity as positive zero. The reciprocal of an exact zero interval +is NaI; an interval spanning both sides of zero maps to infinite bounds. Hulls +ignore NaI members unless all members are NaI. Monotonic mapping skips NaI and +otherwise evaluates both endpoints before rejecting a NaN result. It accepts a +caller-supplied transformation; neither implementation proves monotonicity. + +Interpolation range analysis has distinct finite- and infinite-endpoint paths. +It uses range-specific zero products and infinity handling, rather than calling +the scalar density interpolator. Interval construction also canonicalizes a +negative-zero lower bound when the upper bound is one, matching the reference's +cached `[0, 1]` instance. NaI compares equal to itself, and signed-zero endpoints +compare numerically equal. `java_hash_code` exposes vanilla's endpoint-bit hash +separately: implementing Rust `Hash` with that function would violate Rust's +requirement that equal keys have equal hashes for some signed-zero intervals. + +## Validation and limits + +Run `python3 tools/test_density_parity.py` after preparing the pinned artifacts +with `python3 tools/test_rust_parity.py --prepare`. The original Java adapter +instantiates the actual vanilla sampler classes; it does not duplicate their +arithmetic. Both the client and server JARs process the same deterministic corpus +as the release Rust binary. Reference artifacts are checksum-verified, and source +hashes must remain unchanged during a run. Finite outputs and signed zeros are +compared by bits, with NaNs canonicalized. + +The corpus includes all axes and tiling modes, raw floating-point inputs, +nonfinite values, overflowing block coordinates, both RNG streams, Perlin, +simplex and smeared noise, nested shift graphs, repeated bulk evaluations, +logical buffer tails, unary and binary combinations, scalar short circuits, +zero-period failures and partial writes. The runner removes an old success report +before artifact verification, so a failed run cannot retain a stale success. + +The [recorded local comparison](../benchmarks/rust-density-2026-10-05/scoped-parity.json) +matched **15,524,627 output lines per reference JAR**. + +The separate [float-log comparison](../benchmarks/rust-float-log-2026-10-05/scoped-parity.json) +exhaustively matched **all 4,294,967,296 float input bit patterns** for the compiled +scalar logarithm against both JARs on the recorded Linux/JDK runtime. Signed zeros, +subnormals, infinities and NaNs are included; NaN results use Java's canonical +`Float.floatToIntBits` representation. This does not establish double-precision +logarithm parity or other-platform math parity. Reproduce it with: + +```bash +python3 tools/test_float_log_parity.py --exhaustive +``` + +The default command checks 1,048,576 inputs around domain and rounding boundaries +and is configured in CI. The density suite covers bulk composition and graph +range propagation separately. + +Private inputs, output dumps and reference classes remain under +`.local/rust-density-parity/`. Only the metadata report belongs in +`benchmarks/rust-density-2026-10-05/`. Local results are Linux evidence; +configured Windows/macOS CI checks are not a claim that those remote jobs ran. + +Pending work includes remaining graph definitions, serialized graphs, +serialized registries, concrete structure-density and nonempty old-world blending +providers, and full seeded chunk generation. +This suite establishes only the operations and inputs it exercises; +it does not establish whole-game parity or an FPS/render-distance improvement. diff --git a/docs/dispatch-retry.md b/docs/dispatch-retry.md index 62e70865a..0ea8564b1 100644 --- a/docs/dispatch-retry.md +++ b/docs/dispatch-retry.md @@ -56,7 +56,7 @@ earlier patched return produce different caller durations; these measurements describe the rejected-submission path, not normal task throughput. Linux CI runs the applied hooks; Windows and ARM Mac CI compile the fixture and production mod. -In [Linux CI run 37158922187](https://github.com/ludovic111/minecraft-optimization-lab/actions/runs/37158922187), +In [Linux CI run 37158922187](https://github.com/ludovic111/Horizon/actions/runs/37158922187), [the raw fixture result](../benchmarks/dispatch-retry-2026-10-04/linux-applied-hooks.json) reported 216,987,192 caller allocation bytes and 63,790 rejections upstream, versus 103,384 caller bytes and 6 rejections with the hook. Caller wall times were diff --git a/docs/feature-placement.md b/docs/feature-placement.md new file mode 100644 index 000000000..2e686c3ad --- /dev/null +++ b/docs/feature-placement.md @@ -0,0 +1,543 @@ +# Feature placement + +Horizon implements eighteen Java Edition **26.3** placement modifiers: count, +square spread, three-axis offset, height range, rarity filtering, random-chance +filtering, fixed positions, random selection among modifiers, heightmap positions, surface-relative +thresholds, water-depth filtering, both noise-based count forms, cuboid placement, +count-on-every-layer scans, predicate filtering, vertical environment scans and biome filtering. + +Placement preserves callback order, duplicate positions, wrapping coordinates, +provider sampling and random draw consumption. Fixed positions are filtered by +the origin's chunk X/Z. Random-choice nesting is bounded to depth 256 and 65,536 +modifier nodes; lists are bounded to 8,192 entries. Consumer failures retain +previous emissions and consumed draws. Probability-range decoding distinguishes +negative zero from positive zero, matching the native codec. + +Run `python3 tools/test_placement_parity.py`. The +[local report](../benchmarks/rust-placement-2026-10-06/scoped-parity.json) records +**1,268,600 matching lines per reference JAR**, across **520 definitions** and +**21,840 seeded fixtures**, with **70,080 requested modification calls** and **17,280 direct count queries**. Actual +`PlacementModifier.CODEC` and modifier callbacks supply the reference results. +The corpus tests both random modes, relative-height overflow, nested choices, +malformed fields, repeated calls, consumers that draw randomness and failures +before or after earlier emissions. + +This suite uses an actual placement context backed by a world proxy with traced synthetic heightmaps. +Additional block predicates, full feature registries, registry integration, +Gaussian providers, encoding and complete generated worlds remain pending. + + +## Modifier chains + +`FeaturePlacer` collects a modifier's outputs before processing its descendants, +preserving sibling order through a reusable pending stack. Actual feature callbacks +share the modifier random stream. Boolean results accumulate without skipping later +placements. An empty chain calls the feature directly. Errors retain pending and +modified-position buffers, matching vanilla when the same placer is used again. + +Run `python3 tools/test_feature_placement_parity.py`. The +[chain report](../benchmarks/rust-feature-placement-2026-10-06/scoped-parity.json) +records **548,461 matching lines per JAR**. Actual native `FeaturePlacer` executes +native modifiers and a synthetic feature sink, comparing emitted positions, +feature results, consumed randomness and repeated calls after failures. This tests +the execution machinery; the separate feature suite below connects it to initial block-writing algorithms. + +Rust bounds chains to 1,024 modifiers and per-call work/pending buffers to 2^20. +Unit tests reject oversized chains before feature calls or random draws and stop +multiplicative count expansion after bounded partial progress. + + +## Heightmap queries + +`PlacementContext` supplies generation bounds, the world minimum and heightmap +queries. These are separate: the world minimum can differ from the generator's +minimum. Heightmap placement emits only above the world minimum. Surface-relative +thresholds use 64-bit sums; water-depth subtraction retains Java integer wrapping. +Queries and emitted positions retain native order, and query errors stop the +current operation without drawing randomness or emitting a replacement position. + +Both suites include ordinary/extreme synthetic heights, all six map types, +distinct world/generator minima, default/reversed threshold ranges and injected +query failures. This validates how modifiers consume heightmaps; connecting +feature generation to complete world regions remains pending. + + +## Noise-based counts + +Noise-based and noise-threshold counts share vanilla's fixed biome-information +simplex noise. They preserve the float noise result before double arithmetic, +ceiling/narrowing behavior and strict threshold comparison. They consume no caller +random draws. `repetitions` exposes counts without expanding position lists. + +Primitive comparisons include extreme ratios, factors, offsets and thresholds, +including count-only queries that can return enormous counts safely. Chain tests +exercise ordinary noise counts together with other modifiers and feature callbacks. +Emitting repeating modifiers remains bounded to 4,096 repetitions in Rust. + + +Cuboid placement samples Y size, then independent X and Z sizes, before emitting +positions in X/Y/Z order. Its extents are inclusive. Edge and interior controls +are independent, and coordinates wrap. The suites cover all four control +combinations, provider variation, maximum decoded extents, consumer failures and +cuboids embedded in modifier chains. + + +## Layered placement + +Count-on-every-layer placement samples its count provider at every loop-condition +check, including the final check. Each attempt draws X/Z offsets, queries the +motion-blocking heightmap and scans down for the requested surface layer. Air +states and exact water/lava blocks count as empty. Bedrock is excluded as ground; +other blocks, including bubble columns, are potential ground. Emissions and count +sampling interleave, sharing the caller's random stream. + +The suites compare traced synthetic strata containing these block kinds, random +count providers, repeated passes and injected height/block/consumer failures. +`LayerBlock` is a query classification supplied by the world; complete block +behavior and region-backed feature generation remain pending. A shared 65,536-step +budget bounds scans, including when world queries supply extreme heights. + + +## Initial block-writing features + +`BasicFeature` implements the void start platform, End islands and the End +arrival platform. The world supplies block reads and mutations; required block +states bind through its registry. The algorithms preserve write order, update +flags, wrapped coordinates, ignored false mutation results and partial effects +when a world operation fails. End-island radius sampling retains native draw order. + +Run `python3 tools/test_basic_feature_parity.py`. The +[feature report](../benchmarks/rust-basic-feature-2026-10-06/scoped-parity.json) +records **1,820,614 matching lines per JAR**. Actual feature codecs and native place +methods operate on a mutable world proxy. Both random modes, multiple seeds, +nearby/far chunks, extreme coordinates, rejected writes, thrown failures and +repeated placements are compared, including complete accumulated stored states. +Native `setBlockAndUpdate` executes its actual default method, exposing its flags. +The suite also composes these features with modifier chains, sharing the mutable +world and random stream and reusing placer buffers after failures. +`place_with_context` gives feature callbacks the same world used by modifiers. + +This covers feature algorithms against a supplied mutation interface. Actual chunk +mutation, neighbor updates, lighting, entities/drops, complete feature registries +and generated worlds remain pending. The End-platform generation path does not +request the separate block-destruction/drop behavior used by portal recreation. + + +## Predicate filters and environment scans + +Logical predicates (`true`, `not`, `all_of`, `any_of`) preserve ordered +short-circuiting, including empty-list identities. Inside-world-bounds predicates +apply wrapping offsets before checking the world's inclusive height bounds. +Their offset codec retains Java's wrapping absolute-value behavior for the +minimum signed integer. These five predicate kinds also work inside filters and +vertical scans; state-dependent predicates remain pending. + +Environment scans check the initial allowed condition before the target, then +move one block at a time. They stop immediately outside build height. A failed +allowed condition after a move still permits the final target test at that +position. The codec limits scans to 1–32 steps; shared work and nesting budgets +also bound directly constructed predicates and scans. + +Both placement suites compare actual native codecs and predicate execution, +traced world-bound queries, short-circuiting, wrapped offsets, invalid directions, +step limits and query failures. Unit tests exercise oversized trees and scans +that would otherwise traverse billions of positions. + + +## Resident feature regions + +`TerrainRegion` routes block reads/writes by signed chunk coordinates and lazily +primes missing heightmaps. It requires consistent vertical bounds and registry +identity across resident chunks. Its placement context supplies generation bounds, +world bounds, heightmaps and layer classifications from those same chunks. +`TerrainFeatureAccess` shares that region with feature algorithms and forwards +all writes and flags to a caller-supplied mutation callback. + +Run `python3 tools/test_feature_region_parity.py`. The +[region report](../benchmarks/rust-feature-region-2026-10-06/scoped-parity.json) +records **28,922,634 matching lines per JAR** across 192 fixtures and 2,304 requested +placements. Actual native features and `FeaturePlacer` operate over a world proxy +backed by nine `ProtoChunk`s per fixture. The comparison includes both heightmap +groups, count/square/heightmap/layered chains, repeated writes, missing neighbors, +rejected writes, failures, update flags, random state, final raw sections and +packed heightmaps. + +The region corpus also runs a composed sequence of configured fill layers over +the same live chunks: water, horizontal logs, air and an out-of-height layer. +This connects block-state decoding, nested feature execution, shared placement +and chunk heightmap updates; the standalone fill-layer suite below covers +integer-property parsing and per-column query ordering in more detail. +Single-block replacement and scattered ore also execute against those resident +chunks, sharing the updated state, heightmaps, failure policy and random stream. + +The reference proxy supplies storage mutation. This verifies the connection +between features, placement queries and resident chunks; actual region write +zones, POIs, block entities, postprocessing, lighting and the full feature registry +remain pending. Unit tests check mixed-registry/bounds rejection, negative chunk +routing, missing-neighbor errors and mutation-callback flag/return handling. + + +## Inline feature composition + +`FeatureDefinition` and `PlacedFeatureDefinition` compose the initial block-writing +features with no-op, sequence, boolean choice, uniform choice, chance-based +choice and weighted-choice features. Sequences stop on the first false child. Selectors return the +chosen child's result directly. Child modifiers and features share world state +and randomness; each sequence uses one fresh placer across its children. +Native single-object holder-set shorthand is accepted for sequence/uniform lists. + +Run `python3 tools/test_feature_graph_parity.py`. The +[graph report](../benchmarks/rust-feature-graph-2026-10-06/scoped-parity.json) records +**737,779 matching lines per JAR** for actual native feature codecs and nested +placement. Cases include empty/malformed lists, singleton and nested choices, +zero/one probabilities, negative zero, false child results, partial writes, world +failures, repeated calls and top-level modifier chains. + +Decode depth, node count and list size are bounded. Feature/placed-feature visits +and nested modifier-chain execution share a runtime budget. Unit tests cover deep +decoding, large trees and modifier expansion that reaches no leaf features. +Weighted choices retain zero-weight children and return false without random draws +when their total weight is zero. Positive totals preserve the existing bounded +weighted draw algorithm. `OptionalWeightedList` keeps this behavior separate from +the nonempty weighted lists required by integer/height providers. The graph suite +covers empty/zero lists, integer narrowing, invalid/overflowing weights and nested +choices; both provider suites also pass after the shared implementation change. +The resource resolver below adds named holders and tags. Encoders and the full +feature registry remain pending. + + +## Named feature resources + +`FeatureCatalog` stores an immutable resource snapshot and resolves requested +feature or placed-feature roots. Named children, compact singleton holder sets, +mixed named/inline lists and ordered placed-feature tags expand into executable +trees. Resolution preserves numeric JSON fields, validates unselected children +and bounds dependency depth and expanded nodes. Duplicate canonical resource +names, missing dependencies and cycles return errors. + +Run `python3 tools/test_feature_catalog_parity.py`. The +[catalog report](../benchmarks/rust-feature-catalog-2026-10-06/scoped-parity.json) +records **1,734,390 matching lines per JAR** against actual registry-aware holder +codecs, registered feature snapshots and native `TagLoader`. It compares nine +named features, fourteen placed features, five tag files, nested/duplicate references, +optional/required missing tags, namespace shorthand and subsequent execution. +Configured fill layers, single-block replacements and scattered ore bind block-state +metadata through named roots, nested tags and modifier chains. Block-set +predicates execute through filters, ordered volumes and environment scans against +the mutable world, including repeated placement after earlier writes and flowing-water replacement +that changes later fluid-predicate results. + +Empty named tags retain a native distinction from empty inline lists: a sequence +can resolve an empty tag and succeed, while a uniform selector resolves it and +then fails its zero-bound random choice. The inline list codecs reject empty +lists during decoding. These cases and their random-state effects are compared. + +The resource API validates requested reachable roots, allowing unused unported +resources to remain in the snapshot. Complete datapack loading, live reloads, +registry ownership/identity semantics and all feature algorithms remain pending. + +## Configured fill layers + +`FeatureBlockBindings` binds block-state JSON against the pinned registry and its +integer-property metadata. `FillLayerFeature` visits 16 by 16 columns in native +X/Z order, queries the world minimum for each column and replaces only air states. +It preserves wrapping coordinates, write flags, ignored false write results and +early termination on world errors. Placement consumes no random draws. + +Run `python3 tools/test_fill_layer_parity.py`. The +[fill-layer report](../benchmarks/rust-fill-layer-2026-10-06/scoped-parity.json) +records **1,305,274 matching lines per JAR**, including codec inputs for all +35,723 pinned states, compact/full states, integer properties, invalid-property +defaults, height bounds, extreme coordinates, rejected writes and injected query, +read and write failures. Both random implementations retain matching subsequent +state. This comparison uses observable mutable storage; complete region effects +and full generated worlds remain pending. + +## Replacement rules + +`RuleTest` implements all ten pinned replacement-rule kinds: constant true, +negation, all/any, block identity, exact block state, block tags, inclusive height +range and the two random block/state matches. Logical rules preserve ordering and +short-circuiting. Random rules draw only after matching identity, including at +zero/one probability; their codecs allow probabilities outside that interval. + +Run `python3 tools/test_rule_test_parity.py`. The +[rule report](../benchmarks/rust-rule-test-2026-10-06/scoped-parity.json) records +**1,890,716 matching lines per JAR**, covering every block/state identity, all +300 bundled block tags, absent and empty-path tags, malformed inputs, reversed +height ranges, nested logic and subsequent draws from both random streams. +Decode depth, node count and list size are bounded, including branching inputs. + +Bindings share immutable sets of state IDs for blocks and resolved tags. +Native tag identifiers permit an empty path, which remains distinct from a +missing field. These predicates do not establish complete ore generation or +structure-processor behavior. + +## Single-block replacement + +`ReplaceBlockFeature` applies ordered rule/state pairs at an origin. It re-reads +the current state for each candidate and stops at the first match, regardless of +whether the write returns true. Empty or unmatched target lists still succeed; +read/write errors stop evaluation with the preceding mutations and RNG state +intact. Target decoding shares the graph's node budget when nested in a feature. + +Run `python3 tools/test_replace_block_parity.py`. The +[replacement report](../benchmarks/rust-replace-block-2026-10-06/scoped-parity.json) +records **303,678 matching lines per JAR** for actual native codecs and placement, +including rule ordering, shared random state, update flags, rejected writes, +partial failures, repeated mutations and invalid unselected targets. + +## Scattered ore + +`ScatteredOreFeature` samples the native attempt count, consumes six float draws +for each offset (including zero spread), rounds with Java's tie behavior and +captures the candidate state once per attempt. Matching target rules then apply +the configured air-exposure probability and ordered directional neighbor checks. +The first accepted target writes with flag 2; a false write result is ignored. + +Run `python3 tools/test_scattered_ore_parity.py`. The +[scattered-ore report](../benchmarks/rust-scattered-ore-2026-10-06/scoped-parity.json) +records **758,484 matching lines per JAR** across 11,544 fixtures and 23,088 +requested placements. Cases include size/discard codec boundaries, empty targets, +solid/mixed worlds, each of the six air-neighbor directions, wrapping positions, +partial failures, rejected writes and both shared random streams. + +Ordinary ore veins use a separate bulk-section mutation path and remain pending. +A private Linux/JDK 25 probe also found 4,935 bit differences among 2,581,112 +double sine/cosine results for sampled ore angles when using Rust platform math. +Those intermediates are not yet validated for vein geometry; no exact double-trig +parity is claimed. +This scoped feature comparison does not establish biome decoration or full +generated-world parity. + +## Bulk section access + +`TerrainBulkAccess` exclusively borrows resident chunks and caches sections by +vanilla's packed section key. Raw reads retain cave/void air even when normal +chunk reads collapse an all-air section to AIR. Outside-height reads return AIR +before resolving a chunk. Raw writes maintain section occupancy but leave chunk +heightmaps untouched; region write permissions remain the caller's responsibility. + +Run `python3 tools/test_bulk_section_parity.py`. The +[bulk report](../benchmarks/rust-bulk-section-2026-10-06/scoped-parity.json) records +**959,640 matching lines per JAR** against actual `BulkSectionAccess` and resident +`ProtoChunk`s. It covers every state, primed/lazy heightmaps, missing chunks, +vertical boundaries, packed-coordinate aliases, cache reset and complete final +section/heightmap data. The exclusive Rust borrow replaces Java's acquire/release +locks within this resident-region API; concurrent section ownership remains pending. + +## Biome feature ordering + +`build_features_per_step` combines ordered biome feature lists using placed-feature +object identities. It assigns encounter indices, orders graph traversal by step +and index, detects cycles and reverses DFS completion order to produce each step's +feature list and identity-to-index mapping. Equal feature payloads remain separate +when their identities differ. Traversal uses an explicit stack and bounded input +work; tests include a 50,000-feature dependency chain. + +Run `python3 tools/test_feature_sort_parity.py`. The +[ordering report](../benchmarks/rust-feature-sort-2026-10-06/scoped-parity.json) +records **411,751 matching lines per JAR** across 3,871 fixtures. Native +`FeatureSorter` receives identity-distinct dummy payloads for synthetic graphs and +the feature lists from all 67 bundled biomes, including shuffled/subset combinations. +Cycles, duplicate references, cross-step reuse, empty steps and index lookups are +compared. Cycle diagnostic minimization/text and complete decoration remain pending. + +## World-generation random streams + +`WorldgenRandom` applies vanilla's legacy bit-sampling interface to legacy or +xoroshiro sources. Longs and doubles retain their multi-draw assembly, bounded +integers retain legacy rejection and each bit request increments a wrapping count. +Reseeding preserves the counter. Forks and positional factories delegate to the +underlying source and return its normal draw behavior through a transparent variant. + +Run `python3 tools/test_worldgen_random_parity.py`. The +[random-adapter report](../benchmarks/rust-worldgen-random-2026-10-06/scoped-parity.json) +records **238,800 matching lines per JAR** for 119,100 operations in 300 fixtures. +It includes one to three nested wrappers, arbitrary signed bit-width shifts, +failed bounds, parent/child streams, positional UTF-16 hashes and decoration, +feature, large-feature, salted and slime-chunk seeds with int/long overflow. +Gaussian sampling, concurrent use and complete chunk decoration remain pending. + +## Biome placement filtering + +`Biome` requires the invocation's top placed feature before querying the biome and +its generation settings. `place_with_biome_check` establishes that context for +the current modifier chain; a nested ordinary placer starts without it. Biome +resolution and membership are supplied by the world. Native membership treats +structurally equal placed-feature copies as equal, while feature ordering uses +object identities. + +Run `python3 tools/test_biome_placement_parity.py`. The +[biome-filter report](../benchmarks/rust-biome-placement-2026-10-06/scoped-parity.json) +records **121,423 matching lines per JAR** for 27,456 requested placements across +9,152 fixtures. Actual `BiomeFilter` and `FeaturePlacer` compare missing roots, +equal copies, different features, ordered queries, nested ordinary placement, +injected failures and repeated calls with retained buffers. Both random sources +are tested directly and through `WorldgenRandom`. Complete registry membership, +biome sampling integration and chunk decoration remain pending. + +## Decoration feature scheduling + +`FeatureDecorationPlan` owns immutable biome generation lists and their globally +ordered step features. It reads the surrounding nine chunks in X-first order, +intersects their resident biomes with the generator's possible-biome set and +executes the sorted union of global feature indices for each step. Each root +receives its decoration/feature seed and a shared placer. False results do not +skip subsequent roots. Errors retain previous work and the current-feature +marker; successful completion clears the marker. + +Run `python3 tools/test_decoration_parity.py`. The +[decoration report](../benchmarks/rust-decoration-2026-10-06/scoped-parity.json) +records **337,398 matching lines per JAR** across 2,188 fixtures and 4,376 requested +decoration calls. Actual `ChunkGenerator.applyBiomeDecoration` runs with +structures disabled, resident `ProtoChunk` biome palettes and traced feature +sinks. All 67 bundled biome feature lists participate. Sparse selections, +excluded biomes, step gaps, cycles, coordinate overflow, biome-check modifiers, +false returns and query/placement/progress failures are compared. Rust bounds +extreme signed chunk neighborhoods and input work explicitly. Structure +decoration, real feature payloads in this suite and full chunk lifecycle remain +pending. + +## Decoration over resident chunks + +`BiomeRegion` connects quart biome sections to seeded block-position biome zoom. +`TerrainRegion::biome_at` checks the selected chunk's generation stage before +reading its biome. Premature reads fail even if raw palette values already exist; +decoration's initial palette collection can still inspect those raw values. + +Run `python3 tools/test_decoration_region_parity.py`. The +[resident decoration report](../benchmarks/rust-decoration-region-2026-10-06/scoped-parity.json) +records **36,173,951 matching lines per JAR** for 240 fixtures and 480 requested +decoration calls. Java's actual decoration entry point places three basic +features, configured fill-layer sequences, replacements and scattered ore into +nine `ProtoChunk`s. Uniform/mixed biome palettes, biome zoom, global scheduling, +feature seeds, biome filters, named biome-set and volume predicates, live +heightmaps, repeated decoration and rejected +or failed writes execute together. Every final raw block and heightmap word is +compared, including EMPTY, BIOMES and TERRAIN stage behavior. Workspace tests, +Clippy and 137 Python tests passed after this integration. + +The world transport supplies storage mutation. Actual `WorldGenRegion` write +zones, retrogen, POIs, block entities, postprocessing, lighting, structures and +the complete noise-to-decoration lifecycle remain pending. + +## Block-state providers + +`BlockStateProvider` supports simple states, weighted states, random blocks, +rotation, property copying, randomized integer properties, three noise-based +providers and rule-based selection. Direct decoding preserves the exclusive choice +between a full state object and a typed provider. Random block choices retain +holder/tag order and duplicates. Empty choices return no optional state, while +ordinary sampling reads the existing world state. Rotation chooses a direction +before sampling its nested provider, changes only compatible axis/facing +properties and preserves other properties. Fixed directions consume no direction +draw. Property copying preserves only compatible property families. Integer +sampling leaves states without the named integer property unchanged without +drawing a value; invalid sampled values fail after consuming the draw. Shared +compact state layouts avoid rebuilding property maps during these transforms. + +Noise providers use independently seeded legacy noise and preserve the native +float/double coordinate conversions. Threshold selection preserves conditional +random draws. Dual noise computes the selected candidate directly: the other +candidates are pure noise queries without random or world side effects. +Rule-based providers evaluate conditions in order, continue after empty optional +results and sample their fallback only after all rules are exhausted. Current +conditions cover true, not, all-of, any-of, world bounds, height ranges, block tags +volume matching and registry-bound block/fluid/biome sets. Height-range predicates reconstruct generation bounds per +evaluation; volume matching visits X, Z, then Y and stops on the first failure. +World adapters supply tag membership and fallible generation-bound queries. The +height-range comparison currently exercises ordinary LevelAccessor bounds; the +WorldGenLevel server/generator lookup branch is not covered by this fixture. + +Interrupted runs can be resumed with `python3 tools/test_state_provider_parity.py --resume`. +The runner verifies source, environment, fixture and compiled-artifact hashes +before reusing completed stages. A changed output is regenerated; changed inputs +require a fresh run without `--resume`. Checkpoints stay under `.local`, and +a parity report is written only after both native comparisons pass. + +Run `python3 tools/test_state_provider_parity.py`. The +[provider report](../benchmarks/rust-state-provider-2026-10-06/scoped-parity.json) +records **105,340,143 matching lines per JAR**, with 299,507 codec inputs +and 39,270,062 requested samples across ten provider kinds. Every pinned state is decoded and tested +under all six fixed rotations; random/nested rotations, both sampling methods, +empty tags, weighted boundaries, fallback query failures and four random-stream +combinations are compared. Every target state is also tested against +representatives of all compatible property values, including cross-block copies +and integer-property boundaries. The native harness verifies that the pinned +property-family signatures are unambiguous; Rust validates the Cartesian state +tables before binding their transitions. Noise cases include all eight bundled +provider definitions, coordinate boundaries, extreme scales, variety +selection and malformed codec inputs. Rule cases cover ordered empty results, +fallbacks, nested rules, bound-query failures and wrapping coordinates. Block-tag +cases cover every tag against all block defaults and the two bundled rule-based +definitions against every state. Volume comparisons include exact read order and +early exits, while Rust-only tests bound pathological nested evaluation work. Workspace +tests, Clippy and 137 Python tests passed at this stage. + +The unobstructed predicate validates its optional integer-vector offset but +ignores it during evaluation, matching the pinned Java implementation. The +comparison checks exact translated unit-block bounds, a null excluded entity, +true/false world results, nested volumes and query failures. + +`BiomePredicateBindings` resolves biome names and holder tags to IDs in the +world's owning registry snapshot. The comparison covers every pinned biome and +every bundled biome tag, empty sets, missing names, query failures and nested +volume/short-circuit conditions. Decoration shares the same `BiomeId` identity. + +`FluidStateTable` derives fluid identity, amount, falling/source flags and own +height from the pinned block descriptors. The harness compares every state, +including falling source water in all eight waterlogged copper grates. Fluid +predicates compare all five fluid kinds, holder lists and every bundled fluid tag +against every block state. This covers contained fluid state, not spreading or +entity interactions. + +`StateProviderCatalog` resolves named holder references from an immutable resource +snapshot. Holder, direct and typed entry points retain their distinct decoding +semantics, including ambiguous state/provider objects. The comparison registers +all eight bundled definitions plus nested fixture resources and checks missing +names, nested references and later random draws. Unused resources are not +evaluated; Rust tests reject reachable cycles, duplicate canonical names and +excessive expansion. Full datapack registry loading/reloading remains separate. + +Recursive provider decoding is bounded to depth 128 and shares a 65,536-node +budget with rules, predicates and integer providers; holder/rule lists are bounded +to 8,192 entries. Additional predicates, complete registry loading, block survival +and complete feature placement remain pending. + +Solid and replaceable predicates now bind immutable property tables to the same +block registry as provider and feature decoding. Their offsets, state reads, +short-circuit composition, empty optional-child fallthrough and read failures +are compared across the entire state registry. Together with the earlier kinds, +**14 block-predicate kinds** are covered in the state-provider report. Full +workspace tests, warning-free Clippy and **139 Python tests** passed at this +integration snapshot. Face support and block survival still need implementation. + +The has-sturdy-face predicate now decodes native directions and bounded offsets, +then delegates the ordered state/support query to its placement world. The +state-provider comparison covers all **35,524 cached states**, six directions, +read failures and composed predicates, bringing the scoped corpus to **15 +predicate kinds**. Dynamic state support is not established by this integration +report; unavailable world behavior remains an explicit query error. Workspace +tests, warning-free Clippy and **140 Python tests** passed at this snapshot. + +Unified block-support dispatch now extends that predicate corpus to all **35,723 +states**, including the **199 dynamic states** with absent block entities and +injected block-entity query failures. The updated provider report covers the +combined path. Shulker animation snapshots are covered separately by the dynamic +support suite; active moving-piston shape generation and block-entity lifecycle +remain outside this integration snapshot. Workspace tests, Clippy and **141 +Python tests** passed. + +The `would_survive` predicate now decodes a candidate block state and bounded +offset, then invokes survival at the translated position without placing it. +Both provider and feature bindings use the shared block-state codec; placement +chains forward the survival query. The refreshed provider report records +**105,340,143 matching lines per JAR**, **299,507 inputs**, **39,270,062 requested +samples** and **16 predicate kinds**. Its survival snapshot covers 15 rules, +1,138 definitions and 31,171 candidate states, with each rule tested against the +entire neighbor-state registry, malformed definitions, wrapped offsets, +short-circuit conditions, optional-child fallthrough and query failures. +Unsupported survival definitions remain errors. This report does not establish +full block placement or every block's survival behavior. Workspace tests, +warning-free Clippy and **143 Python tests** passed at this snapshot. diff --git a/docs/heightmaps.md b/docs/heightmaps.md new file mode 100644 index 000000000..74d28b21c --- /dev/null +++ b/docs/heightmaps.md @@ -0,0 +1,57 @@ +# Heightmaps + +Horizon implements the six heightmap types in the pinned Minecraft Java Edition +**26.3**. Each map stores 256 relative column heights in padded 64-bit words. +World-surface predicates use `isAir`; ocean-floor predicates use the version's +`blocks_motion_in_heightmap` block tag. Motion-blocking maps also include nonempty +fluid states, with the separate no-leaves tag for that variant. + +`HeightmapState` supplies block behavior and tag membership. `HeightmapChunk` +supplies the vertical extent, highest occupied section and block reads. The map +owns its packed data and checks that a supplied chunk has the same bounds. Its +current constructor accepts positive, aligned ranges within the vanilla noise +settings codec domain; zero-height and arbitrary runtime accessors are outside +this bounded API. + +Updates retain the early return for blocks below the top two positions. Removing +a qualifying surface scans downward until another qualifying block is found. +Priming scans X, then Z, then descending Y, sharing each block read across the +selected maps. It skips exact AIR blocks and stops a column when all selected +maps have found a surface. If a column finds nothing, its existing value remains. +This also applies to re-priming after a raw-data length mismatch. + +Raw imports preserve every bit when the word count matches, including padding, +unused slots and values above the build height. Column addressing retains Java's +wrapped `x + z * 16` calculation; invalid final indices return typed errors. The +Rust API does not expose a mutable alias to its internal words. + +Run the differential suite with: + +```sh +python3 tools/test_heightmap_parity.py +``` + +The [local metadata report](../benchmarks/rust-heightmap-2026-10-06/scoped-parity.json) +records **1,671,668 matching output lines per reference JAR**, checked separately +against the authenticated client and server. It covers all **35,723 block states**, +all six predicate and persistence/client flags, and **100 chunk fixtures** with +86,806 state writes, 54,306 column queries, 516 priming calls, 378 raw-data loads +and additional update-only error cases. Selected fixtures compare exact ordered +block reads. Cases include section and vertical bounds, leaves, fluid-bearing +states, air variants, removal rescans, empty-column retention, packed padding, +invalid raw lengths and wrapped column indices. + +Air/fluid facts and state identities are exported independently from each JAR and +required to agree. These are private test inputs, not ports of block behavioral +methods. Rust resolves heightmap tag membership using its tag loader and the +300 bundled block-tag resources. The reference binds those resources to the +actual vanilla block registry and invokes `Heightmap` on `ProtoChunk` instances. +Only in-memory section storage is used; placeholder biome holders do not exercise +biome properties or section codecs. + +Source and fixture changes during a run invalidate its report. Raw resources, +state exports and comparison traces stay under ignored `.local`; the checked-in +report contains metadata and hashes. CI runs this suite on its configured +platforms; the local result does not establish those remote results. Chunk +lifecycle integration, generated terrain, lighting and playable gameplay remain +pending. diff --git a/docs/mac-first-test.md b/docs/mac-first-test.md index e361ac809..e5eaf47cf 100644 --- a/docs/mac-first-test.md +++ b/docs/mac-first-test.md @@ -7,7 +7,7 @@ The Linux software-rendering observations do not predict an M2 speedup. ## Import after installing Prism -1. Download [horizon-mac-starter-0.21.0.zip](https://github.com/ludovic111/minecraft-optimization-lab/releases/download/v0.21.0/horizon-mac-starter-0.21.0.zip) +1. Download [horizon-mac-starter-0.21.0.zip](https://github.com/ludovic111/Horizon/releases/download/v0.21.0/horizon-mac-starter-0.21.0.zip) and extract it in Finder. 2. In Prism, choose **Add Instance > Import**, then select `horizon-m2-balanced-0.21.0.mrpack` from the extracted folder. The individual diff --git a/docs/material-conditions.md b/docs/material-conditions.md new file mode 100644 index 000000000..044d9dd0b --- /dev/null +++ b/docs/material-conditions.md @@ -0,0 +1,88 @@ +# Numeric material conditions + +Horizon evaluates the pinned Java Edition **26.3** hole, steepness, height, +water, stone-depth, vertical-gradient, noise-threshold, biome-membership, temperature +preliminary-surface and negated material conditions. +`MaterialConditions` owns each worker's context and compiled conditions, keeping +cache lifetimes tied to that worker. Column updates invalidate both column and +block conditions; block updates leave column caches intact. Secondary surface +noise is shared and sampled lazily once per column revision. + +Height and layer arithmetic preserves signed integer wrapping. Vertical gradients +resolve anchors during compilation, derive named positional random factories and +preserve the boundary order even with equal or reversed bounds. Stone depth uses +the appropriate floor/ceiling depth and Java's floating-point mapping and casts. +`MaterialSurface` implements the surface input interface used by this worker. + +Run `python3 tools/test_material_condition_parity.py`. The +[local report](../benchmarks/rust-material-condition-2026-10-06/scoped-parity.json) +records **5,627,426 matching output lines per reference JAR** across **245 fixtures**, +**11,288 initially compiled conditions** and **217,969 context operations**. +The original Java transport constructs actual vanilla conditions and calls their +compiled evaluators against actual context updates. Secondary sampler queries +are traced to compare lazy evaluation and cache reuse. Tests include both random +algorithms, integer extremes, nonfinite secondary values, floor/ceiling selection, +reversed gradient bounds, repeated evaluations and late compilation. + +For isolation, the native context's surface depth is supplied after each column +update, and secondary noise comes from a traced constant sampler. Full seeded +surface queries have a [separate comparison](material-surfaces.md). Sources and +fixtures are authenticated, and raw reference artifacts stay under `.local`. + +The comparison also covers **8,609 codec inputs**, all **eight bundled material +condition definitions**, forward/nested references, canonical encoding and numeric +conversions. Immutable registry loading rejects missing/cyclic references and +duplicate canonical names without publishing partial results. + +This scope excludes live biome-tag reloads, registry-owner +validation and arbitrary provider failures. Chunk application has a +[separate comparison](material-surfaces.md#chunk-surface-stage). Runtime trees +are bounded to 256 levels and 8,192 registered conditions per worker; these limits +are explicit resource bounds, not vanilla gameplay claims. + +The same comparison now includes **6,271 initially compiled material rules**: +block results, ordered sequences, conditional rules and seeded terracotta bands. +It checks empty/singleton/nested sequences, first-match short circuiting, late +compilation, band-index failures and separate context/application coordinates. +[Bundled rule loading](material-rule-libraries.md) now integrates these runtime +rules; rule encoding remains pending. + +Noise thresholds share lazy suppliers by canonical noise name and dimension mode. +Column-only suppliers still call the three-coordinate sampler with Y fixed at +zero. The comparison includes all 64 bundled noises under both random algorithms, +traced mutable inputs, repeated updates, late binding and nonfinite thresholds. +`MaterialNoiseSources` supplies lazy named samplers from the world positional +factory. Encoded numeric values are compared as double bits to preserve values +independently of JSON number formatting, including Gson NaN/Infinity output. + +Biome membership and temperature checks use the climate fields of all 67 bundled +biomes. Tests cover possible-biome constant folding, shared biome lookup caches, +column/block updates, null lookups, thrown lookup failures and same-revision +retries that retain earlier condition results. A missing result after a failed +first evaluation remains an error. Worker condition evaluation returns typed errors. + +Named biome-tag conditions resolve all **86 bundled tags** through the tag loader +and retain their tag identity when encoded. Comparisons cover nested references, +optional missing members, duplicate entries, empty tags, namespace aliases, +possible-biome folding and conditional-rule application. Registry snapshots are +immutable; live tag reloads remain pending. + +Preliminary heights use a lazily populated unit-spaced XZ density plane, with +scalar sampling outside it. `MaterialDensitySources` accepts the compiled +preliminary-surface root and its world sampler context. The comparison checks +column minimum caching, Y-only updates, ignored original volume strides, partial +failed fills, retries, floor conversions, infinities/NaN and integer wrapping. +The preliminary plane is bounded to 1,048,576 samples. + +Ore-vein rules accept three compiled density roots. Density and richness fill +the expected chunk volume at compilation; gap sampling stays lazy. Cached +lookups require an exact lattice position. Density queries use the block context; +random choices use application coordinates and the seeded `minecraft:ore` stream. +Tests cover both random algorithms, draw order, repeated calls, independent +coordinates, nonfinite runtime values, raw-ore chances and failed compilation. +Debug ore-vein visualization flags are outside this gameplay scope. + +Material density storage is bounded to 32,768 bindings, 1,048,576 samples per +eager volume and 16,777,216 retained eager samples per context. Bundled rule +decoding has a [separate comparison](material-rule-libraries.md); rule encoding +remains pending. The surface-stage comparison integrates these density bindings. diff --git a/docs/material-rule-libraries.md b/docs/material-rule-libraries.md new file mode 100644 index 000000000..47a434d9f --- /dev/null +++ b/docs/material-rule-libraries.md @@ -0,0 +1,36 @@ +# Material-rule libraries + +`MaterialRuleLibrary` loads the pinned Java Edition **26.3** rule resources against +block-state, condition, noise and density registries. It supports block rules, +ordered sequences, conditional rules, terracotta bands, ore veins and nested named +rule references. Loading is atomic; missing references, cycles and duplicate +canonical names return errors. Limits are 8,192 registered definitions, 65,536 +parsed nodes and 256 nested levels. + +The library owns a density compiler configured for one world seed and random +mode. `rule(name)` resolves a runtime tree and lazily compiles its density roots. +Binding that tree to `MaterialConditions` performs per-chunk density sampling. +`named_density(name)` shares the compiler with preliminary-surface sampling. +`compile_router` and `compile_aquifer` bind configurations decoded into the same +density registry before it is passed to the library. Their samplers share the +material roots' cache namespace, so noise filling and surface application can +reuse a worker context. Workers need matching world random settings and separate +cached sampler contexts. + +Run `python3 tools/test_material_rule_library_parity.py`. The +[local report](../benchmarks/rust-material-rule-library-2026-10-06/scoped-parity.json) +records **678,174 matching output lines per reference JAR**, including **665,712 +rule applications** and **142 codec inputs** across 12 fixtures. The test loads all +**42 bundled rules**, **8 conditions**, **55 densities**, **64 noises**, **67 biome +climates** and **86 biome tags** from both authenticated reference JARs. It also +checks synthetic forward references and constant-density ore rules. + +Comparisons use actual seeded noise and ore densities, strided chunk caches, +scalar fallback, varying biomes/depths/heights, possible-biome sets and distinct +context/application coordinates. Surface depth and secondary noise are supplied +context inputs; preliminary density is zero to isolate rule evaluation. + +The [surface stage](material-surfaces.md#chunk-surface-stage) now applies these +rules to chunks. Rule/density encoding, live reload, registry-owner checks and +playable integration remain pending. The report establishes +this tested scope, not complete vanilla gameplay parity or an FPS improvement. diff --git a/docs/material-surfaces.md b/docs/material-surfaces.md new file mode 100644 index 000000000..2f8ad65b1 --- /dev/null +++ b/docs/material-surfaces.md @@ -0,0 +1,125 @@ +# Seeded material surfaces + +Horizon implements the pinned Java Edition **26.3** material system's terracotta +band generation, band lookup, surface depth and secondary surface-noise query. +These primitives now feed the [chunk surface stage](#chunk-surface-stage). + +`ClayBands` generates all 192 entries from the supplied clay-band random stream. +It preserves orange placement, colored-band widths and overwrites, white/gray +adjacency checks and conditional random draws. `MaterialSurface` derives that +stream from the world's root positional factory using `minecraft:clay_bands`. +Its surface-depth query uses a fresh position-derived random stream. + +Band lookup rounds the float noise offset with Java's tie and saturation rules, +then uses wrapped integer addition and signed remainder. A negative final index +returns `None`, corresponding to vanilla's array-index failure. Surface-depth +arithmetic promotes the sampled float to double before applying coefficients and +truncating to an integer. Secondary noise similarly retains the float-to-double +conversion. + +Run: + +```sh +python3 tools/test_material_surface_parity.py +``` + +The [local report](../benchmarks/rust-material-surface-2026-10-06/scoped-parity.json) +records **122,988 matching output lines per reference JAR**, covering **277 fixtures** +and **5,263 surface-query positions**. The original Java transport invokes actual +`MaterialSystem` methods and its real constructor. Comparisons include both random +algorithms, direct and derived streams, preconsumed random inputs, every band +entry, subsequent random draws, real bundled noise definitions and constant-noise +overrides for rounding boundaries, infinities, NaNs and extreme coordinates. + +Reference artifacts and noise resources are authenticated, source/fixture changes +invalidate the report, and raw inputs/outputs stay private under `.local`. CI +includes this comparison on its configured platforms; the local result does not +establish remote outcomes. Subsequent suites cover rule binding, biome-specific +extensions and chunk surface application. + +[Vertical anchors](vertical-anchors.md), used by material conditions, now have a +separate differential implementation and codec comparison. + +[Numeric material conditions](material-conditions.md) now evaluate surface inputs +with worker-owned caches. [Bundled rule libraries](material-rule-libraries.md) +bind the pinned material definitions and their ore-density samplers. + +## Biome-specific column extensions + +`MaterialExtensions` implements eroded-badlands pillars and frozen-ocean icebergs. +It preserves noise coordinate arithmetic, temperature-dependent melting, seeded +random draw order, repeated column reads and property-independent block identity. +The column provider controls out-of-height reads and write clipping; failed calls +retain earlier writes. Each extension call is bounded to 1,048,576 iterations. + +Run `python3 tools/test_material_extension_parity.py`. The +[local extension report](../benchmarks/rust-material-extension-2026-10-06/scoped-parity.json) +records **233,100 matching lines per JAR** across **410 fixtures** and **3,920 +extension calls**. It compares ordered noise/read/write traces and complete +columns, including both random modes, all 67 biome climates, actual seeded noises, +constant threshold/nonfinite inputs, air/water variants and provider failures. +The chunk surface stage integrates these extensions with heightmaps and fluid +postprocessing. + + +## Chunk surface stage + +`build_surface` traverses columns in vanilla X/Z order and scans down each column, +maintaining stone-depth and water-level counters. It applies bound material rules, +eroded-badlands pillars and frozen-ocean icebergs. Writes update both world-generation +heightmaps and append fluid-postprocessing offsets in order, including duplicates. +Generation bounds clip writes while scans retain the chunk's full height. The +worker returns its density context to the caller on success and typed failure; +previous writes remain visible after failure. + +Run `python3 tools/test_material_stage_parity.py`. The +[local stage report](../benchmarks/rust-material-stage-2026-10-06/scoped-parity.json) +records **6,733,382 matching output lines per reference JAR**, covering **79 fixtures**, +**42 terrain fills**, **42 procedural carving passes**, **106 surface builds** and **21,757,952 block values**. The reference invokes actual +`MaterialSystem.buildSurface` on vanilla `ProtoChunk` instances. Comparisons include +complete sections, packed heightmaps, ordered postprocessing and biome queries. +Fixtures exercise both random modes, the bundled rule registries, real seeded +noises, empty and populated chunks, cavities, nondefault solids, clipped writes, +primed and lazy heightmaps, and repeated builds sharing density contexts. +Generated fixtures run actual `NoiseBasedChunkGenerator.doFill` followed by surface +application on the same native noise chunk. Rust shares a compiler and worker +context across both stages. All seven bundled terrain routers and aquifer +configurations are tested with multiple seeds and distant positive/negative +coordinates, comparing full chunk state before and after surface application. + +Synthetic initial chunks use a supplied block-position biome resolver. Generated +terrain fixtures first generate a 3×3 biome neighborhood through actual +`ChunkGenerator.doCreateBiomes`, using multi-noise presets or the End source. +The comparison checks **378 biome chunks** and **400,896 biome cells**, then +performs seeded `BiomeManager` lookups against those stored neighbor biomes. +Both block and quart lookup traces are compared. Rust imports independently +authenticated preset tables; their builders remain separate work. +Generated fixtures additionally select and run biome carvers across the 17×17 +origin neighborhood, comparing uncached biome queries and the complete terrain +state after procedural carving. They then apply explicit masks twice as a stress +check. See [carving integration](carving.md#biome-selected-neighboring-carvers). +The neighborhood decodes its source JSON through the registry-bound biome-source +catalog and uses the shared resolved-source worker API. Block air/fluid metadata +is imported from both authenticated JARs. Native preset builders, full inline biome +codecs, feature/structure stages, nonempty blending, lighting +and complete generated worlds +remain pending. A separate Rust test verifies that successful builds, eager binding +failures and late biome-provider failures preserve density caches and world fields, +and that late failure retains prior chunk writes and fluid offsets. +CI includes the stage gate; remote results have not been observed. + + +## Surface material beneath carved blocks + +`top_material` binds a fresh one-cell material context at the supplied position, +using clamped neighboring heightmap gradients and one stone block above and below. +Submerged queries set water height to Y+1; dry queries use the vanilla sentinel. +Possible-biome restrictions are omitted, as in vanilla's method. The returned +state is left for the carving stage to apply. Both successful and failed queries +retain the caller's density context; the query itself does not change blocks. + +The surface-stage comparison includes **7,584 top-material queries** against +actual `MaterialSystem.topMaterial`, at column edges and interiors, around sea +level and immediately outside vertical bounds, in both dry and submerged contexts. +The latest combined report records **6,733,382 matching lines per JAR**. Unit tests +also check failure-state retention and the omission of possible-biome shortcuts. diff --git a/docs/noise-generation.md b/docs/noise-generation.md new file mode 100644 index 000000000..055c32202 --- /dev/null +++ b/docs/noise-generation.md @@ -0,0 +1,96 @@ +# Horizon noise-generation scope + +The target is the repository-pinned Minecraft Java Edition **26.3**. The Rust +samplers live in `crates/horizon-core/src/noise/` and use the checked legacy or +xoroshiro streams. They are a world-generation foundation; Horizon does not yet +generate complete vanilla chunks or run a playable Rust game. + +## Implemented behavior + +- Gradient offsets and all 256 permutation entries, including the three random + draws consumed when simplex offsets are disabled. +- 26.3 Perlin 2D/3D sampling, single-precision interpolation and accumulation into + caller-supplied derivative arrays. Smeared Perlin uses its adjusted Y component + for gradient dots and the original component for interpolation. Its inherited + derivative method samples the unsmeared field. +- Simplex 2D/3D sampling with both offset modes, double-precision corner arithmetic + and single-precision return values. The second 2D coordinate uses the Y offset. +- Normal coordinate wrapping with the Far Lands debug flag disabled, including + the fast-path boundary immediately below 2^24. +- Positive strided density volumes with Z/X/Y flat ordering, Java-wrapping block + coordinates, bulk Perlin/smeared-Perlin gradient reuse, scalar simplex volumes, + repeated scaled accumulation and untouched buffer tails. +- Ordered noise stacks, nested sampling, flattened stack composition, layer + access and range arithmetic. Zero-amplitude layers are retained. Flattening + rescales each layer before sampling and can differ from a nested stack. +- Normal-noise octave selection, frequencies, amplitude modifiers, compensated + amplitude sums, enabled/disabled/legacy normalization and the parity factory. + Modern creation forks two positional factories and derives each octave from + its name, then interleaves the two sets of Perlin layers. +- Legacy Nether biome initialization, including reverse octave construction, + exactly 262 integer draws for skipped octaves, rejected positive octaves and + the RNG state left by initialization failures. Its two stacks are flattened in + sequence, preserving their distinct accumulation order. + +The bulk Perlin kernel adds X/Z gradient contributions before Y. Calling the +scalar sampler repeatedly would rearrange those operations and can change the +result. Rust preserves the bulk path and caches its eight gradients while the +Y cell remains unchanged. These are implementation choices checked for behavior; +no whole-game frame-rate or generation-speed improvement has been measured. + +## Validation + +After preparing the pinned artifacts with `python3 tools/lab.py prepare`, run: + +```sh +cargo test --workspace +cargo clippy --workspace --all-targets -- -D warnings +python3 tools/test_noise_parity.py +``` + +The original Java adapter invokes the actual downloaded classes on both client +and server JARs. It exposes offsets, permutations, octave parameters and layer +weights for comparison, and calls the reference scalar and bulk methods. +Artifacts and dependencies are authenticated against the repository lock and +the official bundled checksums. Generated corpus/output and compiled adapters +remain private under `.local/rust-noise-parity/`. + +The corpus covers both random streams; offset and lattice boundaries; very large +coordinates; signed zero, subnormals, infinities and NaNs; negative and zero +amplitudes; rejected ranges; nested and flattened stacks; octave gaps; all three +normalization modes; empty definitions; and modern/legacy RNG consumption. +Finite values and signed zeros are compared by bits. NaN payloads/signs are +canonicalized on both sides, matching Java's `floatToIntBits`/`doubleToLongBits`. + +The local run matches **1,443,539 output lines per reference JAR**. This is a +count of output records, including repeated checks, not distinct gameplay +behaviors or a coverage percentage. The metadata-only +[scoped report](../benchmarks/rust-noise-2026-10-05/scoped-parity.json) records +source/input/output hashes and reference identities. The runner removes a prior +success report before running and rejects source changes during validation. +CI includes the suite on Linux, Windows and Apple Silicon macOS; the recorded +local result is Linux, not proof that remote jobs or physical gameplay passed. + +## API limits and remaining integration + +Rust returns typed errors and uses immutable shared samplers. Density dimensions +and strides must be positive, total volume must fit a Java signed array index, +and a short output buffer is rejected before any writes. Vanilla can overflow +its volume-size arithmetic or partially write before an array exception; those +invalid-buffer behaviors are outside this bounded API. + +The normal-noise builder limits allocation to 4,096 octaves; the legacy +initializer also limits reverse construction to 4,096 octave steps. Requests +beyond these limits fail before RNG draws. Vanilla's serialized definition +codec limits octave count to 32. Rust's builder owns a snapshot of parameters; +Java object identity, mutable builder-list aliases, equality/hash methods and +the complete Java API surface are not reproduced. + +The direct normal-noise JSON codec is now implemented and checked against every +bundled noise definition in the [world-generation codec suite](world-generation.md). +The density registry loader is also compared against all bundled definitions. +Remaining noise initializers, complete terrain-router integration, +aquifers, surface rules, biome/feature/structure placement and complete chunk +generation still require implementation and integration evidence. Gaussian +sampling remains absent from the RNG API pending exact logarithm behavior. +No generated-world or full gameplay parity claim follows from this suite. diff --git a/docs/optimization-plan.md b/docs/optimization-plan.md index ff85fc316..eb860fa4e 100644 --- a/docs/optimization-plan.md +++ b/docs/optimization-plan.md @@ -8,6 +8,13 @@ Inspect both pinned game JARs locally, retain bytecode as the reference, and mea Whole-game translation is a long-term research objective. Decompiled Java is an inspection artifact, not the original source tree: build configuration, comments, tooling history, and some source-level constructs cannot be recovered faithfully. A mechanically translated Rust game would also have to preserve behavior, data formats, networking and rendering. An isolated hot-path replacement is a useful first experiment. +The Rust rewrite now has an original `horizon-core` foundation and a bytecode +differential runner for selected position, random-stream and packed-storage +operations. [Rust parity status](rust-parity.md) distinguishes that tested slice +from the unimplemented gameplay and renderer. This establishes compatibility +testing infrastructure; it does not select an FPS bottleneck or supply a playable +Rust client. + ## Local code map These entry points were verified present in the decompiled 26.3 client. Paths below are relative to `.local/minecraft/26.3/sources/client/net/minecraft/`; shared/server logic can also be inspected in the dedicated-server tree. diff --git a/docs/playable-validation.md b/docs/playable-validation.md index 159bcaace..9b881c3ec 100644 --- a/docs/playable-validation.md +++ b/docs/playable-validation.md @@ -5,7 +5,7 @@ Version 0.2.0 targets Minecraft 26.3 / Fabric 0.19.5 / Java 25. This is an initi ## Local checks - Official client runs through a Wayland virtual screen in built-in limited demo mode, without Microsoft credentials. Normal Mac play uses licensed Prism sign-in. -- Balanced stack (Sodium, Lithium, FerriteCore, ImmediatelyFast, EntityCulling, Distant Horizons, Fabric API, Horizon Lab) reaches the menu, loads the demo world, logs in locally, renders terrain, and saves/quits. +- Balanced stack (Sodium, Lithium, FerriteCore, ImmediatelyFast, EntityCulling, Distant Horizons, Fabric API, Horizon) reaches the menu, loads the demo world, logs in locally, renders terrain, and saves/quits. - DH generates and accepts the current configuration schema: 128-chunk LOD radius, two background threads at 0.5 run-time ratio, priority 3. No old-version guessed config keys. - A missing desktop AWT component in the local headless JRE initially caused a DH cloud-texture error. Installing the complete Java 25 runtime resolved it; this was an environment issue, not a packaged mod change. - Native libraries are chosen by OS and architecture, including ARM64 selection when the official manifest has OS-only rules. Builds use portable `/` ZIP paths on Windows too. @@ -167,4 +167,4 @@ terrain generation and steady-state rendering are separate workloads. ## Release content -Packs embed only the original MIT Horizon Lab JAR and config. Mod/game/library downloads retain upstream licenses and are checked against pinned hashes. No game JAR, class, decompiled source, asset, world or credential is committed or uploaded in a starter. The narrow publication allowance is for original Java under `dev/horizonlab`, and the built JAR checks its emitted class namespace. +Packs embed only the original MIT Horizon JAR and config. Mod/game/library downloads retain upstream licenses and are checked against pinned hashes. No game JAR, class, decompiled source, asset, world or credential is committed or uploaded in a starter. The narrow publication allowance is for original Java under `dev/horizonlab`, and the built JAR checks its emitted class namespace. diff --git a/docs/process-memory.md b/docs/process-memory.md index 64ff7aab3..1f4e7186a 100644 --- a/docs/process-memory.md +++ b/docs/process-memory.md @@ -1,6 +1,6 @@ # Measuring resident process memory -Horizon Lab 0.6.0 records process RSS alongside JVM heap and nonheap pools. RSS +Horizon 0.6.0 records process RSS alongside JVM heap and nonheap pools. RSS counts resident pages belonging to the Minecraft process, including native allocations and mapped pages. It helps detect cases where reducing heap use merely moves memory elsewhere. It is not unique physical-memory ownership or diff --git a/docs/rust-parity.md b/docs/rust-parity.md new file mode 100644 index 000000000..6ee0a0378 --- /dev/null +++ b/docs/rust-parity.md @@ -0,0 +1,381 @@ +# Horizon Rust rewrite status + +The behavior target is the repository's pinned **Minecraft Java Edition 26.3**. +One-to-one vanilla gameplay parity is the acceptance criterion. It has **not** +been reached: Horizon's Rust code does not yet run a client, server, or simulation. +It can read and export region files and access saved and resident block sections. +Scheduled block/fluid queues can now collect and dispatch callbacks with +vanilla-checked ordering; the actual block/fluid behavior is still absent. +Double-precision geometry and voxel-grid queries are implemented, with a registry +adapter for vanilla's no-context cached collision branch. +Base noise samplers, octave stacks, normal-noise definitions and bulk density +sampling are implemented. Compiled density samplers now evaluate constants, gradients, +shifted noise, all eleven unary operators, rounding and selected arithmetic operations. An initial density graph compiler +integrates range analysis, specialization, uniform-axis slicing, shared caches, +nested splines and seeded noise; +complete graph coverage, serialized graphs and generated terrain remain absent. +The playable Java performance packs remain available during development. + +## Implemented foundation + +`crates/horizon-core` is a dependency-free Rust library with no unsafe code. +It uses small integer position values, exclusively owned RNG state, and packed +64-bit storage. These choices avoid Java object overhead in this slice; no +whole-game memory, FPS, or render-distance gain has been measured. + +| Area | Implemented and checked operations | Remaining scope | +| --- | --- | --- | +| Positions | Block, section, and chunk packing/unpacking; wrapping block offsets; block-to-section/chunk conversion; section-relative packet positions; block-state storage indices; region coordinates/local indices; bounded inclusive/directional block-box iteration | Remaining iterators, world bounds and entity/world integration | +| Simulation geometry | Selected Vec3 operations, quantized trig/rotations, normalized AABB bounds and transforms, finite block traversal/swept visitation, ray faces, immutable cube/array voxel grids, greedy boxes, collision distances, column heights, closest points, lazy floor height, box quantization and Boolean/optimized joins; movement resolution over supplied shapes, step candidates and step-up decisions/query bounds | Shape rotations/faces/edges, entity-context shape selection, full entity movement and side effects | +| Legacy random stream | Seeding/reseeding; int, bounded/inclusive/exclusive int, long, boolean, float, double; triangular float/double draws; fork; consume count; positional factories and Java UTF-16 string hashes | Gaussian sampling, threading-error behavior and remaining world-generation call sites | +| Xoroshiro random stream | 64-bit seed expansion; explicit 128-bit state including all-zero fallback; the same selected random operations as above; positional factories and MD5-derived seeds with Java UTF-8 surrogate handling | Gaussian sampling, serialization and remaining world-generation call sites | +| Noise generation | 26.3 Perlin/simplex/smeared Perlin; permutation construction and coordinate wrap; Perlin derivatives; cached/scalar density-volume accumulation; nested/flattened stacks; normal-noise octave weights and normalization; modern and legacy Nether seeding | Serialized noise definitions, density graphs, complete chunk generation, biome/feature/structure integration | +| Density evaluation | Compiled constants, clamped/repeating/mirrored gradients, unshifted and XZ/XYZ shifted noise; offset-noise variants, old blended noise, outer End islands and distance-to-point; all eleven unary operators, six binary operators, powers, rounding, constant-operand specializations, min/max, clamp, range choice, interval selection and linear interpolation; separate scalar/bulk paths, nested scratch buffers, context-bound blend alpha/offset/structure samplers, absent/empty blend-density wrappers, context-owned scalar/volume caches, coordinate slices, coarse-grid interpolation, surface searches and nested cubic splines | Codecs, structure-density producers, nonempty old-world blending and terrain integration | +| Density graph compilation | Immutable definitions for constants, gradients, arithmetic/selection operations, powers, rounding, distance-to-point, slices, caches, interpolation, surface search, nested splines, outer End islands and normal/offset/blended noise; context fields, blend-density wrappers, direct/named reference holders; range/axis metadata, constant and disjoint-range specialization, uniform-axis rewriting, cache-ID allocation/deduplication, memoized roots, spline coordinate sharing/validation, world-seed lookup and failure state | Codecs, concrete world-field producers and complete terrain integration | +| Density range analysis | Checked interval constructors, hulls, arithmetic/min/max, reciprocal, abs/square/sign, powers/logarithms, clamp, monotonic endpoint mapping, finite/infinite interpolation, predicates, equality and Java hashes; conservative spline range propagation; integration with supported graph definitions | Propagation through remaining graph definitions | +| Packed palette-index storage | Widths 1–32; allocation; imported raw words; reads; writes returning old values; unpack; fill; padding/tail preservation; invalid-write rejection | Remaining network container integration | +| World data | Named/network NBT, modified UTF-8, mixed lists; gzip/zlib/uncompressed/lz4-java codecs; region exports including external chunks; block/biome saved palettes | Complete save lifecycle, data fixing, concurrent saves and recovery | +| Resident block sections | Pinned block-state registry import, defaults, numeric IDs, uniform sections, packed palette growth, freed-slot reuse and compaction; cached collision shape lookup bound to the same registry | Block behavior, entity-context collision shapes, light and full chunk-lifecycle integration | +| Heightmaps | Six type predicates and flags, packed heights, updates/removal rescans, shared priming, raw imports and length-mismatch fallback; all pinned states and mutation fixtures compared | Block air/fluid behavior and chunk-lifecycle integration | +| Scheduled ticks | Chunk queues, level collection/drain ordering, duplicate suppression, seven priorities, saved delays, chunk eligibility, callback mutations, area removal/copying, saved block/fluid NBT | Actual block/fluid callbacks, neighbor updates, tick-time and chunk-lifecycle integration | + +Packet-relative positions use X/Z/Y ordering; block-state storage indices use +Y/Z/X ordering. Negative coordinate conversion must floor rather than truncate. +The legacy RNG must retain Java's signed-int arithmetic and rejection rules; +the xoroshiro RNG has a different bounded-int algorithm and bit selection. +Positional factories preserve signed coordinate hashing and each stream's distinct +seed derivation. The hash API accepts UTF-16 units so malformed surrogate sequences +retain Java's replacement behavior. Gaussian sampling is still absent: a private +probe found bit differences between Java `Math.log` and the platform logarithm, +which must be resolved before its values and cached-draw behavior can be claimed. +Storage entries never cross a word boundary. Vanilla's fill operation also +writes padding and unused tail bits; imported words retain their original bits +when a slot is changed. These details are covered by the differential corpus. + +Rust APIs return typed errors instead of Java exceptions. Storage lengths and +indices use `usize`; raw decoded values use `u32` bit patterns. Writes reject +values above the nonnegative Java-int domain, including at width 32. Test output +casts raw imported width-32 reads back to signed Java ints for comparison. +Negative lengths and the complete Java object/API surface are not supported. + +## Reproduce validation + +Requires Rust 1.85 or newer, Python 3.10 or newer, and JDK 25. From the checkout: + +```sh +cargo test --workspace +cargo clippy --workspace --all-targets -- -D warnings +python3 tools/test_rust_parity.py --prepare +python3 tools/test_world_parity.py +python3 tools/test_tick_parity.py +python3 tools/test_geometry_parity.py +python3 tools/test_collision_parity.py +python3 tools/test_noise_parity.py +python3 tools/test_density_parity.py +python3 tools/test_worldgen_parity.py +python3 tools/test_heightmap_parity.py +python3 tools/test_terrain_parity.py +python3 tools/test_structure_density_parity.py +python3 tools/test_material_surface_parity.py +python3 tools/test_material_condition_parity.py +python3 tools/test_material_stage_parity.py +python3 tools/test_biome_zoom_parity.py +python3 tools/test_biome_chunk_parity.py +python3 tools/test_biome_generation_parity.py +python3 tools/test_biome_source_parity.py +python3 tools/test_anchor_parity.py +python3 tools/test_biome_temperature_parity.py +python3 tools/test_float_log_parity.py +``` + +`--prepare` regenerates the local reference artifacts from the existing lock; +omit it after preparation to run without downloads. The runner verifies the +official manifest and both game downloads, the server's inner game JAR, and each +server dependency against pinned/bundled hashes. The original Java test adapter +calls vanilla classes directly; it does not substitute a Java reimplementation +of the Rust algorithms. The same corpus runs against client and server code. +The fixtures need no display, account, assets, or world generation. + +The deterministic corpus contains coordinate extremes, all 4,096 local section +positions, 8,192 random coordinate/offset queries, boundary and random signed +seeds, mixed RNG operations, fork/reseed/consume checks, invalid bounds, and +all 32 storage widths at boundary and 4,096-entry sizes. It also imports words +containing all set bits and compares the raw padding and fill results. The +current run produces **1,634,520 matching output lines per reference JAR**. +It includes 4,400 positional-factory commands and 5,000 random-helper commands, +with overflowing integer intervals, hash padding boundaries and malformed UTF-16. +This count includes repeated checks and raw entries; it is not a count of +distinct vanilla behaviors or a percentage of game coverage. + +Artifacts remain gitignored under `.local/rust-parity/`: corpus, Rust output, +client/server output, compiled oracle, and `report.json`. The report records +source/input/output hashes, reference identities, tool versions, and matched +line counts. A prior success report is removed before a new run can fail. +CI runs the same comparison in addition to offline Rust and Python checks. +The checked-in [scoped validation report](../benchmarks/rust-core-2026-10-05/scoped-parity.json) +contains only metadata and digests from the local run, not game code or artifacts. + +The additional [world-data suite](world-data.md) checks NBT and region +interoperability, saved palettes, all 35,723 registered block-state IDs, and +resident sections after repeated mutation. The corresponding +[scoped report](../benchmarks/rust-world-2026-10-05/scoped-parity.json) +records client/server reference hashes and the tested source hashes. + +The [scheduled-tick suite](scheduled-ticks.md) adds 25,815 commands including +2,096 tick invocations, producing 97,776 matching output lines per reference. +It also verifies block/fluid tick save codecs and a persisted region chunk. +The [geometry and cached-collision suites](collision-geometry.md) check numerical +boundaries and runtime block-state shape data, with separate +[geometry](../benchmarks/rust-geometry-2026-10-05/scoped-parity.json) and +[cached-collision](../benchmarks/rust-collision-2026-10-05/scoped-parity.json) +metadata reports. All differential runners reject changed source hashes during a run before publishing +a success report. Historic reports describe their own recorded source versions. + +The [noise suite](noise-generation.md) checks base sampling, derivative and bulk +arithmetic, nested/flattened stacks, normal-noise normalization and both modern +and legacy Nether initialization. Its [scoped report](../benchmarks/rust-noise-2026-10-05/scoped-parity.json) +records the tested sources and both reference artifacts. + +The [density suite](density-functions.md) checks compiled scalar and bulk samplers, +including gradients, nested shifted noise, arithmetic, caching, axis slicing and +coarse-grid interpolation, surface searches and nested splines with range analysis; +it also compares the initial graph compiler with vanilla's compiler. Its +[scoped report](../benchmarks/rust-density-2026-10-05/scoped-parity.json) records +**15,524,627 matching output lines per reference JAR**. That suite constructs graphs through its transport. Serialized registry +comparisons are covered separately below; generated terrain remains pending. + +The [float-log report](../benchmarks/rust-float-log-2026-10-05/scoped-parity.json) +records exhaustive compiled scalar comparisons for all **4,294,967,296 float bit +patterns** against both JARs on the local Linux/JDK runtime, with canonical NaN +results. Double-precision logarithms and other-platform math remain separate +validation work. + +The [world-generation codec suite](world-generation.md) checks every bundled +normal-noise JSON definition and all 55 bundled density definitions against +vanilla's actual registry-aware codecs. It compares decoded octave metadata, +graph ranges and axes, raw and optimized compilation, cache allocation and +seeded scalar and strided bulk sampling. Its +[scoped report](../benchmarks/rust-worldgen-2026-10-06/scoped-parity.json) records +**961,693 matching output lines per reference JAR**. All seven bundled eight-field +routers and their climate samplers are also +compared, including quart-coordinate wrapping and float/long quantization. +Climate search-tree construction and warm/fresh ties are checked across the +bounded API. Scalar and prepared-volume multi-noise biome resolvers are implemented +using private imported built-in parameter tables and compared against vanilla +scalar and bulk biome resolvers. Climate parameter codecs, vertical terrain bounds and the global fluid picker/ +disabled-aquifer path are also compared. Noise-based aquifer configuration and +fluid-pressure selection are implemented, with differential checks for seeded +decisions, sampling order, caches and failure recovery. Tag codecs, stacked resource +replacement and bounded dependency resolution are compared across all 300 bundled +block tags and synthetic missing-reference/cycle fixtures. Complete terrain +integration remains pending. + +The [heightmap suite](heightmaps.md) records **1,671,668 matching output lines per +reference JAR** across all 35,723 block states and 100 chunk fixtures. Rust resolves +tag membership; block air/fluid facts are private, independently verified imports. +Actual vanilla heightmaps compare predicates, mutations, packed words, priming and +selected ordered block reads. Chunk-lifecycle integration remains pending. + +The [noise-fill suite](terrain-filling.md) now compares **7,950,873 output lines per +reference JAR** across 114 fixtures and 200 fills. Final density, aquifers, resident +sections, world-generation heightmaps and fluid postprocessing are integrated for +this stage. The surface stage has a separate comparison; biome, feature and +structure stages remain pending. + +The [structure-density sampler](structure-density.md) matches **1,360,095 output +lines per reference JAR**, including ordered rigid-piece/junction contributions +and scalar/bulk clipping. Live structure discovery and placement remain pending. + +The [vertical-anchor suite](vertical-anchors.md) matches **181,632 output lines per +reference JAR**, including four anchor codecs, runtime overflow, nested exclusive +fields and generation bounds. + +The [material-surface primitives](material-surfaces.md) match **122,988 output +lines per reference JAR** for seeded terracotta bands, band lookup and surface +noise queries. Subsequent suites cover rule evaluation and surface application. + +The [numeric material-condition suite](material-conditions.md) matches **5,627,426 +output lines per reference JAR** for eleven condition forms and their column/block +cache transitions, including codecs, all eight bundled condition definitions and +block/sequence/conditional/terracotta-band rule composition. +The chunk surface comparison below integrates these rules. + +The [biome-temperature suite](biome-temperatures.md) matches **836,659 output lines +per reference JAR** for temperature modifiers, precipitation decisions and ordered +cache behavior, including thread isolation and climate fields from all 67 bundled +biome definitions. Full weather placement remains pending. + +The [surface-extension suite](material-surfaces.md#biome-specific-column-extensions) +matches **233,100 output lines per reference JAR** for badlands pillars and +frozen-ocean icebergs, including ordered column reads/writes and both random modes. + +The [bundled material-rule suite](material-rule-libraries.md) matches **678,174 +output lines per reference JAR**, including 665,712 rule applications across all +42 bundled definitions and the pinned biome, noise and density registries. +The [chunk surface stage](material-surfaces.md#chunk-surface-stage) matches +**6,733,382 output lines per reference JAR** across 79 fixtures, 42 terrain fills +and 106 surface builds, followed by 158 carving-mask passes, including 21,757,952 block values, heightmaps, fluid +postprocessing and ordered biome queries. It tests all seven bundled terrain +settings through both stages with shared density contexts and vanilla fuzzy +biome lookup against 378 generated neighbor biome chunks (400,896 stored cells). +Preset builders and complete generated worlds remain pending. + +The [biome-lookup suite](biome-lookup.md) matches **256,933 output lines per +reference JAR** for seed obfuscation, eight-corner fuzzy selection, direct quart +queries and source replacement. Seed hashes also match an independent SHA-256 +implementation. [Chunk biome storage](biome-lookup.md#chunk-biome-storage) matches +**478,340 lines per JAR** across 160 fills, including section-atomic failure +behavior and clamped reads. [Chunk biome generation](biome-lookup.md#chunk-biome-generation) +matches **383,072 lines per JAR** across 322 fills, including both imported +multi-noise presets and fixed/checkerboard/End sources through all seven terrain +routers. Preset builders and complete world generation remain pending. + +The [fixed/checkerboard/End source suite](biome-lookup.md#fixed-checkerboard-and-end-sources) +matches **1,306,096 lines per JAR**, including 1,147,984 biome queries and ordered +End erosion sampling. [Registry-bound source codecs](biome-lookup.md#registry-bound-source-codecs) +match **363,121 lines per JAR** across 40,481 inputs, including canonical encoding, +possible-biome sets and resolved queries. Chunk generation and surface integration +share the resolved-source API. Inline biome definitions and complete registry +lifecycle behavior remain pending. + +The [carving-mask suite](carving.md) matches **45,742 lines per JAR** across +28 fixtures, including packed column ranges, coordinate wrapping and mutations +retained after failing traversal callbacks. Mask application is included in the +surface-stage suite. [Shared carving geometry](carving.md#shared-shape-primitives) +matches **106,699 lines per JAR**, including 690 ellipsoids and 5,536 reachability +queries. [Seeded cave/canyon paths](carving.md#seeded-cave-and-canyon-paths) match +**882,005** and **1,094,517 lines per JAR**, respectively. The combined stage suite +also covers 42 procedural carving passes, including neighboring biome selection +and ordinal carver seeds. Full-world integration remains pending. + +The [feature-placement primitives](feature-placement.md) match **1,268,600 lines per +JAR** across seventeen modifier kinds, including callback failures and shared random +state. [Modifier-chain execution](feature-placement.md#modifier-chains) matches +**548,461 lines per JAR**, including feature callback failures and reused pending +buffers. [Initial block-writing features](feature-placement.md#initial-block-writing-features) +match **1,820,614 lines per JAR** for the void platform, End islands and End arrival +platform. Remaining feature algorithms and complete world integration remain pending. + +The [scalar value-provider suite](value-providers.md) matches **429,920 lines per +JAR** across 504 definitions and 5,040 seeded fixtures, including exact random +stream consumption. [Anchored height providers](value-providers.md#anchored-height-providers) +match **507,660 lines per JAR**, including all four anchors and overflowing contexts. +Weighted lists include zero weights, nested choices and maximum totals. Gaussian +distributions and provider encoding remain pending. + +The [block-state JSON codec suite](block-state-codecs.md) matches **221,261 output +lines per reference JAR**, covering every registered state and compact/full +encoding plus malformed-property fallback. Block gameplay remains pending. + +## Work required for a playable rewrite + +| Subsystem | Current Rust status | Required parity evidence | +| --- | --- | --- | +| Registries, block states, items and data components | Block-state IDs, property descriptors and defaults imported and checked; items/components absent | Registry lifecycle, remaining registries, data components and behavior | +| World/chunk storage, NBT and region files | Bounded NBT, four codecs, region export, saved and resident section palettes | Generated-save integration, entity/POI integration, upgrades, live saves and crash recovery | +| Terrain, biomes, structures and lighting | Seeded noise/density graphs, bundled registry and router loading, climate sampling/search and imported-table multi-noise biome resolution, aquifer decisions, noise-stage filling and surface-stage application implemented; complete terrain generation absent | Remaining terrain/biome codecs and world fields, seeded generated-chunk comparisons, biome/feature/structure placement, chunk lifecycle and light propagation | +| Tick scheduling, blocks, fluids and redstone | Scheduled queues, eligibility, callback mutations and saved tick data implemented; block/fluid/redstone behavior absent | Actual block/fluid state transitions, neighbor updates, world integration and end-to-end ordered traces | +| Entities, AI, movement and combat | Bounding-box and voxel collision geometry implemented; live entities absent | Context-dependent collision/physics and tick traces, spawning, pathfinding, damage, equipment and lifecycle | +| Survival, inventory, crafting and progression | Not implemented | Recipes, item transitions, hunger/health, effects, experience and advancement behavior | +| Dimensions, portals, weather and game rules | Not implemented | Cross-dimension state, transitions, time/weather and rule-dependent behavior | +| Multiplayer, protocol, authentication and commands | Not implemented | Packet/codec fixtures, vanilla interoperability, reconnects and command behavior | +| Rendering, resources, sound, UI and input | Not implemented | Resource compatibility, render/culling correctness, controls and playable interaction tests | +| Performance and platform support | Not measured for a Rust game | Repeated matched gameplay workloads, frame/tick distributions, memory and physical GPU tests | + +The next simulation milestone is integrating the checked scheduler and +registry-backed sections with actual block behavior and neighbor updates. World +generation now has noise-stage filling, aquifers and surface-stage application; +biome assignment and remaining generation stages need work, +followed by complete seeded-world comparisons. A renderer needs +actual block models, neighboring sections and light data. Simplified geometry +alone cannot establish vanilla behavior. Performance tuning must preserve the +validated simulation and use measured workloads; changing render distance, +simulation distance or terrain detail invalidates an equal-workload speed claim. + +No finite corpus proves every vanilla behavior. Future milestones need broader +version-specific differential suites and playable integration checks. The +project will report implemented/validated scope rather than label a partial +port as 100% parity. + +The [pre-light chunk-stage comparison](terrain-filling.md#block-writes-across-generation-stages) +adds **8,090,090 matching lines per JAR** for stage-dependent block mutation and +heightmap selection, including insertion/removal of every pinned state. This does +not establish the complete chunk lifecycle or region integration. + +The [resident feature-region comparison](feature-placement.md#resident-feature-regions) +adds **28,922,634 matching lines per JAR** for basic features, configured fill layers, replacements and scattered ore sharing +modifier chains and resident neighboring chunks, including live heightmap updates. +World-region side effects and complete feature generation remain pending. + +The [inline feature-graph comparison](feature-placement.md#inline-feature-composition) +adds **737,779 matching lines per JAR** for nested sequences and random selectors, +including short-circuit results, shared randomness and partial mutations. + +The [named feature-resource comparison](feature-placement.md#named-feature-resources) +adds **1,734,390 matching lines per JAR** for registry-aware feature/placed-feature +holders, ordered tags and subsequent nested execution. Complete registry loading, +reloads and remaining feature algorithms are still pending. + +The [configured fill-layer comparison](feature-placement.md#configured-fill-layers) +adds **1,305,274 matching lines per JAR** for block-state binding and ordered +column placement, including decoding every pinned block state. Complete feature +generation and gameplay remain pending. + +The [replacement-rule comparison](feature-placement.md#replacement-rules) adds +**1,890,716 matching lines per JAR** for all ten native predicate kinds, bound +state/tag identities and ordered random evaluation. Complete ore and structure +generation remain pending. + +The [single-block replacement comparison](feature-placement.md#single-block-replacement) +adds **303,678 matching lines per JAR** for ordered rule-driven block mutations, +rejected writes, failures and subsequent random state. + +The [scattered-ore comparison](feature-placement.md#scattered-ore) adds +**758,484 matching lines per JAR** for attempt offsets, ordered air-exposure checks, +rule evaluation and block mutations. Ordinary ore veins and complete biome +decoration remain pending. + +The [bulk-section comparison](feature-placement.md#bulk-section-access) adds +**959,640 matching lines per JAR** for cached raw section access, every block state, +all-air reads and unchanged heightmaps. This supplies storage behavior needed by +ordinary ore generation; vein geometry and concurrent ownership remain pending. + +The [biome feature-order comparison](feature-placement.md#biome-feature-ordering) +adds **411,751 matching lines per JAR** for identity-based ordering, cycles and +step index mappings, including every bundled biome's feature lists. This does +not yet execute complete chunk decoration. + +The [world-generation random-adapter comparison](feature-placement.md#world-generation-random-streams) +adds **238,800 matching lines per JAR** for native bit sampling, counters, forks, +nested wrappers and decoration/feature seeding. Gaussian sampling and complete +chunk decoration remain pending. + +The [biome-placement comparison](feature-placement.md#biome-placement-filtering) +adds **121,423 matching lines per JAR** for top-feature contexts, native generation +settings membership, query order, nested ordinary placers and partial failures. +Complete biome sampling integration and chunk decoration remain pending. + +The [decoration scheduler comparison](feature-placement.md#decoration-feature-scheduling) +adds **337,398 matching lines per JAR** through the native chunk-decoration entry +point, with structures disabled and traced feature sinks. It covers resident +biome selection, global ordering, per-feature seeds and failure/progress state; +complete feature algorithms and chunk lifecycle remain pending. + +The [resident decoration comparison](feature-placement.md#decoration-over-resident-chunks) +adds **36,173,951 matching lines per JAR** for native chunk decoration combining +biome storage/zoom, generation-stage guards, scheduling, implemented feature +graphs, block writes and live heightmaps. It compares complete final resident +sections; structures, lighting and the full generation lifecycle remain pending. + +The [block-state provider comparison](feature-placement.md#block-state-providers) +adds **105,340,143 matching lines per JAR** for ten state-provider kinds, including +all eight bundled provider definitions. It includes every state under six +directions, property transforms, nested draw order and empty selections. Rule-based +selection includes twelve predicate kinds, ordered conditions, empty results and +query failures. Named holder references are resolved through immutable resource +snapshots. Additional predicates, complete registry loading and complete feature placement remain pending. + +The [contained-fluid comparison](world-data.md#contained-fluid-states) adds +**239,190 matching lines per JAR** for fluid-state mapping, liquid-block conversion +and surface/camera height queries. It covers every pinned block state and query +failures; fluid spreading, entity interactions and rendering remain pending. diff --git a/docs/scheduled-ticks.md b/docs/scheduled-ticks.md new file mode 100644 index 000000000..e6faca658 --- /dev/null +++ b/docs/scheduled-ticks.md @@ -0,0 +1,136 @@ +# Horizon scheduled ticks + +The Rust scheduler targets the repository-pinned **Minecraft Java Edition +26.3**. It implements scheduled block/fluid queue mechanics and saved tick +lists. Actual block/fluid updates, random ticks, block events, neighbor updates, +redstone behavior and a running game world remain unimplemented. + +## Behavior + +`horizon_core::ticks` supplies `TickPriority`, `ScheduledTick`, `SavedTick`, +`ChunkTicks` and `LevelTicks`. A numeric `TickTypeId` represents a registry-owned +block or fluid type. Block and fluid scheduling use separate `LevelTicks` +instances. Callers supply identities, game time, sub-tick counters, eligibility, +per-call tick limits and behavior callbacks. + +The first request for a type and position wins, even if a duplicate has an +earlier trigger time or a higher priority. A chunk queue orders by signed +trigger time, then one of seven priorities, then signed sub-tick order. Once +heads are due, **different chunks compete by priority and sub-tick order**. +Consequently, globally sorting every tick by trigger time changes execution. +Within the selected chunk, draining stops when its next head loses to the +competing chunk head, exceeds the time bound, or exhausts the tick limit. + +Equal comparator keys follow the pinned Java array heap behavior. Deadline +traversal follows the pinned fastutil long-map layout, including resizing, +collision shifts and wrapped iterator removals. These details matter when +loaded ticks in different chunks share priority and negative sub-tick order. +They are covered by differential tests rather than replaced with a new tie +breaker. The heap stores tick records inline and retains collection capacity +between frames. Area operations probe small chunk grids directly and visit +only loaded chunks for large sparse areas, preserving X/Z traversal order. +No game FPS or memory gain has been measured. + +Collection happens before callbacks. A callback can schedule, query, clear, +copy, disable or unload chunks; newly scheduled ticks wait for the next +collection. `has_scheduled` covers container queues and pending saved ticks; +`will_tick_this_tick` covers the remaining collected queue. The current callback +has already moved to the already-run list. Vanilla's lazily built membership +set can remain stale after an area clear; that behavior is preserved until +cleanup. Area copying includes already-run, collected and queued ticks and +places copied sub-tick orders after the copied source range with wrapping +signed-long arithmetic. + +Disabled chunks retain due entries. Removing a container returns its queue +for saving or later reinsertion; collected callbacks still run. Scheduling into +an absent chunk returns `MissingChunk` and does not enqueue. The Rust API adds +invariant checks for duplicate chunk insertion, wrong-chunk contents and invalid +collection phase transitions. These checks differ from Java's unchecked API +and logging, while preserving the tested valid lifecycle. + +## Persistence and use + +Saved ticks hold a signed 32-bit relative delay. Packing narrows the wrapped +time difference as Java does and stably sorts active ticks by sub-tick order. +Pending saved entries precede active entries. Unpacking assigns orders from +`-saved_count` through `-1` and adds delays with signed-long wrapping. Vanilla +does not deduplicate a saved list during unpack; duplicate entries and their +membership behavior are retained. + +`horizon_world::tick_data` bridges the vanilla `i`, `x`, `y`, `z`, `t`, `p` +fields to type IDs through caller-supplied names. `ChunkData::saved_ticks` +loads a pending container and filters out positions belonging to other chunks; +`set_saved_ticks` writes packed entries while preserving unrelated root data. +The separate block/fluid name lookup is required because their IDs are not +the resident section's block-state IDs. + +```rust +use horizon_core::{position::ChunkPos, ticks::{LevelTicks, ScheduledTick}}; +use horizon_world::{chunk::ChunkData, tick_data::TickKind}; + +fn run_saved_blocks( + chunk: &mut ChunkData, + now: i64, + resolve: impl FnMut(&str) -> Option, + name: impl FnMut(horizon_core::ticks::TickTypeId) -> Option, + run: impl FnMut(&mut LevelTicks, ScheduledTick), +) -> Result<(), Box> { + let pos: ChunkPos = chunk.position(); + let mut pending = chunk.saved_ticks(TickKind::Block, resolve)?; + pending.unpack(now); + let mut level = LevelTicks::default(); + level.add_chunk(pos, pending)?; + level.tick(now, 65_536, |_| true, run)?; + let pending = level.remove_chunk(pos).unwrap(); + chunk.set_saved_ticks(TickKind::Block, &pending.pack(now), name)?; + Ok(()) +} +``` + +The caller supplies the behavior callback. A game integration must check the +current block/fluid type, invoke its actual behavior, +apply resulting state/neighbor/light changes, and persist remaining queues +through the chunk lifecycle. The scheduler alone does not provide gameplay. + +## Validation + +```sh +cargo test --workspace +cargo clippy --workspace --all-targets -- -D warnings +python3 tools/test_tick_parity.py --prepare +``` + +The runner authenticates both official reference JARs and dependencies against +the repository lock and bundled hashes. An original Java adapter invokes the +actual `LevelTicks`, `LevelChunkTicks`, `ScheduledTick`, `SavedTick` and +`TickPriority` classes; expected traces are not computed by another port. + +The corpus has **25,815 commands**, including **2,096 tick invocations**, and +produces **97,776 matching output lines per reference JAR**. It covers: + +- All priorities, overdue chunk competition, exact comparator ties, duplicate + requests and signed time/order extremes. +- Map growth/shrink, collisions crossing the table boundary, limited draining, + disabled chunks, unloading and restoration. +- Pending-list duplicates, save packing, negative load orders and repeated + save/reload with changed game time. +- Membership queries and rescheduling, clearing, copying, unloading or + disabling chunks during callbacks. +- Eight deterministic randomized scenarios with queue snapshots, saves, + eligibility changes and area operations. + +A separate adapter uses the actual block and fluid `SavedTick` registry codecs. +Rust loads, filters, unpacks, polls, reschedules and saves **251 block ticks and +251 fluid ticks**. Vanilla checks the resulting NBT and a Rust-written region +chunk. Fixtures include duplicate saved entries, out-of-chunk coordinates, +negative delays, overflowing times and numeric NBT coercions including NaNs, +infinities and narrowed longs. + +Offline tests cover phase guards, eligibility, callback deferral, ordering, +area membership, copying, invalid data and atomic saved-list updates. CI runs +this suite alongside core and world-data comparisons. Evidence stays under +`.local/rust-tick-parity/`; success reports are cleared before each run and +source hashes must remain unchanged during validation. The checked-in +[scoped report](../benchmarks/rust-ticks-2026-10-05/scoped-parity.json) contains +metadata and hashes only. Line counts are corpus observations, not gameplay +coverage percentages or proof of complete vanilla parity. diff --git a/docs/shader-world-smoke.md b/docs/shader-world-smoke.md index 6a8464212..c0277408e 100644 --- a/docs/shader-world-smoke.md +++ b/docs/shader-world-smoke.md @@ -54,7 +54,7 @@ snapshot. Waiting state contains only six booleans and a tick count; arbitrary screen names, messages and paths are excluded. An unsuccessful research run remains unsuccessful. Playable shader/backend defaults remain unchanged. -Diagnostic repeat [37199837867](https://github.com/ludovic111/minecraft-optimization-lab/actions/runs/37199837867) +Diagnostic repeat [37199837867](https://github.com/ludovic111/Horizon/actions/runs/37199837867) uses the richer diagnostics. Both cases again hit the 240-second timeout and require bounded termination. OpenGL initializes its device and loads a world with a player, no overlay, an active window and no pause; a screen remains diff --git a/docs/structure-density.md b/docs/structure-density.md new file mode 100644 index 000000000..448d462c9 --- /dev/null +++ b/docs/structure-density.md @@ -0,0 +1,43 @@ +# Structure terrain-adaptation density + +`horizon_core::density::Beardifier` implements the pinned Java Edition **26.3** +structure-density sampler from supplied ordered rigid pieces, jigsaw junctions +and an affected bounding box. It supports `NONE`, `BURY`, `BEARD_THIN`, `BEARD_BOX` +and `ENCAPSULATE` adjustments. Live structure discovery, filtering and placement +remain separate work. + +The sampler retains float accumulation order, wrapped coordinate arithmetic, +ground-level deltas, the 24-by-24-by-24 kernel and vanilla's inverse-square-root +approximation. Its kernel is computed once from the formula. No extracted vanilla +kernel data is stored in the source tree. The immutable sampler can be attached +to `WorldField::Beardifier` and shared between worker contexts. + +Scalar reads return zero outside the affected box. Bulk reads clear the entire +output, including an oversized tail, then scan the clipped strided volume. +Vanilla floors the lower clipping index rather than rounding it upward, so a +first bulk sample can be outside the scalar bounds. Horizon preserves this +scalar/bulk distinction. A missing affected box produces zero even if component +lists are nonempty. Bounds supplied to the Rust constructor must already be +normalized; short output buffers return a typed error before mutation. + +Run: + +```sh +python3 tools/test_structure_density_parity.py +``` + +The [local report](../benchmarks/rust-structure-density-2026-10-06/scoped-parity.json) +records **1,360,095 matching output lines per reference JAR** across **183 fixtures**, +**28,093 scalar queries** and **339 volumes**. The original Java adapter calls the +actual `Beardifier` constructor and samplers. Cases include every adjustment mode, +the full junction kernel neighborhood, ground offsets, overlapping components, +reversed accumulation order, null/empty bounds, floor clipping, output tails and +extreme wrapped coordinates. Float outputs are compared by raw bits with +canonical NaNs. + +The report records the authenticated JARs, source and fixture hashes. Raw outputs +stay private under `.local`. CI runs the comparison on its configured platforms; +the local `Math.pow`-derived kernel check does not establish cross-platform math +parity. The [noise-fill comparison](terrain-filling.md) also checks supplied structure +density through final-density and aquifer graphs. Structure-start selection, +invalid-box repair and complete structure terrain generation remain pending. diff --git a/docs/terrain-filling.md b/docs/terrain-filling.md new file mode 100644 index 000000000..8daf2804d --- /dev/null +++ b/docs/terrain-filling.md @@ -0,0 +1,88 @@ +# Noise-stage terrain filling + +Horizon now connects final-density sampling, aquifer selection, resident block +sections, world-generation heightmaps and fluid postprocessing for the pinned +Minecraft Java Edition **26.3**. This implements the initial noise fill, before +the [surface stage](material-surfaces.md#chunk-surface-stage), features and +structure placement. + +`TerrainChunk` owns registry-backed `BlockSection` palettes, non-air counts, +optional heightmaps and per-section postprocessing offsets. Raw section reads +retain stored cave/void air; chunk reads collapse an all-air section to AIR, as +vanilla `ProtoChunk` does. Block air/fluid behavior and tag membership come from a +`TerrainBlockStates` provider tied to the same immutable registry. + +`fill_noise` samples the entire final-density volume before writing blocks. It +then visits increasing Z, increasing X and decreasing Y. Aquifer results use the +default solid block when absent. Exact default AIR results skip writes, preserving +any prior block at that position. Other states are written before updating +`OCEAN_FLOOR_WG`, then `WORLD_SURFACE_WG`. A scheduled aquifer result with nonempty +fluid appends its packed offset; repeated offsets are retained in insertion order. + +The aquifer and final-density sampler share a context. The caller constructs the +aquifer first, then compiles final density through the same compiler. The Rust +fill API accepts a full 16-by-16 chunk footprint with unit steps and a positive +vertical subrange inside its bounded chunk. Typed failures retain earlier writes +and sampler/aquifer state. Developer diagnostic surface markers are outside this +regular-gameplay path. + +Run the differential comparison with: + +```sh +python3 tools/test_terrain_parity.py +``` + +The [local report](../benchmarks/rust-terrain-2026-10-06/scoped-parity.json) records +**7,950,873 matching output lines per reference JAR**, checked against both client +and server. **114 fixtures** perform **200 fills**; **61 fixtures** enable noise-based +aquifers. Cases include all seven bundled routers, their aquifer configurations, +both random algorithms, multiple seeds and positive/negative chunk coordinates, +synthetic density roots, nondefault fluid-bearing states, prefilled chunks, +partial-height fills and repeated fills using the same caches. An additional +24 fixtures bind rigid-piece and junction density through the actual noise chunk, +including synthetic final-density and aquifer roots that consume that field. + +After every fill, the suite compares every raw section state, both packed +heightmaps, the final fluid-scheduling flag and every ordered postprocessing +offset. The reference invokes actual vanilla `NoiseChunk` and +`NoiseBasedChunkGenerator.doFill`, with empty blending and empty or supplied structure-density fields. +Rust resolves bundled tags and compiles density and aquifer roots itself. +Block identities/properties and air/fluid facts are private exports, generated +independently by both authenticated JARs and required to agree. Importing these +facts does not implement the underlying block behaviors. Placeholder material +and biome holders are never evaluated in this fill-only comparison. + +Reports capture source and fixture hashes, and the runner rejects changes during +validation. CI includes the comparison on its configured platforms; the local +report does not establish remote results. Complete generated terrain still needs +biome assignment, structures, features, nonempty +blending and live structure discovery, lighting and chunk lifecycle integration. These +results do not establish a playable client or whole-game performance improvements. + +The [combined surface-stage suite](material-surfaces.md#chunk-surface-stage) now +checks noise filling followed by surface application through shared density +contexts for all seven bundled terrain settings. + + +## Block writes across generation stages + +`PreLightChunkStage` represents the six statuses from empty through features. +`TerrainChunk::set_block_worldgen` maintains the two world-generation maps through +biomes, then the four final maps at terrain/features. Assigning a stage alone +neither clears nor primes maps. Writes update existing selected maps first and +then prime missing selected maps; maps belonging to earlier stages retain their +stored values. This also preserves native behavior when an earlier stage is +assigned again. + +Run `python3 tools/test_chunk_stage_parity.py`. The +[stage report](../benchmarks/rust-chunk-stage-2026-10-06/scoped-parity.json) records +**8,090,090 matching lines per reference JAR** across 32 fixtures. Every pinned +block state is inserted and removed under both map groups. The comparison uses +actual `ProtoChunk.setBlockState` and persisted-status assignment, checking returned +old states, chunk reads, map presence/heights, packed map words and raw sections. +It also covers forward/backward transitions, explicit priming, empty-section AIR +writes, out-of-height writes and wrapping X/Z coordinates. + +This implements stage-dependent storage mutation. Scheduling, saved status +metadata, retrogen, lighting, block entities and complete region behavior remain +pending. diff --git a/docs/value-providers.md b/docs/value-providers.md new file mode 100644 index 000000000..dfca9216f --- /dev/null +++ b/docs/value-providers.md @@ -0,0 +1,63 @@ +# World-generation value providers + +Horizon implements the scalar distributions needed by the pinned Java Edition +**26.3** cave and canyon definitions. `FloatProvider` supports constant, uniform +and trapezoid distributions. `IntProvider` supports constant, uniform, biased and +very biased distributions, trapezoids, recursively clamped sources and weighted lists. + +Decoding retains vanilla numeric narrowing, field defaults and validation rules. +Sampling preserves float operation order, wrapping integer bounds and the number +of random draws. Symmetric integer trapezoids use vanilla's distinct two-draw +subtraction path. Constant float codecs normalize both signed zeros to positive +zero. Invalid random bounds return an error without silently replacing a result. + +Run `python3 tools/test_value_provider_parity.py`. The +[local report](../benchmarks/rust-value-provider-2026-10-06/scoped-parity.json) +records **429,920 matching lines per vanilla JAR**, across **504 definitions** and +**5,040 seeded fixtures**. The suite invokes actual provider codecs, reads declared +bounds and compares up to 64 samples per valid fixture. Every sample is followed +by a random long, checking draw consumption as well as output. Both random modes, +signed zeros, overflow, equal/reversed ranges, negative plateaus, malformed fields, +duplicate keys and sampling failures are covered. + +Gaussian providers and canonical provider encoding remain pending. A local +Gaussian-math probe found double-bit differences between the host Rust logarithm +and the pinned JVM; using the system logarithm directly would not establish exact +Gaussian parity. +This scoped comparison does not establish complete carver or world-generation +parity. Provider definitions use a bounded decoder; nested integer clamps are +limited to depth 256 and 65,536 total provider nodes. + + +## Anchored height providers + +`HeightProvider` supports constant, uniform, biased, very biased, trapezoid and weighted +heights using all four vertical-anchor kinds. Empty resolved ranges return the +vanilla fallback without drawing randomness. Very biased heights preserve the +guarded inclusive draws, while trapezoid heights retain their distinct sampling +behavior even for symmetric bounds. Anchor resolution and bound arithmetic wrap +as signed Java integers. + +Run `python3 tools/test_height_provider_parity.py`. The +[height-provider report](../benchmarks/rust-height-provider-2026-10-06/scoped-parity.json) +records **507,660 matching lines per JAR**. The suite compares actual +`HeightProvider.CODEC` parsing and up to 32 samples per valid definition/context, +with subsequent random longs. It covers all four anchors, ordinary and overflowing +generation contexts, empty/equal ranges, defaults and invalid inner/plateau fields, +and anchor-versus-dispatch preference. Warning logs are excluded. Height-provider encoding remains pending. + + +## Weighted choices + +Weighted integer and height providers retain entry order, nested providers and +zero-weight entries. Integer bounds include zero-weight entries even though they +cannot be selected. Every selection consumes one bounded draw, including a +singleton of weight one. Total weights must be positive and no greater than +2,147,483,647; native constructor rejections are recorded as decode errors. + +Rust stores cumulative weights and selects by binary search, avoiding allocation +proportional to total weight. The differential suites cover totals on either side +of vanilla's 64-weight selector threshold, maximum and overflowing totals, nested +choices, malformed entries and exact subsequent random state. Each list is bounded +to 8,192 entries, with a shared 65,536-node budget across nested provider decoding. +Unit tests check those allocation limits and reject oversized branching trees. diff --git a/docs/vertical-anchors.md b/docs/vertical-anchors.md new file mode 100644 index 000000000..ce743463a --- /dev/null +++ b/docs/vertical-anchors.md @@ -0,0 +1,22 @@ +# Vertical anchors + +Horizon implements the pinned Java Edition **26.3** vertical anchors: absolute, +above bottom, below top and relative to sea level. Runtime resolution preserves +signed integer wrapping. Codec parsing and encoding enforce the vanilla field +range, preserve decimal truncation and integer wrapping, and follow the nested +exclusive alternatives even when multiple fields appear in one object. + +`WorldGenerationContext` carries the minimum, height and sea level. Its generator +adapter chooses the larger minimum and smaller height independently, matching +vanilla; this differs from intersecting the vertical intervals. + +Run `python3 tools/test_anchor_parity.py`. The +[local report](../benchmarks/rust-anchor-2026-10-06/scoped-parity.json) records +**181,632 matching output lines per reference JAR**, across **192 fixtures**, +**74,112 codec inputs** and **107,328 runtime anchors**. The original Java +transport calls the actual codecs, helper constructors and generation context, +including the native noise-based chunk generator for bounds comparisons. + +Sources and fixtures are hash-checked before publishing results. Raw reference +output stays under `.local`. These tests cover anchor behavior and the three +context values, not complete material rules, level access or JSON diagnostic text. diff --git a/docs/worker-pacing.md b/docs/worker-pacing.md index d804b74a7..5b969dee8 100644 --- a/docs/worker-pacing.md +++ b/docs/worker-pacing.md @@ -67,7 +67,7 @@ terrain completion times alongside foreground performance and CPU use. ## Hosted executor measurements [Raw platform results](../benchmarks/worker-pacing-2026-10-03/) came from -[CI run 37147381649](https://github.com/ludovic111/minecraft-optimization-lab/actions/runs/37147381649), +[CI run 37147381649](https://github.com/ludovic111/Horizon/actions/runs/37147381649), using the 50,000-job workload and the revised overshoot credit. Median worker CPU seconds per elapsed second across three runs were: diff --git a/docs/world-data.md b/docs/world-data.md new file mode 100644 index 000000000..26546c847 --- /dev/null +++ b/docs/world-data.md @@ -0,0 +1,147 @@ +# Horizon world data + +`crates/horizon-world` implements part of the Rust rewrite's storage layer for +the repository-pinned Java Edition **26.3**, data version **5023**. It reads and +exports region files and provides block-section access. Lighting, world generation, +networking and rendering remain unimplemented. Scheduled block/fluid queues now +integrate with saved tick lists, but their gameplay callbacks remain unimplemented. + +## Commands + +Build the standalone tools with `cargo build --release -p horizon-world`. +The binary is `target/release/horizon-world` (`.exe` on Windows). + +```sh +target/release/horizon-world inspect /path/to/world/region/r.0.0.mca +target/release/horizon-world get-block /path/to/world/region/r.0.0.mca 0 64 0 +target/release/horizon-world copy-region /path/to/world/region/r.0.0.mca /path/to/export/r.0.0.mca +target/release/horizon-world copy-region /path/to/world/region/r.0.0.mca /path/to/lz4-export/r.0.0.mca lz4 +target/release/horizon-world edit-block-data /path/to/world/region/r.0.0.mca /path/to/edited/r.0.0.mca 0 64 0 minecraft:oak_log axis=y +target/release/horizon-world nbt-copy /path/to/level.dat /path/to/level-uncompressed.nbt gzip none +target/release/horizon-world --help +``` + +Use offline input and a separate export directory. Output filenames must retain +the source region coordinates. Existing destination regions and external chunk +files are refused. An unchanged export preserves chunk payloads and timestamps; +an explicitly recompressed export preserves decoded NBT values, subject to +vanilla's canonicalization. Region allocation layout may change. + +`get-block` reports the stored descriptor; string descriptors can omit default +properties. `edit-block-data` changes an existing saved section's block data and +preserves other chunk fields. It does **not** perform a gameplay placement: +heightmaps, light, block entities, ticks and neighbor updates are not updated. +The raw command accepts descriptors without validating them against a loaded +registry. The library's `BlockRegistry::resolve` validates properties and +supplies defaults, and `BlockSection` uses that registry for resident storage. + +## Implementation + +NBT handles all tag types, named and unnamed network roots, Java modified UTF-8 +including unpaired UTF-16 surrogates, and 26.3 heterogeneous list wrappers. +Compound key order is not preserved; duplicate keys resolve to their last +value. Java's negative-zero normalization on loading and NaN canonicalization +on writing are reproduced. Defaults bound encoded/decoded NBT to 64 MiB, +one million wire nodes and 512 container levels. These are application limits, +not a reproduction of Java's allocation accounting or exception behavior. + +Region codecs are gzip, zlib, uncompressed and **lz4-java block framing**. +The latter includes the pinned library's 28-bit xxHash checksum adapter. +Region headers, chunk lengths, sector overlap and external `.mcc` chunks are +validated. Chunk coordinates use floor division at negative boundaries. + +Exports build a temporary region, sync file content, then publish using a +hard link that fails if the destination exists. Failed writers cannot publish; +normal error cleanup removes their temporary and newly created external files. +The filesystem must support hard links. This is an offline export mechanism: +concurrent source modification, crash recovery, directory fsync and in-place +save transactions are not implemented. + +Saved palettes support uniform zero-bit sections and padded packed words for +4,096 block entries or 64 biome entries. Resident `BlockSection` stores numeric +state IDs through a shared, borrowed registry. Uniform sections have no word +array. Changes reuse unused palette slots; replacing a unique value can update +its slot without repacking 4,096 entries. Width changes repack only when needed. +Explicit compaction removes unused slots and reduces the packed width. + +The registry loader checks data version, duplicate states, default IDs and +block-name coverage. The local oracle exports all 35,723 state identities and +defaults from vanilla. This imports identities, not block implementations, +shapes or behavior. Registry exports and game-derived fixtures stay in `.local/`. +Chunk access requires data version 5023; older saves need an unimplemented +data-fixing layer. `BlockRegistry::resolve` rejects invalid property descriptors. The separate +[block-state JSON codec](block-state-codecs.md) reproduces vanilla property +fallback for compact and full JSON forms. + +`ChunkData::saved_ticks` reads `block_ticks` or `fluid_ticks`, resolves type +identities through a caller-supplied registry lookup, and filters positions +outside the chunk as vanilla does. `set_saved_ticks` writes a queue's packed +relative delays while preserving other root fields. IDs here identify block or +fluid types, not block states. Missing tick lists are empty. Numeric fields use +vanilla's integer narrowing and floating-point conversion. Unknown types and +malformed entries return errors; vanilla's logging/partial-result paths are not +reproduced. [Scheduler integration and its separate suite](scheduled-ticks.md). + +## Validation + +```sh +cargo test --workspace +cargo clippy --workspace --all-targets -- -D warnings +python3 tools/test_rust_parity.py --prepare +python3 tools/test_world_parity.py +python3 tools/test_tick_parity.py +``` + +The world runner verifies the pinned artifacts, generates fixtures by invoking +actual vanilla classes, processes them with Rust, and reads the results with +both official client and server code. Each reference checks: + +- 32 NBT format/codec conversions covering every tag type, UTF-16 edge cases, + mixed lists, floating-point canonicalization and oversized byte arrays. +- 44 edited/compacted palette cases, comparing 123,776 individual values across + uniform, local and global vanilla palette transitions. +- 48 region chunk reads covering four codecs, copying, recompression, a stored + block edit, negative positions and oversized external chunks. +- All 35,723 exported block-state IDs and their serialized registry data. +- 8,192 resident values: a section with 4,096 distinct states, followed by the + result of 100,000 mixed block replacements checked against an independent + array of expected IDs. Rust additionally checks each returned old value, + periodic compaction, every registry ID through one slot, and uniform collapse. + +Offline tests cover malformed lengths, truncation, NBT limits, corrupt checksums, +invalid palette indices, sector corruption, the inline/external size boundary, +unknown-field preservation, failed-writer cleanup and destination collisions. +CI runs both differential suites. Run artifacts and logs stay under +`.local/rust-world-parity/`; a stale top-level success report is removed before +each run. The checked-in [report](../benchmarks/rust-world-2026-10-05/scoped-parity.json) +contains metadata and hashes only. + +These are synthetic storage fixtures, not a generated world's full save/load +lifecycle or playable integration test. They establish the reported tested +scope; they do not establish complete vanilla parity or any FPS improvement. + + +## Contained fluid states + +`FluidStateTable` derives the fluid carried by each pinned block state: empty, +water or lava, source/flowing identity, amount and falling status. Waterlogged +copper grates carry falling source water. `FluidBlockBindings` binds constant-time +conversion back to liquid block identities, including the collapse of liquid +levels 8–15 to their shared falling-fluid block representation. + +`FluidHeightWorld` supplies above-fluid and downward-face support queries. +Ordinary height returns a full block when matching fluid is above; camera height +first checks downward support above a source. Empty fluids skip world queries. +Coordinates wrap as Java integers, and query failures preserve evaluation order. +The adapter owns block-support geometry; this interface does not implement every +block's support shape. + +Run `python3 tools/test_fluid_parity.py`. The +[fluid report](../benchmarks/rust-fluid-2026-10-06/scoped-parity.json) records +**239,190 matching lines per JAR**. It compares all 35,723 block states, five fluid +identities, every fluid-family pair, own-height bits, source/falling/full flags and +legacy block conversion. The 40,344 world fixtures request 80,688 surface/camera +height queries, including coordinate overflow and injected failures. The support +fixtures use actual vanilla stone and air states. Fluid spreading, scheduled +updates, entity interactions and rendering remain pending. Workspace tests, +Clippy and 137 Python tests passed at this stage. diff --git a/docs/world-generation.md b/docs/world-generation.md new file mode 100644 index 000000000..f2d556727 --- /dev/null +++ b/docs/world-generation.md @@ -0,0 +1,192 @@ +# World generation + +Horizon targets the repository-pinned Minecraft Java Edition **26.3**. +`horizon_world::worldgen::decode_noise` implements its direct normal-noise JSON +codec. `DensityRegistry` decodes named density definitions and `NoiseRouter` +loads the eight router roots against the same graph. `AquiferConfig` binds the six +aquifer density roots, and `NoiseBasedAquifer` implements underground fluid and +pressure selection. Complete terrain generation remains pending. + +The decoder reads numeric tokens directly from `serde_json::value::RawValue`. +This preserves decimal precision and the sign of integer `-0`, avoiding a +double-precision intermediate before float density decoding. Integer +fields retain Gson's truncation toward zero and wrapping to the low 32 bits, +including decimal and exponent forms. + +Noise definitions require a base octave in `[-32,32]`. Defaults are one octave, +unit base amplitude, enabled normalization and an empty amplitude-modifier list. +Octave counts range from 1 to 32. Nonempty modifier lists must contain exactly +that many values. Amplitude bounds retain vanilla's floating-point comparator +ordering: negative zero is below the modifier lower bound of positive zero. +Normalization accepts booleans or the string `"legacy"`. Null optional fields +use their defaults; unknown keys are ignored and duplicate keys retain the last +value. + +The API accepts strict JSON. Gson's additional permissive syntax is outside this +decoder's scope. Construction failures return typed errors; comparison checks +classification and values rather than Java exception messages. + +After preparing the pinned artifacts, run: + +```sh +python3 tools/test_worldgen_parity.py +cargo test --workspace +cargo clippy --workspace --all-targets -- -D warnings +``` + +The original Java transport uses vanilla's actual `NormalNoise.DIRECT_CODEC`, +then its normal and legacy Nether initializers. The suite compares every bundled +noise resource, six world seeds, both random streams and both initialization +paths. Additional cases check codec defaults, normalization modes, field bounds, +invalid types, nulls, duplicate/unknown keys, decimal integer conversion, signed +zero and synthetic parameters. Comparisons include octave metadata, +normalization/range bits, scalar noise and parent random state after success or +failure. Raw registry contents and outputs remain private under `.local`. + +The density loader resolves forward references into distinct immutable named +holders. Numeric and object roots retain direct-value semantics. Its graph is +loaded atomically, with typed errors for missing references and cycles. It +implements the bundled function kinds, including nested splines, shifted noise, +interval selection, rounding, surface searches and context-bound fields. Graph +nesting and interval branches are bounded at 256; inline noise holders remain +pending. These bounds are explicit limits of the Rust API. + +The registry comparison decodes all **55 bundled density definitions** using +vanilla's actual registry-aware codecs and the **64 bundled noise resources**. +It compares ranges, axis dependencies, compilation failures, cache allocation, +seeded scalar values and repeated strided volumes in raw and optimized modes. +Density roots are checked through one compiler per seed and mode. Nonempty +blending and structure fields are outside these fixtures. + +The local run produced **961,693 matching output lines per reference JAR**. The +[metadata report](../benchmarks/rust-worldgen-2026-10-06/scoped-parity.json) records +source hashes, reference identities and resource digests. The runner authenticates +both artifacts, verifies that their registry resources agree, removes stale success +reports and rejects source or fixture changes during validation. CI includes the suite on +its configured platforms; the recorded local run does not establish remote +results or gameplay parity. + +The router loader requires all eight fields in vanilla declaration order. It +retains named holder identity and compiles every field through one shared cache +namespace. Failed router decoding leaves the registry graph intact. All seven +bundled preset routers now match the pinned JARs across six seeds, +both random algorithms and raw/optimized compilation. Single-layer surface +volumes and invalid multilayer surface requests are both checked. This API +decodes the router +object. The vertical `NoiseSettings` and optional `aquifers` members are also decoded; +complete generator settings and material configuration remain pending. + +`NoiseSettings` in 26.3 contains only minimum Y and height. Its JSON fields are +bounded to `[-2032,2031]` and `[0,4064]`. The guard checks the wrapped upper limit +first, then height alignment and minimum alignment to 16. The runtime create +helper applies those guards without the JSON field bounds. Height-accessor +clamping retains wrapped arithmetic, unaligned results and negative heights for +disjoint ranges. The suite compares bundled noise members, runtime and codec +construction, integer conversion and extreme accessor bounds. + +Climate sampling converts quart positions to block coordinates with wrapped +32-bit shifts, evaluates all six fields in order with the same context, and +quantizes using float multiplication followed by Java's saturating long cast. +The suite compares vanilla's actual climate sampler binding and 4,116 quantization +fixtures covering random float bits, subnormals, NaNs, infinities and saturation. +The climate parameter decoder accepts scalar intervals, two-element lists and +objects with `min`/`max` fields. Endpoints use directly parsed floats in `[-2,2]`, +with Java float comparator ordering before quantization. Parameter points require +all six coordinates and an offset in `[0,1]`; negative-zero offsets fail that +lower bound. Codec comparisons include precision-sensitive decimals, missing +fields, invalid types and duplicate keys. + +The immutable climate search tree now reproduces vanilla's stable construction +order, 19-child default, wrapped interval distance and squared fitness, pruning, +and previous-result tie handling. A searcher owns its previous leaf and borrows +one index, preventing cache reuse across unrelated indices. Indexed and brute +lookup intentionally retain their respective tie behavior. The suite compares +all supported branching values 2..32, sizes around branch powers, duplicate +entries, a 65,536-entry tree and extreme signed-long ranges/targets. The entry +bound and typed failures are explicit Rust API limits. + +`MultiNoiseBiomeSource` resolves biome identifiers through scalar climate sampling +and prepared quart volumes. Bulk preparation evaluates six fields in declaration +order and retains their float buffers; each query quantizes those stored values. +Scalar and bulk queries share one previous-result state, so their query order +retains vanilla's tie behavior. The bounded API rejects coordinates outside a +prepared volume. + +The runner exports built-in parameter tables independently from both authenticated +JARs, requires them to agree and keeps them private. These contain 7,594 Overworld +entries covering 56 biome identifiers and five Nether entries. Rust loads the +quantized tables using a Horizon import format. This is an import of built-in +data; the preset builders and vanilla biome codecs remain pending. The reference +uses actual `MultiNoiseBiomeSource` resolvers with keyed registration holders. +These checks resolve identities without evaluating biome properties or gameplay. +Both tables are exercised against every router, including cross-preset fixtures; +this does not establish End biome-source behavior. + +The report records table and fixture digests. Source or private fixture changes +during a comparison invalidate its success report. + +The global fluid picker and disabled-aquifer path are now implemented. Lava +selection uses Y below `min(-54, sea_level)`; other positions use the default +fluid status. Fluid status lookup returns its state only below its level. +Disabled aquifers use the default solid block for positive density; +nonpositive or NaN density calls the picker, and this path never schedules fluid +updates. The reference comparison uses the actual global picker lambda and +`Aquifer.createDisabled`, counting picker calls and checking default state +identities. Regular-mode fixtures cover sea-level cutoffs, extreme coordinates, +subnormal density, signed zeros, NaNs and infinities. Developer fluid-disable +behavior is outside this corpus. + +The noise-based aquifer implementation retains the six-field configuration's +binding order, seeded positional cell generation, nearest-cell ties, pressure +barriers, surface sampling, fluid levels and update scheduling. One context is +shared across all density roots. Cell locations and statuses belong to each +chunk aquifer; surface values are snapped to quart coordinates and cached. +Global fluid statuses use exact state identity where vanilla does, while lava, +water and air predicates classify blocks, including nondefault liquid states, +cave air and void air. Dry cells use the version's `WAY_BELOW_MIN_Y` value +`-32512`; this differs from the global developer-disable status's `-4064`. + +The Rust API limits grids to 16,777,216 cells and constructor surface volumes to +2,097,152 samples, checks array bounds and returns typed errors. It preserves +wrapped grid indexing within that domain, including vanilla's final-index +aliasing. Allocation failures and invalid oversized grids are outside the +comparison corpus. Read-only cache inspection does not populate caches. + +The noise-based comparison uses actual vanilla configuration decoding and aquifer +construction. It checks fluid states, scheduling flags, sampler call order and +values, global picker calls and final location/status/surface caches. Fixtures +include all bundled aquifer configurations, both seeded random factories, +strided volume extents, repeated/reversed queries, nonfinite density/sampler +values, malformed roots and injected failures followed by retries. The runner +requires every injected failure to occur. Developer fluid-disable behavior is +outside these regular-mode checks. This does not validate complete generated +chunks or the registry-backed block classification adapter independently. + +`TagDefinitions` decodes tag entries and files, applies resource-stack replacement, +and resolves required and optional dependencies before building ordered, deduplicated +memberships. Missing required references omit the affected tag while unrelated tags +remain available. Lookup order and required flags retain the pinned runtime's hash +bucket and dependency traversal behavior. A valid JSON resource that fails its tag +codec can introduce an empty tag; invalid replacement leaves earlier entries intact. + +The comparison checks all **300 bundled block-tag files** against **1,286 block +identifiers** exported independently from both JARs. Synthetic fixtures cover +replacement, malformed files, missing references, cycles, duplicate members and +lookup order. The API is bounded to 8,192 definitions and dependency depth 256; +Java hash-tree buckets and pathological self-recursive dependency searches remain +unsupported. These checks cover tag loading, not the gameplay behavior of members. + +The separate [heightmap implementation and comparison](heightmaps.md) now checks +all six types, packed data, updates and priming against actual vanilla chunks. + +The [noise-fill stage](terrain-filling.md) now integrates final density, aquifers, +registry-backed sections, world-generation heightmaps and fluid postprocessing. +Complete terrain still requires material and surface rules, nonempty world fields, +biome/feature/structure placement and complete generated-chunk validation. No rendering, frame-rate or complete gameplay claim follows from +these decoder checks. + + +Subsequent [biome lookup and chunk suites](biome-lookup.md) now validate fuzzy +block-to-quart selection, section-atomic biome fills and multi-noise chunk +assignment through actual `ChunkGenerator.doCreateBiomes`. The original report +above remains a record of its narrower tested source snapshot. diff --git a/mods/horizon-lab/src/main/java/dev/horizonlab/HorizonLab.java b/mods/horizon/src/main/java/dev/horizonlab/HorizonLab.java similarity index 97% rename from mods/horizon-lab/src/main/java/dev/horizonlab/HorizonLab.java rename to mods/horizon/src/main/java/dev/horizonlab/HorizonLab.java index e2fe279e4..b6933a07e 100644 --- a/mods/horizon-lab/src/main/java/dev/horizonlab/HorizonLab.java +++ b/mods/horizon/src/main/java/dev/horizonlab/HorizonLab.java @@ -39,7 +39,7 @@ public final class HorizonLab implements ModInitializer { return started ? 1 : 0; })))) .then(Commands.literal("stop").executes(command -> { finishTicks(); return 1; })))); - LOGGER.info("Horizon Lab ready. Simulation rules and tick rate are unchanged."); + LOGGER.info("Horizon ready. Simulation rules and tick rate are unchanged."); } public static synchronized boolean startTicks(String label, int seconds, Path output, String profile) { diff --git a/mods/horizon-lab/src/main/java/dev/horizonlab/budget/DebounceWait.java b/mods/horizon/src/main/java/dev/horizonlab/budget/DebounceWait.java similarity index 100% rename from mods/horizon-lab/src/main/java/dev/horizonlab/budget/DebounceWait.java rename to mods/horizon/src/main/java/dev/horizonlab/budget/DebounceWait.java diff --git a/mods/horizon-lab/src/main/java/dev/horizonlab/budget/DispatchRetry.java b/mods/horizon/src/main/java/dev/horizonlab/budget/DispatchRetry.java similarity index 100% rename from mods/horizon-lab/src/main/java/dev/horizonlab/budget/DispatchRetry.java rename to mods/horizon/src/main/java/dev/horizonlab/budget/DispatchRetry.java diff --git a/mods/horizon-lab/src/main/java/dev/horizonlab/budget/TerrainBudget.java b/mods/horizon/src/main/java/dev/horizonlab/budget/TerrainBudget.java similarity index 100% rename from mods/horizon-lab/src/main/java/dev/horizonlab/budget/TerrainBudget.java rename to mods/horizon/src/main/java/dev/horizonlab/budget/TerrainBudget.java diff --git a/mods/horizon-lab/src/main/java/dev/horizonlab/budget/TerrainReadWait.java b/mods/horizon/src/main/java/dev/horizonlab/budget/TerrainReadWait.java similarity index 100% rename from mods/horizon-lab/src/main/java/dev/horizonlab/budget/TerrainReadWait.java rename to mods/horizon/src/main/java/dev/horizonlab/budget/TerrainReadWait.java diff --git a/mods/horizon-lab/src/main/java/dev/horizonlab/budget/WakeableIdleWait.java b/mods/horizon/src/main/java/dev/horizonlab/budget/WakeableIdleWait.java similarity index 100% rename from mods/horizon-lab/src/main/java/dev/horizonlab/budget/WakeableIdleWait.java rename to mods/horizon/src/main/java/dev/horizonlab/budget/WakeableIdleWait.java diff --git a/mods/horizon-lab/src/main/java/dev/horizonlab/budget/WorkerPacer.java b/mods/horizon/src/main/java/dev/horizonlab/budget/WorkerPacer.java similarity index 100% rename from mods/horizon-lab/src/main/java/dev/horizonlab/budget/WorkerPacer.java rename to mods/horizon/src/main/java/dev/horizonlab/budget/WorkerPacer.java diff --git a/mods/horizon-lab/src/main/java/dev/horizonlab/client/DistantTerrainBudget.java b/mods/horizon/src/main/java/dev/horizonlab/client/DistantTerrainBudget.java similarity index 97% rename from mods/horizon-lab/src/main/java/dev/horizonlab/client/DistantTerrainBudget.java rename to mods/horizon/src/main/java/dev/horizonlab/client/DistantTerrainBudget.java index 4fa9430c2..c21e9688a 100644 --- a/mods/horizon-lab/src/main/java/dev/horizonlab/client/DistantTerrainBudget.java +++ b/mods/horizon/src/main/java/dev/horizonlab/client/DistantTerrainBudget.java @@ -46,7 +46,7 @@ final class DistantTerrainBudget { double next = policy.update(setting.getTrueValue(), totalNs / 1e6 / count, targetMs, late / (double) count, heap); if (owned == null || Math.abs(next - owned) > 0.0001) { - if (setting.setValue(next, "Horizon Lab adaptive budget")) { + if (setting.setValue(next, "Horizon adaptive budget")) { owned = next; changes++; HorizonLab.LOGGER.info("Adaptive terrain background runtime ratio: {}", next); diff --git a/mods/horizon-lab/src/main/java/dev/horizonlab/client/DistantTerrainSettings.java b/mods/horizon/src/main/java/dev/horizonlab/client/DistantTerrainSettings.java similarity index 100% rename from mods/horizon-lab/src/main/java/dev/horizonlab/client/DistantTerrainSettings.java rename to mods/horizon/src/main/java/dev/horizonlab/client/DistantTerrainSettings.java diff --git a/mods/horizon-lab/src/main/java/dev/horizonlab/client/HorizonClient.java b/mods/horizon/src/main/java/dev/horizonlab/client/HorizonClient.java similarity index 100% rename from mods/horizon-lab/src/main/java/dev/horizonlab/client/HorizonClient.java rename to mods/horizon/src/main/java/dev/horizonlab/client/HorizonClient.java diff --git a/mods/horizon-lab/src/main/java/dev/horizonlab/client/ShaderSettings.java b/mods/horizon/src/main/java/dev/horizonlab/client/ShaderSettings.java similarity index 100% rename from mods/horizon-lab/src/main/java/dev/horizonlab/client/ShaderSettings.java rename to mods/horizon/src/main/java/dev/horizonlab/client/ShaderSettings.java diff --git a/mods/horizon-lab/src/main/java/dev/horizonlab/geometry/RelativeTerrainPosition.java b/mods/horizon/src/main/java/dev/horizonlab/geometry/RelativeTerrainPosition.java similarity index 100% rename from mods/horizon-lab/src/main/java/dev/horizonlab/geometry/RelativeTerrainPosition.java rename to mods/horizon/src/main/java/dev/horizonlab/geometry/RelativeTerrainPosition.java diff --git a/mods/horizon-lab/src/main/java/dev/horizonlab/metrics/ProcessMemoryMonitor.java b/mods/horizon/src/main/java/dev/horizonlab/metrics/ProcessMemoryMonitor.java similarity index 100% rename from mods/horizon-lab/src/main/java/dev/horizonlab/metrics/ProcessMemoryMonitor.java rename to mods/horizon/src/main/java/dev/horizonlab/metrics/ProcessMemoryMonitor.java diff --git a/mods/horizon-lab/src/main/java/dev/horizonlab/metrics/Recording.java b/mods/horizon/src/main/java/dev/horizonlab/metrics/Recording.java similarity index 100% rename from mods/horizon-lab/src/main/java/dev/horizonlab/metrics/Recording.java rename to mods/horizon/src/main/java/dev/horizonlab/metrics/Recording.java diff --git a/mods/horizon-lab/src/main/java/dev/horizonlab/metrics/Reports.java b/mods/horizon/src/main/java/dev/horizonlab/metrics/Reports.java similarity index 100% rename from mods/horizon-lab/src/main/java/dev/horizonlab/metrics/Reports.java rename to mods/horizon/src/main/java/dev/horizonlab/metrics/Reports.java diff --git a/mods/horizon-lab/src/main/java/dev/horizonlab/metrics/ResidentMemory.java b/mods/horizon/src/main/java/dev/horizonlab/metrics/ResidentMemory.java similarity index 100% rename from mods/horizon-lab/src/main/java/dev/horizonlab/metrics/ResidentMemory.java rename to mods/horizon/src/main/java/dev/horizonlab/metrics/ResidentMemory.java diff --git a/mods/horizon-lab/src/main/java/dev/horizonlab/metrics/SampleStats.java b/mods/horizon/src/main/java/dev/horizonlab/metrics/SampleStats.java similarity index 100% rename from mods/horizon-lab/src/main/java/dev/horizonlab/metrics/SampleStats.java rename to mods/horizon/src/main/java/dev/horizonlab/metrics/SampleStats.java diff --git a/mods/horizon-lab/src/main/java/dev/horizonlab/metrics/ServerContext.java b/mods/horizon/src/main/java/dev/horizonlab/metrics/ServerContext.java similarity index 100% rename from mods/horizon-lab/src/main/java/dev/horizonlab/metrics/ServerContext.java rename to mods/horizon/src/main/java/dev/horizonlab/metrics/ServerContext.java diff --git a/mods/horizon-lab/src/main/java/dev/horizonlab/metrics/SoftwareContext.java b/mods/horizon/src/main/java/dev/horizonlab/metrics/SoftwareContext.java similarity index 100% rename from mods/horizon-lab/src/main/java/dev/horizonlab/metrics/SoftwareContext.java rename to mods/horizon/src/main/java/dev/horizonlab/metrics/SoftwareContext.java diff --git a/mods/horizon-lab/src/main/java/dev/horizonlab/metrics/TickState.java b/mods/horizon/src/main/java/dev/horizonlab/metrics/TickState.java similarity index 100% rename from mods/horizon-lab/src/main/java/dev/horizonlab/metrics/TickState.java rename to mods/horizon/src/main/java/dev/horizonlab/metrics/TickState.java diff --git a/mods/horizon-lab/src/main/java/dev/horizonlab/mixin/CullingEmptyWhitelistMixin.java b/mods/horizon/src/main/java/dev/horizonlab/mixin/CullingEmptyWhitelistMixin.java similarity index 100% rename from mods/horizon-lab/src/main/java/dev/horizonlab/mixin/CullingEmptyWhitelistMixin.java rename to mods/horizon/src/main/java/dev/horizonlab/mixin/CullingEmptyWhitelistMixin.java diff --git a/mods/horizon-lab/src/main/java/dev/horizonlab/mixin/CullingRayScratchMixin.java b/mods/horizon/src/main/java/dev/horizonlab/mixin/CullingRayScratchMixin.java similarity index 100% rename from mods/horizon-lab/src/main/java/dev/horizonlab/mixin/CullingRayScratchMixin.java rename to mods/horizon/src/main/java/dev/horizonlab/mixin/CullingRayScratchMixin.java diff --git a/mods/horizon-lab/src/main/java/dev/horizonlab/mixin/DhDebounceWaitMixin.java b/mods/horizon/src/main/java/dev/horizonlab/mixin/DhDebounceWaitMixin.java similarity index 100% rename from mods/horizon-lab/src/main/java/dev/horizonlab/mixin/DhDebounceWaitMixin.java rename to mods/horizon/src/main/java/dev/horizonlab/mixin/DhDebounceWaitMixin.java diff --git a/mods/horizon-lab/src/main/java/dev/horizonlab/mixin/DhPriorityDispatchMixin.java b/mods/horizon/src/main/java/dev/horizonlab/mixin/DhPriorityDispatchMixin.java similarity index 100% rename from mods/horizon-lab/src/main/java/dev/horizonlab/mixin/DhPriorityDispatchMixin.java rename to mods/horizon/src/main/java/dev/horizonlab/mixin/DhPriorityDispatchMixin.java diff --git a/mods/horizon-lab/src/main/java/dev/horizonlab/mixin/DhQuadReuseMixin.java b/mods/horizon/src/main/java/dev/horizonlab/mixin/DhQuadReuseMixin.java similarity index 100% rename from mods/horizon-lab/src/main/java/dev/horizonlab/mixin/DhQuadReuseMixin.java rename to mods/horizon/src/main/java/dev/horizonlab/mixin/DhQuadReuseMixin.java diff --git a/mods/horizon-lab/src/main/java/dev/horizonlab/mixin/DhRelativePositionMixin.java b/mods/horizon/src/main/java/dev/horizonlab/mixin/DhRelativePositionMixin.java similarity index 100% rename from mods/horizon-lab/src/main/java/dev/horizonlab/mixin/DhRelativePositionMixin.java rename to mods/horizon/src/main/java/dev/horizonlab/mixin/DhRelativePositionMixin.java diff --git a/mods/horizon-lab/src/main/java/dev/horizonlab/mixin/DhTerrainReadWaitMixin.java b/mods/horizon/src/main/java/dev/horizonlab/mixin/DhTerrainReadWaitMixin.java similarity index 100% rename from mods/horizon-lab/src/main/java/dev/horizonlab/mixin/DhTerrainReadWaitMixin.java rename to mods/horizon/src/main/java/dev/horizonlab/mixin/DhTerrainReadWaitMixin.java diff --git a/mods/horizon-lab/src/main/java/dev/horizonlab/mixin/DhTickDedupMixin.java b/mods/horizon/src/main/java/dev/horizonlab/mixin/DhTickDedupMixin.java similarity index 100% rename from mods/horizon-lab/src/main/java/dev/horizonlab/mixin/DhTickDedupMixin.java rename to mods/horizon/src/main/java/dev/horizonlab/mixin/DhTickDedupMixin.java diff --git a/mods/horizon-lab/src/main/java/dev/horizonlab/mixin/DhWorkerPacingMixin.java b/mods/horizon/src/main/java/dev/horizonlab/mixin/DhWorkerPacingMixin.java similarity index 100% rename from mods/horizon-lab/src/main/java/dev/horizonlab/mixin/DhWorkerPacingMixin.java rename to mods/horizon/src/main/java/dev/horizonlab/mixin/DhWorkerPacingMixin.java diff --git a/mods/horizon-lab/src/main/java/dev/horizonlab/mixin/FrameMixin.java b/mods/horizon/src/main/java/dev/horizonlab/mixin/FrameMixin.java similarity index 100% rename from mods/horizon-lab/src/main/java/dev/horizonlab/mixin/FrameMixin.java rename to mods/horizon/src/main/java/dev/horizonlab/mixin/FrameMixin.java diff --git a/mods/horizon-lab/src/main/java/dev/horizonlab/mixin/HorizonMixinPlugin.java b/mods/horizon/src/main/java/dev/horizonlab/mixin/HorizonMixinPlugin.java similarity index 100% rename from mods/horizon-lab/src/main/java/dev/horizonlab/mixin/HorizonMixinPlugin.java rename to mods/horizon/src/main/java/dev/horizonlab/mixin/HorizonMixinPlugin.java diff --git a/mods/horizon-lab/src/main/java/dev/horizonlab/mixin/ServerTickMixin.java b/mods/horizon/src/main/java/dev/horizonlab/mixin/ServerTickMixin.java similarity index 100% rename from mods/horizon-lab/src/main/java/dev/horizonlab/mixin/ServerTickMixin.java rename to mods/horizon/src/main/java/dev/horizonlab/mixin/ServerTickMixin.java diff --git a/mods/horizon-lab/src/main/resources/assets/horizonlab/lang/en_us.json b/mods/horizon/src/main/resources/assets/horizonlab/lang/en_us.json similarity index 100% rename from mods/horizon-lab/src/main/resources/assets/horizonlab/lang/en_us.json rename to mods/horizon/src/main/resources/assets/horizonlab/lang/en_us.json diff --git a/mods/horizon-lab/src/main/resources/fabric.mod.json b/mods/horizon/src/main/resources/fabric.mod.json similarity index 95% rename from mods/horizon-lab/src/main/resources/fabric.mod.json rename to mods/horizon/src/main/resources/fabric.mod.json index 6a5f561be..e9978939e 100644 --- a/mods/horizon-lab/src/main/resources/fabric.mod.json +++ b/mods/horizon/src/main/resources/fabric.mod.json @@ -2,7 +2,7 @@ "schemaVersion": 1, "id": "horizonlab", "version": "0.21.0", - "name": "Horizon Lab", + "name": "Horizon", "description": "Client frame pacing and server tick measurements for reproducible optimization experiments.", "authors": [ "Ludovic" diff --git a/mods/horizon-lab/src/main/resources/horizonlab.mixins.json b/mods/horizon/src/main/resources/horizonlab.mixins.json similarity index 100% rename from mods/horizon-lab/src/main/resources/horizonlab.mixins.json rename to mods/horizon/src/main/resources/horizonlab.mixins.json diff --git a/mods/horizon-lab/src/test/java/dev/horizonlab/budget/DebounceQueueBenchmark.java b/mods/horizon/src/test/java/dev/horizonlab/budget/DebounceQueueBenchmark.java similarity index 100% rename from mods/horizon-lab/src/test/java/dev/horizonlab/budget/DebounceQueueBenchmark.java rename to mods/horizon/src/test/java/dev/horizonlab/budget/DebounceQueueBenchmark.java diff --git a/mods/horizon-lab/src/test/java/dev/horizonlab/budget/DebounceWaitTest.java b/mods/horizon/src/test/java/dev/horizonlab/budget/DebounceWaitTest.java similarity index 100% rename from mods/horizon-lab/src/test/java/dev/horizonlab/budget/DebounceWaitTest.java rename to mods/horizon/src/test/java/dev/horizonlab/budget/DebounceWaitTest.java diff --git a/mods/horizon-lab/src/test/java/dev/horizonlab/budget/DispatchRetryTest.java b/mods/horizon/src/test/java/dev/horizonlab/budget/DispatchRetryTest.java similarity index 100% rename from mods/horizon-lab/src/test/java/dev/horizonlab/budget/DispatchRetryTest.java rename to mods/horizon/src/test/java/dev/horizonlab/budget/DispatchRetryTest.java diff --git a/mods/horizon-lab/src/test/java/dev/horizonlab/budget/IdleQueueBenchmark.java b/mods/horizon/src/test/java/dev/horizonlab/budget/IdleQueueBenchmark.java similarity index 100% rename from mods/horizon-lab/src/test/java/dev/horizonlab/budget/IdleQueueBenchmark.java rename to mods/horizon/src/test/java/dev/horizonlab/budget/IdleQueueBenchmark.java diff --git a/mods/horizon-lab/src/test/java/dev/horizonlab/budget/TerrainBudgetTest.java b/mods/horizon/src/test/java/dev/horizonlab/budget/TerrainBudgetTest.java similarity index 100% rename from mods/horizon-lab/src/test/java/dev/horizonlab/budget/TerrainBudgetTest.java rename to mods/horizon/src/test/java/dev/horizonlab/budget/TerrainBudgetTest.java diff --git a/mods/horizon-lab/src/test/java/dev/horizonlab/budget/WakeableIdleWaitTest.java b/mods/horizon/src/test/java/dev/horizonlab/budget/WakeableIdleWaitTest.java similarity index 100% rename from mods/horizon-lab/src/test/java/dev/horizonlab/budget/WakeableIdleWaitTest.java rename to mods/horizon/src/test/java/dev/horizonlab/budget/WakeableIdleWaitTest.java diff --git a/mods/horizon-lab/src/test/java/dev/horizonlab/budget/WorkerPacerTest.java b/mods/horizon/src/test/java/dev/horizonlab/budget/WorkerPacerTest.java similarity index 100% rename from mods/horizon-lab/src/test/java/dev/horizonlab/budget/WorkerPacerTest.java rename to mods/horizon/src/test/java/dev/horizonlab/budget/WorkerPacerTest.java diff --git a/mods/horizon-lab/src/test/java/dev/horizonlab/budget/WorkerPacingBenchmark.java b/mods/horizon/src/test/java/dev/horizonlab/budget/WorkerPacingBenchmark.java similarity index 100% rename from mods/horizon-lab/src/test/java/dev/horizonlab/budget/WorkerPacingBenchmark.java rename to mods/horizon/src/test/java/dev/horizonlab/budget/WorkerPacingBenchmark.java diff --git a/mods/horizon-lab/src/test/java/dev/horizonlab/client/DistantTerrainBudgetTest.java b/mods/horizon/src/test/java/dev/horizonlab/client/DistantTerrainBudgetTest.java similarity index 100% rename from mods/horizon-lab/src/test/java/dev/horizonlab/client/DistantTerrainBudgetTest.java rename to mods/horizon/src/test/java/dev/horizonlab/client/DistantTerrainBudgetTest.java diff --git a/mods/horizon-lab/src/test/java/dev/horizonlab/client/DistantTerrainSettingsTest.java b/mods/horizon/src/test/java/dev/horizonlab/client/DistantTerrainSettingsTest.java similarity index 100% rename from mods/horizon-lab/src/test/java/dev/horizonlab/client/DistantTerrainSettingsTest.java rename to mods/horizon/src/test/java/dev/horizonlab/client/DistantTerrainSettingsTest.java diff --git a/mods/horizon-lab/src/test/java/dev/horizonlab/dispatch/CullingEmptyIntegration.java b/mods/horizon/src/test/java/dev/horizonlab/dispatch/CullingEmptyIntegration.java similarity index 100% rename from mods/horizon-lab/src/test/java/dev/horizonlab/dispatch/CullingEmptyIntegration.java rename to mods/horizon/src/test/java/dev/horizonlab/dispatch/CullingEmptyIntegration.java diff --git a/mods/horizon-lab/src/test/java/dev/horizonlab/dispatch/CullingRayIntegration.java b/mods/horizon/src/test/java/dev/horizonlab/dispatch/CullingRayIntegration.java similarity index 100% rename from mods/horizon-lab/src/test/java/dev/horizonlab/dispatch/CullingRayIntegration.java rename to mods/horizon/src/test/java/dev/horizonlab/dispatch/CullingRayIntegration.java diff --git a/mods/horizon-lab/src/test/java/dev/horizonlab/dispatch/DispatchIntegration.java b/mods/horizon/src/test/java/dev/horizonlab/dispatch/DispatchIntegration.java similarity index 100% rename from mods/horizon-lab/src/test/java/dev/horizonlab/dispatch/DispatchIntegration.java rename to mods/horizon/src/test/java/dev/horizonlab/dispatch/DispatchIntegration.java diff --git a/mods/horizon-lab/src/test/java/dev/horizonlab/dispatch/PositionIntegration.java b/mods/horizon/src/test/java/dev/horizonlab/dispatch/PositionIntegration.java similarity index 100% rename from mods/horizon-lab/src/test/java/dev/horizonlab/dispatch/PositionIntegration.java rename to mods/horizon/src/test/java/dev/horizonlab/dispatch/PositionIntegration.java diff --git a/mods/horizon-lab/src/test/java/dev/horizonlab/dispatch/QuadReuseIntegration.java b/mods/horizon/src/test/java/dev/horizonlab/dispatch/QuadReuseIntegration.java similarity index 100% rename from mods/horizon-lab/src/test/java/dev/horizonlab/dispatch/QuadReuseIntegration.java rename to mods/horizon/src/test/java/dev/horizonlab/dispatch/QuadReuseIntegration.java diff --git a/mods/horizon-lab/src/test/java/dev/horizonlab/dispatch/QuadSizeIntegration.java b/mods/horizon/src/test/java/dev/horizonlab/dispatch/QuadSizeIntegration.java similarity index 100% rename from mods/horizon-lab/src/test/java/dev/horizonlab/dispatch/QuadSizeIntegration.java rename to mods/horizon/src/test/java/dev/horizonlab/dispatch/QuadSizeIntegration.java diff --git a/mods/horizon-lab/src/test/java/dev/horizonlab/dispatch/TerrainReadIntegration.java b/mods/horizon/src/test/java/dev/horizonlab/dispatch/TerrainReadIntegration.java similarity index 100% rename from mods/horizon-lab/src/test/java/dev/horizonlab/dispatch/TerrainReadIntegration.java rename to mods/horizon/src/test/java/dev/horizonlab/dispatch/TerrainReadIntegration.java diff --git a/mods/horizon-lab/src/test/java/dev/horizonlab/dispatch/TickDedupIntegration.java b/mods/horizon/src/test/java/dev/horizonlab/dispatch/TickDedupIntegration.java similarity index 100% rename from mods/horizon-lab/src/test/java/dev/horizonlab/dispatch/TickDedupIntegration.java rename to mods/horizon/src/test/java/dev/horizonlab/dispatch/TickDedupIntegration.java diff --git a/mods/horizon-lab/src/test/java/dev/horizonlab/dispatch/fixture/CullingRayAccess.java b/mods/horizon/src/test/java/dev/horizonlab/dispatch/fixture/CullingRayAccess.java similarity index 100% rename from mods/horizon-lab/src/test/java/dev/horizonlab/dispatch/fixture/CullingRayAccess.java rename to mods/horizon/src/test/java/dev/horizonlab/dispatch/fixture/CullingRayAccess.java diff --git a/mods/horizon-lab/src/test/java/dev/horizonlab/dispatch/fixture/GraphicsBackendTraceMixin.java b/mods/horizon/src/test/java/dev/horizonlab/dispatch/fixture/GraphicsBackendTraceMixin.java similarity index 100% rename from mods/horizon-lab/src/test/java/dev/horizonlab/dispatch/fixture/GraphicsBackendTraceMixin.java rename to mods/horizon/src/test/java/dev/horizonlab/dispatch/fixture/GraphicsBackendTraceMixin.java diff --git a/mods/horizon-lab/src/test/java/dev/horizonlab/geometry/RelativeTerrainPositionTest.java b/mods/horizon/src/test/java/dev/horizonlab/geometry/RelativeTerrainPositionTest.java similarity index 100% rename from mods/horizon-lab/src/test/java/dev/horizonlab/geometry/RelativeTerrainPositionTest.java rename to mods/horizon/src/test/java/dev/horizonlab/geometry/RelativeTerrainPositionTest.java diff --git a/mods/horizon-lab/src/test/java/dev/horizonlab/metrics/ClientGraphicsIntegration.java b/mods/horizon/src/test/java/dev/horizonlab/metrics/ClientGraphicsIntegration.java similarity index 100% rename from mods/horizon-lab/src/test/java/dev/horizonlab/metrics/ClientGraphicsIntegration.java rename to mods/horizon/src/test/java/dev/horizonlab/metrics/ClientGraphicsIntegration.java diff --git a/mods/horizon-lab/src/test/java/dev/horizonlab/metrics/MetricsTest.java b/mods/horizon/src/test/java/dev/horizonlab/metrics/MetricsTest.java similarity index 100% rename from mods/horizon-lab/src/test/java/dev/horizonlab/metrics/MetricsTest.java rename to mods/horizon/src/test/java/dev/horizonlab/metrics/MetricsTest.java diff --git a/mods/horizon-lab/src/test/java/dev/horizonlab/metrics/ObjectHeaderBenchmark.java b/mods/horizon/src/test/java/dev/horizonlab/metrics/ObjectHeaderBenchmark.java similarity index 100% rename from mods/horizon-lab/src/test/java/dev/horizonlab/metrics/ObjectHeaderBenchmark.java rename to mods/horizon/src/test/java/dev/horizonlab/metrics/ObjectHeaderBenchmark.java diff --git a/mods/horizon-lab/src/test/java/dev/horizonlab/metrics/ObjectSizeAgent.java b/mods/horizon/src/test/java/dev/horizonlab/metrics/ObjectSizeAgent.java similarity index 100% rename from mods/horizon-lab/src/test/java/dev/horizonlab/metrics/ObjectSizeAgent.java rename to mods/horizon/src/test/java/dev/horizonlab/metrics/ObjectSizeAgent.java diff --git a/mods/horizon-lab/src/test/java/dev/horizonlab/metrics/ResidentMemoryTest.java b/mods/horizon/src/test/java/dev/horizonlab/metrics/ResidentMemoryTest.java similarity index 100% rename from mods/horizon-lab/src/test/java/dev/horizonlab/metrics/ResidentMemoryTest.java rename to mods/horizon/src/test/java/dev/horizonlab/metrics/ResidentMemoryTest.java diff --git a/mods/horizon-lab/src/test/java/dev/horizonlab/metrics/ServerGraphicsIntegration.java b/mods/horizon/src/test/java/dev/horizonlab/metrics/ServerGraphicsIntegration.java similarity index 100% rename from mods/horizon-lab/src/test/java/dev/horizonlab/metrics/ServerGraphicsIntegration.java rename to mods/horizon/src/test/java/dev/horizonlab/metrics/ServerGraphicsIntegration.java diff --git a/mods/horizon-lab/src/test/java/dev/horizonlab/metrics/TickStateIntegration.java b/mods/horizon/src/test/java/dev/horizonlab/metrics/TickStateIntegration.java similarity index 100% rename from mods/horizon-lab/src/test/java/dev/horizonlab/metrics/TickStateIntegration.java rename to mods/horizon/src/test/java/dev/horizonlab/metrics/TickStateIntegration.java diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaAnchorOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaAnchorOracle.java new file mode 100644 index 000000000..9d8c4ec70 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaAnchorOracle.java @@ -0,0 +1,57 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import com.mojang.serialization.JsonOps; +import java.io.*; +import java.lang.reflect.Proxy; +import java.nio.charset.StandardCharsets; +import java.nio.file.*; +import java.util.*; +import net.minecraft.core.*; +import net.minecraft.world.level.*; +import net.minecraft.world.level.biome.*; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.levelgen.*; +import net.minecraft.world.level.levelgen.densityfunction.DensityFunctions; +import net.minecraft.world.level.levelgen.material.rule.BlockRule; + +/** Original transport for vertical anchor codecs and generation contexts. */ +public final class VanillaAnchorOracle { + private static WorldGenerationContext context(JsonObject f) { + var v=f.getAsJsonArray("context");int min=v.get(0).getAsInt(),height=v.get(1).getAsInt(),sea=v.get(2).getAsInt(); + if(f.has("generator")) { + var g=f.getAsJsonArray("generator");var zero=DensityFunctions.zero(); + var settings=new NoiseGeneratorSettings(new NoiseSettings(g.get(0).getAsInt(),g.get(1).getAsInt()),Blocks.STONE.defaultBlockState(),Blocks.WATER.defaultBlockState(),new NoiseRouter(zero,zero,zero,zero,zero,zero,zero,zero),Holder.direct(new BlockRule(Blocks.STONE.defaultBlockState())),List.of(),g.get(2).getAsInt(),false,Optional.empty(),false,NoiseGeneratorSettings.DebugFunctions.EMPTY); + var biome=Holder.Reference.createStandAlone(new HolderOwner(){},Biomes.PLAINS); + var generator=new NoiseBasedChunkGenerator(new FixedBiomeSource(biome),Holder.direct(settings)); + return new WorldGenerationContext(generator,LevelHeightAccessor.create(min,height)); + } + var accessor=(LevelAccessor)Proxy.newProxyInstance(LevelAccessor.class.getClassLoader(),new Class[]{LevelAccessor.class},(proxy,method,args)->switch(method.getName()) { + case "getMinY"->min;case "getHeight"->height;case "getSeaLevel"->sea; + default->throw new AssertionError("unexpected accessor method "+method); + }); + return WorldGenerationContext.of(accessor); + } + private static void anchor(VerticalAnchor anchor,WorldGenerationContext context,PrintWriter out) { + var encoded=VerticalAnchor.CODEC.encodeStart(JsonOps.INSTANCE,anchor).result(); + out.println("anchor "+anchor.resolveY(context)+" "+encoded.map(Object::toString).orElse("error")); + } + public static void main(String[] args) throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); + Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt"),StandardCharsets.UTF_8))) { + for(String line:Files.readAllLines(dir.resolve("inputs.txt"))) { + var f=JsonParser.parseString(line).getAsJsonObject();var context=context(f); + out.println("context "+context.getMinGenY()+" "+context.getGenDepth()+" "+context.seaLevel()); + anchor(VerticalAnchor.bottom(),context,out);anchor(VerticalAnchor.top(),context,out);anchor(VerticalAnchor.seaLevel(),context,out); + for(var e:f.getAsJsonArray("values")) { + int value=e.getAsInt(); + for(var a:List.of(VerticalAnchor.absolute(value),VerticalAnchor.aboveBottom(value),VerticalAnchor.belowTop(value),VerticalAnchor.relativeToSeaLevel(value)))anchor(a,context,out); + } + for(var e:f.getAsJsonArray("json")) { + var result=VerticalAnchor.CODEC.parse(JsonOps.INSTANCE,JsonParser.parseString(e.getAsString())).result(); + if(result.isPresent())anchor(result.get(),context,out);else out.println("error"); + } + } + } + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBasicFeatureOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBasicFeatureOracle.java new file mode 100644 index 000000000..1b566c2ae --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBasicFeatureOracle.java @@ -0,0 +1,78 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import com.mojang.serialization.JsonOps; +import java.io.*; +import java.lang.reflect.*; +import java.nio.charset.StandardCharsets; +import java.nio.file.*; +import java.util.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Holder; +import net.minecraft.world.level.levelgen.placement.*; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.WorldGenLevel; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.levelgen.*; +import net.minecraft.world.level.levelgen.feature.Feature; + +/** Invokes native block-writing features through an observable mutable world. */ +public final class VanillaBasicFeatureOracle { + private static final class Stop extends RuntimeException {} + public static void main(String[] args) throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); + final Block[] BLOCKS={Blocks.AIR,Blocks.STONE,Blocks.COBBLESTONE,Blocks.END_STONE,Blocks.OBSIDIAN}; + if(args[0].equals("export")) { + var values=new JsonArray();for(var block:BLOCKS)values.add(Block.getId(block.defaultBlockState()));Files.writeString(Path.of(args[1]),values.toString());return; + } + Path dir=Path.of(args[1]); + var contextMethod=VanillaPlacementOracle.class.getDeclaredMethod("context",JsonObject.class);contextMethod.setAccessible(true); + var bounds=new JsonObject();bounds.add("context",JsonParser.parseString("[-64,384,63]")); + var generator=((PlacementContext)contextMethod.invoke(null,bounds)).generator(); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt"),StandardCharsets.UTF_8))) { + for(var line:Files.readAllLines(dir.resolve("inputs.txt"))) { + var f=JsonParser.parseString(line).getAsJsonObject();long seed=f.get("seed").getAsLong(); + RandomSource random=f.get("legacy").getAsBoolean()?new LegacyRandomSource(seed):new XoroshiroRandomSource(seed); + var decoded=Feature.DIRECT_CODEC.parse(JsonOps.INSTANCE,JsonParser.parseString(f.get("definition").getAsString())).result(); + var modifiers=new ArrayList();boolean valid=true; + if(f.has("placement"))for(var json:f.getAsJsonArray("placement")) { + try {var modifier=PlacementModifier.CODEC.parse(JsonOps.INSTANCE,json).result();if(modifier.isPresent())modifiers.add(modifier.get());else valid=false;} + catch(IllegalArgumentException error){valid=false;} + } + if(decoded.isEmpty()||!valid)out.println("decode error");else { + out.println("decode ok");int[] calls={0};int fail=f.get("fail").getAsInt(),reject=f.get("reject").getAsInt(); + var states=new TreeMap(Comparator.comparingInt(BlockPos::getX).thenComparingInt(BlockPos::getY).thenComparingInt(BlockPos::getZ)); + var world=(WorldGenLevel)Proxy.newProxyInstance(WorldGenLevel.class.getClassLoader(),new Class[]{WorldGenLevel.class},(proxy,method,values)->{ + if(method.getName().equals("getMinY"))return -64; + if(method.getName().equals("getHeight")&&(values==null||values.length==0))return 384; + if(method.getName().equals("getSeaLevel"))return 63; + if(method.getName().equals("setBlockAndUpdate"))return InvocationHandler.invokeDefault(proxy,method,values); + var p=((BlockPos)values[0]).immutable();int call=calls[0]++; + switch(method.getName()) { + case "getBlockState"->{ + out.println("get "+p.getX()+" "+p.getY()+" "+p.getZ());if(call==fail)throw new Stop(); + var state=states.getOrDefault(p,BLOCKS[Math.floorMod(p.getX()*31+p.getY()*7+p.getZ()*17,5)].defaultBlockState());out.println("state "+Block.getId(state));return state; + } + case "setBlock"->{ + var state=(BlockState)values[1];int flags=(Integer)values[2];out.println("set "+p.getX()+" "+p.getY()+" "+p.getZ()+" "+Block.getId(state)+" "+flags);if(call==fail)throw new Stop(); + boolean result=reject==0||call%reject!=0;if(result)states.put(p,state);out.println("written "+result);return result; + } + default->throw new AssertionError("unexpected world method "+method); + } + }); + var p=f.getAsJsonArray("origin");var origin=new BlockPos(p.get(0).getAsInt(),p.get(1).getAsInt(),p.get(2).getAsInt()); + var placed=new PlacedFeature(Holder.direct(decoded.get()),modifiers);var placer=new FeaturePlacer(world,generator); + for(int repeat=0;repeat>(); + for(int i=0;i<512;i++)ids.add(Holder.Reference.createStandAlone(new HolderOwner(){},ResourceKey.create(Registries.BIOME,Identifier.parse("horizon:biome_"+i)))); + Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt"),StandardCharsets.UTF_8))) { + for(String line:Files.readAllLines(dir.resolve("inputs.txt"))) { + var f=JsonParser.parseString(line).getAsJsonObject();int min=f.get("min").getAsInt(),height=f.get("height").getAsInt(); + var factory=new PalettedContainerFactory(Strategy.createForBlockStates(Block.BLOCK_STATE_REGISTRY),Blocks.AIR.defaultBlockState(),null,Strategy.createForBiomes(ids),ids.byId(f.get("default").getAsInt()),null); + var bounds=new int[]{min,min+height-1}; + var chunk=new ProtoChunk(new ChunkPos(f.get("cx").getAsInt(),f.get("cz").getAsInt()),UpgradeData.EMPTY,LevelHeightAccessor.create(min,height),factory,null){@Override public LevelHeightAccessor getHeightAccessorForGeneration(){return LevelHeightAccessor.create(bounds[0],bounds[1]-bounds[0]+1);}}; + chunk.setPersistedStatus(net.minecraft.world.level.chunk.status.ChunkStatus.BIOMES); + for(var value:f.getAsJsonArray("ops")) { + var op=value.getAsJsonArray();bounds[0]=op.get(3).getAsInt();bounds[1]=op.get(4).getAsInt();var calls=new int[1];boolean ok=true; + try { chunk.fillBiomesFromNoise((x,y,z)->{ + out.println("resolve "+x+" "+y+" "+z);int previous=calls[0]++; + if(previous==op.get(2).getAsInt())throw new IllegalStateException("synthetic provider failure"); + return ids.byId(Math.floorMod(x*31+y*7+z*17+op.get(0).getAsInt(),op.get(1).getAsInt())); + });}catch(IllegalStateException error){ok=false;} + out.println("fill "+(ok?"ok":"error")+" "+calls[0]); + for(int section=0;section>>(); + MultiNoiseBiomeSourceParameterList.knownPresets().forEach((preset,list)->presets.put(preset.id().toString(),list)); + for(var preset:presets.entrySet()) { + var entries=new JsonArray(); + for(var value:preset.getValue().values()) { + var point=value.getFirst();var entry=new JsonObject();var coordinates=new JsonArray(); + for(var parameter:new Climate.Parameter[]{point.temperature(),point.humidity(),point.continentalness(),point.erosion(),point.depth(),point.weirdness()}) { + var interval=new JsonArray();interval.add(parameter.min());interval.add(parameter.max());coordinates.add(interval); + } + entry.add("coordinates",coordinates);entry.addProperty("offset",point.offset());entry.addProperty("biome",value.getSecond().identifier().toString());entries.add(entry); + } + result.addProperty(preset.getKey(),entries.toString()); + } + Files.writeString(Path.of(args[0]),result.toString(),StandardCharsets.UTF_8); + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeGenerationOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeGenerationOracle.java new file mode 100644 index 000000000..817a3d1bd --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeGenerationOracle.java @@ -0,0 +1,69 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import com.mojang.serialization.*; +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.nio.file.*; +import java.util.*; +import net.minecraft.core.*; +import net.minecraft.core.registries.*; +import net.minecraft.resources.*; +import net.minecraft.world.level.*; +import net.minecraft.world.level.biome.*; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.chunk.*; +import net.minecraft.world.level.levelgen.*; +import net.minecraft.world.level.levelgen.blending.Blender; +import net.minecraft.world.level.levelgen.densityfunction.*; +import net.minecraft.world.level.levelgen.material.rule.MaterialRule; +import net.minecraft.world.level.levelgen.synth.NormalNoise; + +/** Original transport invoking actual ChunkGenerator.doCreateBiomes. */ +public final class VanillaBiomeGenerationOracle { + @SuppressWarnings("unchecked") + public static void main(String[] args) throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();Path dir=Path.of(args[1]); + var bundle=JsonParser.parseString(Files.readString(dir.resolve("registries.json"))).getAsJsonObject(); + var noises=new MappedRegistry(Registries.NOISE,Lifecycle.stable());var densities=new MappedRegistry(Registries.DENSITY_FUNCTION,Lifecycle.stable()); + var noiseLookup=noises.createRegistrationLookup();var densityLookup=densities.createRegistrationLookup(); + var ops=RegistryOps.create(JsonOps.INSTANCE,new RegistryOps.RegistryInfoLookup(){public Optional> lookup(ResourceKey> key){ + if(key.equals(Registries.NOISE))return (Optional>)(Optional)Optional.of(noiseLookup); + if(key.equals(Registries.DENSITY_FUNCTION))return (Optional>)(Optional)Optional.of(densityLookup);return Optional.empty();}}); + for(var e:bundle.getAsJsonObject("noises").entrySet())noises.register(ResourceKey.create(Registries.NOISE,Identifier.parse(e.getKey())),NormalNoise.DIRECT_CODEC.parse(ops,JsonParser.parseString(e.getValue().getAsString())).getOrThrow(),RegistrationInfo.BUILT_IN);noises.freeze(); + for(var e:bundle.getAsJsonObject("densities").entrySet())densities.register(ResourceKey.create(Registries.DENSITY_FUNCTION,Identifier.parse(e.getKey())),DensityFunctions.DIRECT_CODEC.parse(ops,JsonParser.parseString(e.getValue().getAsString())).getOrThrow(),RegistrationInfo.BUILT_IN);densities.freeze(); + var presets=new TreeMap>>();MultiNoiseBiomeSourceParameterList.knownPresets().forEach((preset,list)->presets.put(preset.id().toString(),list)); + var ids=new IdMapper>();var holders=new TreeMap>(); + var keys=new TreeSet();keys.add("minecraft:plains");keys.addAll(List.of("minecraft:the_end","minecraft:end_highlands","minecraft:end_midlands","minecraft:small_end_islands","minecraft:end_barrens"));for(var list:presets.values())for(var entry:list.values())keys.add(entry.getSecond().identifier().toString()); + for(var key:keys){var holder=Holder.Reference.createStandAlone(new HolderOwner(){},ResourceKey.create(Registries.BIOME,Identifier.parse(key)));holders.put(key,holder);ids.add(holder);} + var factory=new PalettedContainerFactory(Strategy.createForBlockStates(Block.BLOCK_STATE_REGISTRY),Blocks.AIR.defaultBlockState(),null,Strategy.createForBiomes(ids),holders.get("minecraft:plains"),null); + var fill=ChunkGenerator.class.getDeclaredMethod("doCreateBiomes",Blender.class,RandomState.class,ChunkAccess.class);fill.setAccessible(true); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt"),StandardCharsets.UTF_8))) { + for(var line:Files.readAllLines(dir.resolve("inputs.txt"))) { + var f=JsonParser.parseString(line).getAsJsonObject();int min=f.get("min").getAsInt(),height=f.get("height").getAsInt(),sea=63;long seed=f.get("seed").getAsLong();boolean legacy=f.get("legacy").getAsBoolean(); + var setting=JsonParser.parseString(bundle.getAsJsonObject("settings").get(f.get("setting").getAsString()).getAsString()).getAsJsonObject();var router=NoiseRouter.CODEC.parse(ops,setting.get("noise_router")).getOrThrow(); + var state=RandomState.create(noises,seed,legacy,Blocks.STONE.defaultBlockState(),sea,router); + var entries=new ArrayList>>(); + for(var entry:presets.get(f.get("preset").getAsString()).values())entries.add(com.mojang.datafixers.util.Pair.of(entry.getFirst(),holders.get(entry.getSecond().identifier().toString()))); + BiomeSource source=MultiNoiseBiomeSource.createFromList(new Climate.ParameterList<>(entries)); + if(f.has("source"))switch(f.get("source").getAsString()) { + case "fixed" -> source=new FixedBiomeSource(holders.get("minecraft:plains")); + case "checkerboard" -> source=new CheckerboardColumnBiomeSource(HolderSet.direct(List.of(holders.get("minecraft:plains"),holders.get("minecraft:the_end"),holders.get("minecraft:nether_wastes"))),f.get("scale").getAsInt()); + case "end" -> {var constructor=TheEndBiomeSource.class.getDeclaredConstructor(Holder.class,Holder.class,Holder.class,Holder.class,Holder.class);constructor.setAccessible(true);source=constructor.newInstance(holders.get("minecraft:the_end"),holders.get("minecraft:end_highlands"),holders.get("minecraft:end_midlands"),holders.get("minecraft:small_end_islands"),holders.get("minecraft:end_barrens"));} + default -> throw new IllegalArgumentException("unknown source"); + } + var material=Holder.Reference.createStandAlone(new HolderOwner(){},ResourceKey.create(Registries.MATERIAL_RULE,Identifier.parse("horizon:unused"))); + var settings=new NoiseGeneratorSettings(NoiseSettings.create(min,height),Blocks.STONE.defaultBlockState(),Blocks.WATER.defaultBlockState(),router,material,List.of(),sea,false,Optional.empty(),legacy,NoiseGeneratorSettings.DebugFunctions.EMPTY); + var generator=new NoiseBasedChunkGenerator(source,Holder.direct(settings)); + var bounds=LevelHeightAccessor.create(f.get("write_min").getAsInt(),f.get("write_max").getAsInt()-f.get("write_min").getAsInt()+1); + var chunk=new ProtoChunk(new ChunkPos(f.get("cx").getAsInt(),f.get("cz").getAsInt()),UpgradeData.EMPTY,LevelHeightAccessor.create(min,height),factory,null){@Override public LevelHeightAccessor getHeightAccessorForGeneration(){return bounds;}}; + chunk.setPersistedStatus(net.minecraft.world.level.chunk.status.ChunkStatus.BIOMES); + for(int repeat=0;repeat();for(var value:f.getAsJsonArray("placement"))modifiers.add(PlacementModifier.CODEC.parse(JsonOps.INSTANCE,value).getOrThrow()); + int[] queries={0},calls={0};int queryFail=f.get("query_fail").getAsInt(),featureFail=f.get("feature_fail").getAsInt(); + var bounds=new JsonObject();bounds.add("context",JsonParser.parseString("[-64,384,63]")); + var generator=((PlacementContext)contextMethod.invoke(null,bounds)).generator(); + var biomes=List.of(Holder.Reference.createStandAlone(new HolderOwner(){},ResourceKey.create(Registries.BIOME,Identifier.parse("horizon:a"))),Holder.Reference.createStandAlone(new HolderOwner(){},ResourceKey.create(Registries.BIOME,Identifier.parse("horizon:b")))); + var leaf=new Feature(){ + public MapCodec codec(){return MapCodec.unit(this);} + public boolean place(WorldGenLevel world,ChunkGenerator gen,RandomSource rng,BlockPos p){ + out.println("feature "+p.getX()+" "+p.getY()+" "+p.getZ()); + if(f.get("draw").getAsBoolean())out.println("draw "+rng.nextLong()); + if(calls[0]++==featureFail)throw new Stop(); + if(f.get("nested").getAsBoolean())return new FeaturePlacer(world,gen).place(new PlacedFeature(Holder.direct(this),List.of(BiomeFilter.biome())),rng,p); + return f.get("return_mode").getAsInt()==0||(f.get("return_mode").getAsInt()==2&&Math.floorMod(p.getX()+p.getY()+p.getZ(),2)==0); + } + }; + var root=new PlacedFeature(Holder.direct(leaf),modifiers); + var copy=new PlacedFeature(root.feature(),root.placement()); + var other=new PlacedFeature(Holder.direct(new Feature(){public MapCodec codec(){return MapCodec.unit(this);}public boolean place(WorldGenLevel w,ChunkGenerator g,RandomSource r,BlockPos p){return true;}}),modifiers); + var settings=new ArrayList(); + for(var value:f.getAsJsonArray("membership")) { + int mode=value.getAsInt();var values=mode==0?List.>of():List.of(Holder.direct(mode==1?root:mode==2?copy:other)); + settings.add(constructor.newInstance(HolderSet.direct(List.of()),List.of(HolderSet.direct(values)))); + } + getter.set(generator,(java.util.function.Function,BiomeGenerationSettings>)(biome)->{ + int index=biome==biomes.get(0)?0:1;out.println("settings "+index);if(queries[0]++==queryFail)throw new Stop();return settings.get(index); + }); + var world=(WorldGenLevel)Proxy.newProxyInstance(WorldGenLevel.class.getClassLoader(),new Class[]{WorldGenLevel.class},(proxy,method,values)->switch(method.getName()) { + case "getMinY"->-64;case "getHeight"->384;case "getSeaLevel"->63; + case "getBiome"->{var p=(BlockPos)values[0];out.println("biome "+p.getX()+" "+p.getY()+" "+p.getZ());if(queries[0]++==queryFail)throw new Stop();int index=Math.floorMod(p.getX()*31+p.getY()*7+p.getZ()*17,2);out.println("selected "+index);yield biomes.get(index);} + default->throw new AssertionError(method); + }); + var p=f.getAsJsonArray("origin");var origin=new BlockPos(p.get(0).getAsInt(),p.get(1).getAsInt(),p.get(2).getAsInt()); + boolean top=f.get("top").getAsBoolean(),direct=f.get("direct").getAsBoolean(); + var context=new PlacementContext(world,generator,top?Optional.of(root):Optional.empty());var placer=new FeaturePlacer(world,generator); + for(int repeat=0;repeat<3;repeat++) { + queries[0]=0;calls[0]=0; + try { + if(direct){final RandomSource rng=random;modifiers.get(0).modify(context,random,origin,q->leaf.place(world,generator,rng,q));out.println("place true");} + else out.println("place "+(top?placer.placeWithBiomeCheck(root,random,origin):placer.place(root,random,origin))); + } catch(Stop|IllegalStateException|IndexOutOfBoundsException error){out.println("place error");} + out.println("next "+random.nextLong()); + } + out.println("tail "+random.nextLong()); + } + } + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeSourceCodecOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeSourceCodecOracle.java new file mode 100644 index 000000000..8e79ae905 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeSourceCodecOracle.java @@ -0,0 +1,47 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import com.mojang.serialization.*; +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.nio.file.*; +import java.util.*; +import net.minecraft.core.*; +import net.minecraft.core.registries.*; +import net.minecraft.resources.*; +import net.minecraft.world.level.biome.*; +import net.minecraft.world.level.levelgen.densityfunction.*; + +/** Original transport using BiomeSource.CODEC and decoded vanilla resolvers. */ +public final class VanillaBiomeSourceCodecOracle { + private static JsonElement normalized(JsonElement value) { + if(value.isJsonArray()){var a=new JsonArray();for(var v:value.getAsJsonArray())a.add(normalized(v));return a;} + if(value.isJsonObject()){var a=new JsonObject();for(var key:new TreeSet<>(value.getAsJsonObject().keySet()))a.add(key,normalized(value.getAsJsonObject().get(key)));return a;} + if(value.isJsonPrimitive()&&value.getAsJsonPrimitive().isNumber()){var a=new JsonObject();a.addProperty("float64_bits",String.format("%016x",Double.doubleToRawLongBits(Double.parseDouble(value.toString()))));return a;} + return value; + } + @SuppressWarnings("unchecked") + public static void main(String[] args) throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();Path dir=Path.of(args[1]); + var load=VanillaMaterialConditionOracle.class.getDeclaredMethod("loadBiomes",Path.class);load.setAccessible(true);load.invoke(null,dir); + var field=VanillaMaterialConditionOracle.class.getDeclaredField("biomes");field.setAccessible(true);var biomes=(MappedRegistry)field.get(null); + var presets=new MappedRegistry(Registries.MULTI_NOISE_BIOME_SOURCE_PARAMETER_LIST,Lifecycle.stable()); + for(var preset:List.of(MultiNoiseBiomeSourceParameterList.Preset.OVERWORLD,MultiNoiseBiomeSourceParameterList.Preset.NETHER))presets.register(ResourceKey.create(Registries.MULTI_NOISE_BIOME_SOURCE_PARAMETER_LIST,preset.id()),new MultiNoiseBiomeSourceParameterList(preset,biomes),RegistrationInfo.BUILT_IN);presets.freeze(); + var ops=RegistryOps.create(JsonOps.INSTANCE,new RegistryOps.RegistryInfoLookup(){public Optional> lookup(ResourceKey> key){ + if(key.equals(Registries.BIOME))return (Optional>)(Optional)Optional.of(biomes); + if(key.equals(Registries.MULTI_NOISE_BIOME_SOURCE_PARAMETER_LIST))return (Optional>)(Optional)Optional.of(presets);return Optional.empty();}}); + var positions=JsonParser.parseString(Files.readString(dir.resolve("positions.json"))).getAsJsonArray(); + var zero=new DensitySampler(){public float sampleValue(SamplerContext c,int x,int y,int z){return 0;}public void sampleVolume(SamplerContext c,DensityBuffer b,DensityVolume v){b.fill(0);}}.bind(SamplerContext.builder().enableCaches().build()); + var climate=new Climate.Sampler(zero,zero,zero,zero,zero,zero); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt"),StandardCharsets.UTF_8))) { + for(var json:Files.readAllLines(dir.resolve("inputs.txt"))) { + Optional decoded; + try { decoded=BiomeSource.CODEC.parse(ops,JsonParser.parseString(json)).result(); }catch(IllegalArgumentException|IllegalStateException error){decoded=Optional.empty();} + if(decoded.isEmpty()){out.println("codec error");continue;} + var source=decoded.get();out.println("codec "+normalized(BiomeSource.CODEC.encodeStart(ops,source).getOrThrow())); + var names=new TreeSet();for(var biome:source.possibleBiomes())names.add(biome.unwrapKey().orElseThrow().identifier().toString());out.println("possible "+new Gson().toJson(names)); + var resolver=source.createResolver(climate); + for(var p:positions){var q=p.getAsJsonArray();try{out.println("biome "+resolver.getNoiseBiome(q.get(0).getAsInt(),q.get(1).getAsInt(),q.get(2).getAsInt()).unwrapKey().orElseThrow().identifier());}catch(ArithmeticException|IllegalStateException error){out.println("biome error");}} + } + } + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeSourceOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeSourceOracle.java new file mode 100644 index 000000000..0432f22bb --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeSourceOracle.java @@ -0,0 +1,39 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.nio.file.*; +import java.util.*; +import net.minecraft.core.*; +import net.minecraft.core.registries.*; +import net.minecraft.resources.*; +import net.minecraft.world.level.biome.*; +import net.minecraft.world.level.levelgen.densityfunction.*; + +/** Original transport calling actual fixed/checkerboard/End biome resolvers. */ +public final class VanillaBiomeSourceOracle { + public static void main(String[] args) throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); + var ids=new IdMapper>();for(int i=0;i<512;i++)ids.add(Holder.Reference.createStandAlone(new HolderOwner(){},ResourceKey.create(Registries.BIOME,Identifier.parse("horizon:biome_"+i)))); + var constructor=TheEndBiomeSource.class.getDeclaredConstructor(Holder.class,Holder.class,Holder.class,Holder.class,Holder.class);constructor.setAccessible(true); + var end=constructor.newInstance(ids.byId(0),ids.byId(1),ids.byId(2),ids.byId(3),ids.byId(4)); + Path dir=Path.of(args[1]);try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt"),StandardCharsets.UTF_8))) { + for(var line:Files.readAllLines(dir.resolve("inputs.txt"))) { + var f=JsonParser.parseString(line).getAsJsonObject();BiomeResolver resolver; + switch(f.get("kind").getAsString()) { + case "fixed" -> resolver=new FixedBiomeSource(ids.byId(7)).createResolver(null); + case "checkerboard" -> {var values=new ArrayList>();for(var v:f.getAsJsonArray("biomes"))values.add(ids.byId(v.getAsInt()));resolver=new CheckerboardColumnBiomeSource(HolderSet.direct(values),f.get("scale").getAsInt()).createResolver(null);} + case "end" -> { + var sampler=new DensitySampler(){ + public float sampleValue(SamplerContext context,int x,int y,int z){out.println("sample "+x+" "+y+" "+z);if(f.get("fail").getAsBoolean())throw new IllegalStateException("synthetic sampler failure");return Float.intBitsToFloat(Integer.parseUnsignedInt(f.get("bits").getAsString(),16));} + public void sampleVolume(SamplerContext context,DensityBuffer buffer,DensityVolume volume){throw new AssertionError("unexpected bulk query");} + }.bind(SamplerContext.builder().enableCaches().build()); + resolver=end.createResolver(new Climate.Sampler(sampler,sampler,sampler,sampler,sampler,sampler)); + } + default -> throw new IllegalArgumentException("invalid source"); + } + for(var p:f.getAsJsonArray("positions")){var q=p.getAsJsonArray();try{out.println("biome "+ids.getId(resolver.getNoiseBiome(q.get(0).getAsInt(),q.get(1).getAsInt(),q.get(2).getAsInt())));}catch(ArithmeticException|IllegalStateException error){out.println("error");}} + } + } + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeTemperatureOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeTemperatureOracle.java new file mode 100644 index 000000000..bfe972b19 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeTemperatureOracle.java @@ -0,0 +1,69 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import com.mojang.serialization.*; +import java.io.*; +import java.lang.reflect.*; +import java.nio.charset.StandardCharsets; +import java.nio.file.*; +import java.util.concurrent.atomic.AtomicReference; +import it.unimi.dsi.fastutil.longs.Long2FloatLinkedOpenHashMap; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.biome.Biome; + +/** Original transport for native biome temperature methods and cache contents. */ +public final class VanillaBiomeTemperatureOracle { + private static Method adjusted,temperature; + private static Field cache; + private static Object climate(JsonObject f) throws Exception { + var type=Class.forName("net.minecraft.world.level.biome.Biome$ClimateSettings"); + if(f.has("json")) { + var field=type.getDeclaredField("CODEC");field.setAccessible(true); + var codec=(MapCodec)field.get(null); + return codec.codec().parse(JsonOps.INSTANCE,JsonParser.parseString(f.get("json").getAsString())).result().orElse(null); + } + var constructor=type.getDeclaredConstructor(boolean.class,float.class,Biome.TemperatureModifier.class,float.class);constructor.setAccessible(true); + return constructor.newInstance(f.get("precipitation").getAsBoolean(),Float.intBitsToFloat(Integer.parseUnsignedInt(f.get("base").getAsString(),16)),Biome.TemperatureModifier.valueOf(f.get("modifier").getAsString()),f.has("downfall")?Float.intBitsToFloat(Integer.parseUnsignedInt(f.get("downfall").getAsString(),16)):0f); + } + private static Object field(Object value,String name) throws Exception { + var method=value.getClass().getDeclaredMethod(name);method.setAccessible(true);return method.invoke(value); + } + private static Biome make(Object climate) throws Exception { + var biome=Biome.class.getDeclaredConstructors()[0];biome.setAccessible(true);return (Biome)biome.newInstance(climate,null,null,null); + } + private static String bits(float value){return Integer.toUnsignedString(Float.floatToIntBits(value),16);} + private static void operations(Biome biome,JsonArray operations,PrintWriter out) throws Exception { + for(var item:operations) { + var op=item.getAsJsonArray();switch(op.get(0).getAsString()) { + case "query"->{ + var pos=new BlockPos(op.get(1).getAsInt(),op.get(2).getAsInt(),op.get(3).getAsInt());int sea=op.get(4).getAsInt(); + out.println("adjusted "+bits((Float)adjusted.invoke(biome,pos,sea))); + out.println("cached "+bits((Float)temperature.invoke(biome,pos,sea))); + out.println("weather "+biome.warmEnoughToRain(pos,sea)+" "+biome.coldEnoughToSnow(pos,sea)+" "+biome.shouldMeltFrozenOceanIcebergSlightly(pos,sea)+" "+biome.getPrecipitationAt(pos,sea)); + } + case "fill"->{for(int i=0;i{var map=(Long2FloatLinkedOpenHashMap)((ThreadLocal)cache.get(biome)).get();out.println("cache "+map.size());for(var entry:map.long2FloatEntrySet())out.println(Long.toUnsignedString(entry.getLongKey(),16)+" "+bits(entry.getFloatValue()));} + case "thread"->{ + var failure=new AtomicReference(); + var thread=new Thread(()->{try{operations(biome,op.get(1).getAsJsonArray(),out);}catch(Throwable error){failure.set(error);}}); + thread.start();thread.join();if(failure.get()!=null)throw new AssertionError("temperature worker failed",failure.get()); + } + default->throw new AssertionError("unknown operation "+op); + } + } + } + public static void main(String[] args) throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); + adjusted=Biome.class.getDeclaredMethod("getHeightAdjustedTemperature",BlockPos.class,int.class);adjusted.setAccessible(true); + temperature=Biome.class.getDeclaredMethod("getTemperature",BlockPos.class,int.class);temperature.setAccessible(true); + cache=Biome.class.getDeclaredField("temperatureCache");cache.setAccessible(true); + Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt"),StandardCharsets.UTF_8))) { + for(String line:Files.readAllLines(dir.resolve("inputs.txt"))) { + var f=JsonParser.parseString(line).getAsJsonObject();var climate=climate(f); + if(climate==null){out.println("decode error");continue;} + out.println("settings "+field(climate,"hasPrecipitation")+" "+bits((Float)field(climate,"temperature"))+" "+field(climate,"temperatureModifier")+" "+bits((Float)field(climate,"downfall"))); + operations(make(climate),f.getAsJsonArray("ops"),out); + } + } + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeZoomOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeZoomOracle.java new file mode 100644 index 000000000..e130df20f --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeZoomOracle.java @@ -0,0 +1,36 @@ +package dev.horizonlab.parity; +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.nio.file.*; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.biome.BiomeManager; + +/** Original transport; actual biome manager selects coordinates for a traced resolver. */ +public final class VanillaBiomeZoomOracle { + public static void main(String[] args) throws Exception { + Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt"),StandardCharsets.UTF_8))) { + for(String line:Files.readAllLines(dir.resolve("inputs.txt"))) { + var v=line.split(" "); + switch(v[0]) { + case "s" -> out.println("s "+BiomeManager.obfuscateSeed(Long.parseLong(v[1]))); + case "b" -> { + out.print("b"); + var manager=new BiomeManager((x,y,z)->{out.print(" "+x+" "+y+" "+z);return null;},Long.parseLong(v[1])); + var pos=new BlockPos(Integer.parseInt(v[2]),Integer.parseInt(v[3]),Integer.parseInt(v[4])); + manager.getBiome(pos);manager.getNoiseBiomeAtPosition(pos); + manager.withDifferentSource((x,y,z)->{out.print(" "+x+" "+y+" "+z);return null;}).getBiome(pos.getX(),pos.getY(),pos.getZ()); + out.println(); + } + case "p" -> { + out.print("p"); + var manager=new BiomeManager((x,y,z)->{out.print(" "+x+" "+y+" "+z);return null;},0); + manager.getNoiseBiomeAtPosition(Double.longBitsToDouble(Long.parseUnsignedLong(v[1],16)),Double.longBitsToDouble(Long.parseUnsignedLong(v[2],16)),Double.longBitsToDouble(Long.parseUnsignedLong(v[3],16))); + out.println(); + } + default -> throw new IllegalArgumentException("unknown fixture operation"); + } + } + } + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java new file mode 100644 index 000000000..7367beefd --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java @@ -0,0 +1,56 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*; +import java.lang.reflect.*; +import java.nio.file.*; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.nbt.*; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.state.*; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.shapes.*; +/** Imports definition inputs only; vanilla computes the independently compared solidity results. */ +public final class VanillaBlockPropertiesOracle { + private static Field field(Class cls,String name) throws Exception {var f=cls.getDeclaredField(name);f.setAccessible(true);return f;} + private static VoxelShape shape(JsonElement value) { + var a=value.getAsJsonArray();double[] v=new double[6];for(int i=0;i<6;i++)v[i]=Double.longBitsToDouble(Long.parseUnsignedLong(a.get(i).getAsString(),16)); + return Shapes.create(new AABB(v[0],v[1],v[2],v[3],v[4],v[5])); + } + public static void main(String[] args) throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); + var properties=field(BlockBehaviour.class,"properties");var on=field(BlockBehaviour.Properties.class,"forceSolidOn");var off=field(BlockBehaviour.Properties.class,"forceSolidOff");var replace=field(BlockBehaviour.Properties.class,"replaceable");var liquid=field(BlockBehaviour.Properties.class,"liquid");var occlude=field(BlockBehaviour.Properties.class,"canOcclude"); + var cache=field(BlockBehaviour.BlockStateBase.class,"cache");var collision=field(cache.getType(),"collisionShape"); + var calculate=BlockBehaviour.BlockStateBase.class.getDeclaredMethod("calculateSolid");calculate.setAccessible(true); + Path dir=Path.of(args[1]); + if(args[0].equals("export")) { + VanillaCollisionOracle.main(new String[]{"generate",args[1]}); + var states=new ListTag();var blocks=new CompoundTag(); + for(var state:Block.BLOCK_STATE_REGISTRY)states.add(BlockState.FULL_CODEC.encodeStart(NbtOps.INSTANCE,state).getOrThrow()); + for(var block:BuiltInRegistries.BLOCK) { + var p=properties.get(block);blocks.putByte(BuiltInRegistries.BLOCK.getKey(block).toString(),(byte)((on.getBoolean(p)?1:0)|(off.getBoolean(p)?2:0)|(replace.getBoolean(p)?4:0)|(liquid.getBoolean(p)?8:0)|(occlude.getBoolean(p)?16:0))); + } + var root=new CompoundTag();root.putInt("DataVersion",net.minecraft.SharedConstants.getCurrentVersion().dataVersion().version());root.put("states",states);root.put("blocks",blocks);root.put("occlusion",VanillaCollisionOracle.occlusionDefinitions()); + try(var out=new DataOutputStream(Files.newOutputStream(dir.resolve("block-properties.nbt")))){NbtIo.write(root,out);}return; + } + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")))) { + for(var state:Block.BLOCK_STATE_REGISTRY) { + var p=properties.get(state.getBlock()); + out.printf("state %d %s %s %s %s%n",Block.getId(state),on.getBoolean(p),off.getBoolean(p),state.canBeReplaced(),state.isSolid()); + out.printf("render %s %s %s%n",state.liquid(),state.canOcclude(),state.isSolidRender()); + var c=cache.get(state);var s=c==null?null:(VoxelShape)collision.get(c); + if(s==null)out.println("cache none");else if(s.isEmpty())out.println("cache empty");else { + var b=s.bounds();out.printf("cache %016x %016x %016x %016x %016x %016x%n",Double.doubleToRawLongBits(b.minX),Double.doubleToRawLongBits(b.minY),Double.doubleToRawLongBits(b.minZ),Double.doubleToRawLongBits(b.maxX),Double.doubleToRawLongBits(b.maxY),Double.doubleToRawLongBits(b.maxZ)); + } + } + var state=Blocks.STONE.defaultBlockState();var p=properties.get(Blocks.STONE);var savedCache=cache.get(state);var savedShape=collision.get(savedCache);boolean savedOn=on.getBoolean(p),savedOff=off.getBoolean(p); + try(var inputs=Files.lines(dir.resolve("inputs.txt"))) { + for(var line:(Iterable)inputs::iterator) { + var f=JsonParser.parseString(line).getAsJsonObject();VoxelShape s=Shapes.empty();for(var value:f.getAsJsonArray("shape"))s=Shapes.or(s,shape(value)); + on.setBoolean(p,f.get("on").getAsBoolean());off.setBoolean(p,f.get("off").getAsBoolean());cache.set(state,f.get("cached").getAsBoolean()?savedCache:null);collision.set(savedCache,s); + out.println("solid "+calculate.invoke(state)); + out.println("render "+Block.isShapeFullBlock(f.get("occludes").getAsBoolean()?s:Shapes.empty())); + } + } finally {cache.set(state,savedCache);collision.set(savedCache,savedShape);on.setBoolean(p,savedOn);off.setBoolean(p,savedOff);} + } + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java new file mode 100644 index 000000000..12de99201 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java @@ -0,0 +1,46 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import com.mojang.serialization.JsonOps; +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.nio.file.*; +import java.util.*; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.IntegerProperty; + +/** Original transport for actual compact/full block-state codecs. */ +public final class VanillaBlockStateCodecOracle { + private static JsonElement canonical(JsonElement value) { + if(value.isJsonObject()){var result=new JsonObject();for(var e:new TreeMap<>(value.getAsJsonObject().asMap()).entrySet())result.add(e.getKey(),canonical(e.getValue()));return result;} + if(value.isJsonArray()){var result=new JsonArray();for(var e:value.getAsJsonArray())result.add(canonical(e));return result;} + return value; + } + private static String encode(BlockState state,boolean full){return canonical((full?BlockState.FULL_CODEC:BlockState.CODEC).encodeStart(JsonOps.INSTANCE,state).getOrThrow()).toString();} + public static void main(String[] args) throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); + Path dir=Path.of(args[1]); + if(args[0].equals("export")) { + var result=new JsonObject();var states=new JsonArray();var defaults=new JsonObject();var integers=new JsonArray(); + for(var state:Block.BLOCK_STATE_REGISTRY) { + if(Block.getId(state)!=states.size())throw new AssertionError("registry IDs not dense"); + states.add(BlockState.FULL_CODEC.encodeStart(JsonOps.INSTANCE,state).getOrThrow()); + } + for(var id:new TreeSet<>(BuiltInRegistries.BLOCK.keySet())) { + var block=BuiltInRegistries.BLOCK.getValue(id);defaults.addProperty(id.toString(),Block.getId(block.defaultBlockState())); + for(var p:block.getStateDefinition().getProperties())if(p instanceof IntegerProperty){var entry=new JsonArray();entry.add(id.toString());entry.add(p.getName());integers.add(entry);} + } + result.add("states",states);result.add("defaults",defaults);result.add("integers",integers); + Files.writeString(dir,result.toString(),StandardCharsets.UTF_8);return; + } + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt"),StandardCharsets.UTF_8))) { + for(var state:Block.BLOCK_STATE_REGISTRY)out.println("state "+Block.getId(state)+" "+encode(state,false)+" "+encode(state,true)); + for(var line:Files.readAllLines(dir.resolve("inputs.txt"))) { + var input=JsonParser.parseString(line).getAsJsonArray();boolean full=input.get(0).getAsBoolean(); + var value=(full?BlockState.FULL_CODEC:BlockState.CODEC).parse(JsonOps.INSTANCE,JsonParser.parseString(input.get(1).getAsString())).result(); + if(value.isEmpty())out.println("decode error");else {var state=value.get();out.println("decode "+Block.getId(state)+" "+encode(state,false)+" "+encode(state,true));} + } + } + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSupportOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSupportOracle.java new file mode 100644 index 000000000..ce3b327e6 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSupportOracle.java @@ -0,0 +1,37 @@ +package dev.horizonlab.parity; +import java.io.*; +import java.lang.reflect.*; +import java.nio.file.*; +import java.util.*; +import net.minecraft.core.*; +import net.minecraft.nbt.*; +import net.minecraft.world.level.*; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.state.*; +import net.minecraft.world.phys.shapes.*; +/** Private support-shape data export; native cache answers are the independent reference. */ +public final class VanillaBlockSupportOracle { + public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); + var cache=BlockBehaviour.BlockStateBase.class.getDeclaredField("cache");cache.setAccessible(true);Path dir=Path.of(args[1]); + if(args[0].equals("export")) { + VanillaCollisionOracle.main(new String[]{"generate",args[1]}); + var grid=VanillaCollisionOracle.class.getDeclaredMethod("grid",VoxelShape.class);grid.setAccessible(true); + var states=new ListTag();var shapes=new ListTag();var ids=new IdentityHashMap();int[] mapping=new int[Block.BLOCK_STATE_REGISTRY.size()]; + for(var state:Block.BLOCK_STATE_REGISTRY){int id=Block.getId(state);states.add(BlockState.FULL_CODEC.encodeStart(NbtOps.INSTANCE,state).getOrThrow());if(cache.get(state)==null){mapping[id]=-1;continue;} + var shape=state.getBlockSupportShape(EmptyBlockGetter.INSTANCE,BlockPos.ZERO);Integer shapeId=ids.get(shape);if(shapeId==null){shapeId=shapes.size();ids.put(shape,shapeId);shapes.add((CompoundTag)grid.invoke(null,shape));}mapping[id]=shapeId; + } + var cachedIds=new com.google.gson.JsonArray();for(int i=0;i=0)cachedIds.add(i);Files.writeString(dir.resolve("support-cached-states.json"),cachedIds.toString()); + var root=new CompoundTag();root.putInt("DataVersion",net.minecraft.SharedConstants.getCurrentVersion().dataVersion().version());root.putString("Kind","block_support");root.put("states",states);root.put("shapes",shapes);root.putIntArray("cached_shapes",mapping); + try(var out=new DataOutputStream(Files.newOutputStream(dir.resolve("cached-support.nbt")))){NbtIo.write(root,out);}return; + } + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")))) { + for(var state:Block.BLOCK_STATE_REGISTRY){int id=Block.getId(state);if(cache.get(state)==null){out.println("state "+id+" uncached");continue;} + out.println("state "+id+" cached"); + for(var direction:Direction.values()) { + out.print("support "+direction.ordinal());for(var type:SupportType.values())out.print(" "+state.isFaceSturdy(EmptyBlockGetter.INSTANCE,BlockPos.ZERO,direction,type));out.println(" "+state.isFaceSturdy(EmptyBlockGetter.INSTANCE,BlockPos.ZERO,direction)); + } + } + } + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSurvivalOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSurvivalOracle.java new file mode 100644 index 000000000..efd3cd0e4 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSurvivalOracle.java @@ -0,0 +1,91 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*; +import java.lang.reflect.*; +import java.nio.file.*; +import net.minecraft.core.*; +import net.minecraft.resources.*; +import net.minecraft.tags.*; +import net.minecraft.world.level.material.Fluid; +import com.mojang.serialization.JsonOps; +import java.util.*; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; +import net.minecraft.world.level.*; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.entity.ShulkerBoxBlockEntity; +import net.minecraft.world.level.block.state.*; +/** Native survival calls over changing neighbor states and independent query failures. */ +public final class VanillaBlockSurvivalOracle { + private static final class Stop extends RuntimeException {} + private static Class declaring(Class type,String name,Class... parameters) { + while(type!=null){try{type.getDeclaredMethod(name,parameters);return type;}catch(NoSuchMethodException e){type=type.getSuperclass();}} + return null; + } + private static void bindFluidTags(JsonObject resources) { + var registry=BuiltInRegistries.FLUID; + var loader=new TagLoader>((id,required)->registry.get(id).map(value->(Holder)value),"tags/fluid"); + var definitions=new HashMap>(); + for(var item:resources.entrySet()) { + var file=TagFile.CODEC.parse(JsonOps.INSTANCE,JsonParser.parseString(item.getValue().getAsString())).getOrThrow(); + var entries=new ArrayList(); + for(var entry:file.entries())entries.add(new TagLoader.EntryWithSource(entry,"vanilla")); + definitions.put(Identifier.parse(item.getKey()),entries); + } + var tags=new HashMap,List>>(); + loader.build(definitions).forEach((id,values)->tags.put(TagKey.create(Registries.FLUID,id),List.copyOf(values))); + if(tags.size()!=resources.size())throw new AssertionError("incomplete fluid tags"); + registry.prepareTagReload(new TagLoader.LoadResult<>(Registries.FLUID,tags)).apply(); + } + public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();Path dir=Path.of(args[1]); + if(args[0].equals("export")||args[0].equals("definitions")) { + if(args[0].equals("export")) { + VanillaBlockPropertiesOracle.main(new String[]{"export",args[1]});VanillaBlockSupportOracle.main(new String[]{"export",args[1]});VanillaBlockStateCodecOracle.main(new String[]{"export",dir.resolve("facts.json").toString()}); + } + var extra=new JsonObject();var fenceGates=new JsonArray();var ignition=new JsonObject(); + for(var block:BuiltInRegistries.BLOCK)if(block instanceof FenceGateBlock)fenceGates.add(BuiltInRegistries.BLOCK.getKey(block).toString()); + var ignitionField=FireBlock.class.getDeclaredField("igniteOdds");ignitionField.setAccessible(true); + var odds=(it.unimi.dsi.fastutil.objects.Object2IntMap)ignitionField.get(Blocks.FIRE); + for(var block:BuiltInRegistries.BLOCK)ignition.addProperty(BuiltInRegistries.BLOCK.getKey(block).toString(),odds.getInt(block)); + extra.add("fence_gates",fenceGates);extra.add("ignition_odds",ignition);Files.writeString(dir.resolve("survival-extra-definitions.json"),extra.toString()); + var definitions=new JsonObject();var placement=new JsonObject();var supportTags=new JsonObject(); + for(var block:BuiltInRegistries.BLOCK){ + String name=BuiltInRegistries.BLOCK.getKey(block).toString(); + Class type=declaring(block.getClass(),"canSurvive",BlockState.class,LevelReader.class,BlockPos.class); + definitions.addProperty(name,type.getSimpleName()); + type=declaring(block.getClass(),"mayPlaceOn",BlockState.class,BlockGetter.class,BlockPos.class); + if(type!=null)placement.addProperty(name,type.getSimpleName()); + var fields=new JsonObject(); + for(Class c=block.getClass();c!=null;c=c.getSuperclass())for(var field:c.getDeclaredFields())if(field.getType().equals(net.minecraft.tags.TagKey.class)&&!Modifier.isStatic(field.getModifiers())) { + field.setAccessible(true);var tag=(net.minecraft.tags.TagKey)field.get(block);if(tag!=null)fields.addProperty(field.getName(),tag.location().toString()); + } + if(fields.size()>0)supportTags.add(name,fields); + } + Files.writeString(dir.resolve("survival-classes.json"),definitions.toString()); + Files.writeString(dir.resolve("survival-placement-classes.json"),placement.toString()); + Files.writeString(dir.resolve("survival-support-tags.json"),supportTags.toString());return; + } + VanillaHeightmapOracle.bindTags(JsonParser.parseString(Files.readString(dir.resolve("tags.json"))).getAsJsonObject()); + bindFluidTags(JsonParser.parseString(Files.readString(dir.resolve("fluid-tags.json"))).getAsJsonObject()); + var allocator=Class.forName("sun.misc.Unsafe");var access=allocator.getDeclaredField("theUnsafe");access.setAccessible(true);var unsafe=access.get(null);var allocate=allocator.getMethod("allocateInstance",Class.class); + var oldProgress=ShulkerBoxBlockEntity.class.getDeclaredField("progressOld");oldProgress.setAccessible(true);var progress=ShulkerBoxBlockEntity.class.getDeclaredField("progress");progress.setAccessible(true); + var animation=ShulkerBoxBlockEntity.class.getDeclaredField("animationStatus");animation.setAccessible(true); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var inputs=Files.lines(dir.resolve("inputs.txt"))) { + for(var line:(Iterable)inputs::iterator){ + var f=JsonParser.parseString(line).getAsJsonObject();var candidate=Block.stateById(f.get("state").getAsInt());var xyz=f.getAsJsonArray("position");var p=new BlockPos(xyz.get(0).getAsInt(),xyz.get(1).getAsInt(),xyz.get(2).getAsInt());var neighbors=f.getAsJsonArray("neighbors");int[] reads={0},entities={0},lights={0},fluids={0}; + Object entity=null;String mode=f.get("entity").getAsString();if(!mode.equals("none")){entity=allocate.invoke(unsafe,ShulkerBoxBlockEntity.class);Object status=null;for(var value:animation.getType().getEnumConstants())if(((Enum)value).name().equals(mode.toUpperCase(java.util.Locale.ROOT)))status=value;if(status==null)throw new AssertionError(mode);animation.set(entity,status);}if(entity!=null && f.has("shulker_progress")){var data=f.getAsJsonArray("shulker_progress");oldProgress.setFloat(entity,Float.intBitsToFloat(Integer.parseUnsignedInt(data.get(0).getAsString(),16)));progress.setFloat(entity,Float.intBitsToFloat(Integer.parseUnsignedInt(data.get(1).getAsString(),16)));}Object selected=entity; + var world=(LevelReader)Proxy.newProxyInstance(LevelReader.class.getClassLoader(),new Class[]{LevelReader.class},(proxy,method,values)->{ + if(method.getName().equals("getFluidState")){var at=(BlockPos)values[0];out.println("fluid "+at.getX()+" "+at.getY()+" "+at.getZ());int count=fluids[0]++;if(count==(f.has("fluid_fail")?f.get("fluid_fail").getAsInt():-1))throw new Stop();var states=f.has("fluid_states")?f.getAsJsonArray("fluid_states"):neighbors;return Block.stateById(states.get(count%states.size()).getAsInt()).getFluidState();} + if(method.getName().equals("getRawBrightness")){var at=(BlockPos)values[0];out.println("light "+at.getX()+" "+at.getY()+" "+at.getZ()+" "+values[1]);if(lights[0]++==(f.has("light_fail")?f.get("light_fail").getAsInt():-1))throw new Stop();return f.has("brightness")?f.get("brightness").getAsInt():15;} + if(method.getName().equals("getBlockState")){var at=(BlockPos)values[0];out.println("read "+at.getX()+" "+at.getY()+" "+at.getZ());int count=reads[0]++;if(count==f.get("fail").getAsInt())throw new Stop();return Block.stateById(neighbors.get(count%neighbors.size()).getAsInt());} + if(method.getName().equals("getBlockEntity")){var at=(BlockPos)values[0];out.println("entity "+at.getX()+" "+at.getY()+" "+at.getZ());if(entities[0]++==f.get("entity_fail").getAsInt())throw new Stop();return selected;} + if(method.isDefault())return InvocationHandler.invokeDefault(proxy,method,values); + throw new AssertionError(method); + }); + try{out.println("survive "+candidate.canSurvive(world,p));}catch(Stop error){out.println("survive error");} + out.println("counts "+reads[0]+" "+entities[0]+" "+lights[0]+" "+fluids[0]); + } + } + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBulkSectionOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBulkSectionOracle.java new file mode 100644 index 000000000..160207065 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBulkSectionOracle.java @@ -0,0 +1,88 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import com.mojang.serialization.JsonOps; +import java.io.*; +import java.lang.reflect.*; +import java.nio.charset.StandardCharsets; +import java.nio.file.*; +import java.util.*; +import net.minecraft.core.*; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.*; +import net.minecraft.world.level.biome.*; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.chunk.*; +import net.minecraft.world.level.chunk.status.ChunkStatus; +import net.minecraft.world.level.levelgen.*; +import net.minecraft.world.level.levelgen.feature.Feature; +import net.minecraft.world.level.levelgen.placement.*; + +/** Native feature placement into resident ProtoChunks through a world transport. */ +public final class VanillaBulkSectionOracle { + private static ProtoChunk chunk(Map chunks,int x,int z) { + var chunk=chunks.get(new ChunkPos(x>>4,z>>4));if(chunk==null)throw new IllegalArgumentException("missing region chunk");return chunk; + } + private static int count(BulkSectionAccess bulk) throws Exception { + var field=BulkSectionAccess.class.getDeclaredField("acquiredSections");field.setAccessible(true);return ((Map)field.get(bulk)).size(); + } + public static void main(String[] args) throws Exception { + if(args[0].equals("export")){VanillaHeightmapOracle.main(args);return;} + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); + Path dir=Path.of(args[1]); + Holder biome=Holder.Reference.createStandAlone(new HolderOwner(){},Biomes.PLAINS); + var ids=new IdMapper>();ids.add(biome); + var factory=new PalettedContainerFactory(Strategy.createForBlockStates(Block.BLOCK_STATE_REGISTRY),Blocks.AIR.defaultBlockState(),null,Strategy.createForBiomes(ids),biome,null); + VanillaHeightmapOracle.bindTags(JsonParser.parseString(Files.readString(dir.resolve("tags.json"))).getAsJsonObject()); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt"),StandardCharsets.UTF_8))) { + for(var line:Files.readAllLines(dir.resolve("inputs.txt"))) { + var f=JsonParser.parseString(line).getAsJsonObject();int minimum=f.get("min").getAsInt(),height=f.get("height").getAsInt(); + var chunks=new TreeMap(Comparator.comparingInt(p->p.x()).thenComparingInt(p->p.z())); + for(var value:f.getAsJsonArray("chunks")) { + var p=value.getAsJsonArray();var cp=new ChunkPos(p.get(0).getAsInt(),p.get(1).getAsInt()); + var chunk=new ProtoChunk(cp,UpgradeData.EMPTY,LevelHeightAccessor.create(minimum,height),factory,null); + chunk.setPersistedStatus(ChunkStatus.TERRAIN); + if(f.get("prime").getAsBoolean())Heightmap.primeHeightmaps(chunk,EnumSet.allOf(Heightmap.Types.class)); + chunks.put(cp,chunk); + } + var world=(LevelAccessor)Proxy.newProxyInstance(LevelAccessor.class.getClassLoader(),new Class[]{LevelAccessor.class},(proxy,method,values)->switch(method.getName()) { + case "getMinY"->minimum; + case "getHeight"->height; + case "getChunk"->{var c=chunks.get(new ChunkPos((Integer)values[0],(Integer)values[1]));if(c==null)throw new IllegalArgumentException("missing chunk");yield c;} + default->{if(method.isDefault())yield InvocationHandler.invokeDefault(proxy,method,values);throw new AssertionError(method);} + }); + var bulk=new BulkSectionAccess(world); + try { + for(var value:f.getAsJsonArray("ops")) { + var op=value.getAsJsonArray();String kind=op.get(0).getAsString(); + try { + if(kind.equals("reset")){bulk.close();bulk=new BulkSectionAccess(world);out.println("reset");} + else if(kind.equals("height")) { + int x=op.get(2).getAsInt(),z=op.get(3).getAsInt(); + out.println("height "+(chunk(chunks,x,z).getHeight(Heightmap.Types.valueOf(op.get(1).getAsString()),x&15,z&15)+1)); + } else { + var p=new BlockPos(op.get(1).getAsInt(),op.get(2).getAsInt(),op.get(3).getAsInt()); + switch(kind) { + case "get"->out.println("get "+Block.getId(bulk.getBlockState(p))); + case "world"->out.println("world "+Block.getId(chunk(chunks,p.getX(),p.getZ()).getBlockState(p))); + case "has"->out.println("has "+(bulk.getSection(p)!=null)); + case "set"->{var section=bulk.getSection(p);if(section==null)out.println("set none");else out.println("set "+Block.getId(section.setBlockState(p.getX()&15,p.getY()&15,p.getZ()&15,Block.stateById(op.get(4).getAsInt()),false)));} + default->throw new AssertionError(kind); + } + } + } catch(IllegalArgumentException error){out.println("error");} + out.println("cache "+count(bulk)); + } + } finally {bulk.close();} + for(var entry:chunks.entrySet()) { + var cp=entry.getKey();var chunk=entry.getValue();out.println("chunk "+cp.x()+" "+cp.z()); + for(var kind:Heightmap.Types.values()) { + if(chunk.hasPrimedHeightmap(kind)){out.println("map "+kind.name());for(long word:chunk.getOrCreateHeightmapUnprimed(kind).getRawData())out.println(Long.toUnsignedString(word,16));} + else out.println("missing "+kind.name()); + } + for(int i=0;iout.println("column "+x+" "+z+" "+low+" "+high));out.println("next "+random.nextLong()); + } + } + out.println("tail "+random.nextLong()); + } + } + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCarvingGeometryOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCarvingGeometryOracle.java new file mode 100644 index 000000000..a7524b27d --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCarvingGeometryOracle.java @@ -0,0 +1,43 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.nio.file.*; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.chunk.*; +import net.minecraft.world.level.levelgen.carver.WorldCarver; + +/** Original transport invoking native shared cave/canyon geometry. */ +public final class VanillaCarvingGeometryOracle { + private static double d(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + private static float f(JsonElement v){return Float.intBitsToFloat(Integer.parseUnsignedInt(v.getAsString(),16));} + private static String bits(double v){return Long.toHexString(Double.doubleToLongBits(v));} + private static final class OutputFailure extends RuntimeException {} + public static void main(String[] args) throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); + Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt"),StandardCharsets.UTF_8))) { + for(String line:Files.readAllLines(dir.resolve("inputs.txt"))) { + var input=JsonParser.parseString(line).getAsJsonObject();var cp=input.getAsJsonArray("chunk");var chunk=new ChunkPos(cp.get(0).getAsInt(),cp.get(1).getAsInt()); + var mask=new CarvingMask(input.get("min").getAsInt(),input.get("max").getAsInt()); + for(var value:input.getAsJsonArray("ellipsoids")) { + var e=value.getAsJsonObject();var center=e.getAsJsonArray("center");int[] calls={0}; + var output=new CarverOutput(){public int minY(){return mask.minY();}public int maxY(){return mask.maxY();}public void carve(int x,int y,int z){ + out.println("cell "+x+" "+y+" "+z);int previous=calls[0]++;if(previous==e.get("fail").getAsInt())throw new OutputFailure();mask.carve(x,y,z); + }}; + int mode=e.get("skip").getAsInt();boolean ok=true; + try {WorldCarver.carveEllipsoid(chunk,d(center.get(0)),d(center.get(1)),d(center.get(2)),d(e.get("horizontal")),d(e.get("vertical")),output,(x,y,z,by)->{ + boolean skip=switch(mode){case 0->x*x+y*y+z*z>=1;case 1->y<=-0.7||x*x+y*y+z*z>=1;case 2->Math.floorMod(by,3)==0;default->false;}; + out.println("skip "+bits(x)+" "+bits(y)+" "+bits(z)+" "+by+" "+skip);return skip; + });}catch(OutputFailure error){ok=false;} + out.println("ellipsoid "+(ok?"ok":"error")+" "+calls[0]); + mask.visit((x,z,low,high)->out.println("column "+x+" "+z+" "+low+" "+high)); + } + } + for(String line:Files.readAllLines(dir.resolve("reach.txt"))) { + var q=JsonParser.parseString(line).getAsJsonArray(); + out.println("reach "+WorldCarver.canReach(new ChunkPos(q.get(0).getAsInt(),q.get(1).getAsInt()),d(q.get(2)),d(q.get(3)),q.get(4).getAsInt(),q.get(5).getAsInt(),f(q.get(6)))); + } + } + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCarvingMaskOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCarvingMaskOracle.java new file mode 100644 index 000000000..483ab1542 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCarvingMaskOracle.java @@ -0,0 +1,51 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.nio.file.*; +import net.minecraft.world.level.chunk.CarvingMask; + +/** Original transport invoking the pinned vanilla carving mask directly. */ +public final class VanillaCarvingMaskOracle { + private static boolean carve(CarvingMask mask,JsonArray q) { + try {mask.carve(q.get(0).getAsInt(),q.get(1).getAsInt(),q.get(2).getAsInt());return true;} + catch(IndexOutOfBoundsException error){return false;} + } + private static final class VisitorFailure extends RuntimeException {} + public static void main(String[] args) throws Exception { + Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt"),StandardCharsets.UTF_8))) { + for(String line:Files.readAllLines(dir.resolve("inputs.txt"))) { + var f=JsonParser.parseString(line).getAsJsonObject();var mask=new CarvingMask(f.get("min").getAsInt(),f.get("max").getAsInt()); + out.println("mask "+mask.minY()+" "+mask.maxY()); + for(var value:f.getAsJsonArray("ops")) { + var op=value.getAsJsonObject(); + switch(op.get("kind").getAsString()) { + case "carve" -> out.println("carve "+(carve(mask,op.getAsJsonArray("pos"))?"ok":"error")); + case "fill" -> { + var b=op.getAsJsonArray("box");int calls=0; + for(int x=b.get(0).getAsInt();x<=b.get(1).getAsInt();x++)for(int z=b.get(4).getAsInt();z<=b.get(5).getAsInt();z++) { + int low=b.get(2).getAsInt(),high=b.get(3).getAsInt(); + for(int dy=0;dy<=(long)high-low;dy++){mask.carve(x,low+dy,z);calls++;} + } + out.println("fill "+calls); + } + case "visit" -> { + int[] calls={0};boolean ok=true; + try {mask.visit((x,z,low,high)->{ + out.println("column "+x+" "+z+" "+low+" "+high);int previous=calls[0]++; + var points=op.getAsJsonObject("add").get(Integer.toString(previous)); + if(points!=null)for(var q:points.getAsJsonArray())out.println("add "+(carve(mask,q.getAsJsonArray())?"ok":"error")); + if(previous==op.get("fail").getAsInt())throw new VisitorFailure(); + });}catch(VisitorFailure error){ok=false;} + out.println("visit "+(ok?"ok":"error")+" "+calls[0]); + } + case "read" -> {mask.visit((x,z,low,high)->out.println("column "+x+" "+z+" "+low+" "+high));out.println("read");} + default -> throw new IllegalArgumentException("unknown operation"); + } + out.println("empty "+mask.isEmpty()); + } + } + } + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCaveCarverOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCaveCarverOracle.java new file mode 100644 index 000000000..db49b6aff --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCaveCarverOracle.java @@ -0,0 +1,40 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import com.mojang.serialization.JsonOps; +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.nio.file.*; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.chunk.*; +import net.minecraft.world.level.levelgen.*; +import net.minecraft.world.level.levelgen.carver.*; + +/** Original transport calling actual decoded cave carvers and tracing mask writes. */ +public final class VanillaCaveCarverOracle { + private static final class OutputFailure extends RuntimeException {} + public static void main(String[] args) throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();Path dir=Path.of(args[1]); + var contextMethod=VanillaAnchorOracle.class.getDeclaredMethod("context",JsonObject.class);contextMethod.setAccessible(true); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt"),StandardCharsets.UTF_8))) { + for(var line:Files.readAllLines(dir.resolve("inputs.txt"))) { + var f=JsonParser.parseString(line).getAsJsonObject();long seed=f.get("seed").getAsLong(); + var context=(WorldGenerationContext)contextMethod.invoke(null,f); + RandomSource random=f.get("legacy").getAsBoolean()?new LegacyRandomSource(seed):new XoroshiroRandomSource(seed); + var decoded=WorldCarver.DIRECT_CODEC.parse(JsonOps.INSTANCE,JsonParser.parseString(f.get("definition").getAsString())); + if(decoded.result().isEmpty())out.println("decode error");else { + var carver=decoded.result().get();out.println("decode ok"); + var mask=new CarvingMask(context.getMinGenY()+1,context.getMinGenY()+context.getGenDepth()-8); + var t=f.getAsJsonArray("target");var o=f.getAsJsonArray("origin");var target=new ChunkPos(t.get(0).getAsInt(),t.get(1).getAsInt());var origin=new ChunkPos(o.get(0).getAsInt(),o.get(1).getAsInt()); + for(int repeat=0;repeatout.println("column "+x+" "+z+" "+low+" "+high));out.println("next "+random.nextLong()); + } + } + out.println("tail "+random.nextLong()); + } + } + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaChunkStageOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaChunkStageOracle.java new file mode 100644 index 000000000..3e6379837 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaChunkStageOracle.java @@ -0,0 +1,56 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.nio.file.*; +import java.util.*; +import net.minecraft.core.*; +import net.minecraft.world.level.*; +import net.minecraft.world.level.biome.*; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.chunk.*; +import net.minecraft.world.level.chunk.status.ChunkStatus; +import net.minecraft.world.level.levelgen.Heightmap; + +/** Actual pre-light ProtoChunk writes and persisted-status transitions. */ +public final class VanillaChunkStageOracle { + private static final Map STAGES=new HashMap<>(); + public static void main(String[] args) throws Exception { + if(args[0].equals("export")){VanillaHeightmapOracle.main(args);return;} + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); + STAGES.put("empty",ChunkStatus.EMPTY);STAGES.put("structure_starts",ChunkStatus.STRUCTURE_STARTS);STAGES.put("structure_references",ChunkStatus.STRUCTURE_REFERENCES);STAGES.put("biomes",ChunkStatus.BIOMES);STAGES.put("terrain",ChunkStatus.TERRAIN);STAGES.put("features",ChunkStatus.FEATURES); + Path dir=Path.of(args[1]); + Holder biome=Holder.Reference.createStandAlone(new HolderOwner(){},Biomes.PLAINS); + var ids=new IdMapper>();ids.add(biome); + var factory=new PalettedContainerFactory(Strategy.createForBlockStates(Block.BLOCK_STATE_REGISTRY),Blocks.AIR.defaultBlockState(),null,Strategy.createForBiomes(ids),biome,null); + VanillaHeightmapOracle.bindTags(JsonParser.parseString(Files.readString(dir.resolve("tags.json"))).getAsJsonObject()); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt"),StandardCharsets.UTF_8))) { + for(var line:Files.readAllLines(dir.resolve("inputs.txt"))) { + var f=JsonParser.parseString(line).getAsJsonObject();int min=f.get("min").getAsInt(),height=f.get("height").getAsInt();var cp=f.getAsJsonArray("chunk");int cx=cp.get(0).getAsInt(),cz=cp.get(1).getAsInt(); + var chunk=new ProtoChunk(new ChunkPos(cx,cz),UpgradeData.EMPTY,LevelHeightAccessor.create(min,height),factory,null); + out.println("chunk "+cx+" "+cz+" "+min+" "+height); + for(var value:f.getAsJsonArray("ops")) { + var a=value.getAsJsonArray();String op=a.get(0).getAsString(); + switch(op) { + case "stage"->{String name=a.get(1).getAsString();chunk.setPersistedStatus(STAGES.get(name));out.println("stage "+name);} + case "set"->{var p=new BlockPos(a.get(1).getAsInt(),a.get(2).getAsInt(),a.get(3).getAsInt());out.println("set "+Block.getId(chunk.setBlockState(p,Block.stateById(a.get(4).getAsInt()),3)));} + case "get"->out.println("get "+Block.getId(chunk.getBlockState(new BlockPos(a.get(1).getAsInt(),a.get(2).getAsInt(),a.get(3).getAsInt())))); + case "prime"->{int mask=a.get(1).getAsInt();var kinds=EnumSet.noneOf(Heightmap.Types.class);for(var kind:Heightmap.Types.values())if((mask&(1<{for(var kind:Heightmap.Types.values()) { + if(chunk.hasPrimedHeightmap(kind))out.println("height "+kind.name()+" "+chunk.getOrCreateHeightmapUnprimed(kind).getFirstAvailable(a.get(1).getAsInt()&15,a.get(2).getAsInt()&15)); + else out.println("missing "+kind.name()); + }} + case "dump"->{ + for(var kind:Heightmap.Types.values()) { + if(chunk.hasPrimedHeightmap(kind)){out.println("map "+kind.name());for(long word:chunk.getOrCreateHeightmapUnprimed(kind).getRawData())out.println(Long.toUnsignedString(word,16));} + else out.println("missing "+kind.name()); + } + for(int i=0;ithrow new AssertionError(op); + } + } + } + } + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java new file mode 100644 index 000000000..318bb1251 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java @@ -0,0 +1,153 @@ +package dev.horizonlab.parity; + +import java.io.*; +import java.lang.reflect.*; +import java.nio.file.*; +import java.util.*; +import net.minecraft.SharedConstants; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.*; +import net.minecraft.server.Bootstrap; +import net.minecraft.world.level.EmptyBlockGetter; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.*; +import net.minecraft.world.phys.shapes.*; + +/** Exports private runtime data locally and invokes actual vanilla cached-shape queries. */ +public final class VanillaCollisionOracle { + static { SharedConstants.tryDetectVersion(); Bootstrap.bootStrap(); } + private static final Field CACHE, COLLISION, DISCRETE; + private static final Method INDEX; + static { + try { + CACHE = BlockBehaviour.BlockStateBase.class.getDeclaredField("cache"); CACHE.setAccessible(true); + COLLISION = CACHE.getType().getDeclaredField("collisionShape"); COLLISION.setAccessible(true); + DISCRETE = VoxelShape.class.getDeclaredField("shape"); DISCRETE.setAccessible(true); + INDEX = VoxelShape.class.getDeclaredMethod("findIndex", Direction.Axis.class, double.class); INDEX.setAccessible(true); + } catch (ReflectiveOperationException e) { throw new ExceptionInInitializerError(e); } + } + private static VoxelShape cached(BlockState state) throws ReflectiveOperationException { + Object cache = CACHE.get(state); + if (cache == null) return null; + VoxelShape shape = (VoxelShape) COLLISION.get(cache); + if (state.getCollisionShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO) != shape) throw new AssertionError("cached dispatch differs"); + return shape; + } + private static CompoundTag grid(VoxelShape shape) throws ReflectiveOperationException { + CompoundTag tag = new CompoundTag(); + tag.putByte("cube", (byte)(shape instanceof CubeVoxelShape ? 1 : 0)); + int cubeAxes=0;for(Direction.Axis axis:Direction.Axis.values())if(shape.getCoords(axis) instanceof CubePointRange)cubeAxes|=1<();int[] mapping=new int[Block.BLOCK_STATE_REGISTRY.size()];int index=0; + for(var state:Block.BLOCK_STATE_REGISTRY) { + states.add(BlockState.FULL_CODEC.encodeStart(NbtOps.INSTANCE,state).getOrThrow()); + var shape=(VoxelShape)method.invoke(state.getBlock(),state);Integer id=ids.get(shape); + if(id==null){id=shapes.size();ids.put(shape,id);shapes.add(grid(shape));} + mapping[index++]=id; + } + var data=new CompoundTag();data.putInt("DataVersion",SharedConstants.getCurrentVersion().dataVersion().version());data.put("states",states);data.put("shapes",shapes);data.putIntArray("cached_shapes",mapping);return data; + } + private static void write(CompoundTag tag, Path path) throws IOException { + try (DataOutputStream out = new DataOutputStream(Files.newOutputStream(path))) { NbtIo.write(tag, out); } + } + private static void inputValues(PrintWriter out, double... values) { for (double value : values) out.printf(" %016x", Double.doubleToRawLongBits(value)); } + private static void generate(Path base) throws Exception { + ListTag states = new ListTag(), shapes = new ListTag(); CompoundTag defaults = new CompoundTag(); + Map ids = new IdentityHashMap<>();Set grids=new HashSet<>(); int[] mapping = new int[Block.BLOCK_STATE_REGISTRY.size()]; int cachedCount = 0; + for (BlockState state : Block.BLOCK_STATE_REGISTRY) { + int id = states.size(); + if (Block.BLOCK_STATE_REGISTRY.getId(state) != id) throw new AssertionError("non-dense states"); + Tag encoded = BlockState.FULL_CODEC.encodeStart(NbtOps.INSTANCE, state).getOrThrow(); states.add(encoded); + if (state == state.getBlock().defaultBlockState()) defaults.putInt(((CompoundTag)encoded).getStringOr("id", ""), id); + VoxelShape shape = cached(state); + if (shape == null) mapping[id] = -1; + else { + cachedCount++; CompoundTag data = grid(shape);grids.add(data); Integer shapeId = ids.get(shape); + if (shapeId == null) { shapeId = shapes.size(); ids.put(shape, shapeId); shapes.add(data); } + mapping[id] = shapeId; + } + } + CompoundTag registry = new CompoundTag(); registry.putInt("DataVersion", SharedConstants.getCurrentVersion().dataVersion().version()); registry.put("states", states); registry.put("defaults", defaults); + write(registry, base.resolve("block-registry.nbt")); + CompoundTag collision = new CompoundTag(); collision.putInt("DataVersion", SharedConstants.getCurrentVersion().dataVersion().version()); collision.put("states", states); collision.put("shapes", shapes); collision.putIntArray("cached_shapes", mapping); + write(collision, base.resolve("cached-collision.nbt")); + Random random = new Random(0x484f52495a4f4eL); + try (PrintWriter out = new PrintWriter(Files.newBufferedWriter(base.resolve("inputs.txt")))) { + for (int id = 0; id < mapping.length; id++) { + if (mapping[id] < 0) continue; + for (int scenario = 0; scenario < 6; scenario++) { + BlockPos offset = switch(scenario % 3) { case 0 -> BlockPos.ZERO; case 1 -> new BlockPos(-17,-64,-1); default -> new BlockPos(30_000_000,64,-30_000_000); }; + double[] origin = {offset.getX(),offset.getY(),offset.getZ()}; double[] lower = new double[3], upper = new double[3], start = new double[3], end = new double[3], point = new double[3]; + for (int axis = 0; axis < 3; axis++) { + lower[axis] = origin[axis] + (scenario < 3 ? -.6 + axis * .4 : random.nextDouble() * 4 - 2); + upper[axis] = lower[axis] + (axis == 1 ? 1.8 : .6); + start[axis] = origin[axis] + (scenario < 3 ? (axis == 0 ? -1 : .5) : random.nextDouble() * 3 - 1); + end[axis] = origin[axis] + (scenario < 3 ? (axis == 0 ? 2 : .5) : random.nextDouble() * 3 - 1); + point[axis] = origin[axis] + random.nextDouble() * 3 - 1; + } + out.print(id); out.printf(" %d %d %d",offset.getX(),offset.getY(),offset.getZ()); + inputValues(out, lower); inputValues(out, upper); inputValues(out, start); inputValues(out, end); inputValues(out, point); + inputValues(out, scenario == 4 ? 1e-8 : scenario == 5 ? -1e-7 : random.nextDouble() * 4 - 2); out.println(); + } + } + } + System.out.printf("HORIZON_COLLISION_RESULT {\"registry_states\":%d,\"cached_states\":%d,\"uncached_states\":%d,\"unique_shapes\":%d,\"unique_grids\":%d,\"queries\":%d}%n", mapping.length,cachedCount,mapping.length-cachedCount,shapes.size(),grids.size(),cachedCount*6); + } + private static void values(PrintWriter out, String label, double... values) { out.print(label); for (double value : values) out.printf(" %016x",Double.doubleToLongBits(value)); out.println(); } + private static void box(PrintWriter out, String label, AABB b) { values(out,label,b.minX,b.minY,b.minZ,b.maxX,b.maxY,b.maxZ); } + private static void hit(PrintWriter out, BlockHitResult h) { + if (h == null) out.println("hit none"); else {Vec3 v=h.getLocation(); out.printf("hit %d %d %016x %016x %016x%n",h.getDirection().ordinal(),h.isInside()?1:0,Double.doubleToLongBits(v.x),Double.doubleToLongBits(v.y),Double.doubleToLongBits(v.z));} + } + private static final class Input { + String[] words; int index; + Input(String line) {words=line.split(" ");} + int integer() {return Integer.parseInt(words[index++]);} + double number() {return Double.longBitsToDouble(Long.parseUnsignedLong(words[index++],16));} + Vec3 vector() {return new Vec3(number(),number(),number());} + } + private static void verify(Path base, String side) throws Exception { + try (PrintWriter out = new PrintWriter(Files.newBufferedWriter(base.resolve("vanilla-"+side+".txt")))) { + IdentityHashMap identities=new IdentityHashMap<>(); + for (BlockState state : Block.BLOCK_STATE_REGISTRY) { + VoxelShape shape=cached(state); int id=Block.BLOCK_STATE_REGISTRY.getId(state); + if (shape==null) {out.printf("state %d uncached%n",id); continue;} + List boxes=shape.toAabbs(); out.printf("state %d cached %d%n",id,boxes.size()); + out.printf("identity %d%n",identities.computeIfAbsent(shape,key->identities.size())); + int cubeAxes=0;for(Direction.Axis axis:Direction.Axis.values())if(shape.getCoords(axis) instanceof CubePointRange)cubeAxes|=1< nearest=moved.closestPointTo(point); if(nearest.isEmpty()) out.println("closest none"); else values(out,"closest",nearest.get().x,nearest.get().y,nearest.get().z); + out.printf("index %d %d %d%n",INDEX.invoke(moved,Direction.Axis.X,point.x),INDEX.invoke(moved,Direction.Axis.Y,point.y),INDEX.invoke(moved,Direction.Axis.Z,point.z)); + if(in.index!=in.words.length) throw new AssertionError("trailing input"); + } + } + } + } + public static void main(String[] args) throws Exception { Path base=Path.of(args[1]); if(args[0].equals("generate"))generate(base);else verify(base,args[0]); } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCoreOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCoreOracle.java new file mode 100644 index 000000000..a2e66cee7 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCoreOracle.java @@ -0,0 +1,161 @@ +package dev.horizonlab.parity; + +import java.io.BufferedReader; +import java.io.PrintWriter; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Arrays; +import java.util.StringTokenizer; +import net.minecraft.core.BlockPos; +import net.minecraft.core.IdMapper; +import net.minecraft.core.SectionPos; +import net.minecraft.util.RandomSource; +import net.minecraft.util.SimpleBitStorage; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.chunk.Strategy; +import net.minecraft.world.level.levelgen.LegacyRandomSource; +import net.minecraft.world.level.levelgen.XoroshiroRandomSource; +import net.minecraft.world.level.levelgen.PositionalRandomFactory; +import net.minecraft.world.level.levelgen.RandomSupport; +import net.minecraft.util.Mth; + +/** Original test adapter. Calls downloaded vanilla classes, never reimplements them. */ +public final class VanillaCoreOracle { + private static final int[] BOUNDS = {1, 2, 3, 16, 31, 256, 65537, 1073741825, Integer.MAX_VALUE, 0, -1}; + private static final Strategy BLOCKS = Strategy.createForBlockStates(new IdMapper<>()); + + private static int integer(StringTokenizer args) { return Integer.parseInt(args.nextToken()); } + private static long longValue(StringTokenizer args) { return Long.parseLong(args.nextToken()); } + private static String utf16(String token) { + if(token.equals("-"))return ""; + char[] units=new char[token.length()/4];for(int i=0;i Integer.toString(rng.nextInt()); + case 1 -> Long.toString(rng.nextLong()); + case 2 -> { + try { yield Integer.toString(rng.nextInt(BOUNDS[(i / 10) % BOUNDS.length])); } + catch (IllegalArgumentException e) { yield "error"; } + } + case 3 -> rng.nextBoolean() ? "1" : "0"; + case 4 -> Integer.toUnsignedString(Float.floatToRawIntBits(rng.nextFloat())); + case 5 -> Long.toUnsignedString(Double.doubleToRawLongBits(rng.nextDouble())); + case 6 -> Long.toString(rng.fork().nextLong()); + case 7 -> { + rng.consumeCount(i % 7 - 2); + yield Long.toString(rng.nextLong()); + } + case 8 -> { + if (i % 101 == 8) rng.setSeed(rng.nextLong() - i); + yield Integer.toString(rng.nextInt(1073741825)); + } + default -> throw new AssertionError(); + }; + out.println("rng " + i + " " + value); + } + } + + private static void probe(String line, PrintWriter out) { + StringTokenizer args = new StringTokenizer(line); + switch (args.nextToken()) { + case "helpers" -> { + String kind=args.nextToken();long seed=longValue(args);int min=integer(args),max=integer(args); + double mean=Double.longBitsToDouble(Long.parseUnsignedLong(args.nextToken(),16)),deviation=Double.longBitsToDouble(Long.parseUnsignedLong(args.nextToken(),16)); + float smallMean=Float.intBitsToFloat(Integer.parseUnsignedInt(args.nextToken(),16)),smallDeviation=Float.intBitsToFloat(Integer.parseUnsignedInt(args.nextToken(),16)); + RandomSource source=kind.equals("legacy")?new LegacyRandomSource(seed):new XoroshiroRandomSource(seed); + for(int i=0;i<32;i++) { + String inclusive,exclusive; + try { inclusive=Integer.toString(source.nextIntBetweenInclusive(min,max)); } catch(IllegalArgumentException e) { inclusive="error"; } + try { exclusive=Integer.toString(source.nextInt(min,max)); } catch(IllegalArgumentException e) { exclusive="error"; } + String d=Long.toUnsignedString(Double.doubleToLongBits(source.triangle(mean,deviation))); + String f=Integer.toUnsignedString(Float.floatToIntBits(source.triangle(smallMean,smallDeviation))); + out.printf("helpers %d %s %s %s %s %d%n",i,inclusive,exclusive,d,f,source.nextLong()); + } + random(out,source,24); + } + case "factory" -> { + String kind=args.nextToken();int mode=integer(args);long lo=longValue(args),hi=longValue(args); + BlockPos position=new BlockPos(integer(args),integer(args),integer(args));long seed=longValue(args);String name=utf16(args.nextToken());int count=integer(args); + RandomSource source=kind.equals("legacy")?new LegacyRandomSource(lo):new XoroshiroRandomSource(lo); + PositionalRandomFactory factory=mode!=0?source.forkPositional():kind.equals("legacy")?new LegacyRandomSource.LegacyPositionalRandomFactory(lo):new XoroshiroRandomSource.XoroshiroPositionalRandomFactory(lo,hi); + var hash=RandomSupport.seedFromHashOf(name);out.printf("seeds %d %d %d %d%n",Mth.getSeed(position),name.hashCode(),hash.seedLo(),hash.seedHi()); + out.println("factory at");random(out,factory.at(position),count);out.println("factory seed");random(out,factory.fromSeed(seed),count);out.println("factory hash");random(out,factory.fromHashOf(name),count); + if(mode!=0)out.println("parent "+source.nextLong()); + } + case "position" -> { + BlockPos p = new BlockPos(integer(args), integer(args), integer(args)); + BlockPos offset = p.offset(integer(args), integer(args), integer(args)); + long packed = p.asLong(); + BlockPos decoded = BlockPos.of(packed); + SectionPos section = SectionPos.of(p); + long sp = section.asLong(); + SectionPos sd = SectionPos.of(sp); + ChunkPos chunk = ChunkPos.containing(p); + long cp = chunk.pack(); + ChunkPos cd = ChunkPos.unpack(cp); + short relative = SectionPos.sectionRelativePos(p); + BlockPos rebuilt = section.relativeToBlockPos(relative); + out.printf("position %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d%n", + packed, decoded.getX(), decoded.getY(), decoded.getZ(), sp, sd.x(), sd.y(), sd.z(), + cp, cd.x(), cd.z(), chunk.getRegionX(), chunk.getRegionZ(), chunk.getRegionLocalX(), chunk.getRegionLocalZ(), + Short.toUnsignedInt(relative), BLOCKS.getIndex(p.getX() & 15, p.getY() & 15, p.getZ() & 15), + rebuilt.getX(), rebuilt.getY(), rebuilt.getZ(), offset.getX(), offset.getY(), offset.getZ()); + } + case "legacy" -> random(out, new LegacyRandomSource(longValue(args)), integer(args)); + case "xoroshiro" -> random(out, new XoroshiroRandomSource(longValue(args)), integer(args)); + case "xoroshiro_state" -> random(out, new XoroshiroRandomSource(longValue(args), longValue(args)), integer(args)); + case "storage" -> { + int bits = integer(args); + int len = integer(args); + long seed = longValue(args); + SimpleBitStorage storage = new SimpleBitStorage(bits, len); + RandomSource rng = new LegacyRandomSource(seed); + long mask = Math.min((1L << bits) - 1, Integer.MAX_VALUE); + for (int i = 0; i < len * 3; i++) { + int index = rng.nextInt(len); + int value = (int) (Integer.toUnsignedLong(rng.nextInt()) & mask); + int old = storage.getAndSet(index, value); + out.println("set " + i + " " + index + " " + Integer.toUnsignedString(old) + " " + Integer.toUnsignedString(storage.get(index))); + } + for (int i = 0; i < storage.getRaw().length; i++) out.println("word " + i + " " + storage.getRaw()[i]); + int[] unpacked = new int[len]; + storage.unpack(unpacked); + for (int i = 0; i < len; i++) out.println("value " + i + " " + unpacked[i]); + long[] words = new long[storage.getRaw().length]; + Arrays.fill(words, -1L); + SimpleBitStorage imported = new SimpleBitStorage(bits, len, words); + for (int i = 0; i < len; i++) out.println("import " + i + " " + imported.get(i)); + if (len > 0) imported.set(len - 1, 0); + for (int i = 0; i < words.length; i++) out.println("import_word " + i + " " + words[i]); + for (int value : new int[]{0, 1, (int) mask}) { + imported.fill(value); + for (int i = 0; i < words.length; i++) out.println("fill " + value + " " + i + " " + words[i]); + } + long[] before = storage.getRaw().clone(); + try { storage.set(len, 0); out.println("invalid_index 0"); } + catch (IllegalArgumentException e) { out.println("invalid_index 1"); } + if (len > 0) { + try { storage.set(0, bits == 32 ? -1 : 1 << bits); out.println("invalid_value 0"); } + catch (IllegalArgumentException e) { out.println("invalid_value 1"); } + } + out.println("unchanged " + (Arrays.equals(before, storage.getRaw()) ? "1" : "0")); + } + default -> throw new IllegalArgumentException("unknown operation"); + } + if (args.hasMoreTokens()) throw new IllegalArgumentException("unexpected trailing argument"); + } + + public static void main(String[] args) throws Exception { + try (BufferedReader input = Files.newBufferedReader(Path.of(args[0]), StandardCharsets.UTF_8); + PrintWriter out = new PrintWriter(Files.newBufferedWriter(Path.of(args[1]), StandardCharsets.UTF_8))) { + String line; + while ((line = input.readLine()) != null) probe(line, out); + if (out.checkError()) throw new IllegalStateException("oracle output failed"); + } + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDecorationOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDecorationOracle.java new file mode 100644 index 000000000..2af6d7627 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDecorationOracle.java @@ -0,0 +1,102 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import com.mojang.serialization.*; +import java.io.*; +import java.lang.reflect.*; +import java.nio.charset.StandardCharsets; +import java.nio.file.*; +import java.util.*; +import java.util.function.*; +import net.minecraft.core.*; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.*; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.*; +import net.minecraft.world.level.biome.*; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.chunk.*; +import net.minecraft.world.level.levelgen.*; +import net.minecraft.world.level.levelgen.feature.Feature; +import net.minecraft.world.level.levelgen.placement.*; +import net.minecraft.world.level.levelgen.structure.Structure; + +/** Actual chunk decoration, with structures disabled and traced feature sinks. */ +public final class VanillaDecorationOracle { + private static final class Stop extends RuntimeException {} + public static void main(String[] args) throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); + Path dir=Path.of(args[1]); + var contextMethod=VanillaPlacementOracle.class.getDeclaredMethod("context",JsonObject.class);contextMethod.setAccessible(true); + var settingsConstructor=BiomeGenerationSettings.class.getDeclaredConstructor(HolderSet.class,List.class);settingsConstructor.setAccessible(true); + var getter=ChunkGenerator.class.getDeclaredField("generationSettingsGetter");getter.setAccessible(true); + var stepsField=ChunkGenerator.class.getDeclaredField("featuresPerStep");stepsField.setAccessible(true); + var possibleField=BiomeSource.class.getDeclaredField("possibleBiomes");possibleField.setAccessible(true); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt"),StandardCharsets.UTF_8))) { + for(var line:Files.readAllLines(dir.resolve("inputs.txt"))) { + var f=JsonParser.parseString(line).getAsJsonObject();int min=f.get("min").getAsInt(),height=f.get("height").getAsInt(); + int biomeCount=f.getAsJsonArray("biomes").size(),featureCount=f.getAsJsonArray("placements").size(); + var holders=new ArrayList>();var ids=new IdMapper>(); + for(int i=0;i<=biomeCount;i++){var holder=Holder.Reference.createStandAlone(new HolderOwner(){},ResourceKey.create(Registries.BIOME,Identifier.parse("horizon:b"+i)));holders.add(holder);ids.add(holder);} + var bounds=new JsonObject();bounds.add("context",JsonParser.parseString("[-64,384,63]")); + var generator=((PlacementContext)contextMethod.invoke(null,bounds)).generator(); + var placed=new MappedRegistry(Registries.PLACED_FEATURE,Lifecycle.stable()); + var structures=new MappedRegistry(Registries.STRUCTURE,Lifecycle.stable());structures.freeze(); + int[] calls={0},queries={0},notifications={0},chunksRead={0}; + var features=new ArrayList(); + for(int i=0;i codec(){return MapCodec.unit(this);} + public boolean place(WorldGenLevel w,ChunkGenerator g,RandomSource r,BlockPos p){ + out.println("feature "+id+" "+p.getX()+" "+p.getY()+" "+p.getZ()); + out.println("draw "+r.nextLong()+" "+r.nextInt(17)+" "+Integer.toHexString(Float.floatToRawIntBits(r.nextFloat()))+" "+Long.toHexString(Double.doubleToRawLongBits(r.nextDouble()))); + if(calls[0]++==f.get("feature_fail").getAsInt())throw new Stop(); + return f.get("return_mode").getAsInt()==0||(f.get("return_mode").getAsInt()==2&&id%2==0); + } + }; + var modifiers=new ArrayList();for(var value:f.getAsJsonArray("placements").get(i).getAsJsonArray())modifiers.add(PlacementModifier.CODEC.parse(JsonOps.INSTANCE,value).getOrThrow()); + var root=new PlacedFeature(Holder.direct(leaf),modifiers);features.add(root); + placed.register(ResourceKey.create(Registries.PLACED_FEATURE,Identifier.parse("horizon:f"+i)),root,RegistrationInfo.BUILT_IN); + } + placed.freeze(); + var settings=new ArrayList(); + for(var value:f.getAsJsonArray("biomes")) { + var steps=new ArrayList>(); + for(var step:value.getAsJsonArray()){var roots=new ArrayList>();for(var root:step.getAsJsonArray())roots.add(Holder.direct(features.get(root.getAsInt())));steps.add(HolderSet.direct(roots));} + settings.add(settingsConstructor.newInstance(HolderSet.direct(List.of()),steps)); + } + settings.add(settingsConstructor.newInstance(HolderSet.direct(List.of()),List.of())); + Function,BiomeGenerationSettings> settingsGetter=biome->settings.get(ids.getId(biome));getter.set(generator,settingsGetter); + var possible=new LinkedHashSet>(holders.subList(0,biomeCount));possibleField.set(generator.getBiomeSource(),(Supplier>>)(()->possible)); + List sorted; + try {sorted=FeatureSorter.buildFeaturesPerStep(new ArrayList<>(possible),b->settingsGetter.apply(b).features(),true);} + catch(IllegalStateException error){out.println("plan error");continue;} + stepsField.set(generator,(Supplier>)(()->sorted));out.println("plan ok"); + var factory=new PalettedContainerFactory(Strategy.createForBlockStates(Block.BLOCK_STATE_REGISTRY),Blocks.AIR.defaultBlockState(),null,Strategy.createForBiomes(ids),holders.get(biomeCount),null); + var cp=new ChunkPos(f.get("cx").getAsInt(),f.get("cz").getAsInt());var chunks=new HashMap(); + var palettes=f.getAsJsonArray("palettes");int ordinal=0; + for(int dz=-1;dz<=1;dz++)for(int dx=-1;dx<=1;dx++) { + var pos=new ChunkPos(cp.x()+dx,cp.z()+dz);var chunk=new ProtoChunk(pos,UpgradeData.EMPTY,LevelHeightAccessor.create(min,height),factory,null); + final var values=palettes.get(ordinal++).getAsJsonArray(); + chunk.fillBiomesFromNoise((x,y,z)->holders.get(values.get(Math.floorMod((y-(min>>2))*16+(z&3)*4+(x&3),values.size())).getAsInt()));chunks.put(pos,chunk); + } + var access=new RegistryAccess.ImmutableRegistryAccess(List.of(structures,placed)).freeze(); + var world=(WorldGenLevel)Proxy.newProxyInstance(WorldGenLevel.class.getClassLoader(),new Class[]{WorldGenLevel.class},(proxy,method,values)->switch(method.getName()) { + case "getMinY"->min;case "getHeight"->height;case "getSeaLevel"->63; + case "getMinSectionY"->InvocationHandler.invokeDefault(proxy,method,values); + case "getSeed"->f.get("seed").getAsLong();case "registryAccess"->access; + case "getChunk"->{int x=(Integer)values[0],z=(Integer)values[1];out.println("chunk "+x+" "+z);if(chunksRead[0]++==f.get("chunk_fail").getAsInt())throw new Stop();var chunk=chunks.get(new ChunkPos(x,z));if(chunk==null)throw new AssertionError("missing chunk");yield chunk;} + case "setCurrentlyGenerating"->{String label=values[0]==null?"none":((Supplier)values[0]).get().toString();out.println("generating "+label);if(notifications[0]++==f.get("notify_fail").getAsInt())throw new Stop();yield null;} + case "getBiome"->{var p=(BlockPos)values[0];int id=Math.floorMod(p.getX()*31+p.getY()*7+p.getZ()*17+f.get("biome_offset").getAsInt(),biomeCount+1);out.println("biome "+p.getX()+" "+p.getY()+" "+p.getZ()+" "+id);if(queries[0]++==f.get("query_fail").getAsInt())throw new Stop();yield holders.get(id);} + default->throw new AssertionError(method); + }); + var manager=new StructureManager(world,new WorldOptions(f.get("seed").getAsLong(),false,false),null); + for(int repeat=0;repeat<2;repeat++) { + calls[0]=queries[0]=notifications[0]=chunksRead[0]=0; + try {generator.applyBiomeDecoration(world,chunks.get(cp),manager);out.println("decorate ok");} + catch(Stop|net.minecraft.ReportedException error){out.println("decorate error");} + } + } + } + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDecorationRegionOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDecorationRegionOracle.java new file mode 100644 index 000000000..093d6eeed --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDecorationRegionOracle.java @@ -0,0 +1,125 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import com.mojang.serialization.*; +import java.io.*; +import java.lang.reflect.*; +import java.nio.charset.StandardCharsets; +import java.nio.file.*; +import java.util.*; +import java.util.function.*; +import net.minecraft.core.*; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.*; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.*; +import net.minecraft.world.level.biome.*; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.chunk.*; +import net.minecraft.world.level.levelgen.*; +import net.minecraft.world.level.levelgen.feature.Feature; +import net.minecraft.world.level.levelgen.placement.*; +import net.minecraft.world.level.levelgen.structure.Structure; + +/** Actual chunk decoration, with structures disabled and resident block-writing features. */ +public final class VanillaDecorationRegionOracle { + private static final class Stop extends RuntimeException {} + @SuppressWarnings("unchecked") + public static void main(String[] args) throws Exception { + if(args[0].equals("export")){VanillaHeightmapOracle.main(args);return;} + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); + Path dir=Path.of(args[1]); + VanillaHeightmapOracle.bindTags(JsonParser.parseString(Files.readString(dir.resolve("tags.json"))).getAsJsonObject()); + var contextMethod=VanillaPlacementOracle.class.getDeclaredMethod("context",JsonObject.class);contextMethod.setAccessible(true); + var settingsConstructor=BiomeGenerationSettings.class.getDeclaredConstructor(HolderSet.class,List.class);settingsConstructor.setAccessible(true); + var getter=ChunkGenerator.class.getDeclaredField("generationSettingsGetter");getter.setAccessible(true); + var stepsField=ChunkGenerator.class.getDeclaredField("featuresPerStep");stepsField.setAccessible(true); + var possibleField=BiomeSource.class.getDeclaredField("possibleBiomes");possibleField.setAccessible(true); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt"),StandardCharsets.UTF_8))) { + for(var line:Files.readAllLines(dir.resolve("inputs.txt"))) { + var f=JsonParser.parseString(line).getAsJsonObject();int min=f.get("min").getAsInt(),height=f.get("height").getAsInt(); + int biomeCount=f.getAsJsonArray("biomes").size(),featureCount=f.getAsJsonArray("placements").size(); + var holders=new ArrayList>();var ids=new IdMapper>(); + for(int i=0;i<=biomeCount;i++){var holder=Holder.Reference.createStandAlone(new HolderOwner(){},ResourceKey.create(Registries.BIOME,Identifier.parse("horizon:b"+i)));holders.add(holder);ids.add(holder);} + var biomeLookup=new HolderGetter() { + public Optional> get(ResourceKey key) { + return holders.stream().filter(h->h.unwrapKey().orElseThrow().equals(key)).map(h->(Holder.Reference)h).findFirst(); + } + public Optional> get(net.minecraft.tags.TagKey key) {return Optional.empty();} + }; + var ops=RegistryOps.create(JsonOps.INSTANCE,new RegistryOps.RegistryInfoLookup(){public Optional> lookup(ResourceKey> key){ + return key.equals(Registries.BIOME)?(Optional>)(Optional)Optional.of(biomeLookup):Optional.empty(); + }}); + var bounds=new JsonObject();bounds.add("context",JsonParser.parseString("[-64,384,63]")); + var generator=((PlacementContext)contextMethod.invoke(null,bounds)).generator(); + var placed=new MappedRegistry(Registries.PLACED_FEATURE,Lifecycle.stable()); + var structures=new MappedRegistry(Registries.STRUCTURE,Lifecycle.stable());structures.freeze(); + int[] calls={0},queries={0},notifications={0},chunksRead={0}; + var features=new ArrayList(); + for(int i=0;i();for(var value:f.getAsJsonArray("placements").get(i).getAsJsonArray())modifiers.add(PlacementModifier.CODEC.parse(ops,value).getOrThrow()); + var root=new PlacedFeature(Holder.direct(leaf),modifiers);features.add(root); + placed.register(ResourceKey.create(Registries.PLACED_FEATURE,Identifier.parse("horizon:f"+i)),root,RegistrationInfo.BUILT_IN); + } + placed.freeze(); + var settings=new ArrayList(); + for(var value:f.getAsJsonArray("biomes")) { + var steps=new ArrayList>(); + for(var step:value.getAsJsonArray()){var roots=new ArrayList>();for(var root:step.getAsJsonArray())roots.add(Holder.direct(features.get(root.getAsInt())));steps.add(HolderSet.direct(roots));} + settings.add(settingsConstructor.newInstance(HolderSet.direct(List.of()),steps)); + } + settings.add(settingsConstructor.newInstance(HolderSet.direct(List.of()),List.of())); + Function,BiomeGenerationSettings> settingsGetter=biome->settings.get(ids.getId(biome));getter.set(generator,settingsGetter); + var possible=new LinkedHashSet>(holders.subList(0,biomeCount));possibleField.set(generator.getBiomeSource(),(Supplier>>)(()->possible)); + List sorted; + try {sorted=FeatureSorter.buildFeaturesPerStep(new ArrayList<>(possible),b->settingsGetter.apply(b).features(),true);} + catch(IllegalStateException error){out.println("plan error");continue;} + stepsField.set(generator,(Supplier>)(()->sorted));out.println("plan ok"); + var factory=new PalettedContainerFactory(Strategy.createForBlockStates(Block.BLOCK_STATE_REGISTRY),Blocks.AIR.defaultBlockState(),null,Strategy.createForBiomes(ids),holders.get(biomeCount),null); + var cp=new ChunkPos(f.get("cx").getAsInt(),f.get("cz").getAsInt());var chunks=new TreeMap(Comparator.comparingInt(p->p.x()).thenComparingInt(p->p.z())); + var palettes=f.getAsJsonArray("palettes");int ordinal=0; + for(int dz=-1;dz<=1;dz++)for(int dx=-1;dx<=1;dx++) { + var pos=new ChunkPos(cp.x()+dx,cp.z()+dz);var chunk=new ProtoChunk(pos,UpgradeData.EMPTY,LevelHeightAccessor.create(min,height),factory,null); + chunk.setPersistedStatus(switch(f.get("stage").getAsString()){case "terrain"->net.minecraft.world.level.chunk.status.ChunkStatus.TERRAIN;case "biomes"->net.minecraft.world.level.chunk.status.ChunkStatus.BIOMES;default->net.minecraft.world.level.chunk.status.ChunkStatus.EMPTY;}); + for(int x=0;x<16;x++)for(int z=0;z<16;z++) { + chunk.setBlockState(new BlockPos((pos.x()<<4)+x,-56,(pos.z()<<4)+z),Blocks.STONE.defaultBlockState(),3); + if((x+z)%3!=0)chunk.setBlockState(new BlockPos((pos.x()<<4)+x,-48,(pos.z()<<4)+z),Blocks.DIRT.defaultBlockState(),3); + } + final var values=palettes.get(ordinal++).getAsJsonArray(); + chunk.fillBiomesFromNoise((x,y,z)->holders.get(values.get(Math.floorMod((y-(min>>2))*16+(z&3)*4+(x&3),values.size())).getAsInt()));chunks.put(pos,chunk); + } + var zoom=new BiomeManager((x,y,z)->{var chunk=chunks.get(new ChunkPos(x>>2,z>>2));if(chunk==null)throw new Stop();return chunk.getNoiseBiome(x,y,z);},BiomeManager.obfuscateSeed(f.get("seed").getAsLong())); + var access=new RegistryAccess.ImmutableRegistryAccess(List.of(structures,placed)).freeze(); + var world=(WorldGenLevel)Proxy.newProxyInstance(WorldGenLevel.class.getClassLoader(),new Class[]{WorldGenLevel.class},(proxy,method,values)->switch(method.getName()) { + case "getMinY"->min;case "getSeaLevel"->63; + case "getHeight"->{if(values==null||values.length==0)yield height;var kind=(Heightmap.Types)values[0];int x=(Integer)values[1],z=(Integer)values[2];var chunk=chunks.get(new ChunkPos(x>>4,z>>4));if(chunk==null)throw new Stop();yield chunk.getHeight(kind,x&15,z&15)+1;} + case "getMaxY","isInsideBuildHeight","isOutsideBuildHeight","setBlockAndUpdate"->InvocationHandler.invokeDefault(proxy,method,values); + case "getBlockState"->{var p=(BlockPos)values[0];var chunk=chunks.get(new ChunkPos(p.getX()>>4,p.getZ()>>4));if(chunk==null)throw new Stop();yield chunk.getBlockState(p);} + case "setBlock"->{var p=(BlockPos)values[0];var state=(net.minecraft.world.level.block.state.BlockState)values[1];int flags=(Integer)values[2];out.println("write "+p.getX()+" "+p.getY()+" "+p.getZ()+" "+Block.getId(state)+" "+flags);int call=calls[0]++;if(call==f.get("write_fail").getAsInt())throw new Stop();int reject=f.get("reject").getAsInt();boolean result=reject==0||call%reject!=0;if(result){var chunk=chunks.get(new ChunkPos(p.getX()>>4,p.getZ()>>4));if(chunk==null)throw new Stop();chunk.setBlockState(p,state,flags);}out.println("written "+result);yield result;} + case "getMinSectionY"->InvocationHandler.invokeDefault(proxy,method,values); + case "getSeed"->f.get("seed").getAsLong();case "registryAccess"->access; + case "getChunk"->{int x=(Integer)values[0],z=(Integer)values[1];out.println("chunk "+x+" "+z);if(chunksRead[0]++==f.get("chunk_fail").getAsInt())throw new Stop();var chunk=chunks.get(new ChunkPos(x,z));if(chunk==null)throw new AssertionError("missing chunk");yield chunk;} + case "setCurrentlyGenerating"->{String label=values[0]==null?"none":((Supplier)values[0]).get().toString();out.println("generating "+label);if(notifications[0]++==f.get("notify_fail").getAsInt())throw new Stop();yield null;} + case "getBiome"->{var p=(BlockPos)values[0];var biome=zoom.getBiome(p);out.println("biome "+p.getX()+" "+p.getY()+" "+p.getZ()+" "+ids.getId(biome));yield biome;} + default->throw new AssertionError(method); + }); + var manager=new StructureManager(world,new WorldOptions(f.get("seed").getAsLong(),false,false),null); + for(int repeat=0;repeat<2;repeat++) { + calls[0]=queries[0]=notifications[0]=chunksRead[0]=0; + try {generator.applyBiomeDecoration(world,chunks.get(cp),manager);out.println("decorate ok");} + catch(Stop|net.minecraft.ReportedException error){out.println("decorate error");} + for(int[] p:new int[][]{{0,0},{15,15},{16,16},{-1,-1}})for(var kind:Heightmap.Types.values())out.println("height "+kind.name()+" "+p[0]+" "+p[1]+" "+(chunks.get(new ChunkPos(p[0]>>4,p[1]>>4)).getHeight(kind,p[0]&15,p[1]&15)+1)); + } + for(var entry:chunks.entrySet()) { + var pos=entry.getKey();var chunk=entry.getValue();out.println("stored "+pos.x()+" "+pos.z()); + for(var kind:Heightmap.Types.values()) { + if(chunk.hasPrimedHeightmap(kind)){out.println("map "+kind.name());for(long word:chunk.getOrCreateHeightmapUnprimed(kind).getRawData())out.println(Long.toUnsignedString(word,16));} + else out.println("missing "+kind.name()); + } + for(int i=0;i[] types,Object... arguments) throws Exception { + var constructor=Class.forName("net.minecraft.world.level.levelgen.densityfunction.op."+nested).getDeclaredConstructor(types); + constructor.setAccessible(true);return (DensitySampler)constructor.newInstance(arguments); + } + private static void intervalOutput(PrintWriter out,String name,java.util.function.Supplier compute) { + try { var result=compute.get();out.printf("bounds %s %s %s %d %d%n",name,bits(result.min()),bits(result.max()),result.isNaI()?1:0,result.hashCode()); } + catch(IllegalArgumentException | IllegalStateException e) { out.println("bounds "+name+" error"); } + } + private static void fbmProbe(RandomSource random,int octave,double smear,double amplitude,PrintWriter out) throws Exception { + NoiseStack stack; + try { stack=BlendedNoise.createFbm(random,octave,smear,amplitude); } + catch(IllegalArgumentException e) { out.println("fbm error");out.println("fbm-parent "+random.nextLong());return; } + var layersField=NoiseStack.class.getDeclaredField("layers");layersField.setAccessible(true);Object[] layers=(Object[])layersField.get(stack); + out.printf("fbm %d %s %s%n",layers.length,bits(stack.range().min()),bits(stack.range().max())); + for(int i=0;i holder) { return noise; } + public RandomSource createRandom(net.minecraft.resources.Identifier id) { throw new AssertionError("unexpected random lookup"); } + public RandomSource createEndIslandRandom() { throw new AssertionError("unexpected end lookup"); } + }; + } + private static Interval[] splineRanges = {Interval.INFINITE,Interval.INFINITE,Interval.INFINITE}; + private static final class TransportFunction implements DensityFunction { + private final DensitySampler sampler; + private final int id; + TransportFunction(int id,DensitySampler sampler) { this.id=id;this.sampler=sampler; } + public DensitySampler compileSampler(DensityFunction.CompileContext context) { return sampler; } + public DensityFunction rewriteChildren(DfRewriteRule rule) { return this; } + public Interval range() { return splineRanges[id % 3]; } + public int domainAxes() { return 7; } + public com.mojang.serialization.MapCodec codec() { throw new AssertionError("unexpected codec lookup"); } + } + private static final class BoundFunction implements DensityFunction { + private final DensitySampler sampler; + private final Interval range; + private final int axes; + BoundFunction(DensitySampler sampler,Interval range,int axes){this.sampler=sampler;this.range=range;this.axes=axes;} + public DensitySampler compileSampler(DensityFunction.CompileContext context){return sampler;} + public DensityFunction rewriteChildren(DfRewriteRule rule){return this;} + public Interval range(){return range;} + public int domainAxes(){return axes;} + public com.mojang.serialization.MapCodec codec(){throw new AssertionError("unexpected codec lookup");} + } + private static int cacheCount(DensityFunctionCompiler compiler) throws Exception { + var field=DensityFunctionCompiler.class.getDeclaredField("nextCacheId");field.setAccessible(true);return field.getInt(compiler); + } + // The concrete structure key has an erased DensitySampler runtime contract. + // Widen it solely to attach transport samplers that expose delegation calls. + @SuppressWarnings("unchecked") + private static net.minecraft.util.context.ContextKey structureKey() { + return (net.minecraft.util.context.ContextKey)(net.minecraft.util.context.ContextKey)Beardifier.CONTEXT_KEY; + } + public static void main(String[] paths) throws Exception { + net.minecraft.SharedConstants.tryDetectVersion(); + net.minecraft.server.Bootstrap.bootStrap(); + var samplers=new ArrayList(); + var noises=new ArrayList(); + var splines=new ArrayList>(); + var functions=new java.util.HashMap(); + var context=SamplerContext.EMPTY_UNCACHED; + var counters=new ArrayList(); + var graph=new ArrayList(); + var graphFunctions=new net.minecraft.core.MappedRegistry(net.minecraft.core.registries.Registries.DENSITY_FUNCTION,com.mojang.serialization.Lifecycle.stable()); + var namedFunctions=new java.util.HashMap>(); + var graphSplines=new ArrayList>(); + var graphNoises=new ArrayList>(); + var graphContext=shiftContext(null); + net.minecraft.core.MappedRegistry graphRegistry=null; + long graphWorldSeed=0;boolean graphLegacy=false; + var graphCompiler=new DensityFunctionCompiler(shiftContext(null)); + try(var reader=Files.newBufferedReader(Path.of(paths[0]),StandardCharsets.UTF_8); + var out=new PrintWriter(Files.newBufferedWriter(Path.of(paths[1]),StandardCharsets.UTF_8))) { + String line; + while((line=reader.readLine())!=null) { + var args=new StringTokenizer(line); + switch(args.nextToken()) { + case "constant" -> { samplers.add(new ConstantFunction.Sampler(small(args)));out.println("create "+(samplers.size()-1)); } + case "gradient" -> { + var axis=Axis.values()[integer(args)];var tiling=TilingMode.values()[integer(args)]; + int from=integer(args),to=integer(args);float low=small(args),high=small(args); + samplers.add(new GradientFunction(axis,tiling,from,to,low,high).compileSampler(null)); + out.println("create "+(samplers.size()-1)); + } + case "noise" -> { + String kind=args.nextToken(),stream=args.nextToken();long seed=Long.parseLong(args.nextToken());double scale=number(args); + RandomSource random=stream.equals("legacy")?new LegacyRandomSource(seed):new XoroshiroRandomSource(seed); + Noise noise=switch(kind) { case "normal"->NormalNoise.builder().setBaseOctave(-7).setOctaveCount(4).build().create(random);case "perlin"->new PerlinNoise(random);case "simplex"->new SimplexNoise(random);case "smeared"->new SmearedPerlinNoise(random,scale);default->throw new AssertionError(); }; + var sampler=new NoiseFunction.Sampler(noise,number(args),number(args));noises.add(sampler);samplers.add(sampler); + out.printf("noise %d %d%n",noises.size()-1,samplers.size()-1); + } + case "shift" -> { + var noise=noises.get(integer(args));int x=integer(args),y=integer(args),z=integer(args); + samplers.add(y<0?new NoiseFunction.ShiftedXzSampler(samplers.get(x),samplers.get(z),noise.noise(),noise.xzScale(),noise.yScale()):new NoiseFunction.ShiftedXyzSampler(samplers.get(x),samplers.get(y),samplers.get(z),noise.noise(),noise.xzScale(),noise.yScale())); + out.println("create "+(samplers.size()-1)); + } + case "unary" -> { + String kind=args.nextToken();var input=samplers.get(integer(args));float a=small(args),b=small(args); + DensitySampler result=switch(kind) { + case "abs" -> new UnaryFunction.AbsSampler(input); + case "negate" -> new UnaryFunction.NegateSampler(input); + case "square" -> new UnaryFunction.SquareSampler(input); + case "cube" -> new UnaryFunction.CubeSampler(input); + case "sqrt" -> new UnaryFunction.SqrtSampler(input); + case "log" -> new UnaryFunction.LogSampler(input); + case "reciprocal" -> new UnaryFunction.ReciprocalSampler(input); + case "sign" -> new UnaryFunction.SignSampler(input); + case "squeeze" -> new UnaryFunction.SqueezeSampler(input); + case "leaky" -> new UnaryFunction.LeakyReLUSampler(input,a); + case "add" -> new BinaryFunction.ConstAddSampler(input,a); + case "sub" -> new BinaryFunction.ConstSubSampler(a,input); + case "mul" -> new BinaryFunction.ConstMulSampler(input,a); + case "div" -> new BinaryFunction.ConstDivSampler(a,input); + case "min" -> new BinaryFunction.ConstMinSampler(input,a); + case "max" -> new BinaryFunction.ConstMaxSampler(input,a); + case "clamp" -> new ClampFunction.Sampler(input,a,b); + default -> throw new AssertionError(); + }; + samplers.add(result);out.println("create "+(samplers.size()-1)); + } + case "round" -> { + var type=RoundFunction.Type.values()[integer(args)];var input=samplers.get(integer(args));int multiple=integer(args); + var result=multiple<0?construct("RoundFunction$IntegerMultipleSampler",new Class[]{RoundFunction.Type.class,DensitySampler.class},type,input): + construct("RoundFunction$Sampler",new Class[]{RoundFunction.Type.class,DensitySampler.class,DensitySampler.class},type,input,samplers.get(multiple)); + samplers.add(result);out.println("create "+(samplers.size()-1)); + } + case "power" -> { + int mode=integer(args);DensitySampler result; + if(mode==0)result=construct("PowFunction$Sampler",new Class[]{DensitySampler.class,DensitySampler.class},samplers.get(integer(args)),samplers.get(integer(args))); + else if(mode==1)result=construct("PowFunction$ConstBaseSampler",new Class[]{double.class,DensitySampler.class},number(args),samplers.get(integer(args))); + else if(mode==2)result=construct("PowFunction$ConstExponentSampler",new Class[]{DensitySampler.class,double.class},samplers.get(integer(args)),number(args)); + else throw new AssertionError(); + samplers.add(result);out.println("create "+(samplers.size()-1)); + } + case "binary" -> { + String kind=args.nextToken();var left=samplers.get(integer(args));var right=samplers.get(integer(args));float bound=small(args); + DensitySampler result=switch(kind) { + case "add" -> new BinaryFunction.AddSampler(left,right); + case "sub" -> new BinaryFunction.SubSampler(left,right); + case "mul" -> new BinaryFunction.MulSampler(left,right); + case "div" -> new BinaryFunction.DivSampler(left,right); + case "min" -> new BinaryFunction.MinSampler(left,right,bound); + case "max" -> new BinaryFunction.MaxSampler(left,right,bound); + default -> throw new AssertionError(); + }; + samplers.add(result);out.println("create "+(samplers.size()-1)); + } + case "choice" -> { + int mode=integer(args);var input=samplers.get(integer(args));float min=small(args),max=small(args); + DensitySampler result; + if(mode==1)result=construct("RangeChoiceFunction$ConstSampler",new Class[]{DensitySampler.class,float.class,float.class,float.class,float.class},input,min,max,small(args),small(args)); + else result=construct("RangeChoiceFunction$Sampler",new Class[]{DensitySampler.class,float.class,float.class,DensitySampler.class,DensitySampler.class},input,min,max,samplers.get(integer(args)),samplers.get(integer(args))); + samplers.add(result);out.println("create "+(samplers.size()-1)); + } + case "lerp" -> { + int mode=integer(args);var alpha=samplers.get(integer(args)); + DensitySampler result=switch(mode) { + case 0 -> new LerpFunction.Sampler(alpha,samplers.get(integer(args)),samplers.get(integer(args))); + case 1 -> new LerpFunction.ConstFirstSampler(alpha,small(args),samplers.get(integer(args))); + case 2 -> new LerpFunction.ConstSecondSampler(alpha,samplers.get(integer(args)),small(args)); + default -> throw new AssertionError(); + }; + samplers.add(result);out.println("create "+(samplers.size()-1)); + } + case "interval" -> { + int mode=integer(args);var input=samplers.get(integer(args));int count=integer(args); + float[] thresholds=new float[count];for(int i=0;i[]{DensitySampler.class,float[].class,DensitySampler[].class},input,thresholds,branches): + construct("IntervalSelectFunction$SingleThresholdSampler",new Class[]{DensitySampler.class,float.class,DensitySampler.class,DensitySampler.class},input,thresholds[0],branches[0],branches[1]); + samplers.add(result);out.println("create "+(samplers.size()-1)); + } + case "bounds" -> { + int mode=integer(args);float a=small(args),b=small(args),c=small(args),d=small(args),e=small(args),f=small(args); + Interval left; + try { left=switch(mode) {case 0->Interval.of(a,b);case 1->Interval.ofSymmetric(a);case 2->Interval.ofExact(a);case 3->Interval.encapsulating(a,b);case 4->Interval.NaI;case 5->Interval.INFINITE;default->throw new AssertionError();}; } + catch(IllegalArgumentException error) { out.println("bounds create error");break; } + final var first=left;var right=Interval.encapsulating(c,d);var third=Interval.encapsulating(e,f); + intervalOutput(out,"create",()->first);intervalOutput(out,"right",()->right); + intervalOutput(out,"add",()->Interval.add(first,right));intervalOutput(out,"sub",()->Interval.sub(first,right)); + intervalOutput(out,"mul",()->Interval.mul(first,right));intervalOutput(out,"div",()->Interval.div(first,right)); + intervalOutput(out,"min",()->Interval.min(first,right));intervalOutput(out,"max",()->Interval.max(first,right)); + intervalOutput(out,"reciprocal",()->Interval.reciprocal(first));intervalOutput(out,"abs",()->Interval.abs(first)); + intervalOutput(out,"square",()->Interval.square(first));intervalOutput(out,"sign",()->Interval.sign(first)); + intervalOutput(out,"power",()->Interval.pow(first,right)); + intervalOutput(out,"clamp",()->Interval.clamp(first,c,d)); + intervalOutput(out,"log",()->Interval.log(first)); + intervalOutput(out,"lerp-values",()->Interval.lerp(first,c,d));intervalOutput(out,"lerp-ranges",()->Interval.lerp(first,right,third)); + intervalOutput(out,"map-negate",()->Interval.mapMonotonic(first,v->-v));intervalOutput(out,"map-cube",()->Interval.mapMonotonic(first,v->v*v*v)); + intervalOutput(out,"map-sqrt",()->Interval.mapMonotonic(first,v->(float)Math.sqrt(v)));intervalOutput(out,"map-reciprocal",()->Interval.mapMonotonic(first,v->1.0f/v)); + intervalOutput(out,"hull",()->Interval.encapsulating(first,right,third)); + intervalOutput(out,"empty",()->Interval.encapsulating(new Interval[0])); + out.printf("bounds query %d %d %d %d%n",first.contains(e)?1:0,first.intersects(right)?1:0,first.equals(right)?1:0,first.equals(first)?1:0); + } + case "offset" -> { + int kind=integer(args);var contextForShift=shiftContext(noises.get(integer(args)).noise()); + var sampler=switch(kind) {case 0->new ShiftNoiseFunction.Shift(null).compileSampler(contextForShift);case 1->new ShiftNoiseFunction.ShiftA(null).compileSampler(contextForShift);case 2->new ShiftNoiseFunction.ShiftB(null).compileSampler(contextForShift);default->throw new AssertionError();}; + samplers.add(sampler);out.println("create "+(samplers.size()-1)); + } + case "blended", "blendfail" -> { + String stream=args.nextToken();long seed=Long.parseLong(args.nextToken()); + var definition=new BlendedNoise(number(args),number(args),number(args),number(args),number(args)); + intervalOutput(out,"blended",definition::range); + RandomSource random=stream.equals("legacy")?new LegacyRandomSource(seed):new XoroshiroRandomSource(seed); + DensitySampler sampler=null; + try { sampler=definition.compileSampler(random); } catch(IllegalArgumentException e) { } + out.printf("blended %s %d%n",sampler==null?"error":"ok",random.nextLong()); + if(sampler!=null) { samplers.add(sampler);out.println("create "+(samplers.size()-1)); } + } + case "blendfbm" -> { + String stream=args.nextToken();long seed=Long.parseLong(args.nextToken());int octave=integer(args);double smear=number(args),amplitude=number(args); + RandomSource random=stream.equals("legacy")?new LegacyRandomSource(seed):new XoroshiroRandomSource(seed); + fbmProbe(random,octave,smear,amplitude,out); + } + case "distance" -> { + var metric=DistanceMetric.values()[integer(args)];var point=new net.minecraft.core.Vec3i(integer(args),integer(args),integer(args)); + samplers.add(new DistanceToPointFunction(point,metric).compileSampler(null));out.println("create "+(samplers.size()-1)); + } + case "metric" -> { + float x=small(args),y=small(args),z=small(args); + for(var metric:DistanceMetric.values())out.printf("metric %s %s%n",bits(metric.compute(x,y)),bits(metric.compute(x,y,z))); + } + case "wfield" -> { + int field=integer(args),fallback=integer(args); + var key=switch(field){case 0->Blender.ALPHA_KEY;case 1->Blender.OFFSET_KEY;case 2->Beardifier.CONTEXT_KEY;default->throw new AssertionError();}; + samplers.add(fallback<0?SimpleDensityFunction.values()[field].compileSampler(null):new ContextBoundSampler(key,samplers.get(fallback)));out.println("create "+(samplers.size()-1)); + } + case "blenddensity" -> { + samplers.add(new BlendDensityFunction(new BoundFunction(samplers.get(integer(args)),Interval.INFINITE,7)).compileSampler(null));out.println("create "+(samplers.size()-1)); + } + case "context","wcontext" -> { + boolean cached=integer(args)!=0; + var builder=SamplerContext.builder().useBufferArena(new DensityBufferArena() { + public ScopedDensityBuffer acquire(int size) { var result=DensityBufferArena.GLOBAL.acquire(size);result.fill(0.0f);return result; } + public void release(ScopedDensityBuffer buffer) { DensityBufferArena.GLOBAL.release(buffer); } + }); + if(line.startsWith("wcontext ")) { + var fields=ContextMap.builder(); + int alpha=integer(args),offset=integer(args),beard=integer(args),blender=integer(args); + if(alpha>=0)fields.set(Blender.ALPHA_KEY,samplers.get(alpha)); + if(offset>=0)fields.set(Blender.OFFSET_KEY,samplers.get(offset)); + if(beard>=0)fields.set(structureKey(),samplers.get(beard)); + if(blender!=0)fields.set(Blender.CONTEXT_KEY,Blender.empty()); + builder.setUserFields(fields.build()); + } + if(cached)builder.enableCaches();context=builder.build();out.println("context"); + } + case "counted" -> { + var input=samplers.get(integer(args));var calls=new long[2];counters.add(calls); + samplers.add(new DensitySampler() { + public float sampleValue(SamplerContext ctx,int x,int y,int z) { calls[0]++;return input.sampleValue(ctx,x,y,z); } + public void sampleVolume(SamplerContext ctx,DensityBuffer buffer,DensityVolume volume) { calls[1]++;input.sampleVolume(ctx,buffer,volume); } + }); + out.printf("counted %d %d%n",counters.size()-1,samplers.size()-1); + } + case "counts" -> { var calls=counters.get(integer(args));out.printf("counts %d %d%n",calls[0],calls[1]); } + case "greset" -> {graphFunctions=new net.minecraft.core.MappedRegistry<>(net.minecraft.core.registries.Registries.DENSITY_FUNCTION,com.mojang.serialization.Lifecycle.stable());namedFunctions.clear();graph.clear();graphSplines.clear();graphNoises.clear();graphContext=shiftContext(null);graphCompiler=new DensityFunctionCompiler(graphContext);context=SamplerContext.EMPTY_UNCACHED;out.println("graph-reset");} + case "gend" -> {graph.add(new EndIslandFunction());out.println("graph-create "+(graph.size()-1));} + case "gseed" -> { + long seed=Long.parseLong(args.nextToken());boolean legacy=integer(args)!=0; + graphWorldSeed=seed;graphLegacy=legacy; + graphRegistry=new net.minecraft.core.MappedRegistry<>(net.minecraft.core.registries.Registries.NOISE,com.mojang.serialization.Lifecycle.stable()); + // Original fixtures supply constructor-only material inputs; + // RandomState performs all seed derivation and noise creation. + for(var key:java.util.List.of(net.minecraft.world.level.levelgen.Noises.CLAY_BANDS_OFFSET,net.minecraft.world.level.levelgen.Noises.SURFACE,net.minecraft.world.level.levelgen.Noises.SURFACE_SECONDARY,net.minecraft.world.level.levelgen.Noises.BADLANDS_PILLAR,net.minecraft.world.level.levelgen.Noises.BADLANDS_PILLAR_ROOF,net.minecraft.world.level.levelgen.Noises.BADLANDS_SURFACE,net.minecraft.world.level.levelgen.Noises.ICEBERG_PILLAR,net.minecraft.world.level.levelgen.Noises.ICEBERG_PILLAR_ROOF,net.minecraft.world.level.levelgen.Noises.ICEBERG_SURFACE)) + graphRegistry.register(key,NormalNoise.builder().setOctaveCount(0).build(),net.minecraft.core.RegistrationInfo.BUILT_IN); + graphContext=shiftContext(null);graphCompiler=new DensityFunctionCompiler(graphContext); + graphFunctions=new net.minecraft.core.MappedRegistry<>(net.minecraft.core.registries.Registries.DENSITY_FUNCTION,com.mojang.serialization.Lifecycle.stable());namedFunctions.clear();graph.clear();graphSplines.clear();graphNoises.clear();context=SamplerContext.EMPTY_UNCACHED;out.println("graph-seed"); + } + case "gready" -> { + graphRegistry.freeze(); + var zero=DensityFunctions.zero();var router=new net.minecraft.world.level.levelgen.NoiseRouter(zero,zero,zero,zero,zero,zero,zero,zero); + var state=net.minecraft.world.level.levelgen.RandomState.create(graphRegistry,graphWorldSeed,graphLegacy,net.minecraft.world.level.block.Blocks.STONE.defaultBlockState(),63,router); + var compilerField=state.getClass().getDeclaredField("densityFunctionCompiler");compilerField.setAccessible(true);graphCompiler=(DensityFunctionCompiler)compilerField.get(state); + var contextField=DensityFunctionCompiler.class.getDeclaredField("context");contextField.setAccessible(true);graphContext=(DensityFunction.CompileContext)contextField.get(graphCompiler); + out.println("graph-ready"); + } + case "gregister" -> { + String name=args.nextToken();int base=integer(args);double amplitude=number(args);int count=integer(args),normalization=integer(args),modifiers=integer(args); + var builder=NormalNoise.builder().setBaseOctave(base).setBaseAmplitude(amplitude).setOctaveCount(count); + if(normalization==2)builder.setLegacyNormalization();else builder.setNormalize(normalization==1); + for(int i=0;i {var holder=graphNoises.get(integer(args));var a=graphContext.createNoiseSampler(holder);var b=graphContext.createNoiseSampler(holder);out.println("graph-instance "+(a==b?1:0));} + case "gsconstant" -> {graphSplines.add(CubicSpline.constant(small(args)));out.println("graph-spline "+(graphSplines.size()-1));} + case "gspoints" -> { + var coordinate=new SplineFunction.Coordinate(graph.get(integer(args)));int count=integer(args); + var locations=new float[count];var derivatives=new float[count];var values=new ArrayList>(); + for(int i=0;i(coordinate,locations,values,derivatives));out.println("graph-spline "+(graphSplines.size()-1)); + } + case "gref" -> {graph.add(new DensityFunctions.HolderHolder(net.minecraft.core.Holder.direct(graph.get(integer(args)))));out.println("graph-create "+(graph.size()-1));} + case "gnamed" -> { + String name=args.nextToken();var value=graph.get(integer(args)); + // Distinct equal constant objects may have distinct registered holders. + if(value instanceof ConstantFunction constant)value=new ConstantFunction(constant.value()); + var key=net.minecraft.resources.ResourceKey.create(net.minecraft.core.registries.Registries.DENSITY_FUNCTION,net.minecraft.resources.Identifier.parse(name)); + var holder=graphFunctions.register(key,value,net.minecraft.core.RegistrationInfo.BUILT_IN); + // Bind each transport entry immediately, as freeze binds a loaded registry. + var bind=net.minecraft.core.Holder.Reference.class.getDeclaredMethod("bindValue",Object.class);bind.setAccessible(true);bind.invoke(holder,value);namedFunctions.put(name,holder); + graph.add(new DensityFunctions.HolderHolder(holder));out.println("graph-create "+(graph.size()-1)); + } + case "glookup" -> {graph.add(new DensityFunctions.HolderHolder(namedFunctions.get(args.nextToken())));out.println("graph-create "+(graph.size()-1));} + case "gspline" -> {graph.add(new SplineFunction(graphSplines.get(integer(args))));out.println("graph-create "+(graph.size()-1));} + case "gbind" -> { + var sampler=samplers.get(integer(args));var range=Interval.encapsulating(small(args),small(args));int axes=integer(args); + graph.add(new BoundFunction(sampler,range,axes));out.println("graph-create "+(graph.size()-1)); + } + case "gconst","ggradient","gunary","gbinary","gclamp","gchoice","glerp","gslice","gcache","ginterp","gsurface","ginterval","gdistance","gnoise","goffset","gblended","ground","gpow","gwfield","gblenddensity" -> { + String command=line.substring(0,line.indexOf(' ')); + DensityFunction node=switch(command){ + case "gconst"->new ConstantFunction(small(args)); + case "gwfield"->SimpleDensityFunction.values()[integer(args)]; + case "gblenddensity"->new BlendDensityFunction(graph.get(integer(args))); + case "gnoise"->new NoiseFunction(graphNoises.get(integer(args)),number(args),number(args),graph.get(integer(args)),graph.get(integer(args)),graph.get(integer(args))); + case "goffset"->{var noise=graphNoises.get(integer(args));yield switch(integer(args)){case 0->new ShiftNoiseFunction.Shift(noise);case 1->new ShiftNoiseFunction.ShiftA(noise);case 2->new ShiftNoiseFunction.ShiftB(noise);default->throw new AssertionError();};} + case "gblended"->new BlendedNoise(number(args),number(args),number(args),number(args),number(args)); + case "ground"->new RoundFunction(RoundFunction.Type.values()[integer(args)],graph.get(integer(args)),graph.get(integer(args))); + case "gpow"->new PowFunction(graph.get(integer(args)),graph.get(integer(args))); + case "gdistance"->new DistanceToPointFunction(new net.minecraft.core.Vec3i(integer(args),integer(args),integer(args)),DistanceMetric.values()[integer(args)]); + case "ginterval"->{ + var input=graph.get(integer(args));int count=integer(args); + float[] thresholds=new float[count];for(int i=0;i();for(int i=0;i<=count;i++)branches.add(graph.get(integer(args))); + yield new IntervalSelectFunction(input,it.unimi.dsi.fastutil.floats.FloatArrayList.wrap(thresholds),branches); + } + case "ggradient"->new GradientFunction(Axis.values()[integer(args)],TilingMode.values()[integer(args)],integer(args),integer(args),small(args),small(args)); + case "gunary"->new UnaryFunction(UnaryFunction.Type.values()[new int[]{0,1,2,4,5,6,7,8,10,9,3}[integer(args)]],graph.get(integer(args))); + case "gbinary"->new BinaryFunction(BinaryFunction.Type.values()[integer(args)],graph.get(integer(args)),graph.get(integer(args))); + case "gclamp"->new ClampFunction(graph.get(integer(args)),small(args),small(args)); + case "gchoice"->new RangeChoiceFunction(graph.get(integer(args)),small(args),small(args),graph.get(integer(args)),graph.get(integer(args))); + case "glerp"->new LerpFunction(graph.get(integer(args)),graph.get(integer(args)),graph.get(integer(args))); + case "gslice"->new SliceFunction(Axis.values()[integer(args)],integer(args),graph.get(integer(args))); + case "gcache"->new CacheFunction(graph.get(integer(args))); + case "ginterp"->new InterpolatedFunction(graph.get(integer(args)),integer(args),integer(args)); + case "gsurface"->new FindTopSurfaceFunction(graph.get(integer(args)),graph.get(integer(args)),integer(args),integer(args)); + default->throw new AssertionError(); + }; + graph.add(node);out.println("graph-create "+(graph.size()-1)); + } + case "ginfo" -> {var node=graph.get(integer(args));intervalOutput(out,"graph",node::range);out.println("graph-axes "+node.domainAxes());} + case "gsame" -> out.println("graph-same "+(graph.get(integer(args)).equals(graph.get(integer(args)))?1:0)); + case "gcompile","gtry" -> { + String command=line.substring(0,line.indexOf(' '));int mode=integer(args);var node=graph.get(integer(args)); + if(command.equals("gtry")){ + String status="ok"; + try{if(mode==0)node.compileSampler(graphContext);else graphCompiler.getSampler(node);} + catch(IllegalArgumentException | IllegalStateException e){status="error";} + out.printf("graph-try %s %d%n",status,cacheCount(graphCompiler)); + }else{ + var sampler=mode==0?node.compileSampler(graphContext):graphCompiler.getSampler(node); + int same=mode==0?-1:(sampler==graphCompiler.getSampler(node)?1:0); + samplers.add(sampler);out.printf("graph-compile %d %d %d%n",samplers.size()-1,cacheCount(graphCompiler),same); + } + } + case "spconstant" -> { + splines.add(CubicSpline.constant(small(args)));out.println("spline "+(splines.size()-1)); + } + case "sppoints" -> { + int id=integer(args),count=integer(args);var function=functions.computeIfAbsent(id,key->new TransportFunction(key,samplers.get(key))); + var locations=new float[count];var derivatives=new float[count];var values=new ArrayList>(); + for(int i=0;i(new SplineFunction.Coordinate(function),locations,values,derivatives));out.println("spline "+(splines.size()-1)); + } + case "spfail" -> { + var spline=splines.get(integer(args)); + try {new SplineFunction(spline).compileSampler(shiftContext(null));out.println("spline-compile ok");} + catch(IllegalArgumentException e){out.println("spline-compile error");} + } + case "sprange" -> { + var spline=splines.get(integer(args)); + for(int i=0;i<3;i++)splineRanges[i]=Interval.encapsulating(small(args),small(args)); + intervalOutput(out,"spline",spline::range); + java.util.Arrays.fill(splineRanges,Interval.INFINITE); + } + case "spsampler" -> { + samplers.add(new SplineFunction(splines.get(integer(args))).compileSampler(shiftContext(null)));out.println("create "+(samplers.size()-1)); + } + case "surface" -> { + int mode=integer(args);var density=samplers.get(integer(args));var upper=samplers.get(integer(args));int lower=integer(args),height=integer(args); + var sampler=construct("FindTopSurfaceFunction$Sampler",new Class[]{DensitySampler.class,DensitySampler.class,int.class,int.class},density,upper,lower,height); + samplers.add(mode==0?sampler:new SliceFunction.YSampler(sampler,0));out.println("create "+(samplers.size()-1)); + } + case "interpolate" -> { + var input=samplers.get(integer(args));int xz=integer(args),y=integer(args); + samplers.add(construct("InterpolatedFunction$Sampler",new Class[]{DensitySampler.class,int.class,int.class,float.class,float.class},input,xz,y,1.0f/xz,1.0f/y)); + out.println("create "+(samplers.size()-1)); + } + case "slice" -> { + int mode=integer(args);var input=samplers.get(integer(args));int a=integer(args),b=integer(args); + DensitySampler sampler=switch(mode) { + case 0->new SliceFunction.XSampler(input,a); + case 1->new SliceFunction.YSampler(input,a); + case 2->new SliceFunction.ZSampler(input,a); + case 3->new SliceFunction.XzSampler(input,a,b); + default->throw new AssertionError(); + }; + samplers.add(sampler);out.println("create "+(samplers.size()-1)); + } + case "cache" -> { int id=integer(args);samplers.add(new CachingDensitySampler(id,samplers.get(integer(args))));out.println("create "+(samplers.size()-1)); } + case "lookup" -> { + var volume=new DensityVolume(integer(args),integer(args),integer(args),integer(args),integer(args),integer(args),integer(args),integer(args),integer(args)); + out.println("lookup "+volume.indexOfBlock(integer(args),integer(args),integer(args))); + } + case "query" -> { + var sampler=samplers.get(integer(args));int x=integer(args),y=integer(args),z=integer(args); + try { out.println("query "+bits(sampler.sampleValue(context,x,y,z))); } + catch(ArithmeticException e) { out.println("query error"); } + } + case "volume" -> { + var sampler=samplers.get(integer(args)); + int sx=integer(args),sy=integer(args),sz=integer(args),mx=integer(args),my=integer(args),mz=integer(args),dx=integer(args),dy=integer(args),dz=integer(args); + int tail=integer(args);long seed=Long.parseLong(args.nextToken());int repeats=integer(args); + var volume=new DensityVolume(sx,sy,sz,mx,my,mz,dx,dy,dz);var buffer=DensityBuffer.createUnpooled(volume.size()+tail);var random=new LegacyRandomSource(seed); + for(int i=0;i throw new AssertionError(); + } + if(args.hasMoreTokens())throw new AssertionError("extra argument"); + } + if(out.checkError())throw new java.io.IOException("reference output failed"); + } + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDynamicSupportOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDynamicSupportOracle.java new file mode 100644 index 000000000..26619a5b3 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDynamicSupportOracle.java @@ -0,0 +1,55 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*; +import java.lang.reflect.*; +import java.nio.file.*; +import net.minecraft.core.*; +import net.minecraft.world.level.*; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.entity.*; +import net.minecraft.world.level.block.piston.PistonMovingBlockEntity; +import net.minecraft.world.level.block.state.*; +import net.minecraft.world.phys.shapes.*; +/** Native uncached support selection; block-entity lifecycle is outside these snapshots. */ +public final class VanillaDynamicSupportOracle { + private static final class Stop extends RuntimeException {} + @SuppressWarnings("unchecked") public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();Path dir=Path.of(args[1]); + if(args[0].equals("export")) { + VanillaCollisionOracle.main(new String[]{"generate",args[1]}); + VanillaBlockStateCodecOracle.main(new String[]{"export",dir.resolve("facts.json").toString()}); + var cache=BlockBehaviour.BlockStateBase.class.getDeclaredField("cache");cache.setAccessible(true);var ids=new JsonArray();for(var state:Block.BLOCK_STATE_REGISTRY)if(cache.get(state)==null)ids.add(Block.getId(state));Files.writeString(dir.resolve("uncached-states.json"),ids.toString());return; + } + var allocator=Class.forName("sun.misc.Unsafe");var access=allocator.getDeclaredField("theUnsafe");access.setAccessible(true);var unsafe=access.get(null);var allocate=allocator.getMethod("allocateInstance",Class.class); + var progress=PistonMovingBlockEntity.class.getDeclaredField("progress");progress.setAccessible(true);var clipField=PistonMovingBlockEntity.class.getDeclaredField("NOCLIP");clipField.setAccessible(true);var noclip=(ThreadLocal)clipField.get(null); + var shulkerOld=ShulkerBoxBlockEntity.class.getDeclaredField("progressOld");shulkerOld.setAccessible(true);var shulkerProgress=ShulkerBoxBlockEntity.class.getDeclaredField("progress");shulkerProgress.setAccessible(true); + var animation=ShulkerBoxBlockEntity.class.getDeclaredField("animationStatus");animation.setAccessible(true); + var emit=VanillaFaceSupportOracle.class.getDeclaredMethod("emit",PrintWriter.class,VoxelShape.class);emit.setAccessible(true); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var inputs=Files.lines(dir.resolve("inputs.txt"))) { + for(var line:(Iterable)inputs::iterator) { + var f=JsonParser.parseString(line).getAsJsonObject();var state=Block.stateById(f.get("state").getAsInt());var xyz=f.getAsJsonArray("position");var p=new BlockPos(xyz.get(0).getAsInt(),xyz.get(1).getAsInt(),xyz.get(2).getAsInt());String mode=f.get("entity").getAsString(); + Object entity=null; + if(!mode.equals("none")) { + if(mode.equals("other"))entity=allocate.invoke(unsafe,state.getBlock() instanceof ShulkerBoxBlock?PistonMovingBlockEntity.class:ShulkerBoxBlockEntity.class); + else if(mode.equals("piston")) { + var data=f.getAsJsonObject("piston");var moving=new PistonMovingBlockEntity(p,state,Block.stateById(data.get("state").getAsInt()),Direction.values()[data.get("direction").getAsInt()],data.get("extending").getAsBoolean(),data.get("source").getAsBoolean()); + progress.setFloat(moving,Float.intBitsToFloat(Integer.parseUnsignedInt(data.get("progress").getAsString(),16)));entity=moving;int clip=data.get("noclip").getAsInt();noclip.set(clip<0?null:Direction.values()[clip]); + } + else {entity=allocate.invoke(unsafe,ShulkerBoxBlockEntity.class);Object status=null;for(var value:animation.getType().getEnumConstants())if(((Enum)value).name().equals(mode.toUpperCase(java.util.Locale.ROOT)))status=value;if(status==null)throw new AssertionError(mode);animation.set(entity,status);} + } + if(entity instanceof ShulkerBoxBlockEntity && f.has("shulker_progress")){var data=f.getAsJsonArray("shulker_progress");shulkerOld.setFloat(entity,Float.intBitsToFloat(Integer.parseUnsignedInt(data.get(0).getAsString(),16)));shulkerProgress.setFloat(entity,Float.intBitsToFloat(Integer.parseUnsignedInt(data.get(1).getAsString(),16)));} + Object selected=entity;int[] calls={0}; + var world=(BlockGetter)Proxy.newProxyInstance(BlockGetter.class.getClassLoader(),new Class[]{BlockGetter.class},(proxy,method,values)->{ + if(!method.getName().equals("getBlockEntity"))throw new AssertionError(method); + var at=(BlockPos)values[0];out.println("entity "+at.getX()+" "+at.getY()+" "+at.getZ());if(calls[0]++==f.get("fail").getAsInt())throw new Stop();return selected; + }); + var offset=state.getOffset(p);out.printf("offset %016x %016x %016x%n",Double.doubleToRawLongBits(offset.x),Double.doubleToRawLongBits(offset.y),Double.doubleToRawLongBits(offset.z)); + try {emit.invoke(null,out,f.has("collision")&&f.get("collision").getAsBoolean()?state.getCollisionShape(world,p):state.getBlockSupportShape(world,p));}catch(Stop error){out.println("shape error");} + for(var direction:Direction.values())for(var type:SupportType.values()) { + try {out.println("support "+direction.ordinal()+" "+type.ordinal()+" "+state.isFaceSturdy(world,p,direction,type));}catch(Stop error){out.println("support "+direction.ordinal()+" "+type.ordinal()+" error");} + } + out.println("queries "+calls[0]);noclip.remove(); + } + } + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityObstructionOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityObstructionOracle.java new file mode 100644 index 000000000..71e349021 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityObstructionOracle.java @@ -0,0 +1,58 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*; +import java.lang.reflect.*; +import java.nio.file.*; +import java.util.*; +import java.util.function.Predicate; +import net.minecraft.world.entity.*; +import net.minecraft.world.level.EntityGetter; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.shapes.*; +/** Original snapshot transport executing the actual EntityGetter default method. */ +public final class VanillaEntityObstructionOracle { + private static final class Stop extends RuntimeException {} + public static final class Snapshot extends Marker { + boolean spectator; + // Instances are allocated without constructors: the world-owned entity lifecycle is outside this fixture. + public Snapshot(){super(null,null);} + @Override public boolean isSpectator(){return spectator;} + } + private static AABB box(JsonElement value) { + var a=value.getAsJsonArray();double[] v=new double[6]; + for(int i=0;i<6;i++)v[i]=Double.longBitsToDouble(Long.parseUnsignedLong(a.get(i).getAsString(),16)); + return new AABB(v[0],v[1],v[2],v[3],v[4],v[5]); + } + @SuppressWarnings("unchecked") + public static void main(String[] args) throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); + Class allocator=Class.forName("sun.misc.Unsafe");var field=allocator.getDeclaredField("theUnsafe");field.setAccessible(true);var unsafe=field.get(null);var allocate=allocator.getMethod("allocateInstance",Class.class); + var removed=Entity.class.getDeclaredField("removalReason");removed.setAccessible(true);var vehicle=Entity.class.getDeclaredField("vehicle");vehicle.setAccessible(true); + Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var inputs=Files.lines(dir.resolve("inputs.txt"))) { + for(var line:(Iterable)inputs::iterator) { + var f=JsonParser.parseString(line).getAsJsonObject();var entities=new ArrayList(); + for(var value:f.getAsJsonArray("entities")) { + var e=value.getAsJsonObject();var snapshot=(Snapshot)allocate.invoke(unsafe,Snapshot.class); + snapshot.setId(entities.size()+1);snapshot.setBoundingBox(box(e.get("box")));snapshot.blocksBuilding=e.get("building").getAsBoolean();snapshot.spectator=e.get("spectator").getAsBoolean(); + if(e.get("removed").getAsBoolean())removed.set(snapshot,Entity.RemovalReason.DISCARDED); + int parent=e.get("parent").getAsInt();if(parent>=0)vehicle.set(snapshot,entities.get(parent));entities.add(snapshot); + } + VoxelShape shape=Shapes.empty();for(var value:f.getAsJsonArray("shape"))shape=Shapes.or(shape,Shapes.create(box(value))); + int excluded=f.get("exclude").getAsInt();Entity except=excluded<0?null:entities.get(excluded);int[] calls={0}; + var world=(EntityGetter)Proxy.newProxyInstance(EntityGetter.class.getClassLoader(),new Class[]{EntityGetter.class},(proxy,method,values)->{ + if(method.isDefault())return InvocationHandler.invokeDefault(proxy,method,values); + if(!method.getName().equals("getEntities")||values.length!=3)throw new AssertionError(method); + var exceptEntity=(Entity)values[0];var bounds=(AABB)values[1];var predicate=(Predicate)values[2]; + out.printf("query %d %016x %016x %016x %016x %016x %016x%n",exceptEntity==null?-1:exceptEntity.getId(),Double.doubleToRawLongBits(bounds.minX),Double.doubleToRawLongBits(bounds.minY),Double.doubleToRawLongBits(bounds.minZ),Double.doubleToRawLongBits(bounds.maxX),Double.doubleToRawLongBits(bounds.maxY),Double.doubleToRawLongBits(bounds.maxZ)); + calls[0]++;if(f.get("fail").getAsBoolean())throw new Stop(); + var selected=new ArrayList(); + for(var entity:entities)if(entity!=exceptEntity&&entity.getBoundingBox().intersects(bounds)&&predicate.test(entity)){selected.add(entity);out.println("picked "+entity.getId());} + return selected; + }); + try {out.println("clear "+world.isUnobstructed(except,shape));}catch(Stop error){out.println("clear error");} + out.println("queries "+calls[0]); + } + } + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceSupportOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceSupportOracle.java new file mode 100644 index 000000000..4e816024b --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceSupportOracle.java @@ -0,0 +1,56 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*; +import java.lang.reflect.*; +import java.nio.file.*; +import net.minecraft.core.*; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.*; +import net.minecraft.world.level.*; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.state.*; +import net.minecraft.world.phys.*; +import net.minecraft.world.phys.shapes.*; +/** Native face slicing and support algorithms over caller-specified shape data. */ +public final class VanillaFaceSupportOracle { + private static final class SupportBlock extends Block { + VoxelShape shape;int calls; + SupportBlock(){super(BlockBehaviour.Properties.of().setId(ResourceKey.create(Registries.BLOCK,Identifier.parse("horizon:fixture_support"))));} + @Override protected VoxelShape getBlockSupportShape(BlockState state,BlockGetter world,BlockPos pos){calls++;return shape;} + } + private static double number(JsonElement value){return Double.longBitsToDouble(Long.parseUnsignedLong(value.getAsString(),16));} + private static double[] numbers(JsonArray values){double[] result=new double[values.size()];for(int i=0;i)inputs::iterator) { + var f=JsonParser.parseString(line).getAsJsonObject();VoxelShape shape; + if(f.has("coords")) { + var coords=f.getAsJsonArray("coords");double[] x=numbers(coords.get(0).getAsJsonArray()),y=numbers(coords.get(1).getAsJsonArray()),z=numbers(coords.get(2).getAsJsonArray()); + int nx=x.length-1,ny=y.length-1,nz=z.length-1;var bits=new BitSetDiscreteVoxelShape(nx,ny,nz);var occupied=f.getAsJsonArray("occupied"); + for(int i=0;i decodeRoot(RegistryOps ops,JsonObject f) { + var json=JsonParser.parseString(f.get("definition").getAsString()); + if(!f.get("placed_root").getAsBoolean())return Feature.CODEC.parse(ops,json).result().map(Holder::value); + return PlacedFeature.CODEC.parse(ops,json).result().map(holder->new Feature(){ + public com.mojang.serialization.MapCodec codec(){return com.mojang.serialization.MapCodec.unit(this);} + public boolean place(WorldGenLevel world,ChunkGenerator generator,RandomSource random,BlockPos p){return holder.value().place(world,generator,random,p);} + }); + } + @SuppressWarnings("unchecked") + private static RegistryOps loadCatalog(Path dir) throws Exception { + var bundle=JsonParser.parseString(Files.readString(dir.resolve("catalog.json"))).getAsJsonObject(); + var features=new MappedRegistry(Registries.FEATURE,Lifecycle.stable()); + var placed=new MappedRegistry(Registries.PLACED_FEATURE,Lifecycle.stable()); + var ops=RegistryOps.create(JsonOps.INSTANCE,new RegistryOps.RegistryInfoLookup(){public Optional> lookup(ResourceKey> key){ + if(key.equals(Registries.FLUID))return (Optional>)(Optional)Optional.of(net.minecraft.core.registries.BuiltInRegistries.FLUID); + if(key.equals(Registries.BLOCK))return (Optional>)(Optional)Optional.of(net.minecraft.core.registries.BuiltInRegistries.BLOCK); + if(key.equals(Registries.FEATURE))return (Optional>)(Optional)Optional.of(features); + if(key.equals(Registries.PLACED_FEATURE))return (Optional>)(Optional)Optional.of(placed); + return Optional.empty(); + }}); + for(var entry:bundle.getAsJsonObject("features").entrySet())if(!entry.getKey().equals("horizon:composite"))features.register(ResourceKey.create(Registries.FEATURE,Identifier.parse(entry.getKey())),Feature.DIRECT_CODEC.parse(ops,JsonParser.parseString(entry.getValue().getAsString())).getOrThrow(),RegistrationInfo.BUILT_IN); + for(var entry:bundle.getAsJsonObject("placed").entrySet())placed.register(ResourceKey.create(Registries.PLACED_FEATURE,Identifier.parse(entry.getKey())),PlacedFeature.DIRECT_CODEC.parse(ops,JsonParser.parseString(entry.getValue().getAsString())).getOrThrow(),RegistrationInfo.BUILT_IN); + placed.freeze(); + var loader=new TagLoader>((id,required)->placed.get(id).map(value->(Holder)value),"tags/worldgen/placed_feature"); + var definitions=new HashMap>(); + for(var entry:bundle.getAsJsonObject("tags").entrySet()) { + var file=TagFile.CODEC.parse(JsonOps.INSTANCE,JsonParser.parseString(entry.getValue().getAsString())).getOrThrow(); + var values=new ArrayList();for(var value:file.entries())values.add(new TagLoader.EntryWithSource(value,"fixture")); + definitions.put(Identifier.parse(entry.getKey()),values); + } + var tags=new HashMap,List>>(); + loader.build(definitions).forEach((name,values)->tags.put(TagKey.create(Registries.PLACED_FEATURE,name),List.copyOf(values))); + placed.prepareTagReload(new TagLoader.LoadResult<>(Registries.PLACED_FEATURE,tags)).apply(); + features.register(ResourceKey.create(Registries.FEATURE,Identifier.parse("horizon:composite")),Feature.DIRECT_CODEC.parse(ops,JsonParser.parseString(bundle.getAsJsonObject("features").get("horizon:composite").getAsString())).getOrThrow(),RegistrationInfo.BUILT_IN); + features.freeze();return ops; + } + public static void main(String[] args) throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); + final Block[] BLOCKS={Blocks.AIR,Blocks.STONE,Blocks.COBBLESTONE,Blocks.END_STONE,Blocks.OBSIDIAN}; + if(args[0].equals("export")) { + VanillaBlockStateCodecOracle.main(args);return; + } + Path dir=Path.of(args[1]); + var ops=loadCatalog(dir); + var contextMethod=VanillaPlacementOracle.class.getDeclaredMethod("context",JsonObject.class);contextMethod.setAccessible(true); + var bounds=new JsonObject();bounds.add("context",JsonParser.parseString("[-64,384,63]")); + var generator=((PlacementContext)contextMethod.invoke(null,bounds)).generator(); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt"),StandardCharsets.UTF_8))) { + for(var line:Files.readAllLines(dir.resolve("inputs.txt"))) { + var f=JsonParser.parseString(line).getAsJsonObject();long seed=f.get("seed").getAsLong(); + RandomSource random=f.get("legacy").getAsBoolean()?new LegacyRandomSource(seed):new XoroshiroRandomSource(seed); + if(f.get("worldgen").getAsBoolean())random=new WorldgenRandom(random); + Optional decoded; + try {decoded=decodeRoot(ops,f);}catch(IllegalArgumentException|IllegalStateException error){decoded=Optional.empty();} + var modifiers=new ArrayList();boolean valid=true; + if(f.has("placement"))for(var json:f.getAsJsonArray("placement")) { + try {var modifier=PlacementModifier.CODEC.parse(JsonOps.INSTANCE,json).result();if(modifier.isPresent())modifiers.add(modifier.get());else valid=false;} + catch(IllegalArgumentException error){valid=false;} + } + if(decoded.isEmpty()||!valid)out.println("decode error");else { + out.println("decode ok");int[] calls={0};int fail=f.get("fail").getAsInt(),reject=f.get("reject").getAsInt(); + var states=new TreeMap(Comparator.comparingInt(BlockPos::getX).thenComparingInt(BlockPos::getY).thenComparingInt(BlockPos::getZ)); + var world=(WorldGenLevel)Proxy.newProxyInstance(WorldGenLevel.class.getClassLoader(),new Class[]{WorldGenLevel.class},(proxy,method,values)->{ + if(method.getName().equals("getMinY"))return -64; + if(method.getName().equals("getHeight")&&(values==null||values.length==0))return 384; + if(method.getName().equals("getSeaLevel"))return 63; + if(Set.of("getMaxY","isInsideBuildHeight","isOutsideBuildHeight","setBlockAndUpdate").contains(method.getName()))return InvocationHandler.invokeDefault(proxy,method,values); + var p=((BlockPos)values[0]).immutable();int call=calls[0]++; + switch(method.getName()) { + case "getBlockState"->{ + out.println("get "+p.getX()+" "+p.getY()+" "+p.getZ());if(call==fail)throw new Stop(); + var state=states.getOrDefault(p,BLOCKS[Math.floorMod(p.getX()*31+p.getY()*7+p.getZ()*17,5)].defaultBlockState());out.println("state "+Block.getId(state));return state; + } + case "setBlock"->{ + var state=(BlockState)values[1];int flags=(Integer)values[2];out.println("set "+p.getX()+" "+p.getY()+" "+p.getZ()+" "+Block.getId(state)+" "+flags);if(call==fail)throw new Stop(); + boolean result=reject==0||call%reject!=0;if(result)states.put(p,state);out.println("written "+result);return result; + } + default->throw new AssertionError("unexpected world method "+method); + } + }); + var p=f.getAsJsonArray("origin");var origin=new BlockPos(p.get(0).getAsInt(),p.get(1).getAsInt(),p.get(2).getAsInt()); + var placed=new PlacedFeature(Holder.direct(decoded.get()),modifiers);var placer=new FeaturePlacer(world,generator); + for(int repeat=0;repeat decoded; + try {decoded=Feature.DIRECT_CODEC.parse(JsonOps.INSTANCE,JsonParser.parseString(f.get("definition").getAsString())).result();}catch(IllegalArgumentException error){decoded=Optional.empty();} + var modifiers=new ArrayList();boolean valid=true; + if(f.has("placement"))for(var json:f.getAsJsonArray("placement")) { + try {var modifier=PlacementModifier.CODEC.parse(JsonOps.INSTANCE,json).result();if(modifier.isPresent())modifiers.add(modifier.get());else valid=false;} + catch(IllegalArgumentException error){valid=false;} + } + if(decoded.isEmpty()||!valid)out.println("decode error");else { + out.println("decode ok");int[] calls={0};int fail=f.get("fail").getAsInt(),reject=f.get("reject").getAsInt(); + var states=new TreeMap(Comparator.comparingInt(BlockPos::getX).thenComparingInt(BlockPos::getY).thenComparingInt(BlockPos::getZ)); + var world=(WorldGenLevel)Proxy.newProxyInstance(WorldGenLevel.class.getClassLoader(),new Class[]{WorldGenLevel.class},(proxy,method,values)->{ + if(method.getName().equals("getMinY"))return -64; + if(method.getName().equals("getHeight")&&(values==null||values.length==0))return 384; + if(method.getName().equals("getSeaLevel"))return 63; + if(Set.of("getMaxY","isInsideBuildHeight","isOutsideBuildHeight","setBlockAndUpdate").contains(method.getName()))return InvocationHandler.invokeDefault(proxy,method,values); + var p=((BlockPos)values[0]).immutable();int call=calls[0]++; + switch(method.getName()) { + case "getBlockState"->{ + out.println("get "+p.getX()+" "+p.getY()+" "+p.getZ());if(call==fail)throw new Stop(); + var state=states.getOrDefault(p,BLOCKS[Math.floorMod(p.getX()*31+p.getY()*7+p.getZ()*17,5)].defaultBlockState());out.println("state "+Block.getId(state));return state; + } + case "setBlock"->{ + var state=(BlockState)values[1];int flags=(Integer)values[2];out.println("set "+p.getX()+" "+p.getY()+" "+p.getZ()+" "+Block.getId(state)+" "+flags);if(call==fail)throw new Stop(); + boolean result=reject==0||call%reject!=0;if(result)states.put(p,state);out.println("written "+result);return result; + } + default->throw new AssertionError("unexpected world method "+method); + } + }); + var p=f.getAsJsonArray("origin");var origin=new BlockPos(p.get(0).getAsInt(),p.get(1).getAsInt(),p.get(2).getAsInt()); + var placed=new PlacedFeature(Holder.direct(decoded.get()),modifiers);var placer=new FeaturePlacer(world,generator); + for(int repeat=0;repeat();boolean valid=true; + for(var json:f.getAsJsonArray("modifiers")) { + try {var decoded=PlacementModifier.CODEC.parse(JsonOps.INSTANCE,json).result();if(decoded.isPresent())modifiers.add(decoded.get());else valid=false;} + catch(IllegalArgumentException error){valid=false;} + } + if(!valid)out.println("decode error");else { + out.println("decode ok");int[] count={0};int fail=f.get("fail").getAsInt();boolean draw=f.get("draw").getAsBoolean();int mode=f.get("result").getAsInt(); + var feature=new Feature() { + public com.mojang.serialization.MapCodec codec(){return com.mojang.serialization.MapCodec.unit(this);} + public boolean place(WorldGenLevel level,ChunkGenerator generator,RandomSource rng,BlockPos p) { + if(count[0]++==fail)throw new Stop(); + out.println("feature "+p.getX()+" "+p.getY()+" "+p.getZ()); + long value=p.getX()+p.getY()+p.getZ();if(draw){value=rng.nextLong();out.println("consumer "+value);} + boolean result=mode==1||(mode==2&&(value&1)==0);out.println("result "+result);return result; + } + }; + var placed=new PlacedFeature(Holder.direct(feature),modifiers);var placer=new FeaturePlacer(context.getLevel(),context.generator()); + for(var value:f.getAsJsonArray("positions")) { + var p=value.getAsJsonArray();var position=new BlockPos(p.get(0).getAsInt(),p.get(1).getAsInt(),p.get(2).getAsInt());count[0]=0; + try {out.println("place "+placer.place(placed,random,position));}catch(Stop|IllegalArgumentException error){out.println("place error");} + out.println("next "+random.nextLong()); + } + } + out.println("tail "+random.nextLong()); + } + } + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureRegionOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureRegionOracle.java new file mode 100644 index 000000000..a7831c06b --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureRegionOracle.java @@ -0,0 +1,97 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import com.mojang.serialization.JsonOps; +import java.io.*; +import java.lang.reflect.*; +import java.nio.charset.StandardCharsets; +import java.nio.file.*; +import java.util.*; +import net.minecraft.core.*; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.*; +import net.minecraft.world.level.biome.*; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.chunk.*; +import net.minecraft.world.level.chunk.status.ChunkStatus; +import net.minecraft.world.level.levelgen.*; +import net.minecraft.world.level.levelgen.feature.Feature; +import net.minecraft.world.level.levelgen.placement.*; + +/** Native feature placement into resident ProtoChunks through a world transport. */ +public final class VanillaFeatureRegionOracle { + private static ProtoChunk chunk(Map chunks,int x,int z) { + var chunk=chunks.get(new ChunkPos(x>>4,z>>4));if(chunk==null)throw new IllegalArgumentException("missing region chunk");return chunk; + } + public static void main(String[] args) throws Exception { + if(args[0].equals("export")){VanillaHeightmapOracle.main(args);return;} + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); + Path dir=Path.of(args[1]); + Holder biome=Holder.Reference.createStandAlone(new HolderOwner(){},Biomes.PLAINS); + var ids=new IdMapper>();ids.add(biome); + var factory=new PalettedContainerFactory(Strategy.createForBlockStates(Block.BLOCK_STATE_REGISTRY),Blocks.AIR.defaultBlockState(),null,Strategy.createForBiomes(ids),biome,null); + VanillaHeightmapOracle.bindTags(JsonParser.parseString(Files.readString(dir.resolve("tags.json"))).getAsJsonObject()); + var contextMethod=VanillaPlacementOracle.class.getDeclaredMethod("context",JsonObject.class);contextMethod.setAccessible(true); + var bounds=new JsonObject();bounds.add("context",JsonParser.parseString("[-64,64,0]")); + var generator=((PlacementContext)contextMethod.invoke(null,bounds)).generator(); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt"),StandardCharsets.UTF_8))) { + for(var line:Files.readAllLines(dir.resolve("inputs.txt"))) { + var f=JsonParser.parseString(line).getAsJsonObject();long seed=f.get("seed").getAsLong(); + var features=new ArrayList(); + for(var value:f.getAsJsonArray("features"))features.add(Feature.DIRECT_CODEC.parse(JsonOps.INSTANCE,value).getOrThrow()); + RandomSource random=f.get("legacy").getAsBoolean()?new LegacyRandomSource(seed):new XoroshiroRandomSource(seed); + if(f.get("worldgen").getAsBoolean())random=new WorldgenRandom(random); + var chunks=new TreeMap(Comparator.comparingInt(p->p.x()).thenComparingInt(p->p.z())); + for(int cx=-1;cx<=1;cx++)for(int cz=-1;cz<=1;cz++) { + var cp=new ChunkPos(cx,cz);var chunk=new ProtoChunk(cp,UpgradeData.EMPTY,LevelHeightAccessor.create(-64,64),factory,null); + chunk.setPersistedStatus(f.get("stage").getAsString().equals("terrain")?ChunkStatus.TERRAIN:ChunkStatus.EMPTY); + for(int x=0;x<16;x++)for(int z=0;z<16;z++) { + chunk.setBlockState(new BlockPos((cx<<4)+x,-56,(cz<<4)+z),Blocks.STONE.defaultBlockState(),3); + if((x+z)%3!=0)chunk.setBlockState(new BlockPos((cx<<4)+x,-48,(cz<<4)+z),Blocks.DIRT.defaultBlockState(),3); + } + chunks.put(cp,chunk); + } + int[] calls={0};int fail=f.get("fail").getAsInt(),reject=f.get("reject").getAsInt(); + var world=(WorldGenLevel)Proxy.newProxyInstance(WorldGenLevel.class.getClassLoader(),new Class[]{WorldGenLevel.class},(proxy,method,values)->switch(method.getName()) { + case "getMinY"->-64; + case "getSeaLevel"->0; + case "getHeight"->{ + if(values==null||values.length==0)yield 64; + var kind=(Heightmap.Types)values[0];int x=(Integer)values[1],z=(Integer)values[2];yield chunk(chunks,x,z).getHeight(kind,x&15,z&15)+1; + } + case "getMaxY","isInsideBuildHeight","isOutsideBuildHeight","setBlockAndUpdate"->InvocationHandler.invokeDefault(proxy,method,values); + case "getBlockState"->{var p=(BlockPos)values[0];yield chunk(chunks,p.getX(),p.getZ()).getBlockState(p);} + case "setBlock"->{ + var p=(BlockPos)values[0];var state=(BlockState)values[1];int flags=(Integer)values[2]; + out.println("write "+p.getX()+" "+p.getY()+" "+p.getZ()+" "+Block.getId(state)+" "+flags); + int call=calls[0]++;if(call==fail)throw new IllegalArgumentException("injected write failure"); + boolean result=reject==0||call%reject!=0; + if(result)chunk(chunks,p.getX(),p.getZ()).setBlockState(p,state,flags); + out.println("written "+result);yield result; + } + default->throw new AssertionError("unexpected world method "+method); + }); + var modifiers=new ArrayList();for(var value:f.getAsJsonArray("placement"))modifiers.add(PlacementModifier.CODEC.parse(JsonOps.INSTANCE,value).getOrThrow()); + var placer=new FeaturePlacer(world,generator); + for(int repeat=0;repeat<2;repeat++) { + for(var feature:features) { + calls[0]=0; + try {out.println("place "+placer.place(new PlacedFeature(Holder.direct(feature),modifiers),random,new BlockPos(15,-40,15)));}catch(RuntimeException error){out.println("place error");} + out.println("next "+random.nextLong()); + for(int[] p:new int[][]{{0,0},{15,15},{16,16},{-1,-1}})for(var kind:Heightmap.Types.values())out.println("height "+kind.name()+" "+p[0]+" "+p[1]+" "+(chunk(chunks,p[0],p[1]).getHeight(kind,p[0]&15,p[1]&15)+1)); + } + out.println("repeat "+repeat); + } + for(var entry:chunks.entrySet()) { + var cp=entry.getKey();var chunk=entry.getValue();out.println("chunk "+cp.x()+" "+cp.z()); + for(var kind:Heightmap.Types.values()) { + if(chunk.hasPrimedHeightmap(kind)){out.println("map "+kind.name());for(long word:chunk.getOrCreateHeightmapUnprimed(kind).getRawData())out.println(Long.toUnsignedString(word,16));} + else out.println("missing "+kind.name()); + } + for(int i=0;i<4;i++){out.println("section "+i);var section=chunk.getSection(i);for(int y=0;y<16;y++)for(int z=0;z<16;z++)for(int x=0;x<16;x++)out.println(Block.getId(section.getBlockState(x,y,z)));} + } + out.println("tail "+random.nextLong()); + } + } + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureSortOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureSortOracle.java new file mode 100644 index 000000000..833ede52d --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureSortOracle.java @@ -0,0 +1,45 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import com.mojang.serialization.JsonOps; +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.nio.file.*; +import java.util.*; +import net.minecraft.core.*; +import net.minecraft.world.level.biome.FeatureSorter; +import net.minecraft.world.level.levelgen.feature.Feature; +import net.minecraft.world.level.levelgen.placement.PlacedFeature; + +/** Exercises identity-based native feature ordering, using equal dummy payloads. */ +public final class VanillaFeatureSortOracle { + public static void main(String[] args) throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); + var noop=Feature.DIRECT_CODEC.parse(JsonOps.INSTANCE,JsonParser.parseString("{\"type\":\"no_op\"}")).getOrThrow(); + Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt"),StandardCharsets.UTF_8));var inputs=Files.lines(dir.resolve("inputs.txt"))) { + for(var line:(Iterable)inputs::iterator) { + var f=JsonParser.parseString(line).getAsJsonObject(); + var identities=new HashMap();var names=new IdentityHashMap(); + java.util.function.IntFunction feature=id->identities.computeIfAbsent(id,key->{var value=new PlacedFeature(Holder.direct(noop),List.of());names.put(value,key);return value;}); + var biomes=new ArrayList>>(); + for(var b:f.getAsJsonArray("biomes")) { + var steps=new ArrayList>(); + for(var s:b.getAsJsonArray()) { + var values=new ArrayList>();for(var id:s.getAsJsonArray())values.add(Holder.direct(feature.apply(id.getAsInt()))); + steps.add(HolderSet.direct(values)); + } + biomes.add(steps); + } + try { + var steps=FeatureSorter.buildFeaturesPerStep(biomes,value->value,false); + out.println("steps "+steps.size()); + for(int i=0;i(Comparator.comparingInt(BlockPos::getX).thenComparingInt(BlockPos::getY).thenComparingInt(BlockPos::getZ)); + var world=(WorldGenLevel)Proxy.newProxyInstance(WorldGenLevel.class.getClassLoader(),new Class[]{WorldGenLevel.class},(proxy,method,values)->{ + if(method.getName().equals("getMinY")) { + out.println("min");int call=calls[0]++;if(call==fail)throw new Stop(); + int minimum=f.get("world_min").getAsInt();out.println("minimum "+minimum);return minimum; + } + if(method.getName().equals("getHeight")&&(values==null||values.length==0))return 384; + if(method.getName().equals("getSeaLevel"))return 63; + if(method.getName().equals("setBlockAndUpdate"))return InvocationHandler.invokeDefault(proxy,method,values); + var p=((BlockPos)values[0]).immutable();int call=calls[0]++; + switch(method.getName()) { + case "getBlockState"->{ + out.println("get "+p.getX()+" "+p.getY()+" "+p.getZ());if(call==fail)throw new Stop(); + var state=states.getOrDefault(p,BLOCKS[Math.floorMod(p.getX()*31+p.getY()*7+p.getZ()*17,7)].defaultBlockState());out.println("state "+Block.getId(state));return state; + } + case "setBlock"->{ + var state=(BlockState)values[1];int flags=(Integer)values[2];out.println("set "+p.getX()+" "+p.getY()+" "+p.getZ()+" "+Block.getId(state)+" "+flags);if(call==fail)throw new Stop(); + boolean result=reject==0||call%reject!=0;if(result)states.put(p,state);out.println("written "+result);return result; + } + default->throw new AssertionError("unexpected world method "+method); + } + }); + var p=f.getAsJsonArray("origin");var origin=new BlockPos(p.get(0).getAsInt(),p.get(1).getAsInt(),p.get(2).getAsInt()); + for(int repeat=0;repeat0x100000000L) + throw new IllegalArgumentException("invalid float bit range"); + var sampler=new UnaryFunction.LogSampler(new DensitySampler() { + public float sampleValue(SamplerContext context,int x,int y,int z) {return Float.intBitsToFloat(x);} + public void sampleVolume(SamplerContext context,DensityBuffer buffer,DensityVolume volume) {throw new AssertionError("unexpected volume");} + }); + byte[] buffer=new byte[1<<20]; + try(var out=new BufferedOutputStream(System.out,1<<20)) { + while(remaining>0) { + int count=(int)Math.min(remaining,buffer.length/4); + for(int i=0;i>>24);buffer[at+1]=(byte)(bits>>>16); + buffer[at+2]=(byte)(bits>>>8);buffer[at+3]=(byte)bits; + } + out.write(buffer,0,count*4); + start+=count;remaining-=count; + } + } + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFluidOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFluidOracle.java new file mode 100644 index 000000000..f3d7e32a7 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFluidOracle.java @@ -0,0 +1,45 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*; +import java.lang.reflect.*; +import java.nio.file.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.material.FlowingFluid; +/** Original transport for native contained fluid state and height queries. */ +public final class VanillaFluidOracle { + private static final class Stop extends RuntimeException {} + public static void main(String[] args) throws Exception { + if(args[0].equals("export")){VanillaBlockStateCodecOracle.main(args);return;} + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); + Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var inputs=Files.lines(dir.resolve("inputs.txt"))) { + for(var first:BuiltInRegistries.FLUID)for(var second:BuiltInRegistries.FLUID) + out.println("family "+BuiltInRegistries.FLUID.getKey(first)+" "+BuiltInRegistries.FLUID.getKey(second)+" "+first.isSame(second)); + for(var block:Block.BLOCK_STATE_REGISTRY) { + var state=block.getFluidState();boolean falling=state.hasProperty(FlowingFluid.FALLING)&&state.getValue(FlowingFluid.FALLING); + out.println("state "+Block.getId(block)+" "+BuiltInRegistries.FLUID.getKey(state.getType())+" "+state.getAmount()+" "+falling+" "+state.isFull()+" "+state.isSource()+" "+Integer.toUnsignedString(Float.floatToRawIntBits(state.getOwnHeight()))+" "+Block.getId(state.createLegacyBlock())); + } + for(var line:(Iterable)inputs::iterator) { + var f=JsonParser.parseString(line).getAsJsonObject();var state=Block.stateById(f.get("state").getAsInt()).getFluidState(); + var above=Block.stateById(f.get("above").getAsInt()).getFluidState();int[] calls={0};int fail=f.get("fail").getAsInt(); + var world=(BlockGetter)Proxy.newProxyInstance(BlockGetter.class.getClassLoader(),new Class[]{BlockGetter.class},(proxy,method,values)->{ + var p=(BlockPos)values[0];boolean fluid=method.getName().equals("getFluidState"); + if(!fluid&&!method.getName().equals("getBlockState"))throw new AssertionError(method); + out.println((fluid?"fluid ":"block ")+p.getX()+" "+p.getY()+" "+p.getZ()); + if(calls[0]++==fail)throw new Stop(); + return fluid?above:(f.get("sturdy").getAsBoolean()?Blocks.STONE:Blocks.AIR).defaultBlockState(); + }); + var xyz=f.getAsJsonArray("position");var p=new BlockPos(xyz.get(0).getAsInt(),xyz.get(1).getAsInt(),xyz.get(2).getAsInt()); + for(boolean camera:new boolean[]{false,true}) { + try {float height=camera?state.getHeightForCamera(world,p):state.getHeight(world,p);out.println("height "+Integer.toUnsignedString(Float.floatToRawIntBits(height)));} + catch(Stop error){out.println("height error");} + } + out.println("calls "+calls[0]); + } + } + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaGeometryOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaGeometryOracle.java new file mode 100644 index 000000000..4241b656b --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaGeometryOracle.java @@ -0,0 +1,218 @@ +package dev.horizonlab.parity; + +import java.io.*; +import java.lang.reflect.*; +import java.nio.file.*; +import java.util.*; +import net.minecraft.SharedConstants; +import net.minecraft.server.Bootstrap; +import net.minecraft.world.entity.Entity; +import net.minecraft.util.Mth; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.phys.*; +import net.minecraft.world.phys.shapes.*; + +/** Original I/O adapter. Every geometry calculation invokes the pinned vanilla classes. */ +public final class VanillaGeometryOracle { + private static final Constructor ARRAY; + private static final Method INDEX; + private static final Method MOTION, STEP, COLLIDE, ALLOCATE; + private static final Object ALLOCATOR; + static { + try { + ARRAY = ArrayVoxelShape.class.getDeclaredConstructor(DiscreteVoxelShape.class, double[].class, double[].class, double[].class); + ARRAY.setAccessible(true); + INDEX = VoxelShape.class.getDeclaredMethod("findIndex", Direction.Axis.class, double.class); + INDEX.setAccessible(true); + MOTION = Entity.class.getDeclaredMethod("collideWithShapes", Vec3.class, AABB.class, List.class); MOTION.setAccessible(true); + STEP = Entity.class.getDeclaredMethod("collectCandidateStepUpHeights", AABB.class, List.class, float.class, float.class); STEP.setAccessible(true); + COLLIDE = Entity.class.getDeclaredMethod("collide", Vec3.class); COLLIDE.setAccessible(true); + Class allocator = Class.forName("sun.misc.Unsafe"); + Field field = allocator.getDeclaredField("theUnsafe"); field.setAccessible(true); + ALLOCATOR = field.get(null); ALLOCATE = allocator.getMethod("allocateInstance", Class.class); + } catch (ReflectiveOperationException error) { throw new ExceptionInInitializerError(error); } + } + private static final class Input { + final String[] words; int cursor = 1; + Input(String line) { words = line.split(" "); } + String word() { return words[cursor++]; } + int integer() { return Integer.parseInt(word()); } + double number() { return Double.longBitsToDouble(Long.parseUnsignedLong(word(), 16)); } + Vec3 vector() { return new Vec3(number(), number(), number()); } + AABB box() { return new AABB(vector(), vector()); } + BlockPos pos() { return new BlockPos(integer(), integer(), integer()); } + } + private final PrintWriter out; + private final List shapes = new ArrayList<>(); + private VanillaGeometryOracle(PrintWriter out) { this.out = out; } + private void values(String label, double... values) { out.print(label); for (double v : values) out.printf(" %016x", Double.doubleToLongBits(v)); out.println(); } + private void vector(String label, Vec3 v) { values(label, v.x, v.y, v.z); } + private void box(String label, AABB b) { values(label, b.minX, b.minY, b.minZ, b.maxX, b.maxY, b.maxZ); } + private void point(String label, Optional p) { if (p.isPresent()) vector(label, p.get()); else out.println(label + " none"); } + private void hit(BlockHitResult h) { if (h == null) out.println("hit none"); else { BlockPos p = h.getBlockPos(); Vec3 v = h.getLocation(); out.printf("hit %d %d %d %d %d %016x %016x %016x%n", h.getDirection().ordinal(), h.isInside() ? 1 : 0, p.getX(), p.getY(), p.getZ(), Double.doubleToLongBits(v.x), Double.doubleToLongBits(v.y), Double.doubleToLongBits(v.z)); } } + private static int flag(boolean v) { return v ? 1 : 0; } + // These fixtures only provide caller-controlled shape lists and entity + // inputs. The private vanilla Entity.collide method performs every movement + // and step decision. Allocation avoids starting a world/server or invoking + // entity lifecycle logic unrelated to this geometry comparison. + private static final class StepBorder extends net.minecraft.world.level.border.WorldBorder { + VoxelShape shape; + @Override public boolean isInsideCloseToBorder(Entity entity, AABB box) { return shape != null; } + @Override public VoxelShape getCollisionShape() { return shape; } + } + private static final class StepLevel extends net.minecraft.server.level.ServerLevel { + VanillaGeometryOracle oracle; + StepBorder border; + List entities, initial, stepping; + int queries; + private StepLevel() { super(null, null, null, null, null, null, false, 0L, List.of(), false); } + @Override public net.minecraft.world.level.border.WorldBorder getWorldBorder() { return border; } + @Override public List getEntityCollisions(Entity entity, AABB query) { oracle.box("entity-query", query); return entities; } + @Override public Iterable getBlockCollisions(Entity entity, AABB query) { oracle.box("block-query", query); return queries++ == 0 ? initial : stepping; } + } + private static final class StepEntity extends net.minecraft.world.entity.decoration.ArmorStand { + float step; + boolean grounded; + private StepEntity() { super(null, null); } + @Override public float maxUpStep() { return step; } + @Override public boolean onGround() { return grounded; } + void configure(StepLevel level, AABB box, float step, boolean grounded) { setLevel(level); setBoundingBox(box); this.step = step; this.grounded = grounded; } + } + private List selected(Input in) { + int count = in.integer(); List selected = new ArrayList<>(count); + for (int i = 0; i < count; i++) selected.add(shapes.get(in.integer())); + return selected; + } + private void positions(String label, Iterable positions, int limit) { + int count = 0; Iterator iterator = positions.iterator(); + while (count < limit && iterator.hasNext()) { BlockPos pos = iterator.next(); out.printf("%s %d %d %d%n", label, pos.getX(), pos.getY(), pos.getZ()); count++; } + out.printf("%s-count %d%n", label, count); + } + private void emitShape(VoxelShape shape) { + values("axis-extrema",shape.min(Direction.Axis.X),shape.min(Direction.Axis.Y),shape.min(Direction.Axis.Z),shape.max(Direction.Axis.X),shape.max(Direction.Axis.Y),shape.max(Direction.Axis.Z)); + List boxes=shape.toAabbs();out.printf("shape %d %d%n",shapes.size(),boxes.size());int cubeAxes=0; + for(Direction.Axis axis:Direction.Axis.values())if(shape.getCoords(axis) instanceof CubePointRange)cubeAxes|=1< { + VoxelShape shape = shapes.get(in.integer()), below = shapes.get(in.integer()); int[] calls = {0}; + values("floor-height", net.minecraft.world.level.EmptyBlockGetter.INSTANCE.getBlockFloorHeight(shape, () -> { calls[0]++; return below; })); + out.printf("below-calls %d%n", calls[0]); + } + case "block-iterate" -> { + BlockPos a = in.pos(), b = in.pos(); Vec3 movement = in.vector(); int limit = in.integer(); + positions("closed", BlockPos.betweenClosed(a, b), limit); + positions("direction", BlockPos.betweenCornersInDirection(a, b, movement), limit); + } + case "box-iterate" -> { + AABB box = in.box(); Vec3 movement = in.vector(); int limit = in.integer(); + positions("closed", BlockPos.betweenClosed(box), limit); + positions("direction", BlockPos.betweenCornersInDirection(box, movement), limit); + } + case "sweep" -> { + Vec3 start = in.vector(), end = in.vector(); AABB box = in.box(); int stop = in.integer(); int[] count = {0}; + boolean completed = BlockGetter.forEachBlockIntersectedBetween(start, end, box, (pos, step) -> { count[0]++; out.printf("block-visit %d %d %d %d%n", pos.getX(), pos.getY(), pos.getZ(), step); return count[0] != stop; }); + out.printf("sweep %d %d%n", flag(completed), count[0]); + } + case "step-motion" -> { + AABB box = in.box(); Vec3 movement = in.vector(); float maxStep = (float)in.number(); boolean grounded = in.integer() != 0; + StepLevel level = (StepLevel)ALLOCATE.invoke(ALLOCATOR, StepLevel.class); + level.oracle = this; level.entities = selected(in); level.initial = selected(in); level.stepping = selected(in); + int border = in.integer(); level.border = new StepBorder(); level.border.shape = border < 0 ? null : shapes.get(border); + StepEntity entity = (StepEntity)ALLOCATE.invoke(ALLOCATOR, StepEntity.class); entity.configure(level, box, maxStep, grounded); + vector("step-motion", (Vec3)COLLIDE.invoke(entity, movement)); + out.printf("block-queries %d%n", level.queries); + } + case "make-box" -> emitShape(Shapes.create(in.box())); + case "optimize" -> emitShape(shapes.get(in.integer()).optimize()); + case "join", "join-optimized" -> { + VoxelShape a=shapes.get(in.integer()),b=shapes.get(in.integer());int bits=in.integer();BooleanOp op=(first,second)->(bits&(1<<((first?2:0)+(second?1:0))))!=0; + if((bits&1)!=0) { + try {Shapes.joinUnoptimized(a,b,op);throw new AssertionError("accepted unbounded Boolean");}catch(IllegalArgumentException expected){out.println("join invalid");} + }else{ + VoxelShape shape=operation.equals("join")?Shapes.joinUnoptimized(a,b,op):Shapes.join(a,b,op);out.printf("overlap %d%n",flag(Shapes.joinIsNotEmpty(a,b,op)));emitShape(shape); + } + } + case "traverse" -> { + Vec3 start=in.vector(),end=in.vector();int stop=in.integer();int[] count={0}; + BlockPos result=BlockGetter.traverseBlocks(start,end,stop,(context,pos)->{count[0]++;out.printf("visit %d %d %d%n",pos.getX(),pos.getY(),pos.getZ());if(count[0]==context)return pos;return null;},context->null); + if(result==null)out.printf("traverse none %d%n",count[0]);else out.printf("traverse %d %d %d %d%n",result.getX(),result.getY(),result.getZ(),count[0]); + } + case "trig-table" -> { + Field field=Mth.class.getDeclaredField("SIN");field.setAccessible(true);float[] table=(float[])field.get(null); + for(int i=0;i { + Vec3 v=in.vector();double angle=in.number();float pitch=(float)in.number(),yaw=(float)in.number();int axes=in.integer();Direction.Axis axis=Direction.Axis.values()[in.integer()];Direction direction=Direction.values()[in.integer()];double amount=in.number(); + values("trig",Mth.sin(angle),Mth.cos(angle));vector("rotate-x",v.xRot((float)angle));vector("rotate-y",v.yRot((float)angle));vector("rotate-z",v.zRot((float)angle));vector("clockwise",v.rotateClockwise90());vector("look",Vec3.directionFromRotation(pitch,yaw)); + Vec2 rotation=v.rotation();values("rotation",rotation.x,rotation.y); + EnumSet selected=EnumSet.noneOf(Direction.Axis.class);for(Direction.Axis a:Direction.Axis.values())if((axes&(1< { + Vec3 a = in.vector(), b = in.vector(); double t = in.number(); + vector("add", a.add(b)); vector("subtract", a.subtract(b)); vector("vector-to", a.vectorTo(b)); vector("multiply", a.multiply(b)); vector("scale", a.scale(t)); vector("normalize", a.normalize()); vector("cross", a.cross(b)); vector("lerp", a.lerp(b, t)); vector("projected", a.projectedOn(b)); vector("reverse", a.reverse()); vector("horizontal", a.horizontal()); + values("scalar", a.dot(b), a.lengthSqr(), a.length(), a.horizontalDistanceSqr(), a.horizontalDistance(), a.distanceToSqr(b), a.distanceTo(b)); + out.printf("flags %d %d %d %d%n", flag(a.equals(b)), flag(a.isFinite()), flag(a.closerThan(b, t)), Direction.getApproximateNearest(a).ordinal()); + var order = Direction.axisStepOrder(a); out.printf("order %d %d %d%n", order.get(0).ordinal(), order.get(1).ordinal(), order.get(2).ordinal()); + } + case "box" -> { + AABB a = in.box(), b = in.box(); Vec3 start = in.vector(), end = in.vector(), amount = in.vector(); Direction.Axis axis = Direction.Axis.values()[in.integer()]; double value = in.number(); + box("bounds", a); box("move", a.move(amount)); box("inflate", a.inflate(amount.x, amount.y, amount.z)); box("deflate", a.deflate(amount.x, amount.y, amount.z)); box("contract", a.contract(amount.x, amount.y, amount.z)); box("expand", a.expandTowards(amount)); box("intersect", a.intersect(b)); box("union", a.minmax(b)); box("next", a.nextDeflated()); + box("set-min", switch(axis) { case X -> a.setMinX(value); case Y -> a.setMinY(value); case Z -> a.setMinZ(value); }); + box("set-max", switch(axis) { case X -> a.setMaxX(value); case Y -> a.setMaxY(value); case Z -> a.setMaxZ(value); }); + box("of-size", AABB.ofSize(start, amount.x, amount.y, amount.z)); box("unit", AABB.unitCubeFromLowerCorner(start)); + vector("center", a.getCenter()); vector("bottom", a.getBottomCenter()); vector("size", new Vec3(a.getXsize(), a.getYsize(), a.getZsize())); + values("distance", a.getSize(), a.distanceToSqr(start), a.distanceToSqr(b)); + out.printf("flags %d %d %d %d%n", flag(a.intersects(b)), flag(a.contains(start)), flag(a.hasNaN()), flag(a.collidedAlongVector(amount, List.of(b)))); + point("clip", a.clip(start, end)); hit(AABB.clip(List.of(a, b), start, end, BlockPos.ZERO)); + } + case "block-box" -> { BlockPos a = in.pos(), b = in.pos(); box("block", new AABB(a)); box("encapsulate", AABB.encapsulatingFullBlocks(a, b)); } + case "grid" -> { + boolean cube = in.integer() != 0; int nx = in.integer(), ny = in.integer(), nz = in.integer(); + double[] xs = new double[nx + 1], ys = new double[ny + 1], zs = new double[nz + 1]; + for (double[] coords : new double[][] {xs, ys, zs}) for (int i = 0; i < coords.length; i++) coords[i] = in.number(); + String occupied = in.word(); BitSetDiscreteVoxelShape discrete = new BitSetDiscreteVoxelShape(nx, ny, nz); + for (int x = 0; x < nx; x++) for (int y = 0; y < ny; y++) for (int z = 0; z < nz; z++) if (occupied.charAt((x * ny + y) * nz + z) == '1') discrete.fill(x, y, z); + VoxelShape shape = cube ? new CubeVoxelShape(discrete) : ARRAY.newInstance(discrete, xs, ys, zs); + List boxes = shape.toAabbs(); out.printf("shape %d %d%n", shapes.size(), boxes.size()); + values("axis-extrema",shape.min(Direction.Axis.X),shape.min(Direction.Axis.Y),shape.min(Direction.Axis.Z),shape.max(Direction.Axis.X),shape.max(Direction.Axis.Y),shape.max(Direction.Axis.Z)); + if (shape.isEmpty()) out.println("shape-bounds none"); else box("shape-bounds", shape.bounds()); + for (AABB b : boxes) box("part", b); shapes.add(shape); + } + case "query" -> { + VoxelShape shape = shapes.get(in.integer()); AABB b = in.box(); Vec3 start = in.vector(), end = in.vector(), p = in.vector(); BlockPos block = in.pos(); Direction.Axis axis = Direction.Axis.values()[in.integer()]; double amount = in.number(); + values("column", shape.min(axis, p.x, p.y), shape.max(axis, p.x, p.y)); + values("collide", shape.collide(axis, b, amount)); hit(shape.clip(start, end, block)); point("closest", shape.closestPointTo(p)); + out.printf("index %d %d %d%n", INDEX.invoke(shape, Direction.Axis.X, p.x), INDEX.invoke(shape, Direction.Axis.Y, p.y), INDEX.invoke(shape, Direction.Axis.Z, p.z)); + } + case "many" -> { + AABB b = in.box(); Direction.Axis axis = Direction.Axis.values()[in.integer()]; double amount = in.number(); int count = in.integer(); List selected = new ArrayList<>(); + for (int i = 0; i < count; i++) selected.add(shapes.get(in.integer())); values("many", Shapes.collide(axis, b, selected, amount)); + } + case "motion" -> { + AABB b = in.box(); Vec3 movement = in.vector(); float maxStep = (float)in.number(), currentY = (float)in.number(); int count = in.integer(); List selected = new ArrayList<>(); + for (int i = 0; i < count; i++) selected.add(shapes.get(in.integer())); + vector("motion", (Vec3)MOTION.invoke(null,movement,b,selected)); + float[] candidates = (float[])STEP.invoke(null,b,selected,maxStep,currentY); + out.printf("steps %d",candidates.length); for(float height:candidates)out.printf(" %08x",Float.floatToIntBits(height)); out.println(); + } + default -> throw new IllegalArgumentException(operation); + } + if (in.cursor != in.words.length) throw new AssertionError("trailing input"); + } + public static void main(String[] args) throws Exception { + SharedConstants.tryDetectVersion(); Bootstrap.bootStrap(); + try (BufferedReader input = Files.newBufferedReader(Path.of(args[0])); PrintWriter out = new PrintWriter(Files.newBufferedWriter(Path.of(args[1])))) { + VanillaGeometryOracle oracle = new VanillaGeometryOracle(out); int lineNumber = 0; + for (String line; (line = input.readLine()) != null;) oracle.command(line, ++lineNumber); + } + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightProviderOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightProviderOracle.java new file mode 100644 index 000000000..b3fb18aff --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightProviderOracle.java @@ -0,0 +1,32 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import com.mojang.serialization.JsonOps; +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.nio.file.*; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.levelgen.*; +import net.minecraft.world.level.levelgen.heightproviders.HeightProvider; + +/** Original transport calling native height-provider codecs and samples. */ +public final class VanillaHeightProviderOracle { + public static void main(String[] args) throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();Path dir=Path.of(args[1]); + var contextMethod=VanillaAnchorOracle.class.getDeclaredMethod("context",JsonObject.class);contextMethod.setAccessible(true); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt"),StandardCharsets.UTF_8))) { + for(var line:Files.readAllLines(dir.resolve("inputs.txt"))) { + var f=JsonParser.parseString(line).getAsJsonObject();long seed=f.get("seed").getAsLong(); + var context=(WorldGenerationContext)contextMethod.invoke(null,f); + RandomSource random=f.get("legacy").getAsBoolean()?new LegacyRandomSource(seed):new XoroshiroRandomSource(seed); + com.mojang.serialization.DataResult decoded; + try {decoded=HeightProvider.CODEC.parse(JsonOps.INSTANCE,JsonParser.parseString(f.get("definition").getAsString()));} catch(IllegalArgumentException error) {out.println("decode error");out.println("tail "+random.nextLong());continue;} + int count=f.get("samples").getAsInt(); + if(decoded.result().isEmpty())out.println("decode error");else { + var provider=decoded.result().get();out.println("decode ok"); + for(int i=0;i(BuiltInRegistries.BLOCK.keySet())) + defaults.addProperty(id.toString(),Block.getId(BuiltInRegistries.BLOCK.getValue(id).defaultBlockState())); + result.add("states",states);result.add("defaults",defaults);return result; + } + static void bindTags(JsonObject resources) { + var registry=BuiltInRegistries.BLOCK; + var loader=new TagLoader>((id,required)->registry.get(id).map(value->(Holder)value),"tags/block"); + var definitions=new HashMap>(); + for(var item:resources.entrySet()) { + var file=TagFile.CODEC.parse(JsonOps.INSTANCE,JsonParser.parseString(item.getValue().getAsString())).getOrThrow(); + var entries=new ArrayList(); + for(var entry:file.entries())entries.add(new TagLoader.EntryWithSource(entry,"vanilla")); + definitions.put(Identifier.parse(item.getKey()),entries); + } + var tags=new HashMap,List>>(); + loader.build(definitions).forEach((id,values)->tags.put(TagKey.create(Registries.BLOCK,id),List.copyOf(values))); + if(tags.size()!=resources.size())throw new AssertionError("incomplete block tags"); + registry.prepareTagReload(new TagLoader.LoadResult<>(Registries.BLOCK,tags)).apply(); + } + private static final class Chunk extends ProtoChunk { + final List reads=new ArrayList<>(); + final boolean trace; + Chunk(int min,int height,boolean trace) { + super(new ChunkPos(0,0),UpgradeData.EMPTY,LevelHeightAccessor.create(min,height),factory,null); + this.trace=trace; + } + @Override public BlockState getBlockState(BlockPos pos) { + var state=super.getBlockState(pos); + if(trace)reads.add("read "+pos.getX()+" "+pos.getY()+" "+pos.getZ()+" "+Block.getId(state)); + return state; + } + void write(int x,int y,int z,int id) { + getSection(getSectionIndex(y)).setBlockState(x&15,y&15,z&15,Block.stateById(id),false); + } + } + private static void fixture(JsonObject input,PrintWriter out) { + int min=input.get("min").getAsInt(),height=input.get("height").getAsInt(); + var chunk=new Chunk(min,height,input.get("trace").getAsBoolean()); + out.println("chunk "+min+" "+height); + for(var item:input.getAsJsonArray("initial")) { + var a=item.getAsJsonArray();chunk.write(a.get(0).getAsInt(),a.get(1).getAsInt(),a.get(2).getAsInt(),a.get(3).getAsInt()); + } + for(var type:TYPES)chunk.getOrCreateHeightmapUnprimed(type); + for(var item:input.getAsJsonArray("ops")) { + var a=item.getAsJsonArray();String op=a.get(0).getAsString(); + switch(op) { + case "set" -> { + int x=a.get(1).getAsInt(),y=a.get(2).getAsInt(),z=a.get(3).getAsInt(),id=a.get(4).getAsInt(),mask=a.get(5).getAsInt(); + chunk.write(x,y,z,id); + for(int t=0;t { + int x=a.get(1).getAsInt(),y=a.get(2).getAsInt(),z=a.get(3).getAsInt(),id=a.get(4).getAsInt(),t=a.get(5).getAsInt(); + try {out.println("update "+t+" "+chunk.getOrCreateHeightmapUnprimed(TYPES[t]).update(x,y,z,Block.stateById(id)));} + catch(RuntimeException e){out.println("update "+t+" error");} + } + case "prime" -> { + var selected=EnumSet.noneOf(Heightmap.Types.class);int mask=a.get(1).getAsInt(); + for(int t=0;t { + int t=a.get(1).getAsInt();var words=a.get(2).getAsJsonArray();long[] data=new long[words.size()]; + for(int i=0;i { + int x=a.get(1).getAsInt(),z=a.get(2).getAsInt(); + for(int t=0;t { + out.println("highest_section "+chunk.getHighestSectionPosition()); + for(int t=0;t throw new IllegalArgumentException(op); + } + for(String read:chunk.reads)out.println(read);chunk.reads.clear(); + } + } + public static void main(String[] args) throws Exception { + SharedConstants.tryDetectVersion();Bootstrap.bootStrap(); + Path directory=Path.of(args[1]); + if(args[0].equals("export")) { + Files.writeString(directory,new Gson().toJson(facts()),StandardCharsets.UTF_8);return; + } + Holder biome=Holder.Reference.createStandAlone(new HolderOwner(){},Biomes.PLAINS); + var ids=new IdMapper>();ids.add(biome); + // Only in-memory section storage is exercised; biome and section codecs are not invoked. + factory=new PalettedContainerFactory(Strategy.createForBlockStates(Block.BLOCK_STATE_REGISTRY),Blocks.AIR.defaultBlockState(),null,Strategy.createForBiomes(ids),biome,null); + bindTags(JsonParser.parseString(Files.readString(directory.resolve("tags.json"))).getAsJsonObject()); + try(var out=new PrintWriter(Files.newBufferedWriter(directory.resolve(args[0]+".txt"),StandardCharsets.UTF_8))) { + for(int t=0;t noises; + private static MappedRegistry definitions; + private static MappedRegistry biomes; + private static RegistryOps ops; + private static MappedRegistry densities; + private static HolderGetter densityLookup; + private static MappedRegistry ruleDefinitions; + private static HolderGetter ruleLookup; + private static JsonElement canonical(JsonElement value) { + if(value.isJsonObject()) {var result=new JsonObject();for(var e:new TreeMap<>(value.getAsJsonObject().asMap()).entrySet())result.add(e.getKey(),canonical(e.getValue()));return result;} + if(value.isJsonArray()){var result=new JsonArray();for(var e:value.getAsJsonArray())result.add(canonical(e));return result;} + if(value.isJsonPrimitive() && value.getAsJsonPrimitive().isNumber())return new JsonPrimitive("number:"+Long.toUnsignedString(Double.doubleToLongBits(value.getAsDouble()),16)); + return value; + } + private static String encode(MaterialCondition value) {return MaterialCondition.CODEC.encodeStart(ops,value).result().map(v->canonical(v).toString()).orElse("error");} + @SuppressWarnings("unchecked") + private static RegistryOps conditionOps(HolderGetter lookup) { + return RegistryOps.create(JsonOps.INSTANCE,new RegistryOps.RegistryInfoLookup(){ + public Optional> lookup(ResourceKey> key){ + if(key.equals(Registries.NOISE))return (Optional>)(Optional)Optional.of(noises); + if(key.equals(Registries.DENSITY_FUNCTION))return (Optional>)(Optional)Optional.ofNullable(densityLookup); + if(key.equals(Registries.MATERIAL_RULE))return (Optional>)(Optional)Optional.ofNullable(ruleLookup); + if(key.equals(Registries.BIOME))return (Optional>)(Optional)Optional.of(biomes); + if(key.equals(Registries.MATERIAL_CONDITION))return (Optional>)(Optional)Optional.of(lookup); + return Optional.empty(); + } + }); + } + private static void loadBiomes(Path dir) throws Exception { + biomes=new MappedRegistry<>(Registries.BIOME,Lifecycle.stable()); + var climate=VanillaBiomeTemperatureOracle.class.getDeclaredMethod("climate",JsonObject.class);climate.setAccessible(true); + var make=VanillaBiomeTemperatureOracle.class.getDeclaredMethod("make",Object.class);make.setAccessible(true); + var definitions=JsonParser.parseString(Files.readString(dir.resolve("biomes.json"))).getAsJsonObject(); + for(var e:definitions.entrySet()) { + var f=new JsonObject();f.addProperty("json",e.getValue().getAsString()); + var biome=(Biome)make.invoke(null,climate.invoke(null,f)); + biomes.register(ResourceKey.create(Registries.BIOME,Identifier.parse(e.getKey())),biome,RegistrationInfo.BUILT_IN); + } + biomes.freeze(); + var tagResources=JsonParser.parseString(Files.readString(dir.resolve("biome_tags.json"))).getAsJsonObject(); + var loader=new TagLoader>((id,required)->biomes.get(id).map(value->(Holder)value),"tags/worldgen/biome"); + var tags=new HashMap>(); + for(var e:tagResources.entrySet()) { + var file=TagFile.CODEC.parse(JsonOps.INSTANCE,JsonParser.parseString(e.getValue().getAsString())).getOrThrow(); + var entries=new ArrayList();for(var entry:file.entries())entries.add(new TagLoader.EntryWithSource(entry,"vanilla")); + tags.put(Identifier.parse(e.getKey()),entries); + } + var resolved=new HashMap,List>>(); + loader.build(tags).forEach((id,values)->resolved.put(TagKey.create(Registries.BIOME,id),List.copyOf(values))); + if(resolved.size()!=tagResources.size())throw new AssertionError("unresolved biome tags"); + biomes.prepareTagReload(new TagLoader.LoadResult<>(Registries.BIOME,resolved)).apply(); + } + private static Holder biome(String name) {return biomes.getOrThrow(ResourceKey.create(Registries.BIOME,Identifier.parse(name)));} + private static String test(ConditionEvaluator condition) {try{return Boolean.toString(condition.test());}catch(RuntimeException error){return "error";}} + private static void loadConditions(Path dir) throws Exception { + definitions=new MappedRegistry<>(Registries.MATERIAL_CONDITION,Lifecycle.stable()); + ops=conditionOps(definitions.createRegistrationLookup()); + var data=JsonParser.parseString(Files.readString(dir.resolve("conditions.json"))).getAsJsonObject(); + for(var e:new TreeMap<>(data.asMap()).entrySet())definitions.register(ResourceKey.create(Registries.MATERIAL_CONDITION,Identifier.parse(e.getKey())),MaterialCondition.DIRECT_CODEC.parse(ops,JsonParser.parseString(e.getValue().getAsString())).getOrThrow(),RegistrationInfo.BUILT_IN); + definitions.freeze();ops=conditionOps(definitions); + } + private static void loadRules(Path dir) throws Exception { + if(!Files.exists(dir.resolve("rules.json")))return; + densities=new MappedRegistry<>(Registries.DENSITY_FUNCTION,Lifecycle.stable());densityLookup=densities.createRegistrationLookup(); + var densityJson=JsonParser.parseString(Files.readString(dir.resolve("densities.json"))).getAsJsonObject(); + for(var e:new TreeMap<>(densityJson.asMap()).entrySet())densities.register(ResourceKey.create(Registries.DENSITY_FUNCTION,Identifier.parse(e.getKey())),DensityFunctions.DIRECT_CODEC.parse(ops,JsonParser.parseString(e.getValue().getAsString())).getOrThrow(),RegistrationInfo.BUILT_IN); + densities.freeze();densityLookup=densities; + ruleDefinitions=new MappedRegistry<>(Registries.MATERIAL_RULE,Lifecycle.stable());ruleLookup=ruleDefinitions.createRegistrationLookup(); + var data=JsonParser.parseString(Files.readString(dir.resolve("rules.json"))).getAsJsonObject(); + for(var e:new TreeMap<>(data.asMap()).entrySet())ruleDefinitions.register(ResourceKey.create(Registries.MATERIAL_RULE,Identifier.parse(e.getKey())),MaterialRule.DIRECT_CODEC.parse(ops,JsonParser.parseString(e.getValue().getAsString())).getOrThrow(),RegistrationInfo.BUILT_IN); + ruleDefinitions.freeze();ruleLookup=ruleDefinitions; + } + private static VerticalAnchor anchor(JsonElement e) { + var a=e.getAsJsonArray();int v=a.get(1).getAsInt(); + return switch(a.get(0).getAsInt()) {case 0->VerticalAnchor.absolute(v);case 1->VerticalAnchor.aboveBottom(v);case 2->VerticalAnchor.belowTop(v);case 3->VerticalAnchor.relativeToSeaLevel(v);default->throw new AssertionError();}; + } + private static MaterialCondition condition(JsonElement e) { + var a=e.getAsJsonArray();return switch(a.get(0).getAsString()) { + case "temperature"->TemperatureCondition.INSTANCE; + case "above"->AbovePreliminarySurfaceCondition.INSTANCE; + case "biome"->{var selected=new ArrayList>();for(var name:a.get(1).getAsJsonArray())selected.add(biome(name.getAsString()));yield new BiomeCondition(HolderSet.direct(selected));} + case "noise"->new NoiseThresholdCondition(ResourceKey.create(Registries.NOISE,Identifier.parse(a.get(1).getAsString())),Double.longBitsToDouble(Long.parseUnsignedLong(a.get(2).getAsString(),16)),Double.longBitsToDouble(Long.parseUnsignedLong(a.get(3).getAsString(),16)),a.get(4).getAsBoolean()); + case "json"->MaterialCondition.CODEC.parse(ops,JsonParser.parseString(a.get(1).getAsString())).getOrThrow(); + case "hole"->HoleCondition.INSTANCE; + case "steep"->SteepCondition.INSTANCE; + case "y"->new YCondition(anchor(a.get(1)),a.get(2).getAsInt(),a.get(3).getAsBoolean()); + case "water"->new WaterCondition(a.get(1).getAsInt(),a.get(2).getAsInt(),a.get(3).getAsBoolean()); + case "stone"->new StoneDepthCondition(a.get(1).getAsInt(),a.get(2).getAsBoolean(),a.get(3).getAsInt(),a.get(4).getAsBoolean()?CaveSurface.CEILING:CaveSurface.FLOOR); + case "gradient"->new VerticalGradientCondition(Identifier.parse(a.get(1).getAsString()),anchor(a.get(2)),anchor(a.get(3))); + case "not"->new NotCondition(condition(a.get(1))); + default->throw new AssertionError("unknown condition "+a); + }; + } + private static BlockState[] BLOCKS; + private static DensityFunction[] oreFunctions; + private static int label(BlockState state){if(ruleDefinitions!=null)return net.minecraft.world.level.block.Block.getId(state);for(int i=0;inew BlockRule(BLOCKS[a.get(1).getAsInt()]); + case "band"->BandlandsRule.INSTANCE; + case "ore"->new OreVeinRule(BLOCKS[7],BLOCKS[8],BLOCKS[9],Float.intBitsToFloat(Integer.parseUnsignedInt(a.get(1).getAsString(),16)),oreFunctions[0],oreFunctions[1],oreFunctions[2]); + case "if"->new ConditionRule(condition(a.get(1)),rule(a.get(2))); + case "sequence"->{var rules=new ArrayList();for(var child:a.get(1).getAsJsonArray())rules.add(rule(child));yield new SequenceRule(rules);} + default->throw new AssertionError("unknown rule "+a); + }; + } + @SuppressWarnings("unchecked") + private static void fixture(JsonObject f,PrintWriter out) throws Exception { + long seed=f.get("seed").getAsLong();boolean legacy=f.get("legacy").getAsBoolean(); + var zero=DensityFunctions.zero();var router=new NoiseRouter(zero,zero,zero,zero,zero,zero,zero,zero); + var random=RandomState.create(noises,seed,legacy,Blocks.STONE.defaultBlockState(),63,router);var system=random.surfaceSystem(); + int[] depth={0};float[] secondary={0}; + if(!f.has("real_noise")||!f.get("real_noise").getAsBoolean()) { + var noiseField=RandomState.class.getDeclaredField("noiseInstances");noiseField.setAccessible(true); + var noiseCache=(Map,Noise>)noiseField.get(random); + for(var key:noises.registryKeySet())noiseCache.put(key,new Noise(){ + public net.minecraft.util.Interval range(){return net.minecraft.util.Interval.INFINITE;} + public float get(double x,double z){throw new AssertionError("unexpected 2D noise call");} + public float get(double x,double y,double z){out.println("noise query "+key.identifier()+" "+(int)x+" "+(int)y+" "+(int)z);return secondary[0];} + }); + } + Noise noise=new Noise() { + public net.minecraft.util.Interval range(){return net.minecraft.util.Interval.INFINITE;} + public float get(double x,double z){throw new AssertionError("unexpected 2D lookup");} + public float get(double x,double y,double z){if(y!=0)throw new AssertionError("unexpected secondary Y");out.println("secondary query "+(int)x+" "+(int)z);return secondary[0];} + }; + var secondaryField=MaterialSystem.class.getDeclaredField("surfaceSecondaryNoise");secondaryField.setAccessible(true);secondaryField.set(system,noise); + var getContext=VanillaAnchorOracle.class.getDeclaredMethod("context",JsonObject.class);getContext.setAccessible(true); + var generation=(WorldGenerationContext)getContext.invoke(null,f); + var ctor=MaterialRuleContext.class.getDeclaredConstructors()[0];ctor.setAccessible(true); + String[] currentBiome={"minecraft:plains"}; + Function> biomeGetter=pos->{ + out.println("biome query "+pos.getX()+" "+pos.getY()+" "+pos.getZ()); + if(currentBiome[0]==null)return null; + if(currentBiome[0].equals("#throw"))throw new IllegalStateException("fixture biome lookup failure"); + return biome(currentBiome[0]); + }; + Set> possible=null; + if(f.has("possible_biomes")&&!f.get("possible_biomes").isJsonNull()){possible=new HashSet<>();for(var name:f.getAsJsonArray("possible_biomes"))possible.add(biome(name.getAsString()));} + float[] density={0}; int[] remaining={-1}; + DensitySampler sampler=new DensitySampler(){ + public float sampleValue(SamplerContext c,int x,int y,int z){ + out.println("density query "+x+" "+y+" "+z); + if(remaining[0]==0)throw new IllegalStateException("fixture density failure"); + if(remaining[0]>0)remaining[0]--; + return density[0]; + } + public void sampleVolume(SamplerContext c,DensityBuffer b,DensityVolume v){ + out.println("density volume "+v.sizeX()+" "+v.sizeY()+" "+v.sizeZ()+" "+v.minBlockX()+" "+v.minBlockY()+" "+v.minBlockZ()+" "+v.stepBlockX()+" "+v.stepBlockY()+" "+v.stepBlockZ()); + DensitySampler.sampleVolumeNaive(c,b,v,this); + } + }; + oreFunctions=new DensityFunction[]{DensityFunctions.constant(12345),DensityFunctions.constant(12346),DensityFunctions.constant(12347)}; + float[] oreValues={1,1,-1};int[] oreRemaining={-1,-1,-1}; + if(f.has("ore_values"))for(int i=0;i<3;i++)oreValues[i]=Float.intBitsToFloat(Integer.parseUnsignedInt(f.getAsJsonArray("ore_values").get(i).getAsString(),16)); + var oreSamplers=new DensitySampler[3]; + for(int id=0;id<3;id++) {final int channel=id;oreSamplers[id]=new DensitySampler(){ + public float sampleValue(SamplerContext c,int x,int y,int z){ + out.println("ore "+channel+" query "+x+" "+y+" "+z); + if(oreRemaining[channel]==0)throw new IllegalStateException("fixture ore density failure"); + if(oreRemaining[channel]>0)oreRemaining[channel]--; + return oreValues[channel]; + } + public void sampleVolume(SamplerContext c,DensityBuffer b,DensityVolume v){ + out.println("ore "+channel+" volume "+v.sizeX()+" "+v.sizeY()+" "+v.sizeZ()+" "+v.minBlockX()+" "+v.minBlockY()+" "+v.minBlockZ()+" "+v.stepBlockX()+" "+v.stepBlockY()+" "+v.stepBlockZ()); + DensitySampler.sampleVolumeNaive(c,b,v,this); + } + };} + DensitySamplerSet densitySamplers=function->{ + if(function==system.preliminarySurfaceFunction())return sampler.bind(SamplerContext.EMPTY_UNCACHED); + for(int i=0;i<3;i++)if(function==oreFunctions[i])return oreSamplers[i].bind(SamplerContext.EMPTY_UNCACHED); + throw new AssertionError("unexpected density function"); + }; + if(ruleDefinitions!=null) { + densitySamplers=random.samplersWithContext(SamplerContext.builder().enableCaches().useBufferArena(DensityBufferArena.GLOBAL).build()); + if(f.has("library_json"))for(var value:f.getAsJsonArray("library_json"))out.println("rule decode "+(MaterialRule.DIRECT_CODEC.parse(ops,JsonParser.parseString(value.getAsString())).result().isPresent()?"ok":"error")); + } + int[] dims={16,1,16,0,0,0,1,1,1};if(f.has("volume"))for(int i=0;i<9;i++)dims[i]=f.getAsJsonArray("volume").get(i).getAsInt(); + var expected=new DensityVolume(dims[0],dims[1],dims[2],dims[3],dims[4],dims[5],dims[6],dims[7],dims[8]); + var context=(MaterialRuleContext)ctor.newInstance(system,random,expected,densitySamplers,biomeGetter,generation,possible); + var updateXZ=MaterialRuleContext.class.getDeclaredMethod("updateXZ",int.class,int.class,int.class,int.class);updateXZ.setAccessible(true); + var updateY=MaterialRuleContext.class.getDeclaredMethod("updateY",int.class,int.class,int.class,int.class);updateY.setAccessible(true); + var depthField=MaterialRuleContext.class.getDeclaredField("surfaceDepth");depthField.setAccessible(true); + var conditions=new ArrayList(); + for(var c:f.getAsJsonArray("conditions")) {var value=condition(c);out.println("runtime "+encode(value));conditions.add(value.compile(context));} + if(f.has("json"))for(var c:f.getAsJsonArray("json")) { + var value=MaterialCondition.CODEC.parse(ops,JsonParser.parseString(c.getAsString())).result(); + if(value.isEmpty())out.println("decode error");else {out.println("decode "+encode(value.get()));try{conditions.add(value.get().compile(context));}catch(IllegalStateException|NoSuchElementException error){out.println("compile error");}} + } + var rules=new ArrayList(); + if(f.has("rules"))for(var r:f.getAsJsonArray("rules"))rules.add(rule(r).compile(context)); + if(ruleDefinitions!=null)for(var name:f.getAsJsonArray("library_rules"))rules.add(ruleDefinitions.getValue(Identifier.parse(name.getAsString())).compile(context)); + for(var item:f.getAsJsonArray("ops")) { + var op=item.getAsJsonArray();switch(op.get(0).getAsString()) { + case "ore_input"->{int channel=op.get(1).getAsInt();oreValues[channel]=Float.intBitsToFloat(Integer.parseUnsignedInt(op.get(2).getAsString(),16));oreRemaining[channel]=op.get(3).getAsInt();} + case "density"->{density[0]=Float.intBitsToFloat(Integer.parseUnsignedInt(op.get(1).getAsString(),16));remaining[0]=op.get(2).getAsInt();} + case "minimum"->{try{out.println("minimum "+context.getMinSurfaceLevel());}catch(RuntimeException error){out.println("minimum error");}} + case "biome"->currentBiome[0]=op.get(1).isJsonNull()?null:op.get(1).getAsString(); + case "rule"->{try{rules.add(rule(op.get(1)).compile(context));out.println("rule added "+(rules.size()-1));}catch(RuntimeException error){out.println("rule compile error");}} + case "apply"->{for(int i=0;i{depth[0]=op.get(1).getAsInt();secondary[0]=Float.intBitsToFloat(Integer.parseUnsignedInt(op.get(2).getAsString(),16));} + case "xz"->{updateXZ.invoke(context,op.get(1).getAsInt(),op.get(2).getAsInt(),op.get(3).getAsInt(),op.get(4).getAsInt());depthField.setInt(context,depth[0]);} + case "y"->updateY.invoke(context,op.get(1).getAsInt(),op.get(2).getAsInt(),op.get(3).getAsInt(),op.get(4).getAsInt()); + case "add"->{conditions.add(condition(op.get(1)).compile(context));out.println("added "+(conditions.size()-1));} + case "eval"->{if(op.size()==1){for(int i=0;iout.println("secondary "+Long.toUnsignedString(Double.doubleToLongBits(context.getSurfaceSecondary()),16)); + default->throw new AssertionError("unknown operation "+op); + } + } + } + public static void main(String[] args) throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); + BLOCKS=Arrays.stream(new String[]{"terracotta","orange_terracotta","yellow_terracotta","brown_terracotta","red_terracotta","white_terracotta","light_gray_terracotta","stone","air","water"}).map(name->BuiltInRegistries.BLOCK.getValue(Identifier.withDefaultNamespace(name)).defaultBlockState()).toArray(BlockState[]::new); + Path dir=Path.of(args[1]);noises=new MappedRegistry<>(Registries.NOISE,Lifecycle.stable()); + var noiseDefinitions=JsonParser.parseString(Files.readString(dir.resolve("noises.json"))).getAsJsonObject(); + for(var e:noiseDefinitions.entrySet())noises.register(ResourceKey.create(Registries.NOISE,Identifier.parse(e.getKey())),NormalNoise.DIRECT_CODEC.parse(JsonOps.INSTANCE,JsonParser.parseString(e.getValue().getAsString())).getOrThrow(),RegistrationInfo.BUILT_IN); + noises.freeze();loadBiomes(dir);loadConditions(dir);loadRules(dir); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt"),StandardCharsets.UTF_8))) { + for(var name:definitions.keySet().stream().map(Object::toString).sorted().toList())out.println("registry "+name+" "+encode(definitions.getValue(Identifier.parse(name)))); + for(String line:Files.readAllLines(dir.resolve("inputs.txt")))fixture(JsonParser.parseString(line).getAsJsonObject(),out); + } + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMaterialExtensionOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMaterialExtensionOracle.java new file mode 100644 index 000000000..2204fa6e0 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMaterialExtensionOracle.java @@ -0,0 +1,67 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import com.mojang.serialization.*; +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.nio.file.*; +import java.lang.reflect.*; +import java.util.*; +import net.minecraft.core.*; +import net.minecraft.core.registries.*; +import net.minecraft.resources.*; +import net.minecraft.world.level.*; +import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.chunk.BlockColumn; +import net.minecraft.world.level.levelgen.*; +import net.minecraft.world.level.levelgen.densityfunction.DensityFunctions; +import net.minecraft.world.level.levelgen.material.MaterialSystem; +import net.minecraft.world.level.levelgen.synth.*; + +/** Original transport invoking the actual private column extension methods. */ +public final class VanillaMaterialExtensionOracle { + private static final String[] NAMES={"badlands_surface","badlands_pillar","badlands_pillar_roof","iceberg_surface","iceberg_pillar","iceberg_pillar_roof"}; + private static final String[] FIELDS={"badlandsSurfaceNoise","badlandsPillarNoise","badlandsPillarRoofNoise","icebergSurfaceNoise","icebergPillarNoise","icebergPillarRoofNoise"}; + private static MappedRegistry noises; + private static JsonObject biomes; + private static BlockState[] states; + private static Method badlands,frozen,climate,make; + private static int label(BlockState state){for(int i=0;i=0 && i=0 && iBlockState.CODEC.parse(JsonOps.INSTANCE,JsonParser.parseString(text)).getOrThrow()).toArray(BlockState[]::new); + noises=new MappedRegistry<>(Registries.NOISE,Lifecycle.stable());var definitions=JsonParser.parseString(Files.readString(dir.resolve("noises.json"))).getAsJsonObject(); + for(var e:definitions.entrySet())noises.register(ResourceKey.create(Registries.NOISE,Identifier.parse(e.getKey())),NormalNoise.DIRECT_CODEC.parse(JsonOps.INSTANCE,JsonParser.parseString(e.getValue().getAsString())).getOrThrow(),RegistrationInfo.BUILT_IN);noises.freeze(); + biomes=JsonParser.parseString(Files.readString(dir.resolve("biomes.json"))).getAsJsonObject(); + badlands=MaterialSystem.class.getDeclaredMethod("erodedBadlandsExtension",BlockColumn.class,int.class,int.class,int.class,LevelHeightAccessor.class);badlands.setAccessible(true); + frozen=MaterialSystem.class.getDeclaredMethod("frozenOceanExtension",int.class,Biome.class,BlockColumn.class,BlockPos.MutableBlockPos.class,int.class,int.class,int.class);frozen.setAccessible(true); + climate=VanillaBiomeTemperatureOracle.class.getDeclaredMethod("climate",JsonObject.class);climate.setAccessible(true);make=VanillaBiomeTemperatureOracle.class.getDeclaredMethod("make",Object.class);make.setAccessible(true); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt"),StandardCharsets.UTF_8))){for(var line:Files.readAllLines(dir.resolve("inputs.txt")))fixture(JsonParser.parseString(line).getAsJsonObject(),out);} + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMaterialStageOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMaterialStageOracle.java new file mode 100644 index 000000000..8a2e81a71 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMaterialStageOracle.java @@ -0,0 +1,181 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import com.mojang.serialization.*; +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.nio.file.*; +import java.lang.reflect.*; +import java.util.*; +import net.minecraft.core.*; +import net.minecraft.core.registries.*; +import net.minecraft.resources.*; +import net.minecraft.world.level.*; +import net.minecraft.world.level.biome.*; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.state.*; +import net.minecraft.world.level.block.state.properties.IntegerProperty; +import net.minecraft.world.level.chunk.*; +import net.minecraft.world.level.chunk.status.ChunkStatus; +import net.minecraft.world.level.levelgen.*; +import net.minecraft.world.level.levelgen.blending.Blender; +import net.minecraft.world.level.levelgen.densityfunction.*; +import net.minecraft.world.level.levelgen.material.rule.MaterialRule; +import net.minecraft.world.level.levelgen.synth.NormalNoise; + +/** Original transport calling the actual MaterialSystem.buildSurface on ProtoChunk. */ +public final class VanillaMaterialStageOracle { + private static MappedRegistry noises; + private static MappedRegistry biomes; + private static RegistryOps ops; + private static PalettedContainerFactory factory; + private static Object field(String name) throws Exception {var f=VanillaMaterialConditionOracle.class.getDeclaredField(name);f.setAccessible(true);return f.get(null);} + @SuppressWarnings("unchecked") + private static void load(Path dir) throws Exception { + noises=new MappedRegistry<>(Registries.NOISE,Lifecycle.stable()); + var data=JsonParser.parseString(Files.readString(dir.resolve("noises.json"))).getAsJsonObject(); + for(var e:data.entrySet())noises.register(ResourceKey.create(Registries.NOISE,Identifier.parse(e.getKey())),NormalNoise.DIRECT_CODEC.parse(JsonOps.INSTANCE,JsonParser.parseString(e.getValue().getAsString())).getOrThrow(),RegistrationInfo.BUILT_IN);noises.freeze(); + var field=VanillaMaterialConditionOracle.class.getDeclaredField("noises");field.setAccessible(true);field.set(null,noises); + for(var name:new String[]{"loadBiomes","loadConditions","loadRules"}){var method=VanillaMaterialConditionOracle.class.getDeclaredMethod(name,Path.class);method.setAccessible(true);method.invoke(null,dir);} + biomes=(MappedRegistry)field("biomes");ops=(RegistryOps)field("ops"); + VanillaHeightmapOracle.bindTags(JsonParser.parseString(Files.readString(dir.resolve("block_tags.json"))).getAsJsonObject()); + var ids=new IdMapper>();for(var id:biomes.keySet())ids.add(biome(id.toString())); + factory=new PalettedContainerFactory(Strategy.createForBlockStates(Block.BLOCK_STATE_REGISTRY),Blocks.AIR.defaultBlockState(),null,Strategy.createForBiomes(ids),biome("minecraft:plains"),null); + var carvers=new MappedRegistry(Registries.CARVER,Lifecycle.stable()); + var carverJson=JsonParser.parseString(Files.readString(dir.resolve("carvers.json"))).getAsJsonObject(); + for(var e:carverJson.entrySet())carvers.register(ResourceKey.create(Registries.CARVER,Identifier.parse(e.getKey())),net.minecraft.world.level.levelgen.carver.WorldCarver.DIRECT_CODEC.parse(JsonOps.INSTANCE,JsonParser.parseString(e.getValue().getAsString())).getOrThrow(),RegistrationInfo.BUILT_IN);carvers.freeze(); + var carverOps=RegistryOps.create(JsonOps.INSTANCE,new RegistryOps.RegistryInfoLookup(){public Optional> lookup(ResourceKey> key){if(key.equals(Registries.CARVER))return (Optional>)(Optional)Optional.of(carvers);return Optional.empty();}}); + var generationField=Biome.class.getDeclaredField("generationSettings");generationField.setAccessible(true);var biomeJson=JsonParser.parseString(Files.readString(dir.resolve("biomes.json"))).getAsJsonObject(); + for(var e:biomeJson.entrySet()) { + var config=new JsonObject();config.add("carvers",JsonParser.parseString(e.getValue().getAsString()).getAsJsonObject().get("carvers"));config.add("features",new JsonArray()); + generationField.set(biome(e.getKey()).value(),BiomeGenerationSettings.CODEC.codec().parse(carverOps,config).getOrThrow()); + } + } + @SuppressWarnings("unchecked") + private static RegistryOps biomeOps() { + var presets=new MappedRegistry(Registries.MULTI_NOISE_BIOME_SOURCE_PARAMETER_LIST,Lifecycle.stable()); + for(var preset:List.of(MultiNoiseBiomeSourceParameterList.Preset.OVERWORLD,MultiNoiseBiomeSourceParameterList.Preset.NETHER))presets.register(ResourceKey.create(Registries.MULTI_NOISE_BIOME_SOURCE_PARAMETER_LIST,preset.id()),new MultiNoiseBiomeSourceParameterList(preset,biomes),RegistrationInfo.BUILT_IN);presets.freeze(); + return RegistryOps.create(JsonOps.INSTANCE,new RegistryOps.RegistryInfoLookup(){public Optional> lookup(ResourceKey> key){ + if(key.equals(Registries.BIOME))return (Optional>)(Optional)Optional.of(biomes); + if(key.equals(Registries.MULTI_NOISE_BIOME_SOURCE_PARAMETER_LIST))return (Optional>)(Optional)Optional.of(presets);return Optional.empty();}}); + } + private static Holder biome(String name){return biomes.getOrThrow(ResourceKey.create(Registries.BIOME,Identifier.parse(name)));} + private static void export(Path path) throws Exception { + var method=VanillaHeightmapOracle.class.getDeclaredMethod("facts");method.setAccessible(true);var facts=(JsonObject)method.invoke(null); + var integers=new JsonArray();for(var id:new TreeSet<>(BuiltInRegistries.BLOCK.keySet()))for(var p:BuiltInRegistries.BLOCK.getValue(id).getStateDefinition().getProperties())if(p instanceof IntegerProperty){var a=new JsonArray();a.add(id.toString());a.add(p.getName());integers.add(a);} + facts.add("integers",integers);Files.writeString(path,facts.toString(),StandardCharsets.UTF_8); + } + private static void fixture(JsonObject f,PrintWriter out) throws Exception { + int cx=f.get("cx").getAsInt(),cz=f.get("cz").getAsInt(),min=f.get("min").getAsInt(),height=f.get("height").getAsInt(),sea=f.get("sea").getAsInt(); + long seed=f.get("seed").getAsLong();boolean legacy=f.get("legacy").getAsBoolean(); + var rule=MaterialRule.CODEC.parse(ops,new JsonPrimitive(f.get("rule").getAsString())).getOrThrow(); + var routerJson=new JsonObject();for(var name:new String[]{"chunk_surface_level","continents","depth","erosion","final_density","ridges","temperature","vegetation"})routerJson.addProperty(name,0);routerJson.add("chunk_surface_level",f.get("preliminary")); + if(f.has("router"))routerJson=f.getAsJsonObject("router"); + var router=NoiseRouter.CODEC.parse(ops,routerJson).getOrThrow();var defaultBlock=Block.stateById(f.get("default").getAsInt()); + Optional aquifers=f.has("aquifers")&&!f.get("aquifers").isJsonNull()?Optional.of(Aquifer.Config.CODEC.parse(ops,f.get("aquifers")).getOrThrow()):Optional.empty(); + var fluid=f.has("fluid")?Block.stateById(f.get("fluid").getAsInt()):Blocks.WATER.defaultBlockState(); + var settings=new NoiseGeneratorSettings(NoiseSettings.create(f.get("noise_min").getAsInt(),f.get("noise_height").getAsInt()),defaultBlock,fluid,router,Holder.direct(rule),List.of(),sea,false,aquifers,legacy,NoiseGeneratorSettings.DebugFunctions.EMPTY); + var random=RandomState.create(noises,seed,legacy,defaultBlock,sea,router); + var bounds=LevelHeightAccessor.create(f.get("write_min").getAsInt(),f.get("write_max").getAsInt()-f.get("write_min").getAsInt()+1); + var chunk=new ProtoChunk(new ChunkPos(cx,cz),UpgradeData.EMPTY,LevelHeightAccessor.create(min,height),factory,null){@Override public LevelHeightAccessor getHeightAccessorForGeneration(){return bounds;}}; + chunk.setPersistedStatus(ChunkStatus.BIOMES); + for(var value:f.getAsJsonArray("initial")){var a=value.getAsJsonArray();int x=a.get(0).getAsInt(),z=a.get(2).getAsInt();for(int y=a.get(1).getAsInt();y<=a.get(3).getAsInt();y++)chunk.getSection(chunk.getSectionIndex(y)).setBlockState(x&15,y&15,z&15,Block.stateById(a.get(4).getAsInt()),false);} + if(f.get("prime").getAsBoolean())Heightmap.primeHeightmaps(chunk,EnumSet.of(Heightmap.Types.WORLD_SURFACE_WG,Heightmap.Types.OCEAN_FLOOR_WG)); + var neighborhood=new HashMap(); + BiomeSource source=null; + if(f.has("biome_source")) { + source=BiomeSource.CODEC.parse(biomeOps(),f.get("biome_source_json")).getOrThrow(); + var generator=new NoiseBasedChunkGenerator(source,Holder.direct(settings)); + var create=ChunkGenerator.class.getDeclaredMethod("doCreateBiomes",Blender.class,RandomState.class,ChunkAccess.class);create.setAccessible(true); + for(int dx=-1;dx<=1;dx++)for(int dz=-1;dz<=1;dz++) { + int x=cx+dx,z=cz+dz;var neighbor=dx==0&&dz==0?chunk:new ProtoChunk(new ChunkPos(x,z),UpgradeData.EMPTY,LevelHeightAccessor.create(min,height),factory,null); + neighbor.setPersistedStatus(ChunkStatus.BIOMES);create.invoke(generator,Blender.empty(),random,neighbor); + out.println("biomechunk "+x+" "+z); + for(int section=0;section{ + Holder value; + if(!neighborhood.isEmpty())value=neighborhood.get(ChunkPos.pack(x>>2,z>>2)).getNoiseBiome(x,y,z); + else {int hash=x*31+y*7+z*17;value=biome(names.get(Math.floorMod(hash,names.size())).getAsString());} + out.println("quart "+x+" "+y+" "+z+" "+biomes.getKey(value.value()));return value; + },BiomeManager.obfuscateSeed(seed)) { + @Override public Holder getBiome(BlockPos pos) { + Holder value; + if(zoom)value=super.getBiome(pos); + else {int hash=pos.getX()*31+pos.getY()*7+pos.getZ()*17;value=biome(names.get(Math.floorMod(hash,names.size())).getAsString());} + out.println("biome "+pos.getX()+" "+pos.getY()+" "+pos.getZ()+" "+biomes.getKey(value.value()));return value; + } + }; + Set> possible=null;if(!f.get("possible").isJsonNull()){possible=new HashSet<>();for(var name:f.getAsJsonArray("possible"))possible.add(biome(name.getAsString()));} + var contextInput=new JsonObject();var contextArray=new JsonArray();contextArray.add(min);contextArray.add(height);contextArray.add(sea);contextInput.add("context",contextArray); + var contextMethod=VanillaAnchorOracle.class.getDeclaredMethod("context",JsonObject.class);contextMethod.setAccessible(true);var context=(WorldGenerationContext)contextMethod.invoke(null,contextInput); + var volume=new DensityVolume(16,f.get("noise_height").getAsInt(),16,cx<<4,f.get("noise_min").getAsInt(),cz<<4); + var pickerMethod=NoiseBasedChunkGenerator.class.getDeclaredMethod("createFluidPicker",NoiseGeneratorSettings.class);pickerMethod.setAccessible(true); + var picker=(Aquifer.FluidPicker)pickerMethod.invoke(null,settings); + try(var noise=new NoiseChunk(random,Beardifier.EMPTY,settings,picker,Blender.empty(),volume)) { + if(f.has("router")) { + var generator=new NoiseBasedChunkGenerator(new FixedBiomeSource(biome(names.get(0).getAsString())),Holder.direct(settings)); + var fill=NoiseBasedChunkGenerator.class.getDeclaredMethod("doFill",NoiseChunk.class,ChunkAccess.class);fill.setAccessible(true);fill.invoke(generator,noise,chunk); + out.println("terrain "+noise.aquifer().shouldScheduleFluidUpdate());dump(chunk,height,out); + } + for(int repeat=0;repeat codec(){return com.mojang.serialization.MapCodec.unit(delegateSource);} + protected java.util.stream.Stream> collectPossibleBiomes(){return delegateSource.possibleBiomes().stream();} + public BiomeResolver createResolver(Climate.Sampler sampler) { + var resolver=delegateSource.createResolver(sampler); + return (x,y,z)->{var value=resolver.getNoiseBiome(x,y,z);out.println("rawquart "+x+" "+y+" "+z+" "+biomes.getKey(value.value()));return value;}; + } + }; + var generator=new NoiseBasedChunkGenerator(tracedSource,Holder.direct(settings)); + var generate=NoiseBasedChunkGenerator.class.getDeclaredMethod("generateCarvers",ChunkAccess.class,Blender.class,NoiseChunk.class,RandomState.class,BiomeManager.class,net.minecraft.server.level.WorldGenRegion.class,MaterialRule.class);generate.setAccessible(true); + try {generate.invoke(generator,chunk,Blender.empty(),noise,random,manager,null,rule);out.println("generatedcarving ok");} + catch(java.lang.reflect.InvocationTargetException error){out.println("generatedcarving error");error.getCause().printStackTrace();} + dump(chunk,height,out); + } + var carving=f.getAsJsonObject("carving"); + for(var value:carving.getAsJsonArray("initial")) {var q=value.getAsJsonArray();chunk.setBlockState(new BlockPos(q.get(0).getAsInt(),q.get(1).getAsInt(),q.get(2).getAsInt()),Block.stateById(q.get(3).getAsInt()));} + var mask=new CarvingMask(min+1,min+height-8); + for(var value:carving.getAsJsonArray("spans")) {var q=value.getAsJsonArray();for(int y=q.get(2).getAsInt();y<=q.get(3).getAsInt();y++)mask.carve(q.get(0).getAsInt(),y,q.get(1).getAsInt());} + var generator=new NoiseBasedChunkGenerator(new FixedBiomeSource(biome(names.get(0).getAsString())),Holder.direct(settings)); + var apply=NoiseBasedChunkGenerator.class.getDeclaredMethod("applyCarvingMask",ChunkAccess.class,CarvingMask.class,RandomState.class,MaterialRule.class,WorldGenerationContext.class,NoiseChunk.class,java.util.function.Function.class,CarvingMask.Filter.class);apply.setAccessible(true); + for(var value:carving.getAsJsonArray("filters")) { + int mode=value.getAsInt();CarvingMask.Filter filter=mode==0?null:(x,y,z)->{boolean keep=mode==1&&Math.floorMod(x*31+y*7+z*17,5)!=0;out.println("filter "+x+" "+y+" "+z+" "+keep);return keep;}; + try {apply.invoke(generator,chunk,mask,random,rule,context,noise,(java.util.function.Function>)manager::getBiome,filter);out.println("carving "+mode+" ok");} + catch(java.lang.reflect.InvocationTargetException error){out.println("carving "+mode+" error");error.getCause().printStackTrace();} + dump(chunk,height,out); + } + } + } + private static void dump(ProtoChunk chunk,int height,PrintWriter out) { + for(int section=0;section noises; + private static int label(BlockState state) { + String name=BuiltInRegistries.BLOCK.getKey(state.getBlock()).toString(); + for(int i=0;i(Registries.NOISE,Lifecycle.stable()); + var definitions=JsonParser.parseString(Files.readString(dir.resolve("noises.json"))).getAsJsonObject(); + for(var e:definitions.entrySet())noises.register(ResourceKey.create(Registries.NOISE,Identifier.parse(e.getKey())),NormalNoise.DIRECT_CODEC.parse(JsonOps.INSTANCE,JsonParser.parseString(e.getValue().getAsString())).getOrThrow(),RegistrationInfo.BUILT_IN); + noises.freeze(); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt"),StandardCharsets.UTF_8))) { + for(String line:Files.readAllLines(dir.resolve("inputs.txt")))fixture(JsonParser.parseString(line).getAsJsonObject(),out); + } + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaNoiseOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaNoiseOracle.java new file mode 100644 index 000000000..cf0cfb7d9 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaNoiseOracle.java @@ -0,0 +1,149 @@ +package dev.horizonlab.parity; + +import java.io.PrintWriter; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.StringTokenizer; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.levelgen.LegacyRandomSource; +import net.minecraft.world.level.levelgen.XoroshiroRandomSource; +import net.minecraft.world.level.levelgen.synth.GradientNoise; +import net.minecraft.world.level.levelgen.synth.Noise; +import net.minecraft.world.level.levelgen.synth.NoiseStack; +import net.minecraft.world.level.levelgen.synth.NormalNoise; +import net.minecraft.world.level.levelgen.synth.PerlinNoise; +import net.minecraft.world.level.levelgen.synth.SimplexNoise; +import net.minecraft.world.level.levelgen.synth.SmearedPerlinNoise; +import net.minecraft.world.level.levelgen.densityfunction.DensityBuffer; +import net.minecraft.world.level.levelgen.densityfunction.DensityVolume; + +/** Original transport adapter; samples the reference classes directly. */ +public final class VanillaNoiseOracle { + private static int integer(StringTokenizer args) { return Integer.parseInt(args.nextToken()); } + private static double number(StringTokenizer args) { return Double.longBitsToDouble(Long.parseUnsignedLong(args.nextToken(),16)); } + private static float small(StringTokenizer args) { return Float.intBitsToFloat(Integer.parseUnsignedInt(args.nextToken(),16)); } + private static String bits(float value) { return Integer.toUnsignedString(Float.floatToIntBits(value)); } + private static String bits(double value) { return Long.toUnsignedString(Double.doubleToLongBits(value)); } + private static Object field(Object object, String name) throws Exception { + Field field=GradientNoise.class.getDeclaredField(name);field.setAccessible(true);return field.get(object); + } + private static Object declared(Object object,String name) throws Exception { + Field field=object.getClass().getDeclaredField(name);field.setAccessible(true);return field.get(object); + } + private static void normal(StringTokenizer args,PrintWriter out) throws Exception { + String kind=args.nextToken();long seed=Long.parseLong(args.nextToken());int parity=integer(args),base=integer(args),count=integer(args),normalization=integer(args); + double amplitude=number(args);double[] modifiers=new double[integer(args)];for(int i=0;i)declared(definition,"octaves"); + out.printf("normal %d %s %s %s%n",octaves.size(),bits((double)declared(definition,"normalizationFactor")),bits(definition.range().min()),bits(definition.range().max())); + for(Object octave:octaves) { + Method name=octave.getClass().getDeclaredMethod("seed");name.setAccessible(true); + out.printf("octave %d %s %s %s%n",(int)declared(octave,"octaveIndex"),bits((double)declared(octave,"frequency")),bits((double)declared(octave,"amplitude")),name.invoke(octave)); + } + NoiseStack noise; + try { noise=(NoiseStack)((parity&2)!=0?definition.createForLegacyNetherBiome(random):definition.create(random)); } + catch(IllegalArgumentException | IllegalStateException e) { out.println("normal-create error");out.println("normal-parent "+random.nextLong());return; } + Field layerField=NoiseStack.class.getDeclaredField("layers");layerField.setAccessible(true);Object[] layers=(Object[])layerField.get(noise); + out.printf("normal-create %d %s %s%n",layers.length,bits(noise.range().min()),bits(noise.range().max())); + for(int i=0;i(); + Method wrap=GradientNoise.class.getDeclaredMethod("wrap",double.class);wrap.setAccessible(true); + try(var reader=Files.newBufferedReader(Path.of(paths[0]),StandardCharsets.UTF_8); + var out=new PrintWriter(Files.newBufferedWriter(Path.of(paths[1]),StandardCharsets.UTF_8))) { + String line; + while((line=reader.readLine())!=null) { + var args=new StringTokenizer(line); + String operation=args.nextToken(); + switch(operation) { + case "normal" -> normal(args,out); + case "create" -> { + String kind=args.nextToken(),stream=args.nextToken();long seed=Long.parseLong(args.nextToken()); + boolean skip=integer(args)!=0;double scale=number(args); + RandomSource random=switch(stream) {case "legacy"->new LegacyRandomSource(seed);case "xoroshiro"->new XoroshiroRandomSource(seed);default->throw new AssertionError();}; + GradientNoise noise=switch(kind) {case "perlin"->new PerlinNoise(random);case "simplex"->new SimplexNoise(random,skip);case "smeared"->new SmearedPerlinNoise(random,scale);default->throw new AssertionError();}; + samplers.add(noise); + String lower,upper; + try { lower=bits(noise.range().min());upper=bits(noise.range().max()); } + catch(IllegalArgumentException e) { lower="error";upper="error"; } + out.printf("create %s %s %s %s %s %d%n",bits((double)field(noise,"offsetX")),bits((double)field(noise,"offsetY")),bits((double)field(noise,"offsetZ")),lower,upper,random.nextLong()); + out.print("permutations");for(byte v:(byte[])field(noise,"perms"))out.print(" "+(v&255));out.println(); + } + case "query", "local" -> { + var noise=samplers.get(integer(args));double x=number(args),y=number(args),z=number(args); + if(operation.equals("local")) { x-=(double)field(noise,"offsetX");y-=(double)field(noise,"offsetY");z-=(double)field(noise,"offsetZ"); } + float[] derivative={small(args),small(args),small(args)}; + out.print("query "+bits(noise.get(x,z))+" "+bits(noise.get(x,y,z))); + if(noise instanceof PerlinNoise perlin)out.print(" "+bits(perlin.noiseWithDerivative(x,y,z,derivative))+" "+bits(derivative[0])+" "+bits(derivative[1])+" "+bits(derivative[2])); + out.println(); + } + case "volume" -> { + var noise=samplers.get(integer(args)); + int sx=integer(args),sy=integer(args),sz=integer(args),mx=integer(args),my=integer(args),mz=integer(args),dx=integer(args),dy=integer(args),dz=integer(args); + double xzScale=number(args),yScale=number(args);float amplitude=small(args);long seed=Long.parseLong(args.nextToken());int repeats=integer(args); + DensityVolume volume; + try { volume=new DensityVolume(sx,sy,sz,mx,my,mz,dx,dy,dz); } + catch(IllegalArgumentException e) { out.println("volume error");break; } + var buffer=DensityBuffer.createUnpooled(volume.size()+4);var random=new LegacyRandomSource(seed); + for(int i=0;i { + int count=integer(args);var builder=NoiseStack.builder(); + for(int i=0;i out.println("wrap "+bits((double)wrap.invoke(null,number(args)))); + default -> throw new AssertionError(); + } + if(args.hasMoreTokens())throw new AssertionError("extra argument"); + } + if(out.checkError())throw new java.io.IOException("reference output failed"); + } + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPistonShapeOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPistonShapeOracle.java new file mode 100644 index 000000000..4df179e17 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPistonShapeOracle.java @@ -0,0 +1,41 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*; +import java.lang.reflect.*; +import java.nio.file.*; +import net.minecraft.core.*; +import net.minecraft.world.level.*; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.piston.PistonMovingBlockEntity; +import net.minecraft.world.phys.shapes.*; +/** Executes native moving-piston collision and interpolation with actual registry states. */ +public final class VanillaPistonShapeOracle { + private static final class Stop extends RuntimeException {} + private static Field field(String name)throws Exception {var f=PistonMovingBlockEntity.class.getDeclaredField(name);f.setAccessible(true);return f;} + private static float number(JsonElement value){return Float.intBitsToFloat(Integer.parseUnsignedInt(value.getAsString(),16));} + @SuppressWarnings("unchecked") public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();Path dir=Path.of(args[1]); + if(args[0].equals("export")){VanillaCollisionOracle.main(new String[]{"generate",args[1]});VanillaBlockStateCodecOracle.main(new String[]{"export",dir.resolve("facts.json").toString()});return;} + var progress=field("progress");var previous=field("progressO");var noclip=(ThreadLocal)field("NOCLIP").get(null); + var related=PistonMovingBlockEntity.class.getDeclaredMethod("getCollisionRelatedBlockState");related.setAccessible(true); + var movement=PistonMovingBlockEntity.class.getDeclaredMethod("getMovementDirection");movement.setAccessible(true); + var emit=VanillaFaceSupportOracle.class.getDeclaredMethod("emit",PrintWriter.class,VoxelShape.class);emit.setAccessible(true); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var inputs=Files.lines(dir.resolve("inputs.txt"))) { + for(var line:(Iterable)inputs::iterator) { + var f=JsonParser.parseString(line).getAsJsonObject();var v=f.getAsJsonArray("position");var p=new BlockPos(v.get(0).getAsInt(),v.get(1).getAsInt(),v.get(2).getAsInt()); + var direction=Direction.values()[f.get("direction").getAsInt()];var moved=Block.stateById(f.get("state").getAsInt()); + var piston=new PistonMovingBlockEntity(p,Blocks.MOVING_PISTON.defaultBlockState(),moved,direction,f.get("extending").getAsBoolean(),f.get("source").getAsBoolean());progress.setFloat(piston,number(f.get("progress")));previous.setFloat(piston,number(f.get("previous")));float partial=number(f.get("partial")); + int clip=f.get("noclip").getAsInt();noclip.set(clip<0?null:Direction.values()[clip]);int[] calls={0}; + var world=(BlockGetter)Proxy.newProxyInstance(BlockGetter.class.getClassLoader(),new Class[]{BlockGetter.class},(proxy,method,values)->{ + if(!method.getName().equals("getBlockEntity"))throw new AssertionError(method);var at=(BlockPos)values[0];out.println("entity "+at.getX()+" "+at.getY()+" "+at.getZ());if(calls[0]++==f.get("fail").getAsInt())throw new Stop();return null; + }); + try { + out.printf("motion %d %08x %08x %08x %08x%n",((Direction)movement.invoke(piston)).ordinal(),Float.floatToIntBits(piston.getProgress(partial)),Float.floatToIntBits(piston.getXOff(partial)),Float.floatToIntBits(piston.getYOff(partial)),Float.floatToIntBits(piston.getZOff(partial))); + out.println("related "+Block.getId((net.minecraft.world.level.block.state.BlockState)related.invoke(piston))); + if(!f.get("kinematic").getAsBoolean())try {emit.invoke(null,out,piston.getCollisionShape(world,p));}catch(Stop error){out.println("shape error");} + out.println("queries "+calls[0]); + } finally {noclip.remove();} + } + } + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java new file mode 100644 index 000000000..528b8f893 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java @@ -0,0 +1,101 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import com.mojang.serialization.JsonOps; +import java.io.*; +import java.lang.reflect.Proxy; +import java.lang.reflect.InvocationHandler; +import java.nio.charset.StandardCharsets; +import java.nio.file.*; +import java.util.*; +import net.minecraft.core.*; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.*; +import net.minecraft.world.level.biome.*; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.levelgen.*; +import net.minecraft.world.level.levelgen.densityfunction.DensityFunctions; +import net.minecraft.world.level.levelgen.material.rule.BlockRule; +import net.minecraft.world.level.levelgen.placement.*; + +/** Original transport invoking actual placement codecs and modifier callbacks. */ +public final class VanillaPlacementOracle { + private static final class Stop extends RuntimeException {} + private static PlacementContext context(JsonObject f) {return context(f,null);} + private static PlacementContext context(JsonObject f,PrintWriter out) { + var v=f.getAsJsonArray("context");int min=v.get(0).getAsInt(),height=v.get(1).getAsInt(),sea=v.get(2).getAsInt(); + var zero=DensityFunctions.zero(); + var settings=new NoiseGeneratorSettings(new NoiseSettings(min,height),Blocks.STONE.defaultBlockState(),Blocks.WATER.defaultBlockState(),new NoiseRouter(zero,zero,zero,zero,zero,zero,zero,zero),Holder.direct(new BlockRule(Blocks.STONE.defaultBlockState())),List.of(),sea,false,Optional.empty(),false,NoiseGeneratorSettings.DebugFunctions.EMPTY); + var biome=Holder.Reference.createStandAlone(new HolderOwner(){},Biomes.PLAINS); + var generator=new NoiseBasedChunkGenerator(new FixedBiomeSource(biome),Holder.direct(settings)); + int worldMin=f.has("world_min")?f.get("world_min").getAsInt():min;int mode=f.has("height_mode")?f.get("height_mode").getAsInt():0;int fail=f.has("query_fail")?f.get("query_fail").getAsInt():-1;int[] calls={0};boolean layerWorld=f.has("layer_world")&&f.get("layer_world").getAsBoolean(); + var level=(WorldGenLevel)Proxy.newProxyInstance(WorldGenLevel.class.getClassLoader(),new Class[]{WorldGenLevel.class},(proxy,method,args)->switch(method.getName()) { + case "isInsideBuildHeight"->{ + if(args[0] instanceof BlockPos p) { + if(out!=null)out.println("inside "+p.getX()+" "+p.getY()+" "+p.getZ()); + if(calls[0]++==fail)throw new IllegalArgumentException("bounds query failure"); + var result=InvocationHandler.invokeDefault(proxy,method,args); + if(out!=null)out.println("bounds_result "+result);yield result; + } + yield InvocationHandler.invokeDefault(proxy,method,args); + } + case "isOutsideBuildHeight"->{ + if(out!=null)out.println("outside "+args[0]); + if(calls[0]++==fail)throw new IllegalArgumentException("bounds query failure"); + var result=InvocationHandler.invokeDefault(proxy,method,args); + if(out!=null)out.println("bounds_result "+result);yield result; + } + case "getMaxY"->InvocationHandler.invokeDefault(proxy,method,args); + case "getMinY"->worldMin; + case "getHeight"->{ + if(args==null||args.length==0)yield height; + var kind=(Heightmap.Types)args[0];int x=(Integer)args[1],z=(Integer)args[2]; + if(out!=null)out.println("height "+kind.name()+" "+x+" "+z); + if(calls[0]++==fail)throw new IllegalArgumentException("height query failure"); + int result; + if(layerWorld)result=min+24+((x^z)&3); + else if(mode==0)result=min+Math.floorMod(x*31+z*17+kind.ordinal()*7,129)-64; + else {int[] values={Integer.MIN_VALUE,Integer.MAX_VALUE,0,-1,min,min+1};result=values[(kind.ordinal()+((x^z)&3))%6];} + if(out!=null)out.println("height_result "+result);yield result; + } + case "getBlockState"->{ + var p=(BlockPos)args[0];if(out!=null)out.println("block "+p.getX()+" "+p.getY()+" "+p.getZ()); + if(calls[0]++==fail)throw new IllegalArgumentException("block query failure"); + var blocks=new net.minecraft.world.level.block.Block[]{Blocks.BEDROCK,Blocks.STONE,Blocks.AIR,Blocks.WATER,Blocks.DIRT,Blocks.CAVE_AIR,Blocks.LAVA,Blocks.BUBBLE_COLUMN,Blocks.VOID_AIR,Blocks.GRASS_BLOCK,Blocks.AIR,Blocks.WATER}; + int index=p.getY()<=min?0:Math.floorMod(p.getY()-min+((p.getX()*31+p.getZ()*17)&3),12); + var block=blocks[index];if(out!=null)out.println("block_result "+net.minecraft.core.registries.BuiltInRegistries.BLOCK.getKey(block));yield block.defaultBlockState(); + } + case "getSeaLevel"->sea; + default->throw new AssertionError("unexpected world method "+method); + }); + var context=new PlacementContext(level,generator,Optional.empty());return context; + } + public static void main(String[] args) throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt"),StandardCharsets.UTF_8))) { + for(var line:Files.readAllLines(dir.resolve("inputs.txt"))) { + var f=JsonParser.parseString(line).getAsJsonObject();var context=context(f,out);long seed=f.get("seed").getAsLong(); + RandomSource random=f.get("legacy").getAsBoolean()?new LegacyRandomSource(seed):new XoroshiroRandomSource(seed); + Optional decoded; + try {decoded=PlacementModifier.CODEC.parse(JsonOps.INSTANCE,JsonParser.parseString(f.get("definition").getAsString())).result();}catch(IllegalArgumentException error){decoded=Optional.empty();} + if(decoded.isEmpty())out.println("decode error");else { + out.println("decode ok");var provider=decoded.get(); + for(var value:f.getAsJsonArray("positions")) { + var p=value.getAsJsonArray();var position=new BlockPos(p.get(0).getAsInt(),p.get(1).getAsInt(),p.get(2).getAsInt()); + if(f.has("count_only")&&f.get("count_only").getAsBoolean()) { + try {out.println("count "+((RepeatingPlacement)provider).count(random,position));}catch(IllegalArgumentException error){out.println("count error");} + out.println("next "+random.nextLong());continue; + } + int[] count={0};int fail=f.get("fail").getAsInt();boolean draw=f.get("draw").getAsBoolean(); + try {provider.modify(context,random,position,result->{ + if(count[0]++==fail)throw new Stop(); + out.println("position "+result.getX()+" "+result.getY()+" "+result.getZ()); + if(draw)out.println("consumer "+random.nextLong()); + });out.println("modify ok");}catch(Stop|IllegalArgumentException error){out.println("modify error");} + out.println("next "+random.nextLong()); + } + } + out.println("tail "+random.nextLong()); + } + } + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaReplaceBlockOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaReplaceBlockOracle.java new file mode 100644 index 000000000..1f14fbec8 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaReplaceBlockOracle.java @@ -0,0 +1,74 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import com.mojang.serialization.JsonOps; +import java.io.*; +import java.lang.reflect.*; +import java.nio.charset.StandardCharsets; +import java.nio.file.*; +import java.util.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Holder; +import net.minecraft.world.level.levelgen.placement.*; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.WorldGenLevel; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.levelgen.*; +import net.minecraft.world.level.levelgen.feature.Feature; + +/** Invokes native block-writing features through an observable mutable world. */ +public final class VanillaReplaceBlockOracle { + private static final class Stop extends RuntimeException {} + public static void main(String[] args) throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); + final Block[] BLOCKS={Blocks.AIR,Blocks.CAVE_AIR,Blocks.VOID_AIR,Blocks.STONE,Blocks.WATER,Blocks.OAK_LEAVES,Blocks.DIRT}; + if(args[0].equals("export")) { + VanillaBlockStateCodecOracle.main(args); + return; + } + Path dir=Path.of(args[1]); + VanillaHeightmapOracle.bindTags(JsonParser.parseString(Files.readString(dir.resolve("tags.json"))).getAsJsonObject()); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt"),StandardCharsets.UTF_8))) { + for(var line:Files.readAllLines(dir.resolve("inputs.txt"))) { + var f=JsonParser.parseString(line).getAsJsonObject();long seed=f.get("seed").getAsLong(); + RandomSource random=f.get("legacy").getAsBoolean()?new LegacyRandomSource(seed):new XoroshiroRandomSource(seed); + var decoded=Feature.DIRECT_CODEC.parse(JsonOps.INSTANCE,JsonParser.parseString(f.get("definition").getAsString())).result(); + if(decoded.isEmpty())out.println("decode error");else { + out.println("decode ok");int[] calls={0};int fail=f.get("fail").getAsInt(),reject=f.get("reject").getAsInt(); + var states=new TreeMap(Comparator.comparingInt(BlockPos::getX).thenComparingInt(BlockPos::getY).thenComparingInt(BlockPos::getZ)); + var world=(WorldGenLevel)Proxy.newProxyInstance(WorldGenLevel.class.getClassLoader(),new Class[]{WorldGenLevel.class},(proxy,method,values)->{ + if(method.getName().equals("getMinY")) { + out.println("min");int call=calls[0]++;if(call==fail)throw new Stop(); + int minimum=f.get("world_min").getAsInt();out.println("minimum "+minimum);return minimum; + } + if(method.getName().equals("getHeight")&&(values==null||values.length==0))return 384; + if(method.getName().equals("getSeaLevel"))return 63; + if(method.getName().equals("setBlockAndUpdate"))return InvocationHandler.invokeDefault(proxy,method,values); + var p=((BlockPos)values[0]).immutable();int call=calls[0]++; + switch(method.getName()) { + case "getBlockState"->{ + out.println("get "+p.getX()+" "+p.getY()+" "+p.getZ());if(call==fail)throw new Stop(); + var state=states.getOrDefault(p,BLOCKS[Math.floorMod(p.getX()*31+p.getY()*7+p.getZ()*17,7)].defaultBlockState());out.println("state "+Block.getId(state));return state; + } + case "setBlock"->{ + var state=(BlockState)values[1];int flags=(Integer)values[2];out.println("set "+p.getX()+" "+p.getY()+" "+p.getZ()+" "+Block.getId(state)+" "+flags);if(call==fail)throw new Stop(); + boolean result=reject==0||call%reject!=0;if(result)states.put(p,state);out.println("written "+result);return result; + } + default->throw new AssertionError("unexpected world method "+method); + } + }); + var p=f.getAsJsonArray("origin");var origin=new BlockPos(p.get(0).getAsInt(),p.get(1).getAsInt(),p.get(2).getAsInt()); + for(int repeat=0;repeat)inputs::iterator) { + var f=JsonParser.parseString(line).getAsJsonObject();long seed=f.get("seed").getAsLong(); + RandomSource random=f.get("legacy").getAsBoolean()?new LegacyRandomSource(seed):new XoroshiroRandomSource(seed); + var decoded=RuleTest.CODEC.parse(JsonOps.INSTANCE,JsonParser.parseString(f.get("definition").getAsString())).result(); + if(decoded.isEmpty())out.println("decode error");else { + out.println("decode ok");int index=0;var heights=f.getAsJsonArray("heights"); + for(int repeat=0;repeat(Comparator.comparingInt(BlockPos::getX).thenComparingInt(BlockPos::getY).thenComparingInt(BlockPos::getZ)); + var o=f.getAsJsonArray("origin");var center=new BlockPos(o.get(0).getAsInt(),o.get(1).getAsInt(),o.get(2).getAsInt()); + int mode=f.get("mode").getAsInt(); + var world=(WorldGenLevel)Proxy.newProxyInstance(WorldGenLevel.class.getClassLoader(),new Class[]{WorldGenLevel.class},(proxy,method,values)->{ + if(method.getName().equals("getMinY")) { + out.println("min");int call=calls[0]++;if(call==fail)throw new Stop(); + int minimum=f.get("world_min").getAsInt();out.println("minimum "+minimum);return minimum; + } + if(method.getName().equals("getHeight")&&(values==null||values.length==0))return 384; + if(method.getName().equals("getSeaLevel"))return 63; + if(method.getName().equals("setBlockAndUpdate"))return InvocationHandler.invokeDefault(proxy,method,values); + var p=((BlockPos)values[0]).immutable();int call=calls[0]++; + switch(method.getName()) { + case "getBlockState"->{ + out.println("get "+p.getX()+" "+p.getY()+" "+p.getZ());if(call==fail)throw new Stop(); + var fallback=mode==0?BLOCKS[Math.floorMod(p.getX()*31+p.getY()*7+p.getZ()*17,7)].defaultBlockState():Blocks.STONE.defaultBlockState(); + if(mode>=2&&p.equals(center.relative(net.minecraft.core.Direction.values()[mode-2])))fallback=Blocks.CAVE_AIR.defaultBlockState(); + var state=states.getOrDefault(p,fallback);out.println("state "+Block.getId(state));return state; + } + case "setBlock"->{ + var state=(BlockState)values[1];int flags=(Integer)values[2];out.println("set "+p.getX()+" "+p.getY()+" "+p.getZ()+" "+Block.getId(state)+" "+flags);if(call==fail)throw new Stop(); + boolean result=reject==0||call%reject!=0;if(result)states.put(p,state);out.println("written "+result);return result; + } + default->throw new AssertionError("unexpected world method "+method); + } + }); + var p=f.getAsJsonArray("origin");var origin=new BlockPos(p.get(0).getAsInt(),p.get(1).getAsInt(),p.get(2).getAsInt()); + for(int repeat=0;repeat>(); + for(var block:BuiltInRegistries.BLOCK)for(var property:block.getStateDefinition().getProperties()) { + var values=new ArrayList(); + for(var value:property.getPossibleValues())values.add(((net.minecraft.world.level.block.state.properties.Property)property).getName((Comparable)value)); + Collections.sort(values); + String signature=property.getName()+"/"+(property instanceof net.minecraft.world.level.block.state.properties.IntegerProperty)+"/"+values; + var previous=families.putIfAbsent(signature,property); + if(previous!=null&&!previous.equals(property))throw new AssertionError("ambiguous pinned property family: "+signature); + } + } + private static void bindFluidTags(JsonObject resources) { + var registry=BuiltInRegistries.FLUID; + var loader=new TagLoader>((id,required)->registry.get(id).map(value->(Holder)value),"tags/fluid"); + var definitions=new HashMap>(); + for(var item:resources.entrySet()) { + var file=TagFile.CODEC.parse(JsonOps.INSTANCE,JsonParser.parseString(item.getValue().getAsString())).getOrThrow(); + var entries=new ArrayList(); + for(var entry:file.entries())entries.add(new TagLoader.EntryWithSource(entry,"vanilla")); + definitions.put(Identifier.parse(item.getKey()),entries); + } + var tags=new HashMap,List>>(); + loader.build(definitions).forEach((id,values)->tags.put(TagKey.create(Registries.FLUID,id),List.copyOf(values))); + if(tags.size()!=resources.size())throw new AssertionError("incomplete fluid tags"); + registry.prepareTagReload(new TagLoader.LoadResult<>(Registries.FLUID,tags)).apply(); + } + @SuppressWarnings("unchecked") + public static void main(String[] args) throws Exception { + if(args[0].equals("export")){VanillaBlockStateCodecOracle.main(args);return;} + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); + verifyPropertyFamilies(); + Path dir=Path.of(args[1]); + VanillaHeightmapOracle.bindTags(JsonParser.parseString(Files.readString(dir.resolve("tags.json"))).getAsJsonObject()); + bindFluidTags(JsonParser.parseString(Files.readString(dir.resolve("fluid-tags.json"))).getAsJsonObject()); + var biomeLoad=VanillaMaterialConditionOracle.class.getDeclaredMethod("loadBiomes",Path.class);biomeLoad.setAccessible(true);biomeLoad.invoke(null,dir); + var biomeField=VanillaMaterialConditionOracle.class.getDeclaredField("biomes");biomeField.setAccessible(true); + var biomeRegistry=(MappedRegistry)biomeField.get(null); + var biomeNames=new ArrayList<>(new TreeSet<>(biomeRegistry.keySet())); + var providers=new MappedRegistry(Registries.BLOCK_STATE_PROVIDER,com.mojang.serialization.Lifecycle.stable()); + var ops=RegistryOps.create(JsonOps.INSTANCE,new RegistryOps.RegistryInfoLookup(){public Optional> lookup(ResourceKey> key){ + if(key.equals(Registries.BIOME))return (Optional>)(Optional)Optional.of(biomeRegistry); + if(key.equals(Registries.FLUID))return (Optional>)(Optional)Optional.of(BuiltInRegistries.FLUID); + if(key.equals(Registries.BLOCK_STATE_PROVIDER))return (Optional>)(Optional)Optional.of(providers); + return key.equals(Registries.BLOCK)?(Optional>)(Optional)Optional.of(BuiltInRegistries.BLOCK):Optional.empty(); + }}); + for(var entry:JsonParser.parseString(Files.readString(dir.resolve("catalog.json"))).getAsJsonObject().entrySet()) { + var provider=BlockStateProvider.DIRECT_CODEC.parse(ops,JsonParser.parseString(entry.getValue().getAsString())).getOrThrow(); + providers.register(ResourceKey.create(Registries.BLOCK_STATE_PROVIDER,Identifier.parse(entry.getKey())),provider,RegistrationInfo.BUILT_IN); + } + providers.freeze(); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt"),StandardCharsets.UTF_8));var inputs=Files.lines(dir.resolve("inputs.txt"))) { + for(var state:Block.BLOCK_STATE_REGISTRY) { + var fluid=state.getFluidState();boolean falling=fluid.hasProperty(FlowingFluid.FALLING)&&fluid.getValue(FlowingFluid.FALLING); + out.println("fluid "+Block.getId(state)+" "+BuiltInRegistries.FLUID.getKey(fluid.getType())+" "+fluid.getAmount()+" "+falling+" "+fluid.isSource()+" "+Integer.toUnsignedString(Float.floatToRawIntBits(fluid.getOwnHeight()))); + } + for(var line:(Iterable)inputs::iterator) { + var f=JsonParser.parseString(line).getAsJsonObject();long seed=f.get("seed").getAsLong(); + RandomSource random=f.get("legacy").getAsBoolean()?new LegacyRandomSource(seed):new XoroshiroRandomSource(seed); + if(f.get("worldgen").getAsBoolean())random=new WorldgenRandom(random); + Optional decoded; + try { + var definition=JsonParser.parseString(f.get("definition").getAsString()); + decoded=f.has("holder")&&f.get("holder").getAsBoolean()?BlockStateProvider.CODEC.parse(ops,definition).result().map(Holder::value):(f.get("typed").getAsBoolean()?BlockStateProvider.TYPED_CODEC:BlockStateProvider.DIRECT_CODEC).parse(ops,definition).result(); + } + catch(IllegalArgumentException|IllegalStateException error){decoded=Optional.empty();} + if(decoded.isEmpty())out.println("decode error");else { + out.println("decode ok");int[] calls={0};int[] fallback={0};int[] queries={0};int[] biomeIndex={0}; + int queryFail=f.has("query_fail")?f.get("query_fail").getAsInt():-1; + int min=f.has("bounds")?f.getAsJsonArray("bounds").get(0).getAsInt():-64; + int height=f.has("bounds")?f.getAsJsonArray("bounds").get(1).getAsInt():384; + int sea=f.has("bounds")?f.getAsJsonArray("bounds").get(2).getAsInt():63; + var world=(LevelAccessor)Proxy.newProxyInstance(LevelAccessor.class.getClassLoader(),new Class[]{LevelAccessor.class},(proxy,method,values)->{ + if(method.getName().equals("getFluidState")) { + var at=(BlockPos)values[0];out.println("fluid "+at.getX()+" "+at.getY()+" "+at.getZ()); + if(queries[0]++==queryFail)throw new Stop();return Block.stateById(fallback[0]).getFluidState(); + } + if(method.getName().equals("getRawBrightness")) { + var at=(BlockPos)values[0];out.println("light "+at.getX()+" "+at.getY()+" "+at.getZ()+" "+values[1]); + if(queries[0]++==queryFail)throw new Stop();return f.has("brightness")?f.get("brightness").getAsInt():15; + } + if(method.getName().equals("getBlockEntity")) { + var p=(BlockPos)values[0];out.println("entity "+p.getX()+" "+p.getY()+" "+p.getZ()); + if(queries[0]++==queryFail)throw new Stop();return null; + } + if(method.getName().equals("isUnobstructed")) { + if(values[0]!=null)throw new AssertionError("unexpected excluded entity"); + var box=((net.minecraft.world.phys.shapes.VoxelShape)values[1]).bounds(); + out.printf("clear %016x %016x %016x %016x %016x %016x%n",Double.doubleToRawLongBits(box.minX),Double.doubleToRawLongBits(box.minY),Double.doubleToRawLongBits(box.minZ),Double.doubleToRawLongBits(box.maxX),Double.doubleToRawLongBits(box.maxY),Double.doubleToRawLongBits(box.maxZ)); + if(queries[0]++==queryFail)throw new Stop();return !f.has("unobstructed")||f.get("unobstructed").getAsBoolean(); + } + if(method.getName().equals("getBiome")) { + var p=(BlockPos)values[0];out.println("biome "+p.getX()+" "+p.getY()+" "+p.getZ()); + if(queries[0]++==queryFail)throw new Stop(); + return biomeRegistry.getOrThrow(ResourceKey.create(Registries.BIOME,biomeNames.get(biomeIndex[0]))); + } + if(method.getName().equals("getBlockState")){var p=(BlockPos)values[0];out.println("read "+p.getX()+" "+p.getY()+" "+p.getZ());if(calls[0]++==f.get("fail").getAsInt())throw new Stop();return Block.stateById(fallback[0]);} + if(method.getName().equals("getMinY")||method.getName().equals("getHeight")) { + boolean minimum=method.getName().equals("getMinY");out.println(minimum?"min":"height"); + if(queries[0]++==queryFail)throw new Stop();return minimum?min:height; + } + if(method.getName().equals("getSeaLevel")){out.println("sea");if(queries[0]++==queryFail)throw new Stop();return sea;} + if(method.isDefault())return InvocationHandler.invokeDefault(proxy,method,values); + throw new AssertionError(method); + }); + int positionIndex=0,sampleIndex=0; + for(int repeat=0;repeat();var junctions=new ArrayList(); + for(var e:f.getAsJsonArray("pieces")) {var a=e.getAsJsonArray();pieces.add(new Beardifier.Rigid(box(a.get(0)),TerrainAdjustment.valueOf(a.get(1).getAsString()),a.get(2).getAsInt()));} + for(var e:f.getAsJsonArray("junctions")) {var a=e.getAsJsonArray();junctions.add(new JigsawJunction(a.get(0).getAsInt(),a.get(1).getAsInt(),a.get(2).getAsInt(),0,StructureTemplatePool.Projection.RIGID));} + var sampler=new Beardifier(pieces,junctions,box(f.get("affected")));var context=SamplerContext.builder().build(); + out.println("beardifier "+pieces.size()+" "+junctions.size()); + for(var e:f.getAsJsonArray("points")) {var a=e.getAsJsonArray();out.println("value "+bits(sampler.sampleValue(context,a.get(0).getAsInt(),a.get(1).getAsInt(),a.get(2).getAsInt())));} + for(var e:f.getAsJsonArray("volumes")) { + var a=e.getAsJsonArray();var volume=new DensityVolume(a.get(0).getAsInt(),a.get(1).getAsInt(),a.get(2).getAsInt(),a.get(3).getAsInt(),a.get(4).getAsInt(),a.get(5).getAsInt(),a.get(6).getAsInt(),a.get(7).getAsInt(),a.get(8).getAsInt()); + var buffer=DensityBuffer.createUnpooled(volume.size()+a.get(9).getAsInt());buffer.fill(-123.5f); + sampler.sampleVolume(context,buffer,volume);out.println("volume "+buffer.size()); + for(int i=0;i(); + for(var id:net.minecraft.core.registries.BuiltInRegistries.BLOCK.keySet())names.put(id.toString(),id.toString()); + java.nio.file.Files.writeString(java.nio.file.Path.of(paths[0]),new com.google.gson.Gson().toJson(names),java.nio.charset.StandardCharsets.UTF_8); + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaTerrainOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaTerrainOracle.java new file mode 100644 index 000000000..13fb2de3a --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaTerrainOracle.java @@ -0,0 +1,110 @@ +package dev.horizonlab.parity; + +import com.google.gson.*; +import com.mojang.serialization.*; +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.nio.file.*; +import java.util.*; +import net.minecraft.SharedConstants; +import net.minecraft.server.Bootstrap; +import net.minecraft.core.*; +import net.minecraft.core.registries.*; +import net.minecraft.resources.*; +import net.minecraft.world.level.*; +import net.minecraft.world.level.biome.*; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.chunk.*; +import net.minecraft.world.level.levelgen.*; +import net.minecraft.world.level.levelgen.blending.Blender; +import net.minecraft.world.level.levelgen.densityfunction.*; +import net.minecraft.world.level.levelgen.material.rule.MaterialRule; +import net.minecraft.world.level.levelgen.synth.NormalNoise; + +/** Original transport invoking NoiseChunk and the actual generator fill routine. */ +public final class VanillaTerrainOracle { + private static MappedRegistry noises; + private static RegistryOps ops; + private static Holder biome; + private static PalettedContainerFactory factory; + @SuppressWarnings("unchecked") + private static void load(JsonObject bundle) { + noises=new MappedRegistry<>(Registries.NOISE,Lifecycle.stable()); + var densities=new MappedRegistry(Registries.DENSITY_FUNCTION,Lifecycle.stable()); + var noiseLookup=noises.createRegistrationLookup();var densityLookup=densities.createRegistrationLookup(); + ops=RegistryOps.create(JsonOps.INSTANCE,new RegistryOps.RegistryInfoLookup() { + public Optional> lookup(ResourceKey> key) { + if(key.equals(Registries.NOISE))return (Optional>)(Optional)Optional.of(noiseLookup); + if(key.equals(Registries.DENSITY_FUNCTION))return (Optional>)(Optional)Optional.of(densityLookup); + return Optional.empty(); + } + }); + for(var e:bundle.getAsJsonObject("noises").entrySet())noises.register(ResourceKey.create(Registries.NOISE,Identifier.parse(e.getKey())),NormalNoise.DIRECT_CODEC.parse(ops,JsonParser.parseString(e.getValue().getAsString())).getOrThrow(),RegistrationInfo.BUILT_IN); + noises.freeze(); + for(var e:bundle.getAsJsonObject("densities").entrySet())densities.register(ResourceKey.create(Registries.DENSITY_FUNCTION,Identifier.parse(e.getKey())),DensityFunctions.DIRECT_CODEC.parse(ops,JsonParser.parseString(e.getValue().getAsString())).getOrThrow(),RegistrationInfo.BUILT_IN); + densities.freeze(); + VanillaHeightmapOracle.bindTags(bundle.getAsJsonObject("tags")); + biome=Holder.Reference.createStandAlone(new HolderOwner(){},Biomes.PLAINS); + var ids=new IdMapper>();ids.add(biome); + factory=new PalettedContainerFactory(Strategy.createForBlockStates(Block.BLOCK_STATE_REGISTRY),Blocks.AIR.defaultBlockState(),null,Strategy.createForBiomes(ids),biome,null); + } + private static Beardifier structure(JsonObject f) { + if(!f.has("structure"))return Beardifier.EMPTY; + var source=f.getAsJsonObject("structure"); + var pieces=new ArrayList(); + var junctions=new ArrayList(); + java.util.function.Function box=e->{var a=e.getAsJsonArray();return new net.minecraft.world.level.levelgen.structure.BoundingBox(a.get(0).getAsInt(),a.get(1).getAsInt(),a.get(2).getAsInt(),a.get(3).getAsInt(),a.get(4).getAsInt(),a.get(5).getAsInt());}; + for(var e:source.getAsJsonArray("pieces")) {var a=e.getAsJsonArray();pieces.add(new Beardifier.Rigid(box.apply(a.get(0)),net.minecraft.world.level.levelgen.structure.TerrainAdjustment.valueOf(a.get(1).getAsString()),a.get(2).getAsInt()));} + for(var e:source.getAsJsonArray("junctions")) {var a=e.getAsJsonArray();junctions.add(new net.minecraft.world.level.levelgen.structure.pools.JigsawJunction(a.get(0).getAsInt(),a.get(1).getAsInt(),a.get(2).getAsInt(),0,net.minecraft.world.level.levelgen.structure.pools.StructureTemplatePool.Projection.RIGID));} + return new Beardifier(pieces,junctions,box.apply(source.get("affected"))); + } + private static void fixture(JsonObject f,PrintWriter out) throws Exception { + int min=f.get("min").getAsInt(),height=f.get("height").getAsInt(),noiseMin=f.get("noise_min").getAsInt(),noiseHeight=f.get("noise_height").getAsInt(); + int cx=f.get("cx").getAsInt(),cz=f.get("cz").getAsInt(),sea=f.get("sea").getAsInt();long seed=f.get("seed").getAsLong();boolean legacy=f.get("legacy").getAsBoolean(); + var block=Block.stateById(f.get("block").getAsInt());var fluid=Block.stateById(f.get("fluid").getAsInt()); + var router=NoiseRouter.CODEC.parse(ops,f.get("router")).getOrThrow(); + Optional config=f.get("aquifers").isJsonNull()?Optional.empty():Optional.of(Aquifer.Config.CODEC.parse(ops,f.get("aquifers")).getOrThrow()); + // Neither material rules nor biome properties are evaluated by doFill. + var rule=Holder.Reference.createStandAlone(new HolderOwner(){},ResourceKey.create(Registries.MATERIAL_RULE,Identifier.parse("horizon:unused"))); + var settings=new NoiseGeneratorSettings(NoiseSettings.create(noiseMin,noiseHeight),block,fluid,router,rule,List.of(),sea,false,config,legacy,NoiseGeneratorSettings.DebugFunctions.EMPTY); + var state=RandomState.create(noises,seed,legacy,block,sea,router); + var generator=new NoiseBasedChunkGenerator(new FixedBiomeSource(biome),Holder.direct(settings)); + var pickerMethod=NoiseBasedChunkGenerator.class.getDeclaredMethod("createFluidPicker",NoiseGeneratorSettings.class);pickerMethod.setAccessible(true); + var picker=(Aquifer.FluidPicker)pickerMethod.invoke(null,settings); + var volume=new DensityVolume(16,noiseHeight,16,cx<<4,noiseMin,cz<<4,1,1,1); + var chunk=new ProtoChunk(new ChunkPos(cx,cz),UpgradeData.EMPTY,LevelHeightAccessor.create(min,height),factory,null); + for(var item:f.getAsJsonArray("initial")) { + var a=item.getAsJsonArray();int x=a.get(0).getAsInt(),y=a.get(1).getAsInt(),z=a.get(2).getAsInt(); + chunk.getSection(chunk.getSectionIndex(y)).setBlockState(x&15,y&15,z&15,Block.stateById(a.get(3).getAsInt()),false); + } + var fill=NoiseBasedChunkGenerator.class.getDeclaredMethod("doFill",NoiseChunk.class,ChunkAccess.class);fill.setAccessible(true); + out.println("chunk "+cx+" "+cz+" "+min+" "+height); + try(var noise=new NoiseChunk(state,structure(f),settings,picker,Blender.empty(),volume)) { + for(int repeat=0;repeat>> BLOCKS = SavedTick.codec(BuiltInRegistries.BLOCK.byNameCodec()).listOf(); + private static final Codec>> FLUIDS = SavedTick.codec(BuiltInRegistries.FLUID.byNameCodec()).listOf(); + private static List> samples(List types) { + List> ticks = new ArrayList<>(); + int[] delays = {Integer.MIN_VALUE, -1, 0, 1, 100, Integer.MAX_VALUE}; + for (int i = 0; i < 256; i++) { + SavedTick tick = new SavedTick<>(types.get(i % types.size()), new BlockPos((i & 15) + (i % 17 == 0 ? 16 : 0), (i % 9 - 4) * 16, (i >>> 4) & 15), delays[i % delays.length], TickPriority.byValue(i % 11 - 5)); + ticks.add(tick); + if (i % 23 == 0) ticks.add(tick); + } + return ticks; + } + private static CompoundTag ids(List types, Registry registry) { + CompoundTag tag = new CompoundTag(); + for (T type : types) tag.putInt(registry.getKey(type).toString(), registry.getId(type)); + return tag; + } + private static Tag encode(Codec>> codec, List> ticks) { return codec.encodeStart(NbtOps.INSTANCE, ticks).getOrThrow(); } + private static List> changed(Codec>> codec, Tag input, long time) { + List> saved = SavedTick.filterTickListForChunk(codec.parse(NbtOps.INSTANCE, input).getOrThrow(), POS); + LevelChunkTicks ticks = new LevelChunkTicks<>(saved); + ticks.unpack(time); + ScheduledTick first = ticks.poll(); + if (first != null) ticks.schedule(new ScheduledTick<>(first.type(), first.pos(), time + 123, TickPriority.HIGH, 77)); + return ticks.pack(time); + } + private static void generate(Path base) throws Exception { + List blocks = List.of(Blocks.STONE, Blocks.OAK_LOG, Blocks.REPEATER, Blocks.WATER, Blocks.CHEST, Blocks.REDSTONE_WIRE); + List fluids = List.of(Fluids.EMPTY, Fluids.WATER, Fluids.FLOWING_WATER, Fluids.LAVA, Fluids.FLOWING_LAVA); + CompoundTag root = new CompoundTag(); + root.putInt("DataVersion", 5023); root.putInt("xPos", 0); root.putInt("zPos", 0); root.put("sections", new ListTag()); + root.put("block_ticks", encode(BLOCKS, samples(blocks))); root.put("fluid_ticks", encode(FLUIDS, samples(fluids))); + for (String field : List.of("block_ticks", "fluid_ticks")) { + ListTag list = (ListTag) root.get(field); + CompoundTag a = (CompoundTag) list.get(3), b = (CompoundTag) list.get(4), c = (CompoundTag) list.get(5); + a.putLong("t", Long.MAX_VALUE); a.putFloat("p", Float.NaN); + b.putDouble("t", Double.POSITIVE_INFINITY); b.putShort("p", (short) 999); b.putByte("y", (byte) -7); + c.putDouble("x", 4.75); c.putDouble("p", Double.NEGATIVE_INFINITY); + } + root.put("block_ids", ids(blocks, BuiltInRegistries.BLOCK)); root.put("fluid_ids", ids(fluids, BuiltInRegistries.FLUID)); + root.putString("unknown-root-data", "preserved through scheduled-tick mutation"); + NbtIo.write(root, base.resolve("ticks-input.nbt")); + } + private static void verify(Path base) throws Exception { + CompoundTag original = NbtIo.read(base.resolve("ticks-input.nbt")); + List> blocks = changed(BLOCKS, original.get("block_ticks"), 1000); + List> fluids = changed(FLUIDS, original.get("fluid_ticks"), Long.MAX_VALUE - 8); + CompoundTag expected = original.copy(); + expected.put("block_ticks", encode(BLOCKS, blocks)); expected.put("fluid_ticks", encode(FLUIDS, fluids)); + CompoundTag actual = NbtIo.read(base.resolve("ticks-output.nbt")); + if (!actual.equals(expected)) throw new AssertionError("Rust saved tick NBT differs from vanilla"); + Path regionPath = base.resolve("tick-region/r.0.0.mca"); + RegionStorageInfo info = new RegionStorageInfo("horizon-tick-fixture", Level.OVERWORLD, "chunk"); + try (RegionFile region = new RegionFile(info, regionPath, regionPath.getParent(), false); + DataInputStream input = region.getChunkDataInputStream(POS)) { + if (input == null || !NbtIo.read(input).equals(expected)) throw new AssertionError("Rust region tick data differs from vanilla"); + } + System.out.printf("HORIZON_TICK_DATA_RESULT {\"block_ticks\":%d,\"fluid_ticks\":%d,\"region_chunks\":1}%n", blocks.size(), fluids.size()); + } + public static void main(String[] args) throws Exception { + Path base = Path.of(args[1]); + switch (args[0]) { case "generate" -> generate(base); case "verify" -> verify(base); default -> throw new AssertionError("unknown mode"); } + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaTickOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaTickOracle.java new file mode 100644 index 000000000..9ccf17050 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaTickOracle.java @@ -0,0 +1,109 @@ +package dev.horizonlab.parity; + +import java.io.*; +import java.lang.reflect.Field; +import java.nio.file.*; +import java.util.*; +import net.minecraft.SharedConstants; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Vec3i; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.levelgen.structure.BoundingBox; +import net.minecraft.world.ticks.*; + +/** Original trace adapter; queues, ordering, mutations and save packing are vanilla. */ +public final class VanillaTickOracle { + private static final Object[] TYPES = new Object[32]; + static { for (int i = 0; i < TYPES.length; i++) TYPES[i] = new Object(); } + private static final Field ALREADY_RUN; + static { + try { ALREADY_RUN = LevelTicks.class.getDeclaredField("alreadyRunThisTick"); ALREADY_RUN.setAccessible(true); } + catch (ReflectiveOperationException error) { throw new ExceptionInInitializerError(error); } + } + private final Set blocked = new HashSet<>(); + private final Map> chunks = new HashMap<>(); + private final Map> detached = new HashMap<>(); + private LevelTicks level = new LevelTicks<>(key -> !blocked.contains(key)); + private final PrintWriter out; + private VanillaTickOracle(PrintWriter out) { this.out = out; } + private static int type(Object type) { for (int i = 0; i < TYPES.length; i++) if (TYPES[i] == type) return i; throw new AssertionError(); } + private static final class Input { + final String[] words; int cursor = 1; + Input(String line) { words = line.split(" "); } + int integer() { return Integer.parseInt(words[cursor++]); } + long number() { return Long.parseLong(words[cursor++]); } + BlockPos pos() { return new BlockPos(integer(), integer(), integer()); } + ChunkPos chunk() { return new ChunkPos(integer(), integer()); } + BoundingBox area() { BlockPos a = pos(), b = pos(); return new BoundingBox(Math.min(a.getX(), b.getX()), Math.min(a.getY(), b.getY()), Math.min(a.getZ(), b.getZ()), Math.max(a.getX(), b.getX()), Math.max(a.getY(), b.getY()), Math.max(a.getZ(), b.getZ())); } + } + private int schedule(ScheduledTick tick) { + if (!chunks.containsKey(ChunkPos.pack(tick.pos()))) { level.schedule(tick); return 2; } + boolean duplicate = level.hasScheduledTick(tick.pos(), tick.type()); + level.schedule(tick); + return duplicate ? 0 : 1; + } + private void add(ChunkPos pos, LevelChunkTicks chunk) { chunks.put(pos.pack(), chunk); level.addContainer(pos, chunk); } + private LevelChunkTicks remove(ChunkPos pos) { level.removeContainer(pos); return chunks.remove(pos.pack()); } + private void scheduled(ScheduledTick tick) { out.printf("queued %d %d %d %d %d %d %d%n", type(tick.type()), tick.pos().getX(), tick.pos().getY(), tick.pos().getZ(), tick.triggerTick(), tick.priority().getValue(), tick.subTickOrder()); } + @SuppressWarnings("unchecked") + private ScheduledTick running() { + try { List> ticks = (List>) ALREADY_RUN.get(level); return ticks.getLast(); } + catch (ReflectiveOperationException error) { throw new AssertionError(error); } + } + private void command(String line, int lineNumber) { + Input in = new Input(line); String operation = in.words[0]; + out.printf("command %d %s%n", lineNumber, operation); + switch (operation) { + case "reset" -> { blocked.clear(); chunks.clear(); detached.clear(); level = new LevelTicks<>(key -> !blocked.contains(key)); } + case "add" -> { ChunkPos pos = in.chunk(); if (!chunks.containsKey(pos.pack())) add(pos, new LevelChunkTicks<>()); } + case "load" -> { + ChunkPos pos = in.chunk(); int count = in.integer(); List> ticks = new ArrayList<>(); + for (int i = 0; i < count; i++) ticks.add(new SavedTick<>(TYPES[in.integer()], in.pos(), in.integer(), TickPriority.byValue(in.integer()))); + remove(pos); add(pos, new LevelChunkTicks<>(ticks)); + } + case "unpack" -> { ChunkPos pos = in.chunk(); long time = in.number(); LevelChunkTicks chunk = chunks.get(pos.pack()); if (chunk != null) chunk.unpack(time); } + case "remove" -> { ChunkPos pos = in.chunk(); LevelChunkTicks chunk = remove(pos); if (chunk != null) detached.put(pos.pack(), chunk); } + case "restore" -> { ChunkPos pos = in.chunk(); if (!chunks.containsKey(pos.pack())) { LevelChunkTicks chunk = detached.remove(pos.pack()); if (chunk != null) add(pos, chunk); } } + case "enable" -> { ChunkPos pos = in.chunk(); if (in.integer() == 0) blocked.add(pos.pack()); else blocked.remove(pos.pack()); } + case "schedule" -> { ScheduledTick tick = new ScheduledTick<>(TYPES[in.integer()], in.pos(), in.number(), TickPriority.byValue(in.integer()), in.number()); out.printf("schedule %d%n", schedule(tick)); } + case "query" -> { Object kind = TYPES[in.integer()]; BlockPos pos = in.pos(); out.printf("query %d %d%n", level.hasScheduledTick(pos, kind) ? 1 : 0, level.willTickThisTick(pos, kind) ? 1 : 0); } + case "chunk" -> { LevelChunkTicks chunk = chunks.get(in.chunk().pack()); if (chunk == null) out.println("chunk absent"); else { out.printf("chunk %d%n", chunk.count()); chunk.getAll().forEach(this::scheduled); } } + case "save" -> { + LevelChunkTicks chunk = chunks.get(in.chunk().pack()); long time = in.number(); + if (chunk == null) out.println("saved absent"); else { + List> ticks = chunk.pack(time); out.printf("saved %d%n", ticks.size()); + for (SavedTick tick : ticks) out.printf("saved-value %d %d %d %d %d %d%n", type(tick.type()), tick.pos().getX(), tick.pos().getY(), tick.pos().getZ(), tick.delay(), tick.priority().getValue()); + } + } + case "reload" -> { ChunkPos pos = in.chunk(); long saveTime = in.number(), loadTime = in.number(); LevelChunkTicks old = remove(pos); if (old != null) { LevelChunkTicks chunk = new LevelChunkTicks<>(old.pack(saveTime)); chunk.unpack(loadTime); add(pos, chunk); } } + case "clear" -> level.clearArea(in.area()); + case "copy" -> { BoundingBox area = in.area(); BlockPos offset = in.pos(); level.copyArea(area, new Vec3i(offset.getX(), offset.getY(), offset.getZ())); } + case "tick" -> { + long time = in.number(); int maximum = in.integer(), action = in.integer(); Object probeKind = TYPES[in.integer()]; BlockPos probe = in.pos(); long[] order = {in.number()}; + level.tick(time, maximum, (pos, kind) -> { + ScheduledTick tick = running(); scheduled(tick); + out.printf("running %d %d %d%n", level.willTickThisTick(pos, kind) ? 1 : 0, level.hasScheduledTick(pos, kind) ? 1 : 0, level.willTickThisTick(probe, probeKind) ? 1 : 0); + switch (action) { + case 1 -> out.printf("callback-schedule %d%n", schedule(new ScheduledTick<>(kind, pos, time, tick.priority(), order[0]++))); + case 2 -> { level.clearArea(new BoundingBox(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1)); out.printf("callback-clear %d%n", level.willTickThisTick(probe, probeKind) ? 1 : 0); } + case 3 -> level.copyArea(new BoundingBox(pos.getX() - 2, pos.getY() - 2, pos.getZ() - 2, pos.getX() + 2, pos.getY() + 2, pos.getZ() + 2), new Vec3i(16, 0, 0)); + case 4 -> { ChunkPos chunkPos = new ChunkPos(pos.getX() >> 4, pos.getZ() >> 4); LevelChunkTicks chunk = remove(chunkPos); if (chunk != null) detached.put(chunkPos.pack(), chunk); } + case 5 -> blocked.add(ChunkPos.pack(pos)); + case 0 -> {} + default -> throw new AssertionError("unknown callback action"); + } + }); + } + default -> throw new AssertionError("unknown command: " + operation); + } + if (in.cursor != in.words.length) throw new AssertionError("extra arguments"); + out.printf("count %d%n", level.count()); + } + public static void main(String[] args) throws Exception { + SharedConstants.tryDetectVersion(); + try (BufferedReader input = Files.newBufferedReader(Path.of(args[0])); PrintWriter out = new PrintWriter(Files.newBufferedWriter(Path.of(args[1])))) { + VanillaTickOracle oracle = new VanillaTickOracle(out); String line; int index = 0; + while ((line = input.readLine()) != null) oracle.command(line, index++); + } + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaValueProviderOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaValueProviderOracle.java new file mode 100644 index 000000000..3010569e7 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaValueProviderOracle.java @@ -0,0 +1,39 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import com.mojang.serialization.JsonOps; +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.nio.file.*; +import net.minecraft.util.RandomSource; +import net.minecraft.util.valueproviders.*; +import net.minecraft.world.level.levelgen.*; + +/** Original transport calling native value-provider codecs and samples. */ +public final class VanillaValueProviderOracle { + private static String bits(float value){return Integer.toHexString(Float.floatToIntBits(value));} + public static void main(String[] args) throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt"),StandardCharsets.UTF_8))) { + for(var line:Files.readAllLines(dir.resolve("inputs.txt"))) { + var f=JsonParser.parseString(line).getAsJsonObject();long seed=f.get("seed").getAsLong(); + RandomSource random=f.get("legacy").getAsBoolean()?new LegacyRandomSource(seed):new XoroshiroRandomSource(seed); + var json=JsonParser.parseString(f.get("definition").getAsString());int count=f.get("samples").getAsInt(); + if(f.get("kind").getAsString().equals("float")) { + var decoded=FloatProviders.CODEC.parse(JsonOps.INSTANCE,json); + if(decoded.result().isEmpty())out.println("decode error");else { + var provider=decoded.result().get();out.println("float "+bits(provider.min())+" "+bits(provider.max())); + for(int i=0;i decoded; + try {decoded=IntProviders.CODEC.parse(JsonOps.INSTANCE,json);} catch(IllegalArgumentException error) {out.println("decode error");out.println("tail "+random.nextLong());continue;} + if(decoded.result().isEmpty())out.println("decode error");else { + var provider=decoded.result().get();out.println("int "+provider.minInclusive()+" "+provider.maxInclusive()); + for(int i=0;i IDS = new IdMapper<>(); + static { for (int i = 0; i < 8192; i++) IDS.add("state" + i); } + private static final RegionStorageInfo INFO = new RegionStorageInfo("horizon-fixture", Level.OVERWORLD, "chunk"); + private static final Strategy BLOCKS = Strategy.createForBlockStates(Block.BLOCK_STATE_REGISTRY); + private static final Codec> BLOCK_CODEC = PalettedContainer.codecRW(BlockState.CODEC, BLOCKS, Blocks.AIR.defaultBlockState()); + + private static void check(boolean value, String message) { if (!value) throw new AssertionError(message); } + private static RegionFileVersion codec(int id) { return RegionFileVersion.fromId(id); } + private static Tag read(Path path, int compression, boolean network) throws Exception { + try (DataInputStream in = new DataInputStream(codec(compression).wrap(Files.newInputStream(path)))) { + return network ? NbtIo.readAnyTag(in, NbtAccounter.unlimitedHeap()) : NbtIo.readUnnamedTag(in, NbtAccounter.unlimitedHeap()); + } + } + private static void write(Tag tag, Path path, int compression, boolean network) throws Exception { + Files.createDirectories(path.getParent()); + try (DataOutputStream out = new DataOutputStream(codec(compression).wrap(Files.newOutputStream(path)))) { + if (network) NbtIo.writeAnyTag(tag, out); else NbtIo.writeUnnamedTag(tag, out); + } + } + private static CompoundTag specimen() { + CompoundTag root = new CompoundTag(); + root.putByte("byte", Byte.MIN_VALUE); + root.putShort("short", Short.MIN_VALUE); + root.putInt("int", Integer.MIN_VALUE); + root.putLong("long", Long.MIN_VALUE); + root.putFloat("float", Float.intBitsToFloat(0x7f800001)); + root.putDouble("double", Double.NEGATIVE_INFINITY); + root.put("negative-zero-float", new FloatTag(-0.0f)); + root.put("negative-zero-double", new DoubleTag(-0.0)); + root.putString("text\0\ud800", "nul\0 / unicode \u20ac \ud83c\udf0d / unpaired \ud800x\udfff"); + root.putString("max-ascii", "a".repeat(65535)); + root.putIntArray("ints", new int[]{0, -1, Integer.MIN_VALUE, Integer.MAX_VALUE}); + root.putLongArray("longs", new long[]{0, -1, Long.MIN_VALUE, Long.MAX_VALUE}); + byte[] bytes = new byte[1_200_013]; + new Random(173).nextBytes(bytes); + root.putByteArray("bytes", bytes); + ListTag mixed = new ListTag(); + mixed.add(IntTag.valueOf(42)); + mixed.add(StringTag.valueOf("different type")); + CompoundTag wrapper = new CompoundTag(); + wrapper.putInt("", 19); + mixed.add(wrapper); + CompoundTag normal = new CompoundTag(); + normal.putString("kept", "nested"); + mixed.add(normal); + mixed.add(new ListTag()); + root.put("mixed", mixed); + CompoundTag branch = new CompoundTag(); + for (int i = 0; i < 40; i++) { CompoundTag next = new CompoundTag(); next.put("child", branch); branch = next; } + root.put("deep", branch); + return root; + } + + private static Codec> paletteCodec(boolean biome) { + // IdMapper keys use object identity. Decoding must return registry-owned + // objects, just as the real BlockState codec does. + Codec stateCodec = Codec.STRING.xmap(value -> IDS.byId(Integer.parseInt(value.substring(5))), value -> value); + return PalettedContainer.codecRW(stateCodec, biome ? Strategy.createForBiomes(IDS) : Strategy.createForBlockStates(IDS), IDS.byId(0)); + } + private static PalettedContainer palette(boolean biome, int distinct) { + PalettedContainer result = new PalettedContainer<>(IDS.byId(0), biome ? Strategy.createForBiomes(IDS) : Strategy.createForBlockStates(IDS)); + int axis = biome ? 2 : 4, mask = (1 << axis) - 1, len = biome ? 64 : 4096; + for (int i = 0; i < len; i++) result.set(i & mask, i >> (axis * 2), (i >> axis) & mask, IDS.byId(i % distinct)); + return result; + } + private static CompoundTag chunk(ChunkPos pos, boolean oversized) { + CompoundTag root = new CompoundTag(); + root.putInt("DataVersion", SharedConstants.getCurrentVersion().dataVersion().version()); + root.putInt("xPos", pos.x()); root.putInt("zPos", pos.z()); root.putInt("yPos", -4); + root.putString("Status", "minecraft:full"); + root.putString("unknown-future-field", "preserve this exactly"); + root.putLong("LastUpdate", 123456789L); + ListTag sections = new ListTag(); + CompoundTag section = new CompoundTag(); section.putByte("Y", (byte)-4); + PalettedContainer blocks = new PalettedContainer<>(Blocks.AIR.defaultBlockState(), BLOCKS); + blocks.set(1, 0, 0, Blocks.OAK_LOG.defaultBlockState()); + section.put("block_states", BLOCK_CODEC.encodeStart(NbtOps.INSTANCE, blocks).getOrThrow()); + section.putString("unknown-section-field", "retain"); + sections.add(section); root.put("sections", sections); + root.put("block_entities", new ListTag()); + if (oversized) { byte[] bytes = new byte[1_200_013]; new Random(173).nextBytes(bytes); root.putByteArray("large-fixture", bytes); } + return root; + } + + private static void generate(Path base) throws Exception { + CompoundTag specimen = specimen(); + for (int codec = 1; codec <= 4; codec++) { + write(specimen, base.resolve("nbt/" + codec + ".bin"), codec, false); + write(specimen, base.resolve("network/" + codec + ".bin"), codec, true); + Path folder = base.resolve("regions/" + codec); Files.createDirectories(folder); + try (RegionFile region = new RegionFile(INFO, folder.resolve("r.-1.0.mca"), folder, codec(codec), false)) { + for (ChunkPos pos : List.of(new ChunkPos(-32, 0), new ChunkPos(-1, 31))) { + try (DataOutputStream out = region.getChunkDataOutputStream(pos)) { NbtIo.write(chunk(pos, pos.x() == -1), out); } + } + } + } + for (boolean biome : new boolean[]{false, true}) { + for (int size : SIZES) { + if (biome && size > 64) continue; + Tag data = paletteCodec(biome).encodeStart(NbtOps.INSTANCE, palette(biome, size)).getOrThrow(); + write(data, base.resolve("palettes/" + (biome ? "biome" : "block") + "-" + size + ".nbt"), 3, false); + } + } + CompoundTag registry = new CompoundTag(); + registry.putInt("DataVersion", SharedConstants.getCurrentVersion().dataVersion().version()); + ListTag states = new ListTag(); + CompoundTag defaults = new CompoundTag(); + for (BlockState state : Block.BLOCK_STATE_REGISTRY) { + check(Block.BLOCK_STATE_REGISTRY.getId(state) == states.size(), "registry IDs are not dense"); + states.add(BlockState.FULL_CODEC.encodeStart(NbtOps.INSTANCE, state).getOrThrow()); + if (state == state.getBlock().defaultBlockState()) { + Tag encoded = BlockState.FULL_CODEC.encodeStart(NbtOps.INSTANCE, state).getOrThrow(); + defaults.putInt(((CompoundTag)encoded).getStringOr("id", ""), Block.BLOCK_STATE_REGISTRY.getId(state)); + } + } + registry.put("states", states); registry.put("defaults", defaults); + write(registry, base.resolve("block-registry.nbt"), 3, false); + System.out.println("HORIZON_WORLD_GENERATED states=" + states.size()); + } + + private static void verify(Path base) throws Exception { + int nbt = 0, palettes = 0, regions = 0, blocks = 0; + for (boolean network : new boolean[]{false, true}) for (int source = 1; source <= 4; source++) for (int target = 1; target <= 4; target++) { + String directory = network ? "network" : "nbt"; + Tag original = read(base.resolve(directory + "/" + source + ".bin"), source, network); + Tag actual = read(base.resolve("rust/" + directory + "/" + source + "-" + target + ".bin"), target, network); + check(original.equals(actual), "NBT semantic mismatch " + directory + " " + source + " " + target); + nbt++; + } + for (boolean biome : new boolean[]{false, true}) for (int size : SIZES) { + if (biome && size > 64) continue; + String name = (biome ? "biome" : "block") + "-" + size + ".nbt"; + PalettedContainer control = paletteCodec(biome).parse(NbtOps.INSTANCE, read(base.resolve("palettes/" + name), 3, false)).getOrThrow(); + int controlAxis = biome ? 2 : 4, controlMask = (1 << controlAxis) - 1; + for (int i = 0; i < (biome ? 64 : 4096); i++) + check(control.get(i & controlMask, i >> (controlAxis * 2), (i >> controlAxis) & controlMask).equals("state" + (i % size)), "vanilla palette control failed"); + for (String variant : List.of("edited", "compact")) { + Tag tag = read(base.resolve("rust/palettes/" + variant + "-" + name), 3, false); + PalettedContainer actual = paletteCodec(biome).parse(NbtOps.INSTANCE, tag).getOrThrow(); + int axis = biome ? 2 : 4, mask = (1 << axis) - 1, len = biome ? 64 : 4096; + for (int i = 0; i < len; i++) { + String expected = "state" + (i == len - 1 ? 4096 : i % size); + check(actual.get(i & mask, i >> (axis * 2), (i >> axis) & mask).equals(expected), "palette index mismatch " + name + " " + i); + blocks++; + } + palettes++; + } + } + for (int source = 1; source <= 4; source++) for (String variant : List.of("copy", "1", "2", "3", "4", "edited")) { + Path folder = base.resolve("rust/regions/" + source + "-" + variant); + try (RegionFile region = new RegionFile(INFO, folder.resolve("r.-1.0.mca"), folder, false)) { + for (ChunkPos pos : List.of(new ChunkPos(-32, 0), new ChunkPos(-1, 31))) { + try (DataInputStream in = region.getChunkDataInputStream(pos)) { + check(in != null, "chunk missing"); + CompoundTag actual = NbtIo.read(in); + CompoundTag expected = chunk(pos, pos.x() == -1); + if (variant.equals("edited") && pos.x() == -32) { + CompoundTag section = actual.getListOrEmpty("sections").getCompoundOrEmpty(0); + PalettedContainer states = BLOCK_CODEC.parse(NbtOps.INSTANCE, section.get("block_states")).getOrThrow(); + check(states.get(0, 0, 0) == Blocks.STONE.defaultBlockState(), "edited block differs"); + check(states.get(1, 0, 0) == Blocks.OAK_LOG.defaultBlockState(), "neighbor changed"); + section.put("block_states", expected.getListOrEmpty("sections").getCompoundOrEmpty(0).get("block_states")); + } + check(expected.equals(actual), "region data changed " + source + " " + variant + " " + pos); + regions++; + } + } + check(!region.hasChunk(new ChunkPos(-31, 0)), "unexpected extra chunk"); + } + } + Tag actualRegistry = read(base.resolve("rust/block-registry.nbt"), 3, false); + check(read(base.resolve("block-registry.nbt"), 3, false).equals(actualRegistry), "registry roundtrip differs"); + PalettedContainer resident = BLOCK_CODEC.parse(NbtOps.INSTANCE, read(base.resolve("rust/runtime-section.nbt"), 3, false)).getOrThrow(); + for (int i = 0; i < 4096; i++) check(resident.get(i & 15, i >> 8, (i >> 4) & 15) == Block.BLOCK_STATE_REGISTRY.byId(i * 7 % Block.BLOCK_STATE_REGISTRY.size()), "resident block state differs"); + int[] expectedStates = new int[4096]; + long random = 0x31415926L; + for (int step = 0; step < 100_000; step++) { + random = random * 6364136223846793005L + 1; + int index = (int) ((random >>> 32) % 4096); + expectedStates[index] = step % 3 == 0 ? 0 : Integer.remainderUnsigned((int) (random >>> 16), Block.BLOCK_STATE_REGISTRY.size()); + } + PalettedContainer mutated = BLOCK_CODEC.parse(NbtOps.INSTANCE, read(base.resolve("rust/runtime-mutated.nbt"), 3, false)).getOrThrow(); + for (int i = 0; i < 4096; i++) check(mutated.get(i & 15, i >> 8, (i >> 4) & 15) == Block.BLOCK_STATE_REGISTRY.byId(expectedStates[i]), "mutated resident block state differs"); + System.out.printf("HORIZON_WORLD_RESULT {\"nbt_pairs\":%d,\"palettes\":%d,\"palette_values\":%d,\"region_chunks\":%d,\"registry_states\":%d,\"resident_values\":8192}%n", nbt, palettes, blocks, regions, Block.BLOCK_STATE_REGISTRY.size()); + } + + public static void main(String[] args) throws Exception { + if (args[0].equals("generate")) generate(Path.of(args[1])); + else if (args[0].equals("verify")) verify(Path.of(args[1])); + else throw new IllegalArgumentException("unknown mode"); + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaWorldgenOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaWorldgenOracle.java new file mode 100644 index 000000000..e42ba7edd --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaWorldgenOracle.java @@ -0,0 +1,387 @@ +package dev.horizonlab.parity; + +import java.io.PrintWriter; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import com.google.gson.JsonParser; +import com.mojang.serialization.JsonOps; +import net.minecraft.world.level.levelgen.LegacyRandomSource; +import net.minecraft.world.level.levelgen.XoroshiroRandomSource; +import net.minecraft.world.level.levelgen.synth.NormalNoise; + +/** Original JSON transport; decoding and evaluation use vanilla classes. */ +public final class VanillaWorldgenOracle { + private static java.util.Map>> biomePresets; + private static void registryProbe(String path,long seed,boolean legacy,boolean optimized,String setting,PrintWriter out) throws Exception { + registryProbe(path,seed,legacy,optimized,setting,null,out); + } + @SuppressWarnings("unchecked") + private static void registryProbe(String path,long seed,boolean legacy,boolean optimized,String setting,String aquiferFixture,PrintWriter out) throws Exception { + var bundle=JsonParser.parseString(Files.readString(Path.of(path))).getAsJsonObject(); + var noises=new net.minecraft.core.MappedRegistry(net.minecraft.core.registries.Registries.NOISE,com.mojang.serialization.Lifecycle.stable()); + var densities=new net.minecraft.core.MappedRegistry(net.minecraft.core.registries.Registries.DENSITY_FUNCTION,com.mojang.serialization.Lifecycle.stable()); + var noiseLookup=noises.createRegistrationLookup();var densityLookup=densities.createRegistrationLookup(); + var ops=net.minecraft.resources.RegistryOps.create(JsonOps.INSTANCE,new net.minecraft.resources.RegistryOps.RegistryInfoLookup() { + public java.util.Optional> lookup(net.minecraft.resources.ResourceKey> key) { + if(key.equals(net.minecraft.core.registries.Registries.NOISE))return (java.util.Optional>)(java.util.Optional)java.util.Optional.of(noiseLookup); + if(key.equals(net.minecraft.core.registries.Registries.DENSITY_FUNCTION))return (java.util.Optional>)(java.util.Optional)java.util.Optional.of(densityLookup); + return java.util.Optional.empty(); + } + }); + for(var entry:bundle.getAsJsonObject("noises").entrySet()) { + var key=net.minecraft.resources.ResourceKey.create(net.minecraft.core.registries.Registries.NOISE,net.minecraft.resources.Identifier.parse(entry.getKey())); + var noise=NormalNoise.DIRECT_CODEC.parse(ops,JsonParser.parseString(entry.getValue().getAsString())).getOrThrow(); + noises.register(key,noise,net.minecraft.core.RegistrationInfo.BUILT_IN); + } + noises.freeze(); + java.util.Map functions=new java.util.TreeMap<>(); + for(var entry:bundle.getAsJsonObject("densities").entrySet()) { + var key=net.minecraft.resources.ResourceKey.create(net.minecraft.core.registries.Registries.DENSITY_FUNCTION,net.minecraft.resources.Identifier.parse(entry.getKey())); + var function=net.minecraft.world.level.levelgen.densityfunction.DensityFunctions.DIRECT_CODEC.parse(ops,JsonParser.parseString(entry.getValue().getAsString())).getOrThrow(); + densities.register(key,function,net.minecraft.core.RegistrationInfo.BUILT_IN);functions.put(entry.getKey(),function); + } + densities.freeze(); + var zero=net.minecraft.world.level.levelgen.densityfunction.DensityFunctions.zero(); + var router=new net.minecraft.world.level.levelgen.NoiseRouter(zero,zero,zero,zero,zero,zero,zero,zero); + if(setting!=null) { + var settings=JsonParser.parseString(bundle.getAsJsonObject("settings").get(setting).getAsString()).getAsJsonObject(); + router=net.minecraft.world.level.levelgen.NoiseRouter.CODEC.parse(ops,settings.get("noise_router")).getOrThrow(); + functions=new java.util.LinkedHashMap<>(); + functions.put("temperature",router.temperature());functions.put("vegetation",router.vegetation()); + functions.put("continents",router.continents());functions.put("erosion",router.erosion()); + functions.put("depth",router.depth());functions.put("ridges",router.ridges()); + functions.put("chunk_surface_level",router.chunkSurfaceLevel());functions.put("final_density",router.finalDensity()); + } + var state=net.minecraft.world.level.levelgen.RandomState.create(noises,seed,legacy,net.minecraft.world.level.block.Blocks.STONE.defaultBlockState(),63,router); + var compilerField=state.getClass().getDeclaredField("densityFunctionCompiler");compilerField.setAccessible(true); + var compiler=(net.minecraft.world.level.levelgen.densityfunction.DensityFunctionCompiler)compilerField.get(state); + var contextField=compiler.getClass().getDeclaredField("context");contextField.setAccessible(true); + var compileContext=(net.minecraft.world.level.levelgen.densityfunction.DensityFunction.CompileContext)contextField.get(compiler); + var countField=compiler.getClass().getDeclaredField("nextCacheId");countField.setAccessible(true); + if(aquiferFixture!=null) { + var fixture=JsonParser.parseString(aquiferFixture).getAsJsonObject(); + var settings=JsonParser.parseString(bundle.getAsJsonObject("settings").get(setting).getAsString()).getAsJsonObject(); + var configJson=fixture.has("config")?JsonParser.parseString(fixture.get("config").getAsString()):settings.get("aquifers"); + if(configJson==null){out.println("aquifer config error");return;} + net.minecraft.world.level.levelgen.Aquifer.Config config; + try{var decoded=net.minecraft.world.level.levelgen.Aquifer.Config.CODEC.parse(ops,configJson).result(); + if(decoded.isEmpty()){out.println("aquifer config error");return;}config=decoded.get();} + catch(IllegalArgumentException | IllegalStateException e){out.println("aquifer config error");return;} + noiseAquiferProbe(fixture,config,compiler,state,countField,out);return; + } + out.println(setting==null?"registry "+functions.size():"router "+setting+" "+functions.size()); + var sharedContext=createContext(); + for(var entry:functions.entrySet()) { + var function=entry.getValue();var range=function.range(); + out.printf("entry %s %s %s %d%n",entry.getKey(),bits(range.min()),bits(range.max()),function.domainAxes()); + net.minecraft.world.level.levelgen.densityfunction.DensitySampler sampler; + try { sampler=optimized?compiler.getSampler(function):function.compileSampler(compileContext); } + catch(IllegalArgumentException | IllegalStateException e){out.println("compile error");continue;} + out.println("compile ok "+countField.getInt(compiler)); + var context=setting==null?createContext():sharedContext; + int[][] points={{0,0,0},{-17,-64,32},{30000000,319,-30000000},{1,-1,-1}}; + for(var point:points)out.println("density "+bits(sampler.sampleValue(context,point[0],point[1],point[2]))); + int[][] origins={{-17,-64,32},{-16,-64,32},{-17,0,32}},steps={{1,1,1},{4,8,4},{4,1,4}},extents={{2,9,2},{2,9,2},{3,1,2}}; + for(int v=0;v<(setting==null?2:3);v++) { + var volume=new net.minecraft.world.level.levelgen.densityfunction.DensityVolume(extents[v][0],extents[v][1],extents[v][2],origins[v][0],origins[v][1],origins[v][2],steps[v][0],steps[v][1],steps[v][2]); + var buffer=net.minecraft.world.level.levelgen.densityfunction.DensityBuffer.createUnpooled(volume.size());buffer.fill(0.0f); + for(int repeat=0;repeat<2;repeat++) { + String status="ok";try{sampler.sampleVolume(context,buffer,volume);}catch(IllegalArgumentException | IllegalStateException e){status="error";} + out.println("volume "+status);for(int i=0;i>>(); + biomePresets.forEach((preset,list)->presets.put(preset.id().toString(),list)); + for(var preset:presets.entrySet()) { + // Resolver lookup needs holder identities, not biome properties. + // Registration placeholders retain actual keys without fabricating + // biome implementations or invoking their gameplay behavior. + var biomes=new net.minecraft.core.MappedRegistry(net.minecraft.core.registries.Registries.BIOME,com.mojang.serialization.Lifecycle.stable()); + var lookup=biomes.createRegistrationLookup(); + var entries=new java.util.ArrayList>>(); + for(var entry:preset.getValue().values())entries.add(com.mojang.datafixers.util.Pair.of(entry.getFirst(),lookup.getOrThrow(entry.getSecond()))); + var source=net.minecraft.world.level.biome.MultiNoiseBiomeSource.createFromList(new net.minecraft.world.level.biome.Climate.ParameterList<>(entries)); + out.println("biomes "+preset.getKey()+" "+entries.size()); + var resolver=source.createResolver(climate); + for(var position:positions)out.println("biome "+resolver.getNoiseBiome(position[0],position[1],position[2]).unwrapKey().orElseThrow().identifier()); + int[][] minima={{-5,-16,8},{-4,-16,8},{Integer.MAX_VALUE-1,Integer.MIN_VALUE,-1}},extents={{3,4,2},{3,4,2},{2,2,2}}; + for(int v=0;v<3;v++) { + var min=minima[v];var size=extents[v]; + var bulk=source.createResolverForChunk(climate,min[0],min[1],min[2],size[0],size[1],size[2]); + var queries=new java.util.ArrayList(); + for(int z=0;z(queries);var reverse=new java.util.ArrayList<>(queries);java.util.Collections.reverse(reverse);queries.addAll(reverse);queries.addAll(forward.subList(0,3)); + for(var position:queries)out.println("biomecell "+bulk.getNoiseBiome(position[0],position[1],position[2]).unwrapKey().orElseThrow().identifier()); + } + } + + } + + } + private static net.minecraft.world.level.levelgen.densityfunction.SamplerContext createContext() { + return net.minecraft.world.level.levelgen.densityfunction.SamplerContext.builder().enableCaches().useBufferArena(new net.minecraft.world.level.levelgen.densityfunction.DensityBufferArena() { + public net.minecraft.world.level.levelgen.densityfunction.ScopedDensityBuffer acquire(int size) { var buffer=net.minecraft.world.level.levelgen.densityfunction.DensityBufferArena.GLOBAL.acquire(size);buffer.fill(0.0f);return buffer; } + public void release(net.minecraft.world.level.levelgen.densityfunction.ScopedDensityBuffer buffer) { net.minecraft.world.level.levelgen.densityfunction.DensityBufferArena.GLOBAL.release(buffer); } + }).build(); + } + private static void leafOrder(Object node,PrintWriter out) throws Exception { + try { + var value=node.getClass().getDeclaredField("value");value.setAccessible(true);out.println("leaf "+value.get(node)); + } catch(NoSuchFieldException e) { + var children=node.getClass().getDeclaredField("children");children.setAccessible(true); + for(var child:(Object[])children.get(node))leafOrder(child,out); + } + } + @SuppressWarnings("unchecked") + private static void indexProbe(int branching,String json,PrintWriter out) throws Exception { + var input=JsonParser.parseString(json).getAsJsonObject(); + var entries=new java.util.ArrayList>(); + for(var raw:input.getAsJsonArray("entries")) { + var entry=raw.getAsJsonObject();var coordinates=entry.getAsJsonArray("coordinates"); + var p=new net.minecraft.world.level.biome.Climate.Parameter[6]; + for(int i=0;i<6;i++){var coord=coordinates.get(i).getAsJsonArray();p[i]=new net.minecraft.world.level.biome.Climate.Parameter(coord.get(0).getAsLong(),coord.get(1).getAsLong());} + entries.add(com.mojang.datafixers.util.Pair.of(new net.minecraft.world.level.biome.Climate.ParameterPoint(p[0],p[1],p[2],p[3],p[4],p[5],entry.get("offset").getAsLong()),entries.size())); + } + // The Rust bounded API accepts branching 2..32. Other reference rebuild + // values can diverge or fail to terminate and are outside this transport. + if(branching<2 || branching>32){out.println("index error");return;} + var constructor=net.minecraft.world.level.biome.Climate.ParameterList.class.getDeclaredConstructor(java.util.List.class,int.class);constructor.setAccessible(true); + net.minecraft.world.level.biome.Climate.ParameterList index; + try{index=(net.minecraft.world.level.biome.Climate.ParameterList)constructor.newInstance(entries,branching);} + catch(java.lang.reflect.InvocationTargetException e){out.println("index error");return;} + var indexField=index.getClass().getDeclaredField("index");indexField.setAccessible(true);var tree=indexField.get(index); + var rootField=tree.getClass().getDeclaredField("root");rootField.setAccessible(true); + var lastField=tree.getClass().getDeclaredField("lastResult");lastField.setAccessible(true);var last=(ThreadLocal)lastField.get(tree); + out.println("index ok "+entries.size());leafOrder(rootField.get(tree),out); + for(var target:input.getAsJsonArray("targets")) { + var values=target.getAsJsonArray();var point=new net.minecraft.world.level.biome.Climate.TargetPoint(values.get(0).getAsLong(),values.get(1).getAsLong(),values.get(2).getAsLong(),values.get(3).getAsLong(),values.get(4).getAsLong(),values.get(5).getAsLong()); + int brute=index.findValueBruteForce(point);out.println("brute "+brute+" "+entries.get(brute).getFirst().fitness(point)); + try{int found=index.findValue(point);out.println("cached "+found+" "+entries.get(found).getFirst().fitness(point));} + catch(NullPointerException e){out.println("cached error");} + var previous=last.get();last.remove(); + try{int found=index.findValue(point);out.println("fresh "+found+" "+entries.get(found).getFirst().fitness(point));} + catch(NullPointerException e){out.println("fresh error");} + finally{if(previous==null)last.remove();else last.set(previous);} + } + } + private static void settingsProbe(net.minecraft.world.level.levelgen.NoiseSettings settings,PrintWriter out) { + out.println("settings "+settings.minY()+" "+settings.height()); + int[][] accessors={{-64,384},{0,128},{-2032,4064},{17,15},{2048,16},{Integer.MAX_VALUE,1},{Integer.MIN_VALUE,Integer.MAX_VALUE}}; + for(var accessor:accessors) { + var clamped=settings.clampToHeightAccessor(net.minecraft.world.level.LevelHeightAccessor.create(accessor[0],accessor[1])); + out.println("clamped "+clamped.minY()+" "+clamped.height()); + } + } + private static net.minecraft.world.level.block.state.BlockState fluidState(int label) { + return switch(label) { + case 0 -> net.minecraft.world.level.block.Blocks.WATER.defaultBlockState(); + case 1 -> net.minecraft.world.level.block.Blocks.LAVA.defaultBlockState(); + case 2 -> net.minecraft.world.level.block.Blocks.AIR.defaultBlockState(); + case 3 -> net.minecraft.world.level.block.Blocks.STONE.defaultBlockState(); + case 4 -> net.minecraft.world.level.block.Blocks.CAVE_AIR.defaultBlockState(); + case 5 -> net.minecraft.world.level.block.Blocks.VOID_AIR.defaultBlockState(); + case 6 -> net.minecraft.world.level.block.Blocks.WATER.defaultBlockState().setValue(net.minecraft.world.level.block.LiquidBlock.LEVEL,1); + case 7 -> net.minecraft.world.level.block.Blocks.LAVA.defaultBlockState().setValue(net.minecraft.world.level.block.LiquidBlock.LEVEL,1); + default -> throw new AssertionError("unknown fluid label"); + }; + } + private static int fluidLabel(net.minecraft.world.level.block.state.BlockState state) { + for(int label=0;label<8;label++)if(fluidState(label)==state)return label; + throw new AssertionError("unknown fluid state"); + } + private static void aquiferProbe(String line,PrintWriter out) throws Exception { + if(net.minecraft.SharedConstants.DEBUG_DISABLE_FLUID_GENERATION)throw new AssertionError("reference requires regular fluid generation"); + var args=line.split(" ");int sea=Integer.parseInt(args[1]),label=Integer.parseInt(args[2]),x=Integer.parseInt(args[3]),y=Integer.parseInt(args[4]),z=Integer.parseInt(args[5]); + double density=Double.longBitsToDouble(Long.parseUnsignedLong(args[6],16)); + var empty=new net.minecraft.world.level.levelgen.Aquifer.FluidStatus(-4064,fluidState(2)); + var lava=new net.minecraft.world.level.levelgen.Aquifer.FluidStatus(-54,fluidState(1)); + var fluid=new net.minecraft.world.level.levelgen.Aquifer.FluidStatus(sea,fluidState(label)); + var method=net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator.class.getDeclaredMethod("lambda$createFluidPicker$0",net.minecraft.world.level.levelgen.Aquifer.FluidStatus.class,int.class,net.minecraft.world.level.levelgen.Aquifer.FluidStatus.class,net.minecraft.world.level.levelgen.Aquifer.FluidStatus.class,int.class,int.class,int.class);method.setAccessible(true); + net.minecraft.world.level.levelgen.Aquifer.FluidPicker picker=(px,py,pz)->{ + try{return (net.minecraft.world.level.levelgen.Aquifer.FluidStatus)method.invoke(null,empty,sea,lava,fluid,px,py,pz);} + catch(ReflectiveOperationException e){throw new AssertionError(e);} + }; + var status=picker.computeFluid(x,y,z);out.println("fluid "+status.fluidLevel()+" "+fluidLabel(status.fluidType())+" "+fluidLabel(status.at(y))); + var calls=new java.util.concurrent.atomic.AtomicInteger(); + var aquifer=net.minecraft.world.level.levelgen.Aquifer.createDisabled((px,py,pz)->{calls.incrementAndGet();return picker.computeFluid(px,py,pz);}); + var substance=aquifer.computeSubstance(x,y,z,density); + out.println("substance "+(substance==null?"default_solid":Integer.toString(fluidLabel(substance)))+" "+aquifer.shouldScheduleFluidUpdate()+" "+calls.get()); + } + private static void noiseAquiferProbe(com.google.gson.JsonObject fixture,net.minecraft.world.level.levelgen.Aquifer.Config config,net.minecraft.world.level.levelgen.densityfunction.DensityFunctionCompiler compiler,net.minecraft.world.level.levelgen.RandomState state,java.lang.reflect.Field countField,PrintWriter out) throws Exception { + var functions=new net.minecraft.world.level.levelgen.densityfunction.DensityFunction[]{config.barrierNoise(),config.fluidLevelFloodednessNoise(),config.fluidLevelSpreadNoise(),config.lavaNoise(),config.exclusion(),config.surfaceLevel()}; + var samplers=new net.minecraft.world.level.levelgen.densityfunction.DensitySampler[6]; + try{for(int i=0;i<6;i++)samplers[i]=compiler.getSampler(functions[i]);} + catch(IllegalArgumentException | IllegalStateException e){out.println("aquifer compile error");return;} + out.println("aquifer compile ok "+countField.getInt(compiler)); + var events=new java.util.ArrayList();var context=createContext();var binding=new java.util.concurrent.atomic.AtomicInteger(); + net.minecraft.world.level.levelgen.densityfunction.DensitySamplerSet set=function->{ + int field=binding.getAndIncrement();var inner=samplers[field]; + if(fixture.has("overrides") && !fixture.getAsJsonArray("overrides").get(field).isJsonNull())inner=net.minecraft.world.level.levelgen.densityfunction.DensityFunctions.constant(Float.intBitsToFloat(Integer.parseUnsignedInt(fixture.getAsJsonArray("overrides").get(field).getAsString(),16))).compileSampler(null); + var source=inner; + return new net.minecraft.world.level.levelgen.densityfunction.DensitySampler(){ + private int calls; + private void enter(String event){events.add(event);calls++;if(fixture.has("fail") && fixture.getAsJsonArray("fail").get(0).getAsInt()==field && fixture.getAsJsonArray("fail").get(1).getAsInt()==calls){events.add("sample failure "+field);throw new IllegalStateException("injected sampler failure");}} + public float sampleValue(net.minecraft.world.level.levelgen.densityfunction.SamplerContext ctx,int x,int y,int z){ + enter("sample "+field+" value "+x+" "+y+" "+z); + try{float value=source.sampleValue(ctx,x,y,z);events.add("value "+bits(value));return value;} + catch(IllegalArgumentException | IllegalStateException e){events.add("value error");throw e;} + } + public void sampleVolume(net.minecraft.world.level.levelgen.densityfunction.SamplerContext ctx,net.minecraft.world.level.levelgen.densityfunction.DensityBuffer buffer,net.minecraft.world.level.levelgen.densityfunction.DensityVolume volume){ + enter("sample "+field+" volume "+volume.sizeX()+" "+volume.sizeY()+" "+volume.sizeZ()+" "+volume.minBlockX()+" "+volume.minBlockY()+" "+volume.minBlockZ()+" "+volume.stepBlockX()+" "+volume.stepBlockY()+" "+volume.stepBlockZ()); + String result="ok"; + try{source.sampleVolume(ctx,buffer,volume);}catch(IllegalArgumentException | IllegalStateException e){result="error";throw e;} + finally{events.add("sample volume "+result);for(int i=0;i{try{var result=(net.minecraft.world.level.levelgen.Aquifer.FluidStatus)method.invoke(null,empty,sea,lava,fluid,x,y,z);events.add("pick "+x+" "+y+" "+z+" "+result.fluidLevel()+" "+fluidLabel(result.fluidType()));return result;}catch(ReflectiveOperationException e){throw new AssertionError(e);}}; + var size=fixture.getAsJsonArray("sizes");var min=fixture.getAsJsonArray("minimum");var steps=fixture.getAsJsonArray("steps"); + var volume=new net.minecraft.world.level.levelgen.densityfunction.DensityVolume(size.get(0).getAsInt(),size.get(1).getAsInt(),size.get(2).getAsInt(),min.get(0).getAsInt(),min.get(1).getAsInt(),min.get(2).getAsInt(),steps.get(0).getAsInt(),steps.get(1).getAsInt(),steps.get(2).getAsInt()); + net.minecraft.world.level.levelgen.Aquifer aquifer; + try{aquifer=config.create(set,state.getOrCreateRandomFactory(net.minecraft.resources.Identifier.withDefaultNamespace("aquifer")),volume,picker);} + catch(IllegalArgumentException | IllegalStateException e){events.forEach(out::println);out.println("aquifer create error");return;} + events.forEach(out::println);events.clear(); + var skip=aquifer.getClass().getDeclaredField("skipSamplingAboveY");skip.setAccessible(true);out.println("aquifer ready "+skip.getInt(aquifer)); + for(var raw:fixture.getAsJsonArray("queries")){ + var query=raw.getAsJsonArray();String result; + try{var block=aquifer.computeSubstance(query.get(0).getAsInt(),query.get(1).getAsInt(),query.get(2).getAsInt(),Double.longBitsToDouble(Long.parseUnsignedLong(query.get(3).getAsString(),16)));result=block==null?"default_solid":Integer.toString(fluidLabel(block));} + catch(IllegalArgumentException | IllegalStateException | IndexOutOfBoundsException e){result="error";} + events.forEach(out::println);events.clear();out.println("aquifer result "+result+" "+aquifer.shouldScheduleFluidUpdate()); + } + var locationsField=aquifer.getClass().getDeclaredField("aquiferLocationCache");locationsField.setAccessible(true);var locations=(long[])locationsField.get(aquifer); + var statusesField=aquifer.getClass().getDeclaredField("aquiferCache");statusesField.setAccessible(true);var statuses=(net.minecraft.world.level.levelgen.Aquifer.FluidStatus[])statusesField.get(aquifer); + for(int i=0;i();surfaces.long2IntEntrySet().forEach(entry->sorted.put(entry.getLongKey(),entry.getIntValue())); + sorted.forEach((key,value)->out.println("aquifer surface "+key+" "+value)); + } + + private static void tagEntryProbe(String json,PrintWriter out){ + var decoded=net.minecraft.tags.TagEntry.CODEC.parse(JsonOps.INSTANCE,JsonParser.parseString(json)).result(); + if(decoded.isEmpty())out.println("tag entry error");else out.println("tag entry "+decoded.get()); + } + private static void tagFileProbe(String json,PrintWriter out){ + var decoded=net.minecraft.tags.TagFile.CODEC.parse(JsonOps.INSTANCE,JsonParser.parseString(json)).result(); + if(decoded.isEmpty()){out.println("tag file error");return;} + var file=decoded.get();out.println("tag file "+file.replace()+" "+file.entries().size()); + for(var entry:file.entries())out.println("tag entry "+entry); + } + private static void tagsProbe(com.google.gson.JsonObject fixture,PrintWriter out)throws Exception { + out.println("tags resources "+fixture.getAsJsonArray("files").size()); + var definitions=new java.util.HashMap>(); + for(var raw:fixture.getAsJsonArray("files")){ + var row=raw.getAsJsonArray();var name=net.minecraft.resources.Identifier.parse(row.get(0).getAsString());String source=row.get(1).getAsString(); + var json=JsonParser.parseString(row.get(2).getAsString());var entries=definitions.computeIfAbsent(name,ignored->new java.util.ArrayList<>()); + var decoded=net.minecraft.tags.TagFile.CODEC.parse(JsonOps.INSTANCE,json).result(); + if(decoded.isEmpty()){out.println("tag resource error "+name+" "+source);continue;} + var file=decoded.get();if(file.replace())entries.clear(); + for(var entry:file.entries())entries.add(new net.minecraft.tags.TagLoader.EntryWithSource(entry,source)); + } + var elements=fixture.getAsJsonObject("elements");var trace=new java.util.ArrayList(); + var loader=new net.minecraft.tags.TagLoader((id,required)->{ + trace.add("tag lookup "+id+" "+required); + return elements.has(id.toString())?java.util.Optional.of(elements.get(id.toString()).getAsString()):java.util.Optional.empty(); + },"tags/block"); + var result=loader.build(definitions);trace.forEach(out::println); + var sorted=new java.util.TreeMap>();result.forEach((key,value)->sorted.put(key.toString(),value)); + out.println("tags built "+sorted.size()); + for(var entry:sorted.entrySet()){out.println("tag members "+entry.getKey()+" "+entry.getValue().size());for(var value:entry.getValue())out.println("tag member "+value);} + definitions.keySet().stream().filter(name->!result.containsKey(name)).map(Object::toString).sorted().forEach(name->out.println("tag missing "+name)); + } + private static void tagRegistryProbe(String path,PrintWriter out)throws Exception { + var bundle=JsonParser.parseString(Files.readString(Path.of(path))).getAsJsonObject(); + var fixture=new com.google.gson.JsonObject();var files=new com.google.gson.JsonArray(); + var sorted=new java.util.TreeMap();bundle.getAsJsonObject("tags").entrySet().forEach(entry->sorted.put(entry.getKey(),entry.getValue())); + sorted.forEach((name,json)->{var row=new com.google.gson.JsonArray();row.add(name);row.add("vanilla");row.add(json);files.add(row);});fixture.add("files",files); + // This lookup table must agree with the actual reference registry. + var elements=bundle.getAsJsonObject("block_elements"); + if(elements.size()!=net.minecraft.core.registries.BuiltInRegistries.BLOCK.keySet().size())throw new AssertionError("block identifiers differ"); + for(var name:elements.keySet())if(!net.minecraft.core.registries.BuiltInRegistries.BLOCK.containsKey(net.minecraft.resources.Identifier.parse(name)))throw new AssertionError("unknown exported block"); + fixture.add("elements",elements);tagsProbe(fixture,out); + } + + private static String bits(float value) { return Integer.toUnsignedString(Float.floatToIntBits(value)); } + public static void main(String[] paths) throws Exception { + net.minecraft.SharedConstants.tryDetectVersion(); + net.minecraft.server.Bootstrap.bootStrap(); + var octavesField=NormalNoise.class.getDeclaredField("octaves");octavesField.setAccessible(true); + var factorField=NormalNoise.class.getDeclaredField("normalizationFactor");factorField.setAccessible(true); + try(var reader=Files.newBufferedReader(Path.of(paths[0]),StandardCharsets.UTF_8); + var out=new PrintWriter(Files.newBufferedWriter(Path.of(paths[1]),StandardCharsets.UTF_8))) { + String line; + while((line=reader.readLine())!=null) { + if(line.startsWith("tag_entry ")){tagEntryProbe(line.substring(10),out);continue;} + if(line.startsWith("tag_file ")){tagFileProbe(line.substring(9),out);continue;} + if(line.startsWith("tag_registry ")){tagRegistryProbe(line.substring(13),out);continue;} + if(line.startsWith("tags ")){tagsProbe(JsonParser.parseString(line.substring(5)).getAsJsonObject(),out);continue;} + if(line.startsWith("noise_aquifer ")){var fields=line.split(" ",6);registryProbe(fields[3],Long.parseLong(fields[1]),fields[2].equals("1"),true,fields[4],fields[5],out);continue;} + if(line.startsWith("aquifer ")){aquiferProbe(line,out);continue;} + if(line.startsWith("noise_settings ")) { + var decoded=net.minecraft.world.level.levelgen.NoiseSettings.CODEC.parse(JsonOps.INSTANCE,JsonParser.parseString(line.substring("noise_settings ".length()))).result(); + if(decoded.isEmpty())out.println("settings error");else settingsProbe(decoded.get(),out);continue; + } + if(line.startsWith("settings_create ")) { + var values=line.split(" "); + try{settingsProbe(net.minecraft.world.level.levelgen.NoiseSettings.create(Integer.parseInt(values[1]),Integer.parseInt(values[2])),out);} + catch(IllegalStateException e){out.println("settings error");}continue; + } + if(line.startsWith("climate_parameter ")) { + var decoded=net.minecraft.world.level.biome.Climate.Parameter.CODEC.parse(JsonOps.INSTANCE,JsonParser.parseString(line.substring("climate_parameter ".length()))).result(); + if(decoded.isEmpty())out.println("parameter error");else{var p=decoded.get();out.println("parameter "+p.min()+" "+p.max());}continue; + } + if(line.startsWith("climate_point ")) { + var decoded=net.minecraft.world.level.biome.Climate.ParameterPoint.CODEC.parse(JsonOps.INSTANCE,JsonParser.parseString(line.substring("climate_point ".length()))).result(); + if(decoded.isEmpty())out.println("parameterpoint error");else{ + var p=decoded.get();out.print("parameterpoint"); + for(var coordinate:new net.minecraft.world.level.biome.Climate.Parameter[]{p.temperature(),p.humidity(),p.continentalness(),p.erosion(),p.depth(),p.weirdness()})out.print(" "+coordinate.min()+" "+coordinate.max()); + out.println(" "+p.offset()); + }continue; + } + if(line.startsWith("index ")) {var fields=line.split(" ",3);indexProbe(Integer.parseInt(fields[1]),fields[2],out);continue;} + if(line.startsWith("quantize ")) { + var values=line.split(" ");out.print("quantized"); + for(int i=1;i<=6;i++)out.print(" "+net.minecraft.world.level.biome.Climate.quantizeCoord(Float.intBitsToFloat(Integer.parseUnsignedInt(values[i],16)))); + out.println();out.println("unquantized "+bits(net.minecraft.world.level.biome.Climate.unquantizeCoord(Long.parseLong(values[7]))));continue; + } + String[] args=line.split(" ",5); + if(args[0].equals("router")){var fields=args[4].split(" ",2);registryProbe(fields[0],Long.parseLong(args[1]),args[2].equals("1"),args[3].equals("1"),fields[1],out);continue;} + if(args[0].equals("registry")){registryProbe(args[4],Long.parseLong(args[1]),args[2].equals("1"),args[3].equals("1"),null,out);continue;} + if(!args[0].equals("noise"))throw new AssertionError("unknown command"); + long seed=Long.parseLong(args[1]);boolean legacy=args[2].equals("1"),nether=args[3].equals("1"); + var decoded=NormalNoise.DIRECT_CODEC.parse(JsonOps.INSTANCE,JsonParser.parseString(args[4])).result(); + if(decoded.isEmpty()){out.println("decode error");continue;} + var noise=decoded.get();var octaves=(java.util.List)octavesField.get(noise); + out.printf("decode %d %s %s %s%n",octaves.size(),Long.toUnsignedString(Double.doubleToLongBits(factorField.getDouble(noise))),bits(noise.range().min()),bits(noise.range().max())); + for(var octave:octaves) { + var index=octave.getClass().getDeclaredMethod("octaveIndex");index.setAccessible(true); + var frequency=octave.getClass().getDeclaredMethod("frequency");frequency.setAccessible(true); + var amplitude=octave.getClass().getDeclaredMethod("amplitude");amplitude.setAccessible(true); + out.printf("octave %d %s %s%n",index.invoke(octave),Long.toUnsignedString(Double.doubleToLongBits((Double)frequency.invoke(octave))),Long.toUnsignedString(Double.doubleToLongBits((Double)amplitude.invoke(octave)))); + } + net.minecraft.util.RandomSource random=legacy?new LegacyRandomSource(seed):new XoroshiroRandomSource(seed); + net.minecraft.world.level.levelgen.synth.Noise sampler; + try { sampler=nether?noise.createForLegacyNetherBiome(random):noise.create(random); } + catch(IllegalArgumentException | IllegalStateException e){out.println("sample error "+random.nextLong());continue;} + double[][] points={{0,0,0},{-17.25,64.125,32.5},{30e6,-64,-30e6},{1.25,-.5,-3.75},{33554432,-2048,-33554433}}; + for(var point:points)out.printf("query %s %s%n",bits(sampler.get(point[0],point[2])),bits(sampler.get(point[0],point[1],point[2]))); + out.println("parent "+random.nextLong()); + } + } + } +} diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaWorldgenRandomOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaWorldgenRandomOracle.java new file mode 100644 index 000000000..d074834d0 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaWorldgenRandomOracle.java @@ -0,0 +1,50 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.nio.file.*; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.levelgen.*; + +/** Native world-generation bit adapter, forks, counters and seeding methods. */ +public final class VanillaWorldgenRandomOracle { + public static void main(String[] args) throws Exception { + Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt"),StandardCharsets.UTF_8))) { + for(var line:Files.readAllLines(dir.resolve("inputs.txt"))) { + var f=JsonParser.parseString(line).getAsJsonObject();long seed=f.get("seed").getAsLong(); + RandomSource source=f.get("legacy").getAsBoolean()?new LegacyRandomSource(seed):new XoroshiroRandomSource(seed); + source.consumeCount(f.get("warmup").getAsInt()); + for(int i=1;i{random=root;out.println("root");} + case "bits"->out.println("bits "+root.next(op.get(1).getAsInt())); + case "decoration"->out.println("decoration "+root.setDecorationSeed(op.get(1).getAsLong(),op.get(2).getAsInt(),op.get(3).getAsInt())); + case "feature"->{root.setFeatureSeed(op.get(1).getAsLong(),op.get(2).getAsInt(),op.get(3).getAsInt());out.println("feature");} + case "large"->{root.setLargeFeatureSeed(op.get(1).getAsLong(),op.get(2).getAsInt(),op.get(3).getAsInt());out.println("large");} + case "salt"->{root.setLargeFeatureWithSalt(op.get(1).getAsLong(),op.get(2).getAsInt(),op.get(3).getAsInt(),op.get(4).getAsInt());out.println("salt");} + case "slime"->{var r=WorldgenRandom.seedSlimeChunk(op.get(1).getAsInt(),op.get(2).getAsInt(),op.get(3).getAsLong(),op.get(4).getAsLong());out.println("slime "+r.nextLong()+" "+r.nextInt(10));} + case "int"->out.println("int "+random.nextInt()); + case "long"->out.println("long "+random.nextLong()); + case "bool"->out.println("bool "+random.nextBoolean()); + case "float"->out.println("float "+Integer.toUnsignedString(Float.floatToRawIntBits(random.nextFloat()),16)); + case "double"->out.println("double "+Long.toUnsignedString(Double.doubleToRawLongBits(random.nextDouble()),16)); + case "bound"->{try{out.println("bound "+random.nextInt(op.get(1).getAsInt()));}catch(IllegalArgumentException e){out.println("bound error");}} + case "seed"->{random.setSeed(op.get(1).getAsLong());out.println("seed");} + case "consume"->{random.consumeCount(op.get(1).getAsInt());out.println("consume");} + case "fork"->{random=random.fork();out.println("fork");} + case "pos"->{random=random.forkPositional().at(op.get(1).getAsInt(),op.get(2).getAsInt(),op.get(3).getAsInt());out.println("pos");} + case "pos_seed"->{random=random.forkPositional().fromSeed(op.get(1).getAsLong());out.println("pos_seed");} + case "pos_hash"->{var values=op.get(1).getAsJsonArray();char[] units=new char[values.size()];for(int i=0;ithrow new AssertionError(kind); + } + out.println("count "+root.getCount()); + } + out.println("tail "+root.nextLong());out.println("count "+root.getCount()); + } + } + } +} diff --git a/packs/START-HERE.txt b/packs/START-HERE.txt index b563f2f05..225f8a086 100644 --- a/packs/START-HERE.txt +++ b/packs/START-HERE.txt @@ -1,4 +1,4 @@ -HORIZON LAB @PACK_VERSION@ — playable optimization experiments +HORIZON @PACK_VERSION@ — playable optimization experiments YOUR MAC 1. Extract this ZIP. Double-click Mac-Start.command. If macOS asks, use Open @@ -179,7 +179,7 @@ Only original project binaries are embedded. Mods, the game and assets download from their publishers with pinned hashes. No decompiled Minecraft is distributed. Source, build commands and measured validation: -https://github.com/ludovic111/minecraft-optimization-lab +https://github.com/ludovic111/Horizon TERRAIN / SHADER COMPARISONS Version 0.12 records actual DH radius/quality, worker count/duty cycle, Iris state diff --git a/tests/test_anchor_parity.py b/tests/test_anchor_parity.py new file mode 100644 index 000000000..a9df54cea --- /dev/null +++ b/tests/test_anchor_parity.py @@ -0,0 +1,22 @@ +import itertools +import json +import unittest +from tools import test_anchor_parity as anchor + + +class AnchorCorpusTests(unittest.TestCase): + def test_exclusive_alternatives_and_unrestricted_runtime_bounds(self): + fixtures=list(anchor.corpus()) + self.assertEqual(fixtures,list(anchor.corpus())) + self.assertEqual(len(fixtures),192) + self.assertEqual(sum('generator' in f for f in fixtures),96) + self.assertIn(-2**31,fixtures[0]['values']) + self.assertIn(2**31-1,fixtures[0]['values']) + decoded=[json.loads(s) for s in fixtures[0]['json']] + names=['absolute','above_bottom','below_top','relative_to_sea_level'] + for combination in itertools.product([None,0,2032,'bad'],repeat=4): + self.assertIn({k:v for k,v in zip(names,combination) if v is not None},decoded) + self.assertIn('{"absolute":1,"absolute":null}',fixtures[0]['json']) + + +if __name__=='__main__':unittest.main() diff --git a/tests/test_basic_feature_parity.py b/tests/test_basic_feature_parity.py new file mode 100644 index 000000000..a0744781c --- /dev/null +++ b/tests/test_basic_feature_parity.py @@ -0,0 +1,25 @@ +import json +import unittest +from tools import test_basic_feature_parity as features + + +class BasicFeatureCorpusTests(unittest.TestCase): + def test_native_feature_types_partial_mutations_and_wrapped_origins(self): + fixtures = list(features.corpus()) + self.assertEqual(fixtures, list(features.corpus())) + kinds = {v.get('type') for f in fixtures if isinstance(v := json.loads(f['definition']), dict)} + self.assertTrue({'void_start_platform', 'end_island', 'end_platform'} <= kinds) + self.assertEqual({f['legacy'] for f in fixtures}, {False, True}) + self.assertEqual({f['fail'] for f in fixtures}, {-1, 0, 7, 63}) + self.assertEqual({f['reject'] for f in fixtures}, {0, 3}) + self.assertTrue(any(f['origin'][0] == 2**31 - 1 for f in fixtures)) + self.assertTrue(any(f['origin'][1] == -2**31 for f in fixtures)) + self.assertTrue(any(f['repeats'] == 2 for f in fixtures)) + composed = [f for f in fixtures if 'placement' in f] + self.assertTrue(any(not f['placement'] for f in composed)) + self.assertTrue(any(len(f['placement']) > 1 and f['fail'] == 7 for f in composed)) + self.assertTrue(any(any(p['type'] == 'height_range' for p in f['placement']) for f in composed)) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_biome_chunk_parity.py b/tests/test_biome_chunk_parity.py new file mode 100644 index 000000000..769ddc757 --- /dev/null +++ b/tests/test_biome_chunk_parity.py @@ -0,0 +1,23 @@ +import unittest +from tools import test_biome_chunk_parity as chunk + + +class BiomeChunkCorpusTests(unittest.TestCase): + def test_bounds_section_failure_and_query_coverage(self): + fixtures = list(chunk.corpus()) + self.assertEqual(fixtures, list(chunk.corpus())) + self.assertEqual(len(fixtures), 20) + self.assertTrue(any(f['height'] == 4064 for f in fixtures)) + self.assertTrue(any(f['cx'] == -(2**31) for f in fixtures)) + for f in fixtures: + self.assertEqual({op[2] for op in f['ops']}, {-1, 0, 63, 64, 65}) + self.assertTrue(any(op[3] % 16 != 0 for op in f['ops'])) + for op in f['ops']: + self.assertTrue(f['min'] <= op[3] <= op[4] < f['min'] + f['height']) + self.assertTrue(1 <= op[1] <= 512) + for q in f['queries']: + self.assertTrue(all(-(2**31) <= v < 2**31 for v in q)) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_biome_generation_parity.py b/tests/test_biome_generation_parity.py new file mode 100644 index 000000000..2d7f35574 --- /dev/null +++ b/tests/test_biome_generation_parity.py @@ -0,0 +1,27 @@ +import json +import unittest +from tools import test_biome_generation_parity as generation + + +class BiomeGenerationCorpusTests(unittest.TestCase): + def test_router_preset_seed_and_clipped_generation_coverage(self): + bundle = {'settings': {'minecraft:overworld': json.dumps({'noise': {'min_y': -64, 'height': 384}})}, + 'presets': {'minecraft:overworld': '[]', 'minecraft:nether': '[]'}} + all_fixtures = list(generation.corpus(bundle)) + self.assertEqual({f.get('source', 'multi') for f in all_fixtures}, {'multi', 'fixed', 'checkerboard', 'end'}) + fixtures = [f for f in all_fixtures if 'source' not in f] + self.assertEqual(all_fixtures, list(generation.corpus(bundle))) + self.assertEqual(len(fixtures), 12) + self.assertEqual(sum(f['repeats'] for f in fixtures), 16) + self.assertEqual({f['preset'] for f in fixtures}, set(bundle['presets'])) + self.assertEqual({f['legacy'] for f in fixtures}, {False, True}) + self.assertTrue(any(f['write_min'] > f['min'] for f in fixtures)) + self.assertTrue(any(abs(f['cx']) > 1_000_000 for f in fixtures)) + for f in fixtures: + self.assertEqual(len(f['queries']), 180) + self.assertTrue(any(q[1] < f['min'] for q in f['queries'])) + self.assertTrue(any(q[1] >= f['min'] + f['height'] for q in f['queries'])) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_biome_placement_parity.py b/tests/test_biome_placement_parity.py new file mode 100644 index 000000000..11b1ce200 --- /dev/null +++ b/tests/test_biome_placement_parity.py @@ -0,0 +1,20 @@ +import unittest +from tools import test_biome_placement_parity as biome + + +class BiomePlacementCorpusTests(unittest.TestCase): + def test_context_membership_nested_placers_and_partial_failures(self): + fixtures = list(biome.corpus()) + self.assertEqual({f['top'] for f in fixtures}, {False, True}) + self.assertEqual({f['direct'] for f in fixtures}, {False, True}) + self.assertEqual({f['nested'] for f in fixtures}, {False, True}) + self.assertEqual({f['worldgen'] for f in fixtures}, {False, True}) + self.assertEqual({f['legacy'] for f in fixtures}, {False, True}) + self.assertEqual({mode for f in fixtures for mode in f['membership']}, {0, 1, 2, 3}) + self.assertTrue(all(f['placement'] == [{'type': 'biome'}] for f in fixtures if f['direct'])) + self.assertTrue(any(f['query_fail'] == 1 for f in fixtures)) + self.assertTrue(any(f['feature_fail'] == 2 for f in fixtures)) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_biome_source_codec_parity.py b/tests/test_biome_source_codec_parity.py new file mode 100644 index 000000000..924f3d306 --- /dev/null +++ b/tests/test_biome_source_codec_parity.py @@ -0,0 +1,23 @@ +import json +import unittest +from tools import test_biome_source_codec_parity as codec + + +class BiomeSourceCodecCorpusTests(unittest.TestCase): + def test_registry_holders_fallbacks_and_numeric_boundaries(self): + bundle = {'biomes': {'minecraft:plains': ''}, 'biome_tags': {'minecraft:is_overworld': ''}} + fixtures = list(codec.corpus(bundle)) + self.assertEqual(fixtures, list(codec.corpus(bundle))) + values = [json.loads(f) for f in fixtures] + objects = [v for v in values if isinstance(v, dict)] + self.assertTrue({'fixed', 'checkerboard', 'the_end', 'multi_noise'} <= {v.get('type') for v in objects}) + self.assertTrue(any(v.get('biomes') == '#minecraft:is_overworld' for v in objects)) + self.assertTrue(any(v.get('biomes') == [] and v.get('preset') == 'overworld' for v in objects)) + self.assertTrue(any(v.get('preset') == {'preset': 'nether'} for v in objects)) + self.assertTrue(any('4294967298' in f for f in fixtures)) + self.assertTrue(any('"scale":-1,"scale":2' in f for f in fixtures)) + self.assertEqual(len(codec.positions()), 7) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_biome_source_parity.py b/tests/test_biome_source_parity.py new file mode 100644 index 000000000..40b62aa69 --- /dev/null +++ b/tests/test_biome_source_parity.py @@ -0,0 +1,23 @@ +import unittest +from tools import test_biome_source_parity as source + + +class BiomeSourceCorpusTests(unittest.TestCase): + def test_shift_threshold_failure_and_wrapped_coordinate_coverage(self): + fixtures = list(source.corpus()) + self.assertEqual(fixtures, list(source.corpus())) + self.assertEqual({f['kind'] for f in fixtures}, {'fixed', 'checkerboard', 'end'}) + checker = [f for f in fixtures if f['kind'] == 'checkerboard'] + self.assertTrue(set(range(63)) <= {f['scale'] for f in checker}) + self.assertTrue(any(not f['biomes'] for f in checker)) + self.assertTrue(any(len(f['biomes']) != len(set(f['biomes'])) for f in checker)) + self.assertTrue(any(len(f['biomes']) == 512 for f in checker)) + end = [f for f in fixtures if f['kind'] == 'end'] + self.assertTrue(any(f['fail'] for f in end)) + self.assertTrue({'3e800000', 'bd800000', 'be600000', '7fc00000'} <= {f['bits'] for f in end}) + self.assertIn([-(2**31), 0, 2**31-1], fixtures[0]['positions']) + self.assertIn([256, 0, 0], fixtures[0]['positions']) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_biome_temperature_parity.py b/tests/test_biome_temperature_parity.py new file mode 100644 index 000000000..5b356f383 --- /dev/null +++ b/tests/test_biome_temperature_parity.py @@ -0,0 +1,33 @@ +import unittest +import json +from tools import test_biome_temperature_parity as biome + + +class BiomeTemperatureCorpusTests(unittest.TestCase): + def test_temperature_edges_packed_aliases_and_cache_eviction(self): + fixtures=list(biome.corpus()) + self.assertEqual(fixtures,list(biome.corpus())) + self.assertEqual(len(fixtures),204) + self.assertEqual({(f['modifier'],f['precipitation']) for f in fixtures},{('NONE',False),('NONE',True),('FROZEN',False),('FROZEN',True)}) + self.assertTrue({'3e199999','3e19999a','3e19999b','7f800000','ff800000','7fc00000'}<={f['base'] for f in fixtures}) + isolated=[f for f in fixtures if any(op[0]=='thread' for op in f['ops'])] + self.assertEqual(len(isolated),12) + self.assertEqual({f['ops'][2][1] for f in isolated},{0,1023}) + self.assertTrue(all(f['ops'][0]==['fill',1024,0,63] for f in isolated)) + queries=[op[1:] for op in fixtures[0]['ops'] if op[0]=='query'] + self.assertIn([0,80,0,63],queries) + self.assertIn([0,81,0,63],queries) + self.assertIn([2**26,4032,-2**26,63],queries) + + def test_climate_codec_fields_and_float_rounding_edges(self): + fixtures=list(biome.codec_corpus({'horizon:test':'{"has_precipitation":false,"temperature":0,"downfall":1}'})) + self.assertEqual(fixtures,list(biome.codec_corpus({'horizon:test':'{"has_precipitation":false,"temperature":0,"downfall":1}'}))) + decoded=[json.loads(f['json']) for f in fixtures] + self.assertIn({'has_precipitation':True,'temperature':0.5,'downfall':0.5},decoded) + self.assertIn({'has_precipitation':True,'temperature':0.5,'downfall':0.5,'temperature_modifier':None},decoded) + self.assertTrue(any('1.000000059604644775390626' in f['json'] for f in fixtures)) + self.assertTrue(any('1e1000' in f['json'] for f in fixtures)) + self.assertTrue(any('"temperature":0.2,"temperature":null' in f['json'] for f in fixtures)) + + +if __name__=='__main__':unittest.main() diff --git a/tests/test_biome_zoom_parity.py b/tests/test_biome_zoom_parity.py new file mode 100644 index 000000000..9f792d79a --- /dev/null +++ b/tests/test_biome_zoom_parity.py @@ -0,0 +1,20 @@ +import unittest +from tools import test_biome_zoom_parity as zoom + + +class BiomeZoomCorpusTests(unittest.TestCase): + def test_seed_coordinate_and_double_boundary_coverage(self): + fixtures = list(zoom.corpus()) + self.assertEqual(fixtures, list(zoom.corpus())) + self.assertEqual({f[0] for f in fixtures}, {'s', 'b', 'p'}) + self.assertIn('s -9223372036854775808', fixtures) + self.assertIn('s 9223372036854775807', fixtures) + self.assertIn('b 0 -2147483648 0 2147483647', fixtures) + self.assertIn('b 1 -1 0 1', fixtures) + self.assertIn('p 7ff0000000000000 fff0000000000000 7ff8000000000000', fixtures) + self.assertIn('p 0000000000000001 8000000000000001 fff8000000000000', fixtures) + self.assertEqual(sum(f.startswith('s ') for f in fixtures), 4104) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_block_properties_parity.py b/tests/test_block_properties_parity.py new file mode 100644 index 000000000..9f1eacf3f --- /dev/null +++ b/tests/test_block_properties_parity.py @@ -0,0 +1,19 @@ +import unittest +from tools import test_block_properties_parity as properties + + +class BlockPropertiesCorpusTests(unittest.TestCase): + def test_cache_flags_empty_shapes_and_threshold_cases(self): + fixtures=list(properties.corpus()) + self.assertEqual(fixtures,list(properties.corpus())) + self.assertEqual({(f['on'],f['off'],f['cached']) for f in fixtures}, + {(a,b,c) for a in [False,True] for b in [False,True] for c in [False,True]}) + self.assertEqual({f['occludes'] for f in fixtures},{False,True}) + self.assertTrue(any(not f['shape'] for f in fixtures)) + self.assertTrue(any(len(f['shape'])>1 for f in fixtures)) + self.assertGreater(len(fixtures),8000) + for f in fixtures: + for box in f['shape']:self.assertEqual(len(box),6) + + +if __name__=='__main__':unittest.main() diff --git a/tests/test_block_state_codec_parity.py b/tests/test_block_state_codec_parity.py new file mode 100644 index 000000000..95777bc37 --- /dev/null +++ b/tests/test_block_state_codec_parity.py @@ -0,0 +1,19 @@ +import json +import unittest +from tools import test_block_state_codec_parity as block + + +class BlockStateCodecCorpusTests(unittest.TestCase): + def test_modes_property_defaults_and_integer_boundaries(self): + facts={'states':[{'id':'minecraft:stone'},{'id':'minecraft:water','properties':{'level':'0'}}], 'defaults':{'minecraft:stone':0,'minecraft:water':1},'integers':[['minecraft:water','level']]} + fixtures=list(block.corpus(facts)) + self.assertEqual(fixtures,list(block.corpus(facts))) + self.assertEqual({f[0] for f in fixtures},{False,True}) + values=[json.loads(f[1]) for f in fixtures] + for value in ['+01','-2147483649','\u0660\u0661','\uff10\uff11','\U0001d7d9']: + self.assertIn({'id':'minecraft:water','properties':{'level':value}},values) + self.assertIn({'id':'minecraft:stone','properties':False},values) + self.assertTrue(any('"level":"0","level":"1"' in f[1] for f in fixtures)) + + +if __name__=='__main__':unittest.main() diff --git a/tests/test_block_survival_parity.py b/tests/test_block_survival_parity.py new file mode 100644 index 000000000..13bd63b01 --- /dev/null +++ b/tests/test_block_survival_parity.py @@ -0,0 +1,72 @@ +import unittest +import tempfile +from pathlib import Path +from tools import test_block_survival_parity as survival + + +class SurvivalCheckpointTests(unittest.TestCase): + def test_resume_rejects_changed_sources_environment_inputs_and_executables(self): + with tempfile.TemporaryDirectory() as directory: + root=Path(directory);fixture=root/'fixture';binary=root/'binary';path=root/'checkpoint.json' + fixture.write_bytes(b'original input');binary.write_bytes(b'original executable') + sources={'source.rs':'original'};environment={'java':'pinned'} + checkpoint={'schema':1,'sources_sha256':sources,'environment':environment,'fixtures_sha256':{str(fixture):survival.lab.digest(fixture,'sha256')},'artifacts_sha256':{str(binary):survival.lab.digest(binary,'sha256')}} + survival.save_checkpoint(path,checkpoint) + self.assertEqual(survival.load_checkpoint(path,sources,environment),checkpoint) + for changed_sources,changed_environment in [({'source.rs':'edited'},environment),(sources,{'java':'different'})]: + with self.assertRaises(ValueError):survival.load_checkpoint(path,changed_sources,changed_environment) + for artifact in [fixture,binary]: + original=artifact.read_bytes();artifact.write_bytes(b'changed') + with self.assertRaises(ValueError):survival.load_checkpoint(path,sources,environment) + artifact.unlink() + with self.assertRaises(ValueError):survival.load_checkpoint(path,sources,environment) + artifact.write_bytes(original) + self.assertEqual(survival.load_checkpoint(path,sources,environment),checkpoint) + + +class BlockSurvivalCorpusTests(unittest.TestCase): + def test_definition_dispatch_preserves_virtual_support_methods(self): + classes = {'a': 'VegetationBlock', 'b': 'VegetationBlock', 'c': 'VegetationBlock', 'd': 'DoublePlantBlock', 'e': 'DoublePlantBlock'} + placement = {'a': 'VegetationBlock', 'b': 'StemBlock', 'c': 'UnknownVegetationBlock', 'd': 'VegetationBlock', 'e': 'UnknownPlantBlock'} + tags = {'b': {'stemSupportBlocks': 'minecraft:supports_melon_stem', 'fruitSupportBlocks': 'minecraft:wrong_for_survival'}} + rules = survival.bind_definitions(classes, placement, tags) + self.assertEqual(rules, {'a': 'TagBelow:minecraft:supports_vegetation', 'b': 'TagBelow:minecraft:supports_melon_stem', 'd': 'DoublePlant'}) + with self.assertRaises(KeyError): + survival.bind_definitions(classes, placement, {}) + + def test_branching_neighbor_sequences_and_candidate_properties(self): + names=['air','stone','end_stone','chorus_plant','chorus_flower','scaffolding','bell','pitcher_crop'] + states=[{'id':'minecraft:'+name,'properties':{}} for name in names] + states += [dict(states[-2],properties={'attachment':'ceiling','facing':'north'}),dict(states[-1],properties={'half':'upper'})] + facts={'states':states,'defaults':{'minecraft:'+name:index for index,name in enumerate(names)}} + definitions={states[i]['id']:rule for i,rule in [(3,'ChorusPlant'),(4,'ChorusFlower'),(5,'Scaffolding'),(6,'Bell'),(7,'PitcherCrop')]} + seen=set();long_failures=set();brightness=set();upper_brightness=set() + for fixture in survival.corpus(facts,definitions): + seen.add(fixture['state']) + if len(fixture['neighbors'])==10:long_failures.add(fixture['fail']) + if 'brightness' in fixture: + brightness.add(fixture['brightness']) + if fixture['state']==9:upper_brightness.add(fixture['brightness']) + self.assertEqual(seen,{3,4,5,6,7,8,9}) + self.assertEqual(long_failures,{-1,*range(10)}) + self.assertTrue({7,8,9}.issubset(brightness)) + self.assertEqual(upper_brightness,brightness) + + def test_supported_candidates_and_query_transitions(self): + names = ['minecraft:air', 'minecraft:stone', 'minecraft:shulker_box', 'minecraft:moving_piston', 'minecraft:pale_moss_carpet', 'minecraft:unsupported'] + facts = {'states': [{'id': name, 'properties': {'bottom': 'true'}} for name in names], 'defaults': dict(zip(names, range(len(names))))} + definitions = {names[0]: 'Always', names[1]: 'RigidOrCenterBelow', names[4]: 'MossCarpet'} + fixtures = list(survival.corpus(facts, definitions)) + self.assertEqual(fixtures, list(survival.corpus(facts, definitions))) + self.assertEqual({f['state'] for f in fixtures}, {0, 1, 4}) + self.assertEqual(len([f for f in fixtures if f['state'] == 0]), 1) + self.assertTrue(any(f['neighbors'] == [2, 3] for f in fixtures)) + self.assertTrue(any(f['fail'] == 1 and f['entity_fail'] == 0 for f in fixtures)) + self.assertEqual({f['entity'] for f in fixtures}, {'none', 'closed', 'opened'}) + self.assertTrue(any(-2147483648 in f['position'] for f in fixtures)) + for candidate in [1, 4]: + self.assertTrue(all(any(f['state'] == candidate and f['neighbors'] == [neighbor] and f['fail'] == -1 for f in fixtures) for neighbor in range(len(names)))) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_bulk_section_parity.py b/tests/test_bulk_section_parity.py new file mode 100644 index 000000000..6ef998d36 --- /dev/null +++ b/tests/test_bulk_section_parity.py @@ -0,0 +1,22 @@ +import unittest +from tools import test_bulk_section_parity as bulk + + +class BulkSectionCorpusTests(unittest.TestCase): + def test_all_state_cycles_cache_aliases_and_vertical_bounds(self): + facts = {'states': list(range(5)), 'defaults': {'minecraft:air': 0, 'minecraft:cave_air': 1, 'minecraft:void_air': 2, 'minecraft:stone': 3, 'minecraft:water': 4}} + fixtures = list(bulk.corpus(facts)) + self.assertEqual(fixtures, list(bulk.corpus(facts))) + self.assertEqual({f['min'] for f in fixtures}, {-2032, -64, 0, 1968}) + self.assertEqual({f['prime'] for f in fixtures}, {False, True}) + self.assertTrue(all([4194304, 0] in f['chunks'] for f in fixtures)) + self.assertTrue(all(['reset'] in f['ops'] for f in fixtures)) + for f in fixtures: + self.assertTrue(any(op[:2] == ['get', 67108864] for op in f['ops'])) + if f['min'] == -64: + inserted = {op[4] for op in f['ops'] if op[:4] == ['set', 0, -63, 0]} + self.assertEqual(inserted, set(range(5))) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_canyon_carver_parity.py b/tests/test_canyon_carver_parity.py new file mode 100644 index 000000000..0ae46fe16 --- /dev/null +++ b/tests/test_canyon_carver_parity.py @@ -0,0 +1,20 @@ +import json +import unittest +from tools import test_canyon_carver_parity as canyon + + +class CanyonCarverCorpusTests(unittest.TestCase): + def test_heights_custom_widths_and_failures(self): + config={'type':'minecraft:canyon','probability':0.01,'y':{'absolute':40},'vertical_rotation':0,'shape':{'width_smoothness':3,'distance_factor':1,'thickness':3,'horizontal_radius_factor':1,'vertical_radius_default_factor':1,'vertical_radius_center_factor':0,'y_scale':3}} + fixtures=list(canyon.corpus({'canyon':json.dumps(config)})) + self.assertEqual(fixtures,list(canyon.corpus({'canyon':json.dumps(config)}))) + self.assertEqual({f['context'][1] for f in fixtures},{16,128,384,4064}) + self.assertEqual({f['fail'] for f in fixtures},{-1,0,1,63}) + self.assertTrue(any(f['target']==[-2**31,2**31-1] for f in fixtures)) + definitions=[json.loads(f['definition']) for f in fixtures] + shapes=[d['shape'] for d in definitions if isinstance(d,dict) and isinstance(d.get('shape'),dict)] + self.assertTrue(any(s.get('width_smoothness')==2**31-1 for s in shapes)) + self.assertTrue(any(s.get('distance_factor')==0 for s in shapes)) + + +if __name__=='__main__':unittest.main() diff --git a/tests/test_carving_geometry_parity.py b/tests/test_carving_geometry_parity.py new file mode 100644 index 000000000..649a50f6c --- /dev/null +++ b/tests/test_carving_geometry_parity.py @@ -0,0 +1,22 @@ +import unittest +from tools import test_carving_geometry_parity as geometry + + +class CarvingGeometryCorpusTests(unittest.TestCase): + def test_shape_boundaries_ieee_values_and_output_failures(self): + fixtures = list(geometry.corpus()) + self.assertEqual(fixtures, list(geometry.corpus())) + self.assertEqual(len(fixtures), 15) + shapes = [e for f in fixtures for e in f['ellipsoids']] + self.assertEqual(len(shapes), 690) + self.assertEqual({e['skip'] for e in shapes}, {0, 1, 2, 3}) + self.assertEqual({e['fail'] for e in shapes}, {-1, 0, 1, 63}) + self.assertIn(geometry.bits(float('nan')), {e['horizontal'] for e in shapes}) + self.assertIn(geometry.bits(-0.), {e['vertical'] for e in shapes}) + reach = list(geometry.reach_corpus()) + self.assertEqual(reach, list(geometry.reach_corpus())) + self.assertTrue(any(q[4] == -2**31 and q[5] == 2**31 - 1 for q in reach)) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_carving_mask_parity.py b/tests/test_carving_mask_parity.py new file mode 100644 index 000000000..29c19168e --- /dev/null +++ b/tests/test_carving_mask_parity.py @@ -0,0 +1,20 @@ +import unittest +from tools import test_carving_mask_parity as carving + + +class CarvingMaskCorpusTests(unittest.TestCase): + def test_sparse_dense_wrap_and_mutating_traversal_coverage(self): + fixtures = list(carving.corpus()) + self.assertEqual(fixtures, list(carving.corpus())) + self.assertTrue(any(f['max'] - f['min'] + 1 == 4064 for f in fixtures)) + self.assertTrue(any(f['min'] == -2**31 for f in fixtures)) + self.assertTrue(any(f['max'] == 2**31 - 1 for f in fixtures)) + ops = [op for f in fixtures for op in f['ops']] + self.assertEqual({op['kind'] for op in ops}, {'carve', 'fill', 'visit', 'read'}) + self.assertTrue(any(op.get('fail') == 0 and op.get('add') for op in ops)) + self.assertTrue(any(op.get('fail') == 63 for op in ops)) + self.assertTrue(any(op.get('pos', [0])[0] == -2**31 for op in ops)) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_cave_carver_parity.py b/tests/test_cave_carver_parity.py new file mode 100644 index 000000000..1f25f850b --- /dev/null +++ b/tests/test_cave_carver_parity.py @@ -0,0 +1,21 @@ +import json +import unittest +from tools import test_cave_carver_parity as cave + + +class CaveCarverCorpusTests(unittest.TestCase): + def test_seeds_origin_neighborhoods_and_partial_failures(self): + config={'type':'minecraft:cave','count':0,'probability':0.15,'thickness':1,'y':{'absolute':40},'floor_level':-0.7} + resources={'cave':json.dumps(config),'nether_cave':json.dumps(config)} + fixtures=list(cave.corpus(resources)) + self.assertEqual(fixtures,list(cave.corpus(resources))) + self.assertEqual({f['legacy'] for f in fixtures},{False,True}) + self.assertEqual({f['fail'] for f in fixtures},{-1,0,1,63}) + self.assertTrue(any(f['target']==[-2**31,2**31-1] for f in fixtures)) + self.assertTrue(any(f['origin']==[8,-8] for f in fixtures)) + self.assertTrue(any(f['repeats']==2 for f in fixtures)) + definitions=[json.loads(f['definition']) for f in fixtures] + self.assertTrue(any(isinstance(v,dict) and v.get('thickness')==6 for v in definitions)) + + +if __name__=='__main__':unittest.main() diff --git a/tests/test_chunk_stage_parity.py b/tests/test_chunk_stage_parity.py new file mode 100644 index 000000000..20bd88cbf --- /dev/null +++ b/tests/test_chunk_stage_parity.py @@ -0,0 +1,22 @@ +import unittest +from tools import test_chunk_stage_parity as stages + + +class ChunkStageCorpusTests(unittest.TestCase): + def test_all_stages_state_writes_and_reverse_transitions(self): + names = ['air', 'cave_air', 'void_air', 'stone', 'water', 'lava', 'oak_leaves', 'oak_slab', 'seagrass', 'snow', 'powder_snow', 'glass', 'barrier'] + facts = {'states': names, 'defaults': {'minecraft:' + name: i for i, name in enumerate(names)}} + fixtures = list(stages.corpus(facts)) + self.assertEqual(fixtures, list(stages.corpus(facts))) + expected = {'empty', 'structure_starts', 'structure_references', 'biomes', 'terrain', 'features'} + self.assertEqual({op[1] for f in fixtures for op in f['ops'] if op[0] == 'stage'}, expected) + for f in fixtures[:2]: + self.assertEqual({op[4] for op in f['ops'] if op[0] == 'set'}, set(range(len(names)))) + self.assertTrue(any(f['height'] == 4064 for f in fixtures)) + self.assertTrue(any(op[0] == 'set' and op[2] < f['min'] for f in fixtures for op in f['ops'])) + self.assertTrue(any(op[0] == 'set' and op[2] >= f['min'] + f['height'] for f in fixtures for op in f['ops'])) + self.assertTrue(any([op[1] for op in f['ops'] if op[0] == 'stage'][-1] == 'empty' for f in fixtures[2:])) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_decoration_parity.py b/tests/test_decoration_parity.py new file mode 100644 index 000000000..ee73d3ec3 --- /dev/null +++ b/tests/test_decoration_parity.py @@ -0,0 +1,22 @@ +import unittest +from tools import test_decoration_parity as decoration + + +class DecorationCorpusTests(unittest.TestCase): + def test_global_indices_foreign_palettes_failures_and_reproducibility(self): + resources = {'a': [[], ['horizon:a', 'horizon:b']], 'b': [['horizon:c'], ['horizon:b']]} + fixtures = list(decoration.corpus(resources)) + self.assertEqual(fixtures, list(decoration.corpus(resources))) + self.assertTrue(any(f['biomes'] == [[[0, 1]], [[1, 0]]] for f in fixtures)) + self.assertTrue(any(len(b) > 12 for f in fixtures for b in f['biomes'])) + self.assertTrue(any(f['palettes'][:8] == [[3]] * 8 and f['palettes'][8] == [1] for f in fixtures)) + for key in ['feature_fail', 'query_fail', 'chunk_fail', 'notify_fail']: + self.assertTrue(any(f[key] >= 0 for f in fixtures)) + for f in fixtures: + self.assertEqual(len(f['palettes']), 9) + self.assertTrue(all(0 <= b <= len(f['biomes']) for p in f['palettes'] for b in p)) + self.assertTrue(all(0 <= feature < len(f['placements']) for b in f['biomes'] for step in b for feature in step)) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_decoration_region_parity.py b/tests/test_decoration_region_parity.py new file mode 100644 index 000000000..395bb2d9e --- /dev/null +++ b/tests/test_decoration_region_parity.py @@ -0,0 +1,22 @@ +import unittest +from tools import test_decoration_region_parity as region + + +class DecorationRegionCorpusTests(unittest.TestCase): + def test_real_features_mixed_biomes_live_heights_and_partial_writes(self): + fixtures = list(region.corpus({})) + self.assertEqual(fixtures, list(region.corpus({}))) + self.assertEqual(len(fixtures), 240) + self.assertEqual({f['stage'] for f in fixtures}, {'empty', 'biomes', 'terrain'}) + self.assertEqual({f['write_fail'] for f in fixtures}, {-1, 7}) + self.assertTrue(any(f['palettes'] == [[0]] * 9 for f in fixtures)) + self.assertTrue(any(3 in p for f in fixtures for p in f['palettes'])) + for f in fixtures: + self.assertEqual(len(f['features']), 6) + self.assertEqual(len(f['placements']), len(f['features'])) + self.assertTrue(all(any(m['type'] == 'biome' for m in p) for p in f['placements'])) + self.assertTrue(all(0 <= feature < len(f['features']) for biome in f['biomes'] for step in biome for feature in step)) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_density_parity.py b/tests/test_density_parity.py new file mode 100644 index 000000000..7b5a3824f --- /dev/null +++ b/tests/test_density_parity.py @@ -0,0 +1,254 @@ +from collections import Counter +from pathlib import Path +import tempfile +import unittest +from unittest import mock + +from tools import test_density_parity as parity + + +class DensityRunnerTests(unittest.TestCase): + def test_failed_reference_verification_removes_previous_success(self): + with tempfile.TemporaryDirectory() as temp: + report = Path(temp) / "rust-density-parity/report.json" + report.parent.mkdir() + report.write_text('{"previous_success":true}') + with mock.patch.object(parity.lab, "LOCAL", Path(temp)), mock.patch("sys.argv", ["parity"]), \ + mock.patch.object(parity.test_rust_parity, "verify_artifacts", side_effect=ValueError("corrupt artifact")): + with self.assertRaisesRegex(ValueError, "corrupt artifact"): + parity.main() + self.assertFalse(report.exists()) + + def test_corpus_replays_valid_graph_references_and_edge_cases(self): + commands = list(parity.corpus()) + self.assertEqual(commands, list(parity.corpus())) + counts = Counter(line.split()[0] for line in commands) + self.assertEqual(counts["gradient"], 2041) + self.assertEqual(counts["shift"], 1200) + self.assertGreater(counts["query"], 140000) + self.assertEqual(counts["bounds"], 41176) + self.assertEqual(counts["offset"], 816) + self.assertEqual(counts["blended"], 192) + self.assertEqual(counts["blendfail"], 10) + self.assertEqual(counts["blendfbm"], 256) + self.assertEqual(counts["counted"], 3120) + self.assertEqual(counts["context"], 34805) + self.assertEqual(counts["lookup"], 10000) + self.assertEqual(counts["slice"], 384) + self.assertEqual(counts["interpolate"], 384) + self.assertEqual(counts["surface"], 384) + self.assertEqual(counts["sppoints"], 768) + self.assertEqual(counts["spconstant"], 78) + self.assertEqual(counts["spsampler"] + counts["spfail"], 334) + self.assertGreaterEqual(counts["spfail"], 2) + self.assertEqual(counts["sprange"], 13536) + self.assertEqual(counts["greset"], 368) + self.assertEqual(counts["gcompile"], 18282) + self.assertEqual(counts["power"], 1456) + self.assertEqual(counts["gpow"], 1552) + self.assertEqual(counts["round"], 1576) + self.assertEqual(counts["ground"], 880) + self.assertEqual(counts["gsconstant"], 1120) + self.assertEqual(counts["gspoints"], 1456) + self.assertEqual(counts["gspline"], 2160) + self.assertEqual(counts["gseed"], 70) + self.assertEqual(counts["gready"], 70) + self.assertEqual(counts["gregister"], 326) + self.assertEqual(counts["gnoise"], 838) + self.assertEqual(counts["goffset"], 262) + self.assertEqual(counts["gblended"], 64) + self.assertEqual(counts["gend"], 128) + self.assertEqual(counts["gref"], 288) + self.assertEqual(counts["gnamed"], 224) + self.assertEqual(counts["glookup"], 64) + self.assertEqual(counts["wfield"], 96) + self.assertEqual(counts["blenddensity"], 96) + self.assertEqual(counts["gwfield"], 96) + self.assertEqual(counts["gblenddensity"], 176) + self.assertEqual(counts["wcontext"], 20416) + self.assertEqual(counts["ginstance"], 640) + self.assertEqual(counts["ginterval"], 1024) + self.assertEqual(counts["gdistance"], 128) + self.assertEqual({line.split()[1] for line in commands if line.startswith("bounds ")}, set("012345")) + samplers = noises = splines = graph_nodes = graph_splines = graph_noises = 0 + tilings = set() + noise_modes = set() + shift_modes = set() + graph_ready = False + named_functions = set() + for command in commands: + fields = command.split() + if fields[0] in ["greset", "gseed"]: + graph_nodes = 0 + graph_splines = 0 + graph_noises = 0 + graph_ready = False + named_functions.clear() + elif fields[0] in ["gref", "gnamed", "glookup"]: + if fields[0] == "gnamed": + self.assertNotIn(fields[1], named_functions) + self.assertLess(int(fields[2]), graph_nodes) + named_functions.add(fields[1]) + elif fields[0] == "glookup": + self.assertIn(fields[1], named_functions) + else: + self.assertLess(int(fields[1]), graph_nodes) + graph_nodes += 1 + elif fields[0] == "gregister": + self.assertFalse(graph_ready) + self.assertIn(":", fields[1]) + self.assertEqual(len(fields), 7 + int(fields[6])) + graph_noises += 1 + elif fields[0] == "gready": + self.assertFalse(graph_ready) + self.assertGreater(graph_noises, 0) + graph_ready = True + elif fields[0] == "ginstance": + self.assertTrue(graph_ready) + self.assertLess(int(fields[1]), graph_noises) + elif fields[0] == "gnoise": + self.assertTrue(graph_ready) + self.assertLess(int(fields[1]), graph_noises) + for reference in map(int,fields[4:7]): + self.assertLess(reference, graph_nodes) + graph_nodes += 1 + elif fields[0] == "goffset": + self.assertLess(int(fields[1]), graph_noises) + self.assertIn(fields[2], ["0", "1", "2"]) + graph_nodes += 1 + elif fields[0] == "gsconstant": + graph_splines += 1 + elif fields[0] == "gspoints": + self.assertLess(int(fields[1]), graph_nodes) + count = int(fields[2]) + self.assertEqual(len(fields), 3 + 3*count) + for reference in map(int, fields[5::3]): + self.assertLess(reference, graph_splines) + graph_splines += 1 + elif fields[0] == "gspline": + self.assertLess(int(fields[1]), graph_splines) + graph_nodes += 1 + elif fields[0] == "gbind": + self.assertLess(int(fields[1]), samplers) + graph_nodes += 1 + elif fields[0] in ["gconst", "ggradient", "gdistance", "gblended", "gend", "gwfield"]: + graph_nodes += 1 + elif fields[0] == "ginterval": + count = int(fields[2]) + self.assertEqual(len(fields), 4 + 2*count) + for reference in map(int, fields[1:2] + fields[3+count:]): + self.assertLess(reference,graph_nodes) + graph_nodes += 1 + elif fields[0] in ["gunary", "gbinary", "ground", "gpow", "gclamp", "gchoice", "glerp", "gslice", "gcache", "ginterp", "gsurface", "gblenddensity"]: + references = { + "gunary": fields[2:3], "gbinary": fields[2:4], "ground": fields[2:4], "gpow": fields[1:3], "gclamp": fields[1:2], + "gchoice": fields[1:2] + fields[4:6], "glerp": fields[1:4], "gslice": fields[3:4], + "gcache": fields[1:2], "gblenddensity": fields[1:2], "ginterp": fields[1:2], "gsurface": fields[1:3], + }[fields[0]] + for reference in map(int,references): + self.assertLess(reference,graph_nodes) + graph_nodes += 1 + elif fields[0] in ["gcompile", "gtry"]: + self.assertLess(int(fields[2]),graph_nodes) + elif fields[0] in ["ginfo", "gsame"]: + for reference in map(int,fields[1:]): + self.assertLess(reference,graph_nodes) + elif fields[0] in ["cache", "counted"]: + self.assertLess(int(fields[-1]), samplers) + elif fields[0] == "spconstant": + splines += 1 + elif fields[0] == "sppoints": + self.assertLess(int(fields[1]), samplers) + self.assertEqual(len(fields), 3 + int(fields[2])*3) + for reference in map(int, fields[5::3]): + self.assertLess(reference, splines) + splines += 1 + elif fields[0] in ["spsampler", "spfail", "sprange"]: + self.assertLess(int(fields[1]), splines) + elif fields[0] == "surface": + for reference in map(int, fields[2:4]): + self.assertLess(reference, samplers) + self.assertGreater(int(fields[5]), 0) + elif fields[0] == "interpolate": + self.assertLess(int(fields[1]), samplers) + self.assertGreater(int(fields[2]), 0) + self.assertGreater(int(fields[3]), 0) + elif fields[0] == "slice": + self.assertIn(fields[1], list("0123")) + self.assertLess(int(fields[2]), samplers) + elif fields[0] == "offset": + self.assertIn(fields[1], ["0", "1", "2"]) + self.assertLess(int(fields[2]), noises) + elif fields[0] == "interval": + count = int(fields[3]) + references = [fields[2]] + fields[4+count:] + self.assertEqual(len(references), count + 2) + if fields[1] == "1": + self.assertEqual(count, 1) + for reference in map(int, references): + self.assertGreaterEqual(reference, 0) + self.assertLess(reference, samplers) + elif fields[0] in ["choice", "lerp"]: + mode = int(fields[1]) + references = [fields[2]] + if fields[0] == "choice" and mode == 0: + references += fields[5:7] + elif fields[0] == "lerp": + if mode != 1: + references.append(fields[3]) + if mode != 2: + references.append(fields[4]) + for reference in map(int, references): + self.assertGreaterEqual(reference, 0) + self.assertLess(reference, samplers) + elif fields[0] == "wcontext": + self.assertIn(fields[1], ["0", "1"]) + self.assertIn(fields[5], ["0", "1"]) + for reference in map(int,fields[2:5]): + self.assertGreaterEqual(reference, -1) + self.assertLess(reference, samplers) + elif fields[0] == "wfield": + self.assertIn(fields[1], ["0", "1", "2"]) + self.assertGreaterEqual(int(fields[2]), -1) + self.assertLess(int(fields[2]), samplers) + elif fields[0] == "blenddensity": + self.assertLess(int(fields[1]), samplers) + elif fields[0] == "round": + self.assertIn(fields[1], ["0", "1", "2", "3"]) + self.assertGreaterEqual(int(fields[2]), 0) + self.assertLess(int(fields[2]), samplers) + self.assertGreaterEqual(int(fields[3]), -1) + self.assertLess(int(fields[3]), samplers) + elif fields[0] == "power": + self.assertIn(fields[1], ["0", "1", "2"]) + references = fields[2:4] if fields[1] == "0" else fields[3:4] if fields[1] == "1" else fields[2:3] + for reference in map(int,references): + self.assertGreaterEqual(reference, 0) + self.assertLess(reference, samplers) + elif fields[0] in ["unary", "binary"]: + references = fields[2:3] if fields[0] == "unary" else fields[2:4] + for reference in map(int, references): + self.assertGreaterEqual(reference, 0) + self.assertLess(reference, samplers) + elif fields[0] == "shift": + self.assertLess(int(fields[1]), noises) + for reference in map(int, fields[2:]): + self.assertGreaterEqual(reference, -1) + self.assertLess(reference, samplers) + shift_modes.add(int(fields[3]) >= 0) + elif fields[0] == "noise": + noise_modes.add(tuple(fields[1:3])) + noises += 1 + elif fields[0] == "gradient": + tilings.add(tuple(fields[1:3])) + elif fields[0] in ["volume", "query"]: + self.assertLess(int(fields[1]), samplers) + if fields[0] in ["constant", "gradient", "noise", "shift", "unary", "binary", "round", "power", "choice", "lerp", "interval", "offset", "blended", "distance", "cache", "counted", "slice", "interpolate", "surface", "spsampler", "gcompile", "wfield", "blenddensity"]: + samplers += 1 + self.assertEqual(shift_modes, {False, True}) + self.assertEqual(tilings, {(str(axis), str(mode)) for axis in range(3) for mode in range(3)}) + self.assertEqual(noise_modes, {(kind, stream) for kind in ["perlin", "simplex", "smeared", "normal"] for stream in ["legacy", "xoroshiro"]}) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_dynamic_support_parity.py b/tests/test_dynamic_support_parity.py new file mode 100644 index 000000000..6fb189c33 --- /dev/null +++ b/tests/test_dynamic_support_parity.py @@ -0,0 +1,31 @@ +import unittest +from tools import test_dynamic_support_parity as support + + +class DynamicSupportCorpusTests(unittest.TestCase): + def test_entity_states_coordinate_boundaries_and_failures(self): + facts={'states':[{'id':name} for name in ['minecraft:bamboo','minecraft:shulker_box','minecraft:moving_piston','minecraft:stone']], 'defaults':{'minecraft:stone':3}} + fixtures=list(support.corpus(facts,[0,1,2])) + self.assertEqual(fixtures,list(support.corpus(facts,[0,1,2]))) + self.assertEqual({f['entity'] for f in fixtures if f['state']==0},{'none'}) + self.assertEqual({f['entity'] for f in fixtures if f['state']==1},{'none','other','closed','opening','opened','closing'}) + self.assertEqual({f['entity'] for f in fixtures if f['state']==2},{'none','other','piston'}) + self.assertEqual({f['fail'] for f in fixtures},{-1,0,1,5,18}) + self.assertTrue(any(2147483647 in f['position'] for f in fixtures)) + self.assertTrue(any(-2147483648 in f['position'] for f in fixtures)) + + + def test_collision_progress_corpus_preserves_support_cases(self): + facts={'states':[{'id':name} for name in ['minecraft:bamboo','minecraft:shulker_box']], 'defaults':{}} + original=list(support.corpus(facts,[0,1])) + fixtures=list(support.collision_corpus(facts,[0,1])) + self.assertEqual([f for f in fixtures if not f.get('collision')],original) + self.assertTrue(all(f.get('collision') for f in fixtures if 'shulker_progress' in f)) + progress={tuple(f['shulker_progress']) for f in fixtures if 'shulker_progress' in f} + self.assertIn(('00000000','3f800000'),progress) + self.assertIn(('3f800000','00000000'),progress) + self.assertIn(('80000000','00000001'),progress) + self.assertGreater(len(progress),2000) + + +if __name__=='__main__':unittest.main() diff --git a/tests/test_entity_obstruction_parity.py b/tests/test_entity_obstruction_parity.py new file mode 100644 index 000000000..6fb78d40b --- /dev/null +++ b/tests/test_entity_obstruction_parity.py @@ -0,0 +1,19 @@ +import unittest +from tools import test_entity_obstruction_parity as obstruction + + +class EntityObstructionCorpusTests(unittest.TestCase): + def test_shapes_flags_vehicle_chains_and_world_failures(self): + fixtures=list(obstruction.corpus()) + self.assertEqual(fixtures,list(obstruction.corpus())) + self.assertTrue(any(not f['shape'] and f['fail'] for f in fixtures)) + self.assertTrue(any(len(f['shape'])>1 for f in fixtures)) + self.assertTrue(any(f['exclude']>=0 for f in fixtures)) + flags={(e['building'],e['removed'],e['spectator']) for f in fixtures for e in f['entities']} + self.assertEqual(len(flags),8) + self.assertTrue(any(any(e['parent']>=0 for e in f['entities']) for f in fixtures)) + for f in fixtures: + for i,e in enumerate(f['entities']):self.assertTrue(-1<=e['parent']= 4 for chain in chains)) + fixtures = list(placement.corpus()) + self.assertEqual(len(fixtures), sum(36 if any(v.get("type") == "count_on_every_layer" for v in chain) else 72 for chain in chains)) + self.assertEqual({f['legacy'] for f in fixtures}, {False, True}) + self.assertEqual({f['fail'] for f in fixtures}, {-1, 0, 2, 5}) + self.assertEqual({f['result'] for f in fixtures}, {0, 1, 2}) + self.assertTrue(any(f['query_fail'] == 1 for f in fixtures)) + self.assertTrue(all(f['positions'][0] == f['positions'][1] for f in fixtures)) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_feature_region_parity.py b/tests/test_feature_region_parity.py new file mode 100644 index 000000000..ac5618dc7 --- /dev/null +++ b/tests/test_feature_region_parity.py @@ -0,0 +1,21 @@ +import unittest +from tools import test_feature_region_parity as regions + + +class FeatureRegionCorpusTests(unittest.TestCase): + def test_resident_mutation_contexts_and_failures(self): + fixtures = list(regions.corpus({})) + self.assertEqual(fixtures, list(regions.corpus({}))) + self.assertEqual({f['worldgen'] for f in fixtures}, {False, True}) + self.assertEqual({f['legacy'] for f in fixtures}, {False, True}) + self.assertEqual({f['stage'] for f in fixtures}, {'empty', 'terrain'}) + self.assertEqual({f['fail'] for f in fixtures}, {-1, 7}) + self.assertEqual({f['reject'] for f in fixtures}, {0, 3}) + self.assertTrue(all(f['features'][3]['type'] == 'sequence' for f in fixtures)) + self.assertEqual(len(fixtures[0]['features'][3]['features']), 4) + kinds = {m['type'] for f in fixtures for m in f['placement']} + self.assertTrue({'heightmap', 'count_on_every_layer', 'in_square'} <= kinds) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_feature_sort_parity.py b/tests/test_feature_sort_parity.py new file mode 100644 index 000000000..5457bbcb0 --- /dev/null +++ b/tests/test_feature_sort_parity.py @@ -0,0 +1,18 @@ +import unittest +from tools import test_feature_sort_parity as sort + + +class FeatureSortCorpusTests(unittest.TestCase): + def test_identity_duplicates_step_gaps_and_resource_orderings(self): + resources = {'a': [[], ['horizon:a', 'horizon:b']], 'b': [['horizon:c'], ['horizon:a']]} + fixtures = list(sort.corpus(resources)) + self.assertEqual(fixtures, list(sort.corpus(resources))) + self.assertTrue(any(f['biomes'] == [[[0, 1]], [[1, 0]]] for f in fixtures)) + self.assertTrue(any(f['biomes'] == [[[0, 0]], [[]]] for f in fixtures)) + self.assertTrue(any(f['biomes'] == [] for f in fixtures)) + self.assertTrue(any(f['biomes'] == [[], [[], [], []]] for f in fixtures)) + self.assertTrue(any(len(f['biomes']) == 2 and f['biomes'][0] == [[], [0, 1]] and f['biomes'][1] == [[2], [0]] for f in fixtures)) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_fill_layer_parity.py b/tests/test_fill_layer_parity.py new file mode 100644 index 000000000..e4988a300 --- /dev/null +++ b/tests/test_fill_layer_parity.py @@ -0,0 +1,20 @@ +import json +import unittest +from tools import test_fill_layer_parity as fill + + +class FillLayerCorpusTests(unittest.TestCase): + def test_exhaustive_states_and_column_failure_cases(self): + states = ['stone', {'id': 'oak_log', 'properties': {'axis': 'x'}}] + fixtures = list(fill.corpus({'states': states})) + decode = [f for f in fixtures if f['repeats'] == 0] + self.assertEqual([json.loads(f['definition'])['state'] for f in decode], states) + self.assertEqual({f['fail'] for f in fixtures}, {-1, 0, 1, 7, 63}) + self.assertEqual({f['legacy'] for f in fixtures}, {False, True}) + self.assertEqual({f['world_min'] for f in fixtures}, {-64, -2147483648, 2147483647}) + heights = {json.loads(f['definition'])['height'] for f in fixtures} + self.assertTrue({-1, 0, 4064, 4065, 4294967297}.issubset(heights)) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_float_log_parity.py b/tests/test_float_log_parity.py new file mode 100644 index 000000000..0024cea8e --- /dev/null +++ b/tests/test_float_log_parity.py @@ -0,0 +1,37 @@ +from pathlib import Path +import tempfile +import unittest +from unittest import mock + +from tools import test_float_log_parity as parity + + +class FloatLogRunnerTests(unittest.TestCase): + def test_binary_comparison_rejects_difference_and_truncated_equal_outputs(self): + with tempfile.TemporaryDirectory() as temp: + reference, candidate = Path(temp)/"java.bin", Path(temp)/"rust.bin" + reference.write_bytes(bytes.fromhex("000000003f800000")) + candidate.write_bytes(bytes.fromhex("000000003f800001")) + with self.assertRaisesRegex(ValueError, "float bits 3f800001"): + parity.compare(reference, candidate, 0x3f800000, 2) + candidate.write_bytes(reference.read_bytes()) + self.assertEqual(parity.compare(reference, candidate, 0x3f800000, 2), 2) + with self.assertRaisesRegex(ValueError, "does not cover 3 floats"): + parity.compare(reference, candidate, 0x3f800000, 3) + + def test_exhaustive_range_covers_all_float_bits(self): + self.assertEqual(parity.ranges(True), [(0, 1 << 32)]) + for start, count in parity.ranges(False): + self.assertGreaterEqual(start, 0) + self.assertLessEqual(start + count, 1 << 32) + + def test_failed_verification_removes_old_report(self): + with tempfile.TemporaryDirectory() as temp: + report = Path(temp)/"rust-float-log-parity/report.json" + report.parent.mkdir() + report.write_text('{"old_success":true}') + with mock.patch.object(parity.lab, "LOCAL", Path(temp)), mock.patch("sys.argv", ["parity"]), \ + mock.patch.object(parity.test_rust_parity, "verify_artifacts", side_effect=ValueError("corrupt artifact")): + with self.assertRaisesRegex(ValueError, "corrupt artifact"): + parity.main() + self.assertFalse(report.exists()) diff --git a/tests/test_fluid_parity.py b/tests/test_fluid_parity.py new file mode 100644 index 000000000..0721679e8 --- /dev/null +++ b/tests/test_fluid_parity.py @@ -0,0 +1,17 @@ +import unittest +from tools import test_fluid_parity as fluid + + +class FluidCorpusTests(unittest.TestCase): + def test_liquid_levels_grate_sources_and_query_failures(self): + facts={'states':[{'id':'minecraft:air'},{'id':'minecraft:water','properties':{'level':'0'}},{'id':'minecraft:water','properties':{'level':'8'}},{'id':'minecraft:lava','properties':{'level':'1'}},{'id':'minecraft:copper_grate','properties':{'waterlogged':'true'}},{'id':'minecraft:stone'}]} + fixtures=list(fluid.corpus(facts)) + self.assertEqual(fixtures,list(fluid.corpus(facts))) + self.assertEqual({v['state'] for v in fixtures},set(range(5))) + self.assertEqual({v['above'] for v in fixtures},set(range(5))) + self.assertEqual({v['sturdy'] for v in fixtures},{False,True}) + self.assertEqual({v['fail'] for v in fixtures},{-1,0,1,2}) + self.assertTrue(any(v['position'][1]==2147483647 for v in fixtures)) + + +if __name__=='__main__':unittest.main() diff --git a/tests/test_geometry_parity.py b/tests/test_geometry_parity.py new file mode 100644 index 000000000..783d188dd --- /dev/null +++ b/tests/test_geometry_parity.py @@ -0,0 +1,41 @@ +from pathlib import Path +import tempfile +import unittest +from unittest import mock + +from tools import test_geometry_parity as geometry +from tools import test_collision_parity as collision + + +class GeometryRunnerTests(unittest.TestCase): + def test_bad_artifacts_remove_old_success_reports(self): + for module, name in [(geometry, "rust-geometry-parity"), (collision, "rust-collision-parity")]: + with self.subTest(name=name), tempfile.TemporaryDirectory() as temp: + local = Path(temp) + report = local / name / "report.json" + report.parent.mkdir() + report.write_text('{"previous_success":true}') + with mock.patch.object(module.lab, "LOCAL", local), mock.patch("sys.argv", ["parity"]), \ + mock.patch.object(module.test_rust_parity, "verify_artifacts", side_effect=ValueError("corrupt artifact")): + with self.assertRaisesRegex(ValueError, "corrupt artifact"): + module.main() + self.assertFalse(report.exists()) + + def test_collision_counts_reject_missing_partial_and_inconsistent_coverage(self): + for output in ["", "HORIZON_COLLISION_RESULT {}", 'HORIZON_COLLISION_RESULT {"registry_states":35723,"cached_states":1,"uncached_states":1,"queries":6,"unique_shapes":1}']: + with self.subTest(output=output), self.assertRaises((AssertionError, KeyError)): + collision.counts(output) + + def test_geometry_inputs_are_repeatable_and_include_ieee_boundaries(self): + commands = list(geometry.corpus()) + self.assertEqual(commands, list(geometry.corpus())) + joined = "\n".join(commands) + for value in ["8000000000000000", "7ff0000000000000", "fff0000000000000", "7ff8000000000000", "0000000000000001"]: + self.assertIn(value, joined) + operations = {line.split()[0] for line in commands} + self.assertEqual(operations, {"vec", "box", "block-box", "grid", "query", "many", "motion", "step-motion", "trig-table", "rotation", "traverse", "join", "make-box", "optimize", "join-optimized", "block-iterate", "box-iterate", "sweep", "floor-height"}) + self.assertEqual({int(line.split()[-1]) for line in commands if line.startswith("join-optimized ")}, set(range(16))) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_height_provider_parity.py b/tests/test_height_provider_parity.py new file mode 100644 index 000000000..f9d28d594 --- /dev/null +++ b/tests/test_height_provider_parity.py @@ -0,0 +1,23 @@ +import json +import unittest +from tools import test_height_provider_parity as height + + +class HeightProviderCorpusTests(unittest.TestCase): + def test_anchor_variants_inner_plateaus_and_overflow_contexts(self): + definitions = list(height.definitions()) + self.assertEqual(definitions, list(height.definitions())) + values = [json.loads(raw) for raw in definitions] + objects = [v for v in values if isinstance(v, dict)] + self.assertTrue({'weighted_list', 'constant', 'uniform', 'biased_to_bottom', 'very_biased_to_bottom', 'trapezoid'} <= {v.get('type') for v in objects}) + self.assertTrue(any(v.get('absolute') == 5 and v.get('type') == 'uniform' for v in objects)) + self.assertTrue(any(v.get('inner') == 0 for v in objects)) + self.assertTrue(any(v.get('plateau') == -2**31 for v in objects)) + fixtures = list(height.corpus()) + self.assertEqual(len(fixtures), len(definitions) * 30) + self.assertEqual({f['legacy'] for f in fixtures}, {False, True}) + self.assertTrue(any(f['context'][0] == -2**31 for f in fixtures)) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_heightmap_parity.py b/tests/test_heightmap_parity.py new file mode 100644 index 000000000..70c8ffb3b --- /dev/null +++ b/tests/test_heightmap_parity.py @@ -0,0 +1,39 @@ +import unittest +from tools import test_heightmap_parity as heightmap + + +class HeightmapCorpusTests(unittest.TestCase): + def facts(self): + names=["air","cave_air","void_air","stone","water","lava","oak_leaves","oak_slab","seagrass","snow","powder_snow","glass","barrier"] + return {"states":[["minecraft:"+name,name.endswith("air"),name in ["water","lava"],name] for name in names], + "defaults":{"minecraft:"+name:i for i,name in enumerate(names)}} + + def test_every_state_is_inserted_queried_and_removed(self): + facts=self.facts();fixtures=list(heightmap.corpus(facts)) + self.assertEqual(fixtures,list(heightmap.corpus(facts))) + ops=fixtures[0]["ops"] + for i in range(len(facts["states"])): + self.assertEqual(ops[i*3],["set",4,5,7,i,63]) + self.assertEqual(ops[i*3+1],["query",4,7]) + self.assertEqual(ops[i*3+2],["set",4,5,7,facts["defaults"]["minecraft:air"],63]) + + def test_corpus_keeps_vertical_edges_raw_fallbacks_and_traces(self): + fixtures=list(heightmap.corpus(self.facts())) + self.assertIn((-2032,4064),{(f["min"],f["height"]) for f in fixtures}) + for f in fixtures: + self.assertEqual(f["min"]%16,0) + self.assertEqual(f["height"]%16,0) + self.assertGreaterEqual(f["min"],-2032) + self.assertLessEqual(f["min"]+f["height"],2032) + for op in f["ops"]: + if op[0]=="set":self.assertTrue(f["min"]<=op[2] f['min'] for f in fixtures)) + self.assertTrue(any(f['noise_min'] != f['min'] for f in fixtures)) + self.assertTrue(any(f['cx'] < 0 for f in fixtures)) + for f in fixtures: + self.assertLessEqual(f['min'], f['write_min']) + self.assertLess(f['write_max'], f['min'] + f['height']) + for x, low, z, high, state in f['initial']: + self.assertTrue(0 <= x < 16 and 0 <= z < 16) + self.assertTrue(f['min'] <= low <= high < f['min'] + f['height']) + self.assertIn(state, facts['defaults'].values()) + + def test_generated_chunks_use_each_setting_and_share_the_router_surface_root(self): + names = ['stone', 'water', 'air', 'cave_air', 'void_air', 'oak_log', + 'oak_leaves', 'netherrack', 'end_stone'] + facts = {'defaults': {'minecraft:' + name: i for i, name in enumerate(names)}} + settings = {'minecraft:overworld': json.dumps({ + 'noise': {'min_y': -64, 'height': 384}, 'sea_level': 63, + 'default_block': 'minecraft:stone', 'default_fluid': 'minecraft:water', + 'material_rule': 'minecraft:overworld', + 'noise_router': {'chunk_surface_level': {'type': 'constant', 'argument': 64}}, + 'aquifers': {'barrier': 0}})} + generated = [f for f in stage.corpus(facts, {'minecraft:plains': ''}, settings) if 'router' in f] + self.assertEqual(len(generated), 6) + self.assertEqual(sum(f['repeats'] for f in generated), 8) + self.assertEqual({f['legacy'] for f in generated}, {False, True}) + self.assertTrue(any(abs(f['cx']) > 1_000_000 for f in generated)) + for f in generated: + self.assertEqual(f['preliminary'], f['router']['chunk_surface_level']) + self.assertEqual(f['initial'], []) + self.assertEqual(f['aquifers'], {'barrier': 0}) + self.assertTrue(f['biome_zoom']) + + def test_carving_masks_have_disjoint_runs_and_surface_restoration_inputs(self): + names = ['grass_block', 'mycelium', 'dirt', 'bedrock'] + facts = {'defaults': {'minecraft:' + name: i for i, name in enumerate(names)}} + f = {'min': -64, 'height': 384, 'sea': 63} + result = stage.carving_fixture(f, facts) + self.assertEqual(result['filters'], [0, 1]) + self.assertEqual({q[3] for q in result['initial']}, set(range(4))) + runs = [q for q in result['spans'] if q[:2] == [6, 0]] + self.assertEqual(len(runs), 2) + self.assertLess(runs[1][3] + 1, runs[0][2]) + for x, z, low, high in result['spans']: + self.assertTrue(0 <= x <= 15 and 0 <= z <= 15) + self.assertTrue(-63 <= low <= high <= 312) + + def test_top_queries_cover_water_and_gradient_boundaries(self): + f = {'cx': -1, 'cz': 1875000, 'min': -64, 'height': 384, 'sea': 63} + queries = stage.top_queries(f) + self.assertEqual(len(queries), 96) + self.assertEqual({q[3] for q in queries}, {False, True}) + self.assertEqual({q[1] for q in queries}, {-65, -64, 62, 63, 319, 320}) + self.assertTrue(any(q[0] == -16 and q[2] == 30000000 for q in queries)) + self.assertTrue(any(q[0] == -1 and q[2] == 30000015 for q in queries)) + + def test_generated_neighborhood_uses_preset_possible_biomes(self): + names = ['stone', 'water', 'air', 'cave_air', 'void_air', 'oak_log', 'oak_leaves', 'netherrack', 'end_stone'] + facts = {'defaults': {'minecraft:' + name: i for i, name in enumerate(names)}} + setting = {'noise': {'min_y': 0, 'height': 128}, 'sea_level': 63, + 'default_block': 'minecraft:stone', 'default_fluid': 'minecraft:water', + 'material_rule': 'minecraft:end', 'noise_router': {'chunk_surface_level': 0}} + presets = {'minecraft:overworld': json.dumps([{'biome': 'minecraft:plains'}])} + fixtures = list(stage.corpus(facts, {'minecraft:plains': ''}, {'minecraft:end': json.dumps(setting)}, presets)) + generated = [f for f in fixtures if 'biome_source' in f] + self.assertEqual(len(generated), 6) + self.assertTrue(all(f['biome_source'] == 'end' for f in generated)) + for f in generated: + if f['legacy']: + self.assertEqual(len(f['possible']), 5) + self.assertIn('minecraft:small_end_islands', f['possible']) + else: + self.assertIsNone(f['possible']) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_material_surface_parity.py b/tests/test_material_surface_parity.py new file mode 100644 index 000000000..85665b25f --- /dev/null +++ b/tests/test_material_surface_parity.py @@ -0,0 +1,21 @@ +import unittest +from tools import test_material_surface_parity as material + + +class MaterialSurfaceCorpusTests(unittest.TestCase): + def test_seeded_band_stream_modes_and_boundary_overrides(self): + fixtures=list(material.corpus()) + self.assertEqual(fixtures,list(material.corpus())) + real=[f for f in fixtures if f["overrides"]==[None]*3] + self.assertEqual(len(real),128) + self.assertEqual({(f["legacy"],f["child"]) for f in real},{(False,False),(False,True),(True,False),(True,True)}) + self.assertEqual({f["consume"] for f in real},{-1,0,1,17}) + values={f["overrides"][0] for f in fixtures if f["overrides"][0] is not None} + self.assertTrue({"3dffffff","3e000000","3e000001","be000000","7f800000","ff800000","7fc00001"}<=values) + points=fixtures[0]["points"] + self.assertIn([7,-193,-11],points) + self.assertIn([7,-192,-11],points) + self.assertIn([-2**31,-2**31,2**31-1],points) + + +if __name__=="__main__":unittest.main() diff --git a/tests/test_noise_parity.py b/tests/test_noise_parity.py new file mode 100644 index 000000000..b40d807fb --- /dev/null +++ b/tests/test_noise_parity.py @@ -0,0 +1,43 @@ +from collections import Counter +from pathlib import Path +import tempfile +import unittest +from unittest import mock + +from tools import test_noise_parity as parity + + +class NoiseRunnerTests(unittest.TestCase): + def test_failed_reference_verification_removes_previous_success(self): + with tempfile.TemporaryDirectory() as temp: + report = Path(temp) / "rust-noise-parity/report.json" + report.parent.mkdir() + report.write_text('{"previous_success":true}') + with mock.patch.object(parity.lab, "LOCAL", Path(temp)), mock.patch("sys.argv", ["parity"]), \ + mock.patch.object(parity.test_rust_parity, "verify_artifacts", side_effect=ValueError("corrupt artifact")): + with self.assertRaisesRegex(ValueError, "corrupt artifact"): + parity.main() + self.assertFalse(report.exists()) + + def test_corpus_replays_both_streams_offsets_and_accumulation_modes(self): + commands = list(parity.corpus()) + self.assertEqual(commands, list(parity.corpus())) + counts = Counter(line.split()[0] for line in commands) + self.assertGreater(counts["query"], 190000) + self.assertEqual(counts["local"], 38400) + creates = [line.split() for line in commands if line.startswith("create ")] + self.assertEqual({(line[1], line[2], line[4]) for line in creates}, + {(kind, stream, skip) for stream in ["legacy", "xoroshiro"] + for kind, skip in [("perlin", "0"), ("simplex", "0"), ("simplex", "1"), ("smeared", "0")]}) + self.assertEqual({line.split()[-1] for line in commands if line.startswith("volume ")}, {"0", "1", "2", "3"}) + wrapped = {line.split()[1] for line in commands if line.startswith("wrap ")} + self.assertTrue({"8000000000000000", "7ff0000000000000", "fff0000000000000", "7ff8000000000000", "0000000000000001"} <= wrapped) + normal = [line.split() for line in commands if line.startswith("normal ")] + self.assertEqual({line[1] for line in normal}, {"legacy", "xoroshiro"}) + self.assertEqual({line[3] for line in normal}, {"0", "1", "2", "3"}) + self.assertEqual({line[6] for line in normal}, {"0", "1", "2"}) + self.assertIn("stack 0 ", commands) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_packs.py b/tests/test_packs.py index 9b2e80b1e..a4fcde8f0 100644 --- a/tests/test_packs.py +++ b/tests/test_packs.py @@ -10,18 +10,34 @@ from tools import build_pack, compare_benchmarks, runtime class PackTests(unittest.TestCase): + def test_rebrand_upgrade_retires_legacy_and_current_names(self): + with tempfile.TemporaryDirectory() as temp: + root = Path(temp) + mods = root / "instance/mods" + mods.mkdir(parents=True) + previous = [mods / "horizon-lab-0.20.0.jar", mods / "horizon-0.21.0.jar"] + for old in previous: + with zipfile.ZipFile(old, "w") as archive: + archive.writestr("fabric.mod.json", json.dumps({"id": "horizonlab"})) + new = root / "horizon-0.22.0.jar" + new.write_bytes(b"new original fixture") + runtime.install_original_mod(new, mods) + self.assertTrue(all(not old.exists() for old in previous)) + self.assertEqual(list(mods.iterdir()), [mods / new.name]) + self.assertEqual(len(list((mods.parent / ".horizon-mod-backups").glob("*.jar"))), 2) + def test_original_mod_upgrade_preserves_backup_and_other_mods(self): with tempfile.TemporaryDirectory() as temp: root = Path(temp) mods = root / "instance/mods" mods.mkdir(parents=True) - old = mods / "horizon-lab-0.2.0.jar" + old = mods / "horizon-0.2.0.jar" with zipfile.ZipFile(old, "w") as archive: archive.writestr("fabric.mod.json", json.dumps({"id": "horizonlab"})) old_bytes = old.read_bytes() other = mods / "other.jar" other.write_bytes(b"another mod") - new = root / "horizon-lab-0.3.0.jar" + new = root / "horizon-0.3.0.jar" new.write_bytes(b"new original fixture") runtime.install_original_mod(new, mods) self.assertFalse(old.exists()) @@ -34,9 +50,9 @@ class PackTests(unittest.TestCase): def test_original_mod_upgrade_refuses_unrelated_named_jar(self): with tempfile.TemporaryDirectory() as temp: root = Path(temp) - with zipfile.ZipFile(root / "horizon-lab-0.1.0.jar", "w") as archive: + with zipfile.ZipFile(root / "horizon-0.1.0.jar", "w") as archive: archive.writestr("fabric.mod.json", json.dumps({"id": "someoneelse"})) - new = root / "horizon-lab-0.3.0.jar" + new = root / "horizon-0.3.0.jar" new.write_bytes(b"new original fixture") with self.assertRaisesRegex(ValueError, "another mod"): runtime.install_original_mod(new, root) @@ -176,7 +192,7 @@ class PackTests(unittest.TestCase): with zipfile.ZipFile(pack) as archive: names = archive.namelist() self.assertEqual([n for n in names if n.endswith(".jar")], - [f"overrides/mods/horizon-lab-{build_pack.read_lock()['pack_version']}.jar"]) + [f"overrides/mods/horizon-{build_pack.read_lock()['pack_version']}.jar"]) index = json.loads(archive.read("modrinth.index.json")) self.assertEqual(index["dependencies"]["minecraft"], "26.3") options = dict(line.split(":", 1) for line in archive.read("overrides/options.txt").decode().splitlines()) diff --git a/tests/test_piston_shape_parity.py b/tests/test_piston_shape_parity.py new file mode 100644 index 000000000..b800e8c84 --- /dev/null +++ b/tests/test_piston_shape_parity.py @@ -0,0 +1,19 @@ +import unittest +from tools import test_piston_shape_parity as piston + + +class PistonShapeCorpusTests(unittest.TestCase): + def test_source_extension_thresholds_noclip_and_float_interpolation(self): + facts={'states':[{'id':name} for name in ['minecraft:stone','minecraft:piston','minecraft:shulker_box','minecraft:moving_piston']], 'defaults':{'minecraft:stone':0}} + fixtures=list(piston.corpus(facts)) + self.assertEqual(fixtures,list(piston.corpus(facts))) + self.assertEqual({f['noclip'] for f in fixtures},set(range(-1,6))) + self.assertEqual({f['direction'] for f in fixtures},set(range(6))) + self.assertEqual({(f['source'],f['extending']) for f in fixtures},{(s,e) for s in [False,True] for e in [False,True]}) + self.assertEqual(sum(f['kinematic'] for f in fixtures),10000) + self.assertTrue(any(f['fail']==0 for f in fixtures)) + for field in ['progress','previous','partial']: + self.assertTrue(all(len(f[field])==8 for f in fixtures)) + + +if __name__=='__main__':unittest.main() diff --git a/tests/test_placement_parity.py b/tests/test_placement_parity.py new file mode 100644 index 000000000..5b4d4412f --- /dev/null +++ b/tests/test_placement_parity.py @@ -0,0 +1,27 @@ +import json +import unittest +from tools import test_placement_parity as placement + + +class PlacementCorpusTests(unittest.TestCase): + def test_modifier_kinds_callback_failures_and_overflow(self): + definitions = list(placement.definitions()) + self.assertEqual(definitions, list(placement.definitions())) + values = [json.loads(raw) for raw in definitions] + kinds = {v.get('type') for v in values if isinstance(v, dict)} + self.assertTrue({'block_predicate_filter', 'environment_scan', 'count_on_every_layer', 'cuboid', 'noise_based_count', 'noise_threshold_count', 'heightmap', 'surface_relative_threshold_filter', 'surface_water_depth_filter', 'count', 'in_square', 'offset', 'height_range', 'rarity_filter', 'random_chance', 'fixed_placement', 'randomly_selected'} <= kinds) + fixtures = list(placement.corpus()) + self.assertEqual({f['legacy'] for f in fixtures}, {False, True}) + self.assertEqual({f['fail'] for f in fixtures}, {-1, 0, 2}) + self.assertEqual({f['draw'] for f in fixtures}, {False, True}) + self.assertEqual({f['height_mode'] for f in fixtures}, {0, 1}) + self.assertEqual({f['count_only'] for f in fixtures}, {False, True}) + self.assertTrue(any(f['query_fail'] == 1 for f in fixtures)) + self.assertTrue(any(f['world_min'] != f['context'][0] for f in fixtures)) + self.assertTrue(any(f['context'][0] == 2**31 - 1 for f in fixtures)) + self.assertTrue(any('4294967297' in f['definition'] for f in fixtures)) + self.assertTrue(all(len(f['positions']) == 4 for f in fixtures)) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_replace_block_parity.py b/tests/test_replace_block_parity.py new file mode 100644 index 000000000..29f98b46c --- /dev/null +++ b/tests/test_replace_block_parity.py @@ -0,0 +1,20 @@ +import json +import unittest +from tools import test_replace_block_parity as replace + + +class ReplaceBlockCorpusTests(unittest.TestCase): + def test_ordered_targets_failures_and_repeated_world_state(self): + fixtures = list(replace.corpus({})) + self.assertEqual({f['legacy'] for f in fixtures}, {False, True}) + self.assertEqual({f['fail'] for f in fixtures}, {-1, 0, 1, 2, 4}) + self.assertEqual({f['reject'] for f in fixtures}, {0, 2}) + self.assertTrue(all(f['repeats'] == 3 for f in fixtures)) + definitions = [json.loads(f['definition']) for f in fixtures] + self.assertTrue(any(d['targets'] == [] for d in definitions)) + self.assertTrue(any(isinstance(d['targets'], list) and len(d['targets']) == 3 for d in definitions)) + self.assertTrue(any('random_block_match' in f['definition'] for f in fixtures)) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_rule_test_parity.py b/tests/test_rule_test_parity.py new file mode 100644 index 000000000..7466fc26c --- /dev/null +++ b/tests/test_rule_test_parity.py @@ -0,0 +1,19 @@ +import json +import unittest +from tools import test_rule_test_parity as rules + + +class RuleTestCorpusTests(unittest.TestCase): + def test_registry_coverage_logic_and_random_modes(self): + facts = {'states': ['air', 'stone'], 'defaults': {'minecraft:air': 0, 'minecraft:stone': 1}} + fixtures = list(rules.corpus(facts, {'minecraft:test': '{}'})) + kinds = {json.loads(f['definition']).get('predicate_type') for f in fixtures if isinstance(json.loads(f['definition']), dict)} + self.assertTrue({'always_true', 'not', 'all_of', 'any_of', 'block_match', 'blockstate_match', 'tag_match', 'height_match', 'random_block_match', 'random_blockstate_match'} <= kinds) + self.assertEqual({f['legacy'] for f in fixtures}, {False, True}) + self.assertTrue(any('minecraft:test' in f['definition'] for f in fixtures)) + self.assertTrue(any('horizon:missing' in f['definition'] for f in fixtures)) + self.assertTrue(all(0 <= s < len(facts['states']) for f in fixtures for s in f['states'])) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_rust_parity.py b/tests/test_rust_parity.py new file mode 100644 index 000000000..3efc9de1c --- /dev/null +++ b/tests/test_rust_parity.py @@ -0,0 +1,72 @@ +import json +from pathlib import Path +import tempfile +import unittest +from unittest import mock + +from tools import test_rust_parity as parity + + +class ParityRunnerTests(unittest.TestCase): + def test_report_rejects_sources_changed_during_a_run(self): + with tempfile.TemporaryDirectory() as temp: + root = Path(temp) + source = root / "source.rs" + source.write_text("before") + with mock.patch.object(parity.lab, "ROOT", root): + before = parity.source_hashes([source]) + parity.ensure_sources_unchanged([source], before) + source.write_text("after") + with self.assertRaisesRegex(RuntimeError, "source.rs"): + parity.ensure_sources_unchanged([source], before) + def test_comparison_rejects_changed_missing_extra_and_empty_results(self): + for reference, candidate in [("rng 0 1\n", "rng 0 2\n"), + ("rng 0 1\n", ""), + ("rng 0 1\n", "rng 0 1\nrng 1 2\n"), ("", "")]: + with self.subTest(reference=reference, candidate=candidate), tempfile.TemporaryDirectory() as temp: + left, right = Path(temp) / "reference", Path(temp) / "candidate" + left.write_text(reference) + right.write_text(candidate) + with self.assertRaises(AssertionError): + parity.compare(left, right) + + def test_comparison_counts_matching_lines(self): + with tempfile.TemporaryDirectory() as temp: + left, right = Path(temp) / "reference", Path(temp) / "candidate" + left.write_text("rng 0 1\nrng 1 -1\n") + right.write_text(left.read_text()) + self.assertEqual(parity.compare(left, right), 2) + + def test_failed_artifact_verification_removes_previous_success(self): + with tempfile.TemporaryDirectory() as temp: + local = Path(temp) + report = local / "rust-parity/report.json" + report.parent.mkdir() + report.write_text(json.dumps({"previous_success": True})) + with mock.patch.object(parity.lab, "LOCAL", local), mock.patch("sys.argv", ["parity"]), \ + mock.patch.object(parity, "verify_artifacts", side_effect=ValueError("corrupt artifact")): + with self.assertRaisesRegex(ValueError, "corrupt artifact"): + parity.main() + self.assertFalse(report.exists()) + + def test_corpus_is_repeatable_and_contains_rejection_and_word_boundaries(self): + commands = list(parity.corpus()) + self.assertEqual(commands, list(parity.corpus())) + self.assertIn("xoroshiro_state 0 0 2200", commands) + self.assertIn("legacy -9223372036854775808 2200", commands) + factories = [line.split() for line in commands if line.startswith("factory ")] + self.assertEqual(len(factories), 4400) + self.assertTrue({"-", "d800", "dc00", "d83dde00", "d8000061dc00"} <= {line[9] for line in factories}) + helpers = [line.split() for line in commands if line.startswith("helpers ")] + self.assertEqual(len(helpers), 5000) + for stream in ["legacy", "xoroshiro"]: + bounds = {(int(line[3]), int(line[4])) for line in helpers if line[1] == stream} + self.assertTrue({(-2147483648, 2147483647), (2147483647, -2147483648), (0, 0), (0, 1073741825)} <= bounds) + for bits in range(1, 33): + lengths = {int(line.split()[2]) for line in commands if line.startswith(f"storage {bits} ")} + per_word = 64 // bits + self.assertTrue({0, 1, per_word - 1, per_word, per_word + 1, 4096} <= lengths) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_scattered_ore_parity.py b/tests/test_scattered_ore_parity.py new file mode 100644 index 000000000..783632d6f --- /dev/null +++ b/tests/test_scattered_ore_parity.py @@ -0,0 +1,21 @@ +import json +import unittest +from tools import test_scattered_ore_parity as ore + + +class ScatteredOreCorpusTests(unittest.TestCase): + def test_exposure_directions_empty_targets_and_boundary_sizes(self): + fixtures = list(ore.corpus({})) + self.assertEqual({f['mode'] for f in fixtures}, set(range(8))) + self.assertEqual({f['legacy'] for f in fixtures}, {False, True}) + self.assertEqual({f['fail'] for f in fixtures}, {-1, 0, 7}) + definitions = [json.loads(f['definition']) for f in fixtures] + sizes = {d['size'] for d in definitions} + self.assertTrue({-1, 0, 1, 7, 8, 64, 65, 4294967297} <= sizes) + self.assertTrue(any(d['targets'] == [] for d in definitions)) + self.assertTrue(any(f['origin'][0] == 2147483647 for f in fixtures)) + self.assertTrue(any(f['origin'][0] == -2147483648 for f in fixtures)) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_state_provider_parity.py b/tests/test_state_provider_parity.py new file mode 100644 index 000000000..e4241890a --- /dev/null +++ b/tests/test_state_provider_parity.py @@ -0,0 +1,32 @@ +import json +import unittest +from tools import test_state_provider_parity as provider + + +class StateProviderCorpusTests(unittest.TestCase): + def test_exclusive_decode_empty_fallback_rotations_and_shared_streams(self): + facts = {'states': [{'id': 'minecraft:stone'}, {'id': 'minecraft:water'}], 'defaults': {'minecraft:stone': 0, 'minecraft:water': 1}} + resources = {'horizon:provider': '{"id":"stone"}'} + fixtures = list(provider.corpus(facts, {'horizon:empty': '{"values":[]}'}, catalog_resources=resources, survival_rules={"minecraft:stone": "Always", "minecraft:water": "Always"})) + self.assertEqual(fixtures, list(provider.corpus(facts, {'horizon:empty': '{"values":[]}'}, catalog_resources=resources, survival_rules={"minecraft:stone": "Always", "minecraft:water": "Always"}))) + definitions = [json.loads(f['definition']) for f in fixtures] + self.assertTrue(any(isinstance(v, dict) and v.get('type') == 'simple' and v.get('id') == 'stone' for v in definitions)) + self.assertTrue(any(isinstance(v, dict) and v.get('type') == 'random_block' and v.get('blocks') == [] for v in definitions)) + self.assertEqual({f['typed'] for f in fixtures}, {False, True}) + self.assertEqual({(f['legacy'], f['worldgen']) for f in fixtures}, {(False, False), (True, False), (False, True), (True, True)}) + self.assertEqual({f['fail'] for f in fixtures}, {-1, 0, 1, 2}) + for kind in ['copy_properties', 'randomized_int', 'noise', 'noise_threshold', 'dual_noise', 'rule_based']: + self.assertTrue(any(isinstance(v, dict) and v.get('type') == kind for v in definitions)) + self.assertTrue(any([2147483647, -2147483648, 2147483647] in f.get('positions', []) for f in fixtures)) + self.assertEqual({f.get('query_fail', -1) for f in fixtures}, {-1, 0, 1, 2}) + self.assertTrue(any(f.get('bounds') == [2147483647, 2, 0] for f in fixtures)) + self.assertTrue(any(f.get("holder") and json.loads(f["definition"]) == "horizon:provider" for f in fixtures)) + conditions = [rule['if_true'] for v in definitions if isinstance(v, dict) and v.get('type') == 'rule_based' and isinstance(v.get('rules'), list) for rule in v['rules'] if isinstance(rule, dict) and isinstance(rule.get('if_true'), dict)] + for kind in ['matching_block_tag', 'matching_blocks', 'matching_fluids', 'matching_biomes', 'unobstructed', 'solid', 'replaceable', 'has_sturdy_face', 'would_survive', 'height_range', 'volume_match']: + self.assertTrue(any(v.get('type') == kind for v in conditions)) + for direction in ['down', 'up', 'north', 'south', 'west', 'east']: + self.assertTrue(any(isinstance(v, dict) and v.get('type') == 'rotated' and v.get('direction') == direction for v in definitions)) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_structure_density_parity.py b/tests/test_structure_density_parity.py new file mode 100644 index 000000000..f29bfe470 --- /dev/null +++ b/tests/test_structure_density_parity.py @@ -0,0 +1,27 @@ +import unittest +from tools import test_structure_density_parity as structure + + +class StructureDensityCorpusTests(unittest.TestCase): + def test_modes_kernel_neighborhood_and_null_bounds_are_covered(self): + fixtures=list(structure.corpus()) + self.assertEqual(fixtures,list(structure.corpus())) + self.assertEqual({p[1] for f in fixtures for p in f["pieces"]},{"NONE","BURY","BEARD_THIN","BEARD_BOX","ENCAPSULATE"}) + kernel=fixtures[0] + self.assertEqual(kernel["junctions"],[[0,0,0]]) + self.assertIn([29,29,29,-14,-14,-14,1,1,1,3],kernel["volumes"]) + self.assertTrue(any(f["affected"] is None and f["pieces"] for f in fixtures)) + self.assertTrue(any(p[2]==-2**31 for f in fixtures for p in f["pieces"])) + self.assertTrue(any(p[2]==2**31-1 for f in fixtures for p in f["pieces"])) + + def test_clipped_stride_fixture_exercises_a_sample_below_bounds(self): + fixture=next(f for f in structure.corpus() if f["affected"]==[1,1,1,9,9,9]) + volume=fixture["volumes"][0] + for axis in range(3): + minimum=volume[axis+3];step=volume[axis+6];bound=fixture["affected"][axis] + first=minimum+max(0,bound-minimum)//step*step + self.assertLess(first,bound) + self.assertGreater(volume[9],0) + + +if __name__=="__main__":unittest.main() diff --git a/tests/test_terrain_parity.py b/tests/test_terrain_parity.py new file mode 100644 index 000000000..071b7cf65 --- /dev/null +++ b/tests/test_terrain_parity.py @@ -0,0 +1,37 @@ +import json +import unittest +from tools import test_terrain_parity as terrain + + +class TerrainCorpusTests(unittest.TestCase): + def inputs(self): + names=["air","void_air","cave_air","stone","water","lava","oak_leaves","glass","oak_slab"] + facts={"states":[["minecraft:"+name,name.endswith("air"),name in ["water","lava","oak_slab"]] for name in names], + "defaults":{"minecraft:"+name:i for i,name in enumerate(names)}} + setting={"noise":{"min_y":-64,"height":384},"default_block":"minecraft:stone","default_fluid":"minecraft:water","sea_level":63,"noise_router":{},"aquifers":{"barrier":0}} + return facts,{"settings":{"minecraft:overworld":json.dumps(setting)}} + + def test_corpus_retains_presets_seed_modes_and_repeat_fills(self): + facts,bundle=self.inputs();fixtures=list(terrain.corpus(facts,bundle)) + self.assertEqual(fixtures,list(terrain.corpus(facts,bundle))) + self.assertEqual(len(fixtures),66) + self.assertEqual({f["legacy"] for f in fixtures[:6]},{True,False}) + self.assertEqual({f["seed"] for f in fixtures[:6]},{0,-1,0x123456789abcdef}) + self.assertTrue(all(f["initial"] for f in fixtures)) + self.assertTrue(any(f["repeats"]==2 for f in fixtures[:6])) + self.assertTrue(any(f["aquifers"] is None for f in fixtures)) + self.assertTrue(any(f["aquifers"] is not None for f in fixtures)) + + def test_partial_fills_and_input_writes_stay_inside_chunk(self): + facts,bundle=self.inputs();fixtures=list(terrain.corpus(facts,bundle)) + self.assertTrue(any(f["min"] -Horizon Lab — Compare runs +Horizon — Compare runs
-
Horizon Lab
Offline · files stay on your device
+
Horizon
Offline · files stay on your device

Compare your runs.

Choose two Horizon benchmark JSON files from your instance’s horizon-benchmarks folder. Add each matching CSV to see frame spikes. Compare frames with frames, or server ticks with server ticks.

diff --git a/tools/build_mod.py b/tools/build_mod.py index faacf092e..f6a01aa52 100644 --- a/tools/build_mod.py +++ b/tools/build_mod.py @@ -17,7 +17,7 @@ except ImportError: import runtime ROOT = lab.ROOT -SOURCE = ROOT / "mods/horizon-lab/src" +SOURCE = ROOT / "mods/horizon/src" BUILD = ROOT / ".local/mod-build" @@ -106,11 +106,11 @@ def build(): "dev.horizonlab.metrics.ResidentMemoryTest"], check=True) subprocess.run(["java", "-cp", os.pathsep.join([str(adapter_tests), test_classpath]), "dev.horizonlab.geometry.RelativeTerrainPositionTest"], check=True) - output = ROOT / "dist" / f"horizon-lab-{lock['pack_version']}.jar" + output = ROOT / "dist" / f"horizon-{lock['pack_version']}.jar" output.parent.mkdir(exist_ok=True) entries = {path.relative_to(classes).as_posix(): path.read_bytes() for path in classes.rglob("*.class")} if any(not name.startswith("dev/horizonlab/") for name in entries): - raise ValueError("Only original Horizon Lab classes may be packaged") + raise ValueError("Only original Horizon classes may be packaged") resources = SOURCE / "main/resources" entries.update({path.relative_to(resources).as_posix(): path.read_bytes() for path in resources.rglob("*") if path.is_file()}) entries["LICENSE"] = (ROOT / "LICENSE").read_bytes() diff --git a/tools/build_pack.py b/tools/build_pack.py index cbbe2b49e..0900ab497 100644 --- a/tools/build_pack.py +++ b/tools/build_pack.py @@ -82,7 +82,7 @@ def options(profile): def overrides(profile_name, mod_bytes): profile = PROFILES[profile_name] - files = {f"mods/horizon-lab-{read_lock()['pack_version']}.jar": mod_bytes, + files = {f"mods/horizon-{read_lock()['pack_version']}.jar": mod_bytes, "config/horizon-profile.txt": (profile_name + "\n").encode(), "options.txt": options(profile).encode()} experiment = any(profile.get(key, False) for key in ["adaptive", "pacing", "queue_wait", "dispatch_retry", "tick_dedup", "culling_empty", "culling_rays", "terrain_position", "quad_reuse"]) @@ -138,7 +138,7 @@ def build(profile_name, mod_jar): files.append({"path": mod_path(entry), "hashes": entry["hashes"], "downloads": [entry["url"]], "fileSize": entry["size"], "env": {"client": "required", "server": "unsupported"}}) index = {"formatVersion": 1, "game": "minecraft", "versionId": lock["pack_version"], - "name": "Horizon Lab — " + profile["title"], + "name": "Horizon — " + profile["title"], "summary": "Vanilla mechanics, pinned performance mods, measured frame and tick timings.", "files": files, "dependencies": {"minecraft": lock["minecraft"], "fabric-loader": lock["fabric_loader"]}} entries = {"modrinth.index.json": json.dumps(index, indent=2).encode()} @@ -161,7 +161,7 @@ def prepare_instance(profile_name, destination, mod_jar): target = destination / mod_path(entry) target.parent.mkdir(parents=True, exist_ok=True) shutil.copyfile(source, target) - runtime.install_original_mod(mod_jar, destination / "mods", f"horizon-lab-{lock['pack_version']}.jar") + runtime.install_original_mod(mod_jar, destination / "mods", f"horizon-{lock['pack_version']}.jar") for name, data in overrides(profile_name, mod_jar.read_bytes()).items(): if name.startswith("mods/"): continue @@ -175,7 +175,7 @@ def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--profile", choices=PROFILES) parser.add_argument("--instance", type=Path, help="Local demo smoke-test directory (no normal account launch)") - parser.add_argument("--mod", type=Path, default=ROOT / "dist" / f"horizon-lab-{read_lock()['pack_version']}.jar") + parser.add_argument("--mod", type=Path, default=ROOT / "dist" / f"horizon-{read_lock()['pack_version']}.jar") args = parser.parse_args() if not args.mod.exists(): parser.error("Build the original mod first: python3 tools/build_mod.py") diff --git a/tools/build_release.py b/tools/build_release.py index 8fe11fe55..00ded705b 100644 --- a/tools/build_release.py +++ b/tools/build_release.py @@ -15,7 +15,7 @@ ROOT = build_pack.ROOT def main(): lock = build_pack.read_lock() version = lock["pack_version"] - mod = ROOT / "dist" / f"horizon-lab-{version}.jar" + mod = ROOT / "dist" / f"horizon-{version}.jar" if not mod.exists(): raise FileNotFoundError("Run tools/build_mod.py first") packs = [build_pack.build(profile, mod) for profile in build_pack.PROFILES] diff --git a/tools/check_public_tree.py b/tools/check_public_tree.py index 26c47f4e8..7ca8b6217 100644 --- a/tools/check_public_tree.py +++ b/tools/check_public_tree.py @@ -16,8 +16,8 @@ def prohibited(path): # Original JDK-only tools are an exact allowlist; recovered game Java stays private. if path in ORIGINAL_JDK_TOOLS: return False - # Original Horizon Lab mod sources may also be tracked. - if parsed.suffix == ".java" and path.startswith("mods/horizon-lab/src/"): + # Original Horizon mod sources may also be tracked. + if parsed.suffix == ".java" and path.startswith(("mods/horizon/src/", "mods/horizon-lab/src/")): return not ("/dev/horizonlab/" in path) return bool(parsed.parts and parsed.parts[0] in PRIVATE_ROOTS) or parsed.suffix.lower() in PRIVATE_EXTENSIONS diff --git a/tools/lab.py b/tools/lab.py index c6c189aca..77d2b8a87 100644 --- a/tools/lab.py +++ b/tools/lab.py @@ -40,7 +40,7 @@ def download(url, destination, checksum, algorithm="sha1"): try: with tempfile.NamedTemporaryFile(dir=destination.parent, delete=False) as stream: temporary = Path(stream.name) - request = urllib.request.Request(url, headers={"User-Agent": "minecraft-optimization-lab/0.1"}) + request = urllib.request.Request(url, headers={"User-Agent": "horizon/0.1"}) with urllib.request.urlopen(request, timeout=120) as response: shutil.copyfileobj(response, stream) actual = digest(temporary, algorithm) diff --git a/tools/runtime.py b/tools/runtime.py index 60cc4b37d..1a40378c8 100644 --- a/tools/runtime.py +++ b/tools/runtime.py @@ -27,7 +27,9 @@ def install_original_mod(source, mod_dir, filename=None): """Replace our own previous versions, retaining backups outside Fabric's mod scan.""" mod_dir.mkdir(parents=True, exist_ok=True) filename = filename or source.name - for old in mod_dir.glob("horizon-lab-*.jar"): + # Retire both current and pre-rebrand filenames to avoid duplicate mod IDs. + candidates = sorted({*mod_dir.glob("horizon-*.jar"), *mod_dir.glob("horizon-lab-*.jar")}) + for old in candidates: if old.name == filename: continue with zipfile.ZipFile(old) as archive: diff --git a/tools/server.py b/tools/server.py index 4191bf75a..d9d2facc7 100644 --- a/tools/server.py +++ b/tools/server.py @@ -37,7 +37,7 @@ def prepare(instance, baseline=False): source = runtime.fetch(entry["url"], ROOT / ".local/pack-cache" / entry["filename"], entry["hashes"]["sha512"], "sha512") shutil.copyfile(source, mod_dir / entry["filename"]) - original = ROOT / "dist" / f"horizon-lab-{pack_lock['pack_version']}.jar" + original = ROOT / "dist" / f"horizon-{pack_lock['pack_version']}.jar" if not original.exists(): raise FileNotFoundError("Build the original mod first with tools/build_mod.py, or use the server starter ZIP") runtime.install_original_mod(original, mod_dir) diff --git a/tools/test_anchor_parity.py b/tools/test_anchor_parity.py new file mode 100644 index 000000000..fbff1d7e6 --- /dev/null +++ b/tools/test_anchor_parity.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python3 +"""Compare vertical anchor codecs, resolution and generation bounds with pinned vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import random +import subprocess +try: + from . import lab,test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + rng=random.Random(0x484f52495a4f4e414e43484f52) + names=["absolute","above_bottom","below_top","relative_to_sea_level"] + edges=[-2**31,-2033,-2032,-64,-1,0,1,63,2031,2032,2**31-1] + values=edges+[rng.randrange(-2**31,2**31) for _ in range(128)] + encodings=['null','false','0','"absolute"','[]','{}'] + numbers=[str(v) for v in edges]+['0.9','-0.9','1e3','-1e3','4294967296','4294967295','-4294967296','1e100','-1e100','1e-100','2147483648.9','-2147483649.9','null','true','"12"','[]','{}'] + for name in names: + for value in numbers:encodings.append('{"'+name+'":'+value+'}') + encodings += ['{"'+name+'":0,"unknown":true}','{"'+name+'":0,"'+name+'":1}','{"'+name+'":1,"'+name+'":null}'] + import itertools + for combination in itertools.product([None,0,2032,"bad"],repeat=4): + encodings.append(json.dumps({name:value for name,value in zip(names,combination) if value is not None},separators=(",",":"))) + contexts=[[-64,384,63],[0,256,32],[-2032,4064,0],[100,0,-100],[0,-1,0]] + contexts += [[x,y,z] for x,y,z in itertools.product([-2**31,0,2**31-1],repeat=3)] + contexts += [[rng.randrange(-2**31,2**31) for _ in range(3)] for _ in range(64)] + for i,context in enumerate(contexts): + for generator in [None,contexts[(i+7)%len(contexts)]]: + fixture={"context":context,"values":values,"json":encodings} + if generator is not None:fixture["generator"]=generator + yield fixture + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument("--prepare",action="store_true");args=parser.parse_args() + build=lab.LOCAL/"rust-anchor-parity";build.mkdir(parents=True,exist_ok=True) + report_path=build/"report.json";report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaAnchorOracle.java" + sources=[oracle,Path(__file__),lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock",lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml", + *sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/anchor_fixture.rs"] + tested_sources=base.source_hashes(sources) + fixtures=list(corpus());inputs=build/"inputs.txt";inputs.write_text("".join(json.dumps(f,separators=(",",":"))+"\n" for f in fixtures),encoding="utf-8") + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths);classes=build/"classes";classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle],"compile-java") + run(["cargo","build","--release","-p","horizon-world","--example","anchor_fixture"],"compile-rust") + metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) + binary=Path(metadata["target_directory"])/"release/examples"/("anchor_fixture.exe" if os.name=="nt" else "anchor_fixture") + run([binary,build],"rust") + references=[] + for side,jar in jars.items(): + reference=build/f"{side}.txt" + run(["java","-Xmx512M","-cp",os.pathsep.join([str(classes),str(jar),dependency_path]),"dev.horizonlab.parity.VanillaAnchorOracle",side,build],side) + matched=base.compare(reference,build/"rust.txt") + references.append({"side":side,"jar_sha256":lab.digest(jar,"sha256"),"output_sha256":lab.digest(reference,"sha256"),"matched_output_lines":matched}) + print(f"{side}: {matched:,} anchor output lines match Rust",flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={"schema":1,"minecraft":lock["minecraft"]["version"],"manifest_sha1":lock["minecraft"]["manifest_sha1"],"platform":platform.platform(), + "java":subprocess.check_output(["java","--version"],text=True).splitlines()[0],"rustc":subprocess.check_output(["rustc","--version"],text=True).strip(), + "fixtures":len(fixtures),"codec_inputs":sum(len(f["json"]) for f in fixtures),"runtime_anchors":sum(3+4*len(f["values"]) for f in fixtures), + "sources_sha256":tested_sources,"fixtures_sha256":tested_fixtures,"rust_output_sha256":lab.digest(build/"rust.txt","sha256"),"references":references, + "scope":"Actual VerticalAnchor.CODEC parsing and encoding, all four anchor kinds, constant helpers, runtime integer overflow and unrestricted constructor values. WorldGenerationContext.of uses a LevelAccessor proxy with verified method calls; the generator constructor uses a native NoiseBasedChunkGenerator with supplied minimum, height and sea level. Strict JSON transport covers range limits, numeric truncation/wrapping, null/wrong field types, duplicate fields and nested exclusive alternatives. Level access outside the three queried values, JSON syntax diagnostics and complete material conditions remain pending."} + lab.write_json(report_path,report);print(f"Scoped anchor parity passed: {report_path}") + + +if __name__=="__main__":main() diff --git a/tools/test_basic_feature_parity.py b/tools/test_basic_feature_parity.py new file mode 100644 index 000000000..001397965 --- /dev/null +++ b/tools/test_basic_feature_parity.py @@ -0,0 +1,95 @@ +#!/usr/bin/env python3 +"""Compare basic feature algorithms and ordered world mutations with pinned vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import random +import subprocess +try: + from . import lab,test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + encode=lambda value:json.dumps(value,separators=(',',':')) + origins=[[cx*16,64,cz*16] for cx in [-1,0,1] for cz in [-1,0,1]]+[[8,64,8],[-32,0,0],[32,0,0],[2147483647,-2147483648,2147483647],[-2147483648,2147483647,-2147483648]] + for legacy in [False,True]: + for seed in [0,-1,0x123456789abcdef]: + for kind in ['void_start_platform','end_island','end_platform']: + for origin in origins: + for reject in [0,3]: + for fail in [-1,0,7,63]: + yield {'definition':encode({'type':kind}),'origin':origin,'legacy':legacy,'seed':seed,'reject':reject,'fail':fail,'repeats':2} + chains=[[], + [{'type':'count','count':2}], + [{'type':'count','count':2},{'type':'in_square'}], + [{'type':'in_square'},{'type':'count','count':2}], + [{'type':'count','count':{'type':'uniform','min_inclusive':0,'max_inclusive':3}}, + {'type':'offset','x':{'type':'uniform','min_inclusive':-2,'max_inclusive':2},'y':1,'z':-1}], + [{'type':'count','count':2},{'type':'height_range','height':{'type':'uniform','min_inclusive':{'above_bottom':0},'max_inclusive':{'below_top':0}}}], + [{'type':'random_chance','chance':0.5},{'type':'count','count':2}], + [{'type':'count','count':2},{'type':'random_chance','chance':0.5}], + [{'type':'cuboid','xz_size':1,'y_size':1},{'type':'random_chance','chance':0.5}], + [{'type':'fixed_placement','positions':[[0,64,0],[0,64,0],[1,64,1]]}], + [{'type':'noise_threshold_count','noise_level':0,'below_noise':1,'above_noise':2},{'type':'in_square'}]] + for legacy in [False,True]: + for seed in [0,-1,0x123456789abcdef]: + for kind in ['void_start_platform','end_island','end_platform']: + for chain in chains: + for fail in [-1,0,7,63]: + for reject in [0,3]: + yield {'definition':encode({'type':kind}),'placement':chain,'origin':[0,64,0], + 'legacy':legacy,'seed':seed,'reject':reject,'fail':fail,'repeats':2} + for definition in [None,False,0,[],{}, {'type':'missing'}, {'type':':end_island'}, {'type':'minecraft:end_platform','ignored':0}]: + yield {'definition':encode(definition),'origin':[0,64,0],'legacy':False,'seed':0,'reject':0,'fail':7,'repeats':1} + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument("--prepare",action="store_true");args=parser.parse_args() + build=lab.LOCAL/"rust-basic-feature-parity";build.mkdir(parents=True,exist_ok=True) + report_path=build/"report.json";report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBasicFeatureOracle.java" + helper=oracle.with_name("VanillaPlacementOracle.java") + sources=[oracle,helper,Path(__file__),lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock",lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml", + *sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/basic_feature_fixture.rs"] + tested_sources=base.source_hashes(sources) + fixtures=list(corpus());inputs=build/"inputs.txt";inputs.write_text("".join(json.dumps(f,separators=(",",":"))+"\n" for f in fixtures),encoding="utf-8") + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths);classes=build/"classes";classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle,helper],"compile-java") + for side,jar in jars.items(): + path=build/f"facts-{side}.json" + run(["java","-Xmx512M","-cp",os.pathsep.join([str(classes),str(jar),dependency_path]),"dev.horizonlab.parity.VanillaBasicFeatureOracle","export",path],side+"-export") + fixture_paths.append(path) + if json.loads((build/"facts-client.json").read_text())!=json.loads((build/"facts-server.json").read_text()):raise ValueError("reference feature block states differ") + tested_fixtures=base.source_hashes(fixture_paths) + run(["cargo","build","--release","-p","horizon-world","--example","basic_feature_fixture"],"compile-rust") + metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) + binary=Path(metadata["target_directory"])/"release/examples"/("basic_feature_fixture.exe" if os.name=="nt" else "basic_feature_fixture") + run([binary,build],"rust") + references=[] + for side,jar in jars.items(): + reference=build/f"{side}.txt" + run(["java","-Xmx512M","-cp",os.pathsep.join([str(classes),str(jar),dependency_path]),"dev.horizonlab.parity.VanillaBasicFeatureOracle",side,build],side) + matched=base.compare(reference,build/"rust.txt") + references.append({"side":side,"jar_sha256":lab.digest(jar,"sha256"),"output_sha256":lab.digest(reference,"sha256"),"matched_output_lines":matched}) + print(f"{side}: {matched:,} basic-feature output lines match Rust",flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={"schema":1,"minecraft":lock["minecraft"]["version"],"manifest_sha1":lock["minecraft"]["manifest_sha1"],"platform":platform.platform(), + "java":subprocess.check_output(["java","--version"],text=True).splitlines()[0],"rustc":subprocess.check_output(["rustc","--version"],text=True).strip(), + "fixtures":len(fixtures),"basic_features":3,"block_states":5,"composed_fixtures":sum("placement" in f for f in fixtures),"requested_placements":sum(f["repeats"] for f in fixtures), + "sources_sha256":tested_sources,"fixtures_sha256":tested_fixtures,"rust_output_sha256":lab.digest(build/"rust.txt","sha256"),"references":references, + "scope":"Actual Feature.DIRECT_CODEC and native void-start-platform, End-island and End-platform feature algorithms. A mutable WorldGenLevel proxy logs ordered block reads, writes, update flags, rejected writes, thrown failures and accumulated stored states after repeated placements. Native LevelWriter.setBlockAndUpdate executes through its actual default method. Required default block-state IDs are independently exported and checked across both authenticated JARs. Direct calls and native FeaturePlacer modifier chains share the mutable world and random stream, including reused placer buffers after failures. Both random modes, multiple seeds, nearby/far chunks and extreme wrapped coordinates are compared, with nextLong values after every placement and at fixture end. The End-platform feature invokes its ordinary generation path without block destruction/drops. Actual chunk mutation, neighbor updates, lighting, entity/block drops, full feature registry behavior and complete generated worlds remain outside this comparison."} + + lab.write_json(report_path,report);print(f"Scoped basic-feature parity passed: {report_path}") + + +if __name__=="__main__":main() diff --git a/tools/test_biome_chunk_parity.py b/tools/test_biome_chunk_parity.py new file mode 100644 index 000000000..9dc484b54 --- /dev/null +++ b/tools/test_biome_chunk_parity.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python3 +"""Compare quart-biome chunk storage and section-atomic filling with pinned vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import random +import subprocess +try: + from . import lab,test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + rng=random.Random(0x484f52495a4f4e42494f4348) + for minimum,height in [(-64,384),(0,128),(-2032,4064),(2000,32),(-16,16)]: + for cx,cz in [(0,0),(-1,2),(1875000,-1875000),(-2**31,2**31-1)]: + maximum=minimum+height-1 + queries=[[x,y,z] for x,y,z in [(cx*4,minimum//4,cz*4),(cx*4+3,maximum//4,cz*4+3),(-2**31,-2**31,2**31-1),(2**31-1,2**31-1,-2**31)]] + queries=[[((v+2**31)%2**32)-2**31 for v in q] for q in queries] + queries += [[rng.randrange(-2**31,2**31) for _ in range(3)] for _ in range(128)] + ops=[[0,1,-1,minimum,maximum],[17,67,-1,minimum,maximum],[97,129,0,minimum,maximum],[5,2,63,minimum,maximum],[9,8,64,minimum,maximum],[123,512,65,minimum,maximum],[17,3,-1,minimum+1,maximum-1],[-2**31,67,-1,minimum,maximum]] + yield {'cx':cx,'cz':cz,'min':minimum,'height':height,'default':rng.randrange(512),'ops':ops,'queries':queries} + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument("--prepare",action="store_true");args=parser.parse_args() + build=lab.LOCAL/"rust-biome-chunk-parity";build.mkdir(parents=True,exist_ok=True) + report_path=build/"report.json";report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeChunkOracle.java" + sources=[oracle,Path(__file__),lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock",lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml", + *sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/biome_chunk_fixture.rs"] + tested_sources=base.source_hashes(sources) + fixtures=list(corpus());inputs=build/"inputs.txt";inputs.write_text("".join(json.dumps(f,separators=(",",":"))+"\n" for f in fixtures),encoding="utf-8") + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths);classes=build/"classes";classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle],"compile-java") + run(["cargo","build","--release","-p","horizon-world","--example","biome_chunk_fixture"],"compile-rust") + metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) + binary=Path(metadata["target_directory"])/"release/examples"/("biome_chunk_fixture.exe" if os.name=="nt" else "biome_chunk_fixture") + run([binary,build],"rust") + references=[] + for side,jar in jars.items(): + reference=build/f"{side}.txt" + run(["java","-Xmx512M","-cp",os.pathsep.join([str(classes),str(jar),dependency_path]),"dev.horizonlab.parity.VanillaBiomeChunkOracle",side,build],side) + matched=base.compare(reference,build/"rust.txt") + references.append({"side":side,"jar_sha256":lab.digest(jar,"sha256"),"output_sha256":lab.digest(reference,"sha256"),"matched_output_lines":matched}) + print(f"{side}: {matched:,} biome-chunk output lines match Rust",flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={"schema":1,"minecraft":lock["minecraft"]["version"],"manifest_sha1":lock["minecraft"]["manifest_sha1"],"platform":platform.platform(), + "java":subprocess.check_output(["java","--version"],text=True).splitlines()[0],"rustc":subprocess.check_output(["rustc","--version"],text=True).strip(), + "fixtures":len(fixtures),"fills":sum(len(f["ops"]) for f in fixtures),"block_queries":sum(len(f["ops"])*len(f["queries"]) for f in fixtures), + "sources_sha256":tested_sources,"fixtures_sha256":tested_fixtures,"rust_output_sha256":lab.digest(build/"rust.txt","sha256"),"references":references, + "scope":"Actual ChunkAccess.fillBiomesFromNoise, LevelChunkSection.fillBiomesFromNoise and chunk/section biome reads using synthetic registered holder identities. Ordered resolver queries, section contents and clamped/wrapped chunk lookups are compared after repeated fills and failures at section boundaries. Covers full supported aligned vertical bounds, generation bounds cutting through sections, negative/extreme chunk coordinates and 1..512 possible biome identities. Completed earlier sections survive failure while the failing section retains its previous values. This compares stored biome values, not native in-memory palette layout, wire encoding, biome-source generation, blending, retrogen or complete generated worlds."} + + lab.write_json(report_path,report);print(f"Scoped biome-chunk parity passed: {report_path}") + + +if __name__=="__main__":main() diff --git a/tools/test_biome_generation_parity.py b/tools/test_biome_generation_parity.py new file mode 100644 index 000000000..e0be3acb9 --- /dev/null +++ b/tools/test_biome_generation_parity.py @@ -0,0 +1,88 @@ +#!/usr/bin/env python3 +"""Compare chunk generation for all four biome-source kinds with pinned vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import random +import subprocess +try: + from . import lab,test_rust_parity as base,test_worldgen_parity as worldgen +except ImportError: + import lab + import test_rust_parity as base + import test_worldgen_parity as worldgen + + +def corpus(bundle): + for setting,raw in sorted(bundle['settings'].items()): + value=json.loads(raw);minimum=value['noise']['min_y'];height=value['noise']['height'] + for preset in sorted(bundle['presets']): + for legacy in [False,True]: + for seed,cx,cz in [(0,0,0),(-1,-2,3),(0x123456789abcdef,1875000,-1875000)]: + queries=[[cx*16+x,y,cz*16+z] for x in [-1,0,2,7,15,16] for z in [-1,0,2,7,15,16] for y in [minimum-20,minimum,minimum+17,minimum+height-1,minimum+height+20]] + yield {'setting':setting,'preset':preset,'seed':seed,'legacy':legacy,'cx':cx,'cz':cz,'min':minimum,'height':height,'write_min':minimum+(17 if seed==-1 else 0),'write_max':minimum+height-1-(17 if seed==-1 else 0),'queries':queries,'repeats':2 if seed==0 else 1} + + + for source in ['fixed','checkerboard','end']: + for legacy in [False,True]: + for seed,cx,cz,scale in [(0,0,0,2),(-1,65,0,0),(2,-65,1,30),(-2**63,1875000,-1875000,62)]: + queries=[[cx*16+x,y,cz*16+z] for x in [-1,0,7,15,16] for z in [-1,0,7,15,16] for y in [minimum-1,minimum+17,minimum+height]] + yield {'setting':setting,'preset':'minecraft:overworld','source':source,'scale':scale,'seed':seed,'legacy':legacy,'cx':cx,'cz':cz,'min':minimum,'height':height,'write_min':minimum,'write_max':minimum+height-1,'queries':queries,'repeats':2 if seed==0 else 1} + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument("--prepare",action="store_true");args=parser.parse_args() + build=lab.LOCAL/"rust-biome-generation-parity";build.mkdir(parents=True,exist_ok=True) + report_path=build/"report.json";report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeGenerationOracle.java" + exporter=oracle.with_name("VanillaBiomeExport.java") + sources=[oracle,exporter,Path(__file__),lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock",lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml", + *sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/biome_generation_fixture.rs"] + tested_sources=base.source_hashes(sources) + classes=build/"classes";classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle,exporter],"compile-java") + bundle={} + for field,kind in [('noises','noise'),('densities','density_function'),('settings','noise_settings')]: + resources=worldgen.registry_resources(jars['server'],kind) + if not resources or resources!=worldgen.registry_resources(jars['client'],kind):raise ValueError('reference '+kind+' resources differ') + prefix='data/minecraft/worldgen/'+kind+'/' + bundle[field]={'minecraft:'+name[len(prefix):-5]:raw for name,raw in resources.items()} + exports=[] + for side,jar in jars.items(): + path=build/f'presets-{side}.json';exports.append(path) + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jar),dependency_path]),'dev.horizonlab.parity.VanillaBiomeExport',path],side+'-export') + presets=json.loads(path.read_text()) + if not presets or ('presets' in bundle and presets!=bundle['presets']):raise ValueError('reference biome preset tables differ') + bundle['presets']=presets + registries=build/'registries.json';registries.write_text(json.dumps(bundle,separators=(',',':')),encoding='utf-8') + fixtures=list(corpus(bundle));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(f,separators=(',',':'))+'\n' for f in fixtures),encoding='utf-8') + fixture_paths=[inputs,registries,*exports];tested_fixtures=base.source_hashes(fixture_paths) + run(["cargo","build","--release","-p","horizon-world","--example","biome_generation_fixture"],"compile-rust") + metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) + binary=Path(metadata["target_directory"])/"release/examples"/("biome_generation_fixture.exe" if os.name=="nt" else "biome_generation_fixture") + run([binary,build],"rust") + references=[] + for side,jar in jars.items(): + reference=build/f"{side}.txt" + run(["java","-Xmx512M","-cp",os.pathsep.join([str(classes),str(jar),dependency_path]),"dev.horizonlab.parity.VanillaBiomeGenerationOracle",side,build],side) + matched=base.compare(reference,build/"rust.txt") + references.append({"side":side,"jar_sha256":lab.digest(jar,"sha256"),"output_sha256":lab.digest(reference,"sha256"),"matched_output_lines":matched}) + print(f"{side}: {matched:,} biome-generation output lines match Rust",flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={"schema":1,"minecraft":lock["minecraft"]["version"],"manifest_sha1":lock["minecraft"]["manifest_sha1"],"platform":platform.platform(), + "java":subprocess.check_output(["java","--version"],text=True).splitlines()[0],"rustc":subprocess.check_output(["rustc","--version"],text=True).strip(), + "fixtures":len(fixtures),"fills":sum(f["repeats"] for f in fixtures),"biome_values":sum(f["repeats"]*f["height"]*4 for f in fixtures),"block_queries":sum(f["repeats"]*len(f["queries"]) for f in fixtures),"preset_entries":{name:len(json.loads(raw)) for name,raw in bundle["presets"].items()},"source_fixtures":{name:sum(f.get("source","multi")==name for f in fixtures) for name in ["multi","fixed","checkerboard","end"]}, + "sources_sha256":tested_sources,"fixtures_sha256":tested_fixtures,"rust_output_sha256":lab.digest(build/"rust.txt","sha256"),"references":references, + "scope":"Actual ChunkGenerator.doCreateBiomes through NoiseBasedChunkGenerator with empty Blender and no retrogen. Both bundled Overworld/Nether multi-noise preset tables are independently exported from authenticated JARs; Rust imports quantized tables and compiles climate routers itself. All seven bundled routers, both random modes, multiple seeds and distant positive/negative chunks are tested. Complete section biome values and subsequent BiomeManager block lookups are compared, including repeated generation with fresh density contexts and persistent previous-leaf search state, and generation bounds excluding top/bottom sections. Holders are identity placeholders; no biome properties are evaluated. Fixed, checkerboard and End source fixtures also run actual chunk generation through every bundled router, including real seeded End erosion, the central-island shortcut, distant coordinates and wrapped checkerboard shifts. Preset builders, complete biome-source codecs, blending, retrogen, terrain-stage linkage and complete generated worlds remain pending."} + + lab.write_json(report_path,report);print(f"Scoped biome-generation parity passed: {report_path}") + + +if __name__=="__main__":main() diff --git a/tools/test_biome_placement_parity.py b/tools/test_biome_placement_parity.py new file mode 100644 index 000000000..b32a0297b --- /dev/null +++ b/tools/test_biome_placement_parity.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python3 +"""Compare biome placement filtering, root context, nested placers and partial failures.""" +import argparse +import itertools +import json +import os +from pathlib import Path +import platform +import random +import subprocess +import zipfile +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + biome={'type':'biome'} + chains=[[biome],[{'type':'count','count':3},{'type':'in_square'},biome],[biome,{'type':'count','count':2},{'type':'offset','x':1,'y':0,'z':0},biome],[{'type':'random_chance','chance':0.5},biome,{'type':'count','count':2}],[{'type':'count','count':2},biome,{'type':'offset','x':1,'y':0,'z':0},biome]] + for legacy in [False,True]: + for worldgen in [False,True]: + for top in [False,True]: + for membership in [[0,0],[1,0],[0,1],[1,1],[2,3],[3,2]]: + for placement in chains: + for query_fail,feature_fail in [(-1,-1),(0,-1),(1,-1),(3,-1),(-1,0),(-1,2)]: + for nested in [False,True]: + for return_mode in [0,1,2]: + yield {'legacy':legacy,'worldgen':worldgen,'seed':-1 if nested else 0,'top':top,'direct':False,'membership':membership,'placement':placement,'query_fail':query_fail,'feature_fail':feature_fail,'nested':nested,'draw':return_mode!=1,'return_mode':return_mode,'origin':[15,-64,15]} + for legacy in [False,True]: + for top in [False,True]: + for membership in itertools.product(range(4),repeat=2): + for query_fail in [-1,0,1,2]: + for origin in [[0,0,0],[2147483647,-2147483648,2147483647]]: + yield {'legacy':legacy,'worldgen':False,'seed':0,'top':top,'direct':True,'membership':list(membership),'placement':[biome],'query_fail':query_fail,'feature_fail':-1,'nested':False,'draw':True,'return_mode':0,'origin':origin} + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-biome-placement-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomePlacementOracle.java' + helper=oracle.with_name("VanillaPlacementOracle.java") + sources=[oracle,helper,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/biome_placement_fixture.rs'] + tested_sources=base.source_hashes(sources) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(f,separators=(',',':'))+'\n' for f in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle,helper],'compile-java') + run(['cargo','build','--release','-p','horizon-world','--example','biome_placement_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('biome_placement_fixture.exe' if os.name=='nt' else 'biome_placement_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jar),dependency_path]),'dev.horizonlab.parity.VanillaBiomePlacementOracle',side,build],side) + reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} biome-placement output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'random_modes':2,'requested_placements':len(fixtures)*3,'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual BiomeFilter.modify and FeaturePlacer.place/placeWithBiomeCheck with native biome generation settings. Missing top features fail before biome lookup. Direct, absent, structurally equal and different placed-feature membership, query order, callback random draws/results/errors, dirty buffers across repeats and nested plain placers are compared. Direct and WorldgenRandom-wrapped legacy/xoroshiro streams execute modifier chains. Rust delegates biome resolution and generation-settings membership to the caller while isolating each placer invocation context. Full biome sampling/registry equality, complete decoration, crash-report text and gameplay remain pending.'} + lab.write_json(report_path,report);print(f'Scoped biome-placement parity passed: {report_path}') + + +if __name__=='__main__':main() diff --git a/tools/test_biome_source_codec_parity.py b/tools/test_biome_source_codec_parity.py new file mode 100644 index 000000000..58989d884 --- /dev/null +++ b/tools/test_biome_source_codec_parity.py @@ -0,0 +1,120 @@ +#!/usr/bin/env python3 +"""Compare registry-bound biome-source codecs and decoded runtime behavior.""" +import argparse +import json +import os +from pathlib import Path +import platform +import random +import subprocess +try: + from . import lab,test_rust_parity as base,test_worldgen_parity as worldgen,test_biome_temperature_parity as temperature,test_material_condition_parity as material +except ImportError: + import lab + import test_rust_parity as base + import test_worldgen_parity as worldgen + import test_biome_temperature_parity as temperature + import test_material_condition_parity as material + + +def corpus(bundle): + encode=lambda value:json.dumps(value,separators=(',',':')) + for value in [None,False,0,'fixed',[],{}, {'type':'missing'}, {'type':None}]:yield encode(value) + for name in sorted(bundle['biomes']): + yield encode({'type':'fixed','biome':name}) + yield encode({'type':'checkerboard','biomes':name}) + for name in sorted(bundle['biome_tags']):yield encode({'type':'checkerboard','biomes':'#'+name,'scale':3}) + for value in [None,False,0,[],{},'',':','missing','Minecraft:plains','#is_overworld',['plains'],['plains','desert','plains'],['#is_overworld']]: + yield encode({'type':'fixed','biome':value}) + yield encode({'type':'checkerboard','biomes':value}) + for token in ['null','false','"2"','{}','[]','-1','0','1','2','30','31','32','62','63','-0.0','2.9','-0.9','4294967296','4294967298','2147483648','-4294967296','1e100','-1e100','1e-100']: + yield '{"type":"checkerboard","biomes":["plains","desert"],"scale":'+token+'}' + yield '{"type":"checkerboard","biomes":"plains","scale":-1,"scale":2}' + yield '{"type":":fixed","biome":":plains","ignored":true}' + yield '{"type":"fixed","biome":"missing","biome":"plains"}' + for value in [{},{'biome':'missing'},{'preset':None}]:yield encode({'type':'the_end',**value}) + point={name:0 for name in ['temperature','humidity','continentalness','erosion','depth','weirdness','offset']} + good={'parameters':point,'biome':'plains'} + for preset in [None,False,0,[],{},'overworld','nether',':overworld','missing',{'preset':'overworld'},{'preset':'nether'},{'preset':'missing'},{'preset':None}]: + yield encode({'type':'multi_noise','preset':preset}) + yield encode({'type':'multi_noise','biomes':[good],'preset':preset}) + yield encode({'type':'multi_noise','biomes':[],'preset':preset}) + yield encode({'type':'multi_noise','biomes':[{'biome':'missing','parameters':point}],'preset':preset}) + for entries in [[],[good],[good,good],[good,{'parameters':point,'biome':'desert'}],[{}],[{'parameters':point}],[{'biome':'plains'}],None,'plains',0]:yield encode({'type':'multi_noise','biomes':entries}) + for field in point: + for value in [None,False,'0',[],{},[-1,1],{'min':-1,'max':1},[1,-1],[-0.0,0.0],[0.0,-0.0],-2,-2.0001,2,2.0001,-0.0,0.00009999,0.123456789,1e100]: + changed={**point,field:value} + yield encode({'type':'multi_noise','biomes':[{'parameters':changed,'biome':'plains'}]}) + for name in point: + changed={key:value for key,value in point.items() if key!=name} + yield encode({'type':'multi_noise','biomes':[{'parameters':changed,'biome':'plains'}]}) + yield encode({'type':'multi_noise','biomes':[{'parameters':{**point,'temperature':[-0.1111,0.2222],'offset':0.012345},'biome':'desert'}]}) + + + # Cover every quantized climate value in [-2,2], including interval encoding + # and every nonnegative offset increment. Input floats are parsed by each codec. + for step in range(-20000,20001): + changed={**point,'temperature':step/10000,'humidity':[-2,step/10000],'offset':abs(step)%10001/10000} + yield encode({'type':'multi_noise','biomes':[{'parameters':changed,'biome':'plains'}]}) + + +def positions(): + return [[0,0,0],[256,0,0],[260,-1,0],[-257,8,1],[7500000,79,-7500000],[-2**31,2**31-1,-1],[2**31-1,-2**31,17]] + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument("--prepare",action="store_true");args=parser.parse_args() + build=lab.LOCAL/"rust-biome-source-codec-parity";build.mkdir(parents=True,exist_ok=True) + report_path=build/"report.json";report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeSourceCodecOracle.java" + exporter=oracle.with_name("VanillaBiomeExport.java") + helpers=[oracle.with_name(name+".java") for name in ["VanillaMaterialConditionOracle","VanillaAnchorOracle","VanillaBiomeTemperatureOracle"]] + sources=[oracle,exporter,*helpers,lab.ROOT/"tools/test_biome_temperature_parity.py",lab.ROOT/"tools/test_material_condition_parity.py",Path(__file__),lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock",lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml", + *sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/biome_source_codec_fixture.rs"] + tested_sources=base.source_hashes(sources) + classes=build/"classes";classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle,exporter,*helpers],"compile-java") + bundle={} + for field,getter in [('biomes',temperature.biome_resources),('biome_tags',material.biome_tag_resources)]: + bundle[field]=getter(jars['server']) + if not bundle[field] or bundle[field]!=getter(jars['client']):raise ValueError('reference '+field+' resources differ') + (build/(field+'.json')).write_text(json.dumps(bundle[field],separators=(',',':')),encoding='utf-8') + exports=[] + for side,jar in jars.items(): + path=build/f'presets-{side}.json';exports.append(path) + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jar),dependency_path]),'dev.horizonlab.parity.VanillaBiomeExport',path],side+'-export') + presets=json.loads(path.read_text()) + if not presets or ('presets' in bundle and presets!=bundle['presets']):raise ValueError('reference biome preset tables differ') + bundle['presets']=presets + (build/'presets.json').write_text(json.dumps(bundle['presets'],separators=(',',':')),encoding='utf-8') + fixtures=list(corpus(bundle));inputs=build/'inputs.txt';inputs.write_text('\n'.join(fixtures)+'\n',encoding='utf-8') + (build/'positions.json').write_text(json.dumps(positions(),separators=(',',':')),encoding='utf-8') + fixture_paths=[inputs,*exports,build/'positions.json',*[build/(name+'.json') for name in bundle]];tested_fixtures=base.source_hashes(fixture_paths) + run(["cargo","build","--release","-p","horizon-world","--example","biome_source_codec_fixture"],"compile-rust") + metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) + binary=Path(metadata["target_directory"])/"release/examples"/("biome_source_codec_fixture.exe" if os.name=="nt" else "biome_source_codec_fixture") + run([binary,build],"rust") + references=[] + for side,jar in jars.items(): + reference=build/f"{side}.txt" + run(["java","-Xmx512M","-cp",os.pathsep.join([str(classes),str(jar),dependency_path]),"dev.horizonlab.parity.VanillaBiomeSourceCodecOracle",side,build],side) + matched=base.compare(reference,build/"rust.txt") + references.append({"side":side,"jar_sha256":lab.digest(jar,"sha256"),"output_sha256":lab.digest(reference,"sha256"),"matched_output_lines":matched}) + print(f"{side}: {matched:,} biome-source codec output lines match Rust",flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={"schema":1,"minecraft":lock["minecraft"]["version"],"manifest_sha1":lock["minecraft"]["manifest_sha1"],"platform":platform.platform(), + "java":subprocess.check_output(["java","--version"],text=True).splitlines()[0],"rustc":subprocess.check_output(["rustc","--version"],text=True).strip(), + "fixtures":len(fixtures),"query_positions":len(positions()),"climate_grid_cases":40001,"biomes":len(bundle['biomes']),"biome_tags":len(bundle['biome_tags']), + + "sources_sha256":tested_sources,"fixtures_sha256":tested_fixtures,"rust_output_sha256":lab.digest(build/"rust.txt","sha256"),"references":references, + "scope":"Actual BiomeSource.CODEC parsing and encoding for fixed, checkerboard, End and multi-noise sources bound to pinned biome/tag registries and preset holders. Named biome holders, direct/tag holder sets, canonical identifiers, scale defaults/bounds/numeric narrowing, inline climate parameter lists, named/inline preset holders, inline-list preference/fallback, malformed fields and duplicate keys are compared. Canonical serialized JSON is compared as sorted structures with numeric double-bit values; possible-biome sets are sorted and compared, followed by source queries against zero climate/erosion. Rust imports independently authenticated preset tables. Full inline biome definitions, live registry ownership/reloads and complete source/world generation remain outside this scoped codec comparison."} + + lab.write_json(report_path,report);print(f"Scoped biome-source codec parity passed: {report_path}") + + +if __name__=="__main__":main() diff --git a/tools/test_biome_source_parity.py b/tools/test_biome_source_parity.py new file mode 100644 index 000000000..093c92427 --- /dev/null +++ b/tools/test_biome_source_parity.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python3 +"""Compare fixed, checkerboard and End biome sources with pinned vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import random +import subprocess +try: + from . import lab,test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + rng=random.Random(0x484f52495a4f4e534f55524345) + edges=[-2**31,-2**31+1,-536870913,-536870912,-260,-257,-256,-255,-4,-1,0,1,4,255,256,257,260,536870911,536870912,2**31-1] + positions=[[x,y,z] for x in edges for z in edges for y in [-2**31,-1,0,79,2**31-1]] + positions += [[rng.randrange(-2**31,2**31) for _ in range(3)] for _ in range(512)] + yield {'kind':'fixed','positions':positions} + for scale in [-2**31,-65,-34,-33,-32,-3,-2,-1,*range(63),63,64,65,2**31-1]: + for biomes in [[],[0],[3,1,3,2],list(range(67)),list(range(512))]:yield {'kind':'checkerboard','scale':scale,'biomes':biomes,'positions':positions} + bits=['00000000','80000000','3e800000','3e7fffff','3e800001','bd800000','bd800001','bd7fffff','be600000','be600001','be5fffff','7f800000','ff800000','7fc00000','7f800001','ffc00000'] + bits += [f'{rng.getrandbits(32):08x}' for _ in range(64)] + for value in bits:yield {'kind':'end','bits':value,'fail':False,'positions':positions} + yield {'kind':'end','bits':'00000000','fail':True,'positions':positions} + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument("--prepare",action="store_true");args=parser.parse_args() + build=lab.LOCAL/"rust-biome-source-parity";build.mkdir(parents=True,exist_ok=True) + report_path=build/"report.json";report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeSourceOracle.java" + sources=[oracle,Path(__file__),lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock",lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml", + *sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/biome_source_fixture.rs"] + tested_sources=base.source_hashes(sources) + fixtures=list(corpus());inputs=build/"inputs.txt";inputs.write_text("".join(json.dumps(f,separators=(",",":"))+"\n" for f in fixtures),encoding="utf-8") + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths);classes=build/"classes";classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle],"compile-java") + run(["cargo","build","--release","-p","horizon-world","--example","biome_source_fixture"],"compile-rust") + metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) + binary=Path(metadata["target_directory"])/"release/examples"/("biome_source_fixture.exe" if os.name=="nt" else "biome_source_fixture") + run([binary,build],"rust") + references=[] + for side,jar in jars.items(): + reference=build/f"{side}.txt" + run(["java","-Xmx512M","-cp",os.pathsep.join([str(classes),str(jar),dependency_path]),"dev.horizonlab.parity.VanillaBiomeSourceOracle",side,build],side) + matched=base.compare(reference,build/"rust.txt") + references.append({"side":side,"jar_sha256":lab.digest(jar,"sha256"),"output_sha256":lab.digest(reference,"sha256"),"matched_output_lines":matched}) + print(f"{side}: {matched:,} biome-source output lines match Rust",flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={"schema":1,"minecraft":lock["minecraft"]["version"],"manifest_sha1":lock["minecraft"]["manifest_sha1"],"platform":platform.platform(), + "java":subprocess.check_output(["java","--version"],text=True).splitlines()[0],"rustc":subprocess.check_output(["rustc","--version"],text=True).strip(), + "fixtures":len(fixtures),"queries":sum(len(f["positions"]) for f in fixtures),"sources":{name:sum(f["kind"]==name for f in fixtures) for name in ["fixed","checkerboard","end"]}, + "sources_sha256":tested_sources,"fixtures_sha256":tested_fixtures,"rust_output_sha256":lab.digest(build/"rust.txt","sha256"),"references":references, + "scope":"Actual FixedBiomeSource, CheckerboardColumnBiomeSource and TheEndBiomeSource runtime queries using synthetic holder identities. Fixed results, checkerboard empty/duplicate/large lists, all codec-valid scales plus unrestricted runtime scales, Java masked shifts and wrapping sums are compared. End central-circle shortcuts, erosion sampler coordinates, exact threshold boundaries, nonfinite float samples, sampler failures and integer coordinate wrapping are compared through actual Climate.Sampler bindings. End density inputs in this suite are supplied constants; real seeded End density, biome-source codecs, registry/preset loading, possible-biome metadata and generated-world integration remain separate work."} + + lab.write_json(report_path,report);print(f"Scoped biome-source parity passed: {report_path}") + + +if __name__=="__main__":main() diff --git a/tools/test_biome_temperature_parity.py b/tools/test_biome_temperature_parity.py new file mode 100644 index 000000000..1edec516e --- /dev/null +++ b/tools/test_biome_temperature_parity.py @@ -0,0 +1,105 @@ +#!/usr/bin/env python3 +"""Compare biome temperature sampling, precipitation and cache behavior with pinned vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import random +import subprocess +import zipfile +try: + from . import lab,test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + rng=random.Random(0x484f52495a4f4e54454d50) + bases=[0,0x80000000,1,0x80000001,0x3dcccccc,0x3dcccccd,0x3dccccce,0x3e199999,0x3e19999a,0x3e19999b,0x3e4ccccd,0x3f000000,0x3f800000,0xbf800000,0x7f7fffff,0xff7fffff,0x7f800000,0xff800000,0x7fc00000,0xffc00001] + bases += [rng.getrandbits(32) for _ in range(28)] + edges=[-2**31,-33554433,-33554432,-16777217,-16777216,-4097,-4096,-64,-1,0,1,63,64,79,80,81,4095,4096,16777216,16777217,33554431,33554432,2**31-1] + wrap=lambda value:(value+2**31)%2**32-2**31 + points=[[0,y,0,63] for y in [-64,0,63,79,80,81,82,319,4096]] + points += [[rng.choice(edges),rng.choice(edges),rng.choice(edges),rng.choice(edges)] for _ in range(96)] + points += [[rng.randrange(-30000000,30000001),rng.randrange(-64,321),rng.randrange(-30000000,30000001),63] for _ in range(96)] + # Reuse packed keys while varying the source coordinates and sea level. + for x,y,z,sea in list(points[:32]): + points += [[x,y,z,wrap(sea+500)],[wrap(x+2**26),wrap(y+4096),wrap(z-2**26),sea]] + for base in bases: + for modifier in ['NONE','FROZEN']: + for precipitation in [False,True]: + ops=[['query',*p] for p in points] + ops += [['fill',1100,-10000,63],['dump'],['query',-8901,1099&255,1099*31,-64],['query',-10000,0,0,63],['dump']] + yield {'base':f'{base:x}','modifier':modifier,'precipitation':precipitation,'ops':ops} + for base in [0x3e4ccccd,0x7fc00000,0xffc00001]: + for modifier in ['NONE','FROZEN']: + for first in [0,1023]: + ops=[['fill',1024,0,63],['dump'],['query',first,first&255,first*31,-64],['dump'],['fill',1,5000,63],['dump']] + child=[['dump'],['query',first,first&255,first*31,-1000],['query',0,4096,0,0],['dump']] + ops += [['thread',child],['dump'],['query',first,first&255,first*31,-64],['dump']] + yield {'base':f'{base:x}','modifier':modifier,'precipitation':True,'ops':ops} + + +def biome_resources(jar): + prefix='data/minecraft/worldgen/biome/' + with zipfile.ZipFile(jar) as archive: + return {'minecraft:'+name[len(prefix):-5]:archive.read(name).decode('utf-8') for name in sorted(archive.namelist()) if name.startswith(prefix) and name.endswith('.json')} + + +def codec_corpus(biomes): + cases=list(biomes.values())+['null','false','0','[]','{}'] + template={'has_precipitation':True,'temperature':0.5,'downfall':0.5,'temperature_modifier':'none'} + tokens=['null','true','false','0','-0.0','0.1','0.15','0.2','1','-1','1.000000059604644775390625','1.000000059604644775390626','1e40','-1e40','1e1000','-1e1000','1e-1000','"none"','"frozen"','"NONE"','"minecraft:none"','"NaN"','"Infinity"','"0.1"','[]','{}'] + for key in template: + cases.append(json.dumps({k:v for k,v in template.items() if k!=key})) + for token in tokens: + cases.append('{'+','.join(json.dumps(k)+':'+(token if k==key else json.dumps(v)) for k,v in template.items())+'}') + cases += [json.dumps(dict(template,unknown={'anything':True})), + '{"has_precipitation":true,"temperature":0.2,"temperature":-0.0,"downfall":0.0}', + '{"has_precipitation":true,"temperature":0.2,"temperature":null,"downfall":0.0}'] + operations=[['query',0,y,0,63] for y in [-64,0,63,79,80,81,319]]+[['query',12345,100,-9876,63],['query',12345,100,-9876,-1000],['dump']] + for value in cases:yield {'json':value,'ops':operations} + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument("--prepare",action="store_true");args=parser.parse_args() + build=lab.LOCAL/"rust-biome-temperature-parity";build.mkdir(parents=True,exist_ok=True) + report_path=build/"report.json";report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + biomes=biome_resources(jars['server']) + if not biomes or biomes!=biome_resources(jars['client']):raise ValueError('client/server biome resources differ') + (build/'biomes.json').write_text(json.dumps(biomes,separators=(',',':')),encoding='utf-8') + oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeTemperatureOracle.java" + sources=[oracle,Path(__file__),lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock",lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml", + *sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/biome_temperature_fixture.rs"] + tested_sources=base.source_hashes(sources) + fixtures=[*corpus(),*codec_corpus(biomes)];inputs=build/"inputs.txt";inputs.write_text("".join(json.dumps(f,separators=(",",":"))+"\n" for f in fixtures),encoding="utf-8") + fixture_paths=[inputs,build/"biomes.json"];tested_fixtures=base.source_hashes(fixture_paths);classes=build/"classes";classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle],"compile-java") + run(["cargo","build","--release","-p","horizon-world","--example","biome_temperature_fixture"],"compile-rust") + metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) + binary=Path(metadata["target_directory"])/"release/examples"/("biome_temperature_fixture.exe" if os.name=="nt" else "biome_temperature_fixture") + run([binary,build],"rust") + references=[] + for side,jar in jars.items(): + reference=build/f"{side}.txt" + run(["java","-Xmx512M","-cp",os.pathsep.join([str(classes),str(jar),dependency_path]),"dev.horizonlab.parity.VanillaBiomeTemperatureOracle",side,build],side) + matched=base.compare(reference,build/"rust.txt") + references.append({"side":side,"jar_sha256":lab.digest(jar,"sha256"),"output_sha256":lab.digest(reference,"sha256"),"matched_output_lines":matched}) + print(f"{side}: {matched:,} biome-temperature output lines match Rust",flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={"schema":1,"minecraft":lock["minecraft"]["version"],"manifest_sha1":lock["minecraft"]["manifest_sha1"],"platform":platform.platform(), + "java":subprocess.check_output(["java","--version"],text=True).splitlines()[0],"rustc":subprocess.check_output(["rustc","--version"],text=True).strip(), + "fixtures":len(fixtures),"biome_resources":len(biomes),"codec_inputs":sum("json" in f for f in fixtures),"operations":sum(len(f["ops"]) for f in fixtures),"thread_isolation_fixtures":sum(any(op[0]=="thread" for op in f["ops"]) for f in fixtures), + "sources_sha256":tested_sources,"fixtures_sha256":tested_fixtures,"rust_output_sha256":lab.digest(build/"rust.txt","sha256"),"references":references, + "scope":"Actual Biome temperature methods, warm/cold/iceberg-melt predicates and precipitation selection, with both temperature modifiers and arbitrary base float bits. Native private climate/biome constructors provide explicit temperature inputs; unrelated biome fields are null and never queried. Fixed seeded simplex/stack sources, float/double conversion and arithmetic order, height adjustment and sea-level overflow, packed-position aliases, repeated queries with changed sea levels, cache capacity/order/content, NaN recomputation and eviction, and actual native thread-local isolation versus independently owned Rust workers. ClimateSettings map-codec parsing additionally covers all independently authenticated bundled biome definitions, direct float conversion, nonfinite overflow, modifier defaults/null handling, field types, duplicates and missing fields. Full biome data codecs, climate encoding, complete weather placement/freezing, material condition integration and automatic migration of shared biome instances between threads remain outside this scope."} + lab.write_json(report_path,report);print(f"Scoped biome-temperature parity passed: {report_path}") + + +if __name__=="__main__":main() diff --git a/tools/test_biome_zoom_parity.py b/tools/test_biome_zoom_parity.py new file mode 100644 index 000000000..4dc5cea0c --- /dev/null +++ b/tools/test_biome_zoom_parity.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python3 +"""Compare biome zoom, quart lookup and seed obfuscation with pinned vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import random +import subprocess +try: + from . import lab,test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + rng=random.Random(0x484f52495a4f4e42494f4d45) + seeds=[-2**63,-2**63+1,-987654321,-1,0,1,987654321,2**63-1] + for seed in seeds+[rng.randrange(-2**63,2**63) for _ in range(4096)]: + yield f's {seed}' + edges=[-2**31,-2**31+1,-2**31+2,-30000000,-17,-16,-5,-4,-3,-2,-1,0,1,2,3,4,5,15,16,17,30000000,2**31-2,2**31-1] + import itertools + for seed in seeds: + for x,y,z in itertools.product(edges,repeat=3):yield f'b {seed} {x} {y} {z}' + for x,y,z in itertools.product(range(-8,9),repeat=3):yield f'b {seed} {x} {y} {z}' + for _ in range(32768): + seed=rng.randrange(-2**63,2**63);x,y,z=[rng.randrange(-2**31,2**31) for _ in range(3)] + yield f'b {seed} {x} {y} {z}' + import struct + float_values=[float(v) for v in edges]+[-0.,0.1,-0.1,3.9999999999999996,-4.000000000000001,1e100,-1e100,float('inf'),-float('inf'),float('nan')] + bits=[struct.pack('>d',v).hex() for v in float_values]+['0000000000000001','8000000000000001','7ff0000000000001','fff8000000000000'] + for a,b,c in itertools.product(bits,repeat=3):yield f'p {a} {b} {c}' + for _ in range(32768):yield 'p '+' '.join(f'{rng.getrandbits(64):016x}' for _ in range(3)) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument("--prepare",action="store_true");args=parser.parse_args() + build=lab.LOCAL/"rust-biome-zoom-parity";build.mkdir(parents=True,exist_ok=True) + report_path=build/"report.json";report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeZoomOracle.java" + sources=[oracle,Path(__file__),lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock",lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml", + *sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-core/examples/biome_zoom_fixture.rs"] + tested_sources=base.source_hashes(sources) + fixtures=list(corpus());inputs=build/"inputs.txt";inputs.write_text("\n".join(fixtures)+"\n",encoding="utf-8") + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths);classes=build/"classes";classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle],"compile-java") + run(["cargo","build","--release","-p","horizon-core","--example","biome_zoom_fixture"],"compile-rust") + metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) + binary=Path(metadata["target_directory"])/"release/examples"/("biome_zoom_fixture.exe" if os.name=="nt" else "biome_zoom_fixture") + run([binary,build],"rust") + import hashlib + with (build/"rust.txt").open() as output: + for fixture in fixtures: + result=output.readline().strip() + if fixture.startswith('s '): + seed=int(fixture[2:]);digest=hashlib.sha256(seed.to_bytes(8,'little',signed=True)).digest() + if result!='s '+str(int.from_bytes(digest[:8],'little',signed=True)):raise AssertionError('seed SHA-256 disagrees with hashlib') + references=[] + for side,jar in jars.items(): + reference=build/f"{side}.txt" + run(["java","-Xmx512M","-cp",os.pathsep.join([str(classes),str(jar),dependency_path]),"dev.horizonlab.parity.VanillaBiomeZoomOracle",side,build],side) + matched=base.compare(reference,build/"rust.txt") + references.append({"side":side,"jar_sha256":lab.digest(jar,"sha256"),"output_sha256":lab.digest(reference,"sha256"),"matched_output_lines":matched}) + print(f"{side}: {matched:,} biome-zoom output lines match Rust",flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={"schema":1,"minecraft":lock["minecraft"]["version"],"manifest_sha1":lock["minecraft"]["manifest_sha1"],"platform":platform.platform(), + "java":subprocess.check_output(["java","--version"],text=True).splitlines()[0],"rustc":subprocess.check_output(["rustc","--version"],text=True).strip(), + "fixtures":len(fixtures),"seed_hashes":sum(f.startswith("s ") for f in fixtures),"block_queries":sum(f.startswith("b ") for f in fixtures),"position_queries":sum(f.startswith("p ") for f in fixtures), + "sources_sha256":tested_sources,"fixtures_sha256":tested_fixtures,"rust_output_sha256":lab.digest(build/"rust.txt","sha256"),"references":references, + "scope":"Actual BiomeManager seed obfuscation, block-position eight-corner jitter selection, direct block/double-to-quart queries, and source replacement preserving the zoom seed. Captured resolver coordinates are compared, including dense local grids, signed coordinate overflow, negative boundaries, distant blocks, long-seed boundaries, random seeds/positions, double infinities/NaNs/subnormals and saturating conversion. SHA-256 seed transforms are also compared against Python hashlib independently. Biome storage/source generation, blending, chunk integration and gameplay remain separate work."} + + lab.write_json(report_path,report);print(f"Scoped biome-zoom parity passed: {report_path}") + + +if __name__=="__main__":main() diff --git a/tools/test_block_properties_parity.py b/tools/test_block_properties_parity.py new file mode 100644 index 000000000..4b284f345 --- /dev/null +++ b/tools/test_block_properties_parity.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python3 +"""Compare block-definition flags and calculated solidity with pinned vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + def box(values):return [struct.pack('>d',float(v)).hex() for v in values] + shapes=[[],[[0,0,0,1,1,1]],[[0,0,0,0.1,1,0.1]],[[0,0,0,1,0.1,1]],[[0,0,0,0.01,0.01,0.01],[0.99,0.99,0.99,1,1,1]]] + threshold=0.7291666666666666 + for x in [0.0,0.125,0.5,threshold,1.0,2.0]: + for y in [0.0,1e-8,0.125,0.5,math.nextafter(1.0,0.0),1.0,math.nextafter(1.0,2.0)]: + z=3*threshold-x-y + for extent in [math.nextafter(z,-math.inf),z,math.nextafter(z,math.inf)]:shapes.append([[0,0,0,x,y,extent]]) + rng=random.Random(0x534f4c4944) + for _ in range(1000): + shape=[] + for _ in range(rng.randrange(1,5)): + low=[rng.uniform(-1,1) for _ in range(3)];high=[v+rng.choice([1e-8,1e-7,0.125,0.5,1.0,2.0]) for v in low];shape.append([*low,*high]) + shapes.append(shape) + for shape in shapes: + for on in [False,True]: + for off in [False,True]: + for cached in [False,True]: + for occludes in [False,True]:yield {'shape':[box(v) for v in shape],'on':on,'off':off,'cached':cached,'occludes':occludes} + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-block-properties-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java' + helper=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java' + sources=[oracle,helper,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/block_properties_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle,helper],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaBlockPropertiesOracle',mode,path],side+'-'+mode) + java('server','export',build) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs,build/'block-registry.nbt',build/'cached-collision.nbt',build/'block-properties.nbt'];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','block_properties_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('block_properties_fixture.exe' if os.name=='nt' else 'block_properties_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} block-properties output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'registry_states':35723,'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'All pinned block-definition force-solid, replaceability, liquid and occlusion flags and raw occlusion geometry are imported privately; Rust computes legacy solidity from cached collision shapes and solid rendering from occlusion geometry. Actual native BlockState isSolid, liquid, canOcclude, isSolidRender and no-context canBeReplaced are compared for every state, together with raw cached bounds and synthetic force-flag/cache/shape threshold combinations using the private native solidity calculator and native full-shape test. Item/fluid replacement, block support, survival, dynamic collision and full gameplay remain pending.'} + lab.write_json(report_path,report);print(f'Scoped block-properties parity passed: {report_path}') + + +if __name__=='__main__':main() diff --git a/tools/test_block_state_codec_parity.py b/tools/test_block_state_codec_parity.py new file mode 100644 index 000000000..7073f4bc8 --- /dev/null +++ b/tools/test_block_state_codec_parity.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python3 +"""Compare pinned vanilla compact/full block-state JSON codecs.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(facts): + states=facts['states'];defaults=facts['defaults'] + for state in states: + for full in [False,True]:yield [full,json.dumps(state,separators=(',',':'))] + for name,index in sorted(defaults.items()): + default=states[index] + for value in [name,name.removeprefix('minecraft:'),':'+name.removeprefix('minecraft:'),{'id':name},{'id':name,'properties':default.get('properties',{})}]: + for full in [False,True]:yield [full,json.dumps(value)] + for properties in [None,False,0,1.5,'unknown',[],[{}],{}, {'unknown':'unknown'}]: + for full in [False,True]:yield [full,json.dumps({'id':name,'properties':properties})] + for key,original in default.get('properties',{}).items(): + for value in [None,True,False,0,1.0,[],{},'',original.upper(),'unknown',original]: + changed=dict(default['properties']);changed[key]=value;changed['unknown']='ignored' + for full in [False,True]:yield [full,json.dumps({'id':name,'properties':changed})] + zeroes=[0x30,0x660,0x6f0,0x7c0,0x966,0x9e6,0xa66,0xae6,0xb66,0xbe6,0xc66,0xce6,0xd66,0xde6,0xe50,0xed0,0xf20,0x1040,0x1090,0x17e0,0x1810,0x1946,0x19d0,0x1a80,0x1a90,0x1b50,0x1bb0,0x1c40,0x1c50,0xa620,0xa8d0,0xa900,0xa9d0,0xa9f0,0xaa50,0xabf0,0xff10] + for name,key in facts['integers']: + for value in ['+0','-0','00','+01','-01','1.0','1e0',' 1','1 ','2147483647','2147483648','-2147483648','-2147483649','9'*80,'0'*80+'1','+','--1','+-1','\u00b2','\U0001d7d9',*[str(i) for i in range(-2,34)],*[chr(z)+chr(z+1) for z in zeroes]]: + for full in [False,True]:yield [full,json.dumps({'id':name,'properties':{key:value}})] + invalid=[None,False,1,[],{}, {'Name':'minecraft:stone'}, {'id':None}, {'id':True}, {'id':1}, {'id':[]}, {'id':{}},'minecraft:unknown','minecraft:',':','Minecraft:stone','minecraft:stone:foo','mine craft:stone',{'id':'minecraft:unknown','properties':{}}] + for value in invalid: + for full in [False,True]:yield [full,json.dumps(value)] + for text in ['{"id":"minecraft:stone","id":"minecraft:water"}','{"id":"minecraft:water","properties":{"level":"0","level":"1"}}','{"id":"minecraft:water","properties":{"level":"1"},"properties":null}']: + for full in [False,True]:yield [full,text] + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-block-state-codec-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/block_state_codec_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaBlockStateCodecOracle',mode,path],side+'-'+mode) + for side in jars:java(side,'export',build/f'facts-{side}.json') + facts=json.loads((build/'facts-server.json').read_text()) + if facts!=json.loads((build/'facts-client.json').read_text()):raise ValueError('client/server registry metadata differs') + if len(facts['states'])!=35723:raise ValueError('incomplete pinned state registry') + fixtures=list(corpus(facts));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs,build/'facts-client.json',build/'facts-server.json'];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','block_state_codec_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('block_state_codec_fixture.exe' if os.name=='nt' else 'block_state_codec_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} block-state codec output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'block_states':len(facts['states']),'blocks':len(facts['defaults']),'integer_properties':len(facts['integers']),'codec_inputs':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual BlockState.CODEC and FULL_CODEC, every pinned runtime block state, compact/default versus full encoding, canonical object keys, namespaces, property omission/invalid fallback, unknown fields, malformed property containers, Java integer-property parsing including signs/leading zeroes/BMP decimal digits and overflow, invalid identifiers/types, duplicate fields. Registry identities, defaults and integer property kinds are imported from both authenticated JARs and must agree. This ports codec behavior over that metadata, not block gameplay. Native warning text, arbitrary malformed JSON/unpaired surrogate text, registry lifecycle/ownership and full material-rule codecs remain pending.'} + lab.write_json(report_path,report);print(f'Scoped block-state codec parity passed: {report_path}') + + +if __name__=='__main__':main() diff --git a/tools/test_block_support_parity.py b/tools/test_block_support_parity.py new file mode 100644 index 000000000..fd7646a39 --- /dev/null +++ b/tools/test_block_support_parity.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python3 +"""Compare registered cached block support with pinned vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-block-support-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSupportOracle.java' + helper=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java' + sources=[oracle,helper,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/block_support_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle,helper],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaBlockSupportOracle',mode,path],side+'-'+mode) + java('server','export',build) + fixture_paths=[build/'block-registry.nbt',build/'cached-support.nbt'];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','block_support_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('block_support_fixture.exe' if os.name=='nt' else 'block_support_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} block-support output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'registry_states':35723,'cached_states':35524,'uncached_states':199,'support_queries':35524*18,'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'All 35,524 cached block-state support shapes are imported privately and Rust derives FULL/CENTER/RIGID face-support masks. These are compared with actual BlockState.isFaceSturdy cache results across all six directions; all 199 uncached states remain explicitly unsupported. Registry/DataVersion/kind validation, shared shape identities, exact face geometry and full-state queries are covered. Dynamic support selection, block survival and full gameplay remain pending.'} + lab.write_json(report_path,report);print(f'Scoped block-support parity passed: {report_path}') + + +if __name__=='__main__':main() diff --git a/tools/test_block_survival_parity.py b/tools/test_block_survival_parity.py new file mode 100644 index 000000000..1300d3bd8 --- /dev/null +++ b/tools/test_block_survival_parity.py @@ -0,0 +1,267 @@ +#!/usr/bin/env python3 +"""Compare initial block survival rules with pinned vanilla.""" +import argparse +import json +import itertools +import random +import struct +import os +from pathlib import Path +import platform +import subprocess +import zipfile +try: + from . import lab, test_rust_parity as base, test_worldgen_parity as worldgen +except ImportError: + import lab + import test_rust_parity as base + import test_worldgen_parity as worldgen + + +CLASS_RULES={ + 'FireBlock':'Fire', + 'CactusBlock':'Cactus', + 'PathBlock':'Path', + 'MushroomBlock':'Mushroom', + + 'MultifaceBlock':'Multiface', + 'VineBlock':'Vine', + 'HangingMossBlock':'HangingMoss', + 'SeaPickleBlock':'SeaPickle', + 'SnowLayerBlock':'SnowLayer', + + 'BellBlock':'Bell','ShelfMushroomBlock':'FullBehind', + 'GrowingPlantBlock':'GrowingPlant', + 'MangrovePropaguleBlock':'MangrovePropagule', + 'SpeleothemBlock':'Speleothem', + 'ScaffoldingBlock':'Scaffolding', + 'PistonHeadBlock':'PistonHead', + 'ChorusPlantBlock':'ChorusPlant', + 'ChorusFlowerBlock':'ChorusFlower', + 'PitcherCropBlock':'PitcherCrop', + + 'BigDripleafBlock':'BigDripleaf','BigDripleafStemBlock':'BigDripleafStem','FarmlandBlock':'Farmland','CocoaBlock':'Cocoa', + 'SugarCaneBlock':'SugarCane','SporeBlossomBlock':'SporeBlossom','FrogspawnBlock':'Frogspawn','SmallDripleafBlock':'SmallDripleaf','TallSeagrassBlock':'TallSeagrass', + 'DoorBlock':'Door', + 'BaseRailBlock':'RigidBelow','LeafLitterBlock':'FullBelow','WallSignBlock':'SolidBehind','GrindstoneBlock':'Always','RedstoneWallTorchBlock':'FullBehind','BubbleColumnBlock':'BubbleColumn','RedstoneWireBlock':'RedstoneWire','SoulFireBlock':'TagBelow:minecraft:soul_fire_base_blocks', + 'BlockBehaviour':'Always','CakeBlock':'SolidBelow','CandleCakeBlock':'SolidBelow','BannerBlock':'SolidBelow','StandingSignBlock':'SolidBelow', + 'WallBannerBlock':'SolidBehind','CarpetBlock':'NonAirBelow','MossyCarpetBlock':'MossCarpet','BaseTorchBlock':'CenterBelow','CandleBlock':'CenterBelow','LanternBlock':'Lantern', + 'HangingRootsBlock':'FullAbove','LadderBlock':'FullBehind','AmethystClusterBlock':'FullBehind','TripWireHookBlock':'FullBehind','BaseCoralWallFanBlock':'FullBehind','WallTorchBlock':'FullBehind', + 'BasePressurePlateBlock':'RigidOrCenterBelow','DiodeBlock':'RigidBelow','BaseCoralPlantTypeBlock':'FullBelow','CeilingHangingSignBlock':'CenterAbove', + 'FaceAttachedHorizontalDirectionalBlock':'FaceAttached','BambooSaplingBlock':'SupportsBamboo','BambooStalkBlock':'SupportsBamboo', +} + +VEGETATION_RULES={ + 'LilyPadBlock':'LilyPad', + 'VegetationBlock':'TagBelow:minecraft:supports_vegetation', + 'AzaleaBlock':'TagBelow:minecraft:supports_azalea', + 'DryVegetationBlock':'TagBelow:minecraft:supports_dry_vegetation', + 'NetherSproutsBlock':'TagBelow:minecraft:supports_nether_sprouts', + 'NetherWartBlock':'TagBelow:minecraft:supports_nether_wart', + 'WitherRoseBlock':'TagBelow:minecraft:supports_wither_rose', + 'CactusFlowerBlock':'CactusFlower','SeagrassBlock':'Seagrass', +} + +def bind_definitions(classes,placement,support_tags): + definitions={name:CLASS_RULES[owner] for name,owner in classes.items() if owner in CLASS_RULES} + for name,owner in classes.items(): + if owner=='CropBlock' and placement.get(name)=='CropBlock':definitions[name]='Crop' + if owner=='DoublePlantBlock' and placement.get(name)=='VegetationBlock':definitions[name]='DoublePlant' + if owner!='VegetationBlock':continue + method=placement[name] + if method in VEGETATION_RULES:definitions[name]=VEGETATION_RULES[method] + elif method in ['AttachedStemBlock','StemBlock','NetherFungusBlock','NetherRootsBlock']: + field='stemSupportBlocks' if method=='StemBlock' else 'supportBlocks' + definitions[name]='TagBelow:'+support_tags[name][field] + return definitions + + +def fluid_tag_resources(jar): + with zipfile.ZipFile(jar) as archive: + prefix='data/minecraft/tags/fluid/' + return {'minecraft:'+name[len(prefix):-5]:archive.read(name).decode('utf-8') for name in sorted(archive.namelist()) if name.startswith(prefix) and name.endswith('.json')} + + +def behavior_key(rule,value): + properties=value.get('properties',{}) + return (rule,properties.get('facing') if rule in ['FullBehind','SolidBehind','Cocoa','PistonHead','Bell'] or rule=='FaceAttached' and properties.get('face')=='wall' else None,properties.get('hanging') if rule in ['Lantern','MangrovePropagule'] else None,properties.get('bottom') if rule=='MossCarpet' else None,properties.get('face') if rule=='FaceAttached' else None,properties.get('half') if rule in ['Door','DoublePlant','SmallDripleaf','TallSeagrass','PitcherCrop'] else None,properties.get('vertical_direction') if rule=='Speleothem' else None,properties.get('type') if rule=='PistonHead' else None,value['id'] if rule in ['GrowingPlant','Speleothem'] else None,properties.get('attachment') if rule=='Bell' else None,tuple(properties.get(face) for face in ['down','up','north','south','west','east']) if rule in ['Multiface','Vine'] else None) + +def corpus(facts,definitions): + positions=[[0,0,0],[2147483647,-2147483648,2147483647],[-17,2147483647,-33]] + def case(state,neighbors,position=0,**kwargs): + f={'state':state,'neighbors':neighbors,'position':positions[position%3],'entity':'none','fail':-1,'entity_fail':-1};f.update(kwargs);return f + defaults=facts['defaults'];samples=[defaults[name] for name in ['minecraft:air','minecraft:stone','minecraft:water','minecraft:pale_moss_carpet'] if name in defaults] + representatives={} + for state,value in enumerate(facts['states']): + rule=definitions.get(value['id']) + if rule is None:continue + yield case(state,samples or [0],state,fail=0) + if rule=='Always':continue + for neighbor in [*samples,state,defaults[value['id']]]:yield case(state,[neighbor],state) + key=behavior_key(rule,value) + representatives.setdefault(key,state) + special=[defaults[name] for name in ['minecraft:shulker_box','minecraft:moving_piston','minecraft:scaffolding','minecraft:oak_slab','minecraft:stone','minecraft:air','minecraft:pale_moss_carpet','minecraft:bamboo'] if name in defaults] or [0] + for candidate in representatives.values(): + rule=definitions[facts['states'][candidate]['id']] + for neighbor in range(len(facts['states'])):yield case(candidate,[neighbor],neighbor) + extra=['big_dripleaf','big_dripleaf_stem','clay','dirt'] if rule=='BigDripleafStem' else ['oak_fence_gate','dirt','oak_trapdoor'] if rule=='Farmland' else ['farmland','dirt'] if rule in ['Crop','PitcherCrop'] else [] + neighbors=[*special,*[defaults['minecraft:'+name] for name in extra if 'minecraft:'+name in defaults]] + if rule in ['Crop','PitcherCrop']: + for brightness in [-2147483648,-1,0,7,8,9,15,2147483647]: + for neighbor in neighbors: + for fail in [-1,0]: + for light_fail in [-1,0]:yield case(candidate,[neighbor],candidate,brightness=brightness,fail=fail,light_fail=light_fail) + if rule in ['LilyPad','Frogspawn','SporeBlossom','SmallDripleaf','TallSeagrass','SugarCane']: + fluid_states=[index for index,state in enumerate(facts['states']) if state['id'] in ['minecraft:water','minecraft:lava','minecraft:air']] + supporting=[defaults['minecraft:'+name] for name in ['stone','dirt','clay','ice','big_dripleaf','small_dripleaf','tall_seagrass','sugar_cane','oak_leaves'] if 'minecraft:'+name in defaults] + for first in fluid_states: + for second in [defaults[name] for name in ['minecraft:air','minecraft:water','minecraft:lava'] if name in defaults]: + for neighbor in supporting: + for fail in [-1,0,1,4]: + for fluid_fail in [-1,0,1,3]: + yield case(candidate,[neighbor],candidate,fluid_states=[first,second],fail=fail,fluid_fail=fluid_fail) + if rule=='Fire': + air=defaults['minecraft:air'] + # An empty first support query forces the ignition lookup even when + # the subsequent neighbor has a full supporting face. + for neighbor in range(len(facts['states'])): + yield case(candidate,[air,neighbor],neighbor) + if rule=='Mushroom': + for brightness in [-2147483648,0,12,13,14,2147483647]: + for neighbor in range(len(facts['states'])): + yield case(candidate,[neighbor],neighbor,brightness=brightness) + for neighbor in range(0,len(facts['states']),7): + for fail in [-1,0]: + yield case(candidate,[neighbor],neighbor,brightness=12,fail=fail,light_fail=0) + if rule=='Cactus': + air=defaults['minecraft:air'];cactus=defaults['minecraft:cactus'] + for neighbor in range(len(facts['states'])): + yield case(candidate,[air,air,air,air,cactus,neighbor],neighbor,fluid_states=[air]) + supports=[defaults['minecraft:'+name] for name in ['air','sand','red_sand','cactus','stone'] if 'minecraft:'+name in defaults] + fluid_states=[index for index,state in enumerate(facts['states']) if state['id'] in ['minecraft:air','minecraft:water','minecraft:lava']] + for support in supports: + for fluid in fluid_states: + for slot in range(4): + fluids=[air]*4;fluids[slot]=fluid + for fail in [-1,*range(6)]: + for fluid_fail in [-1,*range(4)]: + yield case(candidate,[air,air,air,air,support,air],slot,fluid_states=fluids,fail=fail,fluid_fail=fluid_fail) + if rule in ['Multiface','Vine','HangingMoss','SnowLayer','SeaPickle']: + shulkers=[index for index,state in enumerate(facts['states']) if state['id']=='minecraft:shulker_box'] + for neighbor in shulkers: + for old,current in [(0,0),(0,1),(1,0),(0.1,0.2),(0.7,0.8),(1,1)]: + for entity in ['closed','opened']: + for entity_fail in [-1,0,1,2,3]: + yield case(candidate,[neighbor],candidate,entity=entity,entity_fail=entity_fail,shulker_progress=[struct.pack('>f',v).hex() for v in [old,current]]) + if rule in ['ChorusPlant','ChorusFlower','Scaffolding','Multiface','Vine','HangingMoss','SnowLayer','SeaPickle','Fire','Cactus']: + # Long read sequences expose directional order, early exits and failures + # beyond the two alternating neighbors used by the general corpus. + names=['air','stone','end_stone','chorus_plant','chorus_flower','vine','pale_hanging_moss','shulker_box','scaffolding','oak_slab','oak_planks','sand','cactus','water'] + palette=[defaults['minecraft:'+name] for name in names if 'minecraft:'+name in defaults] + if rule=='Scaffolding': + palette.extend(index for index,state in enumerate(facts['states']) if state['id']=='minecraft:scaffolding') + rng=random.Random(0x484f52495a4f4e+candidate) + sequences=(tuple(rng.choice(palette) for _ in range(10)) for _ in range(4096 if rule in ["ChorusPlant","ChorusFlower","Scaffolding"] else 512)) + for index,sequence in enumerate(sequences): + for fail in [-1,*range(10)]:yield case(candidate,list(sequence),index,fail=fail) + if rule in ['ChorusPlant','ChorusFlower']: + for index,sequence in enumerate(itertools.product(palette[:5],repeat=5)): + yield case(candidate,list(sequence),index) + for first in neighbors: + for second in neighbors: + for fail in [-1,0,1]: + for entity_fail in [-1,0]: + for entity in ['none','closed','opened']:yield case(candidate,[first,second],candidate,fail=fail,entity_fail=entity_fail,entity=entity) + + +def save_checkpoint(path, checkpoint): + temporary=path.with_suffix('.tmp') + temporary.write_text(json.dumps(checkpoint,indent=2)+'\n',encoding='utf-8') + temporary.replace(path) + + +def load_checkpoint(path, sources, environment): + if not path.exists():return None + checkpoint=json.loads(path.read_text(encoding='utf-8')) + if checkpoint.get('schema')!=1 or checkpoint['sources_sha256']!=sources or checkpoint['environment']!=environment: + raise ValueError('checkpoint source/environment changed; run again without --resume') + for group in ['fixtures_sha256','artifacts_sha256']: + for name,digest in checkpoint[group].items(): + artifact=Path(name) + if not artifact.is_file() or lab.digest(artifact,'sha256')!=digest: + raise ValueError(f'checkpoint artifact changed: {artifact}; run again without --resume') + return checkpoint + + +def main(): + parser=argparse.ArgumentParser(description=__doc__) + parser.add_argument('--prepare',action='store_true') + parser.add_argument('--resume',action='store_true',help='Reuse completed stages only when all recorded input and executable hashes still match') + args=parser.parse_args() + build=lab.LOCAL/'rust-block-survival-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + checkpoint_path=build/'run-state.json' + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSurvivalOracle.java' + helpers=[oracle.with_name(name+'.java') for name in ['VanillaBlockPropertiesOracle','VanillaBlockSupportOracle','VanillaBlockStateCodecOracle','VanillaCollisionOracle','VanillaHeightmapOracle']] + sources=[oracle,*helpers,lab.ROOT/'tools/test_worldgen_parity.py',Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/block_survival_fixture.rs'] + tested_sources=base.source_hashes(sources) + environment={'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'dependencies':{str(path):lab.digest(path,'sha256') for path in [*jars.values(),*libraries]}} + checkpoint=load_checkpoint(checkpoint_path,tested_sources,environment) if args.resume else None + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:subprocess.run(list(map(str,command)),cwd=lab.ROOT,check=True,stdout=log,stderr=subprocess.STDOUT,timeout=3600) + dependency_path=os.pathsep.join(map(str,libraries)) + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaBlockSurvivalOracle',mode,path],side+'-'+mode) + if checkpoint is None: + checkpoint_path.unlink(missing_ok=True) + tags=worldgen.tag_resources(jars['server']) + if tags!=worldgen.tag_resources(jars['client']):raise ValueError('client/server tags differ') + (build/'tags.json').write_text(json.dumps(tags,separators=(',',':'))) + fluid_tags=fluid_tag_resources(jars['server']) + if fluid_tags!=fluid_tag_resources(jars['client']):raise ValueError('client/server fluid tags differ') + (build/'fluid-tags.json').write_text(json.dumps(fluid_tags,separators=(',',':'))) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle,*helpers],'compile-java') + java('server','export',build) + facts=json.loads((build/'facts.json').read_text());definition_classes=json.loads((build/'survival-classes.json').read_text()) + definitions=bind_definitions(definition_classes,json.loads((build/'survival-placement-classes.json').read_text()),json.loads((build/'survival-support-tags.json').read_text())) + if len(facts['states'])!=35723:raise ValueError('incomplete pinned registry') + if len(definitions)!=len(facts['defaults']):raise ValueError('incomplete pinned survival definitions') + (build/'survival-rules.json').write_text(json.dumps(definitions,separators=(',',':'))) + inputs=build/'inputs.txt';fixture_count=0 + with inputs.open('w',encoding='utf-8') as output: + for fixture in corpus(facts,definitions): + output.write(json.dumps(fixture,separators=(',',':'))+'\n');fixture_count+=1 + fixture_paths=[inputs,build/'survival-extra-definitions.json',build/'fluid-tags.json',build/'survival-placement-classes.json',build/'survival-support-tags.json',build/'facts.json',build/'survival-classes.json',build/'survival-rules.json',build/'tags.json',build/'block-registry.nbt',build/'cached-collision.nbt',build/'block-properties.nbt',build/'cached-support.nbt'] + tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','block_survival_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('block_survival_fixture.exe' if os.name=='nt' else 'block_survival_fixture') + base.ensure_sources_unchanged(sources,tested_sources) + checkpoint={'schema':1,'environment':environment,'sources_sha256':tested_sources,'fixtures_sha256':{str(lab.ROOT/name):digest for name,digest in tested_fixtures.items()},'artifacts_sha256':{str(path):lab.digest(path,'sha256') for path in [binary,*sorted(classes.rglob('*.class'))]},'binary':str(binary),'counts':{'supported_blocks':len(definitions),'supported_states':sum(state['id'] in definitions for state in facts['states']),'survival_rules':len(set(definitions.values())),'survival_rule_kinds':len({rule.split(':',1)[0] for rule in definitions.values()}),'fluid_tag_files':len(fluid_tags),'fixtures':fixture_count},'outputs':{}} + save_checkpoint(checkpoint_path,checkpoint) + print('Verified inputs and compiled executables checkpointed',flush=True) + def stage(name, action): + output=build/(name+'.txt') + previous=checkpoint['outputs'].get(name) + if previous is None or not output.exists() or lab.digest(output,'sha256')!=previous: + action() + checkpoint['outputs'][name]=lab.digest(output,'sha256') + save_checkpoint(checkpoint_path,checkpoint) + print(f'{name}: completed output checkpointed',flush=True) + stage('rust',lambda:run([checkpoint['binary'],build],'rust')) + references=[] + for side,jar in jars.items(): + stage(side,lambda:java(side,side,build)) + reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} block-survival output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources) + load_checkpoint(checkpoint_path,tested_sources,environment) + report={'schema':1,**{key:value for key,value in environment.items() if key!='dependencies'},**checkpoint['counts'],'sources_sha256':tested_sources,'fixtures_sha256':{str(Path(name).relative_to(lab.ROOT)):digest for name,digest in checkpoint['fixtures_sha256'].items()},'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Version-pinned block survival rules are assigned from privately inspected native definition classes and executed in Rust against solid/air/tag tests and unified support geometry. Actual native canSurvive evaluates every supported candidate state, each neighbor state against behavior representatives, changing repeated reads, world-coordinate wrapping, absent/closed/open shulker snapshots, brightness thresholds, independent fluid state sequences and block/entity/light/fluid query failures. All pinned survival families are included; full block placement/update behavior, world/entity lifecycle and full gameplay remain pending.'} + lab.write_json(report_path,report);print(f'Scoped block-survival parity passed: {report_path}') + + +if __name__=='__main__':main() diff --git a/tools/test_bulk_section_parity.py b/tools/test_bulk_section_parity.py new file mode 100644 index 000000000..414613067 --- /dev/null +++ b/tools/test_bulk_section_parity.py @@ -0,0 +1,93 @@ +#!/usr/bin/env python3 +"""Compare resident bulk-section caching, raw mutations and unchanged heightmaps.""" +import argparse +from collections import Counter +import json +import os +from pathlib import Path +import platform +import random +import subprocess + +try: + from . import lab, test_rust_parity as base, test_worldgen_parity as worldgen +except ImportError: + import lab + import test_rust_parity as base + import test_worldgen_parity as worldgen + + +def corpus(facts): + ids=facts['defaults'];count=len(facts['states']);rng=random.Random(6541) + for minimum in [-2032,-64,0,1968]: + for prime in [False,True]: + ops=[] + for x,y,z in [[0,minimum,0],[0,minimum+16,0],[16,minimum+31,-1],[-1,minimum+63,16],[0,minimum-1,0],[2147483647,2147483647,-2147483648],[1600,minimum,1600]]: + ops += [['has',x,y,z],['get',x,y,z],['set',x,y,z,ids['minecraft:cave_air']],['get',x,y,z],['world',x,y,z]] + selected=range(count) if minimum==-64 else [rng.randrange(count) for _ in range(64)] + for state in selected: + ops += [['set',0,minimum+1,0,state],['get',0,minimum+1,0],['world',0,minimum+1,0]] + for state in [ids['minecraft:air'],ids['minecraft:stone'],ids['minecraft:void_air'],ids['minecraft:cave_air']]: + ops += [['set',1,minimum+48,1,state],['get',1,minimum+48,1],['world',1,minimum+48,1],['height','WORLD_SURFACE',1,1]] + # These X positions alias in the native 22-bit packed section key. + for x in [0,67108864,0]: + ops += [['set',x,minimum+2,0,ids['minecraft:stone']],['get',x,minimum+2,0],['world',x,minimum+2,0]] + ops += [['reset']] + for x in [67108864,0,67108864]: + ops += [['set',x,minimum+2,0,ids['minecraft:water']],['get',x,minimum+2,0],['world',x,minimum+2,0]] + yield {'min':minimum,'height':64,'prime':prime,'chunks':[[0,0],[1,-1],[-1,1],[4194304,0]],'ops':ops} + + +def main(): + parser=argparse.ArgumentParser(description=__doc__) + parser.add_argument("--prepare",action="store_true") + args=parser.parse_args() + build=lab.LOCAL/"rust-bulk-section-parity";build.mkdir(parents=True,exist_ok=True) + report_path=build/"report.json";report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + tags=worldgen.tag_resources(jars["server"]) + if not tags or tags!=worldgen.tag_resources(jars["client"]):raise ValueError("client/server block tags differ or are empty") + oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBulkSectionOracle.java" + helper=oracle.with_name("VanillaHeightmapOracle.java") + sources=[oracle,helper,Path(__file__),lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock", + lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml", + *sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/bulk_section_fixture.rs"] + tested_sources=base.source_hashes(sources) + classes=build/"classes";classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle,helper],"compile-java") + def java(side,mode,path): + run(["java","-Xmx1G","-cp",os.pathsep.join([str(classes),str(jars[side]),dependency_path]),"dev.horizonlab.parity.VanillaBulkSectionOracle",mode,path],side+"-"+mode) + for side in jars:java(side,"export",build/f"facts-{side}.json") + facts=json.loads((build/"facts-server.json").read_text()) + if facts!=json.loads((build/"facts-client.json").read_text()):raise ValueError("client/server state facts differ") + if len(facts["states"])!=35723:raise ValueError("incomplete pinned state table") + fixtures=list(corpus(facts));inputs=build/"inputs.txt" + inputs.write_text("".join(json.dumps(value,separators=(",",":"))+"\n" for value in fixtures),encoding="utf-8") + (build/"tags.json").write_text(json.dumps(tags,separators=(",",":")),encoding="utf-8") + fixture_paths=[inputs,build/"tags.json",build/"facts-client.json",build/"facts-server.json"] + tested_fixtures=base.source_hashes(fixture_paths) + run(["cargo","build","--release","-p","horizon-world","--example","bulk_section_fixture"],"compile-rust") + metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) + binary=Path(metadata["target_directory"])/"release/examples"/("bulk_section_fixture.exe" if os.name=="nt" else "bulk_section_fixture") + run([binary,build],"rust") + references=[] + for side,jar in jars.items(): + java(side,side,build) + reference=build/f"{side}.txt";matched=base.compare(reference,build/"rust.txt") + references.append({"side":side,"jar_sha256":lab.digest(jar,"sha256"),"output_sha256":lab.digest(reference,"sha256"),"matched_output_lines":matched}) + print(f"{side}: {matched:,} bulk-section output lines match Rust",flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={"schema":1,"minecraft":lock["minecraft"]["version"],"manifest_sha1":lock["minecraft"]["manifest_sha1"],"platform":platform.platform(), + "java":subprocess.check_output(["java","--version"],text=True).splitlines()[0],"rustc":subprocess.check_output(["rustc","--version"],text=True).strip(), + "block_states":len(facts["states"]),"block_tag_files":len(tags),"fixtures":len(fixtures),"resident_chunks_per_fixture":4,"operations":dict(Counter(op[0] for f in fixtures for op in f["ops"])), + "sources_sha256":tested_sources,"fixtures_sha256":tested_fixtures,"rust_output_sha256":lab.digest(build/"rust.txt","sha256"),"references":references, + "scope":"Actual BulkSectionAccess over resident ProtoChunks: raw reads/writes, all-air chunk-read collapse, outside-height AIR, absent sections, missing neighbors, packed-key caching and aliasing, cache reset and complete final raw sections/heightmap words. Every pinned block state is inserted and read with both preprimed and lazy heightmaps. Rust holds an exclusive region borrow instead of Java section acquire/release locks. Concurrent ownership, ordinary ore geometry, region side effects and complete gameplay remain pending."} + + lab.write_json(report_path,report);print(f"Scoped bulk-section parity passed: {report_path}") + + +if __name__=="__main__":main() diff --git a/tools/test_canyon_carver_parity.py b/tools/test_canyon_carver_parity.py new file mode 100644 index 000000000..81d281a4c --- /dev/null +++ b/tools/test_canyon_carver_parity.py @@ -0,0 +1,89 @@ +#!/usr/bin/env python3 +"""Compare decoded canyon paths, height-dependent widths and random state with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import random +import subprocess +try: + from . import lab,test_rust_parity as base,test_worldgen_parity as worldgen +except ImportError: + import lab + import test_rust_parity as base + import test_worldgen_parity as worldgen + + +def corpus(resources): + encode=lambda value:json.dumps(value,separators=(',',':')) + wrap=lambda value:((value+2**31)%2**32)-2**31 + config=next(json.loads(raw) for raw in resources.values() if json.loads(raw)['type']=='minecraft:canyon') + for context in [[-64,384,63],[0,128,32],[-2032,4064,0],[0,16,8]]: + for legacy in [False,True]: + for seed in [0,1,2,3,17,-1,-987654321,0x123456789abcdef]: + for cx,cz,dx,dz in [(0,0,0,0),(-1,2,1,-1),(107,-59,-4,3),(1875000,-1875000,0,0),(-2**31,2**31-1,0,0),(0,0,8,-8)]: + yield {'definition':encode(config),'context':context,'legacy':legacy,'seed':seed,'target':[cx,cz],'origin':[wrap(cx+dx),wrap(cz+dz)],'repeats':2,'fail':-1} + for mode in range(32): + shape={**config['shape'],'width_smoothness':[1,2,3,2**31-1][mode%4], + 'vertical_radius_center_factor':[-1,0,0.5,2][mode%4], + 'distance_factor':[-1,0,0.001,0.5,1,2,4,0.75][mode%8], + 'horizontal_radius_factor':[0,0.1,1,3][mode%4], + 'thickness':[-1,0,1,6][mode%4],'y_scale':[-1,0,1,4][mode%4]} + custom={**config,'shape':shape,'vertical_rotation':[-0.5,0,0.5,1][mode%4],'y':{'absolute':40}} + yield {'definition':encode(custom),'context':[-64,384,63],'legacy':bool(mode%2),'seed':mode*971,'target':[0,0],'origin':[0,0],'repeats':2,'fail':[-1,0,1,63][mode//8]} + bad=[None,False,0,[],{}, {'type':'missing'}, {**config,'type':':canyon'}] + for field in config: + bad.append({k:v for k,v in config.items() if k!=field}) + for value in [None,False,[],{},'0']:bad.append({**config,field:value}) + for field in config['shape']: + bad.append({**config,'shape':{k:v for k,v in config['shape'].items() if k!=field}}) + for value in [None,False,[],{},'0']:bad.append({**config,'shape':{**config['shape'],field:value}}) + for value in [-1,-0.0,0,1,2,1e100,-1e100,-1e-100]:bad.append({**config,'probability':value}) + for value in [-1,0,1,2**31-1,4294967296]:bad.append({**config,'shape':{**config['shape'],'width_smoothness':value}}) + for value in bad: + yield {'definition':encode(value),'context':[-64,384,63],'legacy':False,'seed':0,'target':[0,0],'origin':[0,0],'repeats':1,'fail':63} + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument("--prepare",action="store_true");args=parser.parse_args() + build=lab.LOCAL/"rust-canyon-carver-parity";build.mkdir(parents=True,exist_ok=True) + report_path=build/"report.json";report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCanyonCarverOracle.java" + helper=oracle.with_name("VanillaAnchorOracle.java") + sources=[oracle,helper,Path(__file__),lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock",lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml", + *sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/canyon_carver_fixture.rs"] + tested_sources=base.source_hashes(sources) + resources=worldgen.registry_resources(jars['server'],'carver') + if not resources or resources!=worldgen.registry_resources(jars['client'],'carver'):raise ValueError('reference carver resources differ') + resources_path=build/'carvers.json';resources_path.write_text(json.dumps(resources,separators=(',',':')),encoding='utf-8') + fixtures=list(corpus(resources));inputs=build/"inputs.txt";inputs.write_text("".join(json.dumps(f,separators=(",",":"))+"\n" for f in fixtures),encoding="utf-8") + fixture_paths=[inputs,resources_path];tested_fixtures=base.source_hashes(fixture_paths);classes=build/"classes";classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle,helper],"compile-java") + run(["cargo","build","--release","-p","horizon-world","--example","canyon_carver_fixture"],"compile-rust") + metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) + binary=Path(metadata["target_directory"])/"release/examples"/("canyon_carver_fixture.exe" if os.name=="nt" else "canyon_carver_fixture") + run([binary,build],"rust") + references=[] + for side,jar in jars.items(): + reference=build/f"{side}.txt" + run(["java","-Xmx512M","-cp",os.pathsep.join([str(classes),str(jar),dependency_path]),"dev.horizonlab.parity.VanillaCanyonCarverOracle",side,build],side) + matched=base.compare(reference,build/"rust.txt") + references.append({"side":side,"jar_sha256":lab.digest(jar,"sha256"),"output_sha256":lab.digest(reference,"sha256"),"matched_output_lines":matched}) + print(f"{side}: {matched:,} canyon-carver output lines match Rust",flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={"schema":1,"minecraft":lock["minecraft"]["version"],"manifest_sha1":lock["minecraft"]["manifest_sha1"],"platform":platform.platform(), + "java":subprocess.check_output(["java","--version"],text=True).splitlines()[0],"rustc":subprocess.check_output(["rustc","--version"],text=True).strip(), + "fixtures":len(fixtures),"carve_attempts":sum(f["repeats"] for f in fixtures),"bundled_canyon_definitions":1, + "sources_sha256":tested_sources,"fixtures_sha256":tested_fixtures,"rust_output_sha256":lab.digest(build/"rust.txt","sha256"),"references":references, + "scope":"Actual WorldCarver.DIRECT_CODEC, CanyonWorldCarver.isStartChunk and CanyonWorldCarver.carve using the independently authenticated bundled canyon definition. Compares ordered output cells including duplicates, partial output failures, resulting mask intervals and subsequent random longs across repeated invocations. Covers both outer random modes, local legacy streams, height-dependent width factors, horizontal/vertical radius variation, four generation heights, negative/distant/extreme coordinates and adjacent/far origin chunks. Custom shapes exercise width smoothness, path length, degenerate radii and failure branches; malformed selected codec fields are tested. Gaussian/weighted provider codecs, neighbor-carver seeding/biome selection, blending and complete worlds remain outside this scope. Rust bounds paths to 4096 steps, height to 4064 and total candidates to 2^24 per invocation."} + + lab.write_json(report_path,report);print(f"Scoped canyon-carver parity passed: {report_path}") + + +if __name__=="__main__":main() diff --git a/tools/test_carving_geometry_parity.py b/tools/test_carving_geometry_parity.py new file mode 100644 index 000000000..0ad9e6da0 --- /dev/null +++ b/tools/test_carving_geometry_parity.py @@ -0,0 +1,96 @@ +#!/usr/bin/env python3 +"""Compare shared cave/canyon geometry and path reachability with pinned vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import random +import subprocess +import struct +import math +try: + from . import lab,test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def bits(value): + return struct.pack('>d',value).hex() + + +def corpus(): + rng=random.Random(0x484f52495a4f4e454c4c4950) + wrap=lambda value:((value+2**31)%2**32)-2**31 + for cx,cz in [(0,0),(-1,2),(1875000,-1875000),(-2**31,2**31-1),(134217727,-134217728)]: + bx,bz=wrap(cx<<4),wrap(cz<<4) + for minimum,height in [(-64,384),(0,128),(-2032,4064)]: + ellipsoids=[] + for index in range(16): + center=[bx+rng.uniform(-8,24),rng.uniform(minimum-8,minimum+height+8),bz+rng.uniform(-8,24)] + horizontal=[0.1,1,4,8,16,32,64,0][index%8] + vertical=[0.1,0.5,1,4,32,64,512,0][index%8] + ellipsoids.append({'center':list(map(bits,center)),'horizontal':bits(horizontal),'vertical':bits(vertical),'skip':index%4,'fail':[-1,0,1,63][index//4]}) + # Exact boundary and IEEE inputs, bounded by real output height. + for index,value in enumerate([0.,-0.,-1.,math.inf,-math.inf,math.nan,2**31,-2**31,1e300,5e-324]): + ellipsoids += [ + {'center':list(map(bits,[bx+8,minimum+height/2,bz+8])),'horizontal':bits(value),'vertical':bits(4),'skip':index%4,'fail':63}, + {'center':list(map(bits,[bx+8,minimum+height/2,bz+8])),'horizontal':bits(4),'vertical':bits(value),'skip':index%4,'fail':63}, + {'center':list(map(bits,[value,minimum+height/2,bz+8])),'horizontal':bits(4),'vertical':bits(4),'skip':index%4,'fail':63}] + yield {'chunk':[cx,cz],'min':minimum,'max':minimum+height-1,'ellipsoids':ellipsoids} + + +def reach_corpus(): + rng=random.Random(0x434152565245414348) + wrap=lambda value:((value+2**31)%2**32)-2**31 + fbits=lambda value:struct.pack('>f',value).hex() + for cx,cz in [(0,0),(-1,2),(1875000,-1875000),(-2**31,2**31-1)]: + bx,bz=wrap(cx<<4)+8,wrap(cz<<4)+8 + for thickness in [0,1,-18,-20,math.inf,-math.inf,math.nan,1e30,0.00001]: + for dx in [0,1,18,19,100,math.inf,-math.inf,math.nan]: + for start,end in [(0,0),(0,112),(111,112),(-2**31,2**31-1),(2**31-1,-2**31)]: + yield [cx,cz,bits(bx+dx),bits(bz+dx),start,end,fbits(thickness)] + for _ in range(1024): + yield [cx,cz,bits(bx+rng.uniform(-300,300)),bits(bz+rng.uniform(-300,300)),rng.randrange(-100,100),rng.randrange(-100,100),fbits(rng.uniform(-20,50))] + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument("--prepare",action="store_true");args=parser.parse_args() + build=lab.LOCAL/"rust-carving-geometry-parity";build.mkdir(parents=True,exist_ok=True) + report_path=build/"report.json";report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCarvingGeometryOracle.java" + sources=[oracle,Path(__file__),lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock",lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml", + *sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/carving_geometry_fixture.rs"] + tested_sources=base.source_hashes(sources) + fixtures=list(corpus());inputs=build/"inputs.txt";inputs.write_text("".join(json.dumps(f,separators=(",",":"))+"\n" for f in fixtures),encoding="utf-8") + reach=list(reach_corpus());reach_path=build/'reach.txt';reach_path.write_text(''.join(json.dumps(q,separators=(',',':'))+'\n' for q in reach),encoding='utf-8') + fixture_paths=[inputs,reach_path];tested_fixtures=base.source_hashes(fixture_paths);classes=build/"classes";classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle],"compile-java") + run(["cargo","build","--release","-p","horizon-world","--example","carving_geometry_fixture"],"compile-rust") + metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) + binary=Path(metadata["target_directory"])/"release/examples"/("carving_geometry_fixture.exe" if os.name=="nt" else "carving_geometry_fixture") + run([binary,build],"rust") + references=[] + for side,jar in jars.items(): + reference=build/f"{side}.txt" + run(["java","-Xmx512M","-cp",os.pathsep.join([str(classes),str(jar),dependency_path]),"dev.horizonlab.parity.VanillaCarvingGeometryOracle",side,build],side) + matched=base.compare(reference,build/"rust.txt") + references.append({"side":side,"jar_sha256":lab.digest(jar,"sha256"),"output_sha256":lab.digest(reference,"sha256"),"matched_output_lines":matched}) + print(f"{side}: {matched:,} carving-geometry output lines match Rust",flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={"schema":1,"minecraft":lock["minecraft"]["version"],"manifest_sha1":lock["minecraft"]["manifest_sha1"],"platform":platform.platform(), + "java":subprocess.check_output(["java","--version"],text=True).splitlines()[0],"rustc":subprocess.check_output(["rustc","--version"],text=True).strip(), + "fixtures":len(fixtures),"ellipsoids":sum(len(f["ellipsoids"]) for f in fixtures),"reach_queries":len(reach), + "sources_sha256":tested_sources,"fixtures_sha256":tested_fixtures,"rust_output_sha256":lab.digest(build/"rust.txt","sha256"),"references":references, + "scope":"Actual WorldCarver.carveEllipsoid and canReach methods. Compares ordered normalized-coordinate skip queries, output cells, partial output on callback failure and resulting mask column runs; canReach includes Java float thickness arithmetic and signed step overflow. Corpus covers negative/extreme/distant chunk coordinates, output-height clipping, small/large/zero/negative radii, boundaries and IEEE NaNs/infinities/subnormals. NaN trace values are canonicalized. This validates shared geometric primitives, not randomized cave/canyon paths, codecs, provider sampling, biome carver selection or complete worlds."} + + lab.write_json(report_path,report);print(f"Scoped carving-geometry parity passed: {report_path}") + + +if __name__=="__main__":main() diff --git a/tools/test_carving_mask_parity.py b/tools/test_carving_mask_parity.py new file mode 100644 index 000000000..a3d4e375c --- /dev/null +++ b/tools/test_carving_mask_parity.py @@ -0,0 +1,89 @@ +#!/usr/bin/env python3 +"""Compare packed carving-mask runs, callback mutations and failure state with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import random +import subprocess +try: + from . import lab,test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + rng=random.Random(0x484f52495a4f4e4341525645) + carve=lambda x,y,z:{'kind':'carve','pos':[x,y,z]} + fill=lambda x0,x1,y0,y1,z0,z1:{'kind':'fill','box':[x0,x1,y0,y1,z0,z1]} + visit=lambda fail=-1,add=None:{'kind':'visit','fail':fail,'add':add or {}} + wrap=lambda value:((value+2**31)%2**32)-2**31 + for minimum,height in [(0,1),(-1,2),(-64,3),(-64,63),(0,64),(10,65),(-64,384),(-2032,4064),(-2**31,65),(2**31-65,65)]: + maximum=minimum+height-1 + # Isolated cells, duplicate insertions, packed word/column boundaries, + # Java-wrapped coordinate aliases, negative indices and positive growth. + ops=[visit(),{'kind':'read'}] + points=[[0,minimum,0],[15,maximum,15],[0,maximum,0],[0,minimum,1],[1,minimum,0]] + points += [[rng.randrange(16),minimum+rng.randrange(height),rng.randrange(16)] for _ in range(512)] + for x in [-2**31,-2**31+1,-268435456,-1,0,15,16,2**31-1]: + for y in [wrap(minimum-1),minimum,maximum,wrap(maximum+1)]: + for z in [-17,-1,0,16,17]: + index=wrap(wrap(y-minimum)+wrap(wrap(z+wrap(x<<4))*height)) + if index<0 or index<2**20:points.append([x,y,z]) + for i,(x,y,z) in enumerate(points): + ops += [carve(x,y,z)] + if i%97==0:ops += [visit()] + ops += [visit(0),visit(63),visit(),{'kind':'read'}] + yield {'min':minimum,'max':maximum,'ops':ops} + # Runs spanning all columns and word boundaries, duplicate dense writes. + yield {'min':minimum,'max':maximum,'ops':[fill(0,15,minimum,maximum,0,15),visit(),fill(0,1,minimum,maximum,0,1),{'kind':'read'}]} + if height>=3: + # Mutation behind/ahead of the cursor, extending its current run, + # joining runs, and a failing visitor retaining its added bits. + yield {'min':minimum,'max':maximum,'ops':[ + carve(0,minimum,1),carve(0,minimum+2,1),carve(2,minimum,0), + visit(-1,{'0':[[0,minimum,0],[0,minimum+1,1],[0,minimum+2,1],[1,maximum,0]],'1':[[3,maximum,15]],'2':[[4,minimum,1]]}), + visit(0,{'0':[[5,maximum,1]]}),{'kind':'read'},visit()]} + + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument("--prepare",action="store_true");args=parser.parse_args() + build=lab.LOCAL/"rust-carving-mask-parity";build.mkdir(parents=True,exist_ok=True) + report_path=build/"report.json";report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCarvingMaskOracle.java" + sources=[oracle,Path(__file__),lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock",lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml", + *sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/carving_mask_fixture.rs"] + tested_sources=base.source_hashes(sources) + fixtures=list(corpus());inputs=build/"inputs.txt";inputs.write_text("".join(json.dumps(f,separators=(",",":"))+"\n" for f in fixtures),encoding="utf-8") + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths);classes=build/"classes";classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle],"compile-java") + run(["cargo","build","--release","-p","horizon-world","--example","carving_mask_fixture"],"compile-rust") + metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) + binary=Path(metadata["target_directory"])/"release/examples"/("carving_mask_fixture.exe" if os.name=="nt" else "carving_mask_fixture") + run([binary,build],"rust") + references=[] + for side,jar in jars.items(): + reference=build/f"{side}.txt" + run(["java","-Xmx512M","-cp",os.pathsep.join([str(classes),str(jar),dependency_path]),"dev.horizonlab.parity.VanillaCarvingMaskOracle",side,build],side) + matched=base.compare(reference,build/"rust.txt") + references.append({"side":side,"jar_sha256":lab.digest(jar,"sha256"),"output_sha256":lab.digest(reference,"sha256"),"matched_output_lines":matched}) + print(f"{side}: {matched:,} carving-mask output lines match Rust",flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={"schema":1,"minecraft":lock["minecraft"]["version"],"manifest_sha1":lock["minecraft"]["manifest_sha1"],"platform":platform.platform(), + "java":subprocess.check_output(["java","--version"],text=True).splitlines()[0],"rustc":subprocess.check_output(["rustc","--version"],text=True).strip(), + "fixtures":len(fixtures),"operations":sum(len(f["ops"]) for f in fixtures), + "sources_sha256":tested_sources,"fixtures_sha256":tested_fixtures,"rust_output_sha256":lab.digest(build/"rust.txt","sha256"),"references":references, + "scope":"Actual CarvingMask construction, carve, isEmpty and visit methods. Compares packed vertical-run traversal, splitting across columns, dense/sparse masks, duplicate writes, word boundaries, coordinate overflow and positive aliases, negative index failures, callback additions during traversal and mutations retained after visitor failures. Rust bounds height to 1..4064 and positive index growth to 2^24 bits; corpus indices remain below 2^20. This validates masks, not cave/canyon generation, mask application, aquifers, blending or complete terrain generation."} + + lab.write_json(report_path,report);print(f"Scoped carving-mask parity passed: {report_path}") + + +if __name__=="__main__":main() diff --git a/tools/test_cave_carver_parity.py b/tools/test_cave_carver_parity.py new file mode 100644 index 000000000..863dd15d4 --- /dev/null +++ b/tools/test_cave_carver_parity.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python3 +"""Compare decoded cave-carver paths, ordered mask writes and random state with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import random +import subprocess +try: + from . import lab,test_rust_parity as base,test_worldgen_parity as worldgen +except ImportError: + import lab + import test_rust_parity as base + import test_worldgen_parity as worldgen + + +def corpus(resources): + encode=lambda value:json.dumps(value,separators=(',',':')) + wrap=lambda value:((value+2**31)%2**32)-2**31 + configs=[(name,json.loads(raw)) for name,raw in sorted(resources.items()) if json.loads(raw)['type']=='minecraft:cave'] + for name,config in configs: + context=[0,128,32] if 'nether' in name else [-64,384,63] + for legacy in [False,True]: + for seed in [0,1,2,3,17,-1,-987654321,0x123456789abcdef]: + for cx,cz,dx,dz in [(0,0,0,0),(-1,2,1,-1),(107,-59,-4,3),(1875000,-1875000,0,0),(-2**31,2**31-1,0,0),(0,0,8,-8)]: + yield {'definition':encode(config),'context':context,'legacy':legacy,'seed':seed,'target':[cx,cz],'origin':[wrap(cx+dx),wrap(cz+dz)],'repeats':2,'fail':-1} + for mode in range(12): + custom={**config,'count':3,'thickness':6 if mode%3==0 else 1,'weird_thickness_bias':bool(mode%2),'y':{'absolute':40},'floor_level':[-1,-0.7,0,1][mode%4]} + yield {'definition':encode(custom),'context':context,'legacy':bool(mode%2),'seed':mode*971,'target':[0,0],'origin':[0,0],'repeats':2,'fail':[-1,0,1,63][mode//3]} + base={**configs[0][1],'count':0} + bad=[None,False,0,[],{}, {'type':'missing'}, {**base,'type':':cave'}] + for field in list(base): + bad.append({k:v for k,v in base.items() if k!=field}) + for value in [None,False,[],{},'0']: + bad.append({**base,field:value}) + for field in ['probability','thickness','floor_level']: + for value in [-1,-0.0,0,1,2,1e100,-1e100,-1e-100]:bad.append({**base,field:value}) + for value in bad: + yield {'definition':encode(value),'context':[-64,384,63],'legacy':False,'seed':0,'target':[0,0],'origin':[0,0],'repeats':1,'fail':63} + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument("--prepare",action="store_true");args=parser.parse_args() + build=lab.LOCAL/"rust-cave-carver-parity";build.mkdir(parents=True,exist_ok=True) + report_path=build/"report.json";report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCaveCarverOracle.java" + helper=oracle.with_name("VanillaAnchorOracle.java") + sources=[oracle,helper,Path(__file__),lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock",lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml", + *sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/cave_carver_fixture.rs"] + tested_sources=base.source_hashes(sources) + resources=worldgen.registry_resources(jars['server'],'carver') + if not resources or resources!=worldgen.registry_resources(jars['client'],'carver'):raise ValueError('reference carver resources differ') + resources_path=build/'carvers.json';resources_path.write_text(json.dumps(resources,separators=(',',':')),encoding='utf-8') + fixtures=list(corpus(resources));inputs=build/"inputs.txt";inputs.write_text("".join(json.dumps(f,separators=(",",":"))+"\n" for f in fixtures),encoding="utf-8") + fixture_paths=[inputs,resources_path];tested_fixtures=base.source_hashes(fixture_paths);classes=build/"classes";classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle,helper],"compile-java") + run(["cargo","build","--release","-p","horizon-world","--example","cave_carver_fixture"],"compile-rust") + metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) + binary=Path(metadata["target_directory"])/"release/examples"/("cave_carver_fixture.exe" if os.name=="nt" else "cave_carver_fixture") + run([binary,build],"rust") + references=[] + for side,jar in jars.items(): + reference=build/f"{side}.txt" + run(["java","-Xmx512M","-cp",os.pathsep.join([str(classes),str(jar),dependency_path]),"dev.horizonlab.parity.VanillaCaveCarverOracle",side,build],side) + matched=base.compare(reference,build/"rust.txt") + references.append({"side":side,"jar_sha256":lab.digest(jar,"sha256"),"output_sha256":lab.digest(reference,"sha256"),"matched_output_lines":matched}) + print(f"{side}: {matched:,} cave-carver output lines match Rust",flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={"schema":1,"minecraft":lock["minecraft"]["version"],"manifest_sha1":lock["minecraft"]["manifest_sha1"],"platform":platform.platform(), + "java":subprocess.check_output(["java","--version"],text=True).splitlines()[0],"rustc":subprocess.check_output(["rustc","--version"],text=True).strip(), + "fixtures":len(fixtures),"carve_attempts":sum(f["repeats"] for f in fixtures),"bundled_cave_definitions":3, + "sources_sha256":tested_sources,"fixtures_sha256":tested_fixtures,"rust_output_sha256":lab.digest(build/"rust.txt","sha256"),"references":references, + "scope":"Actual WorldCarver.DIRECT_CODEC, CaveWorldCarver.isStartChunk and CaveWorldCarver.carve using all three independently authenticated bundled cave definitions. Compares ordered output cells including duplicates, partial output failures, resulting mask intervals and subsequent random longs across repeated invocations. Covers both outer random modes, local legacy tunnel streams, rooms, branching, thickness bias, floor thresholds, negative/distant/extreme target coordinates and adjacent/far origin chunks. Explicit custom distributions force path and failure branches; malformed selected codec fields are tested. Gaussian/weighted provider codecs, canyon paths, neighbor-carver seeding/biome selection, blending and complete generated worlds remain outside this scope. Rust bounds count to 4096 and total candidates to 2^24 per invocation."} + + lab.write_json(report_path,report);print(f"Scoped cave-carver parity passed: {report_path}") + + +if __name__=="__main__":main() diff --git a/tools/test_chunk_stage_parity.py b/tools/test_chunk_stage_parity.py new file mode 100644 index 000000000..6e055f631 --- /dev/null +++ b/tools/test_chunk_stage_parity.py @@ -0,0 +1,96 @@ +#!/usr/bin/env python3 +"""Compare pre-light chunk status transitions and native ProtoChunk writes.""" +import argparse +from collections import Counter +import json +import os +from pathlib import Path +import platform +import random +import subprocess + +try: + from . import lab, test_rust_parity as base, test_worldgen_parity as worldgen +except ImportError: + import lab + import test_rust_parity as base + import test_worldgen_parity as worldgen + + +def corpus(facts): + defaults=facts['defaults'];air=defaults['minecraft:air'] + stages=['empty','structure_starts','structure_references','biomes','terrain','features'] + choices=[defaults['minecraft:'+name] for name in ['air','cave_air','void_air','stone','water','lava','oak_leaves','oak_slab','seagrass','snow','powder_snow','glass','barrier']] + for stage in ['empty','terrain']: + ops=[['stage',stage]] + for state in range(len(facts['states'])): + ops.extend([['set',4,5,7,state],['get',4,5,7],['query',4,7],['set',4,5,7,air],['query',4,7]]) + yield {'chunk':[0,0],'min':0,'height':16,'ops':ops+[['dump']]} + rng=random.Random(0x484f52495a4f4e5354414745) + for minimum,height in [(-64,384),(0,16),(-16,32),(-2032,4064),(2016,16)]: + for initial_stage in stages: + ops=[['stage',initial_stage],['set',0,minimum,0,air],['query',0,0]] + for index,stage in enumerate(stages+list(reversed(stages))): + ops.extend([['stage',stage],['query',0,0]]) + for i in range(24): + x,z=rng.choice([(0,0),(15,15),(-1,16),(2147483647,-2147483648)]) + y=minimum+rng.choice([-1,0,height//2,height-1,height]) + state=rng.choice(choices) + ops.extend([['set',x,y,z,state],['get',x,y,z],['query',x,z]]) + if index%3==0:ops.append(['prime',rng.randrange(64)]) + yield {'chunk':[-3,7],'min':minimum,'height':height,'ops':ops+[['dump']]} + + +def main(): + parser=argparse.ArgumentParser(description=__doc__) + parser.add_argument("--prepare",action="store_true") + args=parser.parse_args() + build=lab.LOCAL/"rust-chunk-stage-parity";build.mkdir(parents=True,exist_ok=True) + report_path=build/"report.json";report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + tags=worldgen.tag_resources(jars["server"]) + if not tags or tags!=worldgen.tag_resources(jars["client"]):raise ValueError("client/server block tags differ or are empty") + oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaChunkStageOracle.java" + helper=oracle.with_name("VanillaHeightmapOracle.java") + sources=[oracle,helper,Path(__file__),lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock", + lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml", + *sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/chunk_stage_fixture.rs"] + tested_sources=base.source_hashes(sources) + classes=build/"classes";classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle,helper],"compile-java") + def java(side,mode,path): + run(["java","-Xmx1G","-cp",os.pathsep.join([str(classes),str(jars[side]),dependency_path]),"dev.horizonlab.parity.VanillaChunkStageOracle",mode,path],side+"-"+mode) + for side in jars:java(side,"export",build/f"facts-{side}.json") + facts=json.loads((build/"facts-server.json").read_text()) + if facts!=json.loads((build/"facts-client.json").read_text()):raise ValueError("client/server state facts differ") + if len(facts["states"])!=35723:raise ValueError("incomplete pinned state table") + fixtures=list(corpus(facts));inputs=build/"inputs.txt" + inputs.write_text("".join(json.dumps(value,separators=(",",":"))+"\n" for value in fixtures),encoding="utf-8") + (build/"tags.json").write_text(json.dumps(tags,separators=(",",":")),encoding="utf-8") + fixture_paths=[inputs,build/"tags.json",build/"facts-client.json",build/"facts-server.json"] + tested_fixtures=base.source_hashes(fixture_paths) + run(["cargo","build","--release","-p","horizon-world","--example","chunk_stage_fixture"],"compile-rust") + metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) + binary=Path(metadata["target_directory"])/"release/examples"/("chunk_stage_fixture.exe" if os.name=="nt" else "chunk_stage_fixture") + run([binary,build],"rust") + references=[] + for side,jar in jars.items(): + java(side,side,build) + reference=build/f"{side}.txt";matched=base.compare(reference,build/"rust.txt") + references.append({"side":side,"jar_sha256":lab.digest(jar,"sha256"),"output_sha256":lab.digest(reference,"sha256"),"matched_output_lines":matched}) + print(f"{side}: {matched:,} chunk-stage output lines match Rust",flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={"schema":1,"minecraft":lock["minecraft"]["version"],"manifest_sha1":lock["minecraft"]["manifest_sha1"],"platform":platform.platform(), + "java":subprocess.check_output(["java","--version"],text=True).splitlines()[0],"rustc":subprocess.check_output(["rustc","--version"],text=True).strip(), + "block_states":len(facts["states"]),"block_tag_files":len(tags),"fixtures":len(fixtures),"operation_counts":dict(Counter(op[0] for fixture in fixtures for op in fixture["ops"])), + "sources_sha256":tested_sources,"fixtures_sha256":tested_fixtures,"rust_output_sha256":lab.digest(build/"rust.txt","sha256"),"references":references, + "scope":"Actual ProtoChunk.setBlockState, direct section reads, heightmap presence/packed data and pre-light persisted-status assignments for empty, structure starts, structure references, biomes, terrain and features. Every pinned block state is inserted/removed under both heightmap groups. Forward/backward status assignments, untouched stale maps, missing-map priming, explicit priming, empty-section AIR writes, cave/void-air collapse, outside-height writes and wrapped X/Z coordinates are compared. Facts are independently exported from both authenticated JARs; block tags are resolved in Rust. This covers stage-dependent mutation and map selection, not the scheduler, persisted metadata, retro-generation, block entities, lighting, whole region behavior or a complete generated world."} + + lab.write_json(report_path,report);print(f"Scoped chunk-stage parity passed: {report_path}") + + +if __name__=="__main__":main() diff --git a/tools/test_client_graphics.py b/tools/test_client_graphics.py index 5db6a130a..a23040843 100644 --- a/tools/test_client_graphics.py +++ b/tools/test_client_graphics.py @@ -111,7 +111,7 @@ def main(): 'dev.horizonlab.metrics.ClientGraphicsIntegration', fixture_mixins=['GraphicsBackendTraceMixin'], fixture_dependencies={}) version = build_pack.read_lock()['pack_version'] - mod = root / 'dist' / f'horizon-lab-{version}.jar' + mod = root / 'dist' / f'horizon-{version}.jar' original_hash = hashlib.sha256(mod.read_bytes()).hexdigest() results = [] for profile in args.profile or (['cinematic'] if args.shaders else ['core-performance', 'm2-balanced']): diff --git a/tools/test_collision_parity.py b/tools/test_collision_parity.py new file mode 100644 index 000000000..3794fa642 --- /dev/null +++ b/tools/test_collision_parity.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python3 +"""Validate registry-backed cached collisions against the pinned vanilla binaries.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import tempfile + +try: + from . import lab, test_rust_parity +except ImportError: + import lab + import test_rust_parity + + +def counts(output): + marker = "HORIZON_COLLISION_RESULT " + found = [json.loads(line.split(marker, 1)[1]) for line in output.splitlines() if marker in line] + if len(found) != 1: + raise AssertionError(f"Missing collision counts: {found}") + result = found[0] + if result["registry_states"] != 35723 or result["cached_states"] + result["uncached_states"] != result["registry_states"] or result["queries"] != result["cached_states"] * 6 or result["unique_shapes"] <= 0: + raise AssertionError(f"Incomplete collision coverage: {result}") + return result + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--prepare", action="store_true") + args = parser.parse_args() + directory = lab.LOCAL / "rust-collision-parity" + directory.mkdir(parents=True, exist_ok=True) + report_path = directory / "report.json" + report_path.unlink(missing_ok=True) + if args.prepare: + lab.prepare() + lock, jars, libraries = test_rust_parity.verify_artifacts() + base = Path(tempfile.mkdtemp(prefix="run-", dir=directory)) + oracle = lab.ROOT / "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java" + sources = [oracle, Path(__file__).resolve(), lab.ROOT / "tools/test_rust_parity.py", lab.ROOT / "Cargo.toml", lab.ROOT / "Cargo.lock", lab.ROOT / "crates/horizon-core/Cargo.toml", lab.ROOT / "crates/horizon-world/Cargo.toml", *sorted((lab.ROOT / "crates/horizon-core/src").rglob("*.rs")), *sorted((lab.ROOT / "crates/horizon-world/src").rglob("*.rs")), lab.ROOT / "crates/horizon-world/examples/collision_fixture.rs"] + tested_sources = test_rust_parity.source_hashes(sources) + classes = base / "classes" + classes.mkdir() + dependency_path = os.pathsep.join(map(str, libraries)) + test_rust_parity.run(["javac", "--release", "25", "-proc:none", "-cp", os.pathsep.join([str(jars["server"]), dependency_path]), "-d", str(classes), str(oracle)]) + def java(side, mode): + result = subprocess.run(["java", "-Xmx1G", "-cp", os.pathsep.join([str(classes), str(jars[side]), dependency_path]), "dev.horizonlab.parity.VanillaCollisionOracle", mode, str(base)], cwd=lab.ROOT, capture_output=True, text=True, timeout=300) + (base / f"{side}-{mode}.log").write_text(result.stdout + result.stderr, encoding="utf-8") + result.check_returncode() + return result.stdout + expected = counts(java("server", "generate")) + test_rust_parity.run(["cargo", "build", "--release", "-p", "horizon-world", "--example", "collision_fixture"]) + metadata = json.loads(subprocess.check_output(["cargo", "metadata", "--no-deps", "--format-version", "1"], cwd=lab.ROOT, text=True)) + binary = Path(metadata["target_directory"]) / "release/examples" / ("collision_fixture.exe" if os.name == "nt" else "collision_fixture") + actual = counts(subprocess.check_output([str(binary), str(base)], cwd=lab.ROOT, text=True)) + if actual != expected: + raise AssertionError(f"Collision coverage differs: vanilla={expected}, Rust={actual}") + references = [] + for side, jar in jars.items(): + java(side, side) + reference = base / f"vanilla-{side}.txt" + matched = test_rust_parity.compare(reference, base / "rust.txt") + references.append({"side": side, "jar_sha256": lab.digest(jar, "sha256"), "output_sha256": lab.digest(reference, "sha256"), "matched_output_lines": matched, **expected}) + print(f"{side}: {matched:,} cached collision output lines match", flush=True) + test_rust_parity.ensure_sources_unchanged(sources, tested_sources) + report = {"schema": 1, "minecraft": lock["minecraft"]["version"], "manifest_sha1": lock["minecraft"]["manifest_sha1"], "platform": platform.platform(), + "java": subprocess.check_output(["java", "--version"], text=True).splitlines()[0], "rustc": subprocess.check_output(["rustc", "--version"], text=True).strip(), + "inputs_sha256": lab.digest(base / "inputs.txt", "sha256"), "rust_output_sha256": lab.digest(base / "rust.txt", "sha256"), "sources_sha256": tested_sources, "references": references, + "scope": "Pinned no-context cached collision branch only. Registry identity validation, resident section lookup, grids, discrete extrema including empty shapes, greedy boxes, bounds, translated collide, ray hits, closest points and moved cell lookup. Uncached states and entity-context behavior remain unsupported."} + lab.write_json(report_path, report) + lab.write_json(base / "report.json", report) + print(f"Cached collision comparison passed: {report_path}") + + +if __name__ == "__main__": + main() diff --git a/tools/test_culling_empty.py b/tools/test_culling_empty.py index fd278733b..d2bcbbc39 100644 --- a/tools/test_culling_empty.py +++ b/tools/test_culling_empty.py @@ -22,7 +22,7 @@ def main(): args = parser.parse_args() root = build_pack.ROOT fixture = build_mod.build_culling_empty_fixture() - mod = root / "dist" / f"horizon-lab-{build_pack.read_lock()['pack_version']}.jar" + mod = root / "dist" / f"horizon-{build_pack.read_lock()['pack_version']}.jar" results = [] for enabled in [False, True]: instance = root / ".local/runtime" / ("culling-empty-fixture-patched" if enabled else "culling-empty-fixture-upstream") diff --git a/tools/test_culling_rays.py b/tools/test_culling_rays.py index 2fc43ca29..b0dfba84b 100644 --- a/tools/test_culling_rays.py +++ b/tools/test_culling_rays.py @@ -56,7 +56,7 @@ def main(): args = parser.parse_args() root = build_pack.ROOT fixture = build_mod.build_integration_fixture("culling-rays", "dev.horizonlab.dispatch.CullingRayIntegration", ["entityculling"], ["CullingRayAccess"]) - mod = root / "dist" / f"horizon-lab-{build_pack.read_lock()['pack_version']}.jar" + mod = root / "dist" / f"horizon-{build_pack.read_lock()['pack_version']}.jar" original_sha256 = hashlib.sha256(mod.read_bytes()).hexdigest() results = [] for enabled in [False, True]: diff --git a/tools/test_decoration_parity.py b/tools/test_decoration_parity.py new file mode 100644 index 000000000..ea693b6a1 --- /dev/null +++ b/tools/test_decoration_parity.py @@ -0,0 +1,92 @@ +#!/usr/bin/env python3 +"""Compare the feature branch of native chunk biome decoration.""" +import argparse +import itertools +import json +import os +from pathlib import Path +import platform +import random +import subprocess +try: + from . import lab, test_rust_parity as base, test_feature_sort_parity as sort +except ImportError: + import lab + import test_rust_parity as base + import test_feature_sort_parity as sort + + +def fixture(biomes, seed=0, mode=0, present=None): + count=max((v for b in biomes for s in b for v in s),default=-1)+1 + chains=[[],[{'type':'count','count':3},{'type':'in_square'}],[{'type':'count','count':3},{'type':'in_square'},{'type':'biome'}],[{'type':'biome'},{'type':'random_chance','chance':0.5},{'type':'count','count':2}]] + if present is None:present=list(range(len(biomes)+1)) + if not present:present=[len(biomes)] + return {'biomes':biomes,'placements':[chains[mode%len(chains)] for _ in range(count)],'palettes':[present[i%len(present):]+present[:i%len(present)] for i in range(9)],'seed':seed,'cx':0,'cz':0,'min':-64,'height':32,'biome_offset':0,'chunk_fail':-1,'notify_fail':-1,'query_fail':-1,'feature_fail':-1,'return_mode':0} + + +def corpus(resources): + graphs=[[],[[]],[[[],[],[]]],[[[0,1,2]]],[[[0,2]],[[1,2]]],[[[0],[],[1,2]],[[1],[],[2,3]]],[[[0,0]]],[[[0,1]],[[1,0]]],[[[0]],[[1]]],[[[],[2]],[[],[0,1]]],[[[0],[],[0]],[[1],[2],[3]]],[[[0]]+[[] for _ in range(12)]+[[1]],[[1]]]] + policies=[{}, {'feature_fail':0},{'feature_fail':3},{'query_fail':0},{'query_fail':2},{'chunk_fail':0},{'chunk_fail':4},{'notify_fail':0},{'notify_fail':2},{'return_mode':1},{'return_mode':2}] + for graph,mode,seed,policy in itertools.product(graphs,range(4),[0,-1,2**63-1],policies): + f=fixture(graph,seed,mode);f.update(policy) + f['cx']=[0,-1,1874999,134217728][mode];f['cz']=[0,-1875000,1,-134217729][mode] + f['min']=[-64,0,-2032,1968][mode];f['height']=[16,32,64,16][mode];f['biome_offset']=mode + yield f + # Resident palettes can contain only an excluded biome, only a neighbor's + # feature, or duplicates. Selection must retain global ordering and indices. + graph=[[[0,3]],[[1,3]],[[2,3]]] + for present in [[],[0],[1],[2],[0,2],[3],[0,0,3],[2,1,0]]: + for mode in range(4): + f=fixture(graph,-9223372036854775808,mode,present) + f['palettes']=[([3] if i!=8 else present or [3]) for i in range(9)] + yield f + names=sorted({name for steps in resources.values() for step in steps for name in step}) + if any(not isinstance(name,str) or name.startswith('#') for name in names):raise ValueError('unsupported fixture holder form') + identity={name:i for i,name in enumerate(names)} + biomes=[[[identity[name] for name in step] for step in steps] for steps in resources.values()] + rng=random.Random(8845) + for mode in range(4): + for selected in [list(range(len(biomes))),[],*[ [i] for i in range(len(biomes))],*[rng.sample(range(len(biomes)),rng.randrange(len(biomes)+1)) for _ in range(24)]]: + f=fixture(biomes,rng.randrange(-2**63,2**63),mode,selected) + f['cx']=rng.randrange(-1875000,1875000);f['cz']=rng.randrange(-1875000,1875000) + yield f + for _ in range(200): + # Shared order avoids cycles while exercising sparse high step indices. + biomes=[[[i for i in range(12) if rng.randrange(5)==0] for _ in range(rng.randrange(15))] for _ in range(rng.randrange(8))] + f=fixture(biomes,rng.randrange(-2**63,2**63),rng.randrange(4));f.update(rng.choice(policies));yield f + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-decoration-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + resources=sort.biome_features(jars['server']) + if len(resources)!=67 or resources!=sort.biome_features(jars['client']):raise ValueError('pinned biome feature resources differ') + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDecorationOracle.java';helper=oracle.with_name('VanillaPlacementOracle.java') + sources=[oracle,helper,Path(__file__),lab.ROOT/'tools/test_feature_sort_parity.py',lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/decoration_fixture.rs'] + tested_sources=base.source_hashes(sources) + fixtures=list(corpus(resources));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(f,separators=(',',':'))+'\n' for f in fixtures),encoding='utf-8') + resource_path=build/'biome-features.json';resource_path.write_text(json.dumps(resources,separators=(',',':')),encoding='utf-8') + fixture_paths=[inputs,resource_path];tested_fixtures=base.source_hashes(fixture_paths) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle,helper],'compile-java') + run(['cargo','build','--release','-p','horizon-world','--example','decoration_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('decoration_fixture.exe' if os.name=='nt' else 'decoration_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + run(['java','-Xmx768M','-cp',os.pathsep.join([str(classes),str(jar),dependency_path]),'dev.horizonlab.parity.VanillaDecorationOracle',side,build],side) + reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} decoration output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'biomes':len(resources),'requested_decorations':len(fixtures)*2,'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual ChunkGenerator.applyBiomeDecoration with structure generation disabled, native ProtoChunk biome palettes, native FeatureSorter and WorldgenRandom, and traced feature sinks. Nine-chunk query order, possible-biome intersection, sorted global feature indices, decoration/feature seeds, biome-check placement, repeated calls, ignored false results, progress markers and partial failures are compared. All 67 bundled biome feature lists participate with synthetic payloads. Rust owns immutable generation settings and delegates resident palette transport and feature callbacks. Structure decoration, complete registry/world region integration, all feature algorithms, crash-report formatting and full gameplay remain pending.'} + lab.write_json(report_path,report);print(f'Scoped decoration parity passed: {report_path}') + + +if __name__=='__main__':main() diff --git a/tools/test_decoration_region_parity.py b/tools/test_decoration_region_parity.py new file mode 100644 index 000000000..583545c25 --- /dev/null +++ b/tools/test_decoration_region_parity.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python3 +"""Compare biome decoration, resident biome zoom, feature writes and heightmaps.""" +import argparse +from collections import Counter +import json +import os +from pathlib import Path +import platform +import random +import subprocess + +try: + from . import lab, test_rust_parity as base, test_worldgen_parity as worldgen, test_feature_region_parity as region, test_decoration_parity as decoration +except ImportError: + import lab + import test_rust_parity as base + import test_worldgen_parity as worldgen + import test_feature_region_parity as region + import test_decoration_parity as decoration + + +def corpus(facts): + template=next(region.corpus(facts)) + biomes=[[[0],[1,2],[3,4,5]],[[0],[2],[3,5]],[[1],[2],[4,5]]] + chains=[ + [{'type':'count','count':2},{'type':'in_square'},{'type':'heightmap','heightmap':'MOTION_BLOCKING'},{'type':'biome'}], + [{'type':'count_on_every_layer','count':1},{'type':'offset','x':0,'y':1,'z':0},{'type':'biome'}], + [{'type':'biome'},{'type':'count','count':2},{'type':'heightmap','heightmap':'WORLD_SURFACE'},{'type':'offset','x':1,'y':0,'z':1}], + [{'type':'count','count':3},{'type':'in_square'},{'type':'heightmap','heightmap':'MOTION_BLOCKING'},{'type':'block_predicate_filter','predicate':{'type':'matching_biomes','biomes':['horizon:b0','horizon:b1']}},{'type':'biome'}], + [{'type':'biome'},{'type':'block_predicate_filter','predicate':{'type':'volume_match','min':[-1,0,-1],'max':[1,0,1],'match':{'type':'not','predicate':{'type':'matching_biomes','biomes':['horizon:b3']}}}}], + ] + for seed in [0,-1]: + for stage in ['empty','biomes','terrain']: + for fail in [-1,7]: + for reject in [0,3]: + for placement in chains: + for mixed in [False,True]: + f=decoration.fixture(biomes,seed,present=[0,1,2,3] if mixed else [0]) + f.update(features=template['features'],placements=[placement]*len(template['features']),min=-64,height=64,stage=stage,write_fail=fail,reject=reject) + yield f + + +def main(): + parser=argparse.ArgumentParser(description=__doc__) + parser.add_argument("--prepare",action="store_true") + args=parser.parse_args() + build=lab.LOCAL/"rust-decoration-region-parity";build.mkdir(parents=True,exist_ok=True) + report_path=build/"report.json";report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + tags=worldgen.tag_resources(jars["server"]) + if not tags or tags!=worldgen.tag_resources(jars["client"]):raise ValueError("client/server block tags differ or are empty") + oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDecorationRegionOracle.java" + helper=oracle.with_name("VanillaHeightmapOracle.java") + placement_helper=oracle.with_name("VanillaPlacementOracle.java") + sources=[oracle,helper,placement_helper,Path(__file__),lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/test_feature_region_parity.py",lab.ROOT/"tools/test_decoration_parity.py",lab.ROOT/"tools/test_feature_sort_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock", + lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml", + *sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/decoration_region_fixture.rs",lab.ROOT/"crates/horizon-world/examples/support/decoration_storage.rs"] + tested_sources=base.source_hashes(sources) + classes=build/"classes";classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle,helper,placement_helper],"compile-java") + def java(side,mode,path): + run(["java","-Xmx1G","-cp",os.pathsep.join([str(classes),str(jars[side]),dependency_path]),"dev.horizonlab.parity.VanillaDecorationRegionOracle",mode,path],side+"-"+mode) + for side in jars:java(side,"export",build/f"facts-{side}.json") + facts=json.loads((build/"facts-server.json").read_text()) + if facts!=json.loads((build/"facts-client.json").read_text()):raise ValueError("client/server state facts differ") + if len(facts["states"])!=35723:raise ValueError("incomplete pinned state table") + fixtures=list(corpus(facts));inputs=build/"inputs.txt" + inputs.write_text("".join(json.dumps(value,separators=(",",":"))+"\n" for value in fixtures),encoding="utf-8") + (build/"tags.json").write_text(json.dumps(tags,separators=(",",":")),encoding="utf-8") + fixture_paths=[inputs,build/"tags.json",build/"facts-client.json",build/"facts-server.json"] + tested_fixtures=base.source_hashes(fixture_paths) + run(["cargo","build","--release","-p","horizon-world","--example","decoration_region_fixture"],"compile-rust") + metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) + binary=Path(metadata["target_directory"])/"release/examples"/("decoration_region_fixture.exe" if os.name=="nt" else "decoration_region_fixture") + run([binary,build],"rust") + references=[] + for side,jar in jars.items(): + java(side,side,build) + reference=build/f"{side}.txt";matched=base.compare(reference,build/"rust.txt") + references.append({"side":side,"jar_sha256":lab.digest(jar,"sha256"),"output_sha256":lab.digest(reference,"sha256"),"matched_output_lines":matched}) + print(f"{side}: {matched:,} decoration-region output lines match Rust",flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={"schema":1,"minecraft":lock["minecraft"]["version"],"manifest_sha1":lock["minecraft"]["manifest_sha1"],"platform":platform.platform(), + "java":subprocess.check_output(["java","--version"],text=True).splitlines()[0],"rustc":subprocess.check_output(["rustc","--version"],text=True).strip(), + "block_states":len(facts["states"]),"block_tag_files":len(tags),"fixtures":len(fixtures),"biome_zoom":True,"resident_chunks_per_fixture":9,"requested_decorations":len(fixtures)*2, + "sources_sha256":tested_sources,"fixtures_sha256":tested_fixtures,"rust_output_sha256":lab.digest(build/"rust.txt","sha256"),"references":references, + "scope":"Actual ChunkGenerator.applyBiomeDecoration with structures disabled executes three native basic features, configured fill-layer sequences, replacements and scattered ore into nine ProtoChunks. Biome palettes, native BiomeManager zoom, possible-biome selection, FeatureSorter order, WorldgenRandom seeding, biome filters, registry-bound matching-biome predicates, ordered volume predicates and graph composition share resident terrain. Both pre-light heightmap groups, mixed/uniform biome neighborhoods, count/square/heightmap/layered chains, repeated decoration, rejected writes and partial failures are compared. Ordered writes, current-feature markers, complete final raw sections and all heightmap presence/data are checked. Rust uses resident BiomeRegion and TerrainRegion with caller-owned biome membership/write effects. Actual WorldGenRegion write-zone policy, POIs, block entities, postprocessing, lighting, structures, remaining feature algorithms, complete noise-to-decoration lifecycle and gameplay remain pending."} + + + lab.write_json(report_path,report);print(f"Scoped decoration-region parity passed: {report_path}") + + +if __name__=="__main__":main() diff --git a/tools/test_density_parity.py b/tools/test_density_parity.py new file mode 100644 index 000000000..aeb319e0f --- /dev/null +++ b/tools/test_density_parity.py @@ -0,0 +1,1100 @@ +#!/usr/bin/env python3 +"""Compare 26.3 compiled density samplers with checksum-pinned vanilla JARs.""" +import argparse +from collections import Counter +import json +import math +import os +from pathlib import Path +import platform +import random +import struct +import subprocess + +try: + from . import lab, test_rust_parity +except ImportError: + import lab + import test_rust_parity + + +def number(value): + return struct.pack(">d", value).hex() + + +def corpus(): + rng = random.Random(0x484f52495a4f4e44454e53495459) + edges = [-2147483648, -2147483647, -65536, -64, -1, 0, 1, 64, 65536, 2147483646, 2147483647] + floats = ["00000000", "80000000", "00000001", "80000001", "3f000000", "bf000000", "3f800000", "bf800000", "7f7fffff", "ff7fffff", "7f800000", "ff800000", "7fc00000", "7fa00001"] + def probes(index, points=32, exact=False): + for value in edges: + yield f"query {index} {value} {value} {value}" + for _ in range(points): + position = [rng.choice(edges) if rng.randrange(3) == 0 else rng.randrange(-2**31, 2**31) for _ in range(3)] + yield f"query {index} " + " ".join(map(str, position)) + for iteration in range(5): + sizes = [rng.randrange(1, 5), rng.randrange(1, 9), rng.randrange(1, 5)] + minimum = [rng.choice(edges) for _ in range(3)] + steps = [rng.choice([1, 4, 16, 65536, 2147483647]) for _ in range(3)] + yield f"volume {index} " + " ".join(map(str, sizes+minimum+steps)) + f" {0 if exact else iteration % 3} {rng.randrange(-2**63, 2**63)} 2" + index = 0 + good_children = [] + all_children = [] + for value in floats + [f"{rng.getrandbits(32):08x}" for _ in range(64)]: + yield f"constant {value}" + yield from probes(index) + all_children.append(index) + good_children.append(index) + index += 1 + for scenario in range(1800): + axis, tiling = scenario % 3, (scenario // 3) % 3 + if scenario % 4 == 0: + start, end = rng.choice(edges), rng.choice(edges) + elif scenario % 4 == 1: + start, end = rng.randrange(-2**31, 2**31), rng.randrange(-2**31, 2**31) + else: + start, end = rng.randrange(-128, 128), rng.randrange(-128, 128) + if scenario % 37 == 0: + end = start + if scenario % 41 == 0: + start, end = 0, -1 # MIN / -1 overflow in repeating paths. + low, high = (rng.choice(floats) if scenario % 3 == 0 else f"{rng.getrandbits(32):08x}" for _ in range(2)) + yield f"gradient {axis} {tiling} {start} {end} {low} {high}" + for coordinate in [start, end, max(-2**31, start-1), min(2**31-1, end+1)]: + yield f"query {index} {coordinate} {coordinate} {coordinate}" + yield from probes(index) + all_children.append(index) + if tiling == 0 or start != end: + good_children.append(index) + index += 1 + scales = [0.0, -0.0, .001, -.001, .125, .5, 1.0, 4.0, 1e100, float("inf"), float("-inf"), float("nan")] + noise_children = [] + for scenario in range(240): + kind = ["perlin", "simplex", "smeared"][scenario % 3] + stream = ["legacy", "xoroshiro"][(scenario // 3) % 2] + scale = rng.choice(scales) + xz, y = (rng.choice(scales) if scenario % 3 == 0 else rng.uniform(-2, 2) for _ in range(2)) + noise_children.append(index) + yield f"noise {kind} {stream} {rng.randrange(-2**63, 2**63)} {number(scale)} {number(xz)} {number(y)}" + yield from probes(index) + good_children.append(index) + all_children.append(index) + index += 1 + nested = [] + for scenario in range(1200): + choices = all_children if scenario % 9 == 0 else good_children + choices = choices + [i for i, depth in nested if depth < 4] + x, y, z = (rng.choice(choices) for _ in range(3)) + if scenario % 2 == 0: + y = -1 + yield f"shift {scenario % 240} {x} {y} {z}" + yield from probes(index) + depth = 1 + max([d for i, d in nested if i in [x, y, z]], default=0) + nested.append((index, depth)) + index += 1 + unary_kinds = ["abs", "negate", "square", "cube", "sqrt", "reciprocal", "sign", "squeeze", "leaky", "add", "sub", "mul", "div", "min", "max", "clamp"] + arithmetic = [] + for scenario in range(2400): + kind = unary_kinds[scenario % len(unary_kinds)] + choices = all_children + [i for i, depth in nested if depth <= 2] + [i for i, depth in arithmetic if depth < 4] + child = rng.choice(choices) + a, b = (rng.choice(floats) if scenario % 3 == 0 else f"{rng.getrandbits(32):08x}" for _ in range(2)) + yield f"unary {kind} {child} {a} {b}" + yield from probes(index) + depth = 1 + max([d for i, d in arithmetic if i == child], default=0) + arithmetic.append((index, depth)) + index += 1 + binary = [] + for scenario in range(2400): + kind = ["add", "sub", "mul", "div", "min", "max"][scenario % 6] + choices = all_children + [i for i, depth in arithmetic if depth <= 2] + [i for i, depth in binary if depth < 4] + left, right = (rng.choice(choices) for _ in range(2)) + if scenario % 7 == 0: + left = scenario % len(floats) # Force scalar shortcuts and exceptional values. + bound = rng.choice(floats) if scenario % 3 == 0 else f"{rng.getrandbits(32):08x}" + yield f"binary {kind} {left} {right} {bound}" + yield from probes(index, exact=True) + depth = 1 + max([d for i, d in binary if i in [left, right]], default=0) + binary.append((index, depth)) + index += 1 + + selections = [] + for scenario in range(2400): + choices = all_children + [i for i, depth in arithmetic+binary+selections if depth < 3] + selected = rng.choice(choices) if scenario % 3 else scenario % len(floats) + if scenario % 2 == 0: + mode = (scenario // 2) % 2 + a, b = (rng.choice(floats) if scenario % 3 == 0 else f"{rng.getrandbits(32):08x}" for _ in range(2)) + inside, outside = (rng.choice(floats) if mode else str(rng.choice(choices)) for _ in range(2)) + yield f"choice {mode} {selected} {a} {b} {inside} {outside}" + children = [selected] + ([] if mode else [int(inside), int(outside)]) + else: + mode = (scenario // 2) % 3 + first = rng.choice(floats) if mode == 1 else str(rng.choice(choices)) + second = rng.choice(floats) if mode == 2 else str(rng.choice(choices)) + yield f"lerp {mode} {selected} {first} {second}" + children = [selected] + ([] if mode == 1 else [int(first)]) + ([] if mode == 2 else [int(second)]) + yield from probes(index, exact=True) + depth = 1 + max([d for i, d in arithmetic+binary+selections if i in children], default=0) + selections.append((index, depth)) + index += 1 + # Known failure nodes make skipped branches, bulk evaluation order and + # partial writes directly observable at scalar branch endpoints. + failure = index + yield "gradient 0 1 0 0 00000000 3f800000" + index += 1 + for zero in [0, 1, 6, 12]: + for operation in [f"binary mul {zero} {failure} 00000000", f"binary div {zero} {failure} 00000000", + f"choice 0 {zero} 00000000 3f800000 6 {failure}", f"choice 0 {zero} 00000000 3f800000 {failure} 6", + f"lerp 0 {zero} 6 {failure}", f"lerp 0 {zero} {failure} 6", + f"lerp 1 {zero} 80000000 {failure}", f"lerp 2 {zero} {failure} 80000000"]: + yield operation + yield from probes(index, points=1, exact=True) + index += 1 + for source in range(14): + for minimum, maximum in [("00000000", "3f800000"), ("80000000", "00000000"), ("7fc00000", "3f800000")]: + yield f"choice 1 {source} {minimum} {maximum} 80000000 3f800000" + yield from probes(index, points=1) # Constant-choice logical tails. + index += 1 + + interval_nodes = [] + for scenario in range(1000): + choices = all_children + [i for i, depth in arithmetic+binary+selections+interval_nodes if depth < 3] + source = rng.choice(choices) if scenario % 3 else scenario % len(floats) + mode = scenario % 2 + count = 1 if mode else rng.choice([0, 1, 2, 3, 4, 8, 16]) + thresholds = [rng.choice(floats) if scenario % 3 == 0 else f"{rng.getrandbits(32):08x}" for _ in range(count)] + branches = [rng.choice(choices) for _ in range(count+1)] + if scenario % 13 == 0: + branches[scenario % len(branches)] = failure + yield f"interval {mode} {source} {count} " + " ".join(thresholds + list(map(str, branches))) + yield from probes(index, exact=True) + depth = 1 + max([d for i, d in arithmetic+binary+selections+interval_nodes if i in [source]+branches], default=0) + interval_nodes.append((index, depth)) + index += 1 + + # Range propagation is independently checked on bit-pattern endpoints. + for a in floats: + for b in floats: + for mode in range(6): + yield f"bounds {mode} {a} {b} {a} {b} {a} {b}" + for scenario in range(24000): + values = [rng.choice(floats) if scenario % 3 == 0 else f"{rng.getrandbits(32):08x}" for _ in range(6)] + yield f"bounds {scenario % 6} " + " ".join(values) + + for scenario in range(32): + stream = ["legacy", "xoroshiro"][scenario % 2] + yield f"noise normal {stream} {rng.randrange(-2**63,2**63)} {number(0)} {number(.25)} {number(.125)}" + yield from probes(index) + index += 1 + for noise_id in range(272): + for kind in range(3): + yield f"offset {kind} {noise_id}" + yield from probes(index) + index += 1 + for scenario in range(192): + stream = ["legacy", "xoroshiro"][scenario % 2] + # The first cases include the actual overworld/nether and End parameters. + if scenario < 4: + parameters = [.25 if scenario < 2 else 1.0, .125 if scenario < 2 else 1.0, 80.0, 160.0, 8.0 if scenario < 2 else 4.0] + elif scenario % 3 == 0: + parameters = [rng.choice([0.0, -0.0, .001, .25, 1.0, -1.0, 1000.0, 1e100, float("inf")]), rng.choice([0.0, -0.0, .001, .125, 1.0, -1.0, 1000.0]), rng.choice([0.0, -0.0, 80.0, -80.0, 1e100, float("inf")]), rng.choice([160.0, -160.0, 1e100, float("inf")]), rng.choice([0.0, -0.0, 1.0, 4.0, 8.0, -8.0, 1e100])] + else: + parameters = [rng.uniform(.001,1000), rng.uniform(.001,1000), rng.uniform(.001,1000), rng.uniform(.001,1000), rng.uniform(1,8)] + yield f"blended {stream} {rng.randrange(-2**63,2**63)} " + " ".join(map(number,parameters)) + yield from probes(index, points=96, exact=True) + yield f"volume {index} 3 9 3 -32 -64 16 4 8 4 0 {scenario} 2" + index += 1 + for scenario in range(320): + point = [rng.choice(edges) if scenario % 2 == 0 else rng.randrange(-2**31,2**31) for _ in range(3)] + yield f"distance {scenario % 4} " + " ".join(map(str,point)) + yield f"query {index} " + " ".join(map(str,point)) + yield from probes(index) + index += 1 + for scenario in range(12000): + values = [rng.choice(floats) if scenario % 3 == 0 else f"{rng.getrandbits(32):08x}" for _ in range(3)] + yield "metric " + " ".join(values) + for stream in ["legacy", "xoroshiro"]: + for parameters in [[1,float("nan"),80,160,8], [1,1,80,float("nan"),8], [1,0,80,0,8], [1,1,80,160,float("nan")], [1,0,80,160,float("inf")]]: + yield f"blendfail {stream} -1 " + " ".join(map(number,parameters)) + for scenario in range(256): + stream = ["legacy", "xoroshiro"][scenario % 2] + octave = rng.choice([0,-1,-7,-15,-31,-63,-127,1]) + smear = rng.choice([0.0,-0.0,.125,1.0,-1.0,1000.0,1e100,float("inf"),float("nan")]) + amplitude = rng.choice([0.0,-0.0,1.0,-1.0,.9999847412109375,12.75,1e100,float("inf"),float("nan")]) + yield f"blendfbm {stream} {rng.randrange(-2**63,2**63)} {octave} {number(smear)} {number(amplitude)}" + + for scenario in range(192): + source = rng.choice(noise_children) if scenario % 4 == 1 else (rng.choice(all_children) if scenario % 4 else scenario % len(floats)) + yield f"counted {source}" + counted = index + index += 1 + # Some nested caches share a node; IDs remain distinct on every path. + if scenario % 3 == 0: + yield f"cache {scenario + 256} {counted}" + counted = index + index += 1 + yield f"cache {scenario} {counted}" + cached = index + index += 1 + for enabled in [0, 1]: + yield f"context {enabled}" + for point in [[0,0,0], [0,0,0], [2**26,4096,-2**26], [-17,-64,32], [-17,-64,32]]: + yield f"query {cached} " + " ".join(map(str,point)) + yield f"counts {scenario}" + for minimum in [[-17,-64,32], [-17,-64,32], [2147483647,-2147483648,0], [-17,-64,32]]: + yield f"volume {cached} 2 3 2 " + " ".join(map(str,minimum)) + f" 4 1 4 0 {scenario} 2" + yield f"counts {scenario}" + for offset in [[0,0,0],[0,0,0],[4,1,4],[1,0,0],[0,3,0]]: + point = [((a+b+2**31) % 2**32)-2**31 for a,b in zip(minimum,offset)] + yield f"query {cached} " + " ".join(map(str,point)) + yield f"counts {scenario}" + for scenario in range(10000): + sizes = [rng.randrange(1,9) for _ in range(3)] + minimum = [rng.choice(edges) for _ in range(3)] + steps = [rng.choice([1,4,16,65536,2147483647]) for _ in range(3)] + offsets = [rng.randrange(-1, sizes[i]+1)*steps[i] + (1 if scenario % 5 == 0 else 0) for i in range(3)] + point = [((a+b+2**31) % 2**32)-2**31 for a,b in zip(minimum,offsets)] + yield "lookup " + " ".join(map(str,sizes+minimum+steps+point)) + + sliced = [] + for scenario in range(384): + mode = (scenario // 8) % 4 + a, b = rng.choice(edges), rng.choice(edges) + # Force buffer tails on primitive inputs, and nested/cached graphs on + # exact buffers. IDs are never reused for different cached functions. + tails = scenario % 8 == 0 + choices = all_children + [i for i, depth in binary if depth < 3] + [i for i, depth in sliced if depth < 3] + source = scenario % len(floats) if tails else rng.choice(choices) + depth = 1 + max([d for i, d in sliced if i == source], default=0) + yield f"counted {source}" + child = index + counter = 192 + scenario + index += 1 + if scenario % 8 == 1: + yield f"cache {1024 + scenario} {child}" + child = index + index += 1 + yield f"slice {mode} {child} {a} {b}" + sampler = index + sliced.append((sampler, depth)) + index += 1 + for enabled in [0, 1]: + yield f"context {enabled}" + for command in probes(sampler, points=8, exact=not tails): + yield command + yield f"counts {counter}" + for match_minimum in [False, True]: + for match_size in [False, True]: + sizes = [2, 5, 3] + minimum = [-17, -64, 32] + fixed = [(mode, a)] if mode < 3 else [(0, a), (2, b)] + for axis, value in fixed: + sizes[axis] = 1 if match_size else sizes[axis] + minimum[axis] = value if match_minimum else (value ^ 1) + yield f"volume {sampler} " + " ".join(map(str, sizes+minimum+[4,8,16])) + f" {2 if tails else 0} {scenario} 2" + yield f"counts {counter}" + + for scenario in range(384): + xz = [1, 2, 3, 4, 7, 8, 16, 31][scenario % 8] + cell_y = [1, 2, 3, 4, 7, 8, 16, 31][(scenario // 8) % 8] + source = rng.choice(all_children + [i for i, d in binary if d < 3] + [i for i, d in sliced if d < 3]) + if scenario % 3 == 0: + source = rng.choice(noise_children) + elif scenario % 3 == 1: + source = (scenario // 3) % len(floats) + yield f"counted {source}" + counter = 576 + scenario + child = index + index += 1 + if scenario % 5 == 0: + yield f"cache {2048 + scenario} {child}" + child = index + index += 1 + yield f"interpolate {child} {xz} {cell_y}" + sampler = index + index += 1 + for enabled in [0, 1]: + yield f"context {enabled}" + for value in edges + [rng.randrange(-2**31, 2**31) for _ in range(8)]: + yield f"query {sampler} {value} {value} {value}" + yield f"counts {counter}" + for point in [[0,0,0],[-xz,-cell_y,xz],[xz,cell_y,-xz],[-1,-1,-1]]: + yield f"query {sampler} " + " ".join(map(str,point)) + yield f"counts {counter}" + for iteration in range(12): + sizes = [rng.randrange(1,6),rng.randrange(1,17),rng.randrange(1,6)] + minimum = [rng.choice([-2147479552,-65,-64,-33,-17,-1,0,1,16,32,2147479551]) for _ in range(3)] + steps = [1,1,1] if iteration < 4 else ([xz,cell_y,xz] if iteration < 8 else [2,3,4]) + if iteration in [4,5]: + minimum = [-xz,-cell_y,xz] + if iteration == 6: + sizes = [1,1,1] + minimum = [0,0,0] + steps = [1,1,1] + if iteration == 7: + sizes = [2,1,3] + minimum = [0,0,0] + steps = [xz,1,xz] + yield f"volume {sampler} " + " ".join(map(str,sizes+minimum+steps)) + f" {2 if scenario % 3 == 1 and scenario % 5 != 0 else 0} {scenario} 2" + yield f"counts {counter}" + + for scenario in range(384): + lower = [-128,-64,-63,0,64][scenario % 5] + height = [1,2,3,4,8,16,31][scenario % 7] + density = rng.choice(all_children) + if scenario % 2 == 0: + upper_bits = (floats + [struct.pack(">f",v).hex() for v in [-128,-64,-1,1,64,256,384,100.5]])[(scenario // 2) % 22] + upper_value = struct.unpack(">f",bytes.fromhex(upper_bits))[0] + if not (-512 <= upper_value <= 512): + density = 6 # Positive density makes extreme-height searches terminate immediately. + if scenario % 4 == 0: + height = 2147483647 + yield f"constant {upper_bits}" + else: + end = -64 if scenario % 17 == 0 else 64 + yield f"gradient {(scenario // 2) % 3} {(scenario // 6) % 3} -64 {end} c3000000 43800000" + upper = index + index += 1 + yield f"counted {density}" + density = index + index += 1 + yield f"counted {upper}" + upper = index + index += 1 + if scenario % 7 == 0: + yield f"cache {4096 + scenario} {density}" + density = index + index += 1 + mode = (scenario // 2) % 2 + yield f"surface {mode} {density} {upper} {lower} {height}" + sampler = index + index += 1 + for enabled in [0,1]: + yield f"context {enabled}" + for value in edges + [-129,-65,-63,63,127,128,255,256]: + yield f"query {sampler} {value} {value} {value}" + yield f"counts {960 + scenario * 2}" + yield f"counts {961 + scenario * 2}" + for iteration in range(6): + sizes = [rng.randrange(1,5),1 if iteration < 4 else 3,rng.randrange(1,5)] + minimum = [rng.choice(edges),0 if iteration % 2 else -64,rng.choice(edges)] + steps = [rng.choice([1,4,65536,2147483647]),8,rng.choice([1,4,65536,2147483647])] + yield f"volume {sampler} " + " ".join(map(str,sizes+minimum+steps)) + f" {iteration % 3} {scenario} 2" + yield f"counts {960 + scenario * 2}" + yield f"counts {961 + scenario * 2}" + + yield "context 0" + spline_index = 0 + for value in floats + [f"{rng.getrandbits(32):08x}" for _ in range(64)]: + yield f"spconstant {value}" + if math.isnan(struct.unpack(">f",bytes.fromhex(value))[0]): + yield f"spfail {spline_index}" + else: + yield f"spsampler {spline_index}" + yield from probes(index, points=8) + index += 1 + spline_index += 1 + for scenario in range(256): + sources = [rng.choice(all_children),rng.choice(noise_children),rng.choice(all_children)] + if scenario % 4 in [0,1]: + sources[0] = 12 if scenario % 4 == 0 else 4 + coordinates = [] + for source in sources: + yield f"counted {source}" + coordinates.append(index) + index += 1 + nodes = [] + for node in range(3): + coordinate = coordinates[0 if node == 2 or (node == 0 and scenario % 2 == 0) else node+1] + count = [1,2,3,8][(scenario+node) % 4] + locations = [float(i)-count*.5 for i in range(count)] + if scenario % 7 == 0: + locations = [struct.unpack(">f",bytes.fromhex(rng.choice(floats)))[0] for _ in locations] + elif scenario % 7 == 1: + locations = [0.0 for _ in locations] + fields = [] + for point, location in enumerate(locations): + derivative = rng.choice(floats) if scenario % 3 == 0 else struct.pack(">f",rng.uniform(-2,2)).hex() + value = rng.randrange(78) if node < 2 else rng.choice(nodes) + if node == 2 and point == count-1: + value = nodes[0] # Force repeated NaN coordinate reads in scalar queries. + fields += [struct.pack(">f",location).hex(),derivative,str(value)] + yield f"sppoints {coordinate} {count} " + " ".join(fields) + nodes.append(spline_index) + spline_index += 1 + yield f"spsampler {nodes[-1]}" + sampler = index + index += 1 + for enabled in [0,1]: + yield f"context {enabled}" + for command in probes(sampler, points=8, exact=True): + yield command + for counter in range(1728+scenario*3,1731+scenario*3): + yield f"counts {counter}" + + for spline in range(spline_index): + for scenario in range(16): + values = [rng.choice(floats) if scenario % 2 else struct.pack(">f",rng.uniform(-4,4)).hex() for _ in range(6)] + if scenario == 0: + values = ["ff800000","7f800000"] * 3 + if scenario == 1: + values = ["7fc00000"] * 6 + yield f"sprange {spline} " + " ".join(values) + + for scenario in range(128): + yield "greset" + for value in ["00000000","80000000","3f800000","bf800000","42000000",rng.choice(floats[:12])]: + yield f"gconst {value}" + yield f"ggradient {scenario % 3} {(scenario // 3) % 3} -64 {(-64 if scenario % 17 == 0 else 64)} bf800000 3f800000" + for slot, source in enumerate([rng.choice(noise_children),rng.choice(all_children)]): + yield f"counted {source}" + counted = index + index += 1 + yield f"gbind {counted} bf800000 3f800000 {(scenario+slot) % 8}" + yield "gcache 6" + yield "gcache 6" + yield "gsame 9 10" + yield "gcache 9" + yield f"gslice {0 if scenario % 2 else 2} {-17 if scenario % 3 else 0} 7" + yield f"gslice {2 if scenario % 2 else 0} {32 if scenario % 3 else 0} 12" + yield f"gunary {scenario % 9} 9" + yield f"gbinary {scenario % 6} {5 if scenario % 4 == 0 else 14} {5 if scenario % 4 == 1 else 8}" + yield "gclamp 15 bf800000 3f800000" + yield "gchoice 7 bf000000 3f000000 16 14" + yield f"glerp 16 {2 if scenario % 3 == 0 else 17} {5 if scenario % 3 == 1 else 14}" + yield "ginterp 18 4 8" + yield "gsurface 18 4 -64 8" + yield "gbinary 5 19 20" + yield "gcache 21" + yield "gbinary 0 22 11" + for node in range(24): + yield f"ginfo {node}" + yield "gtry 0 9" + for mode, roots in [(0,[5,6,13]),(1,[5,6,9,11,13,14,15,16,17,18,19,20,21,22,23])]: + for root in roots: + yield f"gcompile {mode} {root}" + sampler = index + index += 1 + for enabled in [0,1]: + yield f"context {enabled}" + for point in [[0,0,0],[-17,-64,32],[1,7,-1],[1,7,-1],[-2147483648,0,2147483647],[2147483647,-1,-2147483648]]: + yield f"query {sampler} " + " ".join(map(str,point)) + for counter in [2496+scenario*2,2497+scenario*2]: + yield f"counts {counter}" + for sizes, minimum, steps in [([2,5,3],[-17,-64,32],[1,1,1]),([2,5,3],[-16,-64,32],[4,8,4]),([1,3,1],[0,0,0],[1,1,1])]: + yield f"volume {sampler} " + " ".join(map(str,sizes+minimum+steps)) + f" {2 if root == 5 else 0} {scenario} 2" + for counter in [2496+scenario*2,2497+scenario*2]: + yield f"counts {counter}" + yield "gconst 7fc00000" + yield "gcache 24" + yield "gcache 25" + for root in [26,26,25]: + yield f"gtry 1 {root}" + yield "gtry 0 25" + yield "ginfo 24" + yield "ginfo 25" + yield "gconst 7fa00001" + yield "gsame 24 27" + yield "gconst 80000000" + yield "gsame 1 28" + yield "gsame 0 28" + yield f"gdistance {-2147483648 if scenario % 3 == 0 else -17} {scenario-64} {2147483647 if scenario % 3 == 1 else 32} {scenario % 4}" + yield f"ginterval 7 1 {floats[scenario % len(floats)]} 8 29" + thresholds = [[], ["00000000"], ["7fc00000"], ["80000000", "00000000", "7f800000"], ["3f800000", "bf800000", "7fc00000"]][scenario % 5] + branches = [29, 13, 7, 2][:len(thresholds)+1] + yield f"ginterval 8 {len(thresholds)} " + " ".join(thresholds + list(map(str,branches))) + yield "gcache 30" + yield "ginterval 9 1 00000000 30 29" + yield "ginterval 24 1 00000000 29 2" + yield "ginterval 7 1 7fc00000 8 29" + yield "ginterval 7 1 7fa00001 8 29" + yield "gsame 35 36" + yield "ginterval 7 1 00000000 8 29" + yield "ginterval 7 1 80000000 8 29" + yield "gsame 37 38" + yield "gcache 35" + yield "gcache 36" + yield "gtry 1 39" + yield "gtry 1 40" + yield "gbinary 0 37 37" + yield "gbinary 0 38 38" + yield "gsame 41 42" + yield "gcache 41" + yield "gcache 42" + yield "gtry 1 43" + yield "gtry 1 44" + for node in range(29,41): + yield f"ginfo {node}" + for mode, roots in [(0,[29,30,31,34]),(1,[29,30,31,32,33,34])]: + for root in roots: + yield f"gcompile {mode} {root}" + sampler = index + index += 1 + for enabled in [0,1]: + yield f"context {enabled}" + for point in [[0,0,0],[-17,-64,32],[1,7,-1],[-2147483648,0,2147483647],[2147483647,-1,-2147483648]]: + yield f"query {sampler} " + " ".join(map(str,point)) + for counter in [2496+scenario*2,2497+scenario*2]: + yield f"counts {counter}" + for sizes, minimum, steps in [([2,5,3],[-17,-64,32],[1,1,1]),([2,5,3],[-16,-64,32],[4,8,4])]: + yield f"volume {sampler} " + " ".join(map(str,sizes+minimum+steps)) + f" {2 if root == 29 else 0} {scenario} 2" + for counter in [2496+scenario*2,2497+scenario*2]: + yield f"counts {counter}" + for value in ["00000000", "80000000", "3f800000", "bf800000", "7fc00000", "7f800000"]: + yield f"gsconstant {value}" + for spline in [0,1,2,4,5]: + yield f"gspline {spline}" + # Shared and structurally equal coordinates, including zero-hash variants. + coordinate = [7,8,13][scenario % 3] + point_fields = [] + for point, location in enumerate(["bf800000", "00000000", "3f800000"]): + derivative = rng.choice(floats) if scenario % 4 == 0 else struct.pack(">f",rng.uniform(-2,2)).hex() + value = rng.randrange(6) if scenario % 4 == 0 else point % 4 + point_fields += [location, derivative, str(value)] + yield f"gspoints {coordinate} 3 " + " ".join(point_fields) + yield f"gspoints {[7,8,13][(scenario+1)%3]} 2 bf000000 00000000 6 3f000000 00000000 6" + yield f"gspoints {9 if scenario % 2 else 29} 3 bf800000 00000000 7 00000000 3f000000 6 3f800000 00000000 7" + for spline in [6,7,8,8]: + yield f"gspline {spline}" + yield "gsame 52 53" + yield f"gspoints {coordinate} 3 " + " ".join(point_fields) + yield "gspline 9" + yield "gsame 50 54" + for coordinate in [37,38]: + yield f"gspoints {coordinate} 2 bf800000 00000000 0 3f800000 00000000 2" + yield "gspline 10" + yield "gspline 11" + yield "gsame 55 56" + yield "gcache 55" + yield "gcache 56" + yield "gtry 1 57" + yield "gtry 1 58" + yield "gcache 52" + yield "gtry 1 59" + yield "gtry 1 59" + yield "gspoints 24 1 00000000 00000000 0" + yield "gspline 12" + yield "gspoints 48 1 00000000 00000000 0" + yield "gspline 13" + yield f"gbind {counted} 7fc00000 7fc00000 2" + yield "gspoints 62 1 00000000 00000000 12" + yield "gspline 14" + for node in range(45,64): + yield f"ginfo {node}" + for mode in [0,1]: + for root in [48,60,61,63]: + yield f"gtry {mode} {root}" + for mode, roots in [(0,[45,46,47,49,50,54,55,56]),(1,[45,46,47,49,50,51,52,53,54,55,56,57,58])]: + for root in roots: + yield f"gcompile {mode} {root}" + sampler = index + index += 1 + for enabled in [0,1]: + yield f"context {enabled}" + for point in [[0,0,0],[-17,-64,32],[1,7,-1],[1,7,-1],[-2147483648,0,2147483647],[2147483647,-1,-2147483648]]: + yield f"query {sampler} " + " ".join(map(str,point)) + for counter in [2496+scenario*2,2497+scenario*2]: + yield f"counts {counter}" + for sizes, minimum, steps in [([2,5,3],[-17,-64,32],[1,1,1]),([2,5,3],[-16,-64,32],[4,8,4]),([1,3,1],[0,0,0],[1,1,1])]: + yield f"volume {sampler} " + " ".join(map(str,sizes+minimum+steps)) + f" {2 if root in [45,46,47,49] else 0} {scenario} 2" + for counter in [2496+scenario*2,2497+scenario*2]: + yield f"counts {counter}" + + for scenario in range(64): + seed = [0, 1, -1, -9223372036854775808, 9223372036854775807][scenario % 5] if scenario < 10 else rng.randrange(-2**63,2**63) + yield f"gseed {seed} {scenario % 2}" + definitions = [ + ("horizon:primary", -7, 1.0, 4, scenario % 3, [1.0,0.0,-0.5,1.0] if scenario % 4 == 0 else []), + ("minecraft:nether/temperature", -7, 1.0, 4, 2, []), + ("minecraft:nether/vegetation", -8, 1.0, 4, 2, [1.0,0.0,0.5,1.0]), + ("horizon:empty", 0, 1.0, 0, 1, []), + ("horizon:secondary", -3, 0.75, 3, 0, [1.0,-0.5,0.0]), + ] + for name, base, amplitude, count, normalization, modifiers in definitions: + yield f"gregister {name} {base} {number(amplitude)} {count} {normalization} {len(modifiers)} " + " ".join(number(v) for v in modifiers) + yield "gready" + for noise in range(5): + yield f"ginstance {noise}" + for value in ["00000000", "80000000", "3f800000"]: + yield f"gconst {value}" + yield "ggradient 1 0 -64 320 bf800000 3f800000" + yield "ggradient 0 0 -32 32 bf800000 3f800000" + for kind in range(3): + yield f"goffset 0 {kind}" + yield "gcache 6" + yield f"gnoise 0 {number(.125)} {number(.25)} 0 0 0" + yield f"gnoise 0 {number(.125)} {number(.25)} 6 0 7" + yield f"gnoise 0 {number(.125)} {number(.25)} 6 1 7" + yield f"gnoise 0 {number(.125)} {number(.25)} 6 3 7" + yield f"gnoise 3 {number(1)} {number(0)} 0 0 0" + yield f"gnoise 1 {number(.25)} {number(0)} 0 0 0" + yield f"gnoise 2 {number(.25)} {number(0)} 0 0 0" + yield f"gnoise 4 {number(-0.0)} {number(0)} 0 0 0" + scale = [0.0, -0.0, .125, 1.0, float('inf'), float('nan'), -.5][scenario % 7] + yield f"gnoise 4 {number(scale)} {number(scale)} 4 3 2" + yield f"gnoise 0 {number(.125)} {number(.25)} 8 0 7" + yield "gcache 12" + parameters = [(.25,.125,80.,160.,8.), (.25,.375,80.,60.,8.), (.25,.25,80.,160.,4.)][scenario % 3] + yield "gblended " + " ".join(number(v) for v in parameters) + yield "gbinary 0 19 20" + yield "gsconstant 00000000" + yield "gsconstant 3f800000" + yield "gspoints 9 2 bf800000 00000000 0 3f800000 00000000 1" + yield "gspoints 12 2 bf800000 00000000 2 3f800000 00000000 2" + yield "gspline 3" + yield "ginterp 21 4 8" + yield "gcache 23" + yield "gclamp 22 bf800000 3f800000" + yield f"gnoise 0 {number(.125)} {number(.25)} 0 0 0" + yield "gsame 9 26" + yield f"gnoise 0 {number(.125)} {number(.25)} 1 0 0" + yield "goffset 3 1" + yield f"gnoise 4 {number(0)} {number(0)} 0 0 0" + yield "gend" + yield "gend" + yield "gsame 30 31" + yield "gcache 30" + yield "gbinary 0 30 12" + yield "gclamp 33 bf800000 3f800000" + yield "ginterp 33 4 8" + yield "gspoints 30 2 bf800000 00000000 0 3f800000 00000000 1" + yield "gspline 4" + yield "gsurface 33 2 -64 8" + for node in range(38): + yield f"ginfo {node}" + yield "gtry 0 8" + for mode, roots in [(0,[5,6,7,9,10,11,12,13,14,15,16,17,20,22,25,27,28,29,30,31,33,34,35,36,37]),(1,[5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37])]: + for root in roots: + yield f"gcompile {mode} {root}" + sampler = index + index += 1 + for enabled in [0,1]: + yield f"context {enabled}" + points = [[0,0,0],[-17,-64,32],[1,7,-1],[1,7,-1],[-2147483648,0,2147483647],[2147483647,-1,-2147483648]] + if root >= 30: + points += [[1024,80,1024],[-1025,-64,1024],[2048,256,-4096]] + for point in points: + yield f"query {sampler} " + " ".join(map(str,point)) + volumes = [([2,5,3],[-17,-64,32],[1,1,1]),([2,5,3],[-16,-64,32],[4,8,4]),([1,3,1],[0,0,0],[1,1,1])] + if root >= 30: + volumes.append(([3,2,3],[1024,-64,1024],[16,64,16])) + for sizes, minimum, steps in volumes: + yield f"volume {sampler} " + " ".join(map(str,sizes+minimum+steps)) + f" 0 {scenario} 2" + for noise in range(5): + yield f"ginstance {noise}" + + for scenario in range(6): + yield f"gseed {-9223372036854775808 if scenario % 2 else 9223372036854775807} {scenario % 2}" + base, count = [(0,3), (1,1), (-1,8)][scenario // 2] + yield f"gregister minecraft:nether/temperature {base} {number(1)} {count} 1 0" + yield "gready" + yield "gconst 00000000" + yield f"gnoise 0 {number(.25)} {number(0)} 0 0 0" + yield "goffset 0 1" + yield "gcache 1" + for root in [1,2,3]: + yield f"ginfo {root}" + for mode in [0,1,1]: + yield f"gtry {mode} {root}" + + # Rounding is appended so the established corpus keeps its original inputs. + rounding_values = floats + ["3effffff","3f000001","beffffff","bf000001", + "3fbfffff","3fc00000","3fc00001","bfbfffff","bfc00000","bfc00001", + "4affffff","4b000000","4effffff","4f000000","ceffffff","cf000000"] + rounding_inputs = [] + for value in rounding_values: + yield f"constant {value}" + rounding_inputs.append(index) + index += 1 + multiples = [-1] + [rounding_inputs[i] for i in [0,1,2,4,5,6,7,10,11,12]] + for kind in range(4): + for input in rounding_inputs: + for multiple in multiples: + yield f"round {kind} {input} {multiple}" + yield f"query {index} -17 -64 32" + yield f"volume {index} 2 3 2 -17 -64 32 4 8 4 {2 if multiple < 0 else 0} {index} 2" + index += 1 + for scenario in range(256): + input = rng.choice(all_children) + multiple = -1 if scenario % 5 == 0 else rng.choice(all_children) + yield f"round {scenario % 4} {input} {multiple}" + yield from probes(index, points=8, exact=multiple >= 0) + index += 1 + + for scenario in range(64): + yield "greset" + for value in ["00000000","80000000","3f800000","bf800000","7fc00000","7f800000",rounding_values[scenario % len(rounding_values)]]: + yield f"gconst {value}" + yield "ggradient 1 0 -64 64 bf800000 3f800000" + for slot, source in enumerate([rng.choice(noise_children),rng.choice(all_children)]): + yield f"counted {source}" + counted = index + index += 1 + yield f"gbind {counted} bf800000 3f800000 {7 if slot == 0 else scenario % 8}" + yield "gcache 8" + for input, multiple, offset in [(8,2,0),(8,9,1),(7,0,2),(7,1,3),(9,6,0),(6,3,1),(10,9,2)]: + yield f"ground {(scenario+offset) % 4} {input} {multiple}" + yield "gcache 12" + yield f"ground {(scenario+3) % 4} 18 11" + yield f"ground {scenario % 4} 6 4" + yield f"ground {scenario % 4} 6 5" + yield f"gbind {rounding_inputs[6]} 3f800000 3f800000 0" + yield f"ground {scenario % 4} 9 22" + for node in range(24): + yield f"ginfo {node}" + for mode, roots in [(0,[11,12,13,14,15,16,20,21,23]),(1,list(range(11,22))+[23])]: + for root in roots: + yield f"gcompile {mode} {root}" + sampler = index + index += 1 + for enabled in [0,1]: + yield f"context {enabled}" + for point in [[0,0,0],[-17,-64,32],[1,7,-1],[-2147483648,0,2147483647],[2147483647,-1,-2147483648]]: + yield f"query {sampler} " + " ".join(map(str,point)) + for counter in [2752+scenario*2,2753+scenario*2]: + yield f"counts {counter}" + for sizes, minimum, steps in [([2,5,3],[-17,-64,32],[1,1,1]),([2,5,3],[-16,-64,32],[4,8,4])]: + yield f"volume {sampler} " + " ".join(map(str,sizes+minimum+steps)) + f" 0 {scenario} 2" + for counter in [2752+scenario*2,2753+scenario*2]: + yield f"counts {counter}" + yield "gcache 6" + yield f"ground {scenario % 4} 24 2" + for root in [24,25]: + for mode in [0,1,1]: + yield f"gtry {mode} {root}" + + for scenario in range(768): + child = rounding_inputs[scenario % len(rounding_inputs)] if scenario < 128 else rng.choice(all_children) + yield f"unary log {child} 00000000 00000000" + yield from probes(index, points=8) + index += 1 + + power_values = floats + ["40000000","c0000000","40400000","c0400000","3fc00000","bfc00000"] + for base in power_values: + for first in power_values: + for last in power_values: + yield f"bounds 2 {base} {base} {first} {last} 00000000 3f800000" + yield f"bounds 3 {first} {last} {base} {base} 00000000 3f800000" + + for scenario in range(64): + yield "greset" + for value in ["00000000","80000000","3f800000","bf800000","7fc00000","7f800000",rounding_values[scenario % len(rounding_values)]]: + yield f"gconst {value}" + yield "ggradient 1 0 -64 64 00000000 40800000" + yield "ggradient 0 0 -32 32 bf800000 3f800000" + yield f"counted {rng.choice(all_children)}" + counted = index + index += 1 + low, high = [("00000000","40800000"),("bf800000","3f800000"),("ff800000","7f800000"),("80000000","80000000"),("bf800000","bf000000"),("7fc00000","7fc00000")][scenario % 6] + yield f"gbind {counted} {low} {high} {scenario % 8}" + yield "gcache 9" + for kind, input in [(9,7),(10,7),(9,8),(10,8),(9,9),(10,9),(9,10),(10,10)]: + yield f"gunary {kind} {input}" + yield "gcache 11" + yield "gbinary 0 17 18" + yield "gclamp 20 bf800000 3f800000" + yield "ground 1 21 2" + yield "gcache 20" + yield "gunary 9 6" + yield "gunary 10 6" + yield "gunary 9 3" + for node in range(27): + yield f"ginfo {node}" + for mode, roots in [(0,[11,12,13,14,15,16,24,25,26]),(1,list(range(11,27)))]: + for root in roots: + yield f"gcompile {mode} {root}" + sampler = index + index += 1 + for enabled in [0,1]: + yield f"context {enabled}" + for point in [[0,0,0],[-17,-64,32],[1,7,-1],[-2147483648,0,2147483647],[2147483647,-1,-2147483648]]: + yield f"query {sampler} " + " ".join(map(str,point)) + yield f"counts {2880+scenario}" + for sizes, minimum, steps in [([2,5,3],[-17,-64,32],[1,1,1]),([2,5,3],[-16,-64,32],[4,8,4]),([1,3,1],[0,0,0],[1,1,1])]: + yield f"volume {sampler} " + " ".join(map(str,sizes+minimum+steps)) + f" 0 {scenario} 2" + yield f"counts {2880+scenario}" + + power_inputs = [] + for value in power_values: + yield f"constant {value}" + power_inputs.append(index) + index += 1 + for mode in range(3): + for base, base_bits in zip(power_inputs, power_values): + for exponent, exponent_bits in zip(power_inputs, power_values): + base_constant = number(struct.unpack(">f", bytes.fromhex(base_bits))[0]) + exponent_constant = number(struct.unpack(">f", bytes.fromhex(exponent_bits))[0]) + fields = [str(base),str(exponent)] if mode == 0 else [base_constant,str(exponent)] if mode == 1 else [str(base),exponent_constant] + yield f"power {mode} " + " ".join(fields) + yield f"query {index} -17 -64 32" + yield f"volume {index} 2 3 2 -17 -64 32 4 8 4 {0 if mode == 0 else 2} {index} 2" + index += 1 + for scenario in range(256): + mode = scenario % 3 + child = rng.choice(all_children) + constant = rng.choice(scales + [2.,-2.,3.,-3.,4.,-4.]) if scenario % 2 else struct.unpack(">d",rng.getrandbits(64).to_bytes(8,"big"))[0] + fields = [str(child),str(rng.choice(all_children))] if mode == 0 else [number(constant),str(child)] if mode == 1 else [str(child),number(constant)] + yield f"power {mode} " + " ".join(fields) + yield from probes(index, points=8, exact=mode == 0) + index += 1 + + for scenario in range(64): + yield "greset" + for value in ["00000000","80000000","3f800000","bf800000","3f000000","bf000000","40000000","c0000000","40400000","c0400000","40800000","c0800000","7fc00000","7f800000","ff800000",power_values[scenario % len(power_values)]]: + yield f"gconst {value}" + yield "ggradient 1 0 -64 64 bf800000 3f800000" + for slot, source in enumerate([rng.choice(noise_children),rng.choice(all_children)]): + yield f"counted {source}" + counted = index + index += 1 + yield f"gbind {counted} bf800000 3f800000 {7 if slot == 0 else scenario % 8}" + yield "gcache 17" + yield "gpow 17 18" + yield "gpow 15 18" + for exponent in [4,5,2,3,6,7,8,9,10,11,12,13,14,0,1]: + yield f"gpow 17 {exponent}" + yield "gpow 15 15" + yield "gpow 19 18" + yield "gpow 18 19" + yield "gcache 20" + yield "gpow 40 21" + yield "gclamp 41 bf800000 3f800000" + yield "ginterp 42 4 8" + yield "gsconstant 00000000" + yield "gsconstant 3f800000" + yield "gspoints 42 2 bf800000 00000000 0 3f800000 00000000 1" + yield "gspline 2" + yield "gsurface 42 2 -64 8" + yield "gpow 12 19" + yield "gcache 46" + for node in range(48): + yield f"ginfo {node}" + for mode, roots in [(0,list(range(20,38))),(1,list(range(20,47)))]: + for root in roots: + if root == 44 and power_values[scenario % len(power_values)] in ["7fc00000","7fa00001"]: + yield f"gtry {mode} {root}" + continue + yield f"gcompile {mode} {root}" + sampler = index + index += 1 + for enabled in [0,1]: + yield f"context {enabled}" + for point in [[0,0,0],[-17,-64,32],[1,7,-1],[-2147483648,0,2147483647],[2147483647,-1,-2147483648]]: + yield f"query {sampler} " + " ".join(map(str,point)) + for counter in [2944+scenario*2,2945+scenario*2]: + yield f"counts {counter}" + for sizes, minimum, steps in [([2,5,3],[-17,-64,32],[1,1,1]),([2,5,3],[-16,-64,32],[4,8,4])]: + yield f"volume {sampler} " + " ".join(map(str,sizes+minimum+steps)) + f" 0 {scenario} 2" + for counter in [2944+scenario*2,2945+scenario*2]: + yield f"counts {counter}" + for root in [46,47]: + for mode in [0,1,1]: + yield f"gtry {mode} {root}" + + + # Context fields are resolved at evaluation time. Deliberately bind values + # outside declared ranges and axes to retain vanilla's compiler behavior. + for scenario in range(16): + sources = [] + for field in range(3): + yield f"gradient {(scenario+field) % 3} {1 if scenario % 5 == 0 else 0} {-17 if scenario % 5 else 0} {32 if scenario % 5 else 0} {floats[(scenario+field) % len(floats)]} {floats[(scenario+field+5) % len(floats)]}" + source = index + index += 1 + yield f"counted {source}" + sources.append(index) + index += 1 + yield f"constant {floats[scenario % len(floats)]}" + fallback = index + index += 1 + roots = [] + for field in range(3): + for default in [-1, fallback]: + yield f"wfield {field} {default}" + roots.append(index) + index += 1 + for source in roots[:6]: + yield f"blenddensity {source}" + roots.append(index) + index += 1 + for slot, source in enumerate(roots[:6]): + yield f"cache {slot} {source}" + roots.append(index) + index += 1 + for root in roots: + for cached in [0,1]: + for blender in [0,1]: + for mask in [0,1,2,4,7]: + bindings = [str(sources[field] if mask & (1<f',progress).hex(),'noclip':noclip} + f={'state':state,'position':[-17,-64,30000000],'entity':'piston','piston':piston,'fail':-1} + yield f + if progress==0.5 and noclip==-1:yield dict(f,fail=1) + + +def collision_corpus(facts,states): + for fixture in corpus(facts,states): + yield fixture + yield dict(fixture,collision=True) + shulkers=[state for state in states if facts['states'][state]['id']=='minecraft:shulker_box'] + rng=random.Random(0x5348554c4b4552) + progress=[0.0,-0.0,1.0,0.1,0.2,0.3,0.5,0.7,0.9,struct.unpack('>f',bytes.fromhex('3f7fffff'))[0],struct.unpack('>f',bytes.fromhex('00000001'))[0]] + progress_pairs=[(old,current) for old in progress for current in progress] + progress_pairs.extend((rng.random(),rng.random()) for _ in range(2048)) + for state in shulkers: + for old,current in progress_pairs: + yield {'state':state,'position':[-17,2147483647,-33],'entity':'opened','fail':-1,'collision':True,'shulker_progress':[struct.pack('>f',v).hex() for v in [old,current]]} + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-dynamic-support-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDynamicSupportOracle.java' + helpers=[oracle.with_name(name+'.java') for name in ['VanillaFaceSupportOracle','VanillaBlockStateCodecOracle','VanillaCollisionOracle']] + sources=[oracle,*helpers,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/dynamic_support_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle,*helpers],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaDynamicSupportOracle',mode,path],side+'-'+mode) + java('server','export',build) + facts=json.loads((build/'facts.json').read_text());states=json.loads((build/'uncached-states.json').read_text()) + if len(states)!=199:raise ValueError('incomplete uncached support registry') + fixtures=list(collision_corpus(facts,states));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs,build/'facts.json',build/'uncached-states.json',build/'block-registry.nbt',build/'cached-collision.nbt'];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','dynamic_support_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('dynamic_support_fixture.exe' if os.name=='nt' else 'dynamic_support_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} dynamic-support output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'uncached_states':len(states),'collision_fixtures':sum(bool(f.get('collision')) for f in fixtures),'shulker_progress_fixtures':sum('shulker_progress' in f for f in fixtures),'active_piston_fixtures':sum(f['entity']=='piston' for f in fixtures),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual native support-shape and no-entity-context collision selection, block offsets and all support directions/types for the 199 uncached states. Bamboo, speleothem thickness/direction, scaffolding, powder snow and shulker support are compared over coordinate boundaries and privately allocated block-entity snapshots, including animation state, absent/wrong entity types and failures. Collision checks additionally cover exact shulker bounds and shape representation over progress interpolation boundaries and deterministic finite progress pairs. Moving-piston selection also delegates to actual native entity collision generation for active snapshots; Rust composes the independently tested piston algorithm with registry collision shapes across extension/retraction, source heads, progress boundaries, noclip directions and world-query failures. Entity lifecycle, ticking/pushing and full gameplay remain pending.'} + lab.write_json(report_path,report);print(f'Scoped dynamic-support parity passed: {report_path}') + + +if __name__=='__main__':main() diff --git a/tools/test_entity_obstruction_parity.py b/tools/test_entity_obstruction_parity.py new file mode 100644 index 000000000..9024ccb75 --- /dev/null +++ b/tools/test_entity_obstruction_parity.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python3 +"""Compare entity obstruction queries and shape intersection with pinned vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + def box(values):return [struct.pack('>d',float(v)).hex() for v in values] + def entity(bounds,building=True,removed=False,spectator=False,parent=-1): + return {'box':box(bounds),'building':building,'removed':removed,'spectator':spectator,'parent':parent} + unit=[0,0,0,1,1,1] + shapes=[[],[unit],[[0,0,0,1,0.5,1]],[[0,0,0,1,0.25,1],[0,0.75,0,1,1,1]],[[0,0,0,1e-8,1,1]],[[1,1,1,0,0,0]],[[2147483647,0,-2147483648,2147483648,1,-2147483647]]] + boxes=[unit,[0.2,0.4,0.2,0.8,0.6,0.8],[1,0,0,2,1,1],[0.5,0.5,0.5,0.5,0.75,0.75],[-1e-8,0,0,1e-8,1,1],[1-1e-8,0,0,2,1,1],[1-2e-7,0,0,2,1,1],[2,2,2,3,3,3],[2147483647,0,-2147483648,2147483648,1,-2147483647]] + variants=[[]] + for bounds in boxes: + for flags in range(8):variants.append([entity(bounds,bool(flags&1),bool(flags&2),bool(flags&4))]) + for parent in [-1,0]: + variants.append([entity(unit),entity(unit,parent=parent),entity([0.2,0.4,0.2,0.8,0.6,0.8],parent=1)]) + variants.append([entity(unit,False),entity(unit,parent=parent),entity(unit,removed=True,parent=1)]) + for shape in shapes: + for entities in variants: + for exclude in range(-1,len(entities)): + for fail in [False,True]:yield {'shape':[box(v) for v in shape],'entities':entities,'exclude':exclude,'fail':fail} + rng=random.Random(0x484f52495a4f4e) + extents=[-1.0,0.0,1e-8,1e-7,2e-7,0.125,0.5,1.0,2.0] + def random_box(): + low=[rng.choice([-2.0,-1e-8,0.0,0.5,1.0-1e-8,1.0,2.0]) for _ in range(3)] + return [*low,*[v+rng.choice(extents) for v in low]] + for index in range(3000): + shape=[box(random_box()) for _ in range(rng.randrange(1,5))] + entities=[entity(random_box(),rng.choice([True,True,False]),rng.randrange(4)==0,rng.randrange(4)==0,rng.randrange(-1,i) if i else -1) for i in range(rng.randrange(1,13))] + yield {'shape':shape,'entities':entities,'exclude':rng.randrange(-1,len(entities)),'fail':index%17==0} + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-entity-obstruction-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityObstructionOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/entity_obstruction_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaEntityObstructionOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','entity_obstruction_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('entity_obstruction_fixture.exe' if os.name=='nt' else 'entity_obstruction_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} entity-obstruction output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual EntityGetter.isUnobstructed, its default non-spectator query, Entity removal/root-vehicle methods and voxel intersection execute over privately allocated entity snapshots. Empty shapes, excluded identities, spectators, removed/non-building entities, same-root vehicle exclusions, ordered broad-phase queries and selected candidates, thin boxes, boundary contacts, composite shapes and query failures are compared. Entity construction, lifecycle, spatial indexing, vehicle maintenance and full gameplay remain pending.'} + lab.write_json(report_path,report);print(f'Scoped entity-obstruction parity passed: {report_path}') + + +if __name__=='__main__':main() diff --git a/tools/test_face_support_parity.py b/tools/test_face_support_parity.py new file mode 100644 index 000000000..662504fec --- /dev/null +++ b/tools/test_face_support_parity.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python3 +"""Compare face slicing and support geometry with pinned vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + def nums(v):return [struct.pack('>d',float(x)).hex() for x in v] + for cube in [False,True]: + for mask in range(256):yield {'coords':[nums([0,0.5,1])]*3,'cube':cube,'occupied':[bool(mask&(1<d", value).hex() + + +def numbers(values): + return " ".join(map(number, values)) + + +def corpus(): + rng = random.Random(0x484f52495a4f4e47454f) + special = [0.0, -0.0, 1.0, -1.0, 1e-7, -1e-7, + math.nextafter(1e-7, 0), math.nextafter(1e-7, math.inf), + 9.999999747378752e-6, math.nextafter(9.999999747378752e-6, 0), + float.fromhex("0x0.0000000000001p-1022"), 1e-200, 1e200, + float("inf"), float("-inf"), float("nan")] + def component(): + return rng.choice(special) if rng.randrange(5) == 0 else rng.uniform(-32, 32) + def vector(): + return [component() for _ in range(3)] + boundaries = [-1.0, -0.0, 0.0, 1e-8, .5, math.nextafter(1.0, 0.0), 1.0, math.nextafter(1.0, math.inf)] + for start in boundaries: + for end in boundaries: + for axes in range(1, 8): + a = [start if axes & (1 << i) else 0.0 for i in range(3)] + b = [end if axes & (1 << i) else 0.0 for i in range(3)] + yield "traverse " + numbers(a + b) + " 0" + for step in range(8000): + base = rng.choice([0, -30_000_000, 30_000_000, -2147483648, 2147483647]) + start = [base + rng.choice([rng.uniform(-4, 4), -1, 0, .5, 1]) for _ in range(3)] + end = [v + rng.choice([-16, -1, 0, 1, 16, rng.uniform(-16, 16)]) for v in start] + if step % 13 == 0: + end = start[:] + yield "traverse " + numbers(start + end) + f" {rng.choice([0, 1, 2, 3, 10, 1000])}" + yield "trig-table" + for step in range(16000): + angle = component() if step % 3 == 0 else rng.uniform(-100000, 100000) + pitch, yaw = rng.uniform(-90, 90), rng.uniform(-360, 360) + if step % 11 == 0: + pitch, yaw = rng.choice(special), rng.choice(special) + yield "rotation " + numbers(vector() + [angle, pitch, yaw]) + f" {rng.randrange(8)} {rng.randrange(3)} {rng.randrange(6)} " + number(component()) + for a in special: + for b in special: + yield "vec " + numbers([a, a, a, b, b, b, rng.choice(special)]) + for _ in range(7000): + a = vector() + b = a if rng.randrange(7) == 0 else vector() + yield "vec " + numbers(a + b + [component()]) + for _ in range(7000): + yield "box " + numbers(vector() + vector() + vector() + vector() + vector() + vector() + vector()) + f" {rng.randrange(3)} " + number(component()) + # Direct ray ties, strict endpoint exclusion, inside and epsilon thresholds. + for start, end in [([-1, -1, -1], [2, 2, 2]), ([2, 2, 2], [-1, -1, -1]), + ([-1, .5, .5], [0, .5, .5]), ([0, .5, .5], [1, .5, .5]), + ([.5, .5, .5], [2, .5, .5]), ([-1e-7, .5, .5], [1e-7, .5, .5])]: + yield "box " + numbers([0, 0, 0, 1, 1, 1] * 2 + start + end + [0, 0, 0]) + " 0 " + number(0) + integers = [-2147483648, -2147483647, -16, -1, 0, 1, 15, 16, 2147483646, 2147483647] + for a in integers: + for b in integers: + yield f"block-box {a} {b} {a} {b} {a} {b}" + shape_id = 0 + for scenario in range(180): + cube = scenario % 3 == 0 + sizes = [rng.randrange(1, 7) for _ in range(3)] if scenario else [0, 0, 0] + if scenario == 0: + cube = False + coords = [] + for size in sizes: + if cube: + coords.append([i / size for i in range(size + 1)]) + else: + coords.append(sorted(rng.sample(range(-16, 33), size + 1))) + coords[-1] = [v / 16 for v in coords[-1]] + if scenario == 1: + sizes = [1, 1, 1] + coords = [[0.0, 1.0] for _ in range(3)] + density = rng.choice([0, .15, .5, .85, 1]) if scenario != 1 else 1 + occupied = "".join("1" if rng.random() < density else "0" for _ in range(math.prod(sizes))) or "-" + yield f"grid {int(cube)} {' '.join(map(str, sizes))} " + numbers(sum(coords, [])) + " " + occupied + for step in range(250): + # Collision boxes lie outside, touch, or overlap individual boundaries. + lower, upper = [], [] + for axis in range(3): + edge = rng.choice(coords[axis]) + offset = rng.choice([0, 1e-7, -1e-7, 1e-8, -1e-8, .3, -.3, -1, 1]) + lower.append(edge + offset) + upper.append(edge + offset + rng.choice([0, 1e-8, 1e-7, .2, .6, 1.8])) + point = [rng.choice(coords[axis] + special + [rng.uniform(-3, 3)]) for axis in range(3)] + block = rng.choice([(0, 0, 0), (-17, -64, -1), (30_000_000, 64, -30_000_000)]) + start = [rng.uniform(-3, 3) + v for v in block] + end = [rng.uniform(-3, 3) + v for v in block] + if step % 13 == 0: + start = [.5 + v for v in block] + if step % 17 == 0: + end = start[:] + if step % 19 == 0: + end = [v + 1e-5 for v in start] + amount = rng.choice(special) if step % 4 == 0 else rng.uniform(-4, 4) + yield f"query {shape_id} " + numbers(lower + upper + start + end + point) + f" {' '.join(map(str, block))} {rng.randrange(3)} " + number(amount) + shape_id += 1 + for _ in range(2500): + count = rng.randrange(9) + selected = [rng.randrange(shape_id) for _ in range(count)] + yield "many " + numbers(vector() + vector()) + f" {rng.randrange(3)} " + number(component()) + f" {count}" + (" " + " ".join(map(str, selected)) if selected else "") + for step in range(12000): + count = rng.randrange(12) + selected = [rng.randrange(shape_id) for _ in range(count)] + movement = vector() if step % 3 == 0 else [rng.choice([0.0, -0.0, 1e-8, -1e-8, .3, -.3, 1.0, -1.0]) for _ in range(3)] + lower = [rng.choice([-1.0, -.6, -.5, -0.0, 0.0, .5, 1.0]) for _ in range(3)] if step % 4 else vector() + upper = [v + rng.choice([0.0, .6, 1.0, 1.8]) for v in lower] + max_step = rng.choice([0.0, -0.0, .5, .6, 1.0, 2.0, float("nan"), float("inf")]) + current_y = rng.choice([0.0, -0.0, -.5, .5, -.6, .6, float("nan")]) + yield "motion " + numbers(lower + upper + movement + [max_step, current_y]) + f" {count}" + (" " + " ".join(map(str, selected)) if selected else "") + epsilon_shapes = [] + for offset in [0.0, -0.0, 1e-8, -1e-8, 1e-7, math.nextafter(1e-7, 0), math.nextafter(1e-7, math.inf), -1e-7, 1.0-1e-7, 1.0, 1.0+1e-7, 2.0]: + epsilon_shapes.append(shape_id) + shape_id += 1 + yield "grid 0 1 1 1 " + numbers([offset, offset+1, 0, 1, 0, 1]) + " 1" + for first in epsilon_shapes: + for second in epsilon_shapes: + for operation in range(0, 16, 2): + yield f"join {first} {second} {operation}" + shape_id += 1 + # Joined shapes feed subsequent joins and collision queries. Sparse and empty + # results retain merged coordinate metadata, which affects later operations. + for step in range(4500): + first = rng.randrange(shape_id) + second = first if step % 7 == 0 else rng.randrange(shape_id) + operation = step % 16 + yield f"join {first} {second} {operation}" + if operation & 1: + continue + new_id = shape_id + shape_id += 1 + for axis in range(3): + lower = [rng.uniform(-2, 2) for _ in range(3)] + upper = [v + rng.choice([.2, .6, 1.8]) for v in lower] + start, end = [rng.uniform(-2, 2) for _ in range(3)], [rng.uniform(-2, 2) for _ in range(3)] + point = [rng.choice([0, .5, 1, rng.uniform(-2, 2), float("nan")]) for _ in range(3)] + yield f"query {new_id} " + numbers(lower + upper + start + end + point) + f" 0 0 0 {axis} " + number(rng.uniform(-3, 3)) + for step in range(600): + lower = [rng.choice([0, -0.0, -.5, .125, .25, .5, .875, 1, 1e-8, -1e-8, 1e-7, -1e-7]) for _ in range(3)] + upper = [v + rng.choice([0, 1e-8, 1e-7, math.nextafter(1e-7, math.inf), .125, .25, .5, 1, .3333333333333333]) for v in lower] + if step % 31 == 0: + lower, upper = [0.0] * 3, [1.0] * 3 + yield "make-box " + numbers(lower + upper) + shape_id += 1 + for step in range(1000): + first = rng.randrange(shape_id) + if step % 2: + second = rng.randrange(shape_id) + operation = (step // 2) % 16 + yield f"join-optimized {first} {second} {operation}" + if operation & 1: + continue + else: + yield f"optimize {first}" + new_id = shape_id + shape_id += 1 + lower, upper = [-.6, 0, .2], [-.2, 1.8, .8] + yield f"query {new_id} " + numbers(lower + upper + [-1, .5, .5, 2, .5, .5, .5, .5, .5]) + " 0 0 0 0 " + number(1) + + + yield from step_corpus(rng, shape_id, vector) + yield from sweep_corpus(rng, vector) + for _ in range(12000): + yield f"floor-height {rng.randrange(shape_id)} {rng.randrange(shape_id)}" + + +def sweep_corpus(rng, vector): + for step in range(2400): + base = rng.choice([-2147483648, -30000000, -17, -1, 0, 16, 30000000, 2147483640]) + a = [base + rng.randrange(4) for _ in range(3)] + b = [base + rng.randrange(7) for _ in range(3)] + direction = vector() if step % 5 == 0 else [rng.choice([-2, -1, -0.0, 0.0, 1, 2]) for _ in range(3)] + limit = rng.choice([0, 1, 3, 10, 1000]) + yield f"block-iterate {' '.join(map(str, a+b))} " + numbers(direction) + f" {limit}" + lower = [v + rng.choice([0.0, -0.0, .25, .5, .99999999]) for v in a] + upper = [v + rng.choice([0.0, .25, .6, 1.0, 1.8]) for v in lower] + yield "box-iterate " + numbers(lower + upper + direction) + f" {limit}" + float_epsilon = struct.unpack(">f", struct.pack(">f", 1e-5))[0] + epsilon = math.sqrt(struct.unpack(">f", struct.pack(">f", float_epsilon * float_epsilon))[0]) + for axis in range(3): + for sign in [-1, 1]: + for value in [epsilon, math.nextafter(epsilon, 0), math.nextafter(epsilon, math.inf)]: + end = [0.0] * 3 + end[axis] = sign * value + yield "sweep " + numbers([0.0] * 3 + end + [-1.0] * 3 + [1.0] * 3) + " 0" + for step in range(9000): + base = rng.choice([-30000000, -17, -1, 0, 16, 30000000]) + start = [base + rng.choice([-1.0, -0.0, 0.0, .5, 1.0, rng.uniform(-3, 3)]) for _ in range(3)] + delta = [rng.choice([-4, -1, -1e-5, -1e-8, -0.0, 0.0, 1e-8, 1e-5, 1, 4, rng.uniform(-5, 5)]) for _ in range(3)] + if step % 19 == 0: + delta = [rng.choice([0.0, 1e-200, epsilon, math.nextafter(epsilon, 0), math.nextafter(epsilon, math.inf)]), 0.0, 0.0] + end = [a+b for a, b in zip(start, delta)] + lower = [end[i] + rng.choice([-1.0, -.3, -0.0, 0.0]) for i in range(3)] + upper = [v + rng.choice([0.0, .3, .6, 1.0, 1.8, 2.0]) for v in lower] + yield "sweep " + numbers(start + end + lower + upper) + f" {rng.choice([0, 1, 2, 4, 10, 1000])}" + # Packed-position identity aliases Y every 4096 blocks. The initial loop + # still visits all cells; subsequent footprints use the packed dedup set. + for delta in [0.0, 1e-8, 1.0, -1.0]: + yield "sweep " + numbers([0, 0, 0, delta, 0, 0, delta, -2048, 0, delta+.3, 2048, .3]) + " 0" + + +def step_corpus(rng, shape_id, vector): + def selected(ids): + return str(len(ids)) + (" " + " ".join(map(str, ids)) if ids else "") + # Controlled shape selection invokes the real Entity.collide, including its + # second query. Ledges, floors and ceilings exercise success and failure. + ledges = [] + for height in [.125, .5, .6, 1.0, 1.5, math.nextafter(.5, 0), math.nextafter(.5, math.inf)]: + ledges.append(shape_id) + yield "grid 0 1 1 1 " + numbers([0, 1, 0, height, 0, 1]) + " 1" + shape_id += 1 + floor = shape_id + yield "grid 0 1 1 1 " + numbers([-8, 8, -1, 0, -8, 8]) + " 1" + shape_id += 1 + ceiling = shape_id + yield "grid 0 1 1 1 " + numbers([-8, 8, 2.1, 3, -8, 8]) + " 1" + shape_id += 1 + for ledge in ledges: + for height in [0.0, .5, .6, 1.0, 2.0]: + for y in [0.0, .2, 1.0]: + for dy in [0.0, -.1, -2.0, .1]: + for grounded in [0, 1]: + for overhang in [False, True]: + blocks = [floor, ledge] + ([ceiling] if overhang else []) + bounds = [-.6, y, .2, -.2, y+1.8, .8] + yield "step-motion " + numbers(bounds + [1.0, dy, 0.0, height]) + f" {grounded} 0 " + selected(blocks) + " " + selected(blocks) + " -1" + for step in range(16000): + def random_shapes(): + return [rng.randrange(shape_id) for _ in range(rng.randrange(9))] + entities, initial, stepping = random_shapes(), random_shapes(), random_shapes() + if step % 3 == 0: + initial = stepping = [floor, rng.choice(ledges)] + lower = [rng.choice([-1.0, -.6, -.5, -0.0, 0.0, .5, 1.0]) for _ in range(3)] + if step % 11 == 0: + lower = vector() + upper = [v + rng.choice([0.0, .6, 1.0, 1.8]) for v in lower] + movement = vector() if step % 4 == 0 else [rng.choice([0.0, -0.0, 1e-200, 1e-8, -1e-8, .3, -.3, 1.0, -1.0]) for _ in range(3)] + height = rng.choice([0.0, -0.0, -.6, .5, .6, 1.0, 2.0, float("nan"), float("inf")]) + border = rng.randrange(shape_id) if step % 5 == 0 else -1 + yield "step-motion " + numbers(lower + upper + movement + [height]) + f" {rng.randrange(2)} " + " ".join(map(selected, [entities, initial, stepping])) + f" {border}" + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--prepare", action="store_true") + args = parser.parse_args() + directory = lab.LOCAL / "rust-geometry-parity" + directory.mkdir(parents=True, exist_ok=True) + report_path = directory / "report.json" + report_path.unlink(missing_ok=True) + if args.prepare: + lab.prepare() + lock, jars, libraries = test_rust_parity.verify_artifacts() + base = Path(tempfile.mkdtemp(prefix="run-", dir=directory)) + commands = list(corpus()) + inputs = base / "inputs.txt" + inputs.write_text("\n".join(commands) + "\n", encoding="utf-8") + oracle = lab.ROOT / "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaGeometryOracle.java" + sources = [oracle, Path(__file__).resolve(), lab.ROOT / "tools/test_rust_parity.py", lab.ROOT / "Cargo.toml", lab.ROOT / "Cargo.lock", lab.ROOT / "crates/horizon-core/Cargo.toml", *sorted((lab.ROOT / "crates/horizon-core/src").rglob("*.rs"))] + tested_sources = test_rust_parity.source_hashes(sources) + classes = base / "classes" + classes.mkdir() + dependency_path = os.pathsep.join(map(str, libraries)) + test_rust_parity.run(["javac", "--release", "25", "-proc:none", "-cp", os.pathsep.join([str(jars["server"]), dependency_path]), "-d", str(classes), str(oracle)]) + test_rust_parity.run(["cargo", "build", "--release", "--bin", "horizon-geometry-parity"]) + metadata = json.loads(subprocess.check_output(["cargo", "metadata", "--no-deps", "--format-version", "1"], cwd=lab.ROOT, text=True)) + binary = Path(metadata["target_directory"]) / "release" / ("horizon-geometry-parity.exe" if os.name == "nt" else "horizon-geometry-parity") + candidate = base / "rust.txt" + with inputs.open("rb") as stdin, candidate.open("wb") as stdout: + test_rust_parity.run([str(binary)], stdin=stdin, stdout=stdout) + references = [] + for side, jar in jars.items(): + reference = base / f"vanilla-{side}.txt" + with (base / f"vanilla-{side}.log").open("wb") as log: + test_rust_parity.run(["java", "-Xmx512M", "-cp", os.pathsep.join([str(classes), str(jar), dependency_path]), "dev.horizonlab.parity.VanillaGeometryOracle", str(inputs), str(reference)], stdout=log, stderr=subprocess.STDOUT) + matched = test_rust_parity.compare(reference, candidate) + references.append({"side": side, "jar_sha256": lab.digest(jar, "sha256"), "output_sha256": lab.digest(reference, "sha256"), "matched_output_lines": matched}) + print(f"{side}: {matched:,} geometry output lines match", flush=True) + test_rust_parity.ensure_sources_unchanged(sources, tested_sources) + report = {"schema": 1, "minecraft": lock["minecraft"]["version"], "manifest_sha1": lock["minecraft"]["manifest_sha1"], "platform": platform.platform(), + "java": subprocess.check_output(["java", "--version"], text=True).splitlines()[0], "rustc": subprocess.check_output(["rustc", "--version"], text=True).strip(), + "commands": dict(Counter(command.split()[0] for command in commands)), "inputs_sha256": lab.digest(inputs, "sha256"), "rust_output_sha256": lab.digest(candidate, "sha256"), + "sources_sha256": tested_sources, "references": references, + "scope": "Selected Vec3/AABB operations, sine table entries, quantized trig, rotations and look directions; finite block-ray traversal; bounded inclusive/directional block iteration and finite swept-block visits with step indices; immutable cube/array voxel-grid bounds, column minima/maxima, greedy boxes, collide, ray hits, closest points and cell lookup; lazy floor-height selection; box quantization, optimized/unoptimized Boolean joins, alias identity and joinIsNotEmpty; Entity.collideWithShapes, candidate step heights and Entity.collide step-up decisions/query bounds with caller-controlled block/entity/border shape lists. No live entities, actual world shape selection, grounding/velocity side effects, fluids or block behavior."} + lab.write_json(report_path, report) + lab.write_json(base / "report.json", report) + print(f"Geometry comparison passed: {report_path}") + + +if __name__ == "__main__": + main() diff --git a/tools/test_height_provider_parity.py b/tools/test_height_provider_parity.py new file mode 100644 index 000000000..a14b7f8ca --- /dev/null +++ b/tools/test_height_provider_parity.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python3 +"""Compare anchored height-provider decoding and seeded samples with pinned vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import random +import subprocess +try: + from . import lab,test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def definitions(): + encode=lambda value:json.dumps(value,separators=(',',':')) + anchors=[{'absolute':-64},{'absolute':0},{'absolute':1},{'absolute':2031},{'above_bottom':8},{'below_top':1},{'relative_to_sea_level':-8}] + for value in [None,False,0,[],{},*anchors,{'absolute':2032},{'absolute':0,'above_bottom':1}]: + yield encode(value);yield encode({'type':'constant','value':value}) + for minimum in anchors: + for maximum in anchors: + for kind in ['uniform','biased_to_bottom','very_biased_to_bottom','trapezoid']: + yield encode({'type':kind,'min_inclusive':minimum,'max_inclusive':maximum}) + for kind in ['biased_to_bottom','very_biased_to_bottom','trapezoid']: + field='plateau' if kind=='trapezoid' else 'inner' + for token in ['null','false','"1"','{}','[]','-1','0','1','2','4','14','100','2147483647','-2147483648','4294967297','1e100']: + yield '{"type":"'+kind+'","min_inclusive":{"absolute":0},"max_inclusive":{"absolute":14},"'+field+'":'+token+'}' + yield '{"type":"uniform","absolute":5,"min_inclusive":{"absolute":0},"max_inclusive":{"absolute":1}}' + yield '{"type":"constant","value":{"absolute":0},"value":{"relative_to_sea_level":0}}' + yield '{"type":"trapezoid","min_inclusive":{"absolute":-7},"max_inclusive":{"absolute":7}}' + yield '{"type":":uniform","min_inclusive":{"above_bottom":8},"max_inclusive":{"below_top":1}}' + + + # Zero-weight entries remain part of declared bounds, but are never sampled. + constant = (lambda n: {'absolute': n}) if True else (lambda n: n) + weighted = lambda entries: {'type': 'weighted_list', 'distribution': entries} + entry = lambda value, weight: {'data': value, 'weight': weight} + choices = [constant(-7), constant(19), {'type': 'uniform', 'min_inclusive': constant(0), 'max_inclusive': constant(31)}] + for weights in [(1,), (0,), (0, 1), (1, 0), (1, 1), (1, 62), (1, 63), (1, 64), (0, 3, 7), (2147483647,), (2147483646, 1), (2147483647, 1), (-1, 2), (4294967297, 2), (0.9, 1.9)]: + value = weighted([entry(choices[i % len(choices)], weight) for i, weight in enumerate(weights)]) + yield encode(value) + nested = weighted([entry(constant(5), 1), entry(constant(-9), 4)]) + yield encode(weighted([entry(nested, 3), entry(choices[-1], 2)])) + for distribution in [None, {}, [], [entry(constant(0), 0), entry(constant(1), 0)], [entry(None, 0), entry(constant(1), 1)], [{'data': constant(1)}], [{'weight': 1}], [entry(constant(1), '1')], [entry(constant(1), None)]]: + yield encode(weighted(distribution)) + + +def corpus(): + definitions_list=list(definitions()) + contexts=[[-64,384,63],[0,128,32],[-2032,4064,0],[2**31-1,-2**31,2**31-1],[-2**31,2**31-1,-2**31]] + for legacy in [False,True]: + for seed in [0,-1,0x123456789abcdef]: + for context in contexts: + for definition in definitions_list:yield {'definition':definition,'context':context,'legacy':legacy,'seed':seed,'samples':32} + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument("--prepare",action="store_true");args=parser.parse_args() + build=lab.LOCAL/"rust-height-provider-parity";build.mkdir(parents=True,exist_ok=True) + report_path=build/"report.json";report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightProviderOracle.java" + helper=oracle.with_name("VanillaAnchorOracle.java") + sources=[oracle,helper,Path(__file__),lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock",lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml", + *sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/height_provider_fixture.rs"] + tested_sources=base.source_hashes(sources) + fixtures=list(corpus());inputs=build/"inputs.txt";inputs.write_text("".join(json.dumps(f,separators=(",",":"))+"\n" for f in fixtures),encoding="utf-8") + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths);classes=build/"classes";classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle,helper],"compile-java") + run(["cargo","build","--release","-p","horizon-world","--example","height_provider_fixture"],"compile-rust") + metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) + binary=Path(metadata["target_directory"])/"release/examples"/("height_provider_fixture.exe" if os.name=="nt" else "height_provider_fixture") + run([binary,build],"rust") + references=[] + for side,jar in jars.items(): + reference=build/f"{side}.txt" + run(["java","-Xmx512M","-cp",os.pathsep.join([str(classes),str(jar),dependency_path]),"dev.horizonlab.parity.VanillaHeightProviderOracle",side,build],side) + matched=base.compare(reference,build/"rust.txt") + references.append({"side":side,"jar_sha256":lab.digest(jar,"sha256"),"output_sha256":lab.digest(reference,"sha256"),"matched_output_lines":matched}) + print(f"{side}: {matched:,} height-provider output lines match Rust",flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={"schema":1,"minecraft":lock["minecraft"]["version"],"manifest_sha1":lock["minecraft"]["manifest_sha1"],"platform":platform.platform(), + "java":subprocess.check_output(["java","--version"],text=True).splitlines()[0],"rustc":subprocess.check_output(["rustc","--version"],text=True).strip(), + "fixtures":len(fixtures),"definitions":len(list(definitions())),"samples_per_valid_fixture":32, + "sources_sha256":tested_sources,"fixtures_sha256":tested_fixtures,"rust_output_sha256":lab.digest(build/"rust.txt","sha256"),"references":references, + "scope":"Actual HeightProvider.CODEC decoding and sampled heights with interleaved nextLong values, using actual WorldGenerationContext and all four vertical-anchor kinds. Covers constant, uniform, biased-to-bottom, very-biased-to-bottom trapezoid and weighted-list providers, both random modes, empty/equal ranges, inner/plateau defaults and bounds, numeric narrowing, relative coordinate overflow, malformed fields and anchor-versus-dispatch preference. Warning logs are excluded. Weighted lists include zero weights, singleton draws, nested providers, 63/64/65 weight totals, maximum/overflow totals and malformed entries; native constructor rejections count as decode errors. Encoding, cave/canyon paths and complete generation remain outside this scope."} + + lab.write_json(report_path,report);print(f"Scoped height-provider parity passed: {report_path}") + + +if __name__=="__main__":main() diff --git a/tools/test_heightmap_parity.py b/tools/test_heightmap_parity.py new file mode 100644 index 000000000..86368997c --- /dev/null +++ b/tools/test_heightmap_parity.py @@ -0,0 +1,122 @@ +#!/usr/bin/env python3 +"""Compare packed heightmaps with the pinned Java chunk and heightmap runtime.""" +import argparse +from collections import Counter +import json +import os +from pathlib import Path +import platform +import random +import subprocess + +try: + from . import lab, test_rust_parity as base, test_worldgen_parity as worldgen +except ImportError: + import lab + import test_rust_parity as base + import test_worldgen_parity as worldgen + + +def corpus(facts): + states, defaults = facts["states"], facts["defaults"] + air, stone = defaults["minecraft:air"], defaults["minecraft:stone"] + choices = [defaults["minecraft:"+name] for name in ["air", "cave_air", "void_air", "stone", "water", "lava", "oak_leaves", "oak_slab", "seagrass", "snow", "powder_snow", "glass", "barrier"]] + rng = random.Random(0x484f52495a4f4e484549474854) + def fixture(minimum, height, initial, ops, trace=False): + return {"min": minimum, "height": height, "initial": initial, "ops": ops, "trace": trace} + # Every state participates in insertion and removal, not just predicate export. + ops=[] + for state in range(len(states)): + ops.extend([["set", 4, 5, 7, state, 63], ["query", 4, 7], ["set", 4, 5, 7, air, 63]]) + yield fixture(0, 16, [], [*ops, ["dump"]]) + # Exercise section boundaries, the full codec height bound and all bit widths. + for minimum, height in [(-64,384),(0,256),(0,128),(-2032,4064),(2016,16),(-2032,16),(0,16),(0,32),(0,64),(0,512),(0,1024),(0,2032)]: + initial=[[x,minimum+(x*97+z*13)%height,z,choices[(x+z)%len(choices)]] for x in range(16) for z in range(16)] + ops=[["prime",63],["dump"]] + for x in range(16): + for z in range(16):ops.append(["query",x,z]) + for x,y,z,_ in initial:ops.extend([["set",x,y,z,air,63],["query",x,z]]) + ops.extend([["prime",63],["dump"]]) + yield fixture(minimum,height,initial,ops,height==16) + # Re-priming empty columns retains old values; invalid lengths take that path. + for height in [16,32,128,256,384,1024,2032]: + bits=height.bit_length();words=(256+(64//bits)-1)//(64//bits) + for fill in ["0","ffffffffffffffff","a55a00ff55ff00aa"]: + ops=[] + for t in range(6):ops.append(["raw",t,[fill]*words]) + ops.extend([["prime",0],["dump"],["prime",63],["dump"]]) + for t in range(6):ops.extend([["raw",t,[]],["raw",t,["0"]*(words+1)]]) + for x,z in [(0,0),(15,15),(16,0),(-1,1),(0,16),(-1,0),(2**31-1,2**31-1)]:ops.append(["query",x,z]) + ops.extend([["update",0,2**31-1,0,stone,0],["update",0,-2**31,0,air,0],["dump"]]) + yield fixture(0,height,[[2,height-1,3,stone]],ops,height==16 and fill=="a55a00ff55ff00aa") + # Mutation and raw edits interleave; repeated columns force downward rescans. + for scenario in range(64): + minimum,height=rng.choice([(-64,384),(0,16),(-16,32),(0,128)]) + initial=[] + for i in range(64):initial.append([rng.randrange(16),minimum+rng.randrange(height),rng.randrange(16),rng.choice(choices)]) + ops=[["prime",63]] + for i in range(192): + x,z=rng.choice([(0,0),(15,15),(3,9)]) + y=minimum+rng.choice([0,height-1,rng.randrange(height)]) + state=rng.choice(choices) if i%3 else rng.randrange(len(states)) + ops.extend([["set",x,y,z,state,63],["query",x,z]]) + if i%47==0:ops.extend([["prime",rng.randrange(64)],["dump"]]) + ops.extend([["prime",63],["dump"]]) + yield fixture(minimum,height,initial,ops,scenario<2) + # All-air sections collapse cave/void air to AIR when read through ProtoChunk. + for other in [air,stone]: + initial=[[2,7,3,defaults["minecraft:cave_air"]],[3,7,3,defaults["minecraft:void_air"]],[15,0,15,other]] + yield fixture(0,16,initial,[["prime",63],["query",2,3],["query",3,3],["dump"]],True) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__) + parser.add_argument("--prepare",action="store_true") + args=parser.parse_args() + build=lab.LOCAL/"rust-heightmap-parity";build.mkdir(parents=True,exist_ok=True) + report_path=build/"report.json";report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + tags=worldgen.tag_resources(jars["server"]) + if not tags or tags!=worldgen.tag_resources(jars["client"]):raise ValueError("client/server block tags differ or are empty") + oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java" + sources=[oracle,Path(__file__),lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock", + lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml", + *sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/heightmap_fixture.rs"] + tested_sources=base.source_hashes(sources) + classes=build/"classes";classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle],"compile-java") + def java(side,mode,path): + run(["java","-Xmx1G","-cp",os.pathsep.join([str(classes),str(jars[side]),dependency_path]),"dev.horizonlab.parity.VanillaHeightmapOracle",mode,path],side+"-"+mode) + for side in jars:java(side,"export",build/f"facts-{side}.json") + facts=json.loads((build/"facts-server.json").read_text()) + if facts!=json.loads((build/"facts-client.json").read_text()):raise ValueError("client/server state facts differ") + if len(facts["states"])!=35723:raise ValueError("incomplete pinned state table") + fixtures=list(corpus(facts));inputs=build/"inputs.txt" + inputs.write_text("".join(json.dumps(value,separators=(",",":"))+"\n" for value in fixtures),encoding="utf-8") + (build/"tags.json").write_text(json.dumps(tags,separators=(",",":")),encoding="utf-8") + fixture_paths=[inputs,build/"tags.json",build/"facts-client.json",build/"facts-server.json"] + tested_fixtures=base.source_hashes(fixture_paths) + run(["cargo","build","--release","-p","horizon-world","--example","heightmap_fixture"],"compile-rust") + metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) + binary=Path(metadata["target_directory"])/"release/examples"/("heightmap_fixture.exe" if os.name=="nt" else "heightmap_fixture") + run([binary,build],"rust") + references=[] + for side,jar in jars.items(): + java(side,side,build) + reference=build/f"{side}.txt";matched=base.compare(reference,build/"rust.txt") + references.append({"side":side,"jar_sha256":lab.digest(jar,"sha256"),"output_sha256":lab.digest(reference,"sha256"),"matched_output_lines":matched}) + print(f"{side}: {matched:,} heightmap output lines match Rust",flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={"schema":1,"minecraft":lock["minecraft"]["version"],"manifest_sha1":lock["minecraft"]["manifest_sha1"],"platform":platform.platform(), + "java":subprocess.check_output(["java","--version"],text=True).splitlines()[0],"rustc":subprocess.check_output(["rustc","--version"],text=True).strip(), + "block_states":len(facts["states"]),"block_tag_files":len(tags),"fixtures":len(fixtures),"operation_counts":dict(Counter(op[0] for fixture in fixtures for op in fixture["ops"])), + "sources_sha256":tested_sources,"fixtures_sha256":tested_fixtures,"rust_output_sha256":lab.digest(build/"rust.txt","sha256"),"references":references, + "scope":"Six heightmap types, client/persistence flags and predicates for every pinned block state. Air/fluid facts are imported independently from both authenticated JARs and required to agree; block-tag membership is resolved in Rust from bundled resources. State behavioral methods are not ported by that import. Actual vanilla ProtoChunk and Heightmap APIs compare insertion/removal, downward rescans, repeated priming, empty-column retention, raw packed words including padding/unused slots, invalid-length fallback, wrapped column indexing, height queries, errors and selected exact block-read traces. Positive aligned vertical ranges are bounded to the NoiseSettings codec domain; arbitrary height accessors, chunk lifecycle integration, complete terrain/gameplay and rendering remain pending."} + lab.write_json(report_path,report);print(f"Scoped heightmap parity passed: {report_path}") + + +if __name__=="__main__":main() diff --git a/tools/test_material_condition_parity.py b/tools/test_material_condition_parity.py new file mode 100644 index 000000000..43e0fa48b --- /dev/null +++ b/tools/test_material_condition_parity.py @@ -0,0 +1,316 @@ +#!/usr/bin/env python3 +"""Compare numeric material conditions and cache transitions with pinned vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import random +import subprocess +import zipfile +try: + from . import lab,test_rust_parity as base,test_worldgen_parity as worldgen,test_biome_temperature_parity as biome +except ImportError: + import lab + import test_rust_parity as base + import test_worldgen_parity as worldgen + import test_biome_temperature_parity as biome + + +def corpus(): + rng=random.Random(0x484f52495a4f4e434f4e444954494f4e) + edges=[-2**31,-2032,-64,-21,-20,-5,-4,-3,-1,0,1,3,4,5,20,21,63,2031,2**31-1] + conditions=[["hole"],["steep"]] + for multiplier in [-2**31,-20,-1,0,1,20,2**31-1]: + for add in [False,True]: + for kind in range(4):conditions.append(["y",[kind,[-64,0,63,2**31-1][kind]],multiplier,add]) + conditions.append(["water",edges[(multiplier+3)%len(edges)],multiplier,add]) + for secondary in [-2**31,-100,-1,0,1,2,12,2**31-1]: + for add in [False,True]: + for ceiling in [False,True]:conditions.append(["stone",edges[(secondary+7)%len(edges)],add,secondary,ceiling]) + for name in ["bedrock_floor","minecraft:bedrock_floor",":bedrock_roof","horizon:test",""]: + for low,high in [([0,-64],[0,64]),([1,0],[1,5]),([2,5],[2,0]),([3,-5],[3,5]),([0,0],[0,0]),([0,64],[0,-64]),([0,-2**31],[0,2**31-1])]: + conditions.append(["gradient",name,low,high]) + conditions += [["not",["hole"]],["not",["not",["stone",0,True,12,False]]]] + secondary_bits=[0,0x80000000,1,0x80000001,0x3f000000,0xbf000000,0x3f800000,0xbf800000,0x40000000,0xc0000000,0x7f7fffff,0xff7fffff,0x7f800000,0xff800000,0x7fc00000]+[rng.getrandbits(32) for _ in range(81)] + seeds=[0,1,-1,-2**63,2**63-1]+[rng.randrange(-2**63,2**63) for _ in range(19)] + for fixture,seed in enumerate(seeds): + ops=[["eval"],["eval"],["secondary"]] + for i,bits in enumerate(secondary_bits): + depth=edges[(i+fixture)%len(edges)] + x,z=[rng.choice(edges) if i%3==0 else rng.randrange(-30000000,30000001) for _ in range(2)] + above,below,water=[rng.choice(edges) for _ in range(3)] + y=[-65,-64,-63,-1,0,1,62,63,64,65][i%10] if i%2 else rng.choice(edges) + ops += [["input",depth,f"{bits:x}"],["xz",x,z,edges[i%len(edges)],edges[(i+9)%len(edges)]],["y",above,below,water,y],["eval"],["eval"]] + # Changing source values alone does not invalidate cached results. + ops += [["input",depth^1,f"{secondary_bits[(i+7)%len(secondary_bits)]:x}"],["secondary"],["y",below,above,water,y],["eval"],["secondary"]] + if i%12==0: + ops += [["add",["not",["gradient","horizon:late",[0,-64],[0,64]]]],["eval"]] + for legacy in [False,True]: + yield {"seed":seed,"legacy":legacy,"context":[[-64,384,63],[0,256,32],[-2032,4064,0],[2**31-1,-2**31,-2**31]][fixture%4],"conditions":conditions,"ops":ops} + + +def condition_resources(jar): + prefix="data/minecraft/worldgen/material_condition/" + with zipfile.ZipFile(jar) as archive: + return {"minecraft:"+name[len(prefix):-5]:archive.read(name).decode("utf-8") for name in sorted(archive.namelist()) if name.startswith(prefix) and name.endswith(".json")} + + +def codec_corpus(definitions): + templates=[ + {"type":"hole"},{"type":"steep"},{"type":"temperature"}, + {"type":"biome","biome_is":["minecraft:plains"]}, + {"type":"noise_threshold","noise":"surface","min_threshold":-1.0,"max_threshold":1.0,"is_3d":False}, + {"type":"y_above","anchor":{"absolute":0},"surface_depth_multiplier":0,"add_stone_depth":False}, + {"type":"water","offset":0,"surface_depth_multiplier":0,"add_stone_depth":False}, + {"type":"stone_depth","offset":0,"add_surface_depth":False,"secondary_depth_range":0,"surface_type":"floor"}, + {"type":"vertical_gradient","random_name":"bedrock_floor","true_at_and_below":{"above_bottom":0},"false_at_and_above":{"above_bottom":5}}, + {"type":"not","invert":{"type":"hole"}}, + ] + cases=['null','false','0','[]','{}','"minecraft:unknown"'] + cases += list(definitions.values())+[json.dumps(name) for name in definitions] + cases += [json.dumps({"type":"not","invert":name}) for name in definitions] + tokens=['null','true','false','0','1','-1','-21','-20','20','21','2147483647','-2147483648','4294967296','4294967295','0.99','-0.99','1e100','1e1000','-1e1000','1e-100','""','"floor"','"ceiling"','"FLOOR"','"true"','"a:b:c"','[]','{}','{"absolute":0}','{"above_bottom":0,"below_top":0,"relative_to_sea_level":0}'] + for template in templates: + cases.append(json.dumps(template,separators=(",",":"))) + for key in template: + cases.append(json.dumps({k:v for k,v in template.items() if k!=key})) + for token in tokens: + fields=[json.dumps(k)+":"+(token if k==key else json.dumps(v,separators=(",",":"))) for k,v in template.items()] + cases.append("{"+",".join(fields)+"}") + for prefix in ["minecraft:",":","other:","Minecraft:"]: + cases.append(json.dumps(dict(template,type=prefix+template["type"]))) + cases.append(json.dumps(dict(template,unknown=[1,2,3]))) + cases += ['{"type":"hole","type":"steep"}','{"type":"hole","type":null}'] + base=next(corpus()) + for context in [[-64,384,63],[0,256,32],[-2032,4064,0],[2**31-1,-2**31,-2**31]]: + for legacy in [False,True]: + yield {"seed":-1,"legacy":legacy,"context":context,"conditions":[],"json":cases,"ops":base["ops"][:166]} + + +def rule_corpus(definitions): + rng=random.Random(0x484f52495a4f4e52554c45) + base=next(corpus()) + choices=base["conditions"]+[["json",json.dumps(name)] for name in sorted(definitions)] + def tree(depth): + kind=rng.randrange(4 if depth else 2) + if kind==0:return ["block",rng.randrange(10)] + if kind==1:return ["band"] + if kind==2:return ["if",rng.choice(choices),tree(depth-1)] + return ["sequence",[tree(depth-1) for _ in range(rng.randrange(4))]] + rules=[["block",i] for i in range(10)]+[["band"],["sequence",[]],["sequence",[["block",8]]],["sequence",[["sequence",[]]]]] + rules += [["if",c,["block",7]] for c in choices] + rules += [["sequence",[["block",8],["if",["stone",0,False,12,False],["block",7]],["band"]]], + ["sequence",[["if",["hole"],["block",0]],["if",["not",["hole"]],["band"]]]], + ["if",["stone",0,True,12,False],["sequence",[["if",["steep"],["block",1]],["block",9]]]]] + rules += [tree(3) for _ in range(48)] + edges=[-2**31,-1000,-193,-192,-65,-64,-1,0,1,63,64,191,192,319,2**31-1] + for fixture in range(12): + ops=[["apply",0,0,0],["apply",0,0,0]] + for i in range(64): + x,y,z=[rng.choice(edges) for _ in range(3)] + a,b,w=[rng.choice(edges) for _ in range(3)] + ops += [["input",[-1,0,1,4,12,2**31-1][i%6],["0","3f800000","bf800000","7f800000","7fc00000"][i%5]], + ["xz",x,z,[-5,-4,-3,0,3,4,5][i%7],[5,4,3,0,-3,-4,-5][i%7]],["y",a,b,w,y], + ["apply",x,y,z],["apply",x,y,z],["apply",z,edges[(i+7)%len(edges)],x]] + if i%16==0:ops += [["rule",tree(3)]] + for legacy in [False,True]: + yield {"seed":[0,1,-1,-2**63,2**63-1,987654321][fixture%6],"legacy":legacy,"context":[-64,384,63],"conditions":[],"rules":rules,"ops":ops} + + +def noise_corpus(noises): + import struct + bits=lambda value:struct.pack('>d',value).hex() + bounds=[(-1.,1.),(0.,0.),(-0.,0.),(1.,-1.),(float('-inf'),float('inf')),(float('nan'),1.),(-1.,float('nan'))] + conditions=[] + for name in ['surface','minecraft:surface',':surface_secondary','minecraft:clay_bands_offset']: + for is3d in [False,True]: + for low,high in bounds:conditions.append(['noise',name,bits(low),bits(high),is3d]) + conditions += [['not',c] for c in conditions[:14]] + random=__import__('random').Random(0x484f52495a4f4e4e4f495345) + noise_bits=[0,0x80000000,0x3f800000,0xbf800000,0x3f800001,0xbf800001,0x3f7fffff,0xbf7fffff,0x7f800000,0xff800000,0x7fc00000]+[random.getrandbits(32) for _ in range(85)] + edges=[-2**31,-1000,-64,-1,0,1,63,319,2**31-1] + for real in [False,True]: + selected=conditions if not real else [['noise',name,bits(-0.25),bits(0.25),is3d] for name in sorted(noises) for is3d in [False,True]] + for seed in [0,1,-1,-2**63,2**63-1,87654321]: + operations=[['eval'],['eval']] + for i,b in enumerate(noise_bits): + x,y,z=[random.choice(edges) for _ in range(3)] + operations += [['input',0,f'{b:x}'],['xz',x,z,0,0],['y',0,0,0,y],['eval'],['eval'],['input',0,f'{noise_bits[(i+7)%len(noise_bits)]:x}'],['eval'],['y',0,0,0,y],['eval'],['xz',x,z,0,0],['eval']] + if i%16==0:operations += [['add',selected[i%len(selected)]],['eval']] + for legacy in [False,True]: + yield {'seed':seed,'legacy':legacy,'context':[-64,384,63],'conditions':selected,'real_noise':real,'ops':operations} + + +def biome_corpus(biomes): + names=sorted(biomes) + conditions=[['temperature'],['not',['temperature']],['biome',[]],['biome',names]] + conditions += [['biome',[name]] for name in names] + conditions += [['not',['biome',[name]]] for name in names[::7]] + conditions += [['biome',['minecraft:plains','minecraft:plains','minecraft:desert']]] + choices=[None,[],['minecraft:plains'],['minecraft:desert'],['minecraft:plains','minecraft:desert'],names] + ops=[['eval'],['eval']] + for i,name in enumerate(names): + ops += [['biome',name],['xz',i*31,i*-17,(i%9)-4,4-(i%9)],['eval'],['y',0,0,0,[-64,0,63,80,81,120,319][i%7]],['eval'],['eval']] + if i%9==0:ops += [['add',['biome',[name]]],['eval']] + # Errors after a previous result preserve that result on a same-revision + # retry. Null biome results are queried again by uncached conditions. + ops += [['biome','#throw'],['y',0,0,0,0],['eval'],['eval'],['add',['biome',['minecraft:plains']]],['eval'],['eval'], + ['biome','minecraft:plains'],['eval'],['y',0,0,0,0],['eval'],['biome',None],['y',0,0,0,81],['eval'],['eval'], + ['biome','minecraft:desert'],['xz',7,9,0,0],['eval'],['y',0,0,0,81],['eval']] + for possible in choices: + for sea in [63,-1000,2**31-1]: + yield {'seed':0,'legacy':False,'context':[-64,384,sea],'possible_biomes':possible,'conditions':conditions,'ops':ops} + + +def biome_tag_resources(jar): + prefix='data/minecraft/tags/worldgen/biome/' + with zipfile.ZipFile(jar) as archive: + return {'minecraft:'+name[len(prefix):-5]:archive.read(name).decode('utf-8') for name in sorted(archive.namelist()) if name.startswith(prefix) and name.endswith('.json')} + + +def biome_tag_corpus(biomes,tags): + conditions=[['json',json.dumps({'type':'biome','biome_is':'#'+name})] for name in sorted(tags)] + conditions += [['not',c] for c in conditions[:8]] + invalid=[{'type':'biome','biome_is':value} for value in ['#minecraft:unknown','#',['#minecraft:is_badlands'],'##minecraft:is_badlands']] + aliases=[{'type':'biome','biome_is':'#'+name.removeprefix('minecraft:')} for name in sorted(tags)] + rules=[['sequence',[['if',c,['block',7]],['block',8]]] for c in conditions] + for possible in [None,[],['minecraft:plains'],['minecraft:badlands'],sorted(biomes)]: + ops=[['eval'],['eval']] + for i,name in enumerate(sorted(biomes)): + ops += [['biome',name],['xz',i,i*-3,0,0],['y',0,0,0,i],['eval'],['apply',i,i,i*-3]] + ops += [['biome','#throw'],['y',0,0,0,80],['eval'],['eval'],['biome',None],['y',0,0,0,81],['eval'],['eval'],['biome','minecraft:plains'],['eval']] + yield {'seed':0,'legacy':False,'context':[-64,384,63],'possible_biomes':possible,'conditions':conditions,'json':[json.dumps(v) for v in [*invalid,*aliases]],'rules':rules,'ops':ops} + + +def preliminary_corpus(): + def wrap(v): return (v+2**31)%2**32-2**31 + volumes=[[4,3,5,0,-64,0,1,1,1],[5,7,3,-17,32,19,4,8,4], + [1,1,1,1024,0,-1024,1,1,1],[4,2,4,2**31-2,1,-2**31,3,2,5]] + bit_values=['00000000','80000000','3f000000','bf000000','3f7fffff','bf800001','42810000', + 'c2810000','4effffff','4f000000','cf000000','cf000001','7f800000','ff800000','7fc00000','00000001','80000001'] + conditions=[['above'],['not',['above']],['not',['not',['above']]]] + rules=[['if',['above'],['block',7]],['sequence',[['if',['not',['above']],['block',8]],['block',9]]]] + for volume in volumes: + sx,_,sz,x,_,z,_,_,_=volume + for failure in [-1,0,1,3,19]: + for first in ['minimum','eval','apply']: + # Inside-plane allocation and failed retries, or initial scalar + # lookup before the first allocation, vary independently. + initial=[first] if first!='apply' else ['apply',0,200,0] + ops=[['density','42810000',failure],['input',3,'0'],['xz',x,z,0,0],initial,['minimum'],['eval'],['apply',7,11,13]] + ops += [['density','43400000',-1],['minimum'],['eval'],['y',0,0,0,80],['minimum'],['eval']] + for iz in range(sz): + for ix in range(sx): + ops += [['xz',wrap(x+ix),wrap(z+iz),0,0],['minimum'],['y',0,0,0,(ix+iz)*31-8],['eval'],['apply',-17,90,31]] + for i,bits in enumerate(bit_values): + depth=[-2**31,-9,0,3,8,2**31-1][i%6] + # Scalar fallback: floor/conversion, wrapping, cache reuse, + # failure after a previous successful minimum, and recovery. + ox,oz=wrap(x-1-i),wrap(z-1-i) + ops += [['density',bits,-1],['input',depth,'0'],['xz',ox,oz,0,0],['minimum']] + for y in [-2**31,-65,-8,-1,0,56,64,65,2**31-1]: + ops += [['y',0,0,0,y],['eval'],['apply',0,0,0]] + ops += [['density','0',0],['minimum'],['xz',ox,oz,0,0],['eval'],['minimum'],['eval'],['density',bits,-1],['minimum'],['xz',ox,oz,0,0],['minimum']] + ops += [['add',['above']],['eval']] + yield {'seed':failure,'legacy':first=='eval','context':[-64,384,63], 'volume':volume,'conditions':conditions,'rules':rules, + 'json':['{"type":"above_preliminary_surface"}','{"type":"minecraft:above_preliminary_surface","ignored":null}'], 'ops':ops} + # A scalar lookup outside the plane must not allocate or populate it. + yield {'seed':0,'legacy':False,'context':[-64,384,63],'volume':[2,1,2,10,0,10,1,1,1], + 'conditions':conditions,'rules':rules,'ops':[['density','42810000',-1],['minimum'],['density','43400000',-1],['xz',10,10,0,0],['minimum'],['xz',0,0,0,0],['minimum']]} + + +def ore_corpus(): + def wrap(v): return (v+2**31)%2**32-2**31 + rng=random.Random(0x484f52495a4f4e4f5245) + bits=['0','80000000','00000001','3e4ccccd','3f000000','3f333333','3f7fffff','3f800000', + '3f800001','bf800000','7f800000','ff800000','7fc00000'] + volumes=[[3,4,2,-1,-2,5,1,1,1],[3,2,3,-10,-5,-15,4,8,4],[2,2,2,2**31-1,-2**31,2**31-1,2,3,2]] + chances=['0','3ca3d70a','3f000000','3f800000','bf800000','7f800000','7fc00000'] + rules=[['ore',chance] for chance in chances] + rules += [['sequence',[['block',0],['ore','3f800000']]],['if',['not',['hole']],['ore','0']]] + for volume in volumes: + sx,sy,sz,x,y,z,dx,dy,dz=volume + positions=[[wrap(x+ix*dx),wrap(y+iy*dy),wrap(z+iz*dz)] for iz in range(sz) for ix in range(sx) for iy in range(sy)] + positions += [[wrap(x-1),y,z],[x,wrap(y-1),z],[x,y,wrap(z-1)],[wrap(x+1),wrap(y+1),wrap(z+1)]] + ops=[['apply',0,0,0]] + for i in range(180): + if iI",struct.pack(">f",value))[0]:x}' + triples=[['0','3f800000','0'],['3f800000','bf800000','3f800000'],['3f800000','0','3f800000'],['3f000000','3f000000','0'],['3f800000','3f800000','3f800000'],['7fc00000','3f800000','3f800000'],['3f800000','7fc00000','3f800000'],['3f800000','3f800000','7fc00000'],['7f800000','7f800000','0'],['7f800000','7f800000','7f800000'],['80000000','80000000','80000000']] + threshold=struct.unpack('>I',struct.pack('>f',1.8/15))[0] + triples += [[bits(1.0),f'{threshold+step:x}',bits(1.0)] for step in [-1,0,1]] + for i,triple in enumerate(triples): + for pattern in range(5): + for legacy in [False,True]: + name=sorted(biomes)[(i*5+pattern)%len(biomes)] + ops=[['badlands',17,-31,64,-64],['badlands',17,-31,64,-64],['frozen',17,-31,64,-64],['frozen',17,-31,64,-64],['frozen',-1000,3001,100,50]] + yield {'seed':-2**63 if legacy else 2**63-1,'legacy':legacy,'sea':[63,-17,127][pattern%3],'default':[3,8,3,8,4][pattern],'biome':name,'min':-64,'initial':column(pattern),'noise_bits':triple+triple,'limit':4096,'ops':ops} + for sea in [-2**31,2**31-1]: + yield {'seed':0,'legacy':False,'sea':sea,'default':3,'biome':sorted(biomes)[0],'min':-64,'initial':column(0),'noise_bits':['3f800000']*6,'limit':32,'ops':[['badlands',2**31-1,-2**31,2**31-1,-64],['frozen',2**31-1,-2**31,2**31-1,-64]]} + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-material-extension-parity';build.mkdir(parents=True,exist_ok=True);report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + resources=worldgen.noise_resources(jars['server']) + if not resources or resources!=worldgen.noise_resources(jars['client']):raise ValueError('reference noise resources differ') + prefix='data/minecraft/worldgen/noise/';noises={'minecraft:'+name[len(prefix):-5]:raw for name,raw in resources.items()} + biomes=biome.biome_resources(jars['server']) + if not biomes or biomes!=biome.biome_resources(jars['client']):raise ValueError('reference biome resources differ') + for name,data in [('noises',noises),('biomes',biomes)]:(build/(name+'.json')).write_text(json.dumps(data,separators=(',',':')),encoding='utf-8') + folder=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity';oracles=[folder/(name+'.java') for name in ['VanillaMaterialExtensionOracle','VanillaBiomeTemperatureOracle']] + sources=[*oracles,Path(__file__),*[lab.ROOT/'tools'/name for name in ['test_biome_temperature_parity.py','test_worldgen_parity.py','test_rust_parity.py','lab.py']],lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/material_extension_fixture.rs'] + tested_sources=base.source_hashes(sources);fixtures=list(corpus(biomes));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(f,separators=(',',':'))+'\n' for f in fixtures),encoding='utf-8') + fixture_paths=[inputs,build/'noises.json',build/'biomes.json'];tested_fixtures=base.source_hashes(fixture_paths);classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependencies=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependencies,'-d',classes,*oracles],'compile-java') + run(['cargo','build','--release','-p','horizon-world','--example','material_extension_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True));binary=Path(metadata['target_directory'])/'release/examples'/('material_extension_fixture.exe' if os.name=='nt' else 'material_extension_fixture');run([binary,build],'rust');references=[] + for side,jar in jars.items(): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jar),dependencies]),'dev.horizonlab.parity.VanillaMaterialExtensionOracle',side,build],side) + reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt');references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched});print(f'{side}: {matched:,} material-extension output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'extension_calls':sum(len(f['ops']) for f in fixtures),'biome_resources':len(biomes),'noise_resources':len(noises),'constant_noise_fixtures':sum('noise_bits' in f for f in fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual private MaterialSystem erodedBadlandsExtension and frozenOceanExtension methods, with ordered noise-coordinate/block-read/block-write traces and complete resulting columns. Both positional random modes, actual seeded bundled noises, all biome climate settings, same-block identity across state properties, air variants, flowing water, waterlogged nonwater blocks, snow/ice thresholds, repeated calls and height clipping by supplied column providers. Constant overrides cover thresholds, signed zero, NaN/infinity, sea-level integer extremes and bounded provider read failures. Native exception class/message and full chunk/heightmap/postprocessing integration are not compared here. Rust caps extension loops to 1,048,576 iterations; oversized synthetic scans hit the fixture provider limit in both implementations. Full surface-stage and playable parity remain pending.'} + lab.write_json(report_path,report);print(f'Scoped material-extension parity passed: {report_path}') + + +if __name__=='__main__':main() diff --git a/tools/test_material_rule_library_parity.py b/tools/test_material_rule_library_parity.py new file mode 100644 index 000000000..b5f4dde58 --- /dev/null +++ b/tools/test_material_rule_library_parity.py @@ -0,0 +1,93 @@ +#!/usr/bin/env python3 +"""Compare bundled material-rule loading and evaluation with pinned vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +try: + from . import lab,test_rust_parity as base,test_worldgen_parity as worldgen,test_material_condition_parity as material,test_biome_temperature_parity as biome +except ImportError: + import lab + import test_rust_parity as base + import test_worldgen_parity as worldgen + import test_material_condition_parity as material + import test_biome_temperature_parity as biome + + +def codec_inputs(rules): + values=[json.loads(raw) for raw in rules.values()] + bases=[{'type':'block','result_state':'minecraft:stone'}, {'type':'sequence','sequence':[]}, {'type':'condition','if_true':{'type':'hole'},'then_run':{'type':'bandlands'}}, {'type':'ore_vein','ore_block':'minecraft:copper_ore','raw_ore_block':'minecraft:raw_copper_block','filler_block':'minecraft:granite','raw_ore_chance':0.02,'density':1,'richness':0.5,'filler_gap':-1}] + for base in bases: + values += [base,dict(base,ignored=None)] + for key in base: + missing=base.copy();del missing[key];values.append(missing) + for value in [None,[],False]:values.append(dict(base,**{key:value})) + values += [None,False,0,[],{},'minecraft:overworld',{'type':'bandlands'},{'type':'bandlands','unused':False},{'type':'condition','if_true':{'type':'hole'},'then_run':'minecraft:unknown'}, {'type':'block','result_state':{'id':'minecraft:water','properties':{'level':'+01'}}}, {'type':'block','result_state':{'id':'minecraft:oak_log','properties':{'axis':'invalid'}}}] + for chance in [-1,0,1,1.01,'0.02']: + values.append(dict(bases[-1],raw_ore_chance=chance)) + for field in ['density','richness','filler_gap']: + for value in ['minecraft:unknown',{'type':'minecraft:constant','argument':0},True,None]:values.append(dict(bases[-1],**{field:value})) + return [json.dumps(value,separators=(',',':')) for value in values] + + +def corpus(rules,biomes): + names=sorted(rules);biome_names=sorted(biomes) + for legacy in [False,True]: + for seed in [0,-1,87654321]: + for case in range(2): + ops=[] + for i,name in enumerate(biome_names): + for j,y in enumerate([-64,-48,-32,-8,-1,0,16,32,48,63,64,80,120,200,319]): + x=[0,1,-1,15,16,17,2**24+3,-2**24-3][(i+j)%8];z=(i%17)-8 + ops += [['biome',name],['input',[0,1,3,7][(i+j)%4],['0','3f000000','bf000000','3f800000'][(i+j)%4]],['xz',x,z,[-5,0,5][i%3],[-5,0,5][j%3]],['y',(j%6)+1,(i%8)+1,63 if j%2 else -2**31,y],['apply',x,y,z]] + if j%5==0:ops += [['apply',x+13,y-17,z+27]] + fixture={'seed':seed,'legacy':legacy,'context':[-64,384,63],'conditions':[],'real_noise':True,'library_rules':names,'volume':[3,4,3,0,-64,0,2,1,2] if case==0 else [4,8,2,-17,24,7,1,2,1], 'possible_biomes':None if case==0 else biome_names,'ops':ops} + if not legacy and seed==0 and case==0:fixture['library_json']=codec_inputs(rules) + yield fixture + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-material-rule-library-parity';build.mkdir(parents=True,exist_ok=True);report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + bundle={} + for field,kind in [('noises','noise'),('densities','density_function'),('rules','material_rule')]: + resources=worldgen.registry_resources(jars['server'],kind) + if not resources or resources!=worldgen.registry_resources(jars['client'],kind):raise ValueError('reference '+kind+' resources differ') + prefix='data/minecraft/worldgen/'+kind+'/' + bundle[field]={'minecraft:'+name[len(prefix):-5]:raw for name,raw in resources.items()} + for field,getter in [('conditions',material.condition_resources),('biomes',biome.biome_resources),('biome_tags',material.biome_tag_resources)]: + bundle[field]=getter(jars['server']) + if not bundle[field] or bundle[field]!=getter(jars['client']):raise ValueError('reference '+field+' resources differ') + counts={key:len(value) for key,value in bundle.items()} + bundle['rules'].update({'horizon:a_forward':'{"type":"condition","if_true":{"type":"hole"},"then_run":"horizon:z_leaf"}','horizon:z_leaf':'{"type":"block","result_state":{"id":"minecraft:oak_log","properties":{"axis":"x"}}}','horizon:empty':'{"type":"sequence","sequence":[]}','horizon:constant_ore':'{"type":"ore_vein","ore_block":"minecraft:copper_ore","raw_ore_block":"minecraft:raw_copper_block","filler_block":"minecraft:granite","raw_ore_chance":0.02,"density":1,"richness":0.5,"filler_gap":-1}'}) + for field,value in bundle.items():(build/(field+'.json')).write_text(json.dumps(value,separators=(',',':')),encoding='utf-8') + folder=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity' + oracles=[folder/(name+'.java') for name in ['VanillaMaterialConditionOracle','VanillaAnchorOracle','VanillaBiomeTemperatureOracle','VanillaBlockStateCodecOracle']] + sources=[*oracles,Path(__file__),*[lab.ROOT/'tools'/name for name in ['test_material_condition_parity.py','test_biome_temperature_parity.py','test_worldgen_parity.py','test_rust_parity.py','lab.py']],lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/material_condition_fixture.rs'] + tested_sources=base.source_hashes(sources);classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependencies=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependencies,'-d',classes,*oracles],'compile-java') + def java(side,oracle,mode,path):run(['java','-Xmx1G','-cp',os.pathsep.join([str(classes),str(jars[side]),dependencies]),'dev.horizonlab.parity.'+oracle,mode,path],side+'-'+mode) + for side in jars:java(side,'VanillaBlockStateCodecOracle','export',build/f'facts-{side}.json') + facts=json.loads((build/'facts-server.json').read_text()) + if facts!=json.loads((build/'facts-client.json').read_text()):raise ValueError('reference block metadata differs') + fixtures=list(corpus(bundle['rules'],bundle['biomes']));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(f,separators=(',',':'))+'\n' for f in fixtures),encoding='utf-8') + fixture_paths=[inputs,build/'facts-client.json',build/'facts-server.json',*[build/(field+'.json') for field in bundle]];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','material_condition_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True));binary=Path(metadata['target_directory'])/'release/examples'/('material_condition_fixture.exe' if os.name=='nt' else 'material_condition_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,'VanillaMaterialConditionOracle',side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched});print(f'{side}: {matched:,} material-rule library output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'resources':counts,'fixtures':len(fixtures),'codec_inputs':sum(len(f.get('library_json',[])) for f in fixtures),'rule_applications':sum(sum(op[0]=='apply' for op in f['ops'])*len(f['library_rules']) for f in fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'All bundled material-rule definitions loaded against authenticated condition, biome/tag, block-state, noise and density registries, then compiled/evaluated for both world random modes. Forward/nested rule holders, all five rule kinds, malformed/omitted fields and property fallback, actual seeded density/richness/gap sources, strided chunk-volume caching, scalar fallback and independent context/application positions are covered. Surface depth and secondary noise remain supplied context inputs; preliminary density is zero for isolation. All bundled biome climates are used, with unrestricted or complete possible-biome sets. Rust library definitions are immutable and atomically loaded, with typed cycle/resource-bound errors. Rule/density encoding, live reload/registry owner validation, complete surface-stage chunks and gameplay remain pending.'} + lab.write_json(report_path,report);print(f'Scoped material-rule library parity passed: {report_path}') + + +if __name__=='__main__':main() diff --git a/tools/test_material_stage_parity.py b/tools/test_material_stage_parity.py new file mode 100644 index 000000000..8fbfdac5b --- /dev/null +++ b/tools/test_material_stage_parity.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python3 +"""Compare full surface-stage chunk application with pinned vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +try: + from . import lab,test_rust_parity as base,test_worldgen_parity as worldgen,test_material_condition_parity as material,test_biome_temperature_parity as biome +except ImportError: + import lab + import test_rust_parity as base + import test_worldgen_parity as worldgen + import test_material_condition_parity as material + import test_biome_temperature_parity as biome + + +def synthetic_rules(): + block=lambda name:{'type':'block','result_state':'minecraft:'+name} + conditional=lambda condition,name:{'type':'condition','if_true':condition,'then_run':block(name)} + rules={'horizon:water':block('water'),'horizon:air':block('air'),'horizon:stone':block('stone')} + rules['horizon:probe']={'type':'sequence','sequence':[ + conditional({'type':'stone_depth','offset':0,'add_surface_depth':False,'secondary_depth_range':0,'surface_type':'ceiling'},'gravel'), + conditional({'type':'steep'},'air'), + conditional({'type':'water','offset':0,'surface_depth_multiplier':1,'add_stone_depth':True},'sand'), + conditional({'type':'stone_depth','offset':1,'add_surface_depth':True,'secondary_depth_range':4,'surface_type':'floor'},'dirt'),block('stone')]} + return {name:json.dumps(value,separators=(',',':')) for name,value in rules.items()} + + +def corpus(facts,biomes,settings=None,presets=None): + defaults=facts['defaults'];all_biomes=sorted(biomes) + scenes=[('overworld','stone',['minecraft:plains'],-64,256,63),('overworld','stone',['minecraft:eroded_badlands'],-64,256,63),('overworld','stone',['minecraft:frozen_ocean'],-64,256,63),('overworld','stone',['minecraft:deep_frozen_ocean','minecraft:eroded_badlands','minecraft:desert','minecraft:grove','minecraft:sulfur_caves'],-64,256,63),('overworld','stone',all_biomes,-64,256,63),('nether','netherrack',['minecraft:basalt_deltas','minecraft:crimson_forest','minecraft:soul_sand_valley','minecraft:nether_wastes','minecraft:warped_forest'],0,128,32),('end','end_stone',['minecraft:the_end','minecraft:end_highlands'],0,128,63)] + def initial(minimum,height,sea,default,pattern): + spans=[] + for x in range(16): + for z in range(16): + top=minimum+height//2+(x*7+z*11)%27-13 + spans.append([x,minimum,z,top,default]) + if topd", value).hex() + + +def numbers(values): + return " ".join(map(number, values)) + + +def corpus(): + rng = random.Random(0x484f52495a4f4e4e4f495345) + half = math.nextafter(2**24, 0) + specials = [0.0, -0.0, 1.0, -1.0, .5, -.5, 1e-7, -1e-7, + float.fromhex("0x0.0000000000001p-1022"), 1e-200, -1e-200, + 2**24, -(2**24), half, -half, math.nextafter(half, 0), + math.nextafter(-half, -math.inf), 2**25, -(2**25), + 2147483647.0, -2147483648.0, 1e100, -1e100, + float("inf"), float("-inf"), float("nan")] + for value in specials: + yield "wrap " + number(value) + for _ in range(12000): + yield "wrap " + (f"{rng.getrandbits(64):016x}" if rng.randrange(2) else number(rng.uniform(-1e10, 1e10))) + seeds = [-(2**63), -1, 0, 1, 2**63 - 1, *[rng.randrange(-2**63, 2**63) for _ in range(19)]] + scales = [0.0, -0.0, .001, .125, .5, 1.0, 4.0, -.125, -4.0, 1e-200, 1e200, math.inf, -math.inf, math.nan] + derivative_edges = ["00000000", "80000000", "3f800000", "bf800000", "7f800000", "ff800000", "7fc00000", "00000001", "7f7fffff"] + sampler_id = 0 + valid_bases = [] + invalid_ranges = [] + for stream, (kind, skip), scenario in itertools.product(["legacy", "xoroshiro"], [("perlin", 0), ("simplex", 0), ("simplex", 1), ("smeared", 0)], range(48)): + seed = seeds[scenario % len(seeds)] + scale = scales[scenario % len(scales)] + (invalid_ranges if kind == "smeared" and math.isnan(scale) else valid_bases).append(sampler_id) + yield f"create {kind} {stream} {seed} {skip} {number(scale)}" + for value in specials: + # Axis-specific extremes as well as all coordinates equal. + for axis in range(4): + coords = [value if i == axis or axis == 3 else 0.0 for i in range(3)] + yield f"query {sampler_id} " + numbers(coords) + " 00000000 80000000 3f800000" + for step in range(400): + if step % 5 == 0: + coords = [rng.choice(specials) for _ in range(3)] + elif step % 7 == 0: + value = rng.uniform(-2, 2) + coords = [value, value, value] # Ties in skipped-offset simplex. + else: + magnitude = rng.choice([1, 16, 10000, 30_000_000, 2**31, 1e100]) + coords = [rng.uniform(-magnitude, magnitude) for _ in range(3)] + initial = [rng.choice(derivative_edges) if step % 3 == 0 else f"{rng.getrandbits(32):08x}" for _ in range(3)] + yield f"query {sampler_id} " + numbers(coords) + " " + " ".join(initial) + local_edges = [-1.0, math.nextafter(-1.0, -math.inf), -0.0, 0.0, math.nextafter(0.0, math.inf), + .125, .5, math.nextafter(1.0, 0.0), 1.0, math.nextafter(1.0, math.inf)] + for x, y in itertools.product(local_edges, repeat=2): + yield f"local {sampler_id} " + numbers([x, y, x]) + " 00000000 80000000 3f800000" + if kind in ["perlin", "smeared", "simplex"]: + for step in range(32): + sizes = [rng.randrange(1, 6), rng.randrange(1, 17), rng.randrange(1, 6)] + steps = [rng.choice([1, 4, 16, 2147483647]) for _ in range(3)] + minimum = [rng.choice([-2147483648, 2147483647, -64, 0, 16]) for _ in range(3)] + xz_scale, y_scale = (rng.choice([0.0, -0.0, .001, -.001, .5, 1.0, 4.0, 1e100, math.inf, -math.inf, math.nan]) for _ in range(2)) + amplitude = rng.choice(derivative_edges) + seed = rng.randrange(-2**63, 2**63) + if step % 11 == 0: + sizes[step % 3] = 0 if step == 0 else -1 + if step % 13 == 0: + steps[step % 3] = 0 if step == 0 else -1 + yield f"volume {sampler_id} " + " ".join(map(str, sizes + minimum + steps)) + f" {numbers([xz_scale,y_scale])} {amplitude} {seed} {step % 4}" + sampler_id += 1 + stacks = [] + amplitudes = ["00000000", "80000000", "3f800000", "bf800000", "3e800000", "1e3ce508", "7f7fffff", "7f800000", "ff800000"] + for scenario in range(640): + layers = [] + layer_count = 0 + depth = 1 + for _ in range(scenario % 7): + eligible = [entry for entry in stacks if entry[1] <= 24 and entry[2] <= 3] + if eligible and rng.randrange(3) == 0: + selected, count, previous_depth = rng.choice(eligible) + flatten = rng.randrange(2) + depth = max(depth, previous_depth + (1 - flatten)) + layer_count += count if flatten else 1 + else: + selected, flatten = rng.choice(valid_bases), 0 + layer_count += 1 + frequency = rng.choice(specials) if scenario % 4 == 0 else rng.uniform(-8, 8) + # Keep generated success IDs stable: flattening 0 * infinity would + # itself create a NaN layer amplitude and reject the build. + amplitude = rng.choice(amplitudes[2:7] if flatten else amplitudes) + layers.extend([str(flatten), str(selected), number(frequency), amplitude]) + yield f"stack {scenario % 7} " + " ".join(layers) + stacks.append((sampler_id, layer_count, depth)) + for step in range(64): + point = [rng.choice(specials) if step % 5 == 0 else rng.uniform(-1000, 1000) for _ in range(3)] + yield f"query {sampler_id} " + numbers(point) + " 00000000 00000000 00000000" + for step in range(3): + scale = [rng.choice([0.0, .001, .5, -2.0, 1e100, math.inf, math.nan]) for _ in range(2)] + yield f"volume {sampler_id} 2 4 2 -17 -64 2147483647 4 1 16 " + numbers(scale) + f" {rng.choice(amplitudes)} {scenario} {step + 1}" + sampler_id += 1 + # Failed builds do not append a sampler. Zero amplitude does not bypass + # checking a layer's invalid range; NaN frequency is allowed instead. + if scenario % 16 == 0: + yield f"stack 1 0 {rng.choice(valid_bases)} {number(1.0)} 7fc00000" + yield f"stack 1 0 {rng.choice(invalid_ranges)} {number(1.0)} 00000000" + yield f"stack 1 0 0 {number(1.0)} 00000000" + yield f"stack 1 1 {sampler_id} {number(1.0)} 7f800000" # Flattened zero times infinity rejects. + yield f"stack 1 0 {sampler_id} {number(1.0)} 7f800000" # Nested range remains zero; samples are NaN. + yield f"query {sampler_id + 1} " + numbers([1.0, 2.0, 3.0]) + " 00000000 00000000 00000000" + bases = [-(2**31), 2**31-1, -1075, -1074, -1023, -1022, -32, -16, -8, 0, 16, 32, 1022, 1023, 1024] + base_amplitudes = [0.0, -0.0, 1.0, 2.0, .5, 1e-6, 1e-160, 1e160, 1e200, 1e-200, -1.0, math.inf, -math.inf, math.nan] + for scenario in range(1800): + parity = int(scenario % 5 == 0) + count = rng.choice([0, 1, 2, 3, 4, 8, 16, 32, 33, 64, -1]) + base = rng.choice(bases) if scenario % 3 == 0 else rng.randrange(-32, 33) + amplitude = rng.choice(base_amplitudes) if scenario % 3 == 0 else rng.uniform(.0001, 100) + normalization = scenario % 3 + if scenario >= 1400: + parity |= 2 + base = rng.choice([-64, -16, -8, -1, 0, 1, 2, 4]) + modifiers = [] + if parity & 1 or scenario % 4 != 0: + for _ in range(max(0, count)): + choices = [0.0, -0.0, 1.0, .5, -1.0, rng.uniform(0, 4), 1e-16, 1e16] + if scenario % 17 == 0: + choices.extend([1e200, 1e-200, math.inf, math.nan]) + modifiers.append(rng.choice(choices)) + if scenario % 31 == 0: + modifiers = [0.0] * max(0, count) + if scenario % 37 == 0 and not (parity & 1): + modifiers.append(1.0) # Also check the builder's modifier-index failure. + points = [[0, 0, 0], [-17.25, 64.125, 32.5], *[[rng.uniform(-1000, 1000) for _ in range(3)] for _ in range(16)]] + if scenario % 7 == 0: + points.extend([[value, value, value] for value in specials]) + for stream in ["legacy", "xoroshiro"]: + yield f"normal {stream} {seeds[scenario % len(seeds)]} {parity} {base} {count} {normalization} {number(amplitude)} {len(modifiers)} " + numbers(modifiers) + f" {len(points)} " + numbers(sum(points, [])) + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--prepare", action="store_true") + args = parser.parse_args() + build = lab.LOCAL / "rust-noise-parity" + build.mkdir(parents=True, exist_ok=True) + report_path = build / "report.json" + report_path.unlink(missing_ok=True) + if args.prepare: + lab.prepare() + lock, jars, libraries = test_rust_parity.verify_artifacts() + commands = list(corpus()) + inputs = build / "inputs.txt" + inputs.write_text("\n".join(commands) + "\n", encoding="utf-8") + source = lab.ROOT / "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaNoiseOracle.java" + sources = [source, Path(__file__), lab.ROOT / "tools/test_rust_parity.py", lab.ROOT / "tools/lab.py", + *sorted((lab.ROOT / "crates/horizon-core").rglob("*.rs")), + lab.ROOT / "crates/horizon-core/Cargo.toml", lab.ROOT / "Cargo.toml", lab.ROOT / "Cargo.lock"] + tested_sources = test_rust_parity.source_hashes(sources) + classes = build / "classes" + classes.mkdir(exist_ok=True) + dependency_path = os.pathsep.join(map(str, libraries)) + run = test_rust_parity.run + run(["javac", "--release", str(lock["minecraft"]["java_major"]), "-proc:none", + "-cp", os.pathsep.join([str(jars["server"]), dependency_path]), "-d", str(classes), str(source)]) + run(["cargo", "build", "--release", "--bin", "horizon-noise-parity"]) + metadata = json.loads(subprocess.check_output(["cargo", "metadata", "--no-deps", "--format-version", "1"], cwd=lab.ROOT, text=True)) + binary = Path(metadata["target_directory"]) / "release" / ("horizon-noise-parity.exe" if os.name == "nt" else "horizon-noise-parity") + candidate = build / "rust.txt" + with inputs.open("rb") as stdin, candidate.open("wb") as stdout: + run([str(binary)], stdin=stdin, stdout=stdout) + references = [] + for side, jar in jars.items(): + reference = build / f"vanilla-{side}.txt" + run(["java", "-Xmx512M", "-cp", os.pathsep.join([str(classes), str(jar), dependency_path]), + "dev.horizonlab.parity.VanillaNoiseOracle", str(inputs), str(reference)]) + matched = test_rust_parity.compare(reference, candidate) + references.append({"side": side, "jar_sha256": lab.digest(jar, "sha256"), + "output_sha256": lab.digest(reference, "sha256"), "matched_output_lines": matched}) + print(f"{side}: {matched:,} noise output lines match Rust", flush=True) + test_rust_parity.ensure_sources_unchanged(sources, tested_sources) + report = {"schema": 1, "minecraft": lock["minecraft"]["version"], "platform": platform.platform(), + "java": subprocess.check_output(["java", "--version"], text=True).splitlines()[0], + "rustc": subprocess.check_output(["rustc", "--version"], text=True).strip(), + "manifest_sha1": lock["minecraft"]["manifest_sha1"], "commands": dict(Counter(line.split()[0] for line in commands)), + "inputs_sha256": lab.digest(inputs, "sha256"), "rust_output_sha256": lab.digest(candidate, "sha256"), + "sources_sha256": tested_sources, "references": references, + "scope": "26.3 gradient offsets, permutation tables, constructor RNG consumption, ranges, coordinate wrap, Perlin 2D/3D and derivative accumulation, simplex 2D/3D with both offset modes, smeared Perlin 2D/3D and inherited unsmeared derivatives; bounded strided density volumes, wrapped block coordinates, flat indices, cached and scalar bulk accumulation with preserved buffer tails; nested and flattened noise stacks; normal-noise octave construction, enabled/disabled/legacy normalization, parity factory, modern positional seeding, legacy Nether biome initialization, failure draw state, scalar and bulk sampling. Finite outputs and signed zeros compared by bits; NaNs canonicalized. No serialized noise definitions, density-function graphs, generated terrain, gameplay, rendering or performance claim."} + lab.write_json(report_path, report) + print(f"Scoped noise parity passed: {report_path}") + + +if __name__ == "__main__": + main() diff --git a/tools/test_piston_shape_parity.py b/tools/test_piston_shape_parity.py new file mode 100644 index 000000000..aca667fe5 --- /dev/null +++ b/tools/test_piston_shape_parity.py @@ -0,0 +1,79 @@ +#!/usr/bin/env python3 +"""Compare moving-piston collision shapes and interpolation with pinned vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(facts): + def bits(value):return struct.pack('>f',float(value)).hex() + steps=[bits(v) for v in [-1,-0.0,0,0.25,0.5,0.75,1,2]]+['3e7fffff','3e800001','3f3fffff','3f400001'] + positions=[[0,0,0],[-17,-64,30000000],[2147483647,-2147483648,-2147483648]] + partials=[bits(v) for v in [-1,0,0.5,1,2]]+['7fc00001','7f800000','ff800000'] + def fixture(state,index=0,**kwargs): + result={'state':state,'position':positions[index%3],'direction':index%6,'extending':index%2==0,'source':False,'progress':steps[index%len(steps)],'previous':bits(0.25),'partial':partials[index%len(partials)],'noclip':-1,'fail':-1,'kinematic':False};result.update(kwargs);return result + for state in range(len(facts['states'])):yield fixture(state,state) + for state,value in enumerate(facts['states']): + if value['id'] in ['minecraft:piston','minecraft:sticky_piston']: + for direction in range(6): + for extending in [False,True]: + for source in [False,True]: + for progress in steps: + for noclip in range(-1,6):yield fixture(state,direction,extending=extending,source=source,progress=progress,noclip=noclip) + if value['id'].endswith('shulker_box') or value['id']=='minecraft:moving_piston': + for extending in [False,True]: + for direction in range(6): + for noclip in [-1,direction,direction^1]: + for fail in [-1,0]:yield fixture(state,direction,extending=extending,progress=bits(0.5),noclip=noclip,fail=fail) + rng=random.Random(0x504953544f4e) + stone=facts['defaults'].get('minecraft:stone',0) + for index in range(10000): + yield fixture(stone,index,kinematic=True,progress=f'{rng.getrandbits(32):08x}',previous=f'{rng.getrandbits(32):08x}',partial=f'{rng.getrandbits(32):08x}') + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-piston-shape-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPistonShapeOracle.java' + helpers=[oracle.with_name(name+'.java') for name in ['VanillaFaceSupportOracle','VanillaBlockStateCodecOracle','VanillaCollisionOracle']] + sources=[oracle,*helpers,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/piston_shape_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle,*helpers],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaPistonShapeOracle',mode,path],side+'-'+mode) + java('server','export',build) + facts=json.loads((build/'facts.json').read_text()) + if len(facts['states'])!=35723:raise ValueError('incomplete pinned registry') + fixtures=list(corpus(facts));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs,build/'facts.json',build/'block-registry.nbt',build/'cached-collision.nbt'];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','piston_shape_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('piston_shape_fixture.exe' if os.name=='nt' else 'piston_shape_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} piston-shape output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'block_states':len(facts['states']),'kinematic_cases':sum(f['kinematic'] for f in fixtures),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual moving-piston entity collision shape, interpolation/offset float bits, movement direction and collision-related block-state selection. Every registered moved state is sampled, piston-base/source/extension/head thresholds and all noclip directions are crossed, and dynamic block-entity query failures are compared. Cached collision geometry is imported privately; uncached moved blocks use Rust support selection only in the tested empty-collision-context, absent-block-entity world. Piston ticking, entity pushes, live block entities, networking and full gameplay remain pending.'} + lab.write_json(report_path,report);print(f'Scoped piston-shape parity passed: {report_path}') + + +if __name__=='__main__':main() diff --git a/tools/test_placement_parity.py b/tools/test_placement_parity.py new file mode 100644 index 000000000..8ac2f9247 --- /dev/null +++ b/tools/test_placement_parity.py @@ -0,0 +1,132 @@ +#!/usr/bin/env python3 +"""Compare placement-modifier decoding and ordered emissions with pinned vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import random +import subprocess +try: + from . import lab,test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def definitions(): + encode=lambda value:json.dumps(value,separators=(',',':')) + for value in [None,False,0,[],{}, {'type':'missing'}, {'type':'in_square'}, {'type':':in_square'}]:yield encode(value) + for count in [-1,0,1,3,17,4096,4097,4294967297, {'type':'uniform','min_inclusive':0,'max_inclusive':5}, {'type':'clamped','source':10,'min_inclusive':0,'max_inclusive':3}, {'type':'weighted_list','distribution':[{'data':0,'weight':1},{'data':4,'weight':3}]}]:yield encode({'type':'count','count':count}) + for field in ['x','y','z']: + for value in [-17,-16,-1,0,1,16,17,4294967297, {'type':'uniform','min_inclusive':-16,'max_inclusive':16}, {'type':'trapezoid','min':-7,'max':7,'plateau':0}]: + definition={'type':'offset','x':0,'y':0,'z':0};definition[field]=value;yield encode(definition) + for chance in [None,False,'1',-1,-0.,0,1e-100,0.1,0.5,1,2,3,7,16777217,2147483647,4294967297]: + for kind in ['rarity_filter','random_chance']:yield encode({'type':kind,'chance':chance}) + for height in [{'absolute':0},{'above_bottom':7},{'relative_to_sea_level':-3}, {'type':'uniform','min_inclusive':{'above_bottom':0},'max_inclusive':{'below_top':0}}, {'type':'trapezoid','min_inclusive':{'absolute':-7},'max_inclusive':{'absolute':7}}, {'type':'weighted_list','distribution':[{'data':{'absolute':1},'weight':2},{'data':{'below_top':1},'weight':3}]}]:yield encode({'type':'height_range','height':height}) + fixed=[[0,7,0],[15,20,15],[-1,-64,-1],[-16,99,16],[2147483647,-2147483648,2147483647],[0,7,0]] + for positions in [[],fixed,[[1,2]],[[1,2,3,4]],[[0,False,0]],[[4294967297,0,-4294967297]]]:yield encode({'type':'fixed_placement','positions':positions}) + for placements in [[],[{'type':'in_square'}],[{'type':'in_square'},{'type':'count','count':3},{'type':'fixed_placement','positions':fixed}],[{'type':'randomly_selected','placements':[{'type':'in_square'},{'type':'count','count':0}]}]]:yield encode({'type':'randomly_selected','placements':placements}) + for kind,field in [('count','count'),('height_range','height'),('offset','y'),('rarity_filter','chance'),('random_chance','chance'),('fixed_placement','positions'),('randomly_selected','placements')]: + for value in [None,{},[]]:yield encode({'type':kind,field:value}) + + + for heightmap in ['WORLD_SURFACE_WG','WORLD_SURFACE','OCEAN_FLOOR_WG','OCEAN_FLOOR','MOTION_BLOCKING','MOTION_BLOCKING_NO_LEAVES','world_surface','missing',None,0]: + yield encode({'type':'heightmap','heightmap':heightmap}) + yield encode({'type':'surface_relative_threshold_filter','heightmap':heightmap}) + for low,high in [(-3,3),(1,0),(-2147483648,2147483647),(2147483647,2147483647),(-2147483648,-2147483648),(None,None)]: + yield encode({'type':'surface_relative_threshold_filter','heightmap':heightmap,'min_inclusive':low,'max_inclusive':high}) + for depth in [-2147483648,-1,0,1,7,2147483647,4294967297,None,False,'0']: + yield encode({'type':'surface_water_depth_filter','max_water_depth':depth}) + + for ratio in [-2147483648,-9,-1,0,1,5,16,2147483647]: + for factor in [-1e300,-200,-0.,0,1e-300,1,80,200,1e300]: + yield encode({'type':'noise_based_count','noise_to_count_ratio':ratio,'noise_factor':factor}) + for offset in [None,-1,0,0.1,1,1e300,'0',False]: + yield encode({'type':'noise_based_count','noise_to_count_ratio':7,'noise_factor':80,'noise_offset':offset}) + for level in [-1e300,-1,-0.,0,0.1,0.7,1,1e300]: + for below,above in [(-1,3),(0,0),(1,7),(17,2),(-2147483648,2147483647)]: + yield encode({'type':'noise_threshold_count','noise_level':level,'below_noise':below,'above_noise':above}) + + for xz,y in [(1,1),(2,3),(3,4),(16,16),(0,2),(2,17),({'type':'uniform','min_inclusive':1,'max_inclusive':5},{'type':'uniform','min_inclusive':1,'max_inclusive':3})]: + for edges,interior in [(True,True),(True,False),(False,True),(False,False),(None,None),(0,True),(True,'false')]: + yield encode({'type':'cuboid','xz_size':xz,'y_size':y,'include_edges':edges,'include_interior':interior}) + + for count in [-1,0,1,3,7,257, {'type':'uniform','min_inclusive':0,'max_inclusive':5}, {'type':'weighted_list','distribution':[{'data':0,'weight':1},{'data':4,'weight':3}]}]: + yield encode({'type':'count_on_every_layer','count':count}) + + truth={'type':'true'};false={'type':'not','predicate':truth};inside={'type':'inside_world_bounds'} + predicates=[truth,false,inside,{'type':'all_of','predicates':[]},{'type':'any_of','predicates':[]}] + for offset in [None,[],[0,0],[0,0,0,0],[0,-17,0],[16,16,-16],[0,-16,0],[0,1,0],[-2147483648,-2147483648,-2147483648],[4294967296,4294967297,-4294967297],[0,False,0]]: + predicates.append({'type':'inside_world_bounds','offset':offset}) + for kind in ['all_of','any_of']: + for values in [[truth,inside],[false,inside],[inside,truth],[inside,false],[inside,{'type':'not','predicate':inside}],None,False]: + predicates.append({'type':kind,'predicates':values}) + predicates += [None,False,{},{'type':'not'},{'type':'not','predicate':None},{'type':'missing'}] + for predicate in predicates:yield encode({'type':'block_predicate_filter','predicate':predicate}) + for direction in ['up','down','north','UP',None]: + for steps in [0,1,4,32,33]: + for target in [truth,false,{'type':'not','predicate':{'type':'inside_world_bounds','offset':[0,-16,0]}}]: + yield encode({'type':'environment_scan','direction_of_search':direction,'target_condition':target,'max_steps':steps}) + for allowed in [None,truth,false,inside,{'type':'inside_world_bounds','offset':[0,16,0]}, {'type':'all_of','predicates':[inside,inside]}]: + for target in [inside,{'type':'not','predicate':{'type':'inside_world_bounds','offset':[0,-16,0]}}]: + for direction in ['up','down']: + yield encode({'type':'environment_scan','direction_of_search':direction,'target_condition':target,'allowed_search_condition':allowed,'max_steps':32}) + + +def corpus(): + positions=[[0,0,0],[-1,63,-1],[-16,-64,16],[2147483647,-2147483648,2147483647]] + for legacy in [False,True]: + for seed in [0,-1,0x123456789abcdef]: + for context in [[-64,384,63],[2147483647,-2147483648,2147483647]]: + for index,definition in enumerate(definitions()): + for fail,draw in [(-1,False),(0,False),(2,True)]: + # Limit successful 4096-repeat output; a failing consumer still checks the bound. + if '4096' in definition and fail==-1:continue + value=json.loads(definition) + layer=isinstance(value,dict) and value.get('type')=='count_on_every_layer' + if layer and context[0]!=-64:continue + noise=isinstance(value,dict) and value.get('type') in ['noise_based_count','noise_threshold_count'] + unsafe=noise and (abs(value.get('noise_to_count_ratio',0))>16 or not isinstance(value.get('noise_offset',0),(int,float)) or abs(value.get('noise_offset',0))>2 or abs(value.get('below_noise',0))>17 or abs(value.get('above_noise',0))>17) + for count_only in ([True] if unsafe else [False,True] if noise else [False]): + yield {'layer_world':layer,'count_only':count_only,'definition':definition,'context':context,'legacy':legacy,'seed':seed,'positions':positions,'fail':fail,'draw':draw,'height_mode':index%2,'query_fail':1 if index%5==0 and fail==2 else -1,'world_min':max(-2**31,min(2**31-1,context[0]+[-8,0,8][index%3]))} + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument("--prepare",action="store_true");args=parser.parse_args() + build=lab.LOCAL/"rust-placement-parity";build.mkdir(parents=True,exist_ok=True) + report_path=build/"report.json";report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java" + sources=[oracle,Path(__file__),lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock",lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml", + *sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/placement_fixture.rs",lab.ROOT/"crates/horizon-world/examples/support/placement_queries.rs"] + tested_sources=base.source_hashes(sources) + fixtures=list(corpus());inputs=build/"inputs.txt";inputs.write_text("".join(json.dumps(f,separators=(",",":"))+"\n" for f in fixtures),encoding="utf-8") + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths);classes=build/"classes";classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle],"compile-java") + run(["cargo","build","--release","-p","horizon-world","--example","placement_fixture"],"compile-rust") + metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) + binary=Path(metadata["target_directory"])/"release/examples"/("placement_fixture.exe" if os.name=="nt" else "placement_fixture") + run([binary,build],"rust") + references=[] + for side,jar in jars.items(): + reference=build/f"{side}.txt" + run(["java","-Xmx512M","-cp",os.pathsep.join([str(classes),str(jar),dependency_path]),"dev.horizonlab.parity.VanillaPlacementOracle",side,build],side) + matched=base.compare(reference,build/"rust.txt") + references.append({"side":side,"jar_sha256":lab.digest(jar,"sha256"),"output_sha256":lab.digest(reference,"sha256"),"matched_output_lines":matched}) + print(f"{side}: {matched:,} placement output lines match Rust",flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={"schema":1,"minecraft":lock["minecraft"]["version"],"manifest_sha1":lock["minecraft"]["manifest_sha1"],"platform":platform.platform(), + "java":subprocess.check_output(["java","--version"],text=True).splitlines()[0],"rustc":subprocess.check_output(["rustc","--version"],text=True).strip(), + "fixtures":len(fixtures),"modifier_kinds":17,"predicate_kinds":5,"definitions":len(list(definitions())),"requested_modifications":sum(len(f["positions"]) for f in fixtures if not f["count_only"]),"requested_counts":sum(len(f["positions"]) for f in fixtures if f["count_only"]), + "sources_sha256":tested_sources,"fixtures_sha256":tested_fixtures,"rust_output_sha256":lab.digest(build/"rust.txt","sha256"),"references":references, + "scope":"Actual PlacementModifier.CODEC parsing and modify callbacks for count, in-square, offset, height-range, rarity, random-chance, fixed-position randomly-selected, heightmap, surface-relative-threshold and surface-water-depth modifiers, plus native noise-based and noise-threshold repeating counts and cuboid placement with edge/interior controls and count-on-every-layer scans, predicate filters and environment scans. Logical and inside-world-bounds predicates preserve short-circuiting and offset wrapping; traced world-bound queries expose scan termination, final target tests and failures. Layer scanning uses traced synthetic block strata containing air variants, water/lava, ordinary ground, bubble columns and bedrock; callbacks and injected height/block failures preserve query order and random consumption. Both random modes, repeated calls, zero counts, inclusive provider bounds, nested random choices, anchored and overflowing coordinates, same-chunk fixed filtering, duplicates, malformed fields and failing consumers. Consumer callbacks optionally draw from the shared random stream; subsequent nextLong values verify exact consumption. Contexts use an actual PlacementContext with a traced WorldGenLevel proxy and native noise generator. Heightmap queries use traced synthetic world responses, ordinary/extreme heights and injected query failures; world minimum and generation minimum can differ. Noise count-only calls include extreme ratios, factors, offsets and thresholds without expanding huge position lists. Additional block predicates, biome filtering, configured features, provider encoders, Gaussian providers and complete world generation remain pending."} + + lab.write_json(report_path,report);print(f"Scoped placement parity passed: {report_path}") + + +if __name__=="__main__":main() diff --git a/tools/test_quad_reuse.py b/tools/test_quad_reuse.py index e4ed5d995..baa95c387 100644 --- a/tools/test_quad_reuse.py +++ b/tools/test_quad_reuse.py @@ -29,7 +29,7 @@ def main(): args = parser.parse_args() root = build_pack.ROOT fixture = build_mod.build_integration_fixture("quad-reuse", "dev.horizonlab.dispatch.QuadReuseIntegration") - mod = root / "dist" / f"horizon-lab-{build_pack.read_lock()['pack_version']}.jar" + mod = root / "dist" / f"horizon-{build_pack.read_lock()['pack_version']}.jar" original_sha256 = hashlib.sha256(mod.read_bytes()).hexdigest() results = [] for enabled in [False, True]: diff --git a/tools/test_quad_sizes.py b/tools/test_quad_sizes.py index 485f5af6f..51650e373 100644 --- a/tools/test_quad_sizes.py +++ b/tools/test_quad_sizes.py @@ -42,7 +42,7 @@ def main(): root = build_pack.ROOT agent = build_agent() fixture = build_mod.build_integration_fixture("quad-size", "dev.horizonlab.dispatch.QuadSizeIntegration") - mod = root / "dist" / f"horizon-lab-{build_pack.read_lock()['pack_version']}.jar" + mod = root / "dist" / f"horizon-{build_pack.read_lock()['pack_version']}.jar" mod_hash = hashlib.sha256(mod.read_bytes()).hexdigest() results = [] for headers in [False, True]: diff --git a/tools/test_replace_block_parity.py b/tools/test_replace_block_parity.py new file mode 100644 index 000000000..8ca916b07 --- /dev/null +++ b/tools/test_replace_block_parity.py @@ -0,0 +1,93 @@ +#!/usr/bin/env python3 +"""Compare ordered block replacements and rule-driven mutations with pinned vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import random +import subprocess +try: + from . import lab,test_rust_parity as base,test_worldgen_parity as worldgen +except ImportError: + import lab + import test_rust_parity as base + import test_worldgen_parity as worldgen + + +def corpus(facts): + yes={'predicate_type':'always_true'} + no={'predicate_type':'not','rule':yes} + rules=[yes,no,{'predicate_type':'tag_match','tag':'leaves'}, {'predicate_type':'tag_match','tag':'horizon:missing'}, {'predicate_type':'height_match','min_inclusive':-64,'max_inclusive':63}] + for name in ['air','cave_air','void_air','stone','water','oak_leaves','dirt']: + for kind,field in [('block_match','block'),('blockstate_match','block_state')]: + rules.append({'predicate_type':kind,field:name}) + rules += [{'predicate_type':'random_block_match','block':name,'probability':p} for p in [0,0.5,1,2]] + rules += [{'predicate_type':'any_of','rules':rules[5:12]}, {'predicate_type':'all_of','rules':[no,yes]}] + definitions=[{'type':'replace_single_block','targets':[]}] + for rule in rules: + targets=[{'target':rule,'state':{'id':'oak_log','properties':{'axis':'x'}}}] + definitions += [{'type':'replace_single_block','targets':targets}, {'type':'replace_single_block','targets':[{'target':no,'state':'air'},*targets,{'target':yes,'state':'water'}]}] + for value in [None,False,'stone',{},[{}],[{'target':yes,'state':'missing'}],[{'target':yes,'state':'stone'},{'target':{'predicate_type':'missing'},'state':'air'}]]: + definitions.append({'type':'replace_single_block','targets':value}) + for legacy in [False,True]: + for definition in definitions: + for x in range(7): + for fail in [-1,0,1,2,4]: + for reject in [0,2]: + yield {'definition':json.dumps(definition,separators=(',',':')),'origin':[x,-64+x*32,0],'world_min':-64,'legacy':legacy,'seed':-1 if legacy else 0,'reject':reject,'fail':fail,'repeats':3} + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument("--prepare",action="store_true");args=parser.parse_args() + build=lab.LOCAL/"rust-replace-block-parity";build.mkdir(parents=True,exist_ok=True) + report_path=build/"report.json";report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaReplaceBlockOracle.java" + helper=oracle.with_name("VanillaBlockStateCodecOracle.java") + tag_helper=oracle.with_name("VanillaHeightmapOracle.java") + tags=worldgen.tag_resources(jars['server']) + if not tags or tags!=worldgen.tag_resources(jars['client']):raise ValueError('client/server tags differ') + (build/'tags.json').write_text(json.dumps(tags,separators=(',',':')),encoding='utf-8') + sources=[oracle,helper,tag_helper,Path(__file__),lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock",lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml", + *sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/replace_block_fixture.rs"] + tested_sources=base.source_hashes(sources) + fixture_paths=[build/"tags.json"];classes=build/"classes";classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle,helper,tag_helper],"compile-java") + for side,jar in jars.items(): + path=build/f"facts-{side}.json" + run(["java","-Xmx512M","-cp",os.pathsep.join([str(classes),str(jar),dependency_path]),"dev.horizonlab.parity.VanillaReplaceBlockOracle","export",path],side+"-export") + fixture_paths.append(path) + if json.loads((build/"facts-client.json").read_text())!=json.loads((build/"facts-server.json").read_text()):raise ValueError("reference feature block states differ") + facts=json.loads((build/"facts-server.json").read_text()) + if len(facts['states'])!=35723:raise ValueError('incomplete pinned registry') + fixtures=list(corpus(facts));inputs=build/"inputs.txt";inputs.write_text("".join(json.dumps(f,separators=(",",":"))+"\n" for f in fixtures),encoding="utf-8") + fixture_paths.append(inputs) + tested_fixtures=base.source_hashes(fixture_paths) + run(["cargo","build","--release","-p","horizon-world","--example","replace_block_fixture"],"compile-rust") + metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) + binary=Path(metadata["target_directory"])/"release/examples"/("replace_block_fixture.exe" if os.name=="nt" else "replace_block_fixture") + run([binary,build],"rust") + references=[] + for side,jar in jars.items(): + reference=build/f"{side}.txt" + run(["java","-Xmx512M","-cp",os.pathsep.join([str(classes),str(jar),dependency_path]),"dev.horizonlab.parity.VanillaReplaceBlockOracle",side,build],side) + matched=base.compare(reference,build/"rust.txt") + references.append({"side":side,"jar_sha256":lab.digest(jar,"sha256"),"output_sha256":lab.digest(reference,"sha256"),"matched_output_lines":matched}) + print(f"{side}: {matched:,} replace-block output lines match Rust",flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={"schema":1,"minecraft":lock["minecraft"]["version"],"manifest_sha1":lock["minecraft"]["manifest_sha1"],"platform":platform.platform(), + "java":subprocess.check_output(["java","--version"],text=True).splitlines()[0],"rustc":subprocess.check_output(["rustc","--version"],text=True).strip(), + "fixtures":len(fixtures),"block_states":len(facts["states"]),"integer_properties":len(facts["integers"]),"requested_placements":sum(f["repeats"] for f in fixtures), + "sources_sha256":tested_sources,"fixtures_sha256":tested_fixtures,"rust_output_sha256":lab.digest(build/"rust.txt","sha256"),"references":references, + "scope":"Actual replace_single_block feature codecs and native ReplaceBlockFeature.place. Ordered target rules re-read the origin state, short-circuit on the first match, preserve random draw order and write flags, ignore rejected writes, retain partial mutations and stop on injected read/write failures. Bound block/tag/state/height/random/logical targets and malformed unselected entries are compared across both random modes and repeated calls. Full region side effects, structure processors, ore clusters and complete gameplay remain pending."} + + + lab.write_json(report_path,report);print(f"Scoped replace-block parity passed: {report_path}") + + +if __name__=="__main__":main() diff --git a/tools/test_rule_test_parity.py b/tools/test_rule_test_parity.py new file mode 100644 index 000000000..0937e10b1 --- /dev/null +++ b/tools/test_rule_test_parity.py @@ -0,0 +1,89 @@ +#!/usr/bin/env python3 +"""Compare all pinned replacement-rule codecs and ordered evaluation.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +try: + from . import lab, test_rust_parity as base, test_worldgen_parity as worldgen +except ImportError: + import lab + import test_rust_parity as base + import test_worldgen_parity as worldgen + + +def corpus(facts, tags): + defaults=list(facts['defaults'].values()) + all_states=list(range(len(facts['states']))) + heights=[-2147483648,-2032,-65,-64,-1,0,1,63,64,319,2031,2147483647] + def cases(definition, states=defaults, repeats=1): + for legacy in [False,True]: + yield {'definition':json.dumps(definition,separators=(',',':')),'states':states,'heights':heights,'legacy':legacy,'seed':-1 if legacy else 0x123456789abcdef,'repeats':repeats} + yes={'predicate_type':'always_true'} + no={'predicate_type':'not','rule':yes} + for value in [yes,no,{'predicate_type':'all_of','rules':[]},{'predicate_type':'any_of','rules':[]}]:yield from cases(value,all_states) + for name in sorted(tags):yield from cases({'predicate_type':'tag_match','tag':name}) + for name in ['minecraft:logs','minecraft:leaves','minecraft:stone_ore_replaceables','horizon:missing']: + yield from cases({'predicate_type':'tag_match','tag':name},all_states) + for name, state in facts['defaults'].items(): + yield from cases({'predicate_type':'block_match','block':name},[0,state,(state+1)%len(all_states),all_states[-1]]) + for i,state in enumerate(facts['states']): + yield from cases({'predicate_type':'blockstate_match','block_state':state},[i,(i+1)%len(all_states)]) + for low,high in [(-2147483648,2147483647),(-64,319),(64,63),(0,0),(4294967297,-4294967295),(0.9,1.9)]: + yield from cases({'predicate_type':'height_match','min_inclusive':low,'max_inclusive':high},defaults[:24],2) + for kind,field in [('random_block_match','block'),('random_blockstate_match','block_state')]: + for block in ['air','water','oak_log',{'id':'water','properties':{'level':'+01'}}]: + for probability in [-1,-0.0,0,1e-50,0.25,0.5,1,2,1e100,None,False,'0.5']: + rule={'predicate_type':kind,field:block,'probability':probability} + yield from cases(rule,all_states[0:160],2) + for wrapper in [{'predicate_type':'all_of','rules':[rule,yes,rule]}, {'predicate_type':'any_of','rules':[rule,no,rule]}, {'predicate_type':'all_of','rules':[no,rule]}, {'predicate_type':'any_of','rules':[yes,rule]}, {'predicate_type':'not','rule':rule}]: + yield from cases(wrapper,all_states[0:160],2) + invalid=[None,False,0,[],{}, {'predicate_type':'unknown'}, {'predicate_type':False}] + for kind,field in [('block_match','block'),('blockstate_match','block_state'),('tag_match','tag'),('not','rule'),('all_of','rules'),('any_of','rules')]: + invalid += [{'predicate_type':kind,field:value} for value in [None,False,0,[],{},'missing','Minecraft:stone',':']] + invalid.append({'predicate_type':kind}) + for value in invalid:yield from cases(value,defaults[:4]) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-rule-test-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRuleTestOracle.java' + helpers=[oracle.with_name('VanillaBlockStateCodecOracle.java'),oracle.with_name('VanillaHeightmapOracle.java')] + tags=worldgen.tag_resources(jars['server']) + if not tags or tags!=worldgen.tag_resources(jars['client']):raise ValueError('client/server tags differ') + (build/'tags.json').write_text(json.dumps(tags,separators=(',',':')),encoding='utf-8') + sources=[oracle,*helpers,lab.ROOT/'tools/test_worldgen_parity.py',Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/rule_test_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle,*helpers],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaRuleTestOracle',mode,path],side+'-'+mode) + for side in jars:java(side,'export',build/f'facts-{side}.json') + facts=json.loads((build/'facts-server.json').read_text()) + if facts!=json.loads((build/'facts-client.json').read_text()):raise ValueError('client/server registry metadata differs') + if len(facts['states'])!=35723:raise ValueError('incomplete pinned state registry') + fixtures=list(corpus(facts,tags));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs,build/'tags.json',build/'facts-client.json',build/'facts-server.json'];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','rule_test_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('rule_test_fixture.exe' if os.name=='nt' else 'rule_test_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} replacement-rule output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'block_states':len(facts['states']),'blocks':len(facts['defaults']),'integer_properties':len(facts['integers']),'codec_inputs':len(fixtures),'rule_types':10,'block_tag_files':len(tags),'requested_tests':sum(len(f['states'])*f['repeats'] for f in fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual RuleTest.CODEC and all ten registered replacement-rule types. Every block and block-state identity, all bundled block tags, absent tags, inclusive and reversed height ranges, unrestricted random probabilities, logical short-circuit evaluation, malformed inputs, both random modes and subsequent draws are compared. Registry metadata and tag resources independently agree across authenticated JARs. Bound tags are immutable snapshots. Replacement feature mutations, structure processors, reload ownership and complete gameplay remain outside this standalone comparison.'} + lab.write_json(report_path,report);print(f'Scoped replacement-rule parity passed: {report_path}') + + +if __name__=='__main__':main() diff --git a/tools/test_rust_parity.py b/tools/test_rust_parity.py new file mode 100644 index 000000000..21b013b57 --- /dev/null +++ b/tools/test_rust_parity.py @@ -0,0 +1,185 @@ +#!/usr/bin/env python3 +"""Compare Horizon core operations with both checksum-pinned vanilla game JARs.""" + +import argparse +from collections import Counter +import itertools +import json +import os +from pathlib import Path +import platform +import random +import subprocess +import zipfile + +try: + from . import lab +except ImportError: + import lab + + +def corpus(): + """Stable inputs; Java supplies expected results instead of a second port.""" + rng = random.Random(0x484F52495A4F4E) + edges = [-2147483648, -33554433, -33554432, -2097152, -2049, -2048, + -1025, -1024, -513, -512, -33, -32, -17, -16, -1, 0, 1, + 15, 16, 31, 32, 511, 512, 2047, 2048, 2097151, 33554431, 33554432, 2147483647] + for axis in range(3): + for edge in edges: + p = [0, 0, 0] + p[axis] = edge + yield f"position {' '.join(map(str, p))} 1 -1 2147483647" + for x, y, z in itertools.product(range(16), repeat=3): + yield f"position {x - 16} {y - 16} {z - 16} 0 0 0" + for _ in range(8192): + values = [rng.randrange(-2147483648, 2147483648) for _ in range(6)] + yield "position " + " ".join(map(str, values)) + seeds = [-9223372036854775808, -281474976710656, -1, 0, 1, 281474976710656, + 9223372036854775807, *[rng.randrange(-2**63, 2**63) for _ in range(16)]] + for kind in ["legacy", "xoroshiro"]: + for seed in seeds: + yield f"{kind} {seed} 2200" + for lo, hi in [(0, 0), (0, 1), (1, 0), (-1, -1), (-9223372036854775808, 9223372036854775807)]: + yield f"xoroshiro_state {lo} {hi} 2200" + for bits in range(1, 33): + per_word = 64 // bits + for length in sorted({0, 1, per_word - 1, per_word, per_word + 1, 63, 64, 65, 4096}): + yield f"storage {bits} {length} {rng.randrange(-2**63, 2**63)}" + names = [[], [0], [0xffff], [0xd800], [0xdc00], [0xd800, 0x61, 0xdc00], [0xd83d, 0xde00], [0xdbff, 0xdfff], + *[[ord(c) for c in text] for text in ["minecraft:temperature", "octave_-3", "Aa", "BB", "Horizon", "àé中"]], + *[[0x61] * n for n in [55, 56, 63, 64, 65, 119, 120, 127, 128, 129, 1024]]] + for scenario in range(2200): + name = names[scenario % len(names)] if scenario % 3 else [rng.randrange(65536) for _ in range(rng.randrange(160))] + encoded = "".join(f"{unit:04x}" for unit in name) or "-" + lo = seeds[scenario % len(seeds)] if scenario % 3 else rng.randrange(-2**63, 2**63) + hi = lo if scenario % 11 == 0 else rng.randrange(-2**63, 2**63) + position = [rng.choice(edges) if scenario % 4 else rng.randrange(-2**31, 2**31) for _ in range(3)] + seed = lo if scenario % 7 == 0 else rng.randrange(-2**63, 2**63) + for kind in ["legacy", "xoroshiro"]: + yield f"factory {kind} {scenario % 2} {lo} {hi} {' '.join(map(str, position))} {seed} {encoded} 24" + double_edges = [0, 1, 0x8000000000000000, 0x3ff0000000000000, 0xbff0000000000000, + 0x7fefffffffffffff, 0x7ff0000000000000, 0xfff0000000000000, 0x7ff8000000000000] + float_edges = [0, 1, 0x80000000, 0x3f800000, 0xbf800000, 0x7f7fffff, 0x7f800000, 0xff800000, 0x7fc00000] + interval_edges = [-(2**31), -(2**31)+1, -1, 0, 1, 2, 16, 2**30+1, 2**31-2, 2**31-1] + intervals = [*itertools.product(interval_edges, repeat=2), + *[(rng.randrange(-2**31,2**31),rng.randrange(-2**31,2**31)) for _ in range(2400)]] + for scenario, (minimum, maximum) in enumerate(intervals): + d = [rng.choice(double_edges) if scenario % 3 else rng.getrandbits(64) for _ in range(2)] + f = [rng.choice(float_edges) if scenario % 3 else rng.getrandbits(32) for _ in range(2)] + for kind in ["legacy", "xoroshiro"]: + yield f"helpers {kind} {seeds[scenario % len(seeds)]} {minimum} {maximum} {d[0]:016x} {d[1]:016x} {f[0]:08x} {f[1]:08x}" + + +def verify_artifacts(): + """Authenticate against the lock and the bundled checksums, not generated reports.""" + lock, directory = lab.config() + manifest_path = directory / "manifest.json" + if lab.digest(manifest_path, "sha1") != lock["minecraft"]["manifest_sha1"]: + raise ValueError("Manifest checksum changed; run tools/lab.py prepare") + manifest = json.loads(manifest_path.read_text()) + if manifest["id"] != lock["minecraft"]["version"]: + raise ValueError("Manifest version differs from the lock") + jars = {} + for side in ["client", "server"]: + jar = directory / "jars" / f"{side}.jar" + if lab.digest(jar, "sha1") != manifest["downloads"][side]["sha1"]: + raise ValueError(f"{side} artifact checksum changed; run tools/lab.py prepare") + jars[side] = jar + libraries = [] + with zipfile.ZipFile(jars["server"]) as archive: + versions = list(lab.bundle_entries(archive, "META-INF/versions.list")) + if len(versions) != 1 or versions[0][1] != manifest["id"]: + raise ValueError("Unexpected server bundle") + checksum, _, _ = versions[0] + jars["server"] = directory / "jars/server-game.jar" + if lab.digest(jars["server"], "sha256") != checksum: + raise ValueError("Inner server artifact checksum changed") + for checksum, _, relative in lab.bundle_entries(archive, "META-INF/libraries.list"): + library = directory / "libraries/server" / relative + if lab.digest(library, "sha256") != checksum: + raise ValueError(f"Dependency checksum changed: {relative}") + libraries.append(library) + return lock, jars, libraries + + +def compare(reference, candidate): + count = 0 + with reference.open(encoding="utf-8") as expected, candidate.open(encoding="utf-8") as actual: + for count, (left, right) in enumerate(itertools.zip_longest(expected, actual), 1): + if left != right: + raise AssertionError(f"Parity mismatch at output line {count}: vanilla={left!r}, Rust={right!r}") + if count == 0: + raise AssertionError("Empty output cannot establish parity") + return count + + +def run(command, **kwargs): + subprocess.run(command, cwd=lab.ROOT, check=True, timeout=300, **kwargs) + + +def source_hashes(sources): + return {str(Path(path).resolve().relative_to(lab.ROOT)): lab.digest(Path(path), "sha256") for path in sources} + + +def ensure_sources_unchanged(sources, expected): + actual = source_hashes(sources) + changed = sorted(key for key in expected.keys() | actual.keys() if expected.get(key) != actual.get(key)) + if changed: + raise RuntimeError("Sources changed during validation: " + ", ".join(changed)) + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--prepare", action="store_true", help="Download and verify the pinned reference artifacts first") + args = parser.parse_args() + build = lab.LOCAL / "rust-parity" + build.mkdir(parents=True, exist_ok=True) + # Remove a previous success marker before any build or comparison can fail. + report_path = build / "report.json" + report_path.unlink(missing_ok=True) + if args.prepare: + lab.prepare() + lock, jars, libraries = verify_artifacts() + commands = list(corpus()) + inputs = build / "inputs.txt" + inputs.write_text("\n".join(commands) + "\n", encoding="utf-8") + source = lab.ROOT / "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCoreOracle.java" + sources = [source, Path(__file__), *sorted((lab.ROOT / "crates/horizon-core").rglob("*.rs")), + lab.ROOT / "crates/horizon-core/Cargo.toml", lab.ROOT / "Cargo.toml", lab.ROOT / "Cargo.lock"] + tested_sources = source_hashes(sources) + classes = build / "classes" + classes.mkdir(exist_ok=True) + dependency_path = os.pathsep.join(map(str, libraries)) + run(["javac", "--release", str(lock["minecraft"]["java_major"]), "-proc:none", + "-cp", os.pathsep.join([str(jars["server"]), dependency_path]), "-d", str(classes), str(source)]) + run(["cargo", "build", "--release", "--bin", "horizon-parity"]) + # Ask Cargo for its artifact path so custom target directories work too. + metadata = json.loads(subprocess.check_output(["cargo", "metadata", "--no-deps", "--format-version", "1"], cwd=lab.ROOT, text=True)) + binary = Path(metadata["target_directory"]) / "release" / ("horizon-parity.exe" if os.name == "nt" else "horizon-parity") + candidate = build / "rust.txt" + with inputs.open("rb") as stdin, candidate.open("wb") as stdout: + run([str(binary)], stdin=stdin, stdout=stdout) + references = [] + for side, jar in jars.items(): + reference = build / f"vanilla-{side}.txt" + run(["java", "-Xmx512M", "-cp", os.pathsep.join([str(classes), str(jar), dependency_path]), + "dev.horizonlab.parity.VanillaCoreOracle", str(inputs), str(reference)]) + matched = compare(reference, candidate) + references.append({"side": side, "jar_sha256": lab.digest(jar, "sha256"), + "output_sha256": lab.digest(reference, "sha256"), "matched_output_lines": matched}) + print(f"{side}: {matched:,} output lines match the Rust implementation", flush=True) + ensure_sources_unchanged(sources, tested_sources) + report = {"schema": 1, "minecraft": lock["minecraft"]["version"], "platform": platform.platform(), + "java": subprocess.check_output(["java", "--version"], text=True).splitlines()[0], + "rustc": subprocess.check_output(["rustc", "--version"], text=True).strip(), + "manifest_sha1": lock["minecraft"]["manifest_sha1"], "commands": dict(Counter(line.split()[0] for line in commands)), + "inputs_sha256": lab.digest(inputs, "sha256"), "rust_output_sha256": lab.digest(candidate, "sha256"), + "sources_sha256": tested_sources, + "references": references, + "scope": "Selected integer positions, seeded RNG operations including inclusive/exclusive integer intervals and float/double triangular draws, positional factories, UTF-16 Java string hashing, MD5-derived seeds and packed-storage operations. Floating-point helper NaNs canonicalized; finite results and signed zeros compared by bits. No gameplay, rendering or performance claim."} + lab.write_json(report_path, report) + print(f"Scoped parity checks passed: {report_path}") + + +if __name__ == "__main__": + main() diff --git a/tools/test_scattered_ore_parity.py b/tools/test_scattered_ore_parity.py new file mode 100644 index 000000000..b6bbd5aa7 --- /dev/null +++ b/tools/test_scattered_ore_parity.py @@ -0,0 +1,94 @@ +#!/usr/bin/env python3 +"""Compare scattered-ore attempts, air exposure and rule-driven mutations.""" +import argparse +import json +import os +from pathlib import Path +import platform +import random +import subprocess +try: + from . import lab,test_rust_parity as base,test_worldgen_parity as worldgen +except ImportError: + import lab + import test_rust_parity as base + import test_worldgen_parity as worldgen + + +def corpus(facts): + yes={'predicate_type':'always_true'} + no={'predicate_type':'not','rule':yes} + targets=[[],[{'target':yes,'state':'gold_ore'}],[{'target':no,'state':'air'},{'target':{'predicate_type':'random_block_match','block':'stone','probability':0.5},'state':'iron_ore'},{'target':yes,'state':'copper_ore'}]] + def fixture(definition,legacy=False,seed=0,mode=0,fail=-1,reject=0,origin=None): + return {'definition':json.dumps(definition,separators=(',',':')),'origin':origin or [15,-64,15],'world_min':-64,'legacy':legacy,'seed':seed,'mode':mode,'reject':reject,'fail':fail,'repeats':2} + for size in [0,1,7,8,64]: + for chance in [0,0.25,0.5,1]: + for values in targets: + definition={'type':'scattered_ore','targets':values,'size':size,'discard_chance_on_air_exposure':chance} + for legacy in [False,True]: + for seed in [0,-1,9223372036854775807]: + for mode in range(8): + for fail,reject in [(-1,0),(-1,3),(0,0),(7,0)]: + yield fixture(definition,legacy,seed,mode,fail,reject) + for field,values in [('size',[-1,65,4294967297,None,False,'1',0.9]),('discard_chance_on_air_exposure',[-0.0,-1e-100,-0.1,1.01,1e100,None,False,'0.5']),('targets',[None,False,{},'stone',[{}]])]: + for value in values: + definition={'type':'scattered_ore','targets':targets[1],'size':8,'discard_chance_on_air_exposure':0.5};definition[field]=value + yield fixture(definition) + for p in [[2147483647,2147483647,2147483647],[-2147483648,-2147483648,-2147483648]]: + for legacy in [False,True]: + yield fixture({'type':'scattered_ore','targets':targets[1],'size':64,'discard_chance_on_air_exposure':1},legacy=legacy,origin=p) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument("--prepare",action="store_true");args=parser.parse_args() + build=lab.LOCAL/"rust-scattered-ore-parity";build.mkdir(parents=True,exist_ok=True) + report_path=build/"report.json";report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaScatteredOreOracle.java" + helper=oracle.with_name("VanillaBlockStateCodecOracle.java") + tag_helper=oracle.with_name("VanillaHeightmapOracle.java") + tags=worldgen.tag_resources(jars['server']) + if not tags or tags!=worldgen.tag_resources(jars['client']):raise ValueError('client/server tags differ') + (build/'tags.json').write_text(json.dumps(tags,separators=(',',':')),encoding='utf-8') + sources=[oracle,helper,tag_helper,Path(__file__),lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock",lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml", + *sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/scattered_ore_fixture.rs"] + tested_sources=base.source_hashes(sources) + fixture_paths=[build/"tags.json"];classes=build/"classes";classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle,helper,tag_helper],"compile-java") + for side,jar in jars.items(): + path=build/f"facts-{side}.json" + run(["java","-Xmx512M","-cp",os.pathsep.join([str(classes),str(jar),dependency_path]),"dev.horizonlab.parity.VanillaScatteredOreOracle","export",path],side+"-export") + fixture_paths.append(path) + if json.loads((build/"facts-client.json").read_text())!=json.loads((build/"facts-server.json").read_text()):raise ValueError("reference feature block states differ") + facts=json.loads((build/"facts-server.json").read_text()) + if len(facts['states'])!=35723:raise ValueError('incomplete pinned registry') + fixtures=list(corpus(facts));inputs=build/"inputs.txt";inputs.write_text("".join(json.dumps(f,separators=(",",":"))+"\n" for f in fixtures),encoding="utf-8") + fixture_paths.append(inputs) + tested_fixtures=base.source_hashes(fixture_paths) + run(["cargo","build","--release","-p","horizon-world","--example","scattered_ore_fixture"],"compile-rust") + metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) + binary=Path(metadata["target_directory"])/"release/examples"/("scattered_ore_fixture.exe" if os.name=="nt" else "scattered_ore_fixture") + run([binary,build],"rust") + references=[] + for side,jar in jars.items(): + reference=build/f"{side}.txt" + run(["java","-Xmx512M","-cp",os.pathsep.join([str(classes),str(jar),dependency_path]),"dev.horizonlab.parity.VanillaScatteredOreOracle",side,build],side) + matched=base.compare(reference,build/"rust.txt") + references.append({"side":side,"jar_sha256":lab.digest(jar,"sha256"),"output_sha256":lab.digest(reference,"sha256"),"matched_output_lines":matched}) + print(f"{side}: {matched:,} scattered-ore output lines match Rust",flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={"schema":1,"minecraft":lock["minecraft"]["version"],"manifest_sha1":lock["minecraft"]["manifest_sha1"],"platform":platform.platform(), + "java":subprocess.check_output(["java","--version"],text=True).splitlines()[0],"rustc":subprocess.check_output(["rustc","--version"],text=True).strip(), + "fixtures":len(fixtures),"block_states":len(facts["states"]),"integer_properties":len(facts["integers"]),"requested_placements":sum(f["repeats"] for f in fixtures), + "sources_sha256":tested_sources,"fixtures_sha256":tested_fixtures,"rust_output_sha256":lab.digest(build/"rust.txt","sha256"),"references":references, + "scope":"Actual scattered_ore feature codec and native ScatteredOreFeature.place. Attempt counts, six float draws per offset, Java rounding, wrapped coordinates, state capture per attempt, ordered target predicates, conditional air-exposure draws, directional neighbor reads, early air detection and mutation flags/results/errors are compared. Both random modes, size/discard boundaries, empty targets, repeated calls, solid/mixed/directional-air worlds and partial failures are included. Complete ore veins, region side effects, chunk decoration and gameplay remain pending."} + + + lab.write_json(report_path,report);print(f"Scoped scattered-ore parity passed: {report_path}") + + +if __name__=="__main__":main() diff --git a/tools/test_server_graphics.py b/tools/test_server_graphics.py index 9e894a229..ac30c0680 100644 --- a/tools/test_server_graphics.py +++ b/tools/test_server_graphics.py @@ -25,7 +25,7 @@ def main(): fixture = build_mod.build_integration_fixture('server-graphics', 'dev.horizonlab.metrics.ServerGraphicsIntegration', fixture_dependencies={}) version = build_pack.read_lock()['pack_version'] - mod = root / 'dist' / f'horizon-lab-{version}.jar' + mod = root / 'dist' / f'horizon-{version}.jar' digest = hashlib.sha256(mod.read_bytes()).hexdigest() instance = root / '.local/runtime' / ('server-graphics-' + (args.backend or 'default')) if instance.exists(): diff --git a/tools/test_state_provider_parity.py b/tools/test_state_provider_parity.py new file mode 100644 index 000000000..693fa3fd5 --- /dev/null +++ b/tools/test_state_provider_parity.py @@ -0,0 +1,400 @@ +#!/usr/bin/env python3 +"""Compare initial state-provider codecs, choices and optional sampling.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import zipfile +try: + from . import lab, test_rust_parity as base, test_worldgen_parity as worldgen, test_biome_temperature_parity as temperature, test_material_condition_parity as material, test_block_survival_parity as survival +except ImportError: + import lab + import test_rust_parity as base + import test_worldgen_parity as worldgen + import test_biome_temperature_parity as temperature + import test_material_condition_parity as material, test_block_survival_parity as survival + + +def corpus(facts,tags,provider_resources=None,catalog_resources=None,fluid_tags=None,biomes=None,biome_tags=None,support_states=None,survival_rules=None): + def cases(definition,states=None,repeats=1,wide=False): + if states is None:states=list(facts['defaults'].values())[:6] + for typed in [False,True]: + for legacy,worldgen in ([(False,False),(True,False),(False,True),(True,True)] if wide else [(False,False)]): + yield {'definition':json.dumps(definition,separators=(',',':')),'typed':typed,'legacy':legacy,'worldgen':worldgen,'seed':-1 if legacy else 0x123456789abcdef,'states':states,'repeats':repeats,'fail':-1} + for index,state in enumerate(facts['states']): + yield from cases(state,[index]) + yield from cases({'type':'simple','state':state},[index]) + for name in facts['defaults']: + for value in [name,{'type':'simple','state':name},{'type':'random_block','blocks':name},{'type':'random_block','blocks':[name]}]: + yield from cases(value,[0],wide=False) + for name in sorted(tags): + yield from cases({'type':'random_block','blocks':'#'+name},wide=True) + for blocks in [[],['water','stone','water'],['air'],['oak_log','redstone_wire','water'],['#minecraft:logs'],'#horizon:missing',['missing'],False,{},None]: + for f in cases({'type':'random_block','blocks':blocks},repeats=3,wide=True): + yield f + yield dict(f,fail=0) + yield dict(f,fail=2) + entries=lambda weights:[{'data':state,'weight':weight} for state,weight in zip(['stone','water','oak_log'],weights)] + for weights in [[],[0],[1],[100],[0,0,0],[0,1,0],[1,0,2],[2147483647],[2147483647,1],[-1],[1.9],[4294967297],[True],[None]]: + yield from cases({'type':'weighted','entries':entries(weights)},repeats=5,wide=True) + for state in ['missing','stone',{'id':'water','properties':{'level':'+01'}},{'id':'oak_log','properties':{'axis':'z'}},None,False,1,[],{}]: + yield from cases({'type':'simple','state':state},wide=True) + for typed in [{'type':'simple','state':'water'},{'type':'weighted','entries':entries([1,2,3])},{'type':'random_block','blocks':['water']},{'type':'missing'}]: + for name in ['stone','missing']: + yield from cases(dict(typed,id=name),wide=True) + all_states=list(range(len(facts['states']))) + for direction in ['down','up','north','south','west','east']: + yield from cases({'type':'rotated','state':{'type':'random_block','blocks':[]},'direction':direction},all_states) + yield from cases({'type':'rotated','state':{'type':'random_block','blocks':[]}},all_states,wide=True) + sources=[{'id':'oak_log'},{'type':'weighted','entries':[{'data':'oak_log','weight':2},{'data':'piston','weight':3},{'data':'hopper','weight':1}]},{'type':'random_block','blocks':['furnace','stone','oak_stairs']},{'type':'random_block','blocks':[]},{'type':'random_block','blocks':'#horizon:empty'},'oak_log',None] + for source in sources: + for direction in [None,'up','west','UP','missing',False,1]: + for f in cases({'type':'rotated','state':source,'direction':direction},repeats=4,wide=True): + yield f + yield dict(f,fail=0) + for depth in [1,2,8,64]: + source={'type':'weighted','entries':[{'data':'oak_log','weight':1},{'data':'piston','weight':1}]} + for _ in range(depth):source={'type':'rotated','state':source} + yield from cases(source,repeats=2,wide=True) + # One representative per property-family value covers every compatible + # property update for each target state without a quadratic all-state matrix. + integers={tuple(v) for v in facts.get('integers',[])} + domains={} + for state in facts['states']: + for name,value in state.get('properties',{}).items():domains.setdefault((state['id'],name),set()).add(value) + signatures={key:(key[1],key in integers,tuple(sorted(values))) for key,values in domains.items()} + representatives={} + for index,state in enumerate(facts['states']): + for name,value in state.get('properties',{}).items():representatives.setdefault(signatures[(state['id'],name)],{}).setdefault(value,index) + for index,state in enumerate(facts['states']): + targets={0,index} + for name in state.get('properties',{}):targets.update(representatives[signatures[(state['id'],name)]].values()) + f=next(cases({'type':'copy_properties','source':state},sorted(targets))) + yield f + for source in sources: + for f in cases({'type':'copy_properties','source':source},repeats=3,wide=True): + yield f + yield dict(f,fail=0) + yield dict(f,fail=1) + for block,property_name in sorted(integers): + values=sorted(map(int,domains[(block,property_name)])) + for value in [values[0],values[-1],values[0]-1,values[-1]+1,{'type':'uniform','min_inclusive':values[0]-1,'max_inclusive':values[-1]+1}]: + source={'type':'weighted','entries':[{'data':{'id':block},'weight':1},{'data':'stone','weight':1},{'data':'water','weight':1}]} + yield from cases({'type':'randomized_int','source':source,'property':property_name,'values':value},repeats=3,wide=True) + for name in ['missing','axis','level','age','power','distance','',None,False]: + for value in [0,1,-1,{'type':'uniform','min_inclusive':0,'max_inclusive':31}]: + for f in cases({'type':'randomized_int','source':{'type':'random_block','blocks':[]},'property':name,'values':value},list(facts['defaults'].values()),wide=True): + yield f + yield dict(f,fail=0) + for depth in [1,2,8,32]: + source={'type':'random_block','blocks':[]} + for i in range(depth):source={'type':'copy_properties','source':{'type':'randomized_int','source':source,'property':'level','values':{'type':'uniform','min_inclusive':0,'max_inclusive':15}}} + yield from cases(source,wide=True) + positions=[[0,0,0],[1,1,1],[-1,-64,-1],[17,-63,-33],[30000000,319,-30000000],[2147483647,-2147483648,2147483647],[16777217,65,-16777217]] + rng=random.Random(7581) + positions += [[rng.randrange(-30000000,30000000),rng.randrange(-2032,2032),rng.randrange(-30000000,30000000)] for _ in range(9)] + def noise_cases(definition,wide=True): + for f in cases(definition,[0]*len(positions),wide=wide): + yield dict(f,positions=positions) + parameters=[{'base_octave':-3,'octave_count':3},{'base_octave':-32},{'base_octave':32},{'base_octave':0,'base_amplitude':1000,'normalize':False},{'base_octave':-1,'octave_count':2,'amplitude_modifiers':[0,0]}] + for kind in ['noise','noise_threshold','dual_noise']: + for noise in parameters: + for scale in [0.01,0.5,1.0,1e-45,3.4028234663852886e38]: + for seed in [0,-1,9223372036854775807]: + f={'type':kind,'seed':seed,'noise':noise,'scale':scale} + if kind=='noise_threshold':f.update(threshold=0.0,high_chance=0.5,default_state='stone',low_states=['water','dirt'],high_states=['oak_log','poppy','piston']) + else:f['states']=['stone','water','dirt','oak_log','poppy','piston','furnace'] + if kind=='dual_noise':f.update(variety=[1,5],slow_noise={'base_octave':-4,'octave_count':2},slow_scale=scale) + yield from noise_cases(f) + template={'type':'noise','seed':0,'noise':{'base_octave':0},'scale':0.1,'states':['stone','water','oak_log']} + for seed in [18446744073709551617,-18446744073709551617,1e100,-1e100,1.9,-1.9,0.9,-0.9,True,None,'1']: + yield from noise_cases(dict(template,seed=seed)) + for scale in [0,-0.0,-1,1e-50,1e100,None,True,'0.1']: + yield from noise_cases(dict(template,scale=scale),False) + for noise in [{'base_octave':33},{'base_octave':-33},{'base_octave':0,'normalize':'legacy'},{'base_octave':0,'octave_count':0},None,False]: + yield from noise_cases(dict(template,noise=noise),False) + for states in [[],['missing'],None,False,'stone',[{'id':'water','properties':{'level':'1'}}]]: + yield from noise_cases(dict(template,states=states),False) + for variety in [1,64,[1,1],[64,64],[1,64],{'min_inclusive':2,'max_inclusive':7},[0,2],[2,1],[1,65],[],[1],False,None]: + yield from noise_cases(dict(template,type='dual_noise',variety=variety,slow_noise={'base_octave':0,'normalize':False,'base_amplitude':1000},slow_scale=0.25),False) + for threshold in [-1,-0.0,0,1,-1.1,1.1,None]: + for chance in [-0.0,0,0.5,1,2,None]: + yield from noise_cases(dict(template,type='noise_threshold',threshold=threshold,high_chance=chance,default_state='stone',low_states=['water'],high_states=['poppy']),False) + for definition in (provider_resources or {}).values():yield from noise_cases(definition) + true={'type':'true'} + false={'type':'not','predicate':true} + inside={'type':'inside_world_bounds'} + predicates=[true,false,inside,{'type':'all_of','predicates':[]},{'type':'any_of','predicates':[]}, + {'type':'all_of','predicates':[false,inside]}, {'type':'all_of','predicates':[inside,false]}, + {'type':'any_of','predicates':[true,inside]}, {'type':'any_of','predicates':[inside,true]}] + predicates += [{'type':'inside_world_bounds','offset':[0,y,0]} for y in [-2147483648,-16,-1,1,16,17]] + empty={'type':'random_block','blocks':[]} + choices=[empty,{'id':'water'}, {'type':'weighted','entries':entries([1,2,3])}, + {'type':'copy_properties','source':empty}, template, + {'type':'randomized_int','source':{'id':'water'},'property':'level','values':{'type':'uniform','min_inclusive':0,'max_inclusive':16}}] + positions=[[17,y,-33] for y in [-2147483648,-65,-64,-63,0,318,319,320,2147483647]] + for predicate in predicates: + for choice in choices: + for fallback in [None,empty,{'id':'oak_log'}]: + definition={'type':'rule_based','fallback':fallback,'rules':[ + {'if_true':predicate,'then':choice}, {'if_true':inside,'then':empty}, + {'if_true':false,'then':{'type':'copy_properties','source':empty}}]} + for f in cases(definition,[0]*len(positions),wide=True): + f=dict(f,positions=positions) + yield f + yield dict(f,query_fail=0) + yield dict(f,query_fail=2) + yield dict(f,fail=0) + for rules in [[],None,False,[{}],[{'if_true':true}],[{'then':empty}], + [{'if_true':false,'then':{'type':'missing'}}], [{'if_true':{'type':'missing'},'then':empty}]]: + for fallback in [None,empty,{'id':'stone'},'stone',{'type':'missing'}]: + yield from cases({'type':'rule_based','rules':rules,'fallback':fallback},wide=True) + for depth in [1,2,8,32]: + source=empty + for _ in range(depth):source={'type':'rule_based','fallback':source,'rules':[{'if_true':true,'then':empty}]} + yield from cases(source,wide=True) + def predicate_cases(predicate, states=None, wide=True): + if states is None:states=[0]*len(positions) + definition={'type':'rule_based','rules':[{'if_true':predicate,'then':{'id':'stone'}}],'fallback':empty} + for f in cases(definition,states,wide=wide): + f=dict(f,positions=positions) + yield f + yield dict(f,query_fail=1,fail=1) + anchors=[{kind:v} for kind in ['absolute','above_bottom','below_top','relative_to_sea_level'] for v in [-2032,-64,0,63,2031]] + for minimum in anchors: + for maximum in anchors: + yield from predicate_cases({'type':'height_range','min_inclusive':minimum,'max_inclusive':maximum},wide=False) + for invalid in [None,1,{}, {'absolute':2032}, {'below_top':-2033}, {'absolute':0,'above_bottom':0}]: + yield from predicate_cases({'type':'height_range','min_inclusive':invalid,'max_inclusive':{'absolute':0}},wide=False) + for tag in [*sorted(tags),'missing',':','#minecraft:logs','UPPERCASE',None,False]: + yield from predicate_cases({'type':'matching_block_tag','tag':tag},list(facts['defaults'].values()),wide=False) + for name in facts['defaults']: + matching=[i for i,state in enumerate(facts['states']) if state['id']==name] + states=sorted(set(matching+[0,len(facts['states'])-1])) + for blocks in [name,[name]]: + yield from predicate_cases({'type':'matching_blocks','blocks':blocks},states,wide=False) + for blocks in [*['#'+name for name in sorted(tags)], [], ['stone','water','stone'], '#missing', ['#minecraft:logs'], ['missing'], ['stone',None], None, False, {}]: + yield from predicate_cases({'type':'matching_blocks','blocks':blocks},list(facts['defaults'].values()),wide=False) + for fluids in ['empty','flowing_water','water','flowing_lava','lava',*['#'+name for name in sorted(fluid_tags or {})],[],['water','water','flowing_lava'],'missing','#missing',['#minecraft:water'],False,None]: + yield from predicate_cases({'type':'matching_fluids','fluids':fluids},all_states,wide=False) + biome_indices=list(range(len(biomes or {'minecraft:plains':{}}))) + for selected in [*sorted(biomes or {}),*['#'+name for name in sorted(biome_tags or {})],[],['plains','desert','plains'],'plains','missing','#missing',['#minecraft:is_badlands'],False,None]: + predicate={'type':'matching_biomes','biomes':selected} + for condition in [predicate,{'type':'not','predicate':predicate}, {'type':'volume_match','min':[0,0,0],'max':[1,0,1],'match':predicate}]: + for f in predicate_cases(condition,[0]*len(biome_indices),wide=False):yield dict(f,biomes=biome_indices) + for selected in ['plains','#horizon:ordered',[]]: + for f in predicate_cases({'type':'any_of','predicates':[{'type':'matching_biomes','biomes':selected},inside]},[0]*len(biome_indices)): + yield dict(f,biomes=biome_indices) + for offset in [None,[0,0,0],[1,-1,16],[17,18,-19],[2147483647,-2147483648,2147483647],[4294967297,0,0],[1.9,-1.9,0],[],[1],[1,2,3,4],False,{}]: + predicate={'type':'unobstructed','offset':offset} + for condition in [predicate,{'type':'not','predicate':predicate},{'type':'volume_match','min':[-1,0,-1],'max':[1,0,1],'match':predicate}]: + for f in predicate_cases(condition): + yield dict(f,unobstructed=True) + yield dict(f,unobstructed=False) + for offset in [[0,0,0],[16,-16,1],[-2147483648,0,-2147483648],[17,0,0],[],None]: + yield from predicate_cases({'type':'matching_block_tag','tag':'minecraft:logs','offset':offset}) + for minimum,maximum in [([0,0,0],[0,0,0]),([-1,-1,-1],[1,1,1]),([-16,0,0],[16,1,1]),([1,0,0],[0,0,0]),([-17,0,0],[0,0,0]),([-2147483648,0,0],[-2147483648,0,0])]: + for child in [true,false,inside,{'type':'height_range','min_inclusive':{'above_bottom':0},'max_inclusive':{'below_top':0}}, {'type':'matching_block_tag','tag':'minecraft:logs'}, {'type':'not','predicate':{'type':'matching_block_tag','tag':'minecraft:logs'}}]: + yield from predicate_cases({'type':'volume_match','min':minimum,'max':maximum,'match':child}) + for depth in [1,2,3]: + child={'type':'not','predicate':{'type':'matching_block_tag','tag':'minecraft:logs'}} + for _ in range(depth):child={'type':'volume_match','min':[0,0,0],'max':[1,1,1],'match':child} + yield from predicate_cases(child) + for definition in (provider_resources or {}).values(): + if definition.get('type') == 'minecraft:rule_based': + yield from cases(definition,all_states,wide=True) + for bounds in [[0,1,0],[2147483647,2,0],[-2147483648,384,63]]: + for f in cases({'type':'rule_based','rules':[{'if_true':inside,'then':{'id':'stone'}}]},[0]*len(positions),wide=True): + yield dict(f,bounds=bounds,positions=positions) + for kind in ['solid','replaceable']: + for offset in [None,[0,0,0],[16,-16,1],[-2147483648,0,0],[17,0,0],[],[0,0],False,[1.9,0,0]]: + predicate={'type':kind,'offset':offset} + definition={'type':'rule_based','fallback':{'id':'water'},'rules':[{'if_true':predicate,'then':{'id':'stone'}}]} + for f in cases(definition,all_states,wide=True):yield dict(f,positions=positions) + for f in cases(definition,[0,1],wide=True): + yield dict(f,fail=0,positions=positions) + yield dict(f,fail=1,positions=positions) + for condition in [{'type':'all_of','predicates':[false,{'type':kind}]},{'type':'any_of','predicates':[true,{'type':kind}]},{'type':'not','predicate':{'type':kind}},{'type':'volume_match','min':[-1,0,-1],'max':[1,0,1],'match':{'type':kind}}]: + definition={'type':'rule_based','fallback':empty,'rules':[{'if_true':condition,'then':empty},{'if_true':{'type':kind},'then':{'id':'stone'}}]} + for f in cases(definition,list(facts['defaults'].values()),wide=True): + yield f + yield dict(f,fail=0) + yield dict(f,fail=2) + if survival_rules: + representatives={} + neighbors=[facts['defaults'][name] for name in ['minecraft:air','minecraft:stone','minecraft:pale_moss_carpet','minecraft:shulker_box','minecraft:moving_piston'] if name in facts['defaults']] + def survival_provider(condition): + return {'type':'rule_based','fallback':{'id':'water'},'rules':[{'if_true':condition,'then':{'id':'stone'}}]} + for state in facts['states']: + rule=survival_rules.get(state['id']) + if rule is None:continue + key=survival.behavior_key(rule,state) + representatives.setdefault(key,state) + yield from cases(survival_provider({'type':'would_survive','state':state}),neighbors) + for state in representatives.values(): + yield from cases(survival_provider({'type':'would_survive','state':state}),all_states) + if survival_rules[state['id']] in ['Crop','PitcherCrop','Mushroom']: + for brightness in [-2147483648,-1,0,7,8,9,12,13,14,15,2147483647]: + for f in cases(survival_provider({'type':'would_survive','state':state}),all_states[::7],wide=True): + yield dict(f,brightness=brightness) + yield dict(f,brightness=brightness,query_fail=0) + yield dict(f,brightness=brightness,fail=0) + for offset in [[-16,0,16],[16,-16,0],[17,0,0],[-17,0,0],[0,0],None,'bad']: + condition={'type':'would_survive','state':state,'offset':offset} + for f in cases(survival_provider(condition),neighbors,wide=True): + yield dict(f,positions=positions) + yield dict(f,positions=positions,fail=0) + yield dict(f,positions=positions,query_fail=0) + condition={'type':'would_survive','state':state} + for combined in [{'type':'all_of','predicates':[false,condition]},{'type':'any_of','predicates':[true,condition]},{'type':'not','predicate':condition},{'type':'volume_match','min':[-1,0,-1],'max':[1,0,1],'match':condition}]: + definition={'type':'rule_based','rules':[{'if_true':combined,'then':empty},{'if_true':condition,'then':{'id':'stone'}}]} + for f in cases(definition,neighbors,wide=True): + yield f + yield dict(f,fail=1) + for state in ['stone','minecraft:water',{'id':'ladder','properties':{'facing':'east'}},{'id':'water','properties':{'level':'+01'}},'missing',{},None,False,[],{'id':'pale_moss_carpet','properties':{'bottom':'bad'}}]: + yield from cases(survival_provider({'type':'would_survive','state':state}),neighbors,wide=True) + yield from cases(survival_provider({'type':'would_survive'}),neighbors) + support_states = all_states if support_states is None else support_states + support_ids=set(support_states) + dynamic_support_states=[state for state in all_states if state not in support_ids] + for direction in ['down','up','north','south','west','east','UP','missing',None,False,1]: + for offset in [None,[0,0,0],[16,-16,1],[-2147483648,0,0],[17,0,0],[],[1.9,0,0]]: + condition={'type':'has_sturdy_face','direction':direction,'offset':offset} + definition={'type':'rule_based','fallback':{'id':'water'},'rules':[{'if_true':condition,'then':{'id':'stone'}}]} + valid=direction in ['down','up','north','south','west','east'] and offset not in [[17,0,0],[]] + for f in cases(definition,all_states if valid else [0],wide=False):yield dict(f,positions=positions) + for f in cases(definition,[0,1],wide=True):yield dict(f,positions=positions,fail=0) + for direction in ['down','up','north','south','west','east']: + definition={'type':'rule_based','fallback':{'id':'water'},'rules':[{'if_true':{'type':'has_sturdy_face','direction':direction},'then':{'id':'stone'}}]} + if dynamic_support_states: + for f in cases(definition,dynamic_support_states,wide=True): + for failure in [0,1,2]:yield dict(f,query_fail=failure,positions=positions) + for condition in [{'type':'all_of','predicates':[false,{'type':'has_sturdy_face','direction':direction}]},{'type':'any_of','predicates':[true,{'type':'has_sturdy_face','direction':direction}]},{'type':'not','predicate':{'type':'has_sturdy_face','direction':direction}}]: + definition={'type':'rule_based','rules':[{'if_true':condition,'then':empty},{'if_true':{'type':'has_sturdy_face','direction':direction},'then':{'id':'stone'}}]} + for f in cases(definition,support_states[::17],wide=True): + yield f + yield dict(f,fail=1) + for name in [*(catalog_resources or {}),'horizon:unknown','minecraft:stone','STONE',':']: + for f in cases(name,repeats=2,wide=True): + yield f + yield dict(f,holder=True) + for wrapper in [{'type':'copy_properties','source':name},{'type':'rotated','state':name}, + {'type':'randomized_int','source':name,'property':'age','values':1}, + {'type':'rule_based','fallback':name,'rules':[]}, + {'type':'rule_based','rules':[{'if_true':true,'then':name}]}]: + for f in cases(wrapper,repeats=2,wide=True): + yield f + yield dict(f,holder=True,fail=0) + for f in cases({'id':'stone','type':'copy_properties','source':name},wide=True): + yield f + yield dict(f,holder=True) + for definition in (provider_resources or {}).values(): + for f in cases(definition,list(facts['defaults'].values()),wide=True):yield dict(f,holder=True) + for value in [None,False,1,[],{}, {'type':'unknown'}, {'id':'missing'}, {'type':False}, {'type':'simple'}, {'type':'random_block'}, {'type':'weighted'}]: + yield from cases(value) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__) + parser.add_argument('--prepare',action='store_true') + parser.add_argument('--resume',action='store_true',help='Reuse stages only after verifying input, executable and output hashes') + args=parser.parse_args() + build=lab.LOCAL/'rust-state-provider-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + checkpoint_path=build/'run-state.json' + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaStateProviderOracle.java' + helpers=[oracle.with_name(name+'.java') for name in ['VanillaBlockStateCodecOracle','VanillaHeightmapOracle','VanillaMaterialConditionOracle','VanillaBiomeTemperatureOracle','VanillaAnchorOracle','VanillaBlockPropertiesOracle','VanillaBlockSupportOracle','VanillaBlockSurvivalOracle','VanillaCollisionOracle']] + sources=[oracle,*helpers,lab.ROOT/'tools/test_block_survival_parity.py',lab.ROOT/'tools/test_biome_temperature_parity.py',lab.ROOT/'tools/test_material_condition_parity.py',lab.ROOT/'tools/test_worldgen_parity.py',Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/state_provider_fixture.rs'] + tested_sources=base.source_hashes(sources) + environment={'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'dependencies':{str(path):lab.digest(path,'sha256') for path in [*jars.values(),*libraries]}} + checkpoint=survival.load_checkpoint(checkpoint_path,tested_sources,environment) if args.resume else None + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:subprocess.run(list(map(str,command)),cwd=lab.ROOT,check=True,stdout=log,stderr=subprocess.STDOUT,timeout=3600) + dependency_path=os.pathsep.join(map(str,libraries)) + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaStateProviderOracle',mode,path],side+'-'+mode) + if checkpoint is None: + checkpoint_path.unlink(missing_ok=True) + tags=worldgen.tag_resources(jars['server']) + if not tags or tags!=worldgen.tag_resources(jars['client']):raise ValueError('client/server tags differ') + tags.update({'horizon:empty':json.dumps({'values':[]}), 'horizon:ordered':json.dumps({'values':['minecraft:water','minecraft:stone','minecraft:water']})}) + (build/'tags.json').write_text(json.dumps(tags,separators=(',',':')),encoding='utf-8') + def fluid_tag_resources(jar): + with zipfile.ZipFile(jar) as archive: + prefix='data/minecraft/tags/fluid/' + return {'minecraft:'+name[len(prefix):-5]:archive.read(name).decode('utf-8') for name in sorted(archive.namelist()) if name.startswith(prefix) and name.endswith('.json')} + fluid_tags=fluid_tag_resources(jars['server']) + if fluid_tags!=fluid_tag_resources(jars['client']):raise ValueError('client/server fluid tags differ') + fluid_tags['horizon:empty']='{"values":[]}' + (build/'fluid-tags.json').write_text(json.dumps(fluid_tags,separators=(',',':')),encoding='utf-8') + biomes=temperature.biome_resources(jars['server']);biome_tags=material.biome_tag_resources(jars['server']) + if biomes!=temperature.biome_resources(jars['client']) or biome_tags!=material.biome_tag_resources(jars['client']):raise ValueError('client/server biome resources differ') + biome_tags['horizon:empty']='{"values":[]}' + biome_tags['horizon:ordered']='{"values":["minecraft:plains","minecraft:desert","minecraft:plains"]}' + for name,data in [('biomes',biomes),('biome_tags',biome_tags)]: + (build/(name+'.json')).write_text(json.dumps(data,separators=(',',':')),encoding='utf-8') + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle,*helpers],'compile-java') + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars['server']),dependency_path]),'dev.horizonlab.parity.VanillaBlockPropertiesOracle','export',build],'properties-export') + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars['server']),dependency_path]),'dev.horizonlab.parity.VanillaBlockSupportOracle','export',build],'support-export') + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars['server']),dependency_path]),'dev.horizonlab.parity.VanillaBlockSurvivalOracle','definitions',build],'survival-export') + survival_classes=json.loads((build/'survival-classes.json').read_text()) + survival_rules=survival.bind_definitions(survival_classes,json.loads((build/'survival-placement-classes.json').read_text()),json.loads((build/'survival-support-tags.json').read_text())) + (build/'survival-rules.json').write_text(json.dumps(survival_rules,separators=(',',':'))) + support_states=json.loads((build/'support-cached-states.json').read_text()) + if len(support_states)!=35524:raise ValueError('incomplete support state cache') + for side in jars:java(side,'export',build/f'facts-{side}.json') + facts=json.loads((build/'facts-server.json').read_text()) + if facts!=json.loads((build/'facts-client.json').read_text()):raise ValueError('client/server registry metadata differs') + if len(facts['states'])!=35723:raise ValueError('incomplete pinned state registry') + def resources(jar): + with zipfile.ZipFile(jar) as archive: + return {name:json.loads(archive.read(name)) for name in sorted(archive.namelist()) if name.startswith('data/minecraft/worldgen/block_state_provider/') and name.endswith('.json')} + provider_resources=resources(jars['server']) + if provider_resources!=resources(jars['client']):raise ValueError('bundled noise provider resources differ') + (build/'providers.json').write_text(json.dumps(provider_resources,separators=(',',':')),encoding='utf-8') + catalog_resources={name.removeprefix('data/minecraft/worldgen/block_state_provider/').removesuffix('.json'):json.dumps(value,separators=(',',':')) for name,value in provider_resources.items()} + catalog_resources={'minecraft:'+name:value for name,value in catalog_resources.items()} + catalog_resources['horizon:empty']=json.dumps({'type':'random_block','blocks':[]}) + catalog_resources['horizon:tagged']=json.dumps({'type':'rule_based','rules':[{'if_true':{'type':'matching_block_tag','tag':'minecraft:logs'},'then':'minecraft:cave_vines_head'}],'fallback':'horizon:empty'}) + for depth in range(12): + catalog_resources['horizon:chain_'+str(depth)]=json.dumps({'type':'copy_properties','source':'horizon:chain_'+str(depth-1) if depth else 'horizon:tagged'}) + (build/'catalog.json').write_text(json.dumps(catalog_resources,separators=(',',':')),encoding='utf-8') + inputs=build/'inputs.txt';fixture_count=0;requested_samples=0 + with inputs.open('w',encoding='utf-8') as output: + for fixture in corpus(facts,tags,provider_resources,catalog_resources,fluid_tags,biomes,biome_tags,support_states,survival_rules): + output.write(json.dumps(fixture,separators=(',',':'))+'\n') + fixture_count+=1;requested_samples+=len(fixture['states'])*fixture['repeats']*2 + fixture_paths=[inputs,build/'survival-extra-definitions.json',build/'survival-placement-classes.json',build/'survival-support-tags.json',build/'survival-classes.json',build/'survival-rules.json',build/'cached-support.nbt',build/'support-cached-states.json',build/'block-properties.nbt',build/'cached-collision.nbt',build/'biomes.json',build/'biome_tags.json',build/'fluid-tags.json',build/'catalog.json',build/'providers.json',build/'tags.json',build/'facts-client.json',build/'facts-server.json'];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','state_provider_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('state_provider_fixture.exe' if os.name=='nt' else 'state_provider_fixture') + counts={'block_states':len(facts['states']),'blocks':len(facts['defaults']),'integer_properties':len(facts['integers']),'codec_inputs':fixture_count,'provider_types':10,'named_providers':len(catalog_resources),'rule_predicate_types':16,'survival_supported_blocks':len(survival_rules),'survival_supported_states':sum(s['id'] in survival_rules for s in facts['states']),'support_cached_states':len(support_states),'support_dynamic_states':len(facts['states'])-len(support_states),'biomes':len(biomes),'biome_tag_files':len(biome_tags),'fluid_tag_files':len(fluid_tags),'bundled_provider_definitions':len(provider_resources),'block_tag_files':len(tags),'requested_samples':requested_samples} + base.ensure_sources_unchanged(sources,tested_sources) + checkpoint={'schema':1,'environment':environment,'sources_sha256':tested_sources,'fixtures_sha256':{str(lab.ROOT/name):digest for name,digest in tested_fixtures.items()},'artifacts_sha256':{str(path):lab.digest(path,'sha256') for path in [binary,*sorted(classes.rglob('*.class'))]},'binary':str(binary),'counts':counts,'outputs':{}} + survival.save_checkpoint(checkpoint_path,checkpoint) + print('Verified inputs and compiled executables checkpointed',flush=True) + def stage(name,action): + output=build/(name+'.txt');previous=checkpoint['outputs'].get(name) + if previous is None or not output.exists() or lab.digest(output,'sha256')!=previous: + action() + checkpoint['outputs'][name]=lab.digest(output,'sha256') + survival.save_checkpoint(checkpoint_path,checkpoint) + print(f'{name}: completed output checkpointed',flush=True) + stage('rust',lambda:run([checkpoint['binary'],build],'rust'));references=[] + for side,jar in jars.items(): + stage(side,lambda:java(side,side,build));reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} state-provider output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources) + survival.load_checkpoint(checkpoint_path,tested_sources,environment) + report={'schema':1,**{key:value for key,value in environment.items() if key!='dependencies'},**checkpoint['counts'],'sources_sha256':tested_sources,'fixtures_sha256':{str(Path(name).relative_to(lab.ROOT)):digest for name,digest in checkpoint['fixtures_sha256'].items()},'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual BlockStateProvider DIRECT_CODEC/TYPED_CODEC and simple, weighted, random_block, rotated, copy_properties, randomized_int three noise-based providers and rule_based over the pinned state registry. All states and block defaults, full-state versus typed exclusive decoding, ordered holder sets/tags, duplicates, empty optional results versus world-state fallback, zero/overflow weights, query failures, every state across six fixed rotations, nested random rotations, property copying for every target state against representatives of every compatible property value, integer-property ranges/missing properties, composed transforms and subsequent random consumption. Native property equality families are checked for ambiguity; Rust validates Cartesian state tables and uses compact property strides. Both legacy/xoroshiro streams execute directly and through WorldgenRandom. Noise comparisons include every bundled provider definition, independent legacy seeding, float/double scaling, dual-noise variety selection, threshold draw order and coordinate/codec boundaries. Rule-based comparisons cover true/not/all_of/any_of/inside_world_bounds/height_range/volume_match/matching_block_tag/matching_blocks/matching_fluids/matching_biomes/unobstructed/solid/replaceable/has_sturdy_face/would_survive predicates, ordered optional results, fallbacks, nested rules and world-query failures. Every pinned block-state fluid identity, amount, falling/source flag and own-height bits are derived from descriptors and compared. Fluid-holder sets and all bundled fluid tags are tested against every state. Biome-holder membership and all bundled biome tags are compared across every pinned biome identity, including empty sets, missing names, ordered world queries and short-circuit composition. Unobstructed predicates compare null excluded entities, exact translated unit-shape bounds, ignored-but-validated offsets, true/false world results and failures. Named holder versus direct/typed decoding, nested named providers, missing names, inline ambiguity, ordered resource registration and all bundled named definitions are compared. Solidity and replacement predicates cover every block state, offset wrapping/validation, empty-child fallthrough, composed predicates and query failures using privately imported definition flags and Rust-calculated collision solidity. Has-sturdy-face predicates cover all 35,723 states through unified cached/dynamic support dispatch across six directions, native offset rules, failed state reads, block-entity query failures and ordered optional-child/boolean composition. Block entities are absent in this integration corpus; shulker animation-state shape selection is separately tested and active moving-piston shape generation is tested separately. Would-survive decodes candidate states and bounded offsets, evaluates all supported candidate states and each rule against every neighbor state, and preserves world read/entity failures and short-circuit/optional-child behavior. All pinned survival families are bound through the recorded definition inputs. Complete registry loading/reloading, full block placement behavior and full feature generation remain pending.'} + lab.write_json(report_path,report);print(f'Scoped state-provider parity passed: {report_path}') + + +if __name__=='__main__':main() diff --git a/tools/test_structure_density_parity.py b/tools/test_structure_density_parity.py new file mode 100644 index 000000000..75094c3e6 --- /dev/null +++ b/tools/test_structure_density_parity.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python3 +"""Compare structure terrain-adaptation samplers with pinned vanilla bytecode.""" +import argparse +import json +import os +from pathlib import Path +import platform +import random +import subprocess +try: + from . import lab,test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + rng=random.Random(0x484f52495a4f4e4245415244) + kinds=["NONE","BURY","BEARD_THIN","BEARD_BOX","ENCAPSULATE"] + volumes=[[29,29,29,-14,-14,-14,1,1,1,3],[8,9,7,-17,-20,-19,4,5,6,7], + [3,2,4,100,200,300,1,1,1,5],[1,1,1,0,0,0,1,1,1,1]] + points=[[0,0,0],[-12,-12,-12],[11,11,11],[12,12,12],[-13,-13,-13],[-2**31,0,2**31-1],[2**31-1,-2**31,0]] + def fixture(pieces,junctions,affected,pts=None,vol=None): + return {"pieces":pieces,"junctions":junctions,"affected":affected,"points":points if pts is None else pts,"volumes":volumes if vol is None else vol} + # The full junction neighborhood spans every position in the 24-cubed kernel. + yield fixture([],[[0,0,0]],[-100,-100,-100,100,100,100]) + for affected in [None,[-1,-1,-1,1,1,1],[0,0,0,0,0,0]]: + yield fixture([],[],affected) + yield fixture([[[0,0,0,7,8,9],"BURY",0]],[[0,0,0]],affected) + for kind in kinds: + for delta in [-2**31,-33,-12,-1,0,1,12,33,2**31-1]: + yield fixture([[[0,0,0,7,8,9],kind,delta]],[],[-100,-100,-100,100,100,100]) + # Bulk floor clipping intentionally differs from scalar containment. + for affected in [[1,1,1,9,9,9],[-9,-9,-9,-1,-1,-1],[3,5,7,3,5,7]]: + yield fixture([[[0,0,0,7,8,9],"ENCAPSULATE",0]],[[0,0,0]],affected,vol=[[9,9,9,-16,-16,-16,4,4,4,9]]) + for scenario in range(96): + pieces=[];junctions=[] + for i in range(scenario%17): + low=[rng.randrange(-32,33) for _ in range(3)];high=[v+rng.randrange(17) for v in low] + pieces.append([low+high,rng.choice(kinds),rng.randrange(-32,33)]) + for i in range(scenario%11):junctions.append([rng.randrange(-32,33) for _ in range(3)]) + affected=None if scenario%13==0 else [-48,-48,-48,48,48,48] + pts=[[rng.randrange(-60,61) for _ in range(3)] for _ in range(256)] + vol=[[rng.randrange(1,13),rng.randrange(1,15),rng.randrange(1,13),rng.randrange(-60,0),rng.randrange(-60,0),rng.randrange(-60,0),rng.randrange(1,9),rng.randrange(1,9),rng.randrange(1,9),rng.randrange(8)]] + f=fixture(pieces,junctions,affected,pts,vol);yield f + if scenario%8==0:yield fixture(list(reversed(pieces)),list(reversed(junctions)),affected,pts,vol) + # Wrapped relative arithmetic, volume intersections and extreme ground deltas. + for coordinate in [-2**31,-2**31+32,2**31-33,2**31-1]: + low=[coordinate]*3;high=[min(2**31-1,coordinate+8)]*3 + for kind in kinds: + yield fixture([[low+high,kind,2**31-1]],[[coordinate,coordinate,coordinate]],[-2**31]*3+[2**31-1]*3, + [[coordinate]*3,[0,0,0],[-1,-1,-1]],[[3,3,3,coordinate,coordinate,coordinate,16,16,16,2]]) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument("--prepare",action="store_true");args=parser.parse_args() + build=lab.LOCAL/"rust-structure-density-parity";build.mkdir(parents=True,exist_ok=True) + report_path=build/"report.json";report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaStructureDensityOracle.java" + sources=[oracle,Path(__file__),lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock",lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml", + *sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/structure_density_fixture.rs"] + tested_sources=base.source_hashes(sources) + fixtures=list(corpus());inputs=build/"inputs.txt";inputs.write_text("".join(json.dumps(f,separators=(",",":"))+"\n" for f in fixtures),encoding="utf-8") + tested_fixtures=base.source_hashes([inputs]);classes=build/"classes";classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle],"compile-java") + run(["cargo","build","--release","-p","horizon-world","--example","structure_density_fixture"],"compile-rust") + metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) + binary=Path(metadata["target_directory"])/"release/examples"/("structure_density_fixture.exe" if os.name=="nt" else "structure_density_fixture") + run([binary,inputs,build/"rust.txt"],"rust") + references=[] + for side,jar in jars.items(): + reference=build/f"{side}.txt" + run(["java","-Xmx512M","-cp",os.pathsep.join([str(classes),str(jar),dependency_path]),"dev.horizonlab.parity.VanillaStructureDensityOracle",inputs,reference],side) + matched=base.compare(reference,build/"rust.txt") + references.append({"side":side,"jar_sha256":lab.digest(jar,"sha256"),"output_sha256":lab.digest(reference,"sha256"),"matched_output_lines":matched}) + print(f"{side}: {matched:,} structure-density output lines match Rust",flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged([inputs],tested_fixtures) + report={"schema":1,"minecraft":lock["minecraft"]["version"],"manifest_sha1":lock["minecraft"]["manifest_sha1"],"platform":platform.platform(), + "java":subprocess.check_output(["java","--version"],text=True).splitlines()[0],"rustc":subprocess.check_output(["rustc","--version"],text=True).strip(), + "fixtures":len(fixtures),"scalar_queries":sum(len(f["points"]) for f in fixtures),"volumes":sum(len(f["volumes"]) for f in fixtures), + "sources_sha256":tested_sources,"fixtures_sha256":tested_fixtures,"rust_output_sha256":lab.digest(build/"rust.txt","sha256"),"references":references, + "scope":"Actual vanilla Beardifier constructor and scalar/bulk samplers from supplied ordered rigid pieces, jigsaw junctions and normalized affected bounds. Five terrain-adjustment modes, the full 24-cubed junction kernel neighborhood, ground-level offsets and extreme wrapping arithmetic, ordered accumulation, nullable/empty affected bounds, clipped strided volumes including scalar/bulk floor-clipping differences and oversized output tails. Floating outputs compared as canonical-NaN raw bits. Live structure discovery/filtering, invalid bounding-box repair, structure placement and terrain integration remain pending. Local Math.pow-derived kernel results do not establish cross-platform math parity."} + lab.write_json(report_path,report);print(f"Scoped structure-density parity passed: {report_path}") + + +if __name__=="__main__":main() diff --git a/tools/test_terrain_parity.py b/tools/test_terrain_parity.py new file mode 100644 index 000000000..3bd4dbcc6 --- /dev/null +++ b/tools/test_terrain_parity.py @@ -0,0 +1,121 @@ +#!/usr/bin/env python3 +"""Compare noise-stage terrain filling with pinned vanilla client/server bytecode.""" +import argparse +import json +import os +from pathlib import Path +import platform +import random +import subprocess +try: + from . import lab, test_rust_parity as base, test_worldgen_parity as worldgen +except ImportError: + import lab + import test_rust_parity as base + import test_worldgen_parity as worldgen + + +def corpus(facts,bundle): + defaults=facts["defaults"] + rng=random.Random(0x484f52495a4f4e46494c4c) + def fixture(minimum,height,cx,cz,seed,legacy,block,fluid,sea,router,aquifers,repeats=1): + return {"min":minimum,"height":height,"noise_min":minimum,"noise_height":height,"cx":cx,"cz":cz,"seed":seed,"legacy":legacy, + "block":block,"fluid":fluid,"sea":sea,"router":router,"aquifers":aquifers,"initial":[],"repeats":repeats} + for setting,text in bundle["settings"].items(): + s=json.loads(text) + for legacy in [False,True]: + for seed,cx,cz in [(0,0,0),(-1,-2,3),(0x123456789abcdef,1875000,-1875000)]: + f=fixture(s["noise"]["min_y"],s["noise"]["height"],cx,cz,seed,legacy,defaults[s["default_block"]],defaults[s["default_fluid"]],s["sea_level"],s["noise_router"],s.get("aquifers"),2 if seed==0 else 1) + for i in range(16):f["initial"].append([i,f["min"]+(i*17)%f["height"],15-i,defaults["minecraft:glass"]]) + yield f + fields=["temperature","vegetation","continents","erosion","depth","ridges","chunk_surface_level","final_density"] + config={"barrier":0,"fluid_level_floodedness":1,"fluid_level_spread":0,"lava":0,"exclusion":0,"surface_level":64} + wet_slab=next(i for i,state in enumerate(facts["states"]) if state[0]=="minecraft:oak_slab" and state[2]) + states=[defaults["minecraft:"+name] for name in ["air","cave_air","void_air","stone","water","lava","oak_leaves"]]+[wet_slab] + for scenario in range(48): + router=dict.fromkeys(fields,0) + router["final_density"]=[0,1,-1,{"type":"gradient","axis":"y","from_coordinate":-64,"to_coordinate":0,"from_value":1,"to_value":-1}][scenario%4] + f=fixture(-64,64,scenario%5-2,scenario//5-4,rng.randrange(-2**63,2**63),bool(scenario%2),states[(scenario//4)%len(states)],states[scenario%len(states)],[-54,-20,0,64][scenario%4],router,config if scenario%3 else None,2) + # Fill only the middle of an extended chunk; prefilled areas must survive. + if scenario%5==0:f.update(min=-80,height=96) + f["initial"]=[[rng.randrange(16),f["min"]+rng.randrange(f["height"]),rng.randrange(16),rng.choice(states)] for _ in range(48)] + yield f + + + # Real structure-density bindings through both aquifer and final-density roots. + for _,text in bundle["settings"].items(): + setting=json.loads(text) + for legacy in [False,True]: + y=max(setting["noise"]["min_y"]+16,min(setting["sea_level"],setting["noise"]["min_y"]+setting["noise"]["height"]-16)) + f=fixture(setting["noise"]["min_y"],setting["noise"]["height"],0,0,123,legacy,defaults[setting["default_block"]],defaults[setting["default_fluid"]],setting["sea_level"],setting["noise_router"],setting.get("aquifers"),2) + f["initial"]=[[1,y,1,defaults["minecraft:glass"]]] + f["structure"]={"pieces":[[[2,y-4,2,10,y+8,10],"BEARD_BOX",2],[[8,y-2,8,15,y+2,15],"BURY",0]],"junctions":[[3,y,4],[11,y+1,13]],"affected":[-32,y-32,-32,48,y+40,48]} + yield f + for kind in ["NONE","BURY","BEARD_THIN","BEARD_BOX","ENCAPSULATE"]: + for enabled in [False,True]: + router=dict.fromkeys(fields,0);router["final_density"]={"type":"cache","input":{"type":"beardifier"}} + aq=dict(config);aq["barrier"]={"type":"beardifier"};aq["surface_level"]={"type":"add","left":-16,"right":{"type":"beardifier"}} + f=fixture(-64,96,-1,1,17,False,defaults["minecraft:stone"],defaults["minecraft:water"],-16,router,aq if enabled else None,2) + f["initial"]=[[0,0,0,defaults["minecraft:glass"]]] + f["structure"]={"pieces":[[[-14,-24,18,-3,-8,28],kind,3]],"junctions":[[-6,-18,23]],"affected":[-40,-48,-8,16,24,56]} + yield f + + +def main(): + parser=argparse.ArgumentParser(description=__doc__) + parser.add_argument("--prepare",action="store_true") + args=parser.parse_args() + build=lab.LOCAL/"rust-terrain-parity";build.mkdir(parents=True,exist_ok=True) + report_path=build/"report.json";report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + tags=worldgen.tag_resources(jars["server"]) + if not tags or tags!=worldgen.tag_resources(jars["client"]):raise ValueError("client/server block tags differ or are empty") + oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaTerrainOracle.java" + exporter=oracle.with_name("VanillaHeightmapOracle.java") + sources=[oracle,exporter,Path(__file__),lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock", + lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml", + *sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/terrain_fixture.rs"] + tested_sources=base.source_hashes(sources) + classes=build/"classes";classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle,exporter],"compile-java") + def java(side,mode,path): + run(["java","-Xmx1G","-cp",os.pathsep.join([str(classes),str(jars[side]),dependency_path]),"dev.horizonlab.parity."+("VanillaHeightmapOracle" if mode=="export" else "VanillaTerrainOracle"),mode,path],side+"-"+mode) + for side in jars:java(side,"export",build/f"facts-{side}.json") + facts=json.loads((build/"facts-server.json").read_text()) + if facts!=json.loads((build/"facts-client.json").read_text()):raise ValueError("client/server state facts differ") + if len(facts["states"])!=35723:raise ValueError("incomplete pinned state table") + bundle={"tags":tags} + for field,kind in [("noises","noise"),("densities","density_function"),("settings","noise_settings")]: + resources=worldgen.registry_resources(jars["server"],kind) + if not resources or resources!=worldgen.registry_resources(jars["client"],kind):raise ValueError("client/server "+kind+" resources differ") + prefix="data/minecraft/worldgen/"+kind+"/" + bundle[field]={"minecraft:"+name[len(prefix):-5]:text for name,text in resources.items()} + fixtures=list(corpus(facts,bundle));inputs=build/"inputs.txt" + inputs.write_text("".join(json.dumps(value,separators=(",",":"))+"\n" for value in fixtures),encoding="utf-8") + (build/"registries.json").write_text(json.dumps(bundle,separators=(",",":")),encoding="utf-8") + fixture_paths=[inputs,build/"registries.json",build/"facts-client.json",build/"facts-server.json"] + tested_fixtures=base.source_hashes(fixture_paths) + run(["cargo","build","--release","-p","horizon-world","--example","terrain_fixture"],"compile-rust") + metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) + binary=Path(metadata["target_directory"])/"release/examples"/("terrain_fixture.exe" if os.name=="nt" else "terrain_fixture") + run([binary,build],"rust") + references=[] + for side,jar in jars.items(): + java(side,side,build) + reference=build/f"{side}.txt";matched=base.compare(reference,build/"rust.txt") + references.append({"side":side,"jar_sha256":lab.digest(jar,"sha256"),"output_sha256":lab.digest(reference,"sha256"),"matched_output_lines":matched}) + print(f"{side}: {matched:,} terrain-fill output lines match Rust",flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={"schema":1,"minecraft":lock["minecraft"]["version"],"manifest_sha1":lock["minecraft"]["manifest_sha1"],"platform":platform.platform(), + "java":subprocess.check_output(["java","--version"],text=True).splitlines()[0],"rustc":subprocess.check_output(["rustc","--version"],text=True).strip(), + "block_states":len(facts["states"]),"block_tag_files":len(tags),"fixtures":len(fixtures),"fill_calls":sum(f["repeats"] for f in fixtures),"noise_aquifer_fixtures":sum(f["aquifers"] is not None for f in fixtures),"structure_density_fixtures":sum("structure" in f for f in fixtures), + "sources_sha256":tested_sources,"fixtures_sha256":tested_fixtures,"rust_output_sha256":lab.digest(build/"rust.txt","sha256"),"references":references, + "scope":"Noise-stage filling only, using actual vanilla NoiseBasedChunkGenerator.doFill and NoiseChunk with empty blending and empty or supplied rigid-piece/junction structure fields. Independently authenticated client/server registry resources and exported block identities/properties/air/fluid facts must agree. Rust compiles the final density and optional aquifer through a shared compiler/context, writes resident block sections, updates ocean-floor/world-surface worldgen heightmaps and records ordered per-section fluid postprocessing offsets. Comparisons cover every raw section state, heightmap word and postprocessing offset after each fill, all bundled routers/aquifers, both seeded random factories, synthetic roots, prefilled chunks, partial vertical volumes, repeated fills and structure-density bindings in final-density/aquifer graphs. Block behavior facts remain imported; actual biome properties and material rules are not evaluated. Surface/material/carver/feature/structure stages, nonempty blending and live structure discovery, complete generated worlds and gameplay/rendering remain pending."} + lab.write_json(report_path,report);print(f"Scoped terrain-fill parity passed: {report_path}") + + +if __name__=="__main__":main() diff --git a/tools/test_terrain_position.py b/tools/test_terrain_position.py index e067f577f..af4c8b642 100644 --- a/tools/test_terrain_position.py +++ b/tools/test_terrain_position.py @@ -29,7 +29,7 @@ def main(): args = parser.parse_args() root = build_pack.ROOT fixture = build_mod.build_integration_fixture("terrain-position", "dev.horizonlab.dispatch.PositionIntegration") - mod = root / "dist" / f"horizon-lab-{build_pack.read_lock()['pack_version']}.jar" + mod = root / "dist" / f"horizon-{build_pack.read_lock()['pack_version']}.jar" original_sha256 = hashlib.sha256(mod.read_bytes()).hexdigest() results = [] for enabled in [False, True]: diff --git a/tools/test_terrain_read.py b/tools/test_terrain_read.py index eaccf2199..b829d572e 100644 --- a/tools/test_terrain_read.py +++ b/tools/test_terrain_read.py @@ -23,7 +23,7 @@ def main(): args = parser.parse_args() root = build_pack.ROOT fixture = build_mod.build_integration_fixture("terrain-read", "dev.horizonlab.dispatch.TerrainReadIntegration") - mod = root / "dist" / f"horizon-lab-{build_pack.read_lock()['pack_version']}.jar" + mod = root / "dist" / f"horizon-{build_pack.read_lock()['pack_version']}.jar" original_sha256 = hashlib.sha256(mod.read_bytes()).hexdigest() results = [] for enabled in [False, True]: diff --git a/tools/test_tick_dedup.py b/tools/test_tick_dedup.py index 94153b614..4a518e062 100644 --- a/tools/test_tick_dedup.py +++ b/tools/test_tick_dedup.py @@ -22,7 +22,7 @@ def main(): args = parser.parse_args() root = build_pack.ROOT fixture = build_mod.build_tick_dedup_fixture() - mod = root / "dist" / f"horizon-lab-{build_pack.read_lock()['pack_version']}.jar" + mod = root / "dist" / f"horizon-{build_pack.read_lock()['pack_version']}.jar" results = [] for enabled in [False, True]: instance = root / ".local/runtime" / ("tick-dedup-fixture-patched" if enabled else "tick-dedup-fixture-upstream") diff --git a/tools/test_tick_parity.py b/tools/test_tick_parity.py new file mode 100644 index 000000000..4efcc93e9 --- /dev/null +++ b/tools/test_tick_parity.py @@ -0,0 +1,194 @@ +#!/usr/bin/env python3 +"""Compare Rust scheduled-tick traces with checksum-pinned vanilla bytecode.""" +import argparse +from collections import Counter +import json +import os +from pathlib import Path +import platform +import random +import subprocess +import tempfile + +try: + from . import lab, test_rust_parity +except ImportError: + import lab + import test_rust_parity + + +def corpus(): + # Priority versus overdue time, first-request deduplication, and callback deferral. + yield "reset" + yield "add 0 0" + yield "add 1 0" + for command in ["schedule 0 0 64 0 1 3 10", "schedule 1 1 64 0 2 -3 11", + "schedule 2 16 64 0 3 0 12", "schedule 0 0 64 0 -100 -3 -99", + "save 0 0 0", "tick 10 1 0 1 1 64 0 100", "chunk 0 0", + "tick 10 20 1 0 0 64 0 100", "query 0 0 64 0", + "tick 10 20 0 0 0 64 0 100"]: + yield command + # Saved-list duplicates, negative load order, integer narrowing and time overflow. + for base in [-9223372036854775808, -2147483648, 0, 2147483647, 9223372036854775807]: + yield "reset" + yield "load -1 -1 4 0 -1 64 -1 -2147483648 -100 0 -1 64 -1 2147483647 100 1 -2 65 -2 -1 0 2 -3 66 -3 0 0" + yield "query 0 -1 64 -1" + yield "schedule 0 -1 64 -1 0 0 1" + yield f"save -1 -1 {base}" + yield f"unpack -1 -1 {base}" + yield "chunk -1 -1" + yield f"save -1 -1 {base}" + yield "tick 9223372036854775807 100 0 0 -1 64 -1 0" + yield "chunk -1 -1" + # Equal-key heads, map growth/shrink, chunk removal and heap tie behavior. + chunks = [(x, z) for x in range(-8, 9) for z in range(-4, 5)] + for reverse in [False, True]: + yield "reset" + for cx, cz in reversed(chunks) if reverse else chunks: + yield f"add {cx} {cz}" + for i in range(3): + yield f"schedule {i} {cx * 16 + i} 64 {cz * 16} {i % 2} 0 0" + for step in range(18): + yield f"tick 10 23 0 0 0 64 0 {step}" + if step % 3 == 0: + for cx, cz in chunks[step:step + 5]: + yield f"remove {cx} {cz}" + if step % 4 == 0: + for cx, cz in chunks[step:step + 8]: + yield f"restore {cx} {cz}" + yield "tick 100 10000 0 0 0 64 0 0" + # Force wraparound probe clusters in the deadline index. + def mix(key): + value = key * 0x9e3779b97f4a7c15 & ((1 << 64) - 1) + value ^= value >> 32 + return value ^ (value >> 16) + collisions = [x for x in range(1, 2000) if mix(x) & 31 == 31][:18] + yield "reset" + for x in collisions: + yield f"add {x} 0" + yield f"schedule 0 {x * 16} 64 0 0 0 0" + for _ in collisions: + yield "tick 0 1 0 0 0 64 0 0" + # Active membership, clear/copy, unload and eligibility changes in callbacks. + for action in range(6): + yield "reset" + for cx in range(-2, 4): + yield f"add {cx} 0" + for i in range(8): + yield f"schedule {i % 3} {cx * 16 + i} 64 0 0 {i % 7 - 3} {i}" + yield f"tick 0 35 {action} 1 1 64 0 9223372036854775806" + yield "query 1 1 64 0" + yield "tick 0 100 0 1 1 64 0 0" + yield "copy -32 0 0 15 100 15 16 0 0" + yield "clear -30 0 0 -1 100 0" + for cx in range(-2, 4): + yield f"chunk {cx} 0" + yield f"save {cx} 0 -1" + rng = random.Random(0x484F52495A4F4E5449434B) + positions = [(x, z) for x in range(-3, 4) for z in range(-3, 4)] + for scenario in range(8): + yield "reset" + for cx, cz in positions: + yield f"add {cx} {cz}" + for step in range(2500): + cx, cz = rng.choice(positions) + x, y, z = cx * 16 + rng.randrange(8), rng.randrange(-2, 3), cz * 16 + rng.randrange(8) + kind = rng.randrange(8) + order = rng.choice([step, -step, 0, -9223372036854775808, 9223372036854775807]) + operation = rng.randrange(100) + if operation < 55: + yield f"schedule {kind} {x} {y} {z} {rng.randrange(-5, 50)} {rng.randrange(-7, 8)} {order}" + if step % 7 == 0: + yield f"schedule {kind} {x} {y} {z} {rng.randrange(-10, 100)} 0 {order}" + elif operation < 65: + yield f"tick {rng.randrange(-5, 55)} {rng.choice([-1, 0, 1, 2, 7, 17, 100])} {rng.randrange(6)} {kind} {x} {y} {z} {order}" + elif operation < 70: + yield f"query {kind} {x} {y} {z}" + elif operation < 75: + yield f"enable {cx} {cz} {rng.randrange(2)}" + elif operation < 80: + yield f"remove {cx} {cz}" + yield f"restore {cx} {cz}" + elif operation < 84: + yield f"add {cx} {cz}" + elif operation < 88: + yield f"reload {cx} {cz} {rng.randrange(-10, 50)} {rng.randrange(-10, 50)}" + elif operation < 92: + yield f"save {cx} {cz} {rng.choice([step, -step, -9223372036854775808, 9223372036854775807])}" + elif operation < 95: + yield f"chunk {cx} {cz}" + elif operation < 98: + yield f"clear {x} -2 {z} {x + rng.randrange(20)} 2 {z + rng.randrange(20)}" + else: + yield f"copy {x} -2 {z} {x + 7} 2 {z + 7} 16 0 0" + for cx, cz in positions: + yield f"enable {cx} {cz} 1" + yield "tick 9223372036854775807 100000 0 0 0 0 0 0" + for cx, cz in positions: + yield f"chunk {cx} {cz}" + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--prepare", action="store_true") + args = parser.parse_args() + directory = lab.LOCAL / "rust-tick-parity" + directory.mkdir(parents=True, exist_ok=True) + report_path = directory / "report.json" + report_path.unlink(missing_ok=True) + if args.prepare: + lab.prepare() + lock, jars, libraries = test_rust_parity.verify_artifacts() + base = Path(tempfile.mkdtemp(prefix="run-", dir=directory)) + commands = list(corpus()) + inputs = base / "inputs.txt" + inputs.write_text("\n".join(commands) + "\n", encoding="utf-8") + oracle = lab.ROOT / "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaTickOracle.java" + data_oracle = oracle.with_name("VanillaTickDataOracle.java") + sources = [oracle, data_oracle, Path(__file__).resolve(), lab.ROOT / "tools/test_rust_parity.py", lab.ROOT / "Cargo.toml", lab.ROOT / "Cargo.lock", lab.ROOT / "crates/horizon-core/Cargo.toml", lab.ROOT / "crates/horizon-world/Cargo.toml", *sorted((lab.ROOT / "crates/horizon-core/src").rglob("*.rs")), *sorted((lab.ROOT / "crates/horizon-world/src").rglob("*.rs")), lab.ROOT / "crates/horizon-world/examples/tick_fixture.rs"] + tested_sources = test_rust_parity.source_hashes(sources) + classes = base / "classes" + classes.mkdir() + dependency_path = os.pathsep.join(map(str, libraries)) + test_rust_parity.run(["javac", "--release", "25", "-proc:none", "-cp", os.pathsep.join([str(jars["server"]), dependency_path]), "-d", str(classes), str(oracle), str(data_oracle)]) + test_rust_parity.run(["cargo", "build", "--release", "--bin", "horizon-tick-parity"]) + metadata = json.loads(subprocess.check_output(["cargo", "metadata", "--no-deps", "--format-version", "1"], cwd=lab.ROOT, text=True)) + binary = Path(metadata["target_directory"]) / "release" / ("horizon-tick-parity.exe" if os.name == "nt" else "horizon-tick-parity") + candidate = base / "rust.txt" + with inputs.open("rb") as stdin, candidate.open("wb") as stdout: + test_rust_parity.run([str(binary)], stdin=stdin, stdout=stdout) + def data_java(side, mode): + completed = subprocess.run(["java", "-Xmx512M", "-cp", os.pathsep.join([str(classes), str(jars[side]), dependency_path]), "dev.horizonlab.parity.VanillaTickDataOracle", mode, str(base)], cwd=lab.ROOT, capture_output=True, text=True, timeout=300) + (base / f"data-{side}-{mode}.log").write_text(completed.stdout + completed.stderr, encoding="utf-8") + completed.check_returncode() + return completed.stdout + data_java("server", "generate") + test_rust_parity.run(["cargo", "build", "--release", "-p", "horizon-world", "--example", "tick_fixture"]) + fixture = Path(metadata["target_directory"]) / "release/examples" / ("tick_fixture.exe" if os.name == "nt" else "tick_fixture") + test_rust_parity.run([str(fixture), str(base)]) + references = [] + for side, jar in jars.items(): + reference = base / f"vanilla-{side}.txt" + with (base / f"vanilla-{side}.log").open("wb") as log: + test_rust_parity.run(["java", "-Xmx512M", "-cp", os.pathsep.join([str(classes), str(jar), dependency_path]), "dev.horizonlab.parity.VanillaTickOracle", str(inputs), str(reference)], stdout=log, stderr=subprocess.STDOUT) + matched = test_rust_parity.compare(reference, candidate) + output = data_java(side, "verify") + marker = "HORIZON_TICK_DATA_RESULT " + counts = [json.loads(line.split(marker, 1)[1]) for line in output.splitlines() if marker in line] + if len(counts) != 1 or counts[0] != {"block_ticks": 251, "fluid_ticks": 251, "region_chunks": 1}: + raise AssertionError(f"Incomplete tick save fixture: {counts}") + references.append({"side": side, "jar_sha256": lab.digest(jar, "sha256"), "output_sha256": lab.digest(reference, "sha256"), "matched_output_lines": matched, **counts[0]}) + print(f"{side}: {matched:,} scheduled-tick output lines match", flush=True) + test_rust_parity.ensure_sources_unchanged(sources, tested_sources) + report = {"schema": 1, "minecraft": lock["minecraft"]["version"], "manifest_sha1": lock["minecraft"]["manifest_sha1"], "platform": platform.platform(), + "java": subprocess.check_output(["java", "--version"], text=True).splitlines()[0], "rustc": subprocess.check_output(["rustc", "--version"], text=True).strip(), + "commands": dict(Counter(command.split()[0] for command in commands)), "inputs_sha256": lab.digest(inputs, "sha256"), "rust_output_sha256": lab.digest(candidate, "sha256"), + "sources_sha256": tested_sources, "references": references, + "scope": "Scheduled tick ordering, deduplication, save packing, chunk eligibility/loading and callback mutations only. Block/fluid behavior is not implemented."} + lab.write_json(report_path, report) + lab.write_json(base / "report.json", report) + print(f"Scheduled-tick comparison passed: {report_path}") + + +if __name__ == "__main__": + main() diff --git a/tools/test_value_provider_parity.py b/tools/test_value_provider_parity.py new file mode 100644 index 000000000..f276e4f31 --- /dev/null +++ b/tools/test_value_provider_parity.py @@ -0,0 +1,98 @@ +#!/usr/bin/env python3 +"""Compare scalar value-provider decoding and seeded samples with pinned vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import random +import subprocess +try: + from . import lab,test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def definitions(): + encode=lambda value:json.dumps(value,separators=(',',':')) + for kind in ['float','int']: + for token in ['null','false','true','[]','{}','"0"','0','-0.0','1','-1','0.123456789','2.9','-2.9','4294967296','-4294967297','1e100','-1e100','1e-100','-1e-100']: + yield kind,token + yield kind,'{"type":"constant","value":'+token+'}' + for value in [{},{'type':'missing'},{'type':None},{'type':'constant'},{'type':'Constant','value':0},{'type':':constant','value':17}]:yield kind,encode(value) + for minimum,maximum in [(0,1),(-1,1),(-0.,0.),(1,1),(2,1),(-1e100,1e100),(1e100,1e100),(-1e-100,1e-100),(-0.7,1.3),(-1e30,1e30)]: + yield 'float',encode({'type':'uniform','min_inclusive':minimum,'max_exclusive':maximum}) + for plateau in [-1,0,0.1,1,3,1e100]:yield 'float',encode({'type':'trapezoid','min':minimum,'max':maximum,'plateau':plateau}) + ranges=[(0,0),(0,1),(-1,1),(1,1),(2,1),(-7,13),(0,14),(0,9),(-2**31,2**31-1),(0,2**31-1),(-2**31,-2**31+100),(2**31-100,2**31-1),(0,4294967297)] + for minimum,maximum in ranges: + for kind in ['uniform','biased_to_bottom','very_biased_to_bottom']: + value={'type':kind,'min_inclusive':minimum,'max_inclusive':maximum};yield 'int',encode(value) + for low,high in [(0,3),(-100,-50),(50,100),(1,0)]:yield 'int',encode({'type':'clamped','source':value,'min_inclusive':low,'max_inclusive':high}) + for plateau in [-2**31,-10,-1,0,1,3,maximum-minimum,2**31-1]:yield 'int',encode({'type':'trapezoid','min':minimum,'max':maximum,'plateau':plateau}) + for kind in ['float','int']: + yield kind,'{"type":"constant","value":0,"value":-0.0}' + for field in ['min_inclusive','max_exclusive' if kind=='float' else 'max_inclusive']: + for token in ['null','false','"1"','{}','[]']: + yield kind,'{"type":"uniform","min_inclusive":0,"'+('max_exclusive' if kind=='float' else 'max_inclusive')+'":1,"'+field+'":'+token+'}' + + + # Zero-weight entries remain part of declared bounds, but are never sampled. + constant = (lambda n: {'absolute': n}) if False else (lambda n: n) + weighted = lambda entries: {'type': 'weighted_list', 'distribution': entries} + entry = lambda value, weight: {'data': value, 'weight': weight} + choices = [constant(-7), constant(19), {'type': 'uniform', 'min_inclusive': constant(0), 'max_inclusive': constant(31)}] + for weights in [(1,), (0,), (0, 1), (1, 0), (1, 1), (1, 62), (1, 63), (1, 64), (0, 3, 7), (2147483647,), (2147483646, 1), (2147483647, 1), (-1, 2), (4294967297, 2), (0.9, 1.9)]: + value = weighted([entry(choices[i % len(choices)], weight) for i, weight in enumerate(weights)]) + yield 'int', encode(value) + nested = weighted([entry(constant(5), 1), entry(constant(-9), 4)]) + yield 'int', encode(weighted([entry(nested, 3), entry(choices[-1], 2)])) + for distribution in [None, {}, [], [entry(constant(0), 0), entry(constant(1), 0)], [entry(None, 0), entry(constant(1), 1)], [{'data': constant(1)}], [{'weight': 1}], [entry(constant(1), '1')], [entry(constant(1), None)]]: + yield 'int', encode(weighted(distribution)) + + +def corpus(): + definitions_list=list(definitions()) + for legacy in [False,True]: + for seed in [0,-1,0x123456789abcdef,-2**63,2**63-1]: + for kind,definition in definitions_list:yield {'kind':kind,'definition':definition,'legacy':legacy,'seed':seed,'samples':64} + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument("--prepare",action="store_true");args=parser.parse_args() + build=lab.LOCAL/"rust-value-provider-parity";build.mkdir(parents=True,exist_ok=True) + report_path=build/"report.json";report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaValueProviderOracle.java" + sources=[oracle,Path(__file__),lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock",lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml", + *sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/value_provider_fixture.rs"] + tested_sources=base.source_hashes(sources) + fixtures=list(corpus());inputs=build/"inputs.txt";inputs.write_text("".join(json.dumps(f,separators=(",",":"))+"\n" for f in fixtures),encoding="utf-8") + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths);classes=build/"classes";classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle],"compile-java") + run(["cargo","build","--release","-p","horizon-world","--example","value_provider_fixture"],"compile-rust") + metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) + binary=Path(metadata["target_directory"])/"release/examples"/("value_provider_fixture.exe" if os.name=="nt" else "value_provider_fixture") + run([binary,build],"rust") + references=[] + for side,jar in jars.items(): + reference=build/f"{side}.txt" + run(["java","-Xmx512M","-cp",os.pathsep.join([str(classes),str(jar),dependency_path]),"dev.horizonlab.parity.VanillaValueProviderOracle",side,build],side) + matched=base.compare(reference,build/"rust.txt") + references.append({"side":side,"jar_sha256":lab.digest(jar,"sha256"),"output_sha256":lab.digest(reference,"sha256"),"matched_output_lines":matched}) + print(f"{side}: {matched:,} value-provider output lines match Rust",flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={"schema":1,"minecraft":lock["minecraft"]["version"],"manifest_sha1":lock["minecraft"]["manifest_sha1"],"platform":platform.platform(), + "java":subprocess.check_output(["java","--version"],text=True).splitlines()[0],"rustc":subprocess.check_output(["rustc","--version"],text=True).strip(), + "fixtures":len(fixtures),"definitions":len(list(definitions())),"samples_per_valid_fixture":64, + "sources_sha256":tested_sources,"fixtures_sha256":tested_fixtures,"rust_output_sha256":lab.digest(build/"rust.txt","sha256"),"references":references, + "scope":"Actual FloatProviders.CODEC and IntProviders.CODEC decoding, declared ranges, seeded samples and interleaved subsequent nextLong values. Covers constant/uniform/trapezoid floats and constant/uniform/biased-to-bottom/very-biased-to-bottom/trapezoid/clamped/weighted-list integers, both random modes, numeric narrowing, signed zeros, overflow, equal/reversed bounds, negative plateaus, missing fields, duplicate keys and sampling failures. Float NaNs are canonicalized. Weighted lists include zero weights, singleton draws, nested providers, 63/64/65 weight totals, maximum/overflow totals and malformed entries; native constructor rejections count as decode errors. Gaussian providers, encoding, height providers and complete generation remain outside this scope."} + + lab.write_json(report_path,report);print(f"Scoped value-provider parity passed: {report_path}") + + +if __name__=="__main__":main() diff --git a/tools/test_world_parity.py b/tools/test_world_parity.py new file mode 100644 index 000000000..9f4bb5d52 --- /dev/null +++ b/tools/test_world_parity.py @@ -0,0 +1,112 @@ +#!/usr/bin/env python3 +"""Exercise Rust NBT, palette, registry and region I/O with pinned vanilla bytecode.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import tempfile + +try: + from . import lab, test_rust_parity +except ImportError: + import lab + import test_rust_parity + + +def run(command, log=None): + result = subprocess.run(list(map(str, command)), cwd=lab.ROOT, capture_output=True, text=True, timeout=300) + if log: + log.write_text(result.stdout + result.stderr, encoding="utf-8") + if result.returncode: + raise RuntimeError(f"Command failed ({result.returncode}): {command[0]}\n{result.stdout[-3000:]}\n{result.stderr[-3000:]}") + return result.stdout + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--prepare", action="store_true") + args = parser.parse_args() + directory = lab.LOCAL / "rust-world-parity" + directory.mkdir(parents=True, exist_ok=True) + report_path = directory / "report.json" + report_path.unlink(missing_ok=True) + if args.prepare: + lab.prepare() + lock, jars, libraries = test_rust_parity.verify_artifacts() + base = Path(tempfile.mkdtemp(prefix="run-", dir=directory)) + classes = base / "classes" + classes.mkdir() + oracle = lab.ROOT / "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaWorldOracle.java" + sources = [oracle, Path(__file__).resolve(), lab.ROOT / "tools/test_rust_parity.py", lab.ROOT / "Cargo.toml", lab.ROOT / "Cargo.lock", lab.ROOT / "crates/horizon-world/Cargo.toml", + *sorted((lab.ROOT / "crates/horizon-world").rglob("*.rs")), *sorted((lab.ROOT / "crates/horizon-core/src").rglob("*.rs"))] + tested_sources = test_rust_parity.source_hashes(sources) + dependency_path = os.pathsep.join(map(str, libraries)) + run(["javac", "--release", "25", "-proc:none", "-cp", os.pathsep.join([str(jars["server"]), dependency_path]), "-d", classes, oracle], base / "compile-java.log") + + def java(side, mode): + return run(["java", "-Xmx1G", "-cp", os.pathsep.join([str(classes), str(jars[side]), dependency_path]), + "dev.horizonlab.parity.VanillaWorldOracle", mode, base], base / f"{side}-{mode}.log") + + print("Generating vanilla world-data fixtures...", flush=True) + print(java("server", "generate").split("HORIZON_WORLD_GENERATED")[-1].strip(), flush=True) + run(["cargo", "build", "--release", "-p", "horizon-world", "--bin", "horizon-world", "--example", "world_fixture"], base / "compile-rust.log") + metadata = json.loads(run(["cargo", "metadata", "--no-deps", "--format-version", "1"])) + target = Path(metadata["target_directory"]) / "release" + suffix = ".exe" if os.name == "nt" else "" + binary = target / ("horizon-world" + suffix) + run([target / "examples" / ("world_fixture" + suffix), base], base / "rust-fixture.log") + for network in [False, True]: + kind = "network" if network else "nbt" + output = base / "rust" / kind + output.mkdir(parents=True) + for source in range(1, 5): + for destination in range(1, 5): + run([binary, "nbt-network-copy" if network else "nbt-copy", base / kind / f"{source}.bin", + output / f"{source}-{destination}.bin", source, destination]) + for source in range(1, 5): + original = base / "regions" / str(source) / "r.-1.0.mca" + for variant in ["copy", "1", "2", "3", "4"]: + output = base / "rust/regions" / f"{source}-{variant}" / original.name + command = [binary, "copy-region", original, output] + if variant != "copy": + command.append(variant) + run(command) + output = base / "rust/regions" / f"{source}-edited" / original.name + run([binary, "edit-block-data", original, output, -512, -64, 0, "minecraft:stone"]) + actual = run([binary, "get-block", output, -512, -64, 0]).strip() + if actual != "minecraft:stone": + raise AssertionError(f"CLI returned unexpected edited block: {actual}") + # A second export must fail without changing the existing output. + before = lab.digest(output, "sha256") + attempt = subprocess.run([str(binary), "copy-region", str(original), str(output)], capture_output=True, timeout=30) + if attempt.returncode == 0 or lab.digest(output, "sha256") != before: + raise AssertionError("Existing region output was not protected") + references = [] + for side in ["server", "client"]: + print(f"Checking Rust-written world data in vanilla {side}...", flush=True) + output = java(side, "verify") + marker = "HORIZON_WORLD_RESULT " + results = [json.loads(line.split(marker, 1)[1]) for line in output.splitlines() if marker in line] + expected = {"nbt_pairs": 32, "palettes": 44, "palette_values": 123776, + "region_chunks": 48, "registry_states": 35723, "resident_values": 8192} + if len(results) != 1 or any(results[0].get(key) != value for key, value in expected.items()): + raise AssertionError(f"Incomplete world fixture: {results}") + references.append({"side": side, "jar_sha256": lab.digest(jars[side], "sha256"), **results[0]}) + print(json.dumps(references[-1]), flush=True) + test_rust_parity.ensure_sources_unchanged(sources, tested_sources) + report = {"schema": 1, "minecraft": lock["minecraft"]["version"], "data_version": 5023, + "platform": platform.platform(), "java": run(["java", "--version"]).splitlines()[0], + "rustc": run(["rustc", "--version"]).strip(), "references": references, + "sources_sha256": tested_sources, + "notes": ["Synthetic NBT and region fixtures serialized and verified by pinned vanilla classes.", + "Includes all four region codecs, external oversized chunks, UTF-16 edge cases, mixed lists, palette mutation, and the full exported block-state ID registry.", + "Storage-only edits; no world generation, simulation, lighting, live multiplayer, renderer, FPS or whole-game parity claim."]} + lab.write_json(report_path, report) + lab.write_json(base / "report.json", report) + print(f"World-data interoperability passed: {report_path}") + + +if __name__ == "__main__": + main() diff --git a/tools/test_worldgen_parity.py b/tools/test_worldgen_parity.py new file mode 100644 index 000000000..134a9cec8 --- /dev/null +++ b/tools/test_worldgen_parity.py @@ -0,0 +1,394 @@ +#!/usr/bin/env python3 +"""Compare world-generation JSON decoding with the pinned vanilla codecs.""" +import argparse +import hashlib +import json +import os +from pathlib import Path +from collections import Counter +import platform +import random +import subprocess +import zipfile + +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(resources): + rng = random.Random(0x484f52495a4f4e4a534f4e) + seeds = [0,1,-1,-2**63,2**63-1,0x123456789abcdef] + for text in resources.values(): + compact = " ".join(text.splitlines()) + for seed in seeds: + for legacy,nether in [(0,0),(1,0),(0,1),(1,1)]: + yield f"noise {seed} {legacy} {nether} {compact}" + fields = { + "base_octave": ["-33","-32","0","32","33","4294967295","4294967296","-4294967297.9","1.9999999999999999999","12e1","123e-1","-123e-3","123e99","null","true",'"-7"'], + "octave_count": ["0","1","32","33","-1","null","false","1.9999999999999999999","4294967297"], + "base_amplitude": ["0","0.000009999999747378751","0.000009999999747378752","1","1000000","1000000.0000000001","null","true"], + "normalize": ["true","false",'"legacy"',"0","1","0.5","4294967296","null",'"true"','"LEGACY"',"{}"], + "amplitude_modifiers": ["[]","[0]","[-0]","[-0.0]","[1]","[1000000]","[1000001]","[-1]","[null]","null","[1,2]","{}"], + } + for name,values in fields.items(): + for value in values: + text = '{"base_octave":-7,"'+name+'":'+value+'}' if name != "base_octave" else '{"base_octave":'+value+'}' + yield f"noise 0 0 0 {text}" + for text in ['{}','[]','null','42','true','{"base_octave":-7,"unknown":{}}','{"base_octave":-7,"base_octave":-8}']: + yield f"noise 0 0 0 {text}" + for scenario in range(512): + count = 1 + scenario % 8 + parameters = {"base_octave":rng.randrange(-16,1),"octave_count":count} + if scenario % 3: + parameters["base_amplitude"] = rng.choice([.00001,.125,1.,1e6,rng.uniform(.00001,1e6)]) + if scenario % 4: + parameters["normalize"] = [True,False,"legacy"][scenario % 3] + if scenario % 5: + parameters["amplitude_modifiers"] = [rng.choice([0.,.125,1.,1e6,rng.uniform(0,1e6)]) for _ in range(count)] + yield f"noise {rng.randrange(-2**63,2**63)} {(scenario//2)%2} {scenario%2} "+json.dumps(parameters,separators=(",",":")) + + +def registry_resources(jar, kind): + prefix = f"data/minecraft/worldgen/{kind}/" + with zipfile.ZipFile(jar) as archive: + return {name:archive.read(name).decode("utf-8") for name in sorted(archive.namelist()) if name.startswith(prefix) and name.endswith(".json")} + + +def tag_resources(jar): + prefix="data/minecraft/tags/block/" + with zipfile.ZipFile(jar) as archive: + return {"minecraft:"+name[len(prefix):-5]:archive.read(name).decode("utf-8") for name in sorted(archive.namelist()) if name.startswith(prefix) and name.endswith(".json")} + + +def tag_corpus(resources): + entry_values=['"stone"','"#leaves"','""','"#"','":stone"','"minecraft:"','"Minecraft:stone"','"STONE"','"a:b:c"','"a/b:stone"','"#minecraft:leaves"','"##leaves"','42','true','null','[]','{}','{"id":"stone"}','{"id":"#leaves","required":false}','{"id":"stone","required":null}','{"id":null}','{"required":true}'] + for value in entry_values:yield "tag_entry "+value + for required in ['true','false','null','0','1','0.5','4294967296','"true"','{}','[]']: + yield 'tag_entry {"id":"stone","required":'+required+'}' + for text in resources.values():yield "tag_file "+" ".join(text.splitlines()) + for value in entry_values:yield 'tag_file {"values":['+value+']}' + for value in ['true','false','null','0','1','"false"','{}']: + yield 'tag_file {"values":[],"replace":'+value+'}' + for text in ['{}','[]','null','{"values":null}','{"values":true}','{"values":[],"replace":true,"replace":false}']: + yield 'tag_file '+text + def command(files,elements):return "tags "+json.dumps({"files":files,"elements":elements},separators=(",",":")) + def file(name,values,replace=False):return [name,"fixture",json.dumps({"values":values,"replace":replace},separators=(",",":"))] + elements={"minecraft:a":"a","minecraft:b":"b","minecraft:c":"c","minecraft:alias":"a"} + yield command([file("first",["b","a","b","alias"]),file("second",["#first","c","a"])],elements) + yield command([file("a",["a","b"]),file("a",["c"],True),file("a",["a"]),file("empty",[])],elements) + yield command([["a","broken","{}"],file("a",["a"]),["a","broken","{\"replace\":true,\"values\":[true]}"],["empty","broken","null"]],elements) + yield command([file("a",["missing","a"]),file("b",["#a","b"]),file("c",[{"id":"#a","required":False},"c"])],elements) + for mandatory in [True,False]: + yield command([file("a",[{"id":"#b","required":mandatory},"a"]),file("b",[{"id":"#a","required":mandatory},"b"])],elements) + # Required dependencies are processed globally before optional ones. + yield command([file("a",[{"id":"#b","required":False},"a"]),file("b",["#a","b"])],elements) + # Canonicalize unordered missing-tag output by full string, not Identifier's + # path-first comparator; lookup/dependency iteration remains observable. + yield command([file("z:first",["missing"]),file("a:last",["#z:first"]),file("example:child",[{"id":"#z:first","required":False},"a"])],elements) + rng=random.Random(0x484f52495a4f4e54414753) + for scenario in range(192): + count=1+scenario%48;files=[] + for i in range(count): + values=[] + for j in range(rng.randrange(9)): + if i and j%3==0: + # Later dependency names make arbitrary cycles possible. + child=rng.randrange(count) if scenario%4==0 else rng.randrange(i) + if child==i:child=(child+1)%count + values.append({"id":f"#tag_{child}","required":j%2==0}) + else:values.append({"id":rng.choice(["a","b","c","alias","missing"]),"required":j%3!=0}) + files.append(file(f"tag_{i}",values)) + if i%11==0:files.append(file(f"tag_{i}",["c"],scenario%3==0)) + yield command(files,elements) + + +def noise_resources(jar): + return registry_resources(jar,"noise") + + +def climate_corpus(): + rng = random.Random(0x484f52495a4f4e434c494d) + edges = [0,0x80000000,1,0x80000001,0x007fffff,0x00800000, + 0x3f800000,0xbf800000,0x38d1b717,0xb8d1b717, + 0x58612e12,0xd8612e12,0x7f7fffff,0xff7fffff, + 0x7f800000,0xff800000,0x7f800001,0xff800001,0x7fc00000,0xffc00000] + longs = [0,1,-1,-2**63,2**63-1,-10000,10000,16777217,-16777217] + for scenario in range(len(edges)+4096): + values = [edges[(scenario+i)%len(edges)] for i in range(6)] if scenario < len(edges) else [rng.getrandbits(32) for _ in range(6)] + value = longs[scenario%len(longs)] if scenario < len(edges) else rng.randrange(-2**63,2**63) + yield "quantize "+" ".join(f"{value:08x}" for value in values)+f" {value}" + + +def climate_codec_corpus(): + values = ["-2.0000002","-2","-0.0001","-0","0","0.0001","1","2","2.0000001","2.0000001192092895507812500000000001","2.0000002","1e100","null","true",'"1"',"[]","[0]","[0,0,0]","[-2,2]","[1,-1]","[-0,0]","[0,-0]",'{"min":-2,"max":2}','{"min":0}', '{"min":0,"max":0,"ignored":1}'] + for value in values: + yield "climate_parameter "+value + fields = ["temperature","humidity","continentalness","erosion","depth","weirdness","offset"] + for field in fields: + for value in values: + yield "climate_point {"+",".join('"'+name+'":'+(value if field == name else "0") for name in fields)+"}" + yield "climate_point {"+",".join('"'+name+'":0' for name in fields if field != name)+"}" + yield 'climate_point {"temperature":0,"humidity":0,"continentalness":0,"erosion":0,"depth":0,"weirdness":0,"offset":0,"offset":1}' + + +def settings_corpus(resources): + for text in resources.values(): + # The noise member contains integers in bundled resources. Keep all + # synthetic numeric tokens below raw for Gson integer conversion cases. + yield "noise_settings "+json.dumps(json.loads(text)["noise"],separators=(",",":")) + minima = [-2**31,-2033,-2032,-2031,-65,-64,-16,-1,0,1,16,2031,2032,2**31-1] + heights = [-2**31,-16,-1,0,1,15,16,128,384,4063,4064,4065,2**31-1] + for minimum in minima: + for height in heights: + yield f'noise_settings {{"min_y":{minimum},"height":{height}}}' + yield f"settings_create {minimum} {height}" + for field in ["min_y","height"]: + for value in ["null","true",'"16"',"4294967296","4294967312","-4294967312.999999999999","15.9999999999999999999","16.9999999999999999999","16e0","16e-1","16e99"]: + yield 'noise_settings {"'+field+'":'+value+','+('"height":16' if field == "min_y" else '"min_y":0')+'}' + for text in ['{}','[]','null','{"min_y":0}','{"height":0}','{"min_y":0,"height":16,"height":32,"ignored":0}']: + yield "noise_settings "+text + + +def aquifer_corpus(): + rng = random.Random(0x484f52495a4f4e464c554944) + bits = [0,0x8000000000000000,1,0x8000000000000001,0x3ff0000000000000,0xbff0000000000000,0x7fefffffffffffff,0xffefffffffffffff,0x7ff0000000000000,0xfff0000000000000,0x7ff0000000000001,0xfff8000000000000] + for sea in [-2**31,-64,-54,0,63,2**31-1]: + for fluid in range(5): + for y in [-2**31,-4065,-4064,-65,-64,-55,-54,-53,-1,0,62,63,64,2**31-1]: + for value in bits: + yield f"aquifer {sea} {fluid} 0 {y} 0 {value:016x}" + for _ in range(4096): + sea,x,y,z = [rng.randrange(-2**31,2**31) for _ in range(4)] + yield f"aquifer {sea} {rng.randrange(5)} {x} {y} {z} {rng.getrandbits(64):016x}" + + +def noise_aquifer_corpus(bundle, resources): + """Stateful original transport, with vanilla samplers and fault injection.""" + rng = random.Random(0x484f52495a4f4e41515549) + density_bits = ["0000000000000000","8000000000000000","bff0000000000000","bfb999999999999a","0000000000000001","8000000000000001","7ff0000000000000","fff0000000000000","7ff0000000000001","fff8000000000000"] + def emit(seed, legacy, setting, fixture): + return f"noise_aquifer {seed} {legacy} {bundle} {setting} "+json.dumps(fixture,separators=(",",":")) + def fixture(minimum, sizes=(16,128,16), steps=(1,1,1), count=128): + queries=[] + for i in range(count): + # Exercise strided volume extents, not just density lattice samples. + p=[minimum[a]+rng.randrange(sizes[a]*steps[a]) for a in range(3)] + queries.append([*p,density_bits[i%len(density_bits)]]) + queries += queries[:16] + list(reversed(queries[:16])) + return {"sizes":sizes,"minimum":minimum,"steps":steps,"sea":63,"fluid":0,"queries":queries} + for setting in sorted(resources): + for seed in [0,1,-1,-2**63,2**63-1,0x123456789abcdef]: + for legacy in [0,1]: + f=fixture([-16,-64,32]) + yield emit(seed,legacy,setting,f) + def gradient(axis, low, high, start, end): + return {"type":"gradient","axis":axis,"from_coordinate":low,"to_coordinate":high,"from_value":start,"to_value":end} + base={"barrier":0,"fluid_level_floodedness":gradient("x",-96,96,-1,1),"fluid_level_spread":gradient("y",-4,4,-1,1),"lava":gradient("z",-4,4,-1,1),"exclusion":0,"surface_level":96} + origins=[[0,-64,0],[-16,-80,32],[33554416,-64,-33554432],[2147483600,-64,-2147483600]] + float_bits=["00000000","80000000","00000001","80000001","3f800000","bf800000","3f19999a","3f4ccccd","7f800000","ff800000","7fc00000","7f800001","7f7fffff","ff7fffff"] + for scenario in range(160): + f=fixture(origins[scenario%len(origins)],count=192) + config=dict(base) + if scenario%5==0: config["fluid_level_floodedness"]=[-1,0,.4,.6,.8,1][scenario%6] + if scenario%7==0: config["surface_level"]=[-96,-64,-20,0,64,96,256][scenario%7] + if scenario%9==0: config["exclusion"]=1 + f["config"]=json.dumps(config,separators=(",",":")) + f["sea"]=[-2**31,-64,-54,-10,0,63,2**31-1][scenario%7] + f["fluid"]=scenario%8 + if scenario%3==0: + f["overrides"]=[None]*6 + f["overrides"][(scenario//3)%6]=float_bits[(scenario//3)%len(float_bits)] + if scenario%11==0: + f["steps"]=[4,2,4]; f["sizes"]=[4,64,4] + if scenario%13==0: + # Preserve the scheduling flag after a failed array access. + f["queries"] += [[f["minimum"][0]+512,0,f["minimum"][2],"bff0000000000000"]] + yield emit(rng.randrange(-2**63,2**63),scenario%2,"minecraft:overworld",f) + for field in range(6): + for value in float_bits: + f=fixture([0,-54,0],sizes=(16,64,16),count=128) + config=dict(base);config["fluid_level_floodedness"]=.6 + config["fluid_level_spread"]=gradient("x",-4,4,-1,1) + f["config"]=json.dumps(config,separators=(",",":")) + f["overrides"]=[None]*6;f["overrides"][field]=value + yield emit(0,field%2,"minecraft:overworld",f) + # Fail once at each binding's first/second evaluation, then retry the same + # ordered queries. This also exercises constructor surface-volume failure. + for field in range(6): + for occurrence in [1,2,8]: + f=fixture([0,-54,0],sizes=(16,64,16),count=0) + config=dict(base);config["fluid_level_floodedness"]=.6 + config["fluid_level_spread"]=gradient("x",-4,4,-1,1) + f["config"]=json.dumps(config,separators=(",",":"));f["fail"]=[field,occurrence] + f["queries"]=[[x,y,z,"bfb999999999999a"] for x in range(16) for y in [-40,-30,-20,-10,0] for z in [0,7,15]] + if field==0: + f["sizes"]=[32,96,32] + f["queries"]=[[x,y,z,"bfb999999999999a"] for x in range(32) for y in [-40,-30,-20,-10,0,10,20,30] for z in range(0,32,3)] + f["queries"] += f["queries"][:64] + yield emit(0,field%2,"minecraft:overworld",f) + # Required-field codecs and malformed roots are validated before binding. + configs=["null","[]","{}"] + for field in base: + for value in [None,True,{},"minecraft:missing"]: + config=dict(base);config[field]=value;configs.append(json.dumps(config,separators=(",",":"))) + config=dict(base);del config[field];configs.append(json.dumps(config,separators=(",",":"))) + for config in configs: + f=fixture([0,-64,0],count=0);f["config"]=config + yield emit(0,0,"minecraft:overworld",f) + + +def index_corpus(): + rng = random.Random(0x484f52495a4f4e54524545) + def command(branching, entries, targets): + return f"index {branching} "+json.dumps({"entries":entries,"targets":targets},separators=(",",":")) + def entry(coordinates, offset=0): + return {"coordinates":coordinates,"offset":offset} + # Warm ties deliberately differ from a fresh index and brute list order. + ties = [entry([[x,x]]+[[0,0]]*5) for x in [-10,10]] + yield command(19,ties,[[x]+[0]*5 for x in [10,0,-10,0,10,0]]) + for branching in [2,19,32]: + yield command(branching,[entry([[0,0]]*6) for _ in range(40)],[[0]*6,[1]*6,[0]*6]) + yield command(19,[],[[0]*6]) + for branching in range(2,33): + counts = sorted({1,branching-1,branching,branching+1,branching**2-1,branching**2,branching**2+1}) + for count in counts: + entries = [] + for i in range(count): + coordinates = [] + for _ in range(6): + low = rng.randrange(-20000,20001) + coordinates.append([low,low+rng.randrange(0,4001)]) + if i and i%7 == 0: + entries.append(dict(entries[i-1])) + else: + entries.append(entry(coordinates,rng.randrange(0,10001))) + targets = [[rng.randrange(-30000,30001) for _ in range(6)] for _ in range(32)] + targets += targets[:8] + yield command(branching,entries,targets) + for count in [6858,6859,6860,65536]: + entries = [entry([[0,0]]*6) if count == 65536 else entry([[i%17-8,i%17-8]]*6,i%3) for i in range(count)] + yield command(19,entries,[[x]*6 for x in [-10,0,10,0]]) + extremes = [-2**63,-2**63+1,-2**31,-1,0,1,2**31-1,2**63-2,2**63-1] + for count in [1,2,19,20,362]: + entries = [entry([[rng.choice(extremes),rng.choice(extremes)] for _ in range(6)],rng.choice(extremes)) for _ in range(count)] + yield command(19,entries,[[rng.choice(extremes) for _ in range(6)] for _ in range(128)]) + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--prepare",action="store_true") + args = parser.parse_args() + build = lab.LOCAL/"rust-worldgen-parity" + build.mkdir(parents=True,exist_ok=True) + report_path = build/"report.json" + report_path.unlink(missing_ok=True) + if args.prepare: lab.prepare() + lock,jars,libraries = base.verify_artifacts() + resources = noise_resources(jars["server"]) + if not resources: raise ValueError("pinned noise registry is empty") + if resources != noise_resources(jars["client"]): raise ValueError("client/server noise registry resources differ") + densities = registry_resources(jars["server"],"density_function") + if not densities or densities != registry_resources(jars["client"],"density_function"): + raise ValueError("client/server density registry resources differ or are empty") + settings = registry_resources(jars["server"],"noise_settings") + if not settings or settings != registry_resources(jars["client"],"noise_settings"): + raise ValueError("client/server noise settings resources differ or are empty") + tags = tag_resources(jars["server"]) + if not tags or tags != tag_resources(jars["client"]): + raise ValueError("client/server block tag resources differ or are empty") + def named(resources, kind): + prefix = f"data/minecraft/worldgen/{kind}/" + return {"minecraft:"+name[len(prefix):-5]:text for name,text in resources.items()} + bundle = build/"registries.json" + named_settings = named(settings,"noise_settings") + source = lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaWorldgenOracle.java" + exporter = source.with_name("VanillaBiomeExport.java") + tag_exporter = source.with_name("VanillaTagExport.java") + sources = [source,exporter,tag_exporter,Path(__file__),lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/lab.py", + *sorted((lab.ROOT/"crates/horizon-core").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world").rglob("*.rs")), + lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock"] + tested_sources = base.source_hashes(sources) + classes = build/"classes" + classes.mkdir(exist_ok=True) + dependency_path = os.pathsep.join(map(str,libraries)) + base.run(["javac","--release",str(lock["minecraft"]["java_major"]),"-proc:none","-cp",os.pathsep.join([str(jars["server"]),dependency_path]),"-d",str(classes),str(source),str(exporter),str(tag_exporter)]) + preset_files = {} + preset_tables = None + for side,jar in jars.items(): + exported = build/f"biome-presets-{side}.json" + base.run(["java","-Xmx512M","-cp",os.pathsep.join([str(classes),str(jar),dependency_path]),"dev.horizonlab.parity.VanillaBiomeExport",str(exported)]) + tables = json.loads(exported.read_text(encoding="utf-8")) + if not tables: raise ValueError("built-in biome parameter tables are empty") + if preset_tables is not None and tables != preset_tables: raise ValueError("client/server built-in biome parameter tables differ") + preset_tables = tables + preset_files[side] = exported + block_elements = None + tag_export_files = {} + for side,jar in jars.items(): + exported = build/f"blocks-{side}.json" + base.run(["java","-Xmx512M","-cp",os.pathsep.join([str(classes),str(jar),dependency_path]),"dev.horizonlab.parity.VanillaTagExport",str(exported)]) + elements = json.loads(exported.read_text(encoding="utf-8")) + if not elements: raise ValueError("block identifiers are empty") + if block_elements is not None and elements != block_elements: raise ValueError("client/server block identifiers differ") + block_elements = elements + tag_export_files[side] = exported + bundle.write_text(json.dumps({"tags":tags,"block_elements":block_elements,"noises":named(resources,"noise"),"densities":named(densities,"density_function"),"settings":named_settings,"presets":preset_tables},separators=(",",":")),encoding="utf-8") + commands = list(corpus(resources)) + commands.extend(climate_corpus()) + commands.extend(index_corpus()) + commands.extend(climate_codec_corpus()) + commands.extend(settings_corpus(settings)) + commands.extend(tag_corpus(tags)) + commands.append(f"tag_registry {bundle}") + commands.extend(aquifer_corpus()) + commands.extend(noise_aquifer_corpus(bundle,named_settings)) + for seed in [0,1,-1,-2**63,2**63-1,0x123456789abcdef]: + for legacy in [0,1]: + for optimized in [0,1]: + commands.append(f"registry {seed} {legacy} {optimized} {bundle}") + for name in named_settings: + commands.append(f"router {seed} {legacy} {optimized} {bundle} {name}") + inputs = build/"inputs.txt" + inputs.write_text("\n".join(commands)+"\n",encoding="utf-8") + fixture_paths = [bundle,inputs,*preset_files.values(),*tag_export_files.values()] + tested_fixtures = base.source_hashes(fixture_paths) + base.run(["cargo","build","--release","--bin","horizon-worldgen-parity"]) + metadata = json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) + binary = Path(metadata["target_directory"])/"release"/("horizon-worldgen-parity.exe" if os.name == "nt" else "horizon-worldgen-parity") + candidate = build/"rust.txt" + with inputs.open("rb") as stdin,candidate.open("wb") as stdout: base.run([str(binary)],stdin=stdin,stdout=stdout) + injected_failures = Counter() + aquifer_outcomes = Counter() + with candidate.open(encoding="utf-8") as stream: + for line in stream: + if line.startswith("sample failure "): injected_failures[line.strip().split()[-1]] += 1 + elif line.startswith("aquifer result "): aquifer_outcomes[line.strip()[len("aquifer result "):]] += 1 + if dict(injected_failures) != {str(field):3 for field in range(6)}: + raise ValueError(f"Aquifer failure corpus did not hit every injected failure: {injected_failures}") + references = [] + for side,jar in jars.items(): + reference = build/f"vanilla-{side}.txt" + base.run(["java","-Xmx512M","-cp",os.pathsep.join([str(classes),str(jar),dependency_path]),"dev.horizonlab.parity.VanillaWorldgenOracle",str(inputs),str(reference)]) + matched = base.compare(reference,candidate) + references.append({"side":side,"jar_sha256":lab.digest(jar,"sha256"),"output_sha256":lab.digest(reference,"sha256"),"matched_output_lines":matched,"biome_export_sha256":lab.digest(preset_files[side],"sha256"),"block_export_sha256":lab.digest(tag_export_files[side],"sha256")}) + print(f"{side}: {matched:,} world-generation codec output lines match Rust",flush=True) + base.ensure_sources_unchanged(sources,tested_sources) + base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report = {"schema":1,"minecraft":lock["minecraft"]["version"],"platform":platform.platform(), + "java":subprocess.check_output(["java","--version"],text=True).splitlines()[0],"rustc":subprocess.check_output(["rustc","--version"],text=True).strip(), + "manifest_sha1":lock["minecraft"]["manifest_sha1"],"commands":len(commands),"command_counts":dict(Counter(line.split()[0] for line in commands)),"noise_aquifer_injected_failures":dict(injected_failures),"noise_aquifer_outcomes":dict(aquifer_outcomes),"block_tag_entries":len(tags),"block_identifier_entries":len(block_elements),"block_tag_resources_sha256":{name:hashlib.sha256(text.encode("utf-8")).hexdigest() for name,text in tags.items()},"noise_registry_entries":len(resources),"density_registry_entries":len(densities),"noise_settings_entries":len(settings),"biome_parameter_entries":{name:len(json.loads(text)) for name,text in preset_tables.items()}, + "biome_tables_sha256":{name:hashlib.sha256(text.encode("utf-8")).hexdigest() for name,text in preset_tables.items()},"fixtures_sha256":tested_fixtures, + "noise_resources_sha256":{name:hashlib.sha256(text.encode("utf-8")).hexdigest() for name,text in resources.items()}, + "density_resources_sha256":{name:hashlib.sha256(text.encode("utf-8")).hexdigest() for name,text in densities.items()}, + "noise_settings_resources_sha256":{name:hashlib.sha256(text.encode("utf-8")).hexdigest() for name,text in settings.items()}, + "inputs_sha256":lab.digest(inputs,"sha256"),"rust_output_sha256":lab.digest(candidate,"sha256"),"sources_sha256":tested_sources,"references":references, + "scope":"Direct normal-noise JSON decoding using the actual pinned vanilla CODEC. Every bundled noise registry resource, explicit/default parameters, empty and full amplitude modifiers, normalization modes, inclusive field bounds with signed-zero comparator ordering, malformed types, null fields, duplicate and ignored keys, decimal/exponent integer truncation and wrapping, signed zero, seeded modern/legacy and Nether construction, octave metadata, range and normalization bits, scalar noise values and parent random state. JSON resource contents stay private. Strict JSON parsing; no claim for Gson's permissive non-JSON syntax. Bundled density registries are also decoded with actual vanilla registry-aware CODECs: named forward references, all bundled function kinds, declared range/axes, raw compilation errors, seeded optimized roots, cache allocation, scalar values, strided bulk values, repeated cache hits and surface-volume errors are compared using RandomState's actual compile context. All seven bundled noise-setting resources contribute their actual eight-field NoiseRouter.CODEC objects to RandomState. Router fields are compiled in declaration order with a shared compiler/context; cache allocation, raw/optimized scalar and repeated strided volume values, successful single-layer surface volumes and invalid surface-volume shapes are compared. Actual RandomState climate sampler binding and quart-to-block coordinate wrapping are checked at ordinary and extreme positions. Float-to-long climate quantization and long-to-float conversion include subnormals, signed zeros, NaNs, infinities, cast saturation and seeded random bit patterns. Actual vanilla Climate.Parameter and ParameterPoint JSON codecs compare scalar, two-element list and min/max object intervals, float endpoint bounds/ordering, required coordinate/offset fields, negative zero, precision-sensitive float parsing, malformed types and duplicate keys. Climate parameter distances, wrapping squared fitness, stable search-tree leaf order and nearest lookup are compared across every supported branching value 2..32, sizes around branch powers, the 65536-entry API bound, duplicates, warm ties, fresh lookups, brute-force lookup and extreme signed-long endpoints/targets. The Rust tree is immutable with per-worker search state instead of hidden thread locals; invalid or degenerate searches return typed errors. Inline arbitrary distance metrics and behavior outside the bounded API are not covered. Built-in Overworld and Nether quantized biome parameter tables are exported independently by each authenticated JAR and required to agree before Rust consumes them. The Rust multi-noise resolver and actual vanilla MultiNoiseBiomeSource compare biome identities through scalar climate queries and prepared bulk quart volumes, including forward/reverse/repeated query order, wrapped extreme origins and shared previous-result state. Biome holder keys in the reference are registration placeholders; no biome property or gameplay behavior is evaluated. The Rust loader reads a Horizon quantized table format, not the vanilla biome codec, and the preset builders themselves have not been ported. Source and private fixture mutations during validation invalidate the report. The two-field 26.3 NoiseSettings codec, create helper and LevelHeightAccessor clamping are also compared across bundled noise members, dimension/alignment bounds, zero/negative runtime heights, disjoint ranges, wrapped integer arithmetic and decimal/exponent integer conversion. Global fluid cutoff selection and the actual disabled Aquifer implementation are compared with original default block-state identities, extreme sea levels/coordinates, signed-zero/subnormal/nonfinite density and counted picker calls; developer fluid-disable behavior is outside the regular-mode corpus. The actual noise-based Aquifer.Config codec and runtime are compared across bundled aquifer settings, modern/legacy world-seeded aquifer factories, synthetic density roots, nondefault water/lava states, cave/void air, nonfinite sampler overrides, strided volume extents, wrapped coordinates, repeated and reversed queries, counted picker calls, sampler call order/values, injected failures and retry state, scheduling flags, populated location/status caches and sorted surface-cache entries. Oversized or wrapped-invalid grid allocations and developer fluid-disable behavior are outside the bounded regular-mode API. Terrain filling is not yet validated. Router, vertical noise and optional aquifer members are decoded from each noise-setting resource; complete NoiseGeneratorSettings, material rules, nonempty world fields, biome registry/codecs and complete chunk biome assignment, generated chunks, gameplay and rendering remain pending. TagEntry and TagFile codecs, ordered resource-stack replacement, first-occurrence member deduplication, required/optional dependency cycle pruning, lookup order and flags, missing-reference partial results and all bundled block tag members are also compared with actual vanilla TagLoader. Block identifier tables are exported independently by authenticated client/server JARs and required to agree. The bounded tag API supports at most 8192 tags, dependency depth 256 and Java hash buckets without tree nodes; hash-tree ordering and pathological self-cycle failures remain pending. No heightmap or complete terrain integration follows from tag resolution. Inline noise holders and general codec behavior beyond the covered fixtures remain pending."} + lab.write_json(report_path,report) + print(f"Scoped world-generation codec parity passed: {report_path}") + + +if __name__ == "__main__": + main() diff --git a/tools/test_worldgen_random_parity.py b/tools/test_worldgen_random_parity.py new file mode 100644 index 000000000..e0ba5942b --- /dev/null +++ b/tools/test_worldgen_random_parity.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python3 +"""Compare the native world-generation random adapter, counters, forks and seeds.""" +import argparse +import itertools +import json +import os +from pathlib import Path +import platform +import random +import subprocess +import zipfile +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + rng=random.Random(78336) + integers=[-2147483648,-10001,-1,0,1,16,214748,214749,2147483647] + longs=[-9223372036854775808,-1,0,1,9223372036854775807]+[rng.randrange(-2**63,2**63) for _ in range(20)] + sample=[['int'],['long'],['bool'],['float'],['double']] + for legacy in [False,True]: + for layers in [1,2,3]: + for warmup in [0,7]: + for seed in longs: + ops=[] + for bits in [-2147483648,-65,-64,-33,-1,0,1,24,26,27,31,32,33,48,63,64,65,2147483647]:ops.append(['bits',bits]) + ops+=sample + for bound in [-2147483648,-1,0,1,2,3,7,16,1073741825,2147483647]:ops += [['bound',bound],*sample] + for x,z in zip(integers,reversed(integers)): + ops += [['decoration',seed,x,z],*sample,['feature',seed,z,x],*sample,['large',seed,x,z],*sample,['salt',seed,x,z,x],*sample,['slime',x,z,seed,seed^0x123456789abcdef]] + for operation in [['fork'],['pos',-2147483648,2147483647,-1],['pos_seed',seed],['pos_hash',[0,65,0xd800,0xdfff,0x20ac]]]: + ops += [['root'],operation,*sample,['fork'],*sample,['seed',seed],['consume',17],*sample] + ops += [['root'],['consume',-1],['consume',0],['consume',129],*sample] + yield {'legacy':legacy,'layers':layers,'warmup':warmup,'seed':seed,'ops':ops} + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-worldgen-random-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaWorldgenRandomOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/worldgen_random_fixture.rs'] + tested_sources=base.source_hashes(sources) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(f,separators=(',',':'))+'\n' for f in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + run(['cargo','build','--release','-p','horizon-world','--example','worldgen_random_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('worldgen_random_fixture.exe' if os.name=='nt' else 'worldgen_random_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jar),dependency_path]),'dev.horizonlab.parity.VanillaWorldgenRandomOracle',side,build],side) + reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} worldgen-random output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'random_modes':2,'wrapper_depths':[1,2,3],'operations':sum(len(f['ops']) for f in fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual WorldgenRandom bit sampling over legacy and xoroshiro sources, nested wrappers, signed bit-width shifts, draw counters, valid/invalid bounds, reseeding, fork and positional-factory delegation. Decoration, per-feature, large-feature, salt and slime-chunk seeds exercise signed int/long overflow, extreme coordinates and inherited legacy multi-draw behavior. Gaussian samples, concurrent access and full chunk decoration remain pending.'} + lab.write_json(report_path,report);print(f'Scoped worldgen-random parity passed: {report_path}') + + +if __name__=='__main__':main() From c6f204f3d572149c7ac2b93fd067e9ded5602b71 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 11:28:57 +0200 Subject: [PATCH 002/253] Verify survival rules for all pinned Java block states Archive both-JAR matches for all 51 survival families, 1,286 block definitions and 35,723 states across 9,229,463 fixtures. Preserve the scope boundary: placement, updates and complete gameplay remain unfinished. --- .../scoped-parity.json | 52 ++++++++++--------- docs/collision-geometry.md | 21 ++++---- 2 files changed, 39 insertions(+), 34 deletions(-) diff --git a/benchmarks/rust-block-survival-2026-10-06/scoped-parity.json b/benchmarks/rust-block-survival-2026-10-06/scoped-parity.json index c7fe41a50..5e6e99074 100644 --- a/benchmarks/rust-block-survival-2026-10-06/scoped-parity.json +++ b/benchmarks/rust-block-survival-2026-10-06/scoped-parity.json @@ -5,21 +5,21 @@ "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", "java": "openjdk 25.0.4.1 2026-08-18", "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", - "supported_blocks": 1274, - "supported_states": 34758, - "survival_rules": 54, - "survival_rule_kinds": 42, + "supported_blocks": 1286, + "supported_states": 35723, + "survival_rules": 63, + "survival_rule_kinds": 51, "fluid_tag_files": 10, - "fixtures": 4501019, + "fixtures": 9229463, "sources_sha256": { - "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSurvivalOracle.java": "dcbaacd909f0ae33d20957e21306dc1e060f428ea5bff2bd2f3833ce8f131b6f", - "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java": "82e5cadbcdcba5b4577c56c5a033262b066ccc4cc4a14c7c48ce46c4c6247a03", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSurvivalOracle.java": "4e7cc151617c1b02e872f9ca3e9fe4632379f225f4f07718ff6492df4ee551e7", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java": "99a396b9b983f6ca9149133251f3ece9aaf76d3d16dafa1f322378212a19490c", "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSupportOracle.java": "04350901a2d708fb8fa672de61d058f73f332d2e90df1b93a67781862f89c1ad", "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", - "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "02acfbae94aee306c5a4e1db7c86c68f7d6156ddd3dd477dc9e9d06e5ca98118", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "60ff9ef7c1d5e23c080f9aec95ab2e7d3b7c5b5bcd67b9efa9518776c400629a", "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", - "tools/test_block_survival_parity.py": "5ebed710b5674e535a6cbb616878824efe89c53bca53e114c3d2ec9e7da619c1", + "tools/test_block_survival_parity.py": "9e8dff3bd4b95dbfd29f8adc6a2f6d66abf19a6b1cd91423b794a345d4ec244a", "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", @@ -83,17 +83,18 @@ "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", - "crates/horizon-world/src/block_properties.rs": "e74b368012d4d440dcdbd4d9bcaf80495220b90557f0e0c733b0aa21ad03c53c", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_properties.rs": "b3caf26bd3afc9d10cdcca3f7e794c30abf5ba09afa1fe80ba8f44713acdb274", "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", - "crates/horizon-world/src/block_survival.rs": "b0fccfd7b44976b3cf27316da1ce0b202d5aa6a5574e821c36e79952d23026a2", + "crates/horizon-world/src/block_survival.rs": "2c882aeb095c27a8edfda1e934ac829102e4be136d53fd83110132150b7293b1", "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", - "crates/horizon-world/src/dynamic_support.rs": "1bf4ad95fcdf7f2df4e33dde38e08959d9b76a6260838c13e97c2bb59e006294", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", "crates/horizon-world/src/fluid.rs": "8a2834a9347ee2c2db7cf1c86a064907ec06e9ac16ba9cc3936e315fc4ad49ca", "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", - "crates/horizon-world/src/lib.rs": "69cdc611b7a7e20a7da705fcc25de6b97cdb64cf63f954be49d0a11f9a820465", + "crates/horizon-world/src/lib.rs": "09f697d8d4e709acacc8e9f7c35c5fd307bab6ab0df4a1339fe760afc655cdab", "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", @@ -112,7 +113,7 @@ "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", - "crates/horizon-world/src/worldgen/block_feature.rs": "6be7c0161cecf1362c196e91ecbeb166e16c8da3731d988ce8f2308f06209265", + "crates/horizon-world/src/worldgen/block_feature.rs": "82a424d3b20837dc401005f5fe038616659eb17b5bbd78d0c8c29f8bdeb1104a", "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", @@ -151,42 +152,43 @@ "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "fa0616353f07460975ab323357ab280b7f35e7bfe2de6edc08d304316766ed26", "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", - "crates/horizon-world/src/worldgen/state_provider.rs": "89cb0410899608545aa1ba3b1b4c1babf533fb25efd341feab1c87661f44f7b9", + "crates/horizon-world/src/worldgen/state_provider.rs": "9cc353d474184f4db880c4305137ec6e35a564a983f602c76af39349ecb58541", "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", "crates/horizon-world/src/worldgen.rs": "821981c893fc84312351503f2be0c06c681d8bc768dade14576697cf047a9f8f", - "crates/horizon-world/examples/block_survival_fixture.rs": "a3b53925164b72be53d0d8137c1ee5bb07276cd64be8b20f4cd6dbe2ec4377bd" + "crates/horizon-world/examples/block_survival_fixture.rs": "423254da2830e09eae2682784479ff15ac4617002aa21a1c405ecaa848723bff" }, "fixtures_sha256": { - ".local/rust-block-survival-parity/inputs.txt": "bed87f9edbe95e9b0c019e1a544bac7c563a10beda8a2a5283b26b0b39e53161", + ".local/rust-block-survival-parity/inputs.txt": "2608b945a6aec113a8816f2e097e5ba939a912d2c8cba1569d53e90dde93c0c1", + ".local/rust-block-survival-parity/survival-extra-definitions.json": "170f2db5bc97a49fa25cc249540aa7f04beea455cdbaf43742ed9415f5090a02", ".local/rust-block-survival-parity/fluid-tags.json": "f1e5eb6d22ea7effbb118a2282709cfdeef1bfae4516b775a55ad7a4df29d7d0", ".local/rust-block-survival-parity/survival-placement-classes.json": "7fdbf48ab18c87098bbe1b6176cb81f4842b6c5d9a4d6bbaf7037ff61cb1848c", ".local/rust-block-survival-parity/survival-support-tags.json": "15d88d5bb5ad10d65124d5abb2cc055d251b06d129bca7be06f55b43dc13f6fd", ".local/rust-block-survival-parity/facts.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", ".local/rust-block-survival-parity/survival-classes.json": "361832008eea0aa9151d367a125a19c6353d99a0b88b27dd0682f55b7954553e", - ".local/rust-block-survival-parity/survival-rules.json": "4360a5430f28eea27c40491352a0400ca29247a5f5e870895a665be08c298716", + ".local/rust-block-survival-parity/survival-rules.json": "8805c18b3195bb1eac1f1e5281333df56e2892505f64023e5403c58ce2ec4368", ".local/rust-block-survival-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0", ".local/rust-block-survival-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", ".local/rust-block-survival-parity/cached-collision.nbt": "f3a5c6a5b2d51dad6c52e486e2b9989e79fd55db1a9bda6196db399550b04078", - ".local/rust-block-survival-parity/block-properties.nbt": "699a994c5c0c9f7ee58e35b9c23c4503a5936efe84133643113232f825ae2216", + ".local/rust-block-survival-parity/block-properties.nbt": "1aba22092f70d16b8092014c058ddc210e4aaa77bac32f6ec62e4d0e91d92a99", ".local/rust-block-survival-parity/cached-support.nbt": "b6fdc9471b0b61e904206d3f099f4dc235aad6d723536c210be0cb7c3560d82c" }, - "rust_output_sha256": "1bd97e34be67e70f536602c085d8fddb294f7b983589a1db2ed129ec8fae8e10", + "rust_output_sha256": "ce804d8fddb7d1b4ae82621b062863be7c568967da1a656db61dd714989dfc93", "references": [ { "side": "client", "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", - "output_sha256": "1bd97e34be67e70f536602c085d8fddb294f7b983589a1db2ed129ec8fae8e10", - "matched_output_lines": 14574905 + "output_sha256": "ce804d8fddb7d1b4ae82621b062863be7c568967da1a656db61dd714989dfc93", + "matched_output_lines": 35998488 }, { "side": "server", "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", - "output_sha256": "1bd97e34be67e70f536602c085d8fddb294f7b983589a1db2ed129ec8fae8e10", - "matched_output_lines": 14574905 + "output_sha256": "ce804d8fddb7d1b4ae82621b062863be7c568967da1a656db61dd714989dfc93", + "matched_output_lines": 35998488 } ], - "scope": "Initial block survival rules are assigned from privately inspected native definition classes and executed in Rust against solid/air/tag tests and unified support geometry. Actual native canSurvive evaluates every supported candidate state, each neighbor state against behavior representatives, changing repeated reads, world-coordinate wrapping, absent/closed/open shulker snapshots, brightness thresholds, independent fluid state sequences and block/entity/light/fluid query failures. Unsupported survival families, full block placement/update behavior and full gameplay remain pending." + "scope": "Version-pinned block survival rules are assigned from privately inspected native definition classes and executed in Rust against solid/air/tag tests and unified support geometry. Actual native canSurvive evaluates every supported candidate state, each neighbor state against behavior representatives, changing repeated reads, world-coordinate wrapping, absent/closed/open shulker snapshots, brightness thresholds, independent fluid state sequences and block/entity/light/fluid query failures. All pinned survival families are included; full block placement/update behavior, world/entity lifecycle and full gameplay remain pending." } diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index fa39e7000..090668494 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -242,10 +242,10 @@ all support tests. It compares extension/retraction, source heads, progress boundaries, collision exclusions and query failures. These snapshots do not exercise piston ticks, pushed entities or chunk updates. -The archived block-survival snapshot executes 42 rule kinds with 54 distinct rule/tag +The archived block-survival snapshot executes 51 rule kinds with 63 distinct rule/tag bindings over registry-bound solid flags, air identity, support tags and -FULL/CENTER/RIGID geometry. The verified snapshot covers **1,274 block definitions -and 34,758 states**; unsupported definitions return an explicit error. Candidate +FULL/CENTER/RIGID geometry and empty-context collision. The verified snapshot covers +**all 1,286 pinned block definitions and 35,723 states**. Candidate properties select attachment direction, hanging state, door/plant halves and pale moss carpet's serialized `bottom` property. Pressure plates and cactus flowers preserve repeated neighbor reads. Downward center support applies the @@ -259,7 +259,11 @@ Growing plants preserve head/body identity and kelp support restrictions. Scaffolding recomputes neighbor distance in native order; chorus plants and flowers preserve branching reads and early exits. Piston heads validate base type, facing and extension. Mangrove propagules, speleothems, pitcher crops, bells and shelf -mushrooms use their version-specific attachment rules. +mushrooms use their version-specific attachment rules. Multiface blocks, vines, +hanging moss, snow layers and sea pickles preserve support/collision query order. +Fire uses imported ignition odds and waterlogging; cactus checks horizontal solids +and lava before its support and upper liquid state. Paths recognize fence gates, +and mushrooms preserve the light-override tag and solid-render requirement. Interrupted runs can be resumed with `python3 tools/test_block_survival_parity.py --resume`. The runner verifies source, environment, fixture and compiled-artifact hashes @@ -269,7 +273,7 @@ a parity report is written only after both native comparisons pass. `python3 tools/test_block_survival_parity.py` compares actual native `canSurvive` calls in both pinned JARs. The [block-survival report](../benchmarks/rust-block-survival-2026-10-06/scoped-parity.json) -records **14,574,905 matching output lines per JAR** across **4,501,019 fixtures**. +records **35,998,488 matching output lines per JAR** across **9,229,463 fixtures**. Each supported candidate state is exercised; behavior representatives are tested against every neighbor state, changing repeated reads, integer-coordinate wrapping, absent/closed/open shulker snapshots and injected block/entity query @@ -277,7 +281,6 @@ failures, plus light thresholds, independent fluid sequences and fluid-query failures. Native method ownership and support-tag fields supply private definition metadata; survival results are calculated in Rust. Workspace tests, -Clippy, the prior **145-test Python suite**, and five focused harness tests passed. -This establishes the recorded survival -scope, not full placement, neighbor updates, unsupported plant rules or complete -block gameplay. +Clippy and the **147-test Python suite** passed. This establishes the recorded +survival scope; full placement, neighbor updates, scheduled behavior and complete +block gameplay remain pending. From 772d84c731cedaf95097b660e3aca4336cf2d910 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 11:40:09 +0200 Subject: [PATCH 003/253] Require playable Rust builds for macOS Linux and Windows --- README.md | 2 ++ docs/rust-parity.md | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/README.md b/README.md index bfc5d4022..9f846323b 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ Horizon is a Rust rewrite effort targeting one-to-one vanilla gameplay parity wi **First playable release:** pinned Java performance packs, distant terrain, an original frame/tick recorder, and Mac/client/server starter downloads. The M2 Pro/16 GB Mac is the first testing target. A Rust rewrite or custom renderer has not been completed; no M2 FPS improvement has been measured yet. +The Rust rewrite’s final deliverables include **playable native builds for macOS, Linux and Windows**, with launch instructions and platform gameplay validation. Track implementation and acceptance criteria in [Rust rewrite status](docs/rust-parity.md). + ## Play on your Mac Download **horizon-mac-starter-0.21.0.zip** from [Releases](https://github.com/ludovic111/Horizon/releases), extract it and open `Mac-Start.command`. It verifies and installs official universal Prism Launcher in `~/Applications` if needed, then opens the balanced pack import. Sign into Microsoft **inside Prism yourself**. This project needs no credentials. diff --git a/docs/rust-parity.md b/docs/rust-parity.md index 6ee0a0378..dffe74224 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -16,6 +16,27 @@ nested splines and seeded noise; complete graph coverage, serialized graphs and generated terrain remain absent. The playable Java performance packs remain available during development. +## Completion criteria and playable builds + +The final deliverable is the complete Horizon Rust game with one-to-one parity +with pinned Java Edition 26.3, plus playable builds for **macOS, Linux and +Windows** that the user can download and test. Each platform must include a +packaged native executable, required runtime resources, launch instructions, +artifact checksums, and the tested OS/CPU/GPU configuration. The existing M2 Pro +Mac is the first physical macOS target. + +A platform is complete only after its packaged Rust game is launched and tested: +create/load a world, render terrain, use keyboard/mouse controls, move and interact, +break/place blocks, use inventory/crafting, save, quit and reload. These launch +checks accompany the full gameplay-parity suite; they do not replace it. Record +platform-specific failures and test limits. Compiler success, library comparisons +and the existing Java packs do not establish a playable Rust build. + +Optimize FPS, frame pacing, memory use and render distance using matched scenes, +worlds, settings and hardware after behavior is validated. Package and test each +supported platform before declaring the rewrite complete. Commit and push +verified development checkpoints regularly. + ## Implemented foundation `crates/horizon-core` is a dependency-free Rust library with no unsafe code. From 097638b4f162d7ee22c4c0b1d2551e43a4564e10 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 11:53:58 +0200 Subject: [PATCH 004/253] Verify all pinned survival families through feature predicates --- .../scoped-parity.json | 56 ++++++++++--------- docs/feature-placement.md | 23 ++++---- docs/rust-parity.md | 21 +++---- 3 files changed, 52 insertions(+), 48 deletions(-) diff --git a/benchmarks/rust-state-provider-2026-10-06/scoped-parity.json b/benchmarks/rust-state-provider-2026-10-06/scoped-parity.json index 44f186dd5..11dc44ae2 100644 --- a/benchmarks/rust-state-provider-2026-10-06/scoped-parity.json +++ b/benchmarks/rust-state-provider-2026-10-06/scoped-parity.json @@ -8,12 +8,12 @@ "block_states": 35723, "blocks": 1286, "integer_properties": 146, - "codec_inputs": 299507, + "codec_inputs": 356935, "provider_types": 10, "named_providers": 22, "rule_predicate_types": 16, - "survival_supported_blocks": 1138, - "survival_supported_states": 31171, + "survival_supported_blocks": 1286, + "survival_supported_states": 35723, "support_cached_states": 35524, "support_dynamic_states": 199, "biomes": 67, @@ -21,23 +21,23 @@ "fluid_tag_files": 11, "bundled_provider_definitions": 8, "block_tag_files": 302, - "requested_samples": 39270062, + "requested_samples": 79473574, "sources_sha256": { - "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaStateProviderOracle.java": "33ca3001656490ad4eb66e1e61ded306de4e448210eb7aca6299a068780761a0", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaStateProviderOracle.java": "3dcf6c76e1a0d8f80946ef7773c52343e542977414fe269f46ebd7b77a3340c0", "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMaterialConditionOracle.java": "04a87405fd2a1c79baf4eb3a8895aa66dc96b8f6baffb9b486ef207f8b91b5ee", "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeTemperatureOracle.java": "243bbc525c6aec24674e7f172c5fb4f7b50f9a679d8b9dfba40ea278219a2d28", "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaAnchorOracle.java": "226628d98b89aadbdd374936575d033945e7064a900dbb050c662204dbc7e119", - "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java": "82e5cadbcdcba5b4577c56c5a033262b066ccc4cc4a14c7c48ce46c4c6247a03", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java": "99a396b9b983f6ca9149133251f3ece9aaf76d3d16dafa1f322378212a19490c", "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSupportOracle.java": "04350901a2d708fb8fa672de61d058f73f332d2e90df1b93a67781862f89c1ad", - "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSurvivalOracle.java": "00010bad8feea549c4243787e0d594b467a3227236a38c2e528d4247c7ba1c70", - "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "02acfbae94aee306c5a4e1db7c86c68f7d6156ddd3dd477dc9e9d06e5ca98118", - "tools/test_block_survival_parity.py": "e2f661afbf67a8726c9423d610f8b05b9e348c8140c40efb3aafaca0291efe31", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSurvivalOracle.java": "4e7cc151617c1b02e872f9ca3e9fe4632379f225f4f07718ff6492df4ee551e7", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "60ff9ef7c1d5e23c080f9aec95ab2e7d3b7c5b5bcd67b9efa9518776c400629a", + "tools/test_block_survival_parity.py": "9e8dff3bd4b95dbfd29f8adc6a2f6d66abf19a6b1cd91423b794a345d4ec244a", "tools/test_biome_temperature_parity.py": "68f84d02e7802349e491b8cb66e18d9b08c9e72ab2306b663667259e852cc2b1", "tools/test_material_condition_parity.py": "01c82e1a768d9131f8f7e6d59d01ddb06272074469dbdcd8547f44f0a8fa152d", "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", - "tools/test_state_provider_parity.py": "f52ab05832e9e9acf8aae779c3e199a1cd836592f1a993837edb0757d87b0f55", + "tools/test_state_provider_parity.py": "7e39c1497e9f535998a70bcfbe38852a791e65c9688ce6f92f25547a07d040f6", "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", @@ -101,17 +101,18 @@ "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", - "crates/horizon-world/src/block_properties.rs": "e74b368012d4d440dcdbd4d9bcaf80495220b90557f0e0c733b0aa21ad03c53c", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_properties.rs": "b3caf26bd3afc9d10cdcca3f7e794c30abf5ba09afa1fe80ba8f44713acdb274", "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", - "crates/horizon-world/src/block_survival.rs": "d7e4ba3709fe1fe1b4998d067080bf48ebfc549cdfc883d8d648d13d6fdf4e3f", + "crates/horizon-world/src/block_survival.rs": "2c882aeb095c27a8edfda1e934ac829102e4be136d53fd83110132150b7293b1", "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", - "crates/horizon-world/src/dynamic_support.rs": "1bf4ad95fcdf7f2df4e33dde38e08959d9b76a6260838c13e97c2bb59e006294", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", "crates/horizon-world/src/fluid.rs": "8a2834a9347ee2c2db7cf1c86a064907ec06e9ac16ba9cc3936e315fc4ad49ca", "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", - "crates/horizon-world/src/lib.rs": "69cdc611b7a7e20a7da705fcc25de6b97cdb64cf63f954be49d0a11f9a820465", + "crates/horizon-world/src/lib.rs": "09f697d8d4e709acacc8e9f7c35c5fd307bab6ab0df4a1339fe760afc655cdab", "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", @@ -130,7 +131,7 @@ "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", - "crates/horizon-world/src/worldgen/block_feature.rs": "6be7c0161cecf1362c196e91ecbeb166e16c8da3731d988ce8f2308f06209265", + "crates/horizon-world/src/worldgen/block_feature.rs": "82a424d3b20837dc401005f5fe038616659eb17b5bbd78d0c8c29f8bdeb1104a", "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", @@ -169,21 +170,24 @@ "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "fa0616353f07460975ab323357ab280b7f35e7bfe2de6edc08d304316766ed26", "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", - "crates/horizon-world/src/worldgen/state_provider.rs": "89cb0410899608545aa1ba3b1b4c1babf533fb25efd341feab1c87661f44f7b9", + "crates/horizon-world/src/worldgen/state_provider.rs": "9cc353d474184f4db880c4305137ec6e35a564a983f602c76af39349ecb58541", "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", "crates/horizon-world/src/worldgen.rs": "821981c893fc84312351503f2be0c06c681d8bc768dade14576697cf047a9f8f", - "crates/horizon-world/examples/state_provider_fixture.rs": "ec20f6ee5b3d1f2e69c4c5345fd31ef98ef660fc26b69ac0145e4d8473bca498" + "crates/horizon-world/examples/state_provider_fixture.rs": "76c4648eb1b873b8e30c60da5350bb31794e5c539f8719ed914503538db0347b" }, "fixtures_sha256": { - ".local/rust-state-provider-parity/inputs.txt": "8b4ebd390ba64d0c9af15df6355c1722dffb4485248deb784e141d447cec512d", + ".local/rust-state-provider-parity/inputs.txt": "536f1388bc26c0ceb87cb656934b3600e567ef594b15e818108c8a25a0d900fa", + ".local/rust-state-provider-parity/survival-extra-definitions.json": "170f2db5bc97a49fa25cc249540aa7f04beea455cdbaf43742ed9415f5090a02", + ".local/rust-state-provider-parity/survival-placement-classes.json": "7fdbf48ab18c87098bbe1b6176cb81f4842b6c5d9a4d6bbaf7037ff61cb1848c", + ".local/rust-state-provider-parity/survival-support-tags.json": "15d88d5bb5ad10d65124d5abb2cc055d251b06d129bca7be06f55b43dc13f6fd", ".local/rust-state-provider-parity/survival-classes.json": "361832008eea0aa9151d367a125a19c6353d99a0b88b27dd0682f55b7954553e", - ".local/rust-state-provider-parity/survival-rules.json": "2d82abb640c1235179e195b0234b13f3b74af84741b1b739aa6cec648ab3b3d2", + ".local/rust-state-provider-parity/survival-rules.json": "8805c18b3195bb1eac1f1e5281333df56e2892505f64023e5403c58ce2ec4368", ".local/rust-state-provider-parity/cached-support.nbt": "b6fdc9471b0b61e904206d3f099f4dc235aad6d723536c210be0cb7c3560d82c", ".local/rust-state-provider-parity/support-cached-states.json": "353945a58fe69b352925473f1693f9b14a9ad19f13c15159c4184f2c29258622", - ".local/rust-state-provider-parity/block-properties.nbt": "699a994c5c0c9f7ee58e35b9c23c4503a5936efe84133643113232f825ae2216", + ".local/rust-state-provider-parity/block-properties.nbt": "1aba22092f70d16b8092014c058ddc210e4aaa77bac32f6ec62e4d0e91d92a99", ".local/rust-state-provider-parity/cached-collision.nbt": "f3a5c6a5b2d51dad6c52e486e2b9989e79fd55db1a9bda6196db399550b04078", ".local/rust-state-provider-parity/biomes.json": "9b26dc3b662627dc3bbbf8da209f287882ce79ff4daf8f454b994ddc7510df99", ".local/rust-state-provider-parity/biome_tags.json": "2c0193d998b196c2b909e92f51e8158f5e8773f5387ade5a8b85a85f063ca560", @@ -194,20 +198,20 @@ ".local/rust-state-provider-parity/facts-client.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", ".local/rust-state-provider-parity/facts-server.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b" }, - "rust_output_sha256": "aa089984db4632a9b1e2d1c965fa0429f9d8b034e2ceb200bccbe2a4a5b545c8", + "rust_output_sha256": "fd4afc0b54a8891aabf15f6b52fb47a50f73ebc4fa07200080a42741a905b594", "references": [ { "side": "client", "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", - "output_sha256": "aa089984db4632a9b1e2d1c965fa0429f9d8b034e2ceb200bccbe2a4a5b545c8", - "matched_output_lines": 105340143 + "output_sha256": "fd4afc0b54a8891aabf15f6b52fb47a50f73ebc4fa07200080a42741a905b594", + "matched_output_lines": 257299719 }, { "side": "server", "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", - "output_sha256": "aa089984db4632a9b1e2d1c965fa0429f9d8b034e2ceb200bccbe2a4a5b545c8", - "matched_output_lines": 105340143 + "output_sha256": "fd4afc0b54a8891aabf15f6b52fb47a50f73ebc4fa07200080a42741a905b594", + "matched_output_lines": 257299719 } ], - "scope": "Actual BlockStateProvider DIRECT_CODEC/TYPED_CODEC and simple, weighted, random_block, rotated, copy_properties, randomized_int three noise-based providers and rule_based over the pinned state registry. All states and block defaults, full-state versus typed exclusive decoding, ordered holder sets/tags, duplicates, empty optional results versus world-state fallback, zero/overflow weights, query failures, every state across six fixed rotations, nested random rotations, property copying for every target state against representatives of every compatible property value, integer-property ranges/missing properties, composed transforms and subsequent random consumption. Native property equality families are checked for ambiguity; Rust validates Cartesian state tables and uses compact property strides. Both legacy/xoroshiro streams execute directly and through WorldgenRandom. Noise comparisons include every bundled provider definition, independent legacy seeding, float/double scaling, dual-noise variety selection, threshold draw order and coordinate/codec boundaries. Rule-based comparisons cover true/not/all_of/any_of/inside_world_bounds/height_range/volume_match/matching_block_tag/matching_blocks/matching_fluids/matching_biomes/unobstructed/solid/replaceable/has_sturdy_face/would_survive predicates, ordered optional results, fallbacks, nested rules and world-query failures. Every pinned block-state fluid identity, amount, falling/source flag and own-height bits are derived from descriptors and compared. Fluid-holder sets and all bundled fluid tags are tested against every state. Biome-holder membership and all bundled biome tags are compared across every pinned biome identity, including empty sets, missing names, ordered world queries and short-circuit composition. Unobstructed predicates compare null excluded entities, exact translated unit-shape bounds, ignored-but-validated offsets, true/false world results and failures. Named holder versus direct/typed decoding, nested named providers, missing names, inline ambiguity, ordered resource registration and all bundled named definitions are compared. Solidity and replacement predicates cover every block state, offset wrapping/validation, empty-child fallthrough, composed predicates and query failures using privately imported definition flags and Rust-calculated collision solidity. Has-sturdy-face predicates cover all 35,723 states through unified cached/dynamic support dispatch across six directions, native offset rules, failed state reads, block-entity query failures and ordered optional-child/boolean composition. Block entities are absent in this integration corpus; shulker animation-state shape selection is separately tested and active moving-piston entity collision generation remains pending. Would-survive decodes candidate states and bounded offsets, evaluates all supported candidate states and each rule against every neighbor state, and preserves world read/entity failures and short-circuit/optional-child behavior. Survival support is limited to the rule families explicitly recorded here; unsupported survival families, complete registry loading/reloading, full block placement behavior and full feature generation remain pending." + "scope": "Actual BlockStateProvider DIRECT_CODEC/TYPED_CODEC and simple, weighted, random_block, rotated, copy_properties, randomized_int three noise-based providers and rule_based over the pinned state registry. All states and block defaults, full-state versus typed exclusive decoding, ordered holder sets/tags, duplicates, empty optional results versus world-state fallback, zero/overflow weights, query failures, every state across six fixed rotations, nested random rotations, property copying for every target state against representatives of every compatible property value, integer-property ranges/missing properties, composed transforms and subsequent random consumption. Native property equality families are checked for ambiguity; Rust validates Cartesian state tables and uses compact property strides. Both legacy/xoroshiro streams execute directly and through WorldgenRandom. Noise comparisons include every bundled provider definition, independent legacy seeding, float/double scaling, dual-noise variety selection, threshold draw order and coordinate/codec boundaries. Rule-based comparisons cover true/not/all_of/any_of/inside_world_bounds/height_range/volume_match/matching_block_tag/matching_blocks/matching_fluids/matching_biomes/unobstructed/solid/replaceable/has_sturdy_face/would_survive predicates, ordered optional results, fallbacks, nested rules and world-query failures. Every pinned block-state fluid identity, amount, falling/source flag and own-height bits are derived from descriptors and compared. Fluid-holder sets and all bundled fluid tags are tested against every state. Biome-holder membership and all bundled biome tags are compared across every pinned biome identity, including empty sets, missing names, ordered world queries and short-circuit composition. Unobstructed predicates compare null excluded entities, exact translated unit-shape bounds, ignored-but-validated offsets, true/false world results and failures. Named holder versus direct/typed decoding, nested named providers, missing names, inline ambiguity, ordered resource registration and all bundled named definitions are compared. Solidity and replacement predicates cover every block state, offset wrapping/validation, empty-child fallthrough, composed predicates and query failures using privately imported definition flags and Rust-calculated collision solidity. Has-sturdy-face predicates cover all 35,723 states through unified cached/dynamic support dispatch across six directions, native offset rules, failed state reads, block-entity query failures and ordered optional-child/boolean composition. Block entities are absent in this integration corpus; shulker animation-state shape selection is separately tested and active moving-piston shape generation is tested separately. Would-survive decodes candidate states and bounded offsets, evaluates all supported candidate states and each rule against every neighbor state, and preserves world read/entity failures and short-circuit/optional-child behavior. All pinned survival families are bound through the recorded definition inputs. Complete registry loading/reloading, full block placement behavior and full feature generation remain pending." } diff --git a/docs/feature-placement.md b/docs/feature-placement.md index 2e686c3ad..4be761397 100644 --- a/docs/feature-placement.md +++ b/docs/feature-placement.md @@ -458,8 +458,8 @@ a parity report is written only after both native comparisons pass. Run `python3 tools/test_state_provider_parity.py`. The [provider report](../benchmarks/rust-state-provider-2026-10-06/scoped-parity.json) -records **105,340,143 matching lines per JAR**, with 299,507 codec inputs -and 39,270,062 requested samples across ten provider kinds. Every pinned state is decoded and tested +records **257,299,719 matching lines per JAR**, with 356,935 codec inputs +and 79,473,574 requested samples across ten provider kinds. Every pinned state is decoded and tested under all six fixed rotations; random/nested rotations, both sampling methods, empty tags, weighted boundaries, fallback query failures and four random-stream combinations are compared. Every target state is also tested against @@ -533,11 +533,14 @@ The `would_survive` predicate now decodes a candidate block state and bounded offset, then invokes survival at the translated position without placing it. Both provider and feature bindings use the shared block-state codec; placement chains forward the survival query. The refreshed provider report records -**105,340,143 matching lines per JAR**, **299,507 inputs**, **39,270,062 requested -samples** and **16 predicate kinds**. Its survival snapshot covers 15 rules, -1,138 definitions and 31,171 candidate states, with each rule tested against the -entire neighbor-state registry, malformed definitions, wrapped offsets, -short-circuit conditions, optional-child fallthrough and query failures. -Unsupported survival definitions remain errors. This report does not establish -full block placement or every block's survival behavior. Workspace tests, -warning-free Clippy and **143 Python tests** passed at this snapshot. +**257,299,719 matching lines per JAR**, **356,935 inputs**, **79,473,574 requested +samples** and **16 predicate kinds**. Its survival snapshot now covers all +**51 pinned survival families, 1,286 definitions and 35,723 states**. Behavior +representatives run against the entire neighbor-state registry, with malformed +definitions, wrapped offsets, brightness thresholds, short-circuit conditions, +optional-child fallthrough and query failures. Dynamic support and empty-context +collision use absent block entities in this integration corpus; animated shulker +and active-piston snapshots have separate geometry comparisons. This establishes +the recorded provider/predicate integration, while full block placement, updates +and gameplay remain pending. Workspace tests, warning-free Clippy and the +**147-test Python suite** passed. diff --git a/docs/rust-parity.md b/docs/rust-parity.md index dffe74224..a7e270818 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -3,17 +3,14 @@ The behavior target is the repository's pinned **Minecraft Java Edition 26.3**. One-to-one vanilla gameplay parity is the acceptance criterion. It has **not** been reached: Horizon's Rust code does not yet run a client, server, or simulation. -It can read and export region files and access saved and resident block sections. -Scheduled block/fluid queues can now collect and dispatch callbacks with -vanilla-checked ordering; the actual block/fluid behavior is still absent. -Double-precision geometry and voxel-grid queries are implemented, with a registry -adapter for vanilla's no-context cached collision branch. -Base noise samplers, octave stacks, normal-noise definitions and bulk density -sampling are implemented. Compiled density samplers now evaluate constants, gradients, -shifted noise, all eleven unary operators, rounding and selected arithmetic operations. An initial density graph compiler -integrates range analysis, specialization, uniform-axis slicing, shared caches, -nested splines and seeded noise; -complete graph coverage, serialized graphs and generated terrain remain absent. +The Rust workspace implements core arithmetic/random streams, world data and +resident sections, scheduled tick ordering, geometry, contained fluid states, +noise/density evaluation, biome and terrain generation kernels, material rules, +and parts of feature placement and decoration. All pinned block-survival +families now have native differential coverage. Full simulation callbacks, +complete chunk generation, entity behavior, networking, rendering and playable +integration remain unfinished. The linked subsystem documents and hashed reports +record the exact tested scope and remaining gaps. The playable Java performance packs remain available during development. ## Completion criteria and playable builds @@ -389,7 +386,7 @@ graphs, block writes and live heightmaps. It compares complete final resident sections; structures, lighting and the full generation lifecycle remain pending. The [block-state provider comparison](feature-placement.md#block-state-providers) -adds **105,340,143 matching lines per JAR** for ten state-provider kinds, including +adds **257,299,719 matching lines per JAR** for ten state-provider kinds, including all eight bundled provider definitions. It includes every state under six directions, property transforms, nested draw order and empty selections. Rule-based selection includes twelve predicate kinds, ordered conditions, empty results and From f41cd70060527857beec90ad43c7dc17b4e4b90e Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 11:55:13 +0200 Subject: [PATCH 005/253] Implement vanilla simple-block placement and feature composition Add registry-bound double-plant and moss placement, independent world RNG, survival ordering and post-write tick scheduling. Integrate named providers and feature graphs. Both pinned JARs matched 9,613,872 trace lines across 492,554 fixtures; workspace tests and all-target Clippy passed. --- .github/workflows/ci.yml | 4 + .../scoped-parity.json | 201 +++++++ .../examples/simple_block_fixture.rs | 519 ++++++++++++++++++ crates/horizon-world/src/block_placement.rs | 376 +++++++++++++ crates/horizon-world/src/block_survival.rs | 13 + crates/horizon-world/src/lib.rs | 1 + crates/horizon-world/src/worldgen.rs | 1 + .../src/worldgen/block_feature.rs | 24 + .../src/worldgen/feature_graph.rs | 15 + .../src/worldgen/placement/context.rs | 26 + .../src/worldgen/simple_block.rs | 109 ++++ .../src/worldgen/state_provider.rs | 3 + .../src/worldgen/state_provider/catalog.rs | 9 + docs/feature-placement.md | 27 + .../parity/VanillaSimpleBlockOracle.java | 111 ++++ tools/test_simple_block_parity.py | 129 +++++ 16 files changed, 1568 insertions(+) create mode 100644 benchmarks/rust-simple-block-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-world/examples/simple_block_fixture.rs create mode 100644 crates/horizon-world/src/block_placement.rs create mode 100644 crates/horizon-world/src/worldgen/simple_block.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java create mode 100644 tools/test_simple_block_parity.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 975936753..98cdd9e14 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -95,6 +95,10 @@ jobs: env: RUSTUP_TOOLCHAIN: stable run: python tools/test_rule_test_parity.py + - name: Compare simple-block placement and feature composition + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_simple_block_parity.py - name: Compare ordered single-block replacement features env: RUSTUP_TOOLCHAIN: stable diff --git a/benchmarks/rust-simple-block-2026-10-06/scoped-parity.json b/benchmarks/rust-simple-block-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..416d5a057 --- /dev/null +++ b/benchmarks/rust-simple-block-2026-10-06/scoped-parity.json @@ -0,0 +1,201 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 492554, + "candidate_states": 35723, + "double_plant_blocks": 10, + "mossy_carpet_blocks": 1, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java": "82204d06e279275c5967f6d5fd80afe7416ba6c5f5ec19c682a30942f2fb6d7a", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSurvivalOracle.java": "4e7cc151617c1b02e872f9ca3e9fe4632379f225f4f07718ff6492df4ee551e7", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java": "99a396b9b983f6ca9149133251f3ece9aaf76d3d16dafa1f322378212a19490c", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSupportOracle.java": "04350901a2d708fb8fa672de61d058f73f332d2e90df1b93a67781862f89c1ad", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "60ff9ef7c1d5e23c080f9aec95ab2e7d3b7c5b5bcd67b9efa9518776c400629a", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_simple_block_parity.py": "710cc537a5abfb410c28c8121dea9f216a00f96ea60fafbf2c3f82e7621b6e4e", + "tools/test_block_survival_parity.py": "9e8dff3bd4b95dbfd29f8adc6a2f6d66abf19a6b1cd91423b794a345d4ec244a", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b3caf26bd3afc9d10cdcca3f7e794c30abf5ba09afa1fe80ba8f44713acdb274", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "8a2834a9347ee2c2db7cf1c86a064907ec06e9ac16ba9cc3936e315fc4ad49ca", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "a8cd85f6223668c1446ff103276d80937b9707d9a7dc619a176b1b1ceed36a4a", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_feature.rs": "2ea6d26fe88c633ad3efe7bdb6fc49f54961cbdf93b82919d79cf7d37a5c3c7d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "486fe9d8588eb09e0ee5707a0541b0df167b63b0b56c90a2709bfa09a0a3ad19", + "crates/horizon-world/src/worldgen/feature_graph.rs": "1db1c7bffcb045e4365c3434a22ab9b2589a78753f897d17a0ef09ae735619c1", + "crates/horizon-world/src/worldgen/feature_region.rs": "2c78e5f1bdb08307f8d982f231f1abbc3306cd54348d9023b86ee6ed3516fd33", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "e682d13a21f90605215b79f5d254bf2e524d35e89eab2e3b46384709af80b847", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "2fc100f8861fe0e0519a53dc4ae4a1eaa8a96aff2f6bf546ce613bdf665df237", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "c0190c771ec164902db6988a511b7b409c4fa44456548cb7bc40a520ccdf7a92", + "crates/horizon-world/examples/simple_block_fixture.rs": "d839de7fa2827189f8625903cedad84ab47c3e7384bed42e250f660f41d961dc" + }, + "fixtures_sha256": { + ".local/rust-simple-block-parity/inputs.txt": "c60ac2104d268f70971d19ad2d9d94b064b6161e2ca3e258b3eaee5c0e217adc", + ".local/rust-simple-block-parity/block-properties.nbt": "1aba22092f70d16b8092014c058ddc210e4aaa77bac32f6ec62e4d0e91d92a99", + ".local/rust-simple-block-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-simple-block-parity/cached-collision.nbt": "f3a5c6a5b2d51dad6c52e486e2b9989e79fd55db1a9bda6196db399550b04078", + ".local/rust-simple-block-parity/cached-support.nbt": "b6fdc9471b0b61e904206d3f099f4dc235aad6d723536c210be0cb7c3560d82c", + ".local/rust-simple-block-parity/catalog.json": "93581107e3564e60261044fdca61e3b7f237b9e6724c14b86e335ccc01198ba9", + ".local/rust-simple-block-parity/facts.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-simple-block-parity/feature-catalog.json": "c048c761c5084a40560731955cc999a364d14055bdd86fa50989a92e4a771286", + ".local/rust-simple-block-parity/fluid-tags.json": "f1e5eb6d22ea7effbb118a2282709cfdeef1bfae4516b775a55ad7a4df29d7d0", + ".local/rust-simple-block-parity/placement-definitions.json": "f8a972ec87c2352500af6481158a3192bdbf699951025639bea744e4127b97c4", + ".local/rust-simple-block-parity/support-cached-states.json": "353945a58fe69b352925473f1693f9b14a9ad19f13c15159c4184f2c29258622", + ".local/rust-simple-block-parity/survival-classes.json": "361832008eea0aa9151d367a125a19c6353d99a0b88b27dd0682f55b7954553e", + ".local/rust-simple-block-parity/survival-extra-definitions.json": "170f2db5bc97a49fa25cc249540aa7f04beea455cdbaf43742ed9415f5090a02", + ".local/rust-simple-block-parity/survival-placement-classes.json": "7fdbf48ab18c87098bbe1b6176cb81f4842b6c5d9a4d6bbaf7037ff61cb1848c", + ".local/rust-simple-block-parity/survival-rules.json": "8805c18b3195bb1eac1f1e5281333df56e2892505f64023e5403c58ce2ec4368", + ".local/rust-simple-block-parity/survival-support-tags.json": "15d88d5bb5ad10d65124d5abb2cc055d251b06d129bca7be06f55b43dc13f6fd", + ".local/rust-simple-block-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0" + }, + "rust_output_sha256": "844b94c4148519899e030393f1def423da6ab96353b73e8797e53bbb6ba958a6", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "844b94c4148519899e030393f1def423da6ab96353b73e8797e53bbb6ba958a6", + "matched_output_lines": 9613872 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "844b94c4148519899e030393f1def423da6ab96353b73e8797e53bbb6ba958a6", + "matched_output_lines": 9613872 + } + ], + "scope": "Native SimpleBlockFeature map codec, provider selection, actual state survival and single/double-plant/moss placement. Named feature/placed-feature/provider holders, selectors, sequences and placement modifier chains compose the same operations. Mutable world logs ordered reads, fluid/light/entity queries, writes and flags, rejected writes, thrown failures, scheduled block identities, repeated placements and both feature/world random tails. All candidate states and every above-state obstruction for representative double-plant definitions, waterlogging, moss attachment combinations and topper identities are exercised. Registry definition classes and immutable geometry are independently checked in both authenticated JARs. Actual chunks, neighbor updates, scheduled tick execution, entity lifecycle, complete feature registries and playable worlds remain pending." +} diff --git a/crates/horizon-world/examples/simple_block_fixture.rs b/crates/horizon-world/examples/simple_block_fixture.rs new file mode 100644 index 000000000..a90e864b8 --- /dev/null +++ b/crates/horizon-world/examples/simple_block_fixture.rs @@ -0,0 +1,519 @@ +//! Ordered feature effects over a mutable registry-bound world. +use horizon_core::{ + geometry::{Direction, VoxelShape}, + random::{LegacyRandom, RandomSource, XoroshiroRandom}, +}; +use horizon_world::{ + block_collision::{BlockCollisionRegistry, DynamicCollisionWorld, ShulkerCollisionState}, + block_placement::BlockPlacementBindings, + block_properties::BlockPropertiesRegistry, + block_support::{BlockSupportRegistry, SupportType}, + block_survival::{BlockSurvivalRegistry, SurvivalDefinitions, SurvivalRule, SurvivalWorld}, + collision::CachedCollisionRegistry, + dynamic_support::DynamicSupportWorld, + fluid::{FluidKind, FluidState, FluidStateTable}, + heightmap::HeightmapType, + nbt::{self, Limits, Tag}, + registry::{BlockRegistry, BlockStateId}, + worldgen::{ + anchor::WorldGenerationContext, + block_feature::FeatureBlockBindings, + feature::{FeatureBlocks, FeatureWorld}, + feature_catalog::FeatureCatalog, + feature_graph::{FeatureDefinition, PlacedFeatureDefinition}, + placement::{PlacementContext, PlacementQueryError}, + simple_block::SimpleBlockFeature, + state_provider::{StateProviderBindings, StateProviderCatalog}, + tags::TagDefinitions, + }, +}; +use serde_json::Value; +use std::{ + collections::BTreeMap, + fs, + io::{self, BufRead, Write}, + path::Path, + sync::Arc, +}; +struct World<'a, 'r, W, R> { + out: &'a mut W, + random: R, + states: BTreeMap<[i32; 3], BlockStateId>, + fallback: BlockStateId, + fluid: Option, + fluids: &'a FluidStateTable, + water_mask: u8, + survival: &'a BlockSurvivalRegistry<'r>, + support: &'a BlockSupportRegistry<'r>, + calls: i32, + fail: i32, + reject: i32, + brightness: i32, +} +impl World<'_, '_, W, R> { + fn event(&mut self, text: std::fmt::Arguments<'_>) -> io::Result { + writeln!(self.out, "{text}")?; + let call = self.calls; + self.calls += 1; + if call == self.fail { + return Err(io::Error::other("injected world failure")); + } + Ok(call) + } + fn at(&self, p: [i32; 3]) -> BlockStateId { + self.states.get(&p).copied().unwrap_or(self.fallback) + } + fn get(&mut self, p: [i32; 3]) -> io::Result { + self.event(format_args!("get {} {} {}", p[0], p[1], p[2]))?; + let state = self.at(p); + writeln!(self.out, "state {}", state.0)?; + Ok(state) + } + fn entity(&mut self, p: [i32; 3]) -> io::Result<()> { + self.event(format_args!("entity {} {} {}", p[0], p[1], p[2]))?; + Ok(()) + } +} +impl DynamicSupportWorld for World<'_, '_, W, R> { + type Error = io::Error; + fn shulker_is_closed(&mut self, p: [i32; 3]) -> io::Result> { + self.entity(p)?; + Ok(None) + } + fn moving_piston_shape(&mut self, p: [i32; 3]) -> io::Result> { + self.entity(p)?; + Ok(None) + } +} +impl DynamicCollisionWorld for World<'_, '_, W, R> { + fn shulker_collision_state( + &mut self, + p: [i32; 3], + ) -> io::Result> { + self.entity(p)?; + Ok(None) + } +} +impl SurvivalWorld for World<'_, '_, W, R> { + fn block_state(&mut self, p: [i32; 3]) -> io::Result { + self.get(p) + } + fn fluid_state(&mut self, p: [i32; 3]) -> io::Result { + self.event(format_args!("fluid {} {} {}", p[0], p[1], p[2]))?; + self.fluids + .get(self.fluid.unwrap_or_else(|| self.at(p))) + .ok_or_else(|| io::Error::other("unknown fluid")) + } + fn raw_brightness(&mut self, p: [i32; 3], sky_darken: i32) -> io::Result { + self.event(format_args!( + "light {} {} {} {sky_darken}", + p[0], p[1], p[2] + ))?; + Ok(self.brightness) + } +} +impl FeatureWorld for World<'_, '_, W, R> { + type Error = io::Error; + fn block(&mut self, p: [i32; 3]) -> io::Result { + self.get(p) + } + fn set_block(&mut self, p: [i32; 3], state: BlockStateId, flags: i32) -> io::Result { + let call = self.event(format_args!( + "set {} {} {} {} {flags}", + p[0], p[1], p[2], state.0 + ))?; + let result = self.reject == 0 || call % self.reject != 0; + if result { + self.states.insert(p, state); + } + writeln!(self.out, "written {result}")?; + Ok(result) + } +} +fn query(error: impl std::fmt::Display) -> PlacementQueryError { + PlacementQueryError::Failed(error.to_string()) +} +impl PlacementContext for World<'_, '_, W, R> { + fn water_at(&mut self, p: [i32; 3]) -> Result { + Ok(self.fluid_state(p).map_err(query)?.kind().mask() & self.water_mask != 0) + } + fn attachment_at( + &mut self, + p: [i32; 3], + direction: Direction, + ) -> Result { + let survival = self.survival; + survival.can_attach_to(self, p, direction).map_err(query) + } + fn next_world_boolean(&mut self) -> Result { + Ok(self.random.next_boolean()) + } + fn schedule_block_tick( + &mut self, + p: [i32; 3], + block: BlockStateId, + delay: i32, + ) -> Result<(), PlacementQueryError> { + self.event(format_args!( + "tick {} {} {} {} {delay}", + p[0], p[1], p[2], block.0 + )) + .map_err(query)?; + Ok(()) + } + fn generation(&self) -> WorldGenerationContext { + WorldGenerationContext::new(-64, 384, 63) + } + fn min_y(&mut self) -> Result { + Ok(-64) + } + fn max_y(&mut self) -> Result { + Ok(319) + } + fn height(&mut self, _: HeightmapType, _: i32, _: i32) -> Result { + Err(PlacementQueryError::Unavailable) + } + fn block_state(&mut self, p: [i32; 3]) -> Result { + self.get(p).map_err(query) + } + fn block_survives( + &mut self, + state: BlockStateId, + p: [i32; 3], + ) -> Result { + let survival = self.survival; + survival.can_survive(self, state, p).map_err(query) + } + fn face_sturdy( + &mut self, + p: [i32; 3], + direction: Direction, + ) -> Result { + let state = self.get(p).map_err(query)?; + let support = self.support; + support + .is_face_sturdy(self, state, p, direction, SupportType::Full) + .map_err(query) + } +} +enum Feature { + Map(SimpleBlockFeature), + Graph(Box), + Placed(Box), +} +#[allow(clippy::too_many_arguments)] +fn fixture( + f: &Value, + mut random: R, + world_random: R, + providers: &StateProviderBindings<'_>, + catalog: &StateProviderCatalog, + placement: &BlockPlacementBindings<'_>, + feature_bindings: &FeatureBlockBindings<'_>, + feature_catalog: &FeatureCatalog, + blocks: FeatureBlocks, + survival: &BlockSurvivalRegistry<'_>, + support: &BlockSupportRegistry<'_>, + fluids: &FluidStateTable, + water_mask: u8, + out: &mut impl Write, +) -> Result<(), Box> { + let json = f["definition"].as_str().unwrap(); + let feature = match f["mode"].as_str().unwrap_or("map") { + "map" => { + SimpleBlockFeature::from_json(json, providers, catalog, placement).map(Feature::Map) + } + "feature" => feature_catalog + .feature_with_blocks(json, feature_bindings) + .map(|v| Feature::Graph(Box::new(v))), + _ => feature_catalog + .placed_feature_with_blocks(json, feature_bindings) + .map(|v| Feature::Placed(Box::new(v))), + }; + let mut world = World { + out, + random: world_random, + states: f["states"] + .as_array() + .unwrap() + .iter() + .map(|v| { + ( + std::array::from_fn(|i| v[i].as_i64().unwrap() as i32), + BlockStateId(v[3].as_u64().unwrap() as u32), + ) + }) + .collect(), + fallback: BlockStateId(f["fallback"].as_u64().unwrap() as u32), + fluid: f + .get("fluid") + .map(|v| BlockStateId(v.as_u64().unwrap() as u32)), + fluids, + water_mask, + survival, + support, + calls: 0, + fail: f["fail"].as_i64().unwrap() as i32, + reject: f["reject"].as_i64().unwrap() as i32, + brightness: f["brightness"].as_i64().unwrap() as i32, + }; + match feature { + Err(_) => writeln!(world.out, "decode error")?, + Ok(feature) => { + writeln!(world.out, "decode ok")?; + let origin = std::array::from_fn(|i| f["origin"][i].as_i64().unwrap() as i32); + for _ in 0..f["repeats"].as_u64().unwrap() { + world.calls = 0; + let result = match &feature { + Feature::Map(feature) => feature + .place(&mut world, &mut random, origin) + .map_err(|_| ()), + Feature::Graph(feature) => feature + .place(&mut world, &mut random, origin, blocks) + .map_err(|_| ()), + Feature::Placed(feature) => feature + .place(&mut world, &mut random, origin, blocks) + .map_err(|_| ()), + }; + match result { + Ok(result) => writeln!(world.out, "place {result}")?, + Err(_) => writeln!(world.out, "place error")?, + } + writeln!( + world.out, + "next {} {}", + random.next_long(), + world.random.next_long() + )?; + writeln!(world.out, "calls {}", world.calls)?; + for (p, state) in &world.states { + writeln!(world.out, "stored {} {} {} {}", p[0], p[1], p[2], state.0)?; + } + writeln!(world.out, "end")?; + } + } + } + writeln!( + world.out, + "tail {} {}", + random.next_long(), + world.random.next_long() + )?; + Ok(()) +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let read = |name: &str| -> Result> { + Ok( + nbt::read_named(&fs::read(dir.join(name))?, Limits::default())? + .0 + .tag, + ) + }; + let registry = BlockRegistry::from_nbt(&read("block-registry.nbt")?)?; + let collisions = CachedCollisionRegistry::from_nbt(&read("cached-collision.nbt")?, ®istry)?; + let properties = + BlockPropertiesRegistry::from_nbt(&read("block-properties.nbt")?, &collisions)?; + let support = Arc::new(BlockSupportRegistry::from_nbt( + &read("cached-support.nbt")?, + ®istry, + )?); + let resources: BTreeMap = + serde_json::from_str(&fs::read_to_string(dir.join("tags.json"))?)?; + let mut tags = TagDefinitions::default(); + for (name, text) in resources { + tags.apply_json(&name, "vanilla", &text)?; + } + let tags = tags.build(|name, _| registry.default_state(name).map(|_| name.to_owned()))?; + assert!(tags.missing.is_empty()); + let definitions: BTreeMap = + serde_json::from_str(&fs::read_to_string(dir.join("survival-rules.json"))?)?; + let definitions = definitions + .into_iter() + .map(|(name, rule)| { + use SurvivalRule::*; + let rule = match rule.as_str() { + value if value.starts_with("TagBelow:") => TagBelow(value[9..].to_owned()), + "CactusFlower" => CactusFlower, + "Seagrass" => Seagrass, + "BubbleColumn" => BubbleColumn, + "RedstoneWire" => RedstoneWire, + "DoublePlant" => DoublePlant, + "Door" => Door, + "BigDripleaf" => BigDripleaf, + "BigDripleafStem" => BigDripleafStem, + "Farmland" => Farmland, + "Cocoa" => Cocoa, + "Crop" => Crop, + "GrowingPlant" => GrowingPlant, + "MangrovePropagule" => MangrovePropagule, + "Speleothem" => Speleothem, + "Scaffolding" => Scaffolding, + "PistonHead" => PistonHead, + "ChorusPlant" => ChorusPlant, + "ChorusFlower" => ChorusFlower, + "PitcherCrop" => PitcherCrop, + "Multiface" => Multiface, + "Vine" => Vine, + "HangingMoss" => HangingMoss, + "SnowLayer" => SnowLayer, + "SeaPickle" => SeaPickle, + "Fire" => Fire, + "Cactus" => Cactus, + "Path" => Path, + "Mushroom" => Mushroom, + "Bell" => Bell, + "SugarCane" => SugarCane, + "LilyPad" => LilyPad, + "Frogspawn" => Frogspawn, + "SporeBlossom" => SporeBlossom, + "SmallDripleaf" => SmallDripleaf, + "TallSeagrass" => TallSeagrass, + "Always" => Always, + "SolidBelow" => SolidBelow, + "SolidBehind" => SolidBehind, + "NonAirBelow" => NonAirBelow, + "MossCarpet" => MossCarpet, + "CenterBelow" => CenterBelow, + "Lantern" => Lantern, + "FullAbove" => FullAbove, + "FullBehind" => FullBehind, + "RigidOrCenterBelow" => RigidOrCenterBelow, + "RigidBelow" => RigidBelow, + "FullBelow" => FullBelow, + "CenterAbove" => CenterAbove, + "FaceAttached" => FaceAttached, + "SupportsBamboo" => SupportsBamboo, + _ => panic!("unknown rule {rule}"), + }; + (name, rule) + }) + .collect(); + let fluid_resources: BTreeMap = + serde_json::from_str(&fs::read_to_string(dir.join("fluid-tags.json"))?)?; + let mut fluid_tags = TagDefinitions::default(); + for (name, text) in fluid_resources { + fluid_tags.apply_json(&name, "vanilla", &text)?; + } + let fluid_tags = + fluid_tags.build(|name, _| FluidKind::from_name(name).map(|_| name.to_owned()))?; + assert!(fluid_tags.missing.is_empty()); + let fluids = FluidStateTable::new(®istry)?; + let collision = Arc::new(BlockCollisionRegistry::new(Arc::new(collisions))?); + let extra: Value = serde_json::from_str(&fs::read_to_string( + dir.join("survival-extra-definitions.json"), + )?)?; + let definitions = SurvivalDefinitions { + rules: definitions, + ignition_odds: serde_json::from_value(extra["ignition_odds"].clone())?, + fence_gates: serde_json::from_value(extra["fence_gates"].clone())?, + }; + let survival = BlockSurvivalRegistry::new( + ®istry, + &properties, + support.clone(), + collision, + &definitions, + &tags.tags, + &fluid_tags.tags, + )?; + let facts: Value = serde_json::from_str(&fs::read_to_string(dir.join("facts.json"))?)?; + let integers: std::collections::BTreeSet<(String, String)> = facts["integers"] + .as_array() + .unwrap() + .iter() + .map(|v| { + ( + v[0].as_str().unwrap().to_owned(), + v[1].as_str().unwrap().to_owned(), + ) + }) + .collect(); + let providers = StateProviderBindings::new(®istry, integers.clone(), &tags.tags)? + .with_block_properties(&properties)? + .with_fluid_tags(&fluid_tags.tags)?; + let resources: BTreeMap = + serde_json::from_str(&fs::read_to_string(dir.join("catalog.json"))?)?; + let catalog = StateProviderCatalog::from_resources(&resources)?; + let definitions: Value = + serde_json::from_str(&fs::read_to_string(dir.join("placement-definitions.json"))?)?; + let placement = BlockPlacementBindings::new( + ®istry, + &properties, + &serde_json::from_value(definitions["double_plants"].clone())?, + &serde_json::from_value(definitions["mossy_carpets"].clone())?, + )?; + let feature_bindings = + FeatureBlockBindings::with_tags(®istry, integers.clone(), &tags.tags)? + .with_block_properties(&properties)? + .with_fluid_tags(&fluid_tags.tags)? + .with_state_providers( + StateProviderBindings::new(®istry, integers, &tags.tags)? + .with_block_properties(&properties)? + .with_fluid_tags(&fluid_tags.tags)?, + StateProviderCatalog::from_resources(&resources)?, + BlockPlacementBindings::new( + ®istry, + &properties, + &serde_json::from_value(definitions["double_plants"].clone())?, + &serde_json::from_value(definitions["mossy_carpets"].clone())?, + )?, + )?; + let feature_resources: Value = + serde_json::from_str(&fs::read_to_string(dir.join("feature-catalog.json"))?)?; + let feature_catalog = FeatureCatalog::from_resources( + &serde_json::from_value(feature_resources["features"].clone())?, + &serde_json::from_value(feature_resources["placed"].clone())?, + &TagDefinitions::default(), + )?; + let blocks = FeatureBlocks::from_registry(®istry)?; + let water_mask = fluid_tags.tags["minecraft:water"] + .iter() + .fold(0, |mask, name| { + mask | FluidKind::from_name(name).unwrap().mask() + }); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in io::BufReader::new(fs::File::open(dir.join("inputs.txt"))?).lines() { + let f: Value = serde_json::from_str(&line?)?; + let seed = f["seed"].as_i64().unwrap(); + let world_seed = f["world_seed"].as_i64().unwrap(); + if f["legacy"].as_bool().unwrap() { + fixture( + &f, + LegacyRandom::new(seed), + LegacyRandom::new(world_seed), + &providers, + &catalog, + &placement, + &feature_bindings, + &feature_catalog, + blocks, + &survival, + &support, + &fluids, + water_mask, + &mut out, + )?; + } else { + fixture( + &f, + XoroshiroRandom::new(seed), + XoroshiroRandom::new(world_seed), + &providers, + &catalog, + &placement, + &feature_bindings, + &feature_catalog, + blocks, + &survival, + &support, + &fluids, + water_mask, + &mut out, + )?; + } + } + out.flush()?; + Ok(()) +} diff --git a/crates/horizon-world/src/block_placement.rs b/crates/horizon-world/src/block_placement.rs new file mode 100644 index 000000000..cb18e55f5 --- /dev/null +++ b/crates/horizon-world/src/block_placement.rs @@ -0,0 +1,376 @@ +//! Block placement operations used by the simple-block world-generation feature. +use crate::{ + block_properties::{BlockPropertiesRegistry, BlockProperty, BoundBlockProperty}, + compression::invalid, + fluid::FluidStateTable, + registry::{BlockRegistry, BlockStateId}, + worldgen::{ + feature::FeatureWorld, + placement::{PlacementContext, PlacementQueryError}, + }, +}; +use horizon_core::geometry::Direction; +use std::{collections::BTreeSet, io, sync::Arc}; + +const HORIZONTAL: [Direction; 4] = [ + Direction::North, + Direction::East, + Direction::South, + Direction::West, +]; +const SIDE_NAMES: [&str; 4] = ["north", "east", "south", "west"]; + +#[derive(Clone, Copy, Debug)] +enum Placement { + Single, + Double(usize), + Moss, +} +#[derive(Clone, Copy, Debug)] +struct DoublePlant { + halves: [[BlockStateId; 2]; 2], + waterlogged: bool, +} +#[derive(Clone, Copy, Debug)] +struct Moss { + bottom: bool, + sides: [u8; 4], +} +impl Moss { + fn code(self) -> usize { + self.sides + .into_iter() + .fold(usize::from(self.bottom), |code, side| { + code * 3 + usize::from(side) + }) + } + fn has_faces(self) -> bool { + self.bottom || self.sides.into_iter().any(|side| side != 0) + } +} +#[derive(Debug)] +pub enum BlockPlacementError { + World(E), + Registry(io::Error), + Query(PlacementQueryError), +} +impl std::fmt::Display for BlockPlacementError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::World(error) => error.fmt(f), + Self::Registry(error) => error.fmt(f), + Self::Query(error) => error.fmt(f), + } + } +} +impl std::error::Error for BlockPlacementError {} + +pub struct BlockPlacementBindings<'r> { + registry: &'r BlockRegistry, + operations: Arc, +} +/// Precompiled transitions shared by decoded features in one registry snapshot. +#[derive(Debug)] +pub struct BlockPlacement { + kinds: Vec, + doubles: Vec, + replaceable: BoundBlockProperty, + fluids: FluidStateTable, + air: [BlockStateId; 3], + defaults: Vec, + moss: Vec>, + moss_ids: [BlockStateId; 162], + moss_default: BlockStateId, +} +impl<'r> BlockPlacementBindings<'r> { + pub fn new( + registry: &'r BlockRegistry, + properties: &BlockPropertiesRegistry<'r>, + double_plants: &BTreeSet, + mossy_carpets: &BTreeSet, + ) -> io::Result { + if !std::ptr::eq(registry, properties.registry()) { + return Err(invalid("placement properties use another registry")); + } + for name in double_plants.iter().chain(mossy_carpets) { + if registry.default_state(name).is_none() { + return Err(invalid("unknown placement definition")); + } + } + let default = |name: &str| { + registry + .default_state(name) + .ok_or_else(|| invalid("missing placement block")) + }; + let mut kinds = Vec::with_capacity(registry.len()); + let mut doubles = Vec::new(); + let mut defaults = Vec::new(); + let mut moss = Vec::new(); + let mut moss_ids = [None; 162]; + for index in 0..registry.len() { + let id = BlockStateId(index as u32); + let state = registry.state(id).unwrap(); + defaults.push(default(&state.name)?); + let kind = if double_plants.contains(&state.name) { + let waterlogged = state.properties.contains_key("waterlogged"); + let mut halves = [[id; 2]; 2]; + for (half, values) in halves.iter_mut().enumerate() { + for (water, target) in values.iter_mut().enumerate() { + let mut descriptor = state.clone(); + descriptor.properties.insert( + "half".into(), + if half == 0 { "lower" } else { "upper" }.into(), + ); + if waterlogged { + descriptor.properties.insert( + "waterlogged".into(), + if water == 0 { "false" } else { "true" }.into(), + ); + } + *target = registry + .id(&descriptor) + .ok_or_else(|| invalid("missing double-plant transition"))?; + } + } + let selected = doubles.len(); + doubles.push(DoublePlant { + halves, + waterlogged, + }); + Placement::Double(selected) + } else if mossy_carpets.contains(&state.name) { + Placement::Moss + } else { + Placement::Single + }; + kinds.push(kind); + let value = if state.name == "minecraft:pale_moss_carpet" { + let bottom = match state.properties.get("bottom").map(String::as_str) { + Some("true") => true, + Some("false") => false, + _ => return Err(invalid("invalid moss bottom")), + }; + let mut sides = [0; 4]; + for (slot, name) in sides.iter_mut().zip(SIDE_NAMES) { + *slot = match state.properties.get(name).map(String::as_str) { + Some("none") => 0, + Some("low") => 1, + Some("tall") => 2, + _ => return Err(invalid("invalid moss side")), + }; + } + let value = Moss { bottom, sides }; + if moss_ids[value.code()].replace(id).is_some() { + return Err(invalid("ambiguous moss state")); + } + Some(value) + } else { + None + }; + moss.push(value); + } + let moss_ids = moss_ids + .into_iter() + .collect::>>() + .ok_or_else(|| invalid("incomplete moss states"))? + .try_into() + .map_err(|_| invalid("invalid moss state count"))?; + Ok(Self { + registry, + operations: Arc::new(BlockPlacement { + kinds, + doubles, + replaceable: properties.bind(BlockProperty::Replaceable), + fluids: FluidStateTable::new(registry)?, + air: [ + default("minecraft:air")?, + default("minecraft:cave_air")?, + default("minecraft:void_air")?, + ], + defaults, + moss, + moss_ids, + moss_default: default("minecraft:pale_moss_carpet")?, + }), + }) + } + pub fn registry(&self) -> &'r BlockRegistry { + self.registry + } + pub fn operations(&self) -> Arc { + self.operations.clone() + } +} +impl BlockPlacement { + fn read( + &self, + world: &mut W, + position: [i32; 3], + ) -> Result> { + let state = world.block(position).map_err(BlockPlacementError::World)?; + if state.0 as usize >= self.kinds.len() { + return Err(BlockPlacementError::Registry(invalid( + "unregistered placement world state", + ))); + } + Ok(state) + } + fn moss_state(&self, state: BlockStateId) -> Option { + self.moss[state.0 as usize] + } + fn updated_moss( + &self, + world: &mut W, + state: Moss, + position: [i32; 3], + force: bool, + ) -> Result> { + let force = force | state.bottom; + let mut result = state; + let mut above = None; + let mut below = None; + for (index, direction) in HORIZONTAL.into_iter().enumerate() { + let mut side = if world + .attachment_at(position, direction) + .map_err(BlockPlacementError::Query)? + { + if force { 1 } else { state.sides[index] } + } else { + 0 + }; + if side == 1 { + let upper = match above { + Some(id) => id, + None => { + let id = self.read(world, relative(position, Direction::Up))?; + above = Some(id); + id + } + }; + if self + .moss_state(upper) + .is_some_and(|value| !value.bottom && value.sides[index] != 0) + { + side = 2; + } + if !state.bottom { + let lower = match below { + Some(id) => id, + None => { + let id = self.read(world, relative(position, Direction::Down))?; + below = Some(id); + id + } + }; + if self + .moss_state(lower) + .is_some_and(|value| value.sides[index] == 0) + { + side = 0; + } + } + } + result.sides[index] = side; + } + Ok(result) + } + fn topper( + &self, + world: &mut W, + position: [i32; 3], + ) -> Result, BlockPlacementError> { + let above = relative(position, Direction::Up); + let current = self.read(world, above)?; + if self.moss_state(current).is_some_and(|value| value.bottom) + || (self.moss_state(current).is_none() && !self.replaceable.contains(current)) + { + return Ok(None); + } + let mut state = self.moss_state(self.moss_default).unwrap(); + state.bottom = false; + state = self.updated_moss(world, state, above, true)?; + for side in &mut state.sides { + if *side != 0 + && !world + .next_world_boolean() + .map_err(BlockPlacementError::Query)? + { + *side = 0; + } + } + let id = self.moss_ids[state.code()]; + Ok((state.has_faces() && id != current).then_some(id)) + } + pub fn place( + &self, + world: &mut W, + state: BlockStateId, + position: [i32; 3], + flags: i32, + ) -> Result> { + let kind = *self.kinds.get(state.0 as usize).ok_or_else(|| { + BlockPlacementError::Registry(invalid("unregistered placement candidate")) + })?; + match kind { + Placement::Single => { + world + .set_block(position, state, flags) + .map_err(BlockPlacementError::World)?; + } + Placement::Double(index) => { + let above = relative(position, Direction::Up); + let current = self.read(world, above)?; + if !self.air.contains(¤t) + && (self.fluids.get(state) != self.fluids.get(current) + || !self.replaceable.contains(current)) + { + return Ok(false); + } + let plant = self.doubles[index]; + for (half, at) in [position, above].into_iter().enumerate() { + let water = plant.waterlogged + && world.water_at(at).map_err(BlockPlacementError::Query)?; + world + .set_block(at, plant.halves[half][usize::from(water)], flags) + .map_err(BlockPlacementError::World)?; + } + } + Placement::Moss => { + let lower = self.updated_moss( + world, + self.moss_state(self.moss_default).unwrap(), + position, + true, + )?; + world + .set_block(position, self.moss_ids[lower.code()], flags) + .map_err(BlockPlacementError::World)?; + if let Some(top) = self.topper(world, position)? { + world + .set_block(relative(position, Direction::Up), top, flags) + .map_err(BlockPlacementError::World)?; + let lower = self.updated_moss(world, lower, position, true)?; + world + .set_block(position, self.moss_ids[lower.code()], flags) + .map_err(BlockPlacementError::World)?; + } + } + } + Ok(true) + } + pub fn schedule_tick( + &self, + world: &mut W, + position: [i32; 3], + delay: i32, + ) -> Result<(), BlockPlacementError> { + let state = self.read(world, position)?; + world + .schedule_block_tick(position, self.defaults[state.0 as usize], delay) + .map_err(BlockPlacementError::Query) + } +} +fn relative(position: [i32; 3], direction: Direction) -> [i32; 3] { + let step = direction.normal(); + std::array::from_fn(|i| position[i].wrapping_add(step[i])) +} diff --git a/crates/horizon-world/src/block_survival.rs b/crates/horizon-world/src/block_survival.rs index 0140729a2..bb21f46df 100644 --- a/crates/horizon-world/src/block_survival.rs +++ b/crates/horizon-world/src/block_survival.rs @@ -578,6 +578,19 @@ impl<'r> BlockSurvivalRegistry<'r> { .get(direction_name(direction)) .is_some_and(|value| value == "true") } + /// Native multiface attachment at a candidate position, testing support + /// first and then empty-context collision on the neighbor's opposite face. + pub fn can_attach_to( + &self, + world: &mut W, + position: [i32; 3], + direction: Direction, + ) -> Result> { + let step = direction.normal(); + let at = std::array::from_fn(|i| position[i].wrapping_add(step[i])); + let neighbor = self.read(world, at)?; + self.can_attach(world, neighbor, at, direction) + } fn can_attach( &self, world: &mut W, diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index f3cea7028..80c53eae8 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -2,6 +2,7 @@ #![forbid(unsafe_code)] pub mod block_collision; +pub mod block_placement; pub mod block_properties; pub mod block_support; pub mod block_survival; diff --git a/crates/horizon-world/src/worldgen.rs b/crates/horizon-world/src/worldgen.rs index 8642bdc08..45e7ad671 100644 --- a/crates/horizon-world/src/worldgen.rs +++ b/crates/horizon-world/src/worldgen.rs @@ -31,6 +31,7 @@ pub mod placement; pub mod router; pub mod rule_test; pub mod settings; +pub mod simple_block; pub mod state_provider; pub mod tags; pub mod terrain; diff --git a/crates/horizon-world/src/worldgen/block_feature.rs b/crates/horizon-world/src/worldgen/block_feature.rs index 4684a4eb4..9b93d94d0 100644 --- a/crates/horizon-world/src/worldgen/block_feature.rs +++ b/crates/horizon-world/src/worldgen/block_feature.rs @@ -16,6 +16,11 @@ use std::{ pub struct FeatureBlockBindings<'r> { registry: &'r BlockRegistry, + pub(crate) simple_blocks: Option<( + super::state_provider::StateProviderBindings<'r>, + super::state_provider::StateProviderCatalog, + crate::block_placement::BlockPlacementBindings<'r>, + )>, physical_properties: Option<[BoundBlockProperty; 4]>, biomes: Option>, fluids: super::fluid_predicate::FluidPredicateBindings, @@ -25,6 +30,24 @@ pub struct FeatureBlockBindings<'r> { pub(crate) air: [BlockStateId; 3], } impl<'r> FeatureBlockBindings<'r> { + /// Bind provider resources and precompiled placement operations to this registry. + pub fn with_state_providers( + mut self, + providers: super::state_provider::StateProviderBindings<'r>, + catalog: super::state_provider::StateProviderCatalog, + placement: crate::block_placement::BlockPlacementBindings<'r>, + ) -> Result { + if !std::ptr::eq(self.registry, providers.registry()) + || !std::ptr::eq(self.registry, placement.registry()) + { + return Err(DecodeError::Field( + "feature provider/placement registry identity", + )); + } + self.simple_blocks = Some((providers, catalog, placement)); + Ok(self) + } + pub fn with_block_properties( mut self, properties: &BlockPropertiesRegistry<'r>, @@ -103,6 +126,7 @@ impl<'r> FeatureBlockBindings<'r> { }; Ok(Self { registry, + simple_blocks: None, codec, biomes: None, physical_properties: None, diff --git a/crates/horizon-world/src/worldgen/feature_graph.rs b/crates/horizon-world/src/worldgen/feature_graph.rs index 5b2d48c94..8e11f8b45 100644 --- a/crates/horizon-world/src/worldgen/feature_graph.rs +++ b/crates/horizon-world/src/worldgen/feature_graph.rs @@ -28,6 +28,7 @@ pub struct PlacedFeatureDefinition { #[derive(Clone, Debug)] pub enum FeatureDefinition { Basic(BasicFeature), + SimpleBlock(super::simple_block::SimpleBlockFeature), FillLayer(FillLayerFeature), ReplaceBlock(ReplaceBlockFeature), ScatteredOre(ScatteredOreFeature), @@ -44,6 +45,7 @@ pub enum FeatureDefinition { #[derive(Debug)] pub enum FeatureExecutionError { Basic(FeatureError), + SimpleBlock(super::simple_block::SimpleBlockError), Random(InvalidBound), Query(PlacementQueryError), WorkLimit, @@ -53,6 +55,7 @@ impl std::fmt::Display for FeatureExecutionError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Self::Basic(e) => e.fmt(f), + Self::SimpleBlock(e) => e.fmt(f), Self::Random(e) => e.fmt(f), Self::Query(e) => e.fmt(f), Self::WorkLimit => f.write_str("feature graph work limit exceeded"), @@ -218,6 +221,15 @@ impl FeatureDefinition { )?)?; match kind.as_str() { "minecraft:no_op" => Ok(Self::NoOp), + "minecraft:simple_block" => { + let (providers, catalog, placement) = blocks + .and_then(|blocks| blocks.simple_blocks.as_ref()) + .ok_or(DecodeError::Field("simple block bindings unavailable"))?; + super::simple_block::SimpleBlockFeature::decode( + json, providers, catalog, placement, depth, remaining, + ) + .map(Self::SimpleBlock) + } "minecraft:fill_layer" => FillLayerFeature::from_json( json, blocks.ok_or_else(|| { @@ -393,6 +405,9 @@ impl FeatureDefinition { .place(world, random, origin, run.blocks) .map_err(FeatureExecutionError::Basic), Self::NoOp => Ok(true), + Self::SimpleBlock(feature) => feature + .place(world, random, origin) + .map_err(FeatureExecutionError::SimpleBlock), Self::ScatteredOre(feature) => feature .place(world, random, origin) .map_err(FeatureExecutionError::Basic), diff --git a/crates/horizon-world/src/worldgen/placement/context.rs b/crates/horizon-world/src/worldgen/placement/context.rs index 695f0bde6..7e8a5a871 100644 --- a/crates/horizon-world/src/worldgen/placement/context.rs +++ b/crates/horizon-world/src/worldgen/placement/context.rs @@ -26,6 +26,32 @@ pub enum LayerBlock { Ground, } pub trait PlacementContext { + /// Test the current fluid at this position against the world's water tag. + fn water_at(&mut self, _position: [i32; 3]) -> Result { + Err(PlacementQueryError::Unavailable) + } + /// Multiface attachment: neighbor support, then empty-context collision. + fn attachment_at( + &mut self, + _position: [i32; 3], + _direction: horizon_core::geometry::Direction, + ) -> Result { + Err(PlacementQueryError::Unavailable) + } + /// Draw from the world's random stream, independently of the feature RNG. + fn next_world_boolean(&mut self) -> Result { + Err(PlacementQueryError::Unavailable) + } + /// Schedule the block type identified by its registry default state. + fn schedule_block_tick( + &mut self, + _position: [i32; 3], + _block: crate::registry::BlockStateId, + _delay: i32, + ) -> Result<(), PlacementQueryError> { + Err(PlacementQueryError::Unavailable) + } + /// Evaluate this candidate state's survival without placing it. fn block_survives( &mut self, diff --git a/crates/horizon-world/src/worldgen/simple_block.rs b/crates/horizon-world/src/worldgen/simple_block.rs new file mode 100644 index 000000000..a732765c5 --- /dev/null +++ b/crates/horizon-world/src/worldgen/simple_block.rs @@ -0,0 +1,109 @@ +//! Native simple-block feature selection, survival and ordered placement. +use super::feature::FeatureWorld; +use super::{ + DecodeError, Object, optional, + placement::{PlacementContext, PlacementQueryError}, + required, + state_provider::{ + BlockStateProvider, StateProviderBindings, StateProviderCatalog, StateProviderError, + }, +}; +use crate::block_placement::{BlockPlacement, BlockPlacementBindings, BlockPlacementError}; +use horizon_core::random::RandomSource; +use std::sync::Arc; + +/// Immutable state providers and placement transitions share one registry. +#[derive(Clone, Debug)] +pub struct SimpleBlockFeature { + provider: BlockStateProvider, + placement: Arc, + schedule_tick: bool, +} +#[derive(Debug)] +pub enum SimpleBlockError { + Provider(StateProviderError), + Placement(BlockPlacementError), + Query(PlacementQueryError), +} +impl std::fmt::Display for SimpleBlockError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Provider(e) => e.fmt(f), + Self::Placement(e) => e.fmt(f), + Self::Query(e) => e.fmt(f), + } + } +} +impl std::error::Error for SimpleBlockError {} +impl SimpleBlockFeature { + /// Decode the feature's map codec, including optional named providers. + pub fn from_json( + json: &str, + providers: &StateProviderBindings<'_>, + catalog: &StateProviderCatalog, + placement: &BlockPlacementBindings<'_>, + ) -> Result { + Self::decode(json, providers, catalog, placement, 0, &mut 65536) + } + pub(crate) fn decode( + json: &str, + providers: &StateProviderBindings<'_>, + catalog: &StateProviderCatalog, + placement: &BlockPlacementBindings<'_>, + depth: usize, + remaining: &mut usize, + ) -> Result { + if !std::ptr::eq(providers.registry(), placement.registry()) { + return Err(DecodeError::Field("simple block registry identity")); + } + let object: Object = serde_json::from_str(json)?; + let provider = catalog.provider_with_budget( + required(&object, "to_place")?.get(), + providers, + depth + 1, + remaining, + )?; + let schedule_tick = optional(&object, "schedule_tick") + .map(|v| serde_json::from_str::(v.get())) + .transpose()? + .unwrap_or(false); + Ok(Self { + provider, + placement: placement.operations(), + schedule_tick, + }) + } + pub fn place( + &self, + world: &mut W, + random: &mut impl RandomSource, + position: [i32; 3], + ) -> Result> { + let Some(state) = self + .provider + .get_optional_state(world, random, position) + .map_err(SimpleBlockError::Provider)? + else { + return Ok(false); + }; + if !world + .block_survives(state, position) + .map_err(SimpleBlockError::Query)? + { + return Ok(false); + } + if !self + .placement + .place(world, state, position, 2) + .map_err(SimpleBlockError::Placement)? + { + return Ok(false); + } + if self.schedule_tick { + self.placement + .schedule_tick(world, position, 1) + .map_err(SimpleBlockError::Placement)?; + } + Ok(true) + } +} diff --git a/crates/horizon-world/src/worldgen/state_provider.rs b/crates/horizon-world/src/worldgen/state_provider.rs index be1901a44..6f69cfafa 100644 --- a/crates/horizon-world/src/worldgen/state_provider.rs +++ b/crates/horizon-world/src/worldgen/state_provider.rs @@ -41,6 +41,9 @@ pub struct StateProviderBindings<'r> { predicate_states: OnceLock>>>, } impl<'r> StateProviderBindings<'r> { + pub fn registry(&self) -> &'r BlockRegistry { + self.registry + } pub fn with_block_properties( mut self, properties: &BlockPropertiesRegistry<'r>, diff --git a/crates/horizon-world/src/worldgen/state_provider/catalog.rs b/crates/horizon-world/src/worldgen/state_provider/catalog.rs index 0cda3d1e8..e8316713a 100644 --- a/crates/horizon-world/src/worldgen/state_provider/catalog.rs +++ b/crates/horizon-world/src/worldgen/state_provider/catalog.rs @@ -36,6 +36,15 @@ impl StateProviderCatalog { ) -> Result { BlockStateProvider::decode_holder(json, bindings, 0, &mut 65536, Some(self)) } + pub(crate) fn provider_with_budget( + &self, + json: &str, + bindings: &StateProviderBindings<'_>, + depth: usize, + remaining: &mut usize, + ) -> Result { + BlockStateProvider::decode_holder(json, bindings, depth, remaining, Some(self)) + } /// Decode DIRECT_CODEC while allowing nested named holder references. pub fn direct_provider( &self, diff --git a/docs/feature-placement.md b/docs/feature-placement.md index 4be761397..94995d0e6 100644 --- a/docs/feature-placement.md +++ b/docs/feature-placement.md @@ -544,3 +544,30 @@ and active-piston snapshots have separate geometry comparisons. This establishes the recorded provider/predicate integration, while full block placement, updates and gameplay remain pending. Workspace tests, warning-free Clippy and the **147-test Python suite** passed. + + +## Simple-block placement + +`SimpleBlockFeature` combines holder-aware state providers, candidate survival, +precompiled placement transitions and optional scheduled ticks. Ordinary writes +retain native flags and ignore a rejected write's boolean result. Double plants +first check the block above for air or matching replaceable fluid, then copy +waterlogging independently into each half. Pale moss carpet derives side states +from support/collision queries, consumes the world's separate random stream for +its topper and recomputes lower sides after the upper write. Scheduled ticks use +the block actually stored after placement, including rejected writes. + +`FeatureBlockBindings::with_state_providers` binds these operations and provider +resources to the same registry. `FeatureDefinition` and `FeatureCatalog` compose +simple blocks with named holders, selectors, sequences and placement modifiers. +Provider decoding shares the enclosing graph's bounded work/depth budget; compiled +placement tables are shared by immutable reference-counted handles. + +Run `python3 tools/test_simple_block_parity.py` against the pinned JARs. The +[simple-block report](../benchmarks/rust-simple-block-2026-10-06/scoped-parity.json) +records **9,613,872 matching output lines per JAR** across **492,554 fixtures**. +It covers every candidate state, double-plant obstructions, waterlogging, moss +attachment/topper combinations, ordered reads/writes, both random streams, +rejected writes, partial failures, wrapped coordinates and nested composition. +Workspace tests and all-target Clippy passed. Native chunk updates, scheduled tick +execution and complete playable integration remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java new file mode 100644 index 000000000..9c954a363 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java @@ -0,0 +1,111 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import com.mojang.serialization.JsonOps; +import java.io.*; +import java.lang.reflect.*; +import java.nio.file.*; +import java.util.*; +import net.minecraft.core.*; +import net.minecraft.core.registries.*; +import net.minecraft.resources.*; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.*; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.levelgen.*; +import net.minecraft.world.level.levelgen.feature.SimpleBlockFeature; +import net.minecraft.world.level.levelgen.feature.Feature; +import net.minecraft.world.level.levelgen.placement.*; +import net.minecraft.world.level.chunk.ChunkGenerator; +import net.minecraft.world.level.levelgen.feature.stateproviders.BlockStateProvider; + +/** Actual native simple-block map codec and mutable world placement. */ +public final class VanillaSimpleBlockOracle { + private static final class Stop extends RuntimeException {} + private static Optional decode(RegistryOps ops,JsonObject f) { + var json=JsonParser.parseString(f.get("definition").getAsString()); + String mode=f.has("mode")?f.get("mode").getAsString():"map"; + if(mode.equals("map"))return SimpleBlockFeature.CODEC.codec().parse(ops,json).result().map(value->value); + if(mode.equals("feature"))return Feature.CODEC.parse(ops,json).result().map(Holder::value); + return PlacedFeature.CODEC.parse(ops,json).result().map(holder->new Feature(){ + public com.mojang.serialization.MapCodec codec(){return com.mojang.serialization.MapCodec.unit(this);} + public boolean place(WorldGenLevel world,ChunkGenerator generator,RandomSource random,BlockPos p){return holder.value().place(world,generator,random,p);} + }); + } + private static BlockPos pos(JsonArray a){return new BlockPos(a.get(0).getAsInt(),a.get(1).getAsInt(),a.get(2).getAsInt());} + private static String xyz(BlockPos p){return p.getX()+" "+p.getY()+" "+p.getZ();} + private static final class World implements InvocationHandler { + final JsonObject f;final PrintWriter out;final RandomSource random;int calls; + final TreeMap states=new TreeMap<>(Comparator.comparingInt(BlockPos::getX).thenComparingInt(BlockPos::getY).thenComparingInt(BlockPos::getZ)); + World(JsonObject f,PrintWriter out,RandomSource random){this.f=f;this.out=out;this.random=random;for(var raw:f.getAsJsonArray("states")){var v=raw.getAsJsonArray();states.put(pos(v),Block.stateById(v.get(3).getAsInt()));}} + void event(String text){out.println(text);if(calls++==f.get("fail").getAsInt())throw new Stop();} + BlockState at(BlockPos p){return states.getOrDefault(p,Block.stateById(f.get("fallback").getAsInt()));} + public Object invoke(Object proxy,Method method,Object[] args)throws Throwable { + String name=method.getName(); + if(name.equals("getRandom"))return random; + if(name.equals("getMinY"))return -64; + if(name.equals("getHeight")&&(args==null||args.length==0))return 384; + if(name.equals("getSeaLevel"))return 63; + if(name.equals("getBlockState")){var p=(BlockPos)args[0];event("get "+xyz(p));var state=at(p);out.println("state "+Block.getId(state));return state;} + if(name.equals("getFluidState")){var p=(BlockPos)args[0];event("fluid "+xyz(p));return (f.has("fluid")?Block.stateById(f.get("fluid").getAsInt()):at(p)).getFluidState();} + if(name.equals("getRawBrightness")){var p=(BlockPos)args[0];event("light "+xyz(p)+" "+args[1]);return f.get("brightness").getAsInt();} + if(name.equals("getBlockEntity")){event("entity "+xyz((BlockPos)args[0]));return null;} + if(name.equals("setBlock")){ + var p=((BlockPos)args[0]).immutable();var state=(BlockState)args[1];int call=calls;event("set "+xyz(p)+" "+Block.getId(state)+" "+args[2]); + int reject=f.get("reject").getAsInt();boolean result=reject==0||call%reject!=0;if(result)states.put(p,state);out.println("written "+result);return result; + } + if(name.equals("scheduleTick")){event("tick "+xyz((BlockPos)args[0])+" "+Block.getId(((Block)args[1]).defaultBlockState())+" "+args[2]);return null;} + if(method.isDefault())return InvocationHandler.invokeDefault(proxy,method,args); + throw new AssertionError(method); + } + } + @SuppressWarnings("unchecked") + public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();Path dir=Path.of(args[1]); + if(args[0].equals("export")) { + VanillaBlockSurvivalOracle.main(args); + var data=new JsonObject();var doubles=new JsonArray();var moss=new JsonArray(); + for(var block:BuiltInRegistries.BLOCK){String name=BuiltInRegistries.BLOCK.getKey(block).toString();if(block instanceof DoublePlantBlock)doubles.add(name);if(block instanceof MossyCarpetBlock)moss.add(name);} + data.add("double_plants",doubles);data.add("mossy_carpets",moss);Files.writeString(dir.resolve("placement-definitions.json"),data.toString());return; + } + VanillaHeightmapOracle.bindTags(JsonParser.parseString(Files.readString(dir.resolve("tags.json"))).getAsJsonObject()); + var bind=VanillaBlockSurvivalOracle.class.getDeclaredMethod("bindFluidTags",JsonObject.class);bind.setAccessible(true);bind.invoke(null,JsonParser.parseString(Files.readString(dir.resolve("fluid-tags.json"))).getAsJsonObject()); + var providers=new MappedRegistry(Registries.BLOCK_STATE_PROVIDER,com.mojang.serialization.Lifecycle.stable()); + var features=new MappedRegistry(Registries.FEATURE,com.mojang.serialization.Lifecycle.stable()); + var placed=new MappedRegistry(Registries.PLACED_FEATURE,com.mojang.serialization.Lifecycle.stable()); + var ops=RegistryOps.create(JsonOps.INSTANCE,new RegistryOps.RegistryInfoLookup(){public Optional> lookup(ResourceKey> key){ + if(key.equals(Registries.FEATURE))return (Optional>)(Optional)Optional.of(features); + if(key.equals(Registries.PLACED_FEATURE))return (Optional>)(Optional)Optional.of(placed); + if(key.equals(Registries.BLOCK_STATE_PROVIDER))return (Optional>)(Optional)Optional.of(providers); + if(key.equals(Registries.FLUID))return (Optional>)(Optional)Optional.of(BuiltInRegistries.FLUID); + return key.equals(Registries.BLOCK)?(Optional>)(Optional)Optional.of(BuiltInRegistries.BLOCK):Optional.empty(); + }}); + for(var entry:JsonParser.parseString(Files.readString(dir.resolve("catalog.json"))).getAsJsonObject().entrySet()) { + var provider=BlockStateProvider.DIRECT_CODEC.parse(ops,JsonParser.parseString(entry.getValue().getAsString())).getOrThrow(); + providers.register(ResourceKey.create(Registries.BLOCK_STATE_PROVIDER,Identifier.parse(entry.getKey())),provider,RegistrationInfo.BUILT_IN); + }providers.freeze(); + var bundle=JsonParser.parseString(Files.readString(dir.resolve("feature-catalog.json"))).getAsJsonObject(); + for(var entry:bundle.getAsJsonObject("features").entrySet())features.register(ResourceKey.create(Registries.FEATURE,Identifier.parse(entry.getKey())),Feature.DIRECT_CODEC.parse(ops,JsonParser.parseString(entry.getValue().getAsString())).getOrThrow(),RegistrationInfo.BUILT_IN); + features.freeze(); + for(var entry:bundle.getAsJsonObject("placed").entrySet())placed.register(ResourceKey.create(Registries.PLACED_FEATURE,Identifier.parse(entry.getKey())),PlacedFeature.DIRECT_CODEC.parse(ops,JsonParser.parseString(entry.getValue().getAsString())).getOrThrow(),RegistrationInfo.BUILT_IN); + placed.freeze(); + var contextMethod=VanillaPlacementOracle.class.getDeclaredMethod("context",JsonObject.class);contextMethod.setAccessible(true); + var bounds=new JsonObject();bounds.add("context",JsonParser.parseString("[-64,384,63]")); + var generator=((PlacementContext)contextMethod.invoke(null,bounds)).generator(); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var inputs=Files.lines(dir.resolve("inputs.txt"))) { + for(var line:(Iterable)inputs::iterator){var f=JsonParser.parseString(line).getAsJsonObject();long seed=f.get("seed").getAsLong(),worldSeed=f.get("world_seed").getAsLong();boolean legacy=f.get("legacy").getAsBoolean(); + RandomSource random=legacy?new LegacyRandomSource(seed):new XoroshiroRandomSource(seed),worldRandom=legacy?new LegacyRandomSource(worldSeed):new XoroshiroRandomSource(worldSeed); + Optional decoded; + try{decoded=decode(ops,f);}catch(IllegalArgumentException|IllegalStateException error){decoded=Optional.empty();} + if(decoded.isEmpty())out.println("decode error");else { + out.println("decode ok");var handler=new World(f,out,worldRandom);var world=(WorldGenLevel)Proxy.newProxyInstance(WorldGenLevel.class.getClassLoader(),new Class[]{WorldGenLevel.class},handler);var origin=pos(f.getAsJsonArray("origin")); + for(int repeat=0;repeat Date: Tue, 6 Oct 2026 11:55:45 +0200 Subject: [PATCH 006/253] Implement native block-column sampling and truncation --- .github/workflows/ci.yml | 4 + .../scoped-parity.json | 203 ++++++++++++++++++ crates/horizon-world/src/worldgen.rs | 1 + .../src/worldgen/block_column.rs | 186 ++++++++++++++++ .../src/worldgen/feature_graph.rs | 13 ++ docs/feature-placement.md | 20 ++ tools/test_block_column_parity.py | 60 ++++++ tools/test_simple_block_parity.py | 12 +- 8 files changed, 495 insertions(+), 4 deletions(-) create mode 100644 benchmarks/rust-block-column-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-world/src/worldgen/block_column.rs create mode 100644 tools/test_block_column_parity.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 98cdd9e14..ce2a79769 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -99,6 +99,10 @@ jobs: env: RUSTUP_TOOLCHAIN: stable run: python tools/test_simple_block_parity.py + - name: Compare block-column sampling and obstruction + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_block_column_parity.py - name: Compare ordered single-block replacement features env: RUSTUP_TOOLCHAIN: stable diff --git a/benchmarks/rust-block-column-2026-10-06/scoped-parity.json b/benchmarks/rust-block-column-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..a6dd70b4d --- /dev/null +++ b/benchmarks/rust-block-column-2026-10-06/scoped-parity.json @@ -0,0 +1,203 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 64120, + "candidate_states": 35723, + "double_plant_blocks": 10, + "mossy_carpet_blocks": 1, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java": "82204d06e279275c5967f6d5fd80afe7416ba6c5f5ec19c682a30942f2fb6d7a", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSurvivalOracle.java": "4e7cc151617c1b02e872f9ca3e9fe4632379f225f4f07718ff6492df4ee551e7", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java": "99a396b9b983f6ca9149133251f3ece9aaf76d3d16dafa1f322378212a19490c", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSupportOracle.java": "04350901a2d708fb8fa672de61d058f73f332d2e90df1b93a67781862f89c1ad", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "60ff9ef7c1d5e23c080f9aec95ab2e7d3b7c5b5bcd67b9efa9518776c400629a", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_simple_block_parity.py": "8d789c02b88cfd019064b7407f886a2054d26554390a25f804773bb2197c6c35", + "tools/test_block_column_parity.py": "48c542356bdcf0f27d5ef2cee8c61b8e6274d2c84b17dffee5bcbb5ff5439e8a", + "tools/test_block_survival_parity.py": "9e8dff3bd4b95dbfd29f8adc6a2f6d66abf19a6b1cd91423b794a345d4ec244a", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b3caf26bd3afc9d10cdcca3f7e794c30abf5ba09afa1fe80ba8f44713acdb274", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "8a2834a9347ee2c2db7cf1c86a064907ec06e9ac16ba9cc3936e315fc4ad49ca", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "a8cd85f6223668c1446ff103276d80937b9707d9a7dc619a176b1b1ceed36a4a", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "2ea6d26fe88c633ad3efe7bdb6fc49f54961cbdf93b82919d79cf7d37a5c3c7d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "486fe9d8588eb09e0ee5707a0541b0df167b63b0b56c90a2709bfa09a0a3ad19", + "crates/horizon-world/src/worldgen/feature_graph.rs": "26dc6ade715d6d571a18143ba6c95f59d80c212ec8e38d3827ae3e72f4bc89ca", + "crates/horizon-world/src/worldgen/feature_region.rs": "2c78e5f1bdb08307f8d982f231f1abbc3306cd54348d9023b86ee6ed3516fd33", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "e682d13a21f90605215b79f5d254bf2e524d35e89eab2e3b46384709af80b847", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "2fc100f8861fe0e0519a53dc4ae4a1eaa8a96aff2f6bf546ce613bdf665df237", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "2757f22706803afb3624afd65f4f5d05540acbc2bcb01f61e95fa40535575f0f", + "crates/horizon-world/examples/simple_block_fixture.rs": "d839de7fa2827189f8625903cedad84ab47c3e7384bed42e250f660f41d961dc" + }, + "fixtures_sha256": { + ".local/rust-block-column-parity/inputs.txt": "afc1201a78dba6ef140a7588d105a9e78931cfc837ea200baa8777ce02ae3f4f", + ".local/rust-block-column-parity/block-properties.nbt": "1aba22092f70d16b8092014c058ddc210e4aaa77bac32f6ec62e4d0e91d92a99", + ".local/rust-block-column-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-block-column-parity/cached-collision.nbt": "f3a5c6a5b2d51dad6c52e486e2b9989e79fd55db1a9bda6196db399550b04078", + ".local/rust-block-column-parity/cached-support.nbt": "b6fdc9471b0b61e904206d3f099f4dc235aad6d723536c210be0cb7c3560d82c", + ".local/rust-block-column-parity/catalog.json": "93581107e3564e60261044fdca61e3b7f237b9e6724c14b86e335ccc01198ba9", + ".local/rust-block-column-parity/facts.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-block-column-parity/feature-catalog.json": "c048c761c5084a40560731955cc999a364d14055bdd86fa50989a92e4a771286", + ".local/rust-block-column-parity/fluid-tags.json": "f1e5eb6d22ea7effbb118a2282709cfdeef1bfae4516b775a55ad7a4df29d7d0", + ".local/rust-block-column-parity/placement-definitions.json": "f8a972ec87c2352500af6481158a3192bdbf699951025639bea744e4127b97c4", + ".local/rust-block-column-parity/support-cached-states.json": "353945a58fe69b352925473f1693f9b14a9ad19f13c15159c4184f2c29258622", + ".local/rust-block-column-parity/survival-classes.json": "361832008eea0aa9151d367a125a19c6353d99a0b88b27dd0682f55b7954553e", + ".local/rust-block-column-parity/survival-extra-definitions.json": "170f2db5bc97a49fa25cc249540aa7f04beea455cdbaf43742ed9415f5090a02", + ".local/rust-block-column-parity/survival-placement-classes.json": "7fdbf48ab18c87098bbe1b6176cb81f4842b6c5d9a4d6bbaf7037ff61cb1848c", + ".local/rust-block-column-parity/survival-rules.json": "8805c18b3195bb1eac1f1e5281333df56e2892505f64023e5403c58ce2ec4368", + ".local/rust-block-column-parity/survival-support-tags.json": "15d88d5bb5ad10d65124d5abb2cc055d251b06d129bca7be06f55b43dc13f6fd", + ".local/rust-block-column-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0" + }, + "rust_output_sha256": "6fc5753669a2770ba3b7fdc57cc1c42f191b5b1877cdecb35e43dc19054f2f70", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "6fc5753669a2770ba3b7fdc57cc1c42f191b5b1877cdecb35e43dc19054f2f70", + "matched_output_lines": 1204081 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "6fc5753669a2770ba3b7fdc57cc1c42f191b5b1877cdecb35e43dc19054f2f70", + "matched_output_lines": 1204081 + } + ], + "scope": "Native block-column feature codec and algorithms, with nonnegative height-provider validation, all candidate state descriptors, all six directions, both base/tip truncation orders, first obstruction beyond the origin, ordered predicate queries before writes, optional-provider fallback reads, rejected writes, partial failures, coordinate wrapping, named providers and nested feature/modifier composition. Both independent random streams and stored states are checked after repeated calls. A bounded runtime work budget rejects pathological million-operation traversals; actual chunks, neighbor updates and complete gameplay remain pending." +} diff --git a/crates/horizon-world/src/worldgen.rs b/crates/horizon-world/src/worldgen.rs index 45e7ad671..2f5cb5542 100644 --- a/crates/horizon-world/src/worldgen.rs +++ b/crates/horizon-world/src/worldgen.rs @@ -7,6 +7,7 @@ pub mod biome_chunk; pub mod biome_predicate; pub mod biome_source; pub mod biome_temperature; +pub mod block_column; pub mod block_feature; pub mod block_predicate; pub mod bulk_section; diff --git a/crates/horizon-world/src/worldgen/block_column.rs b/crates/horizon-world/src/worldgen/block_column.rs new file mode 100644 index 000000000..72a95c73c --- /dev/null +++ b/crates/horizon-world/src/worldgen/block_column.rs @@ -0,0 +1,186 @@ +//! Ordered column obstruction checks, layer truncation and provider writes. +use super::{ + DecodeError, Object, + block_feature::FeatureBlockBindings, + block_predicate::BlockPredicate, + feature::FeatureWorld, + placement::{PlacementContext, PlacementQueryError}, + required, + state_provider::{BlockStateProvider, StateProviderError}, + value_provider::IntProvider, +}; +use horizon_core::{ + geometry::Direction, + random::{InvalidBound, RandomSource}, +}; +use serde_json::value::RawValue; + +#[derive(Clone, Debug)] +struct Layer { + height: IntProvider, + provider: BlockStateProvider, +} +#[derive(Clone, Debug)] +pub struct BlockColumnFeature { + layers: Vec, + direction: Direction, + allowed: BlockPredicate, + prioritize_tip: bool, +} +#[derive(Debug)] +pub enum BlockColumnError { + Random(InvalidBound), + Provider(StateProviderError), + Query(PlacementQueryError), + World(E), + WorkLimit, +} +impl std::fmt::Display for BlockColumnError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Random(e) => e.fmt(f), + Self::Provider(e) => e.fmt(f), + Self::Query(e) => e.fmt(f), + Self::World(e) => e.fmt(f), + Self::WorkLimit => f.write_str("block column work limit exceeded"), + } + } +} +impl std::error::Error for BlockColumnError {} +impl BlockColumnFeature { + pub fn from_json(json: &str, bindings: &FeatureBlockBindings<'_>) -> Result { + Self::decode(json, bindings, 0, &mut 65536) + } + pub(crate) fn decode( + json: &str, + bindings: &FeatureBlockBindings<'_>, + depth: usize, + remaining: &mut usize, + ) -> Result { + if depth > 128 || *remaining == 0 { + return Err(DecodeError::Field("block column depth or work")); + } + *remaining -= 1; + let object: Object = serde_json::from_str(json)?; + let values: Vec> = serde_json::from_str(required(&object, "layers")?.get())?; + if values.len() > 8192 { + return Err(DecodeError::Field("block column layer count")); + } + let mut layers = Vec::with_capacity(values.len()); + for raw in values { + let layer: Object = serde_json::from_str(raw.get())?; + let height = IntProvider::decode(required(&layer, "height")?, depth + 1, remaining)?; + if height.bounds()[0] < 0 { + return Err(DecodeError::Field("negative block column height")); + } + let (providers, catalog, _) = bindings + .simple_blocks + .as_ref() + .ok_or(DecodeError::Field("block column provider bindings"))?; + let provider = catalog.provider_with_budget( + required(&layer, "provider")?.get(), + providers, + depth + 1, + remaining, + )?; + layers.push(Layer { height, provider }); + } + let name: String = serde_json::from_str(required(&object, "direction")?.get())?; + let direction = match name.as_str() { + "down" => Direction::Down, + "up" => Direction::Up, + "north" => Direction::North, + "south" => Direction::South, + "west" => Direction::West, + "east" => Direction::East, + _ => return Err(DecodeError::Field("block column direction")), + }; + let allowed = BlockPredicate::decode_with_blocks( + required(&object, "allowed_placement")?.get(), + depth + 1, + remaining, + Some(bindings), + )?; + let prioritize_tip = serde_json::from_str(required(&object, "prioritize_tip")?.get())?; + Ok(Self { + layers, + direction, + allowed, + prioritize_tip, + }) + } + pub fn place( + &self, + world: &mut W, + random: &mut impl RandomSource, + origin: [i32; 3], + ) -> Result> { + let mut heights = Vec::with_capacity(self.layers.len()); + let mut total = 0_i32; + for layer in &self.layers { + let height = layer + .height + .sample(random) + .map_err(BlockColumnError::Random)?; + total = total.wrapping_add(height); + heights.push(height); + } + if total == 0 { + return Ok(false); + } + let step = self.direction.normal(); + let advance = |p: [i32; 3]| std::array::from_fn(|i| p[i].wrapping_add(step[i])); + let mut query_position = advance(origin); + let mut budget = 1_048_576_usize; + for index in 0..total { + spend(&mut budget)?; + if !self + .allowed + .test(world, query_position) + .map_err(BlockColumnError::Query)? + { + truncate(&mut heights, total, index, self.prioritize_tip); + break; + } + query_position = advance(query_position); + } + let mut position = origin; + for (layer, height) in self.layers.iter().zip(heights) { + for _ in 0..height { + spend(&mut budget)?; + let state = layer + .provider + .get_state(world, random, position) + .map_err(BlockColumnError::Provider)?; + world + .set_block(position, state, 2) + .map_err(BlockColumnError::World)?; + position = advance(position); + } + } + Ok(true) + } +} +fn spend(budget: &mut usize) -> Result<(), BlockColumnError> { + if *budget == 0 { + return Err(BlockColumnError::WorkLimit); + } + *budget -= 1; + Ok(()) +} +fn truncate(heights: &mut [i32], total: i32, allowed: i32, prioritize_tip: bool) { + let mut remove = total.wrapping_sub(allowed); + for offset in 0..heights.len() { + if remove <= 0 { + break; + } + let index = if prioritize_tip { + offset + } else { + heights.len() - 1 - offset + }; + let count = heights[index].min(remove); + remove = remove.wrapping_sub(count); + heights[index] = heights[index].wrapping_sub(count); + } +} diff --git a/crates/horizon-world/src/worldgen/feature_graph.rs b/crates/horizon-world/src/worldgen/feature_graph.rs index 8e11f8b45..7ea1ae3d6 100644 --- a/crates/horizon-world/src/worldgen/feature_graph.rs +++ b/crates/horizon-world/src/worldgen/feature_graph.rs @@ -28,6 +28,7 @@ pub struct PlacedFeatureDefinition { #[derive(Clone, Debug)] pub enum FeatureDefinition { Basic(BasicFeature), + BlockColumn(super::block_column::BlockColumnFeature), SimpleBlock(super::simple_block::SimpleBlockFeature), FillLayer(FillLayerFeature), ReplaceBlock(ReplaceBlockFeature), @@ -45,6 +46,7 @@ pub enum FeatureDefinition { #[derive(Debug)] pub enum FeatureExecutionError { Basic(FeatureError), + BlockColumn(super::block_column::BlockColumnError), SimpleBlock(super::simple_block::SimpleBlockError), Random(InvalidBound), Query(PlacementQueryError), @@ -55,6 +57,7 @@ impl std::fmt::Display for FeatureExecutionError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Self::Basic(e) => e.fmt(f), + Self::BlockColumn(e) => e.fmt(f), Self::SimpleBlock(e) => e.fmt(f), Self::Random(e) => e.fmt(f), Self::Query(e) => e.fmt(f), @@ -221,6 +224,13 @@ impl FeatureDefinition { )?)?; match kind.as_str() { "minecraft:no_op" => Ok(Self::NoOp), + "minecraft:block_column" => super::block_column::BlockColumnFeature::decode( + json, + blocks.ok_or(DecodeError::Field("block column bindings unavailable"))?, + depth, + remaining, + ) + .map(Self::BlockColumn), "minecraft:simple_block" => { let (providers, catalog, placement) = blocks .and_then(|blocks| blocks.simple_blocks.as_ref()) @@ -405,6 +415,9 @@ impl FeatureDefinition { .place(world, random, origin, run.blocks) .map_err(FeatureExecutionError::Basic), Self::NoOp => Ok(true), + Self::BlockColumn(feature) => feature + .place(world, random, origin) + .map_err(FeatureExecutionError::BlockColumn), Self::SimpleBlock(feature) => feature .place(world, random, origin) .map_err(FeatureExecutionError::SimpleBlock), diff --git a/docs/feature-placement.md b/docs/feature-placement.md index 94995d0e6..21d9ab0b3 100644 --- a/docs/feature-placement.md +++ b/docs/feature-placement.md @@ -571,3 +571,23 @@ attachment/topper combinations, ordered reads/writes, both random streams, rejected writes, partial failures, wrapped coordinates and nested composition. Workspace tests and all-target Clippy passed. Native chunk updates, scheduled tick execution and complete playable integration remain pending. + + +## Block columns + +`BlockColumnFeature` samples all layer heights before checking space. Its first +obstruction query is one step beyond the origin. It removes excess height from +the base or tip in native order, then evaluates providers while writing the +remaining layers from the original position. Empty optional providers use their +ordinary fallback read; rejected writes still advance the position. A completely +zero-height sample returns false, while obstruction that trims every layer to +zero still returns true. + +The [block-column report](../benchmarks/rust-block-column-2026-10-06/scoped-parity.json) +records **1,204,081 matching lines per JAR** over **64,120 fixtures**. Run +`python3 tools/test_block_column_parity.py` to compare all candidate descriptors, +six directions, both truncation priorities, provider and predicate composition, +wrapped coordinates, codec bounds and partial mutations. This uses the same +feature/catalog integration and mutable-world harness as simple-block placement. +Layer/decode limits and a million-operation runtime budget reject pathological +workloads explicitly; complete resident-world integration remains pending. diff --git a/tools/test_block_column_parity.py b/tools/test_block_column_parity.py new file mode 100644 index 000000000..c15cd8a0f --- /dev/null +++ b/tools/test_block_column_parity.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python3 +"""Compare native block-column sampling, obstruction, truncation and writes.""" +import itertools +import json +try: + from . import test_simple_block_parity as harness +except ImportError: + import test_simple_block_parity as harness + + +def corpus(facts, placement): + states=facts['states'];get=lambda name:facts['defaults']['minecraft:'+name] + encode=lambda value:json.dumps(value,separators=(',',':')) + directions={'down':(0,-1,0),'up':(0,1,0),'north':(0,0,-1),'south':(0,0,1),'west':(-1,0,0),'east':(1,0,0)} + def feature(heights=(2,3,1),providers=({'id':'stone'},{'id':'water'},{'id':'pale_moss_carpet'}),direction='up',allowed=None,tip=False): + return {'type':'block_column','layers':[{'height':height,'provider':providers[i%len(providers)]} for i,height in enumerate(heights)],'direction':direction,'allowed_placement':allowed if allowed is not None else {'type':'true'},'prioritize_tip':tip} + def case(definition,**extra): + f={'definition':encode(definition),'mode':'feature','origin':[0,64,0],'legacy':False,'seed':0,'world_seed':1,'fail':-1,'reject':0,'brightness':15,'fallback':get('air'),'states':[],'repeats':2};f.update(extra);return f + for state in states:yield case(feature((1,),[state])) + heights=[[],[0],[1],[0,0],[0,2,0,1],[2,3,1],[{'type':'uniform','min_inclusive':0,'max_inclusive':3},1,{'type':'weighted_list','distribution':[{'data':0,'weight':1},{'data':3,'weight':2}]}]] + # The first allowed-placement test is one step beyond the origin. Truncation + # chooses base or tip layers before any provider is sampled or write occurs. + for direction,step in directions.items(): + for selected in heights: + for tip in [False,True]: + for blocked in range(9): + for legacy in [False,True]: + for seed in [0,-1,0x123456789abcdef]: + for fail in [-1,0,2,5,9]: + obstruction=[step[0]*blocked,64+step[1]*blocked,step[2]*blocked,get('stone')] + yield case(feature(selected,direction=direction,allowed={'type':'matching_blocks','blocks':['air']},tip=tip),states=[obstruction],legacy=legacy,seed=seed,fail=fail,reject=3 if seed else 0) + providers=[{'type':'random_block','blocks':[]},{'type':'random_block','blocks':['stone','water','pale_moss_carpet']},{'type':'rotated','state':{'id':'oak_log'}},{'type':'weighted','entries':[{'data':'stone','weight':1},{'data':'water','weight':2}]},'horizon:stone',{'type':'rule_based','rules':[]}] + for provider,direction,tip in itertools.product(providers,directions,[False,True]): + for legacy,seed,fail,reject in itertools.product([False,True],[0,-1,0x123456789abcdef],[-1,0,1,4],[0,1,3]): + yield case(feature([{'type':'uniform','min_inclusive':0,'max_inclusive':3},2,1],[provider],direction=direction,tip=tip),legacy=legacy,seed=seed,fail=fail,reject=reject,repeats=3) + predicates=[{'type':'true'},{'type':'not','predicate':{'type':'true'}},{'type':'solid'},{'type':'replaceable'},{'type':'has_sturdy_face','direction':'up'},{'type':'would_survive','state':'small_dripleaf'},{'type':'all_of','predicates':[{'type':'replaceable'},{'type':'would_survive','state':'pale_moss_carpet'}]}] + for predicate in predicates: + for neighbor in ['air','stone','water','clay','shulker_box','moving_piston','scaffolding']: + for fail in [-1,0,1,2,3,6]:yield case(feature(allowed=predicate),fallback=get(neighbor),fail=fail) + for origin in [[2147483647,2147483647,2147483647],[-2147483648,-2147483648,-2147483648],[-17,-64,-33]]: + for direction in directions:yield case(feature(direction=direction),origin=origin) + for key,values in [('layers',[None,False,[],[{}],[{'height':-1,'provider':{'id':'stone'}}],[{'height':1,'provider':None}],[{'height':1,'provider':'missing'}]]),('direction',[None,False,0,'UP','missing']),('allowed_placement',[None,{},True]),('prioritize_tip',[None,0,1,'true',False,True])]: + for value in values: + definition=feature();definition[key]=value;yield case(definition) + definition=feature();del definition[key];yield case(definition) + for provider in [-1,{'type':'uniform','min_inclusive':-1,'max_inclusive':2},{'type':'uniform','min_inclusive':0,'max_inclusive':2147483647},2147483647]: + # A false first obstruction permits huge positive heights to truncate + # without an enormous world traversal. + yield case(feature([provider],allowed={'type':'not','predicate':{'type':'true'}})) + for tip in [False,True]: + column=feature(tip=tip,allowed={'type':'matching_blocks','blocks':'air'}) + placed={'feature':column,'placement':[{'type':'count','count':2},{'type':'offset','x':1,'y':0,'z':-1}]} + for legacy,seed,fail,reject in itertools.product([False,True],[0,-1],[-1,0,3,8],[0,1,3]): + yield case(placed,mode='placed',legacy=legacy,seed=seed,fail=fail,reject=reject) + yield case({'type':'sequence','features':[placed,{'feature':'horizon:moss','placement':[]}]},legacy=legacy,seed=seed,fail=fail,reject=reject) + + +if __name__=='__main__': + harness.run(corpus,'rust-block-column-parity',__file__, + 'Native block-column feature codec and algorithms, with nonnegative height-provider validation, all candidate state descriptors, all six directions, both base/tip truncation orders, first obstruction beyond the origin, ordered predicate queries before writes, optional-provider fallback reads, rejected writes, partial failures, coordinate wrapping, named providers and nested feature/modifier composition. Both independent random streams and stored states are checked after repeated calls. A bounded runtime work budget rejects pathological million-operation traversals; actual chunks, neighbor updates and complete gameplay remain pending.') diff --git a/tools/test_simple_block_parity.py b/tools/test_simple_block_parity.py index b4e8bd30a..1f370e25c 100644 --- a/tools/test_simple_block_parity.py +++ b/tools/test_simple_block_parity.py @@ -86,13 +86,13 @@ def corpus(facts, placement): yield case(definition=encode(name),mode='placed') -def main(): +def run(corpus, build_name, source_file, scope): parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() - build=lab.LOCAL/'rust-simple-block-parity';build.mkdir(parents=True,exist_ok=True);report_path=build/'report.json';report_path.unlink(missing_ok=True) + build=lab.LOCAL/build_name;build.mkdir(parents=True,exist_ok=True);report_path=build/'report.json';report_path.unlink(missing_ok=True) if args.prepare:lab.prepare() lock,jars,libraries=base.verify_artifacts();oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java' helpers=[oracle.with_name(name+'.java') for name in ['VanillaPlacementOracle','VanillaBlockSurvivalOracle','VanillaBlockPropertiesOracle','VanillaBlockSupportOracle','VanillaBlockStateCodecOracle','VanillaCollisionOracle','VanillaHeightmapOracle']] - sources=[oracle,*helpers,Path(__file__),*[lab.ROOT/'tools'/name for name in ['test_block_survival_parity.py','test_worldgen_parity.py','test_rust_parity.py','lab.py']],lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/simple_block_fixture.rs'] + sources=[oracle,*helpers,Path(__file__),Path(source_file),*[lab.ROOT/'tools'/name for name in ['test_block_survival_parity.py','test_worldgen_parity.py','test_rust_parity.py','lab.py']],lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/simple_block_fixture.rs'] tested_sources=base.source_hashes(sources);classes=build/'classes';classes.mkdir(exist_ok=True) def run(command,name): with (build/(name+'.log')).open('w',encoding='utf-8') as log:subprocess.run(list(map(str,command)),cwd=lab.ROOT,check=True,timeout=3600,stdout=log,stderr=subprocess.STDOUT) @@ -122,8 +122,12 @@ def main(): java(side,side,build);matched=base.compare(build/(side+'.txt'),build/'rust.txt');print(f'{side}: {matched:,} simple-block output lines match Rust',flush=True) references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(build/(side+'.txt'),'sha256'),'matched_output_lines':matched}) base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixtures,tested_fixtures) - report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':fixture_count,'candidate_states':len(facts['states']),'double_plant_blocks':len(placement['double_plants']),'mossy_carpet_blocks':len(placement['mossy_carpets']),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Native SimpleBlockFeature map codec, provider selection, actual state survival and single/double-plant/moss placement. Named feature/placed-feature/provider holders, selectors, sequences and placement modifier chains compose the same operations. Mutable world logs ordered reads, fluid/light/entity queries, writes and flags, rejected writes, thrown failures, scheduled block identities, repeated placements and both feature/world random tails. All candidate states and every above-state obstruction for representative double-plant definitions, waterlogging, moss attachment combinations and topper identities are exercised. Registry definition classes and immutable geometry are independently checked in both authenticated JARs. Actual chunks, neighbor updates, scheduled tick execution, entity lifecycle, complete feature registries and playable worlds remain pending.'} + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':fixture_count,'candidate_states':len(facts['states']),'double_plant_blocks':len(placement['double_plants']),'mossy_carpet_blocks':len(placement['mossy_carpets']),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':scope} lab.write_json(report_path,report);print(f'Scoped simple-block parity passed: {report_path}',flush=True) +def main(): + run(corpus,'rust-simple-block-parity',__file__,'Native SimpleBlockFeature map codec, provider selection, actual state survival and single/double-plant/moss placement. Named feature/placed-feature/provider holders, selectors, sequences and placement modifier chains compose the same operations. Mutable world logs ordered reads, fluid/light/entity queries, writes and flags, rejected writes, thrown failures, scheduled block identities, repeated placements and both feature/world random tails. All candidate states and every above-state obstruction for representative double-plant definitions, waterlogging, moss attachment combinations and topper identities are exercised. Registry definition classes and immutable geometry are independently checked in both authenticated JARs. Actual chunks, neighbor updates, scheduled tick execution, entity lifecycle, complete feature registries and playable worlds remain pending.') + + if __name__=='__main__':main() From 83b5ace0fc3f5b23f2f80bdbe1fb6a4878d2a938 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 11:56:30 +0200 Subject: [PATCH 007/253] Implement vertical pillars and nested cap placement --- .github/workflows/ci.yml | 4 + .../rust-pillar-2026-10-06/scoped-parity.json | 203 ++++++++++++++++++ .../src/worldgen/feature_catalog.rs | 6 + .../src/worldgen/feature_graph.rs | 114 ++++++++++ docs/feature-placement.md | 18 ++ tools/test_pillar_parity.py | 41 ++++ 6 files changed, 386 insertions(+) create mode 100644 benchmarks/rust-pillar-2026-10-06/scoped-parity.json create mode 100644 tools/test_pillar_parity.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ce2a79769..20f026d41 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,6 +103,10 @@ jobs: env: RUSTUP_TOOLCHAIN: stable run: python tools/test_block_column_parity.py + - name: Compare vertical pillars and cap feature placement + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_pillar_parity.py - name: Compare ordered single-block replacement features env: RUSTUP_TOOLCHAIN: stable diff --git a/benchmarks/rust-pillar-2026-10-06/scoped-parity.json b/benchmarks/rust-pillar-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..cbf5df630 --- /dev/null +++ b/benchmarks/rust-pillar-2026-10-06/scoped-parity.json @@ -0,0 +1,203 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 41742, + "candidate_states": 35723, + "double_plant_blocks": 10, + "mossy_carpet_blocks": 1, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java": "82204d06e279275c5967f6d5fd80afe7416ba6c5f5ec19c682a30942f2fb6d7a", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSurvivalOracle.java": "4e7cc151617c1b02e872f9ca3e9fe4632379f225f4f07718ff6492df4ee551e7", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java": "99a396b9b983f6ca9149133251f3ece9aaf76d3d16dafa1f322378212a19490c", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSupportOracle.java": "04350901a2d708fb8fa672de61d058f73f332d2e90df1b93a67781862f89c1ad", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "60ff9ef7c1d5e23c080f9aec95ab2e7d3b7c5b5bcd67b9efa9518776c400629a", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_simple_block_parity.py": "8d789c02b88cfd019064b7407f886a2054d26554390a25f804773bb2197c6c35", + "tools/test_pillar_parity.py": "8fac172632ae35bacb83c39c8d166365b44b98d07b7a6913a15104c591c3f12a", + "tools/test_block_survival_parity.py": "9e8dff3bd4b95dbfd29f8adc6a2f6d66abf19a6b1cd91423b794a345d4ec244a", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b3caf26bd3afc9d10cdcca3f7e794c30abf5ba09afa1fe80ba8f44713acdb274", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "8a2834a9347ee2c2db7cf1c86a064907ec06e9ac16ba9cc3936e315fc4ad49ca", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "a8cd85f6223668c1446ff103276d80937b9707d9a7dc619a176b1b1ceed36a4a", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "2ea6d26fe88c633ad3efe7bdb6fc49f54961cbdf93b82919d79cf7d37a5c3c7d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "431c523593e7db1e1b3ef446f8f0400dade5a13a097633d590774c2b6ed7c08a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "198599a4c751df0e2dee52462f6b6e3df31ee6b90014fdf15a2e59c10ec5937d", + "crates/horizon-world/src/worldgen/feature_region.rs": "2c78e5f1bdb08307f8d982f231f1abbc3306cd54348d9023b86ee6ed3516fd33", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "e682d13a21f90605215b79f5d254bf2e524d35e89eab2e3b46384709af80b847", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "2fc100f8861fe0e0519a53dc4ae4a1eaa8a96aff2f6bf546ce613bdf665df237", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "2757f22706803afb3624afd65f4f5d05540acbc2bcb01f61e95fa40535575f0f", + "crates/horizon-world/examples/simple_block_fixture.rs": "d839de7fa2827189f8625903cedad84ab47c3e7384bed42e250f660f41d961dc" + }, + "fixtures_sha256": { + ".local/rust-pillar-parity/inputs.txt": "09bf497d889602d1f2bedbfbaddb131aa39c6879a2e019826dd645d96382f346", + ".local/rust-pillar-parity/block-properties.nbt": "1aba22092f70d16b8092014c058ddc210e4aaa77bac32f6ec62e4d0e91d92a99", + ".local/rust-pillar-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-pillar-parity/cached-collision.nbt": "f3a5c6a5b2d51dad6c52e486e2b9989e79fd55db1a9bda6196db399550b04078", + ".local/rust-pillar-parity/cached-support.nbt": "b6fdc9471b0b61e904206d3f099f4dc235aad6d723536c210be0cb7c3560d82c", + ".local/rust-pillar-parity/catalog.json": "93581107e3564e60261044fdca61e3b7f237b9e6724c14b86e335ccc01198ba9", + ".local/rust-pillar-parity/facts.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-pillar-parity/feature-catalog.json": "c048c761c5084a40560731955cc999a364d14055bdd86fa50989a92e4a771286", + ".local/rust-pillar-parity/fluid-tags.json": "f1e5eb6d22ea7effbb118a2282709cfdeef1bfae4516b775a55ad7a4df29d7d0", + ".local/rust-pillar-parity/placement-definitions.json": "f8a972ec87c2352500af6481158a3192bdbf699951025639bea744e4127b97c4", + ".local/rust-pillar-parity/support-cached-states.json": "353945a58fe69b352925473f1693f9b14a9ad19f13c15159c4184f2c29258622", + ".local/rust-pillar-parity/survival-classes.json": "361832008eea0aa9151d367a125a19c6353d99a0b88b27dd0682f55b7954553e", + ".local/rust-pillar-parity/survival-extra-definitions.json": "170f2db5bc97a49fa25cc249540aa7f04beea455cdbaf43742ed9415f5090a02", + ".local/rust-pillar-parity/survival-placement-classes.json": "7fdbf48ab18c87098bbe1b6176cb81f4842b6c5d9a4d6bbaf7037ff61cb1848c", + ".local/rust-pillar-parity/survival-rules.json": "8805c18b3195bb1eac1f1e5281333df56e2892505f64023e5403c58ce2ec4368", + ".local/rust-pillar-parity/survival-support-tags.json": "15d88d5bb5ad10d65124d5abb2cc055d251b06d129bca7be06f55b43dc13f6fd", + ".local/rust-pillar-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0" + }, + "rust_output_sha256": "02bfd7e92539a357079e26d27058020f302e5f42c50e5cf3e3ff42967949796d", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "02bfd7e92539a357079e26d27058020f302e5f42c50e5cf3e3ff42967949796d", + "matched_output_lines": 921075 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "02bfd7e92539a357079e26d27058020f302e5f42c50e5cf3e3ff42967949796d", + "matched_output_lines": 921075 + } + ], + "scope": "Native single-block pillar codec and placement, all provider state descriptors, upward/downward traversal, replacement predicates before continuation draws, bounds checks after draws, cap placement one opposite step from the stopping position even when no column block was placed, ignored rejected writes and cap false results, partial failures, coordinate wrapping, independent world random stream, named holders, nested pillars and feature sequences. Shared graph work limits bound pathological traversals. Actual resident chunks, neighbor updates and complete gameplay remain pending." +} diff --git a/crates/horizon-world/src/worldgen/feature_catalog.rs b/crates/horizon-world/src/worldgen/feature_catalog.rs index ebdf29c4f..626cd50fa 100644 --- a/crates/horizon-world/src/worldgen/feature_catalog.rs +++ b/crates/horizon-world/src/worldgen/feature_catalog.rs @@ -228,6 +228,12 @@ impl FeatureCatalog { required(&object, "type")?.get(), )?)?; match kind.as_str() { + "minecraft:single_block_pillar" => { + if let Some(value) = super::optional(&object, "cap_feature") { + let expanded = self.expand_placed(value, depth + 1, work)?; + object.insert("cap_feature".into(), raw(expanded)?); + } + } "minecraft:sequence" | "minecraft:simple_random_selector" => { let expanded = self.expand_set(required(&object, "features")?, depth + 1, work)?; object.insert("features".into(), raw(expanded)?); diff --git a/crates/horizon-world/src/worldgen/feature_graph.rs b/crates/horizon-world/src/worldgen/feature_graph.rs index 7ea1ae3d6..c1302713b 100644 --- a/crates/horizon-world/src/worldgen/feature_graph.rs +++ b/crates/horizon-world/src/worldgen/feature_graph.rs @@ -28,6 +28,13 @@ pub struct PlacedFeatureDefinition { #[derive(Clone, Debug)] pub enum FeatureDefinition { Basic(BasicFeature), + Pillar { + provider: super::state_provider::BlockStateProvider, + can_replace: super::block_predicate::BlockPredicate, + direction: horizon_core::geometry::Direction, + chance: f32, + cap: Option>, + }, BlockColumn(super::block_column::BlockColumnFeature), SimpleBlock(super::simple_block::SimpleBlockFeature), FillLayer(FillLayerFeature), @@ -46,6 +53,7 @@ pub enum FeatureDefinition { #[derive(Debug)] pub enum FeatureExecutionError { Basic(FeatureError), + Provider(super::state_provider::StateProviderError), BlockColumn(super::block_column::BlockColumnError), SimpleBlock(super::simple_block::SimpleBlockError), Random(InvalidBound), @@ -57,6 +65,7 @@ impl std::fmt::Display for FeatureExecutionError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Self::Basic(e) => e.fmt(f), + Self::Provider(e) => e.fmt(f), Self::BlockColumn(e) => e.fmt(f), Self::SimpleBlock(e) => e.fmt(f), Self::Random(e) => e.fmt(f), @@ -224,6 +233,68 @@ impl FeatureDefinition { )?)?; match kind.as_str() { "minecraft:no_op" => Ok(Self::NoOp), + "minecraft:single_block_pillar" => { + let bindings = + blocks.ok_or(DecodeError::Field("pillar block bindings unavailable"))?; + let (providers, catalog, _) = bindings + .simple_blocks + .as_ref() + .ok_or(DecodeError::Field("pillar provider bindings unavailable"))?; + let provider = catalog.provider_with_budget( + required(&object, "block")?.get(), + providers, + depth + 1, + remaining, + )?; + let can_replace = match super::optional(&object, "can_replace") { + Some(raw) => super::block_predicate::BlockPredicate::decode_with_blocks( + raw.get(), + depth + 1, + remaining, + Some(bindings), + )?, + None => { + super::block_predicate::BlockPredicate::from_json(r#"{"type":"true"}"#)? + } + }; + let direction = + match serde_json::from_str::(required(&object, "direction")?.get())? + .as_str() + { + "up" => horizon_core::geometry::Direction::Up, + "down" => horizon_core::geometry::Direction::Down, + _ => return Err(DecodeError::Field("pillar vertical direction")), + }; + let chance = match super::optional(&object, "chance_to_continue") { + Some(raw) => number_text(raw)? + .parse::() + .map_err(|_| DecodeError::Field("pillar chance"))? + as f32, + None => 1.0, + }; + if !(0.0..=1.0).contains(&chance) { + return Err(DecodeError::Field("pillar chance")); + } + let cap = super::optional(&object, "cap_feature") + .map(|raw| { + PlacedFeatureDefinition::decode( + raw.get(), + depth + 1, + remaining, + empty_tags, + blocks, + ) + .map(Box::new) + }) + .transpose()?; + Ok(Self::Pillar { + provider, + can_replace, + direction, + chance, + cap, + }) + } "minecraft:block_column" => super::block_column::BlockColumnFeature::decode( json, blocks.ok_or(DecodeError::Field("block column bindings unavailable"))?, @@ -415,6 +486,49 @@ impl FeatureDefinition { .place(world, random, origin, run.blocks) .map_err(FeatureExecutionError::Basic), Self::NoOp => Ok(true), + Self::Pillar { + provider, + can_replace, + direction, + chance, + cap, + } => { + let mut position = origin; + let step = direction.normal(); + loop { + if run.remaining.get() == 0 { + return Err(FeatureExecutionError::WorkLimit); + } + run.remaining.set(run.remaining.get() - 1); + if !can_replace + .test(world, position) + .map_err(FeatureExecutionError::Query)? + { + break; + } + if random.next_float() >= *chance { + break; + } + if world + .outside_build_height(position[1]) + .map_err(FeatureExecutionError::Query)? + { + break; + } + let state = provider + .get_state(world, random, position) + .map_err(FeatureExecutionError::Provider)?; + world + .set_block(position, state, 2) + .map_err(|e| FeatureExecutionError::Basic(FeatureError::World(e)))?; + position = std::array::from_fn(|i| position[i].wrapping_add(step[i])); + } + position = std::array::from_fn(|i| position[i].wrapping_sub(step[i])); + if let Some(cap) = cap { + cap.place_in(&mut placer, world, random, position, run)?; + } + Ok(true) + } Self::BlockColumn(feature) => feature .place(world, random, origin) .map_err(FeatureExecutionError::BlockColumn), diff --git a/docs/feature-placement.md b/docs/feature-placement.md index 21d9ab0b3..aaf498d9b 100644 --- a/docs/feature-placement.md +++ b/docs/feature-placement.md @@ -591,3 +591,21 @@ wrapped coordinates, codec bounds and partial mutations. This uses the same feature/catalog integration and mutable-world harness as simple-block placement. Layer/decode limits and a million-operation runtime budget reject pathological workloads explicitly; complete resident-world integration remains pending. + + +## Vertical pillars + +The single-block pillar feature checks its replacement predicate, consumes its +continuation draw, and then checks build height before evaluating and writing +each provider state. Its cap runs one step opposite the stopping position, +including when no pillar block was written. Rejected writes still advance the +pillar, and a cap's false result does not make the pillar return false. Named caps +and nested pillars use the same feature catalog and graph work budget. + +Run `python3 tools/test_pillar_parity.py`. The +[pillar report](../benchmarks/rust-pillar-2026-10-06/scoped-parity.json) records +**921,075 matching lines per JAR** across **41,742 fixtures**, including every +candidate descriptor, both vertical directions, continuation boundaries, +replacement conditions, cap composition, failures, rejected writes and random +stream tails. Workspace tests and all-target Clippy passed. Resident world +updates and complete generation/gameplay remain unfinished. diff --git a/tools/test_pillar_parity.py b/tools/test_pillar_parity.py new file mode 100644 index 000000000..4f8266ece --- /dev/null +++ b/tools/test_pillar_parity.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python3 +"""Compare vertical pillars, cap placement and early-exit random consumption.""" +import itertools +import json +try: + from . import test_simple_block_parity as harness +except ImportError: + import test_simple_block_parity as harness + + +def corpus(facts,placement): + states=facts['states'];get=lambda name:facts['defaults']['minecraft:'+name] + def pillar(block=None,**extra): + definition={'type':'single_block_pillar','block':block if block is not None else {'id':'stone'},'direction':'up'};definition.update(extra);return definition + def case(definition,**extra): + f={'definition':json.dumps(definition,separators=(',',':')),'mode':'feature','origin':[0,318,0],'legacy':False,'seed':0,'world_seed':1,'fail':-1,'reject':0,'brightness':15,'fallback':get('air'),'states':[],'repeats':2};f.update(extra);return f + for state in states:yield case(pillar(state)) + providers=[{'id':'stone'},{'id':'water'},{'type':'random_block','blocks':[]},{'type':'random_block','blocks':['stone','pale_moss_carpet']},{'type':'rotated','state':{'id':'oak_log'}},'horizon:stone'] + caps=[None,'horizon:moss','horizon:empty',{'feature':{'type':'no_op'},'placement':[]},{'feature':'horizon:stone','placement':[{'type':'count','count':2}]},{'feature':{'type':'block_column','layers':[{'height':2,'provider':{'id':'water'}}],'direction':'down','allowed_placement':{'type':'true'},'prioritize_tip':True},'placement':[]}] + for direction,chance,cap in itertools.product(['up','down'],[0.0,0.000001,0.25,0.5,0.999999,1.0],caps): + for legacy,seed,fail,reject in itertools.product([False,True],[0,-1,0x123456789abcdef],[-1,0,2,5],[0,1,3]): + definition=pillar({'type':'random_block','blocks':['stone','water']},direction=direction,chance_to_continue=chance,cap_feature=cap) + yield case(definition,origin=[0,316 if direction=='up' else -61,0],legacy=legacy,seed=seed,world_seed=seed,fail=fail,reject=reject) + predicates=[{'type':'true'},{'type':'not','predicate':{'type':'true'}},{'type':'matching_blocks','blocks':'air'},{'type':'would_survive','state':'pale_moss_carpet'},{'type':'has_sturdy_face','direction':'up'},{'type':'replaceable'}] + for provider,predicate,neighbor,fail in itertools.product(providers,predicates,['air','stone','water','shulker_box'],[-1,0,1,2,5]): + yield case(pillar(provider,can_replace=predicate,cap_feature='horizon:moss'),fallback=get(neighbor),fail=fail) + for origin,direction,chance in itertools.product([[0,-65,0],[0,-64,0],[0,319,0],[0,320,0],[2147483647,-2147483648,-2147483648],[-2147483648,2147483647,2147483647]],['up','down'],[0.0,0.5,1.0]): + yield case(pillar(direction=direction,chance_to_continue=chance,cap_feature='horizon:stone'),origin=origin) + for key,values in [('block',[None,False,0,{},'missing']),('can_replace',[None,False,0,{}, {'type':'true'}]),('direction',[None,'north','UP',False,0]),('chance_to_continue',[None,False,'0.5',-0.01,1.01,0,1]),('cap_feature',[None,'missing',{},False])]: + for value in values: + definition=pillar();definition[key]=value;yield case(definition) + definition=pillar();definition.pop(key,None);yield case(definition) + nested=pillar(chance_to_continue=0,cap_feature={'feature':pillar(direction='down',chance_to_continue=0.5,cap_feature='horizon:stone'),'placement':[{'type':'count','count':2}]}) + for legacy,seed,fail in itertools.product([False,True],[0,-1,0x123456789abcdef],[-1,0,1,4]): + yield case(nested,origin=[0,-61,0],legacy=legacy,seed=seed,fail=fail) + yield case({'type':'sequence','features':[{'feature':nested,'placement':[]},{'feature':'horizon:stone','placement':[]}]},origin=[0,-61,0],legacy=legacy,seed=seed,fail=fail) + + +if __name__=='__main__': + harness.run(corpus,'rust-pillar-parity',__file__, + 'Native single-block pillar codec and placement, all provider state descriptors, upward/downward traversal, replacement predicates before continuation draws, bounds checks after draws, cap placement one opposite step from the stopping position even when no column block was placed, ignored rejected writes and cap false results, partial failures, coordinate wrapping, independent world random stream, named holders, nested pillars and feature sequences. Shared graph work limits bound pathological traversals. Actual resident chunks, neighbor updates and complete gameplay remain pending.') From 5a1044f3fc7f57c4f89a5a118ba76540292de9f0 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 11:57:55 +0200 Subject: [PATCH 008/253] Implement vanilla neighbor-based feature spreading --- .github/workflows/ci.yml | 4 + .../scoped-parity.json | 203 ++++++++++++++++++ .../src/worldgen/feature_graph.rs | 111 ++++++++++ docs/feature-placement.md | 17 ++ tools/test_neighbor_spread_parity.py | 43 ++++ 5 files changed, 378 insertions(+) create mode 100644 benchmarks/rust-neighbor-spread-2026-10-06/scoped-parity.json create mode 100644 tools/test_neighbor_spread_parity.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 20f026d41..b2911407e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -107,6 +107,10 @@ jobs: env: RUSTUP_TOOLCHAIN: stable run: python tools/test_pillar_parity.py + - name: Compare exactly-one-neighbor feature spreading + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_neighbor_spread_parity.py - name: Compare ordered single-block replacement features env: RUSTUP_TOOLCHAIN: stable diff --git a/benchmarks/rust-neighbor-spread-2026-10-06/scoped-parity.json b/benchmarks/rust-neighbor-spread-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..a281b076f --- /dev/null +++ b/benchmarks/rust-neighbor-spread-2026-10-06/scoped-parity.json @@ -0,0 +1,203 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 79580, + "candidate_states": 35723, + "double_plant_blocks": 10, + "mossy_carpet_blocks": 1, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java": "82204d06e279275c5967f6d5fd80afe7416ba6c5f5ec19c682a30942f2fb6d7a", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSurvivalOracle.java": "4e7cc151617c1b02e872f9ca3e9fe4632379f225f4f07718ff6492df4ee551e7", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java": "99a396b9b983f6ca9149133251f3ece9aaf76d3d16dafa1f322378212a19490c", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSupportOracle.java": "04350901a2d708fb8fa672de61d058f73f332d2e90df1b93a67781862f89c1ad", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "60ff9ef7c1d5e23c080f9aec95ab2e7d3b7c5b5bcd67b9efa9518776c400629a", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_simple_block_parity.py": "8d789c02b88cfd019064b7407f886a2054d26554390a25f804773bb2197c6c35", + "tools/test_neighbor_spread_parity.py": "67f1a5381470b819345b547f414ee72ed7c820809f7983bd21ad3c99efe9abe9", + "tools/test_block_survival_parity.py": "9e8dff3bd4b95dbfd29f8adc6a2f6d66abf19a6b1cd91423b794a345d4ec244a", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b3caf26bd3afc9d10cdcca3f7e794c30abf5ba09afa1fe80ba8f44713acdb274", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "8a2834a9347ee2c2db7cf1c86a064907ec06e9ac16ba9cc3936e315fc4ad49ca", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "a8cd85f6223668c1446ff103276d80937b9707d9a7dc619a176b1b1ceed36a4a", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "2ea6d26fe88c633ad3efe7bdb6fc49f54961cbdf93b82919d79cf7d37a5c3c7d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "431c523593e7db1e1b3ef446f8f0400dade5a13a097633d590774c2b6ed7c08a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "837c2756f10e344899418dca43b40c99662512910f7b3d60b7489dcfcf47177a", + "crates/horizon-world/src/worldgen/feature_region.rs": "2c78e5f1bdb08307f8d982f231f1abbc3306cd54348d9023b86ee6ed3516fd33", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "e682d13a21f90605215b79f5d254bf2e524d35e89eab2e3b46384709af80b847", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "2fc100f8861fe0e0519a53dc4ae4a1eaa8a96aff2f6bf546ce613bdf665df237", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "2757f22706803afb3624afd65f4f5d05540acbc2bcb01f61e95fa40535575f0f", + "crates/horizon-world/examples/simple_block_fixture.rs": "d839de7fa2827189f8625903cedad84ab47c3e7384bed42e250f660f41d961dc" + }, + "fixtures_sha256": { + ".local/rust-neighbor-spread-parity/inputs.txt": "d625d0b563b8cd9f6f081baeb4e302fcd6086d757c8a5367398c389e51c0782a", + ".local/rust-neighbor-spread-parity/block-properties.nbt": "1aba22092f70d16b8092014c058ddc210e4aaa77bac32f6ec62e4d0e91d92a99", + ".local/rust-neighbor-spread-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-neighbor-spread-parity/cached-collision.nbt": "f3a5c6a5b2d51dad6c52e486e2b9989e79fd55db1a9bda6196db399550b04078", + ".local/rust-neighbor-spread-parity/cached-support.nbt": "b6fdc9471b0b61e904206d3f099f4dc235aad6d723536c210be0cb7c3560d82c", + ".local/rust-neighbor-spread-parity/catalog.json": "93581107e3564e60261044fdca61e3b7f237b9e6724c14b86e335ccc01198ba9", + ".local/rust-neighbor-spread-parity/facts.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-neighbor-spread-parity/feature-catalog.json": "c048c761c5084a40560731955cc999a364d14055bdd86fa50989a92e4a771286", + ".local/rust-neighbor-spread-parity/fluid-tags.json": "f1e5eb6d22ea7effbb118a2282709cfdeef1bfae4516b775a55ad7a4df29d7d0", + ".local/rust-neighbor-spread-parity/placement-definitions.json": "f8a972ec87c2352500af6481158a3192bdbf699951025639bea744e4127b97c4", + ".local/rust-neighbor-spread-parity/support-cached-states.json": "353945a58fe69b352925473f1693f9b14a9ad19f13c15159c4184f2c29258622", + ".local/rust-neighbor-spread-parity/survival-classes.json": "361832008eea0aa9151d367a125a19c6353d99a0b88b27dd0682f55b7954553e", + ".local/rust-neighbor-spread-parity/survival-extra-definitions.json": "170f2db5bc97a49fa25cc249540aa7f04beea455cdbaf43742ed9415f5090a02", + ".local/rust-neighbor-spread-parity/survival-placement-classes.json": "7fdbf48ab18c87098bbe1b6176cb81f4842b6c5d9a4d6bbaf7037ff61cb1848c", + ".local/rust-neighbor-spread-parity/survival-rules.json": "8805c18b3195bb1eac1f1e5281333df56e2892505f64023e5403c58ce2ec4368", + ".local/rust-neighbor-spread-parity/survival-support-tags.json": "15d88d5bb5ad10d65124d5abb2cc055d251b06d129bca7be06f55b43dc13f6fd", + ".local/rust-neighbor-spread-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0" + }, + "rust_output_sha256": "e0a7c75ecb6274b4d68a479dc6da0a44ba847fbb1983e6b1aa8cff62a0295ebb", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "e0a7c75ecb6274b4d68a479dc6da0a44ba847fbb1983e6b1aa8cff62a0295ebb", + "matched_output_lines": 2650856 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "e0a7c75ecb6274b4d68a479dc6da0a44ba847fbb1983e6b1aa8cff62a0295ebb", + "matched_output_lines": 2650856 + } + ], + "scope": "Native random-neighbor-spread codecs and placement. Origin provider evaluation/write precedes attempt sampling and all replacement checks. X/Y/Z offsets retain sample order. Every candidate state and every potential neighbor state, all six-direction acceptance masks, exactly-one acceptance and early exit after a second match, bounded provider codec ranges, empty/named holder sets, optional-provider fallback reads, mutable spread across repeated attempts, rejected writes, partial failures, wrapped positions, both random modes and composed feature/modifier calls are compared. Actual chunks, neighbor callbacks and complete gameplay remain pending." +} diff --git a/crates/horizon-world/src/worldgen/feature_graph.rs b/crates/horizon-world/src/worldgen/feature_graph.rs index c1302713b..0e5293f1b 100644 --- a/crates/horizon-world/src/worldgen/feature_graph.rs +++ b/crates/horizon-world/src/worldgen/feature_graph.rs @@ -1,5 +1,6 @@ //! Inline feature composition. Named holders, tags and registry reloads remain //! separate from this bounded executable tree. +use super::block_predicate::PredicateBlockResolver; use super::{ DecodeError, Object, block_feature::{ @@ -28,6 +29,14 @@ pub struct PlacedFeatureDefinition { #[derive(Clone, Debug)] pub enum FeatureDefinition { Basic(BasicFeature), + NeighborSpread { + provider: super::state_provider::BlockStateProvider, + neighbors: std::sync::Arc>, + can_replace: super::block_predicate::BlockPredicate, + attempts: super::value_provider::IntProvider, + xz_offset: super::value_provider::IntProvider, + y_offset: super::value_provider::IntProvider, + }, Pillar { provider: super::state_provider::BlockStateProvider, can_replace: super::block_predicate::BlockPredicate, @@ -233,6 +242,51 @@ impl FeatureDefinition { )?)?; match kind.as_str() { "minecraft:no_op" => Ok(Self::NoOp), + "minecraft:random_neighbor_spread" => { + let bindings = + blocks.ok_or(DecodeError::Field("neighbor spread block bindings"))?; + let (providers, catalog, _) = bindings + .simple_blocks + .as_ref() + .ok_or(DecodeError::Field("neighbor spread provider bindings"))?; + let provider = catalog.provider_with_budget( + required(&object, "block")?.get(), + providers, + depth + 1, + remaining, + )?; + let neighbors = + bindings.predicate_block_set(required(&object, "accepted_neighbors")?.get())?; + let can_replace = super::block_predicate::BlockPredicate::decode_with_blocks( + required(&object, "can_replace")?.get(), + depth + 1, + remaining, + Some(bindings), + )?; + let mut integer = |name, low, high| { + let value = super::value_provider::IntProvider::decode( + required(&object, name)?, + depth + 1, + remaining, + )?; + let bounds = value.bounds(); + if bounds[0] < low || bounds[1] > high { + return Err(DecodeError::Field("neighbor spread integer range")); + } + Ok(value) + }; + let attempts = integer("attempts", 1, 3000)?; + let xz_offset = integer("xz_offset", -16, 16)?; + let y_offset = integer("y_offset", -16, 16)?; + Ok(Self::NeighborSpread { + provider, + neighbors, + can_replace, + attempts, + xz_offset, + y_offset, + }) + } "minecraft:single_block_pillar" => { let bindings = blocks.ok_or(DecodeError::Field("pillar block bindings unavailable"))?; @@ -486,6 +540,63 @@ impl FeatureDefinition { .place(world, random, origin, run.blocks) .map_err(FeatureExecutionError::Basic), Self::NoOp => Ok(true), + Self::NeighborSpread { + provider, + neighbors, + can_replace, + attempts, + xz_offset, + y_offset, + } => { + let state = provider + .get_state(world, random, origin) + .map_err(FeatureExecutionError::Provider)?; + world + .set_block(origin, state, 2) + .map_err(|e| FeatureExecutionError::Basic(FeatureError::World(e)))?; + let count = attempts.sample(random)?; + for _ in 0..count { + if run.remaining.get() == 0 { + return Err(FeatureExecutionError::WorkLimit); + } + run.remaining.set(run.remaining.get() - 1); + let dx = xz_offset.sample(random)?; + let dy = y_offset.sample(random)?; + let dz = xz_offset.sample(random)?; + let position = [ + origin[0].wrapping_add(dx), + origin[1].wrapping_add(dy), + origin[2].wrapping_add(dz), + ]; + if !can_replace + .test(world, position) + .map_err(FeatureExecutionError::Query)? + { + continue; + } + let mut found = 0; + for direction in horizon_core::geometry::Direction::ALL { + let step = direction.normal(); + let neighbor = std::array::from_fn(|i| position[i].wrapping_add(step[i])); + let state = world + .block(neighbor) + .map_err(|e| FeatureExecutionError::Basic(FeatureError::World(e)))?; + found += i32::from(neighbors.contains(&state)); + if found > 1 { + break; + } + } + if found == 1 { + let state = provider + .get_state(world, random, position) + .map_err(FeatureExecutionError::Provider)?; + world + .set_block(position, state, 2) + .map_err(|e| FeatureExecutionError::Basic(FeatureError::World(e)))?; + } + } + Ok(true) + } Self::Pillar { provider, can_replace, diff --git a/docs/feature-placement.md b/docs/feature-placement.md index aaf498d9b..dd8158402 100644 --- a/docs/feature-placement.md +++ b/docs/feature-placement.md @@ -609,3 +609,20 @@ candidate descriptor, both vertical directions, continuation boundaries, replacement conditions, cap composition, failures, rejected writes and random stream tails. Workspace tests and all-target Clippy passed. Resident world updates and complete generation/gameplay remain unfinished. + + +## Neighbor-based spreading + +The random-neighbor-spread feature evaluates and writes its origin provider before +sampling attempts or testing replacement. Each attempt samples X, Y and Z offsets +in order, checks replacement, then visits neighbors in native direction order. +Exactly one accepted neighbor allows placement; finding a second stops the scan. +Rejected writes preserve the same subsequent queries and random consumption. + +The [neighbor-spread report](../benchmarks/rust-neighbor-spread-2026-10-06/scoped-parity.json) +records **2,650,856 matching lines per JAR** across **79,580 fixtures**. Run +`python3 tools/test_neighbor_spread_parity.py` to compare all candidate and neighbor +states, all direction masks, bounded integer providers, named/empty holder sets, +mutable repeated attempts, partial failures and nested feature/modifier calls. +Workspace tests and all-target Clippy passed. These feature algorithms still +require complete chunk mutation, neighbor updates and gameplay integration. diff --git a/tools/test_neighbor_spread_parity.py b/tools/test_neighbor_spread_parity.py new file mode 100644 index 000000000..2d6295a41 --- /dev/null +++ b/tools/test_neighbor_spread_parity.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python3 +"""Compare origin placement and exactly-one-neighbor spread behavior.""" +import itertools +import json +try: + from . import test_simple_block_parity as harness +except ImportError: + import test_simple_block_parity as harness + + +def corpus(facts,placement): + states=facts['states'];get=lambda name:facts['defaults']['minecraft:'+name] + directions=[(0,-1,0),(0,1,0),(0,0,-1),(0,0,1),(-1,0,0),(1,0,0)] + def spread(block=None,**extra): + value={'type':'random_neighbor_spread','block':block if block is not None else {'id':'stone'},'accepted_neighbors':'stone','can_replace':{'type':'true'},'attempts':1,'xz_offset':0,'y_offset':0};value.update(extra);return value + def case(definition,**extra): + value={'definition':json.dumps(definition,separators=(',',':')),'mode':'feature','origin':[0,64,0],'legacy':False,'seed':0,'world_seed':1,'fail':-1,'reject':0,'brightness':15,'fallback':get('air'),'states':[],'repeats':2};value.update(extra);return value + for state in states:yield case(spread(state)) + for mask,attempts,fail,reject in itertools.product(range(64),[1,2,3],[-1,*range(9)],[0,1,3]): + initial=[[x,64+y,z,get('stone') if mask&(1< Date: Tue, 6 Oct 2026 12:07:41 +0200 Subject: [PATCH 009/253] Accelerate large differential trace comparisons --- tests/test_rust_parity.py | 30 ++++++++++++++++++++++++++++++ tools/test_rust_parity.py | 27 ++++++++++++++++++++------- 2 files changed, 50 insertions(+), 7 deletions(-) diff --git a/tests/test_rust_parity.py b/tests/test_rust_parity.py index 3efc9de1c..b14723c16 100644 --- a/tests/test_rust_parity.py +++ b/tests/test_rust_parity.py @@ -37,6 +37,36 @@ class ParityRunnerTests(unittest.TestCase): right.write_text(left.read_text()) self.assertEqual(parity.compare(left, right), 2) + def test_chunk_comparison_preserves_newlines_unicode_and_unterminated_lines(self): + cases = [ + ("one", "one", 1), + ("\n\n", "\n\n", 2), + ("one\r\ntwo\r", "one\ntwo\n", 2), + ("α" * (1024 * 1024 + 1) + "\r\nlast", "α" * (1024 * 1024 + 1) + "\nlast", 2), + ("same\n" * 220000 + "tail", "same\n" * 220000 + "tail", 220001), + ] + with tempfile.TemporaryDirectory() as temp: + left, right = Path(temp) / "reference", Path(temp) / "candidate" + for reference, candidate, count in cases: + left.write_bytes(reference.encode("utf-8")) + right.write_bytes(candidate.encode("utf-8")) + self.assertEqual(parity.compare(left, right), count) + + def test_chunk_mismatch_retains_exact_first_line_diagnostic(self): + prefix = "same\n" * 220000 + cases = [("expected\n", "actual\n", "'expected\\n'", "'actual\\n'"), + ("tail", "tail\n", "'tail'", "'tail\\n'"), + ("extra\n", "", "'extra\\n'", "None")] + with tempfile.TemporaryDirectory() as temp: + left, right = Path(temp) / "reference", Path(temp) / "candidate" + for reference, candidate, expected, actual in cases: + left.write_text(prefix + reference) + right.write_text(prefix + candidate) + with self.assertRaises(AssertionError) as caught: + parity.compare(left, right) + self.assertEqual(str(caught.exception), + f"Parity mismatch at output line 220001: vanilla={expected}, Rust={actual}") + def test_failed_artifact_verification_removes_previous_success(self): with tempfile.TemporaryDirectory() as temp: local = Path(temp) diff --git a/tools/test_rust_parity.py b/tools/test_rust_parity.py index 21b013b57..beffc2baa 100644 --- a/tools/test_rust_parity.py +++ b/tools/test_rust_parity.py @@ -103,15 +103,28 @@ def verify_artifacts(): def compare(reference, candidate): + # Text mode retains cross-platform universal-newline behavior. Equal chunks + # avoid a Python loop for every line in multi-gigabyte differential traces. count = 0 - with reference.open(encoding="utf-8") as expected, candidate.open(encoding="utf-8") as actual: - for count, (left, right) in enumerate(itertools.zip_longest(expected, actual), 1): + last = '' + with reference.open(encoding='utf-8') as expected, candidate.open(encoding='utf-8') as actual: + while True: + left, right = expected.read(1024 * 1024), actual.read(1024 * 1024) if left != right: - raise AssertionError(f"Parity mismatch at output line {count}: vanilla={left!r}, Rust={right!r}") - if count == 0: - raise AssertionError("Empty output cannot establish parity") - return count - + break + if not left: + if not last: + raise AssertionError('Empty output cannot establish parity') + return count + (last != '\n') + count += left.count('\n') + last = left[-1] + # Preserve the existing exact first-line mismatch diagnostic. Mismatches are + # exceptional; successful runs use only the bounded chunk buffers above. + with reference.open(encoding='utf-8') as expected, candidate.open(encoding='utf-8') as actual: + for line, (left, right) in enumerate(itertools.zip_longest(expected, actual), 1): + if left != right: + raise AssertionError(f'Parity mismatch at output line {line}: vanilla={left!r}, Rust={right!r}') + raise AssertionError('Parity outputs changed during comparison') def run(command, **kwargs): subprocess.run(command, cwd=lab.ROOT, check=True, timeout=300, **kwargs) From 895af92d1243783478e3e5fbd3c6af6075ee58f5 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 12:13:34 +0200 Subject: [PATCH 010/253] Implement ordered overlay feature composition --- .../scoped-parity.json | 72 +++++++++------- .../scoped-parity.json | 85 ++++++++++++------- .../src/worldgen/feature_catalog.rs | 2 +- .../src/worldgen/feature_graph.rs | 26 ++++-- docs/rust-parity.md | 16 ++++ tests/test_feature_catalog_parity.py | 4 +- tests/test_feature_graph_parity.py | 2 +- tools/test_feature_catalog_parity.py | 8 +- tools/test_feature_graph_parity.py | 12 ++- 9 files changed, 147 insertions(+), 80 deletions(-) diff --git a/benchmarks/rust-feature-catalog-2026-10-06/scoped-parity.json b/benchmarks/rust-feature-catalog-2026-10-06/scoped-parity.json index f7dc0483a..e4c6b60df 100644 --- a/benchmarks/rust-feature-catalog-2026-10-06/scoped-parity.json +++ b/benchmarks/rust-feature-catalog-2026-10-06/scoped-parity.json @@ -5,27 +5,27 @@ "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", "java": "openjdk 25.0.4.1 2026-08-18", "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", - "fixtures": 6408, + "fixtures": 7488, "worldgen_random_modes": [ false, true ], "basic_features": 3, - "composition_features": 6, - "definitions": 89, + "composition_features": 7, + "definitions": 104, "block_states": 35723, "configured_block_features": 3, - "named_features": 9, - "named_placed_features": 14, + "named_features": 10, + "named_placed_features": 15, "tag_files": 5, - "requested_placements": 12816, + "requested_placements": 14976, "sources_sha256": { "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureCatalogOracle.java": "28adc261de263896b32dc7e196bc0091060677b73823d2babbe829a35f1f9f0d", "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", - "tools/test_feature_catalog_parity.py": "2f85e37a24361bd64b0abf8620cb0e3c3b80bf2f69bc9aa1de957e39cb96c547", + "tools/test_feature_catalog_parity.py": "9d4ecda27019112fc93b6ede9063e84fc8b916cfd196f60d32f0732adf5a5469", "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", - "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", @@ -64,8 +64,9 @@ "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", - "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", @@ -87,14 +88,22 @@ "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b3caf26bd3afc9d10cdcca3f7e794c30abf5ba09afa1fe80ba8f44713acdb274", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", - "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", "crates/horizon-world/src/fluid.rs": "8a2834a9347ee2c2db7cf1c86a064907ec06e9ac16ba9cc3936e315fc4ad49ca", "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", - "crates/horizon-world/src/lib.rs": "06aa7b44e1229b3cf50abcf3827f2cacd7ae54321865873bdba0f371cb458b3f", + "crates/horizon-world/src/lib.rs": "a8cd85f6223668c1446ff103276d80937b9707d9a7dc619a176b1b1ceed36a4a", "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", @@ -103,14 +112,16 @@ "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", - "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", - "crates/horizon-world/src/worldgen/block_feature.rs": "f8c2ef2de1cfe9a8689a7375d4bf0cc00431484e06f6d4b2b95aabac8fdfffb0", - "crates/horizon-world/src/worldgen/block_predicate.rs": "8513e9d96c8626594b5ee078bf20ccf3de90fc9f9d7123780d1cab5eefb6b5c2", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "2ea6d26fe88c633ad3efe7bdb6fc49f54961cbdf93b82919d79cf7d37a5c3c7d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", @@ -119,11 +130,11 @@ "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", - "crates/horizon-world/src/worldgen/decoration.rs": "297524aefeb4567c5f5c0c1678013e44002eb91ca16ee63b51ffacf93f31a095", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", - "crates/horizon-world/src/worldgen/feature_catalog.rs": "486fe9d8588eb09e0ee5707a0541b0df167b63b0b56c90a2709bfa09a0a3ad19", - "crates/horizon-world/src/worldgen/feature_graph.rs": "fe61a5e43179a7588737a71782ea246811fe2c8721e74793e1ac018c8eb93c34", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "adca25c42008302f8e10571b448535ff5cf85984d3a37c5b5b3418eb276f0e47", "crates/horizon-world/src/worldgen/feature_region.rs": "2c78e5f1bdb08307f8d982f231f1abbc3306cd54348d9023b86ee6ed3516fd33", "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", "crates/horizon-world/src/worldgen/fluid_predicate.rs": "e682d13a21f90605215b79f5d254bf2e524d35e89eab2e3b46384709af80b847", @@ -138,44 +149,45 @@ "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", - "crates/horizon-world/src/worldgen/placement/chain.rs": "08ee8697f589e96b69653b395238eecd144d51cfec30017214275f9b338d82af", - "crates/horizon-world/src/worldgen/placement/context.rs": "c916b30177e283e8eedfa342dc5282b42c898a2873668b44f59c83501ff866bd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "2fc100f8861fe0e0519a53dc4ae4a1eaa8a96aff2f6bf546ce613bdf665df237", "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", - "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "fa0616353f07460975ab323357ab280b7f35e7bfe2de6edc08d304316766ed26", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", - "crates/horizon-world/src/worldgen/state_provider.rs": "d1097d91b43e30cec38b09365d3ed58f15522b829feb584e255718447e4c68b4", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", - "crates/horizon-world/src/worldgen.rs": "b08f074f54f451c24795d5dda68968165b84b8d762d244f0444a8d62de61820e", + "crates/horizon-world/src/worldgen.rs": "2757f22706803afb3624afd65f4f5d05540acbc2bcb01f61e95fa40535575f0f", "crates/horizon-world/examples/feature_catalog_fixture.rs": "fe03581cad3593d7fae403251ec2a1cde0fc87f958cd42a70ec5f3d0c6840715" }, "fixtures_sha256": { - ".local/rust-feature-catalog-parity/inputs.txt": "b0ee5e1737bd138c7997086cb20c2324cc63a70a5966aad1372c40264a62d32e", - ".local/rust-feature-catalog-parity/catalog.json": "5dc542269399635bbe3f82deb0916bba9052c62ec9328306f3e70c24f26a4443", + ".local/rust-feature-catalog-parity/inputs.txt": "c91a004484a7ef75f84cf2376c0cfc90b50f5da49ead21c7dbc3948959af15f5", + ".local/rust-feature-catalog-parity/catalog.json": "bea3cd754cda700a74bdd9aef28ef06228bf969e72409a340ab243032fc659db", ".local/rust-feature-catalog-parity/facts-client.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", ".local/rust-feature-catalog-parity/facts-server.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b" }, - "rust_output_sha256": "4f6cb77afc2bb55c744e1b3c1b726eeba7655e500ff0df3913e6dc7ce6228f4e", + "rust_output_sha256": "040fcab500bb381ef92810e7b5c3cc0772f9a959c17f048c2bb0d2f5cf5de267", "references": [ { "side": "client", "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", - "output_sha256": "4f6cb77afc2bb55c744e1b3c1b726eeba7655e500ff0df3913e6dc7ce6228f4e", - "matched_output_lines": 1734390 + "output_sha256": "040fcab500bb381ef92810e7b5c3cc0772f9a959c17f048c2bb0d2f5cf5de267", + "matched_output_lines": 2528704 }, { "side": "server", "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", - "output_sha256": "4f6cb77afc2bb55c744e1b3c1b726eeba7655e500ff0df3913e6dc7ce6228f4e", - "matched_output_lines": 1734390 + "output_sha256": "040fcab500bb381ef92810e7b5c3cc0772f9a959c17f048c2bb0d2f5cf5de267", + "matched_output_lines": 2528704 } ], - "scope": "Actual Feature.CODEC and PlacedFeature.CODEC bind named and inline holders through RegistryOps and registered feature/placed-feature snapshots. Native TagLoader resolves ordered nested, duplicate, empty, optional-missing and required-missing placed-feature tags. Root holders, named children, tag lists, mixed inline/named lists, namespace shorthand, unknown names and unselected malformed children are compared. Registry-bound fill-layer, single-block replacement and scattered-ore states execute through named roots, nested tags and composed placement. Registry-bound matching-block/fluid predicates also execute through filters, ordered volumes, environment scans and composed named features against the mutable world, including a flowing-water fill followed by repeated fluid-filtered replacement. Actual feature algorithms, nested placement, ordered world mutations, rejected writes, partial failures and direct and WorldgenRandom-wrapped legacy/xoroshiro streams execute through the same mutable world transport. Rust expands requested immutable resource roots with bounded dependency/node traversal; unused resources, cyclic references, registry reload/lifecycle, encoding, all feature algorithms and complete world generation remain outside this comparison." + "scope": "Actual Feature.CODEC and PlacedFeature.CODEC bind named and inline holders through RegistryOps and registered feature/placed-feature snapshots. Native TagLoader resolves ordered nested, duplicate, empty, optional-missing and required-missing placed-feature tags. Overlay accumulated success and non-short-circuit execution, including empty named tags, are compared. Root holders, named children, tag lists, mixed inline/named lists, namespace shorthand, unknown names and unselected malformed children are compared. Registry-bound fill-layer, single-block replacement and scattered-ore states execute through named roots, nested tags and composed placement. Registry-bound matching-block/fluid predicates also execute through filters, ordered volumes, environment scans and composed named features against the mutable world, including a flowing-water fill followed by repeated fluid-filtered replacement. Actual feature algorithms, nested placement, ordered world mutations, rejected writes, partial failures and direct and WorldgenRandom-wrapped legacy/xoroshiro streams execute through the same mutable world transport. Rust expands requested immutable resource roots with bounded dependency/node traversal; unused resources, cyclic references, registry reload/lifecycle, encoding, all feature algorithms and complete world generation remain outside this comparison." } diff --git a/benchmarks/rust-feature-graph-2026-10-06/scoped-parity.json b/benchmarks/rust-feature-graph-2026-10-06/scoped-parity.json index 529fd53d9..4f6ee1181 100644 --- a/benchmarks/rust-feature-graph-2026-10-06/scoped-parity.json +++ b/benchmarks/rust-feature-graph-2026-10-06/scoped-parity.json @@ -5,19 +5,19 @@ "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", "java": "openjdk 25.0.4.1 2026-08-18", "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", - "fixtures": 3885, + "fixtures": 4736, "basic_features": 3, - "composition_features": 6, - "definitions": 105, + "composition_features": 7, + "definitions": 128, "block_states": 5, - "composed_fixtures": 105, - "requested_placements": 7770, + "composed_fixtures": 128, + "requested_placements": 9472, "sources_sha256": { "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureGraphOracle.java": "27d25432c07f6d9af7b3d5de5f7ea231ae59b9e3439fa83195e9fa05f95ce8ea", "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", - "tools/test_feature_graph_parity.py": "d12fcefa11c1b6971819157528326fd8f80b28d4c5329c9f13dd567e0e11ee9c", + "tools/test_feature_graph_parity.py": "52b49066b02c915fe1bbc36c2a587a916086de2c9b072be407fe06ca78aec92b", "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", - "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", @@ -56,8 +56,9 @@ "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", - "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", @@ -72,19 +73,29 @@ "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", - "crates/horizon-core/src/random.rs": "92135a94c79111cc810b4b071dbd76043ee47c2585fd431e7486ea381f19e5db", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b3caf26bd3afc9d10cdcca3f7e794c30abf5ba09afa1fe80ba8f44713acdb274", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", - "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "8a2834a9347ee2c2db7cf1c86a064907ec06e9ac16ba9cc3936e315fc4ad49ca", "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", - "crates/horizon-world/src/lib.rs": "5476d0a811941c4ea229c9a21c640aec51757b2483133a0f9c222fecbef5cb36", + "crates/horizon-world/src/lib.rs": "a8cd85f6223668c1446ff103276d80937b9707d9a7dc619a176b1b1ceed36a4a", "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", @@ -93,13 +104,17 @@ "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", - "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", - "crates/horizon-world/src/worldgen/biome_chunk.rs": "32b937832b7058d86e8557a2012df32be1c97be324f15d0ae85245c45c73b314", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", - "crates/horizon-world/src/worldgen/block_predicate.rs": "dd8cbda2ec110444950f0b31bf4e088897eab0994674a91568c7b063f8f16210", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "2ea6d26fe88c633ad3efe7bdb6fc49f54961cbdf93b82919d79cf7d37a5c3c7d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", @@ -107,11 +122,14 @@ "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", - "crates/horizon-world/src/worldgen/feature_catalog.rs": "4b445c59c37738ce7dd1cb52234b8743fef68642f6ea9fbb41032e4101617dfb", - "crates/horizon-world/src/worldgen/feature_graph.rs": "36a0017782b6d1d4f4fe419698467646cec447838e8b86f96cfc2ed40b632a4f", - "crates/horizon-world/src/worldgen/feature_region.rs": "4a95a30c0987d97e671f84380e13ddea070ad81f996baa65b2a06c4d892971c7", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "adca25c42008302f8e10571b448535ff5cf85984d3a37c5b5b3418eb276f0e47", + "crates/horizon-world/src/worldgen/feature_region.rs": "2c78e5f1bdb08307f8d982f231f1abbc3306cd54348d9023b86ee6ed3516fd33", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "e682d13a21f90605215b79f5d254bf2e524d35e89eab2e3b46384709af80b847", "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", @@ -122,38 +140,45 @@ "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", - "crates/horizon-world/src/worldgen/placement/chain.rs": "1b976aa4dd2516468196d0af3451e3fdd037493a14d269f54ebdd7254055e05e", - "crates/horizon-world/src/worldgen/placement/context.rs": "b36dfd9297896e62770f2085cf934fc08ebd4c030ecc7ae17d864e819a113201", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "2fc100f8861fe0e0519a53dc4ae4a1eaa8a96aff2f6bf546ce613bdf665df237", "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", - "crates/horizon-world/src/worldgen/placement.rs": "68ecf36954fea5705436d486e9be93836933fd56779022afeb881a0399d6a674", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", - "crates/horizon-world/src/worldgen/tags.rs": "7516e20a20479d1c4a9734d7d8e9826740b324869d7afe51eab94bb1bc7c97ae", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", - "crates/horizon-world/src/worldgen/value_provider.rs": "ad1c0efffcc201839e3471d7dfa06c39307d8cbabddb4c5aed8389ee7b68737a", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", - "crates/horizon-world/src/worldgen.rs": "c40017f3449b57558921e1c968b4998f9d32d9d16054ef1741a0d8edc4478489", + "crates/horizon-world/src/worldgen.rs": "2757f22706803afb3624afd65f4f5d05540acbc2bcb01f61e95fa40535575f0f", "crates/horizon-world/examples/feature_graph_fixture.rs": "5999d3902d8980dd46cfe172ab026adba012e33237b0184f7995318c60c6c499" }, "fixtures_sha256": { - ".local/rust-feature-graph-parity/inputs.txt": "10a2c498d0b8ca151715c93de61eaf8b04e5b83a882c117eb26627ff5ca183b4", + ".local/rust-feature-graph-parity/inputs.txt": "4ef4923e50f3d390711da45372a4b142d8f6ea4fdd958acdc892966a5508f419", ".local/rust-feature-graph-parity/facts-client.json": "6c8d9aeb824f4150293f5d6a580d3347d866589b3eeee185a2c18479f5c64b0a", ".local/rust-feature-graph-parity/facts-server.json": "6c8d9aeb824f4150293f5d6a580d3347d866589b3eeee185a2c18479f5c64b0a" }, - "rust_output_sha256": "a0e074e6ae8f81d383c33deafce607285c27f461ac970734983018054bee5127", + "rust_output_sha256": "9fd2ace9bcbd1c0e0c4503d0ad12b6902f730790838125464f16e280ee00e08a", "references": [ { "side": "client", "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", - "output_sha256": "a0e074e6ae8f81d383c33deafce607285c27f461ac970734983018054bee5127", - "matched_output_lines": 737779 + "output_sha256": "9fd2ace9bcbd1c0e0c4503d0ad12b6902f730790838125464f16e280ee00e08a", + "matched_output_lines": 1146057 }, { "side": "server", "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", - "output_sha256": "a0e074e6ae8f81d383c33deafce607285c27f461ac970734983018054bee5127", - "matched_output_lines": 737779 + "output_sha256": "9fd2ace9bcbd1c0e0c4503d0ad12b6902f730790838125464f16e280ee00e08a", + "matched_output_lines": 1146057 } ], - "scope": "Actual Feature.DIRECT_CODEC and native no-op, sequence, random-boolean-selector, simple-random-selector and chance-based random-selector and weighted-random-selector features compose three native block-writing features through inline PlacedFeature holders and actual nested FeaturePlacer calls. Ordered writes, reads, flags, accumulated states, boolean results, rejected writes, partial failures, shared randomness and top-level modifier chains are compared. Sequence short-circuiting, selector return propagation and empty/all-zero weighted choices without random draws are included. Named registry holders/tags, encoders, full feature registries and complete generated worlds remain pending. Rust bounds decode depth/nodes/lists, nested execution depth and feature/placed-feature visits; nested modifier-chain execution shares the feature work budget." + "scope": "Actual Feature.DIRECT_CODEC and native no-op, sequence, overlay, random-boolean-selector, simple-random-selector and chance-based random-selector and weighted-random-selector features compose three native block-writing features through inline PlacedFeature holders and actual nested FeaturePlacer calls. Ordered writes, reads, flags, accumulated states, boolean results, rejected writes, partial failures, shared randomness and top-level modifier chains are compared. Overlay exhaustive ordered execution with accumulated success, sequence short-circuiting, selector return propagation and empty/all-zero weighted choices without random draws are included. Named registry holders/tags, encoders, full feature registries and complete generated worlds remain pending. Rust bounds decode depth/nodes/lists, nested execution depth and feature/placed-feature visits; nested modifier-chain execution shares the feature work budget." } diff --git a/crates/horizon-world/src/worldgen/feature_catalog.rs b/crates/horizon-world/src/worldgen/feature_catalog.rs index 626cd50fa..1f88278f7 100644 --- a/crates/horizon-world/src/worldgen/feature_catalog.rs +++ b/crates/horizon-world/src/worldgen/feature_catalog.rs @@ -234,7 +234,7 @@ impl FeatureCatalog { object.insert("cap_feature".into(), raw(expanded)?); } } - "minecraft:sequence" | "minecraft:simple_random_selector" => { + "minecraft:sequence" | "minecraft:overlay" | "minecraft:simple_random_selector" => { let expanded = self.expand_set(required(&object, "features")?, depth + 1, work)?; object.insert("features".into(), raw(expanded)?); } diff --git a/crates/horizon-world/src/worldgen/feature_graph.rs b/crates/horizon-world/src/worldgen/feature_graph.rs index 0e5293f1b..c2b10d704 100644 --- a/crates/horizon-world/src/worldgen/feature_graph.rs +++ b/crates/horizon-world/src/worldgen/feature_graph.rs @@ -52,6 +52,7 @@ pub enum FeatureDefinition { NoOp, WeightedChoice(OptionalWeightedList), Sequence(Vec), + Overlay(Vec), BooleanChoice(Box<[PlacedFeatureDefinition; 2]>), RandomChoice(Vec), ChanceChoice { @@ -401,7 +402,7 @@ impl FeatureDefinition { ) })?, )), - "minecraft:sequence" | "minecraft:simple_random_selector" => { + "minecraft:sequence" | "minecraft:overlay" | "minecraft:simple_random_selector" => { let raw = required(&object, "features")?; let name = serde_json::from_str::(raw.get()).ok(); let named_empty = name @@ -411,10 +412,10 @@ impl FeatureDefinition { .transpose()? .is_some_and(|name| empty_tags.contains(&name)); if named_empty { - return Ok(if kind == "minecraft:sequence" { - Self::Sequence(vec![]) - } else { - Self::RandomChoice(vec![]) + return Ok(match kind.as_str() { + "minecraft:sequence" => Self::Sequence(vec![]), + "minecraft:overlay" => Self::Overlay(vec![]), + _ => Self::RandomChoice(vec![]), }); } let values = if raw.get().trim_start().starts_with('[') { @@ -437,10 +438,10 @@ impl FeatureDefinition { ) }) .collect::>()?; - Ok(if kind == "minecraft:sequence" { - Self::Sequence(features) - } else { - Self::RandomChoice(features) + Ok(match kind.as_str() { + "minecraft:sequence" => Self::Sequence(features), + "minecraft:overlay" => Self::Overlay(features), + _ => Self::RandomChoice(features), }) } "minecraft:random_boolean_selector" => Ok(Self::BooleanChoice(Box::new([ @@ -673,6 +674,13 @@ impl FeatureDefinition { } Ok(true) } + Self::Overlay(features) => { + let mut any = false; + for feature in features { + any |= feature.place_in(&mut placer, world, random, origin, run)?; + } + Ok(any) + } Self::BooleanChoice(features) => { let index = if random.next_boolean() { 0 } else { 1 }; features[index].place_in(&mut placer, world, random, origin, run) diff --git a/docs/rust-parity.md b/docs/rust-parity.md index a7e270818..9ff680a30 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -397,3 +397,19 @@ The [contained-fluid comparison](world-data.md#contained-fluid-states) adds **239,190 matching lines per JAR** for fluid-state mapping, liquid-block conversion and surface/camera height queries. It covers every pinned block state and query failures; fluid spreading, entity interactions and rendering remain pending. + +## Overlay feature composition + +The Rust overlay feature executes every child placed feature in order and +accumulates success, sharing the placer and random stream across siblings. +Named holders and placed-feature tags use the same catalog resolution as other +compositions. Empty named tags produce false; empty direct lists fail decoding. + +The expanded [inline graph comparison](../benchmarks/rust-feature-graph-2026-10-06/scoped-parity.json) +matches **1,146,057 output lines per reference JAR**, and the expanded +[named catalog comparison](../benchmarks/rust-feature-catalog-2026-10-06/scoped-parity.json) +matches **2,528,704 lines per reference JAR**. These include partial failures, +rejected writes, nested modifiers, repeated calls, random-stream tails and both +Java random modes. This verifies scoped composition behavior; complete chunk +generation and gameplay remain pending. Workspace tests and all-target Clippy +also pass for this implementation. diff --git a/tests/test_feature_catalog_parity.py b/tests/test_feature_catalog_parity.py index 186d943b5..e3f4a1571 100644 --- a/tests/test_feature_catalog_parity.py +++ b/tests/test_feature_catalog_parity.py @@ -6,8 +6,8 @@ class FeatureCatalogCorpusTests(unittest.TestCase): def test_named_roots_tag_shapes_and_mutation_failures(self): resources = catalog.catalog() self.assertEqual(resources, catalog.catalog()) - self.assertEqual(len(resources['features']), 9) - self.assertEqual(len(resources['placed']), 14) + self.assertEqual(len(resources['features']), 10) + self.assertEqual(len(resources['placed']), 15) self.assertEqual(len(resources['tags']), 5) fixtures = list(catalog.corpus()) self.assertEqual({f['placed_root'] for f in fixtures}, {False, True}) diff --git a/tests/test_feature_graph_parity.py b/tests/test_feature_graph_parity.py index 1374f8545..413be57f4 100644 --- a/tests/test_feature_graph_parity.py +++ b/tests/test_feature_graph_parity.py @@ -7,7 +7,7 @@ class FeatureGraphCorpusTests(unittest.TestCase): def test_composition_decoding_failure_and_shared_randomness(self): definitions = list(graphs.definitions()) self.assertEqual(definitions, list(graphs.definitions())) - self.assertEqual({d['type'] for d in definitions}, {'no_op', 'sequence', 'random_boolean_selector', 'simple_random_selector', 'random_selector', 'weighted_random_selector'}) + self.assertEqual({d['type'] for d in definitions}, {'no_op', 'overlay', 'sequence', 'random_boolean_selector', 'simple_random_selector', 'random_selector', 'weighted_random_selector'}) self.assertTrue(any(d.get('features') == [] for d in definitions)) fixtures = list(graphs.corpus()) self.assertEqual({f['legacy'] for f in fixtures}, {False, True}) diff --git a/tools/test_feature_catalog_parity.py b/tools/test_feature_catalog_parity.py index d3dba1f0b..39a290ed3 100644 --- a/tools/test_feature_catalog_parity.py +++ b/tools/test_feature_catalog_parity.py @@ -43,6 +43,8 @@ def catalog(): 'horizon:optional':{'values':[{'id':'horizon:missing','required':False},'horizon:a_noop']}, 'horizon:invalid':{'values':['horizon:missing']}, } + features['horizon:overlay']={'type':'overlay','features':[{'feature':{'type':'no_op'},'placement':[{'type':'count','count':0}]},{'feature':{'type':'end_island'},'placement':[{'type':'in_square'}]},{'feature':{'type':'end_platform'},'placement':[]}]} + placed['horizon:n_overlay']={'feature':'horizon:overlay','placement':[{'type':'count','count':2}]} features['horizon:composite']={'type':'sequence','features':'#horizon:nested'} return {key:{name:encode(value) for name,value in values.items()} for key,values in [('features',features),('placed',placed),('tags',tags)]} @@ -52,7 +54,7 @@ def definitions(): for root in [*catalog()['features'],'noop',':noop','horizon:missing','#horizon:no_op','HORIZON:no_op',None,False,[]]:yield False,root for root in [*catalog()['placed'],'noop',':noop','horizon:missing','#horizon:nonempty',inline,{'feature':'horizon:composite','placement':[{'type':'count','count':2}]}]:yield True,root for values in ['horizon:c_island','#horizon:nonempty','#horizon:empty','#horizon:nested','#horizon:optional','#horizon:invalid','#horizon:missing',[],['horizon:c_island','horizon:c_island'],['horizon:a_noop','horizon:b_false','horizon:c_island'],['horizon:c_island',inline],[inline,'horizon:c_island'],inline]: - for kind in ['sequence','simple_random_selector']:yield False,{'type':kind,'features':values} + for kind in ['sequence','overlay','simple_random_selector']:yield False,{'type':kind,'features':values} for name in ['horizon:e_nested','horizon:b_false','horizon:missing']: yield False,{'type':'random_boolean_selector','feature_true':name,'feature_false':inline} yield False,{'type':'random_selector','features':[{'feature':name,'chance':0.5}],'default':'horizon:d_platform'} @@ -112,9 +114,9 @@ def main(): base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) report={"schema":1,"minecraft":lock["minecraft"]["version"],"manifest_sha1":lock["minecraft"]["manifest_sha1"],"platform":platform.platform(), "java":subprocess.check_output(["java","--version"],text=True).splitlines()[0],"rustc":subprocess.check_output(["rustc","--version"],text=True).strip(), - "fixtures":len(fixtures),"worldgen_random_modes":[False,True],"basic_features":3,"composition_features":6,"definitions":len(list(definitions())),"block_states":35723,"configured_block_features":3,"named_features":len(catalog()["features"]),"named_placed_features":len(catalog()["placed"]),"tag_files":len(catalog()["tags"]),"requested_placements":sum(f["repeats"] for f in fixtures), + "fixtures":len(fixtures),"worldgen_random_modes":[False,True],"basic_features":3,"composition_features":7,"definitions":len(list(definitions())),"block_states":35723,"configured_block_features":3,"named_features":len(catalog()["features"]),"named_placed_features":len(catalog()["placed"]),"tag_files":len(catalog()["tags"]),"requested_placements":sum(f["repeats"] for f in fixtures), "sources_sha256":tested_sources,"fixtures_sha256":tested_fixtures,"rust_output_sha256":lab.digest(build/"rust.txt","sha256"),"references":references, - "scope":"Actual Feature.CODEC and PlacedFeature.CODEC bind named and inline holders through RegistryOps and registered feature/placed-feature snapshots. Native TagLoader resolves ordered nested, duplicate, empty, optional-missing and required-missing placed-feature tags. Root holders, named children, tag lists, mixed inline/named lists, namespace shorthand, unknown names and unselected malformed children are compared. Registry-bound fill-layer, single-block replacement and scattered-ore states execute through named roots, nested tags and composed placement. Registry-bound matching-block/fluid predicates also execute through filters, ordered volumes, environment scans and composed named features against the mutable world, including a flowing-water fill followed by repeated fluid-filtered replacement. Actual feature algorithms, nested placement, ordered world mutations, rejected writes, partial failures and direct and WorldgenRandom-wrapped legacy/xoroshiro streams execute through the same mutable world transport. Rust expands requested immutable resource roots with bounded dependency/node traversal; unused resources, cyclic references, registry reload/lifecycle, encoding, all feature algorithms and complete world generation remain outside this comparison."} + "scope":"Actual Feature.CODEC and PlacedFeature.CODEC bind named and inline holders through RegistryOps and registered feature/placed-feature snapshots. Native TagLoader resolves ordered nested, duplicate, empty, optional-missing and required-missing placed-feature tags. Overlay accumulated success and non-short-circuit execution, including empty named tags, are compared. Root holders, named children, tag lists, mixed inline/named lists, namespace shorthand, unknown names and unselected malformed children are compared. Registry-bound fill-layer, single-block replacement and scattered-ore states execute through named roots, nested tags and composed placement. Registry-bound matching-block/fluid predicates also execute through filters, ordered volumes, environment scans and composed named features against the mutable world, including a flowing-water fill followed by repeated fluid-filtered replacement. Actual feature algorithms, nested placement, ordered world mutations, rejected writes, partial failures and direct and WorldgenRandom-wrapped legacy/xoroshiro streams execute through the same mutable world transport. Rust expands requested immutable resource roots with bounded dependency/node traversal; unused resources, cyclic references, registry reload/lifecycle, encoding, all feature algorithms and complete world generation remain outside this comparison."} lab.write_json(report_path,report);print(f"Scoped feature-catalog parity passed: {report_path}") diff --git a/tools/test_feature_graph_parity.py b/tools/test_feature_graph_parity.py index 49b14ed35..876b9bc3c 100644 --- a/tools/test_feature_graph_parity.py +++ b/tools/test_feature_graph_parity.py @@ -19,8 +19,8 @@ def definitions(): noop=placed('no_op');false=placed('no_op',[{'type':'count','count':0}]);island=placed('end_island') platform=placed('end_platform',[{'type':'offset','x':1,'y':2,'z':-1}]) yield {'type':'no_op'} - for kind in ['sequence','simple_random_selector']: - for features in [[],[noop],[false],[island],[false,island],[island,false],[noop,island,platform],None,noop]: + for kind in ['sequence','overlay','simple_random_selector']: + for features in [[],[noop],[false],[island],[false,island],[island,false],[false,false],[noop,false,island,platform],[noop,island,platform],None,noop]: yield {'type':kind,'features':features} for yes,no in [(noop,false),(false,island),(island,platform),(false,false)]: yield {'type':'random_boolean_selector','feature_true':yes,'feature_false':no} @@ -32,9 +32,13 @@ def definitions(): nested={'feature':inner,'placement':[{'type':'count','count':2},{'type':'in_square'}]} yield {'type':'sequence','features':[noop,nested,platform]} yield {'type':'simple_random_selector','features':[nested,platform,false]} + overlay={'feature':{'type':'overlay','features':[false,nested,false,platform]},'placement':[{'type':'count','count':2},{'type':'in_square'}]} + yield {'type':'overlay','features':[false,overlay,nested,platform]} + yield {'type':'sequence','features':[overlay,nested]} yield {'type':'random_selector','features':[{'feature':nested,'chance':0},{'feature':false,'chance':1}],'default':island} for malformed in [None,False,{},'missing',{'feature':{'type':'no_op'}},{'feature':{'type':'no_op'},'placement':None}]: yield {'type':'sequence','features':[malformed]} + yield {'type':'overlay','features':[noop,malformed]} yield {'type':'random_boolean_selector','feature_true':noop,'feature_false':malformed} for weights in [[],[0],[1],[63],[64],[65],[2147483647],[0,0],[0,1],[1,0],[1,3],[31,32],[31,33],[31,34],[2147483647,1],[-1,2],[0.9,1],[False,1],['1',2],[4294967297,1]]: @@ -93,9 +97,9 @@ def main(): base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) report={"schema":1,"minecraft":lock["minecraft"]["version"],"manifest_sha1":lock["minecraft"]["manifest_sha1"],"platform":platform.platform(), "java":subprocess.check_output(["java","--version"],text=True).splitlines()[0],"rustc":subprocess.check_output(["rustc","--version"],text=True).strip(), - "fixtures":len(fixtures),"basic_features":3,"composition_features":6,"definitions":len(list(definitions())),"block_states":5,"composed_fixtures":sum("placement" in f for f in fixtures),"requested_placements":sum(f["repeats"] for f in fixtures), + "fixtures":len(fixtures),"basic_features":3,"composition_features":7,"definitions":len(list(definitions())),"block_states":5,"composed_fixtures":sum("placement" in f for f in fixtures),"requested_placements":sum(f["repeats"] for f in fixtures), "sources_sha256":tested_sources,"fixtures_sha256":tested_fixtures,"rust_output_sha256":lab.digest(build/"rust.txt","sha256"),"references":references, - "scope":"Actual Feature.DIRECT_CODEC and native no-op, sequence, random-boolean-selector, simple-random-selector and chance-based random-selector and weighted-random-selector features compose three native block-writing features through inline PlacedFeature holders and actual nested FeaturePlacer calls. Ordered writes, reads, flags, accumulated states, boolean results, rejected writes, partial failures, shared randomness and top-level modifier chains are compared. Sequence short-circuiting, selector return propagation and empty/all-zero weighted choices without random draws are included. Named registry holders/tags, encoders, full feature registries and complete generated worlds remain pending. Rust bounds decode depth/nodes/lists, nested execution depth and feature/placed-feature visits; nested modifier-chain execution shares the feature work budget."} + "scope":"Actual Feature.DIRECT_CODEC and native no-op, sequence, overlay, random-boolean-selector, simple-random-selector and chance-based random-selector and weighted-random-selector features compose three native block-writing features through inline PlacedFeature holders and actual nested FeaturePlacer calls. Ordered writes, reads, flags, accumulated states, boolean results, rejected writes, partial failures, shared randomness and top-level modifier chains are compared. Overlay exhaustive ordered execution with accumulated success, sequence short-circuiting, selector return propagation and empty/all-zero weighted choices without random draws are included. Named registry holders/tags, encoders, full feature registries and complete generated worlds remain pending. Rust bounds decode depth/nodes/lists, nested execution depth and feature/placed-feature visits; nested modifier-chain execution shares the feature work budget."} lab.write_json(report_path,report);print(f"Scoped feature-graph parity passed: {report_path}") From 801bec30d518451a8f94bc2ab41f7cd75194b5fa Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 12:20:29 +0200 Subject: [PATCH 011/253] Implement native block-pile placement and support checks --- .github/workflows/ci.yml | 4 + .../scoped-parity.json | 204 ++++++++++++++++++ .../examples/simple_block_fixture.rs | 8 + crates/horizon-world/src/worldgen.rs | 1 + .../horizon-world/src/worldgen/block_pile.rs | 160 ++++++++++++++ .../src/worldgen/feature_graph.rs | 13 ++ .../src/worldgen/placement/context.rs | 9 + docs/rust-parity.md | 15 ++ tools/test_block_pile_parity.py | 62 ++++++ 9 files changed, 476 insertions(+) create mode 100644 benchmarks/rust-block-pile-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-world/src/worldgen/block_pile.rs create mode 100644 tools/test_block_pile_parity.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b2911407e..a03700e39 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -111,6 +111,10 @@ jobs: env: RUSTUP_TOOLCHAIN: stable run: python tools/test_neighbor_spread_parity.py + - name: Compare block-pile support and placement + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_block_pile_parity.py - name: Compare ordered single-block replacement features env: RUSTUP_TOOLCHAIN: stable diff --git a/benchmarks/rust-block-pile-2026-10-06/scoped-parity.json b/benchmarks/rust-block-pile-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..a0c3e8ce4 --- /dev/null +++ b/benchmarks/rust-block-pile-2026-10-06/scoped-parity.json @@ -0,0 +1,204 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 75667, + "candidate_states": 35723, + "double_plant_blocks": 10, + "mossy_carpet_blocks": 1, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java": "82204d06e279275c5967f6d5fd80afe7416ba6c5f5ec19c682a30942f2fb6d7a", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSurvivalOracle.java": "4e7cc151617c1b02e872f9ca3e9fe4632379f225f4f07718ff6492df4ee551e7", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java": "99a396b9b983f6ca9149133251f3ece9aaf76d3d16dafa1f322378212a19490c", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSupportOracle.java": "04350901a2d708fb8fa672de61d058f73f332d2e90df1b93a67781862f89c1ad", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "60ff9ef7c1d5e23c080f9aec95ab2e7d3b7c5b5bcd67b9efa9518776c400629a", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_simple_block_parity.py": "8d789c02b88cfd019064b7407f886a2054d26554390a25f804773bb2197c6c35", + "tools/test_block_pile_parity.py": "012a15ef52a918ab635189aa3c763fce83a37e4a5b00381ba846238d702022d4", + "tools/test_block_survival_parity.py": "9e8dff3bd4b95dbfd29f8adc6a2f6d66abf19a6b1cd91423b794a345d4ec244a", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b3caf26bd3afc9d10cdcca3f7e794c30abf5ba09afa1fe80ba8f44713acdb274", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "8a2834a9347ee2c2db7cf1c86a064907ec06e9ac16ba9cc3936e315fc4ad49ca", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "a8cd85f6223668c1446ff103276d80937b9707d9a7dc619a176b1b1ceed36a4a", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "2ea6d26fe88c633ad3efe7bdb6fc49f54961cbdf93b82919d79cf7d37a5c3c7d", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "5aa693cba6ad8e7ca79d0aaeb8e4d546f0ac4ec0f3f3eb96d002958610e61dfb", + "crates/horizon-world/src/worldgen/feature_region.rs": "2c78e5f1bdb08307f8d982f231f1abbc3306cd54348d9023b86ee6ed3516fd33", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "e682d13a21f90605215b79f5d254bf2e524d35e89eab2e3b46384709af80b847", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a1fa59d0e035654c5ee8bb4d84822ea9df5a5b86c7e7fa46080af8e87aa58e03", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "efc6f6960422ab281c1636d12080f27062d72955964e7d932863c077a2365531", + "crates/horizon-world/examples/simple_block_fixture.rs": "9eae8e6ed390a49460496a7a6e7f6d631f1ad1fe21e6ffdbeeb1e79b7f92c0f9" + }, + "fixtures_sha256": { + ".local/rust-block-pile-parity/inputs.txt": "754699b4804baf4a9be28d665b053e6ae8b93a4b418b0d8eaa8004159a853851", + ".local/rust-block-pile-parity/block-properties.nbt": "1aba22092f70d16b8092014c058ddc210e4aaa77bac32f6ec62e4d0e91d92a99", + ".local/rust-block-pile-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-block-pile-parity/cached-collision.nbt": "f3a5c6a5b2d51dad6c52e486e2b9989e79fd55db1a9bda6196db399550b04078", + ".local/rust-block-pile-parity/cached-support.nbt": "b6fdc9471b0b61e904206d3f099f4dc235aad6d723536c210be0cb7c3560d82c", + ".local/rust-block-pile-parity/catalog.json": "93581107e3564e60261044fdca61e3b7f237b9e6724c14b86e335ccc01198ba9", + ".local/rust-block-pile-parity/facts.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-block-pile-parity/feature-catalog.json": "c048c761c5084a40560731955cc999a364d14055bdd86fa50989a92e4a771286", + ".local/rust-block-pile-parity/fluid-tags.json": "f1e5eb6d22ea7effbb118a2282709cfdeef1bfae4516b775a55ad7a4df29d7d0", + ".local/rust-block-pile-parity/placement-definitions.json": "f8a972ec87c2352500af6481158a3192bdbf699951025639bea744e4127b97c4", + ".local/rust-block-pile-parity/support-cached-states.json": "353945a58fe69b352925473f1693f9b14a9ad19f13c15159c4184f2c29258622", + ".local/rust-block-pile-parity/survival-classes.json": "361832008eea0aa9151d367a125a19c6353d99a0b88b27dd0682f55b7954553e", + ".local/rust-block-pile-parity/survival-extra-definitions.json": "170f2db5bc97a49fa25cc249540aa7f04beea455cdbaf43742ed9415f5090a02", + ".local/rust-block-pile-parity/survival-placement-classes.json": "7fdbf48ab18c87098bbe1b6176cb81f4842b6c5d9a4d6bbaf7037ff61cb1848c", + ".local/rust-block-pile-parity/survival-rules.json": "8805c18b3195bb1eac1f1e5281333df56e2892505f64023e5403c58ce2ec4368", + ".local/rust-block-pile-parity/survival-support-tags.json": "15d88d5bb5ad10d65124d5abb2cc055d251b06d129bca7be06f55b43dc13f6fd", + ".local/rust-block-pile-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0" + }, + "rust_output_sha256": "639bf7fa3f07d6b293eef1ed6422ac1a465944cd5369fe82d804f499f176c69e", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "639bf7fa3f07d6b293eef1ed6422ac1a465944cd5369fe82d804f499f176c69e", + "matched_output_lines": 11995254 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "639bf7fa3f07d6b293eef1ed6422ac1a465944cd5369fe82d804f499f176c69e", + "matched_output_lines": 11995254 + } + ], + "scope": "Native BlockPileFeature codec and placement with every candidate and supporting block state. Minimum-height early return, radius sampling, native inclusive-box visit order, squared-distance float arithmetic, sparse outer draws, air variants, dirt-path random acceptance, cached/dynamic FULL upper support, provider selection and fallback reads, flags 260, rejected writes, partial failures, repeated calls and both random streams are compared. Named providers and overlay/modifier composition use the same world. Wrapped boxes with finite native counts and failure-terminated prefixes of negative-count boxes are included; Rust bounds pathological iteration to 2^20 visits. Block entities are absent in this fixture. Resident chunks, block updates and complete gameplay remain pending." +} diff --git a/crates/horizon-world/examples/simple_block_fixture.rs b/crates/horizon-world/examples/simple_block_fixture.rs index a90e864b8..7d2b8a777 100644 --- a/crates/horizon-world/examples/simple_block_fixture.rs +++ b/crates/horizon-world/examples/simple_block_fixture.rs @@ -190,6 +190,14 @@ impl PlacementContext for World<'_, '_, W, R> { direction: Direction, ) -> Result { let state = self.get(p).map_err(query)?; + self.state_face_sturdy(state, p, direction) + } + fn state_face_sturdy( + &mut self, + state: BlockStateId, + p: [i32; 3], + direction: Direction, + ) -> Result { let support = self.support; support .is_face_sturdy(self, state, p, direction, SupportType::Full) diff --git a/crates/horizon-world/src/worldgen.rs b/crates/horizon-world/src/worldgen.rs index 2f5cb5542..d1444a6e5 100644 --- a/crates/horizon-world/src/worldgen.rs +++ b/crates/horizon-world/src/worldgen.rs @@ -9,6 +9,7 @@ pub mod biome_source; pub mod biome_temperature; pub mod block_column; pub mod block_feature; +pub mod block_pile; pub mod block_predicate; pub mod bulk_section; pub mod carver; diff --git a/crates/horizon-world/src/worldgen/block_pile.rs b/crates/horizon-world/src/worldgen/block_pile.rs new file mode 100644 index 000000000..2db19f9b4 --- /dev/null +++ b/crates/horizon-world/src/worldgen/block_pile.rs @@ -0,0 +1,160 @@ +//! Randomized two-layer piles, with native support checks and write flags. +use super::{ + DecodeError, Object, + block_feature::FeatureBlockBindings, + block_predicate::PredicateBlockResolver, + feature::FeatureWorld, + placement::{PlacementContext, PlacementQueryError}, + required, + state_provider::{BlockStateProvider, StateProviderError}, +}; +use crate::registry::BlockStateId; +use horizon_core::{ + geometry::Direction, + random::{InvalidBound, RandomSource}, +}; +use std::{collections::BTreeSet, sync::Arc}; + +#[derive(Clone, Debug)] +pub struct BlockPileFeature { + provider: BlockStateProvider, + air: [BlockStateId; 3], + paths: Arc>, +} +#[derive(Debug)] +pub enum BlockPileError { + Random(InvalidBound), + Provider(StateProviderError), + Query(PlacementQueryError), + World(E), + WorkLimit, +} +impl std::fmt::Display for BlockPileError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Random(e) => e.fmt(f), + Self::Provider(e) => e.fmt(f), + Self::Query(e) => e.fmt(f), + Self::World(e) => e.fmt(f), + Self::WorkLimit => f.write_str("block pile work limit exceeded"), + } + } +} +impl std::error::Error for BlockPileError {} +impl BlockPileFeature { + pub fn from_json(json: &str, bindings: &FeatureBlockBindings<'_>) -> Result { + Self::decode(json, bindings, 0, &mut 65536) + } + pub(crate) fn decode( + json: &str, + bindings: &FeatureBlockBindings<'_>, + depth: usize, + remaining: &mut usize, + ) -> Result { + if depth > 128 || *remaining == 0 { + return Err(DecodeError::Field("block pile depth or work")); + } + *remaining -= 1; + let object: Object = serde_json::from_str(json)?; + let (providers, catalog, _) = bindings + .simple_blocks + .as_ref() + .ok_or(DecodeError::Field("block pile provider bindings"))?; + Ok(Self { + provider: catalog.provider_with_budget( + required(&object, "state_provider")?.get(), + providers, + depth + 1, + remaining, + )?, + air: bindings.air, + paths: bindings.predicate_block_set(r#""minecraft:dirt_path""#)?, + }) + } + pub fn place( + &self, + world: &mut W, + random: &mut impl RandomSource, + origin: [i32; 3], + ) -> Result> { + if origin[1] + < world + .min_y() + .map_err(BlockPileError::Query)? + .wrapping_add(5) + { + return Ok(false); + } + let rx = 2 + random.next_int_bound(2).map_err(BlockPileError::Random)?; + let rz = 2 + random.next_int_bound(2).map_err(BlockPileError::Random)?; + let a = [ + origin[0].wrapping_sub(rx), + origin[1], + origin[2].wrapping_sub(rz), + ]; + let b = [ + origin[0].wrapping_add(rx), + origin[1].wrapping_add(1), + origin[2].wrapping_add(rz), + ]; + let min: [i32; 3] = std::array::from_fn(|i| a[i].min(b[i])); + let sizes: [i32; 3] = + std::array::from_fn(|i| a[i].max(b[i]).wrapping_sub(min[i]).wrapping_add(1)); + let count = sizes[0].wrapping_mul(sizes[1]).wrapping_mul(sizes[2]); + let mut index: i32 = 0; + // Native betweenClosed stops on equality, including overflowed counts. + // Ordinary piles visit at most 98 cells; pathological boxes are bounded. + while index != count { + if index == 1_048_576 { + return Err(BlockPileError::WorkLimit); + } + let quotient = index / sizes[0]; + let p = [ + min[0].wrapping_add(index % sizes[0]), + min[1].wrapping_add(quotient % sizes[1]), + min[2].wrapping_add(quotient / sizes[1]), + ]; + index += 1; + let dx = origin[0].wrapping_sub(p[0]); + let dz = origin[2].wrapping_sub(p[2]); + let distance = dx.wrapping_mul(dx).wrapping_add(dz.wrapping_mul(dz)) as f32; + let threshold = random.next_float() * 10.0 - random.next_float() * 6.0; + if distance <= threshold || f64::from(random.next_float()) < 0.031 { + self.try_place(world, random, p)?; + } + } + Ok(true) + } + fn try_place( + &self, + world: &mut W, + random: &mut impl RandomSource, + p: [i32; 3], + ) -> Result<(), BlockPileError> { + if !self + .air + .contains(&world.block(p).map_err(BlockPileError::World)?) + { + return Ok(()); + } + let below = [p[0], p[1].wrapping_sub(1), p[2]]; + let support = world.block(below).map_err(BlockPileError::World)?; + let allowed = if self.paths.contains(&support) { + random.next_boolean() + } else { + world + .state_face_sturdy(support, below, Direction::Up) + .map_err(BlockPileError::Query)? + }; + if allowed { + let state = self + .provider + .get_state(world, random, p) + .map_err(BlockPileError::Provider)?; + world + .set_block(p, state, 260) + .map_err(BlockPileError::World)?; + } + Ok(()) + } +} diff --git a/crates/horizon-world/src/worldgen/feature_graph.rs b/crates/horizon-world/src/worldgen/feature_graph.rs index c2b10d704..18afd444d 100644 --- a/crates/horizon-world/src/worldgen/feature_graph.rs +++ b/crates/horizon-world/src/worldgen/feature_graph.rs @@ -45,6 +45,7 @@ pub enum FeatureDefinition { cap: Option>, }, BlockColumn(super::block_column::BlockColumnFeature), + BlockPile(super::block_pile::BlockPileFeature), SimpleBlock(super::simple_block::SimpleBlockFeature), FillLayer(FillLayerFeature), ReplaceBlock(ReplaceBlockFeature), @@ -65,6 +66,7 @@ pub enum FeatureExecutionError { Basic(FeatureError), Provider(super::state_provider::StateProviderError), BlockColumn(super::block_column::BlockColumnError), + BlockPile(super::block_pile::BlockPileError), SimpleBlock(super::simple_block::SimpleBlockError), Random(InvalidBound), Query(PlacementQueryError), @@ -77,6 +79,7 @@ impl std::fmt::Display for FeatureExecutionError { Self::Basic(e) => e.fmt(f), Self::Provider(e) => e.fmt(f), Self::BlockColumn(e) => e.fmt(f), + Self::BlockPile(e) => e.fmt(f), Self::SimpleBlock(e) => e.fmt(f), Self::Random(e) => e.fmt(f), Self::Query(e) => e.fmt(f), @@ -243,6 +246,13 @@ impl FeatureDefinition { )?)?; match kind.as_str() { "minecraft:no_op" => Ok(Self::NoOp), + "minecraft:block_pile" => super::block_pile::BlockPileFeature::decode( + json, + blocks.ok_or(DecodeError::Field("block pile bindings"))?, + depth, + remaining, + ) + .map(Self::BlockPile), "minecraft:random_neighbor_spread" => { let bindings = blocks.ok_or(DecodeError::Field("neighbor spread block bindings"))?; @@ -541,6 +551,9 @@ impl FeatureDefinition { .place(world, random, origin, run.blocks) .map_err(FeatureExecutionError::Basic), Self::NoOp => Ok(true), + Self::BlockPile(feature) => feature + .place(world, random, origin) + .map_err(FeatureExecutionError::BlockPile), Self::NeighborSpread { provider, neighbors, diff --git a/crates/horizon-world/src/worldgen/placement/context.rs b/crates/horizon-world/src/worldgen/placement/context.rs index 7e8a5a871..13eead886 100644 --- a/crates/horizon-world/src/worldgen/placement/context.rs +++ b/crates/horizon-world/src/worldgen/placement/context.rs @@ -60,6 +60,15 @@ pub trait PlacementContext { ) -> Result { Err(PlacementQueryError::Unavailable) } + /// Evaluate FULL support using an already-read state, without reading it again. + fn state_face_sturdy( + &mut self, + _state: crate::registry::BlockStateId, + _position: [i32; 3], + _direction: horizon_core::geometry::Direction, + ) -> Result { + Err(PlacementQueryError::Unavailable) + } /// Read the block state and evaluate FULL support on the requested face. fn face_sturdy( &mut self, diff --git a/docs/rust-parity.md b/docs/rust-parity.md index 9ff680a30..122e91854 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -413,3 +413,18 @@ rejected writes, nested modifiers, repeated calls, random-stream tails and both Java random modes. This verifies scoped composition behavior; complete chunk generation and gameplay remain pending. Workspace tests and all-target Clippy also pass for this implementation. + +## Block-pile placement + +Rust block piles preserve radius and sparse-candidate random draws, air checks, +dirt-path acceptance, state-aware FULL upper support, provider fallback reads, +and update flags 260. Previously read support states are evaluated without an +extra world read. The [native comparison](../benchmarks/rust-block-pile-2026-10-06/scoped-parity.json) +matches **11,995,254 lines per reference JAR**, covering every candidate and +supporting registry state, partial failures, rejected writes, repeated placement, +and overlay/modifier composition. Workspace tests and all-target Clippy pass. + +Ordinary piles visit at most 98 cells. Rust preserves wrapped native box traversal +but limits pathological iteration to 2^20 cells; negative-count overflow fixtures +compare failure-terminated prefixes. Dynamic block entities are absent in this +feature fixture, and resident-world block updates remain pending. diff --git a/tools/test_block_pile_parity.py b/tools/test_block_pile_parity.py new file mode 100644 index 000000000..4562ef4a8 --- /dev/null +++ b/tools/test_block_pile_parity.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python3 +"""Compare block-pile support, ordered mutations and random consumption.""" +import itertools +import json +try: + from . import test_simple_block_parity as harness +except ImportError: + import test_simple_block_parity as harness + + +def corpus(facts, placement): + states = facts['states'] + get = lambda name: facts['defaults']['minecraft:' + name] + def pile(provider=None): + return {'type': 'block_pile', 'state_provider': provider if provider is not None else {'id': 'stone'}} + def case(definition=None, support=None, **extra): + origin = extra.pop('origin', [0, 64, 0]) + wrap = lambda value: (value + 2**31) % 2**32 - 2**31 + floor = [[wrap(origin[0]+x), wrap(origin[1]-1), wrap(origin[2]+z), support if support is not None else get('stone')] + for z in range(-3, 4) for x in range(-3, 4)] + value = {'definition': json.dumps(definition if definition is not None else pile(), separators=(',', ':')), + 'mode': 'feature', 'origin': origin, 'legacy': False, 'seed': 0, 'world_seed': 1, + 'fail': -1, 'reject': 0, 'brightness': 15, 'fallback': get('air'), 'states': floor, 'repeats': 1} + value.update(extra) + return value + # Every output candidate and every supporting state in the pinned registry. + for state in states: + yield case(pile(state)) + for state in range(len(states)): + yield case(support=state) + providers = [{'id': 'stone'}, {'type': 'random_block', 'blocks': []}, + {'type': 'random_block', 'blocks': ['stone', 'water', 'hay_block']}, + {'type': 'rotated', 'state': {'id': 'oak_log'}}, + {'type': 'weighted', 'entries': [{'data': 'stone', 'weight': 1}, {'data': 'hay_block', 'weight': 3}]}, + 'horizon:stone'] + for provider, ground, legacy, seed, fail, reject in itertools.product( + providers, ['stone', 'dirt_path', 'air', 'oak_slab', 'shulker_box', 'moving_piston'], + [False, True], [0, -1, 0x123456789abcdef], [-1, 0, 1, 2, 7, 19], [0, 1, 3]): + yield case(pile(provider), support=get(ground), legacy=legacy, seed=seed, fail=fail, reject=reject, repeats=2) + for fallback, y, seed in itertools.product(['air', 'cave_air', 'void_air', 'water', 'short_grass', 'snow'], + [-64, -60, -59, -58, 319, 320, 2147483647, -2147483648], range(4)): + yield case(fallback=get(fallback), origin=[-17, y, -33], seed=seed) + for x, z, seed in itertools.product([2147483647, -2147483648], [2147483647, -2147483648], range(8)): + yield case(origin=[x, 64, z], seed=seed) + # One overflowing horizontal dimension produces a negative native iterator + # count; injected failures terminate after a finite matching prefix. + for x, z in [(2147483647, 0), (0, -2147483648)]: + for fail in [0, 1, 3]: + yield case(origin=[x, 64, z], fail=fail) + for value in [None, False, {}, [], 'missing', {'id': 'missing'}]: + yield case({'type': 'block_pile', 'state_provider': value}) + yield case({'type': 'block_pile'}) + for legacy, seed, fail, reject in itertools.product([False, True], [0, -1, 0x123456789abcdef], [-1, 0, 5, 21], [0, 3]): + placed = {'feature': pile(providers[2]), 'placement': [{'type': 'count', 'count': 2}, {'type': 'in_square'}]} + yield case(placed, mode='placed', legacy=legacy, seed=seed, fail=fail, reject=reject) + yield case({'type': 'overlay', 'features': [placed, {'feature': 'horizon:moss', 'placement': []}]}, + legacy=legacy, seed=seed, fail=fail, reject=reject) + + +if __name__ == '__main__': + harness.run(corpus, 'rust-block-pile-parity', __file__, + 'Native BlockPileFeature codec and placement with every candidate and supporting block state. Minimum-height early return, radius sampling, native inclusive-box visit order, squared-distance float arithmetic, sparse outer draws, air variants, dirt-path random acceptance, cached/dynamic FULL upper support, provider selection and fallback reads, flags 260, rejected writes, partial failures, repeated calls and both random streams are compared. Named providers and overlay/modifier composition use the same world. Wrapped boxes with finite native counts and failure-terminated prefixes of negative-count boxes are included; Rust bounds pathological iteration to 2^20 visits. Block entities are absent in this fixture. Resident chunks, block updates and complete gameplay remain pending.') From ea237d983f780e16d7f5b80a1642e9958e275e60 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 12:25:49 +0200 Subject: [PATCH 012/253] Implement disk replacement and chunk postprocessing marks --- .github/workflows/ci.yml | 4 + .../rust-disk-2026-10-06/scoped-parity.json | 205 ++++++++++++++++++ .../examples/simple_block_fixture.rs | 7 + crates/horizon-world/src/worldgen.rs | 1 + crates/horizon-world/src/worldgen/disk.rs | 168 ++++++++++++++ .../src/worldgen/feature_graph.rs | 13 ++ .../src/worldgen/feature_region.rs | 7 + .../src/worldgen/placement/context.rs | 4 + crates/horizon-world/tests/feature_region.rs | 26 +++ docs/rust-parity.md | 16 ++ .../parity/VanillaSimpleBlockOracle.java | 19 +- tools/test_disk_parity.py | 66 ++++++ tools/test_simple_block_parity.py | 5 +- 13 files changed, 538 insertions(+), 3 deletions(-) create mode 100644 benchmarks/rust-disk-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-world/src/worldgen/disk.rs create mode 100644 tools/test_disk_parity.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a03700e39..c4b773117 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -115,6 +115,10 @@ jobs: env: RUSTUP_TOOLCHAIN: stable run: python tools/test_block_pile_parity.py + - name: Compare disk replacement and postprocessing + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_disk_parity.py - name: Compare ordered single-block replacement features env: RUSTUP_TOOLCHAIN: stable diff --git a/benchmarks/rust-disk-2026-10-06/scoped-parity.json b/benchmarks/rust-disk-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..ca6034e06 --- /dev/null +++ b/benchmarks/rust-disk-2026-10-06/scoped-parity.json @@ -0,0 +1,205 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 76409, + "candidate_states": 35723, + "double_plant_blocks": 10, + "mossy_carpet_blocks": 1, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java": "bd07d67d22b7c851901a9dbf4bc814947162196e5f8011987dbc6f43b1720215", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSurvivalOracle.java": "4e7cc151617c1b02e872f9ca3e9fe4632379f225f4f07718ff6492df4ee551e7", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java": "99a396b9b983f6ca9149133251f3ece9aaf76d3d16dafa1f322378212a19490c", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSupportOracle.java": "04350901a2d708fb8fa672de61d058f73f332d2e90df1b93a67781862f89c1ad", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "60ff9ef7c1d5e23c080f9aec95ab2e7d3b7c5b5bcd67b9efa9518776c400629a", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_simple_block_parity.py": "50b783323051fe8cd369bb733448b0314f1e6e7994a950e4cb6cd2fe4f7f8e11", + "tools/test_disk_parity.py": "e6a149b8d51e83f620106e489423612a13c994ee480721111e2171aa4ee40d8a", + "tools/test_block_survival_parity.py": "9e8dff3bd4b95dbfd29f8adc6a2f6d66abf19a6b1cd91423b794a345d4ec244a", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b3caf26bd3afc9d10cdcca3f7e794c30abf5ba09afa1fe80ba8f44713acdb274", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "8a2834a9347ee2c2db7cf1c86a064907ec06e9ac16ba9cc3936e315fc4ad49ca", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "a8cd85f6223668c1446ff103276d80937b9707d9a7dc619a176b1b1ceed36a4a", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "2ea6d26fe88c633ad3efe7bdb6fc49f54961cbdf93b82919d79cf7d37a5c3c7d", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "3433fae1737cc1656029f4e5bf7d2fee070c0013c7cfd6f20fbd8db0b5bcc0ed", + "crates/horizon-world/src/worldgen/feature_region.rs": "3b893ceafbdd1d7b4264f4022dbdb6a7142dfc7001a5cf5c304f5ca7695dfaa0", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "e682d13a21f90605215b79f5d254bf2e524d35e89eab2e3b46384709af80b847", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "b967b71867dac7f83f6dba0eb063ad9c581aa2f29087c2128052a4eb02f199c2", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "e128b958ff24552468f4ef717847eddc7061ebcfc3db8aedc12c68d2ca6cf775", + "crates/horizon-world/examples/simple_block_fixture.rs": "ca50d73773266d3cfcc3c06947a2197bfd0882a8d604f8daa58229a732e1ba11" + }, + "fixtures_sha256": { + ".local/rust-disk-parity/inputs.txt": "e42fc82823e9d31d547df9e2b8650bbf1087d26d9b3ea5bdae24b12c2cc79f66", + ".local/rust-disk-parity/block-properties.nbt": "1aba22092f70d16b8092014c058ddc210e4aaa77bac32f6ec62e4d0e91d92a99", + ".local/rust-disk-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-disk-parity/cached-collision.nbt": "f3a5c6a5b2d51dad6c52e486e2b9989e79fd55db1a9bda6196db399550b04078", + ".local/rust-disk-parity/cached-support.nbt": "b6fdc9471b0b61e904206d3f099f4dc235aad6d723536c210be0cb7c3560d82c", + ".local/rust-disk-parity/catalog.json": "93581107e3564e60261044fdca61e3b7f237b9e6724c14b86e335ccc01198ba9", + ".local/rust-disk-parity/facts.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-disk-parity/feature-catalog.json": "c048c761c5084a40560731955cc999a364d14055bdd86fa50989a92e4a771286", + ".local/rust-disk-parity/fluid-tags.json": "f1e5eb6d22ea7effbb118a2282709cfdeef1bfae4516b775a55ad7a4df29d7d0", + ".local/rust-disk-parity/placement-definitions.json": "f8a972ec87c2352500af6481158a3192bdbf699951025639bea744e4127b97c4", + ".local/rust-disk-parity/support-cached-states.json": "353945a58fe69b352925473f1693f9b14a9ad19f13c15159c4184f2c29258622", + ".local/rust-disk-parity/survival-classes.json": "361832008eea0aa9151d367a125a19c6353d99a0b88b27dd0682f55b7954553e", + ".local/rust-disk-parity/survival-extra-definitions.json": "170f2db5bc97a49fa25cc249540aa7f04beea455cdbaf43742ed9415f5090a02", + ".local/rust-disk-parity/survival-placement-classes.json": "7fdbf48ab18c87098bbe1b6176cb81f4842b6c5d9a4d6bbaf7037ff61cb1848c", + ".local/rust-disk-parity/survival-rules.json": "8805c18b3195bb1eac1f1e5281333df56e2892505f64023e5403c58ce2ec4368", + ".local/rust-disk-parity/survival-support-tags.json": "15d88d5bb5ad10d65124d5abb2cc055d251b06d129bca7be06f55b43dc13f6fd", + ".local/rust-disk-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0" + }, + "rust_output_sha256": "5af9b8533812d5169402c8e1adff112d612409bc04badeafcc8e7293a38509f0", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "5af9b8533812d5169402c8e1adff112d612409bc04badeafcc8e7293a38509f0", + "matched_output_lines": 2816586 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "5af9b8533812d5169402c8e1adff112d612409bc04badeafcc8e7293a38509f0", + "matched_output_lines": 2816586 + } + ], + "scope": "Native DiskFeature codec and descending replacement columns, circular inclusive-box traversal, every candidate state, every state above a replacement, all valid radius/half-height constants and bounded integer provider decoding. Optional-provider gaps retain prior placement while rejected targets reset it. Two-block markAboveForPostProcessing reads stop on any air variant; chunk resolution and native ProtoChunk mark calls are traced with ordered failures. Provider draws, repeated mutations, rejected writes, both random modes and overlay/modifier composition are compared. Wrapped finite boxes and failure-terminated pathological prefixes are covered; Rust bounds visits to 2^20. This fixture checks postprocessing call order, not subsequent chunk postprocessing execution. Complete chunk generation and gameplay remain pending." +} diff --git a/crates/horizon-world/examples/simple_block_fixture.rs b/crates/horizon-world/examples/simple_block_fixture.rs index 7d2b8a777..bddefe858 100644 --- a/crates/horizon-world/examples/simple_block_fixture.rs +++ b/crates/horizon-world/examples/simple_block_fixture.rs @@ -134,6 +134,13 @@ fn query(error: impl std::fmt::Display) -> PlacementQueryError { PlacementQueryError::Failed(error.to_string()) } impl PlacementContext for World<'_, '_, W, R> { + fn mark_postprocessing(&mut self, p: [i32; 3]) -> Result<(), PlacementQueryError> { + self.event(format_args!("chunk {} {} {}", p[0], p[1], p[2])) + .map_err(query)?; + self.event(format_args!("post {} {} {}", p[0], p[1], p[2])) + .map_err(query)?; + Ok(()) + } fn water_at(&mut self, p: [i32; 3]) -> Result { Ok(self.fluid_state(p).map_err(query)?.kind().mask() & self.water_mask != 0) } diff --git a/crates/horizon-world/src/worldgen.rs b/crates/horizon-world/src/worldgen.rs index d1444a6e5..74315e8c6 100644 --- a/crates/horizon-world/src/worldgen.rs +++ b/crates/horizon-world/src/worldgen.rs @@ -17,6 +17,7 @@ pub mod carving; pub mod climate; pub mod decoration; pub mod density; +pub mod disk; pub mod feature; pub mod feature_catalog; pub mod feature_graph; diff --git a/crates/horizon-world/src/worldgen/disk.rs b/crates/horizon-world/src/worldgen/disk.rs new file mode 100644 index 000000000..f088c616f --- /dev/null +++ b/crates/horizon-world/src/worldgen/disk.rs @@ -0,0 +1,168 @@ +//! Circular descending replacement columns and postprocessing above each run. +use super::{ + DecodeError, Object, + block_feature::FeatureBlockBindings, + block_predicate::BlockPredicate, + feature::FeatureWorld, + int_range, + placement::{PlacementContext, PlacementQueryError}, + required, + state_provider::{BlockStateProvider, StateProviderError}, + value_provider::IntProvider, +}; +use crate::registry::BlockStateId; +use horizon_core::random::{InvalidBound, RandomSource}; +#[derive(Clone, Debug)] +pub struct DiskFeature { + provider: BlockStateProvider, + target: BlockPredicate, + radius: IntProvider, + half_height: i32, + air: [BlockStateId; 3], +} +#[derive(Debug)] +pub enum DiskError { + Random(InvalidBound), + Provider(StateProviderError), + Query(PlacementQueryError), + World(E), + WorkLimit, +} +impl std::fmt::Display for DiskError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Random(e) => e.fmt(f), + Self::Provider(e) => e.fmt(f), + Self::Query(e) => e.fmt(f), + Self::World(e) => e.fmt(f), + Self::WorkLimit => f.write_str("disk feature work limit exceeded"), + } + } +} +impl std::error::Error for DiskError {} +impl DiskFeature { + pub fn from_json(json: &str, bindings: &FeatureBlockBindings<'_>) -> Result { + Self::decode(json, bindings, 0, &mut 65536) + } + pub(crate) fn decode( + json: &str, + bindings: &FeatureBlockBindings<'_>, + depth: usize, + remaining: &mut usize, + ) -> Result { + if depth > 128 || *remaining == 0 { + return Err(DecodeError::Field("disk depth or work")); + } + *remaining -= 1; + let object: Object = serde_json::from_str(json)?; + let (providers, catalog, _) = bindings + .simple_blocks + .as_ref() + .ok_or(DecodeError::Field("disk provider bindings"))?; + let provider = catalog.provider_with_budget( + required(&object, "state_provider")?.get(), + providers, + depth + 1, + remaining, + )?; + let target = BlockPredicate::decode_with_blocks( + required(&object, "target")?.get(), + depth + 1, + remaining, + Some(bindings), + )?; + let radius = IntProvider::decode(required(&object, "radius")?, depth + 1, remaining)?; + if radius.bounds()[0] < 0 || radius.bounds()[1] > 8 { + return Err(DecodeError::Field("disk radius range")); + } + let half_height = int_range(required(&object, "half_height")?, "disk half height", 0, 4)?; + Ok(Self { + provider, + target, + radius, + half_height, + air: bindings.air, + }) + } + pub fn place( + &self, + world: &mut W, + random: &mut impl RandomSource, + origin: [i32; 3], + ) -> Result> { + let top = origin[1].wrapping_add(self.half_height); + let bottom = origin[1].wrapping_sub(self.half_height).wrapping_sub(1); + let radius = self.radius.sample(random).map_err(DiskError::Random)?; + let x0 = origin[0].wrapping_sub(radius); + let x1 = origin[0].wrapping_add(radius); + let z0 = origin[2].wrapping_sub(radius); + let z1 = origin[2].wrapping_add(radius); + let min_x = x0.min(x1); + let min_z = z0.min(z1); + let width = x0.max(x1).wrapping_sub(min_x).wrapping_add(1); + let depth = z0.max(z1).wrapping_sub(min_z).wrapping_add(1); + let count = width.wrapping_mul(depth); + let mut index = 0; + let mut remaining = 1_048_576; + let mut any = false; + while index != count { + spend(&mut remaining)?; + let x = min_x.wrapping_add(index % width); + let z = min_z.wrapping_add(index / width); + index = index.wrapping_add(1); + let dx = x.wrapping_sub(origin[0]); + let dz = z.wrapping_sub(origin[2]); + if dx.wrapping_mul(dx).wrapping_add(dz.wrapping_mul(dz)) > radius.wrapping_mul(radius) { + continue; + } + let mut y = top; + let mut previous_placed = false; + while y > bottom { + spend(&mut remaining)?; + let p = [x, y, z]; + if self.target.test(world, p).map_err(DiskError::Query)? { + if let Some(state) = self + .provider + .get_optional_state(world, random, p) + .map_err(DiskError::Provider)? + { + world.set_block(p, state, 2).map_err(DiskError::World)?; + if !previous_placed { + self.mark_above(world, p)?; + } + any = true; + previous_placed = true; + } + } else { + previous_placed = false; + } + y = y.wrapping_sub(1); + } + } + Ok(any) + } + fn mark_above( + &self, + world: &mut W, + mut p: [i32; 3], + ) -> Result<(), DiskError> { + for _ in 0..2 { + p[1] = p[1].wrapping_add(1); + if self + .air + .contains(&world.block(p).map_err(DiskError::World)?) + { + break; + } + world.mark_postprocessing(p).map_err(DiskError::Query)?; + } + Ok(()) + } +} +fn spend(remaining: &mut usize) -> Result<(), DiskError> { + if *remaining == 0 { + return Err(DiskError::WorkLimit); + } + *remaining -= 1; + Ok(()) +} diff --git a/crates/horizon-world/src/worldgen/feature_graph.rs b/crates/horizon-world/src/worldgen/feature_graph.rs index 18afd444d..32f9fa25a 100644 --- a/crates/horizon-world/src/worldgen/feature_graph.rs +++ b/crates/horizon-world/src/worldgen/feature_graph.rs @@ -46,6 +46,7 @@ pub enum FeatureDefinition { }, BlockColumn(super::block_column::BlockColumnFeature), BlockPile(super::block_pile::BlockPileFeature), + Disk(super::disk::DiskFeature), SimpleBlock(super::simple_block::SimpleBlockFeature), FillLayer(FillLayerFeature), ReplaceBlock(ReplaceBlockFeature), @@ -67,6 +68,7 @@ pub enum FeatureExecutionError { Provider(super::state_provider::StateProviderError), BlockColumn(super::block_column::BlockColumnError), BlockPile(super::block_pile::BlockPileError), + Disk(super::disk::DiskError), SimpleBlock(super::simple_block::SimpleBlockError), Random(InvalidBound), Query(PlacementQueryError), @@ -80,6 +82,7 @@ impl std::fmt::Display for FeatureExecutionError { Self::Provider(e) => e.fmt(f), Self::BlockColumn(e) => e.fmt(f), Self::BlockPile(e) => e.fmt(f), + Self::Disk(e) => e.fmt(f), Self::SimpleBlock(e) => e.fmt(f), Self::Random(e) => e.fmt(f), Self::Query(e) => e.fmt(f), @@ -246,6 +249,13 @@ impl FeatureDefinition { )?)?; match kind.as_str() { "minecraft:no_op" => Ok(Self::NoOp), + "minecraft:disk" => super::disk::DiskFeature::decode( + json, + blocks.ok_or(DecodeError::Field("disk bindings"))?, + depth, + remaining, + ) + .map(Self::Disk), "minecraft:block_pile" => super::block_pile::BlockPileFeature::decode( json, blocks.ok_or(DecodeError::Field("block pile bindings"))?, @@ -551,6 +561,9 @@ impl FeatureDefinition { .place(world, random, origin, run.blocks) .map_err(FeatureExecutionError::Basic), Self::NoOp => Ok(true), + Self::Disk(feature) => feature + .place(world, random, origin) + .map_err(FeatureExecutionError::Disk), Self::BlockPile(feature) => feature .place(world, random, origin) .map_err(FeatureExecutionError::BlockPile), diff --git a/crates/horizon-world/src/worldgen/feature_region.rs b/crates/horizon-world/src/worldgen/feature_region.rs index 242e61d73..d96636750 100644 --- a/crates/horizon-world/src/worldgen/feature_region.rs +++ b/crates/horizon-world/src/worldgen/feature_region.rs @@ -136,6 +136,10 @@ impl<'r, B: TerrainBlockStates> TerrainRegion<'r, B> { } } impl PlacementContext for TerrainRegion<'_, B> { + fn mark_postprocessing(&mut self, [x, y, z]: [i32; 3]) -> Result<(), PlacementQueryError> { + self.chunk_mut(x >> 4, z >> 4)?.mark_postprocessing(x, y, z); + Ok(()) + } fn generation(&self) -> WorldGenerationContext { self.generation } @@ -193,6 +197,9 @@ impl<'a, 'r, B: TerrainBlockStates, F> TerrainFeatureAccess<'a, 'r, B, F> { } } impl PlacementContext for TerrainFeatureAccess<'_, '_, B, F> { + fn mark_postprocessing(&mut self, position: [i32; 3]) -> Result<(), PlacementQueryError> { + self.region.mark_postprocessing(position) + } fn generation(&self) -> WorldGenerationContext { self.region.generation() } diff --git a/crates/horizon-world/src/worldgen/placement/context.rs b/crates/horizon-world/src/worldgen/placement/context.rs index 13eead886..6e9eacec9 100644 --- a/crates/horizon-world/src/worldgen/placement/context.rs +++ b/crates/horizon-world/src/worldgen/placement/context.rs @@ -26,6 +26,10 @@ pub enum LayerBlock { Ground, } pub trait PlacementContext { + /// Resolve the containing chunk and mark this position for postprocessing. + fn mark_postprocessing(&mut self, _position: [i32; 3]) -> Result<(), PlacementQueryError> { + Err(PlacementQueryError::Unavailable) + } /// Test the current fluid at this position against the world's water tag. fn water_at(&mut self, _position: [i32; 3]) -> Result { Err(PlacementQueryError::Unavailable) diff --git a/crates/horizon-world/tests/feature_region.rs b/crates/horizon-world/tests/feature_region.rs index 1209a5282..9cb2d7f5f 100644 --- a/crates/horizon-world/tests/feature_region.rs +++ b/crates/horizon-world/tests/feature_region.rs @@ -146,3 +146,29 @@ fn write_callback_controls_mutation_and_receives_all_flags() { } assert_eq!(flags, [2, 3]); } + +#[test] +fn postprocessing_routes_to_resident_chunks_and_preserves_partial_marks() { + let registry = registry(); + let chunk = TerrainChunk::new(ChunkPos::new(-1, 1), -16, 32, ®istry, Properties).unwrap(); + let mut region = + TerrainRegion::new(vec![chunk], WorldGenerationContext::new(-16, 32, 8)).unwrap(); + { + let mut world = TerrainFeatureAccess::new( + &mut region, + |_: &mut TerrainRegion<'_, Properties>, _: [i32; 3], _: BlockStateId, _: i32| { + Ok::<_, RegionError>(false) + }, + ); + world.mark_postprocessing([-1, -1, 16]).unwrap(); + world.mark_postprocessing([-1, -1, 16]).unwrap(); + world.mark_postprocessing([-16, 0, 31]).unwrap(); + world.mark_postprocessing([-1, -17, 16]).unwrap(); + world.mark_postprocessing([-1, 16, 16]).unwrap(); + assert!(world.mark_postprocessing([0, 0, 16]).is_err()); + } + assert_eq!( + region.chunk(-1, 1).unwrap().postprocessing(), + &[vec![255, 255], vec![3840]] + ); +} diff --git a/docs/rust-parity.md b/docs/rust-parity.md index 122e91854..20f04e3ae 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -428,3 +428,19 @@ Ordinary piles visit at most 98 cells. Rust preserves wrapped native box travers but limits pathological iteration to 2^20 cells; negative-count overflow fixtures compare failure-terminated prefixes. Dynamic block entities are absent in this feature fixture, and resident-world block updates remain pending. + +## Disk replacement and postprocessing + +Disk features now decode bounded radii and half-heights, traverse circular +columns in native order, apply optional providers, and mark up to two non-air +blocks above each replacement run. Failed target predicates end a run; empty +optional providers preserve it. Postprocessing requests resolve the containing +resident chunk and retain duplicate marks and prior effects after a failure. + +The [disk comparison](../benchmarks/rust-disk-2026-10-06/scoped-parity.json) +matches **2,816,586 output lines per reference JAR** across **76,409 fixtures**. +Every candidate state and every possible above-state is covered, alongside +random providers, rejected writes, partial failures, wrapped coordinates and +composed placement. Chunk-resolution and native ProtoChunk mark calls are +traced; later chunk postprocessing execution is outside this comparison. +Workspace tests, all-target Clippy and all 149 Python tests pass. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java index 9c954a363..e52341db0 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java @@ -16,7 +16,8 @@ import net.minecraft.world.level.levelgen.*; import net.minecraft.world.level.levelgen.feature.SimpleBlockFeature; import net.minecraft.world.level.levelgen.feature.Feature; import net.minecraft.world.level.levelgen.placement.*; -import net.minecraft.world.level.chunk.ChunkGenerator; +import net.minecraft.world.level.chunk.*; +import net.minecraft.world.level.biome.*; import net.minecraft.world.level.levelgen.feature.stateproviders.BlockStateProvider; /** Actual native simple-block map codec and mutable world placement. */ @@ -34,15 +35,31 @@ public final class VanillaSimpleBlockOracle { } private static BlockPos pos(JsonArray a){return new BlockPos(a.get(0).getAsInt(),a.get(1).getAsInt(),a.get(2).getAsInt());} private static String xyz(BlockPos p){return p.getX()+" "+p.getY()+" "+p.getZ();} + private static final class Chunks { + static final PalettedContainerFactory FACTORY; + static { + Holder biome=Holder.Reference.createStandAlone(new HolderOwner(){},Biomes.PLAINS); + var ids=new IdMapper>();ids.add(biome); + FACTORY=new PalettedContainerFactory(Strategy.createForBlockStates(Block.BLOCK_STATE_REGISTRY),Blocks.AIR.defaultBlockState(),null,Strategy.createForBiomes(ids),biome,null); + } + } private static final class World implements InvocationHandler { final JsonObject f;final PrintWriter out;final RandomSource random;int calls; final TreeMap states=new TreeMap<>(Comparator.comparingInt(BlockPos::getX).thenComparingInt(BlockPos::getY).thenComparingInt(BlockPos::getZ)); World(JsonObject f,PrintWriter out,RandomSource random){this.f=f;this.out=out;this.random=random;for(var raw:f.getAsJsonArray("states")){var v=raw.getAsJsonArray();states.put(pos(v),Block.stateById(v.get(3).getAsInt()));}} + final Map chunks=new HashMap<>(); + ProtoChunk chunk(BlockPos p) { + event("chunk "+xyz(p));var key=new ChunkPos(p.getX()>>4,p.getZ()>>4); + return chunks.computeIfAbsent(key,cp->new ProtoChunk(cp,UpgradeData.EMPTY,LevelHeightAccessor.create(-64,384),Chunks.FACTORY,null){ + @Override public void markPosForPostProcessing(BlockPos position){event("post "+xyz(position));super.markPosForPostProcessing(position);} + }); + } void event(String text){out.println(text);if(calls++==f.get("fail").getAsInt())throw new Stop();} BlockState at(BlockPos p){return states.getOrDefault(p,Block.stateById(f.get("fallback").getAsInt()));} public Object invoke(Object proxy,Method method,Object[] args)throws Throwable { String name=method.getName(); if(name.equals("getRandom"))return random; + if(name.equals("getChunk")&&args.length==1&&args[0] instanceof BlockPos)return chunk((BlockPos)args[0]); if(name.equals("getMinY"))return -64; if(name.equals("getHeight")&&(args==null||args.length==0))return 384; if(name.equals("getSeaLevel"))return 63; diff --git a/tools/test_disk_parity.py b/tools/test_disk_parity.py new file mode 100644 index 000000000..5987aad22 --- /dev/null +++ b/tools/test_disk_parity.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python3 +"""Compare disk columns, optional providers and postprocessing query order.""" +import itertools +import json +try: + from . import test_simple_block_parity as harness +except ImportError: + import test_simple_block_parity as harness + + +def corpus(facts, placement): + states = facts['states']; get = lambda name: facts['defaults']['minecraft:' + name] + def disk(provider=None, **extra): + value = {'type': 'disk', 'state_provider': provider if provider is not None else {'id': 'clay'}, + 'target': {'type': 'true'}, 'radius': 0, 'half_height': 0} + value.update(extra); return value + def case(definition=None, **extra): + value = {'definition': json.dumps(definition if definition is not None else disk(), separators=(',', ':')), + 'mode': 'feature', 'origin': [0, 64, 0], 'legacy': False, 'seed': 0, 'world_seed': 1, + 'fail': -1, 'reject': 0, 'brightness': 15, 'fallback': get('stone'), 'states': [], 'repeats': 2} + value.update(extra); return value + for state in states: + yield case(disk(state)) + for state in range(len(states)): + yield case(states=[[0, 65, 0, state], [0, 66, 0, state]]) + empty = {'type': 'random_block', 'blocks': []} + selective = {'type': 'rule_based', 'fallback': {'id': 'clay'}, 'rules': [ + {'if_true': {'type': 'matching_blocks', 'blocks': 'water'}, 'then': empty}]} + providers = [{'id': 'clay'}, empty, selective, {'type': 'random_block', 'blocks': ['clay', 'air', 'water']}, + {'type': 'rotated', 'state': {'id': 'oak_log'}}, 'horizon:stone'] + targets = [{'type': 'true'}, {'type': 'not', 'predicate': {'type': 'true'}}, + {'type': 'matching_blocks', 'blocks': ['stone', 'water']}, + {'type': 'solid'}, {'type': 'replaceable'}, {'type': 'has_sturdy_face', 'direction': 'up'}] + for provider, target, legacy, seed, fail, reject in itertools.product( + providers, targets, [False, True], [0, -1, 0x123456789abcdef], [-1, 0, 1, 2, 4, 7, 12], [0, 1, 3]): + yield case(disk(provider, target=target, radius={'type': 'uniform', 'min_inclusive': 0, 'max_inclusive': 2}, half_height=2), + states=[[0, 65, 0, get('water')], [0, 63, 0, get('air')]], legacy=legacy, seed=seed, fail=fail, reject=reject) + # Optional-provider gaps retain the preceding placement flag; failed target + # tests reset it. Air above a column stops the two-position postprocessing. + for middle, above, fail in itertools.product(['water', 'air', 'stone'], ['air', 'cave_air', 'void_air', 'stone'], [-1, *range(22)]): + yield case(disk(selective, target={'type': 'matching_blocks', 'blocks': ['stone', 'water']}, half_height=2), + states=[[0, 65, 0, get(middle)], [0, 67, 0, get(above)], [0, 63, 0, get('air')]], fail=fail) + for radius, height in itertools.product(range(9), range(5)): + yield case(disk(radius=radius, half_height=height), repeats=1) + for x, y, z in itertools.product([2147483647, -2147483648], [-64, 319, 2147483647, -2147483648], [2147483647, -2147483648]): + for height in [0, 1, 4]: + # Bottom overflow can make a native column enormous; interrupt its + # first query after comparing the exact traversal prefix. + yield case(disk(radius=2, half_height=height), origin=[x,y,z], fail=0 if y == -2147483648 else -1, repeats=1) + for origin in [[2147483647,64,0], [0,64,-2147483648]]: + yield case(disk(radius=2), origin=origin, fail=0, repeats=1) + for key, values in [('state_provider',[None,False,{},'missing']), ('target',[None,False,{}]), + ('radius',[None,-1,0,8,9,{'type':'uniform','min_inclusive':0,'max_inclusive':9}]), + ('half_height',[None,-1,0,4,5,False,'1'])]: + for value in values: + definition=disk();definition[key]=value;yield case(definition) + definition=disk();del definition[key];yield case(definition) + for legacy, fail, reject in itertools.product([False,True],[-1,0,3,10],[0,3]): + placed={'feature':disk(selective,radius=1,half_height=1),'placement':[{'type':'count','count':2},{'type':'in_square'}]} + yield case(placed,mode='placed',legacy=legacy,fail=fail,reject=reject) + yield case({'type':'overlay','features':[placed,{'feature':'horizon:moss','placement':[]}]},legacy=legacy,fail=fail,reject=reject) + + +if __name__ == '__main__': + harness.run(corpus, 'rust-disk-parity', __file__, + 'Native DiskFeature codec and descending replacement columns, circular inclusive-box traversal, every candidate state, every state above a replacement, all valid radius/half-height constants and bounded integer provider decoding. Optional-provider gaps retain prior placement while rejected targets reset it. Two-block markAboveForPostProcessing reads stop on any air variant; chunk resolution and native ProtoChunk mark calls are traced with ordered failures. Provider draws, repeated mutations, rejected writes, both random modes and overlay/modifier composition are compared. Wrapped finite boxes and failure-terminated pathological prefixes are covered; Rust bounds visits to 2^20. This fixture checks postprocessing call order, not subsequent chunk postprocessing execution. Complete chunk generation and gameplay remain pending.') diff --git a/tools/test_simple_block_parity.py b/tools/test_simple_block_parity.py index 1f370e25c..ac7be3c48 100644 --- a/tools/test_simple_block_parity.py +++ b/tools/test_simple_block_parity.py @@ -88,6 +88,7 @@ def corpus(facts, placement): def run(corpus, build_name, source_file, scope): parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + label=build_name.removeprefix('rust-').removesuffix('-parity') build=lab.LOCAL/build_name;build.mkdir(parents=True,exist_ok=True);report_path=build/'report.json';report_path.unlink(missing_ok=True) if args.prepare:lab.prepare() lock,jars,libraries=base.verify_artifacts();oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java' @@ -119,11 +120,11 @@ def run(corpus, build_name, source_file, scope): metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True));binary=Path(metadata['target_directory'])/'release/examples'/('simple_block_fixture.exe' if os.name=='nt' else 'simple_block_fixture') run([binary,build],'rust');references=[] for side,jar in jars.items(): - java(side,side,build);matched=base.compare(build/(side+'.txt'),build/'rust.txt');print(f'{side}: {matched:,} simple-block output lines match Rust',flush=True) + java(side,side,build);matched=base.compare(build/(side+'.txt'),build/'rust.txt');print(f'{side}: {matched:,} {label} output lines match Rust',flush=True) references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(build/(side+'.txt'),'sha256'),'matched_output_lines':matched}) base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixtures,tested_fixtures) report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':fixture_count,'candidate_states':len(facts['states']),'double_plant_blocks':len(placement['double_plants']),'mossy_carpet_blocks':len(placement['mossy_carpets']),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':scope} - lab.write_json(report_path,report);print(f'Scoped simple-block parity passed: {report_path}',flush=True) + lab.write_json(report_path,report);print(f'Scoped {label} parity passed: {report_path}',flush=True) def main(): From 7984238b3e500f9c172583a60fda5f521048fc0a Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 12:29:30 +0200 Subject: [PATCH 013/253] Implement vanilla block-blob support search and placement --- .github/workflows/ci.yml | 4 + .../scoped-parity.json | 206 ++++++++++++++++++ crates/horizon-world/src/worldgen.rs | 1 + .../horizon-world/src/worldgen/block_blob.rs | 140 ++++++++++++ .../src/worldgen/feature_graph.rs | 13 ++ docs/rust-parity.md | 14 ++ tools/test_block_blob_parity.py | 51 +++++ 7 files changed, 429 insertions(+) create mode 100644 benchmarks/rust-block-blob-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-world/src/worldgen/block_blob.rs create mode 100644 tools/test_block_blob_parity.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c4b773117..eaab30dd4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -119,6 +119,10 @@ jobs: env: RUSTUP_TOOLCHAIN: stable run: python tools/test_disk_parity.py + - name: Compare block-blob support search and geometry + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_block_blob_parity.py - name: Compare ordered single-block replacement features env: RUSTUP_TOOLCHAIN: stable diff --git a/benchmarks/rust-block-blob-2026-10-06/scoped-parity.json b/benchmarks/rust-block-blob-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..5eb47c2d6 --- /dev/null +++ b/benchmarks/rust-block-blob-2026-10-06/scoped-parity.json @@ -0,0 +1,206 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 77686, + "candidate_states": 35723, + "double_plant_blocks": 10, + "mossy_carpet_blocks": 1, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java": "bd07d67d22b7c851901a9dbf4bc814947162196e5f8011987dbc6f43b1720215", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSurvivalOracle.java": "4e7cc151617c1b02e872f9ca3e9fe4632379f225f4f07718ff6492df4ee551e7", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java": "99a396b9b983f6ca9149133251f3ece9aaf76d3d16dafa1f322378212a19490c", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSupportOracle.java": "04350901a2d708fb8fa672de61d058f73f332d2e90df1b93a67781862f89c1ad", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "60ff9ef7c1d5e23c080f9aec95ab2e7d3b7c5b5bcd67b9efa9518776c400629a", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_simple_block_parity.py": "50b783323051fe8cd369bb733448b0314f1e6e7994a950e4cb6cd2fe4f7f8e11", + "tools/test_block_blob_parity.py": "04a8dc9048db38ac3c149a7ae3d6ad828d24b4b884c7da0613e780338d687dc3", + "tools/test_block_survival_parity.py": "9e8dff3bd4b95dbfd29f8adc6a2f6d66abf19a6b1cd91423b794a345d4ec244a", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b3caf26bd3afc9d10cdcca3f7e794c30abf5ba09afa1fe80ba8f44713acdb274", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "8a2834a9347ee2c2db7cf1c86a064907ec06e9ac16ba9cc3936e315fc4ad49ca", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "a8cd85f6223668c1446ff103276d80937b9707d9a7dc619a176b1b1ceed36a4a", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", + "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "2ea6d26fe88c633ad3efe7bdb6fc49f54961cbdf93b82919d79cf7d37a5c3c7d", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "b78927059c43b0860f5e29640720b85ab4099e2e620993baa70feaf8e61b79bf", + "crates/horizon-world/src/worldgen/feature_region.rs": "3b893ceafbdd1d7b4264f4022dbdb6a7142dfc7001a5cf5c304f5ca7695dfaa0", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "e682d13a21f90605215b79f5d254bf2e524d35e89eab2e3b46384709af80b847", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "b967b71867dac7f83f6dba0eb063ad9c581aa2f29087c2128052a4eb02f199c2", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "97dcb2d79f285daab0bbbe2d2ca673edc0376b23c5cd4519e0f8818593e0a4ee", + "crates/horizon-world/examples/simple_block_fixture.rs": "ca50d73773266d3cfcc3c06947a2197bfd0882a8d604f8daa58229a732e1ba11" + }, + "fixtures_sha256": { + ".local/rust-block-blob-parity/inputs.txt": "28f9a79b0a5de2343e5119a2c0f05909cd61f10ea8df12c73891a5a134127147", + ".local/rust-block-blob-parity/block-properties.nbt": "1aba22092f70d16b8092014c058ddc210e4aaa77bac32f6ec62e4d0e91d92a99", + ".local/rust-block-blob-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-block-blob-parity/cached-collision.nbt": "f3a5c6a5b2d51dad6c52e486e2b9989e79fd55db1a9bda6196db399550b04078", + ".local/rust-block-blob-parity/cached-support.nbt": "b6fdc9471b0b61e904206d3f099f4dc235aad6d723536c210be0cb7c3560d82c", + ".local/rust-block-blob-parity/catalog.json": "93581107e3564e60261044fdca61e3b7f237b9e6724c14b86e335ccc01198ba9", + ".local/rust-block-blob-parity/facts.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-block-blob-parity/feature-catalog.json": "c048c761c5084a40560731955cc999a364d14055bdd86fa50989a92e4a771286", + ".local/rust-block-blob-parity/fluid-tags.json": "f1e5eb6d22ea7effbb118a2282709cfdeef1bfae4516b775a55ad7a4df29d7d0", + ".local/rust-block-blob-parity/placement-definitions.json": "f8a972ec87c2352500af6481158a3192bdbf699951025639bea744e4127b97c4", + ".local/rust-block-blob-parity/support-cached-states.json": "353945a58fe69b352925473f1693f9b14a9ad19f13c15159c4184f2c29258622", + ".local/rust-block-blob-parity/survival-classes.json": "361832008eea0aa9151d367a125a19c6353d99a0b88b27dd0682f55b7954553e", + ".local/rust-block-blob-parity/survival-extra-definitions.json": "170f2db5bc97a49fa25cc249540aa7f04beea455cdbaf43742ed9415f5090a02", + ".local/rust-block-blob-parity/survival-placement-classes.json": "7fdbf48ab18c87098bbe1b6176cb81f4842b6c5d9a4d6bbaf7037ff61cb1848c", + ".local/rust-block-blob-parity/survival-rules.json": "8805c18b3195bb1eac1f1e5281333df56e2892505f64023e5403c58ce2ec4368", + ".local/rust-block-blob-parity/survival-support-tags.json": "15d88d5bb5ad10d65124d5abb2cc055d251b06d129bca7be06f55b43dc13f6fd", + ".local/rust-block-blob-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0" + }, + "rust_output_sha256": "6ed1f061cc2b073147acc2bc3523e47901b95b066bef3aa1dab3627b8c122e85", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "6ed1f061cc2b073147acc2bc3523e47901b95b066bef3aa1dab3627b8c122e85", + "matched_output_lines": 2387914 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "6ed1f061cc2b073147acc2bc3523e47901b95b066bef3aa1dab3627b8c122e85", + "matched_output_lines": 2387914 + } + ], + "scope": "Native BlockBlobFeature codec, state decoding, support-predicate descent and three randomized overlapping shapes. Every candidate and supporting registry state, minimum-height returns, query failures, float radius versus double distance, inclusive box order, all three final origin-offset draws, flags 3, rejected writes, repeated mutations and both random modes are compared. Named tags, survival/support predicates and overlay/modifier composition use the same mutable world. Positions near signed integer limits avoid pathological native overflow boxes; Rust bounds descent and box work to 2^20 visits. Resident-world update callbacks and complete gameplay remain pending." +} diff --git a/crates/horizon-world/src/worldgen.rs b/crates/horizon-world/src/worldgen.rs index 74315e8c6..97ab4dd7a 100644 --- a/crates/horizon-world/src/worldgen.rs +++ b/crates/horizon-world/src/worldgen.rs @@ -7,6 +7,7 @@ pub mod biome_chunk; pub mod biome_predicate; pub mod biome_source; pub mod biome_temperature; +pub mod block_blob; pub mod block_column; pub mod block_feature; pub mod block_pile; diff --git a/crates/horizon-world/src/worldgen/block_blob.rs b/crates/horizon-world/src/worldgen/block_blob.rs new file mode 100644 index 000000000..ad866b8d5 --- /dev/null +++ b/crates/horizon-world/src/worldgen/block_blob.rs @@ -0,0 +1,140 @@ +//! Descending support search and three overlapping randomized block blobs. +use super::{ + DecodeError, Object, + block_feature::FeatureBlockBindings, + block_predicate::BlockPredicate, + feature::FeatureWorld, + placement::{PlacementContext, PlacementQueryError}, + required, +}; +use crate::registry::BlockStateId; +use horizon_core::random::{InvalidBound, RandomSource}; +#[derive(Clone, Debug)] +pub struct BlockBlobFeature { + state: BlockStateId, + can_place_on: BlockPredicate, +} +#[derive(Debug)] +pub enum BlockBlobError { + Random(InvalidBound), + Query(PlacementQueryError), + World(E), + WorkLimit, +} +impl std::fmt::Display for BlockBlobError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Random(e) => e.fmt(f), + Self::Query(e) => e.fmt(f), + Self::World(e) => e.fmt(f), + Self::WorkLimit => f.write_str("block blob work limit exceeded"), + } + } +} +impl std::error::Error for BlockBlobError {} +impl BlockBlobFeature { + pub fn from_json(json: &str, bindings: &FeatureBlockBindings<'_>) -> Result { + Self::decode(json, bindings, 0, &mut 65536) + } + pub(crate) fn decode( + json: &str, + bindings: &FeatureBlockBindings<'_>, + depth: usize, + remaining: &mut usize, + ) -> Result { + if depth > 128 || *remaining == 0 { + return Err(DecodeError::Field("block blob depth or work")); + } + *remaining -= 1; + let object: Object = serde_json::from_str(json)?; + Ok(Self { + state: bindings + .codec + .decode(required(&object, "state")?.get(), false) + .map_err(|e| DecodeError::Registry(e.to_string()))?, + can_place_on: BlockPredicate::decode_with_blocks( + required(&object, "can_place_on")?.get(), + depth + 1, + remaining, + Some(bindings), + )?, + }) + } + pub fn place( + &self, + world: &mut W, + random: &mut impl RandomSource, + mut origin: [i32; 3], + ) -> Result> { + let mut remaining = 1_048_576; + while origin[1] + > world + .min_y() + .map_err(BlockBlobError::Query)? + .wrapping_add(3) + { + spend(&mut remaining)?; + let below = [origin[0], origin[1].wrapping_sub(1), origin[2]]; + if self + .can_place_on + .test(world, below) + .map_err(BlockBlobError::Query)? + { + break; + } + origin = below; + } + if origin[1] + <= world + .min_y() + .map_err(BlockBlobError::Query)? + .wrapping_add(3) + { + return Ok(false); + } + for _ in 0..3 { + let rx = random.next_int_bound(2).map_err(BlockBlobError::Random)?; + let ry = random.next_int_bound(2).map_err(BlockBlobError::Random)?; + let rz = random.next_int_bound(2).map_err(BlockBlobError::Random)?; + let radius = (rx + ry + rz) as f32 * 0.333 + 0.5; + let offset = [rx, ry, rz]; + let a: [i32; 3] = std::array::from_fn(|i| origin[i].wrapping_sub(offset[i])); + let b: [i32; 3] = std::array::from_fn(|i| origin[i].wrapping_add(offset[i])); + let min: [i32; 3] = std::array::from_fn(|i| a[i].min(b[i])); + let sizes: [i32; 3] = + std::array::from_fn(|i| a[i].max(b[i]).wrapping_sub(min[i]).wrapping_add(1)); + let count = sizes[0].wrapping_mul(sizes[1]).wrapping_mul(sizes[2]); + let mut index: i32 = 0; + while index != count { + spend(&mut remaining)?; + let quotient = index / sizes[0]; + let p = [ + min[0].wrapping_add(index % sizes[0]), + min[1].wrapping_add(quotient % sizes[1]), + min[2].wrapping_add(quotient / sizes[1]), + ]; + index = index.wrapping_add(1); + let d: [f64; 3] = std::array::from_fn(|i| f64::from(p[i]) - f64::from(origin[i])); + if d[0] * d[0] + d[1] * d[1] + d[2] * d[2] <= f64::from(radius * radius) { + world + .set_block(p, self.state, 3) + .map_err(BlockBlobError::World)?; + } + } + origin[0] = origin[0] + .wrapping_add(-1 + random.next_int_bound(2).map_err(BlockBlobError::Random)?); + origin[1] = + origin[1].wrapping_sub(random.next_int_bound(2).map_err(BlockBlobError::Random)?); + origin[2] = origin[2] + .wrapping_add(-1 + random.next_int_bound(2).map_err(BlockBlobError::Random)?); + } + Ok(true) + } +} +fn spend(remaining: &mut usize) -> Result<(), BlockBlobError> { + if *remaining == 0 { + return Err(BlockBlobError::WorkLimit); + } + *remaining -= 1; + Ok(()) +} diff --git a/crates/horizon-world/src/worldgen/feature_graph.rs b/crates/horizon-world/src/worldgen/feature_graph.rs index 32f9fa25a..ea83661d5 100644 --- a/crates/horizon-world/src/worldgen/feature_graph.rs +++ b/crates/horizon-world/src/worldgen/feature_graph.rs @@ -47,6 +47,7 @@ pub enum FeatureDefinition { BlockColumn(super::block_column::BlockColumnFeature), BlockPile(super::block_pile::BlockPileFeature), Disk(super::disk::DiskFeature), + BlockBlob(super::block_blob::BlockBlobFeature), SimpleBlock(super::simple_block::SimpleBlockFeature), FillLayer(FillLayerFeature), ReplaceBlock(ReplaceBlockFeature), @@ -69,6 +70,7 @@ pub enum FeatureExecutionError { BlockColumn(super::block_column::BlockColumnError), BlockPile(super::block_pile::BlockPileError), Disk(super::disk::DiskError), + BlockBlob(super::block_blob::BlockBlobError), SimpleBlock(super::simple_block::SimpleBlockError), Random(InvalidBound), Query(PlacementQueryError), @@ -83,6 +85,7 @@ impl std::fmt::Display for FeatureExecutionError { Self::BlockColumn(e) => e.fmt(f), Self::BlockPile(e) => e.fmt(f), Self::Disk(e) => e.fmt(f), + Self::BlockBlob(e) => e.fmt(f), Self::SimpleBlock(e) => e.fmt(f), Self::Random(e) => e.fmt(f), Self::Query(e) => e.fmt(f), @@ -249,6 +252,13 @@ impl FeatureDefinition { )?)?; match kind.as_str() { "minecraft:no_op" => Ok(Self::NoOp), + "minecraft:block_blob" => super::block_blob::BlockBlobFeature::decode( + json, + blocks.ok_or(DecodeError::Field("block blob bindings"))?, + depth, + remaining, + ) + .map(Self::BlockBlob), "minecraft:disk" => super::disk::DiskFeature::decode( json, blocks.ok_or(DecodeError::Field("disk bindings"))?, @@ -561,6 +571,9 @@ impl FeatureDefinition { .place(world, random, origin, run.blocks) .map_err(FeatureExecutionError::Basic), Self::NoOp => Ok(true), + Self::BlockBlob(feature) => feature + .place(world, random, origin) + .map_err(FeatureExecutionError::BlockBlob), Self::Disk(feature) => feature .place(world, random, origin) .map_err(FeatureExecutionError::Disk), diff --git a/docs/rust-parity.md b/docs/rust-parity.md index 20f04e3ae..be99695da 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -444,3 +444,17 @@ random providers, rejected writes, partial failures, wrapped coordinates and composed placement. Chunk-resolution and native ProtoChunk mark calls are traced; later chunk postprocessing execution is outside this comparison. Workspace tests, all-target Clippy and all 149 Python tests pass. + +## Block-blob placement + +Block blobs descend until their support predicate accepts the block below, then +write three overlapping randomized shapes with flags 3. Radius calculations +retain native float precision while position distances use double precision; +even the last shape consumes its three origin-offset draws. + +The [block-blob comparison](../benchmarks/rust-block-blob-2026-10-06/scoped-parity.json) +matches **2,387,914 lines per reference JAR** over **77,686 fixtures**, including +every candidate/supporting state, repeated calls, early returns, failed queries, +rejected writes, partial failures and overlay/modifier composition. Workspace +tests and all-target Clippy pass. Rust bounds pathological traversal work; +resident-world update callbacks and full gameplay remain pending. diff --git a/tools/test_block_blob_parity.py b/tools/test_block_blob_parity.py new file mode 100644 index 000000000..951830f98 --- /dev/null +++ b/tools/test_block_blob_parity.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python3 +"""Compare block-blob descent, three randomized shapes and state mutations.""" +import itertools +import json +try: + from . import test_simple_block_parity as harness +except ImportError: + import test_simple_block_parity as harness + + +def corpus(facts, placement): + states=facts['states'];get=lambda name:facts['defaults']['minecraft:'+name] + def blob(state=None, **extra): + value={'type':'block_blob','state':state if state is not None else {'id':'mossy_cobblestone'},'can_place_on':{'type':'matching_blocks','blocks':'stone'}} + value.update(extra);return value + def case(definition=None, **extra): + value={'definition':json.dumps(definition if definition is not None else blob(),separators=(',',':')), + 'mode':'feature','origin':[0,64,0],'legacy':False,'seed':0,'world_seed':1,'fail':-1,'reject':0, + 'brightness':15,'fallback':get('stone'),'states':[],'repeats':2} + value.update(extra);return value + for state in states:yield case(blob(state)) + for state in range(len(states)): + yield case(origin=[0,-60,0],states=[[0,-61,0,state]],repeats=1) + predicates=[{'type':'true'},{'type':'not','predicate':{'type':'true'}}, + {'type':'matching_blocks','blocks':['stone','water']}, + {'type':'matching_blocks','blocks':'#minecraft:logs'}, + {'type':'has_sturdy_face','direction':'up'}, + {'type':'would_survive','state':'short_grass'}, {'type':'solid'}] + for predicate,legacy,seed,fail,reject in itertools.product(predicates,[False,True],range(24),[-1,0,1,3,9,19],[0,1,3]): + yield case(blob(can_place_on=predicate),legacy=legacy,seed=seed,fail=fail,reject=reject, + origin=[15,-48,15],states=[[15,-49,15,get('air')],[15,-50,15,get('oak_log')]]) + for height,depth in itertools.product([-64,-62,-61,-60,-59,0,319,320],range(8)): + initial=[[0,height-1-offset,0,get('air')] for offset in range(depth)] + yield case(origin=[0,height,0],states=initial) + for legacy,seed,origin in itertools.product([False,True],[0,-1,0x123456789abcdef], + [[-2147483640,64,-2147483640],[2147483640,64,2147483640],[-17,-2147483648,-33]]): + yield case(legacy=legacy,seed=seed,origin=origin) + for key,values in [('state',[None,False,{},[],{'id':'missing'},'missing',{'id':'oak_log','properties':{'axis':'invalid'}}]), + ('can_place_on',[None,False,{},[],{'type':'missing'}])]: + for value in values: + definition=blob();definition[key]=value;yield case(definition) + definition=blob();del definition[key];yield case(definition) + for legacy,seed,fail,reject in itertools.product([False,True],[0,-1,0x123456789abcdef],[-1,0,5,17],[0,3]): + placed={'feature':blob(),'placement':[{'type':'count','count':2},{'type':'in_square'}]} + yield case(placed,mode='placed',legacy=legacy,seed=seed,fail=fail,reject=reject) + yield case({'type':'overlay','features':[placed,{'feature':'horizon:moss','placement':[]}]},legacy=legacy,seed=seed,fail=fail,reject=reject) + + +if __name__=='__main__': + harness.run(corpus,'rust-block-blob-parity',__file__, + 'Native BlockBlobFeature codec, state decoding, support-predicate descent and three randomized overlapping shapes. Every candidate and supporting registry state, minimum-height returns, query failures, float radius versus double distance, inclusive box order, all three final origin-offset draws, flags 3, rejected writes, repeated mutations and both random modes are compared. Named tags, survival/support predicates and overlay/modifier composition use the same mutable world. Positions near signed integer limits avoid pathological native overflow boxes; Rust bounds descent and box work to 2^20 visits. Resident-world update callbacks and complete gameplay remain pending.') From 27cbdfdbdec5bef1aeba6edbfaae5ea0d862ef78 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 12:32:23 +0200 Subject: [PATCH 014/253] Implement native fluid-state JSON decoding and encoding --- .../rust-fluid-2026-10-06/scoped-parity.json | 73 ++++++++++++------- .../horizon-world/examples/fluid_fixture.rs | 17 +++++ crates/horizon-world/src/fluid.rs | 66 +++++++++++++++++ crates/horizon-world/src/registry.rs | 1 + crates/horizon-world/src/registry/json.rs | 2 +- docs/rust-parity.md | 13 ++++ .../horizonlab/parity/VanillaFluidOracle.java | 12 +++ tools/test_fluid_parity.py | 20 ++++- 8 files changed, 173 insertions(+), 31 deletions(-) diff --git a/benchmarks/rust-fluid-2026-10-06/scoped-parity.json b/benchmarks/rust-fluid-2026-10-06/scoped-parity.json index d19807d8a..534f7a6f4 100644 --- a/benchmarks/rust-fluid-2026-10-06/scoped-parity.json +++ b/benchmarks/rust-fluid-2026-10-06/scoped-parity.json @@ -7,13 +7,14 @@ "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", "block_states": 35723, "fluid_kinds": 5, + "codec_fixtures": 2432, "fixtures": 40344, "requested_height_queries": 80688, "sources_sha256": { - "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFluidOracle.java": "616e256245f1a95069745b7cde26ade08ae16dadd7e9224fa54abf16cef9fee9", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFluidOracle.java": "bae87f5d7626cbb09132dc8c4e5b221a307cc377cc25b1141819d55220806e0d", "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", - "tools/test_fluid_parity.py": "3728655b2e524a01bfaac137dd9351bf3f4e7b4053037ec72049e6f549d38ba2", - "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/test_fluid_parity.py": "d5fffccdc93b58a7775ea9504f1529820d984de052a4ad536d05cb0ed32cbe29", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", @@ -52,8 +53,9 @@ "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", - "crates/horizon-core/src/geometry/shape.rs": "de22acd7430df3f69ef3632d427c57dffe57f3bdb78950bc75eac7e179ccf9df", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", @@ -75,30 +77,42 @@ "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b3caf26bd3afc9d10cdcca3f7e794c30abf5ba09afa1fe80ba8f44713acdb274", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", - "crates/horizon-world/src/collision.rs": "6c40ab491efd0332bd4e65a1a112f3598f9eb0ea2f32f9c8cc7e81278d003251", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", - "crates/horizon-world/src/fluid.rs": "8a2834a9347ee2c2db7cf1c86a064907ec06e9ac16ba9cc3936e315fc4ad49ca", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", - "crates/horizon-world/src/lib.rs": "06aa7b44e1229b3cf50abcf3827f2cacd7ae54321865873bdba0f371cb458b3f", + "crates/horizon-world/src/lib.rs": "a8cd85f6223668c1446ff103276d80937b9707d9a7dc619a176b1b1ceed36a4a", "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", - "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", - "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/registry/json.rs": "1eae82604d2b3377fd35aaa3a914a67e5af28f93923815a49e895b4d437433cd", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", - "crates/horizon-world/src/worldgen/biome.rs": "b3b73091aa5ec989d916206567c5e4b0e997b007a5bb9c0ca5c53ada9d5fe81f", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", - "crates/horizon-world/src/worldgen/block_feature.rs": "f8c2ef2de1cfe9a8689a7375d4bf0cc00431484e06f6d4b2b95aabac8fdfffb0", - "crates/horizon-world/src/worldgen/block_predicate.rs": "8513e9d96c8626594b5ee078bf20ccf3de90fc9f9d7123780d1cab5eefb6b5c2", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "2ea6d26fe88c633ad3efe7bdb6fc49f54961cbdf93b82919d79cf7d37a5c3c7d", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", @@ -107,12 +121,13 @@ "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", - "crates/horizon-world/src/worldgen/decoration.rs": "297524aefeb4567c5f5c0c1678013e44002eb91ca16ee63b51ffacf93f31a095", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", - "crates/horizon-world/src/worldgen/feature_catalog.rs": "486fe9d8588eb09e0ee5707a0541b0df167b63b0b56c90a2709bfa09a0a3ad19", - "crates/horizon-world/src/worldgen/feature_graph.rs": "fe61a5e43179a7588737a71782ea246811fe2c8721e74793e1ac018c8eb93c34", - "crates/horizon-world/src/worldgen/feature_region.rs": "2c78e5f1bdb08307f8d982f231f1abbc3306cd54348d9023b86ee6ed3516fd33", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "b78927059c43b0860f5e29640720b85ab4099e2e620993baa70feaf8e61b79bf", + "crates/horizon-world/src/worldgen/feature_region.rs": "3b893ceafbdd1d7b4264f4022dbdb6a7142dfc7001a5cf5c304f5ca7695dfaa0", "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", "crates/horizon-world/src/worldgen/fluid_predicate.rs": "e682d13a21f90605215b79f5d254bf2e524d35e89eab2e3b46384709af80b847", "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", @@ -126,43 +141,45 @@ "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", - "crates/horizon-world/src/worldgen/placement/chain.rs": "08ee8697f589e96b69653b395238eecd144d51cfec30017214275f9b338d82af", - "crates/horizon-world/src/worldgen/placement/context.rs": "c916b30177e283e8eedfa342dc5282b42c898a2873668b44f59c83501ff866bd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "b967b71867dac7f83f6dba0eb063ad9c581aa2f29087c2128052a4eb02f199c2", "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", - "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "fa0616353f07460975ab323357ab280b7f35e7bfe2de6edc08d304316766ed26", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", - "crates/horizon-world/src/worldgen/state_provider.rs": "d1097d91b43e30cec38b09365d3ed58f15522b829feb584e255718447e4c68b4", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", - "crates/horizon-world/src/worldgen.rs": "b08f074f54f451c24795d5dda68968165b84b8d762d244f0444a8d62de61820e", - "crates/horizon-world/examples/fluid_fixture.rs": "4603e462ce92f60426bb6025cd42b08410d0d4e81293e08861636a5664dfe0b1" + "crates/horizon-world/src/worldgen.rs": "97dcb2d79f285daab0bbbe2d2ca673edc0376b23c5cd4519e0f8818593e0a4ee", + "crates/horizon-world/examples/fluid_fixture.rs": "dfd419b3a62d371f3068441590fe5b045cc135b0a2cd435bd30d36a47d845e0e" }, "fixtures_sha256": { ".local/rust-fluid-parity/inputs.txt": "532b6e5965ce43b01989e7ee11c104d6bb498e52bcad0a79b14c5865068d287d", + ".local/rust-fluid-parity/codec-inputs.txt": "c279696131c2f644413b5e68eb340ef69ed085d8b3af3beb88523b14522704a5", ".local/rust-fluid-parity/facts-client.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", ".local/rust-fluid-parity/facts-server.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b" }, - "rust_output_sha256": "b25ed573e8c2177c68a5f48ff62665144cf687aee3b948e8de696ab43e16fad1", + "rust_output_sha256": "4f575eff3ad878286ef466b8a8b809e0e4e9a0bccc9d301f8639273bc9838b54", "references": [ { "side": "client", "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", - "output_sha256": "b25ed573e8c2177c68a5f48ff62665144cf687aee3b948e8de696ab43e16fad1", - "matched_output_lines": 239190 + "output_sha256": "4f575eff3ad878286ef466b8a8b809e0e4e9a0bccc9d301f8639273bc9838b54", + "matched_output_lines": 243331 }, { "side": "server", "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", - "output_sha256": "b25ed573e8c2177c68a5f48ff62665144cf687aee3b948e8de696ab43e16fad1", - "matched_output_lines": 239190 + "output_sha256": "4f575eff3ad878286ef466b8a8b809e0e4e9a0bccc9d301f8639273bc9838b54", + "matched_output_lines": 243331 } ], - "scope": "Native fluid identity, amount, falling/source/full flags, own-height bits and legacy block conversion for every pinned block state; all fluid-family identity pairs. Surface and camera height query order, above-fluid family checks, source-only downward-face support checks, coordinate wrapping and injected query failures are compared. The fixture supplies stone/air support states; general block support shapes, fluid spreading/ticks, entities and rendering remain outside this comparison." + "scope": "FluidState.CODEC decoding and encoding include all 37 states, object-only identifiers, lenient missing/invalid properties, Unicode integer levels and native defaults. Legacy conversion is checked for codec-derived fluid states as well. Native fluid identity, amount, falling/source/full flags, own-height bits and legacy block conversion for every pinned block state; all fluid-family identity pairs. Surface and camera height query order, above-fluid family checks, source-only downward-face support checks, coordinate wrapping and injected query failures are compared. The fixture supplies stone/air support states; general block support shapes, fluid spreading/ticks, entities and rendering remain outside this comparison." } diff --git a/crates/horizon-world/examples/fluid_fixture.rs b/crates/horizon-world/examples/fluid_fixture.rs index e874077eb..466b85230 100644 --- a/crates/horizon-world/examples/fluid_fixture.rs +++ b/crates/horizon-world/examples/fluid_fixture.rs @@ -88,6 +88,23 @@ fn main() -> Result<(), Box> { blocks.block(fluid).0 )?; } + for line in fs::read_to_string(dir.join("codec-inputs.txt"))?.lines() { + match FluidState::from_json(line) { + Err(_) => writeln!(out, "codec error")?, + Ok(state) => { + writeln!( + out, + "codec {} {} {} {} {}", + state.kind().name(), + state.amount(), + state.falling(), + state.is_source(), + blocks.block(state).0 + )?; + writeln!(out, "encoded {}", state.to_json()?)?; + } + } + } for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { let f: Value = serde_json::from_str(line)?; let fluid = fluids diff --git a/crates/horizon-world/src/fluid.rs b/crates/horizon-world/src/fluid.rs index f0472709c..4e08a5145 100644 --- a/crates/horizon-world/src/fluid.rs +++ b/crates/horizon-world/src/fluid.rs @@ -61,6 +61,72 @@ pub struct FluidState { falling: bool, } impl FluidState { + /// Native fluid states require an object; properties decode leniently. + pub fn from_json(json: &str) -> io::Result { + let value: serde_json::Value = + serde_json::from_str(json).map_err(|e| invalid(e.to_string()))?; + let name = value + .get("id") + .and_then(serde_json::Value::as_str) + .ok_or_else(|| invalid("missing fluid identifier"))?; + let (namespace, path) = name.split_once(':').unwrap_or(("minecraft", name)); + let name = format!( + "{}:{path}", + if namespace.is_empty() { + "minecraft" + } else { + namespace + } + ); + let kind = + FluidKind::from_name(&name).ok_or_else(|| invalid("unknown fluid identifier"))?; + if kind == FluidKind::Empty { + return Ok(Self::EMPTY); + } + let flowing = matches!(kind, FluidKind::FlowingWater | FluidKind::FlowingLava); + let mut state = Self { + kind, + amount: if flowing { 1 } else { 8 }, + falling: true, + }; + if let Some(properties) = value + .get("properties") + .and_then(serde_json::Value::as_object) + { + if let Some(value) = properties + .get("falling") + .and_then(serde_json::Value::as_str) + { + match value { + "true" => state.falling = true, + "false" => state.falling = false, + _ => {} + } + } + if flowing { + if let Some(value) = properties + .get("level") + .and_then(serde_json::Value::as_str) + .and_then(crate::registry::java_integer) + .filter(|v| (1..=8).contains(v)) + { + state.amount = value as u8; + } + } + } + Ok(state) + } + pub fn to_json(self) -> io::Result { + let mut value = serde_json::json!({"id": self.kind.name()}); + if self.kind != FluidKind::Empty { + let mut properties = serde_json::json!({"falling": self.falling.to_string()}); + if !self.is_source() { + properties["level"] = self.amount.to_string().into(); + } + value["properties"] = properties; + } + serde_json::to_string(&value).map_err(|e| invalid(e.to_string())) + } pub const EMPTY: Self = Self { kind: FluidKind::Empty, amount: 0, diff --git a/crates/horizon-world/src/registry.rs b/crates/horizon-world/src/registry.rs index d5e4acce6..30367e251 100644 --- a/crates/horizon-world/src/registry.rs +++ b/crates/horizon-world/src/registry.rs @@ -3,6 +3,7 @@ mod json; use crate::{DATA_VERSION, chunk::BlockState, compression::invalid, nbt::Tag}; pub use json::BlockStateJsonCodec; +pub(crate) use json::java_integer; use std::{ collections::{BTreeMap, BTreeSet}, io, diff --git a/crates/horizon-world/src/registry/json.rs b/crates/horizon-world/src/registry/json.rs index 664a7e1d9..63aba578d 100644 --- a/crates/horizon-world/src/registry/json.rs +++ b/crates/horizon-world/src/registry/json.rs @@ -103,7 +103,7 @@ impl<'a> BlockStateJsonCodec<'a> { } } -fn java_integer(text: &str) -> Option { +pub(crate) fn java_integer(text: &str) -> Option { let (negative, text) = if let Some(text) = text.strip_prefix('-') { (true, text) } else { diff --git a/docs/rust-parity.md b/docs/rust-parity.md index be99695da..62d55db89 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -458,3 +458,16 @@ every candidate/supporting state, repeated calls, early returns, failed queries, rejected writes, partial failures and overlay/modifier composition. Workspace tests and all-target Clippy pass. Rust bounds pathological traversal work; resident-world update callbacks and full gameplay remain pending. + +## Fluid-state JSON codecs + +Fluid states now decode and encode native object-form identifiers and properties. +Missing properties retain the pinned defaults (`falling=true`, flowing level 1); +invalid property values are ignored, while unknown fluid identifiers fail. +Integer levels share the Java-compatible decimal parser with block properties. + +The expanded [fluid comparison](../benchmarks/rust-fluid-2026-10-06/scoped-parity.json) +matches **243,331 lines per reference JAR**, including all 37 fluid states, +2,432 codec fixtures, encoding, legacy block conversion, and the existing +contained-fluid/height tests. Workspace tests and all-target Clippy pass. +Fluid spreading, tick execution and entity interaction remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFluidOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFluidOracle.java index f3d7e32a7..7e1c08f82 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFluidOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFluidOracle.java @@ -1,5 +1,7 @@ package dev.horizonlab.parity; import com.google.gson.*; +import com.mojang.serialization.JsonOps; +import net.minecraft.world.level.material.FluidState; import java.io.*; import java.lang.reflect.*; import java.nio.file.*; @@ -23,6 +25,16 @@ public final class VanillaFluidOracle { var state=block.getFluidState();boolean falling=state.hasProperty(FlowingFluid.FALLING)&&state.getValue(FlowingFluid.FALLING); out.println("state "+Block.getId(block)+" "+BuiltInRegistries.FLUID.getKey(state.getType())+" "+state.getAmount()+" "+falling+" "+state.isFull()+" "+state.isSource()+" "+Integer.toUnsignedString(Float.floatToRawIntBits(state.getOwnHeight()))+" "+Block.getId(state.createLegacyBlock())); } + for(var line:Files.readAllLines(dir.resolve("codec-inputs.txt"))) { + var decoded=FluidState.CODEC.parse(JsonOps.INSTANCE,JsonParser.parseString(line)).result(); + if(decoded.isEmpty()){out.println("codec error");continue;} + var state=decoded.get();boolean falling=state.hasProperty(FlowingFluid.FALLING)&&state.getValue(FlowingFluid.FALLING); + out.println("codec "+BuiltInRegistries.FLUID.getKey(state.getType())+" "+state.getAmount()+" "+falling+" "+state.isSource()+" "+Block.getId(state.createLegacyBlock())); + var raw=FluidState.CODEC.encodeStart(JsonOps.INSTANCE,state).getOrThrow().getAsJsonObject(); + var canonical=new JsonObject();canonical.add("id",raw.get("id")); + if(raw.has("properties")){var properties=new JsonObject();new java.util.TreeMap<>(raw.getAsJsonObject("properties").asMap()).forEach(properties::add);canonical.add("properties",properties);} + out.println("encoded "+canonical); + } for(var line:(Iterable)inputs::iterator) { var f=JsonParser.parseString(line).getAsJsonObject();var state=Block.stateById(f.get("state").getAsInt()).getFluidState(); var above=Block.stateById(f.get("above").getAsInt()).getFluidState();int[] calls={0};int fail=f.get("fail").getAsInt(); diff --git a/tools/test_fluid_parity.py b/tools/test_fluid_parity.py index 1a18788ec..78a091cf2 100644 --- a/tools/test_fluid_parity.py +++ b/tools/test_fluid_parity.py @@ -23,6 +23,21 @@ def corpus(facts): yield {'state':state,'above':above,'position':position,'sturdy':sturdy,'fail':fail} + +def codec_corpus(): + import itertools + for name in ['empty','water','flowing_water','lava','flowing_lava','missing','minecraft:water',':water','MINECRAFT:water','']: + for definition in [name,{'id':name},{'id':name,'properties':None},{'id':name,'properties':[]},{'id':name,'properties':{'unknown':'x'}}]: + yield definition + for falling,level in itertools.product([None,True,False,0,1,'true','false','TRUE','False',{},[]], + [None,True,False,0,1,8,9,'0','1','8','9','-1','+2','003','٢','3','2147483648','1.0',' 1',{},[]]): + yield {'id':name,'properties':{'falling':falling,'level':level}} + for definition in [None,True,0,[],{}, {'id':None}, {'id':3}, {'Name':'minecraft:water'}]:yield definition + for name in ['water','flowing_water','lava','flowing_lava']: + for falling in ['true','false']: + for level in range(1,9):yield {'id':name,'properties':{'falling':falling,'level':str(level)}} + + def main(): parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() build=lab.LOCAL/'rust-fluid-parity';build.mkdir(parents=True,exist_ok=True) @@ -45,7 +60,8 @@ def main(): if facts!=json.loads((build/'facts-client.json').read_text()):raise ValueError('reference block-state registries differ') if len(facts['states'])!=35723:raise ValueError('incomplete pinned block-state registry') fixtures=list(corpus(facts));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') - fixture_paths=[inputs,build/'facts-client.json',build/'facts-server.json'];tested_fixtures=base.source_hashes(fixture_paths) + codec_inputs=build/'codec-inputs.txt';codec_fixtures=list(codec_corpus());codec_inputs.write_text(''.join(json.dumps(v,separators=(',',':'))+'\n' for v in codec_fixtures),encoding='utf-8') + fixture_paths=[inputs,codec_inputs,build/'facts-client.json',build/'facts-server.json'];tested_fixtures=base.source_hashes(fixture_paths) run(['cargo','build','--release','-p','horizon-world','--example','fluid_fixture'],'compile-rust') metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) binary=Path(metadata['target_directory'])/'release/examples'/('fluid_fixture.exe' if os.name=='nt' else 'fluid_fixture') @@ -55,7 +71,7 @@ def main(): references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) print(f'{side}: {matched:,} fluid output lines match Rust',flush=True) base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) - report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'block_states':len(facts['states']),'fluid_kinds':5,'fixtures':len(fixtures),'requested_height_queries':len(fixtures)*2,'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Native fluid identity, amount, falling/source/full flags, own-height bits and legacy block conversion for every pinned block state; all fluid-family identity pairs. Surface and camera height query order, above-fluid family checks, source-only downward-face support checks, coordinate wrapping and injected query failures are compared. The fixture supplies stone/air support states; general block support shapes, fluid spreading/ticks, entities and rendering remain outside this comparison.'} + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'block_states':len(facts['states']),'fluid_kinds':5,'codec_fixtures':len(codec_fixtures),'fixtures':len(fixtures),'requested_height_queries':len(fixtures)*2,'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'FluidState.CODEC decoding and encoding include all 37 states, object-only identifiers, lenient missing/invalid properties, Unicode integer levels and native defaults. Legacy conversion is checked for codec-derived fluid states as well. Native fluid identity, amount, falling/source/full flags, own-height bits and legacy block conversion for every pinned block state; all fluid-family identity pairs. Surface and camera height query order, above-fluid family checks, source-only downward-face support checks, coordinate wrapping and injected query failures are compared. The fixture supplies stone/air support states; general block support shapes, fluid spreading/ticks, entities and rendering remain outside this comparison.'} lab.write_json(report_path,report);print(f'Scoped fluid parity passed: {report_path}') From 6d5305f987e02d1f272c5b1a47500be50047a820 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 12:36:10 +0200 Subject: [PATCH 015/253] Implement spring cavities and scheduled fluid ticks --- .github/workflows/ci.yml | 4 + .../rust-spring-2026-10-06/scoped-parity.json | 207 ++++++++++++++++++ .../examples/simple_block_fixture.rs | 16 ++ crates/horizon-world/src/worldgen.rs | 1 + .../src/worldgen/block_feature.rs | 4 + .../src/worldgen/feature_graph.rs | 10 + .../src/worldgen/placement/context.rs | 8 + crates/horizon-world/src/worldgen/spring.rs | 116 ++++++++++ docs/rust-parity.md | 14 ++ .../parity/VanillaSimpleBlockOracle.java | 1 + tools/test_spring_parity.py | 64 ++++++ 11 files changed, 445 insertions(+) create mode 100644 benchmarks/rust-spring-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-world/src/worldgen/spring.rs create mode 100644 tools/test_spring_parity.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eaab30dd4..1c44d8be8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -123,6 +123,10 @@ jobs: env: RUSTUP_TOOLCHAIN: stable run: python tools/test_block_blob_parity.py + - name: Compare spring placement and fluid tick scheduling + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_spring_parity.py - name: Compare ordered single-block replacement features env: RUSTUP_TOOLCHAIN: stable diff --git a/benchmarks/rust-spring-2026-10-06/scoped-parity.json b/benchmarks/rust-spring-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..df273de7d --- /dev/null +++ b/benchmarks/rust-spring-2026-10-06/scoped-parity.json @@ -0,0 +1,207 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 172141, + "candidate_states": 35723, + "double_plant_blocks": 10, + "mossy_carpet_blocks": 1, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java": "7ced6f7a0c44a40fe211d3e3bbfe5b5085bbb4e59a3a8d2f24592602825504c2", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSurvivalOracle.java": "4e7cc151617c1b02e872f9ca3e9fe4632379f225f4f07718ff6492df4ee551e7", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java": "99a396b9b983f6ca9149133251f3ece9aaf76d3d16dafa1f322378212a19490c", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSupportOracle.java": "04350901a2d708fb8fa672de61d058f73f332d2e90df1b93a67781862f89c1ad", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "60ff9ef7c1d5e23c080f9aec95ab2e7d3b7c5b5bcd67b9efa9518776c400629a", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_simple_block_parity.py": "50b783323051fe8cd369bb733448b0314f1e6e7994a950e4cb6cd2fe4f7f8e11", + "tools/test_spring_parity.py": "9fe53cc4c5f55ae5f1fae6c067b469bb7d972d791a6858a0dd1823c3fe3bfea7", + "tools/test_block_survival_parity.py": "9e8dff3bd4b95dbfd29f8adc6a2f6d66abf19a6b1cd91423b794a345d4ec244a", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b3caf26bd3afc9d10cdcca3f7e794c30abf5ba09afa1fe80ba8f44713acdb274", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "a8cd85f6223668c1446ff103276d80937b9707d9a7dc619a176b1b1ceed36a4a", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "1eae82604d2b3377fd35aaa3a914a67e5af28f93923815a49e895b4d437433cd", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "bc8fb1a17cd988f7cfc1612180b68d87f90581ec034b880471b840452e66d543", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "0200de733c276f8ddc228f826b85ca0b650f9f3e8b10cf3291cfe005ae060ba9", + "crates/horizon-world/src/worldgen/feature_region.rs": "3b893ceafbdd1d7b4264f4022dbdb6a7142dfc7001a5cf5c304f5ca7695dfaa0", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "e682d13a21f90605215b79f5d254bf2e524d35e89eab2e3b46384709af80b847", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "c04a1f7e9409b0cea0ed9b90fd033fc5a398b66f2688b7f6c0583facc473c457", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "8764f1f4bea56e6b826740e1e654387850116cba9e48f0595a7742eb618425e4", + "crates/horizon-world/examples/simple_block_fixture.rs": "1d2005bdc82c0c0d86d13d00b105983d431c7da6fa5357f4b1f6c43bdcc0019c" + }, + "fixtures_sha256": { + ".local/rust-spring-parity/inputs.txt": "5c359529c58cddcf3c37df0d585727d1f337800952778fc6b046ddb1cc266a4d", + ".local/rust-spring-parity/block-properties.nbt": "1aba22092f70d16b8092014c058ddc210e4aaa77bac32f6ec62e4d0e91d92a99", + ".local/rust-spring-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-spring-parity/cached-collision.nbt": "f3a5c6a5b2d51dad6c52e486e2b9989e79fd55db1a9bda6196db399550b04078", + ".local/rust-spring-parity/cached-support.nbt": "b6fdc9471b0b61e904206d3f099f4dc235aad6d723536c210be0cb7c3560d82c", + ".local/rust-spring-parity/catalog.json": "93581107e3564e60261044fdca61e3b7f237b9e6724c14b86e335ccc01198ba9", + ".local/rust-spring-parity/facts.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-spring-parity/feature-catalog.json": "c048c761c5084a40560731955cc999a364d14055bdd86fa50989a92e4a771286", + ".local/rust-spring-parity/fluid-tags.json": "f1e5eb6d22ea7effbb118a2282709cfdeef1bfae4516b775a55ad7a4df29d7d0", + ".local/rust-spring-parity/placement-definitions.json": "f8a972ec87c2352500af6481158a3192bdbf699951025639bea744e4127b97c4", + ".local/rust-spring-parity/support-cached-states.json": "353945a58fe69b352925473f1693f9b14a9ad19f13c15159c4184f2c29258622", + ".local/rust-spring-parity/survival-classes.json": "361832008eea0aa9151d367a125a19c6353d99a0b88b27dd0682f55b7954553e", + ".local/rust-spring-parity/survival-extra-definitions.json": "170f2db5bc97a49fa25cc249540aa7f04beea455cdbaf43742ed9415f5090a02", + ".local/rust-spring-parity/survival-placement-classes.json": "7fdbf48ab18c87098bbe1b6176cb81f4842b6c5d9a4d6bbaf7037ff61cb1848c", + ".local/rust-spring-parity/survival-rules.json": "8805c18b3195bb1eac1f1e5281333df56e2892505f64023e5403c58ce2ec4368", + ".local/rust-spring-parity/survival-support-tags.json": "15d88d5bb5ad10d65124d5abb2cc055d251b06d129bca7be06f55b43dc13f6fd", + ".local/rust-spring-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0" + }, + "rust_output_sha256": "24f486c78cd80a9b299aa4816698ed9cbb67802ed151461e9ed4e74807ea379d", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "24f486c78cd80a9b299aa4816698ed9cbb67802ed151461e9ed4e74807ea379d", + "matched_output_lines": 3649087 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "24f486c78cd80a9b299aa4816698ed9cbb67802ed151461e9ed4e74807ea379d", + "matched_output_lines": 3649087 + } + ], + "scope": "Native SpringFeature codec and ordered cavity checks. Every block state is exercised above, below, at the origin and as a horizontal neighbor; all air/rock/other five-neighbor combinations and requested count pairs, overlapping air/valid-block membership, defaults, malformed fields, tags, wrapped coordinates and all 37 fluid states are included. Separate ordered rock and hole reads, flags 2, rejected writes, immediate fluid tick requests even after rejected writes, partial failures and untouched random streams are compared. Scheduled requests, named providers and overlay/modifier composition are traced; execution of fluid ticks, spreading and full gameplay remain pending." +} diff --git a/crates/horizon-world/examples/simple_block_fixture.rs b/crates/horizon-world/examples/simple_block_fixture.rs index bddefe858..32273de27 100644 --- a/crates/horizon-world/examples/simple_block_fixture.rs +++ b/crates/horizon-world/examples/simple_block_fixture.rs @@ -134,6 +134,22 @@ fn query(error: impl std::fmt::Display) -> PlacementQueryError { PlacementQueryError::Failed(error.to_string()) } impl PlacementContext for World<'_, '_, W, R> { + fn schedule_fluid_tick( + &mut self, + p: [i32; 3], + fluid: horizon_world::fluid::FluidKind, + delay: i32, + ) -> Result<(), PlacementQueryError> { + self.event(format_args!( + "fluidtick {} {} {} {} {delay}", + p[0], + p[1], + p[2], + fluid.name() + )) + .map_err(query)?; + Ok(()) + } fn mark_postprocessing(&mut self, p: [i32; 3]) -> Result<(), PlacementQueryError> { self.event(format_args!("chunk {} {} {}", p[0], p[1], p[2])) .map_err(query)?; diff --git a/crates/horizon-world/src/worldgen.rs b/crates/horizon-world/src/worldgen.rs index 97ab4dd7a..d16d285d4 100644 --- a/crates/horizon-world/src/worldgen.rs +++ b/crates/horizon-world/src/worldgen.rs @@ -36,6 +36,7 @@ pub mod router; pub mod rule_test; pub mod settings; pub mod simple_block; +pub mod spring; pub mod state_provider; pub mod tags; pub mod terrain; diff --git a/crates/horizon-world/src/worldgen/block_feature.rs b/crates/horizon-world/src/worldgen/block_feature.rs index 9b93d94d0..92fcbb915 100644 --- a/crates/horizon-world/src/worldgen/block_feature.rs +++ b/crates/horizon-world/src/worldgen/block_feature.rs @@ -30,6 +30,10 @@ pub struct FeatureBlockBindings<'r> { pub(crate) air: [BlockStateId; 3], } impl<'r> FeatureBlockBindings<'r> { + pub fn registry(&self) -> &'r BlockRegistry { + self.registry + } + /// Bind provider resources and precompiled placement operations to this registry. pub fn with_state_providers( mut self, diff --git a/crates/horizon-world/src/worldgen/feature_graph.rs b/crates/horizon-world/src/worldgen/feature_graph.rs index ea83661d5..0eb672e6a 100644 --- a/crates/horizon-world/src/worldgen/feature_graph.rs +++ b/crates/horizon-world/src/worldgen/feature_graph.rs @@ -47,6 +47,7 @@ pub enum FeatureDefinition { BlockColumn(super::block_column::BlockColumnFeature), BlockPile(super::block_pile::BlockPileFeature), Disk(super::disk::DiskFeature), + Spring(super::spring::SpringFeature), BlockBlob(super::block_blob::BlockBlobFeature), SimpleBlock(super::simple_block::SimpleBlockFeature), FillLayer(FillLayerFeature), @@ -252,6 +253,11 @@ impl FeatureDefinition { )?)?; match kind.as_str() { "minecraft:no_op" => Ok(Self::NoOp), + "minecraft:spring_feature" => super::spring::SpringFeature::from_json( + json, + blocks.ok_or(DecodeError::Field("spring bindings"))?, + ) + .map(Self::Spring), "minecraft:block_blob" => super::block_blob::BlockBlobFeature::decode( json, blocks.ok_or(DecodeError::Field("block blob bindings"))?, @@ -571,6 +577,10 @@ impl FeatureDefinition { .place(world, random, origin, run.blocks) .map_err(FeatureExecutionError::Basic), Self::NoOp => Ok(true), + Self::Spring(feature) => feature.place(world, origin).map_err(|e| match e { + BlockFeatureError::World(e) => FeatureExecutionError::Basic(FeatureError::World(e)), + BlockFeatureError::Query(e) => FeatureExecutionError::Query(e), + }), Self::BlockBlob(feature) => feature .place(world, random, origin) .map_err(FeatureExecutionError::BlockBlob), diff --git a/crates/horizon-world/src/worldgen/placement/context.rs b/crates/horizon-world/src/worldgen/placement/context.rs index 6e9eacec9..a760bf0d7 100644 --- a/crates/horizon-world/src/worldgen/placement/context.rs +++ b/crates/horizon-world/src/worldgen/placement/context.rs @@ -26,6 +26,14 @@ pub enum LayerBlock { Ground, } pub trait PlacementContext { + fn schedule_fluid_tick( + &mut self, + _position: [i32; 3], + _fluid: crate::fluid::FluidKind, + _delay: i32, + ) -> Result<(), PlacementQueryError> { + Err(PlacementQueryError::Unavailable) + } /// Resolve the containing chunk and mark this position for postprocessing. fn mark_postprocessing(&mut self, _position: [i32; 3]) -> Result<(), PlacementQueryError> { Err(PlacementQueryError::Unavailable) diff --git a/crates/horizon-world/src/worldgen/spring.rs b/crates/horizon-world/src/worldgen/spring.rs new file mode 100644 index 000000000..9249b0448 --- /dev/null +++ b/crates/horizon-world/src/worldgen/spring.rs @@ -0,0 +1,116 @@ +//! Spring cavity checks, fluid block placement and immediate scheduled ticks. +use super::{ + DecodeError, Object, + block_feature::{BlockFeatureError, FeatureBlockBindings}, + block_predicate::PredicateBlockResolver, + feature::FeatureWorld, + integer, optional, + placement::PlacementContext, + required, +}; +use crate::{ + fluid::{FluidBlockBindings, FluidKind, FluidState}, + registry::BlockStateId, +}; +use std::{collections::BTreeSet, sync::Arc}; +#[derive(Clone, Debug)] +pub struct SpringFeature { + state: BlockStateId, + fluid: FluidKind, + requires_below: bool, + rocks: i32, + holes: i32, + valid: Arc>, + air: [BlockStateId; 3], +} +impl SpringFeature { + pub fn from_json(json: &str, bindings: &FeatureBlockBindings<'_>) -> Result { + let object: Object = serde_json::from_str(json)?; + let fluid = FluidState::from_json(required(&object, "state")?.get()) + .map_err(|e| DecodeError::Registry(e.to_string()))?; + let state = FluidBlockBindings::new(bindings.registry()) + .map_err(|e| DecodeError::Registry(e.to_string()))? + .block(fluid); + let requires_below = optional(&object, "requires_block_below") + .map(|v| serde_json::from_str(v.get())) + .transpose()? + .unwrap_or(true); + let rocks = optional(&object, "rock_count") + .map(integer) + .transpose()? + .unwrap_or(4); + let holes = optional(&object, "hole_count") + .map(integer) + .transpose()? + .unwrap_or(1); + Ok(Self { + state, + fluid: fluid.kind(), + requires_below, + rocks, + holes, + valid: bindings.predicate_block_set(required(&object, "valid_blocks")?.get())?, + air: bindings.air, + }) + } + pub fn place( + &self, + world: &mut W, + p: [i32; 3], + ) -> Result> { + let above = [p[0], p[1].wrapping_add(1), p[2]]; + let below = [p[0], p[1].wrapping_sub(1), p[2]]; + if !self + .valid + .contains(&world.block(above).map_err(BlockFeatureError::World)?) + { + return Ok(false); + } + if self.requires_below + && !self + .valid + .contains(&world.block(below).map_err(BlockFeatureError::World)?) + { + return Ok(false); + } + let state = world.block(p).map_err(BlockFeatureError::World)?; + if !self.air.contains(&state) && !self.valid.contains(&state) { + return Ok(false); + } + let neighbors = [ + [p[0].wrapping_sub(1), p[1], p[2]], + [p[0].wrapping_add(1), p[1], p[2]], + [p[0], p[1], p[2].wrapping_sub(1)], + [p[0], p[1], p[2].wrapping_add(1)], + below, + ]; + let mut rocks = 0; + for position in neighbors { + if self + .valid + .contains(&world.block(position).map_err(BlockFeatureError::World)?) + { + rocks += 1; + } + } + let mut holes = 0; + for position in neighbors { + if self + .air + .contains(&world.block(position).map_err(BlockFeatureError::World)?) + { + holes += 1; + } + } + if rocks != self.rocks || holes != self.holes { + return Ok(false); + } + world + .set_block(p, self.state, 2) + .map_err(BlockFeatureError::World)?; + world + .schedule_fluid_tick(p, self.fluid, 0) + .map_err(BlockFeatureError::Query)?; + Ok(true) + } +} diff --git a/docs/rust-parity.md b/docs/rust-parity.md index 62d55db89..b57b345e4 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -471,3 +471,17 @@ matches **243,331 lines per reference JAR**, including all 37 fluid states, 2,432 codec fixtures, encoding, legacy block conversion, and the existing contained-fluid/height tests. Workspace tests and all-target Clippy pass. Fluid spreading, tick execution and entity interaction remain pending. + +## Spring features and fluid tick requests + +Spring features preserve above/below/origin gating, the separate west/east/north/ +south/below rock and air-count passes, fluid-to-block conversion, writes with +flags 2, and immediate fluid tick requests after accepted or rejected writes. +Fluid tick execution is still separate simulation work. + +The [spring comparison](../benchmarks/rust-spring-2026-10-06/scoped-parity.json) +matches **3,649,087 lines per reference JAR** across **172,141 fixtures**. It +covers every state in the gating and neighbor roles, all five-neighbor air/rock/ +other combinations and count pairs, all 37 fluid states, malformed fields, tags, +wrapped positions, partial failures and nested composition. Workspace tests and +all-target Clippy pass. Full fluid spreading and world updates remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java index e52341db0..809fe5676 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java @@ -71,6 +71,7 @@ public final class VanillaSimpleBlockOracle { var p=((BlockPos)args[0]).immutable();var state=(BlockState)args[1];int call=calls;event("set "+xyz(p)+" "+Block.getId(state)+" "+args[2]); int reject=f.get("reject").getAsInt();boolean result=reject==0||call%reject!=0;if(result)states.put(p,state);out.println("written "+result);return result; } + if(name.equals("scheduleTick")&&args[1] instanceof net.minecraft.world.level.material.Fluid fluid){event("fluidtick "+xyz((BlockPos)args[0])+" "+BuiltInRegistries.FLUID.getKey(fluid)+" "+args[2]);return null;} if(name.equals("scheduleTick")){event("tick "+xyz((BlockPos)args[0])+" "+Block.getId(((Block)args[1]).defaultBlockState())+" "+args[2]);return null;} if(method.isDefault())return InvocationHandler.invokeDefault(proxy,method,args); throw new AssertionError(method); diff --git a/tools/test_spring_parity.py b/tools/test_spring_parity.py new file mode 100644 index 000000000..9e7d4f3e0 --- /dev/null +++ b/tools/test_spring_parity.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python3 +"""Compare spring cavity checks, fluid placement and scheduled fluid ticks.""" +import itertools +import json +try: + from . import test_simple_block_parity as harness +except ImportError: + import test_simple_block_parity as harness + + +def corpus(facts, placement): + states=facts['states'];get=lambda name:facts['defaults']['minecraft:'+name] + directions=[(-1,0,0),(1,0,0),(0,0,-1),(0,0,1),(0,-1,0)] + def spring(state=None, **extra): + value={'type':'spring_feature','state':state if state is not None else {'id':'water','properties':{'falling':'false'}},'valid_blocks':'stone'} + value.update(extra);return value + def case(definition=None, **extra): + origin=extra.pop('origin',[0,64,0]);wrap=lambda n:(n+2**31)%2**32-2**31 + position=lambda d:[wrap(origin[i]+d[i]) for i in range(3)] + initial=[[*position((0,0,0)),get('air')],[*position((-1,0,0)),get('air')]] + value={'definition':json.dumps(definition if definition is not None else spring(),separators=(',',':')), + 'mode':'feature','origin':origin,'legacy':False,'seed':0,'world_seed':1,'fail':-1,'reject':0, + 'brightness':15,'fallback':get('stone'),'states':initial,'repeats':1} + value.update(extra);return value + for state in range(len(states)): + for position in [[0,65,0],[0,63,0],[0,64,0],[1,64,0]]: + initial={(0,64,0):get('air'),(-1,64,0):get('air')};initial[tuple(position)]=state + yield case(states=[[*p,s] for p,s in initial.items()]) + palette=[get('air'),get('stone'),get('water')] + for choices in itertools.product(range(3),repeat=5): + initial=[[x,64+y,z,palette[choices[i]]] for i,(x,y,z) in enumerate(directions)]+[[0,64,0,get('air')]] + for required,rocks,holes in itertools.product([False,True],range(6),range(6)): + yield case(spring(requires_block_below=required,rock_count=rocks,hole_count=holes),states=initial) + # Air can belong to valid_blocks; rock and hole counts are independent. + yield case(spring(valid_blocks=['stone','air'],requires_block_below=False, + rock_count=sum(v in [0,1] for v in choices),hole_count=choices.count(0)),states=initial) + fluids=[{'id':'empty'}] + for name in ['water','lava','flowing_water','flowing_lava']: + for falling in ['false','true']: + for level in (range(1,9) if name.startswith('flowing') else [8]): + fluids.append({'id':name,'properties':{'falling':falling,'level':str(level)}}) + for fluid,legacy,fail,reject,origin in itertools.product(fluids,[False,True],[-1,*range(16)],[0,1,3], + [[0,64,0],[2147483647,2147483647,2147483647],[-2147483648,-2147483648,-2147483648]]): + yield case(spring(fluid),legacy=legacy,seed=-1,fail=fail,reject=reject,origin=origin,repeats=2) + for valid in [[],['air','stone'],'#minecraft:logs','#minecraft:leaves',['stone','water','oak_log'],'air']: + for fallback in ['stone','air','oak_log','oak_leaves']: + yield case(spring(valid_blocks=valid,requires_block_below=False),fallback=get(fallback)) + for key,values in [('state',[None,False,'water',{}, {'id':'missing'}, {'id':'water','properties':{'falling':False}}]), + ('requires_block_below',[None,False,True,0,1,'true']), + ('rock_count',[None,-1,0,4,5,6,2147483647,-2147483648,0.5,False,'4',4294967300]), + ('hole_count',[None,-1,0,1,5,6,2147483647,False,'1']), + ('valid_blocks',[None,False,{},[],['missing'],'#missing'])]: + for value in values: + definition=spring();definition[key]=value;yield case(definition) + definition=spring();definition.pop(key,None);yield case(definition) + for legacy,seed,fail,reject in itertools.product([False,True],[0,-1,0x123456789abcdef],[-1,0,5,12,14],[0,3]): + placed={'feature':spring(),'placement':[{'type':'count','count':2}]} + yield case(placed,mode='placed',legacy=legacy,seed=seed,fail=fail,reject=reject,repeats=2) + yield case({'type':'overlay','features':[placed,{'feature':'horizon:moss','placement':[]}]},legacy=legacy,seed=seed,fail=fail,reject=reject) + + +if __name__=='__main__': + harness.run(corpus,'rust-spring-parity',__file__, + 'Native SpringFeature codec and ordered cavity checks. Every block state is exercised above, below, at the origin and as a horizontal neighbor; all air/rock/other five-neighbor combinations and requested count pairs, overlapping air/valid-block membership, defaults, malformed fields, tags, wrapped coordinates and all 37 fluid states are included. Separate ordered rock and hole reads, flags 2, rejected writes, immediate fluid tick requests even after rejected writes, partial failures and untouched random streams are compared. Scheduled requests, named providers and overlay/modifier composition are traced; execution of fluid ticks, spreading and full gameplay remain pending.') From c8d07903ef2a2d25dcdfe7218351f1d1a1703f86 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 12:38:59 +0200 Subject: [PATCH 016/253] Implement native vine attachment priority and placement --- .github/workflows/ci.yml | 4 + .../rust-vines-2026-10-06/scoped-parity.json | 208 ++++++++++++++++++ crates/horizon-world/src/worldgen.rs | 1 + .../src/worldgen/feature_graph.rs | 9 + crates/horizon-world/src/worldgen/vines.rs | 68 ++++++ docs/rust-parity.md | 14 ++ tools/test_vines_parity.py | 37 ++++ 7 files changed, 341 insertions(+) create mode 100644 benchmarks/rust-vines-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-world/src/worldgen/vines.rs create mode 100644 tools/test_vines_parity.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1c44d8be8..514e9cb72 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -127,6 +127,10 @@ jobs: env: RUSTUP_TOOLCHAIN: stable run: python tools/test_spring_parity.py + - name: Compare vine attachment priority and placement + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_vines_parity.py - name: Compare ordered single-block replacement features env: RUSTUP_TOOLCHAIN: stable diff --git a/benchmarks/rust-vines-2026-10-06/scoped-parity.json b/benchmarks/rust-vines-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..ab07429ea --- /dev/null +++ b/benchmarks/rust-vines-2026-10-06/scoped-parity.json @@ -0,0 +1,208 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 224743, + "candidate_states": 35723, + "double_plant_blocks": 10, + "mossy_carpet_blocks": 1, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java": "7ced6f7a0c44a40fe211d3e3bbfe5b5085bbb4e59a3a8d2f24592602825504c2", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSurvivalOracle.java": "4e7cc151617c1b02e872f9ca3e9fe4632379f225f4f07718ff6492df4ee551e7", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java": "99a396b9b983f6ca9149133251f3ece9aaf76d3d16dafa1f322378212a19490c", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSupportOracle.java": "04350901a2d708fb8fa672de61d058f73f332d2e90df1b93a67781862f89c1ad", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "60ff9ef7c1d5e23c080f9aec95ab2e7d3b7c5b5bcd67b9efa9518776c400629a", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_simple_block_parity.py": "50b783323051fe8cd369bb733448b0314f1e6e7994a950e4cb6cd2fe4f7f8e11", + "tools/test_vines_parity.py": "103ad644da719d1d8b6941c1ea5e4200e6a75a5790d29623afc72e6945fb814b", + "tools/test_block_survival_parity.py": "9e8dff3bd4b95dbfd29f8adc6a2f6d66abf19a6b1cd91423b794a345d4ec244a", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b3caf26bd3afc9d10cdcca3f7e794c30abf5ba09afa1fe80ba8f44713acdb274", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "a8cd85f6223668c1446ff103276d80937b9707d9a7dc619a176b1b1ceed36a4a", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "1eae82604d2b3377fd35aaa3a914a67e5af28f93923815a49e895b4d437433cd", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "bc8fb1a17cd988f7cfc1612180b68d87f90581ec034b880471b840452e66d543", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "b7cbb8f464098f22aedbe4d954afd51cbb24d4f3be3f53f3c764015cf9d72d80", + "crates/horizon-world/src/worldgen/feature_region.rs": "3b893ceafbdd1d7b4264f4022dbdb6a7142dfc7001a5cf5c304f5ca7695dfaa0", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "e682d13a21f90605215b79f5d254bf2e524d35e89eab2e3b46384709af80b847", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "c04a1f7e9409b0cea0ed9b90fd033fc5a398b66f2688b7f6c0583facc473c457", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "16efd52eec5e625a5fdd6d4c0591e2d5b02ab4b641f1a1c193737056842ed7c1", + "crates/horizon-world/examples/simple_block_fixture.rs": "1d2005bdc82c0c0d86d13d00b105983d431c7da6fa5357f4b1f6c43bdcc0019c" + }, + "fixtures_sha256": { + ".local/rust-vines-parity/inputs.txt": "8443a66a51f95def2da83b6f9dcffbefbc09a52b9ba3fa6047a96ca8743cde07", + ".local/rust-vines-parity/block-properties.nbt": "1aba22092f70d16b8092014c058ddc210e4aaa77bac32f6ec62e4d0e91d92a99", + ".local/rust-vines-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-vines-parity/cached-collision.nbt": "f3a5c6a5b2d51dad6c52e486e2b9989e79fd55db1a9bda6196db399550b04078", + ".local/rust-vines-parity/cached-support.nbt": "b6fdc9471b0b61e904206d3f099f4dc235aad6d723536c210be0cb7c3560d82c", + ".local/rust-vines-parity/catalog.json": "93581107e3564e60261044fdca61e3b7f237b9e6724c14b86e335ccc01198ba9", + ".local/rust-vines-parity/facts.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-vines-parity/feature-catalog.json": "c048c761c5084a40560731955cc999a364d14055bdd86fa50989a92e4a771286", + ".local/rust-vines-parity/fluid-tags.json": "f1e5eb6d22ea7effbb118a2282709cfdeef1bfae4516b775a55ad7a4df29d7d0", + ".local/rust-vines-parity/placement-definitions.json": "f8a972ec87c2352500af6481158a3192bdbf699951025639bea744e4127b97c4", + ".local/rust-vines-parity/support-cached-states.json": "353945a58fe69b352925473f1693f9b14a9ad19f13c15159c4184f2c29258622", + ".local/rust-vines-parity/survival-classes.json": "361832008eea0aa9151d367a125a19c6353d99a0b88b27dd0682f55b7954553e", + ".local/rust-vines-parity/survival-extra-definitions.json": "170f2db5bc97a49fa25cc249540aa7f04beea455cdbaf43742ed9415f5090a02", + ".local/rust-vines-parity/survival-placement-classes.json": "7fdbf48ab18c87098bbe1b6176cb81f4842b6c5d9a4d6bbaf7037ff61cb1848c", + ".local/rust-vines-parity/survival-rules.json": "8805c18b3195bb1eac1f1e5281333df56e2892505f64023e5403c58ce2ec4368", + ".local/rust-vines-parity/survival-support-tags.json": "15d88d5bb5ad10d65124d5abb2cc055d251b06d129bca7be06f55b43dc13f6fd", + ".local/rust-vines-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0" + }, + "rust_output_sha256": "dc00391d98cfb9a1297bba33c9a8574cc7bfa6247d86510242d175916435c195", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "dc00391d98cfb9a1297bba33c9a8574cc7bfa6247d86510242d175916435c195", + "matched_output_lines": 4315682 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "dc00391d98cfb9a1297bba33c9a8574cc7bfa6247d86510242d175916435c195", + "matched_output_lines": 4315682 + } + ], + "scope": "Native VinesFeature unit codec and placement. Every origin state and every neighbor state in each of the five accepted directions, all support masks, air variants, wrapped coordinates and first-attachment priority Up/North/South/West/East are compared. Native support/collision queries, flags 2, rejected writes, partial failures, repeated calls, unchanged feature/world random streams and overlay/modifier composition share the mutable world. Dynamic block entities are absent in this fixture; resident-world updates, vine growth and complete gameplay remain pending." +} diff --git a/crates/horizon-world/src/worldgen.rs b/crates/horizon-world/src/worldgen.rs index d16d285d4..42c1f66b1 100644 --- a/crates/horizon-world/src/worldgen.rs +++ b/crates/horizon-world/src/worldgen.rs @@ -41,6 +41,7 @@ pub mod state_provider; pub mod tags; pub mod terrain; pub mod value_provider; +pub mod vines; pub mod weighted; use horizon_core::noise::{NoiseBuildError, NormalNoise, Normalization}; use serde_json::value::RawValue; diff --git a/crates/horizon-world/src/worldgen/feature_graph.rs b/crates/horizon-world/src/worldgen/feature_graph.rs index 0eb672e6a..7b87a3ca7 100644 --- a/crates/horizon-world/src/worldgen/feature_graph.rs +++ b/crates/horizon-world/src/worldgen/feature_graph.rs @@ -48,6 +48,7 @@ pub enum FeatureDefinition { BlockPile(super::block_pile::BlockPileFeature), Disk(super::disk::DiskFeature), Spring(super::spring::SpringFeature), + Vines(super::vines::VinesFeature), BlockBlob(super::block_blob::BlockBlobFeature), SimpleBlock(super::simple_block::SimpleBlockFeature), FillLayer(FillLayerFeature), @@ -253,6 +254,10 @@ impl FeatureDefinition { )?)?; match kind.as_str() { "minecraft:no_op" => Ok(Self::NoOp), + "minecraft:vines" => super::vines::VinesFeature::new( + blocks.ok_or(DecodeError::Field("vine feature bindings"))?, + ) + .map(Self::Vines), "minecraft:spring_feature" => super::spring::SpringFeature::from_json( json, blocks.ok_or(DecodeError::Field("spring bindings"))?, @@ -577,6 +582,10 @@ impl FeatureDefinition { .place(world, random, origin, run.blocks) .map_err(FeatureExecutionError::Basic), Self::NoOp => Ok(true), + Self::Vines(feature) => feature.place(world, origin).map_err(|e| match e { + BlockFeatureError::World(e) => FeatureExecutionError::Basic(FeatureError::World(e)), + BlockFeatureError::Query(e) => FeatureExecutionError::Query(e), + }), Self::Spring(feature) => feature.place(world, origin).map_err(|e| match e { BlockFeatureError::World(e) => FeatureExecutionError::Basic(FeatureError::World(e)), BlockFeatureError::Query(e) => FeatureExecutionError::Query(e), diff --git a/crates/horizon-world/src/worldgen/vines.rs b/crates/horizon-world/src/worldgen/vines.rs new file mode 100644 index 000000000..5e5530ee9 --- /dev/null +++ b/crates/horizon-world/src/worldgen/vines.rs @@ -0,0 +1,68 @@ +//! One vine attachment in native direction priority order. +use super::{ + DecodeError, + block_feature::{BlockFeatureError, FeatureBlockBindings}, + feature::FeatureWorld, + placement::PlacementContext, +}; +use crate::registry::BlockStateId; +use horizon_core::geometry::Direction; +const DIRECTIONS: [Direction; 5] = [ + Direction::Up, + Direction::North, + Direction::South, + Direction::West, + Direction::East, +]; +#[derive(Clone, Debug)] +pub struct VinesFeature { + air: [BlockStateId; 3], + states: [BlockStateId; 5], +} +impl VinesFeature { + pub fn new(bindings: &FeatureBlockBindings<'_>) -> Result { + let registry = bindings.registry(); + let default = registry + .default_state("minecraft:vine") + .ok_or(DecodeError::Field("vine block missing"))?; + let mut states = [default; 5]; + for (i, name) in ["up", "north", "south", "west", "east"] + .into_iter() + .enumerate() + { + let mut state = registry.state(default).unwrap().clone(); + state.properties.insert(name.into(), "true".into()); + states[i] = registry + .id(&state) + .ok_or(DecodeError::Field("vine face missing"))?; + } + Ok(Self { + air: bindings.air, + states, + }) + } + pub fn place( + &self, + world: &mut W, + p: [i32; 3], + ) -> Result> { + if !self + .air + .contains(&world.block(p).map_err(BlockFeatureError::World)?) + { + return Ok(false); + } + for (direction, state) in DIRECTIONS.into_iter().zip(self.states) { + if world + .attachment_at(p, direction) + .map_err(BlockFeatureError::Query)? + { + world + .set_block(p, state, 2) + .map_err(BlockFeatureError::World)?; + return Ok(true); + } + } + Ok(false) + } +} diff --git a/docs/rust-parity.md b/docs/rust-parity.md index b57b345e4..3daec853a 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -485,3 +485,17 @@ covers every state in the gating and neighbor roles, all five-neighbor air/rock/ other combinations and count pairs, all 37 fluid states, malformed fields, tags, wrapped positions, partial failures and nested composition. Workspace tests and all-target Clippy pass. Full fluid spreading and world updates remain pending. + +## Vine feature attachment + +Vine features require an air state at the origin and choose the first acceptable +attachment in Up/North/South/West/East order. They evaluate actual support and +collision shapes and return success after the write request, including when the +world rejects that write. Feature and world random streams are unchanged. + +The [vine comparison](../benchmarks/rust-vines-2026-10-06/scoped-parity.json) +matches **4,315,682 lines per reference JAR** across **224,743 fixtures**, covering +every origin state and every state on each candidate face, support combinations, +wrapped positions, partial failures and composed placement. Workspace tests and +all-target Clippy pass. Vine growth, block updates and complete gameplay remain +pending; this fixture uses absent dynamic block entities. diff --git a/tools/test_vines_parity.py b/tools/test_vines_parity.py new file mode 100644 index 000000000..1f07c74c6 --- /dev/null +++ b/tools/test_vines_parity.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python3 +"""Compare vine attachment priority, support queries and ordered writes.""" +import itertools +import json +try: + from . import test_simple_block_parity as harness +except ImportError: + import test_simple_block_parity as harness + + +def corpus(facts, placement): + states=facts['states'];get=lambda name:facts['defaults']['minecraft:'+name] + directions=[(0,1,0),(0,0,-1),(0,0,1),(-1,0,0),(1,0,0)] + def case(**extra): + value={'definition':'{"type":"vines"}','mode':'feature','origin':[0,64,0],'legacy':False,'seed':0,'world_seed':1, + 'fail':-1,'reject':0,'brightness':15,'fallback':get('air'),'states':[],'repeats':2} + value.update(extra);return value + for state in range(len(states)): + yield case(states=[[0,64,0,state],[0,65,0,get('stone')]]) + for x,y,z in directions:yield case(states=[[x,64+y,z,state]],repeats=1) + for mask,origin,legacy,seed,fail,reject in itertools.product(range(32), + [[0,64,0],[2147483647,2147483647,2147483647],[-2147483648,-2147483648,-2147483648]], + [False,True],[0,-1],[-1,0,1,2,3,4,5,6,7],[0,1,3]): + wrap=lambda n:(n+2**31)%2**32-2**31 + initial=[[*[wrap(origin[i]+d[i]) for i in range(3)],get('stone') if mask&(1< Date: Tue, 6 Oct 2026 12:42:28 +0200 Subject: [PATCH 017/253] Compute and verify native full-face occlusion masks --- .../scoped-parity.json | 56 ++++++++++------- .../examples/block_properties_fixture.rs | 20 +++++- crates/horizon-world/src/block_properties.rs | 63 ++++++++++++++++++- .../src/worldgen/block_feature.rs | 3 + docs/rust-parity.md | 12 ++++ .../parity/VanillaBlockPropertiesOracle.java | 3 + tools/test_block_properties_parity.py | 2 +- 7 files changed, 131 insertions(+), 28 deletions(-) diff --git a/benchmarks/rust-block-properties-2026-10-06/scoped-parity.json b/benchmarks/rust-block-properties-2026-10-06/scoped-parity.json index 0382cf402..0b9c3c291 100644 --- a/benchmarks/rust-block-properties-2026-10-06/scoped-parity.json +++ b/benchmarks/rust-block-properties-2026-10-06/scoped-parity.json @@ -8,10 +8,10 @@ "registry_states": 35723, "fixtures": 18096, "sources_sha256": { - "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java": "99a396b9b983f6ca9149133251f3ece9aaf76d3d16dafa1f322378212a19490c", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java": "e871d3a01f15616a98ca9227c27a81e4d17e2d57ac4e68a5650a70fa29811497", "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "60ff9ef7c1d5e23c080f9aec95ab2e7d3b7c5b5bcd67b9efa9518776c400629a", - "tools/test_block_properties_parity.py": "083d09fe190a783b2939068b7ad01e98938d9277f9583c5273bb2453e870d713", - "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/test_block_properties_parity.py": "01cc525e4c02a254a6f7495ec6d04cc09513051ec318144036a776103ca549d6", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", @@ -75,23 +75,24 @@ "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", - "crates/horizon-world/src/block_properties.rs": "b3caf26bd3afc9d10cdcca3f7e794c30abf5ba09afa1fe80ba8f44713acdb274", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", - "crates/horizon-world/src/block_survival.rs": "2c882aeb095c27a8edfda1e934ac829102e4be136d53fd83110132150b7293b1", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", - "crates/horizon-world/src/fluid.rs": "8a2834a9347ee2c2db7cf1c86a064907ec06e9ac16ba9cc3936e315fc4ad49ca", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", - "crates/horizon-world/src/lib.rs": "09f697d8d4e709acacc8e9f7c35c5fd307bab6ab0df4a1339fe760afc655cdab", + "crates/horizon-world/src/lib.rs": "a8cd85f6223668c1446ff103276d80937b9707d9a7dc619a176b1b1ceed36a4a", "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", - "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", - "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/registry/json.rs": "1eae82604d2b3377fd35aaa3a914a67e5af28f93923815a49e895b4d437433cd", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", @@ -104,7 +105,10 @@ "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", - "crates/horizon-world/src/worldgen/block_feature.rs": "82a424d3b20837dc401005f5fe038616659eb17b5bbd78d0c8c29f8bdeb1104a", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "5ce5c6eaa5f8a2557a620e533788217b1eb430654801dcf6135d6c92d7a012ac", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", @@ -116,10 +120,11 @@ "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", - "crates/horizon-world/src/worldgen/feature_catalog.rs": "486fe9d8588eb09e0ee5707a0541b0df167b63b0b56c90a2709bfa09a0a3ad19", - "crates/horizon-world/src/worldgen/feature_graph.rs": "fe61a5e43179a7588737a71782ea246811fe2c8721e74793e1ac018c8eb93c34", - "crates/horizon-world/src/worldgen/feature_region.rs": "2c78e5f1bdb08307f8d982f231f1abbc3306cd54348d9023b86ee6ed3516fd33", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "b7cbb8f464098f22aedbe4d954afd51cbb24d4f3be3f53f3c764015cf9d72d80", + "crates/horizon-world/src/worldgen/feature_region.rs": "3b893ceafbdd1d7b4264f4022dbdb6a7142dfc7001a5cf5c304f5ca7695dfaa0", "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", "crates/horizon-world/src/worldgen/fluid_predicate.rs": "e682d13a21f90605215b79f5d254bf2e524d35e89eab2e3b46384709af80b847", "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", @@ -134,22 +139,25 @@ "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", - "crates/horizon-world/src/worldgen/placement/context.rs": "cd1d2fe305ad4e205e7e01b32128ff895fa8aacc76fa11f200ad6c7c9fba1f49", + "crates/horizon-world/src/worldgen/placement/context.rs": "c04a1f7e9409b0cea0ed9b90fd033fc5a398b66f2688b7f6c0583facc473c457", "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", - "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "fa0616353f07460975ab323357ab280b7f35e7bfe2de6edc08d304316766ed26", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", - "crates/horizon-world/src/worldgen/state_provider.rs": "9cc353d474184f4db880c4305137ec6e35a564a983f602c76af39349ecb58541", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", - "crates/horizon-world/src/worldgen.rs": "821981c893fc84312351503f2be0c06c681d8bc768dade14576697cf047a9f8f", - "crates/horizon-world/examples/block_properties_fixture.rs": "c5438e5397136631e29858e08eb5c09ad2c82647e20bf1913d7ce9160df530a4" + "crates/horizon-world/src/worldgen.rs": "16efd52eec5e625a5fdd6d4c0591e2d5b02ab4b641f1a1c193737056842ed7c1", + "crates/horizon-world/examples/block_properties_fixture.rs": "c997c376a79a48e524524d2afff8c4103bfef8fcc75c7424b332faacc17b6097" }, "fixtures_sha256": { ".local/rust-block-properties-parity/inputs.txt": "b4d336ea8fc168df652a71651bb48e41e5f23fc22bb451b6969c8021140cfe53", @@ -157,20 +165,20 @@ ".local/rust-block-properties-parity/cached-collision.nbt": "f3a5c6a5b2d51dad6c52e486e2b9989e79fd55db1a9bda6196db399550b04078", ".local/rust-block-properties-parity/block-properties.nbt": "1aba22092f70d16b8092014c058ddc210e4aaa77bac32f6ec62e4d0e91d92a99" }, - "rust_output_sha256": "235f4a96d29c0753c31b8f142a22383031458be5606f12539b34e6c72217deb6", + "rust_output_sha256": "57375d2d438beec6df6cd4ba199c34c52d102abcca5f624ff62f5024bcf74a96", "references": [ { "side": "client", "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", - "output_sha256": "235f4a96d29c0753c31b8f142a22383031458be5606f12539b34e6c72217deb6", - "matched_output_lines": 143361 + "output_sha256": "57375d2d438beec6df6cd4ba199c34c52d102abcca5f624ff62f5024bcf74a96", + "matched_output_lines": 197180 }, { "side": "server", "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", - "output_sha256": "235f4a96d29c0753c31b8f142a22383031458be5606f12539b34e6c72217deb6", - "matched_output_lines": 143361 + "output_sha256": "57375d2d438beec6df6cd4ba199c34c52d102abcca5f624ff62f5024bcf74a96", + "matched_output_lines": 197180 } ], - "scope": "All pinned block-definition force-solid, replaceability, liquid and occlusion flags and raw occlusion geometry are imported privately; Rust computes legacy solidity from cached collision shapes and solid rendering from occlusion geometry. Actual native BlockState isSolid, liquid, canOcclude, isSolidRender and no-context canBeReplaced are compared for every state, together with raw cached bounds and synthetic force-flag/cache/shape threshold combinations using the private native solidity calculator and native full-shape test. Item/fluid replacement, block support, survival, dynamic collision and full gameplay remain pending." + "scope": "All pinned block-definition force-solid, replaceability, liquid and occlusion flags and raw occlusion geometry are imported privately; Rust computes legacy solidity from cached collision shapes and solid rendering from occlusion geometry. All six native face-occlusion full-shape tests are compared for every state and every synthetic shape/occlusion-flag case; Rust caches shared shape masks and retains typed errors for unknown state IDs. Actual native BlockState isSolid, liquid, canOcclude, isSolidRender and no-context canBeReplaced are compared for every state, together with raw cached bounds and synthetic force-flag/cache/shape threshold combinations using the private native solidity calculator and native full-shape test. Item/fluid replacement, block support, survival, dynamic collision and full gameplay remain pending." } diff --git a/crates/horizon-world/examples/block_properties_fixture.rs b/crates/horizon-world/examples/block_properties_fixture.rs index 35aef48e9..3404b1fa1 100644 --- a/crates/horizon-world/examples/block_properties_fixture.rs +++ b/crates/horizon-world/examples/block_properties_fixture.rs @@ -1,4 +1,4 @@ -use horizon_core::geometry::{Aabb, Axis, ShapeOp, Vec3, VoxelShape}; +use horizon_core::geometry::{Aabb, Axis, Direction, ShapeOp, Vec3, VoxelShape}; use horizon_world::{ block_properties::{BlockDefinitionProperties, BlockPropertiesRegistry, BlockProperty}, collision::CachedCollisionRegistry, @@ -37,6 +37,12 @@ fn main() -> Result<(), Box> { let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); let solid = properties.bind(BlockProperty::Solid); let replaceable = properties.bind(BlockProperty::Replaceable); + let faces = properties.bind_occlusion_faces(); + assert!( + faces + .is_full(BlockStateId(registry.len() as u32), Direction::Up) + .is_err() + ); for id in 0..registry.len() { let state = BlockStateId(id as u32); let definition = properties @@ -66,6 +72,13 @@ fn main() -> Result<(), Box> { properties.property(state, BlockProperty::SolidRender)?, properties.bind(BlockProperty::SolidRender).contains(state) ); + let mut mask = 0; + for direction in Direction::ALL { + if faces.is_full(state, direction)? { + mask |= 1 << direction as u8; + } + } + writeln!(out, "occlusion {mask}")?; match collisions.cached_shape(state)? { None => writeln!(out, "cache none")?, Some(shape) => match shape.bounds() { @@ -137,6 +150,11 @@ fn main() -> Result<(), Box> { properties.calculate_solid(f["cached"].as_bool().unwrap().then_some(&shape)) )?; writeln!(out, "render {}", properties.calculate_solid_render(&shape)?)?; + writeln!( + out, + "occlusion {}", + properties.calculate_full_occlusion_faces(&shape)? + )?; } Ok(()) } diff --git a/crates/horizon-world/src/block_properties.rs b/crates/horizon-world/src/block_properties.rs index 4ec7498bc..2a463b9e3 100644 --- a/crates/horizon-world/src/block_properties.rs +++ b/crates/horizon-world/src/block_properties.rs @@ -8,8 +8,12 @@ use crate::{ nbt::Tag, registry::{BlockRegistry, BlockStateId}, }; -use horizon_core::geometry::{ShapeError, ShapeOp, VoxelShape}; -use std::{collections::BTreeMap, io, sync::Arc}; +use horizon_core::geometry::{Direction, ShapeError, ShapeOp, VoxelShape}; +use std::{ + collections::{BTreeMap, HashMap}, + io, + sync::Arc, +}; #[derive(Clone, Copy, Debug)] pub struct BlockDefinitionProperties { @@ -20,6 +24,20 @@ pub struct BlockDefinitionProperties { pub can_occlude: bool, } impl BlockDefinitionProperties { + pub fn calculate_full_occlusion_faces(self, occlusion: &VoxelShape) -> Result { + let mut mask = 0; + if self.can_occlude { + for direction in Direction::ALL { + if !occlusion + .face_shape(direction)? + .join_is_not_empty(&VoxelShape::block(), ShapeOp::XOR)? + { + mask |= 1 << direction as u8; + } + } + } + Ok(mask) + } pub fn calculate_solid_render(self, occlusion: &VoxelShape) -> Result { Ok(self.can_occlude && !occlusion.join_is_not_empty(&VoxelShape::block(), ShapeOp::XOR)?) } @@ -72,10 +90,25 @@ impl BoundBlockProperty { } } +/// Immutable FULL face-occlusion results, independent of support/collision. +#[derive(Clone, Debug)] +pub struct BoundOcclusionFaces { + states: Arc<[u8]>, +} +impl BoundOcclusionFaces { + pub fn is_full(&self, state: BlockStateId, direction: Direction) -> io::Result { + self.states + .get(state.0 as usize) + .map(|mask| mask & (1 << direction as u8) != 0) + .ok_or_else(|| invalid("unknown occlusion state ID")) + } +} + pub struct BlockPropertiesRegistry<'r> { registry: &'r BlockRegistry, definitions: BTreeMap, states: Arc<[u8]>, + occlusion_faces: BoundOcclusionFaces, } impl<'r> BlockPropertiesRegistry<'r> { pub fn from_nbt(tag: &Tag, collisions: &CachedCollisionRegistry<'r>) -> io::Result { @@ -123,12 +156,32 @@ impl<'r> BlockPropertiesRegistry<'r> { registry, )?; let mut result = Vec::with_capacity(registry.len()); + let mut faces = Vec::with_capacity(registry.len()); + let mut face_cache = HashMap::new(); for id in 0..registry.len() { let id = BlockStateId(id as u32); let state = registry.state(id).unwrap(); let properties = definitions .get(&state.name) .ok_or_else(|| invalid("missing block definition properties"))?; + let shape = occlusion + .cached_shape(id)? + .ok_or_else(|| invalid("missing block occlusion shape"))?; + let mask = if properties.can_occlude { + let key = std::ptr::from_ref(shape); + if let Some(mask) = face_cache.get(&key) { + *mask + } else { + let mask = properties + .calculate_full_occlusion_faces(shape) + .map_err(|e| invalid(e.to_string()))?; + face_cache.insert(key, mask); + mask + } + } else { + 0 + }; + faces.push(mask); result.push( u8::from(properties.calculate_solid(collisions.cached_shape(id)?)) | (u8::from(properties.replaceable) << 1) @@ -148,8 +201,14 @@ impl<'r> BlockPropertiesRegistry<'r> { registry, definitions, states: result.into(), + occlusion_faces: BoundOcclusionFaces { + states: faces.into(), + }, }) } + pub fn bind_occlusion_faces(&self) -> BoundOcclusionFaces { + self.occlusion_faces.clone() + } pub fn registry(&self) -> &'r BlockRegistry { self.registry } diff --git a/crates/horizon-world/src/worldgen/block_feature.rs b/crates/horizon-world/src/worldgen/block_feature.rs index 92fcbb915..831e9a142 100644 --- a/crates/horizon-world/src/worldgen/block_feature.rs +++ b/crates/horizon-world/src/worldgen/block_feature.rs @@ -22,6 +22,7 @@ pub struct FeatureBlockBindings<'r> { crate::block_placement::BlockPlacementBindings<'r>, )>, physical_properties: Option<[BoundBlockProperty; 4]>, + pub(crate) occlusion_faces: Option, biomes: Option>, fluids: super::fluid_predicate::FluidPredicateBindings, pub(crate) codec: BlockStateJsonCodec<'r>, @@ -67,6 +68,7 @@ impl<'r> FeatureBlockBindings<'r> { properties.bind(BlockProperty::Liquid), properties.bind(BlockProperty::SolidRender), ]); + self.occlusion_faces = Some(properties.bind_occlusion_faces()); Ok(self) } pub fn with_biomes( @@ -134,6 +136,7 @@ impl<'r> FeatureBlockBindings<'r> { codec, biomes: None, physical_properties: None, + occlusion_faces: None, fluids: super::fluid_predicate::FluidPredicateBindings::new(registry)?, blocks: blocks .into_iter() diff --git a/docs/rust-parity.md b/docs/rust-parity.md index 3daec853a..9f736e3ae 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -499,3 +499,15 @@ every origin state and every state on each candidate face, support combinations, wrapped positions, partial failures and composed placement. Workspace tests and all-target Clippy pass. Vine growth, block updates and complete gameplay remain pending; this fixture uses absent dynamic block entities. + +## Full-face occlusion + +Block property bindings now cache six full-face occlusion results per state, +sharing calculations for identical imported shapes. These results use native +occlusion rules independently of collision or support geometry. Unknown state +IDs produce an error. + +The expanded [block-property comparison](../benchmarks/rust-block-properties-2026-10-06/scoped-parity.json) +matches **197,180 lines per reference JAR**, including all 35,723 states and +18,096 synthetic shape/flag combinations. Workspace tests and all-target Clippy +pass. Lighting and renderer integration remain separate work. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java index 7367beefd..f3508e476 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java @@ -4,6 +4,7 @@ import java.io.*; import java.lang.reflect.*; import java.nio.file.*; import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.Direction; import net.minecraft.nbt.*; import net.minecraft.world.level.block.*; import net.minecraft.world.level.block.state.*; @@ -37,6 +38,7 @@ public final class VanillaBlockPropertiesOracle { var p=properties.get(state.getBlock()); out.printf("state %d %s %s %s %s%n",Block.getId(state),on.getBoolean(p),off.getBoolean(p),state.canBeReplaced(),state.isSolid()); out.printf("render %s %s %s%n",state.liquid(),state.canOcclude(),state.isSolidRender()); + int mask=0;for(var direction:Direction.values())if(Block.isShapeFullBlock(state.getFaceOcclusionShape(direction)))mask|=1< Date: Tue, 6 Oct 2026 12:51:12 +0200 Subject: [PATCH 018/253] Implement underwater magma and preserve signed-zero codec rules --- .github/workflows/ci.yml | 4 + .../rust-pillar-2026-10-06/scoped-parity.json | 52 +++-- .../scoped-parity.json | 209 ++++++++++++++++++ crates/horizon-world/src/worldgen.rs | 1 + .../src/worldgen/feature_graph.rs | 15 +- .../src/worldgen/underwater_magma.rs | 187 ++++++++++++++++ docs/collision-geometry.md | 6 +- docs/feature-placement.md | 26 ++- docs/rust-parity.md | 25 ++- docs/world-data.md | 9 +- .../parity/VanillaSimpleBlockOracle.java | 1 + tools/test_pillar_parity.py | 2 +- tools/test_underwater_magma_parity.py | 50 +++++ 13 files changed, 544 insertions(+), 43 deletions(-) create mode 100644 benchmarks/rust-underwater-magma-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-world/src/worldgen/underwater_magma.rs create mode 100644 tools/test_underwater_magma_parity.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 514e9cb72..ef47caa18 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -131,6 +131,10 @@ jobs: env: RUSTUP_TOOLCHAIN: stable run: python tools/test_vines_parity.py + - name: Compare underwater magma floor scans and occlusion + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_underwater_magma_parity.py - name: Compare ordered single-block replacement features env: RUSTUP_TOOLCHAIN: stable diff --git a/benchmarks/rust-pillar-2026-10-06/scoped-parity.json b/benchmarks/rust-pillar-2026-10-06/scoped-parity.json index cbf5df630..e25ab67e1 100644 --- a/benchmarks/rust-pillar-2026-10-06/scoped-parity.json +++ b/benchmarks/rust-pillar-2026-10-06/scoped-parity.json @@ -5,24 +5,24 @@ "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", "java": "openjdk 25.0.4.1 2026-08-18", "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", - "fixtures": 41742, + "fixtures": 41746, "candidate_states": 35723, "double_plant_blocks": 10, "mossy_carpet_blocks": 1, "sources_sha256": { - "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java": "82204d06e279275c5967f6d5fd80afe7416ba6c5f5ec19c682a30942f2fb6d7a", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java": "c72dae42f87b15980ac2155d736126fa2b88f5f15642acf9c739c17849287ade", "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSurvivalOracle.java": "4e7cc151617c1b02e872f9ca3e9fe4632379f225f4f07718ff6492df4ee551e7", - "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java": "99a396b9b983f6ca9149133251f3ece9aaf76d3d16dafa1f322378212a19490c", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java": "e871d3a01f15616a98ca9227c27a81e4d17e2d57ac4e68a5650a70fa29811497", "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSupportOracle.java": "04350901a2d708fb8fa672de61d058f73f332d2e90df1b93a67781862f89c1ad", "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "60ff9ef7c1d5e23c080f9aec95ab2e7d3b7c5b5bcd67b9efa9518776c400629a", "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", - "tools/test_simple_block_parity.py": "8d789c02b88cfd019064b7407f886a2054d26554390a25f804773bb2197c6c35", - "tools/test_pillar_parity.py": "8fac172632ae35bacb83c39c8d166365b44b98d07b7a6913a15104c591c3f12a", + "tools/test_simple_block_parity.py": "50b783323051fe8cd369bb733448b0314f1e6e7994a950e4cb6cd2fe4f7f8e11", + "tools/test_pillar_parity.py": "c3df13e78a5f654d0c3525c57a28b5896395f2e7cd136b014666363b8aa4aa63", "tools/test_block_survival_parity.py": "9e8dff3bd4b95dbfd29f8adc6a2f6d66abf19a6b1cd91423b794a345d4ec244a", "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", - "tools/test_rust_parity.py": "7efa699a38c5820424f5fc8992ee601dbfe26d6482da9d2dab2c17c41fe8f12a", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", @@ -87,7 +87,7 @@ "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", - "crates/horizon-world/src/block_properties.rs": "b3caf26bd3afc9d10cdcca3f7e794c30abf5ba09afa1fe80ba8f44713acdb274", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", @@ -95,15 +95,15 @@ "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", - "crates/horizon-world/src/fluid.rs": "8a2834a9347ee2c2db7cf1c86a064907ec06e9ac16ba9cc3936e315fc4ad49ca", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", "crates/horizon-world/src/lib.rs": "a8cd85f6223668c1446ff103276d80937b9707d9a7dc619a176b1b1ceed36a4a", "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", - "crates/horizon-world/src/registry/json.rs": "40974e8ddbca79f4a4f866f91f1241a7ac7289874527d4729483995dcf9b4f7e", - "crates/horizon-world/src/registry.rs": "566d7ef6a0d0d7e492d73b7f963ff0158544560a86ba33e179ef4d17e1274706", + "crates/horizon-world/src/registry/json.rs": "1eae82604d2b3377fd35aaa3a914a67e5af28f93923815a49e895b4d437433cd", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", @@ -116,8 +116,10 @@ "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", - "crates/horizon-world/src/worldgen/block_feature.rs": "2ea6d26fe88c633ad3efe7bdb6fc49f54961cbdf93b82919d79cf7d37a5c3c7d", + "crates/horizon-world/src/worldgen/block_feature.rs": "5ce5c6eaa5f8a2557a620e533788217b1eb430654801dcf6135d6c92d7a012ac", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", @@ -129,10 +131,11 @@ "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", - "crates/horizon-world/src/worldgen/feature_catalog.rs": "431c523593e7db1e1b3ef446f8f0400dade5a13a097633d590774c2b6ed7c08a", - "crates/horizon-world/src/worldgen/feature_graph.rs": "198599a4c751df0e2dee52462f6b6e3df31ee6b90014fdf15a2e59c10ec5937d", - "crates/horizon-world/src/worldgen/feature_region.rs": "2c78e5f1bdb08307f8d982f231f1abbc3306cd54348d9023b86ee6ed3516fd33", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "fbc0dc49fa5a825e3a7aef74bd465de83fc12855b5a19d907c5b8388bb350b5f", + "crates/horizon-world/src/worldgen/feature_region.rs": "3b893ceafbdd1d7b4264f4022dbdb6a7142dfc7001a5cf5c304f5ca7695dfaa0", "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", "crates/horizon-world/src/worldgen/fluid_predicate.rs": "e682d13a21f90605215b79f5d254bf2e524d35e89eab2e3b46384709af80b847", "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", @@ -147,26 +150,29 @@ "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", - "crates/horizon-world/src/worldgen/placement/context.rs": "2fc100f8861fe0e0519a53dc4ae4a1eaa8a96aff2f6bf546ce613bdf665df237", + "crates/horizon-world/src/worldgen/placement/context.rs": "c04a1f7e9409b0cea0ed9b90fd033fc5a398b66f2688b7f6c0583facc473c457", "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", - "crates/horizon-world/src/worldgen.rs": "2757f22706803afb3624afd65f4f5d05540acbc2bcb01f61e95fa40535575f0f", - "crates/horizon-world/examples/simple_block_fixture.rs": "d839de7fa2827189f8625903cedad84ab47c3e7384bed42e250f660f41d961dc" + "crates/horizon-world/src/worldgen.rs": "11804e16fe587ab8f2c613186de45b450e6d9c459a58e270f108b54223ae68c2", + "crates/horizon-world/examples/simple_block_fixture.rs": "1d2005bdc82c0c0d86d13d00b105983d431c7da6fa5357f4b1f6c43bdcc0019c" }, "fixtures_sha256": { - ".local/rust-pillar-parity/inputs.txt": "09bf497d889602d1f2bedbfbaddb131aa39c6879a2e019826dd645d96382f346", + ".local/rust-pillar-parity/inputs.txt": "067db3ce1c72472e9f09341deec6a1bc92267716bd097c3d15722156b8676e52", ".local/rust-pillar-parity/block-properties.nbt": "1aba22092f70d16b8092014c058ddc210e4aaa77bac32f6ec62e4d0e91d92a99", ".local/rust-pillar-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", ".local/rust-pillar-parity/cached-collision.nbt": "f3a5c6a5b2d51dad6c52e486e2b9989e79fd55db1a9bda6196db399550b04078", @@ -184,19 +190,19 @@ ".local/rust-pillar-parity/survival-support-tags.json": "15d88d5bb5ad10d65124d5abb2cc055d251b06d129bca7be06f55b43dc13f6fd", ".local/rust-pillar-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0" }, - "rust_output_sha256": "02bfd7e92539a357079e26d27058020f302e5f42c50e5cf3e3ff42967949796d", + "rust_output_sha256": "f989182cf82026dbcfe3011990b153bf820d3a06b1f4969a1e63bbb8cc6bd734", "references": [ { "side": "client", "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", - "output_sha256": "02bfd7e92539a357079e26d27058020f302e5f42c50e5cf3e3ff42967949796d", - "matched_output_lines": 921075 + "output_sha256": "f989182cf82026dbcfe3011990b153bf820d3a06b1f4969a1e63bbb8cc6bd734", + "matched_output_lines": 921111 }, { "side": "server", "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", - "output_sha256": "02bfd7e92539a357079e26d27058020f302e5f42c50e5cf3e3ff42967949796d", - "matched_output_lines": 921075 + "output_sha256": "f989182cf82026dbcfe3011990b153bf820d3a06b1f4969a1e63bbb8cc6bd734", + "matched_output_lines": 921111 } ], "scope": "Native single-block pillar codec and placement, all provider state descriptors, upward/downward traversal, replacement predicates before continuation draws, bounds checks after draws, cap placement one opposite step from the stopping position even when no column block was placed, ignored rejected writes and cap false results, partial failures, coordinate wrapping, independent world random stream, named holders, nested pillars and feature sequences. Shared graph work limits bound pathological traversals. Actual resident chunks, neighbor updates and complete gameplay remain pending." diff --git a/benchmarks/rust-underwater-magma-2026-10-06/scoped-parity.json b/benchmarks/rust-underwater-magma-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..9492ca7a2 --- /dev/null +++ b/benchmarks/rust-underwater-magma-2026-10-06/scoped-parity.json @@ -0,0 +1,209 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 253252, + "candidate_states": 35723, + "double_plant_blocks": 10, + "mossy_carpet_blocks": 1, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java": "c72dae42f87b15980ac2155d736126fa2b88f5f15642acf9c739c17849287ade", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSurvivalOracle.java": "4e7cc151617c1b02e872f9ca3e9fe4632379f225f4f07718ff6492df4ee551e7", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java": "e871d3a01f15616a98ca9227c27a81e4d17e2d57ac4e68a5650a70fa29811497", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSupportOracle.java": "04350901a2d708fb8fa672de61d058f73f332d2e90df1b93a67781862f89c1ad", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "60ff9ef7c1d5e23c080f9aec95ab2e7d3b7c5b5bcd67b9efa9518776c400629a", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_simple_block_parity.py": "50b783323051fe8cd369bb733448b0314f1e6e7994a950e4cb6cd2fe4f7f8e11", + "tools/test_underwater_magma_parity.py": "84481073a4b5ea812abe116e8636b57d224d3b94fd86dadc364a971fd29890bb", + "tools/test_block_survival_parity.py": "9e8dff3bd4b95dbfd29f8adc6a2f6d66abf19a6b1cd91423b794a345d4ec244a", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "a8cd85f6223668c1446ff103276d80937b9707d9a7dc619a176b1b1ceed36a4a", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "1eae82604d2b3377fd35aaa3a914a67e5af28f93923815a49e895b4d437433cd", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "5ce5c6eaa5f8a2557a620e533788217b1eb430654801dcf6135d6c92d7a012ac", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "fbc0dc49fa5a825e3a7aef74bd465de83fc12855b5a19d907c5b8388bb350b5f", + "crates/horizon-world/src/worldgen/feature_region.rs": "3b893ceafbdd1d7b4264f4022dbdb6a7142dfc7001a5cf5c304f5ca7695dfaa0", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "e682d13a21f90605215b79f5d254bf2e524d35e89eab2e3b46384709af80b847", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "c04a1f7e9409b0cea0ed9b90fd033fc5a398b66f2688b7f6c0583facc473c457", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "11804e16fe587ab8f2c613186de45b450e6d9c459a58e270f108b54223ae68c2", + "crates/horizon-world/examples/simple_block_fixture.rs": "1d2005bdc82c0c0d86d13d00b105983d431c7da6fa5357f4b1f6c43bdcc0019c" + }, + "fixtures_sha256": { + ".local/rust-underwater-magma-parity/inputs.txt": "332d2930db1501eb70466c5ff6f9ed1c180c83fc7db308c538f33d1aaf5f74c3", + ".local/rust-underwater-magma-parity/block-properties.nbt": "1aba22092f70d16b8092014c058ddc210e4aaa77bac32f6ec62e4d0e91d92a99", + ".local/rust-underwater-magma-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-underwater-magma-parity/cached-collision.nbt": "f3a5c6a5b2d51dad6c52e486e2b9989e79fd55db1a9bda6196db399550b04078", + ".local/rust-underwater-magma-parity/cached-support.nbt": "b6fdc9471b0b61e904206d3f099f4dc235aad6d723536c210be0cb7c3560d82c", + ".local/rust-underwater-magma-parity/catalog.json": "93581107e3564e60261044fdca61e3b7f237b9e6724c14b86e335ccc01198ba9", + ".local/rust-underwater-magma-parity/facts.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-underwater-magma-parity/feature-catalog.json": "c048c761c5084a40560731955cc999a364d14055bdd86fa50989a92e4a771286", + ".local/rust-underwater-magma-parity/fluid-tags.json": "f1e5eb6d22ea7effbb118a2282709cfdeef1bfae4516b775a55ad7a4df29d7d0", + ".local/rust-underwater-magma-parity/placement-definitions.json": "f8a972ec87c2352500af6481158a3192bdbf699951025639bea744e4127b97c4", + ".local/rust-underwater-magma-parity/support-cached-states.json": "353945a58fe69b352925473f1693f9b14a9ad19f13c15159c4184f2c29258622", + ".local/rust-underwater-magma-parity/survival-classes.json": "361832008eea0aa9151d367a125a19c6353d99a0b88b27dd0682f55b7954553e", + ".local/rust-underwater-magma-parity/survival-extra-definitions.json": "170f2db5bc97a49fa25cc249540aa7f04beea455cdbaf43742ed9415f5090a02", + ".local/rust-underwater-magma-parity/survival-placement-classes.json": "7fdbf48ab18c87098bbe1b6176cb81f4842b6c5d9a4d6bbaf7037ff61cb1848c", + ".local/rust-underwater-magma-parity/survival-rules.json": "8805c18b3195bb1eac1f1e5281333df56e2892505f64023e5403c58ce2ec4368", + ".local/rust-underwater-magma-parity/survival-support-tags.json": "15d88d5bb5ad10d65124d5abb2cc055d251b06d129bca7be06f55b43dc13f6fd", + ".local/rust-underwater-magma-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0" + }, + "rust_output_sha256": "70e10d29d4283e391ca2e09b9e04e6e71ab0e99d90c1cf460f544b2997cf44b8", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "70e10d29d4283e391ca2e09b9e04e6e71ab0e99d90c1cf460f544b2997cf44b8", + "matched_output_lines": 6523072 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "70e10d29d4283e391ca2e09b9e04e6e71ab0e99d90c1cf460f544b2997cf44b8", + "matched_output_lines": 6523072 + } + ], + "scope": "Native UnderwaterMagmaFeature codecs and Column.scan floor selection. Initial water identity, upward scan before downward scan, repeated boundary reads, all scan endpoints, every state at origin/floor/below and each horizontal neighbor, exact full-face occlusion, cubic traversal, per-position float draws before block tests, flags 2, rejected writes and partial failures are compared. Both random modes include the complete radius-64 cube with probability zero (2146689 draws), wrapped radius-zero columns and nested placement. Rust allows the entire valid codec radius domain and bounds pathological overflow iteration at 2^23 visits. Actual chunk update callbacks, magma gameplay and full world generation remain pending." +} diff --git a/crates/horizon-world/src/worldgen.rs b/crates/horizon-world/src/worldgen.rs index 42c1f66b1..9b76af172 100644 --- a/crates/horizon-world/src/worldgen.rs +++ b/crates/horizon-world/src/worldgen.rs @@ -40,6 +40,7 @@ pub mod spring; pub mod state_provider; pub mod tags; pub mod terrain; +pub mod underwater_magma; pub mod value_provider; pub mod vines; pub mod weighted; diff --git a/crates/horizon-world/src/worldgen/feature_graph.rs b/crates/horizon-world/src/worldgen/feature_graph.rs index 7b87a3ca7..c033c6624 100644 --- a/crates/horizon-world/src/worldgen/feature_graph.rs +++ b/crates/horizon-world/src/worldgen/feature_graph.rs @@ -49,6 +49,7 @@ pub enum FeatureDefinition { Disk(super::disk::DiskFeature), Spring(super::spring::SpringFeature), Vines(super::vines::VinesFeature), + UnderwaterMagma(super::underwater_magma::UnderwaterMagmaFeature), BlockBlob(super::block_blob::BlockBlobFeature), SimpleBlock(super::simple_block::SimpleBlockFeature), FillLayer(FillLayerFeature), @@ -73,6 +74,7 @@ pub enum FeatureExecutionError { BlockPile(super::block_pile::BlockPileError), Disk(super::disk::DiskError), BlockBlob(super::block_blob::BlockBlobError), + UnderwaterMagma(super::underwater_magma::UnderwaterMagmaError), SimpleBlock(super::simple_block::SimpleBlockError), Random(InvalidBound), Query(PlacementQueryError), @@ -88,6 +90,7 @@ impl std::fmt::Display for FeatureExecutionError { Self::BlockPile(e) => e.fmt(f), Self::Disk(e) => e.fmt(f), Self::BlockBlob(e) => e.fmt(f), + Self::UnderwaterMagma(e) => e.fmt(f), Self::SimpleBlock(e) => e.fmt(f), Self::Random(e) => e.fmt(f), Self::Query(e) => e.fmt(f), @@ -254,6 +257,13 @@ impl FeatureDefinition { )?)?; match kind.as_str() { "minecraft:no_op" => Ok(Self::NoOp), + "minecraft:underwater_magma" => { + super::underwater_magma::UnderwaterMagmaFeature::from_json( + json, + blocks.ok_or(DecodeError::Field("underwater magma bindings"))?, + ) + .map(Self::UnderwaterMagma) + } "minecraft:vines" => super::vines::VinesFeature::new( blocks.ok_or(DecodeError::Field("vine feature bindings"))?, ) @@ -368,7 +378,7 @@ impl FeatureDefinition { as f32, None => 1.0, }; - if !(0.0..=1.0).contains(&chance) { + if !(0.0..=1.0).contains(&chance) || chance.is_sign_negative() { return Err(DecodeError::Field("pillar chance")); } let cap = super::optional(&object, "cap_feature") @@ -582,6 +592,9 @@ impl FeatureDefinition { .place(world, random, origin, run.blocks) .map_err(FeatureExecutionError::Basic), Self::NoOp => Ok(true), + Self::UnderwaterMagma(feature) => feature + .place(world, random, origin) + .map_err(FeatureExecutionError::UnderwaterMagma), Self::Vines(feature) => feature.place(world, origin).map_err(|e| match e { BlockFeatureError::World(e) => FeatureExecutionError::Basic(FeatureError::World(e)), BlockFeatureError::Query(e) => FeatureExecutionError::Query(e), diff --git a/crates/horizon-world/src/worldgen/underwater_magma.rs b/crates/horizon-world/src/worldgen/underwater_magma.rs new file mode 100644 index 000000000..0729fa3f0 --- /dev/null +++ b/crates/horizon-world/src/worldgen/underwater_magma.rs @@ -0,0 +1,187 @@ +//! Water-column floor scans and randomized magma replacement in occluded cells. +use super::{ + DecodeError, Object, block_feature::FeatureBlockBindings, + block_predicate::PredicateBlockResolver, feature::FeatureWorld, int_range, number_text, + required, +}; +use crate::{block_properties::BoundOcclusionFaces, registry::BlockStateId}; +use horizon_core::{geometry::Direction, random::RandomSource}; +use std::{collections::BTreeSet, sync::Arc}; +#[derive(Clone, Debug)] +pub struct UnderwaterMagmaFeature { + search: i32, + radius: i32, + probability: f32, + water: Arc>, + air: [BlockStateId; 3], + magma: BlockStateId, + faces: BoundOcclusionFaces, +} +#[derive(Debug)] +pub enum UnderwaterMagmaError { + World(E), + Registry(std::io::Error), + InvalidColumn, + WorkLimit, +} +impl std::fmt::Display for UnderwaterMagmaError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::World(e) => e.fmt(f), + Self::Registry(e) => e.fmt(f), + Self::InvalidColumn => f.write_str("negative scanned column height"), + Self::WorkLimit => f.write_str("magma placement work limit exceeded"), + } + } +} +impl std::error::Error for UnderwaterMagmaError {} +impl UnderwaterMagmaFeature { + pub fn from_json(json: &str, bindings: &FeatureBlockBindings<'_>) -> Result { + let object: Object = serde_json::from_str(json)?; + let probability = number_text(required( + &object, + "placement_probability_per_valid_position", + )?)? + .parse::() + .map_err(|_| DecodeError::Field("magma probability"))? as f32; + if !(0.0..=1.0).contains(&probability) || probability.is_sign_negative() { + return Err(DecodeError::Field("magma probability")); + } + Ok(Self { + search: int_range( + required(&object, "floor_search_range")?, + "magma floor range", + 0, + 512, + )?, + radius: int_range( + required(&object, "placement_radius_around_floor")?, + "magma radius", + 0, + 64, + )?, + probability, + water: bindings.predicate_block_set(r#""minecraft:water""#)?, + air: bindings.air, + magma: bindings + .registry() + .default_state("minecraft:magma_block") + .ok_or(DecodeError::Field("magma block"))?, + faces: bindings + .occlusion_faces + .clone() + .ok_or(DecodeError::Field("magma occlusion bindings"))?, + }) + } + pub fn place( + &self, + world: &mut W, + random: &mut impl RandomSource, + origin: [i32; 3], + ) -> Result> { + if !self + .water + .contains(&world.block(origin).map_err(UnderwaterMagmaError::World)?) + { + return Ok(false); + } + let ceiling = self.scan(world, origin, 1)?; + let floor = self.scan(world, origin, -1)?; + if let (Some(floor), Some(ceiling)) = (floor, ceiling) { + if ceiling.wrapping_sub(floor).wrapping_sub(1) < 0 { + return Err(UnderwaterMagmaError::InvalidColumn); + } + } + let Some(y) = floor else { + return Ok(false); + }; + let center = [origin[0], y, origin[2]]; + let a: [i32; 3] = std::array::from_fn(|i| center[i].wrapping_sub(self.radius)); + let b: [i32; 3] = std::array::from_fn(|i| center[i].wrapping_add(self.radius)); + let min: [i32; 3] = std::array::from_fn(|i| a[i].min(b[i])); + let sizes: [i32; 3] = + std::array::from_fn(|i| a[i].max(b[i]).wrapping_sub(min[i]).wrapping_add(1)); + let count = sizes[0].wrapping_mul(sizes[1]).wrapping_mul(sizes[2]); + let mut index: i32 = 0; + let mut any = false; + while index != count { + // Includes the full valid radius-64 cube (2,146,689 positions). + if index == 8_388_608 { + return Err(UnderwaterMagmaError::WorkLimit); + } + let quotient = index / sizes[0]; + let p = [ + min[0].wrapping_add(index % sizes[0]), + min[1].wrapping_add(quotient % sizes[1]), + min[2].wrapping_add(quotient / sizes[1]), + ]; + index += 1; + if random.next_float() < self.probability && self.valid(world, p)? { + world + .set_block(p, self.magma, 2) + .map_err(UnderwaterMagmaError::World)?; + any = true; + } + } + Ok(any) + } + fn scan( + &self, + world: &mut W, + mut p: [i32; 3], + step: i32, + ) -> Result, UnderwaterMagmaError> { + let mut distance = 1; + while distance < self.search { + if !self + .water + .contains(&world.block(p).map_err(UnderwaterMagmaError::World)?) + { + break; + } + p[1] = p[1].wrapping_add(step); + distance += 1; + } + Ok((!self + .water + .contains(&world.block(p).map_err(UnderwaterMagmaError::World)?)) + .then_some(p[1])) + } + fn valid( + &self, + world: &mut W, + p: [i32; 3], + ) -> Result> { + let state = world.block(p).map_err(UnderwaterMagmaError::World)?; + if self.water.contains(&state) || self.air.contains(&state) { + return Ok(false); + } + if !self.occluded(world, [p[0], p[1].wrapping_sub(1), p[2]], Direction::Up)? { + return Ok(false); + } + for direction in [ + Direction::North, + Direction::East, + Direction::South, + Direction::West, + ] { + let step = direction.normal(); + let at = std::array::from_fn(|i| p[i].wrapping_add(step[i])); + if !self.occluded(world, at, direction.opposite())? { + return Ok(false); + } + } + Ok(true) + } + fn occluded( + &self, + world: &mut W, + p: [i32; 3], + direction: Direction, + ) -> Result> { + let state = world.block(p).map_err(UnderwaterMagmaError::World)?; + self.faces + .is_full(state, direction) + .map_err(UnderwaterMagmaError::Registry) + } +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 090668494..716ff38e9 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -173,10 +173,10 @@ a shared property table. Predicates query this table in constant time. `python3 tools/test_block_properties_parity.py` compares all **35,723 states** and **18,096 synthetic cache/flag/shape cases**, including adjacent floating-point values around solidity thresholds and both occlusion flag values. The [block-properties report](../benchmarks/rust-block-properties-2026-10-06/scoped-parity.json) -records **143,361 matching lines per JAR**. Definition flags, collision and raw +records **197,180 matching lines per JAR**. Definition flags, collision and raw occlusion data are private runtime inputs; Rust calculates solidity and solid -rendering. The report was produced in an isolated staging copy and archived only -after the integrated sources and copied fixtures matched every recorded hash. +rendering and caches full-face occlusion masks. Every state and synthetic shape +is compared on all six faces; source and fixture hashes are recorded. Item/fluid-context replacement and collision with live entities remain separate work. Face selection now preserves native cube-axis shortcuts, epsilon sample points, diff --git a/docs/feature-placement.md b/docs/feature-placement.md index dd8158402..3c65d395a 100644 --- a/docs/feature-placement.md +++ b/docs/feature-placement.md @@ -181,14 +181,15 @@ routing, missing-neighbor errors and mutation-callback flag/return handling. `FeatureDefinition` and `PlacedFeatureDefinition` compose the initial block-writing features with no-op, sequence, boolean choice, uniform choice, chance-based -choice and weighted-choice features. Sequences stop on the first false child. Selectors return the +choice, weighted-choice and overlay features. Overlays execute every child and +accumulate success. Sequences stop on the first false child. Selectors return the chosen child's result directly. Child modifiers and features share world state and randomness; each sequence uses one fresh placer across its children. Native single-object holder-set shorthand is accepted for sequence/uniform lists. Run `python3 tools/test_feature_graph_parity.py`. The [graph report](../benchmarks/rust-feature-graph-2026-10-06/scoped-parity.json) records -**737,779 matching lines per JAR** for actual native feature codecs and nested +**1,146,057 matching lines per JAR** for actual native feature codecs and nested placement. Cases include empty/malformed lists, singleton and nested choices, zero/one probabilities, negative zero, false child results, partial writes, world failures, repeated calls and top-level modifier chains. @@ -217,9 +218,9 @@ names, missing dependencies and cycles return errors. Run `python3 tools/test_feature_catalog_parity.py`. The [catalog report](../benchmarks/rust-feature-catalog-2026-10-06/scoped-parity.json) -records **1,734,390 matching lines per JAR** against actual registry-aware holder -codecs, registered feature snapshots and native `TagLoader`. It compares nine -named features, fourteen placed features, five tag files, nested/duplicate references, +records **2,528,704 matching lines per JAR** against actual registry-aware holder +codecs, registered feature snapshots and native `TagLoader`. It compares ten +named features, fifteen placed features, five tag files, nested/duplicate references, optional/required missing tags, namespace shorthand and subsequent execution. Configured fill layers, single-block replacements and scattered ore bind block-state metadata through named roots, nested tags and modifier chains. Block-set @@ -228,7 +229,7 @@ the mutable world, including repeated placement after earlier writes and flowing that changes later fluid-predicate results. Empty named tags retain a native distinction from empty inline lists: a sequence -can resolve an empty tag and succeed, while a uniform selector resolves it and +can resolve an empty tag and succeed, an overlay returns false, while a uniform selector resolves it and then fails its zero-bound random choice. The inline list codecs reject empty lists during decoding. These cases and their random-state effects are compared. @@ -604,9 +605,10 @@ and nested pillars use the same feature catalog and graph work budget. Run `python3 tools/test_pillar_parity.py`. The [pillar report](../benchmarks/rust-pillar-2026-10-06/scoped-parity.json) records -**921,075 matching lines per JAR** across **41,742 fixtures**, including every +**921,111 matching lines per JAR** across **41,746 fixtures**, including every candidate descriptor, both vertical directions, continuation boundaries, -replacement conditions, cap composition, failures, rejected writes and random +signed-zero probability rejection, replacement conditions, cap composition, +failures, rejected writes and random stream tails. Workspace tests and all-target Clippy passed. Resident world updates and complete generation/gameplay remain unfinished. @@ -626,3 +628,11 @@ states, all direction masks, bounded integer providers, named/empty holder sets, mutable repeated attempts, partial failures and nested feature/modifier calls. Workspace tests and all-target Clippy passed. These feature algorithms still require complete chunk mutation, neighbor updates and gameplay integration. + +## Additional verified feature algorithms + +The executable feature graph also includes overlay composition, block piles, +disks, block blobs, springs, vines and underwater magma. Their version-specific +reports and remaining integration limits are recorded in [Rust rewrite status](rust-parity.md#overlay-feature-composition). +These comparisons cover ordered world requests; complete world updates and +playable gameplay remain pending. diff --git a/docs/rust-parity.md b/docs/rust-parity.md index 9f736e3ae..ee235e5dc 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -326,11 +326,11 @@ modifier chains and resident neighboring chunks, including live heightmap update World-region side effects and complete feature generation remain pending. The [inline feature-graph comparison](feature-placement.md#inline-feature-composition) -adds **737,779 matching lines per JAR** for nested sequences and random selectors, +adds **1,146,057 matching lines per JAR** for nested sequences, overlays and random selectors, including short-circuit results, shared randomness and partial mutations. The [named feature-resource comparison](feature-placement.md#named-feature-resources) -adds **1,734,390 matching lines per JAR** for registry-aware feature/placed-feature +adds **2,528,704 matching lines per JAR** for registry-aware feature/placed-feature holders, ordered tags and subsequent nested execution. Complete registry loading, reloads and remaining feature algorithms are still pending. @@ -394,7 +394,7 @@ query failures. Named holder references are resolved through immutable resource snapshots. Additional predicates, complete registry loading and complete feature placement remain pending. The [contained-fluid comparison](world-data.md#contained-fluid-states) adds -**239,190 matching lines per JAR** for fluid-state mapping, liquid-block conversion +**243,331 matching lines per JAR** for fluid-state mapping, liquid-block conversion and surface/camera height queries. It covers every pinned block state and query failures; fluid spreading, entity interactions and rendering remain pending. @@ -511,3 +511,22 @@ The expanded [block-property comparison](../benchmarks/rust-block-properties-202 matches **197,180 lines per reference JAR**, including all 35,723 states and 18,096 synthetic shape/flag combinations. Workspace tests and all-target Clippy pass. Lighting and renderer integration remain separate work. + +## Underwater magma and probability decoding + +Underwater magma now performs native water-column scans, including the upper +scan before the lower scan and repeated boundary reads. Each cube position draws +a probability value before testing block identity and the five required full +occlusion faces. Rejected writes still count as successful placements. + +The [underwater magma comparison](../benchmarks/rust-underwater-magma-2026-10-06/scoped-parity.json) +matches **6,523,072 lines per reference JAR** over **253,252 fixtures**. Both RNG +modes cover the complete radius-64 cube, consuming **2,146,689 draws** with zero +placement probability. Every state in the origin/floor/neighbor roles, scan +limits, partial failures, wrapped radius-zero columns and composition are tested. + +The native comparison exposed signed-zero codec behavior: bounded probabilities +reject `-0.0`, including negative values that round to float zero. Magma and +pillar decoding now preserve this. The expanded pillar gate passes **921,111 +lines per JAR** over **41,746 fixtures**. Workspace tests and all-target Clippy +pass. World updates and magma/fluid gameplay remain pending. diff --git a/docs/world-data.md b/docs/world-data.md index 26546c847..2aa84229e 100644 --- a/docs/world-data.md +++ b/docs/world-data.md @@ -138,10 +138,11 @@ block's support shape. Run `python3 tools/test_fluid_parity.py`. The [fluid report](../benchmarks/rust-fluid-2026-10-06/scoped-parity.json) records -**239,190 matching lines per JAR**. It compares all 35,723 block states, five fluid +**243,331 matching lines per JAR**. It compares all 35,723 block states, five fluid identities, every fluid-family pair, own-height bits, source/falling/full flags and -legacy block conversion. The 40,344 world fixtures request 80,688 surface/camera +legacy block conversion. An additional 2,432 fluid-state JSON fixtures compare +all 37 fluid states, native defaults, malformed properties and encoding. The 40,344 world fixtures request 80,688 surface/camera height queries, including coordinate overflow and injected failures. The support fixtures use actual vanilla stone and air states. Fluid spreading, scheduled -updates, entity interactions and rendering remain pending. Workspace tests, -Clippy and 137 Python tests passed at this stage. +updates, entity interactions and rendering remain pending. Workspace tests +and all-target Clippy pass. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java index 809fe5676..fa6dbc28a 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java @@ -59,6 +59,7 @@ public final class VanillaSimpleBlockOracle { public Object invoke(Object proxy,Method method,Object[] args)throws Throwable { String name=method.getName(); if(name.equals("getRandom"))return random; + if(name.equals("isStateAtPosition")){var p=(BlockPos)args[0];event("get "+xyz(p));var state=at(p);out.println("state "+Block.getId(state));return ((java.util.function.Predicate)args[1]).test(state);} if(name.equals("getChunk")&&args.length==1&&args[0] instanceof BlockPos)return chunk((BlockPos)args[0]); if(name.equals("getMinY"))return -64; if(name.equals("getHeight")&&(args==null||args.length==0))return 384; diff --git a/tools/test_pillar_parity.py b/tools/test_pillar_parity.py index 4f8266ece..b34274dc9 100644 --- a/tools/test_pillar_parity.py +++ b/tools/test_pillar_parity.py @@ -26,7 +26,7 @@ def corpus(facts,placement): yield case(pillar(provider,can_replace=predicate,cap_feature='horizon:moss'),fallback=get(neighbor),fail=fail) for origin,direction,chance in itertools.product([[0,-65,0],[0,-64,0],[0,319,0],[0,320,0],[2147483647,-2147483648,-2147483648],[-2147483648,2147483647,2147483647]],['up','down'],[0.0,0.5,1.0]): yield case(pillar(direction=direction,chance_to_continue=chance,cap_feature='horizon:stone'),origin=origin) - for key,values in [('block',[None,False,0,{},'missing']),('can_replace',[None,False,0,{}, {'type':'true'}]),('direction',[None,'north','UP',False,0]),('chance_to_continue',[None,False,'0.5',-0.01,1.01,0,1]),('cap_feature',[None,'missing',{},False])]: + for key,values in [('block',[None,False,0,{},'missing']),('can_replace',[None,False,0,{}, {'type':'true'}]),('direction',[None,'north','UP',False,0]),('chance_to_continue',[None,False,'0.5',-0.01,1.01,-0.0,-1e-100,1e-100,1.0000000001,0,1]),('cap_feature',[None,'missing',{},False])]: for value in values: definition=pillar();definition[key]=value;yield case(definition) definition=pillar();definition.pop(key,None);yield case(definition) diff --git a/tools/test_underwater_magma_parity.py b/tools/test_underwater_magma_parity.py new file mode 100644 index 000000000..89044f622 --- /dev/null +++ b/tools/test_underwater_magma_parity.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python3 +"""Compare underwater magma scans, face occlusion and randomized placement.""" +import itertools +import json +try: + from . import test_simple_block_parity as harness +except ImportError: + import test_simple_block_parity as harness + + +def corpus(facts, placement): + states=facts['states'];get=lambda name:facts['defaults']['minecraft:'+name] + def magma(**extra): + value={'type':'underwater_magma','floor_search_range':2,'placement_radius_around_floor':0,'placement_probability_per_valid_position':1.0};value.update(extra);return value + def case(definition=None, **extra): + origin=extra.pop('origin',[0,64,0]) + value={'definition':json.dumps(definition if definition is not None else magma(),separators=(',',':')), + 'mode':'feature','origin':origin,'legacy':False,'seed':0,'world_seed':1,'fail':-1,'reject':0, + 'brightness':15,'fallback':get('stone'),'states':[[*origin,get('water')]],'repeats':1} + value.update(extra);return value + for state in range(len(states)): + for position in [[0,64,0],[0,63,0],[0,62,0],[0,63,-1],[1,63,0],[0,63,1],[-1,63,0]]: + initial={(0,64,0):get('water')};initial[tuple(position)]=state + yield case(states=[[*p,s] for p,s in initial.items()]) + for search,above,below,legacy,fail in itertools.product([0,1,2,3,4,8,512],range(4),range(4),[False,True],[-1,0,1,2,3,5,9]): + initial=[[0,64+y,0,get('water')] for y in range(-below,above+1)] + yield case(magma(floor_search_range=search),states=initial,legacy=legacy,fail=fail) + for radius,probability,legacy,seed,fail,reject in itertools.product([0,1,2],[0.0,0.1,0.5,1.0],[False,True], + [0,-1,0x123456789abcdef],[-1,0,2,6,8,12,19],[0,1,3]): + yield case(magma(placement_radius_around_floor=radius,placement_probability_per_valid_position=probability), + legacy=legacy,seed=seed,fail=fail,reject=reject,repeats=2) + for legacy in [False,True]: + yield case(magma(placement_radius_around_floor=64,placement_probability_per_valid_position=0.0),legacy=legacy) + for origin,search in itertools.product([[2147483647,2147483647,2147483647],[-2147483648,-2147483648,-2147483648],[-17,-64,-33]],[0,1,2,3,512]): + yield case(magma(floor_search_range=search),origin=origin) + for key,values in [('floor_search_range',[None,-1,0,1,512,513,False,'2',4294967298]), + ('placement_radius_around_floor',[None,-1,0,64,65,False,'0']), + ('placement_probability_per_valid_position',[None,-1,-0.0,-1e-100,0,1e-100,1,1.0000000001,1.01,False,'1'])]: + for value in values: + definition=magma(placement_probability_per_valid_position=0.0);definition[key]=value;yield case(definition) + definition=magma();del definition[key];yield case(definition) + for legacy,seed,fail,reject in itertools.product([False,True],[0,-1],[-1,0,5,12],[0,3]): + placed={'feature':magma(placement_radius_around_floor=1,placement_probability_per_valid_position=0.5),'placement':[{'type':'count','count':2}]} + yield case(placed,mode='placed',legacy=legacy,seed=seed,fail=fail,reject=reject) + yield case({'type':'overlay','features':[placed,{'feature':'horizon:moss','placement':[]}]},legacy=legacy,seed=seed,fail=fail,reject=reject) + + +if __name__=='__main__': + harness.run(corpus,'rust-underwater-magma-parity',__file__, + 'Native UnderwaterMagmaFeature codecs and Column.scan floor selection. Initial water identity, upward scan before downward scan, repeated boundary reads, all scan endpoints, every state at origin/floor/below and each horizontal neighbor, exact full-face occlusion, cubic traversal, per-position float draws before block tests, flags 2, rejected writes and partial failures are compared. Both random modes include the complete radius-64 cube with probability zero (2146689 draws), wrapped radius-zero columns and nested placement. Rust allows the entire valid codec radius domain and bounds pathological overflow iteration at 2^23 visits. Actual chunk update callbacks, magma gameplay and full world generation remain pending.') From 49f526116b8ab1103a7f783f6198120e1b0c2aca Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 12:59:34 +0200 Subject: [PATCH 019/253] Implement native blue-ice seeding and spreading --- .github/workflows/ci.yml | 4 + .../scoped-parity.json | 210 ++++++++++++++++++ .../examples/simple_block_fixture.rs | 6 + crates/horizon-world/src/worldgen.rs | 1 + crates/horizon-world/src/worldgen/blue_ice.rs | 156 +++++++++++++ .../src/worldgen/feature_graph.rs | 10 + .../src/worldgen/feature_region.rs | 15 ++ .../src/worldgen/placement/context.rs | 4 + docs/rust-parity.md | 15 ++ .../parity/VanillaSimpleBlockOracle.java | 2 +- tools/test_blue_ice_parity.py | 40 ++++ 11 files changed, 462 insertions(+), 1 deletion(-) create mode 100644 benchmarks/rust-blue-ice-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-world/src/worldgen/blue_ice.rs create mode 100644 tools/test_blue_ice_parity.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ef47caa18..6aa282bab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -135,6 +135,10 @@ jobs: env: RUSTUP_TOOLCHAIN: stable run: python tools/test_underwater_magma_parity.py + - name: Compare blue-ice seeding and growth attempts + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_blue_ice_parity.py - name: Compare ordered single-block replacement features env: RUSTUP_TOOLCHAIN: stable diff --git a/benchmarks/rust-blue-ice-2026-10-06/scoped-parity.json b/benchmarks/rust-blue-ice-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..e2c9f242a --- /dev/null +++ b/benchmarks/rust-blue-ice-2026-10-06/scoped-parity.json @@ -0,0 +1,210 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 79944, + "candidate_states": 35723, + "double_plant_blocks": 10, + "mossy_carpet_blocks": 1, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java": "8166679666563fbe0fe6e1778f1d88a29c939bbc06f57f723ebf2f81731aea9b", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSurvivalOracle.java": "4e7cc151617c1b02e872f9ca3e9fe4632379f225f4f07718ff6492df4ee551e7", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java": "e871d3a01f15616a98ca9227c27a81e4d17e2d57ac4e68a5650a70fa29811497", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSupportOracle.java": "04350901a2d708fb8fa672de61d058f73f332d2e90df1b93a67781862f89c1ad", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "60ff9ef7c1d5e23c080f9aec95ab2e7d3b7c5b5bcd67b9efa9518776c400629a", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_simple_block_parity.py": "50b783323051fe8cd369bb733448b0314f1e6e7994a950e4cb6cd2fe4f7f8e11", + "tools/test_blue_ice_parity.py": "9d740e5c5e23fa7b63db6755b20e4aefde9fdd43913326f28e54ca0cc19ded45", + "tools/test_block_survival_parity.py": "9e8dff3bd4b95dbfd29f8adc6a2f6d66abf19a6b1cd91423b794a345d4ec244a", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "a8cd85f6223668c1446ff103276d80937b9707d9a7dc619a176b1b1ceed36a4a", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "1eae82604d2b3377fd35aaa3a914a67e5af28f93923815a49e895b4d437433cd", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "5ce5c6eaa5f8a2557a620e533788217b1eb430654801dcf6135d6c92d7a012ac", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "4fbe5954db1bc333bf3bc627e05b446bbed4bc072ce03c8e1d85137c965db8c4", + "crates/horizon-world/src/worldgen/feature_region.rs": "79e8ce343b0dc80dceb8b214c818b383d9b110540bb8c3b0ac32863a7800e288", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "e682d13a21f90605215b79f5d254bf2e524d35e89eab2e3b46384709af80b847", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "33f8a02039131338cc0f50c53bc53df9d069f0d787c84699f07bf6e949a0e6f9", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "ae4ac2d751fa8c1de83074a635f0bbd4da75a621aa3f28e6f973597685fe389e", + "crates/horizon-world/examples/simple_block_fixture.rs": "2fd31ed9b7405cf59df24bb0eff4c7eb9bae4cd211e949c3b53cc3626febc9fa" + }, + "fixtures_sha256": { + ".local/rust-blue-ice-parity/inputs.txt": "2e151bccbe1019892ab2321ee658b9d046f33925b4edda5dbc19ceaaba9a3225", + ".local/rust-blue-ice-parity/block-properties.nbt": "1aba22092f70d16b8092014c058ddc210e4aaa77bac32f6ec62e4d0e91d92a99", + ".local/rust-blue-ice-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-blue-ice-parity/cached-collision.nbt": "f3a5c6a5b2d51dad6c52e486e2b9989e79fd55db1a9bda6196db399550b04078", + ".local/rust-blue-ice-parity/cached-support.nbt": "b6fdc9471b0b61e904206d3f099f4dc235aad6d723536c210be0cb7c3560d82c", + ".local/rust-blue-ice-parity/catalog.json": "93581107e3564e60261044fdca61e3b7f237b9e6724c14b86e335ccc01198ba9", + ".local/rust-blue-ice-parity/facts.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-blue-ice-parity/feature-catalog.json": "c048c761c5084a40560731955cc999a364d14055bdd86fa50989a92e4a771286", + ".local/rust-blue-ice-parity/fluid-tags.json": "f1e5eb6d22ea7effbb118a2282709cfdeef1bfae4516b775a55ad7a4df29d7d0", + ".local/rust-blue-ice-parity/placement-definitions.json": "f8a972ec87c2352500af6481158a3192bdbf699951025639bea744e4127b97c4", + ".local/rust-blue-ice-parity/support-cached-states.json": "353945a58fe69b352925473f1693f9b14a9ad19f13c15159c4184f2c29258622", + ".local/rust-blue-ice-parity/survival-classes.json": "361832008eea0aa9151d367a125a19c6353d99a0b88b27dd0682f55b7954553e", + ".local/rust-blue-ice-parity/survival-extra-definitions.json": "170f2db5bc97a49fa25cc249540aa7f04beea455cdbaf43742ed9415f5090a02", + ".local/rust-blue-ice-parity/survival-placement-classes.json": "7fdbf48ab18c87098bbe1b6176cb81f4842b6c5d9a4d6bbaf7037ff61cb1848c", + ".local/rust-blue-ice-parity/survival-rules.json": "8805c18b3195bb1eac1f1e5281333df56e2892505f64023e5403c58ce2ec4368", + ".local/rust-blue-ice-parity/survival-support-tags.json": "15d88d5bb5ad10d65124d5abb2cc055d251b06d129bca7be06f55b43dc13f6fd", + ".local/rust-blue-ice-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0" + }, + "rust_output_sha256": "ea6121849b6235043d256ebc9056cc8f93b3a1f8ad13ca76d5997edc9da3f30f", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "ea6121849b6235043d256ebc9056cc8f93b3a1f8ad13ca76d5997edc9da3f30f", + "matched_output_lines": 8954666 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "ea6121849b6235043d256ebc9056cc8f93b3a1f8ad13ca76d5997edc9da3f30f", + "matched_output_lines": 8954666 + } + ], + "scope": "Native BlueIceFeature unit codec, world sea-level gate, origin/below water checks, first non-down packed-ice neighbor and seeding. Every origin and candidate-state classification is compared through failure-terminated prefixes; complete 200-attempt runs cover all packed-ice neighbor masks, ten representative fill states, both random streams and many seeds. Vertical bound draws, signed division, X/Z draw order, six-direction blue-ice adjacency, mutable spreading, flags 2, rejected writes, partial failures, extreme sea levels, wrapped positions and overlay/modifier composition are included. Chunk updates, ice gameplay and full world generation remain pending." +} diff --git a/crates/horizon-world/examples/simple_block_fixture.rs b/crates/horizon-world/examples/simple_block_fixture.rs index 32273de27..ee9d8aea9 100644 --- a/crates/horizon-world/examples/simple_block_fixture.rs +++ b/crates/horizon-world/examples/simple_block_fixture.rs @@ -49,6 +49,7 @@ struct World<'a, 'r, W, R> { fail: i32, reject: i32, brightness: i32, + sea_level: i32, } impl World<'_, '_, W, R> { fn event(&mut self, text: std::fmt::Arguments<'_>) -> io::Result { @@ -134,6 +135,10 @@ fn query(error: impl std::fmt::Display) -> PlacementQueryError { PlacementQueryError::Failed(error.to_string()) } impl PlacementContext for World<'_, '_, W, R> { + fn sea_level(&mut self) -> Result { + Ok(self.sea_level) + } + fn schedule_fluid_tick( &mut self, p: [i32; 3], @@ -287,6 +292,7 @@ fn fixture( fail: f["fail"].as_i64().unwrap() as i32, reject: f["reject"].as_i64().unwrap() as i32, brightness: f["brightness"].as_i64().unwrap() as i32, + sea_level: f.get("sea").and_then(Value::as_i64).unwrap_or(63) as i32, }; match feature { Err(_) => writeln!(world.out, "decode error")?, diff --git a/crates/horizon-world/src/worldgen.rs b/crates/horizon-world/src/worldgen.rs index 9b76af172..e089abfe0 100644 --- a/crates/horizon-world/src/worldgen.rs +++ b/crates/horizon-world/src/worldgen.rs @@ -12,6 +12,7 @@ pub mod block_column; pub mod block_feature; pub mod block_pile; pub mod block_predicate; +pub mod blue_ice; pub mod bulk_section; pub mod carver; pub mod carving; diff --git a/crates/horizon-world/src/worldgen/blue_ice.rs b/crates/horizon-world/src/worldgen/blue_ice.rs new file mode 100644 index 000000000..e3b2e3f0c --- /dev/null +++ b/crates/horizon-world/src/worldgen/blue_ice.rs @@ -0,0 +1,156 @@ +//! Packed-ice seeding and 200 ordered blue-ice growth attempts. +use super::{ + DecodeError, + block_feature::FeatureBlockBindings, + block_predicate::PredicateBlockResolver, + feature::FeatureWorld, + placement::{PlacementContext, PlacementQueryError}, +}; +use crate::registry::BlockStateId; +use horizon_core::{ + geometry::Direction, + random::{InvalidBound, RandomSource}, +}; +use std::{collections::BTreeSet, sync::Arc}; +#[derive(Clone, Debug)] +pub struct BlueIceFeature { + water: Arc>, + packed: Arc>, + blue: Arc>, + replaceable: BTreeSet, + output: BlockStateId, +} +#[derive(Debug)] +pub enum BlueIceError { + World(E), + Query(PlacementQueryError), + Random(InvalidBound), +} +impl std::fmt::Display for BlueIceError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::World(e) => e.fmt(f), + Self::Query(e) => e.fmt(f), + Self::Random(e) => e.fmt(f), + } + } +} +impl std::error::Error for BlueIceError {} +impl BlueIceFeature { + pub fn new(bindings: &FeatureBlockBindings<'_>) -> Result { + let water = bindings.predicate_block_set(r#""minecraft:water""#)?; + let packed = bindings.predicate_block_set(r#""minecraft:packed_ice""#)?; + let blue = bindings.predicate_block_set(r#""minecraft:blue_ice""#)?; + let mut replaceable: BTreeSet<_> = bindings.air.into_iter().collect(); + replaceable.extend(water.iter().copied()); + replaceable.extend(packed.iter().copied()); + replaceable.extend( + bindings + .predicate_block_set(r#""minecraft:ice""#)? + .iter() + .copied(), + ); + Ok(Self { + water, + packed, + blue, + replaceable, + output: bindings + .registry() + .default_state("minecraft:blue_ice") + .ok_or(DecodeError::Field("blue ice block"))?, + }) + } + pub fn place( + &self, + world: &mut W, + random: &mut impl RandomSource, + origin: [i32; 3], + ) -> Result> { + if origin[1] + > world + .sea_level() + .map_err(BlueIceError::Query)? + .wrapping_sub(1) + { + return Ok(false); + } + if !self + .water + .contains(&world.block(origin).map_err(BlueIceError::World)?) + && !self.water.contains( + &world + .block([origin[0], origin[1].wrapping_sub(1), origin[2]]) + .map_err(BlueIceError::World)?, + ) + { + return Ok(false); + } + let mut nearby = false; + for direction in Direction::ALL { + if direction == Direction::Down { + continue; + } + let at = offset(origin, direction.normal()); + if self + .packed + .contains(&world.block(at).map_err(BlueIceError::World)?) + { + nearby = true; + break; + } + } + if !nearby { + return Ok(false); + } + world + .set_block(origin, self.output, 2) + .map_err(BlueIceError::World)?; + for _ in 0..200 { + let dy = random.next_int_bound(5).map_err(BlueIceError::Random)? + - random.next_int_bound(6).map_err(BlueIceError::Random)?; + let mut radius = 3; + if dy < 2 { + radius += dy / 2; + } + if radius < 1 { + continue; + } + let dx = random + .next_int_bound(radius) + .map_err(BlueIceError::Random)? + - random + .next_int_bound(radius) + .map_err(BlueIceError::Random)?; + let dz = random + .next_int_bound(radius) + .map_err(BlueIceError::Random)? + - random + .next_int_bound(radius) + .map_err(BlueIceError::Random)?; + let p = offset(origin, [dx, dy, dz]); + if !self + .replaceable + .contains(&world.block(p).map_err(BlueIceError::World)?) + { + continue; + } + for direction in Direction::ALL { + if self.blue.contains( + &world + .block(offset(p, direction.normal())) + .map_err(BlueIceError::World)?, + ) { + world + .set_block(p, self.output, 2) + .map_err(BlueIceError::World)?; + break; + } + } + } + Ok(true) + } +} +fn offset(p: [i32; 3], d: [i32; 3]) -> [i32; 3] { + std::array::from_fn(|i| p[i].wrapping_add(d[i])) +} diff --git a/crates/horizon-world/src/worldgen/feature_graph.rs b/crates/horizon-world/src/worldgen/feature_graph.rs index c033c6624..62b68c8e8 100644 --- a/crates/horizon-world/src/worldgen/feature_graph.rs +++ b/crates/horizon-world/src/worldgen/feature_graph.rs @@ -49,6 +49,7 @@ pub enum FeatureDefinition { Disk(super::disk::DiskFeature), Spring(super::spring::SpringFeature), Vines(super::vines::VinesFeature), + BlueIce(super::blue_ice::BlueIceFeature), UnderwaterMagma(super::underwater_magma::UnderwaterMagmaFeature), BlockBlob(super::block_blob::BlockBlobFeature), SimpleBlock(super::simple_block::SimpleBlockFeature), @@ -74,6 +75,7 @@ pub enum FeatureExecutionError { BlockPile(super::block_pile::BlockPileError), Disk(super::disk::DiskError), BlockBlob(super::block_blob::BlockBlobError), + BlueIce(super::blue_ice::BlueIceError), UnderwaterMagma(super::underwater_magma::UnderwaterMagmaError), SimpleBlock(super::simple_block::SimpleBlockError), Random(InvalidBound), @@ -90,6 +92,7 @@ impl std::fmt::Display for FeatureExecutionError { Self::BlockPile(e) => e.fmt(f), Self::Disk(e) => e.fmt(f), Self::BlockBlob(e) => e.fmt(f), + Self::BlueIce(e) => e.fmt(f), Self::UnderwaterMagma(e) => e.fmt(f), Self::SimpleBlock(e) => e.fmt(f), Self::Random(e) => e.fmt(f), @@ -257,6 +260,10 @@ impl FeatureDefinition { )?)?; match kind.as_str() { "minecraft:no_op" => Ok(Self::NoOp), + "minecraft:blue_ice" => super::blue_ice::BlueIceFeature::new( + blocks.ok_or(DecodeError::Field("blue ice bindings"))?, + ) + .map(Self::BlueIce), "minecraft:underwater_magma" => { super::underwater_magma::UnderwaterMagmaFeature::from_json( json, @@ -592,6 +599,9 @@ impl FeatureDefinition { .place(world, random, origin, run.blocks) .map_err(FeatureExecutionError::Basic), Self::NoOp => Ok(true), + Self::BlueIce(feature) => feature + .place(world, random, origin) + .map_err(FeatureExecutionError::BlueIce), Self::UnderwaterMagma(feature) => feature .place(world, random, origin) .map_err(FeatureExecutionError::UnderwaterMagma), diff --git a/crates/horizon-world/src/worldgen/feature_region.rs b/crates/horizon-world/src/worldgen/feature_region.rs index d96636750..783537df1 100644 --- a/crates/horizon-world/src/worldgen/feature_region.rs +++ b/crates/horizon-world/src/worldgen/feature_region.rs @@ -44,6 +44,7 @@ pub struct TerrainRegion<'r, B: TerrainBlockStates> { min_y: i32, height: i32, generation: WorldGenerationContext, + sea_level: i32, } impl<'r, B: TerrainBlockStates> TerrainRegion<'r, B> { pub fn new( @@ -69,6 +70,7 @@ impl<'r, B: TerrainBlockStates> TerrainRegion<'r, B> { } Ok(Self { chunks: stored, + sea_level: generator.sea_level, min_y, height, generation: WorldGenerationContext::with_generator( @@ -80,6 +82,11 @@ impl<'r, B: TerrainBlockStates> TerrainRegion<'r, B> { ), }) } + /// Override world sea level without changing generator placement anchors. + pub fn with_world_sea_level(mut self, sea_level: i32) -> Self { + self.sea_level = sea_level; + self + } pub fn chunks(&self) -> impl Iterator> { self.chunks.values() } @@ -136,6 +143,10 @@ impl<'r, B: TerrainBlockStates> TerrainRegion<'r, B> { } } impl PlacementContext for TerrainRegion<'_, B> { + fn sea_level(&mut self) -> Result { + Ok(self.sea_level) + } + fn mark_postprocessing(&mut self, [x, y, z]: [i32; 3]) -> Result<(), PlacementQueryError> { self.chunk_mut(x >> 4, z >> 4)?.mark_postprocessing(x, y, z); Ok(()) @@ -197,6 +208,10 @@ impl<'a, 'r, B: TerrainBlockStates, F> TerrainFeatureAccess<'a, 'r, B, F> { } } impl PlacementContext for TerrainFeatureAccess<'_, '_, B, F> { + fn sea_level(&mut self) -> Result { + self.region.sea_level() + } + fn mark_postprocessing(&mut self, position: [i32; 3]) -> Result<(), PlacementQueryError> { self.region.mark_postprocessing(position) } diff --git a/crates/horizon-world/src/worldgen/placement/context.rs b/crates/horizon-world/src/worldgen/placement/context.rs index a760bf0d7..378fb8692 100644 --- a/crates/horizon-world/src/worldgen/placement/context.rs +++ b/crates/horizon-world/src/worldgen/placement/context.rs @@ -26,6 +26,10 @@ pub enum LayerBlock { Ground, } pub trait PlacementContext { + /// World sea level, independently of the generator's placement context. + fn sea_level(&mut self) -> Result { + Err(PlacementQueryError::Unavailable) + } fn schedule_fluid_tick( &mut self, _position: [i32; 3], diff --git a/docs/rust-parity.md b/docs/rust-parity.md index ee235e5dc..797ab8231 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -530,3 +530,18 @@ reject `-0.0`, including negative values that round to float zero. Magma and pillar decoding now preserve this. The expanded pillar gate passes **921,111 lines per JAR** over **41,746 fixtures**. Workspace tests and all-target Clippy pass. World updates and magma/fluid gameplay remain pending. + +## Blue ice generation + +Blue ice features now preserve world sea-level gating, water and packed-ice +seeding checks, all 200 spreading attempts, signed vertical radius adjustment, +random draw order and six-direction adjacency. World sea level can differ from +the generation context's sea level. Rejected writes preserve native success and +subsequent attempts observe the actual mutable world. + +The [blue-ice comparison](../benchmarks/rust-blue-ice-2026-10-06/scoped-parity.json) +matches **8,954,666 lines per reference JAR** across **79,944 fixtures**, covering +every origin/candidate state through failure-terminated prefixes, full spreading +runs, all packed-ice neighbor masks, extreme sea levels, wrapped positions, +partial failures and composition. Workspace tests, all-target Clippy and all +149 Python tests pass. Ice gameplay and complete world generation remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java index fa6dbc28a..a620cffc9 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java @@ -63,7 +63,7 @@ public final class VanillaSimpleBlockOracle { if(name.equals("getChunk")&&args.length==1&&args[0] instanceof BlockPos)return chunk((BlockPos)args[0]); if(name.equals("getMinY"))return -64; if(name.equals("getHeight")&&(args==null||args.length==0))return 384; - if(name.equals("getSeaLevel"))return 63; + if(name.equals("getSeaLevel"))return f.has("sea")?f.get("sea").getAsInt():63; if(name.equals("getBlockState")){var p=(BlockPos)args[0];event("get "+xyz(p));var state=at(p);out.println("state "+Block.getId(state));return state;} if(name.equals("getFluidState")){var p=(BlockPos)args[0];event("fluid "+xyz(p));return (f.has("fluid")?Block.stateById(f.get("fluid").getAsInt()):at(p)).getFluidState();} if(name.equals("getRawBrightness")){var p=(BlockPos)args[0];event("light "+xyz(p)+" "+args[1]);return f.get("brightness").getAsInt();} diff --git a/tools/test_blue_ice_parity.py b/tools/test_blue_ice_parity.py new file mode 100644 index 000000000..83c3b0685 --- /dev/null +++ b/tools/test_blue_ice_parity.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python3 +"""Compare blue-ice sea-level gating, seeding and growth attempts.""" +import itertools +import json +try: + from . import test_simple_block_parity as harness +except ImportError: + import test_simple_block_parity as harness + + +def corpus(facts, placement): + states=facts['states'];get=lambda name:facts['defaults']['minecraft:'+name] + directions=[(0,-1,0),(0,1,0),(0,0,-1),(0,0,1),(-1,0,0),(1,0,0)] + def case(**extra): + origin=extra.pop('origin',[0,60,0]);wrap=lambda n:(n+2**31)%2**32-2**31 + value={'definition':'{"type":"blue_ice"}','mode':'feature','origin':origin,'legacy':False,'seed':0,'world_seed':1, + 'fail':-1,'reject':0,'brightness':15,'sea':63,'fallback':get('air'), + 'states':[[*origin,get('water')],[origin[0],wrap(origin[1]+1),origin[2],get('packed_ice')]],'repeats':1} + value.update(extra);return value + for state in range(len(states)): + yield case(states=[[0,60,0,state],[0,59,0,get('water')],[0,61,0,get('packed_ice')]],fail=24) + yield case(fallback=state,fail=24) + for mask,legacy,seed,fail,reject in itertools.product(range(64),[False,True],[0,-1,0x123456789abcdef],[-1,0,1,3,6,9,21],[0,1,3]): + initial=[[0,60,0,get('water')],*[[x,60+y,z,get('packed_ice') if mask&(1< Date: Tue, 6 Oct 2026 13:04:32 +0200 Subject: [PATCH 020/253] Implement native spike geometry and discontinuous roots --- .github/workflows/ci.yml | 4 + .../rust-spike-2026-10-06/scoped-parity.json | 211 ++++++++++++++++++ crates/horizon-world/src/worldgen.rs | 1 + .../src/worldgen/feature_graph.rs | 13 ++ crates/horizon-world/src/worldgen/spike.rs | 187 ++++++++++++++++ docs/rust-parity.md | 15 ++ tools/test_spike_parity.py | 86 +++++++ 7 files changed, 517 insertions(+) create mode 100644 benchmarks/rust-spike-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-world/src/worldgen/spike.rs create mode 100644 tools/test_spike_parity.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6aa282bab..1a6a0af9e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -139,6 +139,10 @@ jobs: env: RUSTUP_TOOLCHAIN: stable run: python tools/test_blue_ice_parity.py + - name: Compare spike geometry and discontinuous roots + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_spike_parity.py - name: Compare ordered single-block replacement features env: RUSTUP_TOOLCHAIN: stable diff --git a/benchmarks/rust-spike-2026-10-06/scoped-parity.json b/benchmarks/rust-spike-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..4311e007b --- /dev/null +++ b/benchmarks/rust-spike-2026-10-06/scoped-parity.json @@ -0,0 +1,211 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 113127, + "candidate_states": 35723, + "double_plant_blocks": 10, + "mossy_carpet_blocks": 1, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java": "8166679666563fbe0fe6e1778f1d88a29c939bbc06f57f723ebf2f81731aea9b", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSurvivalOracle.java": "4e7cc151617c1b02e872f9ca3e9fe4632379f225f4f07718ff6492df4ee551e7", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java": "e871d3a01f15616a98ca9227c27a81e4d17e2d57ac4e68a5650a70fa29811497", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSupportOracle.java": "04350901a2d708fb8fa672de61d058f73f332d2e90df1b93a67781862f89c1ad", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "60ff9ef7c1d5e23c080f9aec95ab2e7d3b7c5b5bcd67b9efa9518776c400629a", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_simple_block_parity.py": "50b783323051fe8cd369bb733448b0314f1e6e7994a950e4cb6cd2fe4f7f8e11", + "tools/test_spike_parity.py": "c2f40423d588532a5d9f651152a045db3d0f5b1de5c93d33261c6d6ccce6c56e", + "tools/test_block_survival_parity.py": "9e8dff3bd4b95dbfd29f8adc6a2f6d66abf19a6b1cd91423b794a345d4ec244a", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "a8cd85f6223668c1446ff103276d80937b9707d9a7dc619a176b1b1ceed36a4a", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "1eae82604d2b3377fd35aaa3a914a67e5af28f93923815a49e895b4d437433cd", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "5ce5c6eaa5f8a2557a620e533788217b1eb430654801dcf6135d6c92d7a012ac", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "d983b2e518e2da5089e55f03226570e8b6b3132fbb5566287fc8acf2d63038ec", + "crates/horizon-world/src/worldgen/feature_region.rs": "79e8ce343b0dc80dceb8b214c818b383d9b110540bb8c3b0ac32863a7800e288", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "e682d13a21f90605215b79f5d254bf2e524d35e89eab2e3b46384709af80b847", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "33f8a02039131338cc0f50c53bc53df9d069f0d787c84699f07bf6e949a0e6f9", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "197d6660307c61808351ad9b57a1ce54bd6f4782c1bbbc28b14407afb71bbbcb", + "crates/horizon-world/examples/simple_block_fixture.rs": "2fd31ed9b7405cf59df24bb0eff4c7eb9bae4cd211e949c3b53cc3626febc9fa" + }, + "fixtures_sha256": { + ".local/rust-spike-parity/inputs.txt": "e17fd6c5927c52b9bb925d7d3618160b60dbefb826b3393b674d9e84ddf6a401", + ".local/rust-spike-parity/block-properties.nbt": "1aba22092f70d16b8092014c058ddc210e4aaa77bac32f6ec62e4d0e91d92a99", + ".local/rust-spike-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-spike-parity/cached-collision.nbt": "f3a5c6a5b2d51dad6c52e486e2b9989e79fd55db1a9bda6196db399550b04078", + ".local/rust-spike-parity/cached-support.nbt": "b6fdc9471b0b61e904206d3f099f4dc235aad6d723536c210be0cb7c3560d82c", + ".local/rust-spike-parity/catalog.json": "93581107e3564e60261044fdca61e3b7f237b9e6724c14b86e335ccc01198ba9", + ".local/rust-spike-parity/facts.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-spike-parity/feature-catalog.json": "c048c761c5084a40560731955cc999a364d14055bdd86fa50989a92e4a771286", + ".local/rust-spike-parity/fluid-tags.json": "f1e5eb6d22ea7effbb118a2282709cfdeef1bfae4516b775a55ad7a4df29d7d0", + ".local/rust-spike-parity/placement-definitions.json": "f8a972ec87c2352500af6481158a3192bdbf699951025639bea744e4127b97c4", + ".local/rust-spike-parity/support-cached-states.json": "353945a58fe69b352925473f1693f9b14a9ad19f13c15159c4184f2c29258622", + ".local/rust-spike-parity/survival-classes.json": "361832008eea0aa9151d367a125a19c6353d99a0b88b27dd0682f55b7954553e", + ".local/rust-spike-parity/survival-extra-definitions.json": "170f2db5bc97a49fa25cc249540aa7f04beea455cdbaf43742ed9415f5090a02", + ".local/rust-spike-parity/survival-placement-classes.json": "7fdbf48ab18c87098bbe1b6176cb81f4842b6c5d9a4d6bbaf7037ff61cb1848c", + ".local/rust-spike-parity/survival-rules.json": "8805c18b3195bb1eac1f1e5281333df56e2892505f64023e5403c58ce2ec4368", + ".local/rust-spike-parity/survival-support-tags.json": "15d88d5bb5ad10d65124d5abb2cc055d251b06d129bca7be06f55b43dc13f6fd", + ".local/rust-spike-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0" + }, + "rust_output_sha256": "4c7ad7206f10188c86e530a67c915458846cfbba8dad25d3154b308db35f1ae1", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "4c7ad7206f10188c86e530a67c915458846cfbba8dad25d3154b308db35f1ae1", + "matched_output_lines": 8859761 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "4c7ad7206f10188c86e530a67c915458846cfbba8dad25d3154b308db35f1ae1", + "matched_output_lines": 8859761 + } + ], + "scope": "Native SpikeFeature required state/predicate codecs, air descent, support gating, height/radius draws, rare tall spikes, float taper and edge draws, independently tested mirrored layers, and discontinuous roots with a fixed Y=50 floor. Every configured output, origin and candidate state is compared through failure-terminated prefixes. Full runs cover 1024 seeds per RNG, replacement/support predicates, exact-state root exceptions, rejected writes, repeated mutations, query failures, wrapped positions and placement/overlay composition. Rust limits pathological descent/root work to 2^20 visits. World update execution and complete generation remain pending." +} diff --git a/crates/horizon-world/src/worldgen.rs b/crates/horizon-world/src/worldgen.rs index e089abfe0..b493ce262 100644 --- a/crates/horizon-world/src/worldgen.rs +++ b/crates/horizon-world/src/worldgen.rs @@ -37,6 +37,7 @@ pub mod router; pub mod rule_test; pub mod settings; pub mod simple_block; +pub mod spike; pub mod spring; pub mod state_provider; pub mod tags; diff --git a/crates/horizon-world/src/worldgen/feature_graph.rs b/crates/horizon-world/src/worldgen/feature_graph.rs index 62b68c8e8..1d8ef60ec 100644 --- a/crates/horizon-world/src/worldgen/feature_graph.rs +++ b/crates/horizon-world/src/worldgen/feature_graph.rs @@ -49,6 +49,7 @@ pub enum FeatureDefinition { Disk(super::disk::DiskFeature), Spring(super::spring::SpringFeature), Vines(super::vines::VinesFeature), + Spike(super::spike::SpikeFeature), BlueIce(super::blue_ice::BlueIceFeature), UnderwaterMagma(super::underwater_magma::UnderwaterMagmaFeature), BlockBlob(super::block_blob::BlockBlobFeature), @@ -75,6 +76,7 @@ pub enum FeatureExecutionError { BlockPile(super::block_pile::BlockPileError), Disk(super::disk::DiskError), BlockBlob(super::block_blob::BlockBlobError), + Spike(super::spike::SpikeError), BlueIce(super::blue_ice::BlueIceError), UnderwaterMagma(super::underwater_magma::UnderwaterMagmaError), SimpleBlock(super::simple_block::SimpleBlockError), @@ -92,6 +94,7 @@ impl std::fmt::Display for FeatureExecutionError { Self::BlockPile(e) => e.fmt(f), Self::Disk(e) => e.fmt(f), Self::BlockBlob(e) => e.fmt(f), + Self::Spike(e) => e.fmt(f), Self::BlueIce(e) => e.fmt(f), Self::UnderwaterMagma(e) => e.fmt(f), Self::SimpleBlock(e) => e.fmt(f), @@ -260,6 +263,13 @@ impl FeatureDefinition { )?)?; match kind.as_str() { "minecraft:no_op" => Ok(Self::NoOp), + "minecraft:spike" => super::spike::SpikeFeature::decode( + json, + blocks.ok_or(DecodeError::Field("spike bindings"))?, + depth + 1, + remaining, + ) + .map(Self::Spike), "minecraft:blue_ice" => super::blue_ice::BlueIceFeature::new( blocks.ok_or(DecodeError::Field("blue ice bindings"))?, ) @@ -599,6 +609,9 @@ impl FeatureDefinition { .place(world, random, origin, run.blocks) .map_err(FeatureExecutionError::Basic), Self::NoOp => Ok(true), + Self::Spike(feature) => feature + .place(world, random, origin) + .map_err(FeatureExecutionError::Spike), Self::BlueIce(feature) => feature .place(world, random, origin) .map_err(FeatureExecutionError::BlueIce), diff --git a/crates/horizon-world/src/worldgen/spike.rs b/crates/horizon-world/src/worldgen/spike.rs new file mode 100644 index 000000000..fd9cec614 --- /dev/null +++ b/crates/horizon-world/src/worldgen/spike.rs @@ -0,0 +1,187 @@ +//! Randomized tapered spikes, mirrored lower layers and discontinuous roots. +use super::{ + DecodeError, Object, + block_feature::FeatureBlockBindings, + block_predicate::BlockPredicate, + feature::FeatureWorld, + placement::{PlacementContext, PlacementQueryError}, + required, +}; +use crate::registry::BlockStateId; +use horizon_core::random::{InvalidBound, RandomSource}; +#[derive(Clone, Debug)] +pub struct SpikeFeature { + state: BlockStateId, + can_place_on: BlockPredicate, + can_replace: BlockPredicate, + air: [BlockStateId; 3], +} +#[derive(Debug)] +pub enum SpikeError { + World(E), + Query(PlacementQueryError), + Random(InvalidBound), + WorkLimit, +} +impl std::fmt::Display for SpikeError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::World(e) => e.fmt(f), + Self::Query(e) => e.fmt(f), + Self::Random(e) => e.fmt(f), + Self::WorkLimit => f.write_str("spike work limit exceeded"), + } + } +} +impl std::error::Error for SpikeError {} +impl SpikeFeature { + pub fn from_json(json: &str, bindings: &FeatureBlockBindings<'_>) -> Result { + Self::decode(json, bindings, 0, &mut 65536) + } + pub(crate) fn decode( + json: &str, + bindings: &FeatureBlockBindings<'_>, + depth: usize, + remaining: &mut usize, + ) -> Result { + if depth > 128 || *remaining == 0 { + return Err(DecodeError::Field("spike depth or work")); + } + *remaining -= 1; + let object: Object = serde_json::from_str(json)?; + Ok(Self { + state: bindings + .codec + .decode(required(&object, "state")?.get(), false) + .map_err(|e| DecodeError::Registry(e.to_string()))?, + can_place_on: BlockPredicate::decode_with_blocks( + required(&object, "can_place_on")?.get(), + depth + 1, + remaining, + Some(bindings), + )?, + can_replace: BlockPredicate::decode_with_blocks( + required(&object, "can_replace")?.get(), + depth + 1, + remaining, + Some(bindings), + )?, + air: bindings.air, + }) + } + pub fn place( + &self, + world: &mut W, + random: &mut impl RandomSource, + mut origin: [i32; 3], + ) -> Result> { + let mut budget = 1_048_576; + loop { + spend(&mut budget)?; + if !self + .air + .contains(&world.block(origin).map_err(SpikeError::World)?) + { + break; + } + if origin[1] <= world.min_y().map_err(SpikeError::Query)?.wrapping_add(2) { + break; + } + origin[1] = origin[1].wrapping_sub(1); + } + if !self + .can_place_on + .test(world, origin) + .map_err(SpikeError::Query)? + { + return Ok(false); + } + origin[1] = origin[1].wrapping_add(random.next_int_bound(4).map_err(SpikeError::Random)?); + let height = random.next_int_bound(4).map_err(SpikeError::Random)? + 7; + let base = height / 4 + random.next_int_bound(2).map_err(SpikeError::Random)?; + if base > 1 && random.next_int_bound(60).map_err(SpikeError::Random)? == 0 { + origin[1] = + origin[1].wrapping_add(10 + random.next_int_bound(30).map_err(SpikeError::Random)?); + } + for layer in 0..height { + let radius = (1.0 - layer as f32 / height as f32) * base as f32; + let ceil = radius.ceil() as i32; + for x in -ceil..=ceil { + let fx = x.abs() as f32 - 0.25; + for z in -ceil..=ceil { + let fz = z.abs() as f32 - 0.25; + if (x != 0 || z != 0) && fx * fx + fz * fz > radius * radius { + continue; + } + if (x == -ceil || x == ceil || z == -ceil || z == ceil) + && random.next_float() > 0.75 + { + continue; + } + self.place_part(world, offset(origin, [x, layer, z]))?; + if layer != 0 && ceil > 1 { + self.place_part(world, offset(origin, [x, -layer, z]))?; + } + } + } + } + let roots = (base - 1).clamp(0, 1); + for x in -roots..=roots { + for z in -roots..=roots { + let mut p = offset(origin, [x, -1, z]); + let mut remaining = 50; + if x.abs() == 1 && z.abs() == 1 { + remaining = random.next_int_bound(5).map_err(SpikeError::Random)?; + } + while p[1] > 50 { + spend(&mut budget)?; + let state = world.block(p).map_err(SpikeError::World)?; + if !self.air.contains(&state) + && !self.can_replace.test(world, p).map_err(SpikeError::Query)? + && state != self.state + { + break; + } + world + .set_block(p, self.state, 3) + .map_err(SpikeError::World)?; + p[1] = p[1].wrapping_sub(1); + remaining -= 1; + if remaining <= 0 { + p[1] = p[1].wrapping_sub( + random.next_int_bound(5).map_err(SpikeError::Random)? + 1, + ); + remaining = random.next_int_bound(5).map_err(SpikeError::Random)?; + } + } + } + } + Ok(true) + } + fn place_part( + &self, + world: &mut W, + p: [i32; 3], + ) -> Result<(), SpikeError> { + if self + .air + .contains(&world.block(p).map_err(SpikeError::World)?) + || self.can_replace.test(world, p).map_err(SpikeError::Query)? + { + world + .set_block(p, self.state, 3) + .map_err(SpikeError::World)?; + } + Ok(()) + } +} +fn offset(p: [i32; 3], d: [i32; 3]) -> [i32; 3] { + std::array::from_fn(|i| p[i].wrapping_add(d[i])) +} +fn spend(remaining: &mut usize) -> Result<(), SpikeError> { + if *remaining == 0 { + return Err(SpikeError::WorkLimit); + } + *remaining -= 1; + Ok(()) +} diff --git a/docs/rust-parity.md b/docs/rust-parity.md index 797ab8231..30d0b597b 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -545,3 +545,18 @@ every origin/candidate state through failure-terminated prefixes, full spreading runs, all packed-ice neighbor masks, extreme sea levels, wrapped positions, partial failures and composition. Workspace tests, all-target Clippy and all 149 Python tests pass. Ice gameplay and complete world generation remain pending. + +## Spike geometry and roots + +Spike features now implement descending air search, support predicates, randomized +height and radius, rare elevated spikes, float taper calculations and independent +upper/lower replacement tests. Roots retain the native fixed Y=50 boundary, +corner-specific random lengths, gaps, and exact-state replacement exception. + +The [spike comparison](../benchmarks/rust-spike-2026-10-06/scoped-parity.json) +matches **8,859,761 lines per reference JAR** over **113,127 fixtures**. Every +output/origin/candidate state is covered by failure-terminated prefixes; complete +runs include 1,024 seeds per RNG, replacement and support predicates, repeated +mutations, rejected writes, partial failures and composition. Workspace tests +and all-target Clippy pass. Complete world generation and block updates remain +pending. Pathological descent/root work is bounded to 2^20 visits. diff --git a/tools/test_spike_parity.py b/tools/test_spike_parity.py new file mode 100644 index 000000000..75c2fc996 --- /dev/null +++ b/tools/test_spike_parity.py @@ -0,0 +1,86 @@ +#!/usr/bin/env python3 +"""Compare tapered spikes, rare tall forms and discontinuous roots.""" +import itertools +import json +try: + from . import test_simple_block_parity as harness +except ImportError: + import test_simple_block_parity as harness + + +def corpus(facts, placement): + states = facts['states'] + get = lambda name: facts['defaults']['minecraft:' + name] + + def spike(**extra): + value = {'type': 'spike', 'state': {'id': 'packed_ice'}, + 'can_place_on': {'type': 'matching_blocks', 'blocks': 'snow_block'}, + 'can_replace': {'type': 'matching_blocks', 'blocks': ['snow_block', 'ice']}} + value.update(extra) + return value + + def case(definition=None, **extra): + origin = extra.pop('origin', [0, 70, 0]) + value = {'definition': json.dumps(definition if definition is not None else spike(), separators=(',', ':')), + 'mode': 'feature', 'origin': origin, 'legacy': False, 'seed': 0, 'world_seed': 1, + 'fail': -1, 'reject': 0, 'brightness': 15, 'fallback': get('air'), + 'states': [[*origin, get('snow_block')]], 'repeats': 1} + value.update(extra) + return value + + for state in states: + yield case(spike(state=state), fail=20) + for state in range(len(states)): + yield case(origin=[0, -62, 0], states=[[0, -62, 0, state]], fail=20) + yield case(fallback=state, fail=30) + # Full runs include the rare elevated branch and both random algorithms. + for legacy, seed in itertools.product([False, True], range(1024)): + yield case(legacy=legacy, seed=seed) + predicates = [ + {'type': 'true'}, {'type': 'not', 'predicate': {'type': 'true'}}, + {'type': 'matching_blocks', 'blocks': '#minecraft:logs'}, + {'type': 'has_sturdy_face', 'direction': 'up'}, + {'type': 'would_survive', 'state': 'short_grass'}, {'type': 'solid'}, + ] + for predicate, legacy, seed, fail, reject in itertools.product( + predicates, [False, True], range(8), [-1, 0, 1, 9, 31, 200], [0, 1, 3]): + yield case(spike(can_replace=predicate), legacy=legacy, seed=seed, fail=fail, reject=reject, + fallback=get('oak_log'), repeats=2) + yield case(spike(can_place_on=predicate), legacy=legacy, seed=seed, fail=fail, reject=reject, + fallback=get('stone'), repeats=2) + for name, legacy, seed in itertools.product( + ['air', 'cave_air', 'void_air', 'snow_block', 'ice', 'packed_ice', 'blue_ice', 'stone', 'water'], + [False, True], range(16)): + yield case(fallback=get(name), legacy=legacy, seed=seed, repeats=2) + # Distinguish block identity from exact state identity in the root exception. + for state, legacy in itertools.product( + [{'id': 'oak_log', 'properties': {'axis': 'x'}}, {'id': 'oak_log'}, {'id': 'air'}], [False, True]): + yield case(spike(state=state, can_replace={'type': 'not', 'predicate': {'type': 'true'}}), + fallback=get('oak_log'), legacy=legacy) + for y, depth, legacy in itertools.product([-64, -62, -61, 49, 50, 51, 52, 64, 150, 319], range(5), [False, True]): + initial = [[0, y - d, 0, get('air')] for d in range(depth)] + initial.append([0, y - depth, 0, get('snow_block')]) + yield case(origin=[0, y, 0], states=initial, legacy=legacy) + for origin, legacy in itertools.product( + [[2147483647, 70, 2147483647], [-2147483648, 70, -2147483648], + [0, -2147483648, 0], [0, 2147483647, 0]], [False, True]): + yield case(origin=origin, legacy=legacy, fail=200) + for key, values in [ + ('state', [None, False, {}, [], 'missing', {'id': 'missing'}, {'id': 'oak_log', 'properties': {'axis': 'invalid'}}]), + ('can_place_on', [None, False, {}, [], {'type': 'missing'}]), + ('can_replace', [None, False, {}, [], {'type': 'missing'}])]: + for value in values: + definition = spike(); definition[key] = value + yield case(definition) + definition = spike(); del definition[key] + yield case(definition) + for legacy, fail, reject in itertools.product([False, True], [-1, 0, 9, 101], [0, 3]): + placed = {'feature': spike(), 'placement': [{'type': 'count', 'count': 2}]} + yield case(placed, mode='placed', legacy=legacy, fail=fail, reject=reject, repeats=2) + yield case({'type': 'overlay', 'features': [placed, {'feature': 'horizon:moss', 'placement': []}]}, + legacy=legacy, fail=fail, reject=reject) + + +if __name__ == '__main__': + harness.run(corpus, 'rust-spike-parity', __file__, + 'Native SpikeFeature required state/predicate codecs, air descent, support gating, height/radius draws, rare tall spikes, float taper and edge draws, independently tested mirrored layers, and discontinuous roots with a fixed Y=50 floor. Every configured output, origin and candidate state is compared through failure-terminated prefixes. Full runs cover 1024 seeds per RNG, replacement/support predicates, exact-state root exceptions, rejected writes, repeated mutations, query failures, wrapped positions and placement/overlay composition. Rust limits pathological descent/root work to 2^20 visits. World update execution and complete generation remain pending.') From f5a6904494ecf010d0e0179cd24b756d59ea5432 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 13:09:24 +0200 Subject: [PATCH 021/253] Implement End podium construction and destruction requests --- .github/workflows/ci.yml | 4 + .../scoped-parity.json | 212 ++++++++++++++++++ .../examples/simple_block_fixture.rs | 20 ++ crates/horizon-world/src/worldgen.rs | 1 + .../horizon-world/src/worldgen/end_podium.rs | 174 ++++++++++++++ .../src/worldgen/feature_graph.rs | 11 + .../src/worldgen/placement/context.rs | 10 + docs/rust-parity.md | 17 ++ .../parity/VanillaSimpleBlockOracle.java | 5 + tools/test_end_podium_parity.py | 41 ++++ 10 files changed, 495 insertions(+) create mode 100644 benchmarks/rust-end-podium-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-world/src/worldgen/end_podium.rs create mode 100644 tools/test_end_podium_parity.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1a6a0af9e..2bd5383e5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -143,6 +143,10 @@ jobs: env: RUSTUP_TOOLCHAIN: stable run: python tools/test_spike_parity.py + - name: Compare End podium construction and destruction requests + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_end_podium_parity.py - name: Compare ordered single-block replacement features env: RUSTUP_TOOLCHAIN: stable diff --git a/benchmarks/rust-end-podium-2026-10-06/scoped-parity.json b/benchmarks/rust-end-podium-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..d1fe43b06 --- /dev/null +++ b/benchmarks/rust-end-podium-2026-10-06/scoped-parity.json @@ -0,0 +1,212 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 38207, + "candidate_states": 35723, + "double_plant_blocks": 10, + "mossy_carpet_blocks": 1, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java": "1d4616f80e625ad1266aaa94d7c72770944d838cc06a085d6726e1ee812133cb", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSurvivalOracle.java": "4e7cc151617c1b02e872f9ca3e9fe4632379f225f4f07718ff6492df4ee551e7", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java": "e871d3a01f15616a98ca9227c27a81e4d17e2d57ac4e68a5650a70fa29811497", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSupportOracle.java": "04350901a2d708fb8fa672de61d058f73f332d2e90df1b93a67781862f89c1ad", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "60ff9ef7c1d5e23c080f9aec95ab2e7d3b7c5b5bcd67b9efa9518776c400629a", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_simple_block_parity.py": "50b783323051fe8cd369bb733448b0314f1e6e7994a950e4cb6cd2fe4f7f8e11", + "tools/test_end_podium_parity.py": "41e4a9b6f671c91bafa66141df82aede8cb19932b90d2833c8dd1194f8e53f2c", + "tools/test_block_survival_parity.py": "9e8dff3bd4b95dbfd29f8adc6a2f6d66abf19a6b1cd91423b794a345d4ec244a", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "a8cd85f6223668c1446ff103276d80937b9707d9a7dc619a176b1b1ceed36a4a", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "1eae82604d2b3377fd35aaa3a914a67e5af28f93923815a49e895b4d437433cd", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "5ce5c6eaa5f8a2557a620e533788217b1eb430654801dcf6135d6c92d7a012ac", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "9911f293fe752178972737b745db27389ac05834e3f39b018e00d53c2bd0bb20", + "crates/horizon-world/src/worldgen/feature_region.rs": "79e8ce343b0dc80dceb8b214c818b383d9b110540bb8c3b0ac32863a7800e288", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "e682d13a21f90605215b79f5d254bf2e524d35e89eab2e3b46384709af80b847", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "dc3f07719dac53c5ceab6635598c010ccc93db0b149970894407bf9b713946e7", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "18eaf31bd62bb4ecb29539e274dff6fc15cccf19d27032b80bc019ce3de179fb", + "crates/horizon-world/examples/simple_block_fixture.rs": "517b0fb43755555e276b2cdb976cf0b7ae1adc6499bce84f3c9c7f51a0456949" + }, + "fixtures_sha256": { + ".local/rust-end-podium-parity/inputs.txt": "e8b36b1b28d3a7df6a8ccea01f55ceb0c3bbdd87ad02bf91eecb0cb70c09eaaa", + ".local/rust-end-podium-parity/block-properties.nbt": "1aba22092f70d16b8092014c058ddc210e4aaa77bac32f6ec62e4d0e91d92a99", + ".local/rust-end-podium-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-end-podium-parity/cached-collision.nbt": "f3a5c6a5b2d51dad6c52e486e2b9989e79fd55db1a9bda6196db399550b04078", + ".local/rust-end-podium-parity/cached-support.nbt": "b6fdc9471b0b61e904206d3f099f4dc235aad6d723536c210be0cb7c3560d82c", + ".local/rust-end-podium-parity/catalog.json": "93581107e3564e60261044fdca61e3b7f237b9e6724c14b86e335ccc01198ba9", + ".local/rust-end-podium-parity/facts.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-end-podium-parity/feature-catalog.json": "c048c761c5084a40560731955cc999a364d14055bdd86fa50989a92e4a771286", + ".local/rust-end-podium-parity/fluid-tags.json": "f1e5eb6d22ea7effbb118a2282709cfdeef1bfae4516b775a55ad7a4df29d7d0", + ".local/rust-end-podium-parity/placement-definitions.json": "f8a972ec87c2352500af6481158a3192bdbf699951025639bea744e4127b97c4", + ".local/rust-end-podium-parity/support-cached-states.json": "353945a58fe69b352925473f1693f9b14a9ad19f13c15159c4184f2c29258622", + ".local/rust-end-podium-parity/survival-classes.json": "361832008eea0aa9151d367a125a19c6353d99a0b88b27dd0682f55b7954553e", + ".local/rust-end-podium-parity/survival-extra-definitions.json": "170f2db5bc97a49fa25cc249540aa7f04beea455cdbaf43742ed9415f5090a02", + ".local/rust-end-podium-parity/survival-placement-classes.json": "7fdbf48ab18c87098bbe1b6176cb81f4842b6c5d9a4d6bbaf7037ff61cb1848c", + ".local/rust-end-podium-parity/survival-rules.json": "8805c18b3195bb1eac1f1e5281333df56e2892505f64023e5403c58ce2ec4368", + ".local/rust-end-podium-parity/survival-support-tags.json": "15d88d5bb5ad10d65124d5abb2cc055d251b06d129bca7be06f55b43dc13f6fd", + ".local/rust-end-podium-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0" + }, + "rust_output_sha256": "a050dffc6e0a901bf5e12df66e318ba82e5b0f5fa1ab634c4b2f71632961565a", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "a050dffc6e0a901bf5e12df66e318ba82e5b0f5fa1ab634c4b2f71632961565a", + "matched_output_lines": 3309219 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "a050dffc6e0a901bf5e12df66e318ba82e5b0f5fa1ab634c4b2f71632961565a", + "matched_output_lines": 3309219 + } + ], + "scope": "Native EndPodiumFeature optional active codec, inclusive box order and distance cutoffs, bedrock/end-stone/air/portal selection, central pillar and north/east/south/west wall torches. All states pass active replacement prefixes; complete representative runs cover both modes, repeated mutation, exact block identity, partial failures, rejected writes and composition. Destruction is a controlled world request with independently selected success and synthetic air replacement; drops, block entities, updates and dragon/portal gameplay are not simulated. Rust bounds pathological overflow-box work to 2^20 visits; nonoverflow extreme coordinates are tested." +} diff --git a/crates/horizon-world/examples/simple_block_fixture.rs b/crates/horizon-world/examples/simple_block_fixture.rs index ee9d8aea9..c48c3669d 100644 --- a/crates/horizon-world/examples/simple_block_fixture.rs +++ b/crates/horizon-world/examples/simple_block_fixture.rs @@ -50,6 +50,8 @@ struct World<'a, 'r, W, R> { reject: i32, brightness: i32, sea_level: i32, + air: BlockStateId, + destroy_success: bool, } impl World<'_, '_, W, R> { fn event(&mut self, text: std::fmt::Arguments<'_>) -> io::Result { @@ -135,6 +137,19 @@ fn query(error: impl std::fmt::Display) -> PlacementQueryError { PlacementQueryError::Failed(error.to_string()) } impl PlacementContext for World<'_, '_, W, R> { + fn destroy_block_without_entity( + &mut self, + p: [i32; 3], + drops: bool, + ) -> Result { + self.event(format_args!("destroy {} {} {} {drops}", p[0], p[1], p[2])) + .map_err(query)?; + if self.destroy_success { + self.states.insert(p, self.air); + } + writeln!(self.out, "destroyed {}", self.destroy_success).map_err(query)?; + Ok(self.destroy_success) + } fn sea_level(&mut self) -> Result { Ok(self.sea_level) } @@ -293,6 +308,11 @@ fn fixture( reject: f["reject"].as_i64().unwrap() as i32, brightness: f["brightness"].as_i64().unwrap() as i32, sea_level: f.get("sea").and_then(Value::as_i64).unwrap_or(63) as i32, + air: blocks.air, + destroy_success: f + .get("destroy_success") + .and_then(Value::as_bool) + .unwrap_or(true), }; match feature { Err(_) => writeln!(world.out, "decode error")?, diff --git a/crates/horizon-world/src/worldgen.rs b/crates/horizon-world/src/worldgen.rs index b493ce262..5abe2d48e 100644 --- a/crates/horizon-world/src/worldgen.rs +++ b/crates/horizon-world/src/worldgen.rs @@ -20,6 +20,7 @@ pub mod climate; pub mod decoration; pub mod density; pub mod disk; +pub mod end_podium; pub mod feature; pub mod feature_catalog; pub mod feature_graph; diff --git a/crates/horizon-world/src/worldgen/end_podium.rs b/crates/horizon-world/src/worldgen/end_podium.rs new file mode 100644 index 000000000..3fafc591c --- /dev/null +++ b/crates/horizon-world/src/worldgen/end_podium.rs @@ -0,0 +1,174 @@ +//! End exit podium construction and active-portal replacement requests. +use super::{ + DecodeError, Object, + block_feature::FeatureBlockBindings, + feature::FeatureWorld, + optional, + placement::{PlacementContext, PlacementQueryError}, +}; +use crate::registry::BlockStateId; +use std::{collections::BTreeSet, sync::Arc}; +#[derive(Clone, Debug)] +pub struct EndPodiumFeature { + active: bool, + bedrock: BlockStateId, + air: BlockStateId, + end_stone: BlockStateId, + portal: BlockStateId, + torches: [BlockStateId; 4], + same_blocks: [Arc>; 3], +} +#[derive(Debug)] +pub enum EndPodiumError { + World(E), + Query(PlacementQueryError), + WorkLimit, +} +impl std::fmt::Display for EndPodiumError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::World(e) => e.fmt(f), + Self::Query(e) => e.fmt(f), + Self::WorkLimit => f.write_str("end podium work limit exceeded"), + } + } +} +impl std::error::Error for EndPodiumError {} +impl EndPodiumFeature { + pub fn from_json(json: &str, bindings: &FeatureBlockBindings<'_>) -> Result { + let object: Object = serde_json::from_str(json)?; + let active = optional(&object, "active") + .map(|v| serde_json::from_str(v.get())) + .transpose()? + .unwrap_or(false); + let get = |name| { + bindings + .registry() + .default_state(name) + .ok_or_else(|| DecodeError::Registry(format!("unknown podium block {name}"))) + }; + let torches = ["north", "east", "south", "west"].map(|direction| { + bindings + .codec + .decode( + &format!(r#"{{"id":"wall_torch","properties":{{"facing":"{direction}"}}}}"#), + false, + ) + .map_err(|e| DecodeError::Registry(e.to_string())) + }); + let [north, east, south, west] = torches; + let same_blocks = [ + "minecraft:end_stone", + "minecraft:air", + "minecraft:end_portal", + ] + .map(|name| { + bindings + .blocks + .get(name) + .cloned() + .ok_or_else(|| DecodeError::Registry(format!("unknown podium block {name}"))) + }); + let [end_stone, air, portal] = same_blocks; + Ok(Self { + active, + bedrock: get("minecraft:bedrock")?, + air: get("minecraft:air")?, + end_stone: get("minecraft:end_stone")?, + portal: get("minecraft:end_portal")?, + torches: [north?, east?, south?, west?], + same_blocks: [end_stone?, air?, portal?], + }) + } + pub fn place( + &self, + world: &mut W, + origin: [i32; 3], + ) -> Result> { + let a = offset(origin, [-4, -1, -4]); + let b = offset(origin, [4, 32, 4]); + let min: [i32; 3] = std::array::from_fn(|i| a[i].min(b[i])); + let sizes: [i32; 3] = + std::array::from_fn(|i| a[i].max(b[i]).wrapping_sub(min[i]).wrapping_add(1)); + let count = sizes[0].wrapping_mul(sizes[1]).wrapping_mul(sizes[2]); + let mut index: i32 = 0; + let mut remaining = 1_048_576; + while index != count { + if remaining == 0 { + return Err(EndPodiumError::WorkLimit); + } + remaining -= 1; + let quotient = index / sizes[0]; + let p = [ + min[0].wrapping_add(index % sizes[0]), + min[1].wrapping_add(quotient % sizes[1]), + min[2].wrapping_add(quotient / sizes[1]), + ]; + index = index.wrapping_add(1); + let d: [f64; 3] = std::array::from_fn(|i| f64::from(p[i]) - f64::from(origin[i])); + let distance = d[0] * d[0] + d[1] * d[1] + d[2] * d[2]; + let inner = distance < 2.5 * 2.5; + if !inner && distance >= 3.5 * 3.5 { + continue; + } + if p[1] < origin[1] { + if inner { + world + .set_block(p, self.bedrock, 3) + .map_err(EndPodiumError::World)?; + } else { + self.replace(world, p, self.end_stone, 0)?; + } + } else if p[1] > origin[1] { + self.replace(world, p, self.air, 1)?; + } else if !inner { + world + .set_block(p, self.bedrock, 3) + .map_err(EndPodiumError::World)?; + } else if self.active { + self.replace(world, p, self.portal, 2)?; + } else { + world + .set_block(p, self.air, 3) + .map_err(EndPodiumError::World)?; + } + } + for y in 0..4 { + world + .set_block(offset(origin, [0, y, 0]), self.bedrock, 3) + .map_err(EndPodiumError::World)?; + } + for (delta, state) in [[0, 2, -1], [1, 2, 0], [0, 2, 1], [-1, 2, 0]] + .into_iter() + .zip(self.torches) + { + world + .set_block(offset(origin, delta), state, 3) + .map_err(EndPodiumError::World)?; + } + Ok(true) + } + fn replace( + &self, + world: &mut W, + p: [i32; 3], + state: BlockStateId, + kind: usize, + ) -> Result<(), EndPodiumError> { + if self.active { + if self.same_blocks[kind].contains(&world.block(p).map_err(EndPodiumError::World)?) { + return Ok(()); + } + world + .destroy_block_without_entity(p, true) + .map_err(EndPodiumError::Query)?; + } + world + .set_block(p, state, 3) + .map_err(EndPodiumError::World)?; + Ok(()) + } +} +fn offset(p: [i32; 3], d: [i32; 3]) -> [i32; 3] { + std::array::from_fn(|i| p[i].wrapping_add(d[i])) +} diff --git a/crates/horizon-world/src/worldgen/feature_graph.rs b/crates/horizon-world/src/worldgen/feature_graph.rs index 1d8ef60ec..da3851d02 100644 --- a/crates/horizon-world/src/worldgen/feature_graph.rs +++ b/crates/horizon-world/src/worldgen/feature_graph.rs @@ -49,6 +49,7 @@ pub enum FeatureDefinition { Disk(super::disk::DiskFeature), Spring(super::spring::SpringFeature), Vines(super::vines::VinesFeature), + EndPodium(super::end_podium::EndPodiumFeature), Spike(super::spike::SpikeFeature), BlueIce(super::blue_ice::BlueIceFeature), UnderwaterMagma(super::underwater_magma::UnderwaterMagmaFeature), @@ -76,6 +77,7 @@ pub enum FeatureExecutionError { BlockPile(super::block_pile::BlockPileError), Disk(super::disk::DiskError), BlockBlob(super::block_blob::BlockBlobError), + EndPodium(super::end_podium::EndPodiumError), Spike(super::spike::SpikeError), BlueIce(super::blue_ice::BlueIceError), UnderwaterMagma(super::underwater_magma::UnderwaterMagmaError), @@ -94,6 +96,7 @@ impl std::fmt::Display for FeatureExecutionError { Self::BlockPile(e) => e.fmt(f), Self::Disk(e) => e.fmt(f), Self::BlockBlob(e) => e.fmt(f), + Self::EndPodium(e) => e.fmt(f), Self::Spike(e) => e.fmt(f), Self::BlueIce(e) => e.fmt(f), Self::UnderwaterMagma(e) => e.fmt(f), @@ -263,6 +266,11 @@ impl FeatureDefinition { )?)?; match kind.as_str() { "minecraft:no_op" => Ok(Self::NoOp), + "minecraft:end_podium" => super::end_podium::EndPodiumFeature::from_json( + json, + blocks.ok_or(DecodeError::Field("end podium bindings"))?, + ) + .map(Self::EndPodium), "minecraft:spike" => super::spike::SpikeFeature::decode( json, blocks.ok_or(DecodeError::Field("spike bindings"))?, @@ -609,6 +617,9 @@ impl FeatureDefinition { .place(world, random, origin, run.blocks) .map_err(FeatureExecutionError::Basic), Self::NoOp => Ok(true), + Self::EndPodium(feature) => feature + .place(world, origin) + .map_err(FeatureExecutionError::EndPodium), Self::Spike(feature) => feature .place(world, random, origin) .map_err(FeatureExecutionError::Spike), diff --git a/crates/horizon-world/src/worldgen/placement/context.rs b/crates/horizon-world/src/worldgen/placement/context.rs index 378fb8692..6c3c02ac4 100644 --- a/crates/horizon-world/src/worldgen/placement/context.rs +++ b/crates/horizon-world/src/worldgen/placement/context.rs @@ -26,6 +26,16 @@ pub enum LayerBlock { Ground, } pub trait PlacementContext { + /// Request destruction with no responsible entity. The world adapter owns + /// replacement, drops, block entities and updates; false is a rejected request. + fn destroy_block_without_entity( + &mut self, + _position: [i32; 3], + _drop_resources: bool, + ) -> Result { + Err(PlacementQueryError::Unavailable) + } + /// World sea level, independently of the generator's placement context. fn sea_level(&mut self) -> Result { Err(PlacementQueryError::Unavailable) diff --git a/docs/rust-parity.md b/docs/rust-parity.md index 30d0b597b..e0d839c51 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -560,3 +560,20 @@ runs include 1,024 seeds per RNG, replacement and support predicates, repeated mutations, rejected writes, partial failures and composition. Workspace tests and all-target Clippy pass. Complete world generation and block updates remain pending. Pathological descent/root work is bounded to 2^20 visits. + +## End exit podium construction + +End podium features reproduce active/inactive construction, the native distance +cutoffs and box traversal, central bedrock pillar and ordered wall-torch facing. +Active replacement reads block identity, requests destruction with drops and no +responsible entity, then writes the replacement even if destruction was rejected. +Matching blocks skip both requests. + +The [End podium comparison](../benchmarks/rust-end-podium-2026-10-06/scoped-parity.json) +matches **3,309,219 lines per reference JAR** over **38,207 fixtures**. All states +reach active replacement prefixes; full runs cover representative blocks, repeated +construction, rejected destruction/writes, partial failures, composition and +nonoverflow extreme coordinates. Workspace tests, all-target Clippy and all +149 Python tests pass. The fixture controls destruction success and air +replacement; loot, block entities, updates, portal travel and dragon gameplay +remain pending. Pathological overflow-box work is bounded to 2^20 visits. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java index a620cffc9..616663224 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java @@ -68,6 +68,11 @@ public final class VanillaSimpleBlockOracle { if(name.equals("getFluidState")){var p=(BlockPos)args[0];event("fluid "+xyz(p));return (f.has("fluid")?Block.stateById(f.get("fluid").getAsInt()):at(p)).getFluidState();} if(name.equals("getRawBrightness")){var p=(BlockPos)args[0];event("light "+xyz(p)+" "+args[1]);return f.get("brightness").getAsInt();} if(name.equals("getBlockEntity")){event("entity "+xyz((BlockPos)args[0]));return null;} + if(name.equals("destroyBlock")){ + if(args.length!=3||args[2]!=null)throw new UnsupportedOperationException("only no-entity destruction is defined in this fixture"); + var p=((BlockPos)args[0]).immutable();event("destroy "+xyz(p)+" "+args[1]);boolean result=!f.has("destroy_success")||f.get("destroy_success").getAsBoolean(); + if(result)states.put(p,Blocks.AIR.defaultBlockState());out.println("destroyed "+result);return result; + } if(name.equals("setBlock")){ var p=((BlockPos)args[0]).immutable();var state=(BlockState)args[1];int call=calls;event("set "+xyz(p)+" "+Block.getId(state)+" "+args[2]); int reject=f.get("reject").getAsInt();boolean result=reject==0||call%reject!=0;if(result)states.put(p,state);out.println("written "+result);return result; diff --git a/tools/test_end_podium_parity.py b/tools/test_end_podium_parity.py new file mode 100644 index 000000000..eaa7ecd7b --- /dev/null +++ b/tools/test_end_podium_parity.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python3 +"""Compare End podium geometry, active replacements and ordered world effects.""" +import itertools +import json +try: + from . import test_simple_block_parity as harness +except ImportError: + import test_simple_block_parity as harness + + +def corpus(facts, placement): + states = facts['states']; get = lambda name: facts['defaults']['minecraft:' + name] + def case(definition=None, **extra): + value = {'definition': json.dumps(definition if definition is not None else {'type': 'end_podium', 'active': True}), + 'mode': 'feature', 'origin': [0, 64, 0], 'legacy': False, 'seed': 0, 'world_seed': 1, + 'fail': -1, 'reject': 0, 'brightness': 15, 'fallback': get('stone'), 'states': [], 'repeats': 1} + value.update(extra); return value + # Every state's block identity reaches native active replacement checks. + for state in range(len(states)): + yield case(fallback=state, fail=25) + for active, name, legacy, fail, reject, destroy in itertools.product( + [False, True], ['air', 'cave_air', 'void_air', 'stone', 'bedrock', 'end_stone', 'end_portal', 'wall_torch', 'water', 'chest'], + [False, True], [-1, 0, 1, 2, 5, 19, 47, 89, 137, 200], [0, 1, 3], [False, True]): + yield case({'type': 'end_podium', 'active': active}, fallback=get(name), legacy=legacy, fail=fail, reject=reject, + destroy_success=destroy, repeats=2) + for active, origin in itertools.product([False, True], + [[0, -64, 0], [-17, 319, -33], [2147483600, 100, -2147483600], [-2147483600, -2147483600, 2147483600]]): + yield case({'type': 'end_podium', 'active': active}, origin=origin, repeats=2) + for value in [None, False, True, 0, 1, -1, 0.5, 'true', 'false', [], {}]: + yield case({'type': 'end_podium', 'active': value}) + yield case({'type': 'end_podium'}) + for legacy, fail, reject, destroy in itertools.product([False, True], [-1, 0, 9, 101], [0, 3], [False, True]): + placed = {'feature': {'type': 'end_podium', 'active': True}, 'placement': [{'type': 'count', 'count': 2}]} + yield case(placed, mode='placed', legacy=legacy, fail=fail, reject=reject, destroy_success=destroy) + yield case({'type': 'overlay', 'features': [placed, {'feature': {'type': 'end_podium'}, 'placement': []}]}, + legacy=legacy, fail=fail, reject=reject, destroy_success=destroy) + + +if __name__ == '__main__': + harness.run(corpus, 'rust-end-podium-parity', __file__, + 'Native EndPodiumFeature optional active codec, inclusive box order and distance cutoffs, bedrock/end-stone/air/portal selection, central pillar and north/east/south/west wall torches. All states pass active replacement prefixes; complete representative runs cover both modes, repeated mutation, exact block identity, partial failures, rejected writes and composition. Destruction is a controlled world request with independently selected success and synthetic air replacement; drops, block entities, updates and dragon/portal gameplay are not simulated. Rust bounds pathological overflow-box work to 2^20 visits; nonoverflow extreme coordinates are tested.') From 4cc0eaf6da6421ce1da344b9f699eef594bf9182 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 13:13:46 +0200 Subject: [PATCH 022/253] Implement replacement blobs with native Manhattan traversal --- .github/workflows/ci.yml | 4 + .../scoped-parity.json | 213 ++++++++++++++++++ crates/horizon-world/src/worldgen.rs | 1 + .../src/worldgen/feature_graph.rs | 15 ++ .../src/worldgen/replace_blobs.rs | 170 ++++++++++++++ docs/rust-parity.md | 15 ++ tools/test_replace_blobs_parity.py | 63 ++++++ 7 files changed, 481 insertions(+) create mode 100644 benchmarks/rust-replace-blobs-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-world/src/worldgen/replace_blobs.rs create mode 100644 tools/test_replace_blobs_parity.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2bd5383e5..3bb1a8782 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -147,6 +147,10 @@ jobs: env: RUSTUP_TOOLCHAIN: stable run: python tools/test_end_podium_parity.py + - name: Compare replacement blob search and Manhattan shells + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_replace_blobs_parity.py - name: Compare ordered single-block replacement features env: RUSTUP_TOOLCHAIN: stable diff --git a/benchmarks/rust-replace-blobs-2026-10-06/scoped-parity.json b/benchmarks/rust-replace-blobs-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..1a1520072 --- /dev/null +++ b/benchmarks/rust-replace-blobs-2026-10-06/scoped-parity.json @@ -0,0 +1,213 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 109003, + "candidate_states": 35723, + "double_plant_blocks": 10, + "mossy_carpet_blocks": 1, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java": "1d4616f80e625ad1266aaa94d7c72770944d838cc06a085d6726e1ee812133cb", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSurvivalOracle.java": "4e7cc151617c1b02e872f9ca3e9fe4632379f225f4f07718ff6492df4ee551e7", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java": "e871d3a01f15616a98ca9227c27a81e4d17e2d57ac4e68a5650a70fa29811497", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSupportOracle.java": "04350901a2d708fb8fa672de61d058f73f332d2e90df1b93a67781862f89c1ad", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "60ff9ef7c1d5e23c080f9aec95ab2e7d3b7c5b5bcd67b9efa9518776c400629a", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_simple_block_parity.py": "50b783323051fe8cd369bb733448b0314f1e6e7994a950e4cb6cd2fe4f7f8e11", + "tools/test_replace_blobs_parity.py": "c91498d8cd779a77c00e90d9823f31b6a8c2d238193945554478b6494b003928", + "tools/test_block_survival_parity.py": "9e8dff3bd4b95dbfd29f8adc6a2f6d66abf19a6b1cd91423b794a345d4ec244a", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "a8cd85f6223668c1446ff103276d80937b9707d9a7dc619a176b1b1ceed36a4a", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "1eae82604d2b3377fd35aaa3a914a67e5af28f93923815a49e895b4d437433cd", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "5ce5c6eaa5f8a2557a620e533788217b1eb430654801dcf6135d6c92d7a012ac", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "df9b813552cb39d4eb2480be3828d9909d5aeb50425d81012b3a29624ec88060", + "crates/horizon-world/src/worldgen/feature_region.rs": "79e8ce343b0dc80dceb8b214c818b383d9b110540bb8c3b0ac32863a7800e288", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "e682d13a21f90605215b79f5d254bf2e524d35e89eab2e3b46384709af80b847", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "dc3f07719dac53c5ceab6635598c010ccc93db0b149970894407bf9b713946e7", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "5afb4a779143b571ba696f027b981c05f4bbd4646639c5616b0ecadf23d9f968", + "crates/horizon-world/examples/simple_block_fixture.rs": "517b0fb43755555e276b2cdb976cf0b7ae1adc6499bce84f3c9c7f51a0456949" + }, + "fixtures_sha256": { + ".local/rust-replace-blobs-parity/inputs.txt": "fcc765b831f7619cdcae2135e788d189d7aa5d018a0fec8028a32ac126b43c46", + ".local/rust-replace-blobs-parity/block-properties.nbt": "1aba22092f70d16b8092014c058ddc210e4aaa77bac32f6ec62e4d0e91d92a99", + ".local/rust-replace-blobs-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-replace-blobs-parity/cached-collision.nbt": "f3a5c6a5b2d51dad6c52e486e2b9989e79fd55db1a9bda6196db399550b04078", + ".local/rust-replace-blobs-parity/cached-support.nbt": "b6fdc9471b0b61e904206d3f099f4dc235aad6d723536c210be0cb7c3560d82c", + ".local/rust-replace-blobs-parity/catalog.json": "93581107e3564e60261044fdca61e3b7f237b9e6724c14b86e335ccc01198ba9", + ".local/rust-replace-blobs-parity/facts.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-replace-blobs-parity/feature-catalog.json": "c048c761c5084a40560731955cc999a364d14055bdd86fa50989a92e4a771286", + ".local/rust-replace-blobs-parity/fluid-tags.json": "f1e5eb6d22ea7effbb118a2282709cfdeef1bfae4516b775a55ad7a4df29d7d0", + ".local/rust-replace-blobs-parity/placement-definitions.json": "f8a972ec87c2352500af6481158a3192bdbf699951025639bea744e4127b97c4", + ".local/rust-replace-blobs-parity/support-cached-states.json": "353945a58fe69b352925473f1693f9b14a9ad19f13c15159c4184f2c29258622", + ".local/rust-replace-blobs-parity/survival-classes.json": "361832008eea0aa9151d367a125a19c6353d99a0b88b27dd0682f55b7954553e", + ".local/rust-replace-blobs-parity/survival-extra-definitions.json": "170f2db5bc97a49fa25cc249540aa7f04beea455cdbaf43742ed9415f5090a02", + ".local/rust-replace-blobs-parity/survival-placement-classes.json": "7fdbf48ab18c87098bbe1b6176cb81f4842b6c5d9a4d6bbaf7037ff61cb1848c", + ".local/rust-replace-blobs-parity/survival-rules.json": "8805c18b3195bb1eac1f1e5281333df56e2892505f64023e5403c58ce2ec4368", + ".local/rust-replace-blobs-parity/survival-support-tags.json": "15d88d5bb5ad10d65124d5abb2cc055d251b06d129bca7be06f55b43dc13f6fd", + ".local/rust-replace-blobs-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0" + }, + "rust_output_sha256": "e386dd4e54b54132bc4023673056b1deb8172d00ee3e15b8af6384311bd011b6", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "e386dd4e54b54132bc4023673056b1deb8172d00ee3e15b8af6384311bd011b6", + "matched_output_lines": 5538034 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "e386dd4e54b54132bc4023673056b1deb8172d00ee3e15b8af6384311bd011b6", + "matched_output_lines": 5538034 + } + ], + "scope": "Native ReplaceBlobsFeature under its netherrack_replace_blobs registry key: target block identity, required replacement state and radius provider bounded 0..12, build-height clamp, descending target search, three radius draws, clipped Manhattan shells in native depth/X/Y/positive-Z/mirrored-Z order, flags 3 and success after rejected writes. Every configured target and output state has a radius-zero run; all candidate states have failure-terminated prefixes. Full radius/provider runs cover both RNGs, boundaries, wrapped X/Z, repeated mutations, query failures and composition. Pathological descent is bounded to 2^20 visits. World updates and full generation remain pending." +} diff --git a/crates/horizon-world/src/worldgen.rs b/crates/horizon-world/src/worldgen.rs index 5abe2d48e..1e8467e7c 100644 --- a/crates/horizon-world/src/worldgen.rs +++ b/crates/horizon-world/src/worldgen.rs @@ -34,6 +34,7 @@ pub mod material_stage; pub mod material_surface; pub mod ore_feature; pub mod placement; +pub mod replace_blobs; pub mod router; pub mod rule_test; pub mod settings; diff --git a/crates/horizon-world/src/worldgen/feature_graph.rs b/crates/horizon-world/src/worldgen/feature_graph.rs index da3851d02..9a00f04ad 100644 --- a/crates/horizon-world/src/worldgen/feature_graph.rs +++ b/crates/horizon-world/src/worldgen/feature_graph.rs @@ -49,6 +49,7 @@ pub enum FeatureDefinition { Disk(super::disk::DiskFeature), Spring(super::spring::SpringFeature), Vines(super::vines::VinesFeature), + ReplaceBlobs(super::replace_blobs::ReplaceBlobsFeature), EndPodium(super::end_podium::EndPodiumFeature), Spike(super::spike::SpikeFeature), BlueIce(super::blue_ice::BlueIceFeature), @@ -77,6 +78,7 @@ pub enum FeatureExecutionError { BlockPile(super::block_pile::BlockPileError), Disk(super::disk::DiskError), BlockBlob(super::block_blob::BlockBlobError), + ReplaceBlobs(super::replace_blobs::ReplaceBlobsError), EndPodium(super::end_podium::EndPodiumError), Spike(super::spike::SpikeError), BlueIce(super::blue_ice::BlueIceError), @@ -96,6 +98,7 @@ impl std::fmt::Display for FeatureExecutionError { Self::BlockPile(e) => e.fmt(f), Self::Disk(e) => e.fmt(f), Self::BlockBlob(e) => e.fmt(f), + Self::ReplaceBlobs(e) => e.fmt(f), Self::EndPodium(e) => e.fmt(f), Self::Spike(e) => e.fmt(f), Self::BlueIce(e) => e.fmt(f), @@ -266,6 +269,15 @@ impl FeatureDefinition { )?)?; match kind.as_str() { "minecraft:no_op" => Ok(Self::NoOp), + "minecraft:netherrack_replace_blobs" => { + super::replace_blobs::ReplaceBlobsFeature::decode( + json, + blocks.ok_or(DecodeError::Field("replace blobs bindings"))?, + depth + 1, + remaining, + ) + .map(Self::ReplaceBlobs) + } "minecraft:end_podium" => super::end_podium::EndPodiumFeature::from_json( json, blocks.ok_or(DecodeError::Field("end podium bindings"))?, @@ -617,6 +629,9 @@ impl FeatureDefinition { .place(world, random, origin, run.blocks) .map_err(FeatureExecutionError::Basic), Self::NoOp => Ok(true), + Self::ReplaceBlobs(feature) => feature + .place(world, random, origin) + .map_err(FeatureExecutionError::ReplaceBlobs), Self::EndPodium(feature) => feature .place(world, origin) .map_err(FeatureExecutionError::EndPodium), diff --git a/crates/horizon-world/src/worldgen/replace_blobs.rs b/crates/horizon-world/src/worldgen/replace_blobs.rs new file mode 100644 index 000000000..96fbd9198 --- /dev/null +++ b/crates/horizon-world/src/worldgen/replace_blobs.rs @@ -0,0 +1,170 @@ +//! Block-identity replacement in clipped Manhattan shells around a ground target. +use super::{ + DecodeError, Object, + block_feature::FeatureBlockBindings, + feature::FeatureWorld, + placement::{PlacementContext, PlacementQueryError}, + required, + value_provider::IntProvider, +}; +use crate::registry::BlockStateId; +use horizon_core::random::{InvalidBound, RandomSource}; +use std::{collections::BTreeSet, sync::Arc}; +#[derive(Clone, Debug)] +pub struct ReplaceBlobsFeature { + targets: Arc>, + state: BlockStateId, + radius: IntProvider, +} +#[derive(Debug)] +pub enum ReplaceBlobsError { + World(E), + Query(PlacementQueryError), + Random(InvalidBound), + WorkLimit, +} +impl std::fmt::Display for ReplaceBlobsError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::World(e) => e.fmt(f), + Self::Query(e) => e.fmt(f), + Self::Random(e) => e.fmt(f), + Self::WorkLimit => f.write_str("replace blobs work limit exceeded"), + } + } +} +impl std::error::Error for ReplaceBlobsError {} +impl ReplaceBlobsFeature { + pub fn from_json(json: &str, bindings: &FeatureBlockBindings<'_>) -> Result { + Self::decode(json, bindings, 0, &mut 65536) + } + pub(crate) fn decode( + json: &str, + bindings: &FeatureBlockBindings<'_>, + depth: usize, + remaining: &mut usize, + ) -> Result { + if depth > 128 || *remaining == 0 { + return Err(DecodeError::Field("replace blobs depth or work")); + } + *remaining -= 1; + let object: Object = serde_json::from_str(json)?; + let state = |name| { + required(&object, name).and_then(|v| { + bindings + .codec + .decode(v.get(), false) + .map_err(|e| DecodeError::Registry(e.to_string())) + }) + }; + let target = state("target")?; + let name = &bindings + .registry() + .state(target) + .ok_or(DecodeError::Field("replace blobs target"))? + .name; + let targets = bindings + .blocks + .get(name) + .cloned() + .ok_or(DecodeError::Field("replace blobs target block"))?; + let radius = IntProvider::decode(required(&object, "radius")?, depth + 1, remaining)?; + let [min, max] = radius.bounds(); + if min < 0 || max > 12 { + return Err(DecodeError::Field("replace blobs radius bounds")); + } + Ok(Self { + targets, + state: state("state")?, + radius, + }) + } + pub fn place( + &self, + world: &mut W, + random: &mut impl RandomSource, + mut origin: [i32; 3], + ) -> Result> { + let min = world + .min_y() + .map_err(ReplaceBlobsError::Query)? + .wrapping_add(1); + let max = world.max_y().map_err(ReplaceBlobsError::Query)?; + // Match Mth.clamp, including inverted world bounds. + origin[1] = origin[1].max(min).min(max); + let mut remaining = 1_048_576; + loop { + if origin[1] + <= world + .min_y() + .map_err(ReplaceBlobsError::Query)? + .wrapping_add(1) + { + return Ok(false); + } + if remaining == 0 { + return Err(ReplaceBlobsError::WorkLimit); + } + remaining -= 1; + if self + .targets + .contains(&world.block(origin).map_err(ReplaceBlobsError::World)?) + { + break; + } + origin[1] = origin[1].wrapping_sub(1); + } + let rx = self + .radius + .sample(random) + .map_err(ReplaceBlobsError::Random)?; + let ry = self + .radius + .sample(random) + .map_err(ReplaceBlobsError::Random)?; + let rz = self + .radius + .sample(random) + .map_err(ReplaceBlobsError::Random)?; + let mut any = false; + // Native order is depth, ascending X, ascending Y, positive Z then its + // mirror. The feature stops before the first shell beyond max radius. + for depth in 0..=rx.max(ry).max(rz) { + let max_x = rx.min(depth); + for x in -max_x..=max_x { + let max_y = ry.min(depth - x.abs()); + for y in -max_y..=max_y { + let z = depth - x.abs() - y.abs(); + if z > rz { + continue; + } + self.replace(world, offset(origin, [x, y, z]), &mut any)?; + if z != 0 { + self.replace(world, offset(origin, [x, y, -z]), &mut any)?; + } + } + } + } + Ok(any) + } + fn replace( + &self, + world: &mut W, + p: [i32; 3], + any: &mut bool, + ) -> Result<(), ReplaceBlobsError> { + if self + .targets + .contains(&world.block(p).map_err(ReplaceBlobsError::World)?) + { + world + .set_block(p, self.state, 3) + .map_err(ReplaceBlobsError::World)?; + *any = true; + } + Ok(()) + } +} +fn offset(p: [i32; 3], d: [i32; 3]) -> [i32; 3] { + std::array::from_fn(|i| p[i].wrapping_add(d[i])) +} diff --git a/docs/rust-parity.md b/docs/rust-parity.md index e0d839c51..d96c4f74e 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -577,3 +577,18 @@ nonoverflow extreme coordinates. Workspace tests, all-target Clippy and all 149 Python tests pass. The fixture controls destruction success and air replacement; loot, block entities, updates, portal travel and dragon gameplay remain pending. Pathological overflow-box work is bounded to 2^20 visits. + +## Replacement blobs + +The `netherrack_replace_blobs` feature now clamps the search origin to world +height, descends to a matching block, samples three independent radii and visits +clipped Manhattan shells in native order. Target matching uses block identity +regardless of state properties; rejected writes still produce success. + +The [replacement-blob comparison](../benchmarks/rust-replace-blobs-2026-10-06/scoped-parity.json) +matches **5,538,034 lines per reference JAR** over **109,003 fixtures**, including +every target/output state, all candidate states through failure-terminated +prefixes, every constant radius, six provider families, both RNGs, height +boundaries, wrapped X/Z coordinates, partial failures and composition. Workspace +tests and all-target Clippy pass. World updates and full generation remain +pending; pathological descent is bounded to 2^20 visits. diff --git a/tools/test_replace_blobs_parity.py b/tools/test_replace_blobs_parity.py new file mode 100644 index 000000000..63e3bbbd5 --- /dev/null +++ b/tools/test_replace_blobs_parity.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python3 +"""Compare replacement-blob descent, three radius draws and Manhattan order.""" +import itertools +import json +try: + from . import test_simple_block_parity as harness +except ImportError: + import test_simple_block_parity as harness + + +def corpus(facts, placement): + states = facts['states']; get = lambda name: facts['defaults']['minecraft:' + name] + def blob(**extra): + value = {'type': 'netherrack_replace_blobs', 'target': {'id': 'netherrack'}, 'state': {'id': 'basalt'}, 'radius': 2} + value.update(extra); return value + def case(definition=None, **extra): + value = {'definition': json.dumps(definition if definition is not None else blob(), separators=(',', ':')), + 'mode': 'feature', 'origin': [0, 64, 0], 'legacy': False, 'seed': 0, 'world_seed': 1, + 'fail': -1, 'reject': 0, 'brightness': 15, 'fallback': get('netherrack'), 'states': [], 'repeats': 1} + value.update(extra); return value + for state_id, state in enumerate(states): + yield case(blob(target=state, radius=0), fallback=state_id) + yield case(blob(state=state, radius=0)) + yield case(fallback=state_id, states=[[0, 64, 0, get('netherrack')]], fail=30) + for radius, legacy, seed in itertools.product(range(13), [False, True], range(8)): + yield case(blob(radius=radius), legacy=legacy, seed=seed) + providers = [ + {'type': 'uniform', 'min_inclusive': 0, 'max_inclusive': 12}, + {'type': 'biased_to_bottom', 'min_inclusive': 0, 'max_inclusive': 12}, + {'type': 'very_biased_to_bottom', 'min_inclusive': 0, 'max_inclusive': 12}, + {'type': 'trapezoid', 'min': 0, 'max': 12, 'plateau': 4}, + {'type': 'clamped', 'source': {'type': 'uniform', 'min_inclusive': -12, 'max_inclusive': 20}, 'min_inclusive': 0, 'max_inclusive': 12}, + {'type': 'weighted_list', 'distribution': [{'weight': 1, 'data': 0}, {'weight': 3, 'data': 6}, {'weight': 1, 'data': 12}]}, + ] + for provider, legacy, seed, fail, reject in itertools.product(providers, [False, True], range(8), [-1, 0, 1, 7, 29], [0, 1, 3]): + yield case(blob(radius=provider), legacy=legacy, seed=seed, fail=fail, reject=reject, repeats=2) + for y, depth in itertools.product([-2147483648, -65, -64, -63, -62, -61, 0, 319, 320, 2147483647], range(6)): + start = min(319, max(-63, y)) + initial = [[0, start-d, 0, get('air')] for d in range(depth)] + yield case(origin=[0, y, 0], states=initial) + yield case(origin=[0, y, 0], fallback=get('air')) + for target in [{'id': 'oak_log', 'properties': {'axis': 'x'}}, {'id': 'oak_log'}, {'id': 'air'}]: + yield case(blob(target=target), fallback=get('oak_log')) + for origin, legacy in itertools.product([[2147483647, 64, -2147483648], [-2147483648, 64, 2147483647]], [False, True]): + yield case(blob(radius=12), origin=origin, legacy=legacy) + for key, values in [ + ('target', [None, False, {}, [], 'missing', {'id': 'missing'}]), + ('state', [None, False, {}, [], 'missing', {'id': 'oak_log', 'properties': {'axis': 'invalid'}}]), + ('radius', [None, False, -1, 13, -0.0, 0.9, 12.9, '2', {}, [], {'type': 'uniform', 'min_inclusive': -1, 'max_inclusive': 2}, {'type': 'constant', 'value': 13}])]: + for value in values: + definition = blob(); definition[key] = value + yield case(definition) + definition = blob(); del definition[key] + yield case(definition) + for legacy, fail, reject in itertools.product([False, True], [-1, 0, 9, 101], [0, 3]): + placed = {'feature': blob(), 'placement': [{'type': 'count', 'count': 2}]} + yield case(placed, mode='placed', legacy=legacy, fail=fail, reject=reject, repeats=2) + yield case({'type': 'overlay', 'features': [placed, {'feature': 'horizon:moss', 'placement': []}]}, legacy=legacy, fail=fail, reject=reject) + + +if __name__ == '__main__': + harness.run(corpus, 'rust-replace-blobs-parity', __file__, + 'Native ReplaceBlobsFeature under its netherrack_replace_blobs registry key: target block identity, required replacement state and radius provider bounded 0..12, build-height clamp, descending target search, three radius draws, clipped Manhattan shells in native depth/X/Y/positive-Z/mirrored-Z order, flags 3 and success after rejected writes. Every configured target and output state has a radius-zero run; all candidate states have failure-terminated prefixes. Full radius/provider runs cover both RNGs, boundaries, wrapped X/Z, repeated mutations, query failures and composition. Pathological descent is bounded to 2^20 visits. World updates and full generation remain pending.') From 11acaa1617f840b8484bda70737083198d7fc037 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 13:17:56 +0200 Subject: [PATCH 023/253] Implement bamboo stalks, leafy caps and podzol patches --- .github/workflows/ci.yml | 4 + .../rust-bamboo-2026-10-06/scoped-parity.json | 214 ++++++++++++++++++ .../examples/simple_block_fixture.rs | 8 +- crates/horizon-world/src/worldgen.rs | 1 + crates/horizon-world/src/worldgen/bamboo.rs | 156 +++++++++++++ .../src/worldgen/feature_graph.rs | 11 + docs/rust-parity.md | 17 ++ .../parity/VanillaSimpleBlockOracle.java | 1 + tools/test_bamboo_parity.py | 52 +++++ 9 files changed, 462 insertions(+), 2 deletions(-) create mode 100644 benchmarks/rust-bamboo-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-world/src/worldgen/bamboo.rs create mode 100644 tools/test_bamboo_parity.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3bb1a8782..4c59bb888 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -151,6 +151,10 @@ jobs: env: RUSTUP_TOOLCHAIN: stable run: python tools/test_replace_blobs_parity.py + - name: Compare bamboo stalks, podzol patches and leafy caps + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_bamboo_parity.py - name: Compare ordered single-block replacement features env: RUSTUP_TOOLCHAIN: stable diff --git a/benchmarks/rust-bamboo-2026-10-06/scoped-parity.json b/benchmarks/rust-bamboo-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..1f337d87d --- /dev/null +++ b/benchmarks/rust-bamboo-2026-10-06/scoped-parity.json @@ -0,0 +1,214 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 144452, + "candidate_states": 35723, + "double_plant_blocks": 10, + "mossy_carpet_blocks": 1, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java": "311c073113f67aaa85e492ea0ec61cd57e40e5f035ec45331759318ada35892e", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSurvivalOracle.java": "4e7cc151617c1b02e872f9ca3e9fe4632379f225f4f07718ff6492df4ee551e7", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java": "e871d3a01f15616a98ca9227c27a81e4d17e2d57ac4e68a5650a70fa29811497", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSupportOracle.java": "04350901a2d708fb8fa672de61d058f73f332d2e90df1b93a67781862f89c1ad", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "60ff9ef7c1d5e23c080f9aec95ab2e7d3b7c5b5bcd67b9efa9518776c400629a", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_simple_block_parity.py": "50b783323051fe8cd369bb733448b0314f1e6e7994a950e4cb6cd2fe4f7f8e11", + "tools/test_bamboo_parity.py": "9fb99189bb3264cbd28c94f3a7dd5430acbccafb9b49e9ecf1d712d86b82d005", + "tools/test_block_survival_parity.py": "9e8dff3bd4b95dbfd29f8adc6a2f6d66abf19a6b1cd91423b794a345d4ec244a", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "a8cd85f6223668c1446ff103276d80937b9707d9a7dc619a176b1b1ceed36a4a", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "1eae82604d2b3377fd35aaa3a914a67e5af28f93923815a49e895b4d437433cd", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "5ce5c6eaa5f8a2557a620e533788217b1eb430654801dcf6135d6c92d7a012ac", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "bfd3c21cddf130ebafc7041cadb8a6db3180cf9cd9c74457def8cdb8931ac484", + "crates/horizon-world/src/worldgen/feature_region.rs": "79e8ce343b0dc80dceb8b214c818b383d9b110540bb8c3b0ac32863a7800e288", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "e682d13a21f90605215b79f5d254bf2e524d35e89eab2e3b46384709af80b847", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "dc3f07719dac53c5ceab6635598c010ccc93db0b149970894407bf9b713946e7", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "6e1d10aeee1776013db06e0768b51591064484decefeabf8f4721a7512cb1808", + "crates/horizon-world/examples/simple_block_fixture.rs": "2943f7a5b9af96eb2a63b7dfd857051faeffd7cea15df30711094cb281a32a67" + }, + "fixtures_sha256": { + ".local/rust-bamboo-parity/inputs.txt": "70a4b16ad5f5c2c9a59e940e43ffd90d799e38c620c0da3a91b1b94018d905c3", + ".local/rust-bamboo-parity/block-properties.nbt": "1aba22092f70d16b8092014c058ddc210e4aaa77bac32f6ec62e4d0e91d92a99", + ".local/rust-bamboo-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-bamboo-parity/cached-collision.nbt": "f3a5c6a5b2d51dad6c52e486e2b9989e79fd55db1a9bda6196db399550b04078", + ".local/rust-bamboo-parity/cached-support.nbt": "b6fdc9471b0b61e904206d3f099f4dc235aad6d723536c210be0cb7c3560d82c", + ".local/rust-bamboo-parity/catalog.json": "93581107e3564e60261044fdca61e3b7f237b9e6724c14b86e335ccc01198ba9", + ".local/rust-bamboo-parity/facts.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-bamboo-parity/feature-catalog.json": "c048c761c5084a40560731955cc999a364d14055bdd86fa50989a92e4a771286", + ".local/rust-bamboo-parity/fluid-tags.json": "f1e5eb6d22ea7effbb118a2282709cfdeef1bfae4516b775a55ad7a4df29d7d0", + ".local/rust-bamboo-parity/placement-definitions.json": "f8a972ec87c2352500af6481158a3192bdbf699951025639bea744e4127b97c4", + ".local/rust-bamboo-parity/support-cached-states.json": "353945a58fe69b352925473f1693f9b14a9ad19f13c15159c4184f2c29258622", + ".local/rust-bamboo-parity/survival-classes.json": "361832008eea0aa9151d367a125a19c6353d99a0b88b27dd0682f55b7954553e", + ".local/rust-bamboo-parity/survival-extra-definitions.json": "170f2db5bc97a49fa25cc249540aa7f04beea455cdbaf43742ed9415f5090a02", + ".local/rust-bamboo-parity/survival-placement-classes.json": "7fdbf48ab18c87098bbe1b6176cb81f4842b6c5d9a4d6bbaf7037ff61cb1848c", + ".local/rust-bamboo-parity/survival-rules.json": "8805c18b3195bb1eac1f1e5281333df56e2892505f64023e5403c58ce2ec4368", + ".local/rust-bamboo-parity/survival-support-tags.json": "15d88d5bb5ad10d65124d5abb2cc055d251b06d129bca7be06f55b43dc13f6fd", + ".local/rust-bamboo-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0" + }, + "rust_output_sha256": "34664ee037a753f00002f68ac8fa6199d5e9540806a34614be11973de4c0fb13", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "34664ee037a753f00002f68ac8fa6199d5e9540806a34614be11973de4c0fb13", + "matched_output_lines": 3485027 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "34664ee037a753f00002f68ac8fa6199d5e9540806a34614be11973de4c0fb13", + "matched_output_lines": 3485027 + } + ], + "scope": "Native BambooFeature bounded float codec, air-origin gate, actual bamboo survival, attempted-success semantics, height and optional radius draws, circular podzol patch with ordered WORLD_SURFACE requests, replacement tag, stalk air checks and three leafy caps including the stopping-position overwrite. All origin/support/podzol states have failure-terminated prefixes; all obstacle states have full no-podzol runs. Both RNGs, many seeds, signed zero and float rounding, obstruction heights, rejected writes, repeated mutation, partial failures, wrapped coordinates and composition are covered. Fixture height values are controlled and do not update after writes. Growth, world updates and complete generation remain pending; pathological wrapped patch loops are bounded to 2^20 visits." +} diff --git a/crates/horizon-world/examples/simple_block_fixture.rs b/crates/horizon-world/examples/simple_block_fixture.rs index c48c3669d..947210ca9 100644 --- a/crates/horizon-world/examples/simple_block_fixture.rs +++ b/crates/horizon-world/examples/simple_block_fixture.rs @@ -50,6 +50,7 @@ struct World<'a, 'r, W, R> { reject: i32, brightness: i32, sea_level: i32, + surface_height: i32, air: BlockStateId, destroy_success: bool, } @@ -213,8 +214,10 @@ impl PlacementContext for World<'_, '_, W, R> { fn max_y(&mut self) -> Result { Ok(319) } - fn height(&mut self, _: HeightmapType, _: i32, _: i32) -> Result { - Err(PlacementQueryError::Unavailable) + fn height(&mut self, kind: HeightmapType, x: i32, z: i32) -> Result { + self.event(format_args!("height {} {x} {z}", kind.name())) + .map_err(query)?; + Ok(self.surface_height) } fn block_state(&mut self, p: [i32; 3]) -> Result { self.get(p).map_err(query) @@ -308,6 +311,7 @@ fn fixture( reject: f["reject"].as_i64().unwrap() as i32, brightness: f["brightness"].as_i64().unwrap() as i32, sea_level: f.get("sea").and_then(Value::as_i64).unwrap_or(63) as i32, + surface_height: f.get("height").and_then(Value::as_i64).unwrap_or(64) as i32, air: blocks.air, destroy_success: f .get("destroy_success") diff --git a/crates/horizon-world/src/worldgen.rs b/crates/horizon-world/src/worldgen.rs index 1e8467e7c..6e9dd4f47 100644 --- a/crates/horizon-world/src/worldgen.rs +++ b/crates/horizon-world/src/worldgen.rs @@ -2,6 +2,7 @@ //! Complete terrain generation remains pending. pub mod anchor; pub mod aquifer; +pub mod bamboo; pub mod biome; pub mod biome_chunk; pub mod biome_predicate; diff --git a/crates/horizon-world/src/worldgen/bamboo.rs b/crates/horizon-world/src/worldgen/bamboo.rs new file mode 100644 index 000000000..ca63d9d85 --- /dev/null +++ b/crates/horizon-world/src/worldgen/bamboo.rs @@ -0,0 +1,156 @@ +//! Bamboo stalks, podzol patches and ordered cap overwrites. +use super::{ + DecodeError, Object, + block_feature::FeatureBlockBindings, + feature::FeatureWorld, + number_text, + placement::{PlacementContext, PlacementQueryError}, + required, +}; +use crate::{heightmap::HeightmapType, registry::BlockStateId}; +use horizon_core::random::{InvalidBound, RandomSource}; +use std::{collections::BTreeSet, sync::Arc}; +#[derive(Clone, Debug)] +pub struct BambooFeature { + probability: f32, + air: [BlockStateId; 3], + bamboo: BlockStateId, + trunk: BlockStateId, + caps: [BlockStateId; 3], + podzol: BlockStateId, + replaceable: Arc>, +} +#[derive(Debug)] +pub enum BambooError { + World(E), + Query(PlacementQueryError), + Random(InvalidBound), + WorkLimit, +} +impl std::fmt::Display for BambooError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::World(e) => e.fmt(f), + Self::Query(e) => e.fmt(f), + Self::Random(e) => e.fmt(f), + Self::WorkLimit => f.write_str("bamboo work limit exceeded"), + } + } +} +impl std::error::Error for BambooError {} +impl BambooFeature { + pub fn from_json(json: &str, bindings: &FeatureBlockBindings<'_>) -> Result { + let object: Object = serde_json::from_str(json)?; + let probability = number_text(required(&object, "probability")?)? + .parse::() + .map_err(|_| DecodeError::Field("bamboo probability"))? + as f32; + if !(0.0..=1.0).contains(&probability) || probability.is_sign_negative() { + return Err(DecodeError::Field("bamboo probability")); + } + let state = |leaves, stage| { + bindings.codec.decode(&format!(r#"{{"id":"bamboo","properties":{{"age":"1","leaves":"{leaves}","stage":"{stage}"}}}}"#),false).map_err(|e|DecodeError::Registry(e.to_string())) + }; + let get = |name| { + bindings + .registry() + .default_state(name) + .ok_or_else(|| DecodeError::Registry(format!("unknown bamboo block {name}"))) + }; + Ok(Self { + probability, + air: bindings.air, + bamboo: get("minecraft:bamboo")?, + trunk: state("none", 0)?, + caps: [state("large", 1)?, state("large", 0)?, state("small", 0)?], + podzol: get("minecraft:podzol")?, + replaceable: bindings + .tags + .get("minecraft:beneath_bamboo_podzol_replaceable") + .cloned() + .unwrap_or_default(), + }) + } + pub fn place( + &self, + world: &mut W, + random: &mut impl RandomSource, + origin: [i32; 3], + ) -> Result> { + if !self + .air + .contains(&world.block(origin).map_err(BambooError::World)?) + { + return Ok(false); + } + // Native success records the air-origin attempt, even if survival fails. + if !world + .block_survives(self.bamboo, origin) + .map_err(BambooError::Query)? + { + return Ok(true); + } + let height = random.next_int_bound(12).map_err(BambooError::Random)? + 5; + if random.next_float() < self.probability { + let radius = random.next_int_bound(4).map_err(BambooError::Random)? + 1; + let mut x = origin[0].wrapping_sub(radius); + let max_x = origin[0].wrapping_add(radius); + let mut remaining = 1_048_576; + while x <= max_x { + let mut z = origin[2].wrapping_sub(radius); + let max_z = origin[2].wrapping_add(radius); + while z <= max_z { + if remaining == 0 { + return Err(BambooError::WorkLimit); + } + remaining -= 1; + let dx = x.wrapping_sub(origin[0]); + let dz = z.wrapping_sub(origin[2]); + if dx.wrapping_mul(dx).wrapping_add(dz.wrapping_mul(dz)) <= radius * radius { + let y = world + .height(HeightmapType::WorldSurface, x, z) + .map_err(BambooError::Query)? + .wrapping_sub(1); + let p = [x, y, z]; + if self + .replaceable + .contains(&world.block(p).map_err(BambooError::World)?) + { + world + .set_block(p, self.podzol, 2) + .map_err(BambooError::World)?; + } + } + z = z.wrapping_add(1); + } + // Also bound overflow loops when the inner range is empty. + if remaining == 0 { + return Err(BambooError::WorkLimit); + } + remaining -= 1; + x = x.wrapping_add(1); + } + } + let mut p = origin; + for _ in 0..height { + if !self + .air + .contains(&world.block(p).map_err(BambooError::World)?) + { + break; + } + world + .set_block(p, self.trunk, 2) + .map_err(BambooError::World)?; + p[1] = p[1].wrapping_add(1); + } + if p[1].wrapping_sub(origin[1]) >= 3 { + // The first cap occupies the stopping position, including an obstacle. + for state in self.caps { + world.set_block(p, state, 2).map_err(BambooError::World)?; + p[1] = p[1].wrapping_sub(1); + } + } + Ok(true) + } +} diff --git a/crates/horizon-world/src/worldgen/feature_graph.rs b/crates/horizon-world/src/worldgen/feature_graph.rs index 9a00f04ad..a2d5f6a31 100644 --- a/crates/horizon-world/src/worldgen/feature_graph.rs +++ b/crates/horizon-world/src/worldgen/feature_graph.rs @@ -49,6 +49,7 @@ pub enum FeatureDefinition { Disk(super::disk::DiskFeature), Spring(super::spring::SpringFeature), Vines(super::vines::VinesFeature), + Bamboo(super::bamboo::BambooFeature), ReplaceBlobs(super::replace_blobs::ReplaceBlobsFeature), EndPodium(super::end_podium::EndPodiumFeature), Spike(super::spike::SpikeFeature), @@ -78,6 +79,7 @@ pub enum FeatureExecutionError { BlockPile(super::block_pile::BlockPileError), Disk(super::disk::DiskError), BlockBlob(super::block_blob::BlockBlobError), + Bamboo(super::bamboo::BambooError), ReplaceBlobs(super::replace_blobs::ReplaceBlobsError), EndPodium(super::end_podium::EndPodiumError), Spike(super::spike::SpikeError), @@ -98,6 +100,7 @@ impl std::fmt::Display for FeatureExecutionError { Self::BlockPile(e) => e.fmt(f), Self::Disk(e) => e.fmt(f), Self::BlockBlob(e) => e.fmt(f), + Self::Bamboo(e) => e.fmt(f), Self::ReplaceBlobs(e) => e.fmt(f), Self::EndPodium(e) => e.fmt(f), Self::Spike(e) => e.fmt(f), @@ -269,6 +272,11 @@ impl FeatureDefinition { )?)?; match kind.as_str() { "minecraft:no_op" => Ok(Self::NoOp), + "minecraft:bamboo" => super::bamboo::BambooFeature::from_json( + json, + blocks.ok_or(DecodeError::Field("bamboo bindings"))?, + ) + .map(Self::Bamboo), "minecraft:netherrack_replace_blobs" => { super::replace_blobs::ReplaceBlobsFeature::decode( json, @@ -629,6 +637,9 @@ impl FeatureDefinition { .place(world, random, origin, run.blocks) .map_err(FeatureExecutionError::Basic), Self::NoOp => Ok(true), + Self::Bamboo(feature) => feature + .place(world, random, origin) + .map_err(FeatureExecutionError::Bamboo), Self::ReplaceBlobs(feature) => feature .place(world, random, origin) .map_err(FeatureExecutionError::ReplaceBlobs), diff --git a/docs/rust-parity.md b/docs/rust-parity.md index d96c4f74e..934b89580 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -592,3 +592,20 @@ prefixes, every constant radius, six provider families, both RNGs, height boundaries, wrapped X/Z coordinates, partial failures and composition. Workspace tests and all-target Clippy pass. World updates and full generation remain pending; pathological descent is bounded to 2^20 visits. + +## Bamboo and podzol patches + +Bamboo features preserve the initial air gate, real survival checks and native +attempt-success behavior when survival fails. Podzol patches use ordered surface +height requests and the native replacement tag. Stalks preserve random draws and +leaf states, including the first cap overwriting the stopping position when at +least three stalk positions were attempted. + +The [bamboo comparison](../benchmarks/rust-bamboo-2026-10-06/scoped-parity.json) +matches **3,485,027 lines per reference JAR** over **144,452 fixtures**. Every +origin/support/podzol state has a failure-terminated prefix; every obstacle state +has a complete no-podzol run. Tests include both RNGs, signed-zero decoding, +obstruction heights, rejected writes, repeated mutations, wrapped coordinates +and composition. Workspace tests and all-target Clippy pass. Fixture surface +heights are controlled; dynamic height updates, bamboo growth and full gameplay +remain pending. Pathological wrapped patch loops have a 2^20 work limit. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java index 616663224..d1a7c4853 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java @@ -63,6 +63,7 @@ public final class VanillaSimpleBlockOracle { if(name.equals("getChunk")&&args.length==1&&args[0] instanceof BlockPos)return chunk((BlockPos)args[0]); if(name.equals("getMinY"))return -64; if(name.equals("getHeight")&&(args==null||args.length==0))return 384; + if(name.equals("getHeight")&&args.length==3){event("height "+args[0]+" "+args[1]+" "+args[2]);return f.has("height")?f.get("height").getAsInt():64;} if(name.equals("getSeaLevel"))return f.has("sea")?f.get("sea").getAsInt():63; if(name.equals("getBlockState")){var p=(BlockPos)args[0];event("get "+xyz(p));var state=at(p);out.println("state "+Block.getId(state));return state;} if(name.equals("getFluidState")){var p=(BlockPos)args[0];event("fluid "+xyz(p));return (f.has("fluid")?Block.stateById(f.get("fluid").getAsInt()):at(p)).getFluidState();} diff --git a/tools/test_bamboo_parity.py b/tools/test_bamboo_parity.py new file mode 100644 index 000000000..9a2d65c55 --- /dev/null +++ b/tools/test_bamboo_parity.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python3 +"""Compare bamboo survival, podzol spread and ordered leafy caps.""" +import itertools +import json +try: + from . import test_simple_block_parity as harness +except ImportError: + import test_simple_block_parity as harness + + +def corpus(facts, placement): + states = facts['states']; get = lambda name: facts['defaults']['minecraft:' + name] + wrap = lambda n: (n + 2**31) % 2**32 - 2**31 + def bamboo(probability=1): return {'type': 'bamboo', 'probability': probability} + def case(definition=None, **extra): + origin = extra.pop('origin', [0, 65, 0]) + value = {'definition': json.dumps(definition if definition is not None else bamboo()), + 'mode': 'feature', 'origin': origin, 'legacy': False, 'seed': 0, 'world_seed': 1, + 'fail': -1, 'reject': 0, 'brightness': 15, 'height': origin[1], 'fallback': get('air'), + 'states': [[*origin, get('air')], [origin[0], wrap(origin[1]-1), origin[2], get('dirt')]], 'repeats': 1} + value.update(extra); return value + for state in range(len(states)): + yield case(states=[[0, 65, 0, state], [0, 64, 0, get('dirt')]], fail=25) + yield case(bamboo(0), states=[[0, 65, 0, get('air')], [0, 64, 0, state]], fail=25) + yield case(fallback=state, fail=25) + yield case(bamboo(0), states=[[0, 64, 0, get('dirt')], [0, 68, 0, state]]) + for probability, legacy, seed in itertools.product([0, 0.01, 0.5, 1], [False, True], range(64)): + yield case(bamboo(probability), legacy=legacy, seed=seed, repeats=2) + for legacy, seed, fail, reject in itertools.product([False, True], range(16), [-1, 0, 1, 2, 4, 11, 25, 60, 100], [0, 1, 3]): + yield case(legacy=legacy, seed=seed, fail=fail, reject=reject, fallback=get('dirt'), + states=[[0, y, 0, get('air')] for y in range(65, 84)], repeats=2) + for stop, legacy, reject in itertools.product(range(1, 19), [False, True], [0, 1, 3]): + yield case(bamboo(0), legacy=legacy, reject=reject, states=[[0, 64, 0, get('dirt')], [0, 65+stop, 0, get('bedrock')]]) + for height, legacy in itertools.product([-2147483648, -64, 0, 65, 320, 2147483647], [False, True]): + yield case(height=height, legacy=legacy) + for origin, legacy in itertools.product( + [[2147483647, 65, 2147483647], [-2147483648, 65, -2147483648], [0, 2147483647, 0], [0, -2147483648, 0], + [2147483644, 65, 2147483644]], [False, True]): + yield case(origin=origin, legacy=legacy, fail=20) + yield case(bamboo(0), origin=origin, legacy=legacy) + for value in [None, False, -1, -0.0, -1e-100, 1e-100, 1.0000000001, 1.01, '0.5', [], {}]: + yield case(bamboo(value)) + yield case({'type': 'bamboo'}) + for legacy, fail, reject in itertools.product([False, True], [-1, 0, 9, 31], [0, 3]): + placed = {'feature': bamboo(), 'placement': [{'type': 'count', 'count': 2}]} + yield case(placed, mode='placed', legacy=legacy, fail=fail, reject=reject, repeats=2) + yield case({'type': 'overlay', 'features': [placed, {'feature': 'horizon:moss', 'placement': []}]}, legacy=legacy, fail=fail, reject=reject) + + +if __name__ == '__main__': + harness.run(corpus, 'rust-bamboo-parity', __file__, + 'Native BambooFeature bounded float codec, air-origin gate, actual bamboo survival, attempted-success semantics, height and optional radius draws, circular podzol patch with ordered WORLD_SURFACE requests, replacement tag, stalk air checks and three leafy caps including the stopping-position overwrite. All origin/support/podzol states have failure-terminated prefixes; all obstacle states have full no-podzol runs. Both RNGs, many seeds, signed zero and float rounding, obstruction heights, rejected writes, repeated mutation, partial failures, wrapped coordinates and composition are covered. Fixture height values are controlled and do not update after writes. Growth, world updates and complete generation remain pending; pathological wrapped patch loops are bounded to 2^20 visits.') From 6dc818343331adfaa7691ec9734aa966a178d285 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 13:21:42 +0200 Subject: [PATCH 024/253] Implement Nether delta rims and shifted content placement --- .github/workflows/ci.yml | 4 + .../rust-delta-2026-10-06/scoped-parity.json | 215 ++++++++++++++++++ .../examples/simple_block_fixture.rs | 10 +- crates/horizon-world/src/worldgen.rs | 1 + crates/horizon-world/src/worldgen/delta.rs | 202 ++++++++++++++++ .../src/worldgen/feature_graph.rs | 13 ++ docs/rust-parity.md | 17 ++ .../parity/VanillaSimpleBlockOracle.java | 2 +- tools/test_delta_parity.py | 67 ++++++ 9 files changed, 529 insertions(+), 2 deletions(-) create mode 100644 benchmarks/rust-delta-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-world/src/worldgen/delta.rs create mode 100644 tools/test_delta_parity.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4c59bb888..8a2ffa978 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -155,6 +155,10 @@ jobs: env: RUSTUP_TOOLCHAIN: stable run: python tools/test_bamboo_parity.py + - name: Compare Nether delta rims and shifted contents + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_delta_parity.py - name: Compare ordered single-block replacement features env: RUSTUP_TOOLCHAIN: stable diff --git a/benchmarks/rust-delta-2026-10-06/scoped-parity.json b/benchmarks/rust-delta-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..59f90dc67 --- /dev/null +++ b/benchmarks/rust-delta-2026-10-06/scoped-parity.json @@ -0,0 +1,215 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 324269, + "candidate_states": 35723, + "double_plant_blocks": 10, + "mossy_carpet_blocks": 1, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java": "10b73ee4c06d9e0b5d6863b009189e6c1a291f82bb3f0d1b9c18d92bfc86c10c", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSurvivalOracle.java": "4e7cc151617c1b02e872f9ca3e9fe4632379f225f4f07718ff6492df4ee551e7", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java": "e871d3a01f15616a98ca9227c27a81e4d17e2d57ac4e68a5650a70fa29811497", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSupportOracle.java": "04350901a2d708fb8fa672de61d058f73f332d2e90df1b93a67781862f89c1ad", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "60ff9ef7c1d5e23c080f9aec95ab2e7d3b7c5b5bcd67b9efa9518776c400629a", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_simple_block_parity.py": "50b783323051fe8cd369bb733448b0314f1e6e7994a950e4cb6cd2fe4f7f8e11", + "tools/test_delta_parity.py": "3edbfd93114c88909cb3dfedbc577a90f351d2104462bd7a75e122becfa55f2f", + "tools/test_block_survival_parity.py": "9e8dff3bd4b95dbfd29f8adc6a2f6d66abf19a6b1cd91423b794a345d4ec244a", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "a8cd85f6223668c1446ff103276d80937b9707d9a7dc619a176b1b1ceed36a4a", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "1eae82604d2b3377fd35aaa3a914a67e5af28f93923815a49e895b4d437433cd", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "5ce5c6eaa5f8a2557a620e533788217b1eb430654801dcf6135d6c92d7a012ac", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "cd5ca4bc73b1abc8bc1aef98cba995a3a4105532c004ba82f3f8e118cd046621", + "crates/horizon-world/src/worldgen/feature_region.rs": "79e8ce343b0dc80dceb8b214c818b383d9b110540bb8c3b0ac32863a7800e288", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "e682d13a21f90605215b79f5d254bf2e524d35e89eab2e3b46384709af80b847", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "dc3f07719dac53c5ceab6635598c010ccc93db0b149970894407bf9b713946e7", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "fc9a6872e85d38ce92db0ef4fe806ce4688b3ac90c5ab0aade9b65ef7197f5ef", + "crates/horizon-world/examples/simple_block_fixture.rs": "03772ae73202fd6b92617a76d08fa01487acf4c2e65568a35beb4a783d557919" + }, + "fixtures_sha256": { + ".local/rust-delta-parity/inputs.txt": "1dcb3e0f75417acd8ba2ea42e6c3088ce709f4c3a3ea7d2765ee91a1796abf7f", + ".local/rust-delta-parity/block-properties.nbt": "1aba22092f70d16b8092014c058ddc210e4aaa77bac32f6ec62e4d0e91d92a99", + ".local/rust-delta-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-delta-parity/cached-collision.nbt": "f3a5c6a5b2d51dad6c52e486e2b9989e79fd55db1a9bda6196db399550b04078", + ".local/rust-delta-parity/cached-support.nbt": "b6fdc9471b0b61e904206d3f099f4dc235aad6d723536c210be0cb7c3560d82c", + ".local/rust-delta-parity/catalog.json": "93581107e3564e60261044fdca61e3b7f237b9e6724c14b86e335ccc01198ba9", + ".local/rust-delta-parity/facts.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-delta-parity/feature-catalog.json": "c048c761c5084a40560731955cc999a364d14055bdd86fa50989a92e4a771286", + ".local/rust-delta-parity/fluid-tags.json": "f1e5eb6d22ea7effbb118a2282709cfdeef1bfae4516b775a55ad7a4df29d7d0", + ".local/rust-delta-parity/placement-definitions.json": "f8a972ec87c2352500af6481158a3192bdbf699951025639bea744e4127b97c4", + ".local/rust-delta-parity/support-cached-states.json": "353945a58fe69b352925473f1693f9b14a9ad19f13c15159c4184f2c29258622", + ".local/rust-delta-parity/survival-classes.json": "361832008eea0aa9151d367a125a19c6353d99a0b88b27dd0682f55b7954553e", + ".local/rust-delta-parity/survival-extra-definitions.json": "170f2db5bc97a49fa25cc249540aa7f04beea455cdbaf43742ed9415f5090a02", + ".local/rust-delta-parity/survival-placement-classes.json": "7fdbf48ab18c87098bbe1b6176cb81f4842b6c5d9a4d6bbaf7037ff61cb1848c", + ".local/rust-delta-parity/survival-rules.json": "8805c18b3195bb1eac1f1e5281333df56e2892505f64023e5403c58ce2ec4368", + ".local/rust-delta-parity/survival-support-tags.json": "15d88d5bb5ad10d65124d5abb2cc055d251b06d129bca7be06f55b43dc13f6fd", + ".local/rust-delta-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0" + }, + "rust_output_sha256": "58e5fb6d071c86400e0ea44685464cd717e59bb554399e8060210ab48f795b18", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "58e5fb6d071c86400e0ea44685464cd717e59bb554399e8060210ab48f795b18", + "matched_output_lines": 13418994 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "58e5fb6d071c86400e0ea44685464cd717e59bb554399e8060210ab48f795b18", + "matched_output_lines": 13418994 + } + ], + "scope": "Native DeltaFeature required state and bounded size-provider codecs, 0.9 double rim draw, conditional rim X/Z sampling, independent patch X/Z sampling, Manhattan traversal and immediate rim/shifted-content mutations. Every state is tested as origin, contents, rim and all six neighbors; all air-neighbor masks, size/rim limits, six provider families, zero-component rim offsets, both RNGs, seeds, repeated mutations, rejected writes, partial failures, wrapped coordinates and composition are covered. The world fixture has a controlled flat air/ground boundary with mutable overrides. World updates, fluid behavior and full generation remain pending." +} diff --git a/crates/horizon-world/examples/simple_block_fixture.rs b/crates/horizon-world/examples/simple_block_fixture.rs index 947210ca9..575dd07ba 100644 --- a/crates/horizon-world/examples/simple_block_fixture.rs +++ b/crates/horizon-world/examples/simple_block_fixture.rs @@ -51,6 +51,7 @@ struct World<'a, 'r, W, R> { brightness: i32, sea_level: i32, surface_height: i32, + air_above: Option, air: BlockStateId, destroy_success: bool, } @@ -65,7 +66,13 @@ impl World<'_, '_, W, R> { Ok(call) } fn at(&self, p: [i32; 3]) -> BlockStateId { - self.states.get(&p).copied().unwrap_or(self.fallback) + self.states.get(&p).copied().unwrap_or_else(|| { + if self.air_above.is_some_and(|y| p[1] > y) { + self.air + } else { + self.fallback + } + }) } fn get(&mut self, p: [i32; 3]) -> io::Result { self.event(format_args!("get {} {} {}", p[0], p[1], p[2]))?; @@ -312,6 +319,7 @@ fn fixture( brightness: f["brightness"].as_i64().unwrap() as i32, sea_level: f.get("sea").and_then(Value::as_i64).unwrap_or(63) as i32, surface_height: f.get("height").and_then(Value::as_i64).unwrap_or(64) as i32, + air_above: f.get("air_above").and_then(Value::as_i64).map(|v| v as i32), air: blocks.air, destroy_success: f .get("destroy_success") diff --git a/crates/horizon-world/src/worldgen.rs b/crates/horizon-world/src/worldgen.rs index 6e9dd4f47..94268d424 100644 --- a/crates/horizon-world/src/worldgen.rs +++ b/crates/horizon-world/src/worldgen.rs @@ -19,6 +19,7 @@ pub mod carver; pub mod carving; pub mod climate; pub mod decoration; +pub mod delta; pub mod density; pub mod disk; pub mod end_podium; diff --git a/crates/horizon-world/src/worldgen/delta.rs b/crates/horizon-world/src/worldgen/delta.rs new file mode 100644 index 000000000..884a103bd --- /dev/null +++ b/crates/horizon-world/src/worldgen/delta.rs @@ -0,0 +1,202 @@ +//! Nether delta patches with ordered rims, shifted contents and cavity checks. +use super::{ + DecodeError, Object, block_feature::FeatureBlockBindings, feature::FeatureWorld, required, + value_provider::IntProvider, +}; +use crate::registry::BlockStateId; +use horizon_core::{ + geometry::Direction, + random::{InvalidBound, RandomSource}, +}; +use std::{collections::BTreeSet, sync::Arc}; +#[derive(Clone, Debug)] +pub struct DeltaFeature { + contents: BlockStateId, + rim: BlockStateId, + size: IntProvider, + rim_size: IntProvider, + blocked: Arc>, + air: [BlockStateId; 3], +} +#[derive(Debug)] +pub enum DeltaError { + World(E), + Random(InvalidBound), +} +impl std::fmt::Display for DeltaError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::World(e) => e.fmt(f), + Self::Random(e) => e.fmt(f), + } + } +} +impl std::error::Error for DeltaError {} +impl DeltaFeature { + pub fn from_json(json: &str, bindings: &FeatureBlockBindings<'_>) -> Result { + Self::decode(json, bindings, 0, &mut 65536) + } + pub(crate) fn decode( + json: &str, + bindings: &FeatureBlockBindings<'_>, + depth: usize, + remaining: &mut usize, + ) -> Result { + if depth > 128 || *remaining == 0 { + return Err(DecodeError::Field("delta depth or work")); + } + *remaining -= 1; + let object: Object = serde_json::from_str(json)?; + let state = |name| { + required(&object, name).and_then(|v| { + bindings + .codec + .decode(v.get(), false) + .map_err(|e| DecodeError::Registry(e.to_string())) + }) + }; + let contents = state("contents")?; + let rim = state("rim")?; + let mut provider = |name| { + let p = IntProvider::decode(required(&object, name)?, depth + 1, remaining)?; + let [min, max] = p.bounds(); + if min < 0 || max > 16 { + return Err(DecodeError::Field("delta size bounds")); + } + Ok(p) + }; + let size = provider("size")?; + let rim_size = provider("rim_size")?; + let contents_name = &bindings + .registry() + .state(contents) + .ok_or(DecodeError::Field("delta contents"))? + .name; + let mut blocked = BTreeSet::new(); + for name in [ + "minecraft:bedrock", + "minecraft:nether_bricks", + "minecraft:nether_brick_fence", + "minecraft:nether_brick_stairs", + "minecraft:nether_wart", + "minecraft:chest", + "minecraft:spawner", + contents_name.as_str(), + ] { + blocked.extend( + bindings + .blocks + .get(name) + .ok_or_else(|| DecodeError::Registry(format!("unknown delta block {name}")))? + .iter() + .copied(), + ); + } + Ok(Self { + contents, + rim, + size, + rim_size, + blocked: Arc::new(blocked), + air: bindings.air, + }) + } + pub fn place( + &self, + world: &mut W, + random: &mut impl RandomSource, + origin: [i32; 3], + ) -> Result> { + let draw_rim = random.next_double() < 0.9; + let rim_x = if draw_rim { + self.rim_size.sample(random).map_err(DeltaError::Random)? + } else { + 0 + }; + let rim_z = if draw_rim { + self.rim_size.sample(random).map_err(DeltaError::Random)? + } else { + 0 + }; + let rim = draw_rim && rim_x != 0 && rim_z != 0; + let rx = self.size.sample(random).map_err(DeltaError::Random)?; + let rz = self.size.sample(random).map_err(DeltaError::Random)?; + let mut any = false; + for depth in 0..=rx.max(rz) { + let max_x = rx.min(depth); + for x in -max_x..=max_x { + let z = depth - x.abs(); + if z > rz { + continue; + } + self.place_at( + world, + offset(origin, [x, 0, z]), + [rim_x, 0, rim_z], + rim, + &mut any, + )?; + if z != 0 { + self.place_at( + world, + offset(origin, [x, 0, -z]), + [rim_x, 0, rim_z], + rim, + &mut any, + )?; + } + } + } + Ok(any) + } + fn place_at( + &self, + world: &mut W, + p: [i32; 3], + shift: [i32; 3], + rim: bool, + any: &mut bool, + ) -> Result<(), DeltaError> { + if !self.is_clear(world, p)? { + return Ok(()); + } + if rim { + world.set_block(p, self.rim, 3).map_err(DeltaError::World)?; + *any = true; + } + let shifted = offset(p, shift); + if self.is_clear(world, shifted)? { + world + .set_block(shifted, self.contents, 3) + .map_err(DeltaError::World)?; + *any = true; + } + Ok(()) + } + fn is_clear( + &self, + world: &mut W, + p: [i32; 3], + ) -> Result> { + if self + .blocked + .contains(&world.block(p).map_err(DeltaError::World)?) + { + return Ok(false); + } + for direction in Direction::ALL { + let air = self.air.contains( + &world + .block(offset(p, direction.normal())) + .map_err(DeltaError::World)?, + ); + if air != (direction == Direction::Up) { + return Ok(false); + } + } + Ok(true) + } +} +fn offset(p: [i32; 3], d: [i32; 3]) -> [i32; 3] { + std::array::from_fn(|i| p[i].wrapping_add(d[i])) +} diff --git a/crates/horizon-world/src/worldgen/feature_graph.rs b/crates/horizon-world/src/worldgen/feature_graph.rs index a2d5f6a31..2a2d09281 100644 --- a/crates/horizon-world/src/worldgen/feature_graph.rs +++ b/crates/horizon-world/src/worldgen/feature_graph.rs @@ -49,6 +49,7 @@ pub enum FeatureDefinition { Disk(super::disk::DiskFeature), Spring(super::spring::SpringFeature), Vines(super::vines::VinesFeature), + Delta(super::delta::DeltaFeature), Bamboo(super::bamboo::BambooFeature), ReplaceBlobs(super::replace_blobs::ReplaceBlobsFeature), EndPodium(super::end_podium::EndPodiumFeature), @@ -79,6 +80,7 @@ pub enum FeatureExecutionError { BlockPile(super::block_pile::BlockPileError), Disk(super::disk::DiskError), BlockBlob(super::block_blob::BlockBlobError), + Delta(super::delta::DeltaError), Bamboo(super::bamboo::BambooError), ReplaceBlobs(super::replace_blobs::ReplaceBlobsError), EndPodium(super::end_podium::EndPodiumError), @@ -100,6 +102,7 @@ impl std::fmt::Display for FeatureExecutionError { Self::BlockPile(e) => e.fmt(f), Self::Disk(e) => e.fmt(f), Self::BlockBlob(e) => e.fmt(f), + Self::Delta(e) => e.fmt(f), Self::Bamboo(e) => e.fmt(f), Self::ReplaceBlobs(e) => e.fmt(f), Self::EndPodium(e) => e.fmt(f), @@ -272,6 +275,13 @@ impl FeatureDefinition { )?)?; match kind.as_str() { "minecraft:no_op" => Ok(Self::NoOp), + "minecraft:delta_feature" => super::delta::DeltaFeature::decode( + json, + blocks.ok_or(DecodeError::Field("delta bindings"))?, + depth + 1, + remaining, + ) + .map(Self::Delta), "minecraft:bamboo" => super::bamboo::BambooFeature::from_json( json, blocks.ok_or(DecodeError::Field("bamboo bindings"))?, @@ -637,6 +647,9 @@ impl FeatureDefinition { .place(world, random, origin, run.blocks) .map_err(FeatureExecutionError::Basic), Self::NoOp => Ok(true), + Self::Delta(feature) => feature + .place(world, random, origin) + .map_err(FeatureExecutionError::Delta), Self::Bamboo(feature) => feature .place(world, random, origin) .map_err(FeatureExecutionError::Bamboo), diff --git a/docs/rust-parity.md b/docs/rust-parity.md index 934b89580..bb22d313d 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -609,3 +609,20 @@ obstruction heights, rejected writes, repeated mutations, wrapped coordinates and composition. Workspace tests and all-target Clippy pass. Fixture surface heights are controlled; dynamic height updates, bamboo growth and full gameplay remain pending. Pathological wrapped patch loops have a 2^20 work limit. + +## Nether delta patches + +Delta features now preserve the double-precision rim chance, conditional rim +offset draws, independent patch radius draws and Manhattan traversal. Placement +checks block identity and ordered air/nonair neighbors, writes the rim, then +checks shifted contents against the mutated world. A zero rim component still +shifts contents even when it disables the rim write. + +The [delta comparison](../benchmarks/rust-delta-2026-10-06/scoped-parity.json) +matches **13,418,994 lines per reference JAR** across **324,269 fixtures**, +covering every origin/content/rim state and all six neighbor roles, every air +mask, radius limits, six provider families, both RNGs, repeated mutations, +rejected writes, partial failures, wrapped positions and composition. Workspace +tests, all-target Clippy and all 149 Python tests pass. The fixture supplies a +flat ground/air boundary with mutable overrides; fluid behavior, world updates +and complete generation remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java index d1a7c4853..5cb19d93c 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java @@ -55,7 +55,7 @@ public final class VanillaSimpleBlockOracle { }); } void event(String text){out.println(text);if(calls++==f.get("fail").getAsInt())throw new Stop();} - BlockState at(BlockPos p){return states.getOrDefault(p,Block.stateById(f.get("fallback").getAsInt()));} + BlockState at(BlockPos p){return states.getOrDefault(p,f.has("air_above")&&p.getY()>f.get("air_above").getAsInt()?Blocks.AIR.defaultBlockState():Block.stateById(f.get("fallback").getAsInt()));} public Object invoke(Object proxy,Method method,Object[] args)throws Throwable { String name=method.getName(); if(name.equals("getRandom"))return random; diff --git a/tools/test_delta_parity.py b/tools/test_delta_parity.py new file mode 100644 index 000000000..3aef9f358 --- /dev/null +++ b/tools/test_delta_parity.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python3 +"""Compare delta cavity checks, rim placement and mutable shifted contents.""" +import itertools +import json +try: + from . import test_simple_block_parity as harness +except ImportError: + import test_simple_block_parity as harness + + +def corpus(facts, placement): + states = facts['states']; get = lambda name: facts['defaults']['minecraft:' + name] + directions = [(0, -1, 0), (0, 1, 0), (0, 0, -1), (0, 0, 1), (-1, 0, 0), (1, 0, 0)] + def delta(**extra): + value = {'type': 'delta_feature', 'contents': {'id': 'lava'}, 'rim': {'id': 'magma_block'}, 'size': 0, 'rim_size': 0} + value.update(extra); return value + def case(definition=None, **extra): + value = {'definition': json.dumps(definition if definition is not None else delta(), separators=(',', ':')), + 'mode': 'feature', 'origin': [0, 64, 0], 'legacy': False, 'seed': 0, 'world_seed': 1, + 'fail': -1, 'reject': 0, 'brightness': 15, 'fallback': get('netherrack'), 'air_above': 64, 'states': [], 'repeats': 1} + value.update(extra); return value + for state_id, state in enumerate(states): + yield case(states=[[0, 64, 0, state_id]]) + yield case(delta(contents=state)) + yield case(delta(rim=state, rim_size=1)) + for x, y, z in directions: + yield case(states=[[x, 64+y, z, state_id]]) + for mask, legacy, reject in itertools.product(range(64), [False, True], [0, 1, 3]): + yield case(delta(size=2, rim_size=1), legacy=legacy, reject=reject, + states=[[x, 64+y, z, get('air') if mask & (1 << i) else get('stone')] for i, (x, y, z) in enumerate(directions)], repeats=2) + for size, rim, legacy, seed in itertools.product(range(17), [0, 1, 4, 16], [False, True], [0, -1]): + yield case(delta(size=size, rim_size=rim), legacy=legacy, seed=seed) + providers = [ + {'type': 'uniform', 'min_inclusive': 0, 'max_inclusive': 4}, + {'type': 'biased_to_bottom', 'min_inclusive': 0, 'max_inclusive': 4}, + {'type': 'very_biased_to_bottom', 'min_inclusive': 0, 'max_inclusive': 4}, + {'type': 'trapezoid', 'min': 0, 'max': 4, 'plateau': 2}, + {'type': 'clamped', 'source': {'type': 'uniform', 'min_inclusive': -4, 'max_inclusive': 8}, 'min_inclusive': 0, 'max_inclusive': 4}, + {'type': 'weighted_list', 'distribution': [{'weight': 1, 'data': 0}, {'weight': 2, 'data': 4}]}, + ] + for provider, legacy, seed, fail, reject in itertools.product(providers, [False, True], range(8), [-1, 0, 1, 7, 15, 31], [0, 1, 3]): + yield case(delta(size=provider, rim_size=provider), legacy=legacy, seed=seed, fail=fail, reject=reject, repeats=2) + for contents, rim in itertools.product(['air', 'cave_air', 'netherrack', 'magma_block', 'lava', 'bedrock', 'chest'], repeat=2): + yield case(delta(contents={'id': contents}, rim={'id': rim}, size=4, rim_size=2), repeats=2) + for legacy, seed in itertools.product([False, True], range(128)): + yield case(delta(size=2, rim_size={'type': 'uniform', 'min_inclusive': 0, 'max_inclusive': 2}), legacy=legacy, seed=seed) + for origin, legacy in itertools.product([[2147483647, 64, -2147483648], [-2147483648, 64, 2147483647], [0, -2147483648, 0], [0, 2147483647, 0]], [False, True]): + yield case(delta(size=4, rim_size=4), origin=origin, air_above=origin[1], legacy=legacy) + for key, values in [ + ('contents', [None, False, {}, [], 'missing', {'id': 'missing'}]), + ('rim', [None, False, {}, [], 'missing', {'id': 'oak_log', 'properties': {'axis': 'invalid'}}]), + ('size', [None, False, -1, 17, 16.9, '2', {}, [], {'type': 'uniform', 'min_inclusive': -1, 'max_inclusive': 2}]), + ('rim_size', [None, False, -1, 17, 16.9, '2', {}, []])]: + for value in values: + definition = delta(); definition[key] = value + yield case(definition) + definition = delta(); del definition[key] + yield case(definition) + for legacy, fail, reject in itertools.product([False, True], [-1, 0, 9, 101], [0, 3]): + placed = {'feature': delta(size=2, rim_size=1), 'placement': [{'type': 'count', 'count': 2}]} + yield case(placed, mode='placed', legacy=legacy, fail=fail, reject=reject, repeats=2) + yield case({'type': 'overlay', 'features': [placed, {'feature': 'horizon:moss', 'placement': []}]}, legacy=legacy, fail=fail, reject=reject) + + +if __name__ == '__main__': + harness.run(corpus, 'rust-delta-parity', __file__, + 'Native DeltaFeature required state and bounded size-provider codecs, 0.9 double rim draw, conditional rim X/Z sampling, independent patch X/Z sampling, Manhattan traversal and immediate rim/shifted-content mutations. Every state is tested as origin, contents, rim and all six neighbors; all air-neighbor masks, size/rim limits, six provider families, zero-component rim offsets, both RNGs, seeds, repeated mutations, rejected writes, partial failures, wrapped coordinates and composition are covered. The world fixture has a controlled flat air/ground boundary with mutable overrides. World updates, fluid behavior and full generation remain pending.') From 0c80bfa5f8bde843495f40dc7210d78c892c2626 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 13:28:59 +0200 Subject: [PATCH 025/253] Implement biome freezing and snow eligibility --- .github/workflows/ci.yml | 4 + .../scoped-parity.json | 216 ++++++++++++++++++ .../examples/simple_block_fixture.rs | 60 ++++- crates/horizon-world/src/worldgen.rs | 1 + .../src/worldgen/biome_weather.rs | 94 ++++++++ .../src/worldgen/placement/context.rs | 11 + docs/rust-parity.md | 19 ++ .../parity/VanillaSimpleBlockOracle.java | 19 ++ tools/test_biome_weather_parity.py | 46 ++++ 9 files changed, 467 insertions(+), 3 deletions(-) create mode 100644 benchmarks/rust-biome-weather-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-world/src/worldgen/biome_weather.rs create mode 100644 tools/test_biome_weather_parity.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8a2ffa978..30b6eb54c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -159,6 +159,10 @@ jobs: env: RUSTUP_TOOLCHAIN: stable run: python tools/test_delta_parity.py + - name: Compare biome freezing and snow eligibility + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_biome_weather_parity.py - name: Compare ordered single-block replacement features env: RUSTUP_TOOLCHAIN: stable diff --git a/benchmarks/rust-biome-weather-2026-10-06/scoped-parity.json b/benchmarks/rust-biome-weather-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..ca5619a92 --- /dev/null +++ b/benchmarks/rust-biome-weather-2026-10-06/scoped-parity.json @@ -0,0 +1,216 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 326057, + "candidate_states": 35723, + "double_plant_blocks": 10, + "mossy_carpet_blocks": 1, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java": "242a90773326a0059c93514b050ccd5d0d5104bd1b84a55982f0918ce639bd18", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSurvivalOracle.java": "4e7cc151617c1b02e872f9ca3e9fe4632379f225f4f07718ff6492df4ee551e7", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java": "e871d3a01f15616a98ca9227c27a81e4d17e2d57ac4e68a5650a70fa29811497", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSupportOracle.java": "04350901a2d708fb8fa672de61d058f73f332d2e90df1b93a67781862f89c1ad", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "60ff9ef7c1d5e23c080f9aec95ab2e7d3b7c5b5bcd67b9efa9518776c400629a", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_simple_block_parity.py": "50b783323051fe8cd369bb733448b0314f1e6e7994a950e4cb6cd2fe4f7f8e11", + "tools/test_biome_weather_parity.py": "b823d7e9a7afa1c1cc1ca454dd49b01c440a931de05b180e7557c142304c4d6e", + "tools/test_block_survival_parity.py": "9e8dff3bd4b95dbfd29f8adc6a2f6d66abf19a6b1cd91423b794a345d4ec244a", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "a8cd85f6223668c1446ff103276d80937b9707d9a7dc619a176b1b1ceed36a4a", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "1eae82604d2b3377fd35aaa3a914a67e5af28f93923815a49e895b4d437433cd", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "5ce5c6eaa5f8a2557a620e533788217b1eb430654801dcf6135d6c92d7a012ac", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "cd5ca4bc73b1abc8bc1aef98cba995a3a4105532c004ba82f3f8e118cd046621", + "crates/horizon-world/src/worldgen/feature_region.rs": "79e8ce343b0dc80dceb8b214c818b383d9b110540bb8c3b0ac32863a7800e288", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "e682d13a21f90605215b79f5d254bf2e524d35e89eab2e3b46384709af80b847", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "0dd7f8cddd8473a9d2f38306afe4fc88feedfcf28fe522f34d7029d1ca01a935", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "8e3f2a47c5702ef6b7340259e299093f2ac21ccbd5b13c45c5bca899c1061df5", + "crates/horizon-world/examples/simple_block_fixture.rs": "9f8486c812562f4b9fb9745cc0a3f2057d77913e8df2610e98f2a73e391680af" + }, + "fixtures_sha256": { + ".local/rust-biome-weather-parity/inputs.txt": "01d4eb76ac3453640ee0234667b4a3dccdc17696f8fd25eca9abc2686b717891", + ".local/rust-biome-weather-parity/block-properties.nbt": "1aba22092f70d16b8092014c058ddc210e4aaa77bac32f6ec62e4d0e91d92a99", + ".local/rust-biome-weather-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-biome-weather-parity/cached-collision.nbt": "f3a5c6a5b2d51dad6c52e486e2b9989e79fd55db1a9bda6196db399550b04078", + ".local/rust-biome-weather-parity/cached-support.nbt": "b6fdc9471b0b61e904206d3f099f4dc235aad6d723536c210be0cb7c3560d82c", + ".local/rust-biome-weather-parity/catalog.json": "93581107e3564e60261044fdca61e3b7f237b9e6724c14b86e335ccc01198ba9", + ".local/rust-biome-weather-parity/facts.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-biome-weather-parity/feature-catalog.json": "c048c761c5084a40560731955cc999a364d14055bdd86fa50989a92e4a771286", + ".local/rust-biome-weather-parity/fluid-tags.json": "f1e5eb6d22ea7effbb118a2282709cfdeef1bfae4516b775a55ad7a4df29d7d0", + ".local/rust-biome-weather-parity/placement-definitions.json": "f8a972ec87c2352500af6481158a3192bdbf699951025639bea744e4127b97c4", + ".local/rust-biome-weather-parity/support-cached-states.json": "353945a58fe69b352925473f1693f9b14a9ad19f13c15159c4184f2c29258622", + ".local/rust-biome-weather-parity/survival-classes.json": "361832008eea0aa9151d367a125a19c6353d99a0b88b27dd0682f55b7954553e", + ".local/rust-biome-weather-parity/survival-extra-definitions.json": "170f2db5bc97a49fa25cc249540aa7f04beea455cdbaf43742ed9415f5090a02", + ".local/rust-biome-weather-parity/survival-placement-classes.json": "7fdbf48ab18c87098bbe1b6176cb81f4842b6c5d9a4d6bbaf7037ff61cb1848c", + ".local/rust-biome-weather-parity/survival-rules.json": "8805c18b3195bb1eac1f1e5281333df56e2892505f64023e5403c58ce2ec4368", + ".local/rust-biome-weather-parity/survival-support-tags.json": "15d88d5bb5ad10d65124d5abb2cc055d251b06d129bca7be06f55b43dc13f6fd", + ".local/rust-biome-weather-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0" + }, + "rust_output_sha256": "b8558ed7398aa42c9ff464ee50630e24ad6cdef5ce6f9c4e4009f51b7bd3d537", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "b8558ed7398aa42c9ff464ee50630e24ad6cdef5ce6f9c4e4009f51b7bd3d537", + "matched_output_lines": 4071594 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "b8558ed7398aa42c9ff464ee50630e24ad6cdef5ce6f9c4e4009f51b7bd3d537", + "matched_output_lines": 4071594 + } + ], + "scope": "Actual native Biome.shouldFreeze and Biome.shouldSnow using private climate construction for explicit float bits, native temperature modifiers/cache, real fluid identities, real snow survival/support and light/build-height gates. All states are compared as freezing blocks, forced fluid carriers, contained fluids, snow candidates, snow supports and each water-edge neighbor. All neighbor masks, both RNG tails, repeated queries, raw float thresholds/nonfinite values, both temperature modifiers, precipitation flags, light boundaries, sea-level extremes, partial failures and wrapped coordinates are included. Dynamic block entities are absent; lighting propagation, mutation, snow/ice updates and complete weather simulation remain pending. Native per-biome thread-local caches are released only after each independent fixture, retaining repeated-query semantics within it. The fixture mode directly calls biome methods and does not represent a vanilla feature codec." +} diff --git a/crates/horizon-world/examples/simple_block_fixture.rs b/crates/horizon-world/examples/simple_block_fixture.rs index 575dd07ba..e2872a48d 100644 --- a/crates/horizon-world/examples/simple_block_fixture.rs +++ b/crates/horizon-world/examples/simple_block_fixture.rs @@ -17,6 +17,8 @@ use horizon_world::{ registry::{BlockRegistry, BlockStateId}, worldgen::{ anchor::WorldGenerationContext, + biome_temperature::{BiomeTemperature, BiomeTemperatureSettings, TemperatureModifier}, + biome_weather::BiomeWeatherBindings, block_feature::FeatureBlockBindings, feature::{FeatureBlocks, FeatureWorld}, feature_catalog::FeatureCatalog, @@ -158,6 +160,14 @@ impl PlacementContext for World<'_, '_, W, R> { writeln!(self.out, "destroyed {}", self.destroy_success).map_err(query)?; Ok(self.destroy_success) } + fn block_brightness(&mut self, p: [i32; 3]) -> Result { + self.event(format_args!("blocklight {} {} {}", p[0], p[1], p[2])) + .map_err(query)?; + Ok(self.brightness) + } + fn fluid_state(&mut self, p: [i32; 3]) -> Result { + SurvivalWorld::fluid_state(self, p).map_err(query) + } fn sea_level(&mut self) -> Result { Ok(self.sea_level) } @@ -186,7 +196,12 @@ impl PlacementContext for World<'_, '_, W, R> { Ok(()) } fn water_at(&mut self, p: [i32; 3]) -> Result { - Ok(self.fluid_state(p).map_err(query)?.kind().mask() & self.water_mask != 0) + Ok(SurvivalWorld::fluid_state(self, p) + .map_err(query)? + .kind() + .mask() + & self.water_mask + != 0) } fn attachment_at( &mut self, @@ -257,7 +272,14 @@ impl PlacementContext for World<'_, '_, W, R> { .map_err(query) } } +struct WeatherProbe { + bindings: BiomeWeatherBindings, + temperature: BiomeTemperature, + snow: bool, + require_edge: bool, +} enum Feature { + Weather(Box), Map(SimpleBlockFeature), Graph(Box), Placed(Box), @@ -281,6 +303,25 @@ fn fixture( ) -> Result<(), Box> { let json = f["definition"].as_str().unwrap(); let feature = match f["mode"].as_str().unwrap_or("map") { + "weather" => BiomeWeatherBindings::new(feature_bindings).map(|bindings| { + Feature::Weather(Box::new(WeatherProbe { + bindings, + temperature: BiomeTemperature::new(BiomeTemperatureSettings { + base_temperature: f32::from_bits( + u32::from_str_radix(f["base"].as_str().unwrap(), 16).unwrap(), + ), + modifier: if f["modifier"].as_str() == Some("FROZEN") { + TemperatureModifier::Frozen + } else { + TemperatureModifier::None + }, + has_precipitation: f["precipitation"].as_bool().unwrap(), + downfall: 0.0, + }), + snow: f["operation"].as_str() == Some("snow"), + require_edge: f["edge"].as_bool().unwrap(), + })) + }), "map" => { SimpleBlockFeature::from_json(json, providers, catalog, placement).map(Feature::Map) } @@ -328,12 +369,25 @@ fn fixture( }; match feature { Err(_) => writeln!(world.out, "decode error")?, - Ok(feature) => { + Ok(mut feature) => { writeln!(world.out, "decode ok")?; let origin = std::array::from_fn(|i| f["origin"][i].as_i64().unwrap() as i32); for _ in 0..f["repeats"].as_u64().unwrap() { world.calls = 0; - let result = match &feature { + let result = match &mut feature { + Feature::Weather(probe) => if probe.snow { + probe + .bindings + .should_snow(&mut world, &mut probe.temperature, origin) + } else { + probe.bindings.should_freeze( + &mut world, + &mut probe.temperature, + origin, + probe.require_edge, + ) + } + .map_err(|_| ()), Feature::Map(feature) => feature .place(&mut world, &mut random, origin) .map_err(|_| ()), diff --git a/crates/horizon-world/src/worldgen.rs b/crates/horizon-world/src/worldgen.rs index 94268d424..58b2ee8ba 100644 --- a/crates/horizon-world/src/worldgen.rs +++ b/crates/horizon-world/src/worldgen.rs @@ -8,6 +8,7 @@ pub mod biome_chunk; pub mod biome_predicate; pub mod biome_source; pub mod biome_temperature; +pub mod biome_weather; pub mod block_blob; pub mod block_column; pub mod block_feature; diff --git a/crates/horizon-world/src/worldgen/biome_weather.rs b/crates/horizon-world/src/worldgen/biome_weather.rs new file mode 100644 index 000000000..7c58b4d23 --- /dev/null +++ b/crates/horizon-world/src/worldgen/biome_weather.rs @@ -0,0 +1,94 @@ +//! Registry-bound freezing and snow-placement eligibility using biome temperature. +use super::{ + DecodeError, + biome_temperature::{BiomeTemperature, Precipitation}, + block_feature::FeatureBlockBindings, + placement::{PlacementContext, PlacementQueryError}, +}; +use crate::{fluid::FluidKind, registry::BlockStateId}; +use horizon_core::position::BlockPos; +use std::{collections::BTreeSet, sync::Arc}; +#[derive(Clone, Debug)] +pub struct BiomeWeatherBindings { + liquid_blocks: Arc>, + snow_states: Arc>, + snow: BlockStateId, + air: [BlockStateId; 3], +} +impl BiomeWeatherBindings { + pub fn new(bindings: &FeatureBlockBindings<'_>) -> Result { + let mut liquids = BTreeSet::new(); + // WATER and LAVA are the pinned vanilla registry's LiquidBlock instances. + for name in ["minecraft:water", "minecraft:lava"] { + liquids.extend( + bindings + .blocks + .get(name) + .ok_or(DecodeError::Field("weather liquid blocks"))? + .iter() + .copied(), + ); + } + Ok(Self { + liquid_blocks: Arc::new(liquids), + snow_states: bindings + .blocks + .get("minecraft:snow") + .cloned() + .ok_or(DecodeError::Field("weather snow states"))?, + snow: bindings + .registry() + .default_state("minecraft:snow") + .ok_or(DecodeError::Field("weather snow state"))?, + air: bindings.air, + }) + } + pub fn should_freeze( + &self, + world: &mut impl PlacementContext, + temperature: &mut BiomeTemperature, + p: [i32; 3], + require_edge: bool, + ) -> Result { + if temperature.warm_enough_to_rain(BlockPos::new(p[0], p[1], p[2]), world.sea_level()?) { + return Ok(false); + } + if !world.inside_build_height(p)? || world.block_brightness(p)? >= 10 { + return Ok(false); + } + let state = world.block_state(p)?; + let fluid = world.fluid_state(p)?; + if fluid.kind() != FluidKind::Water || !self.liquid_blocks.contains(&state) { + return Ok(false); + } + if !require_edge { + return Ok(true); + } + for d in [[-1, 0, 0], [1, 0, 0], [0, 0, -1], [0, 0, 1]] { + if !world.water_at(std::array::from_fn(|i| p[i].wrapping_add(d[i])))? { + return Ok(true); + } + } + Ok(false) + } + pub fn should_snow( + &self, + world: &mut impl PlacementContext, + temperature: &mut BiomeTemperature, + p: [i32; 3], + ) -> Result { + if temperature.precipitation_at(BlockPos::new(p[0], p[1], p[2]), world.sea_level()?) + != Precipitation::Snow + { + return Ok(false); + } + if !world.inside_build_height(p)? || world.block_brightness(p)? >= 10 { + return Ok(false); + } + let state = world.block_state(p)?; + if !self.air.contains(&state) && !self.snow_states.contains(&state) { + return Ok(false); + } + world.block_survives(self.snow, p) + } +} diff --git a/crates/horizon-world/src/worldgen/placement/context.rs b/crates/horizon-world/src/worldgen/placement/context.rs index 6c3c02ac4..65543e85b 100644 --- a/crates/horizon-world/src/worldgen/placement/context.rs +++ b/crates/horizon-world/src/worldgen/placement/context.rs @@ -26,6 +26,17 @@ pub enum LayerBlock { Ground, } pub trait PlacementContext { + /// Block light only, independently of sky light and sky darkening. + fn block_brightness(&mut self, _position: [i32; 3]) -> Result { + Err(PlacementQueryError::Unavailable) + } + fn fluid_state( + &mut self, + _position: [i32; 3], + ) -> Result { + Err(PlacementQueryError::Unavailable) + } + /// Request destruction with no responsible entity. The world adapter owns /// replacement, drops, block entities and updates; false is a rejected request. fn destroy_block_without_entity( diff --git a/docs/rust-parity.md b/docs/rust-parity.md index bb22d313d..4a6b19e1d 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -626,3 +626,22 @@ rejected writes, partial failures, wrapped positions and composition. Workspace tests, all-target Clippy and all 149 Python tests pass. The fixture supplies a flat ground/air boundary with mutable overrides; fluid behavior, world updates and complete generation remain pending. + +## Biome freezing and snow eligibility + +Registry-bound weather predicates now use the native biome temperature cache, +precipitation selection, build-height and block-light gates. Freezing distinguishes +source water from flowing water, requires a liquid block and optionally checks +water neighbors in west/east/north/south order. Snow accepts air or existing snow +and evaluates the default snow state's actual survival rules. + +The [biome-weather comparison](../benchmarks/rust-biome-weather-2026-10-06/scoped-parity.json) +matches **4,071,594 lines per reference JAR** across **326,057 fixtures**, +covering all states in block/fluid/snow/support/neighbor roles, neighbor masks, +float thresholds and nonfinite temperatures, both temperature modifiers, light +and height boundaries, precipitation flags, repeated queries and partial failures. +Workspace tests and all-target Clippy pass. Native fixture temperature caches +are removed after each independent case to avoid retaining hundreds of thousands +of biomes; repeated queries within a case keep their cache. Dynamic block entities +are absent. Actual weather ticks, lighting propagation and world updates remain +pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java index 5cb19d93c..cb5627754 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java @@ -23,9 +23,26 @@ import net.minecraft.world.level.levelgen.feature.stateproviders.BlockStateProvi /** Actual native simple-block map codec and mutable world placement. */ public final class VanillaSimpleBlockOracle { private static final class Stop extends RuntimeException {} + private static final List> fixtureCaches=new ArrayList<>(); + private static Biome trackBiome(Biome biome)throws ReflectiveOperationException{ + var field=Biome.class.getDeclaredField("temperatureCache");field.setAccessible(true);fixtureCaches.add((ThreadLocal)field.get(biome));return biome; + } private static Optional decode(RegistryOps ops,JsonObject f) { var json=JsonParser.parseString(f.get("definition").getAsString()); String mode=f.has("mode")?f.get("mode").getAsString():"map"; + if(mode.equals("weather")){ + final Biome biome; + try{ + var type=Class.forName("net.minecraft.world.level.biome.Biome$ClimateSettings"); + var climate=type.getDeclaredConstructor(boolean.class,float.class,Biome.TemperatureModifier.class,float.class);climate.setAccessible(true); + var settings=climate.newInstance(f.get("precipitation").getAsBoolean(),Float.intBitsToFloat(Integer.parseUnsignedInt(f.get("base").getAsString(),16)),Biome.TemperatureModifier.valueOf(f.get("modifier").getAsString()),0f); + var constructor=Biome.class.getDeclaredConstructors()[0];constructor.setAccessible(true);biome=trackBiome((Biome)constructor.newInstance(settings,null,null,null)); + }catch(ReflectiveOperationException error){throw new IllegalStateException(error);} + return Optional.of(new Feature(){ + public com.mojang.serialization.MapCodec codec(){return com.mojang.serialization.MapCodec.unit(this);} + public boolean place(WorldGenLevel world,ChunkGenerator generator,RandomSource random,BlockPos p){return f.get("operation").getAsString().equals("snow")?biome.shouldSnow(world,p):biome.shouldFreeze(world,p,f.get("edge").getAsBoolean());} + }); + } if(mode.equals("map"))return SimpleBlockFeature.CODEC.codec().parse(ops,json).result().map(value->value); if(mode.equals("feature"))return Feature.CODEC.parse(ops,json).result().map(Holder::value); return PlacedFeature.CODEC.parse(ops,json).result().map(holder->new Feature(){ @@ -67,6 +84,7 @@ public final class VanillaSimpleBlockOracle { if(name.equals("getSeaLevel"))return f.has("sea")?f.get("sea").getAsInt():63; if(name.equals("getBlockState")){var p=(BlockPos)args[0];event("get "+xyz(p));var state=at(p);out.println("state "+Block.getId(state));return state;} if(name.equals("getFluidState")){var p=(BlockPos)args[0];event("fluid "+xyz(p));return (f.has("fluid")?Block.stateById(f.get("fluid").getAsInt()):at(p)).getFluidState();} + if(name.equals("getBrightness")&&args[0]==LightLayer.BLOCK){event("blocklight "+xyz((BlockPos)args[1]));return f.get("brightness").getAsInt();} if(name.equals("getRawBrightness")){var p=(BlockPos)args[0];event("light "+xyz(p)+" "+args[1]);return f.get("brightness").getAsInt();} if(name.equals("getBlockEntity")){event("entity "+xyz((BlockPos)args[0]));return null;} if(name.equals("destroyBlock")){ @@ -130,6 +148,7 @@ public final class VanillaSimpleBlockOracle { for(var entry:handler.states.entrySet())out.println("stored "+xyz(entry.getKey())+" "+Block.getId(entry.getValue()));out.println("end"); } }out.println("tail "+random.nextLong()+" "+worldRandom.nextLong()); + for(var cache:fixtureCaches)cache.remove();fixtureCaches.clear(); } } } diff --git a/tools/test_biome_weather_parity.py b/tools/test_biome_weather_parity.py new file mode 100644 index 000000000..8845ccc4b --- /dev/null +++ b/tools/test_biome_weather_parity.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python3 +"""Compare native biome freezing and snow eligibility over real block states.""" +import itertools +try: + from . import test_simple_block_parity as harness +except ImportError: + import test_simple_block_parity as harness + + +def corpus(facts, placement): + states = facts['states']; get = lambda name: facts['defaults']['minecraft:' + name] + directions = [(-1, 0, 0), (1, 0, 0), (0, 0, -1), (0, 0, 1)] + def case(operation='freeze', **extra): + origin = extra.pop('origin', [0, 64, 0]) + value = {'definition': '{}', 'mode': 'weather', 'operation': operation, + 'base': '0', 'modifier': 'NONE', 'precipitation': True, 'edge': False, + 'origin': origin, 'legacy': False, 'seed': 0, 'world_seed': 1, + 'fail': -1, 'reject': 0, 'brightness': 0, 'sea': 63, + 'fallback': get('stone'), 'states': [[*origin, get('water' if operation == 'freeze' else 'air')]], 'repeats': 1} + value.update(extra); return value + for state in range(len(states)): + yield case(states=[[0, 64, 0, state]]) + yield case(states=[[0, 64, 0, state]], fluid=get('water')) + yield case(fluid=state) + yield case('snow', states=[[0, 64, 0, state]]) + yield case('snow', states=[[0, 64, 0, get('air')], [0, 63, 0, state]]) + for x, y, z in directions: + yield case(edge=True, fallback=get('water'), states=[[x, 64+y, z, state]]) + for mask, legacy, fail in itertools.product(range(16), [False, True], [-1, 0, 1, 2, 3, 4, 5, 6]): + yield case(edge=True, legacy=legacy, fail=fail, + states=[[0, 64, 0, get('water')], *[[x, 64+y, z, get('water') if mask & (1 << i) else get('stone')] for i, (x, y, z) in enumerate(directions)]]) + for operation, base, modifier, precipitation, y, light in itertools.product( + ['freeze', 'snow'], ['0', '80000000', '3e199999', '3e19999a', '3e19999b', '3e4ccccd', '3f800000', 'bf800000', '7f800000', 'ff800000', '7fc00000', 'ffc00001'], + ['NONE', 'FROZEN'], [False, True], [-65, -64, 0, 64, 80, 81, 319, 320], [-1, 0, 9, 10, 15]): + yield case(operation, base=base, modifier=modifier, precipitation=precipitation, origin=[12345, y, -9876], brightness=light, repeats=2) + for operation, legacy, sea, fail in itertools.product(['freeze', 'snow'], [False, True], [-2147483648, -1000, 0, 63, 2147483647], [-1, 0, 1, 2, 3, 4, 5, 6]): + yield case(operation, origin=[2147483647, 64, -2147483648], legacy=legacy, sea=sea, fail=fail, edge=True, repeats=2) + for operation, origin in itertools.product(['freeze', 'snow'], [[0, -2147483648, 0], [0, 2147483647, 0], [-2147483648, -64, 2147483647]]): + yield case(operation, origin=origin, edge=True) + for name, level, legacy in itertools.product(['air', 'cave_air', 'void_air', 'snow', 'water', 'oak_slab', 'honey_block', 'ice', 'packed_ice'], range(16), [False, True]): + yield case('snow', states=[[0, 64, 0, get(name)], [0, 63, 0, get('stone')]], brightness=level, legacy=legacy) + + +if __name__ == '__main__': + harness.run(corpus, 'rust-biome-weather-parity', __file__, + 'Actual native Biome.shouldFreeze and Biome.shouldSnow using private climate construction for explicit float bits, native temperature modifiers/cache, real fluid identities, real snow survival/support and light/build-height gates. All states are compared as freezing blocks, forced fluid carriers, contained fluids, snow candidates, snow supports and each water-edge neighbor. All neighbor masks, both RNG tails, repeated queries, raw float thresholds/nonfinite values, both temperature modifiers, precipitation flags, light boundaries, sea-level extremes, partial failures and wrapped coordinates are included. Dynamic block entities are absent; lighting propagation, mutation, snow/ice updates and complete weather simulation remain pending. Native per-biome thread-local caches are released only after each independent fixture, retaining repeated-query semantics within it. The fixture mode directly calls biome methods and does not represent a vanilla feature codec.') From fd3416da36a72c0a7e1e51d5aec51cd3e3827245 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 13:32:39 +0200 Subject: [PATCH 026/253] Implement frozen top layers and snowy ground updates --- .github/workflows/ci.yml | 4 + .../scoped-parity.json | 217 ++++++++++++++++++ .../examples/simple_block_fixture.rs | 69 ++++++ crates/horizon-world/src/worldgen.rs | 1 + .../src/worldgen/feature_graph.rs | 10 + .../src/worldgen/placement/context.rs | 17 ++ .../horizon-world/src/worldgen/snow_freeze.rs | 115 ++++++++++ docs/rust-parity.md | 16 ++ .../parity/VanillaSimpleBlockOracle.java | 21 +- tools/test_snow_freeze_parity.py | 42 ++++ 10 files changed, 503 insertions(+), 9 deletions(-) create mode 100644 benchmarks/rust-snow-freeze-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-world/src/worldgen/snow_freeze.rs create mode 100644 tools/test_snow_freeze_parity.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 30b6eb54c..5f3ffc832 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -163,6 +163,10 @@ jobs: env: RUSTUP_TOOLCHAIN: stable run: python tools/test_biome_weather_parity.py + - name: Compare frozen top layers and snowy ground updates + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_snow_freeze_parity.py - name: Compare ordered single-block replacement features env: RUSTUP_TOOLCHAIN: stable diff --git a/benchmarks/rust-snow-freeze-2026-10-06/scoped-parity.json b/benchmarks/rust-snow-freeze-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..3219ea284 --- /dev/null +++ b/benchmarks/rust-snow-freeze-2026-10-06/scoped-parity.json @@ -0,0 +1,217 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 108339, + "candidate_states": 35723, + "double_plant_blocks": 10, + "mossy_carpet_blocks": 1, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java": "4112535c68bfa231d377915112093da8ac776abe0c245e3b1c0cb2d0e3db4d5c", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSurvivalOracle.java": "4e7cc151617c1b02e872f9ca3e9fe4632379f225f4f07718ff6492df4ee551e7", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java": "e871d3a01f15616a98ca9227c27a81e4d17e2d57ac4e68a5650a70fa29811497", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSupportOracle.java": "04350901a2d708fb8fa672de61d058f73f332d2e90df1b93a67781862f89c1ad", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "60ff9ef7c1d5e23c080f9aec95ab2e7d3b7c5b5bcd67b9efa9518776c400629a", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_simple_block_parity.py": "50b783323051fe8cd369bb733448b0314f1e6e7994a950e4cb6cd2fe4f7f8e11", + "tools/test_snow_freeze_parity.py": "eed35be29a720748423bc51a1fdc7d30ec0b98a161ee61fb6c876f4eac866720", + "tools/test_block_survival_parity.py": "9e8dff3bd4b95dbfd29f8adc6a2f6d66abf19a6b1cd91423b794a345d4ec244a", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "84852599dde78687d782f115a5b4b3ef6856c1f9cc92917255167e89c72ab01e", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "a8cd85f6223668c1446ff103276d80937b9707d9a7dc619a176b1b1ceed36a4a", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "1eae82604d2b3377fd35aaa3a914a67e5af28f93923815a49e895b4d437433cd", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "5ce5c6eaa5f8a2557a620e533788217b1eb430654801dcf6135d6c92d7a012ac", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "98bc93dff1373e3b6f4dcf8c4c2b05b56814acd4f66302834aa5877fe90ec7b9", + "crates/horizon-world/src/worldgen/feature_region.rs": "79e8ce343b0dc80dceb8b214c818b383d9b110540bb8c3b0ac32863a7800e288", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "e682d13a21f90605215b79f5d254bf2e524d35e89eab2e3b46384709af80b847", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "b7a59a712d2e376e8f32ec1e1fd901df452c8019e06910c39d469816be63a14f", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "7fb7130111654563f7217f7b84563adde0b11c3ebd6a499a514dc98ebef7c733", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "072d31a3b814eda9cc9bdc1da06a7dab43c38f133824bfd00f55ebb8452d8b88", + "crates/horizon-world/examples/simple_block_fixture.rs": "0e5cd53dc3208f53a71a80ac6d85ff9914c04c09c3d788ea1bb6606f9ae840b8" + }, + "fixtures_sha256": { + ".local/rust-snow-freeze-parity/inputs.txt": "909f7749270bf043415bb0d555298b09df23f175d32438fcb72ed4d0c0dd0372", + ".local/rust-snow-freeze-parity/block-properties.nbt": "1aba22092f70d16b8092014c058ddc210e4aaa77bac32f6ec62e4d0e91d92a99", + ".local/rust-snow-freeze-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-snow-freeze-parity/cached-collision.nbt": "f3a5c6a5b2d51dad6c52e486e2b9989e79fd55db1a9bda6196db399550b04078", + ".local/rust-snow-freeze-parity/cached-support.nbt": "b6fdc9471b0b61e904206d3f099f4dc235aad6d723536c210be0cb7c3560d82c", + ".local/rust-snow-freeze-parity/catalog.json": "93581107e3564e60261044fdca61e3b7f237b9e6724c14b86e335ccc01198ba9", + ".local/rust-snow-freeze-parity/facts.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-snow-freeze-parity/feature-catalog.json": "c048c761c5084a40560731955cc999a364d14055bdd86fa50989a92e4a771286", + ".local/rust-snow-freeze-parity/fluid-tags.json": "f1e5eb6d22ea7effbb118a2282709cfdeef1bfae4516b775a55ad7a4df29d7d0", + ".local/rust-snow-freeze-parity/placement-definitions.json": "f8a972ec87c2352500af6481158a3192bdbf699951025639bea744e4127b97c4", + ".local/rust-snow-freeze-parity/support-cached-states.json": "353945a58fe69b352925473f1693f9b14a9ad19f13c15159c4184f2c29258622", + ".local/rust-snow-freeze-parity/survival-classes.json": "361832008eea0aa9151d367a125a19c6353d99a0b88b27dd0682f55b7954553e", + ".local/rust-snow-freeze-parity/survival-extra-definitions.json": "170f2db5bc97a49fa25cc249540aa7f04beea455cdbaf43742ed9415f5090a02", + ".local/rust-snow-freeze-parity/survival-placement-classes.json": "7fdbf48ab18c87098bbe1b6176cb81f4842b6c5d9a4d6bbaf7037ff61cb1848c", + ".local/rust-snow-freeze-parity/survival-rules.json": "8805c18b3195bb1eac1f1e5281333df56e2892505f64023e5403c58ce2ec4368", + ".local/rust-snow-freeze-parity/survival-support-tags.json": "15d88d5bb5ad10d65124d5abb2cc055d251b06d129bca7be06f55b43dc13f6fd", + ".local/rust-snow-freeze-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0" + }, + "rust_output_sha256": "81796448aa1639d911c29bcf2cdd6142aa55c6b1d8414194b3365504d565e195", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "81796448aa1639d911c29bcf2cdd6142aa55c6b1d8414194b3365504d565e195", + "matched_output_lines": 7764082 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "81796448aa1639d911c29bcf2cdd6142aa55c6b1d8414194b3365504d565e195", + "matched_output_lines": 7764082 + } + ], + "scope": "Native SnowAndFreezeFeature unit codec, 16x16 X-then-Z traversal, MOTION_BLOCKING heights, one biome lookup per column retained across freeze/snow checks, actual biome temperature/freezing/snow predicates, ice-before-snow mutation, snowy ground state changes after attempted snow writes, flags 2 and unconditional normal success. Every ground, snow candidate and fluid-state carrier is compared through failure-terminated prefixes. Full runs cover climate thresholds/NaN, both modifiers, precipitation, light gates, both unchanged RNGs, repeated mutations/cache use, rejected writes, partial failures, extreme heights/sea levels, wrapped X/Z and composition. Fixture heights and a single biome are controlled; actual lighting, dynamic biome selection, world update execution and full generation remain pending. Native temperature caches are released after each independent fixture." +} diff --git a/crates/horizon-world/examples/simple_block_fixture.rs b/crates/horizon-world/examples/simple_block_fixture.rs index e2872a48d..7a9c56a26 100644 --- a/crates/horizon-world/examples/simple_block_fixture.rs +++ b/crates/horizon-world/examples/simple_block_fixture.rs @@ -17,6 +17,7 @@ use horizon_world::{ registry::{BlockRegistry, BlockStateId}, worldgen::{ anchor::WorldGenerationContext, + biome::BiomeId, biome_temperature::{BiomeTemperature, BiomeTemperatureSettings, TemperatureModifier}, biome_weather::BiomeWeatherBindings, block_feature::FeatureBlockBindings, @@ -54,6 +55,7 @@ struct World<'a, 'r, W, R> { sea_level: i32, surface_height: i32, air_above: Option, + biome: Option<(BiomeWeatherBindings, BiomeTemperature)>, air: BlockStateId, destroy_success: bool, } @@ -146,7 +148,52 @@ impl FeatureWorld for World<'_, '_, W, R> { fn query(error: impl std::fmt::Display) -> PlacementQueryError { PlacementQueryError::Failed(error.to_string()) } +impl World<'_, '_, W, R> { + fn weather( + &mut self, + biome: BiomeId, + p: [i32; 3], + snow: bool, + edge: bool, + ) -> Result { + if biome != BiomeId(0) { + return Err(PlacementQueryError::Unavailable); + } + let (bindings, mut temperature) = + self.biome.take().ok_or(PlacementQueryError::Unavailable)?; + let result = if snow { + bindings.should_snow(self, &mut temperature, p) + } else { + bindings.should_freeze(self, &mut temperature, p, edge) + }; + self.biome = Some((bindings, temperature)); + result + } +} impl PlacementContext for World<'_, '_, W, R> { + fn biome_identity(&mut self, p: [i32; 3]) -> Result { + self.event(format_args!("biome {} {} {}", p[0], p[1], p[2])) + .map_err(query)?; + if self.biome.is_none() { + return Err(PlacementQueryError::Unavailable); + } + Ok(BiomeId(0)) + } + fn biome_should_freeze( + &mut self, + biome: BiomeId, + p: [i32; 3], + edge: bool, + ) -> Result { + self.weather(biome, p, false, edge) + } + fn biome_should_snow( + &mut self, + biome: BiomeId, + p: [i32; 3], + ) -> Result { + self.weather(biome, p, true, false) + } fn destroy_block_without_entity( &mut self, p: [i32; 3], @@ -332,7 +379,29 @@ fn fixture( .placed_feature_with_blocks(json, feature_bindings) .map(|v| Feature::Placed(Box::new(v))), }; + let biome = f + .get("biome") + .map(|value| -> Result<_, Box> { + Ok(( + BiomeWeatherBindings::new(feature_bindings)?, + BiomeTemperature::new(BiomeTemperatureSettings { + base_temperature: f32::from_bits(u32::from_str_radix( + value["base"].as_str().unwrap(), + 16, + )?), + modifier: if value["modifier"].as_str() == Some("FROZEN") { + TemperatureModifier::Frozen + } else { + TemperatureModifier::None + }, + has_precipitation: value["precipitation"].as_bool().unwrap(), + downfall: 0.0, + }), + )) + }) + .transpose()?; let mut world = World { + biome, out, random: world_random, states: f["states"] diff --git a/crates/horizon-world/src/worldgen.rs b/crates/horizon-world/src/worldgen.rs index 58b2ee8ba..f4adfc092 100644 --- a/crates/horizon-world/src/worldgen.rs +++ b/crates/horizon-world/src/worldgen.rs @@ -42,6 +42,7 @@ pub mod router; pub mod rule_test; pub mod settings; pub mod simple_block; +pub mod snow_freeze; pub mod spike; pub mod spring; pub mod state_provider; diff --git a/crates/horizon-world/src/worldgen/feature_graph.rs b/crates/horizon-world/src/worldgen/feature_graph.rs index 2a2d09281..b08d90857 100644 --- a/crates/horizon-world/src/worldgen/feature_graph.rs +++ b/crates/horizon-world/src/worldgen/feature_graph.rs @@ -49,6 +49,7 @@ pub enum FeatureDefinition { Disk(super::disk::DiskFeature), Spring(super::spring::SpringFeature), Vines(super::vines::VinesFeature), + SnowAndFreeze(super::snow_freeze::SnowAndFreezeFeature), Delta(super::delta::DeltaFeature), Bamboo(super::bamboo::BambooFeature), ReplaceBlobs(super::replace_blobs::ReplaceBlobsFeature), @@ -80,6 +81,7 @@ pub enum FeatureExecutionError { BlockPile(super::block_pile::BlockPileError), Disk(super::disk::DiskError), BlockBlob(super::block_blob::BlockBlobError), + SnowAndFreeze(super::snow_freeze::SnowAndFreezeError), Delta(super::delta::DeltaError), Bamboo(super::bamboo::BambooError), ReplaceBlobs(super::replace_blobs::ReplaceBlobsError), @@ -102,6 +104,7 @@ impl std::fmt::Display for FeatureExecutionError { Self::BlockPile(e) => e.fmt(f), Self::Disk(e) => e.fmt(f), Self::BlockBlob(e) => e.fmt(f), + Self::SnowAndFreeze(e) => e.fmt(f), Self::Delta(e) => e.fmt(f), Self::Bamboo(e) => e.fmt(f), Self::ReplaceBlobs(e) => e.fmt(f), @@ -275,6 +278,10 @@ impl FeatureDefinition { )?)?; match kind.as_str() { "minecraft:no_op" => Ok(Self::NoOp), + "minecraft:freeze_top_layer" => super::snow_freeze::SnowAndFreezeFeature::new( + blocks.ok_or(DecodeError::Field("snow and freeze bindings"))?, + ) + .map(Self::SnowAndFreeze), "minecraft:delta_feature" => super::delta::DeltaFeature::decode( json, blocks.ok_or(DecodeError::Field("delta bindings"))?, @@ -647,6 +654,9 @@ impl FeatureDefinition { .place(world, random, origin, run.blocks) .map_err(FeatureExecutionError::Basic), Self::NoOp => Ok(true), + Self::SnowAndFreeze(feature) => feature + .place(world, origin) + .map_err(FeatureExecutionError::SnowAndFreeze), Self::Delta(feature) => feature .place(world, random, origin) .map_err(FeatureExecutionError::Delta), diff --git a/crates/horizon-world/src/worldgen/placement/context.rs b/crates/horizon-world/src/worldgen/placement/context.rs index 65543e85b..07f980c4a 100644 --- a/crates/horizon-world/src/worldgen/placement/context.rs +++ b/crates/horizon-world/src/worldgen/placement/context.rs @@ -26,6 +26,23 @@ pub enum LayerBlock { Ground, } pub trait PlacementContext { + /// Use the previously resolved biome, retaining its temperature cache. + fn biome_should_freeze( + &mut self, + _biome: crate::worldgen::biome::BiomeId, + _position: [i32; 3], + _require_edge: bool, + ) -> Result { + Err(PlacementQueryError::Unavailable) + } + fn biome_should_snow( + &mut self, + _biome: crate::worldgen::biome::BiomeId, + _position: [i32; 3], + ) -> Result { + Err(PlacementQueryError::Unavailable) + } + /// Block light only, independently of sky light and sky darkening. fn block_brightness(&mut self, _position: [i32; 3]) -> Result { Err(PlacementQueryError::Unavailable) diff --git a/crates/horizon-world/src/worldgen/snow_freeze.rs b/crates/horizon-world/src/worldgen/snow_freeze.rs new file mode 100644 index 000000000..776336925 --- /dev/null +++ b/crates/horizon-world/src/worldgen/snow_freeze.rs @@ -0,0 +1,115 @@ +//! Freeze exposed water and place snow across a 16-by-16 feature footprint. +use super::{ + DecodeError, + block_feature::FeatureBlockBindings, + feature::FeatureWorld, + placement::{PlacementContext, PlacementQueryError}, +}; +use crate::{heightmap::HeightmapType, registry::BlockStateId}; +use std::{collections::BTreeMap, sync::Arc}; +#[derive(Clone, Debug)] +pub struct SnowAndFreezeFeature { + ice: BlockStateId, + snow: BlockStateId, + snowy: Arc>, +} +#[derive(Debug)] +pub enum SnowAndFreezeError { + World(E), + Query(PlacementQueryError), +} +impl std::fmt::Display for SnowAndFreezeError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::World(e) => e.fmt(f), + Self::Query(e) => e.fmt(f), + } + } +} +impl std::error::Error for SnowAndFreezeError {} +impl SnowAndFreezeFeature { + pub fn new(bindings: &FeatureBlockBindings<'_>) -> Result { + let registry = bindings.registry(); + let get = |name| { + registry + .default_state(name) + .ok_or_else(|| DecodeError::Registry(format!("unknown freezing block {name}"))) + }; + // These are the pinned registry's blocks with SnowyBlock.SNOWY. + let mut snowy = BTreeMap::new(); + for name in [ + "minecraft:grass_block", + "minecraft:podzol", + "minecraft:mycelium", + ] { + for state in bindings + .blocks + .get(name) + .ok_or(DecodeError::Field("snowy block"))? + .iter() + { + let mut descriptor = registry + .state(*state) + .ok_or(DecodeError::Field("snowy state"))? + .clone(); + descriptor + .properties + .insert("snowy".to_owned(), "true".to_owned()); + snowy.insert( + *state, + registry + .id(&descriptor) + .ok_or(DecodeError::Field("snowy true state"))?, + ); + } + } + Ok(Self { + ice: get("minecraft:ice")?, + snow: get("minecraft:snow")?, + snowy: Arc::new(snowy), + }) + } + pub fn place( + &self, + world: &mut W, + origin: [i32; 3], + ) -> Result> { + for dx in 0..16 { + for dz in 0..16 { + let x = origin[0].wrapping_add(dx); + let z = origin[2].wrapping_add(dz); + let y = world + .height(HeightmapType::MotionBlocking, x, z) + .map_err(SnowAndFreezeError::Query)?; + let top = [x, y, z]; + let below = [x, y.wrapping_sub(1), z]; + let biome = world + .biome_identity(top) + .map_err(SnowAndFreezeError::Query)?; + if world + .biome_should_freeze(biome, below, false) + .map_err(SnowAndFreezeError::Query)? + { + world + .set_block(below, self.ice, 2) + .map_err(SnowAndFreezeError::World)?; + } + if world + .biome_should_snow(biome, top) + .map_err(SnowAndFreezeError::Query)? + { + world + .set_block(top, self.snow, 2) + .map_err(SnowAndFreezeError::World)?; + let state = world.block(below).map_err(SnowAndFreezeError::World)?; + if let Some(state) = self.snowy.get(&state) { + world + .set_block(below, *state, 2) + .map_err(SnowAndFreezeError::World)?; + } + } + } + } + Ok(true) + } +} diff --git a/docs/rust-parity.md b/docs/rust-parity.md index 4a6b19e1d..3deb7bacc 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -645,3 +645,19 @@ are removed after each independent case to avoid retaining hundreds of thousands of biomes; repeated queries within a case keep their cache. Dynamic block entities are absent. Actual weather ticks, lighting propagation and world updates remain pending. + +## Frozen top layers and snowy ground + +The `freeze_top_layer` feature now visits its 16×16 footprint in native column +order, queries motion-blocking height and retains the selected biome for both +weather checks. Ice is attempted before snow eligibility. Snow attempts are +followed by snowy ground-property updates even if the snow write was rejected. + +The [snow/freezing feature comparison](../benchmarks/rust-snow-freeze-2026-10-06/scoped-parity.json) +matches **7,764,082 lines per reference JAR** over **108,339 fixtures**. Every +ground/candidate/fluid state has a failure-terminated prefix; full runs cover +climate thresholds and NaN, both modifiers, precipitation, light gates, repeated +mutations, rejected writes, partial failures, extreme heights/sea levels, wrapped +coordinates and composition. Workspace tests and all-target Clippy pass. The +fixture uses controlled heights and one biome; lighting propagation, dynamic +biome selection, world updates and full generation remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java index cb5627754..ef49084b0 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java @@ -31,13 +31,7 @@ public final class VanillaSimpleBlockOracle { var json=JsonParser.parseString(f.get("definition").getAsString()); String mode=f.has("mode")?f.get("mode").getAsString():"map"; if(mode.equals("weather")){ - final Biome biome; - try{ - var type=Class.forName("net.minecraft.world.level.biome.Biome$ClimateSettings"); - var climate=type.getDeclaredConstructor(boolean.class,float.class,Biome.TemperatureModifier.class,float.class);climate.setAccessible(true); - var settings=climate.newInstance(f.get("precipitation").getAsBoolean(),Float.intBitsToFloat(Integer.parseUnsignedInt(f.get("base").getAsString(),16)),Biome.TemperatureModifier.valueOf(f.get("modifier").getAsString()),0f); - var constructor=Biome.class.getDeclaredConstructors()[0];constructor.setAccessible(true);biome=trackBiome((Biome)constructor.newInstance(settings,null,null,null)); - }catch(ReflectiveOperationException error){throw new IllegalStateException(error);} + final Biome biome=makeBiome(f); return Optional.of(new Feature(){ public com.mojang.serialization.MapCodec codec(){return com.mojang.serialization.MapCodec.unit(this);} public boolean place(WorldGenLevel world,ChunkGenerator generator,RandomSource random,BlockPos p){return f.get("operation").getAsString().equals("snow")?biome.shouldSnow(world,p):biome.shouldFreeze(world,p,f.get("edge").getAsBoolean());} @@ -50,6 +44,14 @@ public final class VanillaSimpleBlockOracle { public boolean place(WorldGenLevel world,ChunkGenerator generator,RandomSource random,BlockPos p){return holder.value().place(world,generator,random,p);} }); } + private static Biome makeBiome(JsonObject f){ + try{ + var type=Class.forName("net.minecraft.world.level.biome.Biome$ClimateSettings"); + var climate=type.getDeclaredConstructor(boolean.class,float.class,Biome.TemperatureModifier.class,float.class);climate.setAccessible(true); + var settings=climate.newInstance(f.get("precipitation").getAsBoolean(),Float.intBitsToFloat(Integer.parseUnsignedInt(f.get("base").getAsString(),16)),Biome.TemperatureModifier.valueOf(f.get("modifier").getAsString()),0f); + var constructor=Biome.class.getDeclaredConstructors()[0];constructor.setAccessible(true);return trackBiome((Biome)constructor.newInstance(settings,null,null,null)); + }catch(ReflectiveOperationException error){throw new IllegalStateException(error);} + } private static BlockPos pos(JsonArray a){return new BlockPos(a.get(0).getAsInt(),a.get(1).getAsInt(),a.get(2).getAsInt());} private static String xyz(BlockPos p){return p.getX()+" "+p.getY()+" "+p.getZ();} private static final class Chunks { @@ -61,9 +63,9 @@ public final class VanillaSimpleBlockOracle { } } private static final class World implements InvocationHandler { - final JsonObject f;final PrintWriter out;final RandomSource random;int calls; + final JsonObject f;final PrintWriter out;final RandomSource random;final Holder biome;int calls; final TreeMap states=new TreeMap<>(Comparator.comparingInt(BlockPos::getX).thenComparingInt(BlockPos::getY).thenComparingInt(BlockPos::getZ)); - World(JsonObject f,PrintWriter out,RandomSource random){this.f=f;this.out=out;this.random=random;for(var raw:f.getAsJsonArray("states")){var v=raw.getAsJsonArray();states.put(pos(v),Block.stateById(v.get(3).getAsInt()));}} + World(JsonObject f,PrintWriter out,RandomSource random){this.f=f;this.out=out;this.random=random;this.biome=f.has("biome")?Holder.direct(makeBiome(f.getAsJsonObject("biome"))):null;for(var raw:f.getAsJsonArray("states")){var v=raw.getAsJsonArray();states.put(pos(v),Block.stateById(v.get(3).getAsInt()));}} final Map chunks=new HashMap<>(); ProtoChunk chunk(BlockPos p) { event("chunk "+xyz(p));var key=new ChunkPos(p.getX()>>4,p.getZ()>>4); @@ -75,6 +77,7 @@ public final class VanillaSimpleBlockOracle { BlockState at(BlockPos p){return states.getOrDefault(p,f.has("air_above")&&p.getY()>f.get("air_above").getAsInt()?Blocks.AIR.defaultBlockState():Block.stateById(f.get("fallback").getAsInt()));} public Object invoke(Object proxy,Method method,Object[] args)throws Throwable { String name=method.getName(); + if(name.equals("getBiome")){event("biome "+xyz((BlockPos)args[0]));if(biome==null)throw new IllegalStateException("missing fixture biome");return biome;} if(name.equals("getRandom"))return random; if(name.equals("isStateAtPosition")){var p=(BlockPos)args[0];event("get "+xyz(p));var state=at(p);out.println("state "+Block.getId(state));return ((java.util.function.Predicate)args[1]).test(state);} if(name.equals("getChunk")&&args.length==1&&args[0] instanceof BlockPos)return chunk((BlockPos)args[0]); diff --git a/tools/test_snow_freeze_parity.py b/tools/test_snow_freeze_parity.py new file mode 100644 index 000000000..8cf412dbf --- /dev/null +++ b/tools/test_snow_freeze_parity.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +"""Compare top-layer ice, snow, biome queries and snowy ground mutations.""" +import itertools +import json +try: + from . import test_simple_block_parity as harness +except ImportError: + import test_simple_block_parity as harness + + +def corpus(facts, placement): + states = facts['states']; get = lambda name: facts['defaults']['minecraft:' + name] + def case(**extra): + value = {'definition': '{"type":"freeze_top_layer"}', 'mode': 'feature', + 'biome': {'base': '0', 'modifier': 'NONE', 'precipitation': True}, + 'origin': [0, 100, 0], 'height': 65, 'air_above': 64, 'legacy': False, 'seed': 0, 'world_seed': 1, + 'fail': -1, 'reject': 0, 'brightness': 0, 'sea': 63, 'fallback': get('grass_block'), 'states': [], 'repeats': 1} + value.update(extra); return value + for state in range(len(states)): + yield case(fallback=state, fail=24) + yield case(states=[[0, 65, 0, state]], fail=24) + yield case(fallback=get('water'), fluid=state, fail=24) + for base, modifier, precipitation, light, name, legacy in itertools.product( + ['0', '3e199999', '3e19999a', '3e4ccccd', '7fc00000'], ['NONE', 'FROZEN'], [False, True], [0, 9, 10], + ['grass_block', 'podzol', 'mycelium', 'water', 'ice', 'stone', 'air', 'snow'], [False, True]): + yield case(biome={'base': base, 'modifier': modifier, 'precipitation': precipitation}, brightness=light, fallback=get(name), legacy=legacy, repeats=2) + for name, fail, reject in itertools.product(['water', 'grass_block', 'podzol', 'mycelium', 'stone'], [-1, 0, 1, 2, 3, 5, 9, 17, 31, 100], [0, 1, 3]): + yield case(fallback=get(name), fail=fail, reject=reject, repeats=2) + for y, sea in itertools.product([-2147483648, -64, -63, 0, 64, 80, 81, 319, 320, 2147483647], [-2147483648, 0, 63, 2147483647]): + yield case(height=y, air_above=y-1 if y>-2147483648 else y, sea=sea, repeats=2) + for origin in [[-17, -2147483648, -33], [2147483647, 2147483647, -2147483648], [-2147483648, 0, 2147483647]]: + yield case(origin=origin, repeats=2) + yield case(definition='{"type":"freeze_top_layer","ignored":null}') + for fail, reject in itertools.product([-1, 0, 9, 101], [0, 3]): + placed = {'feature': {'type': 'freeze_top_layer'}, 'placement': [{'type': 'count', 'count': 2}]} + yield case(definition=json.dumps(placed), mode='placed', fail=fail, reject=reject) + yield case(definition=json.dumps({'type': 'overlay', 'features': [placed, {'feature': 'horizon:moss', 'placement': []}]}), fail=fail, reject=reject) + + +if __name__ == '__main__': + harness.run(corpus, 'rust-snow-freeze-parity', __file__, + 'Native SnowAndFreezeFeature unit codec, 16x16 X-then-Z traversal, MOTION_BLOCKING heights, one biome lookup per column retained across freeze/snow checks, actual biome temperature/freezing/snow predicates, ice-before-snow mutation, snowy ground state changes after attempted snow writes, flags 2 and unconditional normal success. Every ground, snow candidate and fluid-state carrier is compared through failure-terminated prefixes. Full runs cover climate thresholds/NaN, both modifiers, precipitation, light gates, both unchanged RNGs, repeated mutations/cache use, rejected writes, partial failures, extreme heights/sea levels, wrapped X/Z and composition. Fixture heights and a single biome are controlled; actual lighting, dynamic biome selection, world update execution and full generation remain pending. Native temperature caches are released after each independent fixture.') From 1cf1322ae281343b2157d6c7298d6b0c1156e6fe Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 13:39:19 +0200 Subject: [PATCH 027/253] Implement proto-chunk ticks and world-generation tick routing --- .github/workflows/ci.yml | 4 + .../scoped-parity.json | 110 ++++++++++ .../examples/generation_tick_fixture.rs | 188 ++++++++++++++++++ crates/horizon-core/src/ticks/generation.rs | 110 ++++++++++ crates/horizon-core/src/ticks/mod.rs | 4 + docs/rust-parity.md | 16 ++ .../parity/VanillaGenerationTickOracle.java | 48 +++++ tools/test_generation_tick_parity.py | 124 ++++++++++++ 8 files changed, 604 insertions(+) create mode 100644 benchmarks/rust-generation-ticks-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-core/examples/generation_tick_fixture.rs create mode 100644 crates/horizon-core/src/ticks/generation.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaGenerationTickOracle.java create mode 100644 tools/test_generation_tick_parity.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5f3ffc832..e85a0f148 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -167,6 +167,10 @@ jobs: env: RUSTUP_TOOLCHAIN: stable run: python tools/test_snow_freeze_parity.py + - name: Compare generation-stage tick storage and routing + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_generation_tick_parity.py - name: Compare ordered single-block replacement features env: RUSTUP_TOOLCHAIN: stable diff --git a/benchmarks/rust-generation-ticks-2026-10-06/scoped-parity.json b/benchmarks/rust-generation-ticks-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..7cce5eb4e --- /dev/null +++ b/benchmarks/rust-generation-ticks-2026-10-06/scoped-parity.json @@ -0,0 +1,110 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "commands": { + "reset": 32, + "load": 38, + "query": 8610, + "snapshot": 115, + "schedule": 8577, + "dump": 536, + "snapshot_dump": 122, + "promote": 115, + "fail": 244, + "will": 199, + "count": 122, + "unpack": 2, + "level": 31, + "remove": 84 + }, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaGenerationTickOracle.java": "c0b95e75e007c2ff53fde575104bf2e25b6fb65e46d11ad2a2dcae760004fe38", + "tools/test_generation_tick_parity.py": "e200240c24d12ed546e2254e0dea947ea3cf8db8a703e4908a90567250d2fdf1", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-core/examples/generation_tick_fixture.rs": "67a6aca02386a9bddd0198c559d66bbb54b1a8f44bad0e916028cfbc4d3cde97" + }, + "fixtures_sha256": { + ".local/rust-generation-tick-parity/inputs.txt": "bc9332ec147bfde2fe6d5a866deb4f985079c77c206fbbece33d4128ff01146e" + }, + "rust_output_sha256": "9ae4ecba3b9b417ee46f8c152c5c2c23d464064e5cdd537da8892c6728860fd7", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "9ae4ecba3b9b417ee46f8c152c5c2c23d464064e5cdd537da8892c6728860fd7", + "matched_output_lines": 101784 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "9ae4ecba3b9b417ee46f8c152c5c2c23d464064e5cdd537da8892c6728860fd7", + "matched_output_lines": 101784 + } + ], + "scope": "Native ProtoChunkTicks load/schedule deduplication, insertion order, zero delay for scheduled requests, preserved saved delays/priorities, time-independent packing and independent scheduledTicks snapshots. Native WorldGenTickAccess lookup ordering, routing to mixed proto/level containers, lookup failures, false willTickThisTick and zero count without lookups. Proto-to-level promotion and unpacked save behavior, position/type identities, priorities, duplicates, unloaded containers and integer/time extremes are compared. Rust exposes pack as a borrowed immutable slice; mutation of the native returned list is outside the API. Actual block/fluid execution and feature-world scheduling integration remain pending." +} diff --git a/crates/horizon-core/examples/generation_tick_fixture.rs b/crates/horizon-core/examples/generation_tick_fixture.rs new file mode 100644 index 000000000..3d154e82a --- /dev/null +++ b/crates/horizon-core/examples/generation_tick_fixture.rs @@ -0,0 +1,188 @@ +//! Private native differential transport for generation-stage tick containers. +use horizon_core::{ + position::BlockPos, + ticks::{ + ChunkTicks, ProtoChunkTicks, SavedTick, ScheduledTick, TickContainerAccess, TickPriority, + TickTypeId, WorldGenTickAccess, WorldGenTickContainers, + }, +}; +use std::{ + collections::BTreeMap, + io::{self, BufRead, Write}, + str::{FromStr, SplitWhitespace}, +}; +enum Container { + Proto(ProtoChunkTicks), + Level(ChunkTicks), +} +impl TickContainerAccess for Container { + fn schedule(&mut self, t: ScheduledTick) -> bool { + match self { + Self::Proto(c) => c.schedule(t), + Self::Level(c) => c.schedule(t), + } + } + fn has_scheduled(&self, p: BlockPos, k: TickTypeId) -> bool { + match self { + Self::Proto(c) => c.has_scheduled(p, k), + Self::Level(c) => c.has_scheduled(p, k), + } + } +} +#[derive(Default)] +struct World { + chunks: BTreeMap<(i32, i32), Container>, + events: Vec, + fail: bool, +} +impl WorldGenTickContainers for World { + type Container = Container; + type Error = (); + fn container_at(&mut self, p: BlockPos) -> Result<&mut Container, ()> { + self.events.push(format!("lookup {} {} {}", p.x, p.y, p.z)); + if self.fail { + return Err(()); + } + Ok(self + .chunks + .entry((p.x >> 4, p.z >> 4)) + .or_insert_with(|| Container::Proto(ProtoChunkTicks::default()))) + } +} +fn number(input: &mut SplitWhitespace<'_>) -> T +where + T::Err: std::fmt::Debug, +{ + input.next().unwrap().parse().unwrap() +} +fn pos(input: &mut SplitWhitespace<'_>) -> BlockPos { + BlockPos::new(number(input), number(input), number(input)) +} +fn saved(input: &mut SplitWhitespace<'_>) -> SavedTick { + SavedTick { + kind: TickTypeId(number(input)), + pos: pos(input), + delay: number(input), + priority: TickPriority::by_value(number(input)), + } +} +fn emit(out: &mut impl Write, ticks: &[SavedTick]) -> io::Result<()> { + writeln!(out, "saved {}", ticks.len())?; + for t in ticks { + writeln!( + out, + "value {} {} {} {} {} {}", + t.kind.0, t.pos.x, t.pos.y, t.pos.z, t.delay, t.priority as i8 + )?; + } + Ok(()) +} +fn flush(access: &mut WorldGenTickAccess, out: &mut impl Write) -> io::Result<()> { + for e in access.containers_mut().events.drain(..) { + writeln!(out, "{e}")?; + } + Ok(()) +} +fn main() -> Result<(), Box> { + let mut access = WorldGenTickAccess::new(World::default()); + let mut snapshot = Vec::new(); + let mut out = io::BufWriter::new(io::stdout().lock()); + for (index, line) in io::stdin().lock().lines().enumerate() { + let line = line?; + let mut input = line.split_whitespace(); + let op = input.next().unwrap(); + writeln!(out, "command {index} {op}")?; + match op { + "reset" => { + access = WorldGenTickAccess::new(World::default()); + snapshot.clear(); + } + "fail" => access.containers_mut().fail = number::(&mut input) != 0, + "load" | "level" => { + let key = (number(&mut input), number(&mut input)); + let count: usize = number(&mut input); + let ticks = (0..count).map(|_| saved(&mut input)).collect::>(); + let c = if op == "load" { + Container::Proto(ProtoChunkTicks::from_saved(ticks)) + } else { + Container::Level(ChunkTicks::from_saved(ticks)) + }; + access.containers_mut().chunks.insert(key, c); + } + "schedule" => { + let t = ScheduledTick { + kind: TickTypeId(number(&mut input)), + pos: pos(&mut input), + trigger_tick: number(&mut input), + priority: TickPriority::by_value(number(&mut input)), + sub_tick_order: number(&mut input), + }; + let result = access.schedule(t); + flush(&mut access, &mut out)?; + writeln!( + out, + "{}", + if result.is_ok() { "scheduled" } else { "error" } + )?; + } + "query" => { + let k = TickTypeId(number(&mut input)); + let p = pos(&mut input); + let result = access.has_scheduled(p, k); + flush(&mut access, &mut out)?; + match result { + Ok(v) => writeln!(out, "query {v}")?, + Err(()) => writeln!(out, "error")?, + } + } + "will" => { + let k = TickTypeId(number(&mut input)); + let p = pos(&mut input); + writeln!(out, "will {}", access.will_tick_this_tick(p, k))?; + } + "dump" => { + let key = (number(&mut input), number(&mut input)); + let time = number(&mut input); + match access.containers().chunks.get(&key) { + Some(Container::Proto(c)) => emit(&mut out, c.pack(time))?, + Some(Container::Level(c)) => emit(&mut out, &c.pack(time))?, + None => writeln!(out, "absent")?, + } + } + "snapshot" => { + let key = (number(&mut input), number(&mut input)); + if let Some(Container::Proto(c)) = access.containers().chunks.get(&key) { + snapshot = c.scheduled_ticks(); + } else { + snapshot.clear(); + } + } + "snapshot_dump" => emit(&mut out, &snapshot)?, + "unpack" | "promote" => { + let key = (number(&mut input), number(&mut input)); + let time = number(&mut input); + if let Some(c) = access.containers_mut().chunks.get_mut(&key) { + if op == "promote" { + if let Container::Proto(proto) = c { + *c = Container::Level(ChunkTicks::from_saved(proto.scheduled_ticks())); + } + } + if let Container::Level(c) = c { + c.unpack(time); + } + } + } + "remove" => { + access + .containers_mut() + .chunks + .remove(&(number(&mut input), number(&mut input))); + } + "count" => {} + _ => panic!("unknown operation {op}"), + } + assert!(input.next().is_none()); + writeln!(out, "count {}", access.count())?; + } + Ok(()) +} diff --git a/crates/horizon-core/src/ticks/generation.rs b/crates/horizon-core/src/ticks/generation.rs new file mode 100644 index 000000000..4e1fdce6f --- /dev/null +++ b/crates/horizon-core/src/ticks/generation.rs @@ -0,0 +1,110 @@ +//! Generation-stage tick storage and routing, before level tick execution. +use super::{ChunkTicks, SavedTick, ScheduledTick, TickTypeId}; +use crate::position::BlockPos; +use std::collections::HashSet; + +/// Proto chunks retain the first request for a type/position in insertion order. +/// Newly scheduled delays are zero; loaded delays and priorities are preserved. +#[derive(Clone, Debug, Default)] +pub struct ProtoChunkTicks { + ticks: Vec, + positions: HashSet<(TickTypeId, BlockPos)>, +} +impl ProtoChunkTicks { + pub fn from_saved(ticks: impl IntoIterator) -> Self { + let mut result = Self::default(); + for tick in ticks { + result.schedule_saved(tick); + } + result + } + fn schedule_saved(&mut self, tick: SavedTick) -> bool { + if !self.positions.insert((tick.kind, tick.pos)) { + return false; + } + self.ticks.push(tick); + true + } + pub fn schedule(&mut self, tick: ScheduledTick) -> bool { + self.schedule_saved(SavedTick { + kind: tick.kind, + pos: tick.pos, + delay: 0, + priority: tick.priority, + }) + } + pub fn has_scheduled(&self, pos: BlockPos, kind: TickTypeId) -> bool { + self.positions.contains(&(kind, pos)) + } + pub fn count(&self) -> usize { + self.ticks.len() + } + /// Borrow the current saved list. Game time does not affect proto delays. + pub fn pack(&self, _game_time: i64) -> &[SavedTick] { + &self.ticks + } + /// An independent snapshot, matching scheduledTicks rather than pack's view. + pub fn scheduled_ticks(&self) -> Vec { + self.ticks.clone() + } +} + +pub trait TickContainerAccess { + fn schedule(&mut self, tick: ScheduledTick) -> bool; + fn has_scheduled(&self, pos: BlockPos, kind: TickTypeId) -> bool; +} +impl TickContainerAccess for ProtoChunkTicks { + fn schedule(&mut self, tick: ScheduledTick) -> bool { + Self::schedule(self, tick) + } + fn has_scheduled(&self, pos: BlockPos, kind: TickTypeId) -> bool { + Self::has_scheduled(self, pos, kind) + } +} +impl TickContainerAccess for ChunkTicks { + fn schedule(&mut self, tick: ScheduledTick) -> bool { + Self::schedule(self, tick) + } + fn has_scheduled(&self, pos: BlockPos, kind: TickTypeId) -> bool { + Self::has_scheduled(self, pos, kind) + } +} + +/// World-owned selection of the receiving chunk/container. This receives the +/// original block position, so lookup policy and its errors remain observable. +pub trait WorldGenTickContainers { + type Container: TickContainerAccess; + type Error; + fn container_at(&mut self, pos: BlockPos) -> Result<&mut Self::Container, Self::Error>; +} + +pub struct WorldGenTickAccess { + containers: C, +} +impl WorldGenTickAccess { + pub fn new(containers: C) -> Self { + Self { containers } + } + pub fn containers(&self) -> &C { + &self.containers + } + pub fn containers_mut(&mut self) -> &mut C { + &mut self.containers + } + pub fn into_containers(self) -> C { + self.containers + } + pub fn schedule(&mut self, tick: ScheduledTick) -> Result { + Ok(self.containers.container_at(tick.pos)?.schedule(tick)) + } + pub fn has_scheduled(&mut self, pos: BlockPos, kind: TickTypeId) -> Result { + Ok(self.containers.container_at(pos)?.has_scheduled(pos, kind)) + } + /// Generation access never reports a currently executing tick or a level count. + pub fn will_tick_this_tick(&self, _pos: BlockPos, _kind: TickTypeId) -> bool { + false + } + pub fn count(&self) -> usize { + 0 + } +} diff --git a/crates/horizon-core/src/ticks/mod.rs b/crates/horizon-core/src/ticks/mod.rs index 38fcef4db..f3cc83999 100644 --- a/crates/horizon-core/src/ticks/mod.rs +++ b/crates/horizon-core/src/ticks/mod.rs @@ -1,5 +1,9 @@ //! Scheduled block/fluid tick machinery for Java Edition 26.3. Type IDs identify //! registry-owned types; each block/fluid registry uses its own LevelTicks. +mod generation; +pub use generation::{ + ProtoChunkTicks, TickContainerAccess, WorldGenTickAccess, WorldGenTickContainers, +}; mod heap; mod index; use crate::position::{BlockPos, ChunkPos}; diff --git a/docs/rust-parity.md b/docs/rust-parity.md index 3deb7bacc..806104da9 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -661,3 +661,19 @@ mutations, rejected writes, partial failures, extreme heights/sea levels, wrappe coordinates and composition. Workspace tests and all-target Clippy pass. The fixture uses controlled heights and one biome; lighting propagation, dynamic biome selection, world updates and full generation remain pending. + +## Generation-stage tick containers + +Proto-chunk tick containers now keep the first type/position request in insertion +order. Newly scheduled ticks retain priority with zero delay; loaded entries +retain their saved delay. Generation tick access routes requests to the selected +container and reports no currently executing ticks or aggregate count. Snapshots +can be promoted into the existing level tick queue. + +The [generation-tick comparison](../benchmarks/rust-generation-ticks-2026-10-06/scoped-parity.json) +matches **101,784 lines per reference JAR**, covering duplicates, saved entries, +snapshot independence, mixed proto/level routing, lookup failures, promotion, +priority boundaries and integer/time extremes. Workspace tests, all-target Clippy +and all 149 Python tests pass. Rust exposes packed entries as an immutable +borrowed slice; mutating Java's returned list is outside this API. Feature-world +scheduling integration and block/fluid tick execution remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaGenerationTickOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaGenerationTickOracle.java new file mode 100644 index 000000000..4d956f5f0 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaGenerationTickOracle.java @@ -0,0 +1,48 @@ +package dev.horizonlab.parity; +import java.io.*; +import java.nio.file.*; +import java.util.*; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.ticks.*; + +/** Original transport for native proto tick storage and world-generation routing. */ +public final class VanillaGenerationTickOracle { + private static final Object[] TYPES=new Object[32]; + static{for(int i=0;i saved(){return new SavedTick<>(TYPES[integer()],pos(),integer(),TickPriority.byValue(integer()));} + } + private final Map> chunks=new HashMap<>(); + private final PrintWriter out;private boolean fail;private List> snapshot=List.of(); + private final WorldGenTickAccess access; + private VanillaGenerationTickOracle(PrintWriter out){this.out=out;access=new WorldGenTickAccess<>(p->{out.println("lookup "+p.getX()+" "+p.getY()+" "+p.getZ());if(fail)throw new Stop();return chunks.computeIfAbsent(ChunkPos.pack(p),key->new ProtoChunkTicks<>());});} + private static int type(Object value){for(int i=0;i> ticks){out.println("saved "+ticks.size());for(var t:ticks)out.println("value "+type(t.type())+" "+t.pos().getX()+" "+t.pos().getY()+" "+t.pos().getZ()+" "+t.delay()+" "+t.priority().getValue());} + @SuppressWarnings("unchecked") private void command(String line,int index){var in=new Input(line);String op=in.words[0];out.println("command "+index+" "+op); + try{switch(op){ + case "reset"->{chunks.clear();snapshot=List.of();fail=false;} + case "fail"->fail=in.integer()!=0; + case "load","level"->{long key=in.chunk();int count=in.integer();var ticks=new ArrayList>();for(int i=0;i(ticks));} + case "schedule"->{var t=new ScheduledTick<>(TYPES[in.integer()],in.pos(),in.number(),TickPriority.byValue(in.integer()),in.number());access.schedule(t);out.println("scheduled");} + case "query"->{var type=TYPES[in.integer()];var p=in.pos();out.println("query "+access.hasScheduledTick(p,type));} + case "will"->{var type=TYPES[in.integer()];var p=in.pos();out.println("will "+access.willTickThisTick(p,type));} + case "dump"->{var c=chunks.get(in.chunk());long time=in.number();if(c==null)out.println("absent");else emit(((SerializableTickContainer)c).pack(time));} + case "snapshot"->{var c=chunks.get(in.chunk());snapshot=c instanceof ProtoChunkTicks?((ProtoChunkTicks)c).scheduledTicks():List.of();} + case "snapshot_dump"->emit(snapshot); + case "unpack","promote"->{long key=in.chunk(),time=in.number();var c=chunks.get(key);if(op.equals("promote")&&c instanceof ProtoChunkTicks){c=new LevelChunkTicks<>(((ProtoChunkTicks)c).scheduledTicks());chunks.put(key,c);}if(c instanceof LevelChunkTicks)((LevelChunkTicks)c).unpack(time);} + case "remove"->chunks.remove(in.chunk()); + case "count"->{} + default->throw new AssertionError(op); + }}catch(Stop ignored){out.println("error");} + if(in.cursor!=in.words.length)throw new AssertionError("extra input");out.println("count "+access.count()); + } + public static void main(String[] args)throws Exception{ + net.minecraft.SharedConstants.tryDetectVersion(); + try(var input=Files.newBufferedReader(Path.of(args[0]));var out=new PrintWriter(Files.newBufferedWriter(Path.of(args[1])))){var oracle=new VanillaGenerationTickOracle(out);String line;int index=0;while((line=input.readLine())!=null)oracle.command(line,index++);} + } +} diff --git a/tools/test_generation_tick_parity.py b/tools/test_generation_tick_parity.py new file mode 100644 index 000000000..c0d906fb7 --- /dev/null +++ b/tools/test_generation_tick_parity.py @@ -0,0 +1,124 @@ +#!/usr/bin/env python3 +"""Compare proto-chunk ticks and world-generation tick routing with vanilla.""" +import argparse +from collections import Counter +import json +import os +from pathlib import Path +import platform +import random +import subprocess +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab, test_rust_parity as base + + +def corpus(): + extremes = [-9223372036854775808, -2147483648, -1, 0, 1, 2147483647, 9223372036854775807] + for time in extremes: + yield 'reset' + yield 'load -1 -1 4 0 -1 64 -1 -2147483648 -100 0 -1 64 -1 2147483647 100 1 -1 64 -1 -1 0 2 -2 65 -2 12 3' + yield 'query 0 -1 64 -1' + yield 'snapshot -1 -1' + yield f'schedule 0 -1 64 -1 {time} -3 {time}' + yield f'schedule 3 -3 66 -3 {time} 2 {time}' + yield f'dump -1 -1 {time}' + yield 'snapshot_dump' + yield f'promote -1 -1 {time}' + yield f'dump -1 -1 {time}' + yield f'schedule 4 -4 67 -4 {time} -2 {time}' + yield f'dump -1 -1 {time}' + yield 'snapshot_dump' + for kind in ['load', 'level']: + yield 'reset' + # Deliberately load a position outside the owning container; routing is + # determined by each request's position, not by entries in saved lists. + yield f'{kind} 0 0 2 0 16 64 0 7 0 0 16 64 0 8 -3' + yield 'query 0 16 64 0' + yield 'dump 0 0 0' + yield 'dump 1 0 0' + yield 'fail 1' + yield 'query 0 0 64 0' + yield 'schedule 1 0 64 0 0 0 0' + yield 'will 1 0 64 0' + yield 'count' + yield 'fail 0' + yield 'query 1 0 64 0' + yield 'unpack 0 0 9223372036854775807' + yield 'dump 0 0 -9223372036854775808' + positions = [[-2147483648, -2147483648, 2147483647], [2147483647, 2147483647, -2147483648], + [0, 0, 0], [67108864, 4096, -67108864], [-1, -1, -1], [15, 319, 15], [16, -64, 16]] + for priority in [-2147483648, -4, -3, -2, -1, 0, 1, 2, 3, 4, 2147483647]: + yield 'reset' + for i, p in enumerate(positions): + xyz = ' '.join(map(str, p)) + yield f'schedule {i} {xyz} -9223372036854775808 {priority} 9223372036854775807' + yield f'schedule {i} {xyz} 9223372036854775807 {-priority if priority != -2147483648 else 0} -9223372036854775808' + yield f'query {i} {xyz}' + yield f'will {i} {xyz}' + yield f'dump {p[0] >> 4} {p[2] >> 4} 12345' + rng = random.Random(0x484f52495a4f4e) + for trial in range(12): + yield 'reset' + for cx in range(-2, 3): + command = 'load' if (cx + trial) % 2 == 0 else 'level' + rows = [] + for i in range(24): + row = [rng.randrange(8), cx*16+rng.randrange(4), rng.randrange(-3, 4), rng.randrange(4), rng.choice([-2147483648, -1, 0, 1, 2147483647]), rng.randrange(-8, 9)] + rows.append(' '.join(map(str, row))) + if i % 3 == 0: rows.append(rows[-1]) + yield f'{command} {cx} 0 {len(rows)} ' + ' '.join(rows) + for step in range(700): + cx = rng.randrange(-2, 3); p = [cx*16+rng.randrange(4), rng.randrange(-3, 4), rng.randrange(4)] + xyz = ' '.join(map(str, p)); typ = rng.randrange(8) + if step % 71 == 0: + yield 'fail 1'; yield f'query {typ} {xyz}'; yield f'will {typ} {xyz}'; yield 'count'; yield 'fail 0' + if step % 79 == 0: yield f'promote {cx} 0 {rng.choice(extremes)}' + if step % 83 == 0: yield f'snapshot {cx} 0' + if step % 89 == 0: yield 'snapshot_dump' + if step % 101 == 0: yield f'remove {cx} 0' + yield f'schedule {typ} {xyz} {rng.choice(extremes)} {rng.randrange(-8, 9)} {rng.choice(extremes)}' + yield f'query {typ} {xyz}' + if step % 23 == 0: yield f'dump {cx} 0 {rng.choice(extremes)}' + for cx in range(-2, 3): yield f'dump {cx} 0 {rng.choice(extremes)}' + yield 'snapshot_dump' + + +def main(): + parser = argparse.ArgumentParser(description=__doc__); parser.add_argument('--prepare', action='store_true'); args = parser.parse_args() + build = lab.LOCAL / 'rust-generation-tick-parity'; build.mkdir(parents=True, exist_ok=True) + report_path = build / 'report.json'; report_path.unlink(missing_ok=True) + if args.prepare: lab.prepare() + lock, jars, libraries = base.verify_artifacts() + oracle = lab.ROOT / 'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaGenerationTickOracle.java' + sources = [oracle, Path(__file__), lab.ROOT / 'tools/test_rust_parity.py', lab.ROOT / 'tools/lab.py', lab.ROOT / 'Cargo.toml', lab.ROOT / 'Cargo.lock', lab.ROOT / 'crates/horizon-core/Cargo.toml', + *sorted((lab.ROOT / 'crates/horizon-core/src').rglob('*.rs')), lab.ROOT / 'crates/horizon-core/examples/generation_tick_fixture.rs'] + tested_sources = base.source_hashes(sources) + commands = list(corpus()); inputs = build / 'inputs.txt'; inputs.write_text('\n'.join(commands) + '\n') + tested_fixtures = base.source_hashes([inputs]); classes = build / 'classes'; classes.mkdir(exist_ok=True) + dependencies = os.pathsep.join(map(str, libraries)) + def run(command, name, **kwargs): + with (build / (name + '.log')).open('w') as log: + subprocess.run(list(map(str, command)), cwd=lab.ROOT, check=True, timeout=3600, stderr=log, **({'stdout': log} | kwargs)) + run(['javac', '--release', lock['minecraft']['java_major'], '-proc:none', '-cp', str(jars['server']) + os.pathsep + dependencies, '-d', classes, oracle], 'compile-java') + run(['cargo', 'build', '--release', '-p', 'horizon-core', '--example', 'generation_tick_fixture'], 'compile-rust') + metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'], cwd=lab.ROOT, text=True)) + binary = Path(metadata['target_directory']) / 'release/examples' / ('generation_tick_fixture.exe' if os.name == 'nt' else 'generation_tick_fixture') + with inputs.open('rb') as source, (build / 'rust.txt').open('wb') as output: run([binary], 'rust', stdin=source, stdout=output) + references = [] + for side, jar in jars.items(): + run(['java', '-Xmx512M', '-cp', os.pathsep.join([str(classes), str(jar), dependencies]), 'dev.horizonlab.parity.VanillaGenerationTickOracle', inputs, build / (side + '.txt')], side) + matched = base.compare(build / (side + '.txt'), build / 'rust.txt') + references.append({'side': side, 'jar_sha256': lab.digest(jar, 'sha256'), 'output_sha256': lab.digest(build / (side + '.txt'), 'sha256'), 'matched_output_lines': matched}) + print(f'{side}: {matched:,} generation-tick lines match Rust', flush=True) + base.ensure_sources_unchanged(sources, tested_sources); base.ensure_sources_unchanged([inputs], tested_fixtures) + report = {'schema': 1, 'minecraft': lock['minecraft']['version'], 'manifest_sha1': lock['minecraft']['manifest_sha1'], 'platform': platform.platform(), + 'java': subprocess.check_output(['java', '--version'], text=True).splitlines()[0], 'rustc': subprocess.check_output(['rustc', '--version'], text=True).strip(), + 'commands': dict(Counter(command.split()[0] for command in commands)), 'sources_sha256': tested_sources, 'fixtures_sha256': tested_fixtures, + 'rust_output_sha256': lab.digest(build / 'rust.txt', 'sha256'), 'references': references, + 'scope': 'Native ProtoChunkTicks load/schedule deduplication, insertion order, zero delay for scheduled requests, preserved saved delays/priorities, time-independent packing and independent scheduledTicks snapshots. Native WorldGenTickAccess lookup ordering, routing to mixed proto/level containers, lookup failures, false willTickThisTick and zero count without lookups. Proto-to-level promotion and unpacked save behavior, position/type identities, priorities, duplicates, unloaded containers and integer/time extremes are compared. Rust exposes pack as a borrowed immutable slice; mutation of the native returned list is outside the API. Actual block/fluid execution and feature-world scheduling integration remain pending.'} + lab.write_json(report_path, report); print(f'Scoped generation-tick parity passed: {report_path}') + + +if __name__ == '__main__': main() From 3cea5de769b3a844e68eeee26450c47de1d4f2d8 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 13:48:50 +0200 Subject: [PATCH 028/253] Connect feature-region scheduling to resident chunk tick queues --- .../scoped-parity.json | 204 ++++++++++++++++++ .../examples/feature_region_fixture.rs | 46 +++- .../src/worldgen/feature_region.rs | 125 ++++++++++- crates/horizon-world/src/worldgen/terrain.rs | 17 ++ docs/rust-parity.md | 17 ++ .../parity/VanillaFeatureRegionOracle.java | 31 ++- tools/test_feature_region_parity.py | 14 +- 7 files changed, 448 insertions(+), 6 deletions(-) create mode 100644 benchmarks/rust-feature-region-ticks-2026-10-06/scoped-parity.json diff --git a/benchmarks/rust-feature-region-ticks-2026-10-06/scoped-parity.json b/benchmarks/rust-feature-region-ticks-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..87ab83c24 --- /dev/null +++ b/benchmarks/rust-feature-region-ticks-2026-10-06/scoped-parity.json @@ -0,0 +1,204 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "block_states": 35723, + "block_tag_files": 300, + "fixtures": 192, + "worldgen_random_modes": [ + false, + true + ], + "resident_chunks_per_fixture": 9, + "requested_placements": 2688, + "direct_tick_requests": 14784, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureRegionOracle.java": "f1d53f2378d4db192ae2d3a0a21027da121dbc16567fe83dbd3e2219d76c81f6", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", + "tools/test_feature_region_parity.py": "d4188a05763c7540a3d997e22c9ef7b87c2c5bc571dc4867a36758124cc59eb7", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "a8cd85f6223668c1446ff103276d80937b9707d9a7dc619a176b1b1ceed36a4a", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "1eae82604d2b3377fd35aaa3a914a67e5af28f93923815a49e895b4d437433cd", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "5ce5c6eaa5f8a2557a620e533788217b1eb430654801dcf6135d6c92d7a012ac", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "98bc93dff1373e3b6f4dcf8c4c2b05b56814acd4f66302834aa5877fe90ec7b9", + "crates/horizon-world/src/worldgen/feature_region.rs": "39c29f24c3f08081533cb2ec4f5ef5a4cd891b112055234fe1ed8dafc2ea4cf7", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "e682d13a21f90605215b79f5d254bf2e524d35e89eab2e3b46384709af80b847", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "b7a59a712d2e376e8f32ec1e1fd901df452c8019e06910c39d469816be63a14f", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "b8fb9fb80a66a851d916f07f15df1a40b6cc95b49e71aaec4d4b4107f13d9f9f", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "072d31a3b814eda9cc9bdc1da06a7dab43c38f133824bfd00f55ebb8452d8b88", + "crates/horizon-world/examples/feature_region_fixture.rs": "5650465d2c4274b68b09521725a237b8ecf54e853c9fb76c09364d81ced233d7" + }, + "fixtures_sha256": { + ".local/rust-feature-region-parity/inputs.txt": "b9291d2acd0a9734a6c6facf40602a6464e03643b485e5e3024fffdad32edc3a", + ".local/rust-feature-region-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0", + ".local/rust-feature-region-parity/facts-client.json": "1d24883ee807b0b71473f0bbf8ed548ddaf712148caeb3fcc7aa13ab973a97b0", + ".local/rust-feature-region-parity/facts-server.json": "1d24883ee807b0b71473f0bbf8ed548ddaf712148caeb3fcc7aa13ab973a97b0" + }, + "rust_output_sha256": "7063716bad44d41187315daa2ce66abc7af187efe8c1b28eb13fbf58e3c5f1f4", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "7063716bad44d41187315daa2ce66abc7af187efe8c1b28eb13fbf58e3c5f1f4", + "matched_output_lines": 28985883 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "7063716bad44d41187315daa2ce66abc7af187efe8c1b28eb13fbf58e3c5f1f4", + "matched_output_lines": 28985883 + } + ], + "scope": "Native FeaturePlacer and three basic block-writing features, a composed sequence of four configured fill layers, single-block replacements, scattered ore and water springs share a world proxy backed by nine actual ProtoChunks. Configured water, horizontal logs, air, out-of-height fills and ore/replacement rules test graph-to-region binding. Initial two-layer stone/dirt terrain, both pre-light heightmap groups, count/square/heightmap/layered modifier chains, repeated placements, direct and WorldgenRandom-wrapped random streams, missing-neighbor errors, rejected writes and injected partial failures are compared. Final complete raw sections, heightmap presence and packed words are compared alongside ordered feature writes, update flags, explicit height queries and subsequent random draws. Rust uses resident registry-backed chunks, lazy heightmap priming and a caller-supplied write callback; imported air/fluid facts and bundled block tags bind independently across authenticated JARs. The proxy supplies storage mutation and actual native default scheduleTick/createTick methods routed through WorldGenTickAccess into each ProtoChunk. Separate block/fluid queues, first-request deduplication, nondefault-state block identity, shared tick-order advancement on duplicates and missing-chunk errors, out-of-height requests and wrapped clock values are compared, including saved queue order and priorities. Actual WorldGenRegion construction, write-zone policy, POIs, block entities, postprocessing execution, lighting, block/fluid tick execution, complete feature registries and complete world generation remain outside this comparison." +} diff --git a/crates/horizon-world/examples/feature_region_fixture.rs b/crates/horizon-world/examples/feature_region_fixture.rs index 2b3918be3..953b280fb 100644 --- a/crates/horizon-world/examples/feature_region_fixture.rs +++ b/crates/horizon-world/examples/feature_region_fixture.rs @@ -12,6 +12,7 @@ use horizon_world::worldgen::{ use horizon_core::position::ChunkPos; use horizon_world::{ DATA_VERSION, + fluid::FluidKind, heightmap::{HeightmapState, HeightmapType}, nbt::Tag, registry::{BlockRegistry, BlockStateId}, @@ -140,7 +141,11 @@ fn run( chunks.push(chunk); } } - let mut region = TerrainRegion::new(chunks, WorldGenerationContext::new(-64, 64, 0))?; + let mut region = TerrainRegion::new(chunks, WorldGenerationContext::new(-64, 64, 0))? + .with_tick_clock( + f["game_time"].as_i64().unwrap(), + f["tick_order"].as_i64().unwrap(), + ); let blocks = FeatureBlocks::from_registry(registry)?; // These configured fixture states use compact names and an enum property; // no integer-property parsing is requested by this region corpus. @@ -213,9 +218,48 @@ fn run( } writeln!(out, "repeat {repeat}")?; } + for command in f["tick_commands"].as_array().unwrap() { + let kind = command[0].as_str().unwrap(); + let id = n(&command[1]) as u32; + let p = std::array::from_fn(|i| n(&command[2][i])); + let delay = n(&command[3]); + writeln!(out, "tickrequest {kind} {id}")?; + let result = if kind == "block" { + region.schedule_block_tick(p, BlockStateId(id), delay) + } else { + region.schedule_fluid_tick(p, FluidKind::ALL[id as usize], delay) + }; + writeln!( + out, + "tickresult {}", + if result.is_ok() { "ok" } else { "error" } + )?; + writeln!(out, "tickorder {}", region.tick_clock().1)?; + } for chunk in region.chunks() { let p = chunk.position(); writeln!(out, "chunk {} {}", p.x, p.z)?; + writeln!(out, "blockticks {}", chunk.block_ticks().count())?; + for tick in chunk.block_ticks().pack(region.tick_clock().0) { + writeln!( + out, + "bt {} {} {} {} {} {}", + tick.kind.0, tick.pos.x, tick.pos.y, tick.pos.z, tick.delay, tick.priority as i8 + )?; + } + writeln!(out, "fluidticks {}", chunk.fluid_ticks().count())?; + for tick in chunk.fluid_ticks().pack(region.tick_clock().0) { + writeln!( + out, + "ft {} {} {} {} {} {}", + FluidKind::ALL[tick.kind.0 as usize].name(), + tick.pos.x, + tick.pos.y, + tick.pos.z, + tick.delay, + tick.priority as i8 + )?; + } for kind in HeightmapType::ALL { if let Some(map) = chunk.heightmap(kind) { writeln!(out, "map {}", kind.name())?; diff --git a/crates/horizon-world/src/worldgen/feature_region.rs b/crates/horizon-world/src/worldgen/feature_region.rs index 783537df1..d5e967fa2 100644 --- a/crates/horizon-world/src/worldgen/feature_region.rs +++ b/crates/horizon-world/src/worldgen/feature_region.rs @@ -9,15 +9,24 @@ use super::{ terrain::{PreLightChunkStage, TerrainBlockStates, TerrainChunk, TerrainError}, }; use crate::{ + fluid::FluidKind, heightmap::{HeightmapState, HeightmapType}, registry::BlockStateId, + tick_data::TickKind, +}; +use horizon_core::{ + position::BlockPos, + ticks::{ + ProtoChunkTicks, ScheduledTick, TickPriority, TickTypeId, WorldGenTickAccess, + WorldGenTickContainers, + }, }; -use horizon_core::position::BlockPos; use std::collections::BTreeMap; #[derive(Debug)] pub enum RegionError { InvalidChunks, + InvalidTickState(BlockStateId), MissingChunk([i32; 2]), Terrain(TerrainError), Biome(BiomeRegionError), @@ -45,6 +54,8 @@ pub struct TerrainRegion<'r, B: TerrainBlockStates> { height: i32, generation: WorldGenerationContext, sea_level: i32, + game_time: i64, + next_tick_order: i64, } impl<'r, B: TerrainBlockStates> TerrainRegion<'r, B> { pub fn new( @@ -71,6 +82,8 @@ impl<'r, B: TerrainBlockStates> TerrainRegion<'r, B> { Ok(Self { chunks: stored, sea_level: generator.sea_level, + game_time: 0, + next_tick_order: 0, min_y, height, generation: WorldGenerationContext::with_generator( @@ -82,6 +95,52 @@ impl<'r, B: TerrainBlockStates> TerrainRegion<'r, B> { ), }) } + /// Supply the owning world's current time and region-local next tick order. + pub fn with_tick_clock(mut self, game_time: i64, next_tick_order: i64) -> Self { + self.game_time = game_time; + self.next_tick_order = next_tick_order; + self + } + pub fn tick_clock(&self) -> (i64, i64) { + (self.game_time, self.next_tick_order) + } + pub fn set_game_time(&mut self, game_time: i64) { + self.game_time = game_time; + } + pub fn schedule_tick( + &mut self, + kind: TickKind, + tick: ScheduledTick, + ) -> Result { + WorldGenTickAccess::new(RegionTickContainers { region: self, kind }).schedule(tick) + } + pub fn has_scheduled_tick( + &mut self, + kind: TickKind, + position: BlockPos, + tick_type: TickTypeId, + ) -> Result { + WorldGenTickAccess::new(RegionTickContainers { region: self, kind }) + .has_scheduled(position, tick_type) + } + fn request_tick( + &mut self, + kind: TickKind, + position: [i32; 3], + tick_type: TickTypeId, + delay: i32, + ) -> Result<(), RegionError> { + let tick = ScheduledTick { + kind: tick_type, + pos: BlockPos::new(position[0], position[1], position[2]), + trigger_tick: self.game_time.wrapping_add(i64::from(delay)), + priority: TickPriority::Normal, + sub_tick_order: self.next_tick_order, + }; + self.next_tick_order = self.next_tick_order.wrapping_add(1); + self.schedule_tick(kind, tick)?; + Ok(()) + } /// Override world sea level without changing generator placement anchors. pub fn with_world_sea_level(mut self, sea_level: i32) -> Self { self.sea_level = sea_level; @@ -142,7 +201,54 @@ impl<'r, B: TerrainBlockStates> TerrainRegion<'r, B> { .set_block_worldgen(x, y, z, state)?) } } +struct RegionTickContainers<'a, 'r, B: TerrainBlockStates> { + region: &'a mut TerrainRegion<'r, B>, + kind: TickKind, +} +impl WorldGenTickContainers for RegionTickContainers<'_, '_, B> { + type Container = ProtoChunkTicks; + type Error = RegionError; + fn container_at(&mut self, p: BlockPos) -> Result<&mut ProtoChunkTicks, RegionError> { + let chunk = self.region.chunk_mut(p.x >> 4, p.z >> 4)?; + Ok(match self.kind { + TickKind::Block => chunk.block_ticks_mut(), + TickKind::Fluid => chunk.fluid_ticks_mut(), + }) + } +} impl PlacementContext for TerrainRegion<'_, B> { + fn schedule_block_tick( + &mut self, + position: [i32; 3], + block: BlockStateId, + delay: i32, + ) -> Result<(), PlacementQueryError> { + let registry = self + .chunks + .first_key_value() + .expect("nonempty region") + .1 + .registry(); + let state = registry + .state(block) + .ok_or(RegionError::InvalidTickState(block))?; + // Default state IDs provide one identity per block, separate from fluids. + let block = registry + .default_state(&state.name) + .ok_or(RegionError::InvalidTickState(block))?; + self.request_tick(TickKind::Block, position, TickTypeId(block.0), delay) + .map_err(Into::into) + } + fn schedule_fluid_tick( + &mut self, + position: [i32; 3], + fluid: FluidKind, + delay: i32, + ) -> Result<(), PlacementQueryError> { + self.request_tick(TickKind::Fluid, position, TickTypeId(fluid as u32), delay) + .map_err(Into::into) + } + fn sea_level(&mut self) -> Result { Ok(self.sea_level) } @@ -208,6 +314,23 @@ impl<'a, 'r, B: TerrainBlockStates, F> TerrainFeatureAccess<'a, 'r, B, F> { } } impl PlacementContext for TerrainFeatureAccess<'_, '_, B, F> { + fn schedule_block_tick( + &mut self, + position: [i32; 3], + block: BlockStateId, + delay: i32, + ) -> Result<(), PlacementQueryError> { + self.region.schedule_block_tick(position, block, delay) + } + fn schedule_fluid_tick( + &mut self, + position: [i32; 3], + fluid: FluidKind, + delay: i32, + ) -> Result<(), PlacementQueryError> { + self.region.schedule_fluid_tick(position, fluid, delay) + } + fn sea_level(&mut self) -> Result { self.region.sea_level() } diff --git a/crates/horizon-world/src/worldgen/terrain.rs b/crates/horizon-world/src/worldgen/terrain.rs index 9daf04cb7..3c716cf6d 100644 --- a/crates/horizon-world/src/worldgen/terrain.rs +++ b/crates/horizon-world/src/worldgen/terrain.rs @@ -13,6 +13,7 @@ use horizon_core::{ noise::DensityVolume, position::ChunkPos, random::PositionalRandom, + ticks::ProtoChunkTicks, }; use std::io; @@ -106,6 +107,8 @@ pub struct TerrainChunk<'r, B: TerrainBlockStates> { blocks: TerrainBlocks<'r, B>, heightmaps: [Option; 6], postprocessing: Vec>, + block_ticks: ProtoChunkTicks, + fluid_ticks: ProtoChunkTicks, } /// The persisted generation statuses before lighting initialization. This models /// their block-write heightmap selection, not scheduling or persisted metadata. @@ -235,6 +238,8 @@ impl<'r, B: TerrainBlockStates> TerrainChunk<'r, B> { }, heightmaps: std::array::from_fn(|_| None), postprocessing: vec![Vec::new(); section_count], + block_ticks: ProtoChunkTicks::default(), + fluid_ticks: ProtoChunkTicks::default(), }) } pub(crate) fn registry(&self) -> &BlockRegistry { @@ -312,6 +317,18 @@ impl<'r, B: TerrainBlockStates> TerrainChunk<'r, B> { pub fn heightmap(&self, kind: HeightmapType) -> Option<&Heightmap> { self.heightmaps[kind as usize].as_ref() } + pub fn block_ticks(&self) -> &ProtoChunkTicks { + &self.block_ticks + } + pub fn block_ticks_mut(&mut self) -> &mut ProtoChunkTicks { + &mut self.block_ticks + } + pub fn fluid_ticks(&self) -> &ProtoChunkTicks { + &self.fluid_ticks + } + pub fn fluid_ticks_mut(&mut self) -> &mut ProtoChunkTicks { + &mut self.fluid_ticks + } pub fn postprocessing(&self) -> &[Vec] { &self.postprocessing } diff --git a/docs/rust-parity.md b/docs/rust-parity.md index 806104da9..1d18e695d 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -677,3 +677,20 @@ priority boundaries and integer/time extremes. Workspace tests, all-target Clipp and all 149 Python tests pass. Rust exposes packed entries as an immutable borrowed slice; mutating Java's returned list is outside this API. Feature-world scheduling integration and block/fluid tick execution remain pending. + +## Resident generation tick queues + +Resident terrain chunks now own separate block and fluid proto-tick queues. +Feature-world scheduling normalizes block states to block identity, routes to the +chunk containing the original position and advances the region's tick order even +for duplicate requests or missing chunks. Time and order use Java wrapping rules. + +The [resident queue comparison](../benchmarks/rust-feature-region-ticks-2026-10-06/scoped-parity.json) +matches **28,985,883 lines per reference JAR** across **192 fixtures**, with nine +resident chunks each, **2,688 requested feature placements** and **14,784 direct +tick requests**. Both references agree on final sections, heightmaps and saved +ticks. Coverage includes spring scheduling, duplicate block identities, separate +fluid identities, missing chunks, out-of-height positions and time/order overflow. +Workspace tests and all-target Clippy pass. This connects generation-stage queues; +block/fluid tick execution, complete chunk persistence and full world-generation +effects remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureRegionOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureRegionOracle.java index a7831c06b..39535438f 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureRegionOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureRegionOracle.java @@ -7,6 +7,10 @@ import java.nio.charset.StandardCharsets; import java.nio.file.*; import java.util.*; import net.minecraft.core.*; +import net.minecraft.core.registries.*; +import net.minecraft.resources.*; +import net.minecraft.world.ticks.*; +import net.minecraft.world.level.material.*; import net.minecraft.util.RandomSource; import net.minecraft.world.level.*; import net.minecraft.world.level.biome.*; @@ -23,6 +27,7 @@ public final class VanillaFeatureRegionOracle { private static ProtoChunk chunk(Map chunks,int x,int z) { var chunk=chunks.get(new ChunkPos(x>>4,z>>4));if(chunk==null)throw new IllegalArgumentException("missing region chunk");return chunk; } + @SuppressWarnings("unchecked") public static void main(String[] args) throws Exception { if(args[0].equals("export")){VanillaHeightmapOracle.main(args);return;} net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); @@ -34,11 +39,17 @@ public final class VanillaFeatureRegionOracle { var contextMethod=VanillaPlacementOracle.class.getDeclaredMethod("context",JsonObject.class);contextMethod.setAccessible(true); var bounds=new JsonObject();bounds.add("context",JsonParser.parseString("[-64,64,0]")); var generator=((PlacementContext)contextMethod.invoke(null,bounds)).generator(); + var ops=RegistryOps.create(JsonOps.INSTANCE,new RegistryOps.RegistryInfoLookup(){public Optional> lookup(ResourceKey> key){ + if(key.equals(Registries.BLOCK))return (Optional>)(Optional)Optional.of(BuiltInRegistries.BLOCK); + if(key.equals(Registries.FLUID))return (Optional>)(Optional)Optional.of(BuiltInRegistries.FLUID); + return Optional.empty(); + }}); + var fluids=new Fluid[]{Fluids.EMPTY,Fluids.FLOWING_WATER,Fluids.WATER,Fluids.FLOWING_LAVA,Fluids.LAVA}; try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt"),StandardCharsets.UTF_8))) { for(var line:Files.readAllLines(dir.resolve("inputs.txt"))) { var f=JsonParser.parseString(line).getAsJsonObject();long seed=f.get("seed").getAsLong(); var features=new ArrayList(); - for(var value:f.getAsJsonArray("features"))features.add(Feature.DIRECT_CODEC.parse(JsonOps.INSTANCE,value).getOrThrow()); + for(var value:f.getAsJsonArray("features"))features.add(Feature.DIRECT_CODEC.parse(ops,value).getOrThrow()); RandomSource random=f.get("legacy").getAsBoolean()?new LegacyRandomSource(seed):new XoroshiroRandomSource(seed); if(f.get("worldgen").getAsBoolean())random=new WorldgenRandom(random); var chunks=new TreeMap(Comparator.comparingInt(p->p.x()).thenComparingInt(p->p.z())); @@ -51,8 +62,16 @@ public final class VanillaFeatureRegionOracle { } chunks.put(cp,chunk); } + var blockTicks=new WorldGenTickAccess(p->chunk(chunks,p.getX(),p.getZ()).getBlockTicks()); + var fluidTicks=new WorldGenTickAccess(p->chunk(chunks,p.getX(),p.getZ()).getFluidTicks()); + long[] tickOrder={f.get("tick_order").getAsLong()}; int[] calls={0};int fail=f.get("fail").getAsInt(),reject=f.get("reject").getAsInt(); var world=(WorldGenLevel)Proxy.newProxyInstance(WorldGenLevel.class.getClassLoader(),new Class[]{WorldGenLevel.class},(proxy,method,values)->switch(method.getName()) { + case "getBlockTicks"->blockTicks; + case "getFluidTicks"->fluidTicks; + case "getGameTime"->f.get("game_time").getAsLong(); + case "nextSubTickCount"->tickOrder[0]++; + case "scheduleTick","createTick","isEmptyBlock"->InvocationHandler.invokeDefault(proxy,method,values); case "getMinY"->-64; case "getSeaLevel"->0; case "getHeight"->{ @@ -82,8 +101,18 @@ public final class VanillaFeatureRegionOracle { } out.println("repeat "+repeat); } + for(var raw:f.getAsJsonArray("tick_commands")){ + var command=raw.getAsJsonArray();String kind=command.get(0).getAsString();int id=command.get(1).getAsInt();var xyz=command.get(2).getAsJsonArray();var p=new BlockPos(xyz.get(0).getAsInt(),xyz.get(1).getAsInt(),xyz.get(2).getAsInt());int delay=command.get(3).getAsInt(); + out.println("tickrequest "+kind+" "+id); + try{if(kind.equals("block"))world.scheduleTick(p,Block.stateById(id).getBlock(),delay);else world.scheduleTick(p,fluids[id],delay);out.println("tickresult ok");}catch(RuntimeException error){out.println("tickresult error");} + out.println("tickorder "+tickOrder[0]); + } for(var entry:chunks.entrySet()) { var cp=entry.getKey();var chunk=entry.getValue();out.println("chunk "+cp.x()+" "+cp.z()); + out.println("blockticks "+chunk.getBlockTicks().count()); + for(var tick:((SerializableTickContainer)chunk.getBlockTicks()).pack(f.get("game_time").getAsLong()))out.println("bt "+Block.getId(tick.type().defaultBlockState())+" "+tick.pos().getX()+" "+tick.pos().getY()+" "+tick.pos().getZ()+" "+tick.delay()+" "+tick.priority().getValue()); + out.println("fluidticks "+chunk.getFluidTicks().count()); + for(var tick:((SerializableTickContainer)chunk.getFluidTicks()).pack(f.get("game_time").getAsLong()))out.println("ft "+BuiltInRegistries.FLUID.getKey(tick.type())+" "+tick.pos().getX()+" "+tick.pos().getY()+" "+tick.pos().getZ()+" "+tick.delay()+" "+tick.priority().getValue()); for(var kind:Heightmap.Types.values()) { if(chunk.hasPrimedHeightmap(kind)){out.println("map "+kind.name());for(long word:chunk.getOrCreateHeightmapUnprimed(kind).getRawData())out.println(Long.toUnsignedString(word,16));} else out.println("missing "+kind.name()); diff --git a/tools/test_feature_region_parity.py b/tools/test_feature_region_parity.py index c65ba734a..45f53cdd3 100644 --- a/tools/test_feature_region_parity.py +++ b/tools/test_feature_region_parity.py @@ -22,6 +22,14 @@ def corpus(facts): layers=[{'feature':{'type':'fill_layer','height':height,'state':state},'placement':[]} for height,state in [(32,'water'),(16,{'id':'oak_log','properties':{'axis':'x'}}),(8,'air'),(4064,'stone')]] targets=[{'target':{'predicate_type':'block_match','block':'stone'},'state':'iron_ore'},{'target':{'predicate_type':'block_match','block':'oak_log'},'state':'copper_ore'}] features=leaves+[{'type':'sequence','features':layers},{'type':'replace_single_block','targets':targets},{'type':'scattered_ore','targets':targets,'size':16,'discard_chance_on_air_exposure':0.5}] + features.append({'type':'spring_feature','state':{'id':'water','properties':{'falling':'false'}},'requires_block_below':False,'rock_count':5,'hole_count':5,'valid_blocks':['air','stone','dirt']}) + get=lambda name:facts['defaults']['minecraft:'+name] + log_x=next(i for i,state in enumerate(facts['states']) if state[4]['id']=='minecraft:oak_log' and state[4].get('properties',{}).get('axis')=='x') + ticks=[] + for p in [[0,-40,0],[-1,-64,-1],[16,100,16],[32,0,0],[-17,0,0],[2147483647,-2147483648,0]]: + for kind,value in [('block',get('water')),('fluid',2),('block',log_x),('block',get('oak_log'))]: + for delay in [-2147483648,0,2147483647]:ticks.append([kind,value,p,delay]) + for kind in range(5):ticks.append(['fluid',kind,[0,-40,0],-1]) chains=[ [{'type':'count','count':2},{'type':'in_square'},{'type':'heightmap','heightmap':'MOTION_BLOCKING'}], [{'type':'count_on_every_layer','count':1},{'type':'offset','x':0,'y':1,'z':0}], @@ -34,7 +42,7 @@ def corpus(facts): for reject in [0,3]: for placement in chains: for worldgen in [False,True]: - yield {'worldgen':worldgen,'legacy':legacy,'seed':seed,'stage':stage,'fail':fail,'reject':reject,'placement':placement,'features':features} + yield {'worldgen':worldgen,'legacy':legacy,'seed':seed,'stage':stage,'fail':fail,'reject':reject,'placement':placement,'features':features,'tick_commands':ticks,'game_time':9223372036854775807 if worldgen else -9223372036854775808,'tick_order':9223372036854775803 if legacy else -9223372036854775808} def main(): @@ -83,9 +91,9 @@ def main(): base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) report={"schema":1,"minecraft":lock["minecraft"]["version"],"manifest_sha1":lock["minecraft"]["manifest_sha1"],"platform":platform.platform(), "java":subprocess.check_output(["java","--version"],text=True).splitlines()[0],"rustc":subprocess.check_output(["rustc","--version"],text=True).strip(), - "block_states":len(facts["states"]),"block_tag_files":len(tags),"fixtures":len(fixtures),"worldgen_random_modes":[False,True],"resident_chunks_per_fixture":9,"requested_placements":sum(len(f["features"])*2 for f in fixtures), + "block_states":len(facts["states"]),"block_tag_files":len(tags),"fixtures":len(fixtures),"worldgen_random_modes":[False,True],"resident_chunks_per_fixture":9,"requested_placements":sum(len(f["features"])*2 for f in fixtures),"direct_tick_requests":sum(len(f["tick_commands"]) for f in fixtures), "sources_sha256":tested_sources,"fixtures_sha256":tested_fixtures,"rust_output_sha256":lab.digest(build/"rust.txt","sha256"),"references":references, - "scope":"Native FeaturePlacer and three basic block-writing features, a composed sequence of four configured fill layers, single-block replacements and scattered ore share a world proxy backed by nine actual ProtoChunks. Configured water, horizontal logs, air, out-of-height fills and ore/replacement rules test graph-to-region binding. Initial two-layer stone/dirt terrain, both pre-light heightmap groups, count/square/heightmap/layered modifier chains, repeated placements, direct and WorldgenRandom-wrapped random streams, missing-neighbor errors, rejected writes and injected partial failures are compared. Final complete raw sections, heightmap presence and packed words are compared alongside ordered feature writes, update flags, explicit height queries and subsequent random draws. Rust uses resident registry-backed chunks, lazy heightmap priming and a caller-supplied write callback; imported air/fluid facts and bundled block tags bind independently across authenticated JARs. The proxy supplies storage mutation only. Actual WorldGenRegion construction, write-zone policy, POIs, block entities, postprocessing effects, lighting, complete feature registries and complete world generation remain outside this comparison."} + "scope":"Native FeaturePlacer and three basic block-writing features, a composed sequence of four configured fill layers, single-block replacements, scattered ore and water springs share a world proxy backed by nine actual ProtoChunks. Configured water, horizontal logs, air, out-of-height fills and ore/replacement rules test graph-to-region binding. Initial two-layer stone/dirt terrain, both pre-light heightmap groups, count/square/heightmap/layered modifier chains, repeated placements, direct and WorldgenRandom-wrapped random streams, missing-neighbor errors, rejected writes and injected partial failures are compared. Final complete raw sections, heightmap presence and packed words are compared alongside ordered feature writes, update flags, explicit height queries and subsequent random draws. Rust uses resident registry-backed chunks, lazy heightmap priming and a caller-supplied write callback; imported air/fluid facts and bundled block tags bind independently across authenticated JARs. The proxy supplies storage mutation and actual native default scheduleTick/createTick methods routed through WorldGenTickAccess into each ProtoChunk. Separate block/fluid queues, first-request deduplication, nondefault-state block identity, shared tick-order advancement on duplicates and missing-chunk errors, out-of-height requests and wrapped clock values are compared, including saved queue order and priorities. Actual WorldGenRegion construction, write-zone policy, POIs, block entities, postprocessing execution, lighting, block/fluid tick execution, complete feature registries and complete world generation remain outside this comparison."} lab.write_json(report_path,report);print(f"Scoped feature-region parity passed: {report_path}") From 43d5793f6bbc1c81c4bd442f694f4230f7931a79 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 13:57:32 +0200 Subject: [PATCH 029/253] Bind resident region fluid states and resolved tag queries --- .../scoped-parity.json | 206 ++++++++++++++++++ .../examples/feature_region_fixture.rs | 119 +++++++++- .../src/worldgen/block_feature.rs | 2 +- .../src/worldgen/feature_region.rs | 89 +++++++- .../src/worldgen/fluid_predicate.rs | 12 + crates/horizon-world/tests/feature_region.rs | 73 ++++++- docs/rust-parity.md | 18 ++ .../parity/VanillaFeatureRegionOracle.java | 39 +++- tools/test_feature_region_parity.py | 18 +- 9 files changed, 560 insertions(+), 16 deletions(-) create mode 100644 benchmarks/rust-feature-region-queries-2026-10-06/scoped-parity.json diff --git a/benchmarks/rust-feature-region-queries-2026-10-06/scoped-parity.json b/benchmarks/rust-feature-region-queries-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..0500ddb6b --- /dev/null +++ b/benchmarks/rust-feature-region-queries-2026-10-06/scoped-parity.json @@ -0,0 +1,206 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "block_states": 35723, + "direct_state_probes": 35723, + "block_tag_files": 300, + "fixtures": 192, + "worldgen_random_modes": [ + false, + true + ], + "resident_chunks_per_fixture": 9, + "requested_placements": 2688, + "direct_tick_requests": 14784, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureRegionOracle.java": "a18a9d6184528b40b5fa853fd30208a400d7b749b3138659fdf209c33649d247", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", + "tools/test_feature_region_parity.py": "9a1d8da1ceaa657d6d70a7697c2761a881b63e1ddf3ba6134d840ed3165d6ec6", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "a8cd85f6223668c1446ff103276d80937b9707d9a7dc619a176b1b1ceed36a4a", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "1eae82604d2b3377fd35aaa3a914a67e5af28f93923815a49e895b4d437433cd", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "98bc93dff1373e3b6f4dcf8c4c2b05b56814acd4f66302834aa5877fe90ec7b9", + "crates/horizon-world/src/worldgen/feature_region.rs": "ae7552027b2efc0db6299dc14ab04c28615e43b876b5d67644855fd7a047e33e", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "b7a59a712d2e376e8f32ec1e1fd901df452c8019e06910c39d469816be63a14f", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "b8fb9fb80a66a851d916f07f15df1a40b6cc95b49e71aaec4d4b4107f13d9f9f", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "072d31a3b814eda9cc9bdc1da06a7dab43c38f133824bfd00f55ebb8452d8b88", + "crates/horizon-world/examples/feature_region_fixture.rs": "d29cb51653d7b6f249c2748d4f9df2c4e2358acf4d8fc57a21c8d69cb17be19c" + }, + "fixtures_sha256": { + ".local/rust-feature-region-parity/inputs.txt": "14e3cc52de74d24351a010e4c7b7ad7aae961a358dff754a3161dd58d050acad", + ".local/rust-feature-region-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0", + ".local/rust-feature-region-parity/fluid-tags.json": "f1e5eb6d22ea7effbb118a2282709cfdeef1bfae4516b775a55ad7a4df29d7d0", + ".local/rust-feature-region-parity/facts-client.json": "1d24883ee807b0b71473f0bbf8ed548ddaf712148caeb3fcc7aa13ab973a97b0", + ".local/rust-feature-region-parity/facts-server.json": "1d24883ee807b0b71473f0bbf8ed548ddaf712148caeb3fcc7aa13ab973a97b0" + }, + "rust_output_sha256": "33c6e7d07bd985f468d3fd7d8d8040001664316e6551fa753d00e1ec90c9ea90", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "33c6e7d07bd985f468d3fd7d8d8040001664316e6551fa753d00e1ec90c9ea90", + "matched_output_lines": 29312766 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "33c6e7d07bd985f468d3fd7d8d8040001664316e6551fa753d00e1ec90c9ea90", + "matched_output_lines": 29312766 + } + ], + "scope": "Native FeaturePlacer and three basic block-writing features, a composed sequence of four configured fill layers, single-block replacements, scattered ore and water springs share a world proxy backed by nine actual ProtoChunks. Configured water, horizontal logs, air, out-of-height fills and ore/replacement rules test graph-to-region binding. Initial two-layer stone/dirt terrain, both pre-light heightmap groups, count/square/heightmap/layered modifier chains, repeated placements, direct and WorldgenRandom-wrapped random streams, missing-neighbor errors, rejected writes and injected partial failures are compared. Final complete raw sections, heightmap presence and packed words are compared alongside ordered feature writes, update flags, explicit height queries and subsequent random draws. Rust uses resident registry-backed chunks, lazy heightmap priming and a caller-supplied write callback; imported air/fluid facts and bundled block tags bind independently across authenticated JARs. The proxy supplies storage mutation and actual native default scheduleTick/createTick methods routed through WorldGenTickAccess into each ProtoChunk. Separate block/fluid queues, first-request deduplication, nondefault-state block identity, shared tick-order advancement on duplicates and missing-chunk errors, out-of-height requests and wrapped clock values are compared, including saved queue order and priorities. All block states are also written into resident chunks, queried through feature access, cleared and queried again; contained fluid identity/amount/falling/source/full flags, water-tag membership and every bundled block tag plus an absent tag are compared. Negative coordinates, chunk edges, outside-height and absent chunks are covered. Block/fluid query bindings are an immutable registry-checked shared snapshot. Actual WorldGenRegion construction, write-zone policy, POIs, block entities, postprocessing execution, lighting, block/fluid tick execution, complete feature registries and complete world generation remain outside this comparison." +} diff --git a/crates/horizon-world/examples/feature_region_fixture.rs b/crates/horizon-world/examples/feature_region_fixture.rs index 953b280fb..6a4409a76 100644 --- a/crates/horizon-world/examples/feature_region_fixture.rs +++ b/crates/horizon-world/examples/feature_region_fixture.rs @@ -78,6 +78,8 @@ fn fixture( f: &Value, registry: &BlockRegistry, states: &[State], + bindings: &FeatureBlockBindings<'_>, + tags: &[String], out: &mut impl Write, ) -> Result<(), Box> { let seed = f["seed"].as_i64().unwrap(); @@ -85,19 +87,39 @@ fn fixture( f["legacy"].as_bool().unwrap(), f["worldgen"].as_bool().unwrap(), ) { - (true, false) => run(f, registry, states, out, LegacyRandom::new(seed)), + (true, false) => run( + f, + registry, + states, + bindings, + tags, + out, + LegacyRandom::new(seed), + ), (true, true) => run( f, registry, states, + bindings, + tags, out, WorldgenRandom::new(LegacyRandom::new(seed)), ), - (false, false) => run(f, registry, states, out, XoroshiroRandom::new(seed)), + (false, false) => run( + f, + registry, + states, + bindings, + tags, + out, + XoroshiroRandom::new(seed), + ), (false, true) => run( f, registry, states, + bindings, + tags, out, WorldgenRandom::new(XoroshiroRandom::new(seed)), ), @@ -107,6 +129,8 @@ fn run( f: &Value, registry: &BlockRegistry, states: &[State], + bindings: &FeatureBlockBindings<'_>, + tags: &[String], out: &mut impl Write, mut random: impl RandomSource, ) -> Result<(), Box> { @@ -145,16 +169,14 @@ fn run( .with_tick_clock( f["game_time"].as_i64().unwrap(), f["tick_order"].as_i64().unwrap(), - ); + ) + .with_block_bindings(bindings)?; let blocks = FeatureBlocks::from_registry(registry)?; - // These configured fixture states use compact names and an enum property; - // no integer-property parsing is requested by this region corpus. - let bindings = FeatureBlockBindings::new(registry, BTreeSet::new())?; let features = f["features"] .as_array() .unwrap() .iter() - .map(|v| FeatureDefinition::from_json_with_blocks(&v.to_string(), &bindings)) + .map(|v| FeatureDefinition::from_json_with_blocks(&v.to_string(), bindings)) .collect::, _>>()?; let modifiers = f["placement"] .as_array() @@ -236,6 +258,30 @@ fn run( )?; writeln!(out, "tickorder {}", region.tick_clock().1)?; } + for id in f["probe_states"].as_array().unwrap() { + let id = n(id) as u32; + let p = [[0, -64, 0], [-1, -49, -1], [16, -1, 16], [31, -32, 31]][id as usize % 4]; + writeln!(out, "probe {id}")?; + for state in [ + BlockStateId(id), + registry.default_state("minecraft:air").unwrap(), + ] { + region.set_block_worldgen(p, state)?; + let mut world = TerrainFeatureAccess::new(&mut region, ()); + query_state(&mut world, p, tags, out)?; + } + } + for p in [ + [0, -65, 0], + [31, 0, 31], + [-1, i32::MIN, -1], + [16, i32::MAX, 16], + [-17, -40, 0], + [32, -40, 0], + [i32::MAX, i32::MIN, 0], + ] { + query_state(&mut region, p, tags, out)?; + } for chunk in region.chunks() { let p = chunk.position(); writeln!(out, "chunk {} {}", p.x, p.z)?; @@ -280,6 +326,39 @@ fn run( writeln!(out, "tail {}", random.next_long())?; Ok(()) } +fn query_state( + world: &mut impl PlacementContext, + p: [i32; 3], + tags: &[String], + out: &mut impl Write, +) -> io::Result<()> { + writeln!(out, "query {} {} {}", p[0], p[1], p[2])?; + match world.fluid_state(p) { + Ok(fluid) => writeln!( + out, + "fluid {} {} {} {} {}", + fluid.kind().name(), + fluid.amount(), + fluid.falling(), + fluid.is_full(), + fluid.is_source() + )?, + Err(_) => writeln!(out, "fluid error")?, + } + match world.water_at(p) { + Ok(water) => writeln!(out, "water {water}")?, + Err(_) => writeln!(out, "water error")?, + } + let mut bits = String::new(); + for tag in tags { + bits.push(match world.block_matches_tag(p, tag) { + Ok(true) => '1', + Ok(false) => '0', + Err(_) => 'E', + }); + } + writeln!(out, "tags {bits}") +} fn main() -> Result<(), Box> { let arg = std::env::args().nth(1).expect("private fixture directory"); let dir = Path::new(&arg); @@ -329,9 +408,33 @@ fn main() -> Result<(), Box> { } }) .collect(); + let fluid_resources: std::collections::BTreeMap = + serde_json::from_str(&fs::read_to_string(dir.join("fluid-tags.json"))?)?; + let mut fluid_defs = TagDefinitions::default(); + for (name, text) in fluid_resources { + fluid_defs.apply_json(&name, "vanilla", &text)?; + } + let fluid_tags = + fluid_defs.build(|name, _| FluidKind::from_name(name).map(|_| name.to_owned()))?; + assert!(fluid_tags.missing.is_empty()); + let bindings = FeatureBlockBindings::with_tags(®istry, BTreeSet::new(), &built.tags)? + .with_fluid_tags(&fluid_tags.tags)?; + let tags: Vec<_> = built + .tags + .keys() + .cloned() + .chain(std::iter::once("horizon:absent".into())) + .collect(); let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { - fixture(&serde_json::from_str(line)?, ®istry, &states, &mut out)?; + fixture( + &serde_json::from_str(line)?, + ®istry, + &states, + &bindings, + &tags, + &mut out, + )?; } out.flush()?; Ok(()) diff --git a/crates/horizon-world/src/worldgen/block_feature.rs b/crates/horizon-world/src/worldgen/block_feature.rs index 831e9a142..3616bacb2 100644 --- a/crates/horizon-world/src/worldgen/block_feature.rs +++ b/crates/horizon-world/src/worldgen/block_feature.rs @@ -24,7 +24,7 @@ pub struct FeatureBlockBindings<'r> { physical_properties: Option<[BoundBlockProperty; 4]>, pub(crate) occlusion_faces: Option, biomes: Option>, - fluids: super::fluid_predicate::FluidPredicateBindings, + pub(crate) fluids: super::fluid_predicate::FluidPredicateBindings, pub(crate) codec: BlockStateJsonCodec<'r>, pub(crate) blocks: BTreeMap>>, pub(crate) tags: BTreeMap>>, diff --git a/crates/horizon-world/src/worldgen/feature_region.rs b/crates/horizon-world/src/worldgen/feature_region.rs index d5e967fa2..8bcfc2077 100644 --- a/crates/horizon-world/src/worldgen/feature_region.rs +++ b/crates/horizon-world/src/worldgen/feature_region.rs @@ -21,11 +21,20 @@ use horizon_core::{ WorldGenTickContainers, }, }; -use std::collections::BTreeMap; +use std::{ + collections::{BTreeMap, BTreeSet}, + sync::Arc, +}; + +struct RegionBlockQueries { + fluids: super::fluid_predicate::FluidPredicateBindings, + tags: BTreeMap>>, +} #[derive(Debug)] pub enum RegionError { InvalidChunks, + InvalidBindings, InvalidTickState(BlockStateId), MissingChunk([i32; 2]), Terrain(TerrainError), @@ -56,6 +65,7 @@ pub struct TerrainRegion<'r, B: TerrainBlockStates> { sea_level: i32, game_time: i64, next_tick_order: i64, + block_queries: Option, } impl<'r, B: TerrainBlockStates> TerrainRegion<'r, B> { pub fn new( @@ -84,6 +94,7 @@ impl<'r, B: TerrainBlockStates> TerrainRegion<'r, B> { sea_level: generator.sea_level, game_time: 0, next_tick_order: 0, + block_queries: None, min_y, height, generation: WorldGenerationContext::with_generator( @@ -95,6 +106,24 @@ impl<'r, B: TerrainBlockStates> TerrainRegion<'r, B> { ), }) } + /// Bind an immutable snapshot of fluid states and resolved block/fluid tags. + /// Tables are shared with configured features; registry identities must match. + pub fn with_block_bindings( + mut self, + bindings: &super::block_feature::FeatureBlockBindings<'r>, + ) -> Result { + if !std::ptr::eq( + self.chunks.first_key_value().unwrap().1.registry(), + bindings.registry(), + ) { + return Err(RegionError::InvalidBindings); + } + self.block_queries = Some(RegionBlockQueries { + fluids: bindings.fluids.clone(), + tags: bindings.tags.clone(), + }); + Ok(self) + } /// Supply the owning world's current time and region-local next tick order. pub fn with_tick_clock(mut self, game_time: i64, next_tick_order: i64) -> Self { self.game_time = game_time; @@ -107,6 +136,8 @@ impl<'r, B: TerrainBlockStates> TerrainRegion<'r, B> { pub fn set_game_time(&mut self, game_time: i64) { self.game_time = game_time; } + /// Raw tick identities are default block-state IDs for block ticks and + /// `FluidKind` discriminants for fluid ticks, in separate namespaces. pub fn schedule_tick( &mut self, kind: TickKind, @@ -217,6 +248,45 @@ impl WorldGenTickContainers for RegionTickContainers<'_, } } impl PlacementContext for TerrainRegion<'_, B> { + fn fluid_state( + &mut self, + position: [i32; 3], + ) -> Result { + let queries = self + .block_queries + .as_ref() + .ok_or(PlacementQueryError::Unavailable)?; + let state = self.block(position)?; + queries + .fluids + .state(state) + .ok_or_else(|| PlacementQueryError::Failed("fluid state outside bound registry".into())) + } + fn water_at(&mut self, position: [i32; 3]) -> Result { + let queries = self + .block_queries + .as_ref() + .ok_or(PlacementQueryError::Unavailable)?; + Ok(queries + .fluids + .state_matches_tag(self.block(position)?, "minecraft:water")) + } + fn block_matches_tag( + &mut self, + position: [i32; 3], + tag: &str, + ) -> Result { + let queries = self + .block_queries + .as_ref() + .ok_or(PlacementQueryError::Unavailable)?; + let state = self.block(position)?; + Ok(queries + .tags + .get(tag) + .is_some_and(|states| states.contains(&state))) + } + fn schedule_block_tick( &mut self, position: [i32; 3], @@ -314,6 +384,23 @@ impl<'a, 'r, B: TerrainBlockStates, F> TerrainFeatureAccess<'a, 'r, B, F> { } } impl PlacementContext for TerrainFeatureAccess<'_, '_, B, F> { + fn fluid_state( + &mut self, + position: [i32; 3], + ) -> Result { + self.region.fluid_state(position) + } + fn water_at(&mut self, position: [i32; 3]) -> Result { + self.region.water_at(position) + } + fn block_matches_tag( + &mut self, + position: [i32; 3], + tag: &str, + ) -> Result { + self.region.block_matches_tag(position, tag) + } + fn schedule_block_tick( &mut self, position: [i32; 3], diff --git a/crates/horizon-world/src/worldgen/fluid_predicate.rs b/crates/horizon-world/src/worldgen/fluid_predicate.rs index bc227d577..d8bcb10ab 100644 --- a/crates/horizon-world/src/worldgen/fluid_predicate.rs +++ b/crates/horizon-world/src/worldgen/fluid_predicate.rs @@ -5,6 +5,7 @@ use crate::{ registry::{BlockRegistry, BlockStateId}, }; use std::{collections::BTreeMap, sync::Arc}; +#[derive(Clone)] pub struct FluidPredicateBindings { table: Arc, tags: BTreeMap, @@ -44,6 +45,17 @@ impl FluidPredicateBindings { self.tags = resolved; Ok(self) } + pub fn state(&self, block: BlockStateId) -> Option { + self.table.get(block) + } + /// Missing tags have no members, as for a native tag-key membership query. + pub fn state_matches_tag(&self, block: BlockStateId, tag: &str) -> bool { + self.table.get(block).is_some_and(|state| { + self.tags + .get(tag) + .is_some_and(|mask| state.kind().mask() & mask != 0) + }) + } pub fn resolve(&self, json: &str) -> Result { let mask = if let Ok(name) = serde_json::from_str::(json) { if let Some(tag) = name.strip_prefix('#') { diff --git a/crates/horizon-world/tests/feature_region.rs b/crates/horizon-world/tests/feature_region.rs index 9cb2d7f5f..65c5e7343 100644 --- a/crates/horizon-world/tests/feature_region.rs +++ b/crates/horizon-world/tests/feature_region.rs @@ -47,6 +47,7 @@ fn registry() -> BlockRegistry { "minecraft:grass_block", "minecraft:mycelium", "minecraft:dirt", + "minecraft:cave_air", ]; BlockRegistry::from_nbt(&Tag::compound([ ("DataVersion", Tag::Int(DATA_VERSION)), @@ -55,7 +56,18 @@ fn registry() -> BlockRegistry { Tag::List( names .iter() - .map(|name| Tag::compound([("id", Tag::String((*name).into()))])) + .map(|name| { + let mut tag = Tag::compound([("id", Tag::String((*name).into()))]); + if *name == "minecraft:water" { + if let Tag::Compound(entries) = &mut tag { + entries.insert( + "properties".into(), + Tag::compound([("level", Tag::String("0".into()))]), + ); + } + } + tag + }) .collect(), ), ), @@ -172,3 +184,62 @@ fn postprocessing_routes_to_resident_chunks_and_preserves_partial_marks() { &[vec![255, 255], vec![3840]] ); } + +#[test] +fn query_bindings_reject_foreign_registries_and_preserve_resolved_tag_snapshot() { + use horizon_world::{ + fluid::FluidKind, + worldgen::{block_feature::FeatureBlockBindings, placement::PlacementQueryError}, + }; + use std::collections::{BTreeMap, BTreeSet}; + let foreign = registry(); + let registry = registry(); + let chunk = || TerrainChunk::new(ChunkPos::new(-1, 0), 0, 16, ®istry, Properties).unwrap(); + let context = WorldGenerationContext::new(0, 16, 8); + let bindings = FeatureBlockBindings::new(&foreign, BTreeSet::new()).unwrap(); + assert!(matches!( + TerrainRegion::new(vec![chunk()], context) + .unwrap() + .with_block_bindings(&bindings), + Err(RegionError::InvalidBindings) + )); + let mut region = TerrainRegion::new(vec![chunk()], context).unwrap(); + assert_eq!( + region.fluid_state([-1, 0, 0]), + Err(PlacementQueryError::Unavailable) + ); + let tags = BTreeMap::from([("horizon:ground".into(), vec!["minecraft:stone".into()])]); + // Deliberately make the water tag contain EMPTY, not water, to catch a + // hard-coded water-family check instead of resolved tag membership. + let fluids = BTreeMap::from([("minecraft:water".into(), vec!["minecraft:empty".into()])]); + let bindings = FeatureBlockBindings::with_tags(®istry, BTreeSet::new(), &tags) + .unwrap() + .with_fluid_tags(&fluids) + .unwrap(); + region = region.with_block_bindings(&bindings).unwrap(); + drop(bindings); + region + .set_block_worldgen([-1, 0, 0], BlockStateId(3)) + .unwrap(); + assert_eq!( + region.fluid_state([-1, 0, 0]).unwrap().kind(), + FluidKind::Water + ); + assert!(!region.water_at([-1, 0, 0]).unwrap()); + region + .set_block_worldgen([-1, 0, 0], BlockStateId(2)) + .unwrap(); + assert!( + region + .block_matches_tag([-1, 0, 0], "horizon:ground") + .unwrap() + ); + assert!( + !region + .block_matches_tag([-1, 0, 0], "horizon:missing") + .unwrap() + ); + assert!(region.water_at([-1, 0, 0]).unwrap()); + assert!(region.water_at([-1, 16, 0]).unwrap()); + assert!(region.fluid_state([0, 0, 0]).is_err()); +} diff --git a/docs/rust-parity.md b/docs/rust-parity.md index 1d18e695d..5948c3b94 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -694,3 +694,21 @@ fluid identities, missing chunks, out-of-height positions and time/order overflo Workspace tests and all-target Clippy pass. This connects generation-stage queues; block/fluid tick execution, complete chunk persistence and full world-generation effects remain pending. + +## Resident block and fluid queries + +Feature regions can bind an immutable snapshot of resolved block/fluid tags and +contained fluid states. The snapshot shares compiled tables with configured +features and rejects bindings from a different block registry. Feature access +forwards fluid, water-tag and block-tag queries against current resident storage. +Missing tags have no members; missing chunks remain query errors. + +The [resident query comparison](../benchmarks/rust-feature-region-queries-2026-10-06/scoped-parity.json) +matches **29,312,766 lines per reference JAR**, retaining the 192 multi-chunk +feature/tick fixtures and adding insertion/removal probes for **all 35,723 block +states**. Each probe checks fluid identity, amount, falling/source/full flags, +water membership and all 300 bundled block tags plus an absent tag. Negative +coordinates, chunk edges, outside-height reads and missing chunks are included. +Workspace tests and all-target Clippy pass; a separate regression covers foreign +registries, binding lifetime and a custom water tag. These queries do not execute +fluid spreading, block behavior or lighting. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureRegionOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureRegionOracle.java index 39535438f..ab8749812 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureRegionOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureRegionOracle.java @@ -9,6 +9,7 @@ import java.util.*; import net.minecraft.core.*; import net.minecraft.core.registries.*; import net.minecraft.resources.*; +import net.minecraft.tags.*; import net.minecraft.world.ticks.*; import net.minecraft.world.level.material.*; import net.minecraft.util.RandomSource; @@ -27,6 +28,30 @@ public final class VanillaFeatureRegionOracle { private static ProtoChunk chunk(Map chunks,int x,int z) { var chunk=chunks.get(new ChunkPos(x>>4,z>>4));if(chunk==null)throw new IllegalArgumentException("missing region chunk");return chunk; } + private static void bindFluidTags(JsonObject resources) { + var registry=BuiltInRegistries.FLUID; + var loader=new TagLoader>((id,required)->registry.get(id).map(value->(Holder)value),"tags/fluid"); + var definitions=new HashMap>(); + for(var item:resources.entrySet()) { + var file=TagFile.CODEC.parse(JsonOps.INSTANCE,JsonParser.parseString(item.getValue().getAsString())).getOrThrow(); + var entries=new ArrayList(); + for(var entry:file.entries())entries.add(new TagLoader.EntryWithSource(entry,"vanilla")); + definitions.put(Identifier.parse(item.getKey()),entries); + } + var tags=new HashMap,List>>(); + loader.build(definitions).forEach((id,values)->tags.put(TagKey.create(Registries.FLUID,id),List.copyOf(values))); + if(tags.size()!=resources.size())throw new AssertionError("incomplete fluid tags"); + registry.prepareTagReload(new TagLoader.LoadResult<>(Registries.FLUID,tags)).apply(); + } + private static void queryState(WorldGenLevel world, BlockPos p, List tags, PrintWriter out) { + out.println("query "+p.getX()+" "+p.getY()+" "+p.getZ()); + try { var fluid=world.getFluidState(p); boolean falling=fluid.hasProperty(FlowingFluid.FALLING)&&fluid.getValue(FlowingFluid.FALLING); out.println("fluid "+BuiltInRegistries.FLUID.getKey(fluid.getType())+" "+fluid.getAmount()+" "+falling+" "+fluid.isFull()+" "+fluid.isSource()); } + catch(RuntimeException error){out.println("fluid error");} + try {out.println("water "+world.isWaterAt(p));}catch(RuntimeException error){out.println("water error");} + var bits=new StringBuilder(); + for(var tag:tags){try{bits.append(world.getBlockState(p).is(TagKey.create(Registries.BLOCK,Identifier.parse(tag)))?'1':'0');}catch(RuntimeException error){bits.append('E');}} + out.println("tags "+bits); + } @SuppressWarnings("unchecked") public static void main(String[] args) throws Exception { if(args[0].equals("export")){VanillaHeightmapOracle.main(args);return;} @@ -36,6 +61,8 @@ public final class VanillaFeatureRegionOracle { var ids=new IdMapper>();ids.add(biome); var factory=new PalettedContainerFactory(Strategy.createForBlockStates(Block.BLOCK_STATE_REGISTRY),Blocks.AIR.defaultBlockState(),null,Strategy.createForBiomes(ids),biome,null); VanillaHeightmapOracle.bindTags(JsonParser.parseString(Files.readString(dir.resolve("tags.json"))).getAsJsonObject()); + bindFluidTags(JsonParser.parseString(Files.readString(dir.resolve("fluid-tags.json"))).getAsJsonObject()); + var queryTags=new ArrayList<>(new TreeSet<>(JsonParser.parseString(Files.readString(dir.resolve("tags.json"))).getAsJsonObject().keySet()));queryTags.add("horizon:absent"); var contextMethod=VanillaPlacementOracle.class.getDeclaredMethod("context",JsonObject.class);contextMethod.setAccessible(true); var bounds=new JsonObject();bounds.add("context",JsonParser.parseString("[-64,64,0]")); var generator=((PlacementContext)contextMethod.invoke(null,bounds)).generator(); @@ -71,7 +98,7 @@ public final class VanillaFeatureRegionOracle { case "getFluidTicks"->fluidTicks; case "getGameTime"->f.get("game_time").getAsLong(); case "nextSubTickCount"->tickOrder[0]++; - case "scheduleTick","createTick","isEmptyBlock"->InvocationHandler.invokeDefault(proxy,method,values); + case "scheduleTick","createTick","isEmptyBlock","isWaterAt"->InvocationHandler.invokeDefault(proxy,method,values); case "getMinY"->-64; case "getSeaLevel"->0; case "getHeight"->{ @@ -79,6 +106,7 @@ public final class VanillaFeatureRegionOracle { var kind=(Heightmap.Types)values[0];int x=(Integer)values[1],z=(Integer)values[2];yield chunk(chunks,x,z).getHeight(kind,x&15,z&15)+1; } case "getMaxY","isInsideBuildHeight","isOutsideBuildHeight","setBlockAndUpdate"->InvocationHandler.invokeDefault(proxy,method,values); + case "getFluidState"->{var p=(BlockPos)values[0];yield chunk(chunks,p.getX(),p.getZ()).getFluidState(p);} case "getBlockState"->{var p=(BlockPos)values[0];yield chunk(chunks,p.getX(),p.getZ()).getBlockState(p);} case "setBlock"->{ var p=(BlockPos)values[0];var state=(BlockState)values[1];int flags=(Integer)values[2]; @@ -107,6 +135,15 @@ public final class VanillaFeatureRegionOracle { try{if(kind.equals("block"))world.scheduleTick(p,Block.stateById(id).getBlock(),delay);else world.scheduleTick(p,fluids[id],delay);out.println("tickresult ok");}catch(RuntimeException error){out.println("tickresult error");} out.println("tickorder "+tickOrder[0]); } + for(var value:f.getAsJsonArray("probe_states")) { + int id=value.getAsInt();int[] xyz=new int[][]{{0,-64,0},{-1,-49,-1},{16,-1,16},{31,-32,31}}[id%4];var p=new BlockPos(xyz[0],xyz[1],xyz[2]); + out.println("probe "+id); + for(var state:new BlockState[]{Block.stateById(id),Blocks.AIR.defaultBlockState()}) { + chunk(chunks,p.getX(),p.getZ()).setBlockState(p,state,3); + queryState(world,p,queryTags,out); + } + } + for(int[] xyz:new int[][]{{0,-65,0},{31,0,31},{-1,Integer.MIN_VALUE,-1},{16,Integer.MAX_VALUE,16},{-17,-40,0},{32,-40,0},{Integer.MAX_VALUE,Integer.MIN_VALUE,0}})queryState(world,new BlockPos(xyz[0],xyz[1],xyz[2]),queryTags,out); for(var entry:chunks.entrySet()) { var cp=entry.getKey();var chunk=entry.getValue();out.println("chunk "+cp.x()+" "+cp.z()); out.println("blockticks "+chunk.getBlockTicks().count()); diff --git a/tools/test_feature_region_parity.py b/tools/test_feature_region_parity.py index 45f53cdd3..40037f489 100644 --- a/tools/test_feature_region_parity.py +++ b/tools/test_feature_region_parity.py @@ -8,6 +8,7 @@ from pathlib import Path import platform import random import subprocess +import zipfile try: from . import lab, test_rust_parity as base, test_worldgen_parity as worldgen @@ -35,6 +36,7 @@ def corpus(facts): [{'type':'count_on_every_layer','count':1},{'type':'offset','x':0,'y':1,'z':0}], [{'type':'count','count':2},{'type':'heightmap','heightmap':'WORLD_SURFACE'},{'type':'offset','x':1,'y':0,'z':1}], ] + fixture_index=0 for legacy in [False,True]: for seed in [0,-1]: for stage in ['empty','terrain']: @@ -42,7 +44,8 @@ def corpus(facts): for reject in [0,3]: for placement in chains: for worldgen in [False,True]: - yield {'worldgen':worldgen,'legacy':legacy,'seed':seed,'stage':stage,'fail':fail,'reject':reject,'placement':placement,'features':features,'tick_commands':ticks,'game_time':9223372036854775807 if worldgen else -9223372036854775808,'tick_order':9223372036854775803 if legacy else -9223372036854775808} + yield {'probe_states':list(range(fixture_index,len(facts['states']),192)),'worldgen':worldgen,'legacy':legacy,'seed':seed,'stage':stage,'fail':fail,'reject':reject,'placement':placement,'features':features,'tick_commands':ticks,'game_time':9223372036854775807 if worldgen else -9223372036854775808,'tick_order':9223372036854775803 if legacy else -9223372036854775808} + fixture_index+=1 def main(): @@ -55,6 +58,13 @@ def main(): lock,jars,libraries=base.verify_artifacts() tags=worldgen.tag_resources(jars["server"]) if not tags or tags!=worldgen.tag_resources(jars["client"]):raise ValueError("client/server block tags differ or are empty") + def fluid_resources(jar): + with zipfile.ZipFile(jar) as archive: + prefix='data/minecraft/tags/fluid/' + return {'minecraft:'+name[len(prefix):-5]:archive.read(name).decode('utf-8') for name in sorted(archive.namelist()) if name.startswith(prefix) and name.endswith('.json')} + fluid_tags=fluid_resources(jars['server']) + if fluid_tags!=fluid_resources(jars['client']):raise ValueError('reference fluid tags differ') + (build/'fluid-tags.json').write_text(json.dumps(fluid_tags,separators=(',',':'))) oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureRegionOracle.java" helper=oracle.with_name("VanillaHeightmapOracle.java") placement_helper=oracle.with_name("VanillaPlacementOracle.java") @@ -76,7 +86,7 @@ def main(): fixtures=list(corpus(facts));inputs=build/"inputs.txt" inputs.write_text("".join(json.dumps(value,separators=(",",":"))+"\n" for value in fixtures),encoding="utf-8") (build/"tags.json").write_text(json.dumps(tags,separators=(",",":")),encoding="utf-8") - fixture_paths=[inputs,build/"tags.json",build/"facts-client.json",build/"facts-server.json"] + fixture_paths=[inputs,build/"tags.json",build/"fluid-tags.json",build/"facts-client.json",build/"facts-server.json"] tested_fixtures=base.source_hashes(fixture_paths) run(["cargo","build","--release","-p","horizon-world","--example","feature_region_fixture"],"compile-rust") metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) @@ -91,9 +101,9 @@ def main(): base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) report={"schema":1,"minecraft":lock["minecraft"]["version"],"manifest_sha1":lock["minecraft"]["manifest_sha1"],"platform":platform.platform(), "java":subprocess.check_output(["java","--version"],text=True).splitlines()[0],"rustc":subprocess.check_output(["rustc","--version"],text=True).strip(), - "block_states":len(facts["states"]),"block_tag_files":len(tags),"fixtures":len(fixtures),"worldgen_random_modes":[False,True],"resident_chunks_per_fixture":9,"requested_placements":sum(len(f["features"])*2 for f in fixtures),"direct_tick_requests":sum(len(f["tick_commands"]) for f in fixtures), + "block_states":len(facts["states"]),"direct_state_probes":sum(len(f["probe_states"]) for f in fixtures),"block_tag_files":len(tags),"fixtures":len(fixtures),"worldgen_random_modes":[False,True],"resident_chunks_per_fixture":9,"requested_placements":sum(len(f["features"])*2 for f in fixtures),"direct_tick_requests":sum(len(f["tick_commands"]) for f in fixtures), "sources_sha256":tested_sources,"fixtures_sha256":tested_fixtures,"rust_output_sha256":lab.digest(build/"rust.txt","sha256"),"references":references, - "scope":"Native FeaturePlacer and three basic block-writing features, a composed sequence of four configured fill layers, single-block replacements, scattered ore and water springs share a world proxy backed by nine actual ProtoChunks. Configured water, horizontal logs, air, out-of-height fills and ore/replacement rules test graph-to-region binding. Initial two-layer stone/dirt terrain, both pre-light heightmap groups, count/square/heightmap/layered modifier chains, repeated placements, direct and WorldgenRandom-wrapped random streams, missing-neighbor errors, rejected writes and injected partial failures are compared. Final complete raw sections, heightmap presence and packed words are compared alongside ordered feature writes, update flags, explicit height queries and subsequent random draws. Rust uses resident registry-backed chunks, lazy heightmap priming and a caller-supplied write callback; imported air/fluid facts and bundled block tags bind independently across authenticated JARs. The proxy supplies storage mutation and actual native default scheduleTick/createTick methods routed through WorldGenTickAccess into each ProtoChunk. Separate block/fluid queues, first-request deduplication, nondefault-state block identity, shared tick-order advancement on duplicates and missing-chunk errors, out-of-height requests and wrapped clock values are compared, including saved queue order and priorities. Actual WorldGenRegion construction, write-zone policy, POIs, block entities, postprocessing execution, lighting, block/fluid tick execution, complete feature registries and complete world generation remain outside this comparison."} + "scope":"Native FeaturePlacer and three basic block-writing features, a composed sequence of four configured fill layers, single-block replacements, scattered ore and water springs share a world proxy backed by nine actual ProtoChunks. Configured water, horizontal logs, air, out-of-height fills and ore/replacement rules test graph-to-region binding. Initial two-layer stone/dirt terrain, both pre-light heightmap groups, count/square/heightmap/layered modifier chains, repeated placements, direct and WorldgenRandom-wrapped random streams, missing-neighbor errors, rejected writes and injected partial failures are compared. Final complete raw sections, heightmap presence and packed words are compared alongside ordered feature writes, update flags, explicit height queries and subsequent random draws. Rust uses resident registry-backed chunks, lazy heightmap priming and a caller-supplied write callback; imported air/fluid facts and bundled block tags bind independently across authenticated JARs. The proxy supplies storage mutation and actual native default scheduleTick/createTick methods routed through WorldGenTickAccess into each ProtoChunk. Separate block/fluid queues, first-request deduplication, nondefault-state block identity, shared tick-order advancement on duplicates and missing-chunk errors, out-of-height requests and wrapped clock values are compared, including saved queue order and priorities. All block states are also written into resident chunks, queried through feature access, cleared and queried again; contained fluid identity/amount/falling/source/full flags, water-tag membership and every bundled block tag plus an absent tag are compared. Negative coordinates, chunk edges, outside-height and absent chunks are covered. Block/fluid query bindings are an immutable registry-checked shared snapshot. Actual WorldGenRegion construction, write-zone policy, POIs, block entities, postprocessing execution, lighting, block/fluid tick execution, complete feature registries and complete world generation remain outside this comparison."} lab.write_json(report_path,report);print(f"Scoped feature-region parity passed: {report_path}") From 619f319924f8fc2059df201e1c28b6a63c2debed Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 14:03:31 +0200 Subject: [PATCH 030/253] Keep decoration fixtures independent of region tick and query probes --- tests/test_feature_region_parity.py | 11 +++++++++-- tools/test_decoration_region_parity.py | 4 ++-- tools/test_feature_region_parity.py | 9 +++++++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/tests/test_feature_region_parity.py b/tests/test_feature_region_parity.py index ac5618dc7..c449389aa 100644 --- a/tests/test_feature_region_parity.py +++ b/tests/test_feature_region_parity.py @@ -4,8 +4,15 @@ from tools import test_feature_region_parity as regions class FeatureRegionCorpusTests(unittest.TestCase): def test_resident_mutation_contexts_and_failures(self): - fixtures = list(regions.corpus({})) - self.assertEqual(fixtures, list(regions.corpus({}))) + facts = {'defaults': {'minecraft:water': 0, 'minecraft:oak_log': 1}, + 'states': [[None, None, None, None, {'id': 'minecraft:water'}], + [None, None, None, None, {'id': 'minecraft:oak_log', 'properties': {'axis': 'y'}}], + [None, None, None, None, {'id': 'minecraft:oak_log', 'properties': {'axis': 'x'}}]]} + fixtures = list(regions.corpus(facts)) + self.assertEqual(fixtures, list(regions.corpus(facts))) + self.assertEqual(sorted(i for f in fixtures for i in f['probe_states']), list(range(len(facts['states'])))) + self.assertTrue(all(len(f['tick_commands']) == 77 for f in fixtures)) + self.assertTrue(all(f['features'][-1]['type'] == 'spring_feature' for f in fixtures)) self.assertEqual({f['worldgen'] for f in fixtures}, {False, True}) self.assertEqual({f['legacy'] for f in fixtures}, {False, True}) self.assertEqual({f['stage'] for f in fixtures}, {'empty', 'terrain'}) diff --git a/tools/test_decoration_region_parity.py b/tools/test_decoration_region_parity.py index 583545c25..0b59c4817 100644 --- a/tools/test_decoration_region_parity.py +++ b/tools/test_decoration_region_parity.py @@ -20,7 +20,7 @@ except ImportError: def corpus(facts): - template=next(region.corpus(facts)) + features=region.configured_features(include_springs=False) biomes=[[[0],[1,2],[3,4,5]],[[0],[2],[3,5]],[[1],[2],[4,5]]] chains=[ [{'type':'count','count':2},{'type':'in_square'},{'type':'heightmap','heightmap':'MOTION_BLOCKING'},{'type':'biome'}], @@ -36,7 +36,7 @@ def corpus(facts): for placement in chains: for mixed in [False,True]: f=decoration.fixture(biomes,seed,present=[0,1,2,3] if mixed else [0]) - f.update(features=template['features'],placements=[placement]*len(template['features']),min=-64,height=64,stage=stage,write_fail=fail,reject=reject) + f.update(features=features,placements=[placement]*len(features),min=-64,height=64,stage=stage,write_fail=fail,reject=reject) yield f diff --git a/tools/test_feature_region_parity.py b/tools/test_feature_region_parity.py index 40037f489..64ecffa7a 100644 --- a/tools/test_feature_region_parity.py +++ b/tools/test_feature_region_parity.py @@ -18,12 +18,17 @@ except ImportError: import test_worldgen_parity as worldgen -def corpus(facts): +def configured_features(*, include_springs=True): leaves=[{'type':name} for name in ['end_island','void_start_platform','end_platform']] layers=[{'feature':{'type':'fill_layer','height':height,'state':state},'placement':[]} for height,state in [(32,'water'),(16,{'id':'oak_log','properties':{'axis':'x'}}),(8,'air'),(4064,'stone')]] targets=[{'target':{'predicate_type':'block_match','block':'stone'},'state':'iron_ore'},{'target':{'predicate_type':'block_match','block':'oak_log'},'state':'copper_ore'}] features=leaves+[{'type':'sequence','features':layers},{'type':'replace_single_block','targets':targets},{'type':'scattered_ore','targets':targets,'size':16,'discard_chance_on_air_exposure':0.5}] - features.append({'type':'spring_feature','state':{'id':'water','properties':{'falling':'false'}},'requires_block_below':False,'rock_count':5,'hole_count':5,'valid_blocks':['air','stone','dirt']}) + if include_springs:features.append({'type':'spring_feature','state':{'id':'water','properties':{'falling':'false'}},'requires_block_below':False,'rock_count':5,'hole_count':5,'valid_blocks':['air','stone','dirt']}) + return features + + +def corpus(facts): + features=configured_features() get=lambda name:facts['defaults']['minecraft:'+name] log_x=next(i for i,state in enumerate(facts['states']) if state[4]['id']=='minecraft:oak_log' and state[4].get('properties',{}).get('axis')=='x') ticks=[] From b344304c6233da70e25acee289d39f334bfd7ce0 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 14:03:31 +0200 Subject: [PATCH 031/253] Implement End gateway geometry and conditional exit updates --- .github/workflows/ci.yml | 4 + .../scoped-parity.json | 219 ++++++++++++++++++ .../examples/simple_block_fixture.rs | 26 +++ crates/horizon-world/src/worldgen.rs | 1 + .../horizon-world/src/worldgen/end_gateway.rs | 123 ++++++++++ .../src/worldgen/feature_graph.rs | 11 + .../src/worldgen/placement/context.rs | 12 + docs/rust-parity.md | 19 ++ .../parity/VanillaSimpleBlockOracle.java | 16 +- tools/test_end_gateway_parity.py | 47 ++++ 10 files changed, 476 insertions(+), 2 deletions(-) create mode 100644 benchmarks/rust-end-gateway-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-world/src/worldgen/end_gateway.rs create mode 100644 tools/test_end_gateway_parity.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e85a0f148..9925c685c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -147,6 +147,10 @@ jobs: env: RUSTUP_TOOLCHAIN: stable run: python tools/test_end_podium_parity.py + - name: Rust End gateway parity + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_end_gateway_parity.py - name: Compare replacement blob search and Manhattan shells env: RUSTUP_TOOLCHAIN: stable diff --git a/benchmarks/rust-end-gateway-2026-10-06/scoped-parity.json b/benchmarks/rust-end-gateway-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..a7f1d5fa9 --- /dev/null +++ b/benchmarks/rust-end-gateway-2026-10-06/scoped-parity.json @@ -0,0 +1,219 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 5820, + "candidate_states": 35723, + "double_plant_blocks": 10, + "mossy_carpet_blocks": 1, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java": "eba60b2b071c200ad46748b2a0a234ad8f77e09c5605a4871d3e669b961944e6", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSurvivalOracle.java": "4e7cc151617c1b02e872f9ca3e9fe4632379f225f4f07718ff6492df4ee551e7", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java": "e871d3a01f15616a98ca9227c27a81e4d17e2d57ac4e68a5650a70fa29811497", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSupportOracle.java": "04350901a2d708fb8fa672de61d058f73f332d2e90df1b93a67781862f89c1ad", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "60ff9ef7c1d5e23c080f9aec95ab2e7d3b7c5b5bcd67b9efa9518776c400629a", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_simple_block_parity.py": "50b783323051fe8cd369bb733448b0314f1e6e7994a950e4cb6cd2fe4f7f8e11", + "tools/test_end_gateway_parity.py": "20eeba6b78c5e61e33f67fa86446ee5fb2436859879523edb29b922a1e6a3eda", + "tools/test_block_survival_parity.py": "9e8dff3bd4b95dbfd29f8adc6a2f6d66abf19a6b1cd91423b794a345d4ec244a", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "a8cd85f6223668c1446ff103276d80937b9707d9a7dc619a176b1b1ceed36a4a", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "1eae82604d2b3377fd35aaa3a914a67e5af28f93923815a49e895b4d437433cd", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "cd0564340c792582108916fc1f6cea84f6cb7c34b70bff443bab878548eced9a", + "crates/horizon-world/src/worldgen/feature_region.rs": "ae7552027b2efc0db6299dc14ab04c28615e43b876b5d67644855fd7a047e33e", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "e05c5ad1e9eb9ae398fdff538e42852a08a328bac1b400d359ffca5a16d678a7", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "b8fb9fb80a66a851d916f07f15df1a40b6cc95b49e71aaec4d4b4107f13d9f9f", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "c3396e5316f4bf890571eb233c20ccedd56324810aad458a52b7a282da0fa6f8", + "crates/horizon-world/examples/simple_block_fixture.rs": "c6d850e1192a11af73996835c251caf639d6fc246d2a39d4e2eba8b25ed45cb2" + }, + "fixtures_sha256": { + ".local/rust-end-gateway-parity/inputs.txt": "00559202fa5a17190a0c0a0810e142f95c8e5bd92a4bc5c46648118ef2511f44", + ".local/rust-end-gateway-parity/block-properties.nbt": "1aba22092f70d16b8092014c058ddc210e4aaa77bac32f6ec62e4d0e91d92a99", + ".local/rust-end-gateway-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-end-gateway-parity/cached-collision.nbt": "f3a5c6a5b2d51dad6c52e486e2b9989e79fd55db1a9bda6196db399550b04078", + ".local/rust-end-gateway-parity/cached-support.nbt": "b6fdc9471b0b61e904206d3f099f4dc235aad6d723536c210be0cb7c3560d82c", + ".local/rust-end-gateway-parity/catalog.json": "93581107e3564e60261044fdca61e3b7f237b9e6724c14b86e335ccc01198ba9", + ".local/rust-end-gateway-parity/facts.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-end-gateway-parity/feature-catalog.json": "c048c761c5084a40560731955cc999a364d14055bdd86fa50989a92e4a771286", + ".local/rust-end-gateway-parity/fluid-tags.json": "f1e5eb6d22ea7effbb118a2282709cfdeef1bfae4516b775a55ad7a4df29d7d0", + ".local/rust-end-gateway-parity/placement-definitions.json": "f8a972ec87c2352500af6481158a3192bdbf699951025639bea744e4127b97c4", + ".local/rust-end-gateway-parity/support-cached-states.json": "353945a58fe69b352925473f1693f9b14a9ad19f13c15159c4184f2c29258622", + ".local/rust-end-gateway-parity/survival-classes.json": "361832008eea0aa9151d367a125a19c6353d99a0b88b27dd0682f55b7954553e", + ".local/rust-end-gateway-parity/survival-extra-definitions.json": "170f2db5bc97a49fa25cc249540aa7f04beea455cdbaf43742ed9415f5090a02", + ".local/rust-end-gateway-parity/survival-placement-classes.json": "7fdbf48ab18c87098bbe1b6176cb81f4842b6c5d9a4d6bbaf7037ff61cb1848c", + ".local/rust-end-gateway-parity/survival-rules.json": "8805c18b3195bb1eac1f1e5281333df56e2892505f64023e5403c58ce2ec4368", + ".local/rust-end-gateway-parity/survival-support-tags.json": "15d88d5bb5ad10d65124d5abb2cc055d251b06d129bca7be06f55b43dc13f6fd", + ".local/rust-end-gateway-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0" + }, + "rust_output_sha256": "56b1b5c93f6a73ffd594ea6d9c38e96680bc42893ecf7fc05d0cd9cb29a8cb2a", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "56b1b5c93f6a73ffd594ea6d9c38e96680bc42893ecf7fc05d0cd9cb29a8cb2a", + "matched_output_lines": 754877 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "56b1b5c93f6a73ffd594ea6d9c38e96680bc42893ecf7fc05d0cd9cb29a8cb2a", + "matched_output_lines": 754877 + } + ], + "scope": "Native EndGatewayFeature required exact and optional exit codecs, 3x5x3 inclusive box traversal, air/bedrock/gateway geometry, update flags and conditional gateway block-entity exit updates. Native actual TheEndGatewayBlockEntity.setExitPosition mutates exit/exact fields before a traced dirty notification; missing/other entities are no-ops. All world-call failure boundaries, rejected writes, repeated updates, both random modes, placement composition, extreme coordinates, bounded overflow prefixes and malformed/numeric codecs are compared. Fixture block entities are controlled independently of writes and their fields are compared after success or partial failure; automatic entity lifecycle, world dirty propagation, gateway teleportation/search and full End generation are not simulated. Rust bounds pathological box work to 2^20 visits." +} diff --git a/crates/horizon-world/examples/simple_block_fixture.rs b/crates/horizon-world/examples/simple_block_fixture.rs index 7a9c56a26..0e611ff08 100644 --- a/crates/horizon-world/examples/simple_block_fixture.rs +++ b/crates/horizon-world/examples/simple_block_fixture.rs @@ -58,6 +58,8 @@ struct World<'a, 'r, W, R> { biome: Option<(BiomeWeatherBindings, BiomeTemperature)>, air: BlockStateId, destroy_success: bool, + gateway_entity: bool, + gateways: BTreeMap<[i32; 3], ([i32; 3], bool)>, } impl World<'_, '_, W, R> { fn event(&mut self, text: std::fmt::Arguments<'_>) -> io::Result { @@ -179,6 +181,21 @@ impl PlacementContext for World<'_, '_, W, R> { } Ok(BiomeId(0)) } + fn configure_end_gateway( + &mut self, + p: [i32; 3], + exit: [i32; 3], + exact: bool, + ) -> Result<(), PlacementQueryError> { + self.event(format_args!("entity {} {} {}", p[0], p[1], p[2])) + .map_err(query)?; + if self.gateway_entity { + self.gateways.insert(p, (exit, exact)); + self.event(format_args!("gateway_changed {} {} {}", p[0], p[1], p[2])) + .map_err(query)?; + } + Ok(()) + } fn biome_should_freeze( &mut self, biome: BiomeId, @@ -401,6 +418,8 @@ fn fixture( }) .transpose()?; let mut world = World { + gateway_entity: f.get("gateway_entity").and_then(Value::as_str) == Some("gateway"), + gateways: BTreeMap::new(), biome, out, random: world_random, @@ -481,6 +500,13 @@ fn fixture( for (p, state) in &world.states { writeln!(world.out, "stored {} {} {} {}", p[0], p[1], p[2], state.0)?; } + for (p, (exit, exact)) in &world.gateways { + writeln!( + world.out, + "gateway {} {} {} {} {} {} {exact}", + p[0], p[1], p[2], exit[0], exit[1], exit[2] + )?; + } writeln!(world.out, "end")?; } } diff --git a/crates/horizon-world/src/worldgen.rs b/crates/horizon-world/src/worldgen.rs index f4adfc092..751216040 100644 --- a/crates/horizon-world/src/worldgen.rs +++ b/crates/horizon-world/src/worldgen.rs @@ -23,6 +23,7 @@ pub mod decoration; pub mod delta; pub mod density; pub mod disk; +pub mod end_gateway; pub mod end_podium; pub mod feature; pub mod feature_catalog; diff --git a/crates/horizon-world/src/worldgen/end_gateway.rs b/crates/horizon-world/src/worldgen/end_gateway.rs new file mode 100644 index 000000000..b1c11f21b --- /dev/null +++ b/crates/horizon-world/src/worldgen/end_gateway.rs @@ -0,0 +1,123 @@ +//! End gateway structure placement and conditional block-entity configuration. +use super::{ + DecodeError, Object, + block_feature::FeatureBlockBindings, + feature::FeatureWorld, + integer, optional, + placement::{PlacementContext, PlacementQueryError}, + required, +}; +use crate::registry::BlockStateId; +use serde_json::value::RawValue; + +#[derive(Clone, Debug)] +pub struct EndGatewayFeature { + exit: Option<[i32; 3]>, + exact: bool, + air: BlockStateId, + bedrock: BlockStateId, + gateway: BlockStateId, +} +#[derive(Debug)] +pub enum EndGatewayError { + World(E), + Query(PlacementQueryError), + WorkLimit, +} +impl std::fmt::Display for EndGatewayError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::World(e) => e.fmt(f), + Self::Query(e) => e.fmt(f), + Self::WorkLimit => f.write_str("end gateway work limit exceeded"), + } + } +} +impl std::error::Error for EndGatewayError {} +impl EndGatewayFeature { + pub fn from_json(json: &str, bindings: &FeatureBlockBindings<'_>) -> Result { + let object: Object = serde_json::from_str(json)?; + let exact = serde_json::from_str(required(&object, "exact")?.get())?; + let exit = optional(&object, "exit") + .map(|raw| { + let values: Vec> = serde_json::from_str(raw.get())?; + if values.len() != 3 { + return Err(DecodeError::Field("gateway exit")); + } + Ok([ + integer(&values[0])?, + integer(&values[1])?, + integer(&values[2])?, + ]) + }) + .transpose()?; + let get = |name| { + bindings + .registry() + .default_state(name) + .ok_or_else(|| DecodeError::Registry(format!("unknown gateway block {name}"))) + }; + Ok(Self { + exit, + exact, + air: get("minecraft:air")?, + bedrock: get("minecraft:bedrock")?, + gateway: get("minecraft:end_gateway")?, + }) + } + pub fn place( + &self, + world: &mut W, + origin: [i32; 3], + ) -> Result> { + let offset = + |d: [i32; 3]| -> [i32; 3] { std::array::from_fn(|i| origin[i].wrapping_add(d[i])) }; + let a = offset([-1, -2, -1]); + let b = offset([1, 2, 1]); + let min: [i32; 3] = std::array::from_fn(|i| a[i].min(b[i])); + let sizes: [i32; 3] = + std::array::from_fn(|i| a[i].max(b[i]).wrapping_sub(min[i]).wrapping_add(1)); + let count = sizes[0].wrapping_mul(sizes[1]).wrapping_mul(sizes[2]); + let mut index: i32 = 0; + let mut remaining = 1_048_576; + while index != count { + if remaining == 0 { + return Err(EndGatewayError::WorkLimit); + } + remaining -= 1; + let quotient = index / sizes[0]; + let p = [ + min[0].wrapping_add(index % sizes[0]), + min[1].wrapping_add(quotient % sizes[1]), + min[2].wrapping_add(quotient / sizes[1]), + ]; + index = index.wrapping_add(1); + let x = p[0] == origin[0]; + let y = p[1] == origin[1]; + let z = p[2] == origin[2]; + let cap = p[1].wrapping_sub(origin[1]).wrapping_abs() == 2; + let center = x && y && z; + let state = if center { + self.gateway + } else if y { + self.air + } else if cap && x && z || !cap && (x || z) { + self.bedrock + } else { + self.air + }; + world + .set_block(p, state, 3) + .map_err(EndGatewayError::World)?; + if center { + if let Some(exit) = self.exit { + // Native code looks up the entity even when the write returned false. + world + .configure_end_gateway(p, exit, self.exact) + .map_err(EndGatewayError::Query)?; + } + } + } + Ok(true) + } +} diff --git a/crates/horizon-world/src/worldgen/feature_graph.rs b/crates/horizon-world/src/worldgen/feature_graph.rs index b08d90857..1d8cc46c7 100644 --- a/crates/horizon-world/src/worldgen/feature_graph.rs +++ b/crates/horizon-world/src/worldgen/feature_graph.rs @@ -54,6 +54,7 @@ pub enum FeatureDefinition { Bamboo(super::bamboo::BambooFeature), ReplaceBlobs(super::replace_blobs::ReplaceBlobsFeature), EndPodium(super::end_podium::EndPodiumFeature), + EndGateway(super::end_gateway::EndGatewayFeature), Spike(super::spike::SpikeFeature), BlueIce(super::blue_ice::BlueIceFeature), UnderwaterMagma(super::underwater_magma::UnderwaterMagmaFeature), @@ -86,6 +87,7 @@ pub enum FeatureExecutionError { Bamboo(super::bamboo::BambooError), ReplaceBlobs(super::replace_blobs::ReplaceBlobsError), EndPodium(super::end_podium::EndPodiumError), + EndGateway(super::end_gateway::EndGatewayError), Spike(super::spike::SpikeError), BlueIce(super::blue_ice::BlueIceError), UnderwaterMagma(super::underwater_magma::UnderwaterMagmaError), @@ -109,6 +111,7 @@ impl std::fmt::Display for FeatureExecutionError { Self::Bamboo(e) => e.fmt(f), Self::ReplaceBlobs(e) => e.fmt(f), Self::EndPodium(e) => e.fmt(f), + Self::EndGateway(e) => e.fmt(f), Self::Spike(e) => e.fmt(f), Self::BlueIce(e) => e.fmt(f), Self::UnderwaterMagma(e) => e.fmt(f), @@ -303,6 +306,11 @@ impl FeatureDefinition { ) .map(Self::ReplaceBlobs) } + "minecraft:end_gateway" => super::end_gateway::EndGatewayFeature::from_json( + json, + blocks.ok_or(DecodeError::Field("end gateway bindings"))?, + ) + .map(Self::EndGateway), "minecraft:end_podium" => super::end_podium::EndPodiumFeature::from_json( json, blocks.ok_or(DecodeError::Field("end podium bindings"))?, @@ -666,6 +674,9 @@ impl FeatureDefinition { Self::ReplaceBlobs(feature) => feature .place(world, random, origin) .map_err(FeatureExecutionError::ReplaceBlobs), + Self::EndGateway(feature) => feature + .place(world, origin) + .map_err(FeatureExecutionError::EndGateway), Self::EndPodium(feature) => feature .place(world, origin) .map_err(FeatureExecutionError::EndPodium), diff --git a/crates/horizon-world/src/worldgen/placement/context.rs b/crates/horizon-world/src/worldgen/placement/context.rs index 07f980c4a..ac9372301 100644 --- a/crates/horizon-world/src/worldgen/placement/context.rs +++ b/crates/horizon-world/src/worldgen/placement/context.rs @@ -26,6 +26,18 @@ pub enum LayerBlock { Ground, } pub trait PlacementContext { + /// Look up the block entity at this position and set its exit only if it is + /// an End gateway. Missing or other entities are successful no-ops. The + /// owning world applies the gateway's dirty notification after the update. + fn configure_end_gateway( + &mut self, + _position: [i32; 3], + _exit: [i32; 3], + _exact: bool, + ) -> Result<(), PlacementQueryError> { + Err(PlacementQueryError::Unavailable) + } + /// Use the previously resolved biome, retaining its temperature cache. fn biome_should_freeze( &mut self, diff --git a/docs/rust-parity.md b/docs/rust-parity.md index 5948c3b94..0719ce0b8 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -712,3 +712,22 @@ coordinates, chunk edges, outside-height reads and missing chunks are included. Workspace tests and all-target Clippy pass; a separate regression covers foreign registries, binding lifetime and a custom water tag. These queries do not execute fluid spreading, block behavior or lighting. + +## End gateway structures and exit configuration + +The `end_gateway` feature now places its air, bedrock and gateway blocks in native +box order. A configured exit triggers a block-entity lookup even when the gateway +write was rejected. Missing or unrelated entities are no-ops; a gateway receives +its exit/exact fields before its dirty notification. + +The [gateway comparison](../benchmarks/rust-end-gateway-2026-10-06/scoped-parity.json) +matches **754,877 lines per reference JAR** across **5,820 fixtures**, including +every world-call failure boundary, rejected writes, repeated updates, both random +streams, placement composition, codec edge cases and bounded prefixes of wrapped +coordinate boxes. The reference invokes the actual gateway entity setter and +compares its fields after partial failures. Workspace tests, all-target Clippy and +all 149 Python tests pass. The Python checks also caught and repaired a shared +fixture dependency: decoration retains its six-feature corpus independently of +region spring/tick/query probes; regenerated inputs are byte-identical to their +validated corpora. Gateway entity creation/removal, dirty propagation, exit search +and teleportation remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java index ef49084b0..72c2be4d3 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java @@ -11,6 +11,7 @@ import net.minecraft.resources.*; import net.minecraft.util.RandomSource; import net.minecraft.world.level.*; import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.entity.*; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.levelgen.*; import net.minecraft.world.level.levelgen.feature.SimpleBlockFeature; @@ -66,6 +67,7 @@ public final class VanillaSimpleBlockOracle { final JsonObject f;final PrintWriter out;final RandomSource random;final Holder biome;int calls; final TreeMap states=new TreeMap<>(Comparator.comparingInt(BlockPos::getX).thenComparingInt(BlockPos::getY).thenComparingInt(BlockPos::getZ)); World(JsonObject f,PrintWriter out,RandomSource random){this.f=f;this.out=out;this.random=random;this.biome=f.has("biome")?Holder.direct(makeBiome(f.getAsJsonObject("biome"))):null;for(var raw:f.getAsJsonArray("states")){var v=raw.getAsJsonArray();states.put(pos(v),Block.stateById(v.get(3).getAsInt()));}} + final TreeMap gateways=new TreeMap<>(Comparator.comparingInt(BlockPos::getX).thenComparingInt(BlockPos::getY).thenComparingInt(BlockPos::getZ)); final Map chunks=new HashMap<>(); ProtoChunk chunk(BlockPos p) { event("chunk "+xyz(p));var key=new ChunkPos(p.getX()>>4,p.getZ()>>4); @@ -89,7 +91,12 @@ public final class VanillaSimpleBlockOracle { if(name.equals("getFluidState")){var p=(BlockPos)args[0];event("fluid "+xyz(p));return (f.has("fluid")?Block.stateById(f.get("fluid").getAsInt()):at(p)).getFluidState();} if(name.equals("getBrightness")&&args[0]==LightLayer.BLOCK){event("blocklight "+xyz((BlockPos)args[1]));return f.get("brightness").getAsInt();} if(name.equals("getRawBrightness")){var p=(BlockPos)args[0];event("light "+xyz(p)+" "+args[1]);return f.get("brightness").getAsInt();} - if(name.equals("getBlockEntity")){event("entity "+xyz((BlockPos)args[0]));return null;} + if(name.equals("getBlockEntity")){ + var p=((BlockPos)args[0]).immutable();event("entity "+xyz(p));String mode=f.has("gateway_entity")?f.get("gateway_entity").getAsString():"none"; + if(mode.equals("other"))return new ShulkerBoxBlockEntity(p,Blocks.SHULKER_BOX.defaultBlockState()); + if(mode.equals("gateway"))return gateways.computeIfAbsent(p,key->new TheEndGatewayBlockEntity(key,Blocks.END_GATEWAY.defaultBlockState()){@Override public void setChanged(){event("gateway_changed "+xyz(key));}}); + return null; + } if(name.equals("destroyBlock")){ if(args.length!=3||args[2]!=null)throw new UnsupportedOperationException("only no-entity destruction is defined in this fixture"); var p=((BlockPos)args[0]).immutable();event("destroy "+xyz(p)+" "+args[1]);boolean result=!f.has("destroy_success")||f.get("destroy_success").getAsBoolean(); @@ -148,7 +155,12 @@ public final class VanillaSimpleBlockOracle { for(int repeat=0;repeat Date: Tue, 6 Oct 2026 14:08:13 +0200 Subject: [PATCH 032/253] Implement bonus chest search, loot seeding and torches --- .github/workflows/ci.yml | 4 + .../scoped-parity.json | 220 ++++++++++++++++++ .../examples/simple_block_fixture.rs | 38 ++- crates/horizon-world/src/worldgen.rs | 1 + .../horizon-world/src/worldgen/bonus_chest.rs | 102 ++++++++ .../src/worldgen/feature_graph.rs | 10 + .../src/worldgen/placement/context.rs | 19 ++ docs/rust-parity.md | 18 ++ .../parity/VanillaSimpleBlockOracle.java | 8 + tools/test_bonus_chest_parity.py | 40 ++++ 10 files changed, 459 insertions(+), 1 deletion(-) create mode 100644 benchmarks/rust-bonus-chest-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-world/src/worldgen/bonus_chest.rs create mode 100644 tools/test_bonus_chest_parity.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9925c685c..fd18f190a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -151,6 +151,10 @@ jobs: env: RUSTUP_TOOLCHAIN: stable run: python tools/test_end_gateway_parity.py + - name: Compare bonus chest placement and conditional loot seeding + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_bonus_chest_parity.py - name: Compare replacement blob search and Manhattan shells env: RUSTUP_TOOLCHAIN: stable diff --git a/benchmarks/rust-bonus-chest-2026-10-06/scoped-parity.json b/benchmarks/rust-bonus-chest-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..3349621a4 --- /dev/null +++ b/benchmarks/rust-bonus-chest-2026-10-06/scoped-parity.json @@ -0,0 +1,220 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 42396, + "candidate_states": 35723, + "double_plant_blocks": 10, + "mossy_carpet_blocks": 1, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java": "d2f9843f8fb20d392cf19d14d1cdd99f0422cead8ef12487ff5b3b0e18576726", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSurvivalOracle.java": "4e7cc151617c1b02e872f9ca3e9fe4632379f225f4f07718ff6492df4ee551e7", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java": "e871d3a01f15616a98ca9227c27a81e4d17e2d57ac4e68a5650a70fa29811497", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSupportOracle.java": "04350901a2d708fb8fa672de61d058f73f332d2e90df1b93a67781862f89c1ad", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "60ff9ef7c1d5e23c080f9aec95ab2e7d3b7c5b5bcd67b9efa9518776c400629a", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_simple_block_parity.py": "50b783323051fe8cd369bb733448b0314f1e6e7994a950e4cb6cd2fe4f7f8e11", + "tools/test_bonus_chest_parity.py": "c882c5a11b12d71b882c0653e48dbb3d9fac1319a366ca003b915a6e80f32c97", + "tools/test_block_survival_parity.py": "9e8dff3bd4b95dbfd29f8adc6a2f6d66abf19a6b1cd91423b794a345d4ec244a", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "a8cd85f6223668c1446ff103276d80937b9707d9a7dc619a176b1b1ceed36a4a", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "1eae82604d2b3377fd35aaa3a914a67e5af28f93923815a49e895b4d437433cd", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "dcc811a313ff93c477bb9e19325420b3cd0e64c8173d7bac68825cd5e19019a8", + "crates/horizon-world/src/worldgen/feature_region.rs": "ae7552027b2efc0db6299dc14ab04c28615e43b876b5d67644855fd7a047e33e", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "b8fb9fb80a66a851d916f07f15df1a40b6cc95b49e71aaec4d4b4107f13d9f9f", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "6fc51d32f71db3d802354456bfef35133a05fa4cd11ed3ab9ea7287cc9bfcebe", + "crates/horizon-world/examples/simple_block_fixture.rs": "c2827b81f21886027d2a53ff41457586a4c6ed7eafe451906320922b11756ca0" + }, + "fixtures_sha256": { + ".local/rust-bonus-chest-parity/inputs.txt": "df73f89f50423ab3ef6b9615ee795eb2d95be8c5ae6e90ffe1a5a361789c7254", + ".local/rust-bonus-chest-parity/block-properties.nbt": "1aba22092f70d16b8092014c058ddc210e4aaa77bac32f6ec62e4d0e91d92a99", + ".local/rust-bonus-chest-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-bonus-chest-parity/cached-collision.nbt": "f3a5c6a5b2d51dad6c52e486e2b9989e79fd55db1a9bda6196db399550b04078", + ".local/rust-bonus-chest-parity/cached-support.nbt": "b6fdc9471b0b61e904206d3f099f4dc235aad6d723536c210be0cb7c3560d82c", + ".local/rust-bonus-chest-parity/catalog.json": "93581107e3564e60261044fdca61e3b7f237b9e6724c14b86e335ccc01198ba9", + ".local/rust-bonus-chest-parity/facts.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-bonus-chest-parity/feature-catalog.json": "c048c761c5084a40560731955cc999a364d14055bdd86fa50989a92e4a771286", + ".local/rust-bonus-chest-parity/fluid-tags.json": "f1e5eb6d22ea7effbb118a2282709cfdeef1bfae4516b775a55ad7a4df29d7d0", + ".local/rust-bonus-chest-parity/placement-definitions.json": "f8a972ec87c2352500af6481158a3192bdbf699951025639bea744e4127b97c4", + ".local/rust-bonus-chest-parity/support-cached-states.json": "353945a58fe69b352925473f1693f9b14a9ad19f13c15159c4184f2c29258622", + ".local/rust-bonus-chest-parity/survival-classes.json": "361832008eea0aa9151d367a125a19c6353d99a0b88b27dd0682f55b7954553e", + ".local/rust-bonus-chest-parity/survival-extra-definitions.json": "170f2db5bc97a49fa25cc249540aa7f04beea455cdbaf43742ed9415f5090a02", + ".local/rust-bonus-chest-parity/survival-placement-classes.json": "7fdbf48ab18c87098bbe1b6176cb81f4842b6c5d9a4d6bbaf7037ff61cb1848c", + ".local/rust-bonus-chest-parity/survival-rules.json": "8805c18b3195bb1eac1f1e5281333df56e2892505f64023e5403c58ce2ec4368", + ".local/rust-bonus-chest-parity/survival-support-tags.json": "15d88d5bb5ad10d65124d5abb2cc055d251b06d129bca7be06f55b43dc13f6fd", + ".local/rust-bonus-chest-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0" + }, + "rust_output_sha256": "e0397cb071d5b1503138824af16d4f2c4c66c1f972825ed9e8d9d5e1cb3f8633", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "e0397cb071d5b1503138824af16d4f2c4c66c1f972825ed9e8d9d5e1cb3f8633", + "matched_output_lines": 1505542 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "e0397cb071d5b1503138824af16d4f2c4c66c1f972825ed9e8d9d5e1cb3f8633", + "matched_output_lines": 1505542 + } + ], + "scope": "Native BonusChestFeature unit codec, independently shuffled chunk X/Z coordinates, ordered heightmap candidate search, air short-circuit and second-read empty-context collision, chest writes, conditional randomizable-container loot seeding, north/east/south/west torch survival and writes. Every state participates in collision prefixes; complete searches cover absent/unrelated/actual native chest entities, repeated mutation, rejected writes, injected failures, both random modes, shuffled search exhaustion, sole viable columns, extreme coordinates/heights and placement composition. Actual ChestBlockEntity loot table and seed are compared; fixtures control heights and entity existence independently of writes. Loot generation, inventory behavior, automatic block-entity lifecycle, world updates and complete spawn generation remain pending." +} diff --git a/crates/horizon-world/examples/simple_block_fixture.rs b/crates/horizon-world/examples/simple_block_fixture.rs index 0e611ff08..742f3b39f 100644 --- a/crates/horizon-world/examples/simple_block_fixture.rs +++ b/crates/horizon-world/examples/simple_block_fixture.rs @@ -48,6 +48,9 @@ struct World<'a, 'r, W, R> { water_mask: u8, survival: &'a BlockSurvivalRegistry<'r>, support: &'a BlockSupportRegistry<'r>, + collision: &'a BlockCollisionRegistry<'r>, + loot_container: bool, + loot: BTreeMap<[i32; 3], (String, i64)>, calls: i32, fail: i32, reject: i32, @@ -181,6 +184,30 @@ impl PlacementContext for World<'_, '_, W, R> { } Ok(BiomeId(0)) } + fn state_collision_empty( + &mut self, + state: BlockStateId, + p: [i32; 3], + ) -> Result { + let collision = self.collision; + collision + .collision_shape(self, state, p) + .map(|shape| shape.is_empty()) + .map_err(query) + } + fn set_block_entity_loot_table( + &mut self, + p: [i32; 3], + table: &str, + random: &mut impl RandomSource, + ) -> Result<(), PlacementQueryError> { + self.event(format_args!("entity {} {} {}", p[0], p[1], p[2])) + .map_err(query)?; + if self.loot_container { + self.loot.insert(p, (table.into(), random.next_long())); + } + Ok(()) + } fn configure_end_gateway( &mut self, p: [i32; 3], @@ -361,6 +388,7 @@ fn fixture( blocks: FeatureBlocks, survival: &BlockSurvivalRegistry<'_>, support: &BlockSupportRegistry<'_>, + collision: &BlockCollisionRegistry<'_>, fluids: &FluidStateTable, water_mask: u8, out: &mut impl Write, @@ -418,6 +446,9 @@ fn fixture( }) .transpose()?; let mut world = World { + collision, + loot_container: f.get("loot_entity").and_then(Value::as_str) == Some("chest"), + loot: BTreeMap::new(), gateway_entity: f.get("gateway_entity").and_then(Value::as_str) == Some("gateway"), gateways: BTreeMap::new(), biome, @@ -500,6 +531,9 @@ fn fixture( for (p, state) in &world.states { writeln!(world.out, "stored {} {} {} {}", p[0], p[1], p[2], state.0)?; } + for (p, (table, seed)) in &world.loot { + writeln!(world.out, "loot {} {} {} {table} {seed}", p[0], p[1], p[2])?; + } for (p, (exit, exact)) in &world.gateways { writeln!( world.out, @@ -631,7 +665,7 @@ fn main() -> Result<(), Box> { ®istry, &properties, support.clone(), - collision, + collision.clone(), &definitions, &tags.tags, &fluid_tags.tags, @@ -709,6 +743,7 @@ fn main() -> Result<(), Box> { blocks, &survival, &support, + &collision, &fluids, water_mask, &mut out, @@ -726,6 +761,7 @@ fn main() -> Result<(), Box> { blocks, &survival, &support, + &collision, &fluids, water_mask, &mut out, diff --git a/crates/horizon-world/src/worldgen.rs b/crates/horizon-world/src/worldgen.rs index 751216040..07b0a033b 100644 --- a/crates/horizon-world/src/worldgen.rs +++ b/crates/horizon-world/src/worldgen.rs @@ -15,6 +15,7 @@ pub mod block_feature; pub mod block_pile; pub mod block_predicate; pub mod blue_ice; +pub mod bonus_chest; pub mod bulk_section; pub mod carver; pub mod carving; diff --git a/crates/horizon-world/src/worldgen/bonus_chest.rs b/crates/horizon-world/src/worldgen/bonus_chest.rs new file mode 100644 index 000000000..ce3d399d0 --- /dev/null +++ b/crates/horizon-world/src/worldgen/bonus_chest.rs @@ -0,0 +1,102 @@ +//! Spawn bonus chest search, loot-table assignment and surrounding torches. +use super::{ + DecodeError, + block_feature::FeatureBlockBindings, + feature::FeatureWorld, + placement::{PlacementContext, PlacementQueryError}, +}; +use crate::{heightmap::HeightmapType, registry::BlockStateId}; +use horizon_core::random::{InvalidBound, RandomSource}; +#[derive(Clone, Debug)] +pub struct BonusChestFeature { + air: [BlockStateId; 3], + chest: BlockStateId, + torch: BlockStateId, +} +#[derive(Debug)] +pub enum BonusChestError { + World(E), + Query(PlacementQueryError), + Random(InvalidBound), +} +impl std::fmt::Display for BonusChestError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::World(e) => e.fmt(f), + Self::Query(e) => e.fmt(f), + Self::Random(e) => e.fmt(f), + } + } +} +impl std::error::Error for BonusChestError {} +impl BonusChestFeature { + pub fn new(bindings: &FeatureBlockBindings<'_>) -> Result { + let get = |name| { + bindings + .registry() + .default_state(name) + .ok_or_else(|| DecodeError::Registry(format!("unknown bonus chest block {name}"))) + }; + Ok(Self { + air: bindings.air, + chest: get("minecraft:chest")?, + torch: get("minecraft:torch")?, + }) + } + pub fn place( + &self, + world: &mut W, + random: &mut impl RandomSource, + origin: [i32; 3], + ) -> Result> { + let mut xs: [i32; 16] = std::array::from_fn(|i| (origin[0] & !15).wrapping_add(i as i32)); + let mut zs: [i32; 16] = std::array::from_fn(|i| (origin[2] & !15).wrapping_add(i as i32)); + for values in [&mut xs, &mut zs] { + for end in (2..=16).rev() { + let other = random + .next_int_bound(end as i32) + .map_err(BonusChestError::Random)? as usize; + values.swap(end - 1, other); + } + } + for x in xs { + for z in zs { + let y = world + .height(HeightmapType::MotionBlockingNoLeaves, x, z) + .map_err(BonusChestError::Query)?; + let p = [x, y, z]; + if !self + .air + .contains(&world.block(p).map_err(BonusChestError::World)?) + { + let state = world.block(p).map_err(BonusChestError::World)?; + if !world + .state_collision_empty(state, p) + .map_err(BonusChestError::Query)? + { + continue; + } + } + world + .set_block(p, self.chest, 2) + .map_err(BonusChestError::World)?; + world + .set_block_entity_loot_table(p, "minecraft:chests/spawn_bonus_chest", random) + .map_err(BonusChestError::Query)?; + for [dx, dz] in [[0, -1], [1, 0], [0, 1], [-1, 0]] { + let at = [x.wrapping_add(dx), y, z.wrapping_add(dz)]; + if world + .block_survives(self.torch, at) + .map_err(BonusChestError::Query)? + { + world + .set_block(at, self.torch, 2) + .map_err(BonusChestError::World)?; + } + } + return Ok(true); + } + } + Ok(false) + } +} diff --git a/crates/horizon-world/src/worldgen/feature_graph.rs b/crates/horizon-world/src/worldgen/feature_graph.rs index 1d8cc46c7..34d1a423d 100644 --- a/crates/horizon-world/src/worldgen/feature_graph.rs +++ b/crates/horizon-world/src/worldgen/feature_graph.rs @@ -55,6 +55,7 @@ pub enum FeatureDefinition { ReplaceBlobs(super::replace_blobs::ReplaceBlobsFeature), EndPodium(super::end_podium::EndPodiumFeature), EndGateway(super::end_gateway::EndGatewayFeature), + BonusChest(super::bonus_chest::BonusChestFeature), Spike(super::spike::SpikeFeature), BlueIce(super::blue_ice::BlueIceFeature), UnderwaterMagma(super::underwater_magma::UnderwaterMagmaFeature), @@ -88,6 +89,7 @@ pub enum FeatureExecutionError { ReplaceBlobs(super::replace_blobs::ReplaceBlobsError), EndPodium(super::end_podium::EndPodiumError), EndGateway(super::end_gateway::EndGatewayError), + BonusChest(super::bonus_chest::BonusChestError), Spike(super::spike::SpikeError), BlueIce(super::blue_ice::BlueIceError), UnderwaterMagma(super::underwater_magma::UnderwaterMagmaError), @@ -112,6 +114,7 @@ impl std::fmt::Display for FeatureExecutionError { Self::ReplaceBlobs(e) => e.fmt(f), Self::EndPodium(e) => e.fmt(f), Self::EndGateway(e) => e.fmt(f), + Self::BonusChest(e) => e.fmt(f), Self::Spike(e) => e.fmt(f), Self::BlueIce(e) => e.fmt(f), Self::UnderwaterMagma(e) => e.fmt(f), @@ -306,6 +309,10 @@ impl FeatureDefinition { ) .map(Self::ReplaceBlobs) } + "minecraft:bonus_chest" => super::bonus_chest::BonusChestFeature::new( + blocks.ok_or(DecodeError::Field("bonus chest bindings"))?, + ) + .map(Self::BonusChest), "minecraft:end_gateway" => super::end_gateway::EndGatewayFeature::from_json( json, blocks.ok_or(DecodeError::Field("end gateway bindings"))?, @@ -674,6 +681,9 @@ impl FeatureDefinition { Self::ReplaceBlobs(feature) => feature .place(world, random, origin) .map_err(FeatureExecutionError::ReplaceBlobs), + Self::BonusChest(feature) => feature + .place(world, random, origin) + .map_err(FeatureExecutionError::BonusChest), Self::EndGateway(feature) => feature .place(world, origin) .map_err(FeatureExecutionError::EndGateway), diff --git a/crates/horizon-world/src/worldgen/placement/context.rs b/crates/horizon-world/src/worldgen/placement/context.rs index ac9372301..3d36ffdea 100644 --- a/crates/horizon-world/src/worldgen/placement/context.rs +++ b/crates/horizon-world/src/worldgen/placement/context.rs @@ -26,6 +26,25 @@ pub enum LayerBlock { Ground, } pub trait PlacementContext { + /// Test the already-read state's collision shape in an empty entity context. + fn state_collision_empty( + &mut self, + _state: crate::registry::BlockStateId, + _position: [i32; 3], + ) -> Result { + Err(PlacementQueryError::Unavailable) + } + /// Look up a randomizable container, then consume a loot seed only when one + /// exists. Missing or unrelated block entities are successful no-ops. + fn set_block_entity_loot_table( + &mut self, + _position: [i32; 3], + _table: &str, + _random: &mut impl horizon_core::random::RandomSource, + ) -> Result<(), PlacementQueryError> { + Err(PlacementQueryError::Unavailable) + } + /// Look up the block entity at this position and set its exit only if it is /// an End gateway. Missing or other entities are successful no-ops. The /// owning world applies the gateway's dirty notification after the update. diff --git a/docs/rust-parity.md b/docs/rust-parity.md index 0719ce0b8..46e1a86fd 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -731,3 +731,21 @@ fixture dependency: decoration retains its six-feature corpus independently of region spring/tick/query probes; regenerated inputs are byte-identical to their validated corpora. Gateway entity creation/removal, dirty propagation, exit search and teleportation remain pending. + +## Bonus chest placement and loot assignment + +Bonus chest generation now independently shuffles the chunk's X and Z columns, +searches motion-blocking-no-leaves heights and checks air or empty collision. +After a chest write it looks up a randomizable container, consuming a loot seed +only when one exists, then checks torch survival in native horizontal order. +Rejected writes retain the subsequent entity and torch operations. + +The [bonus-chest comparison](../benchmarks/rust-bonus-chest-2026-10-06/scoped-parity.json) +matches **1,505,542 lines per reference JAR** across **42,396 fixtures**. All +35,723 states participate in collision prefixes; complete searches cover both +random streams, missing/unrelated/chest entities, sole viable columns, exhausted +searches, repeated mutation, rejected writes, partial failures, extreme positions +and placement composition. Actual native chest loot-table and seed fields are +compared. Workspace tests and all-target Clippy pass. Heights and entity existence +are controlled by the fixture; inventory contents, loot generation, automatic +entity lifecycle and complete spawn generation remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java index 72c2be4d3..5d82bbc8f 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java @@ -67,6 +67,7 @@ public final class VanillaSimpleBlockOracle { final JsonObject f;final PrintWriter out;final RandomSource random;final Holder biome;int calls; final TreeMap states=new TreeMap<>(Comparator.comparingInt(BlockPos::getX).thenComparingInt(BlockPos::getY).thenComparingInt(BlockPos::getZ)); World(JsonObject f,PrintWriter out,RandomSource random){this.f=f;this.out=out;this.random=random;this.biome=f.has("biome")?Holder.direct(makeBiome(f.getAsJsonObject("biome"))):null;for(var raw:f.getAsJsonArray("states")){var v=raw.getAsJsonArray();states.put(pos(v),Block.stateById(v.get(3).getAsInt()));}} + final TreeMap lootContainers=new TreeMap<>(Comparator.comparingInt(BlockPos::getX).thenComparingInt(BlockPos::getY).thenComparingInt(BlockPos::getZ)); final TreeMap gateways=new TreeMap<>(Comparator.comparingInt(BlockPos::getX).thenComparingInt(BlockPos::getY).thenComparingInt(BlockPos::getZ)); final Map chunks=new HashMap<>(); ProtoChunk chunk(BlockPos p) { @@ -93,6 +94,12 @@ public final class VanillaSimpleBlockOracle { if(name.equals("getRawBrightness")){var p=(BlockPos)args[0];event("light "+xyz(p)+" "+args[1]);return f.get("brightness").getAsInt();} if(name.equals("getBlockEntity")){ var p=((BlockPos)args[0]).immutable();event("entity "+xyz(p));String mode=f.has("gateway_entity")?f.get("gateway_entity").getAsString():"none"; + if(f.has("loot_entity")){ + String lootMode=f.get("loot_entity").getAsString(); + if(lootMode.equals("chest"))return lootContainers.computeIfAbsent(p,key->new ChestBlockEntity(key,Blocks.CHEST.defaultBlockState())); + if(lootMode.equals("other"))return new TheEndGatewayBlockEntity(p,Blocks.END_GATEWAY.defaultBlockState()); + return null; + } if(mode.equals("other"))return new ShulkerBoxBlockEntity(p,Blocks.SHULKER_BOX.defaultBlockState()); if(mode.equals("gateway"))return gateways.computeIfAbsent(p,key->new TheEndGatewayBlockEntity(key,Blocks.END_GATEWAY.defaultBlockState()){@Override public void setChanged(){event("gateway_changed "+xyz(key));}}); return null; @@ -156,6 +163,7 @@ public final class VanillaSimpleBlockOracle { handler.calls=0;try{out.println("place "+decoded.get().place(world,generator,random,origin));}catch(Stop|IllegalArgumentException error){out.println("place error");} out.println("next "+random.nextLong()+" "+worldRandom.nextLong());out.println("calls "+handler.calls); for(var entry:handler.states.entrySet())out.println("stored "+xyz(entry.getKey())+" "+Block.getId(entry.getValue())); + for(var entry:handler.lootContainers.entrySet())if(entry.getValue().getLootTable()!=null)out.println("loot "+xyz(entry.getKey())+" "+entry.getValue().getLootTable().identifier()+" "+entry.getValue().getLootTableSeed()); for(var entry:handler.gateways.entrySet()) { var exit=TheEndGatewayBlockEntity.class.getDeclaredField("exitPortal");exit.setAccessible(true);var exact=TheEndGatewayBlockEntity.class.getDeclaredField("exactTeleport");exact.setAccessible(true); out.println("gateway "+xyz(entry.getKey())+" "+xyz((BlockPos)exit.get(entry.getValue()))+" "+exact.getBoolean(entry.getValue())); diff --git a/tools/test_bonus_chest_parity.py b/tools/test_bonus_chest_parity.py new file mode 100644 index 000000000..5ea24963e --- /dev/null +++ b/tools/test_bonus_chest_parity.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python3 +"""Compare native bonus chest candidate search, loot assignment and torches.""" +import itertools +import json +try: + from . import test_simple_block_parity as harness +except ImportError: + import test_simple_block_parity as harness + + +def corpus(facts, placement): + get=lambda name:facts['defaults']['minecraft:'+name] + def case(**extra): + value={'definition':json.dumps({'type':'bonus_chest'}),'mode':'feature','origin':[0,64,0], + 'legacy':False,'seed':0,'world_seed':1,'fail':-1,'reject':0,'brightness':15, + 'fallback':get('air'),'states':[],'repeats':1,'loot_entity':'chest'} + value.update(extra);return value + # Read each state's actual empty-context collision through a candidate prefix. + for state in range(len(facts['states'])): + yield case(fallback=state,fail=8) + names=['air','cave_air','void_air','stone','water','lava','tall_grass','oak_leaves','oak_slab','snow','shulker_box','moving_piston','powder_snow','chest','torch'] + for legacy,seed,name,entity,fail,reject in itertools.product([False,True],[0,-1],names,['none','other','chest'],[-1,0,1,2,3,4,5,8,12,20],[0,1,3]): + yield case(legacy=legacy,seed=seed,fallback=get(name),loot_entity=entity,fail=fail,reject=reject,repeats=2) + for legacy,seed,entity in itertools.product([False,True],range(256),['none','chest']): + yield case(legacy=legacy,seed=seed,loot_entity=entity,air_above=63,fallback=get('stone'),repeats=2) + for legacy,origin,height in itertools.product([False,True],[[0,0,0],[-1,-64,-1],[16,319,16],[2147483647,-2147483648,-2147483648]],[-2147483648,-64,0,319,2147483647]): + yield case(legacy=legacy,origin=origin,height=height,air_above=height-1 if height>-2147483648 else -2147483648,fallback=get('stone')) + # Force search through many solid candidates before finding the sole air cell. + for legacy,seed in itertools.product([False,True],range(32)): + yield case(legacy=legacy,seed=seed,fallback=get('stone'),states=[[15,64,15,get('air')]]) + for legacy,seed,fail,reject in itertools.product([False,True],[0,-1,987654321],[-1,0,5,20],[0,1,3]): + placed={'feature':{'type':'bonus_chest'},'placement':[{'type':'count','count':2},{'type':'in_square'}]} + yield case(definition=json.dumps(placed),mode='placed',legacy=legacy,seed=seed,fail=fail,reject=reject,air_above=63,fallback=get('stone')) + yield case(definition=json.dumps({'type':'overlay','features':[placed,{'feature':{'type':'bonus_chest'},'placement':[]}]}),legacy=legacy,seed=seed,fail=fail,reject=reject) + yield case(definition=json.dumps({'type':'bonus_chest','ignored':None})) + + +if __name__=='__main__': + harness.run(corpus,'rust-bonus-chest-parity',__file__, + 'Native BonusChestFeature unit codec, independently shuffled chunk X/Z coordinates, ordered heightmap candidate search, air short-circuit and second-read empty-context collision, chest writes, conditional randomizable-container loot seeding, north/east/south/west torch survival and writes. Every state participates in collision prefixes; complete searches cover absent/unrelated/actual native chest entities, repeated mutation, rejected writes, injected failures, both random modes, shuffled search exhaustion, sole viable columns, extreme coordinates/heights and placement composition. Actual ChestBlockEntity loot table and seed are compared; fixtures control heights and entity existence independently of writes. Loot generation, inventory behavior, automatic block-entity lifecycle, world updates and complete spawn generation remain pending.') From e2200620ffeb32cb84aba9b9f54b2a9d0ca0f35a Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 14:12:29 +0200 Subject: [PATCH 033/253] Implement recursive chorus generation and connection refreshes --- .github/workflows/ci.yml | 4 + .../scoped-parity.json | 221 ++++++++++++++++++ crates/horizon-world/src/worldgen.rs | 1 + .../src/worldgen/chorus_plant.rs | 204 ++++++++++++++++ .../src/worldgen/feature_graph.rs | 10 + docs/rust-parity.md | 16 ++ tools/test_chorus_plant_parity.py | 48 ++++ 7 files changed, 504 insertions(+) create mode 100644 benchmarks/rust-chorus-plant-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-world/src/worldgen/chorus_plant.rs create mode 100644 tools/test_chorus_plant_parity.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fd18f190a..09bdb89a7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -155,6 +155,10 @@ jobs: env: RUSTUP_TOOLCHAIN: stable run: python tools/test_bonus_chest_parity.py + - name: Compare recursive chorus generation and connection refreshes + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_chorus_plant_parity.py - name: Compare replacement blob search and Manhattan shells env: RUSTUP_TOOLCHAIN: stable diff --git a/benchmarks/rust-chorus-plant-2026-10-06/scoped-parity.json b/benchmarks/rust-chorus-plant-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..017a04167 --- /dev/null +++ b/benchmarks/rust-chorus-plant-2026-10-06/scoped-parity.json @@ -0,0 +1,221 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 254296, + "candidate_states": 35723, + "double_plant_blocks": 10, + "mossy_carpet_blocks": 1, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java": "d2f9843f8fb20d392cf19d14d1cdd99f0422cead8ef12487ff5b3b0e18576726", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSurvivalOracle.java": "4e7cc151617c1b02e872f9ca3e9fe4632379f225f4f07718ff6492df4ee551e7", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java": "e871d3a01f15616a98ca9227c27a81e4d17e2d57ac4e68a5650a70fa29811497", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSupportOracle.java": "04350901a2d708fb8fa672de61d058f73f332d2e90df1b93a67781862f89c1ad", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "60ff9ef7c1d5e23c080f9aec95ab2e7d3b7c5b5bcd67b9efa9518776c400629a", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_simple_block_parity.py": "50b783323051fe8cd369bb733448b0314f1e6e7994a950e4cb6cd2fe4f7f8e11", + "tools/test_chorus_plant_parity.py": "e28dd04628cf781ddfe5f90d17626253859aab1bc9be699790912ec8008340ae", + "tools/test_block_survival_parity.py": "9e8dff3bd4b95dbfd29f8adc6a2f6d66abf19a6b1cd91423b794a345d4ec244a", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "a8cd85f6223668c1446ff103276d80937b9707d9a7dc619a176b1b1ceed36a4a", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "1eae82604d2b3377fd35aaa3a914a67e5af28f93923815a49e895b4d437433cd", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "adcf1af2df04cd2c2de1c3726cb9023ef03a504b0c6ec2f12b7f47d39b4d50d0", + "crates/horizon-world/src/worldgen/feature_region.rs": "ae7552027b2efc0db6299dc14ab04c28615e43b876b5d67644855fd7a047e33e", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "b8fb9fb80a66a851d916f07f15df1a40b6cc95b49e71aaec4d4b4107f13d9f9f", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "0ccfe9532f08efe4f841d779b86239e9c55b36670b50b4aaafb15c3177026d44", + "crates/horizon-world/examples/simple_block_fixture.rs": "c2827b81f21886027d2a53ff41457586a4c6ed7eafe451906320922b11756ca0" + }, + "fixtures_sha256": { + ".local/rust-chorus-plant-parity/inputs.txt": "69f0f10494984b73e855c2609931bb1df1d71edcfe22b52c8cb72168a549cf4a", + ".local/rust-chorus-plant-parity/block-properties.nbt": "1aba22092f70d16b8092014c058ddc210e4aaa77bac32f6ec62e4d0e91d92a99", + ".local/rust-chorus-plant-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-chorus-plant-parity/cached-collision.nbt": "f3a5c6a5b2d51dad6c52e486e2b9989e79fd55db1a9bda6196db399550b04078", + ".local/rust-chorus-plant-parity/cached-support.nbt": "b6fdc9471b0b61e904206d3f099f4dc235aad6d723536c210be0cb7c3560d82c", + ".local/rust-chorus-plant-parity/catalog.json": "93581107e3564e60261044fdca61e3b7f237b9e6724c14b86e335ccc01198ba9", + ".local/rust-chorus-plant-parity/facts.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-chorus-plant-parity/feature-catalog.json": "c048c761c5084a40560731955cc999a364d14055bdd86fa50989a92e4a771286", + ".local/rust-chorus-plant-parity/fluid-tags.json": "f1e5eb6d22ea7effbb118a2282709cfdeef1bfae4516b775a55ad7a4df29d7d0", + ".local/rust-chorus-plant-parity/placement-definitions.json": "f8a972ec87c2352500af6481158a3192bdbf699951025639bea744e4127b97c4", + ".local/rust-chorus-plant-parity/support-cached-states.json": "353945a58fe69b352925473f1693f9b14a9ad19f13c15159c4184f2c29258622", + ".local/rust-chorus-plant-parity/survival-classes.json": "361832008eea0aa9151d367a125a19c6353d99a0b88b27dd0682f55b7954553e", + ".local/rust-chorus-plant-parity/survival-extra-definitions.json": "170f2db5bc97a49fa25cc249540aa7f04beea455cdbaf43742ed9415f5090a02", + ".local/rust-chorus-plant-parity/survival-placement-classes.json": "7fdbf48ab18c87098bbe1b6176cb81f4842b6c5d9a4d6bbaf7037ff61cb1848c", + ".local/rust-chorus-plant-parity/survival-rules.json": "8805c18b3195bb1eac1f1e5281333df56e2892505f64023e5403c58ce2ec4368", + ".local/rust-chorus-plant-parity/survival-support-tags.json": "15d88d5bb5ad10d65124d5abb2cc055d251b06d129bca7be06f55b43dc13f6fd", + ".local/rust-chorus-plant-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0" + }, + "rust_output_sha256": "ca7419b58f7a11619335892948ff291d1d48a0c890bffa2fffc812c8f5ff1ab7", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "ca7419b58f7a11619335892948ff291d1d48a0c890bffa2fffc812c8f5ff1ab7", + "matched_output_lines": 8083367 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "ca7419b58f7a11619335892948ff291d1d48a0c890bffa2fffc812c8f5ff1ab7", + "matched_output_lines": 8083367 + } + ], + "scope": "Native ChorusPlantFeature unit codec, origin air/support gates, ChorusFlowerBlock.generatePlant and depth-bounded recursive growth, horizontal clearance with parent exclusion, branch-distance bounds, connection refreshes in below/above/north/east/south/west read order and age-five terminal flowers. Every state exercises root/support gates and five neighbor connection prefixes. Full runs cover 1024 seeds per RNG, every early world-call failure, rejected writes, repeated mutation, random obstacles, wrapped coordinates and feature composition. Ordered reads/writes, final state maps and subsequent RNG draws are compared. Neighbor-update execution, random tick growth, drops, rendering and complete End generation remain pending." +} diff --git a/crates/horizon-world/src/worldgen.rs b/crates/horizon-world/src/worldgen.rs index 07b0a033b..606e73198 100644 --- a/crates/horizon-world/src/worldgen.rs +++ b/crates/horizon-world/src/worldgen.rs @@ -19,6 +19,7 @@ pub mod bonus_chest; pub mod bulk_section; pub mod carver; pub mod carving; +pub mod chorus_plant; pub mod climate; pub mod decoration; pub mod delta; diff --git a/crates/horizon-world/src/worldgen/chorus_plant.rs b/crates/horizon-world/src/worldgen/chorus_plant.rs new file mode 100644 index 000000000..54ca29b90 --- /dev/null +++ b/crates/horizon-world/src/worldgen/chorus_plant.rs @@ -0,0 +1,204 @@ +//! Bounded recursive chorus generation with native connection-state refreshes. +use super::{DecodeError, block_feature::FeatureBlockBindings, feature::FeatureWorld}; +use crate::registry::BlockStateId; +use horizon_core::random::{InvalidBound, RandomSource}; +use std::{collections::BTreeSet, sync::Arc}; +const HORIZONTAL: [[i32; 3]; 4] = [[0, 0, -1], [1, 0, 0], [0, 0, 1], [-1, 0, 0]]; +const NEIGHBORS: [[i32; 3]; 6] = [ + [0, -1, 0], + [0, 1, 0], + [0, 0, -1], + [1, 0, 0], + [0, 0, 1], + [-1, 0, 0], +]; +fn offset(p: [i32; 3], d: [i32; 3]) -> [i32; 3] { + std::array::from_fn(|i| p[i].wrapping_add(d[i])) +} +#[derive(Clone, Debug)] +pub struct ChorusPlantFeature { + air: [BlockStateId; 3], + support: Arc>, + connectors: BTreeSet, + plant: [BlockStateId; 64], + flower: BlockStateId, +} +#[derive(Debug)] +pub enum ChorusPlantError { + World(E), + Random(InvalidBound), +} +impl std::fmt::Display for ChorusPlantError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::World(e) => e.fmt(f), + Self::Random(e) => e.fmt(f), + } + } +} +impl std::error::Error for ChorusPlantError {} +impl ChorusPlantFeature { + pub fn new(bindings: &FeatureBlockBindings<'_>) -> Result { + let registry = bindings.registry(); + let get = |name| { + registry + .default_state(name) + .ok_or_else(|| DecodeError::Registry(format!("unknown chorus block {name}"))) + }; + let default = get("minecraft:chorus_plant")?; + let mut plant = [default; 64]; + for (mask, id) in plant.iter_mut().enumerate() { + let mut state = registry.state(default).unwrap().clone(); + for (i, name) in ["down", "up", "north", "east", "south", "west"] + .into_iter() + .enumerate() + { + state + .properties + .insert(name.into(), (mask & (1 << i) != 0).to_string()); + } + *id = registry + .id(&state) + .ok_or(DecodeError::Field("chorus connections"))?; + } + let mut flower = registry + .state(get("minecraft:chorus_flower")?) + .unwrap() + .clone(); + flower.properties.insert("age".into(), "5".into()); + let flower = registry + .id(&flower) + .ok_or(DecodeError::Field("chorus flower age"))?; + let mut connectors = BTreeSet::new(); + for name in ["minecraft:chorus_plant", "minecraft:chorus_flower"] { + connectors.extend( + bindings + .blocks + .get(name) + .ok_or(DecodeError::Field("chorus identity"))? + .iter() + .copied(), + ); + } + Ok(Self { + air: bindings.air, + support: bindings + .tags + .get("minecraft:supports_chorus_plant") + .cloned() + .unwrap_or_default(), + connectors, + plant, + flower, + }) + } + pub fn place( + &self, + world: &mut W, + random: &mut impl RandomSource, + origin: [i32; 3], + ) -> Result> { + if !self.empty(world, origin)? + || !self.support.contains( + &world + .block(offset(origin, [0, -1, 0])) + .map_err(ChorusPlantError::World)?, + ) + { + return Ok(false); + } + self.connect(world, origin)?; + self.grow(world, random, origin, origin, 0)?; + Ok(true) + } + fn empty( + &self, + world: &mut W, + p: [i32; 3], + ) -> Result> { + Ok(self + .air + .contains(&world.block(p).map_err(ChorusPlantError::World)?)) + } + fn neighbors_empty( + &self, + world: &mut W, + p: [i32; 3], + except: Option, + ) -> Result> { + for (i, d) in HORIZONTAL.into_iter().enumerate() { + if except != Some(i) && !self.empty(world, offset(p, d))? { + return Ok(false); + } + } + Ok(true) + } + fn connect( + &self, + world: &mut W, + p: [i32; 3], + ) -> Result<(), ChorusPlantError> { + let mut mask = 0; + for (i, d) in NEIGHBORS.into_iter().enumerate() { + let state = world.block(offset(p, d)).map_err(ChorusPlantError::World)?; + if self.connectors.contains(&state) || i == 0 && self.support.contains(&state) { + mask |= 1 << i; + } + } + world + .set_block(p, self.plant[mask], 2) + .map_err(ChorusPlantError::World)?; + Ok(()) + } + fn grow( + &self, + world: &mut W, + random: &mut impl RandomSource, + p: [i32; 3], + root: [i32; 3], + depth: u8, + ) -> Result<(), ChorusPlantError> { + let height = random.next_int_bound(4).map_err(ChorusPlantError::Random)? + + 1 + + if depth == 0 { 1 } else { 0 }; + for step in 1..=height { + let above = offset(p, [0, step, 0]); + if !self.neighbors_empty(world, above, None)? { + return Ok(()); + } + self.connect(world, above)?; + self.connect(world, offset(above, [0, -1, 0]))?; + } + let mut branched = false; + if depth < 4 { + let attempts = random.next_int_bound(4).map_err(ChorusPlantError::Random)? + + if depth == 0 { 1 } else { 0 }; + for _ in 0..attempts { + let direction = + random.next_int_bound(4).map_err(ChorusPlantError::Random)? as usize; + let branch = offset(offset(p, [0, height, 0]), HORIZONTAL[direction]); + if branch[0].wrapping_sub(root[0]).wrapping_abs() >= 8 + || branch[2].wrapping_sub(root[2]).wrapping_abs() >= 8 + { + continue; + } + let opposite = (direction + 2) % 4; + if self.empty(world, branch)? + && self.empty(world, offset(branch, [0, -1, 0]))? + && self.neighbors_empty(world, branch, Some(opposite))? + { + branched = true; + self.connect(world, branch)?; + self.connect(world, offset(branch, HORIZONTAL[opposite]))?; + self.grow(world, random, branch, root, depth + 1)?; + } + } + } + if !branched { + world + .set_block(offset(p, [0, height, 0]), self.flower, 2) + .map_err(ChorusPlantError::World)?; + } + Ok(()) + } +} diff --git a/crates/horizon-world/src/worldgen/feature_graph.rs b/crates/horizon-world/src/worldgen/feature_graph.rs index 34d1a423d..f8ff4a3ed 100644 --- a/crates/horizon-world/src/worldgen/feature_graph.rs +++ b/crates/horizon-world/src/worldgen/feature_graph.rs @@ -56,6 +56,7 @@ pub enum FeatureDefinition { EndPodium(super::end_podium::EndPodiumFeature), EndGateway(super::end_gateway::EndGatewayFeature), BonusChest(super::bonus_chest::BonusChestFeature), + ChorusPlant(super::chorus_plant::ChorusPlantFeature), Spike(super::spike::SpikeFeature), BlueIce(super::blue_ice::BlueIceFeature), UnderwaterMagma(super::underwater_magma::UnderwaterMagmaFeature), @@ -90,6 +91,7 @@ pub enum FeatureExecutionError { EndPodium(super::end_podium::EndPodiumError), EndGateway(super::end_gateway::EndGatewayError), BonusChest(super::bonus_chest::BonusChestError), + ChorusPlant(super::chorus_plant::ChorusPlantError), Spike(super::spike::SpikeError), BlueIce(super::blue_ice::BlueIceError), UnderwaterMagma(super::underwater_magma::UnderwaterMagmaError), @@ -115,6 +117,7 @@ impl std::fmt::Display for FeatureExecutionError { Self::EndPodium(e) => e.fmt(f), Self::EndGateway(e) => e.fmt(f), Self::BonusChest(e) => e.fmt(f), + Self::ChorusPlant(e) => e.fmt(f), Self::Spike(e) => e.fmt(f), Self::BlueIce(e) => e.fmt(f), Self::UnderwaterMagma(e) => e.fmt(f), @@ -309,6 +312,10 @@ impl FeatureDefinition { ) .map(Self::ReplaceBlobs) } + "minecraft:chorus_plant" => super::chorus_plant::ChorusPlantFeature::new( + blocks.ok_or(DecodeError::Field("chorus plant bindings"))?, + ) + .map(Self::ChorusPlant), "minecraft:bonus_chest" => super::bonus_chest::BonusChestFeature::new( blocks.ok_or(DecodeError::Field("bonus chest bindings"))?, ) @@ -681,6 +688,9 @@ impl FeatureDefinition { Self::ReplaceBlobs(feature) => feature .place(world, random, origin) .map_err(FeatureExecutionError::ReplaceBlobs), + Self::ChorusPlant(feature) => feature + .place(world, random, origin) + .map_err(FeatureExecutionError::ChorusPlant), Self::BonusChest(feature) => feature .place(world, random, origin) .map_err(FeatureExecutionError::BonusChest), diff --git a/docs/rust-parity.md b/docs/rust-parity.md index 46e1a86fd..f0419a09f 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -749,3 +749,19 @@ and placement composition. Actual native chest loot-table and seed fields are compared. Workspace tests and all-target Clippy pass. Heights and entity existence are controlled by the fixture; inventory contents, loot generation, automatic entity lifecycle and complete spawn generation remain pending. + +## Recursive chorus generation + +Chorus generation now checks its air origin and tagged support, builds and +refreshes connection states, branches recursively within the native depth and +distance bounds, and places age-five terminal flowers. Clearance checks exclude +the parent branch, and rejected writes retain native subsequent reads and draws. + +The [chorus comparison](../benchmarks/rust-chorus-plant-2026-10-06/scoped-parity.json) +matches **8,083,367 lines per reference JAR** across **254,296 fixtures**. Every +state participates in origin/support gates and five neighbor-connection prefixes. +Full growth covers 1,024 seeds per random generator, early failure boundaries, +rejected writes, repeated mutation, random obstacles, wrapped coordinates and +feature composition. Workspace tests and all-target Clippy pass. Neighbor-update +execution, random tick growth, drops, rendering and complete End generation remain +pending. diff --git a/tools/test_chorus_plant_parity.py b/tools/test_chorus_plant_parity.py new file mode 100644 index 000000000..d4c552c8e --- /dev/null +++ b/tools/test_chorus_plant_parity.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python3 +"""Compare native recursive chorus generation and connection-state refreshes.""" +import itertools +import json +import random +try: + from . import test_simple_block_parity as harness +except ImportError: + import test_simple_block_parity as harness + + +def corpus(facts, placement): + get=lambda name:facts['defaults']['minecraft:'+name] + ground=[0,63,0,get('end_stone')] + def case(**extra): + value={'definition':json.dumps({'type':'chorus_plant'}),'mode':'feature','origin':[0,64,0], + 'legacy':False,'seed':0,'world_seed':1,'fail':-1,'reject':0,'brightness':15, + 'fallback':get('air'),'states':[ground],'repeats':1} + value.update(extra);return value + for state in range(len(facts['states'])): + yield case(states=[[0,64,0,state],ground],fail=2) + yield case(states=[[0,63,0,state]],fail=2) + # Full initial connection-state evaluation before the injected write failure. + for x,y,z in [[0,65,0],[0,64,-1],[1,64,0],[0,64,1],[-1,64,0]]: + yield case(states=[ground,[x,y,z,state]],fail=8) + for legacy,seed in itertools.product([False,True],range(1024)): + yield case(legacy=legacy,seed=seed,repeats=2) + for legacy,seed,fail,reject in itertools.product([False,True],[0,1,-1],[-1,*range(80),101,127,191,255],[0,1,3]): + yield case(legacy=legacy,seed=seed,fail=fail,reject=reject,repeats=2) + rng=random.Random(0x43484f525553) + palette=[get(n) for n in ['air','cave_air','void_air','stone','end_stone','chorus_plant','chorus_flower','water']] + for legacy in [False,True]: + for _ in range(256): + entries=[ground]+[[rng.randrange(-7,8),rng.randrange(65,84),rng.randrange(-7,8),rng.choice(palette)] for _ in range(80)] + yield case(legacy=legacy,seed=rng.randrange(2**63),states=entries,reject=rng.choice([0,1,3]),fail=rng.choice([-1,19,37,100,300])) + for legacy,origin,seed in itertools.product([False,True],[[0,-64,0],[-17,319,-33],[2147483647,2147483647,-2147483648],[-2147483648,-2147483648,2147483647]],[0,1,-1]): + below=[origin[0],((origin[1]-1+2**31)%2**32)-2**31,origin[2],get('end_stone')] + yield case(legacy=legacy,origin=origin,seed=seed,states=[below]) + for legacy,seed,fail,reject in itertools.product([False,True],[0,-1],[-1,0,8,20,100],[0,1,3]): + placed={'feature':{'type':'chorus_plant'},'placement':[{'type':'count','count':2}]} + yield case(definition=json.dumps(placed),mode='placed',legacy=legacy,seed=seed,fail=fail,reject=reject) + yield case(definition=json.dumps({'type':'overlay','features':[placed,{'feature':{'type':'chorus_plant'},'placement':[]}]}),legacy=legacy,seed=seed,fail=fail,reject=reject) + yield case(definition=json.dumps({'type':'chorus_plant','ignored':False})) + + +if __name__=='__main__': + harness.run(corpus,'rust-chorus-plant-parity',__file__, + 'Native ChorusPlantFeature unit codec, origin air/support gates, ChorusFlowerBlock.generatePlant and depth-bounded recursive growth, horizontal clearance with parent exclusion, branch-distance bounds, connection refreshes in below/above/north/east/south/west read order and age-five terminal flowers. Every state exercises root/support gates and five neighbor connection prefixes. Full runs cover 1024 seeds per RNG, every early world-call failure, rejected writes, repeated mutation, random obstacles, wrapped coordinates and feature composition. Ordered reads/writes, final state maps and subsequent RNG draws are compared. Neighbor-update execution, random tick growth, drops, rendering and complete End generation remain pending.') From 53ff11164e3a19309ccc3b6e885c50f8c97f8dc9 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 14:16:46 +0200 Subject: [PATCH 034/253] Implement small speleothem patches and waterlogged points --- .github/workflows/ci.yml | 4 + .../scoped-parity.json | 222 ++++++++++++++++++ crates/horizon-world/src/worldgen.rs | 1 + .../src/worldgen/feature_graph.rs | 11 + .../horizon-world/src/worldgen/speleothem.rs | 210 +++++++++++++++++ docs/rust-parity.md | 16 ++ tools/test_speleothem_parity.py | 53 +++++ 7 files changed, 517 insertions(+) create mode 100644 benchmarks/rust-speleothem-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-world/src/worldgen/speleothem.rs create mode 100644 tools/test_speleothem_parity.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 09bdb89a7..95022faa6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -159,6 +159,10 @@ jobs: env: RUSTUP_TOOLCHAIN: stable run: python tools/test_chorus_plant_parity.py + - name: Compare small speleothem patches and waterlogged points + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_speleothem_parity.py - name: Compare replacement blob search and Manhattan shells env: RUSTUP_TOOLCHAIN: stable diff --git a/benchmarks/rust-speleothem-2026-10-06/scoped-parity.json b/benchmarks/rust-speleothem-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..4df39deb3 --- /dev/null +++ b/benchmarks/rust-speleothem-2026-10-06/scoped-parity.json @@ -0,0 +1,222 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 145473, + "candidate_states": 35723, + "double_plant_blocks": 10, + "mossy_carpet_blocks": 1, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleBlockOracle.java": "d2f9843f8fb20d392cf19d14d1cdd99f0422cead8ef12487ff5b3b0e18576726", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSurvivalOracle.java": "4e7cc151617c1b02e872f9ca3e9fe4632379f225f4f07718ff6492df4ee551e7", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java": "e871d3a01f15616a98ca9227c27a81e4d17e2d57ac4e68a5650a70fa29811497", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSupportOracle.java": "04350901a2d708fb8fa672de61d058f73f332d2e90df1b93a67781862f89c1ad", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "60ff9ef7c1d5e23c080f9aec95ab2e7d3b7c5b5bcd67b9efa9518776c400629a", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_simple_block_parity.py": "50b783323051fe8cd369bb733448b0314f1e6e7994a950e4cb6cd2fe4f7f8e11", + "tools/test_speleothem_parity.py": "babade3019311690a76f1d0ed7a0f7f1e530b9c906af107e8de9a578a1a52ffb", + "tools/test_block_survival_parity.py": "9e8dff3bd4b95dbfd29f8adc6a2f6d66abf19a6b1cd91423b794a345d4ec244a", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "a8cd85f6223668c1446ff103276d80937b9707d9a7dc619a176b1b1ceed36a4a", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "1eae82604d2b3377fd35aaa3a914a67e5af28f93923815a49e895b4d437433cd", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "ae7552027b2efc0db6299dc14ab04c28615e43b876b5d67644855fd7a047e33e", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "b8fb9fb80a66a851d916f07f15df1a40b6cc95b49e71aaec4d4b4107f13d9f9f", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "1dd9ccc9c555e29b52eb5eec591da98bbd9e68921196106d18793d993647592b", + "crates/horizon-world/examples/simple_block_fixture.rs": "c2827b81f21886027d2a53ff41457586a4c6ed7eafe451906320922b11756ca0" + }, + "fixtures_sha256": { + ".local/rust-speleothem-parity/inputs.txt": "c44660d49f333c226b31844317a7eaf4a6153a4a7b72ab5bf94a697e0668896d", + ".local/rust-speleothem-parity/block-properties.nbt": "1aba22092f70d16b8092014c058ddc210e4aaa77bac32f6ec62e4d0e91d92a99", + ".local/rust-speleothem-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-speleothem-parity/cached-collision.nbt": "f3a5c6a5b2d51dad6c52e486e2b9989e79fd55db1a9bda6196db399550b04078", + ".local/rust-speleothem-parity/cached-support.nbt": "b6fdc9471b0b61e904206d3f099f4dc235aad6d723536c210be0cb7c3560d82c", + ".local/rust-speleothem-parity/catalog.json": "93581107e3564e60261044fdca61e3b7f237b9e6724c14b86e335ccc01198ba9", + ".local/rust-speleothem-parity/facts.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-speleothem-parity/feature-catalog.json": "c048c761c5084a40560731955cc999a364d14055bdd86fa50989a92e4a771286", + ".local/rust-speleothem-parity/fluid-tags.json": "f1e5eb6d22ea7effbb118a2282709cfdeef1bfae4516b775a55ad7a4df29d7d0", + ".local/rust-speleothem-parity/placement-definitions.json": "f8a972ec87c2352500af6481158a3192bdbf699951025639bea744e4127b97c4", + ".local/rust-speleothem-parity/support-cached-states.json": "353945a58fe69b352925473f1693f9b14a9ad19f13c15159c4184f2c29258622", + ".local/rust-speleothem-parity/survival-classes.json": "361832008eea0aa9151d367a125a19c6353d99a0b88b27dd0682f55b7954553e", + ".local/rust-speleothem-parity/survival-extra-definitions.json": "170f2db5bc97a49fa25cc249540aa7f04beea455cdbaf43742ed9415f5090a02", + ".local/rust-speleothem-parity/survival-placement-classes.json": "7fdbf48ab18c87098bbe1b6176cb81f4842b6c5d9a4d6bbaf7037ff61cb1848c", + ".local/rust-speleothem-parity/survival-rules.json": "8805c18b3195bb1eac1f1e5281333df56e2892505f64023e5403c58ce2ec4368", + ".local/rust-speleothem-parity/survival-support-tags.json": "15d88d5bb5ad10d65124d5abb2cc055d251b06d129bca7be06f55b43dc13f6fd", + ".local/rust-speleothem-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0" + }, + "rust_output_sha256": "30d673861253bf83e197f8cf45be0501f2f81ae9d75af20ee9f5ebfb54447c2f", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "30d673861253bf83e197f8cf45be0501f2f81ae9d75af20ee9f5ebfb54447c2f", + "matched_output_lines": 2752289 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "30d673861253bf83e197f8cf45be0501f2f81ae9d75af20ee9f5ebfb54447c2f", + "matched_output_lines": 2752289 + } + ], + "scope": "Native SpeleothemFeature codecs and optional float defaults, ceiling/floor base tests, conditional random direction, four horizontal base-patch branches with radius-two/three direction draws, taller-tip chance, post-patch base recheck and waterlogged tip/frustum writes. Base/pointed configured states select block identities and their defaults; invalid pointed properties fail at native placement time. All states cover support/taller/contained-fluid roles, both RNGs, probability boundaries, rejected writes, partial failures, repeated mutation, wrapped coordinates and composition. Base patch updates and point placement are traced in order; neighbor updates, falling behavior, fluids, larger clusters and full cave generation remain pending." +} diff --git a/crates/horizon-world/src/worldgen.rs b/crates/horizon-world/src/worldgen.rs index 606e73198..f86c08957 100644 --- a/crates/horizon-world/src/worldgen.rs +++ b/crates/horizon-world/src/worldgen.rs @@ -46,6 +46,7 @@ pub mod rule_test; pub mod settings; pub mod simple_block; pub mod snow_freeze; +pub mod speleothem; pub mod spike; pub mod spring; pub mod state_provider; diff --git a/crates/horizon-world/src/worldgen/feature_graph.rs b/crates/horizon-world/src/worldgen/feature_graph.rs index f8ff4a3ed..1faf0abe0 100644 --- a/crates/horizon-world/src/worldgen/feature_graph.rs +++ b/crates/horizon-world/src/worldgen/feature_graph.rs @@ -57,6 +57,7 @@ pub enum FeatureDefinition { EndGateway(super::end_gateway::EndGatewayFeature), BonusChest(super::bonus_chest::BonusChestFeature), ChorusPlant(super::chorus_plant::ChorusPlantFeature), + Speleothem(super::speleothem::SpeleothemFeature), Spike(super::spike::SpikeFeature), BlueIce(super::blue_ice::BlueIceFeature), UnderwaterMagma(super::underwater_magma::UnderwaterMagmaFeature), @@ -92,6 +93,7 @@ pub enum FeatureExecutionError { EndGateway(super::end_gateway::EndGatewayError), BonusChest(super::bonus_chest::BonusChestError), ChorusPlant(super::chorus_plant::ChorusPlantError), + Speleothem(super::speleothem::SpeleothemError), Spike(super::spike::SpikeError), BlueIce(super::blue_ice::BlueIceError), UnderwaterMagma(super::underwater_magma::UnderwaterMagmaError), @@ -118,6 +120,7 @@ impl std::fmt::Display for FeatureExecutionError { Self::EndGateway(e) => e.fmt(f), Self::BonusChest(e) => e.fmt(f), Self::ChorusPlant(e) => e.fmt(f), + Self::Speleothem(e) => e.fmt(f), Self::Spike(e) => e.fmt(f), Self::BlueIce(e) => e.fmt(f), Self::UnderwaterMagma(e) => e.fmt(f), @@ -312,6 +315,11 @@ impl FeatureDefinition { ) .map(Self::ReplaceBlobs) } + "minecraft:speleothem" => super::speleothem::SpeleothemFeature::from_json( + json, + blocks.ok_or(DecodeError::Field("speleothem bindings"))?, + ) + .map(Self::Speleothem), "minecraft:chorus_plant" => super::chorus_plant::ChorusPlantFeature::new( blocks.ok_or(DecodeError::Field("chorus plant bindings"))?, ) @@ -688,6 +696,9 @@ impl FeatureDefinition { Self::ReplaceBlobs(feature) => feature .place(world, random, origin) .map_err(FeatureExecutionError::ReplaceBlobs), + Self::Speleothem(feature) => feature + .place(world, random, origin) + .map_err(FeatureExecutionError::Speleothem), Self::ChorusPlant(feature) => feature .place(world, random, origin) .map_err(FeatureExecutionError::ChorusPlant), diff --git a/crates/horizon-world/src/worldgen/speleothem.rs b/crates/horizon-world/src/worldgen/speleothem.rs new file mode 100644 index 000000000..aeb114db3 --- /dev/null +++ b/crates/horizon-world/src/worldgen/speleothem.rs @@ -0,0 +1,210 @@ +//! Small pointed formations, base patches and contained-water placement. +use super::{ + DecodeError, Object, + block_feature::FeatureBlockBindings, + block_predicate::PredicateBlockResolver, + feature::FeatureWorld, + number_text, optional, + placement::{PlacementContext, PlacementQueryError}, + required, +}; +use crate::registry::BlockStateId; +use horizon_core::{ + geometry::Direction, + random::{InvalidBound, RandomSource}, +}; +use std::{collections::BTreeSet, sync::Arc}; +#[derive(Clone, Debug)] +pub struct SpeleothemFeature { + base: BlockStateId, + base_states: Arc>, + replace: Arc>, + empty_or_water: BTreeSet, + // Direction (up/down), thickness (tip/frustum), waterlogged. Unsupported + // properties remain deferred placement failures, as in the native codec. + pointed: [[Option<[Option; 2]>; 2]; 2], + chances: [f32; 4], +} +#[derive(Debug)] +pub enum SpeleothemError { + World(E), + Query(PlacementQueryError), + Random(InvalidBound), + InvalidPointedState, +} +impl std::fmt::Display for SpeleothemError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::World(e) => e.fmt(f), + Self::Query(e) => e.fmt(f), + Self::Random(e) => e.fmt(f), + Self::InvalidPointedState => f.write_str("pointed block lacks required properties"), + } + } +} +impl std::error::Error for SpeleothemError {} +impl SpeleothemFeature { + pub fn from_json(json: &str, bindings: &FeatureBlockBindings<'_>) -> Result { + let object: Object = serde_json::from_str(json)?; + let registry = bindings.registry(); + let block = |field| -> Result { + let state = bindings + .codec + .decode(required(&object, field)?.get(), false) + .map_err(|e| DecodeError::Registry(e.to_string()))?; + registry + .default_state(®istry.state(state).unwrap().name) + .ok_or(DecodeError::Field("speleothem block identity")) + }; + let base = block("base_block")?; + let point = registry.state(block("pointed_block")?).unwrap(); + let mut pointed = [[None; 2]; 2]; + for (direction, row) in ["up", "down"].into_iter().zip(&mut pointed) { + for (thickness, entry) in ["tip", "frustum"].into_iter().zip(row) { + let mut state = point.clone(); + state + .properties + .insert("vertical_direction".into(), direction.into()); + state + .properties + .insert("thickness".into(), thickness.into()); + if registry.id(&state).is_some() { + *entry = Some([false, true].map(|water| { + let mut wet = state.clone(); + wet.properties + .insert("waterlogged".into(), water.to_string()); + registry.id(&wet) + })); + } + } + } + let mut chances = [0.2, 0.7, 0.5, 0.5]; + for (name, chance) in [ + "chance_of_taller_generation", + "chance_of_directional_spread", + "chance_of_spread_radius2", + "chance_of_spread_radius3", + ] + .into_iter() + .zip(&mut chances) + { + if let Some(raw) = optional(&object, name) { + *chance = number_text(raw)? + .parse::() + .map_err(|_| DecodeError::Field("speleothem chance"))? + as f32; + if !(0.0..=1.0).contains(chance) || chance.is_sign_negative() { + return Err(DecodeError::Field("speleothem chance")); + } + } + } + let mut empty_or_water = BTreeSet::from(bindings.air); + empty_or_water.extend( + bindings + .blocks + .get("minecraft:water") + .ok_or(DecodeError::Field("water bindings"))? + .iter() + .copied(), + ); + Ok(Self { + base, + base_states: bindings.blocks[®istry.state(base).unwrap().name].clone(), + replace: bindings + .predicate_block_set(required(&object, "replaceable_blocks")?.get())?, + empty_or_water, + pointed, + chances, + }) + } + fn is_base(&self, state: BlockStateId) -> bool { + self.base_states.contains(&state) || self.replace.contains(&state) + } + fn base_at( + &self, + world: &mut W, + p: [i32; 3], + ) -> Result<(), SpeleothemError> { + if self + .replace + .contains(&world.block(p).map_err(SpeleothemError::World)?) + { + world + .set_block(p, self.base, 2) + .map_err(SpeleothemError::World)?; + } + Ok(()) + } + pub fn place( + &self, + world: &mut W, + random: &mut impl RandomSource, + origin: [i32; 3], + ) -> Result> { + let ceiling = self.is_base( + world + .block(offset(origin, [0, 1, 0])) + .map_err(SpeleothemError::World)?, + ); + let floor = self.is_base( + world + .block(offset(origin, [0, -1, 0])) + .map_err(SpeleothemError::World)?, + ); + let direction = match (ceiling, floor) { + (true, true) => { + if random.next_boolean() { + Direction::Down + } else { + Direction::Up + } + } + (true, false) => Direction::Down, + (false, true) => Direction::Up, + (false, false) => return Ok(false), + }; + let step = direction.normal(); + let base = offset(origin, step.map(|v| -v)); + self.base_at(world, base)?; + for d in [[0, 0, -1], [1, 0, 0], [0, 0, 1], [-1, 0, 0]] { + if random.next_float() > self.chances[1] { + continue; + } + let mut p = offset(base, d); + self.base_at(world, p)?; + for chance in &self.chances[2..] { + if random.next_float() > *chance { + break; + } + let d = Direction::ALL + [random.next_int_bound(6).map_err(SpeleothemError::Random)? as usize]; + p = offset(p, d.normal()); + self.base_at(world, p)?; + } + } + let tall = random.next_float() < self.chances[0] + && self.empty_or_water.contains( + &world + .block(offset(origin, step)) + .map_err(SpeleothemError::World)?, + ); + if self.is_base(world.block(base).map_err(SpeleothemError::World)?) { + let row = &self.pointed[usize::from(direction == Direction::Down)]; + let mut p = origin; + for thickness in if tall { &[1, 0][..] } else { &[0][..] } { + let variants = row[*thickness].ok_or(SpeleothemError::InvalidPointedState)?; + let water = world.water_at(p).map_err(SpeleothemError::Query)?; + let state = + variants[usize::from(water)].ok_or(SpeleothemError::InvalidPointedState)?; + world + .set_block(p, state, 2) + .map_err(SpeleothemError::World)?; + p = offset(p, step); + } + } + Ok(true) + } +} +fn offset(p: [i32; 3], d: [i32; 3]) -> [i32; 3] { + std::array::from_fn(|i| p[i].wrapping_add(d[i])) +} diff --git a/docs/rust-parity.md b/docs/rust-parity.md index f0419a09f..662b5e4a0 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -765,3 +765,19 @@ rejected writes, repeated mutation, random obstacles, wrapped coordinates and feature composition. Workspace tests and all-target Clippy pass. Neighbor-update execution, random tick growth, drops, rendering and complete End generation remain pending. + +## Small pointed formations + +The `speleothem` feature now chooses its growth direction from ceiling/floor +blocks, spreads a base patch, selects one- or two-block height, rechecks its base +and writes waterlogged tip/frustum states. Configured base and pointed states +select block identities; placement uses their defaults. Unsupported pointed-block +properties fail during placement after the preceding patch operations. + +The [speleothem comparison](../benchmarks/rust-speleothem-2026-10-06/scoped-parity.json) +matches **2,752,289 lines per reference JAR** across **145,473 fixtures**, including +all states in support, taller-growth and contained-fluid roles; optional float +defaults and boundaries; both random streams; rejected writes; partial failures; +repeated mutation; wrapped positions; and composition. Workspace tests and +all-target Clippy pass. Neighbor updates, falling behavior, fluid simulation, +larger clusters and complete cave generation remain pending. diff --git a/tools/test_speleothem_parity.py b/tools/test_speleothem_parity.py new file mode 100644 index 000000000..36561c0a9 --- /dev/null +++ b/tools/test_speleothem_parity.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python3 +"""Compare small speleothem direction, base patches and waterlogged points.""" +import itertools +import json +try: + from . import test_simple_block_parity as harness +except ImportError: + import test_simple_block_parity as harness + +FIELDS=['chance_of_taller_generation','chance_of_directional_spread','chance_of_spread_radius2','chance_of_spread_radius3'] +def corpus(facts,placement): + get=lambda name:facts['defaults']['minecraft:'+name] + def definition(**extra): + value={'type':'speleothem','base_block':'dripstone_block','pointed_block':'pointed_dripstone','replaceable_blocks':['stone','dirt']} + value.update(extra);return value + def case(value=None,**extra): + f={'definition':json.dumps(definition() if value is None else value),'mode':'feature','origin':[0,64,0], + 'legacy':False,'seed':0,'world_seed':1,'fail':-1,'reject':0,'brightness':15,'fallback':get('air'), + 'states':[[0,63,0,get('stone')]],'repeats':1} + f.update(extra);return f + zero=definition(**dict.fromkeys(FIELDS,0)) + for state in range(len(facts['states'])): + yield case(states=[[0,65,0,state]],fail=2) + yield case(states=[[0,63,0,state]],fail=2) + yield case(zero,fluid=state) + yield case(definition(chance_of_taller_generation=1),states=[[0,63,0,get('stone')],[0,65,0,state]],fail=12) + for legacy,seed,mask,reject in itertools.product([False,True],range(64),range(4),[0,1,3]): + states=[[0,65,0,get('stone') if mask&1 else get('air')],[0,63,0,get('dirt') if mask&2 else get('air')]] + yield case(legacy=legacy,seed=seed,states=states,reject=reject,repeats=2) + for legacy,fail,reject,chance in itertools.product([False,True],[-1,*range(48)],[0,1,3],[0,0.5,1]): + yield case(definition(**dict.fromkeys(FIELDS,chance)),legacy=legacy,fail=fail,reject=reject,fallback=get('stone'),repeats=2) + for base,point in itertools.product(['stone',{'id':'oak_log','properties':{'axis':'x'}},'water'],['pointed_dripstone',{'id':'pointed_dripstone','properties':{'vertical_direction':'down','thickness':'base','waterlogged':'true'}},'stone','torch']): + for legacy in [False,True]:yield case(definition(base_block=base,pointed_block=point,**dict.fromkeys(FIELDS,1)),legacy=legacy,fallback=get('stone'),repeats=2) + for field in FIELDS: + for value in [None,-0.0,-1,0,1,1.0000000001,1.1,0.2,'0.5',True,False,[],{}]: + yield case(definition(**{field:value})) + for field in ['base_block','pointed_block','replaceable_blocks']: + value=definition();del value[field];yield case(value) + for raw in [None,[],{},False,'missing']: + yield case(definition(**{field:raw})) + for value in ['#minecraft:dripstone_replaceable_blocks',[],['air','water','stone'],'air','#horizon:missing']: + yield case(definition(replaceable_blocks=value),repeats=2) + for origin in [[0,-64,0],[-17,319,-33],[2147483647,2147483647,-2147483648],[-2147483648,-2147483648,2147483647]]: + below=[origin[0],((origin[1]-1+2**31)%2**32)-2**31,origin[2],get('stone')] + yield case(definition(**dict.fromkeys(FIELDS,1)),origin=origin,states=[below],repeats=2) + for legacy,fail,reject in itertools.product([False,True],[-1,0,2,5,19],[0,1,3]): + placed={'feature':definition(),'placement':[{'type':'count','count':2}]} + yield case(placed,mode='placed',legacy=legacy,fail=fail,reject=reject) + yield case({'type':'overlay','features':[placed,{'feature':definition(chance_of_taller_generation=1),'placement':[]}]},legacy=legacy,fail=fail,reject=reject) + +if __name__=='__main__': + harness.run(corpus,'rust-speleothem-parity',__file__, + 'Native SpeleothemFeature codecs and optional float defaults, ceiling/floor base tests, conditional random direction, four horizontal base-patch branches with radius-two/three direction draws, taller-tip chance, post-patch base recheck and waterlogged tip/frustum writes. Base/pointed configured states select block identities and their defaults; invalid pointed properties fail at native placement time. All states cover support/taller/contained-fluid roles, both RNGs, probability boundaries, rejected writes, partial failures, repeated mutation, wrapped coordinates and composition. Base patch updates and point placement are traced in order; neighbor updates, falling behavior, fluids, larger clusters and full cave generation remain pending.') From 0a63903b91b549eb50568e6b803937a503cef5d3 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 14:20:49 +0200 Subject: [PATCH 035/253] Connect generation-time destruction to resident region writes --- .../scoped-parity.json | 210 ++++++++++++++++++ .../examples/feature_region_fixture.rs | 8 +- .../src/worldgen/feature_region.rs | 24 +- docs/rust-parity.md | 16 ++ .../parity/VanillaFeatureRegionOracle.java | 19 ++ tests/test_feature_region_parity.py | 3 +- tools/test_feature_region_parity.py | 4 +- 7 files changed, 279 insertions(+), 5 deletions(-) create mode 100644 benchmarks/rust-feature-region-destroy-2026-10-06/scoped-parity.json diff --git a/benchmarks/rust-feature-region-destroy-2026-10-06/scoped-parity.json b/benchmarks/rust-feature-region-destroy-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..bf0c8d12c --- /dev/null +++ b/benchmarks/rust-feature-region-destroy-2026-10-06/scoped-parity.json @@ -0,0 +1,210 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "block_states": 35723, + "direct_state_probes": 35723, + "block_tag_files": 300, + "fixtures": 192, + "worldgen_random_modes": [ + false, + true + ], + "resident_chunks_per_fixture": 9, + "requested_placements": 3456, + "direct_tick_requests": 14784, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureRegionOracle.java": "e808ce25113543b7f813ca69820dc6118e7d6726f08ff1fef6a70c11baf8a6f8", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", + "tools/test_feature_region_parity.py": "502a1496db34a159ac43dfddccdc86f2893aec4aed52e8e2d6a3bd4c544f98c6", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "a8cd85f6223668c1446ff103276d80937b9707d9a7dc619a176b1b1ceed36a4a", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "1eae82604d2b3377fd35aaa3a914a67e5af28f93923815a49e895b4d437433cd", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "2ec6aa6231597388a16ccde4812ef69fa26a149e46b976c21a12dcfd7e981a96", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "b8fb9fb80a66a851d916f07f15df1a40b6cc95b49e71aaec4d4b4107f13d9f9f", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen.rs": "1dd9ccc9c555e29b52eb5eec591da98bbd9e68921196106d18793d993647592b", + "crates/horizon-world/examples/feature_region_fixture.rs": "b1272565bf7056b7976797e79167f1f4f43c8c7a03a594cc7b93936a4df804d8" + }, + "fixtures_sha256": { + ".local/rust-feature-region-parity/inputs.txt": "8660737853afa958450f3ec15679136379bd8f0b21b1198454982d6ea5424f7d", + ".local/rust-feature-region-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0", + ".local/rust-feature-region-parity/fluid-tags.json": "f1e5eb6d22ea7effbb118a2282709cfdeef1bfae4516b775a55ad7a4df29d7d0", + ".local/rust-feature-region-parity/facts-client.json": "1d24883ee807b0b71473f0bbf8ed548ddaf712148caeb3fcc7aa13ab973a97b0", + ".local/rust-feature-region-parity/facts-server.json": "1d24883ee807b0b71473f0bbf8ed548ddaf712148caeb3fcc7aa13ab973a97b0" + }, + "rust_output_sha256": "b63e8f2fc86c4d3d8d9d9c1a900dcb164444d93fb4ff71bebd902f92c1eb8d3f", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "b63e8f2fc86c4d3d8d9d9c1a900dcb164444d93fb4ff71bebd902f92c1eb8d3f", + "matched_output_lines": 29502523 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "b63e8f2fc86c4d3d8d9d9c1a900dcb164444d93fb4ff71bebd902f92c1eb8d3f", + "matched_output_lines": 29502523 + } + ], + "scope": "Native FeaturePlacer and three basic block-writing features, a composed sequence of four configured fill layers, single-block replacements, scattered ore and water springs share a world proxy backed by nine actual ProtoChunks. Configured water, horizontal logs, air, out-of-height fills and ore/replacement rules test graph-to-region binding. Initial two-layer stone/dirt terrain, both pre-light heightmap groups, count/square/heightmap/layered modifier chains, repeated placements, direct and WorldgenRandom-wrapped random streams, missing-neighbor errors, rejected writes and injected partial failures are compared. Final complete raw sections, heightmap presence and packed words are compared alongside ordered feature writes, update flags, explicit height queries and subsequent random draws. Rust uses resident registry-backed chunks, lazy heightmap priming and a caller-supplied write callback; imported air/fluid facts and bundled block tags bind independently across authenticated JARs. The proxy supplies storage mutation and actual native default scheduleTick/createTick methods routed through WorldGenTickAccess into each ProtoChunk. Separate block/fluid queues, first-request deduplication, nondefault-state block identity, shared tick-order advancement on duplicates and missing-chunk errors, out-of-height requests and wrapped clock values are compared, including saved queue order and priorities. Active and inactive End podiums additionally exercise native WorldGenRegion.destroyBlock through a subclass transport overriding only block reads and writes; air short-circuit, rejected replacements and write failures retain the generation-time semantics. All block states are also written into resident chunks, queried through feature access, cleared and queried again; contained fluid identity/amount/falling/source/full flags, water-tag membership and every bundled block tag plus an absent tag are compared. Negative coordinates, chunk edges, outside-height and absent chunks are covered. Block/fluid query bindings are an immutable registry-checked shared snapshot. Actual WorldGenRegion construction, write-zone policy, POIs, block entities, postprocessing execution, lighting, block/fluid tick execution, complete feature registries and complete world generation remain outside this comparison." +} diff --git a/crates/horizon-world/examples/feature_region_fixture.rs b/crates/horizon-world/examples/feature_region_fixture.rs index 6a4409a76..c2b87c320 100644 --- a/crates/horizon-world/examples/feature_region_fixture.rs +++ b/crates/horizon-world/examples/feature_region_fixture.rs @@ -267,7 +267,13 @@ fn run( registry.default_state("minecraft:air").unwrap(), ] { region.set_block_worldgen(p, state)?; - let mut world = TerrainFeatureAccess::new(&mut region, ()); + let mut world = TerrainFeatureAccess::new( + &mut region, + |_: &mut TerrainRegion<'_, Properties<'_>>, + _: [i32; 3], + _: BlockStateId, + _: i32| Ok::<_, RegionError>(false), + ); query_state(&mut world, p, tags, out)?; } } diff --git a/crates/horizon-world/src/worldgen/feature_region.rs b/crates/horizon-world/src/worldgen/feature_region.rs index 8bcfc2077..843e395f9 100644 --- a/crates/horizon-world/src/worldgen/feature_region.rs +++ b/crates/horizon-world/src/worldgen/feature_region.rs @@ -383,7 +383,29 @@ impl<'a, 'r, B: TerrainBlockStates, F> TerrainFeatureAccess<'a, 'r, B, F> { Self { region, write } } } -impl PlacementContext for TerrainFeatureAccess<'_, '_, B, F> { +impl<'r, B: TerrainBlockStates, F> PlacementContext for TerrainFeatureAccess<'_, 'r, B, F> +where + F: FnMut(&mut TerrainRegion<'r, B>, [i32; 3], BlockStateId, i32) -> Result, +{ + fn destroy_block_without_entity( + &mut self, + position: [i32; 3], + _drop_resources: bool, + ) -> Result { + // WorldGenRegion destruction is an air replacement through its write + // policy. It does not evaluate drops, unlike live-level destruction. + let chunk = self.region.chunk(position[0] >> 4, position[2] >> 4)?; + let state = chunk.block(position[0], position[1], position[2]); + if chunk.block_properties(state).is_air() { + return Ok(false); + } + let air = chunk + .registry() + .default_state("minecraft:air") + .expect("validated air state"); + (self.write)(self.region, position, air, 3).map_err(Into::into) + } + fn fluid_state( &mut self, position: [i32; 3], diff --git a/docs/rust-parity.md b/docs/rust-parity.md index 662b5e4a0..9a7b36ca8 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -781,3 +781,19 @@ defaults and boundaries; both random streams; rejected writes; partial failures; repeated mutation; wrapped positions; and composition. Workspace tests and all-target Clippy pass. Neighbor updates, falling behavior, fluid simulation, larger clusters and complete cave generation remain pending. + +## Generation-time destruction on resident chunks + +Feature access now routes destruction through its supplied write callback using +air and update flags `3`. Air is an immediate false result. This follows +`WorldGenRegion.destroyBlock`, whose generation-time path does not evaluate drops; +live-level destruction remains separate work. + +The [resident destruction comparison](../benchmarks/rust-feature-region-destroy-2026-10-06/scoped-parity.json) +matches **29,502,523 lines per reference JAR** across **192 fixtures**, adding +active/inactive End podiums to the resident feature corpus. The reference invokes +the actual WorldGenRegion method through a subclass that transports reads/writes +to the existing chunk fixture. Final sections, heightmaps, ticks, tag/fluid probes, +rejected writes and partial failures still agree. Workspace tests, all-target +Clippy and all 149 Python tests pass. Write-zone policy, POIs, block entities, +postprocessing execution, lighting and live-world effects remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureRegionOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureRegionOracle.java index ab8749812..9a60f2de0 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureRegionOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureRegionOracle.java @@ -25,6 +25,19 @@ import net.minecraft.world.level.levelgen.placement.*; /** Native feature placement into resident ProtoChunks through a world transport. */ public final class VanillaFeatureRegionOracle { + // Execute the actual native destruction method with resident storage as its + // world transport; no ServerLevel constructor or copied destruction body. + private static final class NativeDestruction extends net.minecraft.server.level.WorldGenRegion { + WorldGenLevel world; + private NativeDestruction(){super(null,null,null,null);} + @Override public BlockState getBlockState(BlockPos p){return world.getBlockState(p);} + @Override public boolean setBlock(BlockPos p,BlockState state,int flags,int recursion){return world.setBlock(p,state,flags,recursion);} + } + private static NativeDestruction destruction(WorldGenLevel world)throws ReflectiveOperationException { + var field=sun.misc.Unsafe.class.getDeclaredField("theUnsafe");field.setAccessible(true); + var value=(NativeDestruction)((sun.misc.Unsafe)field.get(null)).allocateInstance(NativeDestruction.class);value.world=world;return value; + } + private static ProtoChunk chunk(Map chunks,int x,int z) { var chunk=chunks.get(new ChunkPos(x>>4,z>>4));if(chunk==null)throw new IllegalArgumentException("missing region chunk");return chunk; } @@ -93,7 +106,12 @@ public final class VanillaFeatureRegionOracle { var fluidTicks=new WorldGenTickAccess(p->chunk(chunks,p.getX(),p.getZ()).getFluidTicks()); long[] tickOrder={f.get("tick_order").getAsLong()}; int[] calls={0};int fail=f.get("fail").getAsInt(),reject=f.get("reject").getAsInt(); + NativeDestruction[] destroyer={null}; var world=(WorldGenLevel)Proxy.newProxyInstance(WorldGenLevel.class.getClassLoader(),new Class[]{WorldGenLevel.class},(proxy,method,values)->switch(method.getName()) { + case "destroyBlock"->{ + if(method.isDefault())yield InvocationHandler.invokeDefault(proxy,method,values); + yield destroyer[0].destroyBlock((BlockPos)values[0],(Boolean)values[1],(net.minecraft.world.entity.Entity)values[2],(Integer)values[3]); + } case "getBlockTicks"->blockTicks; case "getFluidTicks"->fluidTicks; case "getGameTime"->f.get("game_time").getAsLong(); @@ -118,6 +136,7 @@ public final class VanillaFeatureRegionOracle { } default->throw new AssertionError("unexpected world method "+method); }); + destroyer[0]=destruction(world); var modifiers=new ArrayList();for(var value:f.getAsJsonArray("placement"))modifiers.add(PlacementModifier.CODEC.parse(JsonOps.INSTANCE,value).getOrThrow()); var placer=new FeaturePlacer(world,generator); for(int repeat=0;repeat<2;repeat++) { diff --git a/tests/test_feature_region_parity.py b/tests/test_feature_region_parity.py index c449389aa..741cde3bb 100644 --- a/tests/test_feature_region_parity.py +++ b/tests/test_feature_region_parity.py @@ -12,7 +12,8 @@ class FeatureRegionCorpusTests(unittest.TestCase): self.assertEqual(fixtures, list(regions.corpus(facts))) self.assertEqual(sorted(i for f in fixtures for i in f['probe_states']), list(range(len(facts['states'])))) self.assertTrue(all(len(f['tick_commands']) == 77 for f in fixtures)) - self.assertTrue(all(f['features'][-1]['type'] == 'spring_feature' for f in fixtures)) + self.assertTrue(all(any(v['type'] == 'spring_feature' for v in f['features']) for f in fixtures)) + self.assertTrue(all([v['active'] for v in f['features'] if v['type'] == 'end_podium'] == [False, True] for f in fixtures)) self.assertEqual({f['worldgen'] for f in fixtures}, {False, True}) self.assertEqual({f['legacy'] for f in fixtures}, {False, True}) self.assertEqual({f['stage'] for f in fixtures}, {'empty', 'terrain'}) diff --git a/tools/test_feature_region_parity.py b/tools/test_feature_region_parity.py index 64ecffa7a..a4f8f8e91 100644 --- a/tools/test_feature_region_parity.py +++ b/tools/test_feature_region_parity.py @@ -28,7 +28,7 @@ def configured_features(*, include_springs=True): def corpus(facts): - features=configured_features() + features=configured_features()+[{'type':'end_podium','active':active} for active in [False,True]] get=lambda name:facts['defaults']['minecraft:'+name] log_x=next(i for i,state in enumerate(facts['states']) if state[4]['id']=='minecraft:oak_log' and state[4].get('properties',{}).get('axis')=='x') ticks=[] @@ -108,7 +108,7 @@ def main(): "java":subprocess.check_output(["java","--version"],text=True).splitlines()[0],"rustc":subprocess.check_output(["rustc","--version"],text=True).strip(), "block_states":len(facts["states"]),"direct_state_probes":sum(len(f["probe_states"]) for f in fixtures),"block_tag_files":len(tags),"fixtures":len(fixtures),"worldgen_random_modes":[False,True],"resident_chunks_per_fixture":9,"requested_placements":sum(len(f["features"])*2 for f in fixtures),"direct_tick_requests":sum(len(f["tick_commands"]) for f in fixtures), "sources_sha256":tested_sources,"fixtures_sha256":tested_fixtures,"rust_output_sha256":lab.digest(build/"rust.txt","sha256"),"references":references, - "scope":"Native FeaturePlacer and three basic block-writing features, a composed sequence of four configured fill layers, single-block replacements, scattered ore and water springs share a world proxy backed by nine actual ProtoChunks. Configured water, horizontal logs, air, out-of-height fills and ore/replacement rules test graph-to-region binding. Initial two-layer stone/dirt terrain, both pre-light heightmap groups, count/square/heightmap/layered modifier chains, repeated placements, direct and WorldgenRandom-wrapped random streams, missing-neighbor errors, rejected writes and injected partial failures are compared. Final complete raw sections, heightmap presence and packed words are compared alongside ordered feature writes, update flags, explicit height queries and subsequent random draws. Rust uses resident registry-backed chunks, lazy heightmap priming and a caller-supplied write callback; imported air/fluid facts and bundled block tags bind independently across authenticated JARs. The proxy supplies storage mutation and actual native default scheduleTick/createTick methods routed through WorldGenTickAccess into each ProtoChunk. Separate block/fluid queues, first-request deduplication, nondefault-state block identity, shared tick-order advancement on duplicates and missing-chunk errors, out-of-height requests and wrapped clock values are compared, including saved queue order and priorities. All block states are also written into resident chunks, queried through feature access, cleared and queried again; contained fluid identity/amount/falling/source/full flags, water-tag membership and every bundled block tag plus an absent tag are compared. Negative coordinates, chunk edges, outside-height and absent chunks are covered. Block/fluid query bindings are an immutable registry-checked shared snapshot. Actual WorldGenRegion construction, write-zone policy, POIs, block entities, postprocessing execution, lighting, block/fluid tick execution, complete feature registries and complete world generation remain outside this comparison."} + "scope":"Native FeaturePlacer and three basic block-writing features, a composed sequence of four configured fill layers, single-block replacements, scattered ore and water springs share a world proxy backed by nine actual ProtoChunks. Configured water, horizontal logs, air, out-of-height fills and ore/replacement rules test graph-to-region binding. Initial two-layer stone/dirt terrain, both pre-light heightmap groups, count/square/heightmap/layered modifier chains, repeated placements, direct and WorldgenRandom-wrapped random streams, missing-neighbor errors, rejected writes and injected partial failures are compared. Final complete raw sections, heightmap presence and packed words are compared alongside ordered feature writes, update flags, explicit height queries and subsequent random draws. Rust uses resident registry-backed chunks, lazy heightmap priming and a caller-supplied write callback; imported air/fluid facts and bundled block tags bind independently across authenticated JARs. The proxy supplies storage mutation and actual native default scheduleTick/createTick methods routed through WorldGenTickAccess into each ProtoChunk. Separate block/fluid queues, first-request deduplication, nondefault-state block identity, shared tick-order advancement on duplicates and missing-chunk errors, out-of-height requests and wrapped clock values are compared, including saved queue order and priorities. Active and inactive End podiums additionally exercise native WorldGenRegion.destroyBlock through a subclass transport overriding only block reads and writes; air short-circuit, rejected replacements and write failures retain the generation-time semantics. All block states are also written into resident chunks, queried through feature access, cleared and queried again; contained fluid identity/amount/falling/source/full flags, water-tag membership and every bundled block tag plus an absent tag are compared. Negative coordinates, chunk edges, outside-height and absent chunks are covered. Block/fluid query bindings are an immutable registry-checked shared snapshot. Actual WorldGenRegion construction, write-zone policy, POIs, block entities, postprocessing execution, lighting, block/fluid tick execution, complete feature registries and complete world generation remain outside this comparison."} lab.write_json(report_path,report);print(f"Scoped feature-region parity passed: {report_path}") From e9a082517bd094996989747599be825f5f3c76f2 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 14:38:35 +0200 Subject: [PATCH 036/253] Enforce generation write radii before feature mutations --- .../scoped-parity.json | 213 ++++++++++++++++++ .../examples/feature_region_fixture.rs | 18 ++ crates/horizon-world/src/worldgen.rs | 1 + .../src/worldgen/feature_region.rs | 35 ++- .../horizon-world/src/worldgen/write_zone.rs | 22 ++ docs/rust-parity.md | 16 ++ .../parity/VanillaFeatureRegionOracle.java | 12 + tests/test_feature_region_parity.py | 1 + tools/test_feature_region_parity.py | 17 +- 9 files changed, 328 insertions(+), 7 deletions(-) create mode 100644 benchmarks/rust-feature-region-write-zone-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-world/src/worldgen/write_zone.rs diff --git a/benchmarks/rust-feature-region-write-zone-2026-10-06/scoped-parity.json b/benchmarks/rust-feature-region-write-zone-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..add2dbfed --- /dev/null +++ b/benchmarks/rust-feature-region-write-zone-2026-10-06/scoped-parity.json @@ -0,0 +1,213 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "block_states": 35723, + "direct_state_probes": 35723, + "write_zone_cases": 20125, + "block_tag_files": 300, + "fixtures": 192, + "worldgen_random_modes": [ + false, + true + ], + "resident_chunks_per_fixture": 9, + "requested_placements": 3456, + "direct_tick_requests": 14784, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureRegionOracle.java": "9892689b472e926c38f7ed4a613f761fe8117120f084c1d3195c45d8e223d3b4", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", + "tools/test_feature_region_parity.py": "36063564d3437a607af91ea74aa177a1f51318a4d08b32ef857a165c10d1e291", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "a8cd85f6223668c1446ff103276d80937b9707d9a7dc619a176b1b1ceed36a4a", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "1eae82604d2b3377fd35aaa3a914a67e5af28f93923815a49e895b4d437433cd", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "7677027594ed3df5e538402d5a3ba9276b67b56490463ca2686bfa418d02bd24", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "b8fb9fb80a66a851d916f07f15df1a40b6cc95b49e71aaec4d4b4107f13d9f9f", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "1d79a7fdb5dd18b0b59079cb2dc74682ba7af2a650c8efff027cfa530eee7bf9", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/feature_region_fixture.rs": "969ea5c21d7a2be24e0804185fa5557196c809dad961602f23cecdbfea635eba" + }, + "fixtures_sha256": { + ".local/rust-feature-region-parity/zones.json": "1864a9cdc17816c12fc5e92cd6abd32e45d67615075c52e928872e041d84244c", + ".local/rust-feature-region-parity/inputs.txt": "eb98b59c22ea7c90d657a91698b8f73dcbe4b510a72f3eefae3e982bb9c2086f", + ".local/rust-feature-region-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0", + ".local/rust-feature-region-parity/fluid-tags.json": "f1e5eb6d22ea7effbb118a2282709cfdeef1bfae4516b775a55ad7a4df29d7d0", + ".local/rust-feature-region-parity/facts-client.json": "1d24883ee807b0b71473f0bbf8ed548ddaf712148caeb3fcc7aa13ab973a97b0", + ".local/rust-feature-region-parity/facts-server.json": "1d24883ee807b0b71473f0bbf8ed548ddaf712148caeb3fcc7aa13ab973a97b0" + }, + "rust_output_sha256": "522b3abf0ac74366c9739d0d0977707b61e25ac73a98a620d5e2fb71bd8e32b9", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "522b3abf0ac74366c9739d0d0977707b61e25ac73a98a620d5e2fb71bd8e32b9", + "matched_output_lines": 29231123 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "522b3abf0ac74366c9739d0d0977707b61e25ac73a98a620d5e2fb71bd8e32b9", + "matched_output_lines": 29231123 + } + ], + "scope": "Native FeaturePlacer and three basic block-writing features, a composed sequence of four configured fill layers, single-block replacements, scattered ore and water springs share a world proxy backed by nine actual ProtoChunks. Configured water, horizontal logs, air, out-of-height fills and ore/replacement rules test graph-to-region binding. Initial two-layer stone/dirt terrain, both pre-light heightmap groups, count/square/heightmap/layered modifier chains, repeated placements, direct and WorldgenRandom-wrapped random streams, missing-neighbor errors, rejected writes and injected partial failures are compared. Final complete raw sections, heightmap presence and packed words are compared alongside ordered feature writes, update flags, explicit height queries and subsequent random draws. Rust uses resident registry-backed chunks, lazy heightmap priming and a caller-supplied write callback; imported air/fluid facts and bundled block tags bind independently across authenticated JARs. The proxy supplies storage mutation and actual native default scheduleTick/createTick methods routed through WorldGenTickAccess into each ProtoChunk. Separate block/fluid queues, first-request deduplication, nondefault-state block identity, shared tick-order advancement on duplicates and missing-chunk errors, out-of-height requests and wrapped clock values are compared, including saved queue order and priorities. Active and inactive End podiums additionally exercise native WorldGenRegion.destroyBlock through a subclass transport overriding only block reads and writes; air short-circuit, rejected replacements and write failures retain the generation-time semantics. All block states are also written into resident chunks, queried through feature access, cleared and queried again; contained fluid identity/amount/falling/source/full flags, water-tag membership and every bundled block tag plus an absent tag are compared. Negative coordinates, chunk edges, outside-height and absent chunks are covered. Block/fluid query bindings are an immutable registry-checked shared snapshot. The native horizontal write-zone predicate is compared separately across chunk/block coordinates, negative radii and wrapped subtraction/absolute-value extremes, and gates feature callbacks in selected fixtures. Actual WorldGenRegion construction, upgrading-world vertical write restrictions, POIs, block entities, postprocessing execution, lighting, block/fluid tick execution, complete feature registries and complete world generation remain outside this comparison." +} diff --git a/crates/horizon-world/examples/feature_region_fixture.rs b/crates/horizon-world/examples/feature_region_fixture.rs index c2b87c320..ca41de3da 100644 --- a/crates/horizon-world/examples/feature_region_fixture.rs +++ b/crates/horizon-world/examples/feature_region_fixture.rs @@ -7,6 +7,7 @@ use horizon_world::worldgen::{ feature_region::{RegionError, TerrainFeatureAccess, TerrainRegion}, placement::{FeaturePlacer, PlacementContext, PlacementModifier}, terrain::TerrainError, + write_zone::GenerationWriteZone, }; // Feature chains against a resident multi-chunk region. use horizon_core::position::ChunkPos; @@ -214,6 +215,12 @@ fn run( Ok(result) }; let mut world = TerrainFeatureAccess::new(&mut region, write); + if let Some(zone) = f["write_zone"].as_array() { + world = world.with_write_zone(GenerationWriteZone::new( + ChunkPos::new(n(&zone[0]), n(&zone[1])), + n(&zone[2]), + )); + } placer.place_with_context( &modifiers, &mut world, @@ -432,6 +439,17 @@ fn main() -> Result<(), Box> { .chain(std::iter::once("horizon:absent".into())) .collect(); let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + let zones: Value = serde_json::from_str(&fs::read_to_string(dir.join("zones.json"))?)?; + for row in zones.as_array().unwrap() { + let zone = GenerationWriteZone::new(ChunkPos::new(n(&row[0]), n(&row[1])), n(&row[2])); + let (x, z) = (n(&row[3]), n(&row[4])); + writeln!( + out, + "zone {} {}", + zone.contains_chunk(ChunkPos::new(x, z)), + zone.contains_block(horizon_core::position::BlockPos::new(x, i32::MIN, z)) + )?; + } for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { fixture( &serde_json::from_str(line)?, diff --git a/crates/horizon-world/src/worldgen.rs b/crates/horizon-world/src/worldgen.rs index f86c08957..ed126b40e 100644 --- a/crates/horizon-world/src/worldgen.rs +++ b/crates/horizon-world/src/worldgen.rs @@ -56,6 +56,7 @@ pub mod underwater_magma; pub mod value_provider; pub mod vines; pub mod weighted; +pub mod write_zone; use horizon_core::noise::{NoiseBuildError, NormalNoise, Normalization}; use serde_json::value::RawValue; use std::collections::BTreeMap; diff --git a/crates/horizon-world/src/worldgen/feature_region.rs b/crates/horizon-world/src/worldgen/feature_region.rs index 843e395f9..3c7e38318 100644 --- a/crates/horizon-world/src/worldgen/feature_region.rs +++ b/crates/horizon-world/src/worldgen/feature_region.rs @@ -377,10 +377,39 @@ impl PlacementContext for TerrainRegion<'_, B> { pub struct TerrainFeatureAccess<'a, 'r, B: TerrainBlockStates, F> { region: &'a mut TerrainRegion<'r, B>, write: F, + write_zone: Option, } impl<'a, 'r, B: TerrainBlockStates, F> TerrainFeatureAccess<'a, 'r, B, F> { pub fn new(region: &'a mut TerrainRegion<'r, B>, write: F) -> Self { - Self { region, write } + Self { + region, + write, + write_zone: None, + } + } + /// Apply the horizontal write radius before invoking mutation policy/effects. + /// Upgrading-world vertical restrictions remain the owning world's policy. + pub fn with_write_zone(mut self, zone: super::write_zone::GenerationWriteZone) -> Self { + self.write_zone = Some(zone); + self + } +} +impl<'r, B: TerrainBlockStates, F> TerrainFeatureAccess<'_, 'r, B, F> +where + F: FnMut(&mut TerrainRegion<'r, B>, [i32; 3], BlockStateId, i32) -> Result, +{ + fn write_block( + &mut self, + position: [i32; 3], + state: BlockStateId, + flags: i32, + ) -> Result { + if self.write_zone.is_some_and(|zone| { + !zone.contains_block(BlockPos::new(position[0], position[1], position[2])) + }) { + return Ok(false); + } + (self.write)(self.region, position, state, flags) } } impl<'r, B: TerrainBlockStates, F> PlacementContext for TerrainFeatureAccess<'_, 'r, B, F> @@ -403,7 +432,7 @@ where .registry() .default_state("minecraft:air") .expect("validated air state"); - (self.write)(self.region, position, air, 3).map_err(Into::into) + self.write_block(position, air, 3).map_err(Into::into) } fn fluid_state( @@ -480,6 +509,6 @@ where state: BlockStateId, flags: i32, ) -> Result { - (self.write)(self.region, position, state, flags) + self.write_block(position, state, flags) } } diff --git a/crates/horizon-world/src/worldgen/write_zone.rs b/crates/horizon-world/src/worldgen/write_zone.rs new file mode 100644 index 000000000..50cf1393f --- /dev/null +++ b/crates/horizon-world/src/worldgen/write_zone.rs @@ -0,0 +1,22 @@ +//! Horizontal generation write-zone predicate from the pinned chunk step. +use horizon_core::position::{BlockPos, ChunkPos}; + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct GenerationWriteZone { + center: ChunkPos, + radius: i32, +} +impl GenerationWriteZone { + /// The caller supplies the center chunk and the generation step's write + /// radius. Negative radii and wrapped coordinates retain Java semantics. + pub fn new(center: ChunkPos, radius: i32) -> Self { + Self { center, radius } + } + pub fn contains_chunk(self, chunk: ChunkPos) -> bool { + self.center.x.wrapping_sub(chunk.x).wrapping_abs() <= self.radius + && self.center.z.wrapping_sub(chunk.z).wrapping_abs() <= self.radius + } + pub fn contains_block(self, position: BlockPos) -> bool { + self.contains_chunk(position.chunk()) + } +} diff --git a/docs/rust-parity.md b/docs/rust-parity.md index 9a7b36ca8..b46da0116 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -797,3 +797,19 @@ to the existing chunk fixture. Final sections, heightmaps, ticks, tag/fluid prob rejected writes and partial failures still agree. Workspace tests, all-target Clippy and all 149 Python tests pass. Write-zone policy, POIs, block entities, postprocessing execution, lighting and live-world effects remain pending. + +## Generation write radii + +Feature access can now apply the generation step's horizontal write radius before +calling the mutation policy. Ordinary writes and destruction share the guard; +queries and tick scheduling retain their independent routing. The predicate uses +Java wrapping subtraction and absolute value, including integer-minimum cases. + +The [write-zone comparison](../benchmarks/rust-feature-region-write-zone-2026-10-06/scoped-parity.json) +matches **29,231,123 lines per reference JAR**. It adds **20,125 direct zone cases** +for both chunk and block coordinates, then exercises unrestricted, zero-radius, +shifted-center and negative-radius policies across the 192 resident fixtures. +Vanilla's actual public/private write-zone methods provide the reference. Workspace +tests, all-target Clippy and both focused fixture tests pass. The owning world +still supplies generation-step metadata and upgrading-world vertical restrictions; +full WorldGenRegion effects remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureRegionOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureRegionOracle.java index 9a60f2de0..1ee306b5b 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureRegionOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureRegionOracle.java @@ -38,6 +38,10 @@ public final class VanillaFeatureRegionOracle { var value=(NativeDestruction)((sun.misc.Unsafe)field.get(null)).allocateInstance(NativeDestruction.class);value.world=world;return value; } + private static void setWriteZone(NativeDestruction world,int x,int z,int radius)throws ReflectiveOperationException { + String[] names={"centerChunkX","centerChunkZ","writeRadius"};int[] values={x,z,radius}; + for(int i=0;i chunks,int x,int z) { var chunk=chunks.get(new ChunkPos(x>>4,z>>4));if(chunk==null)throw new IllegalArgumentException("missing region chunk");return chunk; } @@ -86,6 +90,12 @@ public final class VanillaFeatureRegionOracle { }}); var fluids=new Fluid[]{Fluids.EMPTY,Fluids.FLOWING_WATER,Fluids.WATER,Fluids.FLOWING_LAVA,Fluids.LAVA}; try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt"),StandardCharsets.UTF_8))) { + var zoneWorld=destruction(null); + var chunkZone=net.minecraft.server.level.WorldGenRegion.class.getDeclaredMethod("isWithinWriteZone",int.class,int.class);chunkZone.setAccessible(true); + for(var value:JsonParser.parseString(Files.readString(dir.resolve("zones.json"))).getAsJsonArray()) { + var row=value.getAsJsonArray();setWriteZone(zoneWorld,row.get(0).getAsInt(),row.get(1).getAsInt(),row.get(2).getAsInt()); + int x=row.get(3).getAsInt(),z=row.get(4).getAsInt();out.println("zone "+chunkZone.invoke(zoneWorld,x,z)+" "+zoneWorld.isWithinWriteZone(new BlockPos(x,Integer.MIN_VALUE,z))); + } for(var line:Files.readAllLines(dir.resolve("inputs.txt"))) { var f=JsonParser.parseString(line).getAsJsonObject();long seed=f.get("seed").getAsLong(); var features=new ArrayList(); @@ -128,6 +138,7 @@ public final class VanillaFeatureRegionOracle { case "getBlockState"->{var p=(BlockPos)values[0];yield chunk(chunks,p.getX(),p.getZ()).getBlockState(p);} case "setBlock"->{ var p=(BlockPos)values[0];var state=(BlockState)values[1];int flags=(Integer)values[2]; + if(!f.get("write_zone").isJsonNull()&&!destroyer[0].isWithinWriteZone(p))yield false; out.println("write "+p.getX()+" "+p.getY()+" "+p.getZ()+" "+Block.getId(state)+" "+flags); int call=calls[0]++;if(call==fail)throw new IllegalArgumentException("injected write failure"); boolean result=reject==0||call%reject!=0; @@ -137,6 +148,7 @@ public final class VanillaFeatureRegionOracle { default->throw new AssertionError("unexpected world method "+method); }); destroyer[0]=destruction(world); + if(!f.get("write_zone").isJsonNull()){var zone=f.getAsJsonArray("write_zone");setWriteZone(destroyer[0],zone.get(0).getAsInt(),zone.get(1).getAsInt(),zone.get(2).getAsInt());} var modifiers=new ArrayList();for(var value:f.getAsJsonArray("placement"))modifiers.add(PlacementModifier.CODEC.parse(JsonOps.INSTANCE,value).getOrThrow()); var placer=new FeaturePlacer(world,generator); for(int repeat=0;repeat<2;repeat++) { diff --git a/tests/test_feature_region_parity.py b/tests/test_feature_region_parity.py index 741cde3bb..1e86c84d2 100644 --- a/tests/test_feature_region_parity.py +++ b/tests/test_feature_region_parity.py @@ -14,6 +14,7 @@ class FeatureRegionCorpusTests(unittest.TestCase): self.assertTrue(all(len(f['tick_commands']) == 77 for f in fixtures)) self.assertTrue(all(any(v['type'] == 'spring_feature' for v in f['features']) for f in fixtures)) self.assertTrue(all([v['active'] for v in f['features'] if v['type'] == 'end_podium'] == [False, True] for f in fixtures)) + self.assertEqual({None if f['write_zone'] is None else tuple(f['write_zone']) for f in fixtures}, {None, (0, 0, 0), (1, 1, 0), (-1, -1, 1), (0, 0, -1)}) self.assertEqual({f['worldgen'] for f in fixtures}, {False, True}) self.assertEqual({f['legacy'] for f in fixtures}, {False, True}) self.assertEqual({f['stage'] for f in fixtures}, {'empty', 'terrain'}) diff --git a/tools/test_feature_region_parity.py b/tools/test_feature_region_parity.py index a4f8f8e91..ae62f3227 100644 --- a/tools/test_feature_region_parity.py +++ b/tools/test_feature_region_parity.py @@ -49,7 +49,7 @@ def corpus(facts): for reject in [0,3]: for placement in chains: for worldgen in [False,True]: - yield {'probe_states':list(range(fixture_index,len(facts['states']),192)),'worldgen':worldgen,'legacy':legacy,'seed':seed,'stage':stage,'fail':fail,'reject':reject,'placement':placement,'features':features,'tick_commands':ticks,'game_time':9223372036854775807 if worldgen else -9223372036854775808,'tick_order':9223372036854775803 if legacy else -9223372036854775808} + yield {'write_zone':[None,[0,0,0],[1,1,0],[-1,-1,1],[0,0,-1]][fixture_index%5],'probe_states':list(range(fixture_index,len(facts['states']),192)),'worldgen':worldgen,'legacy':legacy,'seed':seed,'stage':stage,'fail':fail,'reject':reject,'placement':placement,'features':features,'tick_commands':ticks,'game_time':9223372036854775807 if worldgen else -9223372036854775808,'tick_order':9223372036854775803 if legacy else -9223372036854775808} fixture_index+=1 @@ -91,7 +91,16 @@ def main(): fixtures=list(corpus(facts));inputs=build/"inputs.txt" inputs.write_text("".join(json.dumps(value,separators=(",",":"))+"\n" for value in fixtures),encoding="utf-8") (build/"tags.json").write_text(json.dumps(tags,separators=(",",":")),encoding="utf-8") - fixture_paths=[inputs,build/"tags.json",build/"fluid-tags.json",build/"facts-client.json",build/"facts-server.json"] + edges=[-2147483648,-2147483647,-134217729,-134217728,-17,-16,-1,0,1,15,16,134217727,134217728,2147483646,2147483647] + zones=[] + for cx,cz in [(0,0),(-1,1),(-2147483648,-2147483648),(2147483647,2147483647),(134217727,-134217728)]: + for radius in [-2147483648,-2,-1,0,1,2,7,134217728,2147483647]: + for x in edges: + for z in edges:zones.append([cx,cz,radius,x,z]) + rng=random.Random(0x574f524c445a4f4e45) + for _ in range(10000):zones.append([rng.randrange(-2**31,2**31) for _ in range(5)]) + zone_inputs=build/'zones.json';zone_inputs.write_text(json.dumps(zones,separators=(',',':'))) + fixture_paths=[zone_inputs,inputs,build/"tags.json",build/"fluid-tags.json",build/"facts-client.json",build/"facts-server.json"] tested_fixtures=base.source_hashes(fixture_paths) run(["cargo","build","--release","-p","horizon-world","--example","feature_region_fixture"],"compile-rust") metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) @@ -106,9 +115,9 @@ def main(): base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) report={"schema":1,"minecraft":lock["minecraft"]["version"],"manifest_sha1":lock["minecraft"]["manifest_sha1"],"platform":platform.platform(), "java":subprocess.check_output(["java","--version"],text=True).splitlines()[0],"rustc":subprocess.check_output(["rustc","--version"],text=True).strip(), - "block_states":len(facts["states"]),"direct_state_probes":sum(len(f["probe_states"]) for f in fixtures),"block_tag_files":len(tags),"fixtures":len(fixtures),"worldgen_random_modes":[False,True],"resident_chunks_per_fixture":9,"requested_placements":sum(len(f["features"])*2 for f in fixtures),"direct_tick_requests":sum(len(f["tick_commands"]) for f in fixtures), + "block_states":len(facts["states"]),"direct_state_probes":sum(len(f["probe_states"]) for f in fixtures),"write_zone_cases":len(zones),"block_tag_files":len(tags),"fixtures":len(fixtures),"worldgen_random_modes":[False,True],"resident_chunks_per_fixture":9,"requested_placements":sum(len(f["features"])*2 for f in fixtures),"direct_tick_requests":sum(len(f["tick_commands"]) for f in fixtures), "sources_sha256":tested_sources,"fixtures_sha256":tested_fixtures,"rust_output_sha256":lab.digest(build/"rust.txt","sha256"),"references":references, - "scope":"Native FeaturePlacer and three basic block-writing features, a composed sequence of four configured fill layers, single-block replacements, scattered ore and water springs share a world proxy backed by nine actual ProtoChunks. Configured water, horizontal logs, air, out-of-height fills and ore/replacement rules test graph-to-region binding. Initial two-layer stone/dirt terrain, both pre-light heightmap groups, count/square/heightmap/layered modifier chains, repeated placements, direct and WorldgenRandom-wrapped random streams, missing-neighbor errors, rejected writes and injected partial failures are compared. Final complete raw sections, heightmap presence and packed words are compared alongside ordered feature writes, update flags, explicit height queries and subsequent random draws. Rust uses resident registry-backed chunks, lazy heightmap priming and a caller-supplied write callback; imported air/fluid facts and bundled block tags bind independently across authenticated JARs. The proxy supplies storage mutation and actual native default scheduleTick/createTick methods routed through WorldGenTickAccess into each ProtoChunk. Separate block/fluid queues, first-request deduplication, nondefault-state block identity, shared tick-order advancement on duplicates and missing-chunk errors, out-of-height requests and wrapped clock values are compared, including saved queue order and priorities. Active and inactive End podiums additionally exercise native WorldGenRegion.destroyBlock through a subclass transport overriding only block reads and writes; air short-circuit, rejected replacements and write failures retain the generation-time semantics. All block states are also written into resident chunks, queried through feature access, cleared and queried again; contained fluid identity/amount/falling/source/full flags, water-tag membership and every bundled block tag plus an absent tag are compared. Negative coordinates, chunk edges, outside-height and absent chunks are covered. Block/fluid query bindings are an immutable registry-checked shared snapshot. Actual WorldGenRegion construction, write-zone policy, POIs, block entities, postprocessing execution, lighting, block/fluid tick execution, complete feature registries and complete world generation remain outside this comparison."} + "scope":"Native FeaturePlacer and three basic block-writing features, a composed sequence of four configured fill layers, single-block replacements, scattered ore and water springs share a world proxy backed by nine actual ProtoChunks. Configured water, horizontal logs, air, out-of-height fills and ore/replacement rules test graph-to-region binding. Initial two-layer stone/dirt terrain, both pre-light heightmap groups, count/square/heightmap/layered modifier chains, repeated placements, direct and WorldgenRandom-wrapped random streams, missing-neighbor errors, rejected writes and injected partial failures are compared. Final complete raw sections, heightmap presence and packed words are compared alongside ordered feature writes, update flags, explicit height queries and subsequent random draws. Rust uses resident registry-backed chunks, lazy heightmap priming and a caller-supplied write callback; imported air/fluid facts and bundled block tags bind independently across authenticated JARs. The proxy supplies storage mutation and actual native default scheduleTick/createTick methods routed through WorldGenTickAccess into each ProtoChunk. Separate block/fluid queues, first-request deduplication, nondefault-state block identity, shared tick-order advancement on duplicates and missing-chunk errors, out-of-height requests and wrapped clock values are compared, including saved queue order and priorities. Active and inactive End podiums additionally exercise native WorldGenRegion.destroyBlock through a subclass transport overriding only block reads and writes; air short-circuit, rejected replacements and write failures retain the generation-time semantics. All block states are also written into resident chunks, queried through feature access, cleared and queried again; contained fluid identity/amount/falling/source/full flags, water-tag membership and every bundled block tag plus an absent tag are compared. Negative coordinates, chunk edges, outside-height and absent chunks are covered. Block/fluid query bindings are an immutable registry-checked shared snapshot. The native horizontal write-zone predicate is compared separately across chunk/block coordinates, negative radii and wrapped subtraction/absolute-value extremes, and gates feature callbacks in selected fixtures. Actual WorldGenRegion construction, upgrading-world vertical write restrictions, POIs, block entities, postprocessing execution, lighting, block/fluid tick execution, complete feature registries and complete world generation remain outside this comparison."} lab.write_json(report_path,report);print(f"Scoped feature-region parity passed: {report_path}") From e755a5920a4dcc4458539abc6793b74d8363c4a1 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 14:59:17 +0200 Subject: [PATCH 037/253] Implement proto-chunk block-entity storage and coordinate resolution --- .github/workflows/ci.yml | 4 + .../scoped-parity.json | 205 ++++++++++++++++++ .../examples/block_entity_storage_fixture.rs | 169 +++++++++++++++ crates/horizon-world/src/block_entities.rs | 102 +++++++++ crates/horizon-world/src/lib.rs | 1 + crates/horizon-world/tests/block_entities.rs | 73 +++++++ docs/rust-parity.md | 20 ++ .../VanillaBlockEntityStorageOracle.java | 62 ++++++ tools/test_block_entity_storage_parity.py | 95 ++++++++ 9 files changed, 731 insertions(+) create mode 100644 benchmarks/rust-block-entity-storage-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-world/examples/block_entity_storage_fixture.rs create mode 100644 crates/horizon-world/src/block_entities.rs create mode 100644 crates/horizon-world/tests/block_entities.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockEntityStorageOracle.java create mode 100644 tools/test_block_entity_storage_parity.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 95022faa6..4ba2c4657 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -187,6 +187,10 @@ jobs: env: RUSTUP_TOOLCHAIN: stable run: python tools/test_generation_tick_parity.py + - name: Compare proto-chunk block-entity storage and coordinates + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_block_entity_storage_parity.py - name: Compare ordered single-block replacement features env: RUSTUP_TOOLCHAIN: stable diff --git a/benchmarks/rust-block-entity-storage-2026-10-06/scoped-parity.json b/benchmarks/rust-block-entity-storage-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..b7d454d6e --- /dev/null +++ b/benchmarks/rust-block-entity-storage-2026-10-06/scoped-parity.json @@ -0,0 +1,205 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "commands": { + "reset": 23, + "resolve": 20825, + "pending": 2533, + "dump": 773, + "get": 864, + "save": 914, + "mutate": 869, + "active": 889, + "remove": 821 + }, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockEntityStorageOracle.java": "7d9c7b9f9b82e3b543a062424d4b59374fccc2068010d5523c6c0020c22c2e69", + "tools/test_block_entity_storage_parity.py": "0a772a8db25e46db18d9a1962209c3199e6daea34140452e64cd73747805f198", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "4e556a5896b893fbb73bf2e2b8e70601a8374f58b9f4f5f3730e99916a846e3a", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "1eae82604d2b3377fd35aaa3a914a67e5af28f93923815a49e895b4d437433cd", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "7677027594ed3df5e538402d5a3ba9276b67b56490463ca2686bfa418d02bd24", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "b8fb9fb80a66a851d916f07f15df1a40b6cc95b49e71aaec4d4b4107f13d9f9f", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "1d79a7fdb5dd18b0b59079cb2dc74682ba7af2a650c8efff027cfa530eee7bf9", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/block_entity_storage_fixture.rs": "feefacc51bcf2b5af62869130512ac150664470c07cc2c2746d9258a6709b181" + }, + "fixtures_sha256": { + ".local/rust-block-entity-storage-parity/inputs.txt": "9b9242240b36a6b65fbc0a3c707685946cbbbe16cfcafa59c5b16bd5aa33718f" + }, + "rust_output_sha256": "81304a08cb574ec6b4c46ea76ffd4bdd8bfc331d5b07bd4bc4de3d7564340dc9", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "81304a08cb574ec6b4c46ea76ffd4bdd8bfc331d5b07bd4bc4de3d7564340dc9", + "matched_output_lines": 78251 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "81304a08cb574ec6b4c46ea76ffd4bdd8bfc331d5b07bd4bc4de3d7564340dc9", + "matched_output_lines": 78251 + } + ], + "scope": "Native BlockEntity.getPosFromTag and actual ProtoChunk pending/active insertion, lookup, removal, position union and pending-save fallback. NumericTag coordinate reads cover integer narrowing, float/double floor overflow, infinities/NaNs, missing/nonnumeric fields, wrong-chunk relocation and wrapped chunk coordinates. Active entries replace pending data; later pending records cannot overwrite active entries. In-place pending coordinate mutation retains the original map key. Native chest entities carry loot seeds for active identity and basic saving-metadata comparisons; Rust supplies caller-owned payload serialization. Iteration order is normalized, and pending reads are borrowed/owned values rather than unrestricted Java aliases. Entity creation from NBT, complete entity serializers, active behavior and integration with chunk lifecycle remain pending." +} diff --git a/crates/horizon-world/examples/block_entity_storage_fixture.rs b/crates/horizon-world/examples/block_entity_storage_fixture.rs new file mode 100644 index 000000000..e321f23fe --- /dev/null +++ b/crates/horizon-world/examples/block_entity_storage_fixture.rs @@ -0,0 +1,169 @@ +use horizon_core::position::{BlockPos, ChunkPos}; +use horizon_world::{ + block_entities::{ProtoBlockEntities, position_from_tag}, + nbt::Tag, +}; +use std::{ + fs, + io::{self, BufRead, Write}, + str::SplitWhitespace, +}; +struct Input<'a>(SplitWhitespace<'a>); +impl Input<'_> { + fn int(&mut self) -> i32 { + self.0.next().unwrap().parse().unwrap() + } + fn long(&mut self) -> i64 { + self.0.next().unwrap().parse().unwrap() + } + fn pos(&mut self) -> BlockPos { + BlockPos::new(self.int(), self.int(), self.int()) + } + fn tag(&mut self) -> Option { + let kind = self.0.next().unwrap(); + let text = self.0.next().unwrap(); + Some(match kind { + "none" => return None, + "byte" => Tag::Byte(text.parse().unwrap()), + "short" => Tag::Short(text.parse().unwrap()), + "int" => Tag::Int(text.parse().unwrap()), + "long" => Tag::Long(text.parse().unwrap()), + "float" => { + let bits = u32::from_str_radix(text, 16).unwrap(); + Tag::Float(if f32::from_bits(bits) == 0.0 { 0 } else { bits }) + } + "double" => { + let bits = u64::from_str_radix(text, 16).unwrap(); + Tag::Double(if f64::from_bits(bits) == 0.0 { 0 } else { bits }) + } + "string" => Tag::String(text.into()), + _ => panic!("unknown atom"), + }) + } +} +fn xyz(p: BlockPos) -> String { + format!("{} {} {}", p.x, p.y, p.z) +} +fn atom(tag: Option<&Tag>) -> String { + match tag { + None => "none".into(), + Some(Tag::Float(v)) => format!("float:{v:x}"), + Some(Tag::Double(v)) => format!("double:{v:x}"), + Some(Tag::Byte(v)) => format!("1:{v}"), + Some(Tag::Short(v)) => format!("2:{v}"), + Some(Tag::Int(v)) => format!("3:{v}"), + Some(Tag::Long(v)) => format!("4:{v}"), + Some(v) => format!("{}:invalid", v.id()), + } +} +fn pending(tag: Option<&Tag>) -> String { + match tag { + None => "none".into(), + Some(tag) => { + let Some(Tag::Long(mark)) = tag.get("mark") else { + panic!("missing marker") + }; + format!( + "{mark} {} {} {}", + atom(tag.get("x")), + atom(tag.get("y")), + atom(tag.get("z")) + ) + } + } +} +fn main() -> Result<(), Box> { + let args: Vec<_> = std::env::args().collect(); + let mut out = io::BufWriter::new(fs::File::create(&args[2])?); + let mut position = ChunkPos::default(); + let mut chunk = ProtoBlockEntities::::new(position); + for (index, line) in io::BufReader::new(fs::File::open(&args[1])?) + .lines() + .enumerate() + { + let line = line?; + let mut input = Input(line.split_whitespace()); + let op = input.0.next().unwrap(); + writeln!(out, "command {index} {op}")?; + match op { + "reset" => { + position = ChunkPos::new(input.int(), input.int()); + chunk = ProtoBlockEntities::new(position); + } + "pending" | "resolve" => { + let mut entries = std::collections::BTreeMap::new(); + entries.insert("mark".into(), Tag::Long(input.long())); + for name in ["x", "y", "z"] { + if let Some(tag) = input.tag() { + entries.insert(name.into(), tag); + } + } + let tag = Tag::Compound(entries); + writeln!(out, "position {}", xyz(position_from_tag(position, &tag)?))?; + if op == "pending" { + chunk.set_pending(tag)?; + } + } + "active" => { + let p = input.pos(); + chunk.set_active(p, input.long()); + } + "remove" => { + chunk.remove(input.pos()); + } + "mutate" => { + let p = input.pos(); + let x = input.int(); + if let Some(Tag::Compound(map)) = chunk.pending_mut(p) { + map.insert("x".into(), Tag::Int(x)); + } + } + "get" => { + let p = input.pos(); + writeln!( + out, + "active {}", + chunk.active(p).map_or("none".into(), ToString::to_string) + )?; + writeln!(out, "pending {}", pending(chunk.pending(p)))?; + } + "save" => { + let p = input.pos(); + let saved = chunk.for_saving(p, |mark| { + Ok::<_, io::Error>(Tag::compound([("LootTableSeed", Tag::Long(*mark))])) + })?; + if chunk.active(p).is_some() { + let Some(Tag::Long(seed)) = saved.as_ref().unwrap().get("LootTableSeed") else { + unreachable!() + }; + writeln!(out, "saved active minecraft:chest {} {seed}", xyz(p))?; + } else { + writeln!(out, "saved pending {}", pending(saved.as_ref()))?; + } + } + "dump" => { + let mut positions: Vec<_> = chunk.positions().into_iter().collect(); + positions.sort_by_key(|p| (p.x, p.y, p.z)); + for p in &positions { + writeln!( + out, + "entry {} {} {}", + xyz(*p), + chunk.active(*p).map_or("none".into(), ToString::to_string), + pending(chunk.pending(*p)) + )?; + } + writeln!( + out, + "size {} {}", + positions.len(), + chunk.pending_entries().len() + )?; + } + _ => panic!("unknown command"), + } + assert!(input.0.next().is_none()); + } + out.flush()?; + Ok(()) +} diff --git a/crates/horizon-world/src/block_entities.rs b/crates/horizon-world/src/block_entities.rs new file mode 100644 index 000000000..22a2bc959 --- /dev/null +++ b/crates/horizon-world/src/block_entities.rs @@ -0,0 +1,102 @@ +//! Proto-chunk block-entity storage. Active payloads are caller-owned runtime +//! types; this module does not create entities or execute their behavior. +use crate::{compression::invalid, nbt::Tag}; +use horizon_core::position::{BlockPos, ChunkPos}; +use std::{ + collections::{HashMap, HashSet}, + io, +}; + +/// Resolve native block-entity coordinates, relocating mismatched X/Z into the +/// owning chunk while retaining local offsets and the full Y coordinate. The +/// supplied tag is not rewritten. NumericTag float/double reads use Mth.floor. +pub fn position_from_tag(chunk: ChunkPos, tag: &Tag) -> io::Result { + if !matches!(tag, Tag::Compound(_)) { + return Err(invalid("block entity is not a compound")); + } + let read = |name| match tag.get(name) { + Some(Tag::Byte(v)) => i32::from(*v), + Some(Tag::Short(v)) => i32::from(*v), + Some(Tag::Int(v)) => *v, + Some(Tag::Long(v)) => *v as i32, + Some(Tag::Float(bits)) => f64::from(f32::from_bits(*bits)).floor() as i32, + Some(Tag::Double(bits)) => f64::from_bits(*bits).floor() as i32, + _ => 0, + }; + let (mut x, y, mut z) = (read("x"), read("y"), read("z")); + if x >> 4 != chunk.x || z >> 4 != chunk.z { + x = chunk.x.wrapping_shl(4).wrapping_add(x & 15); + z = chunk.z.wrapping_shl(4).wrapping_add(z & 15); + } + Ok(BlockPos::new(x, y, z)) +} + +pub struct ProtoBlockEntities { + position: ChunkPos, + pending: HashMap, + active: HashMap, +} +impl ProtoBlockEntities { + pub fn new(position: ChunkPos) -> Self { + Self { + position, + pending: HashMap::new(), + active: HashMap::new(), + } + } + /// Ignore a pending record when an active entity already owns its resolved + /// position. Inserting an active entity removes any earlier pending record. + pub fn set_pending(&mut self, tag: Tag) -> io::Result<()> { + let position = position_from_tag(self.position, &tag)?; + if !self.active.contains_key(&position) { + self.pending.insert(position, tag); + } + Ok(()) + } + /// Position must be the payload's immutable world position, as supplied by + /// the runtime's block-entity constructor. No chunk/build-height gate applies. + pub fn set_active(&mut self, position: BlockPos, entity: E) -> Option { + self.pending.remove(&position); + self.active.insert(position, entity) + } + pub fn active(&self, position: BlockPos) -> Option<&E> { + self.active.get(&position) + } + pub fn active_mut(&mut self, position: BlockPos) -> Option<&mut E> { + self.active.get_mut(&position) + } + pub fn pending(&self, position: BlockPos) -> Option<&Tag> { + self.pending.get(&position) + } + /// Mutating coordinate fields does not re-key an existing pending entry. + pub fn pending_mut(&mut self, position: BlockPos) -> Option<&mut Tag> { + self.pending.get_mut(&position) + } + pub fn pending_entries(&self) -> &HashMap { + &self.pending + } + pub fn positions(&self) -> HashSet { + self.pending + .keys() + .chain(self.active.keys()) + .copied() + .collect() + } + pub fn remove(&mut self, position: BlockPos) -> Option { + self.pending.remove(&position); + self.active.remove(&position) + } + /// Serialize an active entity when present, otherwise clone its pending tag. + /// The caller supplies runtime serialization; this does not instantiate NBT. + pub fn for_saving( + &self, + position: BlockPos, + serialize: impl FnOnce(&E) -> Result, + ) -> Result, T> { + if let Some(entity) = self.active.get(&position) { + serialize(entity).map(Some) + } else { + Ok(self.pending.get(&position).cloned()) + } + } +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 80c53eae8..c3571b884 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -2,6 +2,7 @@ #![forbid(unsafe_code)] pub mod block_collision; +pub mod block_entities; pub mod block_placement; pub mod block_properties; pub mod block_support; diff --git a/crates/horizon-world/tests/block_entities.rs b/crates/horizon-world/tests/block_entities.rs new file mode 100644 index 000000000..244c6f95f --- /dev/null +++ b/crates/horizon-world/tests/block_entities.rs @@ -0,0 +1,73 @@ +use horizon_core::position::{BlockPos, ChunkPos}; +use horizon_world::{block_entities::ProtoBlockEntities, nbt::Tag}; + +#[test] +fn invalid_pending_data_is_rejected_without_replacing_active_or_pending_entries() { + let mut store = ProtoBlockEntities::new(ChunkPos::new(0, 0)); + let active = BlockPos::new(0, 64, 0); + store.set_active(active, "active"); + let pending = Tag::compound([("x", Tag::Int(1)), ("y", Tag::Int(64)), ("z", Tag::Int(0))]); + store.set_pending(pending.clone()).unwrap(); + assert!(store.set_pending(Tag::String("invalid".into())).is_err()); + assert_eq!(store.active(active), Some(&"active")); + assert_eq!(store.pending(BlockPos::new(1, 64, 0)), Some(&pending)); +} + +#[test] +fn failed_active_serialization_never_falls_back_to_stale_pending_data() { + let p = BlockPos::new(-1, 64, -1); + let mut store = ProtoBlockEntities::new(ChunkPos::new(-1, -1)); + store + .set_pending(Tag::compound([ + ("x", Tag::Int(15)), + ("y", Tag::Int(64)), + ("z", Tag::Int(15)), + ])) + .unwrap(); + store.set_active(p, 42); + assert!(store.pending(p).is_none()); + let result = store.for_saving(p, |_| Err::("serialization failed")); + assert_eq!(result, Err("serialization failed")); + assert_eq!(store.remove(p), Some(42)); + assert_eq!( + store.for_saving(p, |_| Err::("must not run")), + Ok(None) + ); +} + +#[test] +fn pending_save_snapshot_is_independent_and_mutating_coordinates_keeps_the_key() { + let mut store = ProtoBlockEntities::<()>::new(ChunkPos::new(0, 0)); + let p = BlockPos::new(0, 0, 0); + store + .set_pending(Tag::compound([("payload", Tag::Long(42))])) + .unwrap(); + let snapshot = store.for_saving(p, |_| Err::(())).unwrap().unwrap(); + let Some(Tag::Compound(tag)) = store.pending_mut(p) else { + panic!("pending") + }; + tag.insert("x".into(), Tag::Int(123)); + assert_eq!(snapshot.get("x"), None); + assert_eq!(store.pending(p).unwrap().get("x"), Some(&Tag::Int(123))); + assert!(store.pending(BlockPos::new(123, 0, 0)).is_none()); +} + +#[test] +fn floating_coordinates_floor_before_saturating_to_java_int() { + use horizon_world::block_entities::position_from_tag; + for (value, expected) in [ + (Tag::Float(0xcf000001), i32::MIN), + (Tag::Double(0xc1e0000000000001), i32::MIN), + (Tag::Float(f32::NEG_INFINITY.to_bits()), i32::MIN), + (Tag::Double(f64::INFINITY.to_bits()), i32::MAX), + (Tag::Double(f64::NAN.to_bits()), 0), + (Tag::Float((-1.5_f32).to_bits()), -2), + (Tag::Double((-1.5_f64).to_bits()), -2), + ] { + let tag = Tag::compound([("y", value)]); + assert_eq!( + position_from_tag(ChunkPos::new(0, 0), &tag).unwrap().y, + expected + ); + } +} diff --git a/docs/rust-parity.md b/docs/rust-parity.md index b46da0116..18678c356 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -813,3 +813,23 @@ Vanilla's actual public/private write-zone methods provide the reference. Worksp tests, all-target Clippy and both focused fixture tests pass. The owning world still supplies generation-step metadata and upgrading-world vertical restrictions; full WorldGenRegion effects remain pending. + +## Proto-chunk block-entity storage + +Rust now stores pending NBT and caller-owned active block-entity payloads by full +block position. Active insertion removes pending data, later pending insertion +cannot overwrite an active entry, and removal clears both maps. Saving uses the +active serializer when present and otherwise returns a pending snapshot. Changing +pending coordinate fields retains the existing map key. Coordinate resolution +matches NumericTag integer narrowing and floating-point flooring before saturating +conversion, then relocates mismatched X/Z into the owning chunk. + +The [block-entity storage comparison](../benchmarks/rust-block-entity-storage-2026-10-06/scoped-parity.json) +matches **78,251 lines per reference JAR** across **28,511 commands**, using actual +native ProtoChunks and chest entities. Cases cover replacement, removal, position +unions, save selection, missing/nonnumeric coordinates, infinities/NaNs, integer +extremes and positions that alias when packed. Four focused Rust tests and +all-target Clippy pass. Collection order is normalized; Rust exposes borrowed or +owned data instead of unrestricted Java aliases. Entity construction from NBT, +complete serializers, active entity behavior and resident chunk lifecycle +integration remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockEntityStorageOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockEntityStorageOracle.java new file mode 100644 index 000000000..50cab96f3 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockEntityStorageOracle.java @@ -0,0 +1,62 @@ +package dev.horizonlab.parity; +import java.io.*; +import java.nio.file.*; +import java.util.*; +import net.minecraft.core.*; +import net.minecraft.core.registries.*; +import net.minecraft.nbt.*; +import net.minecraft.resources.*; +import net.minecraft.world.level.*; +import net.minecraft.world.level.biome.*; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.entity.*; +import net.minecraft.world.level.chunk.*; +import net.minecraft.world.level.storage.loot.LootTable; + +/** Native proto-chunk entity storage and numeric position transport. */ +public final class VanillaBlockEntityStorageOracle { + private static final Comparator ORDER=Comparator.comparingInt(BlockPos::getX).thenComparingInt(BlockPos::getY).thenComparingInt(BlockPos::getZ); + private static PalettedContainerFactory factory; + private static String xyz(BlockPos p){return p.getX()+" "+p.getY()+" "+p.getZ();} + private static final class Input { + String[] words;int cursor=1;Input(String line){words=line.split(" ");} + int integer(){return Integer.parseInt(words[cursor++]);}long number(){return Long.parseLong(words[cursor++]);} + BlockPos pos(){return new BlockPos(integer(),integer(),integer());} + Tag tag(){String type=words[cursor++],value=words[cursor++];return switch(type){ + case "none"->null;case "byte"->ByteTag.valueOf(Byte.parseByte(value));case "short"->ShortTag.valueOf(Short.parseShort(value));case "int"->IntTag.valueOf(Integer.parseInt(value));case "long"->LongTag.valueOf(Long.parseLong(value)); + case "float"->FloatTag.valueOf(Float.intBitsToFloat(Integer.parseUnsignedInt(value,16)));case "double"->DoubleTag.valueOf(Double.longBitsToDouble(Long.parseUnsignedLong(value,16)));case "string"->StringTag.valueOf(value);default->throw new AssertionError(type); + };} + } + private static String atom(Tag tag){ + if(tag==null)return "none"; + if(tag instanceof FloatTag value)return "float:"+Integer.toUnsignedString(Float.floatToRawIntBits(value.floatValue()),16); + if(tag instanceof DoubleTag value)return "double:"+Long.toUnsignedString(Double.doubleToRawLongBits(value.doubleValue()),16); + if(tag instanceof NumericTag value)return tag.getId()+":"+value.longValue(); + return tag.getId()+":invalid"; + } + private static String pending(CompoundTag tag){return tag==null?"none":tag.getLongOr("mark",0)+" "+atom(tag.get("x"))+" "+atom(tag.get("y"))+" "+atom(tag.get("z"));} + public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); + Holder biome=Holder.Reference.createStandAlone(new HolderOwner(){},Biomes.PLAINS);var ids=new IdMapper>();ids.add(biome); + factory=new PalettedContainerFactory(Strategy.createForBlockStates(Block.BLOCK_STATE_REGISTRY),Blocks.AIR.defaultBlockState(),null,Strategy.createForBiomes(ids),biome,null); + var registries=RegistryAccess.fromRegistryOfRegistries(BuiltInRegistries.REGISTRY); + var loot=ResourceKey.create(Registries.LOOT_TABLE,Identifier.parse("horizon:storage_probe")); + ProtoChunk chunk=null; + try(var input=Files.newBufferedReader(Path.of(args[0]));var out=new PrintWriter(Files.newBufferedWriter(Path.of(args[1])))){ + String line;int index=0; + while((line=input.readLine())!=null){var in=new Input(line);String op=in.words[0];out.println("command "+index+++" "+op); + switch(op){ + case "reset"->chunk=new ProtoChunk(new ChunkPos(in.integer(),in.integer()),UpgradeData.EMPTY,LevelHeightAccessor.create(-64,384),factory,null); + case "pending","resolve"->{var tag=new CompoundTag();tag.putLong("mark",in.number());for(String axis:new String[]{"x","y","z"}){var value=in.tag();if(value!=null)tag.put(axis,value);}out.println("position "+xyz(BlockEntity.getPosFromTag(chunk.getPos(),tag)));if(op.equals("pending"))chunk.setBlockEntityNbt(tag);} + case "active"->{var p=in.pos();var entity=new ChestBlockEntity(p,Blocks.CHEST.defaultBlockState());entity.setLootTable(loot,in.number());chunk.setBlockEntity(entity);} + case "remove"->chunk.removeBlockEntity(in.pos()); + case "mutate"->{var p=in.pos();int x=in.integer();var tag=chunk.getBlockEntityNbt(p);if(tag!=null)tag.putInt("x",x);} + case "get","save"->{var p=in.pos();if(op.equals("get")){var active=chunk.getBlockEntity(p);out.println("active "+(active==null?"none":((ChestBlockEntity)active).getLootTableSeed()));out.println("pending "+pending(chunk.getBlockEntityNbt(p)));}else{var tag=chunk.getBlockEntityNbtForSaving(p,registries);if(chunk.getBlockEntity(p)!=null)out.println("saved active "+tag.getStringOr("id","")+" "+tag.getIntOr("x",0)+" "+tag.getIntOr("y",0)+" "+tag.getIntOr("z",0)+" "+tag.getLongOr("LootTableSeed",0));else out.println("saved pending "+pending(tag));}} + case "dump"->{var positions=new TreeSet(ORDER);positions.addAll(chunk.getBlockEntitiesPos());for(var p:positions){var entity=chunk.getBlockEntity(p);out.println("entry "+xyz(p)+" "+(entity==null?"none":((ChestBlockEntity)entity).getLootTableSeed())+" "+pending(chunk.getBlockEntityNbt(p)));}out.println("size "+positions.size()+" "+chunk.getBlockEntityNbts().size());} + default->throw new AssertionError(op); + } + if(in.cursor!=in.words.length)throw new AssertionError("extra input"); + } + } + } +} diff --git a/tools/test_block_entity_storage_parity.py b/tools/test_block_entity_storage_parity.py new file mode 100644 index 000000000..37da0f7f4 --- /dev/null +++ b/tools/test_block_entity_storage_parity.py @@ -0,0 +1,95 @@ +#!/usr/bin/env python3 +"""Compare native proto-chunk block-entity storage and NBT coordinate coercion.""" +import argparse +from collections import Counter +import json +import os +from pathlib import Path +import platform +import random +import subprocess +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab, test_rust_parity as base + + +def corpus(): + atoms=['none 0','string invalid'] + for kind,values in [('byte',[-128,-1,0,1,127]),('short',[-32768,-1,0,1,32767]),('int',[-2147483648,-17,-16,-1,0,1,15,16,2147483647]),('long',[-9223372036854775808,-4294967297,-2147483649,-1,0,2147483648,4294967297,9223372036854775807])]: + atoms += [f'{kind} {v}' for v in values] + atoms += ['float '+bits for bits in ['00000000','80000000','00000001','80000001','3fc00000','bfc00000','4f000000','cf000000','cf000001','7f800000','ff800000','7fc00000','7f800001']] + atoms += ['double '+bits for bits in ['0000000000000000','8000000000000000','0000000000000001','8000000000000001','3ff8000000000000','bff8000000000000','41e0000000000000','c1e0000000000000','c1e0000000000001','7ff0000000000000','fff0000000000000','7ff8000000000000','7ff0000000000001']] + for cx,cz in [(0,0),(-1,-1),(1,-2),(-134217728,134217727),(-2147483648,2147483647)]: + yield f'reset {cx} {cz}' + for axis in range(3): + for i,atom in enumerate(atoms): + xyz=['int -1','int 64','int 31'];xyz[axis]=atom + yield 'resolve 0 '+' '.join(xyz) + yield f'pending {i} '+' '.join(xyz) + yield 'dump' + for marker in [-9223372036854775808,-1,0,1,9223372036854775807]: + yield 'reset -1 -1' + yield f'pending {marker} int 15 int 64 int 15' + yield 'get -1 64 -1';yield 'save -1 64 -1' + yield 'mutate -1 64 -1 2147483647' + yield 'get -1 64 -1';yield 'save -1 64 -1' + yield f'active -1 64 -1 {marker}' + yield 'pending 99 int 15 int 64 int 15' + yield 'get -1 64 -1';yield 'save -1 64 -1';yield 'dump' + yield 'remove -1 64 -1';yield 'get -1 64 -1';yield 'save -1 64 -1' + rng=random.Random(0x424c4f434b454e54) + for trial in range(12): + cx,cz=trial%3-1,trial%5-2 + yield f'reset {cx} {cz}' + positions=[(cx*16+x,y,cz*16+z) for x in [0,1,15] for y in [-2147483648,-64,0,64,2147483647] for z in [0,1,15]] + positions += [(2147483647,-2147483648,-2147483648),(0,4096,0),(67108864,4096,-67108864)] + for _ in range(500): + p=rng.choice(positions);xyz=' '.join(map(str,p));op=rng.randrange(7) + if op<2:yield f'pending {rng.randrange(-2**63,2**63)} int {p[0]} int {p[1]} int {p[2]}' + elif op==2:yield f'active {xyz} {rng.randrange(-2**63,2**63)}' + elif op==3:yield f'remove {xyz}' + elif op==4:yield f'mutate {xyz} {rng.randrange(-2**31,2**31)}' + elif op==5:yield f'get {xyz}' + else:yield f'save {xyz}' + if rng.randrange(8)==0:yield 'dump' + yield 'dump' + yield 'reset 0 0' + for _ in range(20000): + xyz=[rng.choice([f'float {rng.getrandbits(32):08x}',f'double {rng.getrandbits(64):016x}',rng.choice(atoms)]) for _ in range(3)] + yield 'resolve 0 '+' '.join(xyz) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-block-entity-storage-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockEntityStorageOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/block_entity_storage_fixture.rs'] + tested_sources=base.source_hashes(sources) + commands=list(corpus());inputs=build/'inputs.txt';inputs.write_text('\n'.join(commands)+'\n') + tested_fixtures=base.source_hashes([inputs]);classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w') as log:subprocess.run(list(map(str,command)),cwd=lab.ROOT,check=True,timeout=3600,stdout=log,stderr=subprocess.STDOUT) + dependencies=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependencies,'-d',classes,oracle],'compile-java') + run(['cargo','build','--release','-p','horizon-world','--example','block_entity_storage_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('block_entity_storage_fixture.exe' if os.name=='nt' else 'block_entity_storage_fixture') + run([binary,inputs,build/'rust.txt'],'rust') + references=[] + for side,jar in jars.items(): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jar),dependencies]),'dev.horizonlab.parity.VanillaBlockEntityStorageOracle',inputs,build/(side+'.txt')],side) + matched=base.compare(build/(side+'.txt'),build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(build/(side+'.txt'),'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} block-entity storage lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged([inputs],tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(), + 'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(), + 'commands':dict(Counter(c.split()[0] for c in commands)),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references, + 'scope':'Native BlockEntity.getPosFromTag and actual ProtoChunk pending/active insertion, lookup, removal, position union and pending-save fallback. NumericTag coordinate reads cover integer narrowing, float/double floor overflow, infinities/NaNs, missing/nonnumeric fields, wrong-chunk relocation and wrapped chunk coordinates. Active entries replace pending data; later pending records cannot overwrite active entries. In-place pending coordinate mutation retains the original map key. Native chest entities carry loot seeds for active identity and basic saving-metadata comparisons; Rust supplies caller-owned payload serialization. Iteration order is normalized, and pending reads are borrowed/owned values rather than unrestricted Java aliases. Entity creation from NBT, complete entity serializers, active behavior and integration with chunk lifecycle remain pending.'} + lab.write_json(report_path,report);print(f'Scoped block-entity storage parity passed: {report_path}') + +if __name__=='__main__':main() From b1505adc5494a83756cdee5ad470973748978324 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 15:28:26 +0200 Subject: [PATCH 038/253] Enforce generation write heights during below-zero upgrades --- .../scoped-parity.json | 216 ++++++++++++++++++ .../examples/feature_region_fixture.rs | 53 ++++- .../src/worldgen/feature_region.rs | 15 +- .../horizon-world/src/worldgen/write_zone.rs | 23 ++ crates/horizon-world/tests/feature_region.rs | 47 ++++ docs/rust-parity.md | 18 ++ .../parity/VanillaFeatureRegionOracle.java | 22 ++ tests/test_feature_region_parity.py | 1 + tools/test_feature_region_parity.py | 15 +- 9 files changed, 402 insertions(+), 8 deletions(-) create mode 100644 benchmarks/rust-feature-region-upgrade-height-2026-10-06/scoped-parity.json diff --git a/benchmarks/rust-feature-region-upgrade-height-2026-10-06/scoped-parity.json b/benchmarks/rust-feature-region-upgrade-height-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..df95798df --- /dev/null +++ b/benchmarks/rust-feature-region-upgrade-height-2026-10-06/scoped-parity.json @@ -0,0 +1,216 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "block_states": 35723, + "direct_state_probes": 35723, + "write_zone_cases": 20125, + "upgrade_height_cases": 10098, + "block_tag_files": 300, + "fixtures": 192, + "worldgen_random_modes": [ + false, + true + ], + "resident_chunks_per_fixture": 9, + "requested_placements": 3456, + "direct_tick_requests": 14784, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureRegionOracle.java": "4ee4d485771cfaf8313aa57032ca38727d8e7c97a109a24319bfc4f63d599a23", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", + "tools/test_feature_region_parity.py": "16c308731788d69676669afc9289a235b44f3c5e1c62b04deba799c4a6d1f745", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "4e556a5896b893fbb73bf2e2b8e70601a8374f58b9f4f5f3730e99916a846e3a", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "1eae82604d2b3377fd35aaa3a914a67e5af28f93923815a49e895b4d437433cd", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "18d51343c00ad3a551d02f6ddfa37d1be23d481e1861ce6299d0a66991bc7074", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "b8fb9fb80a66a851d916f07f15df1a40b6cc95b49e71aaec4d4b4107f13d9f9f", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/feature_region_fixture.rs": "e45a2b5ddb147b8783fe3ba71ea533d50c86609b03e610ad25b4a215ca1ef371" + }, + "fixtures_sha256": { + ".local/rust-feature-region-parity/heights.json": "5a9a24cd8dcd081955f856df741a8e0eb34c84649d636947f474139d3ed30698", + ".local/rust-feature-region-parity/zones.json": "1864a9cdc17816c12fc5e92cd6abd32e45d67615075c52e928872e041d84244c", + ".local/rust-feature-region-parity/inputs.txt": "597236d7f85cfad764729c389bd71a1063d40587903ba3bd3ef86e4e3f9a481f", + ".local/rust-feature-region-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0", + ".local/rust-feature-region-parity/fluid-tags.json": "f1e5eb6d22ea7effbb118a2282709cfdeef1bfae4516b775a55ad7a4df29d7d0", + ".local/rust-feature-region-parity/facts-client.json": "1d24883ee807b0b71473f0bbf8ed548ddaf712148caeb3fcc7aa13ab973a97b0", + ".local/rust-feature-region-parity/facts-server.json": "1d24883ee807b0b71473f0bbf8ed548ddaf712148caeb3fcc7aa13ab973a97b0" + }, + "rust_output_sha256": "91ae8c67dae0e0de2d6ada1c36f154a5df73feb07e4bc3af8a09d2062a04e859", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "91ae8c67dae0e0de2d6ada1c36f154a5df73feb07e4bc3af8a09d2062a04e859", + "matched_output_lines": 29247433 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "91ae8c67dae0e0de2d6ada1c36f154a5df73feb07e4bc3af8a09d2062a04e859", + "matched_output_lines": 29247433 + } + ], + "scope": "Native FeaturePlacer and three basic block-writing features, a composed sequence of four configured fill layers, single-block replacements, scattered ore and water springs share a world proxy backed by nine actual ProtoChunks. Configured water, horizontal logs, air, out-of-height fills and ore/replacement rules test graph-to-region binding. Initial two-layer stone/dirt terrain, both pre-light heightmap groups, count/square/heightmap/layered modifier chains, repeated placements, direct and WorldgenRandom-wrapped random streams, missing-neighbor errors, rejected writes and injected partial failures are compared. Final complete raw sections, heightmap presence and packed words are compared alongside ordered feature writes, update flags, explicit height queries and subsequent random draws. Rust uses resident registry-backed chunks, lazy heightmap priming and a caller-supplied write callback; imported air/fluid facts and bundled block tags bind independently across authenticated JARs. The proxy supplies storage mutation and actual native default scheduleTick/createTick methods routed through WorldGenTickAccess into each ProtoChunk. Separate block/fluid queues, first-request deduplication, nondefault-state block identity, shared tick-order advancement on duplicates and missing-chunk errors, out-of-height requests and wrapped clock values are compared, including saved queue order and priorities. Active and inactive End podiums additionally exercise native WorldGenRegion.destroyBlock through a subclass transport overriding only block reads and writes; air short-circuit, rejected replacements and write failures retain the generation-time semantics. All block states are also written into resident chunks, queried through feature access, cleared and queried again; contained fluid identity/amount/falling/source/full flags, water-tag membership and every bundled block tag plus an absent tag are compared. Negative coordinates, chunk edges, outside-height and absent chunks are covered. Block/fluid query bindings are an immutable registry-checked shared snapshot. The native horizontal write-zone predicate is compared separately across chunk/block coordinates, negative radii and wrapped subtraction/absolute-value extremes, and gates feature callbacks in selected fixtures. Actual WorldGenRegion.ensureCanWrite also checks the center proto-chunk before/after installing native below-zero retrogen data, with extreme and boundary heights; the generic height interval is independently compared against LevelHeightAccessor. Region feature callbacks and direct accepted/rejected write probes apply the upgrade height before mutation. Retrogen activation remains caller-owned. Actual WorldGenRegion construction, full retrogen replacement/masking and biome behavior, POIs, block entities, postprocessing execution, lighting, block/fluid tick execution, complete feature registries and complete world generation remain outside this comparison." +} diff --git a/crates/horizon-world/examples/feature_region_fixture.rs b/crates/horizon-world/examples/feature_region_fixture.rs index ca41de3da..470100b51 100644 --- a/crates/horizon-world/examples/feature_region_fixture.rs +++ b/crates/horizon-world/examples/feature_region_fixture.rs @@ -2,12 +2,12 @@ use horizon_core::random::{LegacyRandom, RandomSource, WorldgenRandom, Xoroshiro use horizon_world::worldgen::{ anchor::WorldGenerationContext, block_feature::FeatureBlockBindings, - feature::FeatureBlocks, + feature::{FeatureBlocks, FeatureWorld}, feature_graph::FeatureDefinition, feature_region::{RegionError, TerrainFeatureAccess, TerrainRegion}, placement::{FeaturePlacer, PlacementContext, PlacementModifier}, terrain::TerrainError, - write_zone::GenerationWriteZone, + write_zone::{GenerationWriteZone, UpgradeWriteHeight}, }; // Feature chains against a resident multi-chunk region. use horizon_core::position::ChunkPos; @@ -221,6 +221,9 @@ fn run( n(&zone[2]), )); } + if f["upgrading"].as_bool().unwrap() { + world = world.with_upgrade_height(UpgradeWriteHeight::BELOW_ZERO); + } placer.place_with_context( &modifiers, &mut world, @@ -247,6 +250,42 @@ fn run( } writeln!(out, "repeat {repeat}")?; } + for y in [i32::MIN, -65, -64, -63, -1, 0, 1, 319, 320, i32::MAX] { + for x in [0, 16] { + let result = { + let write = |region: &mut TerrainRegion<'_, Properties<'_>>, + p: [i32; 3], + state: BlockStateId, + flags: i32| + -> Result { + writeln!(out, "write {} {} {} {} {flags}", p[0], p[1], p[2], state.0) + .map_err(TerrainError::from)?; + let result = reject == 0; + if result { + region.set_block_worldgen(p, state)?; + } + writeln!(out, "written {result}").map_err(TerrainError::from)?; + Ok(result) + }; + let mut world = TerrainFeatureAccess::new(&mut region, write); + if let Some(zone) = f["write_zone"].as_array() { + world = world.with_write_zone(GenerationWriteZone::new( + ChunkPos::new(n(&zone[0]), n(&zone[1])), + n(&zone[2]), + )); + } + if f["upgrading"].as_bool().unwrap() { + world = world.with_upgrade_height(UpgradeWriteHeight::BELOW_ZERO); + } + world.set_block( + [x, y, 0], + registry.default_state("minecraft:stone").unwrap(), + 2, + )? + }; + writeln!(out, "heightwrite {x} {y} {result}")?; + } + } for command in f["tick_commands"].as_array().unwrap() { let kind = command[0].as_str().unwrap(); let id = n(&command[1]) as u32; @@ -450,6 +489,16 @@ fn main() -> Result<(), Box> { zone.contains_block(horizon_core::position::BlockPos::new(x, i32::MIN, z)) )?; } + let heights: Value = serde_json::from_str(&fs::read_to_string(dir.join("heights.json"))?)?; + for row in heights.as_array().unwrap() { + let y = n(&row[2]); + writeln!( + out, + "heightgate {} true {}", + UpgradeWriteHeight::new(n(&row[0]), n(&row[1])).contains(y), + UpgradeWriteHeight::BELOW_ZERO.contains(y) + )?; + } for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { fixture( &serde_json::from_str(line)?, diff --git a/crates/horizon-world/src/worldgen/feature_region.rs b/crates/horizon-world/src/worldgen/feature_region.rs index 3c7e38318..625473425 100644 --- a/crates/horizon-world/src/worldgen/feature_region.rs +++ b/crates/horizon-world/src/worldgen/feature_region.rs @@ -378,6 +378,7 @@ pub struct TerrainFeatureAccess<'a, 'r, B: TerrainBlockStates, F> { region: &'a mut TerrainRegion<'r, B>, write: F, write_zone: Option, + upgrade_height: Option, } impl<'a, 'r, B: TerrainBlockStates, F> TerrainFeatureAccess<'a, 'r, B, F> { pub fn new(region: &'a mut TerrainRegion<'r, B>, write: F) -> Self { @@ -385,14 +386,20 @@ impl<'a, 'r, B: TerrainBlockStates, F> TerrainFeatureAccess<'a, 'r, B, F> { region, write, write_zone: None, + upgrade_height: None, } } /// Apply the horizontal write radius before invoking mutation policy/effects. - /// Upgrading-world vertical restrictions remain the owning world's policy. pub fn with_write_zone(mut self, zone: super::write_zone::GenerationWriteZone) -> Self { self.write_zone = Some(zone); self } + /// Restrict writes to the upgrading center chunk's generation height. + /// The owning lifecycle supplies this only while an upgrade is active. + pub fn with_upgrade_height(mut self, height: super::write_zone::UpgradeWriteHeight) -> Self { + self.upgrade_height = Some(height); + self + } } impl<'r, B: TerrainBlockStates, F> TerrainFeatureAccess<'_, 'r, B, F> where @@ -409,6 +416,12 @@ where }) { return Ok(false); } + if self + .upgrade_height + .is_some_and(|height| !height.contains(position[1])) + { + return Ok(false); + } (self.write)(self.region, position, state, flags) } } diff --git a/crates/horizon-world/src/worldgen/write_zone.rs b/crates/horizon-world/src/worldgen/write_zone.rs index 50cf1393f..6f5075d77 100644 --- a/crates/horizon-world/src/worldgen/write_zone.rs +++ b/crates/horizon-world/src/worldgen/write_zone.rs @@ -20,3 +20,26 @@ impl GenerationWriteZone { self.contains_chunk(position.chunk()) } } + +/// The center chunk's generation height while an upgrade is active. Normal +/// generation has no vertical write-policy gate (storage bounds are separate). +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct UpgradeWriteHeight { + min_y: i32, + max_y: i32, +} +impl UpgradeWriteHeight { + pub const BELOW_ZERO: Self = Self { + min_y: -64, + max_y: -1, + }; + pub fn new(min_y: i32, height: i32) -> Self { + Self { + min_y, + max_y: min_y.wrapping_add(height).wrapping_sub(1), + } + } + pub fn contains(self, y: i32) -> bool { + y >= self.min_y && y <= self.max_y + } +} diff --git a/crates/horizon-world/tests/feature_region.rs b/crates/horizon-world/tests/feature_region.rs index 65c5e7343..c89627382 100644 --- a/crates/horizon-world/tests/feature_region.rs +++ b/crates/horizon-world/tests/feature_region.rs @@ -243,3 +243,50 @@ fn query_bindings_reject_foreign_registries_and_preserve_resolved_tag_snapshot() assert!(region.water_at([-1, 16, 0]).unwrap()); assert!(region.fluid_state([0, 0, 0]).is_err()); } + +#[test] +fn upgrade_height_rejects_mutations_before_callbacks_but_preserves_reads_and_ticks() { + use horizon_world::worldgen::write_zone::{GenerationWriteZone, UpgradeWriteHeight}; + use std::cell::Cell; + let registry = registry(); + let mut chunk = + TerrainChunk::new(ChunkPos::new(0, 0), -64, 128, ®istry, Properties).unwrap(); + let stone = registry.default_state("minecraft:stone").unwrap(); + chunk.set_block_worldgen(0, 0, 0, stone).unwrap(); + let mut region = + TerrainRegion::new(vec![chunk], WorldGenerationContext::new(-64, 128, 0)).unwrap(); + let calls = Cell::new(0); + { + let write = |region: &mut TerrainRegion<'_, Properties>, p, state, _| { + calls.set(calls.get() + 1); + region.set_block_worldgen(p, state)?; + Ok(true) + }; + let mut world = TerrainFeatureAccess::new(&mut region, write) + .with_write_zone(GenerationWriteZone::new(ChunkPos::new(0, 0), 0)) + .with_upgrade_height(UpgradeWriteHeight::BELOW_ZERO); + assert!(!world.set_block([0, 0, 0], stone, 2).unwrap()); + assert!(!world.destroy_block_without_entity([0, 0, 0], true).unwrap()); + assert!(!world.set_block([0, -65, 0], stone, 2).unwrap()); + assert!(!world.set_block([16, -1, 0], stone, 2).unwrap()); + assert_eq!(calls.get(), 0); + assert_eq!(world.block_state([0, 0, 0]).unwrap(), stone); + world.schedule_block_tick([0, 0, 0], stone, 1).unwrap(); + assert!(world.set_block([0, -1, 0], stone, 2).unwrap()); + assert!( + world + .destroy_block_without_entity([0, -1, 0], true) + .unwrap() + ); + assert_eq!(calls.get(), 2); + } + assert_eq!(region.block([0, 0, 0]).unwrap(), stone); + assert_eq!(region.chunk(0, 0).unwrap().block_ticks().count(), 1); + let write = |_: &mut TerrainRegion<'_, Properties>, _, _, _| { + calls.set(calls.get() + 1); + Ok(true) + }; + let mut world = TerrainFeatureAccess::new(&mut region, write); + assert!(world.set_block([0, i32::MAX, 0], stone, 2).unwrap()); + assert_eq!(calls.get(), 3); +} diff --git a/docs/rust-parity.md b/docs/rust-parity.md index 18678c356..8aad0162a 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -833,3 +833,21 @@ all-target Clippy pass. Collection order is normalized; Rust exposes borrowed or owned data instead of unrestricted Java aliases. Entity construction from NBT, complete serializers, active entity behavior and resident chunk lifecycle integration remain pending. + +## Upgrading-world write heights + +Feature access can now enforce the upgrading center chunk's generation height +before invoking its write callback. Below-zero proto-chunk upgrades use Y = -64 +through -1, inclusive. Ordinary generation has no vertical policy gate; storage +bounds remain separate. Reads and tick scheduling keep their existing behavior, +and generation-time destruction shares the write guard. + +The [upgrade-height comparison](../benchmarks/rust-feature-region-upgrade-height-2026-10-06/scoped-parity.json) +matches **29,247,433 lines per reference JAR**, including **10,098 height cases**, +20,125 horizontal zone cases and all 192 resident fixtures. The reference calls +actual `WorldGenRegion.ensureCanWrite` with a native ProtoChunk before and after +installing below-zero upgrade data. Direct write probes cover boundary and extreme +heights, ordinary/upgrading modes and horizontal rejection. Five focused Rust +region tests, all-target Clippy and both Python fixture tests pass. Upgrade +activation, target-status cleanup, old-bedrock replacement, hole masking, biome +retention and the complete generation lifecycle remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureRegionOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureRegionOracle.java index 1ee306b5b..0fc999bd1 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureRegionOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureRegionOracle.java @@ -42,6 +42,10 @@ public final class VanillaFeatureRegionOracle { String[] names={"centerChunkX","centerChunkZ","writeRadius"};int[] values={x,z,radius}; for(int i=0;i chunks,int x,int z) { var chunk=chunks.get(new ChunkPos(x>>4,z>>4));if(chunk==null)throw new IllegalArgumentException("missing region chunk");return chunk; } @@ -96,6 +100,16 @@ public final class VanillaFeatureRegionOracle { var row=value.getAsJsonArray();setWriteZone(zoneWorld,row.get(0).getAsInt(),row.get(1).getAsInt(),row.get(2).getAsInt()); int x=row.get(3).getAsInt(),z=row.get(4).getAsInt();out.println("zone "+chunkZone.invoke(zoneWorld,x,z)+" "+zoneWorld.isWithinWriteZone(new BlockPos(x,Integer.MIN_VALUE,z))); } + var heightChunk=new ProtoChunk(new ChunkPos(0,0),UpgradeData.EMPTY,LevelHeightAccessor.create(-64,384),factory,null); + center(zoneWorld,heightChunk);setWriteZone(zoneWorld,0,0,0); + var upgrade=retrogen(); + for(var value:JsonParser.parseString(Files.readString(dir.resolve("heights.json"))).getAsJsonArray()) { + var row=value.getAsJsonArray();int y=row.get(2).getAsInt();var p=new BlockPos(0,y,0); + boolean interval=LevelHeightAccessor.create(row.get(0).getAsInt(),row.get(1).getAsInt()).isInsideBuildHeight(y); + heightChunk.setBelowZeroRetrogen(null);boolean normal=zoneWorld.ensureCanWrite(p); + heightChunk.setBelowZeroRetrogen(upgrade);boolean upgrading=zoneWorld.ensureCanWrite(p); + out.println("heightgate "+interval+" "+normal+" "+upgrading); + } for(var line:Files.readAllLines(dir.resolve("inputs.txt"))) { var f=JsonParser.parseString(line).getAsJsonObject();long seed=f.get("seed").getAsLong(); var features=new ArrayList(); @@ -139,6 +153,7 @@ public final class VanillaFeatureRegionOracle { case "setBlock"->{ var p=(BlockPos)values[0];var state=(BlockState)values[1];int flags=(Integer)values[2]; if(!f.get("write_zone").isJsonNull()&&!destroyer[0].isWithinWriteZone(p))yield false; + if(!destroyer[0].ensureCanWrite(p))yield false; out.println("write "+p.getX()+" "+p.getY()+" "+p.getZ()+" "+Block.getId(state)+" "+flags); int call=calls[0]++;if(call==fail)throw new IllegalArgumentException("injected write failure"); boolean result=reject==0||call%reject!=0; @@ -148,6 +163,9 @@ public final class VanillaFeatureRegionOracle { default->throw new AssertionError("unexpected world method "+method); }); destroyer[0]=destruction(world); + var centerChunk=chunks.get(new ChunkPos(0,0)); + if(f.get("upgrading").getAsBoolean())centerChunk.setBelowZeroRetrogen(upgrade); + center(destroyer[0],centerChunk);setWriteZone(destroyer[0],0,0,Integer.MAX_VALUE); if(!f.get("write_zone").isJsonNull()){var zone=f.getAsJsonArray("write_zone");setWriteZone(destroyer[0],zone.get(0).getAsInt(),zone.get(1).getAsInt(),zone.get(2).getAsInt());} var modifiers=new ArrayList();for(var value:f.getAsJsonArray("placement"))modifiers.add(PlacementModifier.CODEC.parse(JsonOps.INSTANCE,value).getOrThrow()); var placer=new FeaturePlacer(world,generator); @@ -160,6 +178,10 @@ public final class VanillaFeatureRegionOracle { } out.println("repeat "+repeat); } + for(int y:new int[]{Integer.MIN_VALUE,-65,-64,-63,-1,0,1,319,320,Integer.MAX_VALUE})for(int x:new int[]{0,16}) { + calls[0]=0;boolean result=world.setBlock(new BlockPos(x,y,0),Blocks.STONE.defaultBlockState(),2); + out.println("heightwrite "+x+" "+y+" "+result); + } for(var raw:f.getAsJsonArray("tick_commands")){ var command=raw.getAsJsonArray();String kind=command.get(0).getAsString();int id=command.get(1).getAsInt();var xyz=command.get(2).getAsJsonArray();var p=new BlockPos(xyz.get(0).getAsInt(),xyz.get(1).getAsInt(),xyz.get(2).getAsInt());int delay=command.get(3).getAsInt(); out.println("tickrequest "+kind+" "+id); diff --git a/tests/test_feature_region_parity.py b/tests/test_feature_region_parity.py index 1e86c84d2..aae14dfd5 100644 --- a/tests/test_feature_region_parity.py +++ b/tests/test_feature_region_parity.py @@ -15,6 +15,7 @@ class FeatureRegionCorpusTests(unittest.TestCase): self.assertTrue(all(any(v['type'] == 'spring_feature' for v in f['features']) for f in fixtures)) self.assertTrue(all([v['active'] for v in f['features'] if v['type'] == 'end_podium'] == [False, True] for f in fixtures)) self.assertEqual({None if f['write_zone'] is None else tuple(f['write_zone']) for f in fixtures}, {None, (0, 0, 0), (1, 1, 0), (-1, -1, 1), (0, 0, -1)}) + self.assertEqual({f['upgrading'] for f in fixtures}, {False, True}) self.assertEqual({f['worldgen'] for f in fixtures}, {False, True}) self.assertEqual({f['legacy'] for f in fixtures}, {False, True}) self.assertEqual({f['stage'] for f in fixtures}, {'empty', 'terrain'}) diff --git a/tools/test_feature_region_parity.py b/tools/test_feature_region_parity.py index ae62f3227..2713e9cb6 100644 --- a/tools/test_feature_region_parity.py +++ b/tools/test_feature_region_parity.py @@ -49,7 +49,7 @@ def corpus(facts): for reject in [0,3]: for placement in chains: for worldgen in [False,True]: - yield {'write_zone':[None,[0,0,0],[1,1,0],[-1,-1,1],[0,0,-1]][fixture_index%5],'probe_states':list(range(fixture_index,len(facts['states']),192)),'worldgen':worldgen,'legacy':legacy,'seed':seed,'stage':stage,'fail':fail,'reject':reject,'placement':placement,'features':features,'tick_commands':ticks,'game_time':9223372036854775807 if worldgen else -9223372036854775808,'tick_order':9223372036854775803 if legacy else -9223372036854775808} + yield {'upgrading':fixture_index%3==0,'write_zone':[None,[0,0,0],[1,1,0],[-1,-1,1],[0,0,-1]][fixture_index%5],'probe_states':list(range(fixture_index,len(facts['states']),192)),'worldgen':worldgen,'legacy':legacy,'seed':seed,'stage':stage,'fail':fail,'reject':reject,'placement':placement,'features':features,'tick_commands':ticks,'game_time':9223372036854775807 if worldgen else -9223372036854775808,'tick_order':9223372036854775803 if legacy else -9223372036854775808} fixture_index+=1 @@ -79,7 +79,7 @@ def main(): tested_sources=base.source_hashes(sources) classes=build/"classes";classes.mkdir(exist_ok=True) def run(command,name): - with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + with (build/(name+".log")).open("w",encoding="utf-8") as log:subprocess.run(list(map(str,command)),cwd=lab.ROOT,check=True,timeout=3600,stdout=log,stderr=subprocess.STDOUT) dependency_path=os.pathsep.join(map(str,libraries)) run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle,helper,placement_helper],"compile-java") def java(side,mode,path): @@ -100,7 +100,12 @@ def main(): rng=random.Random(0x574f524c445a4f4e45) for _ in range(10000):zones.append([rng.randrange(-2**31,2**31) for _ in range(5)]) zone_inputs=build/'zones.json';zone_inputs.write_text(json.dumps(zones,separators=(',',':'))) - fixture_paths=[zone_inputs,inputs,build/"tags.json",build/"fluid-tags.json",build/"facts-client.json",build/"facts-server.json"] + heights=[] + for min_y,height in [(-64,64),(-64,384),(0,256),(2147483647,1),(-2147483648,0),(0,-1),(-2147483648,-1)]: + for y in [-2147483648,-2147483647,-65,-64,-63,-1,0,1,255,256,319,320,2147483646,2147483647]:heights.append([min_y,height,y]) + for _ in range(10000):heights.append([rng.randrange(-2**31,2**31) for _ in range(3)]) + height_inputs=build/'heights.json';height_inputs.write_text(json.dumps(heights,separators=(',',':'))) + fixture_paths=[height_inputs,zone_inputs,inputs,build/"tags.json",build/"fluid-tags.json",build/"facts-client.json",build/"facts-server.json"] tested_fixtures=base.source_hashes(fixture_paths) run(["cargo","build","--release","-p","horizon-world","--example","feature_region_fixture"],"compile-rust") metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) @@ -115,9 +120,9 @@ def main(): base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) report={"schema":1,"minecraft":lock["minecraft"]["version"],"manifest_sha1":lock["minecraft"]["manifest_sha1"],"platform":platform.platform(), "java":subprocess.check_output(["java","--version"],text=True).splitlines()[0],"rustc":subprocess.check_output(["rustc","--version"],text=True).strip(), - "block_states":len(facts["states"]),"direct_state_probes":sum(len(f["probe_states"]) for f in fixtures),"write_zone_cases":len(zones),"block_tag_files":len(tags),"fixtures":len(fixtures),"worldgen_random_modes":[False,True],"resident_chunks_per_fixture":9,"requested_placements":sum(len(f["features"])*2 for f in fixtures),"direct_tick_requests":sum(len(f["tick_commands"]) for f in fixtures), + "block_states":len(facts["states"]),"direct_state_probes":sum(len(f["probe_states"]) for f in fixtures),"write_zone_cases":len(zones),"upgrade_height_cases":len(heights),"block_tag_files":len(tags),"fixtures":len(fixtures),"worldgen_random_modes":[False,True],"resident_chunks_per_fixture":9,"requested_placements":sum(len(f["features"])*2 for f in fixtures),"direct_tick_requests":sum(len(f["tick_commands"]) for f in fixtures), "sources_sha256":tested_sources,"fixtures_sha256":tested_fixtures,"rust_output_sha256":lab.digest(build/"rust.txt","sha256"),"references":references, - "scope":"Native FeaturePlacer and three basic block-writing features, a composed sequence of four configured fill layers, single-block replacements, scattered ore and water springs share a world proxy backed by nine actual ProtoChunks. Configured water, horizontal logs, air, out-of-height fills and ore/replacement rules test graph-to-region binding. Initial two-layer stone/dirt terrain, both pre-light heightmap groups, count/square/heightmap/layered modifier chains, repeated placements, direct and WorldgenRandom-wrapped random streams, missing-neighbor errors, rejected writes and injected partial failures are compared. Final complete raw sections, heightmap presence and packed words are compared alongside ordered feature writes, update flags, explicit height queries and subsequent random draws. Rust uses resident registry-backed chunks, lazy heightmap priming and a caller-supplied write callback; imported air/fluid facts and bundled block tags bind independently across authenticated JARs. The proxy supplies storage mutation and actual native default scheduleTick/createTick methods routed through WorldGenTickAccess into each ProtoChunk. Separate block/fluid queues, first-request deduplication, nondefault-state block identity, shared tick-order advancement on duplicates and missing-chunk errors, out-of-height requests and wrapped clock values are compared, including saved queue order and priorities. Active and inactive End podiums additionally exercise native WorldGenRegion.destroyBlock through a subclass transport overriding only block reads and writes; air short-circuit, rejected replacements and write failures retain the generation-time semantics. All block states are also written into resident chunks, queried through feature access, cleared and queried again; contained fluid identity/amount/falling/source/full flags, water-tag membership and every bundled block tag plus an absent tag are compared. Negative coordinates, chunk edges, outside-height and absent chunks are covered. Block/fluid query bindings are an immutable registry-checked shared snapshot. The native horizontal write-zone predicate is compared separately across chunk/block coordinates, negative radii and wrapped subtraction/absolute-value extremes, and gates feature callbacks in selected fixtures. Actual WorldGenRegion construction, upgrading-world vertical write restrictions, POIs, block entities, postprocessing execution, lighting, block/fluid tick execution, complete feature registries and complete world generation remain outside this comparison."} + "scope":"Native FeaturePlacer and three basic block-writing features, a composed sequence of four configured fill layers, single-block replacements, scattered ore and water springs share a world proxy backed by nine actual ProtoChunks. Configured water, horizontal logs, air, out-of-height fills and ore/replacement rules test graph-to-region binding. Initial two-layer stone/dirt terrain, both pre-light heightmap groups, count/square/heightmap/layered modifier chains, repeated placements, direct and WorldgenRandom-wrapped random streams, missing-neighbor errors, rejected writes and injected partial failures are compared. Final complete raw sections, heightmap presence and packed words are compared alongside ordered feature writes, update flags, explicit height queries and subsequent random draws. Rust uses resident registry-backed chunks, lazy heightmap priming and a caller-supplied write callback; imported air/fluid facts and bundled block tags bind independently across authenticated JARs. The proxy supplies storage mutation and actual native default scheduleTick/createTick methods routed through WorldGenTickAccess into each ProtoChunk. Separate block/fluid queues, first-request deduplication, nondefault-state block identity, shared tick-order advancement on duplicates and missing-chunk errors, out-of-height requests and wrapped clock values are compared, including saved queue order and priorities. Active and inactive End podiums additionally exercise native WorldGenRegion.destroyBlock through a subclass transport overriding only block reads and writes; air short-circuit, rejected replacements and write failures retain the generation-time semantics. All block states are also written into resident chunks, queried through feature access, cleared and queried again; contained fluid identity/amount/falling/source/full flags, water-tag membership and every bundled block tag plus an absent tag are compared. Negative coordinates, chunk edges, outside-height and absent chunks are covered. Block/fluid query bindings are an immutable registry-checked shared snapshot. The native horizontal write-zone predicate is compared separately across chunk/block coordinates, negative radii and wrapped subtraction/absolute-value extremes, and gates feature callbacks in selected fixtures. Actual WorldGenRegion.ensureCanWrite also checks the center proto-chunk before/after installing native below-zero retrogen data, with extreme and boundary heights; the generic height interval is independently compared against LevelHeightAccessor. Region feature callbacks and direct accepted/rejected write probes apply the upgrade height before mutation. Retrogen activation remains caller-owned. Actual WorldGenRegion construction, full retrogen replacement/masking and biome behavior, POIs, block entities, postprocessing execution, lighting, block/fluid tick execution, complete feature registries and complete world generation remain outside this comparison."} lab.write_json(report_path,report);print(f"Scoped feature-region parity passed: {report_path}") From eed1879fae0c59acddcafc3128231501bbe021c2 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 15:40:26 +0200 Subject: [PATCH 039/253] Model pinned chunk statuses and reuse their pre-light metadata --- .github/workflows/ci.yml | 4 + .../scoped-parity.json | 198 ++++++++++++++++++ .../examples/chunk_status_fixture.rs | 69 ++++++ crates/horizon-world/src/chunk_status.rs | 100 +++++++++ crates/horizon-world/src/lib.rs | 1 + crates/horizon-world/src/worldgen/terrain.rs | 23 +- docs/rust-parity.md | 16 ++ .../parity/VanillaChunkStatusOracle.java | 36 ++++ tools/test_chunk_status_parity.py | 62 ++++++ 9 files changed, 491 insertions(+), 18 deletions(-) create mode 100644 benchmarks/rust-chunk-status-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-world/examples/chunk_status_fixture.rs create mode 100644 crates/horizon-world/src/chunk_status.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaChunkStatusOracle.java create mode 100644 tools/test_chunk_status_parity.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4ba2c4657..021cb2def 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -187,6 +187,10 @@ jobs: env: RUSTUP_TOOLCHAIN: stable run: python tools/test_generation_tick_parity.py + - name: Compare chunk-status metadata, ordering and codecs + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_chunk_status_parity.py - name: Compare proto-chunk block-entity storage and coordinates env: RUSTUP_TOOLCHAIN: stable diff --git a/benchmarks/rust-chunk-status-2026-10-06/scoped-parity.json b/benchmarks/rust-chunk-status-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..56cf1e66d --- /dev/null +++ b/benchmarks/rust-chunk-status-2026-10-06/scoped-parity.json @@ -0,0 +1,198 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "statuses": 10, + "ordered_pairs": 100, + "codec_cases": 2065, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaChunkStatusOracle.java": "50b287c20853c398257cfe32d59d30bdae602eb815a2b909dfb65dc776ccc835", + "tools/test_chunk_status_parity.py": "635d424d4d8d4feda9f43b4bb1d42bb2718d234281376ef57eabc7dd2ab43866", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "cee5dbc01ee20ed1ae7cd29315af9916a702e078815dd0e9bf8da83cba3aa70c", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "1eae82604d2b3377fd35aaa3a914a67e5af28f93923815a49e895b4d437433cd", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "18d51343c00ad3a551d02f6ddfa37d1be23d481e1861ce6299d0a66991bc7074", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "ee5a4efcd63536fce4fc3638bb014d4f0943c1126c6966d9d379484d4b8efec1", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/chunk_status_fixture.rs": "60e933cb1f237c10de36af19474e430271e0d44370ffe137cef24bf79fb2bb73" + }, + "fixtures_sha256": { + ".local/rust-chunk-status-parity/inputs.txt": "45bd4c854962b045a617bcc453ef847d16d33629104f227543a35b1c2c628c47" + }, + "rust_output_sha256": "704de8d98e7c7d93b6bd02dd87be27cfbeb6960acfa3d7043b69ce3a1a9d385c", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "704de8d98e7c7d93b6bd02dd87be27cfbeb6960acfa3d7043b69ce3a1a9d385c", + "matched_output_lines": 4232 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "704de8d98e7c7d93b6bd02dd87be27cfbeb6960acfa3d7043b69ce3a1a9d385c", + "matched_output_lines": 4232 + } + ], + "scope": "Actual pinned ChunkStatus status list, ordering and maximum for all pairs, parent identity, chunk kind, selected heightmaps, direct byName fallback and NBT codec acceptance/encoding. All registered names cover qualified, unqualified and empty-namespace forms; unknown, legacy, malformed, random and nonstring inputs are checked. Codec error text is normalized rather than compared. Rust pre-light chunk metadata uses these same status definitions; this does not execute generation steps, implement lighting, or establish full chunk lifecycle parity." +} diff --git a/crates/horizon-world/examples/chunk_status_fixture.rs b/crates/horizon-world/examples/chunk_status_fixture.rs new file mode 100644 index 000000000..92c5fe7bd --- /dev/null +++ b/crates/horizon-world/examples/chunk_status_fixture.rs @@ -0,0 +1,69 @@ +use horizon_world::{chunk_status::ChunkStatus, nbt::Tag, worldgen::terrain::PreLightChunkStage}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, +}; +fn main() -> Result<(), Box> { + let args: Vec<_> = std::env::args().collect(); + let mut out = io::BufWriter::new(fs::File::create(&args[2])?); + writeln!( + out, + "structure_distance {}", + ChunkStatus::MAX_STRUCTURE_DISTANCE + )?; + for status in ChunkStatus::ALL { + let (name, maps) = if let Some(stage) = PreLightChunkStage::ALL.get(status.index()) { + (format!("minecraft:{}", stage.name()), stage.heightmaps()) + } else { + (status.name().to_owned(), status.heightmaps()) + }; + writeln!( + out, + "status {} {} {} {} {}", + status.index(), + name, + status.parent().name(), + status.is_level_chunk(), + maps.iter() + .map(|kind| kind.name()) + .collect::>() + .join(",") + )?; + for other in ChunkStatus::ALL { + writeln!( + out, + "order {} {} {} {} {}", + status >= other, + status > other, + status <= other, + status < other, + status.max(other).name() + )?; + } + } + for line in fs::read_to_string(&args[1])?.lines() { + let row: Value = serde_json::from_str(line)?; + let tag = match row[0].as_str().unwrap() { + "string" => Tag::String(row[1].as_str().unwrap().into()), + "int" => Tag::Int(row[1].as_i64().unwrap() as i32), + "list" => Tag::List(Vec::new()), + "compound" => Tag::Compound(Default::default()), + _ => panic!("unknown tag"), + }; + if let Some(name) = row[1].as_str() { + writeln!(out, "lookup {}", ChunkStatus::by_name(name).name())?; + } + match ChunkStatus::from_nbt(&tag) { + Ok(status) => { + let Tag::String(encoded) = status.to_nbt() else { + unreachable!() + }; + writeln!(out, "decoded {} {}", status.index(), encoded.to_string()?)?; + } + Err(_) => writeln!(out, "decoded error")?, + } + } + out.flush()?; + Ok(()) +} diff --git a/crates/horizon-world/src/chunk_status.rs b/crates/horizon-world/src/chunk_status.rs new file mode 100644 index 000000000..69ed42385 --- /dev/null +++ b/crates/horizon-world/src/chunk_status.rs @@ -0,0 +1,100 @@ +//! Pinned generation-status identities and ordering. A status describes progress; +//! assigning one does not execute its generation task or implement lighting. +use crate::{compression::invalid, heightmap::HeightmapType, nbt::Tag}; +use std::io; + +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[repr(u8)] +pub enum ChunkStatus { + #[default] + Empty, + StructureStarts, + StructureReferences, + Biomes, + Terrain, + Features, + InitializeLight, + Light, + Spawn, + Full, +} +impl ChunkStatus { + pub const MAX_STRUCTURE_DISTANCE: i32 = 8; + pub const FINAL_HEIGHTMAPS: [HeightmapType; 4] = [ + HeightmapType::WorldSurface, + HeightmapType::OceanFloor, + HeightmapType::MotionBlocking, + HeightmapType::MotionBlockingNoLeaves, + ]; + pub const ALL: [Self; 10] = [ + Self::Empty, + Self::StructureStarts, + Self::StructureReferences, + Self::Biomes, + Self::Terrain, + Self::Features, + Self::InitializeLight, + Self::Light, + Self::Spawn, + Self::Full, + ]; + pub fn index(self) -> usize { + self as usize + } + pub fn parent(self) -> Self { + Self::ALL[self.index().saturating_sub(1)] + } + pub fn name(self) -> &'static str { + match self { + Self::Empty => "minecraft:empty", + Self::StructureStarts => "minecraft:structure_starts", + Self::StructureReferences => "minecraft:structure_references", + Self::Biomes => "minecraft:biomes", + Self::Terrain => "minecraft:terrain", + Self::Features => "minecraft:features", + Self::InitializeLight => "minecraft:initialize_light", + Self::Light => "minecraft:light", + Self::Spawn => "minecraft:spawn", + Self::Full => "minecraft:full", + } + } + /// Registry-codec lookup: unknown or invalid identifiers are errors. + pub fn parse(name: &str) -> io::Result { + let path = match name.split_once(':') { + Some(("" | "minecraft", path)) => path, + None => name, + _ => return Err(invalid("unknown chunk status namespace")), + }; + Self::ALL + .into_iter() + .find(|status| status.name().strip_prefix("minecraft:") == Some(path)) + .ok_or_else(|| invalid("unknown chunk status")) + } + /// Direct native byName lookup uses the registry's empty-status fallback. + pub fn by_name(name: &str) -> Self { + Self::parse(name).unwrap_or_default() + } + pub fn from_nbt(tag: &Tag) -> io::Result { + let Tag::String(name) = tag else { + return Err(invalid("chunk status is not a string")); + }; + Self::parse( + &name + .to_string() + .map_err(|error| invalid(error.to_string()))?, + ) + } + pub fn to_nbt(self) -> Tag { + Tag::String(self.name().into()) + } + pub fn is_level_chunk(self) -> bool { + self == Self::Full + } + pub fn heightmaps(self) -> &'static [HeightmapType] { + if self >= Self::Terrain { + &Self::FINAL_HEIGHTMAPS + } else { + &[HeightmapType::WorldSurfaceWg, HeightmapType::OceanFloorWg] + } + } +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index c3571b884..fae1adc59 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -8,6 +8,7 @@ pub mod block_properties; pub mod block_support; pub mod block_survival; pub mod chunk; +pub mod chunk_status; pub mod collision; pub mod compression; pub mod dynamic_support; diff --git a/crates/horizon-world/src/worldgen/terrain.rs b/crates/horizon-world/src/worldgen/terrain.rs index 3c716cf6d..f7f9de17d 100644 --- a/crates/horizon-world/src/worldgen/terrain.rs +++ b/crates/horizon-world/src/worldgen/terrain.rs @@ -131,27 +131,14 @@ impl PreLightChunkStage { Self::Terrain, Self::Features, ]; + pub fn status(self) -> crate::chunk_status::ChunkStatus { + crate::chunk_status::ChunkStatus::ALL[self as usize] + } pub fn name(self) -> &'static str { - match self { - Self::Empty => "empty", - Self::StructureStarts => "structure_starts", - Self::StructureReferences => "structure_references", - Self::Biomes => "biomes", - Self::Terrain => "terrain", - Self::Features => "features", - } + self.status().name().strip_prefix("minecraft:").unwrap() } pub fn heightmaps(self) -> &'static [HeightmapType] { - if matches!(self, Self::Terrain | Self::Features) { - &[ - HeightmapType::WorldSurface, - HeightmapType::OceanFloor, - HeightmapType::MotionBlocking, - HeightmapType::MotionBlockingNoLeaves, - ] - } else { - &[HeightmapType::WorldSurfaceWg, HeightmapType::OceanFloorWg] - } + self.status().heightmaps() } } struct TerrainBlocks<'r, B: TerrainBlockStates> { diff --git a/docs/rust-parity.md b/docs/rust-parity.md index 8aad0162a..9e8d4682a 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -851,3 +851,19 @@ heights, ordinary/upgrading modes and horizontal rejection. Five focused Rust region tests, all-target Clippy and both Python fixture tests pass. Upgrade activation, target-status cleanup, old-bedrock replacement, hole masking, biome retention and the complete generation lifecycle remain pending. + +## Chunk-status identities and metadata + +Rust now represents all ten pinned chunk statuses, their ordering and parents, +proto/level chunk classification, structure-distance constant, and selected +heightmaps. Existing pre-light chunks use these definitions for their names and +heightmap groups. Direct name lookup retains vanilla's `empty` fallback; NBT +codec lookup rejects unknown names and writes canonical namespaced identifiers. + +The [chunk-status comparison](../benchmarks/rust-chunk-status-2026-10-06/scoped-parity.json) +matches **4,232 lines per reference JAR** across all 100 ordered status pairs and +**2,065 codec inputs**. Inputs include qualified/unqualified names, empty +namespaces, obsolete and malformed names, random strings and nonstring NBT. +World-crate tests and all-target Clippy pass. Codec error text is normalized. +Status identities do not execute generation tasks: scheduling, lighting, +post-light lifecycle transitions and the complete gameplay runtime remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaChunkStatusOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaChunkStatusOracle.java new file mode 100644 index 000000000..19e91b6f3 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaChunkStatusOracle.java @@ -0,0 +1,36 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*; +import java.nio.file.*; +import java.util.stream.Collectors; +import net.minecraft.nbt.*; +import net.minecraft.world.level.chunk.status.ChunkType; +import net.minecraft.world.level.chunk.status.ChunkStatus; + +/** Calls the pinned registry and status metadata/codec implementations. */ +public final class VanillaChunkStatusOracle { + public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); + try(var out=new PrintWriter(Files.newBufferedWriter(Path.of(args[1])))){ + out.println("structure_distance "+ChunkStatus.class.getField("MAX_STRUCTURE_DISTANCE").getInt(null)); + for(var status:ChunkStatus.getStatusList()){ + out.println("status "+status.getIndex()+" "+status.getName()+" "+status.getParent().getName()+" "+(status.getChunkType()==ChunkType.LEVELCHUNK)+" "+status.heightmapsAfter().stream().map(Enum::name).collect(Collectors.joining(","))); + for(var other:ChunkStatus.getStatusList())out.println("order "+status.isOrAfter(other)+" "+status.isAfter(other)+" "+status.isOrBefore(other)+" "+status.isBefore(other)+" "+ChunkStatus.max(status,other).getName()); + } + for(var line:Files.readAllLines(Path.of(args[0]))){ + var row=JsonParser.parseString(line).getAsJsonArray(); + Tag tag=switch(row.get(0).getAsString()){ + case "string"->StringTag.valueOf(row.get(1).getAsString()); + case "int"->IntTag.valueOf(row.get(1).getAsInt()); + case "list"->new ListTag(); + case "compound"->new CompoundTag(); + default->throw new AssertionError(); + }; + if(tag instanceof StringTag)out.println("lookup "+ChunkStatus.byName(row.get(1).getAsString()).getName()); + var result=ChunkStatus.CODEC.parse(NbtOps.INSTANCE,tag).result(); + if(result.isEmpty())out.println("decoded error"); + else {var status=result.get();var encoded=ChunkStatus.CODEC.encodeStart(NbtOps.INSTANCE,status).getOrThrow();out.println("decoded "+status.getIndex()+" "+((StringTag)encoded).value());} + } + } + } +} diff --git a/tools/test_chunk_status_parity.py b/tools/test_chunk_status_parity.py new file mode 100644 index 000000000..e2b01dbbe --- /dev/null +++ b/tools/test_chunk_status_parity.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python3 +"""Compare pinned chunk-status ordering, metadata, lookup and NBT codecs.""" +import argparse +import json +import os +from pathlib import Path +import platform +import random +import subprocess +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab, test_rust_parity as base + + +def corpus(): + names=['empty','structure_starts','structure_references','biomes','terrain','features','initialize_light','light','spawn','full'] + for name in names: + for prefix in ['',':','minecraft:','horizon:']: + yield ['string',prefix+name] + for name in ['',':','minecraft:','EMPTY','minecraft:Full','minecraft:noise','minecraft:surface','minecraft:carvers','full ', ' full', 'minecraft::full', 'minecraft/full','FULL','horizon:full','\u0000','\U0001f30d']: + yield ['string',name] + rng=random.Random(0x535441545553) + alphabet='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_:/. -\t\n' + for _ in range(2000):yield ['string',''.join(rng.choices(alphabet,k=rng.randrange(1,40)))] + for value in [-2147483648,-1,0,1,9,10,2147483647]:yield ['int',value] + yield ['list',None];yield ['compound',None] + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-chunk-status-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaChunkStatusOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/chunk_status_fixture.rs'] + tested_sources=base.source_hashes(sources) + commands=list(corpus());inputs=build/'inputs.txt';inputs.write_text('\n'.join(json.dumps(command) for command in commands)+'\n') + tested_fixtures=base.source_hashes([inputs]);classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w') as log:subprocess.run(list(map(str,command)),cwd=lab.ROOT,check=True,timeout=3600,stdout=log,stderr=subprocess.STDOUT) + dependencies=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependencies,'-d',classes,oracle],'compile-java') + run(['cargo','build','--release','-p','horizon-world','--example','chunk_status_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('chunk_status_fixture.exe' if os.name=='nt' else 'chunk_status_fixture') + run([binary,inputs,build/'rust.txt'],'rust') + references=[] + for side,jar in jars.items(): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jar),dependencies]),'dev.horizonlab.parity.VanillaChunkStatusOracle',inputs,build/(side+'.txt')],side) + matched=base.compare(build/(side+'.txt'),build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(build/(side+'.txt'),'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} chunk-status lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged([inputs],tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(), + 'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(), + 'statuses':10,'ordered_pairs':100,'codec_cases':len(commands),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references, + 'scope':'Actual pinned ChunkStatus status list, ordering and maximum for all pairs, parent identity, chunk kind, selected heightmaps, direct byName fallback and NBT codec acceptance/encoding. All registered names cover qualified, unqualified and empty-namespace forms; unknown, legacy, malformed, random and nonstring inputs are checked. Codec error text is normalized rather than compared. Rust pre-light chunk metadata uses these same status definitions; this does not execute generation steps, implement lighting, or establish full chunk lifecycle parity.'} + lab.write_json(report_path,report);print(f'Scoped chunk-status parity passed: {report_path}') + +if __name__=='__main__':main() From b9a8e381bb9a536b95d0a5a6c866b41a408d034b Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 15:55:41 +0200 Subject: [PATCH 040/253] Implement below-zero upgrade data and resident chunk transformations --- .github/workflows/ci.yml | 8 + .../scoped-parity.json | 214 ++++++++++++++++++ .../scoped-parity.json | 198 ++++++++++++++++ .../examples/chunk_stage_fixture.rs | 68 ++++++ .../examples/retrogen_data_fixture.rs | 112 +++++++++ crates/horizon-world/src/lib.rs | 1 + crates/horizon-world/src/retrogen.rs | 143 ++++++++++++ crates/horizon-world/src/worldgen/terrain.rs | 34 ++- docs/rust-parity.md | 26 +++ .../parity/VanillaChunkStageOracle.java | 11 + .../parity/VanillaRetrogenDataOracle.java | 50 ++++ tools/test_retrogen_chunk_parity.py | 97 ++++++++ tools/test_retrogen_data_parity.py | 66 ++++++ 13 files changed, 1026 insertions(+), 2 deletions(-) create mode 100644 benchmarks/rust-retrogen-chunk-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-retrogen-data-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-world/examples/retrogen_data_fixture.rs create mode 100644 crates/horizon-world/src/retrogen.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRetrogenDataOracle.java create mode 100644 tools/test_retrogen_chunk_parity.py create mode 100644 tools/test_retrogen_data_parity.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 021cb2def..0e3327b32 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -187,6 +187,14 @@ jobs: env: RUSTUP_TOOLCHAIN: stable run: python tools/test_generation_tick_parity.py + - name: Compare below-zero upgrade metadata codecs + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_retrogen_data_parity.py + - name: Compare below-zero upgrade lifecycle and block transformations + env: + RUSTUP_TOOLCHAIN: stable + run: python tools/test_retrogen_chunk_parity.py - name: Compare chunk-status metadata, ordering and codecs env: RUSTUP_TOOLCHAIN: stable diff --git a/benchmarks/rust-retrogen-chunk-2026-10-06/scoped-parity.json b/benchmarks/rust-retrogen-chunk-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..7cecf83e7 --- /dev/null +++ b/benchmarks/rust-retrogen-chunk-2026-10-06/scoped-parity.json @@ -0,0 +1,214 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "block_states": 35723, + "block_tag_files": 300, + "fixtures": 138, + "operation_counts": { + "stage": 916, + "prime": 40, + "fill": 84, + "dump": 324, + "upgrade": 300, + "upgrade_info": 1082, + "replace_bedrock": 164, + "mask": 244 + }, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaChunkStageOracle.java": "44ef437cb7efff99d2687644841ab88ac301e4cbb9a39f266753da9a61dd2af5", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_retrogen_chunk_parity.py": "a19e0f2ce97aff4d85626728ebfab15f2b4a2c7f3149451d2b7c5cc2660cf27a", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "2995b209aa3dc24cfcbba405cf8b97a398efbc0de97bb04ef2f51abb4cd2b84c", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "1eae82604d2b3377fd35aaa3a914a67e5af28f93923815a49e895b4d437433cd", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/retrogen.rs": "516c2a1841583acf1f9aef161dee3d59c68dfda9b9f2a7c936be9823abbdbb77", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "18d51343c00ad3a551d02f6ddfa37d1be23d481e1861ce6299d0a66991bc7074", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "9f7b5d9fd62779d9bd2446797b304f980eb51db70eb85575dddaccc3d3a2beab", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/chunk_stage_fixture.rs": "ad802dd3ff3eff1a52010308f15c9ad6095ac0f8c26720cc41561e61df5961a1" + }, + "fixtures_sha256": { + ".local/rust-retrogen-chunk-parity/inputs.txt": "8d997d6967e791b0f804f003c6d16a991904f54094abeca8db4f9315aa3c3160", + ".local/rust-retrogen-chunk-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0", + ".local/rust-retrogen-chunk-parity/facts-client.json": "1d24883ee807b0b71473f0bbf8ed548ddaf712148caeb3fcc7aa13ab973a97b0", + ".local/rust-retrogen-chunk-parity/facts-server.json": "1d24883ee807b0b71473f0bbf8ed548ddaf712148caeb3fcc7aa13ab973a97b0" + }, + "rust_output_sha256": "fd67f47ff49f4ea551892287a3fb3bca0e3770f1e0b8acd39a8838f45a76ed2e", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "fd67f47ff49f4ea551892287a3fb3bca0e3770f1e0b8acd39a8838f45a76ed2e", + "matched_output_lines": 3028057 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "fd67f47ff49f4ea551892287a3fb3bca0e3770f1e0b8acd39a8838f45a76ed2e", + "matched_output_lines": 3028057 + } + ], + "scope": "Native ProtoChunk below-zero metadata installation/removal, pre-light persisted-stage assignments and target completion cleanup, normal/upgrading generation heights, actual BelowZeroRetrogen.replaceOldBedrock and applyBedrockMask. Mixed resident states, legacy five-layer bedrock bands, signed/chunk-relative coordinates, partial vertical overlap, masks with empty/single/sparse/all/out-of-footprint bits, repeated operations, preprimed/stale/missing heightmaps, and clearing under changed generation bounds are compared. Complete raw sections and selected packed heightmaps are checked after each mutation phase. All nine nonempty targets are paired with all six pre-light stages, including installation after an already-advanced status, repeated assignments, backward transitions and explicit removal. Data codecs have a separate comparison. Save-dirty notifications, post-light stages, structure restrictions, biome retention, automatic generation scheduling and complete world/gameplay parity remain outside this comparison." +} diff --git a/benchmarks/rust-retrogen-data-2026-10-06/scoped-parity.json b/benchmarks/rust-retrogen-data-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..9ead91ad3 --- /dev/null +++ b/benchmarks/rust-retrogen-data-2026-10-06/scoped-parity.json @@ -0,0 +1,198 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "codec_cases": 5114, + "hole_queries_per_decoded_input": 1229, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRetrogenDataOracle.java": "9160fc33401fe150003dffdff72d916948a5b1ca2729d635b060d05ddd846adf", + "tools/test_retrogen_data_parity.py": "f8cf5be92d5d5632ee5be2f15b1d4519ac99937ef236956fe0a86b3c4c23d79c", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "dc370d5fdde37238c3e4820046f11c3201020406a4edfa1308257c13edbdcda4", + "Cargo.lock": "7307d0c887364db36d327685ecf0671b75305e31e5ba5fbdcdbb15eaf156d20e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "2995b209aa3dc24cfcbba405cf8b97a398efbc0de97bb04ef2f51abb4cd2b84c", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "1eae82604d2b3377fd35aaa3a914a67e5af28f93923815a49e895b4d437433cd", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/retrogen.rs": "516c2a1841583acf1f9aef161dee3d59c68dfda9b9f2a7c936be9823abbdbb77", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "18d51343c00ad3a551d02f6ddfa37d1be23d481e1861ce6299d0a66991bc7074", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "9f7b5d9fd62779d9bd2446797b304f980eb51db70eb85575dddaccc3d3a2beab", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/retrogen_data_fixture.rs": "517cc8ae0381049ef8d34a23d3b2e64d212cb5b8b89cde824dc2cdffc688bc87" + }, + "fixtures_sha256": { + ".local/rust-retrogen-data-parity/inputs.txt": "df3024560b464227d7a6e0afd18c408abfd6a0a4874bc9dd448ac81c28e314fe" + }, + "rust_output_sha256": "973c296cb151b90b6877f148d21dae9fce66de7781803d9d1a5a0125725215b2", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "973c296cb151b90b6877f148d21dae9fce66de7781803d9d1a5a0125725215b2", + "matched_output_lines": 20626 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "973c296cb151b90b6877f148d21dae9fce66de7781803d9d1a5a0125725215b2", + "matched_output_lines": 20626 + } + ], + "scope": "Native BelowZeroRetrogen codec, non-empty target-status validation, lenient optional bedrock mask decoding, NumericTag/array/list numeric streams, canonical trailing-zero removal, omitted empty masks, hasBedrockHoles and wrapped local X/Z hole queries. All 256 column bits and extra bits beyond the chunk footprint, malformed target/mask fields, mixed numeric lists and random bitsets are covered. Codec error text is normalized rather than compared. Generation scheduling, status transition cleanup, bedrock replacement/masking, biome retention and chunk lifecycle integration remain outside this data comparison." +} diff --git a/crates/horizon-world/examples/chunk_stage_fixture.rs b/crates/horizon-world/examples/chunk_stage_fixture.rs index 874b84f5f..5f5dca1a8 100644 --- a/crates/horizon-world/examples/chunk_stage_fixture.rs +++ b/crates/horizon-world/examples/chunk_stage_fixture.rs @@ -2,9 +2,11 @@ use horizon_core::position::ChunkPos; use horizon_world::{ DATA_VERSION, + chunk_status::ChunkStatus, heightmap::{HeightmapState, HeightmapType}, nbt::Tag, registry::{BlockRegistry, BlockStateId}, + retrogen::BelowZeroRetrogen, worldgen::{ tags::TagDefinitions, terrain::{PreLightChunkStage, TerrainBlockStates, TerrainChunk}, @@ -94,6 +96,72 @@ fn fixture( chunk.set_generation_stage(stage); writeln!(out, "stage {}", chunk.generation_stage().name())?; } + "upgrade" => { + let data = if op[1].is_null() { + None + } else { + Some(BelowZeroRetrogen::new( + ChunkStatus::parse(op[1].as_str().unwrap())?, + op[2] + .as_array() + .unwrap() + .iter() + .map(|v| v.as_i64().unwrap() as u64) + .collect(), + )?) + }; + chunk.set_below_zero_retrogen(data); + writeln!(out, "upgrade")?; + } + "upgrade_info" => { + let (min_y, height) = chunk.height_for_generation(); + writeln!( + out, + "upgrade_info {} {} {min_y} {height}", + chunk.is_upgrading(), + chunk + .below_zero_retrogen() + .map_or("none", |data| data.target_status().name()) + )?; + } + "replace_bedrock" => { + BelowZeroRetrogen::replace_old_bedrock(&mut chunk)?; + writeln!(out, "replace_bedrock")?; + } + "mask" => { + let data = BelowZeroRetrogen::new( + ChunkStatus::Full, + op[1] + .as_array() + .unwrap() + .iter() + .map(|v| v.as_i64().unwrap() as u64) + .collect(), + )?; + data.apply_bedrock_mask(&mut chunk)?; + writeln!(out, "mask")?; + } + "fill" => { + let states = op[1].as_array().unwrap(); + let salt = n(&op[2]); + let p = chunk.position(); + for y in 0..chunk.height() { + for z in 0..16 { + for x in 0..16 { + let state = BlockStateId(n( + &states[((x + 3 * y + 5 * z + salt) as usize) % states.len()] + ) as u32); + chunk.set_block_worldgen( + p.x.wrapping_shl(4).wrapping_add(x), + chunk.min_y().wrapping_add(y), + p.z.wrapping_shl(4).wrapping_add(z), + state, + )?; + } + } + } + writeln!(out, "fill")?; + } "set" => { let previous = chunk.set_block_worldgen( n(&op[1]), diff --git a/crates/horizon-world/examples/retrogen_data_fixture.rs b/crates/horizon-world/examples/retrogen_data_fixture.rs new file mode 100644 index 000000000..1f35cb363 --- /dev/null +++ b/crates/horizon-world/examples/retrogen_data_fixture.rs @@ -0,0 +1,112 @@ +use horizon_world::{nbt::Tag, retrogen::BelowZeroRetrogen}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, +}; +fn tag(row: &Value) -> Tag { + let value = &row[1]; + match row[0].as_str().unwrap() { + "end" => Tag::End, + "byte" => Tag::Byte(value.as_i64().unwrap() as i8), + "short" => Tag::Short(value.as_i64().unwrap() as i16), + "int" => Tag::Int(value.as_i64().unwrap() as i32), + "long" => Tag::Long(value.as_i64().unwrap()), + "float" => Tag::Float(u32::from_str_radix(value.as_str().unwrap(), 16).unwrap()), + "double" => Tag::Double(u64::from_str_radix(value.as_str().unwrap(), 16).unwrap()), + "string" => Tag::String(value.as_str().unwrap().into()), + "list" => Tag::List(value.as_array().unwrap().iter().map(tag).collect()), + "compound" => Tag::Compound( + value + .as_object() + .unwrap() + .iter() + .map(|(name, value)| (name.as_str().into(), tag(value))) + .collect(), + ), + "long_array" => Tag::LongArray( + value + .as_array() + .unwrap() + .iter() + .map(|v| v.as_i64().unwrap()) + .collect(), + ), + "int_array" => Tag::IntArray( + value + .as_array() + .unwrap() + .iter() + .map(|v| v.as_i64().unwrap() as i32) + .collect(), + ), + "byte_array" => Tag::ByteArray( + value + .as_array() + .unwrap() + .iter() + .map(|v| v.as_i64().unwrap() as u8) + .collect(), + ), + _ => panic!("unknown tag"), + } +} +fn main() -> Result<(), Box> { + let args: Vec<_> = std::env::args().collect(); + let mut out = io::BufWriter::new(fs::File::create(&args[2])?); + for (index, line) in fs::read_to_string(&args[1])?.lines().enumerate() { + writeln!(out, "case {index}")?; + let row: Value = serde_json::from_str(line)?; + let Ok(data) = BelowZeroRetrogen::from_nbt(&tag(&row)) else { + writeln!(out, "decoded error")?; + continue; + }; + let encoded = data.to_nbt(); + let Tag::Compound(fields) = &encoded else { + unreachable!() + }; + writeln!( + out, + "decoded {} {} {}", + data.target_status().name(), + data.has_bedrock_holes(), + fields.len() + )?; + let Some(Tag::String(target)) = encoded.get("target_status") else { + unreachable!() + }; + writeln!(out, "encoded_target {}", target.to_string()?)?; + let words = match encoded.get("missing_bedrock") { + Some(Tag::LongArray(words)) => words + .iter() + .map(|v| format!("{:x}", *v as u64)) + .collect::>() + .join(","), + None => "absent".into(), + _ => unreachable!(), + }; + writeln!(out, "mask {words}")?; + let mut holes = String::new(); + for z in -17..=17 { + for x in -17..=17 { + holes.push(if data.has_bedrock_hole(x, z) { + '1' + } else { + '0' + }); + } + } + for z in [i32::MIN, i32::MAX] { + for x in [i32::MIN, i32::MAX] { + holes.push(if data.has_bedrock_hole(x, z) { + '1' + } else { + '0' + }); + } + } + writeln!(out, "holes {holes}")?; + } + out.flush()?; + Ok(()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index fae1adc59..04667b337 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -19,6 +19,7 @@ pub mod nbt; pub mod piston_shape; pub mod region; pub mod registry; +pub mod retrogen; pub mod tick_data; pub mod worldgen; diff --git a/crates/horizon-world/src/retrogen.rs b/crates/horizon-world/src/retrogen.rs new file mode 100644 index 000000000..2aed00891 --- /dev/null +++ b/crates/horizon-world/src/retrogen.rs @@ -0,0 +1,143 @@ +//! Below-zero upgrade metadata and resident block transformations. +//! Generation scheduling and biome resolution remain separate. +use crate::{chunk_status::ChunkStatus, compression::invalid, nbt::Tag}; +use std::io; + +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct BelowZeroRetrogen { + target: ChunkStatus, + missing_bedrock: Vec, +} +impl BelowZeroRetrogen { + pub fn new(target: ChunkStatus, mut missing_bedrock: Vec) -> io::Result { + if target == ChunkStatus::Empty { + return Err(invalid("retrogen target status cannot be empty")); + } + while missing_bedrock.last() == Some(&0) { + missing_bedrock.pop(); + } + Ok(Self { + target, + missing_bedrock, + }) + } + pub fn target_status(&self) -> ChunkStatus { + self.target + } + pub fn has_bedrock_holes(&self) -> bool { + !self.missing_bedrock.is_empty() + } + pub fn has_bedrock_hole(&self, x: i32, z: i32) -> bool { + let index = ((z & 15) * 16 + (x & 15)) as usize; + self.missing_bedrock + .get(index / 64) + .is_some_and(|word| word & (1_u64 << (index % 64)) != 0) + } + pub fn missing_bedrock_words(&self) -> &[u64] { + &self.missing_bedrock + } + pub fn from_nbt(tag: &Tag) -> io::Result { + if !matches!(tag, Tag::Compound(_)) { + return Err(invalid("retrogen is not a compound")); + } + let target = ChunkStatus::from_nbt( + tag.get("target_status") + .ok_or_else(|| invalid("missing retrogen target status"))?, + )?; + // The native optional field is lenient: an invalid stream is absent. + let words = tag + .get("missing_bedrock") + .and_then(long_stream) + .unwrap_or_default(); + Self::new(target, words) + } + pub fn to_nbt(&self) -> Tag { + let mut fields = vec![("target_status", self.target.to_nbt())]; + if self.has_bedrock_holes() { + fields.push(( + "missing_bedrock", + Tag::LongArray( + self.missing_bedrock + .iter() + .map(|word| *word as i64) + .collect(), + ), + )); + } + Tag::compound(fields) + } +} +fn long_stream(tag: &Tag) -> Option> { + match tag { + Tag::LongArray(words) => Some(words.iter().map(|v| *v as u64).collect()), + Tag::IntArray(words) => Some(words.iter().map(|v| i64::from(*v) as u64).collect()), + Tag::ByteArray(words) => Some(words.iter().map(|v| i64::from(*v as i8) as u64).collect()), + Tag::List(words) => words + .iter() + .map(|word| { + Some(match word { + Tag::Byte(v) => i64::from(*v) as u64, + Tag::Short(v) => i64::from(*v) as u64, + Tag::Int(v) => i64::from(*v) as u64, + Tag::Long(v) => *v as u64, + Tag::Float(v) => (f32::from_bits(*v) as i64) as u64, + Tag::Double(v) => (f64::from_bits(*v) as i64) as u64, + _ => return None, + }) + }) + .collect(), + _ => None, + } +} + +impl BelowZeroRetrogen { + /// Replace the legacy five-layer bedrock band in a resident proto-chunk. + /// Local X/Z positions and native X-fastest traversal preserve write order. + pub fn replace_old_bedrock( + chunk: &mut crate::worldgen::terrain::TerrainChunk<'_, B>, + ) -> Result<(), crate::worldgen::terrain::TerrainError> { + use crate::worldgen::terrain::TerrainError; + let bedrock = chunk + .registry() + .default_state("minecraft:bedrock") + .ok_or(TerrainError::InvalidState)?; + let deepslate = chunk + .registry() + .default_state("minecraft:deepslate") + .ok_or(TerrainError::InvalidState)?; + for z in 0..16 { + for y in 0..5 { + for x in 0..16 { + if chunk.same_block(chunk.block(x, y, z), bedrock) { + chunk.set_block_worldgen(x, y, z, deepslate)?; + } + } + } + } + Ok(()) + } + /// Clear marked columns through the supplied chunk's current generation + /// height. The installed upgrade and this mask need not be the same object. + pub fn apply_bedrock_mask( + &self, + chunk: &mut crate::worldgen::terrain::TerrainChunk<'_, B>, + ) -> Result<(), crate::worldgen::terrain::TerrainError> { + use crate::worldgen::terrain::TerrainError; + let air = chunk + .registry() + .default_state("minecraft:air") + .ok_or(TerrainError::MissingAir)?; + let (min_y, height) = chunk.height_for_generation(); + let max_y = min_y.wrapping_add(height).wrapping_sub(1); + for x in 0..16 { + for z in 0..16 { + if self.has_bedrock_hole(x, z) { + for y in min_y..=max_y { + chunk.set_block_worldgen(x, y, z, air)?; + } + } + } + } + Ok(()) + } +} diff --git a/crates/horizon-world/src/worldgen/terrain.rs b/crates/horizon-world/src/worldgen/terrain.rs index f7f9de17d..2a97a1b70 100644 --- a/crates/horizon-world/src/worldgen/terrain.rs +++ b/crates/horizon-world/src/worldgen/terrain.rs @@ -103,6 +103,7 @@ impl From for TerrainError { /// fluid postprocessing offsets for the noise and surface generation stages. pub struct TerrainChunk<'r, B: TerrainBlockStates> { stage: PreLightChunkStage, + below_zero_retrogen: Option, position: ChunkPos, blocks: TerrainBlocks<'r, B>, heightmaps: [Option; 6], @@ -111,7 +112,8 @@ pub struct TerrainChunk<'r, B: TerrainBlockStates> { fluid_ticks: ProtoChunkTicks, } /// The persisted generation statuses before lighting initialization. This models -/// their block-write heightmap selection, not scheduling or persisted metadata. +/// status-dependent storage and upgrade cleanup, not scheduling, lighting or +/// save-dirty notifications. #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] pub enum PreLightChunkStage { #[default] @@ -212,6 +214,7 @@ impl<'r, B: TerrainBlockStates> TerrainChunk<'r, B> { .collect::>>()?; Ok(Self { stage: PreLightChunkStage::Empty, + below_zero_retrogen: None, position, blocks: TerrainBlocks { min_y, @@ -249,9 +252,36 @@ impl<'r, B: TerrainBlockStates> TerrainChunk<'r, B> { self.stage } /// Changing status alone does not prime or clear any heightmaps. Native - /// persisted-status assignment also permits earlier statuses. + /// persisted-status assignment also permits earlier statuses. Reaching an + /// installed upgrade target clears its metadata; save-dirty tracking is separate. pub fn set_generation_stage(&mut self, stage: PreLightChunkStage) { self.stage = stage; + if self + .below_zero_retrogen + .as_ref() + .is_some_and(|data| stage.status() >= data.target_status()) + { + self.below_zero_retrogen = None; + } + } + pub fn below_zero_retrogen(&self) -> Option<&crate::retrogen::BelowZeroRetrogen> { + self.below_zero_retrogen.as_ref() + } + /// Installation alone does not compare the target with the current status. + /// A subsequent persisted-stage assignment performs completion cleanup. + pub fn set_below_zero_retrogen(&mut self, data: Option) { + self.below_zero_retrogen = data; + } + pub fn is_upgrading(&self) -> bool { + self.below_zero_retrogen.is_some() + } + /// Generation minimum Y and height. Storage bounds remain unchanged. + pub fn height_for_generation(&self) -> (i32, i32) { + if self.is_upgrading() { + (-64, 64) + } else { + (self.min_y(), self.height()) + } } /// ProtoChunk writes before lighting. The current stage selects heightmaps; /// missing maps are primed after existing maps are updated. diff --git a/docs/rust-parity.md b/docs/rust-parity.md index 9e8d4682a..a80fb59c6 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -867,3 +867,29 @@ namespaces, obsolete and malformed names, random strings and nonstring NBT. World-crate tests and all-target Clippy pass. Codec error text is normalized. Status identities do not execute generation tasks: scheduling, lighting, post-light lifecycle transitions and the complete gameplay runtime remain pending. + +## Below-zero upgrade data and resident transformations + +Resident chunks now hold optional below-zero upgrade data. Installation alone +keeps the data even if the current stage already exceeds its target; assigning a +persisted stage at or beyond that target clears it. Upgrading chunks expose the +-64 through -1 generation interval independently of their storage bounds. + +The Rust upgrade codec validates nonempty target statuses, accepts vanilla's +lenient optional bedrock-hole mask, normalizes trailing zero words and omits an +empty mask when saving. Hole queries wrap local X/Z coordinates. Resident +transformations replace bedrock in the old Y = 0 through 4 band with default +deepslate and clear marked columns through the chunk's current generation height. + +The [upgrade-data comparison](../benchmarks/rust-retrogen-data-2026-10-06/scoped-parity.json) +matches **20,626 lines per reference JAR** across **5,114 codec inputs**, including +canonical output, all 256 column bits, out-of-footprint bits, signed numeric +streams, malformed optional fields and random masks. Codec error text is normalized. +The [resident upgrade comparison](../benchmarks/rust-retrogen-chunk-2026-10-06/scoped-parity.json) +matches **3,028,057 lines per reference JAR** across **138 fixtures**. It checks all +nine nonempty targets against the six pre-light stages, repeated/backward stage +assignments, complete stored sections and heightmap words after replacement and +masking, partial vertical overlap, empty sections and changed generation bounds. +World-crate tests and all-target Clippy pass. Save-dirty notifications, post-light +transitions, biome retention, structure restrictions, automatic generation +scheduling and full saved-world/gameplay integration remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaChunkStageOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaChunkStageOracle.java index 3e6379837..af5a4b819 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaChunkStageOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaChunkStageOracle.java @@ -11,10 +11,16 @@ import net.minecraft.world.level.block.*; import net.minecraft.world.level.chunk.*; import net.minecraft.world.level.chunk.status.ChunkStatus; import net.minecraft.world.level.levelgen.Heightmap; +import net.minecraft.world.level.levelgen.BelowZeroRetrogen; +import com.mojang.serialization.JsonOps; /** Actual pre-light ProtoChunk writes and persisted-status transitions. */ public final class VanillaChunkStageOracle { private static final Map STAGES=new HashMap<>(); + private static BelowZeroRetrogen upgrade(String target,JsonArray words) { + var data=new JsonObject();data.addProperty("target_status",target);data.add("missing_bedrock",words); + return BelowZeroRetrogen.CODEC.parse(JsonOps.INSTANCE,data).getOrThrow(); + } public static void main(String[] args) throws Exception { if(args[0].equals("export")){VanillaHeightmapOracle.main(args);return;} net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); @@ -33,6 +39,11 @@ public final class VanillaChunkStageOracle { var a=value.getAsJsonArray();String op=a.get(0).getAsString(); switch(op) { case "stage"->{String name=a.get(1).getAsString();chunk.setPersistedStatus(STAGES.get(name));out.println("stage "+name);} + case "upgrade"->{chunk.setBelowZeroRetrogen(a.get(1).isJsonNull()?null:upgrade(a.get(1).getAsString(),a.get(2).getAsJsonArray()));out.println("upgrade");} + case "upgrade_info"->{var data=chunk.getBelowZeroRetrogen();var bounds=chunk.getHeightAccessorForGeneration();out.println("upgrade_info "+chunk.isUpgrading()+" "+(data==null?"none":data.targetStatus().getName())+" "+bounds.getMinY()+" "+bounds.getHeight());} + case "replace_bedrock"->{BelowZeroRetrogen.replaceOldBedrock(chunk);out.println("replace_bedrock");} + case "mask"->{upgrade("full",a.get(1).getAsJsonArray()).applyBedrockMask(chunk);out.println("mask");} + case "fill"->{var states=a.get(1).getAsJsonArray();int salt=a.get(2).getAsInt();for(int y=0;y{var p=new BlockPos(a.get(1).getAsInt(),a.get(2).getAsInt(),a.get(3).getAsInt());out.println("set "+Block.getId(chunk.setBlockState(p,Block.stateById(a.get(4).getAsInt()),3)));} case "get"->out.println("get "+Block.getId(chunk.getBlockState(new BlockPos(a.get(1).getAsInt(),a.get(2).getAsInt(),a.get(3).getAsInt())))); case "prime"->{int mask=a.get(1).getAsInt();var kinds=EnumSet.noneOf(Heightmap.Types.class);for(var kind:Heightmap.Types.values())if((mask&(1<EndTag.INSTANCE; + case "byte"->ByteTag.valueOf(v.getAsByte()); + case "short"->ShortTag.valueOf(v.getAsShort()); + case "int"->IntTag.valueOf(v.getAsInt()); + case "long"->LongTag.valueOf(v.getAsLong()); + case "float"->FloatTag.valueOf(Float.intBitsToFloat(Integer.parseUnsignedInt(v.getAsString(),16))); + case "double"->DoubleTag.valueOf(Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16))); + case "string"->StringTag.valueOf(v.getAsString()); + case "list"->{var list=new ListTag();for(var item:v.getAsJsonArray())list.add(tag(item));yield list;} + case "compound"->{var map=new CompoundTag();for(var item:v.getAsJsonObject().entrySet())map.put(item.getKey(),tag(item.getValue()));yield map;} + case "long_array"->{var array=v.getAsJsonArray();long[] words=new long[array.size()];for(int i=0;i{var array=v.getAsJsonArray();int[] words=new int[array.size()];for(int i=0;i{var array=v.getAsJsonArray();byte[] words=new byte[array.size()];for(int i=0;ithrow new AssertionError(kind); + }; + } + public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); + try(var out=new PrintWriter(Files.newBufferedWriter(Path.of(args[1])))){ + int index=0; + for(var line:Files.readAllLines(Path.of(args[0]))){ + out.println("case "+index++); + var result=BelowZeroRetrogen.CODEC.parse(NbtOps.INSTANCE,tag(JsonParser.parseString(line))).result(); + if(result.isEmpty()){out.println("decoded error");continue;} + var data=result.get();var encoded=(CompoundTag)BelowZeroRetrogen.CODEC.encodeStart(NbtOps.INSTANCE,data).getOrThrow(); + out.println("decoded "+data.targetStatus().getName()+" "+data.hasBedrockHoles()+" "+encoded.size()); + out.println("encoded_target "+((StringTag)encoded.get("target_status")).value()); + var words=(LongArrayTag)encoded.get("missing_bedrock"); + var text=new StringJoiner(",");if(words!=null)for(long word:words.getAsLongArray())text.add(Long.toUnsignedString(word,16)); + out.println("mask "+(words==null?"absent":text)); + var holes=new StringBuilder();for(int z=-17;z<=17;z++)for(int x=-17;x<=17;x++)holes.append(data.hasBedrockHole(x,z)?'1':'0'); + for(int z:new int[]{Integer.MIN_VALUE,Integer.MAX_VALUE})for(int x:new int[]{Integer.MIN_VALUE,Integer.MAX_VALUE})holes.append(data.hasBedrockHole(x,z)?'1':'0'); + out.println("holes "+holes); + } + } + } +} diff --git a/tools/test_retrogen_chunk_parity.py b/tools/test_retrogen_chunk_parity.py new file mode 100644 index 000000000..d35c3f684 --- /dev/null +++ b/tools/test_retrogen_chunk_parity.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python3 +"""Compare below-zero upgrade lifecycle, bedrock replacement and hole clearing.""" +import argparse +from collections import Counter +import json +import os +from pathlib import Path +import platform +import random +import subprocess + +try: + from . import lab, test_rust_parity as base, test_worldgen_parity as worldgen +except ImportError: + import lab + import test_rust_parity as base + import test_worldgen_parity as worldgen + + +def corpus(facts): + defaults=facts['defaults'] + stages=['empty','structure_starts','structure_references','biomes','terrain','features'] + targets=stages[1:]+['initialize_light','light','spawn','full'] + states=[defaults['minecraft:'+name] for name in ['bedrock','deepslate','stone','air','water','cave_air','void_air','oak_leaves','oak_slab','snow','powder_snow','lava']] + masks=[[],[1],[1,-9223372036854775808,0,9223372036854775807],[-1]*4,[0,0,0,0,1]] + index=0 + for minimum,height in [(-64,80),(0,16),(-16,32),(64,16)]: + for stage in ['empty','terrain']: + for upgrading in [False,True]: + for words in masks: + ops=[['stage',stage]] + if index%2==0:ops.append(['prime',63]) + ops += [['fill',states,index%len(states)],['dump'],['upgrade','features' if upgrading else None,[1]],['upgrade_info'],['replace_bedrock'],['replace_bedrock'],['dump'],['mask',words],['mask',words],['dump'],['stage','features'],['upgrade_info'],['mask',words],['dump']] + yield {'chunk':[0,0] if index%2 else [-3,7],'min':minimum,'height':height,'ops':ops} + index+=1 + yield {'chunk':[-3,7],'min':minimum,'height':height,'ops':[['fill',[defaults['minecraft:air']],0],['upgrade','terrain',[-1]*4],['replace_bedrock'],['mask',[-1]*4],['dump'],['upgrade_info']]} + for initial in stages: + for target in targets: + ops=[['stage',initial],['upgrade',target,[1]],['upgrade_info'],['stage',initial],['upgrade_info'],['upgrade',target,[1]],['upgrade_info']] + for stage in stages+list(reversed(stages)):ops += [['stage',stage],['upgrade_info']] + ops += [['upgrade',target,[1]],['upgrade_info'],['upgrade',None,[]],['upgrade_info']] + yield {'chunk':[2147483647,-2147483648],'min':0,'height':16,'ops':ops} + + +def main(): + parser=argparse.ArgumentParser(description=__doc__) + parser.add_argument("--prepare",action="store_true") + args=parser.parse_args() + build=lab.LOCAL/"rust-retrogen-chunk-parity";build.mkdir(parents=True,exist_ok=True) + report_path=build/"report.json";report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + tags=worldgen.tag_resources(jars["server"]) + if not tags or tags!=worldgen.tag_resources(jars["client"]):raise ValueError("client/server block tags differ or are empty") + oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaChunkStageOracle.java" + helper=oracle.with_name("VanillaHeightmapOracle.java") + sources=[oracle,helper,Path(__file__),lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock", + lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml", + *sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/chunk_stage_fixture.rs"] + tested_sources=base.source_hashes(sources) + classes=build/"classes";classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+".log")).open("w",encoding="utf-8") as log:subprocess.run(list(map(str,command)),cwd=lab.ROOT,check=True,timeout=3600,stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle,helper],"compile-java") + def java(side,mode,path): + run(["java","-Xmx1G","-cp",os.pathsep.join([str(classes),str(jars[side]),dependency_path]),"dev.horizonlab.parity.VanillaChunkStageOracle",mode,path],side+"-"+mode) + for side in jars:java(side,"export",build/f"facts-{side}.json") + facts=json.loads((build/"facts-server.json").read_text()) + if facts!=json.loads((build/"facts-client.json").read_text()):raise ValueError("client/server state facts differ") + if len(facts["states"])!=35723:raise ValueError("incomplete pinned state table") + fixtures=list(corpus(facts));inputs=build/"inputs.txt" + inputs.write_text("".join(json.dumps(value,separators=(",",":"))+"\n" for value in fixtures),encoding="utf-8") + (build/"tags.json").write_text(json.dumps(tags,separators=(",",":")),encoding="utf-8") + fixture_paths=[inputs,build/"tags.json",build/"facts-client.json",build/"facts-server.json"] + tested_fixtures=base.source_hashes(fixture_paths) + run(["cargo","build","--release","-p","horizon-world","--example","chunk_stage_fixture"],"compile-rust") + metadata=json.loads(subprocess.check_output(["cargo","metadata","--no-deps","--format-version","1"],cwd=lab.ROOT,text=True)) + binary=Path(metadata["target_directory"])/"release/examples"/("chunk_stage_fixture.exe" if os.name=="nt" else "chunk_stage_fixture") + run([binary,build],"rust") + references=[] + for side,jar in jars.items(): + java(side,side,build) + reference=build/f"{side}.txt";matched=base.compare(reference,build/"rust.txt") + references.append({"side":side,"jar_sha256":lab.digest(jar,"sha256"),"output_sha256":lab.digest(reference,"sha256"),"matched_output_lines":matched}) + print(f"{side}: {matched:,} retrogen-chunk output lines match Rust",flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={"schema":1,"minecraft":lock["minecraft"]["version"],"manifest_sha1":lock["minecraft"]["manifest_sha1"],"platform":platform.platform(), + "java":subprocess.check_output(["java","--version"],text=True).splitlines()[0],"rustc":subprocess.check_output(["rustc","--version"],text=True).strip(), + "block_states":len(facts["states"]),"block_tag_files":len(tags),"fixtures":len(fixtures),"operation_counts":dict(Counter(op[0] for fixture in fixtures for op in fixture["ops"])), + "sources_sha256":tested_sources,"fixtures_sha256":tested_fixtures,"rust_output_sha256":lab.digest(build/"rust.txt","sha256"),"references":references, + "scope":"Native ProtoChunk below-zero metadata installation/removal, pre-light persisted-stage assignments and target completion cleanup, normal/upgrading generation heights, actual BelowZeroRetrogen.replaceOldBedrock and applyBedrockMask. Mixed resident states, legacy five-layer bedrock bands, signed/chunk-relative coordinates, partial vertical overlap, masks with empty/single/sparse/all/out-of-footprint bits, repeated operations, preprimed/stale/missing heightmaps, and clearing under changed generation bounds are compared. Complete raw sections and selected packed heightmaps are checked after each mutation phase. All nine nonempty targets are paired with all six pre-light stages, including installation after an already-advanced status, repeated assignments, backward transitions and explicit removal. Data codecs have a separate comparison. Save-dirty notifications, post-light stages, structure restrictions, biome retention, automatic generation scheduling and complete world/gameplay parity remain outside this comparison."} + + lab.write_json(report_path,report);print(f"Scoped retrogen-chunk parity passed: {report_path}") + + +if __name__=="__main__":main() diff --git a/tools/test_retrogen_data_parity.py b/tools/test_retrogen_data_parity.py new file mode 100644 index 000000000..b79e2046e --- /dev/null +++ b/tools/test_retrogen_data_parity.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python3 +"""Compare native below-zero retrogen NBT, bedrock-hole masks and queries.""" +import argparse +import json +import os +from pathlib import Path +import platform +import random +import subprocess +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab, test_rust_parity as base + + +def corpus(): + targets=[['string',name] for name in ['structure_starts',':structure_references','minecraft:biomes','terrain','features','initialize_light','light','spawn','full','empty','unknown','horizon:full']]+[None,['int',9],['compound',{}]] + masks=[None,['long_array',[]],['long_array',[0]*8],['long_array',[-1]*4],['long_array',[1,0,0,0,0,1,0]],['byte_array',[-128,-1,0,1,127]],['int_array',[-2147483648,-1,0,1,2147483647]],['list',[]],['list',[['byte',-128],['short',-32768],['int',-2147483648],['long',-9223372036854775808]]],['list',[['double','bff8000000000000'],['float','3fc00000'],['double','7ff8000000000000'],['float','ff800000']]],['list',[['long',1],['string','invalid']]],['string','invalid'],['int',1],['compound',{}]] + for bit in [*range(256),256,511,512,1023]: + words=[0]*(bit//64+1);word=1<<(bit%64);words[-1]=word if word<2**63 else word-2**64;masks.append(['long_array',words]) + for target in targets: + for mask in masks: + fields={} + if target is not None:fields['target_status']=target + if mask is not None:fields['missing_bedrock']=mask + yield ['compound',fields] + rng=random.Random(0x524554524f47454e) + for _ in range(1000): + words=[rng.randrange(-2**63,2**63) for _ in range(rng.randrange(17))]+[0]*rng.randrange(4) + yield ['compound',{'target_status':['string','full'],'missing_bedrock':['long_array',words],'extra':['string','ignored']}] + for kind,value in [('end',None),('byte',1),('string','full'),('list',[])]:yield [kind,value] + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-retrogen-data-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRetrogenDataOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/retrogen_data_fixture.rs'] + tested_sources=base.source_hashes(sources) + commands=list(corpus());inputs=build/'inputs.txt';inputs.write_text('\n'.join(json.dumps(command) for command in commands)+'\n') + tested_fixtures=base.source_hashes([inputs]);classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w') as log:subprocess.run(list(map(str,command)),cwd=lab.ROOT,check=True,timeout=3600,stdout=log,stderr=subprocess.STDOUT) + dependencies=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependencies,'-d',classes,oracle],'compile-java') + run(['cargo','build','--release','-p','horizon-world','--example','retrogen_data_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('retrogen_data_fixture.exe' if os.name=='nt' else 'retrogen_data_fixture') + run([binary,inputs,build/'rust.txt'],'rust') + references=[] + for side,jar in jars.items(): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jar),dependencies]),'dev.horizonlab.parity.VanillaRetrogenDataOracle',inputs,build/(side+'.txt')],side) + matched=base.compare(build/(side+'.txt'),build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(build/(side+'.txt'),'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} retrogen-data lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged([inputs],tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(), + 'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(), + 'codec_cases':len(commands),'hole_queries_per_decoded_input':1229,'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references, + 'scope':'Native BelowZeroRetrogen codec, non-empty target-status validation, lenient optional bedrock mask decoding, NumericTag/array/list numeric streams, canonical trailing-zero removal, omitted empty masks, hasBedrockHoles and wrapped local X/Z hole queries. All 256 column bits and extra bits beyond the chunk footprint, malformed target/mask fields, mixed numeric lists and random bitsets are covered. Codec error text is normalized rather than compared. Generation scheduling, status transition cleanup, bedrock replacement/masking, biome retention and chunk lifecycle integration remain outside this data comparison.'} + lab.write_json(report_path,report);print(f'Scoped retrogen-data parity passed: {report_path}') + +if __name__=='__main__':main() From e8b66b83fc5de1592cc2f41e4646e527e0a946b1 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 19:17:08 +0200 Subject: [PATCH 041/253] Add native Horizon development client with textured chunk rendering --- Cargo.lock | 2414 ++++++++++++++++- Cargo.toml | 2 +- README.md | 2 +- .../startup-smoke.json | 141 + crates/horizon-client/Cargo.toml | 18 + crates/horizon-client/src/assets.rs | 223 ++ crates/horizon-client/src/camera.rs | 55 + crates/horizon-client/src/main.rs | 388 +++ crates/horizon-client/src/mesh.rs | 232 ++ crates/horizon-client/src/render.rs | 303 +++ crates/horizon-client/src/world.rs | 96 + crates/horizon-client/src/world.wgsl | 42 + docs/native-client.md | 79 + docs/rust-parity.md | 8 +- tools/prepare_native_client.py | 74 + tools/test_native_client.py | 64 + 16 files changed, 4135 insertions(+), 6 deletions(-) create mode 100644 benchmarks/rust-native-client-2026-10-06/startup-smoke.json create mode 100644 crates/horizon-client/Cargo.toml create mode 100644 crates/horizon-client/src/assets.rs create mode 100644 crates/horizon-client/src/camera.rs create mode 100644 crates/horizon-client/src/main.rs create mode 100644 crates/horizon-client/src/mesh.rs create mode 100644 crates/horizon-client/src/render.rs create mode 100644 crates/horizon-client/src/world.rs create mode 100644 crates/horizon-client/src/world.wgsl create mode 100644 docs/native-client.md create mode 100644 tools/prepare_native_client.py create mode 100644 tools/test_native_client.py diff --git a/Cargo.lock b/Cargo.lock index 09592a28b..4bccbdd69 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,18 +2,315 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "ab_glyph" +version = "0.2.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01c0457472c38ea5bd1c3b5ada5e368271cb550be7a4ca4a0b4634e9913f6cc2" +dependencies = [ + "ab_glyph_rasterizer", + "owned_ttf_parser", +] + +[[package]] +name = "ab_glyph_rasterizer" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "366ffbaa4442f4684d91e2cd7c5ea7c4ed8add41959a31447066e279e432b618" + [[package]] name = "adler2" version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "getrandom 0.3.4", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + +[[package]] +name = "android-activity" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f2a1bb052857d5dd49572219344a7332b31b76405648eabac5bc68978251bcd" +dependencies = [ + "android-properties", + "bitflags 2.13.2", + "cc", + "jni", + "libc", + "log", + "ndk", + "ndk-context", + "ndk-sys", + "num_enum", + "thiserror 2.0.21", +] + +[[package]] +name = "android-properties" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04" + +[[package]] +name = "android_system_properties" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc" +dependencies = [ + "libc", +] + +[[package]] +name = "arrayref" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" + +[[package]] +name = "arrayvec" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56" + +[[package]] +name = "as-raw-xcb-connection" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b" + +[[package]] +name = "ash" +version = "0.38.0+1.3.281" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f" +dependencies = [ + "libloading", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" + +[[package]] +name = "bit-set" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2f926cc3060f09db9ebc5b52823d85268d24bb917e472c0c4bea35780a7d" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b71798fca2c1fe1086445a7258a4bc81e6e49dcd24c8d0dd9a1e57395b603f51" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" + +[[package]] +name = "block2" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f" +dependencies = [ + "objc2 0.5.3", +] + +[[package]] +name = "block2" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" +dependencies = [ + "objc2 0.6.5", +] + +[[package]] +name = "bumpalo" +version = "3.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" + +[[package]] +name = "bytemuck" +version = "1.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a1f896587b6f2c069c73d2f0913e2d590c3990285cd2f0b6aa02b786b4c679c" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "bytes" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" + +[[package]] +name = "calloop" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b99da2f8558ca23c71f4fd15dc57c906239752dd27ff3c00a1d56b685b7cbfec" +dependencies = [ + "bitflags 2.13.2", + "log", + "polling", + "rustix 0.38.44", + "slab", + "thiserror 1.0.69", +] + +[[package]] +name = "calloop-wayland-source" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20" +dependencies = [ + "calloop", + "rustix 0.38.44", + "wayland-backend", + "wayland-client", +] + +[[package]] +name = "cc" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f74872d07caf508b30a21f6836e7d7016a2eaf7d9ff4f48deaa58cd8a0407630" +dependencies = [ + "find-msvc-tools", + "jobserver", + "libc", + "shlex", +] + [[package]] name = "cfg-if" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" +[[package]] +name = "cfg_aliases" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" + +[[package]] +name = "codespan-reporting" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af491d569909a7e4dee0ad7db7f5341fef5c614d5b8ec8cf765732aba3cff681" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "combine" +version = "4.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfc320937d09e6de266b31b9afb480f197d7a861be86be7cb2ea7e5d1bfffc5e" +dependencies = [ + "bytes", + "memchr", +] + +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "core-graphics" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "core-graphics-types", + "foreign-types", + "libc", +] + +[[package]] +name = "core-graphics-types" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "libc", +] + [[package]] name = "crc32fast" version = "1.5.2" @@ -23,6 +320,101 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "crossbeam-utils" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" + +[[package]] +name = "crunchy" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" + +[[package]] +name = "cursor-icon" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f27ae1dd37df86211c42e150270f82743308803d90a6f6e6651cd730d5e1732f" + +[[package]] +name = "dispatch" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" + +[[package]] +name = "dispatch2" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38" +dependencies = [ + "bitflags 2.13.2", + "objc2 0.6.5", +] + +[[package]] +name = "dlib" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a" +dependencies = [ + "libloading", +] + +[[package]] +name = "document-features" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61" +dependencies = [ + "litrs", +] + +[[package]] +name = "downcast-rs" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" + +[[package]] +name = "dpi" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76" + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "fdeflate" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" +dependencies = [ + "simd-adler32", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aedcfb3409746eddb02b9e19ebda1c3394f759a152e48ee875a0844d1b955484" + [[package]] name = "flate2" version = "1.1.10" @@ -30,7 +422,171 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e634e2e0ebac1ee034020da1ca582e17ffe4e0f5e985823721e168928136dcb" dependencies = [ "crc32fast", - "miniz_oxide", + "miniz_oxide 0.9.1", + "zlib-rs", +] + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + +[[package]] +name = "foreign-types" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" +dependencies = [ + "foreign-types-macros", + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-macros" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea5190182e6915eb873ddbc16e23b711b6eb1f9c00a0d0a3a91b5f6228475225" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "foreign-types-shared" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" + +[[package]] +name = "futures-core" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" + +[[package]] +name = "futures-task" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" + +[[package]] +name = "futures-util" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "slab", +] + +[[package]] +name = "gethostname" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8" +dependencies = [ + "rustix 1.1.5", + "windows-link", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi 5.3.0", + "wasip2", +] + +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", +] + +[[package]] +name = "glam" +version = "0.30.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19fc433e8437a212d1b6f1e68c7824af3aed907da60afa994e7f542d18d12aa9" + +[[package]] +name = "gpu-allocator" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51255ea7cfaadb6c5f1528d43e92a82acb2b96c43365989a28b2d44ee38f8795" +dependencies = [ + "ash", + "hashbrown 0.16.1", + "log", + "presser", + "thiserror 2.0.21", + "windows", +] + +[[package]] +name = "half" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" +dependencies = [ + "cfg-if", + "crunchy", + "num-traits", + "zerocopy", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash", +] + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" +dependencies = [ + "foldhash", +] + +[[package]] +name = "hermit-abi" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e17592d60ebacc7d5e169f4663c5f84f9161cc90328abcfe8456f41e4dfcb284" + +[[package]] +name = "horizon-client" +version = "0.1.0" +dependencies = [ + "bytemuck", + "glam", + "horizon-core", + "horizon-world", + "png", + "pollster", + "serde_json", + "wgpu", + "winit", ] [[package]] @@ -48,12 +604,168 @@ dependencies = [ "xxhash-rust", ] +[[package]] +name = "indexmap" +version = "2.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" +dependencies = [ + "equivalent", + "hashbrown 0.17.1", +] + [[package]] name = "itoa" version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" +[[package]] +name = "jni" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498" +dependencies = [ + "cfg-if", + "combine", + "jni-macros", + "jni-sys 0.4.1", + "log", + "simd_cesu8", + "thiserror 2.0.21", + "walkdir", + "windows-link", +] + +[[package]] +name = "jni-macros" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "simd_cesu8", + "syn 2.0.119", +] + +[[package]] +name = "jni-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258" +dependencies = [ + "jni-sys 0.4.1", +] + +[[package]] +name = "jni-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2" +dependencies = [ + "jni-sys-macros", +] + +[[package]] +name = "jni-sys-macros" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" +dependencies = [ + "quote", + "syn 2.0.119", +] + +[[package]] +name = "jobserver" +version = "0.1.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3" +dependencies = [ + "getrandom 0.4.3", + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7883d941dae510fb2d978fc3fe018c71c9e2892fd38854de3e8b92c2e5ad9cc5" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + +[[package]] +name = "libc" +version = "0.2.190" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce5d3ddc6d3fa000eb1536d85e147bfe31aacaba692ed6a876f95cb7c855be78" + +[[package]] +name = "libloading" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" +dependencies = [ + "cfg-if", + "windows-link", +] + +[[package]] +name = "libm" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" + +[[package]] +name = "libredox" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61ff90caf6077a803a240f62fdbe88645a890bbca49ef8174c3cb0404362171d" +dependencies = [ + "bitflags 2.13.2", + "libc", + "plain", + "redox_syscall 0.9.4", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + +[[package]] +name = "litrs" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" + [[package]] name = "lz4_flex" version = "0.14.0" @@ -66,6 +778,25 @@ version = "2.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" +[[package]] +name = "memmap2" +version = "0.9.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1219ed1b7f229ee7104d281dd01d6802fe28bb6e95d292942c4daacdeb798c0" +dependencies = [ + "libc", +] + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", + "simd-adler32", +] + [[package]] name = "miniz_oxide" version = "0.9.1" @@ -76,6 +807,553 @@ dependencies = [ "simd-adler32", ] +[[package]] +name = "naga" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a616d2fb8c89516ac2723a581f69d6c18576046bed761bd6b305e5618e6ae130" +dependencies = [ + "arrayvec", + "bit-set", + "bitflags 2.13.2", + "cfg-if", + "cfg_aliases", + "codespan-reporting", + "half", + "hashbrown 0.17.1", + "indexmap", + "libm", + "log", + "naga-types", + "num-traits", + "once_cell", + "rustc-hash", + "spirv", + "thiserror 2.0.21", + "unicode-ident", +] + +[[package]] +name = "naga-types" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "590afbf58a6f4f62873cd5cff4468061844bafa1cdf399cc954537c22d768d49" +dependencies = [ + "hashbrown 0.17.1", + "indexmap", + "rustc-hash", + "thiserror 2.0.21", +] + +[[package]] +name = "ndk" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" +dependencies = [ + "bitflags 2.13.2", + "jni-sys 0.3.1", + "log", + "ndk-sys", + "num_enum", + "raw-window-handle", + "thiserror 1.0.69", +] + +[[package]] +name = "ndk-context" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" + +[[package]] +name = "ndk-sys" +version = "0.6.0+11769913" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873" +dependencies = [ + "jni-sys 0.3.1", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "num_enum" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26" +dependencies = [ + "num_enum_derive", + "rustversion", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "objc-sys" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310" + +[[package]] +name = "objc2" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d5490aaf8f1d7cf7688dfa9b0ce07900e168852c45cd2c03f534dfd27cfd0b" +dependencies = [ + "objc-sys", + "objc2-encode", +] + +[[package]] +name = "objc2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08849bbd4767dfae9457696856ae1c84fe4e0281bbe4a7abff2d0e06fb7981f8" +dependencies = [ + "objc2-encode", +] + +[[package]] +name = "objc2-app-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "libc", + "objc2 0.5.3", + "objc2-core-data", + "objc2-core-image", + "objc2-foundation 0.2.2", + "objc2-quartz-core 0.2.2", +] + +[[package]] +name = "objc2-cloud-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.3", + "objc2-core-location", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-contacts" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-core-data" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-core-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +dependencies = [ + "bitflags 2.13.2", + "dispatch2", + "objc2 0.6.5", +] + +[[package]] +name = "objc2-core-graphics" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" +dependencies = [ + "dispatch2", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-io-surface", +] + +[[package]] +name = "objc2-core-image" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", + "objc2-metal 0.2.2", +] + +[[package]] +name = "objc2-core-location" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.3", + "objc2-contacts", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-encode" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" + +[[package]] +name = "objc2-foundation" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "dispatch", + "libc", + "objc2 0.5.3", +] + +[[package]] +name = "objc2-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" +dependencies = [ + "bitflags 2.13.2", + "objc2 0.6.5", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-io-surface" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d" +dependencies = [ + "bitflags 2.13.2", + "objc2 0.6.5", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-link-presentation" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.3", + "objc2-app-kit", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-metal" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-metal" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0125f776a10d00af4152d74616409f0d4a2053a6f57fa5b7d6aa2854ac04794" +dependencies = [ + "bitflags 2.13.2", + "block2 0.6.2", + "objc2 0.6.5", + "objc2-foundation 0.3.2", +] + +[[package]] +name = "objc2-quartz-core" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", + "objc2-metal 0.2.2", +] + +[[package]] +name = "objc2-quartz-core" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f" +dependencies = [ + "bitflags 2.13.2", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", + "objc2-metal 0.3.2", +] + +[[package]] +name = "objc2-symbols" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a684efe3dec1b305badae1a28f6555f6ddd3bb2c2267896782858d5a78404dc" +dependencies = [ + "objc2 0.5.3", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-ui-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.3", + "objc2-cloud-kit", + "objc2-core-data", + "objc2-core-image", + "objc2-core-location", + "objc2-foundation 0.2.2", + "objc2-link-presentation", + "objc2-quartz-core 0.2.2", + "objc2-symbols", + "objc2-uniform-type-identifiers", + "objc2-user-notifications", +] + +[[package]] +name = "objc2-uniform-type-identifiers" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-user-notifications" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.3", + "objc2-core-location", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "orbclient" +version = "0.3.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5df339f526ea9a60e371768d50efc2f2508c7203290731565d1f7a6f71d21747" +dependencies = [ + "libc", + "libredox", +] + +[[package]] +name = "ordered-float" +version = "5.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c7c9e0d9b23589f26070720bac724174bfec1083e82f7854cdd0267518343c0" +dependencies = [ + "num-traits", +] + +[[package]] +name = "owned_ttf_parser" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36820e9051aca1014ddc75770aab4d68bc1e9e632f0f5627c4086bc216fb583b" +dependencies = [ + "ttf-parser", +] + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.5.18", + "smallvec", + "windows-link", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pin-project" +version = "1.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2466b2336ed02bcdca6b294417127b90ec92038d1d5c4fbeac971a922e0e0924" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c96395f0a926bc13b1c17622aaddda1ecb55d49c8f1bf9777e4d877800a43f8b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "pkg-config" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548" + +[[package]] +name = "plain" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" + +[[package]] +name = "png" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61" +dependencies = [ + "bitflags 2.13.2", + "crc32fast", + "fdeflate", + "flate2", + "miniz_oxide 0.8.9", +] + +[[package]] +name = "polling" +version = "3.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218" +dependencies = [ + "cfg-if", + "concurrent-queue", + "hermit-abi", + "pin-project-lite", + "rustix 1.1.5", + "windows-sys 0.61.2", +] + +[[package]] +name = "pollster" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f3a9f18d041e6d0e102a0a46750538147e5e8992d3b4873aaafee2520b00ce3" + +[[package]] +name = "portable-atomic" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85" + +[[package]] +name = "portable-atomic-util" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "presser" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa" + +[[package]] +name = "proc-macro-crate" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" +dependencies = [ + "toml_edit", +] + [[package]] name = "proc-macro2" version = "1.0.107" @@ -85,6 +1363,21 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "profiling" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d595e54a326bc53c1c197b32d295e14b169e3cfeaa8dc82b529f947fba6bcf5" + +[[package]] +name = "quick-xml" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e660451e55124f798a69a5af3f49ccfbefbd41910eefd25caf2393e1f3473ec1" +dependencies = [ + "memchr", +] + [[package]] name = "quote" version = "1.0.47" @@ -94,6 +1387,162 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "range-alloc" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca45419789ae5a7899559e9512e58ca889e41f04f1f2445e9f4b290ceccd1d08" + +[[package]] +name = "raw-window-handle" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" + +[[package]] +name = "raw-window-metal" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40d213455a5f1dc59214213c7330e074ddf8114c9a42411eb890c767357ce135" +dependencies = [ + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "objc2-quartz-core 0.3.2", +] + +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "redox_syscall" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "737970939a87c6fa31e7acad13307bccbb017a073b695b6089a2c484f929e20e" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "renderdoc-sys" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags 2.13.2", + "errno", + "libc", + "linux-raw-sys 0.4.15", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustix" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891efababe418670775f199f0d233d84843c227a0949a883ce15b37c78d6629d" +dependencies = [ + "bitflags 2.13.2", + "errno", + "libc", + "linux-raw-sys 0.12.1", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustversion" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "sctk-adwaita" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6277f0217056f77f1d8f49f2950ac6c278c0d607c45f5ee99328d792ede24ec" +dependencies = [ + "ab_glyph", + "log", + "memmap2", + "smithay-client-toolkit", + "tiny-skia", +] + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" + [[package]] name = "serde" version = "1.0.229" @@ -120,7 +1569,7 @@ checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 3.0.6", ] [[package]] @@ -136,12 +1585,112 @@ dependencies = [ "zmij", ] +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + [[package]] name = "simd-adler32" version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea" +[[package]] +name = "simd_cesu8" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11031e251abf8611c80f460e19dbdeb54a66db918e49c65a7065b46ac7aec520" +dependencies = [ + "rustc_version", + "simdutf8", +] + +[[package]] +name = "simdutf8" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9395f0f0eee849a9b707b2f06bb92a6a422090e2123bb2ef8e87a0e61892a8e" + +[[package]] +name = "smithay-client-toolkit" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016" +dependencies = [ + "bitflags 2.13.2", + "calloop", + "calloop-wayland-source", + "cursor-icon", + "libc", + "log", + "memmap2", + "rustix 0.38.44", + "thiserror 1.0.69", + "wayland-backend", + "wayland-client", + "wayland-csd-frame", + "wayland-cursor", + "wayland-protocols", + "wayland-protocols-wlr", + "wayland-scanner", + "xkeysym", +] + +[[package]] +name = "smol_str" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd538fb6910ac1099850255cf94a94df6551fbdd602454387d0adb2d1ca6dead" +dependencies = [ + "serde", +] + +[[package]] +name = "spirv" +version = "0.4.0+sdk-1.4.341.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9571ea910ebd84c86af4b3ed27f9dbdc6ad06f17c5f96146b2b671e2976744f" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "strict-num" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731" + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "syn" version = "3.0.6" @@ -153,22 +1702,883 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" +dependencies = [ + "thiserror-impl 2.0.21", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "tiny-skia" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83d13394d44dae3207b52a326c0c85a8bf87f1541f23b0d143811088497b09ab" +dependencies = [ + "arrayref", + "arrayvec", + "bytemuck", + "cfg-if", + "log", + "tiny-skia-path", +] + +[[package]] +name = "tiny-skia-path" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c9e7fc0c2e86a30b117d0462aa261b72b7a99b7ebd7deb3a14ceda95c5bdc93" +dependencies = [ + "arrayref", + "bytemuck", + "strict-num", +] + +[[package]] +name = "tokio" +version = "1.53.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e95f91fcc7a621e8b030f6aa23c71fe9838ae2fb4d8118b75602a328f5144044" +dependencies = [ + "pin-project-lite", +] + +[[package]] +name = "toml_datetime" +version = "1.1.1+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_edit" +version = "0.25.15+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1340ea94a5856333492c9064b02c778b191dd2c853778d9609debdcdfea3a614" +dependencies = [ + "indexmap", + "toml_datetime", + "toml_parser", + "winnow", +] + +[[package]] +name = "toml_parser" +version = "1.1.3+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d38ac1cf9b95face32296c0a3ede1fdc270627c9d9c02a7274dd6d960dc4d56" +dependencies = [ + "winnow", +] + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" + +[[package]] +name = "ttf-parser" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31" + [[package]] name = "unicode-ident" version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d245f478577f809a851594d02313b640fb437e0bb33866753cff937863096954" +[[package]] +name = "unicode-segmentation" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" + +[[package]] +name = "unicode-width" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + [[package]] name = "voxel-kernels" version = "0.1.0" +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "wasip2" +version = "1.0.4+wasi-0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb54f33acc68fd454578d9820b0bde1a1a3d17aa17bb7b6595806d02886d409" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cbab34de2d982e9b48e18d216d04c4a6f641066ff19ffb699980f591ee3610e" +dependencies = [ + "js-sys", + "tokio", + "wasm-bindgen", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e29d0c35b16e224a7eeb5cd2d25e3e1968fbd65604117b44d3b789d00ee8535" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f501a8bc3719dba86ef8ae4728879c08001bea749eb1333ac5b91e040e2a6b7" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 3.0.6", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23f0c9c52aa7cd7d77769a4cfe2a9adb1b331f489a41d912ce14513d5ab995c6" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wayland-backend" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38a91b4eaddff87b1cd1074985e3713da4af2c49742d1b356b2c01670a67a078" +dependencies = [ + "cc", + "downcast-rs", + "rustix 1.1.5", + "scoped-tls", + "smallvec", + "wayland-sys", +] + +[[package]] +name = "wayland-client" +version = "0.31.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3c36a0f861ad76d0901f2800b46321410d9f73f2ea88aac0650d86c32688073" +dependencies = [ + "bitflags 2.13.2", + "rustix 1.1.5", + "wayland-backend", + "wayland-scanner", +] + +[[package]] +name = "wayland-csd-frame" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e" +dependencies = [ + "bitflags 2.13.2", + "cursor-icon", + "wayland-backend", +] + +[[package]] +name = "wayland-cursor" +version = "0.31.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a52d18780be9b1314328a3de5f930b73d2200112e3849ca6cb11822793fb34d" +dependencies = [ + "rustix 1.1.5", + "wayland-client", + "xcursor", +] + +[[package]] +name = "wayland-protocols" +version = "0.32.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23d0c813de3daa2ed6520af85a3bd49b0e722a3078506899aa9686fea58dc4b6" +dependencies = [ + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-plasma" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b6d8cf1eb2c1c31ed1f5643c88a6e53538129d4af80030c8cabd1f9fa884d91" +dependencies = [ + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-wlr" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb04e52f7836d7c7976c78ca0250d61e33873c34156a2a1fc9474828ec268234" +dependencies = [ + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-scanner" +version = "0.31.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "338e30461b3a2b67d70eb30a6d89f8e0c93a833e07d2ae89085cd070c4a00ac0" +dependencies = [ + "proc-macro2", + "quick-xml", + "quote", +] + +[[package]] +name = "wayland-sys" +version = "0.31.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8eab23fefc9e41f8e841df4a9c707e8a8c4ed26e944ef69297184de2785e3be" +dependencies = [ + "dlib", + "log", + "once_cell", + "pkg-config", +] + +[[package]] +name = "web-sys" +version = "0.3.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88261b9deccee56594c11a3460c462c41f58d148598fe70ad77070126a68aba4" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "wgpu" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527ccdf43dd5b2e8676eed9984ce00e2bbb0a1b85b70c1969dcb6cd2eb55ab9e" +dependencies = [ + "arrayvec", + "bitflags 2.13.2", + "bytemuck", + "cfg-if", + "cfg_aliases", + "document-features", + "hashbrown 0.17.1", + "js-sys", + "log", + "parking_lot", + "portable-atomic", + "profiling", + "raw-window-handle", + "smallvec", + "static_assertions", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "wgpu-core", + "wgpu-hal", + "wgpu-types", +] + +[[package]] +name = "wgpu-core" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c018fce9b6270aa203c2fdd56f3cce996713534bd757e4ea58c8560b121f14" +dependencies = [ + "arrayvec", + "bit-set", + "bit-vec", + "bitflags 2.13.2", + "bytemuck", + "cfg_aliases", + "document-features", + "hashbrown 0.17.1", + "indexmap", + "log", + "naga", + "naga-types", + "once_cell", + "parking_lot", + "portable-atomic", + "profiling", + "raw-window-handle", + "rustc-hash", + "smallvec", + "thiserror 2.0.21", + "wgpu-core-deps-apple", + "wgpu-core-deps-windows-linux-android", + "wgpu-hal", + "wgpu-naga-bridge", + "wgpu-types", +] + +[[package]] +name = "wgpu-core-deps-apple" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "061f3d319a40d39d00b1ecc2c33b89fe21d4e6fe01859df3500a3a8ecccd6b68" +dependencies = [ + "wgpu-hal", +] + +[[package]] +name = "wgpu-core-deps-windows-linux-android" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7586165fd5f6d881cb9ce4bb71f40d6caab2c0f1837e3fc1d9788a197fb6004f" +dependencies = [ + "wgpu-hal", +] + +[[package]] +name = "wgpu-hal" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6b7fb58561a792bc237628ba0792e332de418fefe145f13b5ed8201e6d52f58" +dependencies = [ + "android_system_properties", + "arrayvec", + "ash", + "bit-set", + "bitflags 2.13.2", + "block2 0.6.2", + "bytemuck", + "cfg-if", + "cfg_aliases", + "gpu-allocator", + "hashbrown 0.17.1", + "libc", + "libloading", + "log", + "naga", + "naga-types", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", + "objc2-metal 0.3.2", + "objc2-quartz-core 0.3.2", + "once_cell", + "ordered-float", + "parking_lot", + "portable-atomic", + "portable-atomic-util", + "profiling", + "range-alloc", + "raw-window-handle", + "raw-window-metal", + "renderdoc-sys", + "smallvec", + "static_assertions", + "thiserror 2.0.21", + "wgpu-naga-bridge", + "wgpu-types", + "windows", + "windows-core", +] + +[[package]] +name = "wgpu-naga-bridge" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2f62e73117bb7a62bfd9c5a5841438a823f6566c6442a808ee269d2d055c081" +dependencies = [ + "naga", + "wgpu-types", +] + +[[package]] +name = "wgpu-types" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99dad6f1fbdbbdb4c278a6508b059d44688f5cebddf78d005a46a31340269286" +dependencies = [ + "bitflags 2.13.2", + "bytemuck", + "js-sys", + "log", + "naga-types", + "raw-window-handle", + "static_assertions", + "web-sys", +] + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "windows" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" +dependencies = [ + "windows-collections", + "windows-core", + "windows-future", + "windows-numerics", +] + +[[package]] +name = "windows-collections" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" +dependencies = [ + "windows-core", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-future" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" +dependencies = [ + "windows-core", + "windows-link", + "windows-threading", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-numerics" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" +dependencies = [ + "windows-core", + "windows-link", +] + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows-threading" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winit" +version = "0.30.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6755fa58a9f8350bd1e472d4c3fcc25f824ec358933bba33306d0b63df5978d" +dependencies = [ + "ahash", + "android-activity", + "atomic-waker", + "bitflags 2.13.2", + "block2 0.5.1", + "bytemuck", + "calloop", + "cfg_aliases", + "concurrent-queue", + "core-foundation", + "core-graphics", + "cursor-icon", + "dpi", + "js-sys", + "libc", + "memmap2", + "ndk", + "objc2 0.5.3", + "objc2-app-kit", + "objc2-foundation 0.2.2", + "objc2-ui-kit", + "orbclient", + "percent-encoding", + "pin-project", + "raw-window-handle", + "redox_syscall 0.4.1", + "rustix 0.38.44", + "sctk-adwaita", + "smithay-client-toolkit", + "smol_str", + "tracing", + "unicode-segmentation", + "wasm-bindgen", + "wasm-bindgen-futures", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-protocols-plasma", + "web-sys", + "web-time", + "windows-sys 0.52.0", + "x11-dl", + "x11rb", + "xkbcommon-dl", +] + +[[package]] +name = "winnow" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81" +dependencies = [ + "memchr", +] + +[[package]] +name = "wit-bindgen" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "x11-dl" +version = "2.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f" +dependencies = [ + "libc", + "once_cell", + "pkg-config", +] + +[[package]] +name = "x11rb" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9993aa5be5a26815fe2c3eacfc1fde061fc1a1f094bf1ad2a18bf9c495dd7414" +dependencies = [ + "as-raw-xcb-connection", + "gethostname", + "libc", + "libloading", + "once_cell", + "rustix 1.1.5", + "x11rb-protocol", +] + +[[package]] +name = "x11rb-protocol" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd" + +[[package]] +name = "xcursor" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "163b33ed8786455e2fa5d72f554057ce3f3182425434f756cd39c99839d88e23" + +[[package]] +name = "xkbcommon-dl" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d039de8032a9a8856a6be89cea3e5d12fdd82306ab7c94d74e6deab2460651c5" +dependencies = [ + "bitflags 2.13.2", + "dlib", + "log", + "once_cell", + "xkeysym", +] + +[[package]] +name = "xkeysym" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56" + [[package]] name = "xxhash-rust" version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "550a2b930b62486a393c52d5c3b84bff264b28aa437ed64694d31e93b1757af7" +[[package]] +name = "zerocopy" +version = "0.8.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6400fc4bb7426f6faac3fb07566122bb18622e3022bd2c36426a92ed489b1dbe" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99c27cc7525bad4df59a45e073c45b2c2aa820efb588234cc23a547ec69a34db" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zlib-rs" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112" + [[package]] name = "zmij" version = "1.0.23" diff --git a/Cargo.toml b/Cargo.toml index 5cc45265c..eceb96075 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace] -members = ["crates/horizon-core", "crates/horizon-world", "crates/voxel-kernels"] +members = ["crates/horizon-core", "crates/horizon-world", "crates/voxel-kernels", "crates/horizon-client"] resolver = "2" [workspace.package] diff --git a/README.md b/README.md index 9f846323b..c66931de9 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Horizon -Horizon is a Rust rewrite effort targeting one-to-one vanilla gameplay parity with Minecraft Java **26.3**, alongside client performance research. The Rust implementation has core primitives and world-data storage verified against pinned vanilla classes. It does not yet run a playable game. Existing playable downloads use Java performance packs. Not affiliated with Mojang or Microsoft. +Horizon is a Rust rewrite effort targeting one-to-one vanilla gameplay parity with Minecraft Java **26.3**, alongside client performance research. The Rust implementation has core primitives and world-data storage verified against pinned vanilla classes, plus a [native development client](docs/native-client.md) for inspecting a controlled block scene. It does not yet run a playable game. Existing playable downloads use Java performance packs. Not affiliated with Mojang or Microsoft. **First playable release:** pinned Java performance packs, distant terrain, an original frame/tick recorder, and Mac/client/server starter downloads. The M2 Pro/16 GB Mac is the first testing target. A Rust rewrite or custom renderer has not been completed; no M2 FPS improvement has been measured yet. diff --git a/benchmarks/rust-native-client-2026-10-06/startup-smoke.json b/benchmarks/rust-native-client-2026-10-06/startup-smoke.json new file mode 100644 index 000000000..9da1f902e --- /dev/null +++ b/benchmarks/rust-native-client-2026-10-06/startup-smoke.json @@ -0,0 +1,141 @@ +{ + "adapter": { + "backend": "Vulkan", + "device": 0, + "device_type": "Cpu", + "name": "llvmpipe (LLVM 21.1.8, 256 bits)", + "vendor": 65541 + }, + "arch": "x86_64", + "camera_pitch": -0.3839724354387525, + "camera_position": [ + 25.0, + 18.0, + 25.0 + ], + "camera_yaw": -2.356194490192345, + "elapsed_seconds": 0.541997659, + "error": null, + "merged_quads": 166, + "os": "linux", + "presented_frames": 30, + "project": "Horizon", + "resident_chunks": 9, + "schema": 1, + "scope": "Native opaque-cube renderer and free inspection camera; no gameplay simulation", + "window_size": [ + 1280, + 720 + ], + "executable_sha256": "4907a5678c323ab250934f3dfa32ba10e1554635f81d226ed2a88e7625737c5f", + "resource_manifest_sha256": "eda44ebee6904eab880c15458dbd1212dc2799d320a4419fc810e2ceb0e5d9d6", + "sources": { + "crates/horizon-client/src/assets.rs": "f35107193fc6d08be41891181da1803abf15bd373b62dd63758213809e2c5cbf", + "crates/horizon-client/src/camera.rs": "f9821c8a51a004dd4ad9c0952e746eb07926f6040cf8660bc26da5a0728ae572", + "crates/horizon-client/src/main.rs": "0cc250b695ba0d1e49107f581695edea1d24cdc2fb8ffa3a46368ef2c40430a7", + "crates/horizon-client/src/mesh.rs": "e2fa00435ec8239ba8a3c6539022bb50a10ff9c3850c6faab72f86aabea896ef", + "crates/horizon-client/src/render.rs": "4d58443465ea25769d73701d138db6a99c4f939a288e89e1f2b1ee3d017a2737", + "crates/horizon-client/src/world.rs": "901aa59c23ea084e926eec014589f4d511c41691a8dc1520534e039c28cfc76c", + "crates/horizon-client/src/world.wgsl": "dd7d579d0afb8a61da849171e444fa05a3e9d15bbfe6d019ff6653e8e0774c66", + "Cargo.toml": "4f803d21656a1420555bee6369617ddc825219a2cf05f842a209b3f8eaa583ec", + "Cargo.lock": "b1674833e1d5e66032589eea75643bf1c1eb2f2d6503e79ff7da8efa1b6d21dc", + "crates/horizon-client/Cargo.toml": "3047995858c9cd103ce358dfd991cb81e7d0688a149f4874cc73c36b859bbff7", + "tools/prepare_native_client.py": "b16f62acfc6242552af14ff405e2169ebba3adab12b991fc011e78edb4ffa982", + "tools/test_native_client.py": "adb9aa87cc28b0980d811ce47c1b09878d2d72cef2e083b278ec41183d231f1b" + }, + "validation": { + "rust_workspace_tests": "passed", + "clippy_all_targets": "passed", + "python_tooling_tests": 149, + "mesh_tests": 2, + "manual_visual_checks": [ + "textured scene with 81 chunks and 382 merged quads", + "window resize from 1600x1000 to 1280x720" + ], + "input_checks": [ + "physical W movement", + "physical Right rotation", + "captured relative mouse delta (150,-50) changed yaw by -0.3 and pitch by +0.1 radians", + "Escape and Ctrl+Q" + ] + }, + "environment": { + "os": "Ubuntu 26.04.1 LTS", + "kernel": "7.0.0-31-generic", + "cpu": "Intel Core i7-7500U", + "display": "headless Sway Wayland", + "renderer": "Vulkan llvmpipe software rasterizer" + }, + "limits": [ + "Controlled development scene only; no gameplay simulation or vanilla pixel-parity claim", + "No hardware FPS or render-distance improvement demonstrated", + "macOS and Windows runtime checks and final playable packages remain pending", + "Private game resources and screenshots excluded from this report" + ], + "mouse_check": { + "adapter": { + "backend": "Vulkan", + "device": 0, + "device_type": "Cpu", + "name": "llvmpipe (LLVM 21.1.8, 256 bits)", + "vendor": 65541 + }, + "arch": "x86_64", + "camera_pitch": -0.2839724354387525, + "camera_position": [ + 25.0, + 18.0, + 25.0 + ], + "camera_yaw": -2.6561944901923447, + "elapsed_seconds": 8.654220098, + "error": null, + "merged_quads": 166, + "os": "linux", + "presented_frames": 532, + "project": "Horizon", + "resident_chunks": 9, + "schema": 1, + "scope": "Native opaque-cube renderer and free inspection camera; no gameplay simulation", + "window_size": [ + 1280, + 720 + ] + }, + "physical_keyboard_check": { + "adapter": { + "backend": "Vulkan", + "device": 0, + "device_type": "Cpu", + "name": "llvmpipe (LLVM 21.1.8, 256 bits)", + "vendor": 65541 + }, + "arch": "x86_64", + "camera_pitch": -0.3839724354387525, + "camera_position": [ + 18.943610750255, + 18.0, + 18.943610750255 + ], + "camera_yaw": -2.6478875051923443, + "elapsed_seconds": 17.488515374, + "error": null, + "merged_quads": 166, + "os": "linux", + "presented_frames": 1080, + "project": "Horizon", + "resident_chunks": 9, + "schema": 1, + "scope": "Native opaque-cube renderer and free inspection camera; no gameplay simulation", + "window_size": [ + 1280, + 720 + ], + "source_note": "Same camera/input behavior; before subsequent diagnostic formatting and equivalent let-chain cleanup" + }, + "private_capture_sha256": { + "first-launch.png": "7e53fa26d3d55f943db41828e1c8dd5b65279f9a130854fff288c75a394ee5aa", + "moved-resized.png": "be5a0473ab505740d18ba8eecf1512c15ba93d53d046f49b8dfa96357b25bf22", + "mouse-look.png": "7103678309f06938de40ac294f2f9ca1f56b253bc463e792b121ba607cd7b0a3" + } +} diff --git a/crates/horizon-client/Cargo.toml b/crates/horizon-client/Cargo.toml new file mode 100644 index 000000000..a254ac79a --- /dev/null +++ b/crates/horizon-client/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "horizon-client" +version = "0.1.0" +edition.workspace = true +license.workspace = true +rust-version = "1.90" +description = "Horizon native development client" + +[dependencies] +horizon-core = { path = "../horizon-core" } +horizon-world = { path = "../horizon-world" } +wgpu = { version = "30.0.1", default-features = false, features = ["std", "parking_lot", "vulkan", "metal", "dx12", "wgsl"] } +winit = "0.30.13" +pollster = "0.4" +bytemuck = { version = "1.24", features = ["derive"] } +glam = "0.30" +png = "0.18" +serde_json = "1.0.151" diff --git a/crates/horizon-client/src/assets.rs b/crates/horizon-client/src/assets.rs new file mode 100644 index 000000000..62f83b8fe --- /dev/null +++ b/crates/horizon-client/src/assets.rs @@ -0,0 +1,223 @@ +use crate::Result; +use horizon_world::{ + DATA_VERSION, + heightmap::HeightmapState, + nbt::Tag, + registry::{BlockRegistry, BlockStateId}, + worldgen::{tags::TagDefinitions, terrain::TerrainBlockStates}, +}; +use serde_json::Value; +use std::{ + collections::BTreeSet, + fs::File, + io::{self, BufReader}, + path::Path, + sync::Arc, +}; + +pub const MATERIALS: [&str; 6] = ["bedrock", "dirt", "stone", "sand", "oak_planks", "bricks"]; +#[derive(Clone, Copy)] +pub struct StateFacts { + air: bool, + fluid: bool, + air_block: bool, + motion: bool, + no_leaves: bool, +} +impl HeightmapState for StateFacts { + fn is_air(self) -> bool { + self.air + } + fn is_air_block(self) -> bool { + self.air_block + } + fn has_fluid(self) -> bool { + self.fluid + } + fn blocks_motion_in_heightmap(self) -> bool { + self.motion + } + fn blocks_motion_in_heightmap_no_leaves(self) -> bool { + self.no_leaves + } +} +#[derive(Clone)] +pub struct Properties(Arc>); +impl TerrainBlockStates for Properties { + type State = StateFacts; + fn heightmap_state(&self, id: BlockStateId) -> StateFacts { + self.0[id.0 as usize] + } +} +pub struct Assets { + pub registry: BlockRegistry, + pub properties: Properties, + pub material_states: [BlockStateId; 6], + pub layers: Vec, + pub sprite_size: u32, + pub pixels: Vec, +} +fn invalid(message: &str) -> io::Error { + io::Error::new(io::ErrorKind::InvalidData, message) +} +fn tag(value: &Value) -> Result { + Ok(match value { + Value::String(value) => Tag::String(value.as_str().into()), + Value::Number(value) => Tag::Int(i32::try_from( + value + .as_i64() + .ok_or_else(|| invalid("invalid registry number"))?, + )?), + Value::Array(values) => Tag::List(values.iter().map(tag).collect::>()?), + Value::Object(values) => Tag::Compound( + values + .iter() + .map(|(name, value)| Ok((name.as_str().into(), tag(value)?))) + .collect::>()?, + ), + _ => return Err(invalid("unsupported registry value").into()), + }) +} +impl Assets { + pub fn load(root: &Path) -> Result { + let manifest: Value = serde_json::from_reader(BufReader::new(File::open( + root.join("horizon-resources.json"), + )?))?; + if manifest["data_version"].as_i64() != Some(i64::from(DATA_VERSION)) { + return Err(invalid("resources do not match Horizon's pinned data version").into()); + } + let facts: Value = + serde_json::from_reader(BufReader::new(File::open(root.join("facts.json"))?))?; + let states = facts["states"] + .as_array() + .ok_or_else(|| invalid("missing registry state facts"))?; + let registry = BlockRegistry::from_nbt(&Tag::compound([ + ("DataVersion", Tag::Int(DATA_VERSION)), + ( + "states", + Tag::List( + states + .iter() + .map(|state| tag(&state[4])) + .collect::>()?, + ), + ), + ("defaults", tag(&facts["defaults"])?), + ]))?; + let bundle: Value = + serde_json::from_reader(BufReader::new(File::open(root.join("block-tags.json"))?))?; + let mut definitions = TagDefinitions::default(); + for (name, text) in bundle + .as_object() + .ok_or_else(|| invalid("invalid block tag bundle"))? + { + definitions.apply_json( + name, + "vanilla", + text.as_str() + .ok_or_else(|| invalid("invalid block tag text"))?, + )?; + } + let built = + definitions.build(|name, _| facts["defaults"].get(name).map(|_| name.to_owned()))?; + if !built.missing.is_empty() { + return Err(invalid("unresolved block tags").into()); + } + let motion: BTreeSet<_> = built + .tags + .get("minecraft:blocks_motion_in_heightmap") + .ok_or_else(|| invalid("missing motion tag"))? + .iter() + .map(String::as_str) + .collect(); + let no_leaves: BTreeSet<_> = built + .tags + .get("minecraft:blocks_motion_in_heightmap_no_leaves") + .ok_or_else(|| invalid("missing no-leaves motion tag"))? + .iter() + .map(String::as_str) + .collect(); + let properties = Properties(Arc::new( + states + .iter() + .map(|state| { + Ok(StateFacts { + air: state[1] + .as_bool() + .ok_or_else(|| invalid("missing air fact"))?, + fluid: state[2] + .as_bool() + .ok_or_else(|| invalid("missing fluid fact"))?, + air_block: state[0].as_str() == Some("minecraft:air"), + motion: motion.contains( + state[0] + .as_str() + .ok_or_else(|| invalid("missing state name"))?, + ), + no_leaves: no_leaves.contains( + state[0] + .as_str() + .ok_or_else(|| invalid("missing state name"))?, + ), + }) + }) + .collect::>()?, + )); + let mut layers: Vec<_> = properties + .0 + .iter() + .map(|state| if state.air { -1 } else { -2 }) + .collect(); + let mut material_states = [BlockStateId(0); 6]; + let mut pixels = Vec::new(); + let mut sprite_size = 0; + for (layer, name) in MATERIALS.iter().enumerate() { + let state = registry + .default_state(&format!("minecraft:{name}")) + .ok_or_else(|| invalid("missing test-scene material"))?; + material_states[layer] = state; + layers[state.0 as usize] = layer as i32; + let path = root.join(format!("assets/minecraft/textures/block/{name}.png")); + let mut decoder = png::Decoder::new(BufReader::new(File::open(path)?)); + decoder + .set_transformations(png::Transformations::EXPAND | png::Transformations::STRIP_16); + let mut reader = decoder.read_info()?; + let mut bytes = vec![ + 0; + reader + .output_buffer_size() + .ok_or_else(|| invalid("sprite exceeds decoder limits"))? + ]; + let info = reader.next_frame(&mut bytes)?; + if info.width != info.height + || info.width == 0 + || (sprite_size != 0 && sprite_size != info.width) + { + return Err(invalid( + "test-client sprites must be square and use matching dimensions", + ) + .into()); + } + sprite_size = info.width; + let channels = info.color_type.samples(); + for pixel in bytes[..info.buffer_size()].chunks_exact(channels) { + let rgba = match info.color_type { + png::ColorType::Rgba => [pixel[0], pixel[1], pixel[2], pixel[3]], + png::ColorType::Rgb => [pixel[0], pixel[1], pixel[2], 255], + png::ColorType::Grayscale => [pixel[0], pixel[0], pixel[0], 255], + png::ColorType::GrayscaleAlpha => [pixel[0], pixel[0], pixel[0], pixel[1]], + _ => return Err(invalid("unsupported expanded sprite format").into()), + }; + pixels.extend(rgba); + } + } + Ok(Self { + registry, + properties, + material_states, + layers, + sprite_size, + pixels, + }) + } +} diff --git a/crates/horizon-client/src/camera.rs b/crates/horizon-client/src/camera.rs new file mode 100644 index 000000000..c0e28aae9 --- /dev/null +++ b/crates/horizon-client/src/camera.rs @@ -0,0 +1,55 @@ +//! Free inspection camera, deliberately separate from future player simulation. +use glam::{DVec3, Mat4, Vec3}; +use std::collections::HashSet; +use winit::keyboard::KeyCode; +pub struct Camera { + pub position: DVec3, + pub yaw: f64, + pub pitch: f64, +} +impl Default for Camera { + fn default() -> Self { + Self { + position: DVec3::new(25.0, 18.0, 25.0), + yaw: -135_f64.to_radians(), + pitch: -22_f64.to_radians(), + } + } +} +impl Camera { + pub fn look(&mut self, x: f64, y: f64) { + self.yaw -= x * 0.002; + self.pitch = (self.pitch - y * 0.002).clamp(-1.55, 1.55); + } + pub fn update(&mut self, keys: &HashSet, seconds: f64) { + let held = |key| f64::from(u8::from(keys.contains(&key))); + self.yaw += (held(KeyCode::ArrowLeft) - held(KeyCode::ArrowRight)) * seconds * 1.5; + self.pitch = (self.pitch + + (held(KeyCode::ArrowUp) - held(KeyCode::ArrowDown)) * seconds * 1.5) + .clamp(-1.55, 1.55); + let forward = DVec3::new(self.yaw.sin(), 0.0, self.yaw.cos()); + let right = DVec3::new(-self.yaw.cos(), 0.0, self.yaw.sin()); + let movement = forward * (held(KeyCode::KeyW) - held(KeyCode::KeyS)) + + right * (held(KeyCode::KeyD) - held(KeyCode::KeyA)) + + DVec3::Y + * (held(KeyCode::Space) - held(KeyCode::ShiftLeft) - held(KeyCode::ShiftRight)); + if movement.length_squared() > 0.0 { + self.position += movement.normalize() + * seconds + * if keys.contains(&KeyCode::ControlLeft) || keys.contains(&KeyCode::ControlRight) { + 40.0 + } else { + 12.0 + }; + } + } + pub fn matrix(&self, aspect: f32) -> Mat4 { + let forward = Vec3::new( + (self.yaw.sin() * self.pitch.cos()) as f32, + self.pitch.sin() as f32, + (self.yaw.cos() * self.pitch.cos()) as f32, + ); + Mat4::perspective_rh(70_f32.to_radians(), aspect, 0.05, 1024.0) + * Mat4::look_to_rh(self.position.as_vec3(), forward, Vec3::Y) + } +} diff --git a/crates/horizon-client/src/main.rs b/crates/horizon-client/src/main.rs new file mode 100644 index 000000000..2bcfe2a92 --- /dev/null +++ b/crates/horizon-client/src/main.rs @@ -0,0 +1,388 @@ +//! Native Horizon development client. The scene and free camera are rendering +//! tools; they do not replace the authoritative gameplay implementation. +#![forbid(unsafe_code)] +mod assets; +mod camera; +mod mesh; +mod render; +mod world; +use assets::Assets; +use camera::Camera; +use mesh::Quad; +use render::Renderer; +use std::{ + collections::HashSet, + fs, + path::PathBuf, + sync::Arc, + time::{Duration, Instant}, +}; +use winit::{ + application::ApplicationHandler, + event::{DeviceEvent, DeviceId, ElementState, MouseButton, WindowEvent}, + event_loop::{ActiveEventLoop, ControlFlow, EventLoop}, + keyboard::{KeyCode, PhysicalKey}, + window::{CursorGrabMode, Window, WindowId}, +}; +use world::TestWorld; +type Result = std::result::Result>; +struct Options { + resources: PathBuf, + radius: i32, + frames: Option, + report: Option, + timeout: Duration, + trace_input: bool, +} +impl Options { + fn read() -> Result> { + let sibling = std::env::current_exe()? + .parent() + .ok_or("missing executable directory")? + .join("resources"); + let mut options = Self { + resources: if sibling.join("horizon-resources.json").exists() { + sibling + } else { + PathBuf::from(".local/horizon-client/26.3") + }, + radius: 4, + frames: None, + report: None, + timeout: Duration::from_secs(90), + trace_input: false, + }; + let mut args = std::env::args().skip(1); + while let Some(argument) = args.next() { + if argument == "--trace-input" { + options.trace_input = true; + continue; + } + if argument == "--help" || argument == "-h" { + println!( + "Horizon native development client\n\n --resources PATH Prepared pinned resources\n --radius CHUNKS Controlled scene radius, 1..16 (default 4)\n --frames COUNT Exit after this many presented frames\n --smoke-report PATH Write a runtime report on exit\n --timeout-seconds N Deadline for a frame-limited run (default 90)\n --trace-input Log received keyboard, mouse-button and focus events\n\nControls: click to capture mouse; WASD move; Space/Shift rise/descend;\nCtrl boosts speed; arrow keys rotate; Esc releases mouse; Ctrl+Q quits; F3 shows diagnostics.\n\nThis is a controlled cube scene with a free inspection camera, not complete gameplay." + ); + return Ok(None); + } + let value = args + .next() + .ok_or_else(|| format!("missing value after {argument}"))?; + match argument.as_str() { + "--resources" => options.resources = value.into(), + "--radius" => { + options.radius = value.parse()?; + if !(1..=16).contains(&options.radius) { + return Err("radius must be 1..16 chunks".into()); + } + } + "--frames" => { + let frames = value.parse()?; + if frames == 0 { + return Err("frame count must be positive".into()); + } + options.frames = Some(frames); + } + "--smoke-report" => options.report = Some(value.into()), + "--timeout-seconds" => { + let seconds: u64 = value.parse()?; + if seconds == 0 { + return Err("timeout must be positive".into()); + } + options.timeout = Duration::from_secs(seconds); + } + _ => return Err(format!("unknown option {argument}").into()), + } + } + Ok(Some(options)) + } +} +struct App<'a> { + assets: &'a Assets, + world: TestWorld<'a>, + mesh: Vec, + options: Options, + window: Option>, + renderer: Option, + camera: Camera, + keys: HashSet, + captured: bool, + focused: bool, + diagnostics: bool, + started: Instant, + previous: Instant, + next_redraw: Instant, + title_at: Instant, + title_frames: u64, + frames: u64, + error: Option, +} +impl App<'_> { + fn fail(&mut self, event_loop: &ActiveEventLoop, error: impl ToString) { + self.error = Some(error.to_string()); + event_loop.exit(); + } + fn capture(&mut self, capture: bool) { + let Some(window) = &self.window else { + return; + }; + if capture { + self.captured = window + .set_cursor_grab(CursorGrabMode::Locked) + .or_else(|_| window.set_cursor_grab(CursorGrabMode::Confined)) + .is_ok(); + } else { + let _ = window.set_cursor_grab(CursorGrabMode::None); + self.captured = false; + } + window.set_cursor_visible(!self.captured); + } + fn write_report(&self) -> Result<()> { + let Some(path) = &self.options.report else { + return Ok(()); + }; + let renderer = self.renderer.as_ref(); + let adapter = renderer.map(|r| { + serde_json::json!({ + "name": r.info.name, + "backend": format!("{:?}", r.info.backend), + "device_type": format!("{:?}", r.info.device_type), + "vendor": r.info.vendor, + "device": r.info.device, + }) + }); + let size = self.window.as_ref().map(|window| { + let size = window.inner_size(); + [size.width, size.height] + }); + let report = serde_json::json!({ + "schema": 1, + "project": "Horizon", + "scope": "Native opaque-cube renderer and free inspection camera; no gameplay simulation", + "os": std::env::consts::OS, + "arch": std::env::consts::ARCH, + "adapter": adapter, + "window_size": size, + "presented_frames": self.frames, + "elapsed_seconds": self.started.elapsed().as_secs_f64(), + "resident_chunks": self.world.chunks.len(), + "merged_quads": self.mesh.len(), + "camera_position": self.camera.position.to_array(), + "camera_yaw": self.camera.yaw, + "camera_pitch": self.camera.pitch, + "error": self.error, + }); + if let Some(parent) = path.parent().filter(|p| !p.as_os_str().is_empty()) { + fs::create_dir_all(parent)?; + } + fs::write(path, serde_json::to_vec_pretty(&report)?)?; + Ok(()) + } +} +impl ApplicationHandler for App<'_> { + fn resumed(&mut self, event_loop: &ActiveEventLoop) { + if self.window.is_some() { + return; + } + let window = match event_loop.create_window( + Window::default_attributes() + .with_title("Horizon — Development Client") + .with_inner_size(winit::dpi::LogicalSize::new(1280.0, 800.0)), + ) { + Ok(window) => Arc::new(window), + Err(error) => { + self.fail(event_loop, error); + return; + } + }; + match pollster::block_on(Renderer::new( + window.clone(), + self.assets, + &self.mesh, + ((self.options.radius + 1) * 16) as f32, + )) { + Ok(renderer) => self.renderer = Some(renderer), + Err(error) => { + self.fail(event_loop, error); + return; + } + } + self.window = Some(window); + self.previous = Instant::now(); + self.next_redraw = self.previous; + self.title_at = self.previous; + } + fn window_event(&mut self, event_loop: &ActiveEventLoop, id: WindowId, event: WindowEvent) { + if self.options.trace_input + && matches!( + event, + WindowEvent::Focused(_) + | WindowEvent::KeyboardInput { .. } + | WindowEvent::MouseInput { .. } + ) + { + eprintln!("Horizon input: {event:?}"); + } + if self.window.as_ref().is_none_or(|window| window.id() != id) { + return; + } + match event { + WindowEvent::CloseRequested => event_loop.exit(), + WindowEvent::Resized(size) => { + if let Some(renderer) = &mut self.renderer { + renderer.resize(size.width, size.height); + } + self.next_redraw = Instant::now(); + } + WindowEvent::Focused(focused) => { + self.focused = focused; + if !focused { + self.keys.clear(); + self.capture(false); + } + self.previous = Instant::now(); + } + WindowEvent::MouseInput { + state: ElementState::Pressed, + button: MouseButton::Left, + .. + } => self.capture(true), + WindowEvent::KeyboardInput { event, .. } => { + if let PhysicalKey::Code(key) = event.physical_key { + if event.state == ElementState::Pressed { + self.keys.insert(key); + if key == KeyCode::Escape { + self.capture(false); + } + if key == KeyCode::F3 && !event.repeat { + self.diagnostics = !self.diagnostics; + if !self.diagnostics { + self.window + .as_ref() + .unwrap() + .set_title("Horizon — Development Client"); + } + } + if key == KeyCode::KeyQ + && (self.keys.contains(&KeyCode::ControlLeft) + || self.keys.contains(&KeyCode::ControlRight)) + { + event_loop.exit(); + } + } else { + self.keys.remove(&key); + } + } + } + WindowEvent::RedrawRequested => { + let now = Instant::now(); + let seconds = now.duration_since(self.previous).as_secs_f64().min(0.1); + self.previous = now; + if self.focused { + self.camera.update(&self.keys, seconds); + } + let result = self.renderer.as_mut().unwrap().render(&self.camera); + match result { + Ok(true) => { + self.frames += 1; + self.next_redraw = Instant::now(); + if self + .options + .frames + .is_some_and(|target| self.frames >= target) + { + event_loop.exit(); + } + if self.diagnostics && self.title_at.elapsed() >= Duration::from_secs(1) { + let fps = (self.frames - self.title_frames) as f64 + / self.title_at.elapsed().as_secs_f64(); + self.window.as_ref().unwrap().set_title(&format!( + "Horizon — Development | {fps:.0} FPS | {} chunks | {} quads", + self.world.chunks.len(), + self.mesh.len() + )); + self.title_at = Instant::now(); + self.title_frames = self.frames; + } + } + Ok(false) => self.next_redraw = Instant::now() + Duration::from_millis(100), + Err(error) => self.fail(event_loop, error), + } + } + _ => {} + } + } + fn device_event(&mut self, _: &ActiveEventLoop, _: DeviceId, event: DeviceEvent) { + if self.captured + && self.focused + && let DeviceEvent::MouseMotion { delta: (x, y) } = event + { + self.camera.look(x, y); + } + } + fn about_to_wait(&mut self, event_loop: &ActiveEventLoop) { + if self.options.frames.is_some() && self.started.elapsed() > self.options.timeout { + self.fail(event_loop, "frame-limited client run timed out"); + return; + } + if Instant::now() >= self.next_redraw { + if let Some(window) = &self.window { + window.request_redraw(); + } + event_loop.set_control_flow(if self.options.frames.is_some() { + ControlFlow::WaitUntil(self.started + self.options.timeout) + } else { + ControlFlow::Wait + }); + } else { + event_loop.set_control_flow(ControlFlow::WaitUntil(self.next_redraw)); + } + } +} +fn run() -> Result<()> { + let Some(options) = Options::read()? else { + return Ok(()); + }; + let assets = Assets::load(&options.resources).map_err(|error| { + format!("{error}\nPrepare pinned resources with: python3 tools/prepare_native_client.py") + })?; + let world = TestWorld::new(&assets, options.radius)?; + let mesh = mesh::build(&world)?; + eprintln!( + "Horizon development scene: {} resident chunks, {} merged cube faces.\nClick to capture mouse; WASD/Space/Shift move; arrows rotate; Esc releases; Ctrl+Q quits.", + world.chunks.len(), + mesh.len() + ); + let now = Instant::now(); + let mut app = App { + assets: &assets, + world, + mesh, + options, + window: None, + renderer: None, + camera: Camera::default(), + keys: HashSet::new(), + captured: false, + focused: true, + diagnostics: false, + started: now, + previous: now, + next_redraw: now, + title_at: now, + title_frames: 0, + frames: 0, + error: None, + }; + EventLoop::new()?.run_app(&mut app)?; + app.write_report()?; + if let Some(error) = app.error { + return Err(error.into()); + } + Ok(()) +} +fn main() { + if let Err(error) = run() { + eprintln!("Horizon: {error}"); + std::process::exit(1); + } +} diff --git a/crates/horizon-client/src/mesh.rs b/crates/horizon-client/src/mesh.rs new file mode 100644 index 000000000..4640d5f98 --- /dev/null +++ b/crates/horizon-client/src/mesh.rs @@ -0,0 +1,232 @@ +//! Greedy opaque-cube meshing for the controlled renderer scene. Model geometry, +//! weighted variants, tinting, transparency and lighting are separate work. +use crate::{Result, world::TestWorld}; +#[repr(C)] +#[derive(Clone, Copy, bytemuck::Pod, bytemuck::Zeroable)] +pub struct Quad { + pub origin: [f32; 3], + pub extent: [f32; 2], + pub face: u32, + pub layer: u32, +} +fn position(face: usize, plane: usize, u: usize, v: usize) -> [usize; 3] { + match face { + 0 | 1 => [u, plane, v], + 2 | 3 => [u, v, plane], + _ => [plane, v, u], + } +} +pub fn build(world: &TestWorld<'_>) -> Result> { + let mut quads = Vec::new(); + for &(cx, cz) in world.chunks.keys() { + let mut cells = [-1_i32; 18 * 18 * 18]; + for y in 0..18 { + for z in 0..18 { + for x in 0..18 { + cells[index(x, y, z)] = world.layer( + cx * 16 + x as i32 - 1, + y as i32 - 1, + cz * 16 + z as i32 - 1, + )?; + } + } + } + mesh_chunk(&cells, cx, cz, &mut quads); + } + Ok(quads) +} +fn index(x: usize, y: usize, z: usize) -> usize { + x + 18 * (z + 18 * y) +} +fn mesh_chunk(cells: &[i32; 18 * 18 * 18], cx: i32, cz: i32, quads: &mut Vec) { + for face in 0..6 { + for plane in 0..16 { + let mut mask = [-1_i32; 256]; + for v in 0..16 { + for u in 0..16 { + let p = position(face, plane + 1, u + 1, v + 1); + let layer = cells[index(p[0], p[1], p[2])]; + let mut adjacent = p; + let axis = match face { + 0 | 1 => 1, + 2 | 3 => 2, + _ => 0, + }; + if face % 2 == 0 { + adjacent[axis] -= 1; + } else { + adjacent[axis] += 1; + } + if layer >= 0 && cells[index(adjacent[0], adjacent[1], adjacent[2])] < 0 { + mask[u + v * 16] = layer; + } + } + } + for v in 0..16 { + let mut u = 0; + while u < 16 { + let layer = mask[u + v * 16]; + if layer < 0 { + u += 1; + continue; + } + let mut width = 1; + while u + width < 16 && mask[u + width + v * 16] == layer { + width += 1; + } + let mut height = 1; + while v + height < 16 + && (u..u + width).all(|x| mask[x + (v + height) * 16] == layer) + { + height += 1; + } + for y in v..v + height { + for x in u..u + width { + mask[x + y * 16] = -1; + } + } + let p = position(face, plane + usize::from(face % 2 == 1), u, v); + quads.push(Quad { + origin: [ + (cx * 16 + p[0] as i32) as f32, + p[1] as f32, + (cz * 16 + p[2] as i32) as f32, + ], + extent: [width as f32, height as f32], + face: face as u32, + layer: layer as u32, + }); + u += width; + } + } + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + use std::collections::BTreeSet; + + // Compare rectangles expanded to unit faces against direct voxel adjacency. + // The reference does not use the mesher's plane masks or coordinate helper. + fn verify(cells: &[i32; 18 * 18 * 18], cx: i32, cz: i32) -> Vec { + let mut expected = BTreeSet::new(); + let directions = [ + [0, -1, 0], + [0, 1, 0], + [0, 0, -1], + [0, 0, 1], + [-1, 0, 0], + [1, 0, 0], + ]; + for y in 1..=16 { + for z in 1..=16 { + for x in 1..=16 { + let layer = cells[index(x, y, z)]; + if layer < 0 { + continue; + } + for (face, [dx, dy, dz]) in directions.iter().enumerate() { + let neighbor = [ + (x as i32 + dx) as usize, + (y as i32 + dy) as usize, + (z as i32 + dz) as usize, + ]; + if cells[index(neighbor[0], neighbor[1], neighbor[2])] < 0 { + expected.insert(( + x as i32 - 1 + cx * 16, + y as i32 - 1, + z as i32 - 1 + cz * 16, + face as u32, + layer as u32, + )); + } + } + } + } + } + let mut quads = Vec::new(); + mesh_chunk(cells, cx, cz, &mut quads); + let mut actual = BTreeSet::new(); + for quad in &quads { + assert!( + quad.extent + .iter() + .all(|&e| (1.0..=16.0).contains(&e) && e.fract() == 0.0) + ); + for v in 0..quad.extent[1] as i32 { + for u in 0..quad.extent[0] as i32 { + let [x, y, z] = quad.origin.map(|n| n as i32); + let (x, y, z) = match quad.face { + 0 => (x + u, y, z + v), + 1 => (x + u, y - 1, z + v), + 2 => (x + u, y + v, z), + 3 => (x + u, y + v, z - 1), + 4 => (x, y + v, z + u), + 5 => (x - 1, y + v, z + u), + _ => panic!("invalid face"), + }; + assert!( + actual.insert((x, y, z, quad.face, quad.layer)), + "overlapping faces" + ); + } + } + } + assert_eq!(actual, expected); + quads + } + + #[test] + fn empty_solid_and_neighbor_seams() { + let mut cells = [-1; 18 * 18 * 18]; + assert!(verify(&cells, 0, 0).is_empty()); + for y in 1..=16 { + for z in 1..=16 { + for x in 1..=16 { + cells[index(x, y, z)] = 3; + } + } + } + assert_eq!(verify(&cells, -3, 2).len(), 6); + // A solid neighbor removes only the shared boundary, including corners. + for y in 1..=16 { + for z in 1..=16 { + cells[index(17, y, z)] = 4; + } + } + assert_eq!(verify(&cells, -3, 2).len(), 5); + cells.fill(3); + assert!(verify(&cells, 1, -2).is_empty()); + } + + #[test] + fn cavities_material_boundaries_and_random_neighbors() { + let mut state = 0x183d_994e_058b_9432_u64; + for pattern in 0..12 { + let mut cells = [-1; 18 * 18 * 18]; + for y in 0..18 { + for z in 0..18 { + for x in 0..18 { + state ^= state << 13; + state ^= state >> 7; + state ^= state << 17; + cells[index(x, y, z)] = match pattern { + 0 => { + if x == 8 && y == 8 && z == 8 { + -1 + } else { + 0 + } + } + 1 => ((x + y + z) % 3) as i32, + _ => (state % 7) as i32 - 1, + }; + } + } + } + verify(&cells, pattern - 6, 3 - pattern); + } + } +} diff --git a/crates/horizon-client/src/render.rs b/crates/horizon-client/src/render.rs new file mode 100644 index 000000000..fb4a850f8 --- /dev/null +++ b/crates/horizon-client/src/render.rs @@ -0,0 +1,303 @@ +use crate::{Result, assets::Assets, camera::Camera, mesh::Quad}; +use std::sync::Arc; +use wgpu::util::DeviceExt; +use winit::window::Window; +#[repr(C)] +#[derive(Clone, Copy, bytemuck::Pod, bytemuck::Zeroable)] +struct Uniforms { + matrix: [[f32; 4]; 4], + position: [f32; 4], + fog: [f32; 4], +} +pub struct Renderer { + instance: wgpu::Instance, + surface: wgpu::Surface<'static>, + window: Arc, + device: wgpu::Device, + queue: wgpu::Queue, + config: wgpu::SurfaceConfiguration, + pipeline: wgpu::RenderPipeline, + group: wgpu::BindGroup, + uniform: wgpu::Buffer, + quads: wgpu::Buffer, + depth: wgpu::TextureView, + pub quad_count: u32, + pub info: wgpu::AdapterInfo, + pub suspended: bool, + fog_distance: f32, +} +impl Renderer { + pub async fn new( + window: Arc, + assets: &Assets, + quads: &[Quad], + fog_distance: f32, + ) -> Result { + let instance = + wgpu::Instance::new(wgpu::InstanceDescriptor::new_without_display_handle_from_env()); + let surface = instance.create_surface(window.clone())?; + let adapter = instance + .request_adapter(&wgpu::RequestAdapterOptions { + power_preference: wgpu::PowerPreference::HighPerformance, + compatible_surface: Some(&surface), + force_fallback_adapter: false, + ..Default::default() + }) + .await?; + let info = adapter.get_info(); + eprintln!( + "Horizon renderer: {} ({:?}, {:?})", + info.name, info.backend, info.device_type + ); + let (device, queue) = adapter + .request_device(&wgpu::DeviceDescriptor { + label: Some("Horizon device"), + ..Default::default() + }) + .await?; + let size = window.inner_size(); + let mut config = surface + .get_default_config(&adapter, size.width.max(1), size.height.max(1)) + .ok_or("surface has no supported configuration")?; + let caps = surface.get_capabilities(&adapter); + config.format = caps + .formats + .iter() + .copied() + .find(wgpu::TextureFormat::is_srgb) + .unwrap_or(config.format); + config.present_mode = wgpu::PresentMode::Fifo; + surface.configure(&device, &config); + let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor { + label: Some("Horizon cube renderer"), + source: wgpu::ShaderSource::Wgsl(include_str!("world.wgsl").into()), + }); + let attributes = wgpu::vertex_attr_array![0=>Float32x3,1=>Float32x2,2=>Uint32,3=>Uint32]; + let pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor { + label: Some("Horizon opaque cubes"), + layout: None, + vertex: wgpu::VertexState { + module: &shader, + entry_point: Some("vs_main"), + compilation_options: Default::default(), + buffers: &[Some(wgpu::VertexBufferLayout { + array_stride: std::mem::size_of::() as u64, + step_mode: wgpu::VertexStepMode::Instance, + attributes: &attributes, + })], + }, + primitive: wgpu::PrimitiveState { + cull_mode: Some(wgpu::Face::Back), + ..Default::default() + }, + depth_stencil: Some(wgpu::DepthStencilState { + format: wgpu::TextureFormat::Depth32Float, + depth_write_enabled: Some(true), + depth_compare: Some(wgpu::CompareFunction::Less), + stencil: Default::default(), + bias: Default::default(), + }), + multisample: Default::default(), + fragment: Some(wgpu::FragmentState { + module: &shader, + entry_point: Some("fs_main"), + compilation_options: Default::default(), + targets: &[Some(wgpu::ColorTargetState { + format: config.format, + blend: None, + write_mask: wgpu::ColorWrites::ALL, + })], + }), + multiview_mask: None, + cache: None, + }); + let uniform = device.create_buffer(&wgpu::BufferDescriptor { + label: Some("Horizon camera"), + size: std::mem::size_of::() as u64, + usage: wgpu::BufferUsages::UNIFORM | wgpu::BufferUsages::COPY_DST, + mapped_at_creation: false, + }); + let texture = device.create_texture_with_data( + &queue, + &wgpu::TextureDescriptor { + label: Some("Pinned cube sprites"), + size: wgpu::Extent3d { + width: assets.sprite_size, + height: assets.sprite_size, + depth_or_array_layers: assets.material_states.len() as u32, + }, + mip_level_count: 1, + sample_count: 1, + dimension: wgpu::TextureDimension::D2, + format: wgpu::TextureFormat::Rgba8UnormSrgb, + usage: wgpu::TextureUsages::TEXTURE_BINDING | wgpu::TextureUsages::COPY_DST, + view_formats: &[], + }, + wgpu::util::TextureDataOrder::LayerMajor, + &assets.pixels, + ); + let view = texture.create_view(&wgpu::TextureViewDescriptor { + dimension: Some(wgpu::TextureViewDimension::D2Array), + ..Default::default() + }); + let sampler = device.create_sampler(&wgpu::SamplerDescriptor { + label: Some("Repeating nearest cube sprites"), + address_mode_u: wgpu::AddressMode::Repeat, + address_mode_v: wgpu::AddressMode::Repeat, + mag_filter: wgpu::FilterMode::Nearest, + min_filter: wgpu::FilterMode::Nearest, + ..Default::default() + }); + let group = device.create_bind_group(&wgpu::BindGroupDescriptor { + label: Some("Horizon world resources"), + layout: &pipeline.get_bind_group_layout(0), + entries: &[ + wgpu::BindGroupEntry { + binding: 0, + resource: uniform.as_entire_binding(), + }, + wgpu::BindGroupEntry { + binding: 1, + resource: wgpu::BindingResource::TextureView(&view), + }, + wgpu::BindGroupEntry { + binding: 2, + resource: wgpu::BindingResource::Sampler(&sampler), + }, + ], + }); + let quad_count = u32::try_from(quads.len())?; + let quads = device.create_buffer_init(&wgpu::util::BufferInitDescriptor { + label: Some("Greedy cube faces"), + contents: bytemuck::cast_slice(quads), + usage: wgpu::BufferUsages::VERTEX, + }); + let depth = Self::depth(&device, &config); + Ok(Self { + instance, + surface, + window, + device, + queue, + config, + pipeline, + group, + uniform, + quads, + depth, + quad_count, + info, + suspended: size.width == 0 || size.height == 0, + fog_distance, + }) + } + fn depth(device: &wgpu::Device, config: &wgpu::SurfaceConfiguration) -> wgpu::TextureView { + device + .create_texture(&wgpu::TextureDescriptor { + label: Some("Horizon depth"), + size: wgpu::Extent3d { + width: config.width, + height: config.height, + depth_or_array_layers: 1, + }, + mip_level_count: 1, + sample_count: 1, + dimension: wgpu::TextureDimension::D2, + format: wgpu::TextureFormat::Depth32Float, + usage: wgpu::TextureUsages::RENDER_ATTACHMENT, + view_formats: &[], + }) + .create_view(&Default::default()) + } + pub fn resize(&mut self, width: u32, height: u32) { + self.suspended = width == 0 || height == 0; + if self.suspended { + return; + } + self.config.width = width; + self.config.height = height; + self.surface.configure(&self.device, &self.config); + self.depth = Self::depth(&self.device, &self.config); + } + pub fn render(&mut self, camera: &Camera) -> Result { + if self.suspended { + return Ok(false); + } + let (frame, reconfigure) = match self.surface.get_current_texture() { + wgpu::CurrentSurfaceTexture::Success(frame) => (frame, false), + wgpu::CurrentSurfaceTexture::Suboptimal(frame) => (frame, true), + wgpu::CurrentSurfaceTexture::Timeout | wgpu::CurrentSurfaceTexture::Occluded => { + return Ok(false); + } + wgpu::CurrentSurfaceTexture::Outdated => { + self.surface.configure(&self.device, &self.config); + return Ok(false); + } + wgpu::CurrentSurfaceTexture::Lost => { + self.surface = self.instance.create_surface(self.window.clone())?; + self.surface.configure(&self.device, &self.config); + return Ok(false); + } + wgpu::CurrentSurfaceTexture::Validation => { + return Err("surface acquisition failed validation".into()); + } + }; + let fog = [0.35, 0.55, 0.80, 1.0]; + let p = camera.position.as_vec3(); + let uniforms = Uniforms { + matrix: camera + .matrix(self.config.width as f32 / self.config.height as f32) + .to_cols_array_2d(), + position: [p.x, p.y, p.z, self.fog_distance], + fog, + }; + self.queue + .write_buffer(&self.uniform, 0, bytemuck::bytes_of(&uniforms)); + let view = frame.texture.create_view(&Default::default()); + let mut encoder = self + .device + .create_command_encoder(&wgpu::CommandEncoderDescriptor { + label: Some("Horizon frame"), + }); + { + let attachments = [Some(wgpu::RenderPassColorAttachment { + view: &view, + resolve_target: None, + depth_slice: None, + ops: wgpu::Operations { + load: wgpu::LoadOp::Clear(wgpu::Color { + r: f64::from(fog[0]), + g: f64::from(fog[1]), + b: f64::from(fog[2]), + a: 1.0, + }), + store: wgpu::StoreOp::Store, + }, + })]; + let mut pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor { + label: Some("Horizon world"), + color_attachments: &attachments, + depth_stencil_attachment: Some(wgpu::RenderPassDepthStencilAttachment { + view: &self.depth, + depth_ops: Some(wgpu::Operations { + load: wgpu::LoadOp::Clear(1.0), + store: wgpu::StoreOp::Discard, + }), + stencil_ops: None, + }), + ..Default::default() + }); + pass.set_pipeline(&self.pipeline); + pass.set_bind_group(0, &self.group, &[]); + pass.set_vertex_buffer(0, self.quads.slice(..)); + pass.draw(0..6, 0..self.quad_count); + } + self.queue.submit([encoder.finish()]); + self.window.pre_present_notify(); + self.queue.present(frame); + if reconfigure { + self.surface.configure(&self.device, &self.config); + } + Ok(true) + } +} diff --git a/crates/horizon-client/src/world.rs b/crates/horizon-client/src/world.rs new file mode 100644 index 000000000..036251865 --- /dev/null +++ b/crates/horizon-client/src/world.rs @@ -0,0 +1,96 @@ +//! A controlled opaque-cube scene for exercising the native renderer. This is +//! not the vanilla world generator or an authoritative gameplay simulation. +use crate::{ + Result, + assets::{Assets, Properties}, +}; +use horizon_core::position::ChunkPos; +use horizon_world::{registry::BlockStateId, worldgen::terrain::TerrainChunk}; +use std::collections::BTreeMap; + +pub struct TestWorld<'a> { + pub chunks: BTreeMap<(i32, i32), TerrainChunk<'a, Properties>>, + assets: &'a Assets, + air: BlockStateId, +} +impl<'a> TestWorld<'a> { + pub fn new(assets: &'a Assets, radius: i32) -> Result { + let air = assets + .registry + .default_state("minecraft:air") + .ok_or("missing air state")?; + let mut world = Self { + chunks: BTreeMap::new(), + assets, + air, + }; + for cz in -radius..=radius { + for cx in -radius..=radius { + let mut chunk = TerrainChunk::new( + ChunkPos::new(cx, cz), + 0, + 16, + &assets.registry, + assets.properties.clone(), + )?; + for z in 0..16 { + for x in 0..16 { + for y in 0..4 { + let layer = match y { + 0 => 0, + 1 | 2 => 1, + _ => { + if (cx + cz) & 1 == 0 { + 2 + } else { + 3 + } + } + }; + chunk.set_block_worldgen( + cx * 16 + x, + y, + cz * 16 + z, + assets.material_states[layer], + )?; + } + } + } + world.chunks.insert((cx, cz), chunk); + } + } + for y in 4..11 { + for z in -10_i32..=10 { + for x in -10_i32..=10 { + if x.abs().max(z.abs()) <= 10 - (y - 4) { + world.set( + x, + y, + z, + assets.material_states[if y & 1 == 0 { 4 } else { 5 }], + )?; + } + } + } + } + Ok(world) + } + fn set(&mut self, x: i32, y: i32, z: i32, state: BlockStateId) -> Result<()> { + self.chunks + .get_mut(&(x >> 4, z >> 4)) + .ok_or("test scene exceeds resident chunks")? + .set_block_worldgen(x, y, z, state)?; + Ok(()) + } + pub fn layer(&self, x: i32, y: i32, z: i32) -> Result { + let state = self + .chunks + .get(&(x >> 4, z >> 4)) + .map_or(self.air, |chunk| chunk.block(x, y, z)); + let layer = self.assets.layers[state.0 as usize]; + if layer == -2 { + return Err("test scene contains an unsupported non-cube material".into()); + } + Ok(layer) + } +} diff --git a/crates/horizon-client/src/world.wgsl b/crates/horizon-client/src/world.wgsl new file mode 100644 index 000000000..4899d5a84 --- /dev/null +++ b/crates/horizon-client/src/world.wgsl @@ -0,0 +1,42 @@ +struct Camera { + view_projection: mat4x4, + position: vec4, + fog: vec4, +} +@group(0) @binding(0) var camera: Camera; +@group(0) @binding(1) var sprites: texture_2d_array; +@group(0) @binding(2) var sprite_sampler: sampler; +struct VertexOut { + @builtin(position) clip: vec4, + @location(0) uv: vec2, + @location(1) @interpolate(flat) layer: u32, + @location(2) shade: f32, + @location(3) world_position: vec3, +} +@vertex fn vs_main(@builtin(vertex_index) vertex: u32, + @location(0) origin: vec3, @location(1) extent: vec2, + @location(2) face: u32, @location(3) layer: u32) -> VertexOut { + let corners = array,4>(vec2(0.0,0.0),vec2(1.0,0.0),vec2(1.0,1.0),vec2(0.0,1.0)); + let normal_order = array(0u,1u,2u,0u,2u,3u); + let reversed_order = array(0u,2u,1u,0u,3u,2u); + let flipped = face==1u || face==2u || face==5u; + let corner = corners[select(normal_order[vertex],reversed_order[vertex],flipped)]; + let offset = corner*extent; + var position = origin; + if face<2u { position+=vec3(offset.x,0.0,offset.y); } + else if face<4u { position+=vec3(offset.x,offset.y,0.0); } + else { position+=vec3(0.0,offset.y,offset.x); } + var output: VertexOut; + output.clip=camera.view_projection*vec4(position,1.0); + output.uv=vec2(offset.x,extent.y-offset.y); + output.layer=layer; + output.shade=select(select(0.8,0.6,face>=4u),select(0.5,1.0,face==1u),face<2u); + output.world_position=position; + return output; +} +@fragment fn fs_main(input:VertexOut)->@location(0) vec4 { + let color=textureSample(sprites,sprite_sampler,input.uv,i32(input.layer)); + let distance=length(input.world_position-camera.position.xyz); + let fog_amount=smoothstep(camera.position.w*0.65,camera.position.w,distance); + return vec4(mix(color.rgb*input.shade,camera.fog.rgb,fog_amount),1.0); +} diff --git a/docs/native-client.md b/docs/native-client.md new file mode 100644 index 000000000..e33c222e2 --- /dev/null +++ b/docs/native-client.md @@ -0,0 +1,79 @@ +# Horizon native development client + +`horizon-client` opens a native Rust window and renders a controlled block scene +stored in Horizon's resident chunks. It loads six opaque cube textures and the +block registry from the pinned Java Edition 26.3 resources. A padded chunk mesh +culls hidden faces across chunk boundaries and merges adjacent matching faces; +the GPU draws the rectangles as instances. The camera is a free inspection tool. + +This checkpoint has no player simulation, vanilla world generation, block +interaction, inventory, sound, networking or world save/load. It does not meet +the [playable-build acceptance criteria](rust-parity.md#completion-criteria-and-playable-builds). +Full block models, weighted variants, texture orientation, transparency, tinting, +light, resource packs, chunk streaming and visual parity remain unfinished. + +## Run from a checkout + +Use current stable Rust (the locked client dependencies require Rust 1.90 or +newer), Python 3.10+ and JDK 25. A native desktop display and compatible graphics +driver are required. Resource preparation verifies the pinned game artifacts, +exports the registry using the reference server, and extracts selected client +resources into ignored `.local/horizon-client/26.3/`. + +```sh +python3 tools/prepare_native_client.py --prepare +cargo +stable run --locked -p horizon-client +``` + +Java is used during preparation. The native executable itself runs without a +JVM. Prepared resources stay private; do not commit or publish the extracted game +files. Final distributable builds still need resource provisioning and packaging. + +Use `--resources PATH` for a prepared resource directory. The executable also +looks for a sibling `resources/` directory before the checkout default. Use +`--radius N` to select 1–16 chunks around the origin; this is a finite test scene, +not a render-distance or world-streaming implementation. + +| Control | Action | +| --- | --- | +| WASD | Move horizontally | +| Space / either Shift | Rise / descend | +| Either Ctrl | Boost inspection speed | +| Arrow keys | Rotate camera | +| Left click | Capture mouse for camera rotation | +| Escape | Release mouse | +| F3 | Toggle FPS/chunk/mesh diagnostics in the window title | +| Ctrl+Q or window close | Exit | + +Controls bind physical keyboard positions. Losing focus clears held keys and +releases the mouse. `--trace-input` logs keyboard, mouse-button and focus events +for diagnosis. On headless Linux use `vscreen run ./target/debug/horizon-client`, +then `vscreen shot`. The `wtype` tool's default generated keymap does not preserve +physical key positions; typing the character W can report physical Escape. + +## Validation + +```sh +cargo +stable test -p horizon-client +cargo +stable clippy --workspace --all-targets -- -D warnings +python3 tools/test_native_client.py +# Headless Linux alternative: +python3 tools/test_native_client.py --vscreen +``` + +The mesh tests compare expanded rectangles against independently enumerated +exposed voxel faces, including solid neighbors, cavities, material boundaries, +negative chunk origins and random surroundings. The startup runner launches a +nine-chunk scene, requires 30 presented frames and a clean exit, and writes GPU, +platform, binary and source information to ignored +`.local/horizon-client/startup-smoke.json`. It has an external timeout as well as +the application's frame deadline. These checks do not establish gameplay or +pixel parity with Java. + +Initial local validation uses Linux x86_64, a headless Wayland compositor and +Vulkan llvmpipe software rendering. Textured geometry and resizing were visually +inspected; movement, arrow rotation and Ctrl+Q were exercised using virtual +physical key codes. Captured relative mouse movement and Escape release were +exercised through a virtual pointer. Native macOS/Metal and +Windows/Direct3D 12 runtime tests remain pending. Software-renderer frame rates +are not evidence of a hardware speedup. diff --git a/docs/rust-parity.md b/docs/rust-parity.md index a80fb59c6..fd3c58d77 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -2,7 +2,9 @@ The behavior target is the repository's pinned **Minecraft Java Edition 26.3**. One-to-one vanilla gameplay parity is the acceptance criterion. It has **not** -been reached: Horizon's Rust code does not yet run a client, server, or simulation. +been reached. Horizon now has a [native development client](native-client.md) +that renders a controlled block scene with a free camera. It does not run a +complete game server or gameplay simulation. The Rust workspace implements core arithmetic/random streams, world data and resident sections, scheduled tick ordering, geometry, contained fluid states, noise/density evaluation, biome and terrain generation kernels, material rules, @@ -78,7 +80,9 @@ Negative lengths and the complete Java object/API surface are not supported. ## Reproduce validation -Requires Rust 1.85 or newer, Python 3.10 or newer, and JDK 25. From the checkout: +The core/world libraries require Rust 1.85 or newer; the native client's locked +dependencies require Rust 1.90 or newer. Use current stable Rust, Python 3.10 or +newer, and JDK 25 for the complete workspace. From the checkout: ```sh cargo test --workspace diff --git a/tools/prepare_native_client.py b/tools/prepare_native_client.py new file mode 100644 index 000000000..c670ce65f --- /dev/null +++ b/tools/prepare_native_client.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python3 +"""Prepare private pinned resources for Horizon's native development client.""" +import argparse +import json +import os +from pathlib import Path +import subprocess +import zipfile +try: + from . import lab, test_rust_parity as base, test_worldgen_parity as worldgen +except ImportError: + import lab + import test_rust_parity as base + import test_worldgen_parity as worldgen + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--prepare', action='store_true', help='Fetch pinned reference artifacts first') + args = parser.parse_args() + if args.prepare: + lab.prepare() + lock, jars, libraries = base.verify_artifacts() + root = lab.LOCAL / 'horizon-client' / lock['minecraft']['version'] + root.mkdir(parents=True, exist_ok=True) + facts = root / 'facts.json' + manifest = root / 'horizon-resources.json' + oracle = lab.ROOT / 'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java' + origin = {'minecraft': lock['minecraft']['version'], + 'client_sha256': lab.digest(jars['client'], 'sha256'), + 'server_sha256': lab.digest(jars['server'], 'sha256'), + 'exporter_sha256': lab.digest(oracle, 'sha256')} + previous = json.loads(manifest.read_text()) if manifest.exists() else {} + if not (all(previous.get(k) == v for k, v in origin.items()) and facts.exists() + and previous.get('facts_sha256') == lab.digest(facts, 'sha256')): + classes = root / 'classes' + classes.mkdir(exist_ok=True) + dependencies = os.pathsep.join(map(str, [jars['server'], *libraries])) + with (root / 'export.log').open('w') as log: + subprocess.run(['javac', '--release', str(lock['minecraft']['java_major']), '-proc:none', + '-cp', dependencies, '-d', str(classes), str(oracle)], check=True, + stdout=log, stderr=subprocess.STDOUT, timeout=3600) + subprocess.run(['java', '-Xmx512M', '-cp', str(classes) + os.pathsep + dependencies, + 'dev.horizonlab.parity.VanillaHeightmapOracle', 'export', str(facts)], + check=True, stdout=log, stderr=subprocess.STDOUT, timeout=3600) + tags = worldgen.tag_resources(jars['server']) + if tags != worldgen.tag_resources(jars['client']): + raise ValueError('Reference block tags disagree') + lab.write_json(root / 'block-tags.json', tags) + count = 0 + prefixes = ('assets/minecraft/blockstates/', 'assets/minecraft/models/block/', + 'assets/minecraft/textures/block/') + with zipfile.ZipFile(jars['client']) as archive: + version = json.loads(archive.read('version.json')) + for name in archive.namelist(): + if not name.startswith(prefixes) or name.endswith('/'): + continue + relative = Path(name) + if relative.is_absolute() or '..' in relative.parts: + raise ValueError('Invalid resource path') + target = root / relative + data = archive.read(name) + if not target.exists() or target.read_bytes() != data: + target.parent.mkdir(parents=True, exist_ok=True) + target.write_bytes(data) + count += 1 + lab.write_json(manifest, {'schema': 1, **origin, 'data_version': version['world_version'], + 'facts_sha256': lab.digest(facts, 'sha256'), + 'block_tags_sha256': lab.digest(root / 'block-tags.json', 'sha256'), 'resource_files': count}) + print(f'Prepared Horizon native-client resources: {root}') + + +if __name__ == '__main__': + main() diff --git a/tools/test_native_client.py b/tools/test_native_client.py new file mode 100644 index 000000000..c59b8e63c --- /dev/null +++ b/tools/test_native_client.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python3 +"""Launch the Rust development scene and check bounded GPU presentation. + +Requires prepared private resources and a desktop display (or --vscreen on +headless Linux). This is a renderer startup check, not a gameplay parity gate. +""" +import argparse +import json +import os +from pathlib import Path +import subprocess +import sys + +try: + from . import lab +except ImportError: + import lab + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--vscreen', action='store_true') + parser.add_argument('--prepare', action='store_true') + args = parser.parse_args() + if args.prepare: + subprocess.run([sys.executable, str(lab.ROOT / 'tools/prepare_native_client.py'), + '--prepare'], cwd=lab.ROOT, check=True) + root = lab.LOCAL / 'horizon-client' + root.mkdir(parents=True, exist_ok=True) + report = root / 'startup-smoke.json' + report.unlink(missing_ok=True) + environment = dict(os.environ, RUSTUP_TOOLCHAIN='stable') + subprocess.run(['cargo', 'build', '--locked', '-p', 'horizon-client'], + cwd=lab.ROOT, env=environment, check=True, timeout=3600) + metadata = json.loads(subprocess.check_output( + ['cargo', 'metadata', '--locked', '--no-deps', '--format-version', '1'], + cwd=lab.ROOT, env=environment)) + executable = Path(metadata['target_directory']) / 'debug' / ( + 'horizon-client.exe' if os.name == 'nt' else 'horizon-client') + command = (['vscreen', 'run'] if args.vscreen else []) + [ + str(executable), '--radius', '1', '--frames', '30', + '--smoke-report', str(report), '--timeout-seconds', '60'] + with (root / 'startup-smoke.log').open('w') as log: + subprocess.run(command, cwd=lab.ROOT, env=environment, check=True, + stdout=log, stderr=subprocess.STDOUT, timeout=120) + result = json.loads(report.read_text()) + if (result.get('error') is not None or result.get('presented_frames') != 30 + or result.get('resident_chunks') != 9 or result.get('merged_quads', 0) <= 0 + or not result.get('adapter') or min(result.get('window_size', [0])) <= 0): + raise RuntimeError('Incomplete native client presentation: ' + str(report)) + result['executable_sha256'] = lab.digest(executable, 'sha256') + result['resource_manifest_sha256'] = lab.digest( + root / '26.3/horizon-resources.json', 'sha256') + result['sources'] = { + str(path.relative_to(lab.ROOT)): lab.digest(path, 'sha256') + for path in sorted((lab.ROOT / 'crates/horizon-client/src').glob('*')) + if path.is_file() + } + lab.write_json(report, result) + print(f'Native renderer startup passed: {report}') + + +if __name__ == '__main__': + main() From 32ad4ba6aaaa0520cc7b5f0e129287abe4dcbbf5 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 19:31:11 +0200 Subject: [PATCH 042/253] Apply live chunk-upgrade permissions and retained biome status --- .../scoped-parity.json | 219 ++++++++++++++++++ .../scoped-parity.json | 214 +++++++++++++++++ .../examples/chunk_stage_fixture.rs | 5 +- .../examples/feature_region_fixture.rs | 102 +++++++- .../src/worldgen/feature_region.rs | 52 +++-- crates/horizon-world/src/worldgen/terrain.rs | 9 + crates/horizon-world/tests/feature_region.rs | 95 ++++++++ docs/rust-parity.md | 30 ++- .../parity/VanillaChunkStageOracle.java | 2 +- .../parity/VanillaFeatureRegionOracle.java | 32 +++ tools/test_feature_region_parity.py | 4 +- tools/test_retrogen_chunk_parity.py | 2 +- 12 files changed, 734 insertions(+), 32 deletions(-) create mode 100644 benchmarks/rust-live-upgrade-region-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-retained-upgrade-status-2026-10-06/scoped-parity.json diff --git a/benchmarks/rust-live-upgrade-region-2026-10-06/scoped-parity.json b/benchmarks/rust-live-upgrade-region-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..d752388e3 --- /dev/null +++ b/benchmarks/rust-live-upgrade-region-2026-10-06/scoped-parity.json @@ -0,0 +1,219 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "block_states": 35723, + "direct_state_probes": 35723, + "write_zone_cases": 20125, + "upgrade_height_cases": 10098, + "upgrade_lifecycle_cases": 54, + "block_tag_files": 300, + "fixtures": 192, + "worldgen_random_modes": [ + false, + true + ], + "resident_chunks_per_fixture": 9, + "requested_placements": 3456, + "direct_tick_requests": 14784, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureRegionOracle.java": "3af9440fa50b0c42a23e9d65b394d214965b2c4af2c9cf7e58c5b4b0e56fb569", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlacementOracle.java": "12b1c46cc397755ef6827da777faef3e71c008cafa48403669c03ca2bdc3c7cb", + "tools/test_feature_region_parity.py": "dfbbdedb16a1989306060ea96cfeea1ab5ba8615e17117e172b7a5773d17bbf1", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "4f803d21656a1420555bee6369617ddc825219a2cf05f842a209b3f8eaa583ec", + "Cargo.lock": "b1674833e1d5e66032589eea75643bf1c1eb2f2d6503e79ff7da8efa1b6d21dc", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "2995b209aa3dc24cfcbba405cf8b97a398efbc0de97bb04ef2f51abb4cd2b84c", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "1eae82604d2b3377fd35aaa3a914a67e5af28f93923815a49e895b4d437433cd", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/retrogen.rs": "516c2a1841583acf1f9aef161dee3d59c68dfda9b9f2a7c936be9823abbdbb77", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/feature_region_fixture.rs": "d65fe974a6d5a691d57690b0eafe28f90604268dda17c51d9d02c4dc35a9ae9f" + }, + "fixtures_sha256": { + ".local/rust-feature-region-parity/heights.json": "5a9a24cd8dcd081955f856df741a8e0eb34c84649d636947f474139d3ed30698", + ".local/rust-feature-region-parity/zones.json": "1864a9cdc17816c12fc5e92cd6abd32e45d67615075c52e928872e041d84244c", + ".local/rust-feature-region-parity/inputs.txt": "597236d7f85cfad764729c389bd71a1063d40587903ba3bd3ef86e4e3f9a481f", + ".local/rust-feature-region-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0", + ".local/rust-feature-region-parity/fluid-tags.json": "f1e5eb6d22ea7effbb118a2282709cfdeef1bfae4516b775a55ad7a4df29d7d0", + ".local/rust-feature-region-parity/facts-client.json": "1d24883ee807b0b71473f0bbf8ed548ddaf712148caeb3fcc7aa13ab973a97b0", + ".local/rust-feature-region-parity/facts-server.json": "1d24883ee807b0b71473f0bbf8ed548ddaf712148caeb3fcc7aa13ab973a97b0" + }, + "rust_output_sha256": "eacca412638854ec0ae4ff375b18ae63cae249f714d3b37f055fca62868faa8f", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "eacca412638854ec0ae4ff375b18ae63cae249f714d3b37f055fca62868faa8f", + "matched_output_lines": 29248297 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "eacca412638854ec0ae4ff375b18ae63cae249f714d3b37f055fca62868faa8f", + "matched_output_lines": 29248297 + } + ], + "scope": "Native FeaturePlacer and three basic block-writing features, a composed sequence of four configured fill layers, single-block replacements, scattered ore and water springs share a world proxy backed by nine actual ProtoChunks. Configured water, horizontal logs, air, out-of-height fills and ore/replacement rules test graph-to-region binding. Initial two-layer stone/dirt terrain, both pre-light heightmap groups, count/square/heightmap/layered modifier chains, repeated placements, direct and WorldgenRandom-wrapped random streams, missing-neighbor errors, rejected writes and injected partial failures are compared. Final complete raw sections, heightmap presence and packed words are compared alongside ordered feature writes, update flags, explicit height queries and subsequent random draws. Rust uses resident registry-backed chunks, lazy heightmap priming and a caller-supplied write callback; imported air/fluid facts and bundled block tags bind independently across authenticated JARs. The proxy supplies storage mutation and actual native default scheduleTick/createTick methods routed through WorldGenTickAccess into each ProtoChunk. Separate block/fluid queues, first-request deduplication, nondefault-state block identity, shared tick-order advancement on duplicates and missing-chunk errors, out-of-height requests and wrapped clock values are compared, including saved queue order and priorities. Active and inactive End podiums additionally exercise native WorldGenRegion.destroyBlock through a subclass transport overriding only block reads and writes; air short-circuit, rejected replacements and write failures retain the generation-time semantics. All block states are also written into resident chunks, queried through feature access, cleared and queried again; contained fluid identity/amount/falling/source/full flags, water-tag membership and every bundled block tag plus an absent tag are compared. Negative coordinates, chunk edges, outside-height and absent chunks are covered. Block/fluid query bindings are an immutable registry-checked shared snapshot. The native horizontal write-zone predicate is compared separately across chunk/block coordinates, negative radii and wrapped subtraction/absolute-value extremes, and gates feature callbacks in selected fixtures. Actual WorldGenRegion.ensureCanWrite also checks the center proto-chunk before/after installing native below-zero retrogen data, with extreme and boundary heights; the generic height interval is independently compared against LevelHeightAccessor. Region feature callbacks and direct accepted/rejected write probes apply the upgrade height before mutation. The Rust access object now reads live center-chunk retrogen metadata before each write. Fifty-four lifecycle cases pair all six pre-light stages with all nine nonempty upgrade targets; one access object observes target-completion cleanup, explicit removal, reinstallation and backward stage changes from accepted write callbacks. Neighbor upgrade state is independent. Actual native highest-generated status and ProtoChunk biome-read availability are compared before and after those sequences, including clamped extreme quart Y. Retrogen activation and the world write effects remain caller-owned. Actual WorldGenRegion construction, full retrogen biome resolution, POIs, block entities, postprocessing execution, lighting, block/fluid tick execution, complete feature registries and complete world generation remain outside this comparison." +} diff --git a/benchmarks/rust-retained-upgrade-status-2026-10-06/scoped-parity.json b/benchmarks/rust-retained-upgrade-status-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..24a3c7ef5 --- /dev/null +++ b/benchmarks/rust-retained-upgrade-status-2026-10-06/scoped-parity.json @@ -0,0 +1,214 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "block_states": 35723, + "block_tag_files": 300, + "fixtures": 138, + "operation_counts": { + "stage": 916, + "prime": 40, + "fill": 84, + "dump": 324, + "upgrade": 300, + "upgrade_info": 1082, + "replace_bedrock": 164, + "mask": 244 + }, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaChunkStageOracle.java": "51ae4a6682be6301d0bb7d0a2caba6e5a214f2bcc4d84d767b93ded1e3a2e9bf", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_retrogen_chunk_parity.py": "800e0fd0e9d4bdad0c52f0a7c9cecbbf05398dacadff789b7781eb992b0199d1", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "4f803d21656a1420555bee6369617ddc825219a2cf05f842a209b3f8eaa583ec", + "Cargo.lock": "b1674833e1d5e66032589eea75643bf1c1eb2f2d6503e79ff7da8efa1b6d21dc", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "2995b209aa3dc24cfcbba405cf8b97a398efbc0de97bb04ef2f51abb4cd2b84c", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "1eae82604d2b3377fd35aaa3a914a67e5af28f93923815a49e895b4d437433cd", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/retrogen.rs": "516c2a1841583acf1f9aef161dee3d59c68dfda9b9f2a7c936be9823abbdbb77", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "d6389c8d1adf900eb8f0e6c8833feafe43dc92d74e5c7ffa6f3950975529d624", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/chunk_stage_fixture.rs": "6817bb3800d3752962fbc28951b938770fb6086d410ccdd488e7c7adf55170f9" + }, + "fixtures_sha256": { + ".local/rust-retrogen-chunk-parity/inputs.txt": "8d997d6967e791b0f804f003c6d16a991904f54094abeca8db4f9315aa3c3160", + ".local/rust-retrogen-chunk-parity/tags.json": "36975358262568f32bf84778d63d9989a36e7394ed4796d70a34809a8f4a64f0", + ".local/rust-retrogen-chunk-parity/facts-client.json": "1d24883ee807b0b71473f0bbf8ed548ddaf712148caeb3fcc7aa13ab973a97b0", + ".local/rust-retrogen-chunk-parity/facts-server.json": "1d24883ee807b0b71473f0bbf8ed548ddaf712148caeb3fcc7aa13ab973a97b0" + }, + "rust_output_sha256": "6012a86e482f4ce50e62403dbc37cf1d8b98dea4e9c10661c29532a55af4cb68", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "6012a86e482f4ce50e62403dbc37cf1d8b98dea4e9c10661c29532a55af4cb68", + "matched_output_lines": 3028057 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "6012a86e482f4ce50e62403dbc37cf1d8b98dea4e9c10661c29532a55af4cb68", + "matched_output_lines": 3028057 + } + ], + "scope": "Native ProtoChunk below-zero metadata installation/removal, pre-light persisted-stage assignments and target completion cleanup, normal/upgrading generation heights, highest-generated status from retained targets versus current persisted stages, actual BelowZeroRetrogen.replaceOldBedrock and applyBedrockMask. Mixed resident states, legacy five-layer bedrock bands, signed/chunk-relative coordinates, partial vertical overlap, masks with empty/single/sparse/all/out-of-footprint bits, repeated operations, preprimed/stale/missing heightmaps, and clearing under changed generation bounds are compared. Complete raw sections and selected packed heightmaps are checked after each mutation phase. All nine nonempty targets are paired with all six pre-light stages, including installation after an already-advanced status, repeated assignments, backward transitions and explicit removal. Data codecs have a separate comparison. Save-dirty notifications, post-light stages, structure restrictions, biome retention, automatic generation scheduling and complete world/gameplay parity remain outside this comparison." +} diff --git a/crates/horizon-world/examples/chunk_stage_fixture.rs b/crates/horizon-world/examples/chunk_stage_fixture.rs index 5f5dca1a8..ee57f8930 100644 --- a/crates/horizon-world/examples/chunk_stage_fixture.rs +++ b/crates/horizon-world/examples/chunk_stage_fixture.rs @@ -117,11 +117,12 @@ fn fixture( let (min_y, height) = chunk.height_for_generation(); writeln!( out, - "upgrade_info {} {} {min_y} {height}", + "upgrade_info {} {} {min_y} {height} {}", chunk.is_upgrading(), chunk .below_zero_retrogen() - .map_or("none", |data| data.target_status().name()) + .map_or("none", |data| data.target_status().name()), + chunk.highest_generated_status().name() )?; } "replace_bedrock" => { diff --git a/crates/horizon-world/examples/feature_region_fixture.rs b/crates/horizon-world/examples/feature_region_fixture.rs index 470100b51..a6cb08b10 100644 --- a/crates/horizon-world/examples/feature_region_fixture.rs +++ b/crates/horizon-world/examples/feature_region_fixture.rs @@ -13,10 +13,12 @@ use horizon_world::worldgen::{ use horizon_core::position::ChunkPos; use horizon_world::{ DATA_VERSION, + chunk_status::ChunkStatus, fluid::FluidKind, heightmap::{HeightmapState, HeightmapType}, nbt::Tag, registry::{BlockRegistry, BlockStateId}, + retrogen::BelowZeroRetrogen, worldgen::{ tags::TagDefinitions, terrain::{PreLightChunkStage, TerrainBlockStates, TerrainChunk}, @@ -126,6 +128,88 @@ fn fixture( ), } } +// Reuse one feature access object while successful callbacks change the center. +fn upgrade_lifecycle( + registry: &BlockRegistry, + states: &[State], + out: &mut impl Write, +) -> Result<(), Box> { + use horizon_world::worldgen::biome_chunk::{BiomeChunk, BiomeRegion}; + let biomes = BiomeRegion::new( + (0..2) + .map(|x| BiomeChunk::new(ChunkPos::new(x, 0), -64, 128, ()).unwrap()) + .collect(), + 0, + )?; + let stone = registry.default_state("minecraft:stone").unwrap(); + for stage in PreLightChunkStage::ALL { + for target in ChunkStatus::ALL.into_iter().skip(1) { + writeln!(out, "lifecycle {} {}", stage.status().name(), target.name())?; + let mut chunks = Vec::new(); + for x in 0..2 { + let mut chunk = + TerrainChunk::new(ChunkPos::new(x, 0), -64, 128, registry, Properties(states))?; + chunk.set_generation_stage(stage); + chunk.set_below_zero_retrogen(Some(BelowZeroRetrogen::new(target, vec![])?)); + chunks.push(chunk); + } + let mut region = TerrainRegion::new(chunks, WorldGenerationContext::new(-64, 128, 0))?; + for pass in 0..2 { + for x in 0..2 { + writeln!( + out, + "lifecycle_status {pass} {x} {} {}", + region.chunk(x, 0)?.highest_generated_status().name(), + region.noise_biome(&biomes, [x * 4, i32::MAX, 0]).is_ok() + )?; + } + if pass != 0 { + break; + } + let write = |region: &mut TerrainRegion<'_, Properties<'_>>, + _: [i32; 3], + _: BlockStateId, + flags: i32| + -> Result { + let chunk = region.chunk_mut(0, 0)?; + match flags { + 1 => chunk.set_generation_stage(PreLightChunkStage::Features), + 2 => chunk.set_below_zero_retrogen(Some( + BelowZeroRetrogen::new(target, vec![]).unwrap(), + )), + 3 => chunk.set_below_zero_retrogen(None), + 4 => chunk.set_generation_stage(stage), + _ => {} + } + Ok(true) + }; + let mut world = TerrainFeatureAccess::new(&mut region, write) + .with_write_zone(GenerationWriteZone::new(ChunkPos::new(0, 0), 1)) + .with_upgrade_center(ChunkPos::new(0, 0))?; + for (x, y, flags) in [ + (16, 0, 0), + (16, -1, 1), + (16, 0, 0), + (0, -64, 3), + (16, 0, 2), + (16, 0, 0), + (0, -1, 4), + (16, 0, 0), + (0, -65, 0), + (0, -1, 3), + (16, i32::MAX, 0), + ] { + writeln!( + out, + "lifecycle_write {x} {y} {flags} {}", + world.set_block([x, y, 0], stone, flags)? + )?; + } + } + } + } + Ok(()) +} fn run( f: &Value, registry: &BlockRegistry, @@ -172,6 +256,11 @@ fn run( f["tick_order"].as_i64().unwrap(), ) .with_block_bindings(bindings)?; + if f["upgrading"].as_bool().unwrap() { + region + .chunk_mut(0, 0)? + .set_below_zero_retrogen(Some(BelowZeroRetrogen::new(ChunkStatus::Features, vec![])?)); + } let blocks = FeatureBlocks::from_registry(registry)?; let features = f["features"] .as_array() @@ -214,16 +303,14 @@ fn run( writeln!(out, "written {result}").map_err(TerrainError::from)?; Ok(result) }; - let mut world = TerrainFeatureAccess::new(&mut region, write); + let mut world = TerrainFeatureAccess::new(&mut region, write) + .with_upgrade_center(ChunkPos::new(0, 0))?; if let Some(zone) = f["write_zone"].as_array() { world = world.with_write_zone(GenerationWriteZone::new( ChunkPos::new(n(&zone[0]), n(&zone[1])), n(&zone[2]), )); } - if f["upgrading"].as_bool().unwrap() { - world = world.with_upgrade_height(UpgradeWriteHeight::BELOW_ZERO); - } placer.place_with_context( &modifiers, &mut world, @@ -267,16 +354,14 @@ fn run( writeln!(out, "written {result}").map_err(TerrainError::from)?; Ok(result) }; - let mut world = TerrainFeatureAccess::new(&mut region, write); + let mut world = TerrainFeatureAccess::new(&mut region, write) + .with_upgrade_center(ChunkPos::new(0, 0))?; if let Some(zone) = f["write_zone"].as_array() { world = world.with_write_zone(GenerationWriteZone::new( ChunkPos::new(n(&zone[0]), n(&zone[1])), n(&zone[2]), )); } - if f["upgrading"].as_bool().unwrap() { - world = world.with_upgrade_height(UpgradeWriteHeight::BELOW_ZERO); - } world.set_block( [x, y, 0], registry.default_state("minecraft:stone").unwrap(), @@ -499,6 +584,7 @@ fn main() -> Result<(), Box> { UpgradeWriteHeight::BELOW_ZERO.contains(y) )?; } + upgrade_lifecycle(®istry, &states, &mut out)?; for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { fixture( &serde_json::from_str(line)?, diff --git a/crates/horizon-world/src/worldgen/feature_region.rs b/crates/horizon-world/src/worldgen/feature_region.rs index 625473425..8939d24f9 100644 --- a/crates/horizon-world/src/worldgen/feature_region.rs +++ b/crates/horizon-world/src/worldgen/feature_region.rs @@ -6,7 +6,7 @@ use super::{ biome_chunk::{BiomeRegion, BiomeRegionError}, feature::FeatureWorld, placement::{LayerBlock, PlacementContext, PlacementQueryError}, - terrain::{PreLightChunkStage, TerrainBlockStates, TerrainChunk, TerrainError}, + terrain::{TerrainBlockStates, TerrainChunk, TerrainError}, }; use crate::{ fluid::FluidKind, @@ -195,7 +195,8 @@ impl<'r, B: TerrainBlockStates> TerrainRegion<'r, B> { } /// Level-style biome lookup checks the selected chunk's generation status /// before reading its palette. Raw biome storage remains independently - /// accessible for generation itself. Below-zero retrogen is not modeled. + /// accessible for generation itself. Retained upgrade status permits reading + /// old biomes before the new generation reaches the biome stage. pub fn biome_at<'b, T: Clone>( &self, biomes: &'b BiomeRegion, @@ -209,10 +210,7 @@ impl<'r, B: TerrainBlockStates> TerrainRegion<'r, B> { quart: [i32; 3], ) -> Result<&'b T, RegionError> { let chunk = self.chunk(quart[0] >> 2, quart[2] >> 2)?; - if !matches!( - chunk.generation_stage(), - PreLightChunkStage::Biomes | PreLightChunkStage::Terrain | PreLightChunkStage::Features - ) { + if chunk.highest_generated_status() < crate::chunk_status::ChunkStatus::Biomes { return Err(RegionError::BiomesNotGenerated([ quart[0] >> 2, quart[2] >> 2, @@ -378,7 +376,12 @@ pub struct TerrainFeatureAccess<'a, 'r, B: TerrainBlockStates, F> { region: &'a mut TerrainRegion<'r, B>, write: F, write_zone: Option, - upgrade_height: Option, + upgrade_height: UpgradeHeightPolicy, +} +enum UpgradeHeightPolicy { + Unrestricted, + Fixed(super::write_zone::UpgradeWriteHeight), + Center(horizon_core::position::ChunkPos), } impl<'a, 'r, B: TerrainBlockStates, F> TerrainFeatureAccess<'a, 'r, B, F> { pub fn new(region: &'a mut TerrainRegion<'r, B>, write: F) -> Self { @@ -386,7 +389,7 @@ impl<'a, 'r, B: TerrainBlockStates, F> TerrainFeatureAccess<'a, 'r, B, F> { region, write, write_zone: None, - upgrade_height: None, + upgrade_height: UpgradeHeightPolicy::Unrestricted, } } /// Apply the horizontal write radius before invoking mutation policy/effects. @@ -394,12 +397,23 @@ impl<'a, 'r, B: TerrainBlockStates, F> TerrainFeatureAccess<'a, 'r, B, F> { self.write_zone = Some(zone); self } - /// Restrict writes to the upgrading center chunk's generation height. - /// The owning lifecycle supplies this only while an upgrade is active. + /// Use an explicit height interval. For live generation lifecycle state, + /// prefer `with_upgrade_center`, which observes changes made by callbacks. pub fn with_upgrade_height(mut self, height: super::write_zone::UpgradeWriteHeight) -> Self { - self.upgrade_height = Some(height); + self.upgrade_height = UpgradeHeightPolicy::Fixed(height); self } + /// Read the resident center chunk's upgrade state before each write. The + /// target chunk's upgrade state does not select the region's write height. + /// Horizontal write radius is configured independently with `with_write_zone`. + pub fn with_upgrade_center( + mut self, + center: horizon_core::position::ChunkPos, + ) -> Result { + self.region.chunk(center.x, center.z)?; + self.upgrade_height = UpgradeHeightPolicy::Center(center); + Ok(self) + } } impl<'r, B: TerrainBlockStates, F> TerrainFeatureAccess<'_, 'r, B, F> where @@ -416,10 +430,18 @@ where }) { return Ok(false); } - if self - .upgrade_height - .is_some_and(|height| !height.contains(position[1])) - { + let height = match self.upgrade_height { + UpgradeHeightPolicy::Unrestricted => None, + UpgradeHeightPolicy::Fixed(height) => Some(height), + UpgradeHeightPolicy::Center(center) => { + let chunk = self.region.chunk(center.x, center.z)?; + chunk.is_upgrading().then(|| { + let (min_y, height) = chunk.height_for_generation(); + super::write_zone::UpgradeWriteHeight::new(min_y, height) + }) + } + }; + if height.is_some_and(|height| !height.contains(position[1])) { return Ok(false); } (self.write)(self.region, position, state, flags) diff --git a/crates/horizon-world/src/worldgen/terrain.rs b/crates/horizon-world/src/worldgen/terrain.rs index 2a97a1b70..b5c1eac4c 100644 --- a/crates/horizon-world/src/worldgen/terrain.rs +++ b/crates/horizon-world/src/worldgen/terrain.rs @@ -251,6 +251,15 @@ impl<'r, B: TerrainBlockStates> TerrainChunk<'r, B> { pub fn generation_stage(&self) -> PreLightChunkStage { self.stage } + /// Retained old terrain may already have completed stages that the new + /// below-zero generation has not reached. Biome reads use this status. + pub fn highest_generated_status(&self) -> crate::chunk_status::ChunkStatus { + self.below_zero_retrogen + .as_ref() + .map_or(self.stage.status(), |data| { + self.stage.status().max(data.target_status()) + }) + } /// Changing status alone does not prime or clear any heightmaps. Native /// persisted-status assignment also permits earlier statuses. Reaching an /// installed upgrade target clears its metadata; save-dirty tracking is separate. diff --git a/crates/horizon-world/tests/feature_region.rs b/crates/horizon-world/tests/feature_region.rs index c89627382..c484393bf 100644 --- a/crates/horizon-world/tests/feature_region.rs +++ b/crates/horizon-world/tests/feature_region.rs @@ -290,3 +290,98 @@ fn upgrade_height_rejects_mutations_before_callbacks_but_preserves_reads_and_tic assert!(world.set_block([0, i32::MAX, 0], stone, 2).unwrap()); assert_eq!(calls.get(), 3); } + +#[test] +fn live_center_upgrade_policy_observes_callback_transitions() { + use horizon_world::{chunk_status::ChunkStatus, retrogen::BelowZeroRetrogen}; + let registry = registry(); + let mut chunks = Vec::new(); + for x in 0..2 { + let mut chunk = + TerrainChunk::new(ChunkPos::new(x, 0), -64, 128, ®istry, Properties).unwrap(); + chunk.set_below_zero_retrogen(Some( + BelowZeroRetrogen::new(ChunkStatus::Features, vec![]).unwrap(), + )); + chunks.push(chunk); + } + let mut region = TerrainRegion::new(chunks, WorldGenerationContext::new(-64, 128, 0)).unwrap(); + let mut calls = Vec::new(); + { + let write = |region: &mut TerrainRegion<'_, Properties>, p, _, flags| { + calls.push((p, flags)); + let center = region.chunk_mut(0, 0)?; + match flags { + 1 => center.set_generation_stage(PreLightChunkStage::Features), + 2 => center.set_below_zero_retrogen(Some( + BelowZeroRetrogen::new(ChunkStatus::Full, vec![]).unwrap(), + )), + 3 => center.set_below_zero_retrogen(None), + _ => {} + } + Ok(true) + }; + let mut world = TerrainFeatureAccess::new(&mut region, write) + .with_upgrade_center(ChunkPos::new(0, 0)) + .unwrap(); + assert!(!world.set_block([16, 0, 0], BlockStateId(2), 1).unwrap()); + assert!(world.set_block([16, -1, 0], BlockStateId(2), 1).unwrap()); + // The neighbor remains upgrading, but only the center selects the gate. + assert!(world.set_block([16, 0, 0], BlockStateId(2), 2).unwrap()); + assert!(!world.set_block([16, 0, 0], BlockStateId(2), 3).unwrap()); + assert!(world.set_block([16, -64, 0], BlockStateId(2), 3).unwrap()); + assert!( + world + .set_block([16, i32::MAX, 0], BlockStateId(2), 0) + .unwrap() + ); + } + assert_eq!(calls.len(), 4); + assert!(!region.chunk(0, 0).unwrap().is_upgrading()); + assert!(region.chunk(1, 0).unwrap().is_upgrading()); + assert!( + TerrainFeatureAccess::new(&mut region, ()) + .with_upgrade_center(ChunkPos::new(2, 0)) + .is_err() + ); +} + +#[test] +fn retained_upgrade_status_allows_old_biome_reads() { + use horizon_world::{ + chunk_status::ChunkStatus, + retrogen::BelowZeroRetrogen, + worldgen::biome_chunk::{BiomeChunk, BiomeRegion}, + }; + let registry = registry(); + let position = ChunkPos::new(-1, 1); + let biomes = + BiomeRegion::new(vec![BiomeChunk::new(position, -64, 128, 7).unwrap()], 0).unwrap(); + for stage in PreLightChunkStage::ALL { + for target in ChunkStatus::ALL.into_iter().skip(1) { + let mut chunk = TerrainChunk::new(position, -64, 128, ®istry, Properties).unwrap(); + chunk.set_generation_stage(stage); + chunk.set_below_zero_retrogen(Some(BelowZeroRetrogen::new(target, vec![]).unwrap())); + let mut region = + TerrainRegion::new(vec![chunk], WorldGenerationContext::new(-64, 128, 0)).unwrap(); + for y in [i32::MIN, -16, 0, 15, i32::MAX] { + let result = region.noise_biome(&biomes, [-1, y, 4]); + if stage.status() >= ChunkStatus::Biomes || target >= ChunkStatus::Biomes { + assert_eq!(*result.unwrap(), 7); + } else { + assert!(matches!( + result, + Err(RegionError::BiomesNotGenerated([-1, 1])) + )); + } + } + region + .chunk_mut(-1, 1) + .unwrap() + .set_below_zero_retrogen(None); + assert_eq!( + region.noise_biome(&biomes, [-1, 0, 4]).is_ok(), + stage.status() >= ChunkStatus::Biomes + ); + } + } +} diff --git a/docs/rust-parity.md b/docs/rust-parity.md index fd3c58d77..cddac92d9 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -852,9 +852,10 @@ matches **29,247,433 lines per reference JAR**, including **10,098 height cases* actual `WorldGenRegion.ensureCanWrite` with a native ProtoChunk before and after installing below-zero upgrade data. Direct write probes cover boundary and extreme heights, ordinary/upgrading modes and horizontal rejection. Five focused Rust -region tests, all-target Clippy and both Python fixture tests pass. Upgrade -activation, target-status cleanup, old-bedrock replacement, hole masking, biome -retention and the complete generation lifecycle remain pending. +region tests, all-target Clippy and both Python fixture tests passed for that +checkpoint. Subsequent work below adds resident upgrade metadata, cleanup, +bedrock transformations and live center-chunk write policy. Automatic upgrade +activation, biome retention and the complete generation lifecycle remain pending. ## Chunk-status identities and metadata @@ -897,3 +898,26 @@ masking, partial vertical overlap, empty sections and changed generation bounds. World-crate tests and all-target Clippy pass. Save-dirty notifications, post-light transitions, biome retention, structure restrictions, automatic generation scheduling and full saved-world/gameplay integration remain pending. + +## Live upgrade permissions and retained biome status + +Feature access can bind a resident center chunk and read its upgrade state before +every write. Successful callbacks that complete, remove or reinstall an upgrade +affect the next write through the same access object. The destination chunk's +upgrade state does not select this region-wide height gate. Explicit fixed-height +policies remain available for callers that need a supplied interval. + +Resident chunks also expose vanilla's highest generated status: the later of +their current persisted stage and retained upgrade target. Region biome reads use +this status, allowing access to old biomes while below-zero regeneration is still +at an earlier stage. Removing upgrade metadata restores the persisted-stage gate. + +The [live region comparison](../benchmarks/rust-live-upgrade-region-2026-10-06/scoped-parity.json) +matches **29,248,297 lines per reference JAR**, extending the 192 resident fixtures +with **54 lifecycle cases**. It compares native write permission, highest status +and actual ProtoChunk biome-read availability across all six pre-light stages and +nine nonempty upgrade targets. The [retained-status comparison](../benchmarks/rust-retained-upgrade-status-2026-10-06/scoped-parity.json) +also matches **3,028,057 lines per JAR** across 138 upgrade fixtures. Seven focused +region tests, all-target Clippy and the region corpus test pass. These checks do +not yet cover the biome resolver's cave-biome retention, structure restrictions, +automatic scheduling or complete saved-world integration. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaChunkStageOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaChunkStageOracle.java index af5a4b819..8569d55b5 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaChunkStageOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaChunkStageOracle.java @@ -40,7 +40,7 @@ public final class VanillaChunkStageOracle { switch(op) { case "stage"->{String name=a.get(1).getAsString();chunk.setPersistedStatus(STAGES.get(name));out.println("stage "+name);} case "upgrade"->{chunk.setBelowZeroRetrogen(a.get(1).isJsonNull()?null:upgrade(a.get(1).getAsString(),a.get(2).getAsJsonArray()));out.println("upgrade");} - case "upgrade_info"->{var data=chunk.getBelowZeroRetrogen();var bounds=chunk.getHeightAccessorForGeneration();out.println("upgrade_info "+chunk.isUpgrading()+" "+(data==null?"none":data.targetStatus().getName())+" "+bounds.getMinY()+" "+bounds.getHeight());} + case "upgrade_info"->{var data=chunk.getBelowZeroRetrogen();var bounds=chunk.getHeightAccessorForGeneration();out.println("upgrade_info "+chunk.isUpgrading()+" "+(data==null?"none":data.targetStatus().getName())+" "+bounds.getMinY()+" "+bounds.getHeight()+" "+chunk.getHighestGeneratedStatus().getName());} case "replace_bedrock"->{BelowZeroRetrogen.replaceOldBedrock(chunk);out.println("replace_bedrock");} case "mask"->{upgrade("full",a.get(1).getAsJsonArray()).applyBedrockMask(chunk);out.println("mask");} case "fill"->{var states=a.get(1).getAsJsonArray();int salt=a.get(2).getAsInt();for(int y=0;ychunks[0].setPersistedStatus(ChunkStatus.FEATURES); + case 2->chunks[0].setBelowZeroRetrogen(data); + case 3->chunks[0].setBelowZeroRetrogen(null); + case 4->chunks[0].setPersistedStatus(stage); + } + out.println("lifecycle_write "+step[0]+" "+step[1]+" "+step[2]+" "+accepted); + } + } + } + } @SuppressWarnings("unchecked") public static void main(String[] args) throws Exception { if(args[0].equals("export")){VanillaHeightmapOracle.main(args);return;} @@ -110,6 +141,7 @@ public final class VanillaFeatureRegionOracle { heightChunk.setBelowZeroRetrogen(upgrade);boolean upgrading=zoneWorld.ensureCanWrite(p); out.println("heightgate "+interval+" "+normal+" "+upgrading); } + upgradeLifecycle(factory,out); for(var line:Files.readAllLines(dir.resolve("inputs.txt"))) { var f=JsonParser.parseString(line).getAsJsonObject();long seed=f.get("seed").getAsLong(); var features=new ArrayList(); diff --git a/tools/test_feature_region_parity.py b/tools/test_feature_region_parity.py index 2713e9cb6..901743e1c 100644 --- a/tools/test_feature_region_parity.py +++ b/tools/test_feature_region_parity.py @@ -120,9 +120,9 @@ def main(): base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) report={"schema":1,"minecraft":lock["minecraft"]["version"],"manifest_sha1":lock["minecraft"]["manifest_sha1"],"platform":platform.platform(), "java":subprocess.check_output(["java","--version"],text=True).splitlines()[0],"rustc":subprocess.check_output(["rustc","--version"],text=True).strip(), - "block_states":len(facts["states"]),"direct_state_probes":sum(len(f["probe_states"]) for f in fixtures),"write_zone_cases":len(zones),"upgrade_height_cases":len(heights),"block_tag_files":len(tags),"fixtures":len(fixtures),"worldgen_random_modes":[False,True],"resident_chunks_per_fixture":9,"requested_placements":sum(len(f["features"])*2 for f in fixtures),"direct_tick_requests":sum(len(f["tick_commands"]) for f in fixtures), + "block_states":len(facts["states"]),"direct_state_probes":sum(len(f["probe_states"]) for f in fixtures),"write_zone_cases":len(zones),"upgrade_height_cases":len(heights),"upgrade_lifecycle_cases":54,"block_tag_files":len(tags),"fixtures":len(fixtures),"worldgen_random_modes":[False,True],"resident_chunks_per_fixture":9,"requested_placements":sum(len(f["features"])*2 for f in fixtures),"direct_tick_requests":sum(len(f["tick_commands"]) for f in fixtures), "sources_sha256":tested_sources,"fixtures_sha256":tested_fixtures,"rust_output_sha256":lab.digest(build/"rust.txt","sha256"),"references":references, - "scope":"Native FeaturePlacer and three basic block-writing features, a composed sequence of four configured fill layers, single-block replacements, scattered ore and water springs share a world proxy backed by nine actual ProtoChunks. Configured water, horizontal logs, air, out-of-height fills and ore/replacement rules test graph-to-region binding. Initial two-layer stone/dirt terrain, both pre-light heightmap groups, count/square/heightmap/layered modifier chains, repeated placements, direct and WorldgenRandom-wrapped random streams, missing-neighbor errors, rejected writes and injected partial failures are compared. Final complete raw sections, heightmap presence and packed words are compared alongside ordered feature writes, update flags, explicit height queries and subsequent random draws. Rust uses resident registry-backed chunks, lazy heightmap priming and a caller-supplied write callback; imported air/fluid facts and bundled block tags bind independently across authenticated JARs. The proxy supplies storage mutation and actual native default scheduleTick/createTick methods routed through WorldGenTickAccess into each ProtoChunk. Separate block/fluid queues, first-request deduplication, nondefault-state block identity, shared tick-order advancement on duplicates and missing-chunk errors, out-of-height requests and wrapped clock values are compared, including saved queue order and priorities. Active and inactive End podiums additionally exercise native WorldGenRegion.destroyBlock through a subclass transport overriding only block reads and writes; air short-circuit, rejected replacements and write failures retain the generation-time semantics. All block states are also written into resident chunks, queried through feature access, cleared and queried again; contained fluid identity/amount/falling/source/full flags, water-tag membership and every bundled block tag plus an absent tag are compared. Negative coordinates, chunk edges, outside-height and absent chunks are covered. Block/fluid query bindings are an immutable registry-checked shared snapshot. The native horizontal write-zone predicate is compared separately across chunk/block coordinates, negative radii and wrapped subtraction/absolute-value extremes, and gates feature callbacks in selected fixtures. Actual WorldGenRegion.ensureCanWrite also checks the center proto-chunk before/after installing native below-zero retrogen data, with extreme and boundary heights; the generic height interval is independently compared against LevelHeightAccessor. Region feature callbacks and direct accepted/rejected write probes apply the upgrade height before mutation. Retrogen activation remains caller-owned. Actual WorldGenRegion construction, full retrogen replacement/masking and biome behavior, POIs, block entities, postprocessing execution, lighting, block/fluid tick execution, complete feature registries and complete world generation remain outside this comparison."} + "scope":"Native FeaturePlacer and three basic block-writing features, a composed sequence of four configured fill layers, single-block replacements, scattered ore and water springs share a world proxy backed by nine actual ProtoChunks. Configured water, horizontal logs, air, out-of-height fills and ore/replacement rules test graph-to-region binding. Initial two-layer stone/dirt terrain, both pre-light heightmap groups, count/square/heightmap/layered modifier chains, repeated placements, direct and WorldgenRandom-wrapped random streams, missing-neighbor errors, rejected writes and injected partial failures are compared. Final complete raw sections, heightmap presence and packed words are compared alongside ordered feature writes, update flags, explicit height queries and subsequent random draws. Rust uses resident registry-backed chunks, lazy heightmap priming and a caller-supplied write callback; imported air/fluid facts and bundled block tags bind independently across authenticated JARs. The proxy supplies storage mutation and actual native default scheduleTick/createTick methods routed through WorldGenTickAccess into each ProtoChunk. Separate block/fluid queues, first-request deduplication, nondefault-state block identity, shared tick-order advancement on duplicates and missing-chunk errors, out-of-height requests and wrapped clock values are compared, including saved queue order and priorities. Active and inactive End podiums additionally exercise native WorldGenRegion.destroyBlock through a subclass transport overriding only block reads and writes; air short-circuit, rejected replacements and write failures retain the generation-time semantics. All block states are also written into resident chunks, queried through feature access, cleared and queried again; contained fluid identity/amount/falling/source/full flags, water-tag membership and every bundled block tag plus an absent tag are compared. Negative coordinates, chunk edges, outside-height and absent chunks are covered. Block/fluid query bindings are an immutable registry-checked shared snapshot. The native horizontal write-zone predicate is compared separately across chunk/block coordinates, negative radii and wrapped subtraction/absolute-value extremes, and gates feature callbacks in selected fixtures. Actual WorldGenRegion.ensureCanWrite also checks the center proto-chunk before/after installing native below-zero retrogen data, with extreme and boundary heights; the generic height interval is independently compared against LevelHeightAccessor. Region feature callbacks and direct accepted/rejected write probes apply the upgrade height before mutation. The Rust access object now reads live center-chunk retrogen metadata before each write. Fifty-four lifecycle cases pair all six pre-light stages with all nine nonempty upgrade targets; one access object observes target-completion cleanup, explicit removal, reinstallation and backward stage changes from accepted write callbacks. Neighbor upgrade state is independent. Actual native highest-generated status and ProtoChunk biome-read availability are compared before and after those sequences, including clamped extreme quart Y. Retrogen activation and the world write effects remain caller-owned. Actual WorldGenRegion construction, full retrogen biome resolution, POIs, block entities, postprocessing execution, lighting, block/fluid tick execution, complete feature registries and complete world generation remain outside this comparison."} lab.write_json(report_path,report);print(f"Scoped feature-region parity passed: {report_path}") diff --git a/tools/test_retrogen_chunk_parity.py b/tools/test_retrogen_chunk_parity.py index d35c3f684..2fe4be7ef 100644 --- a/tools/test_retrogen_chunk_parity.py +++ b/tools/test_retrogen_chunk_parity.py @@ -89,7 +89,7 @@ def main(): "java":subprocess.check_output(["java","--version"],text=True).splitlines()[0],"rustc":subprocess.check_output(["rustc","--version"],text=True).strip(), "block_states":len(facts["states"]),"block_tag_files":len(tags),"fixtures":len(fixtures),"operation_counts":dict(Counter(op[0] for fixture in fixtures for op in fixture["ops"])), "sources_sha256":tested_sources,"fixtures_sha256":tested_fixtures,"rust_output_sha256":lab.digest(build/"rust.txt","sha256"),"references":references, - "scope":"Native ProtoChunk below-zero metadata installation/removal, pre-light persisted-stage assignments and target completion cleanup, normal/upgrading generation heights, actual BelowZeroRetrogen.replaceOldBedrock and applyBedrockMask. Mixed resident states, legacy five-layer bedrock bands, signed/chunk-relative coordinates, partial vertical overlap, masks with empty/single/sparse/all/out-of-footprint bits, repeated operations, preprimed/stale/missing heightmaps, and clearing under changed generation bounds are compared. Complete raw sections and selected packed heightmaps are checked after each mutation phase. All nine nonempty targets are paired with all six pre-light stages, including installation after an already-advanced status, repeated assignments, backward transitions and explicit removal. Data codecs have a separate comparison. Save-dirty notifications, post-light stages, structure restrictions, biome retention, automatic generation scheduling and complete world/gameplay parity remain outside this comparison."} + "scope":"Native ProtoChunk below-zero metadata installation/removal, pre-light persisted-stage assignments and target completion cleanup, normal/upgrading generation heights, highest-generated status from retained targets versus current persisted stages, actual BelowZeroRetrogen.replaceOldBedrock and applyBedrockMask. Mixed resident states, legacy five-layer bedrock bands, signed/chunk-relative coordinates, partial vertical overlap, masks with empty/single/sparse/all/out-of-footprint bits, repeated operations, preprimed/stale/missing heightmaps, and clearing under changed generation bounds are compared. Complete raw sections and selected packed heightmaps are checked after each mutation phase. All nine nonempty targets are paired with all six pre-light stages, including installation after an already-advanced status, repeated assignments, backward transitions and explicit removal. Data codecs have a separate comparison. Save-dirty notifications, post-light stages, structure restrictions, biome retention, automatic generation scheduling and complete world/gameplay parity remain outside this comparison."} lab.write_json(report_path,report);print(f"Scoped retrogen-chunk parity passed: {report_path}") From 18d0c44e8d3e6d2ac037faf46c272762b04c3e34 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 19:49:00 +0200 Subject: [PATCH 043/253] Retain vanilla biomes during below-zero regeneration --- .../scoped-parity.json | 202 ++++++++++++++++ .../scoped-parity.json | 216 ++++++++++++++++++ .../examples/biome_chunk_fixture.rs | 48 +++- .../examples/biome_generation_fixture.rs | 35 ++- crates/horizon-world/src/retrogen.rs | 39 +++- .../horizon-world/src/worldgen/biome_chunk.rs | 26 ++- crates/horizon-world/tests/retrogen_biomes.rs | 117 ++++++++++ docs/biome-lookup.md | 30 ++- docs/rust-parity.md | 19 ++ .../parity/VanillaBiomeChunkOracle.java | 30 ++- .../parity/VanillaBiomeGenerationOracle.java | 11 +- tests/test_biome_chunk_parity.py | 13 +- tests/test_biome_generation_parity.py | 16 +- tools/test_biome_chunk_parity.py | 21 +- tools/test_biome_generation_parity.py | 18 +- 15 files changed, 814 insertions(+), 27 deletions(-) create mode 100644 benchmarks/rust-retrogen-biome-fill-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-retrogen-biome-generation-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-world/tests/retrogen_biomes.rs diff --git a/benchmarks/rust-retrogen-biome-fill-2026-10-06/scoped-parity.json b/benchmarks/rust-retrogen-biome-fill-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..ba4a85c93 --- /dev/null +++ b/benchmarks/rust-retrogen-biome-fill-2026-10-06/scoped-parity.json @@ -0,0 +1,202 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 40, + "fills": 740, + "block_queries": 24020, + "retrogen_fills": 560, + "resolver_queries": 2800, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeChunkOracle.java": "7fc0ed0e73178509939630ccb04b6b6737ebd1caf6bd16b4d9436dd9e5265bdf", + "tools/test_biome_chunk_parity.py": "d0bbfa5a165f0e2eaabe9b825101a873d7934b2756fa4821b03afbafce3b4b3d", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "4f803d21656a1420555bee6369617ddc825219a2cf05f842a209b3f8eaa583ec", + "Cargo.lock": "b1674833e1d5e66032589eea75643bf1c1eb2f2d6503e79ff7da8efa1b6d21dc", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "2995b209aa3dc24cfcbba405cf8b97a398efbc0de97bb04ef2f51abb4cd2b84c", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "1eae82604d2b3377fd35aaa3a914a67e5af28f93923815a49e895b4d437433cd", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/biome_chunk_fixture.rs": "810d00491e29b4fa91ef2e4447dc95314abc7191939a0c5f98306d57d36c0711" + }, + "fixtures_sha256": { + ".local/rust-biome-chunk-parity/inputs.txt": "ee52367acd9cf70183e21b696204ac285f0ef371ccf057707790f0949283c20b" + }, + "rust_output_sha256": "d70591bab59501e722318c80c7d8cdffba42342124edee804ebf0fb5b17cb9dd", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "d70591bab59501e722318c80c7d8cdffba42342124edee804ebf0fb5b17cb9dd", + "matched_output_lines": 593152 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "d70591bab59501e722318c80c7d8cdffba42342124edee804ebf0fb5b17cb9dd", + "matched_output_lines": 593152 + } + ], + "scope": "Actual ChunkAccess.fillBiomesFromNoise, LevelChunkSection.fillBiomesFromNoise and chunk/section biome reads using synthetic registered holder identities. Ordered resolver queries, section contents and clamped/wrapped chunk lookups are compared after repeated fills and failures at section boundaries. Covers full supported aligned vertical bounds, generation bounds cutting through sections, negative/extreme chunk coordinates and 1..512 possible biome identities. Completed earlier sections survive failure while the failing section retains its previous values. Additional BelowZeroRetrogen.getBiomeResolver cases compare all three retained cave keys, a lookalike foreign namespace, ordinary keyed holders and a direct holder without a key. All four combinations of upgrade activation at resolver construction and after construction test the captured wrapping decision. Candidate invocation order, injected candidate failures, old-column reads with quart Y fixed to zero and X/Z wrapping, repeated fills, and overlap of generation bounds with the old column section are exercised. Synthetic generation bounds deliberately override the fixed native retrogen height to expose section commit/read ordering. Direct holder values and all keyed holders are identity-only placeholders; biome properties are not evaluated. This compares stored biome values and resolver behavior, not native in-memory palette layout, wire encoding, biome-source generation integration, nonempty blending or complete generated worlds." +} diff --git a/benchmarks/rust-retrogen-biome-generation-2026-10-06/scoped-parity.json b/benchmarks/rust-retrogen-biome-generation-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..7d2a8287e --- /dev/null +++ b/benchmarks/rust-retrogen-biome-generation-2026-10-06/scoped-parity.json @@ -0,0 +1,216 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 396, + "retrogen_fixtures": 144, + "fills": 610, + "biome_values": 728576, + "block_queries": 93510, + "preset_entries": { + "minecraft:nether": 5, + "minecraft:overworld": 7594 + }, + "source_fixtures": { + "multi": 132, + "fixed": 104, + "checkerboard": 80, + "end": 80 + }, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeGenerationOracle.java": "790bcfaf5cf67a41b0abe0994cc64f44bf809142db464573d64a3a018df9014d", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeExport.java": "f9a773713cf21b69bfa10018b76f27b953bda140ede9934f43d3aa3091101cf5", + "tools/test_biome_generation_parity.py": "3a48dfff639e261e58f07ab00126331f46ee31e65312171044e48d01b0926c45", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "4f803d21656a1420555bee6369617ddc825219a2cf05f842a209b3f8eaa583ec", + "Cargo.lock": "b1674833e1d5e66032589eea75643bf1c1eb2f2d6503e79ff7da8efa1b6d21dc", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "47350edab5791f5074a54563ba98108818c5c6b1c5818a591388eab2ac9f5490", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "2995b209aa3dc24cfcbba405cf8b97a398efbc0de97bb04ef2f51abb4cd2b84c", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "1eae82604d2b3377fd35aaa3a914a67e5af28f93923815a49e895b4d437433cd", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/biome_generation_fixture.rs": "5beb21fbf872a05082f5b7a0531188990ae14d3f35421b118dd529db2b36ce30" + }, + "fixtures_sha256": { + ".local/rust-biome-generation-parity/inputs.txt": "15c002f4aeeedfeccf9e26ab93c198fe089822dc702bf39740c81a92dd041f79", + ".local/rust-biome-generation-parity/registries.json": "c6868228cc1002755dab31d947e953cc4be785a1b6ae82697755817a238b7de9", + ".local/rust-biome-generation-parity/presets-client.json": "b03e2fbe85c191a22f333bc989bd2a73c66f0f9fbcd9ddb54774f17c247832e9", + ".local/rust-biome-generation-parity/presets-server.json": "b03e2fbe85c191a22f333bc989bd2a73c66f0f9fbcd9ddb54774f17c247832e9" + }, + "rust_output_sha256": "e200d072cb701cba116f6d4375e36fd9ea8e4fec650ce0b86fd87cee7bf9cfdb", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "e200d072cb701cba116f6d4375e36fd9ea8e4fec650ce0b86fd87cee7bf9cfdb", + "matched_output_lines": 834080 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "e200d072cb701cba116f6d4375e36fd9ea8e4fec650ce0b86fd87cee7bf9cfdb", + "matched_output_lines": 834080 + } + ], + "scope": "Actual ChunkGenerator.doCreateBiomes through NoiseBasedChunkGenerator with empty Blender, in ordinary and below-zero upgrade modes. Both bundled Overworld/Nether multi-noise preset tables are independently exported from authenticated JARs; Rust imports quantized tables and compiles climate routers itself. All seven bundled routers, both random modes, multiple seeds and distant positive/negative chunks are tested. Complete section biome values and subsequent BiomeManager block lookups are compared, including repeated generation with fresh density contexts and persistent previous-leaf search state, and generation bounds excluding top/bottom sections. Holders are identity placeholders; no biome properties are evaluated. Fixed, checkerboard and End source fixtures also run actual chunk generation through every bundled router, including real seeded End erosion, the central-island shortcut, distant coordinates and wrapped checkerboard shifts. Retrogen cases initialize patterned old biome columns, install actual below-zero metadata with a full target on an empty persisted-stage ProtoChunk, and use its native generation height. Four below-zero noise settings, all source kinds, fixed candidates for each of the three retained cave biomes, both random modes, signed/distant seeds and repeated fills are compared. Above-zero stored biomes remain checked alongside regenerated sections and block-level biome zoom. Rust composes seeded candidate resolvers with the independently tested retention fill. Preset builders, complete biome-source codecs, nonempty blending, complete terrain-stage scheduling and complete generated worlds remain pending." +} diff --git a/crates/horizon-world/examples/biome_chunk_fixture.rs b/crates/horizon-world/examples/biome_chunk_fixture.rs index 4adbd0a1f..69f7c897d 100644 --- a/crates/horizon-world/examples/biome_chunk_fixture.rs +++ b/crates/horizon-world/examples/biome_chunk_fixture.rs @@ -1,6 +1,6 @@ //! Original transport for native chunk biome fill order and failure state. use horizon_core::position::ChunkPos; -use horizon_world::worldgen::biome_chunk::BiomeChunk; +use horizon_world::{retrogen::RetrogenBiomeResolver, worldgen::biome_chunk::BiomeChunk}; use serde_json::Value; use std::{ fs, @@ -10,6 +10,16 @@ use std::{ fn n(v: &Value) -> i32 { v.as_i64().unwrap() as i32 } +fn biome_key(id: &i32) -> Option<&str> { + match *id { + 0 => Some("minecraft:lush_caves"), + 1 => Some("minecraft:dripstone_caves"), + 2 => Some("minecraft:deep_dark"), + 3 => Some("horizon:lush_caves"), + 511 => None, + _ => Some("horizon:other"), + } +} fn main() -> Result<(), Box> { let arg = std::env::args().nth(1).expect("private fixture directory"); let dir = Path::new(&arg); @@ -25,7 +35,7 @@ fn main() -> Result<(), Box> { )?; for op in f["ops"].as_array().unwrap() { let mut calls = 0; - let result = chunk.fill(n(&op[3]), n(&op[4]), |[x, y, z]| { + let resolve = |[x, y, z]: [i32; 3]| { writeln!(out, "resolve {x} {y} {z}").unwrap(); let previous = calls; calls += 1; @@ -37,7 +47,20 @@ fn main() -> Result<(), Box> { .wrapping_add(z.wrapping_mul(17)) .wrapping_add(n(&op[0])) .rem_euclid(n(&op[1]))) - }); + }; + let result = if let Some(before) = op.get(5) { + // Native wrapper activation is captured before the later metadata + // mutation at op[6]; filling still uses the supplied bounds. + chunk.fill_with_retrogen( + n(&op[3]), + n(&op[4]), + before.as_bool().unwrap(), + resolve, + biome_key, + ) + } else { + chunk.fill(n(&op[3]), n(&op[4]), resolve) + }; writeln!( out, "fill {} {calls}", @@ -57,6 +80,25 @@ fn main() -> Result<(), Box> { )?; } } + if let Some(queries) = f["resolver_queries"].as_array() { + for query in queries { + let p = [n(&query[1]), n(&query[2]), n(&query[3])]; + let mut resolver = + RetrogenBiomeResolver::new(query[4].as_bool().unwrap(), |[x, y, z]| { + writeln!(out, "resolve_query {x} {y} {z}").unwrap(); + if n(&query[0]) < 0 { + Err(()) + } else { + Ok(n(&query[0])) + } + }); + let result = resolver.sample(p, biome_key, |old| Ok(*chunk.noise_biome(old))); + match result { + Ok(value) => writeln!(out, "resolver_query {value}")?, + Err(()) => writeln!(out, "resolver_query error")?, + } + } + } } Ok(()) } diff --git a/crates/horizon-world/examples/biome_generation_fixture.rs b/crates/horizon-world/examples/biome_generation_fixture.rs index 4c41b7ca5..2377747f9 100644 --- a/crates/horizon-world/examples/biome_generation_fixture.rs +++ b/crates/horizon-world/examples/biome_generation_fixture.rs @@ -46,7 +46,12 @@ fn main() -> Result<(), Box> { ); let climate = router.compile_climate(&mut compiler)?; let definition = match f["source"].as_str().unwrap_or("multi") { - "fixed" => BiomeSourceDefinition::Fixed("minecraft:plains".into()), + "fixed" => BiomeSourceDefinition::Fixed( + f["fixed_biome"] + .as_str() + .unwrap_or("minecraft:plains") + .into(), + ), "checkerboard" => BiomeSourceDefinition::Checkerboard { biomes: BiomeSet::Direct(vec![ "minecraft:plains".into(), @@ -72,6 +77,18 @@ fn main() -> Result<(), Box> { height, "minecraft:plains".to_owned(), )?; + let retrogen = f["retrogen"].as_bool().unwrap_or(false); + if retrogen { + chunk.fill(min, min + height - 1, |[x, y, z]| { + Ok::<_, std::convert::Infallible>(format!( + "horizon:old_{}", + x.wrapping_mul(31) + .wrapping_add(y.wrapping_mul(7)) + .wrapping_add(z.wrapping_mul(17)) + .rem_euclid(3) + )) + })?; + } for repeat in 0..n(&f["repeats"]) { let mut context = SamplerContext::cached(); let volume = resolver.prepare_volume( @@ -79,11 +96,17 @@ fn main() -> Result<(), Box> { [cx.wrapping_shl(4) >> 2, min >> 2, cz.wrapping_shl(4) >> 2], [4, height >> 2, 4], )?; - chunk.fill(n(&f["write_min"]), n(&f["write_max"]), |quart| { - resolver - .sample_prepared(&mut context, volume.as_ref(), quart) - .map(str::to_owned) - })?; + chunk.fill_with_retrogen( + n(&f["write_min"]), + n(&f["write_max"]), + retrogen, + |quart| { + resolver + .sample_prepared(&mut context, volume.as_ref(), quart) + .map(str::to_owned) + }, + |name| Some(name), + )?; writeln!(out, "fill {repeat}")?; for section in 0..height as usize / 16 { writeln!(out, "section {section}")?; diff --git a/crates/horizon-world/src/retrogen.rs b/crates/horizon-world/src/retrogen.rs index 2aed00891..fc9f450bf 100644 --- a/crates/horizon-world/src/retrogen.rs +++ b/crates/horizon-world/src/retrogen.rs @@ -1,5 +1,5 @@ //! Below-zero upgrade metadata and resident block transformations. -//! Generation scheduling and biome resolution remain separate. +//! Generation scheduling remains owned by the caller. use crate::{chunk_status::ChunkStatus, compression::invalid, nbt::Tag}; use std::io; @@ -141,3 +141,40 @@ impl BelowZeroRetrogen { Ok(()) } } + +/// The native decoration decision is captured when the resolver is created. +/// Removing upgrade metadata afterwards does not unwrap an existing resolver. +/// Candidate sampling runs before deciding whether to read an old column biome. +pub struct RetrogenBiomeResolver { + upgrading: bool, + resolve: F, +} +impl RetrogenBiomeResolver { + pub fn new(upgrading: bool, resolve: F) -> Self + where + F: FnMut([i32; 3]) -> Result, + { + Self { upgrading, resolve } + } + pub fn sample( + &mut self, + quart: [i32; 3], + biome_key: impl FnOnce(&T) -> Option<&str>, + old_biome: impl FnOnce([i32; 3]) -> Result, + ) -> Result + where + F: FnMut([i32; 3]) -> Result, + { + let candidate = (self.resolve)(quart)?; + if !self.upgrading + || matches!( + biome_key(&candidate), + Some("minecraft:lush_caves" | "minecraft:dripstone_caves" | "minecraft:deep_dark") + ) + { + Ok(candidate) + } else { + old_biome([quart[0], 0, quart[2]]) + } + } +} diff --git a/crates/horizon-world/src/worldgen/biome_chunk.rs b/crates/horizon-world/src/worldgen/biome_chunk.rs index 3d7e903f4..a9ddd5e70 100644 --- a/crates/horizon-world/src/worldgen/biome_chunk.rs +++ b/crates/horizon-world/src/worldgen/biome_chunk.rs @@ -66,6 +66,30 @@ impl BiomeChunk { min_y: i32, max_y: i32, mut resolve: impl FnMut([i32; 3]) -> Result, + ) -> Result<(), BiomeFillError> { + self.fill_using_chunk(min_y, max_y, |quart, _| resolve(quart)) + } + /// Decorate candidate sampling with the pinned below-zero biome policy. + /// `upgrading` is captured once for this fill, as at native resolver creation. + /// Keys describe holder identity; unkeyed/direct values must return `None`. + pub fn fill_with_retrogen( + &mut self, + min_y: i32, + max_y: i32, + upgrading: bool, + resolve: impl FnMut([i32; 3]) -> Result, + biome_key: impl Fn(&T) -> Option<&str>, + ) -> Result<(), BiomeFillError> { + let mut resolver = crate::retrogen::RetrogenBiomeResolver::new(upgrading, resolve); + self.fill_using_chunk(min_y, max_y, |quart, chunk| { + resolver.sample(quart, &biome_key, |old| Ok(chunk.noise_biome(old).clone())) + }) + } + fn fill_using_chunk( + &mut self, + min_y: i32, + max_y: i32, + mut resolve: impl FnMut([i32; 3], &Self) -> Result, ) -> Result<(), BiomeFillError> { if min_y < self.min_y || max_y >= self.min_y + self.height || min_y > max_y { return Err(BiomeFillError::InvalidBounds); @@ -84,7 +108,7 @@ impl BiomeChunk { z.wrapping_add(dz), ]; values[index(dx, dy, dz)] = - resolve(quart).map_err(BiomeFillError::Resolve)?; + resolve(quart, self).map_err(BiomeFillError::Resolve)?; } } } diff --git a/crates/horizon-world/tests/retrogen_biomes.rs b/crates/horizon-world/tests/retrogen_biomes.rs new file mode 100644 index 000000000..c83b77d93 --- /dev/null +++ b/crates/horizon-world/tests/retrogen_biomes.rs @@ -0,0 +1,117 @@ +use horizon_core::position::ChunkPos; +use horizon_world::{ + retrogen::RetrogenBiomeResolver, + worldgen::biome_chunk::{BiomeChunk, BiomeFillError}, +}; +use std::cell::RefCell; + +#[test] +fn candidates_precede_old_columns_and_errors_short_circuit() { + let events = RefCell::new(Vec::new()); + let mut resolver = RetrogenBiomeResolver::new(true, |p| { + events.borrow_mut().push(p); + if p[1] == 99 { + Err("candidate") + } else { + Ok("minecraft:plains") + } + }); + let old = |p| { + events.borrow_mut().push(p); + Ok("horizon:old") + }; + assert_eq!( + resolver.sample([-3, -15, 8], |v| Some(*v), old), + Ok("horizon:old") + ); + assert_eq!(*events.borrow(), [[-3, -15, 8], [-3, 0, 8]]); + events.borrow_mut().clear(); + assert_eq!( + resolver.sample([1, 99, 2], |v| Some(*v), old), + Err("candidate") + ); + assert_eq!(*events.borrow(), [[1, 99, 2]]); + assert_eq!( + resolver.sample([1, -1, 2], |v| Some(*v), |_| Err("old")), + Err("old") + ); + for name in [ + "minecraft:lush_caves", + "minecraft:dripstone_caves", + "minecraft:deep_dark", + ] { + let mut resolver = RetrogenBiomeResolver::new(true, |_| Ok::<_, ()>(name)); + assert_eq!( + resolver.sample( + [0, -1, 0], + |v| Some(*v), + |_| panic!("retained candidate must not read old column") + ), + Ok(name) + ); + assert_eq!( + resolver.sample([0, -1, 0], |_| None, |_| Ok("old")), + Ok("old") + ); + } + let mut normal = RetrogenBiomeResolver::new(false, |_| Ok::<_, ()>("candidate")); + assert_eq!( + normal.sample( + [0, 0, 0], + |_| panic!("normal resolver must not inspect keys"), + |_| panic!("normal resolver must not read old columns") + ), + Ok("candidate") + ); +} + +#[test] +fn upgrade_fill_preserves_columns_and_section_atomicity() { + let mut chunk = BiomeChunk::new(ChunkPos::new(-1, 2), -64, 128, String::new()).unwrap(); + chunk + .fill(-64, 63, |[x, y, z]| Ok::<_, ()>(format!("old:{x}:{y}:{z}"))) + .unwrap(); + let original = chunk.clone(); + let mut calls = 0; + let result = chunk.fill_with_retrogen( + -64, + -1, + true, + |_| { + calls += 1; + if calls == 66 { + Err("failure") + } else { + Ok("minecraft:plains".to_owned()) + } + }, + |name| Some(name), + ); + assert_eq!(result, Err(BiomeFillError::Resolve("failure"))); + for y in -16..-12 { + for x in -4..0 { + for z in 8..12 { + assert_eq!( + chunk.noise_biome([x, y, z]), + original.noise_biome([x, 0, z]) + ); + } + } + } + for section in 1..8 { + assert_eq!(chunk.section(section), original.section(section)); + } + chunk + .fill_with_retrogen( + -64, + -1, + true, + |_| Ok::<_, ()>("minecraft:lush_caves".to_owned()), + |name| Some(name), + ) + .unwrap(); + assert_eq!(chunk.noise_biome([-4, -16, 8]), "minecraft:lush_caves"); + for section in 4..8 { + assert_eq!(chunk.section(section), original.section(section)); + } +} diff --git a/docs/biome-lookup.md b/docs/biome-lookup.md index a1d069b34..abb527f65 100644 --- a/docs/biome-lookup.md +++ b/docs/biome-lookup.md @@ -71,7 +71,7 @@ block lookups use seeded fuzzy selection and clamped chunk reads. Both JARs independently export the preset tables and must agree: **7,594 Overworld entries** and **5 Nether entries**. Rust imports those quantized tables; preset builders remain unported. Registry-bound source codecs are described below. Reference holders -supply identities without evaluating biome properties. The comparison uses empty +supply identities without evaluating biome properties. That baseline uses empty blending and no below-zero retrogen. An additional 168 fixtures generate chunks through fixed, checkerboard and End sources using every bundled terrain router. They cover real seeded End erosion, the central-island boundary and wrapped checkerboard shifts. The [surface-stage integration](material-surfaces.md#chunk-surface-stage) now @@ -80,6 +80,34 @@ stored neighbor biome lookups. Saved biome palettes and complete world generatio remain pending. +### Below-zero biome retention + +`RetrogenBiomeResolver` captures whether an upgrade is active when the resolver +is created. Later metadata changes do not add or remove its retention policy. +It always samples the candidate first. Keyed `lush_caves`, `dripstone_caves` and +`deep_dark` in the `minecraft` namespace are retained; other candidates read the +old biome at the same quart X/Z and quart Y = 0. Unkeyed holders do not qualify. + +`BiomeChunk::fill_with_retrogen` reads committed old sections while staging the +current section separately. A failure preserves that section's old values; +later sections can observe earlier completed writes. This matters when supplied +generation bounds overlap the section selected by the clamped old-column read. + +The [retention/fill report](../benchmarks/rust-retrogen-biome-fill-2026-10-06/scoped-parity.json) +records **593,152 matching lines per reference JAR**, with 40 fixtures, 740 fills +(560 decorated), and 2,800 direct resolver queries. It includes all activation +timings, keyed and direct holders, foreign namespace lookalikes, callback failures, +boundary sections and extreme coordinates. + +The expanded [generation report](../benchmarks/rust-retrogen-biome-generation-2026-10-06/scoped-parity.json) +records **834,080 matching lines per JAR** across **396 fixtures and 610 fills**. +Its 144 added upgrade fixtures use actual native below-zero metadata and generation +heights, patterned old biome columns, all source kinds, each retained cave biome, +four settings with below-zero storage, both random modes and repeated fills. +Every stored section and subsequent block-biome lookup is compared, including +unchanged data above Y = 0. Nonempty blending, preset builders, full terrain-stage +scheduling and complete saved-world integration remain pending. + ## Fixed, checkerboard and End sources `FixedBiomeSource` always returns its configured value. `CheckerboardBiomeSource` diff --git a/docs/rust-parity.md b/docs/rust-parity.md index cddac92d9..67f32ac3d 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -921,3 +921,22 @@ also matches **3,028,057 lines per JAR** across 138 upgrade fixtures. Seven focu region tests, all-target Clippy and the region corpus test pass. These checks do not yet cover the biome resolver's cave-biome retention, structure restrictions, automatic scheduling or complete saved-world integration. + +## Retained biomes during below-zero generation + +The [biome-retention implementation](biome-lookup.md#below-zero-biome-retention) +now preserves the pinned three cave-biome candidates and otherwise reads the old +column at quart Y = 0. The resolver captures upgrade activation at construction; +candidate failures precede fallback reads. Section fills preserve native commit +ordering and partial-failure behavior while allowing access to old biome storage. + +The [retention/fill comparison](../benchmarks/rust-retrogen-biome-fill-2026-10-06/scoped-parity.json) +matches **593,152 lines per JAR** across 740 fills and 2,800 direct queries. The +[generation integration](../benchmarks/rust-retrogen-biome-generation-2026-10-06/scoped-parity.json) +matches **834,080 lines per JAR** across 396 fixtures and 610 fills, including 144 +upgrading chunks alongside the ordinary-generation cases. It executes actual +native `ChunkGenerator.doCreateBiomes`, including retained-status old biome reads, +native below-zero generation bounds, repeated fills and all biome-source kinds. +This closes the resolver gap described in the preceding checkpoint. Nonempty +blending, structure restrictions, automatic generation scheduling and complete +saved-world/gameplay integration remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeChunkOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeChunkOracle.java index f47b9dc1c..9c203bd2f 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeChunkOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeChunkOracle.java @@ -10,13 +10,20 @@ import net.minecraft.world.level.*; import net.minecraft.world.level.biome.*; import net.minecraft.world.level.block.*; import net.minecraft.world.level.chunk.*; +import net.minecraft.world.level.levelgen.BelowZeroRetrogen; +import com.mojang.serialization.JsonOps; /** Original transport calling vanilla section-atomic biome fill and chunk reads. */ public final class VanillaBiomeChunkOracle { public static void main(String[] args) throws Exception { net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); var ids=new IdMapper>(); - for(int i=0;i<512;i++)ids.add(Holder.Reference.createStandAlone(new HolderOwner(){},ResourceKey.create(Registries.BIOME,Identifier.parse("horizon:biome_"+i)))); + for(int i=0;i<512;i++) { + String key=switch(i){case 0->"minecraft:lush_caves";case 1->"minecraft:dripstone_caves";case 2->"minecraft:deep_dark";case 3->"horizon:lush_caves";default->"horizon:biome_"+i;}; + // No biome properties are accessed; direct holders have no registry key. + ids.add(i==511?Holder.direct(null):Holder.Reference.createStandAlone(new HolderOwner(){},ResourceKey.create(Registries.BIOME,Identifier.parse(key)))); + } + var upgrade=BelowZeroRetrogen.CODEC.parse(JsonOps.INSTANCE,JsonParser.parseString("{\"target_status\":\"minecraft:features\"}")).getOrThrow(); Path dir=Path.of(args[1]); try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt"),StandardCharsets.UTF_8))) { for(String line:Files.readAllLines(dir.resolve("inputs.txt"))) { @@ -27,11 +34,16 @@ public final class VanillaBiomeChunkOracle { chunk.setPersistedStatus(net.minecraft.world.level.chunk.status.ChunkStatus.BIOMES); for(var value:f.getAsJsonArray("ops")) { var op=value.getAsJsonArray();bounds[0]=op.get(3).getAsInt();bounds[1]=op.get(4).getAsInt();var calls=new int[1];boolean ok=true; - try { chunk.fillBiomesFromNoise((x,y,z)->{ + try { BiomeResolver candidate=(x,y,z)->{ out.println("resolve "+x+" "+y+" "+z);int previous=calls[0]++; if(previous==op.get(2).getAsInt())throw new IllegalStateException("synthetic provider failure"); return ids.byId(Math.floorMod(x*31+y*7+z*17+op.get(0).getAsInt(),op.get(1).getAsInt())); - });}catch(IllegalStateException error){ok=false;} + }; + chunk.setBelowZeroRetrogen(op.size()>5&&op.get(5).getAsBoolean()?upgrade:null); + var resolver=BelowZeroRetrogen.getBiomeResolver(candidate,chunk); + chunk.setBelowZeroRetrogen(op.size()>6&&op.get(6).getAsBoolean()?upgrade:null); + chunk.fillBiomesFromNoise(resolver); + }catch(IllegalStateException error){ok=false;} out.println("fill "+(ok?"ok":"error")+" "+calls[0]); for(int section=0;section{ + out.println("resolve_query "+x+" "+y+" "+z); + if(q.get(0).getAsInt()<0)throw new IllegalStateException("synthetic candidate failure"); + return ids.byId(q.get(0).getAsInt()); + },chunk); + chunk.setBelowZeroRetrogen(q.get(5).getAsBoolean()?upgrade:null); + try {out.println("resolver_query "+ids.getId(resolver.getNoiseBiome(q.get(1).getAsInt(),q.get(2).getAsInt(),q.get(3).getAsInt())));} + catch(IllegalStateException error){out.println("resolver_query error");} + } } } } diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeGenerationOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeGenerationOracle.java index 817a3d1bd..2246e960d 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeGenerationOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeGenerationOracle.java @@ -33,7 +33,7 @@ public final class VanillaBiomeGenerationOracle { for(var e:bundle.getAsJsonObject("densities").entrySet())densities.register(ResourceKey.create(Registries.DENSITY_FUNCTION,Identifier.parse(e.getKey())),DensityFunctions.DIRECT_CODEC.parse(ops,JsonParser.parseString(e.getValue().getAsString())).getOrThrow(),RegistrationInfo.BUILT_IN);densities.freeze(); var presets=new TreeMap>>();MultiNoiseBiomeSourceParameterList.knownPresets().forEach((preset,list)->presets.put(preset.id().toString(),list)); var ids=new IdMapper>();var holders=new TreeMap>(); - var keys=new TreeSet();keys.add("minecraft:plains");keys.addAll(List.of("minecraft:the_end","minecraft:end_highlands","minecraft:end_midlands","minecraft:small_end_islands","minecraft:end_barrens"));for(var list:presets.values())for(var entry:list.values())keys.add(entry.getSecond().identifier().toString()); + var keys=new TreeSet();keys.add("minecraft:plains");keys.addAll(List.of("horizon:old_0","horizon:old_1","horizon:old_2"));keys.addAll(List.of("minecraft:the_end","minecraft:end_highlands","minecraft:end_midlands","minecraft:small_end_islands","minecraft:end_barrens"));for(var list:presets.values())for(var entry:list.values())keys.add(entry.getSecond().identifier().toString()); for(var key:keys){var holder=Holder.Reference.createStandAlone(new HolderOwner(){},ResourceKey.create(Registries.BIOME,Identifier.parse(key)));holders.put(key,holder);ids.add(holder);} var factory=new PalettedContainerFactory(Strategy.createForBlockStates(Block.BLOCK_STATE_REGISTRY),Blocks.AIR.defaultBlockState(),null,Strategy.createForBiomes(ids),holders.get("minecraft:plains"),null); var fill=ChunkGenerator.class.getDeclaredMethod("doCreateBiomes",Blender.class,RandomState.class,ChunkAccess.class);fill.setAccessible(true); @@ -46,7 +46,7 @@ public final class VanillaBiomeGenerationOracle { for(var entry:presets.get(f.get("preset").getAsString()).values())entries.add(com.mojang.datafixers.util.Pair.of(entry.getFirst(),holders.get(entry.getSecond().identifier().toString()))); BiomeSource source=MultiNoiseBiomeSource.createFromList(new Climate.ParameterList<>(entries)); if(f.has("source"))switch(f.get("source").getAsString()) { - case "fixed" -> source=new FixedBiomeSource(holders.get("minecraft:plains")); + case "fixed" -> source=new FixedBiomeSource(holders.get(f.has("fixed_biome")?f.get("fixed_biome").getAsString():"minecraft:plains")); case "checkerboard" -> source=new CheckerboardColumnBiomeSource(HolderSet.direct(List.of(holders.get("minecraft:plains"),holders.get("minecraft:the_end"),holders.get("minecraft:nether_wastes"))),f.get("scale").getAsInt()); case "end" -> {var constructor=TheEndBiomeSource.class.getDeclaredConstructor(Holder.class,Holder.class,Holder.class,Holder.class,Holder.class);constructor.setAccessible(true);source=constructor.newInstance(holders.get("minecraft:the_end"),holders.get("minecraft:end_highlands"),holders.get("minecraft:end_midlands"),holders.get("minecraft:small_end_islands"),holders.get("minecraft:end_barrens"));} default -> throw new IllegalArgumentException("unknown source"); @@ -55,8 +55,11 @@ public final class VanillaBiomeGenerationOracle { var settings=new NoiseGeneratorSettings(NoiseSettings.create(min,height),Blocks.STONE.defaultBlockState(),Blocks.WATER.defaultBlockState(),router,material,List.of(),sea,false,Optional.empty(),legacy,NoiseGeneratorSettings.DebugFunctions.EMPTY); var generator=new NoiseBasedChunkGenerator(source,Holder.direct(settings)); var bounds=LevelHeightAccessor.create(f.get("write_min").getAsInt(),f.get("write_max").getAsInt()-f.get("write_min").getAsInt()+1); - var chunk=new ProtoChunk(new ChunkPos(f.get("cx").getAsInt(),f.get("cz").getAsInt()),UpgradeData.EMPTY,LevelHeightAccessor.create(min,height),factory,null){@Override public LevelHeightAccessor getHeightAccessorForGeneration(){return bounds;}}; - chunk.setPersistedStatus(net.minecraft.world.level.chunk.status.ChunkStatus.BIOMES); + var chunk=new ProtoChunk(new ChunkPos(f.get("cx").getAsInt(),f.get("cz").getAsInt()),UpgradeData.EMPTY,LevelHeightAccessor.create(min,height),factory,null){@Override public LevelHeightAccessor getHeightAccessorForGeneration(){return f.has("retrogen")&&f.get("retrogen").getAsBoolean()?super.getHeightAccessorForGeneration():bounds;}}; + if(f.has("retrogen")&&f.get("retrogen").getAsBoolean()) { + chunk.fillBiomesFromNoise((x,y,z)->holders.get("horizon:old_"+Math.floorMod(x*31+y*7+z*17,3))); + chunk.setBelowZeroRetrogen(BelowZeroRetrogen.CODEC.parse(JsonOps.INSTANCE,JsonParser.parseString("{\"target_status\":\"minecraft:full\"}")).getOrThrow()); + } else chunk.setPersistedStatus(net.minecraft.world.level.chunk.status.ChunkStatus.BIOMES); for(int repeat=0;repeat 0 for f in fixtures)) + self.assertTrue(any(f['min'] + f['height'] <= 0 for f in fixtures)) + for f in fixtures: + expected = {(False, False), (False, True), (True, False), (True, True)} + self.assertEqual({tuple(op[5:7]) for op in f['ops'] if len(op) > 5}, expected) + self.assertEqual({tuple(q[4:6]) for q in f['resolver_queries']}, expected) + self.assertEqual({q[0] for q in f['resolver_queries']}, {-1, 0, 1, 2, 3, 4, 511}) + if __name__ == '__main__': unittest.main() diff --git a/tests/test_biome_generation_parity.py b/tests/test_biome_generation_parity.py index 2d7f35574..b39ce132e 100644 --- a/tests/test_biome_generation_parity.py +++ b/tests/test_biome_generation_parity.py @@ -9,7 +9,7 @@ class BiomeGenerationCorpusTests(unittest.TestCase): 'presets': {'minecraft:overworld': '[]', 'minecraft:nether': '[]'}} all_fixtures = list(generation.corpus(bundle)) self.assertEqual({f.get('source', 'multi') for f in all_fixtures}, {'multi', 'fixed', 'checkerboard', 'end'}) - fixtures = [f for f in all_fixtures if 'source' not in f] + fixtures = [f for f in all_fixtures if 'source' not in f and not f.get('retrogen')] self.assertEqual(all_fixtures, list(generation.corpus(bundle))) self.assertEqual(len(fixtures), 12) self.assertEqual(sum(f['repeats'] for f in fixtures), 16) @@ -22,6 +22,20 @@ class BiomeGenerationCorpusTests(unittest.TestCase): self.assertTrue(any(q[1] < f['min'] for q in f['queries'])) self.assertTrue(any(q[1] >= f['min'] + f['height'] for q in f['queries'])) + def test_upgrade_height_all_sources_and_retained_cave_candidates(self): + bundle = {'settings': { + 'minecraft:overworld': json.dumps({'noise': {'min_y': -64, 'height': 384}}), + 'minecraft:end': json.dumps({'noise': {'min_y': 0, 'height': 128}})}, + 'presets': {'minecraft:overworld': '[]', 'minecraft:nether': '[]'}} + fixtures = [f for f in generation.corpus(bundle) if f.get('retrogen')] + self.assertEqual(len(fixtures), 36) + self.assertEqual({f['setting'] for f in fixtures}, {'minecraft:overworld'}) + self.assertEqual({f.get('source', 'multi') for f in fixtures}, {'multi', 'fixed', 'checkerboard', 'end'}) + self.assertEqual({f['fixed_biome'] for f in fixtures if 'fixed_biome' in f}, + {'minecraft:lush_caves', 'minecraft:dripstone_caves', 'minecraft:deep_dark'}) + self.assertTrue(all((f['write_min'], f['write_max'], f['repeats']) == (-64, -1, 2) for f in fixtures)) + self.assertTrue(all(any(q[1] == 0 for q in f['queries']) for f in fixtures)) + if __name__ == '__main__': unittest.main() diff --git a/tools/test_biome_chunk_parity.py b/tools/test_biome_chunk_parity.py index 9dc484b54..f484c1c5f 100644 --- a/tools/test_biome_chunk_parity.py +++ b/tools/test_biome_chunk_parity.py @@ -25,6 +25,21 @@ def corpus(): ops=[[0,1,-1,minimum,maximum],[17,67,-1,minimum,maximum],[97,129,0,minimum,maximum],[5,2,63,minimum,maximum],[9,8,64,minimum,maximum],[123,512,65,minimum,maximum],[17,3,-1,minimum+1,maximum-1],[-2**31,67,-1,minimum,maximum]] yield {'cx':cx,'cz':cz,'min':minimum,'height':height,'default':rng.randrange(512),'ops':ops,'queries':queries} + # Retention uses an existing column at quart Y=0. Include fills that overlap + # that column's section so later sections observe earlier committed sections. + for minimum,height in [(-64,128),(-64,64),(-16,32),(0,32),(64,16)]: + for cx,cz in [(0,0),(-1,2),(1875000,-1875000),(-2**31,2**31-1)]: + maximum=minimum+height-1 + queries=[[-2**31,-2**31,2**31-1],[2**31-1,2**31-1,-2**31],[-1,0,1],[0,-16,0],[3,15,3]] + ops=[[17,67,-1,minimum,maximum]] + for before,after in [(False,False),(True,True),(False,True),(True,False)]: + for salt,count,fail in [(19,512,-1),(0,3,-1),(7,512,0),(9,512,63),(17,512,64),(23,512,65)]: + ops.append([salt,count,fail,minimum,maximum,before,after]) + ops.append([31,512,-1,minimum+1,maximum-1,before,after]) + resolver_queries=[[candidate,*q,before,after] for candidate in [0,1,2,3,4,511,-1] + for before,after in [(False,False),(False,True),(True,False),(True,True)] for q in queries] + yield {'cx':cx,'cz':cz,'min':minimum,'height':height,'default':4,'ops':ops,'queries':queries,'resolver_queries':resolver_queries} + def main(): parser=argparse.ArgumentParser(description=__doc__);parser.add_argument("--prepare",action="store_true");args=parser.parse_args() @@ -39,7 +54,7 @@ def main(): fixtures=list(corpus());inputs=build/"inputs.txt";inputs.write_text("".join(json.dumps(f,separators=(",",":"))+"\n" for f in fixtures),encoding="utf-8") fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths);classes=build/"classes";classes.mkdir(exist_ok=True) def run(command,name): - with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + with (build/(name+".log")).open("w",encoding="utf-8") as log:subprocess.run(list(map(str,command)),cwd=lab.ROOT,check=True,timeout=3600,stdout=log,stderr=subprocess.STDOUT) dependency_path=os.pathsep.join(map(str,libraries)) run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle],"compile-java") run(["cargo","build","--release","-p","horizon-world","--example","biome_chunk_fixture"],"compile-rust") @@ -56,9 +71,9 @@ def main(): base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) report={"schema":1,"minecraft":lock["minecraft"]["version"],"manifest_sha1":lock["minecraft"]["manifest_sha1"],"platform":platform.platform(), "java":subprocess.check_output(["java","--version"],text=True).splitlines()[0],"rustc":subprocess.check_output(["rustc","--version"],text=True).strip(), - "fixtures":len(fixtures),"fills":sum(len(f["ops"]) for f in fixtures),"block_queries":sum(len(f["ops"])*len(f["queries"]) for f in fixtures), + "fixtures":len(fixtures),"fills":sum(len(f["ops"]) for f in fixtures),"block_queries":sum(len(f["ops"])*len(f["queries"]) for f in fixtures),"retrogen_fills":sum(len(op)>5 for f in fixtures for op in f["ops"]),"resolver_queries":sum(len(f.get("resolver_queries",[])) for f in fixtures), "sources_sha256":tested_sources,"fixtures_sha256":tested_fixtures,"rust_output_sha256":lab.digest(build/"rust.txt","sha256"),"references":references, - "scope":"Actual ChunkAccess.fillBiomesFromNoise, LevelChunkSection.fillBiomesFromNoise and chunk/section biome reads using synthetic registered holder identities. Ordered resolver queries, section contents and clamped/wrapped chunk lookups are compared after repeated fills and failures at section boundaries. Covers full supported aligned vertical bounds, generation bounds cutting through sections, negative/extreme chunk coordinates and 1..512 possible biome identities. Completed earlier sections survive failure while the failing section retains its previous values. This compares stored biome values, not native in-memory palette layout, wire encoding, biome-source generation, blending, retrogen or complete generated worlds."} + "scope":"Actual ChunkAccess.fillBiomesFromNoise, LevelChunkSection.fillBiomesFromNoise and chunk/section biome reads using synthetic registered holder identities. Ordered resolver queries, section contents and clamped/wrapped chunk lookups are compared after repeated fills and failures at section boundaries. Covers full supported aligned vertical bounds, generation bounds cutting through sections, negative/extreme chunk coordinates and 1..512 possible biome identities. Completed earlier sections survive failure while the failing section retains its previous values. Additional BelowZeroRetrogen.getBiomeResolver cases compare all three retained cave keys, a lookalike foreign namespace, ordinary keyed holders and a direct holder without a key. All four combinations of upgrade activation at resolver construction and after construction test the captured wrapping decision. Candidate invocation order, injected candidate failures, old-column reads with quart Y fixed to zero and X/Z wrapping, repeated fills, and overlap of generation bounds with the old column section are exercised. Synthetic generation bounds deliberately override the fixed native retrogen height to expose section commit/read ordering. Direct holder values and all keyed holders are identity-only placeholders; biome properties are not evaluated. This compares stored biome values and resolver behavior, not native in-memory palette layout, wire encoding, biome-source generation integration, nonempty blending or complete generated worlds."} lab.write_json(report_path,report);print(f"Scoped biome-chunk parity passed: {report_path}") diff --git a/tools/test_biome_generation_parity.py b/tools/test_biome_generation_parity.py index e0be3acb9..4c38070d7 100644 --- a/tools/test_biome_generation_parity.py +++ b/tools/test_biome_generation_parity.py @@ -31,6 +31,18 @@ def corpus(bundle): queries=[[cx*16+x,y,cz*16+z] for x in [-1,0,7,15,16] for z in [-1,0,7,15,16] for y in [minimum-1,minimum+17,minimum+height]] yield {'setting':setting,'preset':'minecraft:overworld','source':source,'scale':scale,'seed':seed,'legacy':legacy,'cx':cx,'cz':cz,'min':minimum,'height':height,'write_min':minimum,'write_max':minimum+height-1,'queries':queries,'repeats':2 if seed==0 else 1} + for setting,raw in sorted(bundle['settings'].items()): + value=json.loads(raw);minimum=value['noise']['min_y'];height=value['noise']['height'] + if minimum != -64: continue + for legacy in [False,True]: + for mode in ['multi_overworld','multi_nether','fixed','cave_fixed','checkerboard','end']: + for sample,(seed,cx,cz) in enumerate([(0,0,0),(-1,-2,3),(0x123456789abcdef,1875000,-1875000)]): + queries=[[cx*16+x,y,cz*16+z] for x in [-1,0,7,15,16] for z in [-1,0,7,15,16] for y in [-65,-64,-17,-1,0,1,minimum+height-1,minimum+height]] + fixture={'setting':setting,'preset':'minecraft:nether' if mode=='multi_nether' else 'minecraft:overworld','seed':seed,'legacy':legacy,'cx':cx,'cz':cz,'min':minimum,'height':height,'write_min':-64,'write_max':-1,'retrogen':True,'queries':queries,'repeats':2,'scale':2} + if not mode.startswith('multi_'):fixture['source']='fixed' if mode=='cave_fixed' else mode + if mode=='cave_fixed':fixture['fixed_biome']=['minecraft:lush_caves','minecraft:dripstone_caves','minecraft:deep_dark'][sample] + yield fixture + def main(): parser=argparse.ArgumentParser(description=__doc__);parser.add_argument("--prepare",action="store_true");args=parser.parse_args() @@ -45,7 +57,7 @@ def main(): tested_sources=base.source_hashes(sources) classes=build/"classes";classes.mkdir(exist_ok=True) def run(command,name): - with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + with (build/(name+".log")).open("w",encoding="utf-8") as log:subprocess.run(list(map(str,command)),cwd=lab.ROOT,check=True,timeout=3600,stdout=log,stderr=subprocess.STDOUT) dependency_path=os.pathsep.join(map(str,libraries)) run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle,exporter],"compile-java") bundle={} @@ -78,9 +90,9 @@ def main(): base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) report={"schema":1,"minecraft":lock["minecraft"]["version"],"manifest_sha1":lock["minecraft"]["manifest_sha1"],"platform":platform.platform(), "java":subprocess.check_output(["java","--version"],text=True).splitlines()[0],"rustc":subprocess.check_output(["rustc","--version"],text=True).strip(), - "fixtures":len(fixtures),"fills":sum(f["repeats"] for f in fixtures),"biome_values":sum(f["repeats"]*f["height"]*4 for f in fixtures),"block_queries":sum(f["repeats"]*len(f["queries"]) for f in fixtures),"preset_entries":{name:len(json.loads(raw)) for name,raw in bundle["presets"].items()},"source_fixtures":{name:sum(f.get("source","multi")==name for f in fixtures) for name in ["multi","fixed","checkerboard","end"]}, + "fixtures":len(fixtures),"retrogen_fixtures":sum(f.get("retrogen",False) for f in fixtures),"fills":sum(f["repeats"] for f in fixtures),"biome_values":sum(f["repeats"]*f["height"]*4 for f in fixtures),"block_queries":sum(f["repeats"]*len(f["queries"]) for f in fixtures),"preset_entries":{name:len(json.loads(raw)) for name,raw in bundle["presets"].items()},"source_fixtures":{name:sum(f.get("source","multi")==name for f in fixtures) for name in ["multi","fixed","checkerboard","end"]}, "sources_sha256":tested_sources,"fixtures_sha256":tested_fixtures,"rust_output_sha256":lab.digest(build/"rust.txt","sha256"),"references":references, - "scope":"Actual ChunkGenerator.doCreateBiomes through NoiseBasedChunkGenerator with empty Blender and no retrogen. Both bundled Overworld/Nether multi-noise preset tables are independently exported from authenticated JARs; Rust imports quantized tables and compiles climate routers itself. All seven bundled routers, both random modes, multiple seeds and distant positive/negative chunks are tested. Complete section biome values and subsequent BiomeManager block lookups are compared, including repeated generation with fresh density contexts and persistent previous-leaf search state, and generation bounds excluding top/bottom sections. Holders are identity placeholders; no biome properties are evaluated. Fixed, checkerboard and End source fixtures also run actual chunk generation through every bundled router, including real seeded End erosion, the central-island shortcut, distant coordinates and wrapped checkerboard shifts. Preset builders, complete biome-source codecs, blending, retrogen, terrain-stage linkage and complete generated worlds remain pending."} + "scope":"Actual ChunkGenerator.doCreateBiomes through NoiseBasedChunkGenerator with empty Blender, in ordinary and below-zero upgrade modes. Both bundled Overworld/Nether multi-noise preset tables are independently exported from authenticated JARs; Rust imports quantized tables and compiles climate routers itself. All seven bundled routers, both random modes, multiple seeds and distant positive/negative chunks are tested. Complete section biome values and subsequent BiomeManager block lookups are compared, including repeated generation with fresh density contexts and persistent previous-leaf search state, and generation bounds excluding top/bottom sections. Holders are identity placeholders; no biome properties are evaluated. Fixed, checkerboard and End source fixtures also run actual chunk generation through every bundled router, including real seeded End erosion, the central-island shortcut, distant coordinates and wrapped checkerboard shifts. Retrogen cases initialize patterned old biome columns, install actual below-zero metadata with a full target on an empty persisted-stage ProtoChunk, and use its native generation height. Four below-zero noise settings, all source kinds, fixed candidates for each of the three retained cave biomes, both random modes, signed/distant seeds and repeated fills are compared. Above-zero stored biomes remain checked alongside regenerated sections and block-level biome zoom. Rust composes seeded candidate resolvers with the independently tested retention fill. Preset builders, complete biome-source codecs, nonempty blending, complete terrain-stage scheduling and complete generated worlds remain pending."} lab.write_json(report_path,report);print(f"Scoped biome-generation parity passed: {report_path}") From 9dbd93192f55dbbaa6878a1968ccc4c9072b8d8e Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 20:10:30 +0200 Subject: [PATCH 044/253] Decode pinned cuboid models and verify native client semantics --- Cargo.lock | 7 + Cargo.toml | 2 +- .../scoped-parity.json | 37 ++ crates/horizon-assets/Cargo.toml | 10 + .../examples/cuboid_model_fixture.rs | 84 ++++ crates/horizon-assets/src/json.rs | 151 +++++++ crates/horizon-assets/src/lib.rs | 7 + crates/horizon-assets/src/model.rs | 394 ++++++++++++++++++ docs/native-client.md | 19 + docs/rust-parity.md | 4 + .../parity/VanillaCuboidModelOracle.java | 96 +++++ tools/test_cuboid_model_parity.py | 160 +++++++ 12 files changed, 970 insertions(+), 1 deletion(-) create mode 100644 benchmarks/rust-cuboid-model-decoding-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-assets/Cargo.toml create mode 100644 crates/horizon-assets/examples/cuboid_model_fixture.rs create mode 100644 crates/horizon-assets/src/json.rs create mode 100644 crates/horizon-assets/src/lib.rs create mode 100644 crates/horizon-assets/src/model.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCuboidModelOracle.java create mode 100644 tools/test_cuboid_model_parity.py diff --git a/Cargo.lock b/Cargo.lock index 4bccbdd69..d9b9907be 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -574,6 +574,13 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e17592d60ebacc7d5e169f4663c5f84f9161cc90328abcfe8456f41e4dfcb284" +[[package]] +name = "horizon-assets" +version = "0.1.0" +dependencies = [ + "serde_json", +] + [[package]] name = "horizon-client" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index eceb96075..70cf54aba 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace] -members = ["crates/horizon-core", "crates/horizon-world", "crates/voxel-kernels", "crates/horizon-client"] +members = ["crates/horizon-core", "crates/horizon-world", "crates/voxel-kernels", "crates/horizon-client", "crates/horizon-assets"] resolver = "2" [workspace.package] diff --git a/benchmarks/rust-cuboid-model-decoding-2026-10-06/scoped-parity.json b/benchmarks/rust-cuboid-model-decoding-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..c7d9db116 --- /dev/null +++ b/benchmarks/rust-cuboid-model-decoding-2026-10-06/scoped-parity.json @@ -0,0 +1,37 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "resource_models": 2883, + "synthetic_models": 2337, + "rejected_models": 1034, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCuboidModelOracle.java": "f6618f16614a47eb62b1cab40ebd514f075aa8590466a884f7e24e9f1844b065", + "tools/test_cuboid_model_parity.py": "3b7c018570b0f609aae43cef60ff3139c543d5d629be804a5aa257e3ab2dd67c", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "7b4ab0ffa35af7ea8b6e38525f18ff6c3e94768198915f5ffe560d84263423f8", + "crates/horizon-assets/Cargo.toml": "fadb78cf819e026500606c45d27138ed67fcbbc967ae8cee6c1e7c82c9046b36", + "crates/horizon-assets/examples/cuboid_model_fixture.rs": "03e44a7040326660b9681e17a78de86d6f5ff295f1cbef69b6fcb64ab4282e8b", + "crates/horizon-assets/src/json.rs": "e7b89bf4852f561a0e5bf1a984857c61e755961dfd86fcc326b6d55558615f39", + "crates/horizon-assets/src/lib.rs": "3dbc77b4438dbc1d77e6fb9c61fccbc29fd14ac90a54d35c1518385765cbe13e", + "crates/horizon-assets/src/model.rs": "57ddb3d65e88e7a8aa22c62bc298a2dae7f4e994326a873a31f06c0f36ed051b" + }, + "fixtures_sha256": { + ".local/rust-cuboid-model-parity/inputs.jsonl": "9c1822180e1d6869e65eea81a38cbcf3786b9286d4c839e31ba686501694d171" + }, + "rust_output_sha256": "80c4b305084658ab968ed466fb1609bfa78d60738d09790c6243b4de27dfb8fc", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "80c4b305084658ab968ed466fb1609bfa78d60738d09790c6243b4de27dfb8fc", + "matched_output_lines": 5220 + } + ], + "scope": "Actual pinned CuboidModel.fromStream parser compared over every bundled block model and synthetic JSON/numeric/syntax cases. Decoded geometry, texture materials/references, nullable children, inheritance markers, face quadrants, light emission and display transforms; floats compare by IEEE-754 bits. Rejections normalize exception text. This client-only API is absent from the server. Does not yet validate parent resolution, rotation matrices, quad baking, blockstate dispatch, rendered pixels or gameplay." +} diff --git a/crates/horizon-assets/Cargo.toml b/crates/horizon-assets/Cargo.toml new file mode 100644 index 000000000..c0e9f214d --- /dev/null +++ b/crates/horizon-assets/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "horizon-assets" +version = "0.1.0" +edition.workspace = true +license.workspace = true +rust-version.workspace = true +description = "Horizon version-specific model and resource decoding" + +[dependencies] +serde_json = { version = "1.0.151", features = ["raw_value"] } diff --git a/crates/horizon-assets/examples/cuboid_model_fixture.rs b/crates/horizon-assets/examples/cuboid_model_fixture.rs new file mode 100644 index 000000000..1d81cb218 --- /dev/null +++ b/crates/horizon-assets/examples/cuboid_model_fixture.rs @@ -0,0 +1,84 @@ +use horizon_assets::model::*; +use serde_json::{Value, json}; +use std::{ + collections::BTreeMap, + fs::File, + io::{BufRead, BufReader, BufWriter, Write}, +}; + +fn bits(values: [f32; N]) -> Vec { + values.map(f32::to_bits).to_vec() +} +fn transform(value: &DisplayTransform) -> Value { + match value { + DisplayTransform::Inherit => json!("inherit"), + DisplayTransform::Explicit(None) => Value::Null, + DisplayTransform::Explicit(Some(v)) => { + json!({"rotation":bits(v.rotation),"translation":bits(v.translation),"scale":bits(v.scale)}) + } + } +} +fn rotation(value: &ElementRotation) -> Value { + let angles = match value.value { + RotationValue::SingleAxis { axis, angle } => { + json!({"axis": match axis { Axis::X => "x", Axis::Y => "y", Axis::Z => "z" }, "angle":angle.to_bits()}) + } + RotationValue::EulerXyz(v) => json!(bits(v)), + }; + json!({"origin":bits(value.origin),"value":angles,"rescale":value.rescale}) +} +fn face(v: &Face) -> Value { + json!({"cull":v.cull.map(Direction::name),"tint":v.tint_index,"texture":v.texture,"rotation":v.rotation,"uv":v.uv.map(bits)}) +} +fn element(v: &Element) -> Value { + let faces: BTreeMap<_, _> = v + .faces + .iter() + .map(|(k, v)| (k.name(), v.as_ref().map(face))) + .collect(); + json!({"from":bits(v.from),"to":bits(v.to),"faces":faces,"rotation":v.rotation.as_ref().map(rotation),"shade":v.shade_direction_override.map(Direction::name),"light":v.light_emission}) +} +fn model(v: &CuboidModel) -> Value { + let textures: BTreeMap<_, _> = v + .textures + .iter() + .map(|(key, value)| { + ( + key, + match value { + TextureSlot::Reference(r) => json!({"reference":r}), + TextureSlot::Material(m) => { + json!({"sprite":m.sprite,"translucent":m.force_translucent}) + } + }, + ) + }) + .collect(); + let elements = v.elements.as_ref().map(|values| { + values + .iter() + .map(|v| v.as_ref().map(element)) + .collect::>() + }); + let display = v.display.as_ref().map(|v| { + DISPLAY_CONTEXTS + .into_iter() + .zip(v.contexts.iter().map(transform)) + .collect::>() + }); + json!({"parent":v.parent,"ao":v.ambient_occlusion,"gui":v.gui_light.map(|v| match v { GuiLight::Front => "front", GuiLight::Side => "side" }),"textures":textures,"elements":elements,"display":display}) +} +fn main() -> Result<(), Box> { + let args: Vec<_> = std::env::args().collect(); + let input = BufReader::new(File::open(&args[1])?); + let mut output = BufWriter::new(File::create(&args[2])?); + for line in input.lines() { + let row: Vec = serde_json::from_str(&line?)?; + let result = match CuboidModel::from_json(&row[1]) { + Ok(value) => json!({"name":row[0],"model":model(&value)}), + Err(_) => json!({"name":row[0],"error":true}), + }; + writeln!(output, "{result}")?; + } + Ok(()) +} diff --git a/crates/horizon-assets/src/json.rs b/crates/horizon-assets/src/json.rs new file mode 100644 index 000000000..4f6ed2594 --- /dev/null +++ b/crates/horizon-assets/src/json.rs @@ -0,0 +1,151 @@ +use serde_json::value::RawValue; +use std::{collections::BTreeMap, fmt}; + +#[derive(Debug)] +pub struct DecodeError(pub(crate) String); + +impl fmt::Display for DecodeError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str(&self.0) + } +} +impl std::error::Error for DecodeError {} +impl From for DecodeError { + fn from(value: serde_json::Error) -> Self { + Self(value.to_string()) + } +} +pub(crate) type Result = std::result::Result; +pub(crate) type Object<'a> = BTreeMap; +pub(crate) fn error(message: &str) -> DecodeError { + DecodeError(message.to_owned()) +} +/// The native reader recognizes numeric tokens only while they fit its 1024 +/// character lookahead buffer. This applies even in fields the model ignores. +pub(crate) fn validate_number_tokens(raw: &RawValue) -> Result<()> { + let mut quoted = false; + let mut escaped = false; + let mut length = 0; + for byte in raw.get().bytes() { + if quoted { + if escaped { + escaped = false; + } else if byte == b'\\' { + escaped = true; + } else if byte == b'"' { + quoted = false; + } + } else if byte == b'"' { + quoted = true; + length = 0; + } else if byte.is_ascii_digit() || b"-.eE+".contains(&byte) { + length += 1; + if length >= 1024 { + return Err(error("numeric token exceeds native reader buffer")); + } + } else { + length = 0; + } + } + Ok(()) +} +pub(crate) fn object(raw: &RawValue) -> Result> { + if !raw.get().starts_with('{') { + return Err(error("expected object")); + } + Ok(serde_json::from_str(raw.get())?) +} +pub(crate) fn array(raw: &RawValue) -> Result> { + Ok(serde_json::from_str(raw.get())?) +} +pub(crate) fn required<'a>(object: &Object<'a>, key: &str) -> Result<&'a RawValue> { + object + .get(key) + .copied() + .ok_or_else(|| error(&format!("missing {key}"))) +} +pub(crate) fn string(raw: &RawValue) -> Result { + Ok(serde_json::from_str(raw.get())?) +} +/// Gson's string helper accepts any primitive and preserves a number's spelling. +pub(crate) fn primitive_string(raw: &RawValue) -> Result { + match raw.get().as_bytes().first() { + Some(b'"') => string(raw), + Some(b't' | b'f' | b'-' | b'0'..=b'9') => Ok(raw.get().to_owned()), + _ => Err(error("expected primitive")), + } +} +pub(crate) fn boolean(raw: &RawValue) -> Result { + Ok(primitive_string(raw)?.eq_ignore_ascii_case("true")) +} +fn number(raw: &RawValue) -> Result<&str> { + match raw.get().as_bytes().first() { + Some(b'-' | b'0'..=b'9') => Ok(raw.get()), + _ => Err(error("expected number")), + } +} +pub(crate) fn float(raw: &RawValue) -> Result { + number(raw)?.parse().map_err(|_| error("invalid float")) +} +/// Gson LazilyParsedNumber.intValue truncates decimals then keeps the low 32 bits. +/// Work on decimal digits, avoiding f64 rounding and saturating Rust casts. +pub(crate) fn integer(raw: &RawValue) -> Result { + let raw = number(raw)?; + if raw.len() > 10_000 { + return Err(error("number string too long")); + } + let negative = raw.starts_with('-'); + let raw = raw.strip_prefix('-').unwrap_or(raw); + let (mantissa, exponent) = raw.split_once(['e', 'E']).unwrap_or((raw, "0")); + let exponent: i32 = exponent.parse().map_err(|_| error("invalid exponent"))?; + let fractional = mantissa.split_once('.').map_or(0, |(_, f)| f.len()); + let scale = + i64::try_from(fractional).map_err(|_| error("number too long"))? - i64::from(exponent); + if scale.abs() >= 10_000 { + return Err(error("unsupported decimal scale")); + } + let digits = mantissa.bytes().filter(|c| *c != b'.'); + let count = mantissa.len() - usize::from(mantissa.contains('.')); + let take = (count as i64 - scale.max(0)).max(0) as usize; + let mut value = 0u32; + for digit in digits.take(take) { + value = value.wrapping_mul(10).wrapping_add(u32::from(digit - b'0')); + } + if scale < 0 { + // 10^32 and larger are divisible by 2^32. + value = if scale <= -32 { + 0 + } else { + value.wrapping_mul(10u32.wrapping_pow((-scale) as u32)) + }; + } + Ok(if negative { + value.wrapping_neg() + } else { + value + } as i32) +} +pub(crate) fn vector(raw: &RawValue) -> Result<[f32; N]> { + let values = array(raw)?; + if values.len() != N { + return Err(error("wrong vector length")); + } + let mut result = [0.0; N]; + for (target, value) in result.iter_mut().zip(values) { + *target = float(value)?; + } + Ok(result) +} +pub(crate) fn identifier(name: &str) -> Result { + let (namespace, path) = name.split_once(':').unwrap_or(("minecraft", name)); + let namespace = if namespace.is_empty() { + "minecraft" + } else { + namespace + }; + let valid = |c: u8| c.is_ascii_lowercase() || c.is_ascii_digit() || b"_.-".contains(&c); + if !namespace.bytes().all(valid) || !path.bytes().all(|c| valid(c) || c == b'/') { + return Err(error("invalid resource identifier")); + } + Ok(format!("{namespace}:{path}")) +} diff --git a/crates/horizon-assets/src/lib.rs b/crates/horizon-assets/src/lib.rs new file mode 100644 index 000000000..2fa5fb89c --- /dev/null +++ b/crates/horizon-assets/src/lib.rs @@ -0,0 +1,7 @@ +//! Resource decoding for the pinned Java Edition client. +#![forbid(unsafe_code)] + +mod json; +pub mod model; + +pub use json::DecodeError; diff --git a/crates/horizon-assets/src/model.rs b/crates/horizon-assets/src/model.rs new file mode 100644 index 000000000..2e55f9a0f --- /dev/null +++ b/crates/horizon-assets/src/model.rs @@ -0,0 +1,394 @@ +//! The 26.3 cuboid model format, before parent resolution and quad baking. +//! +//! Absent geometry differs from an explicit empty element list. Explicit null +//! elements, faces and display transforms are retained as the native decoder +//! does; render preparation must diagnose these before baking. +use crate::json::*; +use serde_json::value::RawValue; +use std::collections::BTreeMap; + +#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] +pub enum Direction { + Down, + Up, + North, + South, + West, + East, +} +impl Direction { + pub const ALL: [Self; 6] = [ + Self::Down, + Self::Up, + Self::North, + Self::South, + Self::West, + Self::East, + ]; + pub fn name(self) -> &'static str { + match self { + Self::Down => "down", + Self::Up => "up", + Self::North => "north", + Self::South => "south", + Self::West => "west", + Self::East => "east", + } + } + pub fn by_name(name: &str) -> Option { + Self::ALL + .into_iter() + .find(|direction| direction.name() == name) + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum GuiLight { + Front, + Side, +} +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct Material { + pub sprite: String, + pub force_translucent: bool, +} +#[derive(Clone, Debug, PartialEq, Eq)] +pub enum TextureSlot { + Reference(String), + Material(Material), +} +#[derive(Clone, Debug, PartialEq)] +pub struct CuboidModel { + pub parent: Option, + pub ambient_occlusion: Option, + pub gui_light: Option, + pub textures: BTreeMap, + pub elements: Option>>, + pub display: Option, +} +#[derive(Clone, Debug, PartialEq)] +pub struct Element { + pub from: [f32; 3], + pub to: [f32; 3], + pub faces: BTreeMap>, + pub rotation: Option, + pub shade_direction_override: Option, + pub light_emission: u8, +} +#[derive(Clone, Debug, PartialEq)] +pub struct Face { + pub cull: Option, + pub tint_index: i32, + pub texture: String, + pub uv: Option<[f32; 4]>, + /// Normalized counterclockwise quadrants, in the range 0..4. + pub rotation: u8, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum Axis { + X, + Y, + Z, +} +#[derive(Clone, Debug, PartialEq)] +pub enum RotationValue { + SingleAxis { axis: Axis, angle: f32 }, + EulerXyz([f32; 3]), +} +#[derive(Clone, Debug, PartialEq)] +pub struct ElementRotation { + /// Block units, converted from model coordinates during decoding. + pub origin: [f32; 3], + pub value: RotationValue, + pub rescale: bool, +} +#[derive(Clone, Debug, PartialEq)] +pub struct ItemTransform { + pub rotation: [f32; 3], + pub translation: [f32; 3], + pub scale: [f32; 3], +} +/// Missing transforms inherit later. Explicit identity and null values do not. +#[derive(Clone, Debug, PartialEq)] +pub enum DisplayTransform { + Inherit, + Explicit(Option), +} +pub const DISPLAY_CONTEXTS: [&str; 9] = [ + "thirdperson_lefthand", + "thirdperson_righthand", + "firstperson_lefthand", + "firstperson_righthand", + "head", + "gui", + "ground", + "fixed", + "on_shelf", +]; +#[derive(Clone, Debug, PartialEq)] +pub struct ItemTransforms { + pub contexts: [DisplayTransform; 9], +} + +impl CuboidModel { + /// Decode strict JSON, preserving the native parser's primitive coercions, + /// optional inheritance fields, nullable children and f32 conversion. + /// Like the native stream entry point, this reads one value and leaves + /// trailing input unread. The pinned native entry point uses strict JSON. + pub fn from_json(json: &str) -> Result { + let raw = serde_json::Deserializer::from_str(json.strip_prefix('\u{feff}').unwrap_or(json)) + .into_iter::<&RawValue>() + .next() + .ok_or_else(|| error("empty model input"))??; + validate_number_tokens(raw)?; + Self::decode(raw) + } + fn decode(raw: &RawValue) -> Result { + let obj = object(raw)?; + let parent = obj + .get("parent") + .map(|r| primitive_string(r)) + .transpose()? + .unwrap_or_default(); + let parent = if parent.is_empty() { + None + } else { + Some(identifier(&parent)?) + }; + let ambient_occlusion = obj + .get("ambientocclusion") + .map(|r| boolean(r)) + .transpose()?; + let gui_light = obj + .get("gui_light") + .map(|raw| match primitive_string(raw)?.as_str() { + "front" => Ok(GuiLight::Front), + "side" => Ok(GuiLight::Side), + _ => Err(error("invalid gui light")), + }) + .transpose()?; + let mut textures = BTreeMap::new(); + if let Some(raw) = obj.get("textures") { + for (key, raw) in object(raw)? { + textures.insert(key, texture(raw)?); + } + } + let elements = obj + .get("elements") + .map(|raw| { + array(raw)? + .into_iter() + .map(|raw| nullable(raw, Element::decode)) + .collect::>>() + }) + .transpose()?; + let display = obj + .get("display") + .map(|r| ItemTransforms::decode(r)) + .transpose()?; + Ok(Self { + parent, + ambient_occlusion, + gui_light, + textures, + elements, + display, + }) + } +} +fn nullable(raw: &RawValue, decode: impl FnOnce(&RawValue) -> Result) -> Result> { + if raw.get() == "null" { + Ok(None) + } else { + decode(raw).map(Some) + } +} +fn texture(raw: &RawValue) -> Result { + if raw.get().starts_with('"') { + let name = string(raw)?; + if name.is_empty() { + return Err(error("empty texture slot value")); + } + if let Some(target) = name.strip_prefix('#') { + return Ok(TextureSlot::Reference(target.to_owned())); + } + return Ok(TextureSlot::Material(Material { + sprite: identifier(&name)?, + force_translucent: false, + })); + } + let obj = object(raw)?; + let sprite = identifier(&string(required(&obj, "sprite")?)?)?; + let force_translucent = match obj.get("force_translucent") { + None => false, + Some(raw) if raw.get() == "null" => false, + Some(raw) if raw.get() == "true" => true, + Some(raw) if raw.get() == "false" => false, + Some(_) => return Err(error("invalid material boolean")), + }; + Ok(TextureSlot::Material(Material { + sprite, + force_translucent, + })) +} +impl Element { + fn decode(raw: &RawValue) -> Result { + let obj = object(raw)?; + let from = vector(required(&obj, "from")?)?; + let to = vector(required(&obj, "to")?)?; + if from.iter().chain(&to).any(|v| !(-16.0..=32.0).contains(v)) { + return Err(error("element outside model bounds")); + } + let rotation = obj + .get("rotation") + .map(|r| ElementRotation::decode(r)) + .transpose()?; + let mut faces = BTreeMap::new(); + for (name, raw) in object(required(&obj, "faces")?)? { + let direction = + Direction::by_name(&name).ok_or_else(|| error("invalid face direction"))?; + faces.insert(direction, nullable(raw, Face::decode)?); + } + if faces.is_empty() { + return Err(error("element requires a face")); + } + let shade_direction_override = obj + .get("shade_direction_override") + .map(|raw| { + Direction::by_name(&primitive_string(raw)?) + .ok_or_else(|| error("invalid shade direction")) + }) + .transpose()?; + let light_emission = obj + .get("light_emission") + .map(|r| integer(r)) + .transpose()? + .unwrap_or(0); + if !(0..=15).contains(&light_emission) { + return Err(error("invalid light emission")); + } + Ok(Self { + from, + to, + faces, + rotation, + shade_direction_override, + light_emission: light_emission as u8, + }) + } +} +impl Face { + fn decode(raw: &RawValue) -> Result { + let obj = object(raw)?; + let cull = obj + .get("cullface") + .map(|r| primitive_string(r)) + .transpose()? + .and_then(|s| Direction::by_name(&s)); + let texture = primitive_string(required(&obj, "texture")?)?; + let tint_index = obj + .get("tintindex") + .map(|r| integer(r)) + .transpose()? + .unwrap_or(-1); + let rotation = obj + .get("rotation") + .map(|r| integer(r)) + .transpose()? + .unwrap_or(0) + .rem_euclid(360); + if rotation % 90 != 0 { + return Err(error("face rotation must be a multiple of 90")); + } + let uv = obj.get("uv").map(|r| vector(r)).transpose()?; + Ok(Self { + cull, + tint_index, + texture, + uv, + rotation: (rotation / 90) as u8, + }) + } +} +impl ElementRotation { + fn decode(raw: &RawValue) -> Result { + let obj = object(raw)?; + let origin = vector::<3>(required(&obj, "origin")?)?.map(|v| v * 0.0625); + let value = if obj.contains_key("axis") || obj.contains_key("angle") { + let axis = match primitive_string(required(&obj, "axis")?)? + .to_lowercase() + .as_str() + { + "x" => Axis::X, + "y" => Axis::Y, + "z" => Axis::Z, + _ => return Err(error("invalid rotation axis")), + }; + RotationValue::SingleAxis { + axis, + angle: float(required(&obj, "angle")?)?, + } + } else if ["x", "y", "z"].iter().any(|key| obj.contains_key(*key)) { + let mut angles = [0.0; 3]; + for (angle, key) in angles.iter_mut().zip(["x", "y", "z"]) { + *angle = obj.get(key).map(|r| float(r)).transpose()?.unwrap_or(0.0); + } + RotationValue::EulerXyz(angles) + } else { + return Err(error("missing rotation value")); + }; + let rescale = obj + .get("rescale") + .map(|r| boolean(r)) + .transpose()? + .unwrap_or(false); + Ok(Self { + origin, + value, + rescale, + }) + } +} +impl ItemTransform { + fn decode(raw: &RawValue) -> Result { + let obj = object(raw)?; + let rotation = obj + .get("rotation") + .map(|r| vector(r)) + .transpose()? + .unwrap_or([0.0; 3]); + let translation = obj + .get("translation") + .map(|r| vector(r)) + .transpose()? + .unwrap_or([0.0; 3]) + .map(|v| (v * 0.0625).clamp(-5.0, 5.0)); + let scale = obj + .get("scale") + .map(|r| vector(r)) + .transpose()? + .unwrap_or([1.0; 3]) + .map(|v| v.clamp(-4.0, 4.0)); + Ok(Self { + rotation, + translation, + scale, + }) + } +} +impl ItemTransforms { + fn decode(raw: &RawValue) -> Result { + let obj = object(raw)?; + let mut contexts = std::array::from_fn(|_| DisplayTransform::Inherit); + for (transform, key) in contexts.iter_mut().zip(DISPLAY_CONTEXTS) { + if let Some(raw) = obj.get(key) { + *transform = DisplayTransform::Explicit(nullable(raw, ItemTransform::decode)?); + } + } + for (left, right) in [(0, 1), (2, 3)] { + if contexts[left] == DisplayTransform::Inherit { + contexts[left] = contexts[right].clone(); + } + } + Ok(Self { contexts }) + } +} diff --git a/docs/native-client.md b/docs/native-client.md index e33c222e2..6a4fcaad3 100644 --- a/docs/native-client.md +++ b/docs/native-client.md @@ -53,6 +53,25 @@ physical key positions; typing the character W can report physical Escape. ## Validation +The separate `horizon-assets` crate decodes the pinned 26.3 cuboid model format. +Its native comparison covers all **2,883 block-model JSON files** in the client +JAR plus **2,337 synthetic cases**: element bounds, optional geometry, nullable +children, face UVs and quarter turns, single-axis/Euler rotations, texture +references and translucency materials, light emission, display transforms and +inheritance markers. Floating-point fields compare by their exact bits. The +comparison also covers primitive coercion, integer truncation/wraparound and +selected strict-reader numeric/syntax limits. + +```sh +python3 tools/test_cuboid_model_parity.py +``` + +The [archived decoder result](../benchmarks/rust-cuboid-model-decoding-2026-10-06/scoped-parity.json) +records source, fixture and reference hashes. The oracle uses actual client +classes; those rendering APIs are absent from the server. This decoder is not +yet connected to the development renderer. Parent resolution, rotation matrices, +quad baking, blockstate selection and rendered appearance need their own checks. + ```sh cargo +stable test -p horizon-client cargo +stable clippy --workspace --all-targets -- -D warnings diff --git a/docs/rust-parity.md b/docs/rust-parity.md index 67f32ac3d..3e40ec2e0 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -13,6 +13,10 @@ families now have native differential coverage. Full simulation callbacks, complete chunk generation, entity behavior, networking, rendering and playable integration remain unfinished. The linked subsystem documents and hashed reports record the exact tested scope and remaining gaps. +The `horizon-assets` crate now decodes pinned cuboid models, with all 2,883 bundled +block-model JSON files and 2,337 synthetic cases compared against the actual +client parser. [Decoder scope and validation](native-client.md#validation) +are separate from the unfinished model-resolution and rendering integration. The playable Java performance packs remain available during development. ## Completion criteria and playable builds diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCuboidModelOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCuboidModelOracle.java new file mode 100644 index 000000000..134851504 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCuboidModelOracle.java @@ -0,0 +1,96 @@ +package dev.horizonlab.parity; + +import com.google.gson.*; +import java.io.*; +import java.nio.file.*; +import java.util.*; +import net.minecraft.client.resources.model.cuboid.*; +import net.minecraft.client.resources.model.sprite.TextureSlots; +import net.minecraft.world.item.ItemDisplayContext; +import org.joml.Vector3fc; + +/** Original adapter around the pinned client parser. No model assets are embedded. */ +public final class VanillaCuboidModelOracle { + private static final Gson JSON = new GsonBuilder().serializeNulls().create(); + private static long bits(float value) { return Integer.toUnsignedLong(Float.floatToIntBits(value)); } + private static Object vector(Vector3fc value) { return new long[]{bits(value.x()), bits(value.y()), bits(value.z())}; } + private static String direction(net.minecraft.core.Direction value) { return value == null ? null : value.getName(); } + private static Map map(Object... values) { + var result = new TreeMap(); + for (int i=0;i map("axis", single.axis().getName(), "angle", bits(single.angle())); + case CuboidRotation.EulerXYZRotation euler -> new long[]{bits(euler.x()), bits(euler.y()), bits(euler.z())}; + default -> throw new AssertionError("Unexpected parsed rotation " + value.value().getClass()); + }; + return map("origin", vector(value.origin()), "value", angles, "rescale", value.rescale()); + } + private static Object face(CuboidFace value) { + if (value == null) return null; + var uv = value.uvs(); + return map("cull", direction(value.cullForDirection()), "tint", value.tintIndex(), "texture", value.texture(), + "rotation", value.rotation().ordinal(), "uv", uv == null ? null : new long[]{bits(uv.minU()), bits(uv.minV()), bits(uv.maxU()), bits(uv.maxV())}); + } + private static Object element(CuboidModelElement value) { + if (value == null) return null; + var faces = new TreeMap(); + value.faces().forEach((key, f) -> faces.put(key.getName(), face(f))); + return map("from", vector(value.from()), "to", vector(value.to()), "faces", faces, + "rotation", rotation(value.rotation()), "shade", direction(value.shadeDirectionOverride()), "light", value.lightEmission()); + } + private static Object model(CuboidModel value) throws Exception { + if (value == null) return null; + var textures = new TreeMap(); + // Slot implementation records are package-private; inspect only their public accessors. + for (var entry : value.textureSlots().values().entrySet()) { + Object slot = entry.getValue(); + var cls = slot.getClass(); + if (cls.getSimpleName().equals("Reference")) { + var target = cls.getDeclaredMethod("target"); target.setAccessible(true); + textures.put(entry.getKey(), map("reference", target.invoke(slot))); + } else { + var method = cls.getDeclaredMethod("material"); method.setAccessible(true); + var material = (net.minecraft.client.resources.model.sprite.Material)method.invoke(slot); + textures.put(entry.getKey(), map("sprite", material.sprite().toString(), "translucent", material.forceTranslucent())); + } + } + List elements = null; + if (value.geometry() != null) { + elements = new ArrayList<>(); + for (var element : ((UnbakedCuboidGeometry)value.geometry()).elements()) elements.add(element(element)); + } + Object display = null; + if (value.transforms() != null) { + var transforms = new TreeMap(); + for (var context : ItemDisplayContext.values()) { + if (context != ItemDisplayContext.NONE) transforms.put(context.getSerializedName(), transform(value.transforms().getTransform(context))); + } + display = transforms; + } + return map("parent", value.parent() == null ? null : value.parent().toString(), "ao", value.ambientOcclusion(), + "gui", value.guiLight() == null ? null : value.guiLight().name().toLowerCase(Locale.ROOT), "textures", textures, "elements", elements, "display", display); + } + public static void main(String[] args) throws Exception { + net.minecraft.SharedConstants.tryDetectVersion(); + try (var input=Files.newBufferedReader(Path.of(args[0])); var output=Files.newBufferedWriter(Path.of(args[1]))) { + for (String line; (line=input.readLine())!=null;) { + var row=JsonParser.parseString(line).getAsJsonArray(); + CuboidModel decoded; + try { decoded=CuboidModel.fromStream(new StringReader(row.get(1).getAsString())); } + catch (RuntimeException failure) { + output.write(JSON.toJson(map("name", row.get(0).getAsString(), "error", true))); output.newLine(); continue; + } + output.write(JSON.toJson(map("name", row.get(0).getAsString(), "model", model(decoded)))); output.newLine(); + } + } + } +} diff --git a/tools/test_cuboid_model_parity.py b/tools/test_cuboid_model_parity.py new file mode 100644 index 000000000..bc0b3da57 --- /dev/null +++ b/tools/test_cuboid_model_parity.py @@ -0,0 +1,160 @@ +#!/usr/bin/env python3 +"""Compare cuboid decoding with the actual pinned client parser (client-only API).""" +import argparse +import copy +import json +import os +from pathlib import Path +import platform +import random +import subprocess +import zipfile + +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab, test_rust_parity as base + + +def corpus(): + element = {'from': [0, 0, 0], 'to': [16, 16, 16], 'faces': {'north': {'texture': '#all'}}} + values = [None, False, True, 0, 1, -1, 15, 16, 90, 90.9, -90, 360, 450, 1e30, + '', 'true', 'TRUE', 'false', 'north', 'NORTH', 'x', '#all', [], {}, [0, 0, 0]] + for raw in ['null', '{}', '[]', 'false', '0', '"model"', '{"elements":[]}', + '{"elements":[null]}', '{"elements":null}', '{"parent":"","textures":{}}', + '{} trailing', '{} {}', '\ufeff{}', '', ' ', '{"unknown":NaN}', + '{"unknown":Infinity}', '{"unknown":01}', '{"unknown":true,}', '{/*comment*/}', + '{"unknown":"unescaped\nnewline"}', '{unquoted:0}']: + yield raw + for field in ['parent', 'ambientocclusion', 'gui_light', 'textures', 'display', 'elements']: + for value in values: + yield json.dumps({field: value}) + for name in ['block/cube_all', ':block/cube_all', 'horizon:test', ':', 'minecraft:', + 'a:b:c', 'Minecraft:cube', 'a:b c', '../cube', 'é', 'a:/', 'a:.']: + yield json.dumps({'parent': name}) + yield json.dumps({'textures': {'all': name}}) + for value in values + ['#', '##all', 'block/stone', ':block/stone', + {'sprite': 'block/glass'}, {'sprite': ''}, {'sprite': None}]: + yield json.dumps({'textures': {'all': value}}) + for value in values: + yield json.dumps({'textures': {'all': {'sprite': 'block/glass', 'force_translucent': value}}}) + for field in ['from', 'to', 'rotation', 'faces', 'shade_direction_override', 'light_emission', 'shade']: + for value in values: + modified = copy.deepcopy(element); modified[field] = value + yield json.dumps({'elements': [modified]}) + for field in ['cullface', 'texture', 'tintindex', 'uv', 'rotation']: + for value in values: + modified = copy.deepcopy(element); modified['faces']['north'][field] = value + yield json.dumps({'elements': [modified]}) + for direction in ['down', 'up', 'north', 'south', 'west', 'east', 'NORTH', 'north ', '']: + for value in [None, {'texture': '#all'}, {}]: + modified = copy.deepcopy(element); modified['faces'] = {direction: value} + yield json.dumps({'elements': [modified]}) + for rotation in [{'origin': [8, 8, 8]}, {'origin': [8, 8, 8], 'x': 30}, + {'origin': [8, 8, 8], 'y': 20, 'z': 10}, + {'origin': [-32, 0, 64], 'axis': 'X', 'angle': 63, 'x': None}, + {'origin': [0, 0, 0], 'angle': 45, 'x': 0}, + {'origin': [0, 0, 0], 'axis': 'y', 'x': 0}]: + modified = copy.deepcopy(element); modified['rotation'] = rotation + yield json.dumps({'elements': [modified]}) + for key in ['origin', 'axis', 'angle', 'rescale', 'x', 'y', 'z']: + for value in values: + rotation = {'origin': [8, 8, 8], 'axis': 'y', 'angle': 22.5} if key in ['axis', 'angle'] else {'origin': [8, 8, 8], 'x': 45} + rotation[key] = value + modified = copy.deepcopy(element); modified['rotation'] = rotation + yield json.dumps({'elements': [modified]}) + for context in ['thirdperson_lefthand', 'thirdperson_righthand', 'firstperson_lefthand', + 'firstperson_righthand', 'head', 'gui', 'ground', 'fixed', 'on_shelf', 'unknown']: + for value in values + [{'rotation': [1, 2, 3], 'translation': [-81, -0.0, 81], 'scale': [-5, 0, 5]}]: + yield json.dumps({'display': {context: value}}) + for left in ['thirdperson_lefthand', 'firstperson_lefthand']: + right = left.replace('lefthand', 'righthand') + for value in [None, {}, {'scale': [1, 2, 3]}]: + yield json.dumps({'display': {left: value, right: {'rotation': [1, 2, 3]}}}) + yield json.dumps({'display': {right: {'rotation': [1, 2, 3]}}}) + # Raw tokens retain decimal spelling, integer wraparound and direct f32 rounding. + numbers = ['-0.0', '1e02', '90.999', '-90.999', '4294967296', '4294967297', + '9223372036854775809', '-9223372036854775809', '1e100', '1e-100', + '1e2147483647', '1e2147483648', '1e-2147483648', + '1.00000005960464477539062500000001', '1e-46', '-1e-46', '3.5e38', + '1e9999', '1e10000', '1e-9999', '1e-10000', '1.0e10000', '1.0e10001', + '1' * 1023, '1' * 1024, '1' * 10000, '1' * 10001] + for number in numbers: + for field in ['tintindex', 'rotation', 'texture']: + yield '{"elements":[{"from":[0,0,0],"to":[16,16,16],"faces":{"up":{"texture":"#all","' + field + '":' + number + '}}}]}' + yield '{"display":{"gui":{"rotation":[' + number + ',0,0],"translation":[' + number + ',0,0],"scale":[' + number + ',0,0]}}}' + rng = random.Random(0x4355424f4944) + for _ in range(1200): + modified = copy.deepcopy(element) + modified['from'] = [rng.uniform(-17, 33) for _ in range(3)] + modified['to'] = [rng.uniform(-17, 33) for _ in range(3)] + modified['rotation'] = {'origin': [rng.uniform(-100, 100) for _ in range(3)], 'rescale': rng.choice([False, True])} + if rng.randrange(2): + modified['rotation'].update(axis=rng.choice(['x', 'y', 'z']), angle=rng.uniform(-720, 720)) + else: + modified['rotation'].update(zip(['x', 'y', 'z'], [rng.uniform(-720, 720) for _ in range(3)])) + modified['faces'] = {rng.choice(['down', 'up', 'north', 'south', 'west', 'east']): { + 'texture': '#all', 'rotation': 90 * rng.randrange(-12, 13), 'tintindex': rng.randrange(-4, 5), + 'uv': [rng.uniform(-32, 32) for _ in range(4)]}} + modified['light_emission'] = rng.randrange(16) + yield json.dumps({'elements': [modified]}) + + +def canonicalize(path): + rows = [json.loads(line) for line in path.read_text().splitlines()] + path.write_text(''.join(json.dumps(row, sort_keys=True, separators=(',', ':')) + '\n' for row in rows)) + return sum('error' in row for row in rows) + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--prepare', action='store_true') + args = parser.parse_args() + if args.prepare: + lab.prepare() + lock, jars, libraries = base.verify_artifacts() + build = lab.LOCAL / 'rust-cuboid-model-parity'; build.mkdir(parents=True, exist_ok=True) + report_path = build / 'report.json'; report_path.unlink(missing_ok=True) + oracle = lab.ROOT / 'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCuboidModelOracle.java' + crate = lab.ROOT / 'crates/horizon-assets' + sources = [oracle, Path(__file__), lab.ROOT / 'tools/lab.py', lab.ROOT / 'tools/test_rust_parity.py', + lab.ROOT / 'Cargo.toml', lab.ROOT / 'Cargo.lock', crate / 'Cargo.toml', + *sorted(crate.rglob('*.rs'))] + tested_sources = base.source_hashes(sources) + with zipfile.ZipFile(jars['client']) as archive: + names = sorted(name for name in archive.namelist() if name.startswith('assets/minecraft/models/block/') and name.endswith('.json')) + rows = [(name, archive.read(name).decode()) for name in names] + synthetic = list(corpus()) + rows += [(f'synthetic/{index}', raw) for index, raw in enumerate(synthetic)] + inputs = build / 'inputs.jsonl' + inputs.write_text(''.join(json.dumps(row) + '\n' for row in rows)) + fixtures = base.source_hashes([inputs]) + classes = build / 'classes'; classes.mkdir(exist_ok=True) + def run(command, name): + with (build / (name + '.log')).open('w') as log: + subprocess.run(list(map(str, command)), cwd=lab.ROOT, check=True, timeout=3600, stdout=log, stderr=subprocess.STDOUT) + dependencies = os.pathsep.join(map(str, [jars['client'], *libraries])) + run(['javac', '--release', lock['minecraft']['java_major'], '-proc:none', '-cp', dependencies, '-d', classes, oracle], 'compile-java') + run(['cargo', 'build', '--locked', '-p', 'horizon-assets', '--example', 'cuboid_model_fixture'], 'compile-rust') + metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--locked', '--no-deps', '--format-version', '1'], cwd=lab.ROOT)) + binary = Path(metadata['target_directory']) / 'debug/examples' / ('cuboid_model_fixture.exe' if os.name == 'nt' else 'cuboid_model_fixture') + run([binary, inputs, build / 'rust.jsonl'], 'rust') + run(['java', '-Xmx512M', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.VanillaCuboidModelOracle', inputs, build / 'client.jsonl'], 'client') + rejected = canonicalize(build / 'client.jsonl'); canonicalize(build / 'rust.jsonl') + matched = base.compare(build / 'client.jsonl', build / 'rust.jsonl') + base.ensure_sources_unchanged(sources, tested_sources); base.ensure_sources_unchanged([inputs], fixtures) + report = {'schema': 1, 'minecraft': lock['minecraft']['version'], 'manifest_sha1': lock['minecraft']['manifest_sha1'], + 'platform': platform.platform(), 'java': subprocess.check_output(['java', '--version'], text=True).splitlines()[0], + 'rustc': subprocess.check_output(['rustc', '--version'], text=True).strip(), + 'resource_models': len(names), 'synthetic_models': len(synthetic), 'rejected_models': rejected, + 'sources_sha256': tested_sources, 'fixtures_sha256': fixtures, + 'rust_output_sha256': lab.digest(build / 'rust.jsonl', 'sha256'), + 'references': [{'side': 'client', 'jar_sha256': lab.digest(jars['client'], 'sha256'), + 'output_sha256': lab.digest(build / 'client.jsonl', 'sha256'), 'matched_output_lines': matched}], + 'scope': 'Actual pinned CuboidModel.fromStream parser compared over every bundled block model and synthetic JSON/numeric/syntax cases. Decoded geometry, texture materials/references, nullable children, inheritance markers, face quadrants, light emission and display transforms; floats compare by IEEE-754 bits. Rejections normalize exception text. This client-only API is absent from the server. Does not yet validate parent resolution, rotation matrices, quad baking, blockstate dispatch, rendered pixels or gameplay.'} + lab.write_json(report_path, report) + print(f'Client cuboid decoding: {matched:,} models match ({rejected:,} rejected); {report_path}', flush=True) + + +if __name__ == '__main__': + main() From f0a03aea52b1aeddaf45468548eb592c8786cfa4 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 20:17:53 +0200 Subject: [PATCH 045/253] Resolve vanilla model inheritance and texture aliases --- .../scoped-parity.json | 11 +- .../scoped-parity.json | 42 +++ .../examples/cuboid_model_fixture.rs | 69 +---- .../examples/model_resolution_fixture.rs | 68 +++++ crates/horizon-assets/examples/support/mod.rs | 67 +++++ crates/horizon-assets/src/lib.rs | 1 + crates/horizon-assets/src/resolve.rs | 243 ++++++++++++++++++ docs/native-client.md | 20 +- docs/rust-parity.md | 3 +- .../parity/VanillaCuboidModelOracle.java | 6 +- .../parity/VanillaModelResolutionOracle.java | 63 +++++ tools/test_model_resolution_parity.py | 119 +++++++++ 12 files changed, 637 insertions(+), 75 deletions(-) create mode 100644 benchmarks/rust-model-resolution-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-assets/examples/model_resolution_fixture.rs create mode 100644 crates/horizon-assets/examples/support/mod.rs create mode 100644 crates/horizon-assets/src/resolve.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaModelResolutionOracle.java create mode 100644 tools/test_model_resolution_parity.py diff --git a/benchmarks/rust-cuboid-model-decoding-2026-10-06/scoped-parity.json b/benchmarks/rust-cuboid-model-decoding-2026-10-06/scoped-parity.json index c7d9db116..6f606fd7b 100644 --- a/benchmarks/rust-cuboid-model-decoding-2026-10-06/scoped-parity.json +++ b/benchmarks/rust-cuboid-model-decoding-2026-10-06/scoped-parity.json @@ -9,17 +9,20 @@ "synthetic_models": 2337, "rejected_models": 1034, "sources_sha256": { - "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCuboidModelOracle.java": "f6618f16614a47eb62b1cab40ebd514f075aa8590466a884f7e24e9f1844b065", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCuboidModelOracle.java": "7526f20513c549483122ab0d5ad24b9e87f38dc2f6aae55addd701a91ac85e43", "tools/test_cuboid_model_parity.py": "3b7c018570b0f609aae43cef60ff3139c543d5d629be804a5aa257e3ab2dd67c", "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", "Cargo.lock": "7b4ab0ffa35af7ea8b6e38525f18ff6c3e94768198915f5ffe560d84263423f8", "crates/horizon-assets/Cargo.toml": "fadb78cf819e026500606c45d27138ed67fcbbc967ae8cee6c1e7c82c9046b36", - "crates/horizon-assets/examples/cuboid_model_fixture.rs": "03e44a7040326660b9681e17a78de86d6f5ff295f1cbef69b6fcb64ab4282e8b", + "crates/horizon-assets/examples/cuboid_model_fixture.rs": "97609d90e3f6ce340f3590296db2dc778113bb2b33c7d1b54080a1d6f3023f40", + "crates/horizon-assets/examples/model_resolution_fixture.rs": "c071067140299e49345a6ebd94e15b3b6d853cb9ae11d8de46e3cbdfb8b01f0e", + "crates/horizon-assets/examples/support/mod.rs": "bcf5a6d8a54845982191e037911c24139237771d6afa4b01b1e83c011489c3f5", "crates/horizon-assets/src/json.rs": "e7b89bf4852f561a0e5bf1a984857c61e755961dfd86fcc326b6d55558615f39", - "crates/horizon-assets/src/lib.rs": "3dbc77b4438dbc1d77e6fb9c61fccbc29fd14ac90a54d35c1518385765cbe13e", - "crates/horizon-assets/src/model.rs": "57ddb3d65e88e7a8aa22c62bc298a2dae7f4e994326a873a31f06c0f36ed051b" + "crates/horizon-assets/src/lib.rs": "0d31dd0fa84d7b4467a78a1a2b8a8e179533ef5e64a7cbae88e5358e59160a40", + "crates/horizon-assets/src/model.rs": "57ddb3d65e88e7a8aa22c62bc298a2dae7f4e994326a873a31f06c0f36ed051b", + "crates/horizon-assets/src/resolve.rs": "3927ac926cdcbd7d334901cc32d0ecc1e498b1bec98f76a46bca6d4964c13541" }, "fixtures_sha256": { ".local/rust-cuboid-model-parity/inputs.jsonl": "9c1822180e1d6869e65eea81a38cbcf3786b9286d4c839e31ba686501694d171" diff --git a/benchmarks/rust-model-resolution-2026-10-06/scoped-parity.json b/benchmarks/rust-model-resolution-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..5b18ce2cf --- /dev/null +++ b/benchmarks/rust-model-resolution-2026-10-06/scoped-parity.json @@ -0,0 +1,42 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "resource_models": 2883, + "graph_fixtures": 439, + "rejected_cyclic_roots": 702, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaModelResolutionOracle.java": "bd6581d68c69a96586d158ede8be4f3270d0d7a16288ca82dddab16785685b26", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCuboidModelOracle.java": "7526f20513c549483122ab0d5ad24b9e87f38dc2f6aae55addd701a91ac85e43", + "tools/test_model_resolution_parity.py": "d9595f2f1442f1f590b72d2a46600657e79ae103bec3d4c45db98242b964bde0", + "tools/test_cuboid_model_parity.py": "3b7c018570b0f609aae43cef60ff3139c543d5d629be804a5aa257e3ab2dd67c", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "7b4ab0ffa35af7ea8b6e38525f18ff6c3e94768198915f5ffe560d84263423f8", + "crates/horizon-assets/Cargo.toml": "fadb78cf819e026500606c45d27138ed67fcbbc967ae8cee6c1e7c82c9046b36", + "crates/horizon-assets/examples/cuboid_model_fixture.rs": "97609d90e3f6ce340f3590296db2dc778113bb2b33c7d1b54080a1d6f3023f40", + "crates/horizon-assets/examples/model_resolution_fixture.rs": "c071067140299e49345a6ebd94e15b3b6d853cb9ae11d8de46e3cbdfb8b01f0e", + "crates/horizon-assets/examples/support/mod.rs": "bcf5a6d8a54845982191e037911c24139237771d6afa4b01b1e83c011489c3f5", + "crates/horizon-assets/src/json.rs": "e7b89bf4852f561a0e5bf1a984857c61e755961dfd86fcc326b6d55558615f39", + "crates/horizon-assets/src/lib.rs": "0d31dd0fa84d7b4467a78a1a2b8a8e179533ef5e64a7cbae88e5358e59160a40", + "crates/horizon-assets/src/model.rs": "57ddb3d65e88e7a8aa22c62bc298a2dae7f4e994326a873a31f06c0f36ed051b", + "crates/horizon-assets/src/resolve.rs": "3927ac926cdcbd7d334901cc32d0ecc1e498b1bec98f76a46bca6d4964c13541" + }, + "fixtures_sha256": { + ".local/rust-model-resolution-parity/inputs.jsonl": "9b3f9cb64bdb84303a3393ab035a00c11e857a5140e2992c0c5ebac0da2d3744" + }, + "rust_output_sha256": "146858eb5c73a16d71bf255bbd21f6082f330df5b322f10a288b4149b2cc98a4", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "146858eb5c73a16d71bf255bbd21f6082f330df5b322f10a288b4149b2cc98a4", + "matched_output_lines": 5648 + } + ], + "scope": "Actual ModelDiscovery and ResolvedModel/TextureSlots APIs over all bundled block models plus synthetic parent/alias graphs. Compares inherited geometry, AO/gui defaults, per-context display transforms, resolved materials, missing-model fallback, ignored built-in override, cyclic parent rejection, long alias/parent chains and slot lookup. Native rejection text/logging and discovery map iteration order are not compared. Geometry is shared through Arc in Rust; this does not prove quad baking, blockstate dispatch, pixels or gameplay." +} diff --git a/crates/horizon-assets/examples/cuboid_model_fixture.rs b/crates/horizon-assets/examples/cuboid_model_fixture.rs index 1d81cb218..cff7b67ef 100644 --- a/crates/horizon-assets/examples/cuboid_model_fixture.rs +++ b/crates/horizon-assets/examples/cuboid_model_fixture.rs @@ -1,73 +1,12 @@ -use horizon_assets::model::*; -use serde_json::{Value, json}; +mod support; +use horizon_assets::model::CuboidModel; +use serde_json::json; use std::{ - collections::BTreeMap, fs::File, io::{BufRead, BufReader, BufWriter, Write}, }; +use support::model; -fn bits(values: [f32; N]) -> Vec { - values.map(f32::to_bits).to_vec() -} -fn transform(value: &DisplayTransform) -> Value { - match value { - DisplayTransform::Inherit => json!("inherit"), - DisplayTransform::Explicit(None) => Value::Null, - DisplayTransform::Explicit(Some(v)) => { - json!({"rotation":bits(v.rotation),"translation":bits(v.translation),"scale":bits(v.scale)}) - } - } -} -fn rotation(value: &ElementRotation) -> Value { - let angles = match value.value { - RotationValue::SingleAxis { axis, angle } => { - json!({"axis": match axis { Axis::X => "x", Axis::Y => "y", Axis::Z => "z" }, "angle":angle.to_bits()}) - } - RotationValue::EulerXyz(v) => json!(bits(v)), - }; - json!({"origin":bits(value.origin),"value":angles,"rescale":value.rescale}) -} -fn face(v: &Face) -> Value { - json!({"cull":v.cull.map(Direction::name),"tint":v.tint_index,"texture":v.texture,"rotation":v.rotation,"uv":v.uv.map(bits)}) -} -fn element(v: &Element) -> Value { - let faces: BTreeMap<_, _> = v - .faces - .iter() - .map(|(k, v)| (k.name(), v.as_ref().map(face))) - .collect(); - json!({"from":bits(v.from),"to":bits(v.to),"faces":faces,"rotation":v.rotation.as_ref().map(rotation),"shade":v.shade_direction_override.map(Direction::name),"light":v.light_emission}) -} -fn model(v: &CuboidModel) -> Value { - let textures: BTreeMap<_, _> = v - .textures - .iter() - .map(|(key, value)| { - ( - key, - match value { - TextureSlot::Reference(r) => json!({"reference":r}), - TextureSlot::Material(m) => { - json!({"sprite":m.sprite,"translucent":m.force_translucent}) - } - }, - ) - }) - .collect(); - let elements = v.elements.as_ref().map(|values| { - values - .iter() - .map(|v| v.as_ref().map(element)) - .collect::>() - }); - let display = v.display.as_ref().map(|v| { - DISPLAY_CONTEXTS - .into_iter() - .zip(v.contexts.iter().map(transform)) - .collect::>() - }); - json!({"parent":v.parent,"ao":v.ambient_occlusion,"gui":v.gui_light.map(|v| match v { GuiLight::Front => "front", GuiLight::Side => "side" }),"textures":textures,"elements":elements,"display":display}) -} fn main() -> Result<(), Box> { let args: Vec<_> = std::env::args().collect(); let input = BufReader::new(File::open(&args[1])?); diff --git a/crates/horizon-assets/examples/model_resolution_fixture.rs b/crates/horizon-assets/examples/model_resolution_fixture.rs new file mode 100644 index 000000000..e549783c2 --- /dev/null +++ b/crates/horizon-assets/examples/model_resolution_fixture.rs @@ -0,0 +1,68 @@ +mod support; +use horizon_assets::{model::*, resolve::ModelLibrary}; +use serde_json::{Value, json}; +use std::{ + collections::BTreeMap, + fs::File, + io::{BufRead, BufReader, BufWriter, Write}, +}; + +fn material(value: &Material) -> Value { + json!({"sprite":value.sprite,"translucent":value.force_translucent}) +} +fn main() -> Result<(), Box> { + let args: Vec<_> = std::env::args().collect(); + let input = BufReader::new(File::open(&args[1])?); + let mut output = BufWriter::new(File::create(&args[2])?); + for (index, line) in input.lines().enumerate() { + let row: Value = serde_json::from_str(&line?)?; + let models = row["models"] + .as_object() + .unwrap() + .iter() + .map(|(name, raw)| Ok((name.clone(), CuboidModel::from_json(raw.as_str().unwrap())?))) + .collect::>()?; + let library = ModelLibrary::new(models)?; + for root in row["roots"].as_array().unwrap() { + let name = root.as_str().unwrap(); + let Ok(model) = library.resolve(name) else { + writeln!(output, "{}", json!({"case":index,"name":name,"error":true}))?; + continue; + }; + let elements: Vec<_> = model + .elements() + .iter() + .map(|e| e.as_ref().map(support::element)) + .collect(); + let display: BTreeMap<_, _> = DISPLAY_CONTEXTS + .into_iter() + .zip(model.display.contexts.iter().map(support::transform)) + .collect(); + let textures: BTreeMap<_, _> = model + .textures + .iter() + .map(|(key, value)| (key, material(value))) + .collect(); + let queries: Vec<_> = row["queries"] + .as_array() + .unwrap() + .iter() + .map(|raw| { + let slot = raw.as_str().unwrap(); + match model.material(slot) { + Ok(value) => json!({"slot":slot,"value":value.map(material)}), + Err(_) => json!({"slot":slot,"error":true}), + } + }) + .collect(); + writeln!( + output, + "{}", + json!({"case":index,"name":name,"ao":model.ambient_occlusion, + "gui":match model.gui_light { GuiLight::Front => "front", GuiLight::Side => "side" }, + "elements":elements,"display":display,"textures":textures,"queries":queries}) + )?; + } + } + Ok(()) +} diff --git a/crates/horizon-assets/examples/support/mod.rs b/crates/horizon-assets/examples/support/mod.rs new file mode 100644 index 000000000..0d0022baf --- /dev/null +++ b/crates/horizon-assets/examples/support/mod.rs @@ -0,0 +1,67 @@ +use horizon_assets::model::*; +use serde_json::{Value, json}; +use std::collections::BTreeMap; + +fn bits(values: [f32; N]) -> Vec { + values.map(f32::to_bits).to_vec() +} +pub fn transform(value: &DisplayTransform) -> Value { + match value { + DisplayTransform::Inherit => json!("inherit"), + DisplayTransform::Explicit(None) => Value::Null, + DisplayTransform::Explicit(Some(v)) => { + json!({"rotation":bits(v.rotation),"translation":bits(v.translation),"scale":bits(v.scale)}) + } + } +} +fn rotation(value: &ElementRotation) -> Value { + let angles = match value.value { + RotationValue::SingleAxis { axis, angle } => { + json!({"axis": match axis { Axis::X => "x", Axis::Y => "y", Axis::Z => "z" }, "angle":angle.to_bits()}) + } + RotationValue::EulerXyz(v) => json!(bits(v)), + }; + json!({"origin":bits(value.origin),"value":angles,"rescale":value.rescale}) +} +fn face(v: &Face) -> Value { + json!({"cull":v.cull.map(Direction::name),"tint":v.tint_index,"texture":v.texture,"rotation":v.rotation,"uv":v.uv.map(bits)}) +} +pub fn element(v: &Element) -> Value { + let faces: BTreeMap<_, _> = v + .faces + .iter() + .map(|(k, v)| (k.name(), v.as_ref().map(face))) + .collect(); + json!({"from":bits(v.from),"to":bits(v.to),"faces":faces,"rotation":v.rotation.as_ref().map(rotation),"shade":v.shade_direction_override.map(Direction::name),"light":v.light_emission}) +} +#[allow(dead_code)] // Shared by fixtures which normalize different model stages. +pub fn model(v: &CuboidModel) -> Value { + let textures: BTreeMap<_, _> = v + .textures + .iter() + .map(|(key, value)| { + ( + key, + match value { + TextureSlot::Reference(r) => json!({"reference":r}), + TextureSlot::Material(m) => { + json!({"sprite":m.sprite,"translucent":m.force_translucent}) + } + }, + ) + }) + .collect(); + let elements = v.elements.as_ref().map(|values| { + values + .iter() + .map(|v| v.as_ref().map(element)) + .collect::>() + }); + let display = v.display.as_ref().map(|v| { + DISPLAY_CONTEXTS + .into_iter() + .zip(v.contexts.iter().map(transform)) + .collect::>() + }); + json!({"parent":v.parent,"ao":v.ambient_occlusion,"gui":v.gui_light.map(|v| match v { GuiLight::Front => "front", GuiLight::Side => "side" }),"textures":textures,"elements":elements,"display":display}) +} diff --git a/crates/horizon-assets/src/lib.rs b/crates/horizon-assets/src/lib.rs index 2fa5fb89c..0d4c97c62 100644 --- a/crates/horizon-assets/src/lib.rs +++ b/crates/horizon-assets/src/lib.rs @@ -3,5 +3,6 @@ mod json; pub mod model; +pub mod resolve; pub use json::DecodeError; diff --git a/crates/horizon-assets/src/resolve.rs b/crates/horizon-assets/src/resolve.rs new file mode 100644 index 000000000..ca601f0cc --- /dev/null +++ b/crates/horizon-assets/src/resolve.rs @@ -0,0 +1,243 @@ +//! Cuboid parent inheritance and texture-slot resolution. +use crate::{json::*, model::*}; +use std::{ + collections::{BTreeMap, BTreeSet}, + sync::Arc, +}; + +pub const MISSING_MODEL: &str = "minecraft:builtin/missing"; + +/// Decoded models are immutable and their inherited geometry is shared. +pub struct ModelLibrary { + models: BTreeMap>, + missing: Arc, +} +#[derive(Clone, Debug)] +pub struct ResolvedCuboidModel { + pub ambient_occlusion: bool, + pub gui_light: GuiLight, + pub display: ItemTransforms, + pub textures: BTreeMap, + /// Cyclic and dangling aliases are absent from `textures`. + pub unresolved_textures: BTreeSet, + geometry: Option>, +} +impl ResolvedCuboidModel { + pub fn elements(&self) -> &[Option] { + self.geometry + .as_ref() + .and_then(|m| m.elements.as_deref()) + .unwrap_or(&[]) + } + /// Native slot lookup strips a single leading '#'. Non-reference names + /// are still slot names, not direct sprite identifiers. + pub fn material(&self, slot: &str) -> Result> { + if slot.is_empty() { + return Err(error("empty texture lookup")); + } + Ok(self.textures.get(slot.strip_prefix('#').unwrap_or(slot))) + } +} +impl ModelLibrary { + pub fn new(models: BTreeMap) -> Result { + let mut decoded = BTreeMap::new(); + for (name, model) in models { + if decoded + .insert(identifier(&name)?, Arc::new(model)) + .is_some() + { + return Err(error("duplicate normalized model identifier")); + } + } + let missing = Arc::new(missing_model()); + // The native discovery registers this built-in before consulting resources. + decoded.insert(MISSING_MODEL.to_owned(), missing.clone()); + Ok(Self { + models: decoded, + missing, + }) + } + /// Follow the complete parent chain. A missing resource uses the built-in + /// model; a cyclic chain is rejected, as native discovery excludes it. + /// The returned model can outlive this library without copying its elements. + pub fn resolve(&self, name: &str) -> Result { + let mut name = identifier(name)?; + let mut visited = BTreeSet::new(); + let mut chain = Vec::new(); + loop { + if !visited.insert(name.clone()) { + return Err(error("cyclic model parent")); + } + let model = self.models.get(&name).unwrap_or(&self.missing); + chain.push(model); + match &model.parent { + Some(parent) => name = parent.clone(), + None => break, + } + } + let ambient_occlusion = chain + .iter() + .find_map(|m| m.ambient_occlusion) + .unwrap_or(true); + let gui_light = chain + .iter() + .find_map(|m| m.gui_light) + .unwrap_or(GuiLight::Side); + let geometry = chain + .iter() + .find(|m| m.elements.is_some()) + .map(|m| Arc::clone(m)); + let display = ItemTransforms { + contexts: std::array::from_fn(|index| { + chain + .iter() + .filter_map(|m| m.display.as_ref()) + .map(|d| &d.contexts[index]) + .find(|t| **t != DisplayTransform::Inherit) + .cloned() + .unwrap_or(DisplayTransform::Inherit) + }), + }; + // Resolve aliases only after applying every child override. A reference + // inherited from a parent binds to the child's final slot definition. + let mut slots = BTreeMap::new(); + for model in chain.into_iter().rev() { + slots.extend(model.textures.iter().map(|(k, v)| (k.clone(), v))); + } + let mut textures = BTreeMap::::new(); + let mut unresolved_textures = BTreeSet::::new(); + for start in slots.keys() { + let mut current = start.as_str(); + let mut seen = BTreeSet::new(); + let mut path = Vec::new(); + let material = loop { + if let Some(material) = textures.get(current) { + break Some(material.clone()); + } + if unresolved_textures.contains(current) || !seen.insert(current) { + break None; + } + let Some(slot) = slots.get(current) else { + break None; + }; + path.push(current); + match slot { + TextureSlot::Reference(target) => current = target, + TextureSlot::Material(material) => break Some(material.clone()), + } + }; + // Cache the entire walk, including failures, so long alias chains + // and cycles are traversed once rather than once per referencing slot. + match material { + Some(material) => { + for name in path { + textures.insert(name.to_owned(), material.clone()); + } + } + None => { + unresolved_textures.extend(path.into_iter().map(str::to_owned)); + } + } + } + Ok(ResolvedCuboidModel { + ambient_occlusion, + gui_light, + display, + textures, + unresolved_textures, + geometry, + }) + } +} + +/// The native missing-model cube uses slot names without a leading '#'. +pub fn missing_model() -> CuboidModel { + let faces = Direction::ALL + .into_iter() + .map(|direction| { + ( + direction, + Some(Face { + cull: Some(direction), + tint_index: -1, + texture: "missingno".to_owned(), + uv: Some([0.0, 0.0, 16.0, 16.0]), + rotation: 0, + }), + ) + }) + .collect(); + CuboidModel { + parent: None, + ambient_occlusion: None, + gui_light: None, + elements: Some(vec![Some(Element { + from: [0.0; 3], + to: [16.0; 3], + faces, + rotation: None, + shade_direction_override: None, + light_emission: 0, + })]), + display: Some(ItemTransforms { + contexts: std::array::from_fn(|_| DisplayTransform::Inherit), + }), + textures: BTreeMap::from([ + ( + "particle".to_owned(), + TextureSlot::Reference("missingno".to_owned()), + ), + ( + "missingno".to_owned(), + TextureSlot::Material(Material { + sprite: "minecraft:missingno".to_owned(), + force_translucent: false, + }), + ), + ]), + } +} + +#[cfg(test)] +mod tests { + use super::*; + #[test] + fn inherited_alias_uses_child_material_and_geometry_outlives_library() { + let parent = CuboidModel::from_json(r##"{"textures":{"side":"#all","all":"block/stone"},"elements":[{"from":[0,0,0],"to":[16,8,16],"faces":{"up":{"texture":"#side"}}}]}"##).unwrap(); + let child = CuboidModel::from_json(r#"{"parent":"horizon:parent","textures":{"all":{"sprite":"block/glass","force_translucent":true}}}"#).unwrap(); + let library = ModelLibrary::new(BTreeMap::from([ + ("horizon:parent".into(), parent), + ("horizon:child".into(), child), + ])) + .unwrap(); + let model = library.resolve("horizon:child").unwrap(); + drop(library); + assert_eq!(model.elements()[0].as_ref().unwrap().to, [16.0, 8.0, 16.0]); + assert_eq!( + model.material("#side").unwrap().unwrap(), + &Material { + sprite: "minecraft:block/glass".into(), + force_translucent: true + } + ); + } + #[test] + fn absent_parents_fall_back_but_cycles_invalidate_descendants() { + let a = CuboidModel::from_json(r#"{"parent":"horizon:b"}"#).unwrap(); + let b = CuboidModel::from_json(r#"{"parent":"horizon:a"}"#).unwrap(); + let child = CuboidModel::from_json(r#"{"parent":"horizon:a","elements":[]}"#).unwrap(); + let library = ModelLibrary::new(BTreeMap::from([ + ("horizon:a".into(), a), + ("horizon:b".into(), b), + ("horizon:child".into(), child), + ])) + .unwrap(); + assert!(library.resolve("horizon:child").is_err()); + let absent = library.resolve("horizon:absent").unwrap(); + assert_eq!(absent.elements().len(), 1); + assert_eq!( + absent.material("particle").unwrap().unwrap().sprite, + "minecraft:missingno" + ); + } +} diff --git a/docs/native-client.md b/docs/native-client.md index 6a4fcaad3..c4d141c6d 100644 --- a/docs/native-client.md +++ b/docs/native-client.md @@ -69,8 +69,24 @@ python3 tools/test_cuboid_model_parity.py The [archived decoder result](../benchmarks/rust-cuboid-model-decoding-2026-10-06/scoped-parity.json) records source, fixture and reference hashes. The oracle uses actual client classes; those rendering APIs are absent from the server. This decoder is not -yet connected to the development renderer. Parent resolution, rotation matrices, -quad baking, blockstate selection and rendered appearance need their own checks. +yet connected to the development renderer. Rotation matrices, quad baking, +blockstate selection and rendered appearance need their own checks. + +`ModelLibrary` resolves parent geometry, ambient occlusion, GUI lighting and +each display context. It shares inherited elements rather than cloning them. +Texture aliases bind after child overrides are applied; successful and failed +alias walks are cached. Missing resources use the native missing-model cube; +parent cycles invalidate their descendants. The +[resolution comparison](../benchmarks/rust-model-resolution-2026-10-06/scoped-parity.json) +matches **5,648 requested roots across 439 graphs**, including the full bundled +block-model catalog, missing parents, 702 cyclic roots, 1,024-model parent chains, +512-slot alias chains, explicit empty geometry and identity/null transforms. +It calls native `ModelDiscovery`, `ResolvedModel` and `TextureSlots` APIs. + +```sh +python3 tools/test_model_resolution_parity.py +cargo +stable test --locked -p horizon-assets +``` ```sh cargo +stable test -p horizon-client diff --git a/docs/rust-parity.md b/docs/rust-parity.md index 3e40ec2e0..a4dbc3e28 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -16,7 +16,8 @@ record the exact tested scope and remaining gaps. The `horizon-assets` crate now decodes pinned cuboid models, with all 2,883 bundled block-model JSON files and 2,337 synthetic cases compared against the actual client parser. [Decoder scope and validation](native-client.md#validation) -are separate from the unfinished model-resolution and rendering integration. +also include parent/texture resolution over 5,648 roots. Quad baking, +blockstate selection and integration with the renderer remain unfinished. The playable Java performance packs remain available during development. ## Completion criteria and playable builds diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCuboidModelOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCuboidModelOracle.java index 134851504..f06fb088f 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCuboidModelOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCuboidModelOracle.java @@ -15,12 +15,12 @@ public final class VanillaCuboidModelOracle { private static long bits(float value) { return Integer.toUnsignedLong(Float.floatToIntBits(value)); } private static Object vector(Vector3fc value) { return new long[]{bits(value.x()), bits(value.y()), bits(value.z())}; } private static String direction(net.minecraft.core.Direction value) { return value == null ? null : value.getName(); } - private static Map map(Object... values) { + static Map map(Object... values) { var result = new TreeMap(); for (int i=0;i(); value.faces().forEach((key, f) -> faces.put(key.getName(), face(f))); diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaModelResolutionOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaModelResolutionOracle.java new file mode 100644 index 000000000..b198a1882 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaModelResolutionOracle.java @@ -0,0 +1,63 @@ +package dev.horizonlab.parity; + +import com.google.gson.*; +import java.io.*; +import java.nio.file.*; +import java.util.*; +import net.minecraft.client.resources.model.*; +import net.minecraft.client.resources.model.cuboid.*; +import net.minecraft.client.resources.model.geometry.UnbakedGeometry; +import net.minecraft.client.resources.model.sprite.Material; +import net.minecraft.resources.Identifier; +import net.minecraft.world.item.ItemDisplayContext; +import static dev.horizonlab.parity.VanillaCuboidModelOracle.*; + +/** Exercises actual ModelDiscovery, ResolvedModel and TextureSlots resolution. */ +public final class VanillaModelResolutionOracle { + private static final Gson JSON = new GsonBuilder().serializeNulls().create(); + private static Object material(Material value) { + return value == null ? null : map("sprite", value.sprite().toString(), "translucent", value.forceTranslucent()); + } + public static void main(String[] args) throws Exception { + net.minecraft.SharedConstants.tryDetectVersion(); + try (var input=Files.newBufferedReader(Path.of(args[0])); var output=Files.newBufferedWriter(Path.of(args[1]))) { + int index=0; + for (String line; (line=input.readLine())!=null; index++) { + var row=JsonParser.parseString(line).getAsJsonObject(); + var models=new HashMap(); + var slots=new TreeSet(); slots.add("missingno"); slots.add("particle"); + for (var entry:row.getAsJsonObject("models").entrySet()) { + var model=CuboidModel.fromStream(new StringReader(entry.getValue().getAsString())); + models.put(Identifier.parse(entry.getKey()),model); + slots.addAll(model.textureSlots().values().keySet()); + } + var discovery=new ModelDiscovery(models,MissingCuboidModel.missingModel()); + discovery.addRoot(resolver -> {for(var root:row.getAsJsonArray("roots")) resolver.markDependency(Identifier.parse(root.getAsString()));}); + var resolved=discovery.resolve(); + for (var root:row.getAsJsonArray("roots")) { + String name=root.getAsString(); + var model=resolved.get(Identifier.parse(name)); + if(model==null) {output.write(JSON.toJson(map("case",index,"name",name,"error",true)));output.newLine();continue;} + var geometry=model.getTopGeometry(); + var elements=new ArrayList(); + if(geometry!=UnbakedGeometry.EMPTY) for(var e:((UnbakedCuboidGeometry)geometry).elements()) elements.add(element(e)); + var display=new TreeMap(); + var transforms=model.getTopTransforms(); + for(var context:ItemDisplayContext.values()) if(context!=ItemDisplayContext.NONE) display.put(context.getSerializedName(),transform(transforms.getTransform(context))); + var textures=model.getTopTextureSlots(); + var values=new TreeMap(); + for(var slot:slots) {var value=textures.getMaterial("#"+slot);if(value!=null) values.put(slot,material(value));} + var queries=new ArrayList(); + for(var raw:row.getAsJsonArray("queries")) { + String slot=raw.getAsString(); + try {queries.add(map("slot",slot,"value",material(textures.getMaterial(slot))));} + catch(RuntimeException failure) {queries.add(map("slot",slot,"error",true));} + } + output.write(JSON.toJson(map("case",index,"name",name,"ao",model.getTopAmbientOcclusion(), + "gui",model.getTopGuiLight().name().toLowerCase(Locale.ROOT),"elements",elements, + "display",display,"textures",values,"queries",queries)));output.newLine(); + } + } + } + } +} diff --git a/tools/test_model_resolution_parity.py b/tools/test_model_resolution_parity.py new file mode 100644 index 000000000..e9b1ebffe --- /dev/null +++ b/tools/test_model_resolution_parity.py @@ -0,0 +1,119 @@ +#!/usr/bin/env python3 +"""Compare model inheritance, missing fallback and texture aliases with the client.""" +import argparse +import json +import os +from pathlib import Path +import platform +import random +import subprocess +import zipfile +try: + from . import lab, test_rust_parity as base, test_cuboid_model_parity as decoding +except ImportError: + import lab, test_rust_parity as base, test_cuboid_model_parity as decoding + + +def bundle(models, roots=None): + return {'models': {key: json.dumps(value) for key, value in models.items()}, + 'roots': list(models) if roots is None else roots, + 'queries': ['', '#', 'all', '#all', 'side', '#side', 'particle', '#particle', + 'missingno', 'unknown', 'minecraft:block/stone', '##all', '']} + + +def corpus(): + parent = {'ambientocclusion': False, 'gui_light': 'front', 'textures': {'side': '#all', 'all': 'block/stone'}, + 'elements': [{'from': [0, 0, 0], 'to': [16, 8, 16], 'faces': {'up': {'texture': '#side'}}}], + 'display': {'thirdperson_righthand': {'rotation': [1, 2, 3]}, 'gui': {'scale': [2, 2, 2]}}} + for child in [{}, {'elements': []}, {'ambientocclusion': True}, {'gui_light': 'side'}, + {'display': {}}, {'display': {'gui': {}}}, {'display': {'gui': None}}, + {'display': {'thirdperson_righthand': {'scale': [3, 2, 1]}}}, + {'display': {'thirdperson_lefthand': {}, 'thirdperson_righthand': {'scale': [3, 2, 1]}}}, + {'textures': {'all': 'block/dirt'}}, {'textures': {'all': '#side'}}, + {'textures': {'side': '#absent'}}, {'textures': {'all': {'sprite': 'block/glass', 'force_translucent': True}}}]: + yield bundle({'horizon:parent': parent, 'horizon:child': {'parent': 'horizon:parent', **child}}) + yield bundle({}, ['horizon:missing', 'minecraft:builtin/missing']) + yield bundle({'minecraft:builtin/missing': {'elements': []}, 'horizon:child': {'parent': 'builtin/missing'}}) + for chain in [ + {'horizon:a': {'parent': 'horizon:absent'}}, + {'horizon:a': {'parent': 'horizon:a'}}, + {'horizon:a': {'parent': 'horizon:b'}, 'horizon:b': {'parent': 'horizon:a'}}, + {'horizon:a': {'parent': 'horizon:b'}, 'horizon:b': {'parent': 'horizon:b'}, 'horizon:c': {'parent': 'horizon:a', 'elements': []}}, + ]: + yield bundle(chain) + for tail in ['block/stone', '#absent', '#s0000', '#s0040']: + for length in [1, 8, 64, 512]: + textures = {f's{i:04}': f'#s{i+1:04}' for i in range(length - 1)} + textures[f's{length-1:04}'] = tail + textures.update({'all': '#s0000', 'side': '#all', 'particle': '#side', '': 'block/dirt', '#all': '#'}) + yield bundle({'horizon:chain': {'textures': textures}}) + # Deep parent chains use iterative traversal, including descendant cycles. + for final in [{}, {'parent': 'horizon:n0'}, {'parent': 'horizon:missing'}]: + models = {f'horizon:n{i}': {'parent': f'horizon:n{i+1}'} for i in range(1023)} + models['horizon:n1023'] = final + yield bundle(models, ['horizon:n0', 'horizon:n512', 'horizon:n1023']) + rng = random.Random(0x5245534f4c5645) + for _ in range(400): + count = rng.randrange(1, 13) + models = {} + for i in range(count): + model = {} + if rng.randrange(4): model['parent'] = f'horizon:n{rng.randrange(count+2)}' + if rng.randrange(3) == 0: model['ambientocclusion'] = rng.choice([True, False]) + if rng.randrange(3) == 0: model['gui_light'] = rng.choice(['front', 'side']) + if rng.randrange(3) == 0: model['elements'] = rng.choice([[], [None], parent['elements']]) + if rng.randrange(3) == 0: + model['display'] = {rng.choice(['gui', 'firstperson_righthand', 'thirdperson_lefthand', 'on_shelf']): + rng.choice([None, {}, {'translation': [i, -i, 0]}])} + model['textures'] = {key: rng.choice(['block/stone', '#all', '#side', '#missingno', '#', '#absent', + {'sprite': 'block/glass', 'force_translucent': True}]) + for key in rng.sample(['all', 'side', 'particle', '', 'missingno'], rng.randrange(6))} + models[f'horizon:n{i}'] = model + yield bundle(models) + + +def main(): + parser = argparse.ArgumentParser(description=__doc__); parser.add_argument('--prepare', action='store_true'); args = parser.parse_args() + if args.prepare: lab.prepare() + lock, jars, libraries = base.verify_artifacts() + build = lab.LOCAL / 'rust-model-resolution-parity'; build.mkdir(parents=True, exist_ok=True) + report_path = build / 'report.json'; report_path.unlink(missing_ok=True) + oracle = lab.ROOT / 'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaModelResolutionOracle.java' + helper = oracle.with_name('VanillaCuboidModelOracle.java') + crate = lab.ROOT / 'crates/horizon-assets' + sources = [oracle, helper, Path(__file__), lab.ROOT / 'tools/test_cuboid_model_parity.py', + lab.ROOT / 'tools/lab.py', lab.ROOT / 'tools/test_rust_parity.py', lab.ROOT / 'Cargo.toml', + lab.ROOT / 'Cargo.lock', crate / 'Cargo.toml', *sorted(crate.rglob('*.rs'))] + tested_sources = base.source_hashes(sources) + with zipfile.ZipFile(jars['client']) as archive: + names = sorted(name for name in archive.namelist() if name.startswith('assets/minecraft/models/block/') and name.endswith('.json')) + models = {'minecraft:' + name.removeprefix('assets/minecraft/models/').removesuffix('.json'): archive.read(name).decode() for name in names} + rows = [{'models': models, 'roots': list(models) + ['minecraft:builtin/missing', 'horizon:missing'], + 'queries': ['particle', '#particle', 'all', '#all', 'missingno', 'unknown', '', '#']}, *corpus()] + inputs = build / 'inputs.jsonl'; inputs.write_text(''.join(json.dumps(row) + '\n' for row in rows)); fixtures = base.source_hashes([inputs]) + classes = build / 'classes'; classes.mkdir(exist_ok=True) + def run(command, name): + with (build / (name + '.log')).open('w') as log: + subprocess.run(list(map(str, command)), cwd=lab.ROOT, check=True, timeout=3600, stdout=log, stderr=subprocess.STDOUT) + dependencies = os.pathsep.join(map(str, [jars['client'], *libraries])) + run(['javac', '--release', lock['minecraft']['java_major'], '-proc:none', '-cp', dependencies, '-d', classes, oracle, helper], 'compile-java') + run(['cargo', 'build', '--locked', '-p', 'horizon-assets', '--example', 'model_resolution_fixture'], 'compile-rust') + metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--locked', '--no-deps', '--format-version', '1'], cwd=lab.ROOT)) + binary = Path(metadata['target_directory']) / 'debug/examples' / ('model_resolution_fixture.exe' if os.name == 'nt' else 'model_resolution_fixture') + run([binary, inputs, build / 'rust.jsonl'], 'rust') + run(['java', '-Xmx512M', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.VanillaModelResolutionOracle', inputs, build / 'client.jsonl'], 'client') + rejected = decoding.canonicalize(build / 'client.jsonl'); decoding.canonicalize(build / 'rust.jsonl') + matched = base.compare(build / 'client.jsonl', build / 'rust.jsonl') + base.ensure_sources_unchanged(sources, tested_sources); base.ensure_sources_unchanged([inputs], fixtures) + report = {'schema': 1, 'minecraft': lock['minecraft']['version'], 'manifest_sha1': lock['minecraft']['manifest_sha1'], + 'platform': platform.platform(), 'java': subprocess.check_output(['java', '--version'], text=True).splitlines()[0], + 'rustc': subprocess.check_output(['rustc', '--version'], text=True).strip(), + 'resource_models': len(names), 'graph_fixtures': len(rows), 'rejected_cyclic_roots': rejected, + 'sources_sha256': tested_sources, 'fixtures_sha256': fixtures, 'rust_output_sha256': lab.digest(build / 'rust.jsonl', 'sha256'), + 'references': [{'side': 'client', 'jar_sha256': lab.digest(jars['client'], 'sha256'), + 'output_sha256': lab.digest(build / 'client.jsonl', 'sha256'), 'matched_output_lines': matched}], + 'scope': 'Actual ModelDiscovery and ResolvedModel/TextureSlots APIs over all bundled block models plus synthetic parent/alias graphs. Compares inherited geometry, AO/gui defaults, per-context display transforms, resolved materials, missing-model fallback, ignored built-in override, cyclic parent rejection, long alias/parent chains and slot lookup. Native rejection text/logging and discovery map iteration order are not compared. Geometry is shared through Arc in Rust; this does not prove quad baking, blockstate dispatch, pixels or gameplay.'} + lab.write_json(report_path, report); print(f'Client model resolution: {matched:,} roots match ({rejected:,} cyclic); {report_path}', flush=True) + + +if __name__ == '__main__': main() From 8c7d8f6416af0c475f423efe427522ce83999e12 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 20:30:09 +0200 Subject: [PATCH 046/253] Bake vanilla cuboid geometry with native float-bit validation --- .../scoped-parity.json | 45 ++++ .../examples/model_baking_fixture.rs | 51 ++++ crates/horizon-assets/src/bake.rs | 241 ++++++++++++++++++ crates/horizon-assets/src/lib.rs | 1 + docs/native-client.md | 24 +- docs/rust-parity.md | 5 +- .../parity/VanillaModelBakingOracle.java | 89 +++++++ tools/test_model_baking_parity.py | 117 +++++++++ 8 files changed, 569 insertions(+), 4 deletions(-) create mode 100644 benchmarks/rust-model-baking-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-assets/examples/model_baking_fixture.rs create mode 100644 crates/horizon-assets/src/bake.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaModelBakingOracle.java create mode 100644 tools/test_model_baking_parity.py diff --git a/benchmarks/rust-model-baking-2026-10-06/scoped-parity.json b/benchmarks/rust-model-baking-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..967425995 --- /dev/null +++ b/benchmarks/rust-model-baking-2026-10-06/scoped-parity.json @@ -0,0 +1,45 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "resource_models": 2883, + "graph_fixtures": 440, + "rejected_roots": 1039, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaModelBakingOracle.java": "fca267347a21149791a3260826be98df55705208c30396277ef6c3feba875748", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCuboidModelOracle.java": "7526f20513c549483122ab0d5ad24b9e87f38dc2f6aae55addd701a91ac85e43", + "tools/test_model_baking_parity.py": "392ffec44918fb91740ca4a1316d684480d39f14bd34d46175f7f44946d15bd7", + "tools/test_cuboid_model_parity.py": "3b7c018570b0f609aae43cef60ff3139c543d5d629be804a5aa257e3ab2dd67c", + "tools/test_model_resolution_parity.py": "d9595f2f1442f1f590b72d2a46600657e79ae103bec3d4c45db98242b964bde0", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "7b4ab0ffa35af7ea8b6e38525f18ff6c3e94768198915f5ffe560d84263423f8", + "crates/horizon-assets/Cargo.toml": "fadb78cf819e026500606c45d27138ed67fcbbc967ae8cee6c1e7c82c9046b36", + "crates/horizon-assets/examples/cuboid_model_fixture.rs": "97609d90e3f6ce340f3590296db2dc778113bb2b33c7d1b54080a1d6f3023f40", + "crates/horizon-assets/examples/model_baking_fixture.rs": "59caca09dd5afd0b70a2e8fdb8e949deb9322f00adc617918b33d1e7e5b0b522", + "crates/horizon-assets/examples/model_resolution_fixture.rs": "c071067140299e49345a6ebd94e15b3b6d853cb9ae11d8de46e3cbdfb8b01f0e", + "crates/horizon-assets/examples/support/mod.rs": "bcf5a6d8a54845982191e037911c24139237771d6afa4b01b1e83c011489c3f5", + "crates/horizon-assets/src/bake.rs": "0bc519e93ad8200d89543ceb5c811dd82bbeb0e9003b143385c8a03e758dfe65", + "crates/horizon-assets/src/json.rs": "e7b89bf4852f561a0e5bf1a984857c61e755961dfd86fcc326b6d55558615f39", + "crates/horizon-assets/src/lib.rs": "5fe567bdf1e63230cee2b960719c5cb6166176a674772955329a9d04cf22b9db", + "crates/horizon-assets/src/model.rs": "57ddb3d65e88e7a8aa22c62bc298a2dae7f4e994326a873a31f06c0f36ed051b", + "crates/horizon-assets/src/resolve.rs": "3927ac926cdcbd7d334901cc32d0ecc1e498b1bec98f76a46bca6d4964c13541" + }, + "fixtures_sha256": { + ".local/rust-model-baking-parity/inputs.jsonl": "aba24d38f4fc1af060502f983923c2f279c016d0fd412d40f6d50093fac1d811" + }, + "rust_output_sha256": "9216be3bbae9e59bb89b6ed780ccedc5608cd4583c8e7527e50b165a0d8d30da", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "9216be3bbae9e59bb89b6ed780ccedc5608cd4583c8e7527e50b165a0d8d30da", + "matched_output_lines": 7100 + } + ], + "scope": "Actual client FaceBakery geometry overload with a real unit-atlas sprite and default JOML math options. Identity blockstate transform, all bundled cuboid geometry and synthetic rotations, rescaling, default/explicit UVs, winding, degenerate and reversed bounds, inherited models and missing materials. Positions, UVs and element matrix coefficients compare by float bits. This does not cover blockstate transforms/UV lock, atlas packing, transparency classification, lighting, GPU rendering or gameplay." +} diff --git a/crates/horizon-assets/examples/model_baking_fixture.rs b/crates/horizon-assets/examples/model_baking_fixture.rs new file mode 100644 index 000000000..548b682f1 --- /dev/null +++ b/crates/horizon-assets/examples/model_baking_fixture.rs @@ -0,0 +1,51 @@ +use horizon_assets::{ + bake::{ElementMatrix, bake_model}, + model::*, + resolve::ModelLibrary, +}; +use serde_json::{Value, json}; +use std::{ + fs::File, + io::{BufRead, BufReader, BufWriter, Write}, +}; +fn bits(value: f32) -> u32 { + if value.is_nan() { + 0x7fc0_0000 + } else { + value.to_bits() + } +} +fn main() -> Result<(), Box> { + let args: Vec<_> = std::env::args().collect(); + let input = BufReader::new(File::open(&args[1])?); + let mut output = BufWriter::new(File::create(&args[2])?); + for (index, line) in input.lines().enumerate() { + let row: Value = serde_json::from_str(&line?)?; + let models = row["models"] + .as_object() + .unwrap() + .iter() + .map(|(name, raw)| Ok((name.clone(), CuboidModel::from_json(raw.as_str().unwrap())?))) + .collect::>()?; + let library = ModelLibrary::new(models)?; + for root in row["roots"].as_array().unwrap() { + let name = root.as_str().unwrap(); + let baked = library.resolve(name).and_then(|model| { + let quads = bake_model(&model)?.into_iter().map(|q| json!({ + "positions":q.positions.map(|v| v.map(bits)),"uv":q.uv.map(|v| v.map(bits)), + "facing":q.facing.name(),"cull":q.cull.map(Direction::name),"tint":q.tint_index, + "shade":q.shade_direction_override.map(Direction::name),"light":q.light_emission, + "material":{"sprite":q.material.sprite,"translucent":q.material.force_translucent} + })).collect::>(); + let matrices: Vec<_> = model.elements().iter().map(|e| e.as_ref().unwrap().rotation.as_ref().map(|r| ElementMatrix::from_rotation(r).rows.map(|row| row.map(bits)))).collect(); + Ok(json!({"quads":quads,"matrices":matrices})) + }); + let value = match baked { + Ok(baked) => json!({"case":index,"name":name,"baked":baked}), + Err(_) => json!({"case":index,"name":name,"error":true}), + }; + writeln!(output, "{value}")?; + } + } + Ok(()) +} diff --git a/crates/horizon-assets/src/bake.rs b/crates/horizon-assets/src/bake.rs new file mode 100644 index 000000000..57b8b5290 --- /dev/null +++ b/crates/horizon-assets/src/bake.rs @@ -0,0 +1,241 @@ +//! Cuboid geometry in block units, before blockstate rotation and UV locking. +use crate::{json::*, model::*, resolve::ResolvedCuboidModel}; + +#[derive(Clone, Debug, PartialEq)] +pub struct ModelQuad { + pub positions: [[f32; 3]; 4], + /// Normalized unit-atlas coordinates, before placement in a larger atlas. + pub uv: [[f32; 2]; 4], + pub facing: Direction, + pub cull: Option, + pub material: Material, + pub tint_index: i32, + pub shade_direction_override: Option, + pub light_emission: u8, +} + +#[derive(Clone, Copy, Debug)] +pub struct ElementMatrix { + pub rows: [[f32; 3]; 3], + identity: bool, +} +impl ElementMatrix { + pub fn from_rotation(rotation: &ElementRotation) -> Self { + const DEG: f32 = std::f32::consts::PI / 180.0; + let mut matrix = match rotation.value { + RotationValue::SingleAxis { angle: 0.0, .. } => Self { + rows: [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]], + identity: true, + }, + RotationValue::SingleAxis { axis, angle } => { + let (s, c) = sin_cos(angle * DEG); + let rows = match axis { + Axis::X => [[1.0, 0.0, 0.0], [0.0, c, -s], [0.0, s, c]], + Axis::Y => [[c, 0.0, s], [0.0, 1.0, 0.0], [-s, 0.0, c]], + Axis::Z => [[c, -s, 0.0], [s, c, 0.0], [0.0, 0.0, 1.0]], + }; + Self { + rows, + identity: false, + } + } + RotationValue::EulerXyz([x, y, z]) => { + let (sx, cx) = sin_cos(x * DEG); + let (sy, cy) = sin_cos(y * DEG); + let (sz, cz) = sin_cos(z * DEG); + let czsy = cz * sy; + let szsy = sz * sy; + Self { + rows: [ + [cz * cy, -sz * cx + czsy * sx, -sz * -sx + czsy * cx], + [sz * cy, cz * cx + szsy * sx, cz * -sx + szsy * cx], + [-sy, cy * sx, cy * cx], + ], + identity: false, + } + } + }; + if rotation.rescale && !matrix.identity { + let scales: [f32; 3] = std::array::from_fn(|axis| { + let basis = std::array::from_fn(|i| if i == axis { 1.0 } else { 0.0 }); + let column = matrix.direction(basis); + let maximum = java_max(java_max(column[0].abs(), column[1].abs()), column[2].abs()); + 1.0 / maximum + }); + for (axis, scale) in scales.into_iter().enumerate() { + for row in &mut matrix.rows { + row[axis] *= scale; + } + } + } + matrix + } + fn direction(self, value: [f32; 3]) -> [f32; 3] { + self.rows + .map(|r| r[0] * value[0] + (r[1] * value[1] + r[2] * value[2])) + } + fn position(self, value: [f32; 3]) -> [f32; 3] { + if self.identity { + value + } else { + self.rows + .map(|r| r[0] * value[0] + (r[1] * value[1] + (r[2] * value[2] + 0.0))) + } + } +} +fn java_max(a: f32, b: f32) -> f32 { + if a.is_nan() || b.is_nan() { + f32::NAN + } else { + a.max(b) + } +} +/// JOML's default float path uses a double sine rounded to float, and obtains +/// cosine's magnitude from that rounded sine. Keep all subsequent steps f32. +fn sin_cos(angle: f32) -> (f32, f32) { + let sin = f64::from(angle).sin() as f32; + let cos = (1.0 - sin * sin).sqrt(); + let shifted = angle + std::f32::consts::FRAC_PI_2; + let mut period = + shifted - (shifted / std::f32::consts::TAU) as i32 as f32 * std::f32::consts::TAU; + if period < 0.0 { + period += std::f32::consts::TAU; + } + ( + sin, + if period >= std::f32::consts::PI { + -cos + } else { + cos + }, + ) +} + +pub fn default_uv(from: [f32; 3], to: [f32; 3], direction: Direction) -> [f32; 4] { + match direction { + Direction::Down => [from[0], 16.0 - to[2], to[0], 16.0 - from[2]], + Direction::Up => [from[0], from[2], to[0], to[2]], + Direction::North => [16.0 - to[0], 16.0 - to[1], 16.0 - from[0], 16.0 - from[1]], + Direction::South => [from[0], 16.0 - to[1], to[0], 16.0 - from[1]], + Direction::West => [from[2], 16.0 - to[1], to[2], 16.0 - from[1]], + Direction::East => [16.0 - to[2], 16.0 - to[1], 16.0 - from[2], 16.0 - from[1]], + } +} +fn corners(from: [f32; 3], to: [f32; 3], direction: Direction) -> [[f32; 3]; 4] { + let selectors = match direction { + Direction::Down => [[0, 0, 1], [0, 0, 0], [1, 0, 0], [1, 0, 1]], + Direction::Up => [[0, 1, 0], [0, 1, 1], [1, 1, 1], [1, 1, 0]], + Direction::North => [[1, 1, 0], [1, 0, 0], [0, 0, 0], [0, 1, 0]], + Direction::South => [[0, 1, 1], [0, 0, 1], [1, 0, 1], [1, 1, 1]], + Direction::West => [[0, 1, 0], [0, 0, 0], [0, 0, 1], [0, 1, 1]], + Direction::East => [[1, 1, 1], [1, 0, 1], [1, 0, 0], [1, 1, 0]], + }; + selectors + .map(|selector| std::array::from_fn(|i| if selector[i] == 0 { from[i] } else { to[i] })) +} +fn facing(vertices: &[[f32; 3]; 4]) -> Option { + let a: [f32; 3] = std::array::from_fn(|i| vertices[1][i] - vertices[0][i]); + let b: [f32; 3] = std::array::from_fn(|i| vertices[2][i] - vertices[0][i]); + let n = [ + a[1] * b[2] - a[2] * b[1], + a[2] * b[0] - a[0] * b[2], + a[0] * b[1] - a[1] * b[0], + ]; + let inverse_length = 1.0 / (n[0] * n[0] + (n[1] * n[1] + n[2] * n[2])).sqrt(); + let n = n.map(|v| v * inverse_length); + if n.iter().any(|v| !v.is_finite()) { + return None; + } + let mut best = 0.0; + let mut result = None; + for (direction, dot) in Direction::ALL + .into_iter() + .zip([-n[1], n[1], -n[2], n[2], -n[0], n[0]]) + { + if dot >= 0.0 && dot > best { + best = dot; + result = Some(direction); + } + } + result +} + +pub fn bake_model(model: &ResolvedCuboidModel) -> Result> { + let mut output = Vec::new(); + for element in model.elements() { + let element = element + .as_ref() + .ok_or_else(|| error("null model element"))?; + let matrix = element.rotation.as_ref().map(ElementMatrix::from_rotation); + for (direction, face) in &element.faces { + let face = face.as_ref().ok_or_else(|| error("null model face"))?; + let material = model.material(&face.texture)?.cloned().unwrap_or(Material { + sprite: "minecraft:missingno".to_owned(), + force_translucent: false, + }); + output.push(bake_face(element, face, *direction, matrix, material)?); + } + } + Ok(output) +} +fn bake_face( + element: &Element, + face: &Face, + direction: Direction, + matrix: Option, + material: Material, +) -> Result { + let mut positions = corners(element.from, element.to, direction).map(|v| v.map(|c| c / 16.0)); + if let (Some(rotation), Some(matrix)) = (&element.rotation, matrix) { + for vertex in &mut positions { + let relative = std::array::from_fn(|i| vertex[i] - rotation.origin[i]); + let rotated = matrix.position(relative); + *vertex = std::array::from_fn(|i| rotated[i] + rotation.origin[i]); + } + } + let bounds = face + .uv + .unwrap_or_else(|| default_uv(element.from, element.to, direction)); + let mut uv = std::array::from_fn(|i| { + let corner = (i + usize::from(face.rotation)) % 4; + [ + bounds[if corner < 2 { 0 } else { 2 }] / 16.0, + bounds[if corner == 0 || corner == 3 { 1 } else { 3 }] / 16.0, + ] + // Native TextureAtlasSprite applies origin + extent * coordinate; + // even the unit atlas changes negative zero to positive zero. + .map(|value| 0.0 + value) + }); + let normal = facing(&positions); + if let (None, Some(facing)) = (&element.rotation, normal) { + let mut min = [999.0; 3]; + let mut max = [-999.0; 3]; + for vertex in &positions { + for axis in 0..3 { + if vertex[axis] < min[axis] { + min[axis] = vertex[axis]; + } + if vertex[axis] > max[axis] { + max[axis] = vertex[axis]; + } + } + } + for (index, expected) in corners(min, max, facing).into_iter().enumerate() { + let found = (index..4) + .find(|i| positions[*i] == expected) + .ok_or_else(|| error("cannot reorder model face"))?; + positions.swap(index, found); + uv.swap(index, found); + } + } + Ok(ModelQuad { + positions, + uv, + facing: normal.unwrap_or(Direction::Up), + cull: face.cull, + material, + tint_index: face.tint_index, + shade_direction_override: element.shade_direction_override, + light_emission: element.light_emission, + }) +} diff --git a/crates/horizon-assets/src/lib.rs b/crates/horizon-assets/src/lib.rs index 0d4c97c62..31ab2d6b9 100644 --- a/crates/horizon-assets/src/lib.rs +++ b/crates/horizon-assets/src/lib.rs @@ -1,6 +1,7 @@ //! Resource decoding for the pinned Java Edition client. #![forbid(unsafe_code)] +pub mod bake; mod json; pub mod model; pub mod resolve; diff --git a/docs/native-client.md b/docs/native-client.md index c4d141c6d..f31e57409 100644 --- a/docs/native-client.md +++ b/docs/native-client.md @@ -69,8 +69,8 @@ python3 tools/test_cuboid_model_parity.py The [archived decoder result](../benchmarks/rust-cuboid-model-decoding-2026-10-06/scoped-parity.json) records source, fixture and reference hashes. The oracle uses actual client classes; those rendering APIs are absent from the server. This decoder is not -yet connected to the development renderer. Rotation matrices, quad baking, -blockstate selection and rendered appearance need their own checks. +yet connected to the development renderer. Blockstate selection, transformed +models, UV locking and rendered appearance still need their own checks. `ModelLibrary` resolves parent geometry, ambient occlusion, GUI lighting and each display context. It shares inherited elements rather than cloning them. @@ -88,6 +88,26 @@ python3 tools/test_model_resolution_parity.py cargo +stable test --locked -p horizon-assets ``` +Cuboid baking now produces positions in block units, normalized unit-atlas UVs, +face winding and facing, material references, tint indices, shade overrides and +light-emission metadata. It supports single-axis and Euler element rotations +with the pinned rescaling rule. The +[baking comparison](../benchmarks/rust-model-baking-2026-10-06/scoped-parity.json) +matches **7,100 roots across 440 graphs**, using native `FaceBakery` with a real +sprite and the default JOML math options. All bundled block models bake without +errors. Synthetic coverage includes reversed/degenerate bounds, signed zero, +arbitrary rotations, rescaling, null geometry children and parent cycles. +Position, UV and matrix fields compare by exact float bits for these fixtures. + +```sh +python3 tools/test_model_baking_parity.py +``` + +This comparison uses the identity blockstate transform. Atlas packing, +transparency classification, actual tint/light evaluation and GPU rendering +remain separate from the geometry result. Other operating systems still need +their native validation runs. + ```sh cargo +stable test -p horizon-client cargo +stable clippy --workspace --all-targets -- -D warnings diff --git a/docs/rust-parity.md b/docs/rust-parity.md index a4dbc3e28..c131a941e 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -16,8 +16,9 @@ record the exact tested scope and remaining gaps. The `horizon-assets` crate now decodes pinned cuboid models, with all 2,883 bundled block-model JSON files and 2,337 synthetic cases compared against the actual client parser. [Decoder scope and validation](native-client.md#validation) -also include parent/texture resolution over 5,648 roots. Quad baking, -blockstate selection and integration with the renderer remain unfinished. +also include parent/texture resolution over 5,648 roots and cuboid baking over +7,100 roots with identity blockstate transforms. Blockstate selection, transformed +models, UV locking and integration with the renderer remain unfinished. The playable Java performance packs remain available during development. ## Completion criteria and playable builds diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaModelBakingOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaModelBakingOracle.java new file mode 100644 index 000000000..87265bc76 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaModelBakingOracle.java @@ -0,0 +1,89 @@ +package dev.horizonlab.parity; + +import com.google.gson.*; +import com.mojang.blaze3d.platform.NativeImage; +import java.io.*; +import java.nio.file.*; +import java.util.*; +import net.minecraft.client.resources.model.*; +import net.minecraft.client.resources.model.cuboid.*; +import net.minecraft.client.resources.model.geometry.*; +import net.minecraft.client.resources.model.sprite.Material; +import net.minecraft.client.renderer.block.dispatch.ModelState; +import net.minecraft.client.renderer.texture.*; +import net.minecraft.client.resources.metadata.animation.FrameSize; +import net.minecraft.core.Direction; +import net.minecraft.resources.Identifier; +import org.joml.*; +import static dev.horizonlab.parity.VanillaCuboidModelOracle.map; + +/** Geometry-only native baker probe with a real 16x16 sprite in a unit atlas. */ +public final class VanillaModelBakingOracle { + private static final Gson JSON = new GsonBuilder().serializeNulls().create(); + private static final class Sprite extends TextureAtlasSprite { + Sprite(SpriteContents contents) { super(Identifier.parse("horizon:atlas"),contents,16,16,0,0,0); } + } + private static final ModelBaker.Interner INTERNER = new ModelBaker.Interner() { + public Vector3fc vector(Vector3fc vector) { return vector; } + public BakedQuad.MaterialInfo materialInfo(BakedQuad.MaterialInfo value) { return value; } + }; + private static long bits(float value) { return Integer.toUnsignedLong(Float.floatToIntBits(value)); } + private static Object matrix(CuboidRotation rotation) { + if(rotation==null)return null; + var m=rotation.transform(); + return new long[][]{{bits(m.m00()),bits(m.m10()),bits(m.m20())}, + {bits(m.m01()),bits(m.m11()),bits(m.m21())},{bits(m.m02()),bits(m.m12()),bits(m.m22())}}; + } + private static Object bake(ResolvedModel model, Sprite sprite) throws Exception { + var geometry=model.getTopGeometry(); + var quads=new ArrayList(); var matrices=new ArrayList(); + if(geometry==UnbakedGeometry.EMPTY)return map("quads",quads,"matrices",matrices); + var textures=model.getTopTextureSlots(); + var defaultUv=FaceBakery.class.getDeclaredMethod("defaultFaceUV",Vector3fc.class,Vector3fc.class,Direction.class);defaultUv.setAccessible(true); + for(var element:((UnbakedCuboidGeometry)geometry).elements()) { + matrices.add(matrix(element.rotation())); + for(var entry:element.faces().entrySet()) { + var face=entry.getValue(); + var material=textures.getMaterial(face.texture()); + if(material==null)material=new Material(Identifier.parse("minecraft:missingno")); + var uv=face.uvs(); + if(uv==null)uv=(CuboidFace.UVs)defaultUv.invoke(null,element.from(),element.to(),entry.getKey()); + var info=new BakedQuad.MaterialInfo(sprite,null,null,null,null,face.tintIndex(),element.shadeDirectionOverride(),element.lightEmission()); + var quad=FaceBakery.bakeQuad(INTERNER,element.from(),element.to(),uv,face.rotation(),info,entry.getKey(),new ModelState(){},element.rotation()); + var positions=new long[4][3];var uvs=new long[4][2]; + for(int i=0;i<4;i++) { + var p=quad.position(i);positions[i]=new long[]{bits(p.x()),bits(p.y()),bits(p.z())}; + long packed=quad.packedUV(i);uvs[i]=new long[]{packed >>> 32,packed & 0xffffffffL}; + } + quads.add(map("positions",positions,"uv",uvs,"facing",quad.direction().getName(), + "cull",face.cullForDirection()==null?null:face.cullForDirection().getName(),"tint",face.tintIndex(), + "shade",element.shadeDirectionOverride()==null?null:element.shadeDirectionOverride().getName(), + "light",element.lightEmission(),"material",map("sprite",material.sprite().toString(),"translucent",material.forceTranslucent()))); + } + } + return map("quads",quads,"matrices",matrices); + } + public static void main(String[] args) throws Exception { + net.minecraft.SharedConstants.tryDetectVersion(); + if(org.joml.Options.FASTMATH || org.joml.Options.USE_MATH_FMA)throw new AssertionError("Expected default JOML math options"); + var image=new NativeImage(16,16,true); + var contents=new SpriteContents(Identifier.parse("horizon:probe"),new FrameSize(16,16),image); + var sprite=new Sprite(contents); + try (contents; var input=Files.newBufferedReader(Path.of(args[0])); var output=Files.newBufferedWriter(Path.of(args[1]))) { + int index=0; + for(String line;(line=input.readLine())!=null;index++) { + var row=JsonParser.parseString(line).getAsJsonObject();var models=new HashMap(); + for(var entry:row.getAsJsonObject("models").entrySet())models.put(Identifier.parse(entry.getKey()),CuboidModel.fromStream(new StringReader(entry.getValue().getAsString()))); + var discovery=new ModelDiscovery(models,MissingCuboidModel.missingModel()); + discovery.addRoot(resolver->{for(var root:row.getAsJsonArray("roots"))resolver.markDependency(Identifier.parse(root.getAsString()));}); + var resolved=discovery.resolve(); + for(var root:row.getAsJsonArray("roots")) { + String name=root.getAsString();Object value; + try {value=bake(Objects.requireNonNull(resolved.get(Identifier.parse(name))),sprite);} + catch(RuntimeException error) {output.write(JSON.toJson(map("case",index,"name",name,"error",true)));output.newLine();continue;} + output.write(JSON.toJson(map("case",index,"name",name,"baked",value)));output.newLine(); + } + } + } + } +} diff --git a/tools/test_model_baking_parity.py b/tools/test_model_baking_parity.py new file mode 100644 index 000000000..b84af4f23 --- /dev/null +++ b/tools/test_model_baking_parity.py @@ -0,0 +1,117 @@ +#!/usr/bin/env python3 +"""Compare cuboid quad positions, UVs and element matrices with the pinned client.""" +import argparse +import json +import os +from pathlib import Path +import platform +import random +import subprocess +import zipfile +try: + from . import lab, test_rust_parity as base, test_cuboid_model_parity as decoding, test_model_resolution_parity as resolution +except ImportError: + import lab, test_rust_parity as base, test_cuboid_model_parity as decoding, test_model_resolution_parity as resolution + + +def corpus(): + yield from resolution.corpus() + directions = ['down', 'up', 'north', 'south', 'west', 'east'] + models = {} + def add(rotation, start=None, end=None, explicit=False): + index = len(models) + faces = {d: {'texture': '#all', 'cullface': d, 'rotation': 90 * (index % 4), + 'tintindex': index % 3 - 1} for d in directions} + if explicit: + for face in faces.values(): face['uv'] = [-0.0, 3.25, 15.5, -1.0] + element = {'from': start or [0, 0, 0], 'to': end or [16, 16, 16], 'faces': faces, + 'light_emission': index % 16} + if rotation is not None: element['rotation'] = rotation + if index % 3 == 0: element['shade_direction_override'] = directions[index % 6] + models[f'horizon:geometry_{index}'] = {'textures': {'all': 'block/stone'}, 'elements': [element]} + for bounds in [([0,0,0],[16,16,16]), ([16,16,16],[0,0,0]), ([0,8,0],[16,8,16]), + ([0,0,0],[0,0,0]), ([-16,-16,-16],[32,32,32]), ([-0.0,0,0],[16,16,16])]: + for explicit in [False, True]: add(None, *bounds, explicit) + for angle in [-720,-360,-180,-90,-63,-45,-22.5,-0.0,0,22.5,45,63,90,180,270,360,540,720]: + for axis in ['x','y','z']: + for rescale in [False,True]: + add({'origin':[8,8,8], 'axis':axis, 'angle':angle, 'rescale':rescale}, explicit=True) + for x in [0,22.5,90,180]: + for y in [0,45,90,270]: + for z in [-90,0,45,180]: + for rescale in [False,True]: + add({'origin':[8,3,-4], 'x':x, 'y':y, 'z':z, 'rescale':rescale}) + rng=random.Random(0x42414b494e47) + for _ in range(1200): + rotation={'origin':[rng.uniform(-64,64) for _ in range(3)], 'rescale':bool(rng.randrange(2))} + if rng.randrange(2): rotation.update(axis=rng.choice(['x','y','z']), angle=rng.uniform(-3600,3600)) + else: rotation.update(zip(['x','y','z'],[rng.uniform(-3600,3600) for _ in range(3)])) + add(rotation, [rng.uniform(-16,32) for _ in range(3)], [rng.uniform(-16,32) for _ in range(3)], bool(rng.randrange(2))) + row=resolution.bundle(models) + for token in ['1e100','-1e100','1e-100','-1e-100']: + name='horizon:extreme_'+str(len(row['models'])) + raw=json.dumps({'elements':[{'from':[0,0,0],'to':[16,16,16],'faces':{'up':{'texture':'#all'}},'rotation':{'origin':[8,8,8],'axis':'x','angle':'TOKEN','rescale':True}}]}) + row['models'][name]=raw.replace('"TOKEN"',token); row['roots'].append(name) + yield row + + +def client_libraries(): + _, directory=lab.config() + manifest=json.loads((directory/'manifest.json').read_text()) + libraries=[] + for library in manifest['libraries']: + artifact=library.get('downloads',{}).get('artifact') + if artifact: + relative=Path(artifact['path']) + if relative.is_absolute() or '..' in relative.parts: raise ValueError('Unsafe client library path') + path=directory/'libraries/client'/relative + if lab.digest(path,'sha1')!=artifact['sha1']: raise ValueError('Client dependency checksum changed: '+str(relative)) + libraries.append(path) + return libraries + + +def main(): + parser = argparse.ArgumentParser(description=__doc__); parser.add_argument('--prepare', action='store_true'); args = parser.parse_args() + if args.prepare: lab.prepare() + lock, jars, libraries = base.verify_artifacts() + build = lab.LOCAL / 'rust-model-baking-parity'; build.mkdir(parents=True, exist_ok=True) + report_path = build / 'report.json'; report_path.unlink(missing_ok=True) + oracle = lab.ROOT / 'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaModelBakingOracle.java' + helper = oracle.with_name('VanillaCuboidModelOracle.java') + crate = lab.ROOT / 'crates/horizon-assets' + sources = [oracle, helper, Path(__file__), lab.ROOT / 'tools/test_cuboid_model_parity.py', lab.ROOT / 'tools/test_model_resolution_parity.py', + lab.ROOT / 'tools/lab.py', lab.ROOT / 'tools/test_rust_parity.py', lab.ROOT / 'Cargo.toml', + lab.ROOT / 'Cargo.lock', crate / 'Cargo.toml', *sorted(crate.rglob('*.rs'))] + tested_sources = base.source_hashes(sources) + with zipfile.ZipFile(jars['client']) as archive: + names = sorted(name for name in archive.namelist() if name.startswith('assets/minecraft/models/block/') and name.endswith('.json')) + models = {'minecraft:' + name.removeprefix('assets/minecraft/models/').removesuffix('.json'): archive.read(name).decode() for name in names} + rows = [{'models': models, 'roots': list(models) + ['minecraft:builtin/missing', 'horizon:missing'], + 'queries': ['particle', '#particle', 'all', '#all', 'missingno', 'unknown', '', '#']}, *corpus()] + inputs = build / 'inputs.jsonl'; inputs.write_text(''.join(json.dumps(row) + '\n' for row in rows)); fixtures = base.source_hashes([inputs]) + classes = build / 'classes'; classes.mkdir(exist_ok=True) + def run(command, name): + with (build / (name + '.log')).open('w') as log: + subprocess.run(list(map(str, command)), cwd=lab.ROOT, check=True, timeout=3600, stdout=log, stderr=subprocess.STDOUT) + dependencies = os.pathsep.join(map(str, [jars['client'], *client_libraries()])) + run(['javac', '--release', lock['minecraft']['java_major'], '-proc:none', '-cp', dependencies, '-d', classes, oracle, helper], 'compile-java') + run(['cargo', 'build', '--locked', '-p', 'horizon-assets', '--example', 'model_baking_fixture'], 'compile-rust') + metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--locked', '--no-deps', '--format-version', '1'], cwd=lab.ROOT)) + binary = Path(metadata['target_directory']) / 'debug/examples' / ('model_baking_fixture.exe' if os.name == 'nt' else 'model_baking_fixture') + run([binary, inputs, build / 'rust.jsonl'], 'rust') + run(['java', '-Xmx512M', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.VanillaModelBakingOracle', inputs, build / 'client.jsonl'], 'client') + rejected = decoding.canonicalize(build / 'client.jsonl'); decoding.canonicalize(build / 'rust.jsonl') + matched = base.compare(build / 'client.jsonl', build / 'rust.jsonl') + base.ensure_sources_unchanged(sources, tested_sources); base.ensure_sources_unchanged([inputs], fixtures) + report = {'schema': 1, 'minecraft': lock['minecraft']['version'], 'manifest_sha1': lock['minecraft']['manifest_sha1'], + 'platform': platform.platform(), 'java': subprocess.check_output(['java', '--version'], text=True).splitlines()[0], + 'rustc': subprocess.check_output(['rustc', '--version'], text=True).strip(), + 'resource_models': len(names), 'graph_fixtures': len(rows), 'rejected_roots': rejected, + 'sources_sha256': tested_sources, 'fixtures_sha256': fixtures, 'rust_output_sha256': lab.digest(build / 'rust.jsonl', 'sha256'), + 'references': [{'side': 'client', 'jar_sha256': lab.digest(jars['client'], 'sha256'), + 'output_sha256': lab.digest(build / 'client.jsonl', 'sha256'), 'matched_output_lines': matched}], + 'scope': 'Actual client FaceBakery geometry overload with a real unit-atlas sprite and default JOML math options. Identity blockstate transform, all bundled cuboid geometry and synthetic rotations, rescaling, default/explicit UVs, winding, degenerate and reversed bounds, inherited models and missing materials. Positions, UVs and element matrix coefficients compare by float bits. This does not cover blockstate transforms/UV lock, atlas packing, transparency classification, lighting, GPU rendering or gameplay.'} + lab.write_json(report_path, report); print(f'Client cuboid baking: {matched:,} roots match ({rejected:,} rejected); {report_path}', flush=True) + + +if __name__ == '__main__': main() From 6a4add0c67dbea44916f126b69e7f5abf505be16 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 20:47:09 +0200 Subject: [PATCH 047/253] Render baked vanilla models and animated cutout sprites natively --- Cargo.lock | 1 + .../startup-smoke.json | 96 ++++++++ crates/horizon-client/Cargo.toml | 1 + crates/horizon-client/src/assets.rs | 50 +--- crates/horizon-client/src/main.rs | 16 +- crates/horizon-client/src/models.rs | 84 +++++++ crates/horizon-client/src/render.rs | 203 ++++++++++++---- crates/horizon-client/src/sprites.rs | 217 ++++++++++++++++++ crates/horizon-client/src/world.wgsl | 27 +++ docs/native-client.md | 39 +++- docs/rust-parity.md | 7 +- tools/test_native_client.py | 36 ++- 12 files changed, 676 insertions(+), 101 deletions(-) create mode 100644 benchmarks/rust-native-model-client-2026-10-06/startup-smoke.json create mode 100644 crates/horizon-client/src/models.rs create mode 100644 crates/horizon-client/src/sprites.rs diff --git a/Cargo.lock b/Cargo.lock index d9b9907be..6ae1e0340 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -587,6 +587,7 @@ version = "0.1.0" dependencies = [ "bytemuck", "glam", + "horizon-assets", "horizon-core", "horizon-world", "png", diff --git a/benchmarks/rust-native-model-client-2026-10-06/startup-smoke.json b/benchmarks/rust-native-model-client-2026-10-06/startup-smoke.json new file mode 100644 index 000000000..77e26f46a --- /dev/null +++ b/benchmarks/rust-native-model-client-2026-10-06/startup-smoke.json @@ -0,0 +1,96 @@ +{ + "adapter": { + "backend": "Vulkan", + "device": 0, + "device_type": "Cpu", + "name": "llvmpipe (LLVM 21.1.8, 256 bits)", + "vendor": 65541 + }, + "animated_sprites": 1, + "animation_uploads": 1, + "arch": "x86_64", + "camera_pitch": -0.3839724354387525, + "camera_position": [ + 25.0, + 18.0, + 25.0 + ], + "camera_yaw": -2.356194490192345, + "elapsed_seconds": 0.691954259, + "error": null, + "merged_quads": 166, + "model_gallery": [ + "oak_stairs", + "stone_slab", + "anvil", + "torch", + "lantern", + "oak_fence_post", + "oak_fence_gate", + "iron_bars_post", + "cobweb", + "grindstone", + "ladder", + "amethyst_cluster" + ], + "model_quads": 145, + "os": "linux", + "presented_frames": 30, + "project": "Horizon", + "resident_chunks": 9, + "schema": 1, + "scope": "Native cube and cuboid-model renderer with binary cutouts, stepped sprite animation and free camera; no gameplay simulation", + "sprite_layers": 18, + "window_size": [ + 1280, + 720 + ], + "resource_files": { + "files": 5579, + "sha256": "0bc95c8e4b10ef7401f4b948e9a151ea2f9d9112e8dadb9f6807a51e143fcf6f" + }, + "executable_sha256": "da79260dbc9ac235d48837dd7a2ea7369c03adffba40f7cb6a3e30f86c42daa4", + "resource_manifest_sha256": "eda44ebee6904eab880c15458dbd1212dc2799d320a4419fc810e2ceb0e5d9d6", + "sources": { + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "fed441cad861a44e9919087307cdb9b3d8165fe36ae05ab03f72dde23758cbd5", + "tools/test_native_client.py": "e47a866cffd20fcd6fdab62fca573227ca9837488e72384f08f8c33fd4b6228c", + "crates/horizon-client/Cargo.toml": "a6eaf78388d88f1e9628474734ee6f1678f1b12c63ee25e86d7d95c8a9c155a8", + "crates/horizon-assets/Cargo.toml": "fadb78cf819e026500606c45d27138ed67fcbbc967ae8cee6c1e7c82c9046b36", + "crates/horizon-client/src/assets.rs": "c953a42820cb8d19d8964d4807df401614d4d6621bb47d8ba591c8db38f3e214", + "crates/horizon-client/src/camera.rs": "f9821c8a51a004dd4ad9c0952e746eb07926f6040cf8660bc26da5a0728ae572", + "crates/horizon-client/src/main.rs": "7fb00e89b963a77f124c8e7ad59c5506a4a2f3e6c69720944dec00677ed15239", + "crates/horizon-client/src/mesh.rs": "e2fa00435ec8239ba8a3c6539022bb50a10ff9c3850c6faab72f86aabea896ef", + "crates/horizon-client/src/models.rs": "70b0273100e83afbfc5c013c79afae1e6b13565845e067ad3303244c3f0bbe68", + "crates/horizon-client/src/render.rs": "0f8929d9061b20adbc5ddd0adcbe9f90ce76227b7bb9bafe3f4474961ee2984c", + "crates/horizon-client/src/sprites.rs": "0c4d6acc07b947e5d99aeed8f3788d15639d5af1071eaa0852e9e2fd8c51e318", + "crates/horizon-client/src/world.rs": "901aa59c23ea084e926eec014589f4d511c41691a8dc1520534e039c28cfc76c", + "crates/horizon-client/src/world.wgsl": "82873c131f46a31aef35106f89a53589f179048362d0f8877eca6d20aa6274a4", + "crates/horizon-assets/src/bake.rs": "0bc519e93ad8200d89543ceb5c811dd82bbeb0e9003b143385c8a03e758dfe65", + "crates/horizon-assets/src/json.rs": "e7b89bf4852f561a0e5bf1a984857c61e755961dfd86fcc326b6d55558615f39", + "crates/horizon-assets/src/lib.rs": "5fe567bdf1e63230cee2b960719c5cb6166176a674772955329a9d04cf22b9db", + "crates/horizon-assets/src/model.rs": "57ddb3d65e88e7a8aa22c62bc298a2dae7f4e994326a873a31f06c0f36ed051b", + "crates/horizon-assets/src/resolve.rs": "3927ac926cdcbd7d334901cc32d0ecc1e498b1bec98f76a46bca6d4964c13541" + }, + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "manual_validation": { + "scope": "Interactive close inspection of the twelve gallery models, followed by stationary screenshot differences confined to the lantern. This preceded the final Arc allocation/lint cleanup; the bounded startup test above used the final source fingerprints.", + "interactive_frames": 6226, + "animation_uploads": 269, + "lantern_difference_bounds": [ + 411, + 307, + 425, + 318 + ], + "screenshot_sha256": { + "model-gallery-first.png": "2ac637607e34ec05f552b3496c721ae9c09fa9e2a4a1d5e64073a49c39c5b36c", + "model-gallery-close.png": "188d35e8a9ecd0c68ee08545b503402450e2675f2ccf28fbb32d26751e634a7e", + "model-gallery-animation-0.png": "188d35e8a9ecd0c68ee08545b503402450e2675f2ccf28fbb32d26751e634a7e", + "model-gallery-animation-1.png": "1e26f942411d91554c4e509803d7e5eafa8e6d5467c455051d0b5c77497a2ec2", + "model-gallery-animation-2.png": "188d35e8a9ecd0c68ee08545b503402450e2675f2ccf28fbb32d26751e634a7e", + "model-gallery-animation-3.png": "1e26f942411d91554c4e509803d7e5eafa8e6d5467c455051d0b5c77497a2ec2" + }, + "limitations": "Linux software Vulkan adapter only; no native Mac or Windows execution, gameplay or full pixel-parity claim." + } +} diff --git a/crates/horizon-client/Cargo.toml b/crates/horizon-client/Cargo.toml index a254ac79a..8fb88ff23 100644 --- a/crates/horizon-client/Cargo.toml +++ b/crates/horizon-client/Cargo.toml @@ -7,6 +7,7 @@ rust-version = "1.90" description = "Horizon native development client" [dependencies] +horizon-assets = { path = "../horizon-assets" } horizon-core = { path = "../horizon-core" } horizon-world = { path = "../horizon-world" } wgpu = { version = "30.0.1", default-features = false, features = ["std", "parking_lot", "vulkan", "metal", "dx12", "wgsl"] } diff --git a/crates/horizon-client/src/assets.rs b/crates/horizon-client/src/assets.rs index 62f83b8fe..2730fddd1 100644 --- a/crates/horizon-client/src/assets.rs +++ b/crates/horizon-client/src/assets.rs @@ -56,6 +56,9 @@ pub struct Assets { pub layers: Vec, pub sprite_size: u32, pub pixels: Vec, + pub texture_layers: u32, + pub model_quads: Vec, + pub animations: Vec, } fn invalid(message: &str) -> io::Error { io::Error::new(io::ErrorKind::InvalidData, message) @@ -169,55 +172,26 @@ impl Assets { .map(|state| if state.air { -1 } else { -2 }) .collect(); let mut material_states = [BlockStateId(0); 6]; - let mut pixels = Vec::new(); - let mut sprite_size = 0; + let mut sprites = crate::sprites::Sprites::default(); for (layer, name) in MATERIALS.iter().enumerate() { let state = registry .default_state(&format!("minecraft:{name}")) .ok_or_else(|| invalid("missing test-scene material"))?; material_states[layer] = state; - layers[state.0 as usize] = layer as i32; - let path = root.join(format!("assets/minecraft/textures/block/{name}.png")); - let mut decoder = png::Decoder::new(BufReader::new(File::open(path)?)); - decoder - .set_transformations(png::Transformations::EXPAND | png::Transformations::STRIP_16); - let mut reader = decoder.read_info()?; - let mut bytes = vec![ - 0; - reader - .output_buffer_size() - .ok_or_else(|| invalid("sprite exceeds decoder limits"))? - ]; - let info = reader.next_frame(&mut bytes)?; - if info.width != info.height - || info.width == 0 - || (sprite_size != 0 && sprite_size != info.width) - { - return Err(invalid( - "test-client sprites must be square and use matching dimensions", - ) - .into()); - } - sprite_size = info.width; - let channels = info.color_type.samples(); - for pixel in bytes[..info.buffer_size()].chunks_exact(channels) { - let rgba = match info.color_type { - png::ColorType::Rgba => [pixel[0], pixel[1], pixel[2], pixel[3]], - png::ColorType::Rgb => [pixel[0], pixel[1], pixel[2], 255], - png::ColorType::Grayscale => [pixel[0], pixel[0], pixel[0], 255], - png::ColorType::GrayscaleAlpha => [pixel[0], pixel[0], pixel[0], pixel[1]], - _ => return Err(invalid("unsupported expanded sprite format").into()), - }; - pixels.extend(rgba); - } + let sprite = sprites.insert(root, &format!("minecraft:block/{name}"))?; + layers[state.0 as usize] = sprite as i32; } + let model_quads = crate::models::gallery(root, &mut sprites)?; Ok(Self { registry, properties, material_states, layers, - sprite_size, - pixels, + sprite_size: sprites.size, + texture_layers: u32::try_from(sprites.layers.len())?, + pixels: sprites.pixels, + model_quads, + animations: sprites.animations, }) } } diff --git a/crates/horizon-client/src/main.rs b/crates/horizon-client/src/main.rs index 2bcfe2a92..399969f2d 100644 --- a/crates/horizon-client/src/main.rs +++ b/crates/horizon-client/src/main.rs @@ -4,7 +4,9 @@ mod assets; mod camera; mod mesh; +mod models; mod render; +mod sprites; mod world; use assets::Assets; use camera::Camera; @@ -60,7 +62,7 @@ impl Options { } if argument == "--help" || argument == "-h" { println!( - "Horizon native development client\n\n --resources PATH Prepared pinned resources\n --radius CHUNKS Controlled scene radius, 1..16 (default 4)\n --frames COUNT Exit after this many presented frames\n --smoke-report PATH Write a runtime report on exit\n --timeout-seconds N Deadline for a frame-limited run (default 90)\n --trace-input Log received keyboard, mouse-button and focus events\n\nControls: click to capture mouse; WASD move; Space/Shift rise/descend;\nCtrl boosts speed; arrow keys rotate; Esc releases mouse; Ctrl+Q quits; F3 shows diagnostics.\n\nThis is a controlled cube scene with a free inspection camera, not complete gameplay." + "Horizon native development client\n\n --resources PATH Prepared pinned resources\n --radius CHUNKS Controlled scene radius, 1..16 (default 4)\n --frames COUNT Exit after this many presented frames\n --smoke-report PATH Write a runtime report on exit\n --timeout-seconds N Deadline for a frame-limited run (default 90)\n --trace-input Log received keyboard, mouse-button and focus events\n\nControls: click to capture mouse; WASD move; Space/Shift rise/descend;\nCtrl boosts speed; arrow keys rotate; Esc releases mouse; Ctrl+Q quits; F3 shows diagnostics.\n\nThis is a controlled block/model scene with a free inspection camera, not complete gameplay." ); return Ok(None); } @@ -157,7 +159,7 @@ impl App<'_> { let report = serde_json::json!({ "schema": 1, "project": "Horizon", - "scope": "Native opaque-cube renderer and free inspection camera; no gameplay simulation", + "scope": "Native cube and cuboid-model renderer with binary cutouts, stepped sprite animation and free camera; no gameplay simulation", "os": std::env::consts::OS, "arch": std::env::consts::ARCH, "adapter": adapter, @@ -166,6 +168,11 @@ impl App<'_> { "elapsed_seconds": self.started.elapsed().as_secs_f64(), "resident_chunks": self.world.chunks.len(), "merged_quads": self.mesh.len(), + "model_quads": self.assets.model_quads.len(), + "model_gallery": models::GALLERY, + "sprite_layers": self.assets.texture_layers, + "animated_sprites": self.assets.animations.len(), + "animation_uploads": self.renderer.as_ref().map_or(0, |r| r.animation_uploads), "camera_position": self.camera.position.to_array(), "camera_yaw": self.camera.yaw, "camera_pitch": self.camera.pitch, @@ -348,9 +355,10 @@ fn run() -> Result<()> { let world = TestWorld::new(&assets, options.radius)?; let mesh = mesh::build(&world)?; eprintln!( - "Horizon development scene: {} resident chunks, {} merged cube faces.\nClick to capture mouse; WASD/Space/Shift move; arrows rotate; Esc releases; Ctrl+Q quits.", + "Horizon development scene: {} resident chunks, {} merged cube faces, {} baked model faces.\nClick to capture mouse; WASD/Space/Shift move; arrows rotate; Esc releases; Ctrl+Q quits.", world.chunks.len(), - mesh.len() + mesh.len(), + assets.model_quads.len() ); let now = Instant::now(); let mut app = App { diff --git a/crates/horizon-client/src/models.rs b/crates/horizon-client/src/models.rs new file mode 100644 index 000000000..492cbeb70 --- /dev/null +++ b/crates/horizon-client/src/models.rs @@ -0,0 +1,84 @@ +//! A resource-model inspection gallery. Blockstate dispatch is still separate. +use crate::{Result, sprites::Sprites}; +use horizon_assets::{ + bake::bake_model, + model::{CuboidModel, Direction}, + resolve::ModelLibrary, +}; +use std::{collections::BTreeMap, fs, path::Path}; + +pub const GALLERY: [&str; 12] = [ + "oak_stairs", + "stone_slab", + "anvil", + "torch", + "lantern", + "oak_fence_post", + "oak_fence_gate", + "iron_bars_post", + "cobweb", + "grindstone", + "ladder", + "amethyst_cluster", +]; + +#[repr(C)] +#[derive(Clone, Copy, bytemuck::Pod, bytemuck::Zeroable)] +pub struct ModelInstance { + pub positions: [[f32; 3]; 4], + pub uv: [[f32; 2]; 4], + pub layer: u32, + pub shade: f32, +} +pub fn gallery(root: &Path, sprites: &mut Sprites) -> Result> { + let mut models = BTreeMap::new(); + let mut pending: Vec<_> = GALLERY + .iter() + .map(|name| format!("minecraft:block/{name}")) + .collect(); + while let Some(name) = pending.pop() { + if models.contains_key(&name) { + continue; + } + let (namespace, path) = name.split_once(':').ok_or("invalid model identifier")?; + let text = fs::read_to_string(root.join(format!("assets/{namespace}/models/{path}.json")))?; + let model = CuboidModel::from_json(&text)?; + if let Some(parent) = &model.parent { + pending.push(parent.clone()); + } + models.insert(name, model); + } + let library = ModelLibrary::new(models)?; + let mut instances = Vec::new(); + for (index, name) in GALLERY.iter().enumerate() { + let model = library.resolve(&format!("minecraft:block/{name}"))?; + let origin = [ + (index % 4) as f32 * 4.0 - 7.0, + 4.0, + (index / 4) as f32 * 4.0 + 14.0, + ]; + for quad in bake_model(&model)? { + if quad.material.force_translucent || quad.tint_index != -1 { + return Err( + "inspection gallery requires untinted opaque or binary-cutout materials".into(), + ); + } + let layer = sprites.insert(root, &quad.material.sprite)?; + let shade = match quad.shade_direction_override.unwrap_or(quad.facing) { + Direction::Down => 0.5, + Direction::Up => 1.0, + Direction::North | Direction::South => 0.8, + Direction::West | Direction::East => 0.6, + }; + instances.push(ModelInstance { + positions: quad + .positions + .map(|v| std::array::from_fn(|i| v[i] + origin[i])), + uv: quad.uv, + layer, + shade, + }); + } + } + Ok(instances) +} diff --git a/crates/horizon-client/src/render.rs b/crates/horizon-client/src/render.rs index fb4a850f8..631295c61 100644 --- a/crates/horizon-client/src/render.rs +++ b/crates/horizon-client/src/render.rs @@ -1,5 +1,5 @@ -use crate::{Result, assets::Assets, camera::Camera, mesh::Quad}; -use std::sync::Arc; +use crate::{Result, assets::Assets, camera::Camera, mesh::Quad, models::ModelInstance}; +use std::{sync::Arc, time::Instant}; use wgpu::util::DeviceExt; use winit::window::Window; #[repr(C)] @@ -17,6 +17,14 @@ pub struct Renderer { queue: wgpu::Queue, config: wgpu::SurfaceConfiguration, pipeline: wgpu::RenderPipeline, + model_pipeline: wgpu::RenderPipeline, + model_quads: wgpu::Buffer, + model_quad_count: u32, + sprite_texture: wgpu::Texture, + sprite_size: u32, + animations: Vec<(crate::sprites::SpriteAnimation, usize)>, + animation_started: Instant, + pub animation_uploads: u64, group: wgpu::BindGroup, uniform: wgpu::Buffer, quads: wgpu::Buffer, @@ -72,45 +80,101 @@ impl Renderer { label: Some("Horizon cube renderer"), source: wgpu::ShaderSource::Wgsl(include_str!("world.wgsl").into()), }); - let attributes = wgpu::vertex_attr_array![0=>Float32x3,1=>Float32x2,2=>Uint32,3=>Uint32]; - let pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor { - label: Some("Horizon opaque cubes"), - layout: None, - vertex: wgpu::VertexState { - module: &shader, - entry_point: Some("vs_main"), - compilation_options: Default::default(), - buffers: &[Some(wgpu::VertexBufferLayout { - array_stride: std::mem::size_of::() as u64, - step_mode: wgpu::VertexStepMode::Instance, - attributes: &attributes, - })], - }, - primitive: wgpu::PrimitiveState { - cull_mode: Some(wgpu::Face::Back), - ..Default::default() - }, - depth_stencil: Some(wgpu::DepthStencilState { - format: wgpu::TextureFormat::Depth32Float, - depth_write_enabled: Some(true), - depth_compare: Some(wgpu::CompareFunction::Less), - stencil: Default::default(), - bias: Default::default(), - }), - multisample: Default::default(), - fragment: Some(wgpu::FragmentState { - module: &shader, - entry_point: Some("fs_main"), - compilation_options: Default::default(), - targets: &[Some(wgpu::ColorTargetState { - format: config.format, - blend: None, - write_mask: wgpu::ColorWrites::ALL, - })], - }), - multiview_mask: None, - cache: None, + let bindings = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor { + label: Some("Horizon world bindings"), + entries: &[ + wgpu::BindGroupLayoutEntry { + binding: 0, + visibility: wgpu::ShaderStages::VERTEX_FRAGMENT, + ty: wgpu::BindingType::Buffer { + ty: wgpu::BufferBindingType::Uniform, + has_dynamic_offset: false, + min_binding_size: None, + }, + count: None, + }, + wgpu::BindGroupLayoutEntry { + binding: 1, + visibility: wgpu::ShaderStages::FRAGMENT, + ty: wgpu::BindingType::Texture { + sample_type: wgpu::TextureSampleType::Float { filterable: true }, + view_dimension: wgpu::TextureViewDimension::D2Array, + multisampled: false, + }, + count: None, + }, + wgpu::BindGroupLayoutEntry { + binding: 2, + visibility: wgpu::ShaderStages::FRAGMENT, + ty: wgpu::BindingType::Sampler(wgpu::SamplerBindingType::Filtering), + count: None, + }, + ], }); + let layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { + label: Some("Horizon world layout"), + bind_group_layouts: &[Some(&bindings)], + ..Default::default() + }); + let create_pipeline = + |label: &str, vertex: &str, fragment: &str, buffer: wgpu::VertexBufferLayout<'_>| { + device.create_render_pipeline(&wgpu::RenderPipelineDescriptor { + label: Some(label), + layout: Some(&layout), + vertex: wgpu::VertexState { + module: &shader, + entry_point: Some(vertex), + compilation_options: Default::default(), + buffers: &[Some(buffer)], + }, + primitive: wgpu::PrimitiveState { + cull_mode: Some(wgpu::Face::Back), + ..Default::default() + }, + depth_stencil: Some(wgpu::DepthStencilState { + format: wgpu::TextureFormat::Depth32Float, + depth_write_enabled: Some(true), + depth_compare: Some(wgpu::CompareFunction::Less), + stencil: Default::default(), + bias: Default::default(), + }), + multisample: Default::default(), + fragment: Some(wgpu::FragmentState { + module: &shader, + entry_point: Some(fragment), + compilation_options: Default::default(), + targets: &[Some(wgpu::ColorTargetState { + format: config.format, + blend: None, + write_mask: wgpu::ColorWrites::ALL, + })], + }), + multiview_mask: None, + cache: None, + }) + }; + let attributes = wgpu::vertex_attr_array![0=>Float32x3,1=>Float32x2,2=>Uint32,3=>Uint32]; + let pipeline = create_pipeline( + "Horizon opaque cubes", + "vs_main", + "fs_main", + wgpu::VertexBufferLayout { + array_stride: std::mem::size_of::() as u64, + step_mode: wgpu::VertexStepMode::Instance, + attributes: &attributes, + }, + ); + let model_attributes = wgpu::vertex_attr_array![0=>Float32x3,1=>Float32x3,2=>Float32x3,3=>Float32x3,4=>Float32x2,5=>Float32x2,6=>Float32x2,7=>Float32x2,8=>Uint32,9=>Float32]; + let model_pipeline = create_pipeline( + "Horizon model geometry", + "vs_model", + "fs_model", + wgpu::VertexBufferLayout { + array_stride: std::mem::size_of::() as u64, + step_mode: wgpu::VertexStepMode::Instance, + attributes: &model_attributes, + }, + ); let uniform = device.create_buffer(&wgpu::BufferDescriptor { label: Some("Horizon camera"), size: std::mem::size_of::() as u64, @@ -120,11 +184,11 @@ impl Renderer { let texture = device.create_texture_with_data( &queue, &wgpu::TextureDescriptor { - label: Some("Pinned cube sprites"), + label: Some("Pinned block sprites"), size: wgpu::Extent3d { width: assets.sprite_size, height: assets.sprite_size, - depth_or_array_layers: assets.material_states.len() as u32, + depth_or_array_layers: assets.texture_layers, }, mip_level_count: 1, sample_count: 1, @@ -150,7 +214,7 @@ impl Renderer { }); let group = device.create_bind_group(&wgpu::BindGroupDescriptor { label: Some("Horizon world resources"), - layout: &pipeline.get_bind_group_layout(0), + layout: &bindings, entries: &[ wgpu::BindGroupEntry { binding: 0, @@ -172,6 +236,12 @@ impl Renderer { contents: bytemuck::cast_slice(quads), usage: wgpu::BufferUsages::VERTEX, }); + let model_quad_count = u32::try_from(assets.model_quads.len())?; + let model_quads = device.create_buffer_init(&wgpu::util::BufferInitDescriptor { + label: Some("Baked vanilla model faces"), + contents: bytemuck::cast_slice(&assets.model_quads), + usage: wgpu::BufferUsages::VERTEX, + }); let depth = Self::depth(&device, &config); Ok(Self { instance, @@ -181,6 +251,18 @@ impl Renderer { queue, config, pipeline, + model_pipeline, + model_quads, + model_quad_count, + sprite_texture: texture, + sprite_size: assets.sprite_size, + animations: assets + .animations + .iter() + .map(|a| (a.clone(), a.frame(0))) + .collect(), + animation_started: Instant::now(), + animation_uploads: 0, group, uniform, quads, @@ -242,6 +324,38 @@ impl Renderer { return Err("surface acquisition failed validation".into()); } }; + // Inspection textures advance at 20 ticks/s independently of presentation. + let tick = self.animation_started.elapsed().as_millis() / 50; + for (animation, previous) in &mut self.animations { + let frame = animation.frame(tick as u64); + if frame != *previous { + self.queue.write_texture( + wgpu::TexelCopyTextureInfo { + texture: &self.sprite_texture, + mip_level: 0, + origin: wgpu::Origin3d { + x: 0, + y: 0, + z: animation.layer, + }, + aspect: wgpu::TextureAspect::All, + }, + animation.pixels(frame), + wgpu::TexelCopyBufferLayout { + offset: 0, + bytes_per_row: Some(self.sprite_size * 4), + rows_per_image: Some(self.sprite_size), + }, + wgpu::Extent3d { + width: self.sprite_size, + height: self.sprite_size, + depth_or_array_layers: 1, + }, + ); + *previous = frame; + self.animation_uploads += 1; + } + } let fog = [0.35, 0.55, 0.80, 1.0]; let p = camera.position.as_vec3(); let uniforms = Uniforms { @@ -291,6 +405,9 @@ impl Renderer { pass.set_bind_group(0, &self.group, &[]); pass.set_vertex_buffer(0, self.quads.slice(..)); pass.draw(0..6, 0..self.quad_count); + pass.set_pipeline(&self.model_pipeline); + pass.set_vertex_buffer(0, self.model_quads.slice(..)); + pass.draw(0..6, 0..self.model_quad_count); } self.queue.submit([encoder.finish()]); self.window.pre_present_notify(); diff --git a/crates/horizon-client/src/sprites.rs b/crates/horizon-client/src/sprites.rs new file mode 100644 index 000000000..e5681a030 --- /dev/null +++ b/crates/horizon-client/src/sprites.rs @@ -0,0 +1,217 @@ +//! Shared nearest-sampled sprite array for the controlled scene. +use crate::Result; +use std::{ + collections::BTreeMap, + fs::{self, File}, + io::BufReader, + path::Path, + sync::Arc, +}; + +#[derive(Clone)] +pub struct SpriteAnimation { + pub layer: u32, + frames: Arc>>, + sequence: Arc>, + duration: u64, +} +impl SpriteAnimation { + pub fn frame(&self, tick: u64) -> usize { + let mut time = tick % self.duration; + for &(index, duration) in self.sequence.iter() { + if time < u64::from(duration) { + return index; + } + time -= u64::from(duration); + } + unreachable!("validated animation duration") + } + pub fn pixels(&self, frame: usize) -> &[u8] { + &self.frames[frame] + } +} + +#[derive(Default)] +pub struct Sprites { + pub size: u32, + pub pixels: Vec, + pub layers: BTreeMap, + pub animations: Vec, +} +impl Sprites { + pub fn insert(&mut self, root: &Path, name: &str) -> Result { + if let Some(layer) = self.layers.get(name) { + return Ok(*layer); + } + let (namespace, path) = name.split_once(':').ok_or("invalid sprite identifier")?; + let path = root.join(format!("assets/{namespace}/textures/{path}.png")); + let metadata = match fs::read_to_string(path.with_extension("png.mcmeta")) { + Ok(text) => Some(serde_json::from_str::(&text)?), + Err(error) if error.kind() == std::io::ErrorKind::NotFound => None, + Err(error) => return Err(error.into()), + }; + let animation = metadata.as_ref().and_then(|v| v.get("animation")); + let mut decoder = png::Decoder::new(BufReader::new(File::open(path)?)); + decoder.set_transformations(png::Transformations::EXPAND | png::Transformations::STRIP_16); + let mut reader = decoder.read_info()?; + let mut bytes = vec![ + 0; + reader + .output_buffer_size() + .ok_or("sprite exceeds decoder limits")? + ]; + let info = reader.next_frame(&mut bytes)?; + let positive = |value: &serde_json::Value| -> Result { + let value = value + .as_u64() + .filter(|v| *v > 0 && *v <= i32::MAX as u64) + .ok_or("invalid positive animation integer")?; + Ok(value as u32) + }; + let (width, height) = if let Some(animation) = animation { + if !animation.is_object() { + return Err("invalid animation metadata".into()); + } + if animation + .get("interpolate") + .and_then(serde_json::Value::as_bool) + .unwrap_or(false) + { + return Err( + "interpolated animation is not yet supported by the inspection renderer".into(), + ); + } + match ( + animation.get("width").map(positive).transpose()?, + animation.get("height").map(positive).transpose()?, + ) { + (Some(w), Some(h)) => (w, h), + (Some(w), None) => (w, info.height), + (None, Some(h)) => (info.width, h), + (None, None) => { + let size = info.width.min(info.height); + (size, size) + } + } + } else { + (info.width, info.height) + }; + if width != height + || width == 0 + || info.width % width != 0 + || info.height % height != 0 + || (self.size != 0 && self.size != width) + { + return Err(format!( + "inspection sprite {name} must be square and match the sprite array dimensions" + ) + .into()); + } + let channels = info.color_type.samples(); + let mut pixels = Vec::with_capacity(info.width as usize * info.height as usize * 4); + for pixel in bytes[..info.buffer_size()].chunks_exact(channels) { + let rgba = match info.color_type { + png::ColorType::Rgba => [pixel[0], pixel[1], pixel[2], pixel[3]], + png::ColorType::Rgb => [pixel[0], pixel[1], pixel[2], 255], + png::ColorType::Grayscale => [pixel[0], pixel[0], pixel[0], 255], + png::ColorType::GrayscaleAlpha => [pixel[0], pixel[0], pixel[0], pixel[1]], + _ => return Err("unsupported expanded sprite format".into()), + }; + if rgba[3] != 0 && rgba[3] != 255 { + return Err(format!( + "inspection sprite {name} requires fractional-alpha rendering" + ) + .into()); + } + pixels.extend(rgba); + } + let layer = u32::try_from(self.layers.len())?; + let columns = info.width / width; + let count = columns * (info.height / height); + let mut frames = Vec::new(); + for index in 0..count { + let x = index % columns * width; + let y = index / columns * height; + let mut frame = Vec::with_capacity((width * height * 4) as usize); + for row in y..y + height { + let offset = ((row * info.width + x) * 4) as usize; + frame.extend_from_slice(&pixels[offset..offset + (width * 4) as usize]); + } + frames.push(frame); + } + let frames = Arc::new(frames); + let mut initial = 0; + if let Some(metadata) = animation { + let default_time = metadata + .get("frametime") + .map(positive) + .transpose()? + .unwrap_or(1); + let sequence = if let Some(values) = metadata.get("frames") { + let mut sequence = Vec::new(); + for value in values.as_array().ok_or("invalid animation frame list")? { + let (index, time) = if value.is_object() { + ( + value.get("index").and_then(serde_json::Value::as_u64), + value + .get("time") + .map(positive) + .transpose()? + .unwrap_or(default_time), + ) + } else { + (value.as_u64(), default_time) + }; + if let Some(index) = index.filter(|i| *i < u64::from(count)) { + sequence.push((index as usize, time)); + } + } + sequence + } else { + (0..count).map(|i| (i as usize, default_time)).collect() + }; + if sequence.len() > 1 { + initial = sequence[0].0; + let duration = sequence.iter().map(|(_, time)| u64::from(*time)).sum(); + self.animations.push(SpriteAnimation { + layer, + frames: frames.clone(), + sequence: Arc::new(sequence), + duration, + }); + } + } + self.layers.insert(name.to_owned(), layer); + self.size = width; + self.pixels.extend_from_slice(&frames[initial]); + Ok(layer) + } +} + +#[cfg(test)] +mod tests { + use super::*; + #[test] + fn animation_boundaries_and_repeated_frames_do_not_depend_on_render_rate() { + let animation = SpriteAnimation { + layer: 0, + frames: Arc::new(vec![vec![], vec![], vec![]]), + sequence: Arc::new(vec![(2, 8), (1, 3), (1, 2), (0, 1)]), + duration: 14, + }; + for (tick, frame) in [ + (0, 2), + (7, 2), + (8, 1), + (10, 1), + (11, 1), + (12, 1), + (13, 0), + (14, 2), + (29, 2), + (u64::MAX, 2), + ] { + assert_eq!(animation.frame(tick), frame); + } + } +} diff --git a/crates/horizon-client/src/world.wgsl b/crates/horizon-client/src/world.wgsl index 4899d5a84..35126504a 100644 --- a/crates/horizon-client/src/world.wgsl +++ b/crates/horizon-client/src/world.wgsl @@ -40,3 +40,30 @@ struct VertexOut { let fog_amount=smoothstep(camera.position.w*0.65,camera.position.w,distance); return vec4(mix(color.rgb*input.shade,camera.fog.rgb,fog_amount),1.0); } + +@vertex fn vs_model(@builtin(vertex_index) vertex: u32, + @location(0) p0: vec3, @location(1) p1: vec3, + @location(2) p2: vec3, @location(3) p3: vec3, + @location(4) uv0: vec2, @location(5) uv1: vec2, + @location(6) uv2: vec2, @location(7) uv3: vec2, + @location(8) layer: u32, @location(9) shade: f32) -> VertexOut { + let order=array(0u,1u,2u,0u,2u,3u); + let positions=array,4>(p0,p1,p2,p3); + let uvs=array,4>(uv0,uv1,uv2,uv3); + let corner=order[vertex]; + var output: VertexOut; + output.clip=camera.view_projection*vec4(positions[corner],1.0); + output.uv=uvs[corner]; + output.layer=layer; + output.shade=shade; + output.world_position=positions[corner]; + return output; +} +@fragment fn fs_model(input:VertexOut)->@location(0) vec4 { + let color=textureSample(sprites,sprite_sampler,input.uv,i32(input.layer)); + // Inspection sprites are validated to contain only zero or full alpha. + if color.a<0.5 { discard; } + let distance=length(input.world_position-camera.position.xyz); + let fog_amount=smoothstep(camera.position.w*0.65,camera.position.w,distance); + return vec4(mix(color.rgb*input.shade,camera.fog.rgb,fog_amount),1.0); +} diff --git a/docs/native-client.md b/docs/native-client.md index f31e57409..37970b2d7 100644 --- a/docs/native-client.md +++ b/docs/native-client.md @@ -1,16 +1,29 @@ # Horizon native development client `horizon-client` opens a native Rust window and renders a controlled block scene -stored in Horizon's resident chunks. It loads six opaque cube textures and the -block registry from the pinned Java Edition 26.3 resources. A padded chunk mesh +stored in Horizon's resident chunks, alongside twelve real resource models. It +loads the block registry, models and sprites from pinned Java Edition 26.3 +resources. A padded chunk mesh culls hidden faces across chunk boundaries and merges adjacent matching faces; -the GPU draws the rectangles as instances. The camera is a free inspection tool. +the GPU draws the rectangles as instances. A separate instanced draw renders +baked cuboid faces without expanding them into cube approximations. The camera +is a free inspection tool. This checkpoint has no player simulation, vanilla world generation, block interaction, inventory, sound, networking or world save/load. It does not meet the [playable-build acceptance criteria](rust-parity.md#completion-criteria-and-playable-builds). -Full block models, weighted variants, texture orientation, transparency, tinting, -light, resource packs, chunk streaming and visual parity remain unfinished. +Blockstate dispatch, weighted variants, model transforms/UV locking, fractional +transparency, tinting, lighting, resource packs, chunk streaming and full visual +parity remain unfinished. + +The resource gallery sits beside the pyramid and includes oak stairs, a slab, +an anvil, a torch, a lantern, fence parts, iron bars, a cobweb, a grindstone, a +ladder and an amethyst cluster. These are explicit model selections for geometry +inspection, not simulated block placements. Binary-alpha cutouts are rendered; +the lantern's three frames advance every eight inspection ticks at 20 ticks/s. +General animation metadata compatibility, interpolation and synchronization with +the eventual game loop still need validation. Sprites currently require matching +square frame dimensions. ## Run from a checkout @@ -68,8 +81,8 @@ python3 tools/test_cuboid_model_parity.py The [archived decoder result](../benchmarks/rust-cuboid-model-decoding-2026-10-06/scoped-parity.json) records source, fixture and reference hashes. The oracle uses actual client -classes; those rendering APIs are absent from the server. This decoder is not -yet connected to the development renderer. Blockstate selection, transformed +classes; those rendering APIs are absent from the server. The decoder, parent +resolver and baker now feed the development gallery. Blockstate selection, transformed models, UV locking and rendered appearance still need their own checks. `ModelLibrary` resolves parent geometry, ambient occlusion, GUI lighting and @@ -119,11 +132,14 @@ python3 tools/test_native_client.py --vscreen The mesh tests compare expanded rectangles against independently enumerated exposed voxel faces, including solid neighbors, cavities, material boundaries, negative chunk origins and random surroundings. The startup runner launches a -nine-chunk scene, requires 30 presented frames and a clean exit, and writes GPU, +nine-chunk scene, requires 30 presented frames and a clean exit, verifies 145 +baked gallery faces across 18 sprite layers, and writes GPU, platform, binary and source information to ignored `.local/horizon-client/startup-smoke.json`. It has an external timeout as well as the application's frame deadline. These checks do not establish gameplay or -pixel parity with Java. +pixel parity with Java. Source and resource fingerprints must remain unchanged +during the run. An animation test covers duration boundaries, wrapping and +repeated physical frames independently of render frequency. Initial local validation uses Linux x86_64, a headless Wayland compositor and Vulkan llvmpipe software rendering. Textured geometry and resizing were visually @@ -132,3 +148,8 @@ physical key codes. Captured relative mouse movement and Escape release were exercised through a virtual pointer. Native macOS/Metal and Windows/Direct3D 12 runtime tests remain pending. Software-renderer frame rates are not evidence of a hardware speedup. + +The model gallery was also inspected at close range on Linux/Vulkan llvmpipe. +With the camera stationary, screenshot differences were confined to the lantern +as its frames changed. The [model-client startup report](../benchmarks/rust-native-model-client-2026-10-06/startup-smoke.json) +records the bounded presentation check and the scope of this visual inspection. diff --git a/docs/rust-parity.md b/docs/rust-parity.md index c131a941e..496a74f12 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -3,7 +3,8 @@ The behavior target is the repository's pinned **Minecraft Java Edition 26.3**. One-to-one vanilla gameplay parity is the acceptance criterion. It has **not** been reached. Horizon now has a [native development client](native-client.md) -that renders a controlled block scene with a free camera. It does not run a +that renders a controlled block scene and twelve baked resource models with a +free camera. It does not run a complete game server or gameplay simulation. The Rust workspace implements core arithmetic/random streams, world data and resident sections, scheduled tick ordering, geometry, contained fluid states, @@ -18,7 +19,9 @@ block-model JSON files and 2,337 synthetic cases compared against the actual client parser. [Decoder scope and validation](native-client.md#validation) also include parent/texture resolution over 5,648 roots and cuboid baking over 7,100 roots with identity blockstate transforms. Blockstate selection, transformed -models, UV locking and integration with the renderer remain unfinished. +models and UV locking remain unfinished. The native renderer now draws an +inspection gallery from the decoded/resolved/baked models, including binary +cutouts and stepped lantern animation; these are not yet gameplay blocks. The playable Java performance packs remain available during development. ## Completion criteria and playable builds diff --git a/tools/test_native_client.py b/tools/test_native_client.py index c59b8e63c..0244a9b63 100644 --- a/tools/test_native_client.py +++ b/tools/test_native_client.py @@ -5,6 +5,7 @@ Requires prepared private resources and a desktop display (or --vscreen on headless Linux). This is a renderer startup check, not a gameplay parity gate. """ import argparse +import hashlib import json import os from pathlib import Path @@ -17,6 +18,17 @@ except ImportError: import lab +def resource_fingerprint(root): + files = [root / 'facts.json', root / 'block-tags.json', root / 'horizon-resources.json', + *sorted(path for path in (root / 'assets').rglob('*') if path.is_file())] + digest = hashlib.sha256() + for path in files: + data = path.read_bytes() + digest.update(path.relative_to(root).as_posix().encode() + b'\0') + digest.update(len(data).to_bytes(8, 'big')); digest.update(data) + return {'files': len(files), 'sha256': digest.hexdigest()} + + def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('--vscreen', action='store_true') @@ -29,6 +41,16 @@ def main(): root.mkdir(parents=True, exist_ok=True) report = root / 'startup-smoke.json' report.unlink(missing_ok=True) + resources = resource_fingerprint(root / '26.3') + sources = [lab.ROOT / 'Cargo.toml', lab.ROOT / 'Cargo.lock', Path(__file__).resolve(), + lab.ROOT / 'crates/horizon-client/Cargo.toml', lab.ROOT / 'crates/horizon-assets/Cargo.toml', + *sorted((lab.ROOT / 'crates/horizon-client/src').glob('*')), + *sorted((lab.ROOT / 'crates/horizon-assets/src').glob('*.rs'))] + tested_sources = { + str(path.relative_to(lab.ROOT)): lab.digest(path, 'sha256') + for path in sources + if path.is_file() + } environment = dict(os.environ, RUSTUP_TOOLCHAIN='stable') subprocess.run(['cargo', 'build', '--locked', '-p', 'horizon-client'], cwd=lab.ROOT, env=environment, check=True, timeout=3600) @@ -46,16 +68,20 @@ def main(): result = json.loads(report.read_text()) if (result.get('error') is not None or result.get('presented_frames') != 30 or result.get('resident_chunks') != 9 or result.get('merged_quads', 0) <= 0 + or result.get('model_quads') != 145 or len(result.get('model_gallery', [])) != 12 + or result.get('sprite_layers') != 18 or result.get('animated_sprites') != 1 or not result.get('adapter') or min(result.get('window_size', [0])) <= 0): raise RuntimeError('Incomplete native client presentation: ' + str(report)) + if resource_fingerprint(root / '26.3') != resources: + raise RuntimeError('Resources changed during native client verification') + result['resource_files'] = resources result['executable_sha256'] = lab.digest(executable, 'sha256') result['resource_manifest_sha256'] = lab.digest( root / '26.3/horizon-resources.json', 'sha256') - result['sources'] = { - str(path.relative_to(lab.ROOT)): lab.digest(path, 'sha256') - for path in sorted((lab.ROOT / 'crates/horizon-client/src').glob('*')) - if path.is_file() - } + actual_sources = {str(path.relative_to(lab.ROOT)): lab.digest(path, 'sha256') for path in sources if path.is_file()} + if actual_sources != tested_sources: + raise RuntimeError('Sources changed during native client verification') + result['sources'] = tested_sources lab.write_json(report, result) print(f'Native renderer startup passed: {report}') From 81ea783e35700cb17efa95ad537773c1f6dbcb16 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 21:05:55 +0200 Subject: [PATCH 048/253] Match vanilla sprite animation metadata and tick selection --- .../scoped-parity.json | 48 +++++ .../startup-smoke.json | 76 +++++++ .../examples/sprite_animation_fixture.rs | 68 ++++++ crates/horizon-assets/src/animation.rs | 203 ++++++++++++++++++ crates/horizon-assets/src/lib.rs | 1 + crates/horizon-client/Cargo.toml | 2 +- crates/horizon-client/src/sprites.rs | 110 +++------- docs/native-client.md | 29 ++- docs/rust-parity.md | 3 + .../parity/VanillaSpriteAnimationOracle.java | 80 +++++++ tools/test_sprite_animation_parity.py | 93 ++++++++ 11 files changed, 628 insertions(+), 85 deletions(-) create mode 100644 benchmarks/rust-sprite-animation-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-sprite-animation-2026-10-06/startup-smoke.json create mode 100644 crates/horizon-assets/examples/sprite_animation_fixture.rs create mode 100644 crates/horizon-assets/src/animation.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSpriteAnimationOracle.java create mode 100644 tools/test_sprite_animation_parity.py diff --git a/benchmarks/rust-sprite-animation-2026-10-06/scoped-parity.json b/benchmarks/rust-sprite-animation-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..ee6ec6ac4 --- /dev/null +++ b/benchmarks/rust-sprite-animation-2026-10-06/scoped-parity.json @@ -0,0 +1,48 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "resource_animations": 63, + "native_tick_states": 258996, + "fixtures": 907, + "rejected": 203, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSpriteAnimationOracle.java": "90b291abb0b76620f9ca719162393d4fe305ecfb9388d4675d3df89ac1ba136b", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCuboidModelOracle.java": "7526f20513c549483122ab0d5ad24b9e87f38dc2f6aae55addd701a91ac85e43", + "tools/test_sprite_animation_parity.py": "ea5961ff5e7770eeec6e91a916fedd3ec72dbf05e87cbeb8a8d2429440407d48", + "tools/test_model_baking_parity.py": "392ffec44918fb91740ca4a1316d684480d39f14bd34d46175f7f44946d15bd7", + "tools/test_cuboid_model_parity.py": "3b7c018570b0f609aae43cef60ff3139c543d5d629be804a5aa257e3ab2dd67c", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "fed441cad861a44e9919087307cdb9b3d8165fe36ae05ab03f72dde23758cbd5", + "crates/horizon-assets/Cargo.toml": "fadb78cf819e026500606c45d27138ed67fcbbc967ae8cee6c1e7c82c9046b36", + "crates/horizon-assets/examples/cuboid_model_fixture.rs": "97609d90e3f6ce340f3590296db2dc778113bb2b33c7d1b54080a1d6f3023f40", + "crates/horizon-assets/examples/model_baking_fixture.rs": "59caca09dd5afd0b70a2e8fdb8e949deb9322f00adc617918b33d1e7e5b0b522", + "crates/horizon-assets/examples/model_resolution_fixture.rs": "c071067140299e49345a6ebd94e15b3b6d853cb9ae11d8de46e3cbdfb8b01f0e", + "crates/horizon-assets/examples/sprite_animation_fixture.rs": "254314d52deda129ab461221d3d8b95323a60730d374e566c1cd599fba85f072", + "crates/horizon-assets/examples/support/mod.rs": "bcf5a6d8a54845982191e037911c24139237771d6afa4b01b1e83c011489c3f5", + "crates/horizon-assets/src/animation.rs": "ccd51499549d0aa040076406092e35420db56c52f8797a099a0c2468dd8665b1", + "crates/horizon-assets/src/bake.rs": "0bc519e93ad8200d89543ceb5c811dd82bbeb0e9003b143385c8a03e758dfe65", + "crates/horizon-assets/src/json.rs": "e7b89bf4852f561a0e5bf1a984857c61e755961dfd86fcc326b6d55558615f39", + "crates/horizon-assets/src/lib.rs": "92482e4ff4ca46ff5c11a9618ed5007e205762be6390d91648f95068510f0390", + "crates/horizon-assets/src/model.rs": "57ddb3d65e88e7a8aa22c62bc298a2dae7f4e994326a873a31f06c0f36ed051b", + "crates/horizon-assets/src/resolve.rs": "3927ac926cdcbd7d334901cc32d0ecc1e498b1bec98f76a46bca6d4964c13541" + }, + "fixtures_sha256": { + ".local/rust-sprite-animation-parity/inputs.jsonl": "72ccfab50067a4e578c5ce498e395abfdc55df65c487cea758c1e723cabf4da7" + }, + "rust_output_sha256": "842c6693d75234d93b5623be5f55c2fbe739e94b3ec32241b96c81cd6d81317e", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "842c6693d75234d93b5623be5f55c2fbe739e94b3ec32241b96c81cd6d81317e", + "matched_output_lines": 907 + } + ], + "scope": "Actual AnimationMetadataSection JsonOps codec, frame-size calculation, SpriteContents sequence construction and AnimationState ticks. All bundled animated texture metadata plus synthetic numeric, null, invalid, repeated and out-of-image frame cases. Valid image grids only for SpriteContents construction. No resource-loader fallback, image decoding, GPU interpolation pixels, atlas packing or gameplay parity claim." +} diff --git a/benchmarks/rust-sprite-animation-2026-10-06/startup-smoke.json b/benchmarks/rust-sprite-animation-2026-10-06/startup-smoke.json new file mode 100644 index 000000000..064b842ef --- /dev/null +++ b/benchmarks/rust-sprite-animation-2026-10-06/startup-smoke.json @@ -0,0 +1,76 @@ +{ + "adapter": { + "backend": "Vulkan", + "device": 0, + "device_type": "Cpu", + "name": "llvmpipe (LLVM 21.1.8, 256 bits)", + "vendor": 65541 + }, + "animated_sprites": 1, + "animation_uploads": 1, + "arch": "x86_64", + "camera_pitch": -0.3839724354387525, + "camera_position": [ + 25.0, + 18.0, + 25.0 + ], + "camera_yaw": -2.356194490192345, + "elapsed_seconds": 0.885915504, + "error": null, + "merged_quads": 166, + "model_gallery": [ + "oak_stairs", + "stone_slab", + "anvil", + "torch", + "lantern", + "oak_fence_post", + "oak_fence_gate", + "iron_bars_post", + "cobweb", + "grindstone", + "ladder", + "amethyst_cluster" + ], + "model_quads": 145, + "os": "linux", + "presented_frames": 30, + "project": "Horizon", + "resident_chunks": 9, + "schema": 1, + "scope": "Native cube and cuboid-model renderer with binary cutouts, stepped sprite animation and free camera; no gameplay simulation", + "sprite_layers": 18, + "window_size": [ + 1280, + 720 + ], + "resource_files": { + "files": 5579, + "sha256": "0bc95c8e4b10ef7401f4b948e9a151ea2f9d9112e8dadb9f6807a51e143fcf6f" + }, + "executable_sha256": "e71e99a994250a22e530fe713c3323c7336f80eed04b1104828e5203857b4a82", + "resource_manifest_sha256": "eda44ebee6904eab880c15458dbd1212dc2799d320a4419fc810e2ceb0e5d9d6", + "sources": { + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "fed441cad861a44e9919087307cdb9b3d8165fe36ae05ab03f72dde23758cbd5", + "tools/test_native_client.py": "e47a866cffd20fcd6fdab62fca573227ca9837488e72384f08f8c33fd4b6228c", + "crates/horizon-client/Cargo.toml": "d56524457d761c2613c0699b20e21ad6977d93e009d59ef150bbd9fc20d7a025", + "crates/horizon-assets/Cargo.toml": "fadb78cf819e026500606c45d27138ed67fcbbc967ae8cee6c1e7c82c9046b36", + "crates/horizon-client/src/assets.rs": "c953a42820cb8d19d8964d4807df401614d4d6621bb47d8ba591c8db38f3e214", + "crates/horizon-client/src/camera.rs": "f9821c8a51a004dd4ad9c0952e746eb07926f6040cf8660bc26da5a0728ae572", + "crates/horizon-client/src/main.rs": "7fb00e89b963a77f124c8e7ad59c5506a4a2f3e6c69720944dec00677ed15239", + "crates/horizon-client/src/mesh.rs": "e2fa00435ec8239ba8a3c6539022bb50a10ff9c3850c6faab72f86aabea896ef", + "crates/horizon-client/src/models.rs": "70b0273100e83afbfc5c013c79afae1e6b13565845e067ad3303244c3f0bbe68", + "crates/horizon-client/src/render.rs": "0f8929d9061b20adbc5ddd0adcbe9f90ce76227b7bb9bafe3f4474961ee2984c", + "crates/horizon-client/src/sprites.rs": "4dd10998581f901bd1c72ed49c27671f362f18285e86e795ddadd11cbc255f69", + "crates/horizon-client/src/world.rs": "901aa59c23ea084e926eec014589f4d511c41691a8dc1520534e039c28cfc76c", + "crates/horizon-client/src/world.wgsl": "82873c131f46a31aef35106f89a53589f179048362d0f8877eca6d20aa6274a4", + "crates/horizon-assets/src/animation.rs": "ccd51499549d0aa040076406092e35420db56c52f8797a099a0c2468dd8665b1", + "crates/horizon-assets/src/bake.rs": "0bc519e93ad8200d89543ceb5c811dd82bbeb0e9003b143385c8a03e758dfe65", + "crates/horizon-assets/src/json.rs": "e7b89bf4852f561a0e5bf1a984857c61e755961dfd86fcc326b6d55558615f39", + "crates/horizon-assets/src/lib.rs": "92482e4ff4ca46ff5c11a9618ed5007e205762be6390d91648f95068510f0390", + "crates/horizon-assets/src/model.rs": "57ddb3d65e88e7a8aa22c62bc298a2dae7f4e994326a873a31f06c0f36ed051b", + "crates/horizon-assets/src/resolve.rs": "3927ac926cdcbd7d334901cc32d0ecc1e498b1bec98f76a46bca6d4964c13541" + } +} diff --git a/crates/horizon-assets/examples/sprite_animation_fixture.rs b/crates/horizon-assets/examples/sprite_animation_fixture.rs new file mode 100644 index 000000000..1b9d016a7 --- /dev/null +++ b/crates/horizon-assets/examples/sprite_animation_fixture.rs @@ -0,0 +1,68 @@ +use horizon_assets::animation::{AnimationMetadata, AnimationSample}; +use serde_json::{Value, json}; +use std::{ + fs::File, + io::{BufRead, BufReader, BufWriter, Write}, +}; +fn probe(row: &Value) -> Result> { + let m = AnimationMetadata::from_json(row["json"].as_str().unwrap())?; + let width = row["width"].as_i64().unwrap() as i32; + let height = row["height"].as_i64().unwrap() as i32; + let size = m.frame_size(width, height); + let frames = m.frames.as_ref().map(|frames| { + frames + .iter() + .map(|f| json!({"index":f.index,"time":f.time})) + .collect::>() + }); + let mut result = json!({"metadata":{"frames":frames,"width":m.width,"height":m.height,"frametime":m.frame_time,"interpolate":m.interpolate},"size":size}); + if size[0] > width || size[1] > height || width % size[0] != 0 || height % size[1] != 0 { + return Ok(result); + } + result["animation"] = match m.clip(((width / size[0]) * (height / size[1])) as u32)? { + None => Value::Null, + Some(clip) => { + let samples: Vec<_> = (0..=row["ticks"].as_u64().unwrap()) + .map(|tick| sample(clip.sample(tick))) + .collect(); + let mut edges = Vec::new(); + let mut start = 0u64; + for &(_, duration) in clip.sequence() { + let duration = i64::from(duration); + for sub in [0, 1, duration / 2, duration - 2, duration - 1] { + if sub >= 0 && sub < duration { + edges.push(sample(clip.sample(start + sub as u64 + 1))); + } + } + start += duration as u64; + } + json!({"sequence":clip.sequence(),"columns":width/size[0],"samples":samples,"edges":edges}) + } + }; + Ok(result) +} +fn sample(v: AnimationSample) -> Value { + json!([ + v.sequence_index, + v.sub_frame, + v.frame, + v.next_frame, + v.dirty, + v.needs_draw, + v.interpolation_millis + ]) +} +fn main() -> Result<(), Box> { + let args: Vec<_> = std::env::args().collect(); + let input = BufReader::new(File::open(&args[1])?); + let mut output = BufWriter::new(File::create(&args[2])?); + for line in input.lines() { + let row: Value = serde_json::from_str(&line?)?; + let result = match probe(&row) { + Ok(value) => json!({"name":row["name"],"value":value}), + Err(_) => json!({"name":row["name"],"error":true}), + }; + writeln!(output, "{result}")?; + } + Ok(()) +} diff --git a/crates/horizon-assets/src/animation.rs b/crates/horizon-assets/src/animation.rs new file mode 100644 index 000000000..00d905b74 --- /dev/null +++ b/crates/horizon-assets/src/animation.rs @@ -0,0 +1,203 @@ +//! Java Edition 26.3 animation metadata and sprite tick selection. +use crate::json::*; +use serde_json::value::RawValue; + +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct AnimationFrame { + pub index: i32, + pub time: Option, +} + +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct AnimationMetadata { + pub frames: Option>, + pub width: Option, + pub height: Option, + pub frame_time: i32, + pub interpolate: bool, +} + +fn optional<'a>(object: &Object<'a>, name: &str) -> Option<&'a RawValue> { + object.get(name).copied().filter(|v| v.get() != "null") +} +fn bounded_integer(value: &RawValue, minimum: i32) -> Result { + // JsonReader stops recognizing a number at its buffer limit. Its integer + // scanner also keeps wrapping a negative i64 accumulator after overflow: + // if that accumulator becomes zero, a following digit triggers the same + // rejection as a leading zero. JsonParser then exposes a string, which the + // uncompressed integer codec rejects. + let token = value.get(); + if token.len() >= 1024 { + return Err(error("animation number exceeds native reader buffer")); + } + let mut accumulator = 0i64; + for (index, digit) in token + .trim_start_matches('-') + .bytes() + .take_while(u8::is_ascii_digit) + .enumerate() + { + if index > 0 && accumulator == 0 { + return Err(error( + "native reader classifies animation number as a string", + )); + } + accumulator = accumulator + .wrapping_mul(10) + .wrapping_sub(i64::from(digit - b'0')); + } + let value = integer(value)?; + if value < minimum { + return Err(error("animation integer outside codec range")); + } + Ok(value) +} +impl AnimationMetadata { + /// Decode the animation section itself, using the uncompressed JsonOps codec + /// rules. Numeric primitives truncate and wrap as Java Number.intValue does; + /// strings and booleans are not numbers. Null optional fields are absent. + pub fn from_json(text: &str) -> Result { + let raw: &RawValue = serde_json::from_str(text)?; + let fields = object(raw)?; + let positive = |name| { + optional(&fields, name) + .map(|v| bounded_integer(v, 1)) + .transpose() + }; + let frames = optional(&fields, "frames") + .map(|v| { + array(v)? + .into_iter() + .map(|v| { + if v.get().starts_with('{') { + let fields = object(v)?; + Ok(AnimationFrame { + index: bounded_integer(required(&fields, "index")?, 0)?, + time: optional(&fields, "time") + .map(|v| bounded_integer(v, 1)) + .transpose()?, + }) + } else { + Ok(AnimationFrame { + index: bounded_integer(v, 0)?, + time: None, + }) + } + }) + .collect::>>() + }) + .transpose()?; + Ok(Self { + frames, + width: positive("width")?, + height: positive("height")?, + frame_time: positive("frametime")?.unwrap_or(1), + interpolate: optional(&fields, "interpolate") + .map(|v| serde_json::from_str(v.get())) + .transpose()? + .unwrap_or(false), + }) + } + + pub fn frame_size(&self, image_width: i32, image_height: i32) -> [i32; 2] { + match (self.width, self.height) { + (Some(w), Some(h)) => [w, h], + (Some(w), None) => [w, image_height], + (None, Some(h)) => [image_width, h], + (None, None) => [image_width.min(image_height); 2], + } + } + + /// Build the animation after image/frame dimensions have been validated by + /// the resource loader. Out-of-image indices are removed, preserving order + /// and repeats. Zero or one remaining entries mean static physical frame 0. + pub fn clip(&self, physical_frames: u32) -> Result> { + if self.frame_time <= 0 { + return Err(error("nonpositive default animation duration")); + } + let sequence: Vec<_> = match &self.frames { + Some(frames) => frames + .iter() + .filter_map(|v| { + let time = v.time.unwrap_or(self.frame_time); + (v.index >= 0 && (v.index as u32) < physical_frames && time > 0) + .then_some((v.index as u32, time as u32)) + }) + .collect(), + None => (0..physical_frames) + .map(|i| (i, self.frame_time as u32)) + .collect(), + }; + if sequence.len() <= 1 { + return Ok(None); + } + let mut duration = 0u64; + let ends = sequence + .iter() + .map(|&(_, time)| { + duration = duration + .checked_add(u64::from(time)) + .ok_or_else(|| error("animation duration overflow"))?; + Ok(duration) + }) + .collect::>>()?; + Ok(Some(AnimationClip { + sequence, + ends, + duration, + interpolate: self.interpolate, + })) + } +} + +#[derive(Clone, Debug)] +pub struct AnimationClip { + sequence: Vec<(u32, u32)>, + ends: Vec, + duration: u64, + interpolate: bool, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct AnimationSample { + pub sequence_index: usize, + pub sub_frame: u32, + pub frame: u32, + pub next_frame: u32, + pub dirty: bool, + pub needs_draw: bool, + /// Native drawToAtlas encodes floor((subFrame / time) * 1000) in its + /// first-vertex argument. This is not a claim about GPU interpolation pixels. + pub interpolation_millis: u32, +} +impl AnimationClip { + pub fn sequence(&self) -> &[(u32, u32)] { + &self.sequence + } + pub fn duration(&self) -> u64 { + self.duration + } + pub fn interpolates(&self) -> bool { + self.interpolate + } + + /// Random access to the state after `tick` native ticks. Binary search avoids + /// advancing every missed tick when a render frame takes longer than 50 ms. + pub fn sample(&self, tick: u64) -> AnimationSample { + let time = tick % self.duration; + let index = self.ends.partition_point(|end| *end <= time); + let start = if index == 0 { 0 } else { self.ends[index - 1] }; + let sub_frame = (time - start) as u32; + let (frame, duration) = self.sequence[index]; + let previous = (index + self.sequence.len() - 1) % self.sequence.len(); + let dirty = tick == 0 || (sub_frame == 0 && frame != self.sequence[previous].0); + AnimationSample { + sequence_index: index, + sub_frame, + frame, + next_frame: self.sequence[(index + 1) % self.sequence.len()].0, + dirty, + needs_draw: self.interpolate || dirty, + interpolation_millis: ((sub_frame as f32 / duration as f32) * 1000.0) as u32, + } + } +} diff --git a/crates/horizon-assets/src/lib.rs b/crates/horizon-assets/src/lib.rs index 31ab2d6b9..f487ac555 100644 --- a/crates/horizon-assets/src/lib.rs +++ b/crates/horizon-assets/src/lib.rs @@ -1,6 +1,7 @@ //! Resource decoding for the pinned Java Edition client. #![forbid(unsafe_code)] +pub mod animation; pub mod bake; mod json; pub mod model; diff --git a/crates/horizon-client/Cargo.toml b/crates/horizon-client/Cargo.toml index 8fb88ff23..4bf34c0f5 100644 --- a/crates/horizon-client/Cargo.toml +++ b/crates/horizon-client/Cargo.toml @@ -16,4 +16,4 @@ pollster = "0.4" bytemuck = { version = "1.24", features = ["derive"] } glam = "0.30" png = "0.18" -serde_json = "1.0.151" +serde_json = { version = "1.0.151", features = ["raw_value"] } diff --git a/crates/horizon-client/src/sprites.rs b/crates/horizon-client/src/sprites.rs index e5681a030..b8e9c4eb0 100644 --- a/crates/horizon-client/src/sprites.rs +++ b/crates/horizon-client/src/sprites.rs @@ -1,5 +1,6 @@ //! Shared nearest-sampled sprite array for the controlled scene. use crate::Result; +use horizon_assets::animation::{AnimationClip, AnimationMetadata}; use std::{ collections::BTreeMap, fs::{self, File}, @@ -12,19 +13,11 @@ use std::{ pub struct SpriteAnimation { pub layer: u32, frames: Arc>>, - sequence: Arc>, - duration: u64, + clip: Arc, } impl SpriteAnimation { pub fn frame(&self, tick: u64) -> usize { - let mut time = tick % self.duration; - for &(index, duration) in self.sequence.iter() { - if time < u64::from(duration) { - return index; - } - time -= u64::from(duration); - } - unreachable!("validated animation duration") + self.clip.sample(tick).frame as usize } pub fn pixels(&self, frame: usize) -> &[u8] { &self.frames[frame] @@ -46,11 +39,17 @@ impl Sprites { let (namespace, path) = name.split_once(':').ok_or("invalid sprite identifier")?; let path = root.join(format!("assets/{namespace}/textures/{path}.png")); let metadata = match fs::read_to_string(path.with_extension("png.mcmeta")) { - Ok(text) => Some(serde_json::from_str::(&text)?), + Ok(text) => Some(serde_json::from_str::< + BTreeMap>, + >(&text)?), Err(error) if error.kind() == std::io::ErrorKind::NotFound => None, Err(error) => return Err(error.into()), }; - let animation = metadata.as_ref().and_then(|v| v.get("animation")); + let animation = metadata + .as_ref() + .and_then(|v| v.get("animation")) + .map(|v| AnimationMetadata::from_json(v.get())) + .transpose()?; let mut decoder = png::Decoder::new(BufReader::new(File::open(path)?)); decoder.set_transformations(png::Transformations::EXPAND | png::Transformations::STRIP_16); let mut reader = decoder.read_info()?; @@ -61,38 +60,15 @@ impl Sprites { .ok_or("sprite exceeds decoder limits")? ]; let info = reader.next_frame(&mut bytes)?; - let positive = |value: &serde_json::Value| -> Result { - let value = value - .as_u64() - .filter(|v| *v > 0 && *v <= i32::MAX as u64) - .ok_or("invalid positive animation integer")?; - Ok(value as u32) - }; - let (width, height) = if let Some(animation) = animation { - if !animation.is_object() { - return Err("invalid animation metadata".into()); - } - if animation - .get("interpolate") - .and_then(serde_json::Value::as_bool) - .unwrap_or(false) - { + let (width, height) = if let Some(animation) = &animation { + if animation.interpolate { return Err( "interpolated animation is not yet supported by the inspection renderer".into(), ); } - match ( - animation.get("width").map(positive).transpose()?, - animation.get("height").map(positive).transpose()?, - ) { - (Some(w), Some(h)) => (w, h), - (Some(w), None) => (w, info.height), - (None, Some(h)) => (info.width, h), - (None, None) => { - let size = info.width.min(info.height); - (size, size) - } - } + let [width, height] = + animation.frame_size(i32::try_from(info.width)?, i32::try_from(info.height)?); + (u32::try_from(width)?, u32::try_from(height)?) } else { (info.width, info.height) }; @@ -141,45 +117,18 @@ impl Sprites { } let frames = Arc::new(frames); let mut initial = 0; - if let Some(metadata) = animation { - let default_time = metadata - .get("frametime") - .map(positive) - .transpose()? - .unwrap_or(1); - let sequence = if let Some(values) = metadata.get("frames") { - let mut sequence = Vec::new(); - for value in values.as_array().ok_or("invalid animation frame list")? { - let (index, time) = if value.is_object() { - ( - value.get("index").and_then(serde_json::Value::as_u64), - value - .get("time") - .map(positive) - .transpose()? - .unwrap_or(default_time), - ) - } else { - (value.as_u64(), default_time) - }; - if let Some(index) = index.filter(|i| *i < u64::from(count)) { - sequence.push((index as usize, time)); - } - } - sequence - } else { - (0..count).map(|i| (i as usize, default_time)).collect() - }; - if sequence.len() > 1 { - initial = sequence[0].0; - let duration = sequence.iter().map(|(_, time)| u64::from(*time)).sum(); - self.animations.push(SpriteAnimation { - layer, - frames: frames.clone(), - sequence: Arc::new(sequence), - duration, - }); - } + if let Some(clip) = animation + .as_ref() + .map(|m| m.clip(count)) + .transpose()? + .flatten() + { + initial = clip.sample(0).frame as usize; + self.animations.push(SpriteAnimation { + layer, + frames: frames.clone(), + clip: Arc::new(clip), + }); } self.layers.insert(name.to_owned(), layer); self.size = width; @@ -196,8 +145,7 @@ mod tests { let animation = SpriteAnimation { layer: 0, frames: Arc::new(vec![vec![], vec![], vec![]]), - sequence: Arc::new(vec![(2, 8), (1, 3), (1, 2), (0, 1)]), - duration: 14, + clip: Arc::new(AnimationMetadata::from_json(r#"{"frames":[{"index":2,"time":8},{"index":1,"time":3},{"index":1,"time":2},0]}"#).unwrap().clip(3).unwrap().unwrap()), }; for (tick, frame) in [ (0, 2), diff --git a/docs/native-client.md b/docs/native-client.md index 37970b2d7..cb9eb6667 100644 --- a/docs/native-client.md +++ b/docs/native-client.md @@ -21,9 +21,10 @@ an anvil, a torch, a lantern, fence parts, iron bars, a cobweb, a grindstone, a ladder and an amethyst cluster. These are explicit model selections for geometry inspection, not simulated block placements. Binary-alpha cutouts are rendered; the lantern's three frames advance every eight inspection ticks at 20 ticks/s. -General animation metadata compatibility, interpolation and synchronization with -the eventual game loop still need validation. Sprites currently require matching -square frame dimensions. +The animation metadata codec and frame selection now use the shared +`horizon-assets` implementation checked against the pinned client. GPU +interpolation and synchronization with the eventual game loop remain unfinished. +Sprites currently require matching square frame dimensions. ## Run from a checkout @@ -121,6 +122,28 @@ transparency classification, actual tint/light evaluation and GPU rendering remain separate from the geometry result. Other operating systems still need their native validation runs. +The sprite animation module reproduces the pinned metadata codec's integer +conversion, strict primitive types, optional null fields and frame dimensions. +It preserves repeated frames, filters out-of-image frame indices, and treats +sequences with fewer than two valid entries as static physical frame zero. +Frame lookup uses cumulative durations and binary search, so skipped rendering +frames do not require replaying all elapsed animation ticks. The native oracle +also checks dirty flags, draw requirements and interpolation timing, including +transitions near the maximum Java integer duration. Interpolation pixel output +and resource-loader failure recovery are outside this comparison. + +```sh +python3 tools/test_sprite_animation_parity.py +``` + +The [animation comparison](../benchmarks/rust-sprite-animation-2026-10-06/scoped-parity.json) +records 907 fixtures and 258,996 native tick states from the actual client codec +and `SpriteContents.AnimationState.tick`, including all 63 bundled animated +texture metadata sections and synthetic boundary cases. The associated +[startup report](../benchmarks/rust-sprite-animation-2026-10-06/startup-smoke.json) +checks the renderer using this shared implementation. Images, input +fixtures and native traces stay private under `.local/`. + ```sh cargo +stable test -p horizon-client cargo +stable clippy --workspace --all-targets -- -D warnings diff --git a/docs/rust-parity.md b/docs/rust-parity.md index 496a74f12..950e8f0f1 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -22,6 +22,9 @@ also include parent/texture resolution over 5,648 roots and cuboid baking over models and UV locking remain unfinished. The native renderer now draws an inspection gallery from the decoded/resolved/baked models, including binary cutouts and stepped lantern animation; these are not yet gameplay blocks. +Animation metadata, frame sequences and tick-state selection now have native +differential coverage, including all bundled animated texture metadata. GPU +interpolation and game-loop synchronization remain unfinished. The playable Java performance packs remain available during development. ## Completion criteria and playable builds diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSpriteAnimationOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSpriteAnimationOracle.java new file mode 100644 index 000000000..0ee728951 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSpriteAnimationOracle.java @@ -0,0 +1,80 @@ +package dev.horizonlab.parity; + +import com.google.gson.*; +import com.mojang.blaze3d.platform.NativeImage; +import com.mojang.serialization.JsonOps; +import com.mojang.renderpearl.api.buffers.GpuBufferSlice; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; +import java.io.*; +import java.lang.reflect.*; +import java.nio.file.*; +import java.util.*; +import net.minecraft.client.renderer.texture.SpriteContents; +import net.minecraft.client.resources.metadata.animation.*; +import net.minecraft.resources.Identifier; +import static dev.horizonlab.parity.VanillaCuboidModelOracle.map; + +/** Invokes the pinned metadata codec and real animation tick state, without GPU draws. */ +public final class VanillaSpriteAnimationOracle { + private static final Gson JSON = new GsonBuilder().serializeNulls().create(); + private static Object field(Object target, String name) throws Exception { + var field=target.getClass().getDeclaredField(name); field.setAccessible(true); return field.get(target); + } + private static Object probe(JsonObject row) throws Exception { + AnimationMetadataSection metadata; + try { metadata=AnimationMetadataSection.CODEC.parse(JsonOps.INSTANCE,JsonParser.parseString(row.get("json").getAsString())).getOrThrow(); } + catch(RuntimeException error) { return null; } + int width=row.get("width").getAsInt(),height=row.get("height").getAsInt(); + var size=metadata.calculateFrameSize(width,height); + Object frames=metadata.frames().map(list->list.stream().map(f->map("index",f.index(),"time",f.time().orElse(null))).toList()).orElse(null); + var result=map("metadata",map("frames",frames,"width",metadata.frameWidth().orElse(null),"height",metadata.frameHeight().orElse(null),"frametime",metadata.defaultFrameTime(),"interpolate",metadata.interpolatedFrames()),"size",new int[]{size.width(),size.height()}); + // This guard scopes allocation to valid sprite grids. Frame-size calculation + // above remains tested for impossible dimensions; loader errors are separate. + if(size.width()>width || size.height()>height || width%size.width()!=0 || height%size.height()!=0) return result; + try(var contents=new SpriteContents(Identifier.parse("horizon:probe"),size,new NativeImage(width,height,true),Optional.of(metadata),List.of(),Optional.empty())) { + var animation=field(contents,"animatedTexture"); + if(animation==null) { result.put("animation",null); return result; } + var nativeFrames=(List)field(animation,"frames"); var sequence=new ArrayList(); + for(var frame:nativeFrames) sequence.add(new int[]{(int)field(frame,"index"),(int)field(frame,"time")}); + var type=Class.forName("net.minecraft.client.renderer.texture.SpriteContents$AnimationState"); + var constructor=type.getDeclaredConstructors()[0];constructor.setAccessible(true); + var state=(SpriteContents.AnimationState)constructor.newInstance(contents,animation,new Int2ObjectOpenHashMap<>(),new GpuBufferSlice[0]); + var samples=new ArrayList(); + int ticks=row.get("ticks").getAsInt(); + for(int tick=0;tick<=ticks;tick++) { + samples.add(sample(state,sequence)); + state.tick(); + } + // Probe native tick transitions near very long frame durations too. + var edges=new ArrayList(); + var frameField=type.getDeclaredField("frame");frameField.setAccessible(true); + var subField=type.getDeclaredField("subFrame");subField.setAccessible(true); + for(int index=0;index=duration)continue; + frameField.setInt(state,index);subField.setInt(state,sub);state.tick(); + edges.add(sample(state,sequence)); + } + } + result.put("animation",map("sequence",sequence,"columns",field(animation,"frameRowSize"),"samples",samples,"edges",edges)); + } + return result; + } + private static Object sample(SpriteContents.AnimationState state,List sequence) throws Exception { + int index=(int)field(state,"frame"),sub=(int)field(state,"subFrame");var current=sequence.get(index); + int blend=(int)((float)sub/(float)current[1]*1000.0f); + return Arrays.asList(index,sub,current[0],sequence.get((index+1)%sequence.size())[0],field(state,"isDirty"),state.needsToDraw(),blend); + } + public static void main(String[] args) throws Exception { + net.minecraft.SharedConstants.tryDetectVersion(); + try(var input=Files.newBufferedReader(Path.of(args[0]));var output=Files.newBufferedWriter(Path.of(args[1]))) { + for(String line;(line=input.readLine())!=null;) { + var row=JsonParser.parseString(line).getAsJsonObject();Object value; + var probe=probe(row); + value=probe==null ? map("name",row.get("name").getAsString(),"error",true) : map("name",row.get("name").getAsString(),"value",probe); + output.write(JSON.toJson(value));output.newLine(); + } + } + } +} diff --git a/tools/test_sprite_animation_parity.py b/tools/test_sprite_animation_parity.py new file mode 100644 index 000000000..06ca25c96 --- /dev/null +++ b/tools/test_sprite_animation_parity.py @@ -0,0 +1,93 @@ +#!/usr/bin/env python3 +"""Compare animation metadata, frame selection and tick state with the pinned client.""" +import json +import os +from pathlib import Path +import platform +import random +import struct +import subprocess +import zipfile +try: + from . import lab, test_rust_parity as base, test_model_baking_parity as baking, test_cuboid_model_parity as decoding +except ImportError: + import lab, test_rust_parity as base, test_model_baking_parity as baking, test_cuboid_model_parity as decoding + + +def corpus(): + def row(name, metadata, width=16, height=64, ticks=128): + return dict(name=name,json=json.dumps(metadata),width=width,height=height,ticks=ticks) + yield row('default', {}) + for key in ['width','height','frametime','interpolate','frames']: + for i,value in enumerate([None,True,False,0,1,-1,1.9,-0.9,4294967297,2147483648,1e100,'1','true',{},[],[0,1], [None], [{'index':1,'time':2}]]): + yield row(f'field-{key}-{i}',{key:value}) + for key in ['index','time']: + for i,value in enumerate([None,True,False,0,1,-1,1.9,-0.9,4294967297,2147483648,1e100,'1',{},[],[1]]): + yield row(f'frame-{key}-{i}',{'frames':[0,dict(index=1,**{key:value})]}) if key=='time' else row(f'frame-{key}-{i}',{'frames':[0,{'index':value}]}) + for i,frames in enumerate([[],[3],[99],[1,99],[2,2],[0,1,0],[3,2,1,0],[3,99,1,2],[{},0],[{'index':2,'time':None},0],[0,{'index':1,'time':2147483647}]]): + for interpolate in [False,True]: yield row(f'sequence-{i}-{interpolate}',{'frames':frames,'interpolate':interpolate}) + for width,height in [(16,16),(16,48),(48,16),(32,48),(15,32),(1,4),(64,64)]: + for w,h in [(None,None),(8,None),(None,8),(8,8),(16,32),(32,16),(1,1),(65,65)]: + yield row(f'dim-{width}-{height}-{w}-{h}',{'width':w,'height':h},width,height,16) + rng=random.Random(0x535052495445) + for i in range(512): + frames=[{'index':rng.randrange(7),'time':rng.choice([1,2,3,7,19,31,2147483647])} for _ in range(rng.randrange(12))] + yield row(f'random-{i}',{'frames':frames,'frametime':rng.randrange(1,20),'interpolate':bool(rng.randrange(2))},ticks=512) + for i,raw in enumerate(['null','[]','true','1','"x"','{"width":1e9999}','{"frametime":1e-9999}','{"width":4294967312.9}','{"frames":[0.9,1.9,2.9]}']): + item=row(f'raw-{i}',{}); item['json']=raw;yield item + + numbers=['-0.0','4294967296','4294967297','4294967295','9223372036854775809', + '-9223372036854775809','1e9999','1e10000','1e-9999','1e-10000', + '1e2147483647','1e2147483648','1.0e10000','1.0e10001', + '1'*1023,'1'*1024,'1'*10000,'1'*10001, + *('1'+'0'*(n-2)+'1' for n in [20,64,65,66,100,1023,1024,10000,10001]), + '1844674407370955161601','-1844674407370955161601', + '18446744073709551616.1','18446744073709551616e-18'] + for i,number in enumerate(numbers): + for key in ['width','frametime','interpolate']: + item=row(f'number-{key}-{i}',{});item['json']='{"'+key+'":'+number+'}';yield item + item=row(f'number-index-{i}',{});item['json']='{"frames":[0,'+number+']}';yield item + + +def main(): + lock,jars,_=base.verify_artifacts() + build=lab.LOCAL/'rust-sprite-animation-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSpriteAnimationOracle.java' + helper=oracle.with_name('VanillaCuboidModelOracle.java');crate=lab.ROOT/'crates/horizon-assets' + sources=[oracle,helper,Path(__file__),lab.ROOT/'tools/test_model_baking_parity.py',lab.ROOT/'tools/test_cuboid_model_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',crate/'Cargo.toml',*sorted(crate.rglob('*.rs'))] + tested=base.source_hashes(sources) + rows=[] + with zipfile.ZipFile(jars['client']) as archive: + for name in sorted(archive.namelist()): + if not name.startswith('assets/minecraft/textures/') or not name.endswith('.png.mcmeta'):continue + metadata=json.loads(archive.read(name)) + if 'animation' not in metadata:continue + width,height=struct.unpack('>II',archive.read(name.removesuffix('.mcmeta'))[16:24]) + rows.append(dict(name=name,json=json.dumps(metadata['animation']),width=width,height=height,ticks=512)) + resources=len(rows);rows.extend(corpus()) + inputs=build/'inputs.jsonl';inputs.write_text(''.join(json.dumps(row)+'\n' for row in rows));fixtures=base.source_hashes([inputs]) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w') as log:subprocess.run(list(map(str,command)),cwd=lab.ROOT,check=True,timeout=3600,stdout=log,stderr=subprocess.STDOUT) + dependencies=os.pathsep.join(map(str,[jars['client'],*baking.client_libraries()])) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',dependencies,'-d',classes,oracle,helper],'compile-java') + run(['cargo','build','--locked','-p','horizon-assets','--example','sprite_animation_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--locked','--no-deps','--format-version','1'],cwd=lab.ROOT)) + binary=Path(metadata['target_directory'])/'debug/examples'/('sprite_animation_fixture.exe' if os.name=='nt' else 'sprite_animation_fixture') + run([binary,inputs,build/'rust.jsonl'],'rust') + run(['java','-Xmx512M','-cp',str(classes)+os.pathsep+dependencies,'dev.horizonlab.parity.VanillaSpriteAnimationOracle',inputs,build/'client.jsonl'],'client') + rejected=decoding.canonicalize(build/'client.jsonl');decoding.canonicalize(build/'rust.jsonl') + native=[json.loads(line) for line in (build/'client.jsonl').read_text().splitlines()] + rust=[json.loads(line) for line in (build/'rust.jsonl').read_text().splitlines()] + for left,right in zip(native,rust,strict=True): + if left!=right: raise AssertionError('Sprite animation mismatch: '+left['name']) + matched=base.compare(build/'client.jsonl',build/'rust.jsonl') + assert all('error' not in row for row in native[:resources]), 'Bundled resource was rejected' + states=sum(len(row['value']['animation']['samples'])+len(row['value']['animation']['edges']) for row in native if row.get('value',{}).get('animation')) + base.ensure_sources_unchanged(sources,tested);base.ensure_sources_unchanged([inputs],fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'resource_animations':resources,'native_tick_states':states,'fixtures':len(rows),'rejected':rejected,'sources_sha256':tested,'fixtures_sha256':fixtures,'rust_output_sha256':lab.digest(build/'rust.jsonl','sha256'),'references':[{'side':'client','jar_sha256':lab.digest(jars['client'],'sha256'),'output_sha256':lab.digest(build/'client.jsonl','sha256'),'matched_output_lines':matched}],'scope':'Actual AnimationMetadataSection JsonOps codec, frame-size calculation, SpriteContents sequence construction and AnimationState ticks. All bundled animated texture metadata plus synthetic numeric, null, invalid, repeated and out-of-image frame cases. Valid image grids only for SpriteContents construction. No resource-loader fallback, image decoding, GPU interpolation pixels, atlas packing or gameplay parity claim.'} + lab.write_json(report_path,report);print(f'Native sprite animation: {matched:,} fixtures match ({rejected:,} rejected); {report_path}',flush=True) + + +if __name__=='__main__':main() From b3a508dba80065750647afbfbb717ab3570eb864 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 21:09:56 +0200 Subject: [PATCH 049/253] Match native numeric scanner rejection in model resources --- .../model-baking.json | 47 +++++++++++++++ .../model-decoding.json | 44 ++++++++++++++ .../model-resolution.json | 46 ++++++++++++++ .../sprite-animation.json | 48 +++++++++++++++ crates/horizon-assets/src/animation.rs | 31 +++------- crates/horizon-assets/src/json.rs | 60 ++++++++++++++----- docs/native-client.md | 13 +++- docs/rust-parity.md | 2 +- tools/test_cuboid_model_parity.py | 10 +++- 9 files changed, 258 insertions(+), 43 deletions(-) create mode 100644 benchmarks/rust-resource-number-scanner-2026-10-06/model-baking.json create mode 100644 benchmarks/rust-resource-number-scanner-2026-10-06/model-decoding.json create mode 100644 benchmarks/rust-resource-number-scanner-2026-10-06/model-resolution.json create mode 100644 benchmarks/rust-resource-number-scanner-2026-10-06/sprite-animation.json diff --git a/benchmarks/rust-resource-number-scanner-2026-10-06/model-baking.json b/benchmarks/rust-resource-number-scanner-2026-10-06/model-baking.json new file mode 100644 index 000000000..5e774bb2c --- /dev/null +++ b/benchmarks/rust-resource-number-scanner-2026-10-06/model-baking.json @@ -0,0 +1,47 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "resource_models": 2883, + "graph_fixtures": 440, + "rejected_roots": 1039, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaModelBakingOracle.java": "fca267347a21149791a3260826be98df55705208c30396277ef6c3feba875748", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCuboidModelOracle.java": "7526f20513c549483122ab0d5ad24b9e87f38dc2f6aae55addd701a91ac85e43", + "tools/test_model_baking_parity.py": "392ffec44918fb91740ca4a1316d684480d39f14bd34d46175f7f44946d15bd7", + "tools/test_cuboid_model_parity.py": "4a8b1cdcac335751c23413341ae939eea1c49c38d33d70d0708b8904ab8d0461", + "tools/test_model_resolution_parity.py": "d9595f2f1442f1f590b72d2a46600657e79ae103bec3d4c45db98242b964bde0", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "fed441cad861a44e9919087307cdb9b3d8165fe36ae05ab03f72dde23758cbd5", + "crates/horizon-assets/Cargo.toml": "fadb78cf819e026500606c45d27138ed67fcbbc967ae8cee6c1e7c82c9046b36", + "crates/horizon-assets/examples/cuboid_model_fixture.rs": "97609d90e3f6ce340f3590296db2dc778113bb2b33c7d1b54080a1d6f3023f40", + "crates/horizon-assets/examples/model_baking_fixture.rs": "59caca09dd5afd0b70a2e8fdb8e949deb9322f00adc617918b33d1e7e5b0b522", + "crates/horizon-assets/examples/model_resolution_fixture.rs": "c071067140299e49345a6ebd94e15b3b6d853cb9ae11d8de46e3cbdfb8b01f0e", + "crates/horizon-assets/examples/sprite_animation_fixture.rs": "254314d52deda129ab461221d3d8b95323a60730d374e566c1cd599fba85f072", + "crates/horizon-assets/examples/support/mod.rs": "bcf5a6d8a54845982191e037911c24139237771d6afa4b01b1e83c011489c3f5", + "crates/horizon-assets/src/animation.rs": "ebbf7952146a0e66b41396174492f5702627170b03a57e6cd5a45c97a08c975e", + "crates/horizon-assets/src/bake.rs": "0bc519e93ad8200d89543ceb5c811dd82bbeb0e9003b143385c8a03e758dfe65", + "crates/horizon-assets/src/json.rs": "99fe8af4fbf5d4eed408a92e829ac1a39597a0d92471a6bff73771fad9c830a8", + "crates/horizon-assets/src/lib.rs": "92482e4ff4ca46ff5c11a9618ed5007e205762be6390d91648f95068510f0390", + "crates/horizon-assets/src/model.rs": "57ddb3d65e88e7a8aa22c62bc298a2dae7f4e994326a873a31f06c0f36ed051b", + "crates/horizon-assets/src/resolve.rs": "3927ac926cdcbd7d334901cc32d0ecc1e498b1bec98f76a46bca6d4964c13541" + }, + "fixtures_sha256": { + ".local/rust-model-baking-parity/inputs.jsonl": "aba24d38f4fc1af060502f983923c2f279c016d0fd412d40f6d50093fac1d811" + }, + "rust_output_sha256": "9216be3bbae9e59bb89b6ed780ccedc5608cd4583c8e7527e50b165a0d8d30da", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "9216be3bbae9e59bb89b6ed780ccedc5608cd4583c8e7527e50b165a0d8d30da", + "matched_output_lines": 7100 + } + ], + "scope": "Actual client FaceBakery geometry overload with a real unit-atlas sprite and default JOML math options. Identity blockstate transform, all bundled cuboid geometry and synthetic rotations, rescaling, default/explicit UVs, winding, degenerate and reversed bounds, inherited models and missing materials. Positions, UVs and element matrix coefficients compare by float bits. This does not cover blockstate transforms/UV lock, atlas packing, transparency classification, lighting, GPU rendering or gameplay." +} diff --git a/benchmarks/rust-resource-number-scanner-2026-10-06/model-decoding.json b/benchmarks/rust-resource-number-scanner-2026-10-06/model-decoding.json new file mode 100644 index 000000000..33b99b897 --- /dev/null +++ b/benchmarks/rust-resource-number-scanner-2026-10-06/model-decoding.json @@ -0,0 +1,44 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "resource_models": 2883, + "synthetic_models": 2457, + "rejected_models": 1071, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCuboidModelOracle.java": "7526f20513c549483122ab0d5ad24b9e87f38dc2f6aae55addd701a91ac85e43", + "tools/test_cuboid_model_parity.py": "4a8b1cdcac335751c23413341ae939eea1c49c38d33d70d0708b8904ab8d0461", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "fed441cad861a44e9919087307cdb9b3d8165fe36ae05ab03f72dde23758cbd5", + "crates/horizon-assets/Cargo.toml": "fadb78cf819e026500606c45d27138ed67fcbbc967ae8cee6c1e7c82c9046b36", + "crates/horizon-assets/examples/cuboid_model_fixture.rs": "97609d90e3f6ce340f3590296db2dc778113bb2b33c7d1b54080a1d6f3023f40", + "crates/horizon-assets/examples/model_baking_fixture.rs": "59caca09dd5afd0b70a2e8fdb8e949deb9322f00adc617918b33d1e7e5b0b522", + "crates/horizon-assets/examples/model_resolution_fixture.rs": "c071067140299e49345a6ebd94e15b3b6d853cb9ae11d8de46e3cbdfb8b01f0e", + "crates/horizon-assets/examples/sprite_animation_fixture.rs": "254314d52deda129ab461221d3d8b95323a60730d374e566c1cd599fba85f072", + "crates/horizon-assets/examples/support/mod.rs": "bcf5a6d8a54845982191e037911c24139237771d6afa4b01b1e83c011489c3f5", + "crates/horizon-assets/src/animation.rs": "ebbf7952146a0e66b41396174492f5702627170b03a57e6cd5a45c97a08c975e", + "crates/horizon-assets/src/bake.rs": "0bc519e93ad8200d89543ceb5c811dd82bbeb0e9003b143385c8a03e758dfe65", + "crates/horizon-assets/src/json.rs": "99fe8af4fbf5d4eed408a92e829ac1a39597a0d92471a6bff73771fad9c830a8", + "crates/horizon-assets/src/lib.rs": "92482e4ff4ca46ff5c11a9618ed5007e205762be6390d91648f95068510f0390", + "crates/horizon-assets/src/model.rs": "57ddb3d65e88e7a8aa22c62bc298a2dae7f4e994326a873a31f06c0f36ed051b", + "crates/horizon-assets/src/resolve.rs": "3927ac926cdcbd7d334901cc32d0ecc1e498b1bec98f76a46bca6d4964c13541" + }, + "fixtures_sha256": { + ".local/rust-cuboid-model-parity/inputs.jsonl": "0b22593eb0dfe0cf3a5fcb01747a6c845319d1f7001234767b45d2d988d7fc67" + }, + "rust_output_sha256": "c60acdc2d44b2385ff2f9e81c60c2cd335357e920d316adedd6119315cb1e151", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "c60acdc2d44b2385ff2f9e81c60c2cd335357e920d316adedd6119315cb1e151", + "matched_output_lines": 5340 + } + ], + "scope": "Actual pinned CuboidModel.fromStream parser compared over every bundled block model and synthetic JSON/numeric/syntax cases. Decoded geometry, texture materials/references, nullable children, inheritance markers, face quadrants, light emission and display transforms; floats compare by IEEE-754 bits. Rejections normalize exception text. This client-only API is absent from the server. Does not yet validate parent resolution, rotation matrices, quad baking, blockstate dispatch, rendered pixels or gameplay." +} diff --git a/benchmarks/rust-resource-number-scanner-2026-10-06/model-resolution.json b/benchmarks/rust-resource-number-scanner-2026-10-06/model-resolution.json new file mode 100644 index 000000000..b479e27f7 --- /dev/null +++ b/benchmarks/rust-resource-number-scanner-2026-10-06/model-resolution.json @@ -0,0 +1,46 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "resource_models": 2883, + "graph_fixtures": 439, + "rejected_cyclic_roots": 702, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaModelResolutionOracle.java": "bd6581d68c69a96586d158ede8be4f3270d0d7a16288ca82dddab16785685b26", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCuboidModelOracle.java": "7526f20513c549483122ab0d5ad24b9e87f38dc2f6aae55addd701a91ac85e43", + "tools/test_model_resolution_parity.py": "d9595f2f1442f1f590b72d2a46600657e79ae103bec3d4c45db98242b964bde0", + "tools/test_cuboid_model_parity.py": "4a8b1cdcac335751c23413341ae939eea1c49c38d33d70d0708b8904ab8d0461", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "fed441cad861a44e9919087307cdb9b3d8165fe36ae05ab03f72dde23758cbd5", + "crates/horizon-assets/Cargo.toml": "fadb78cf819e026500606c45d27138ed67fcbbc967ae8cee6c1e7c82c9046b36", + "crates/horizon-assets/examples/cuboid_model_fixture.rs": "97609d90e3f6ce340f3590296db2dc778113bb2b33c7d1b54080a1d6f3023f40", + "crates/horizon-assets/examples/model_baking_fixture.rs": "59caca09dd5afd0b70a2e8fdb8e949deb9322f00adc617918b33d1e7e5b0b522", + "crates/horizon-assets/examples/model_resolution_fixture.rs": "c071067140299e49345a6ebd94e15b3b6d853cb9ae11d8de46e3cbdfb8b01f0e", + "crates/horizon-assets/examples/sprite_animation_fixture.rs": "254314d52deda129ab461221d3d8b95323a60730d374e566c1cd599fba85f072", + "crates/horizon-assets/examples/support/mod.rs": "bcf5a6d8a54845982191e037911c24139237771d6afa4b01b1e83c011489c3f5", + "crates/horizon-assets/src/animation.rs": "ebbf7952146a0e66b41396174492f5702627170b03a57e6cd5a45c97a08c975e", + "crates/horizon-assets/src/bake.rs": "0bc519e93ad8200d89543ceb5c811dd82bbeb0e9003b143385c8a03e758dfe65", + "crates/horizon-assets/src/json.rs": "99fe8af4fbf5d4eed408a92e829ac1a39597a0d92471a6bff73771fad9c830a8", + "crates/horizon-assets/src/lib.rs": "92482e4ff4ca46ff5c11a9618ed5007e205762be6390d91648f95068510f0390", + "crates/horizon-assets/src/model.rs": "57ddb3d65e88e7a8aa22c62bc298a2dae7f4e994326a873a31f06c0f36ed051b", + "crates/horizon-assets/src/resolve.rs": "3927ac926cdcbd7d334901cc32d0ecc1e498b1bec98f76a46bca6d4964c13541" + }, + "fixtures_sha256": { + ".local/rust-model-resolution-parity/inputs.jsonl": "9b3f9cb64bdb84303a3393ab035a00c11e857a5140e2992c0c5ebac0da2d3744" + }, + "rust_output_sha256": "146858eb5c73a16d71bf255bbd21f6082f330df5b322f10a288b4149b2cc98a4", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "146858eb5c73a16d71bf255bbd21f6082f330df5b322f10a288b4149b2cc98a4", + "matched_output_lines": 5648 + } + ], + "scope": "Actual ModelDiscovery and ResolvedModel/TextureSlots APIs over all bundled block models plus synthetic parent/alias graphs. Compares inherited geometry, AO/gui defaults, per-context display transforms, resolved materials, missing-model fallback, ignored built-in override, cyclic parent rejection, long alias/parent chains and slot lookup. Native rejection text/logging and discovery map iteration order are not compared. Geometry is shared through Arc in Rust; this does not prove quad baking, blockstate dispatch, pixels or gameplay." +} diff --git a/benchmarks/rust-resource-number-scanner-2026-10-06/sprite-animation.json b/benchmarks/rust-resource-number-scanner-2026-10-06/sprite-animation.json new file mode 100644 index 000000000..331ab541b --- /dev/null +++ b/benchmarks/rust-resource-number-scanner-2026-10-06/sprite-animation.json @@ -0,0 +1,48 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "resource_animations": 63, + "native_tick_states": 258996, + "fixtures": 907, + "rejected": 203, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSpriteAnimationOracle.java": "90b291abb0b76620f9ca719162393d4fe305ecfb9388d4675d3df89ac1ba136b", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCuboidModelOracle.java": "7526f20513c549483122ab0d5ad24b9e87f38dc2f6aae55addd701a91ac85e43", + "tools/test_sprite_animation_parity.py": "ea5961ff5e7770eeec6e91a916fedd3ec72dbf05e87cbeb8a8d2429440407d48", + "tools/test_model_baking_parity.py": "392ffec44918fb91740ca4a1316d684480d39f14bd34d46175f7f44946d15bd7", + "tools/test_cuboid_model_parity.py": "4a8b1cdcac335751c23413341ae939eea1c49c38d33d70d0708b8904ab8d0461", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "fed441cad861a44e9919087307cdb9b3d8165fe36ae05ab03f72dde23758cbd5", + "crates/horizon-assets/Cargo.toml": "fadb78cf819e026500606c45d27138ed67fcbbc967ae8cee6c1e7c82c9046b36", + "crates/horizon-assets/examples/cuboid_model_fixture.rs": "97609d90e3f6ce340f3590296db2dc778113bb2b33c7d1b54080a1d6f3023f40", + "crates/horizon-assets/examples/model_baking_fixture.rs": "59caca09dd5afd0b70a2e8fdb8e949deb9322f00adc617918b33d1e7e5b0b522", + "crates/horizon-assets/examples/model_resolution_fixture.rs": "c071067140299e49345a6ebd94e15b3b6d853cb9ae11d8de46e3cbdfb8b01f0e", + "crates/horizon-assets/examples/sprite_animation_fixture.rs": "254314d52deda129ab461221d3d8b95323a60730d374e566c1cd599fba85f072", + "crates/horizon-assets/examples/support/mod.rs": "bcf5a6d8a54845982191e037911c24139237771d6afa4b01b1e83c011489c3f5", + "crates/horizon-assets/src/animation.rs": "ebbf7952146a0e66b41396174492f5702627170b03a57e6cd5a45c97a08c975e", + "crates/horizon-assets/src/bake.rs": "0bc519e93ad8200d89543ceb5c811dd82bbeb0e9003b143385c8a03e758dfe65", + "crates/horizon-assets/src/json.rs": "99fe8af4fbf5d4eed408a92e829ac1a39597a0d92471a6bff73771fad9c830a8", + "crates/horizon-assets/src/lib.rs": "92482e4ff4ca46ff5c11a9618ed5007e205762be6390d91648f95068510f0390", + "crates/horizon-assets/src/model.rs": "57ddb3d65e88e7a8aa22c62bc298a2dae7f4e994326a873a31f06c0f36ed051b", + "crates/horizon-assets/src/resolve.rs": "3927ac926cdcbd7d334901cc32d0ecc1e498b1bec98f76a46bca6d4964c13541" + }, + "fixtures_sha256": { + ".local/rust-sprite-animation-parity/inputs.jsonl": "72ccfab50067a4e578c5ce498e395abfdc55df65c487cea758c1e723cabf4da7" + }, + "rust_output_sha256": "842c6693d75234d93b5623be5f55c2fbe739e94b3ec32241b96c81cd6d81317e", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "842c6693d75234d93b5623be5f55c2fbe739e94b3ec32241b96c81cd6d81317e", + "matched_output_lines": 907 + } + ], + "scope": "Actual AnimationMetadataSection JsonOps codec, frame-size calculation, SpriteContents sequence construction and AnimationState ticks. All bundled animated texture metadata plus synthetic numeric, null, invalid, repeated and out-of-image frame cases. Valid image grids only for SpriteContents construction. No resource-loader fallback, image decoding, GPU interpolation pixels, atlas packing or gameplay parity claim." +} diff --git a/crates/horizon-assets/src/animation.rs b/crates/horizon-assets/src/animation.rs index 00d905b74..66f494798 100644 --- a/crates/horizon-assets/src/animation.rs +++ b/crates/horizon-assets/src/animation.rs @@ -21,30 +21,13 @@ fn optional<'a>(object: &Object<'a>, name: &str) -> Option<&'a RawValue> { object.get(name).copied().filter(|v| v.get() != "null") } fn bounded_integer(value: &RawValue, minimum: i32) -> Result { - // JsonReader stops recognizing a number at its buffer limit. Its integer - // scanner also keeps wrapping a negative i64 accumulator after overflow: - // if that accumulator becomes zero, a following digit triggers the same - // rejection as a leading zero. JsonParser then exposes a string, which the - // uncompressed integer codec rejects. - let token = value.get(); - if token.len() >= 1024 { - return Err(error("animation number exceeds native reader buffer")); - } - let mut accumulator = 0i64; - for (index, digit) in token - .trim_start_matches('-') - .bytes() - .take_while(u8::is_ascii_digit) - .enumerate() - { - if index > 0 && accumulator == 0 { - return Err(error( - "native reader classifies animation number as a string", - )); - } - accumulator = accumulator - .wrapping_mul(10) - .wrapping_sub(i64::from(digit - b'0')); + // A lenient JsonParser exposes scanner failures as strings, which the + // uncompressed numeric codec rejects. Model streams instead reject them + // globally, even inside ignored fields. + if !native_number_token(value.get()) { + return Err(error( + "native reader classifies animation number as a string", + )); } let value = integer(value)?; if value < minimum { diff --git a/crates/horizon-assets/src/json.rs b/crates/horizon-assets/src/json.rs index 4f6ed2594..32a90d9f5 100644 --- a/crates/horizon-assets/src/json.rs +++ b/crates/horizon-assets/src/json.rs @@ -20,13 +20,37 @@ pub(crate) type Object<'a> = BTreeMap; pub(crate) fn error(message: &str) -> DecodeError { DecodeError(message.to_owned()) } -/// The native reader recognizes numeric tokens only while they fit its 1024 -/// character lookahead buffer. This applies even in fields the model ignores. +/// Whether a syntactically valid JSON number is classified as numeric by the +/// native reader. Its wrapping i64 scanner can hit zero after overflow, causing +/// the next integer digit to be rejected as if it followed a leading zero. +pub(crate) fn native_number_token(token: &str) -> bool { + if token.len() >= 1024 { + return false; + } + let mut accumulator = 0i64; + for (index, digit) in token + .trim_start_matches('-') + .bytes() + .take_while(u8::is_ascii_digit) + .enumerate() + { + if index > 0 && accumulator == 0 { + return false; + } + accumulator = accumulator + .wrapping_mul(10) + .wrapping_sub(i64::from(digit - b'0')); + } + true +} +/// Strict stream parsing rejects numeric scanner failures everywhere, including +/// ignored fields. Quoted copies of those tokens remain ordinary strings. pub(crate) fn validate_number_tokens(raw: &RawValue) -> Result<()> { + let text = raw.get(); let mut quoted = false; let mut escaped = false; - let mut length = 0; - for byte in raw.get().bytes() { + let mut start = None; + for (index, byte) in text.bytes().enumerate() { if quoted { if escaped { escaped = false; @@ -35,17 +59,25 @@ pub(crate) fn validate_number_tokens(raw: &RawValue) -> Result<()> { } else if byte == b'"' { quoted = false; } - } else if byte == b'"' { - quoted = true; - length = 0; - } else if byte.is_ascii_digit() || b"-.eE+".contains(&byte) { - length += 1; - if length >= 1024 { - return Err(error("numeric token exceeds native reader buffer")); - } - } else { - length = 0; + continue; } + if let Some(begin) = start { + if byte.is_ascii_digit() || b"-.eE+".contains(&byte) { + continue; + } + if !native_number_token(&text[begin..index]) { + return Err(error("native reader rejects numeric token")); + } + start = None; + } + if byte == b'"' { + quoted = true; + } else if byte.is_ascii_digit() || byte == b'-' { + start = Some(index); + } + } + if start.is_some_and(|begin| !native_number_token(&text[begin..])) { + return Err(error("native reader rejects numeric token")); } Ok(()) } diff --git a/docs/native-client.md b/docs/native-client.md index cb9eb6667..4e4ddc78f 100644 --- a/docs/native-client.md +++ b/docs/native-client.md @@ -69,18 +69,25 @@ physical key positions; typing the character W can report physical Escape. The separate `horizon-assets` crate decodes the pinned 26.3 cuboid model format. Its native comparison covers all **2,883 block-model JSON files** in the client -JAR plus **2,337 synthetic cases**: element bounds, optional geometry, nullable +JAR plus **2,457 synthetic cases**: element bounds, optional geometry, nullable children, face UVs and quarter turns, single-axis/Euler rotations, texture references and translucency materials, light emission, display transforms and inheritance markers. Floating-point fields compare by their exact bits. The comparison also covers primitive coercion, integer truncation/wraparound and -selected strict-reader numeric/syntax limits. +selected strict-reader numeric/syntax limits. The numeric scanner also preserves +vanilla's rejection when its wrapping integer accumulator hits zero before +another digit, including in ignored fields. Twenty newly exposed acceptance +mismatches were corrected; the complete comparison now covers 5,340 models. +The [resolution](../benchmarks/rust-resource-number-scanner-2026-10-06/model-resolution.json), +[baking](../benchmarks/rust-resource-number-scanner-2026-10-06/model-baking.json) and +[animation](../benchmarks/rust-resource-number-scanner-2026-10-06/sprite-animation.json) +comparisons also pass with the shared scanner correction. ```sh python3 tools/test_cuboid_model_parity.py ``` -The [archived decoder result](../benchmarks/rust-cuboid-model-decoding-2026-10-06/scoped-parity.json) +The [archived decoder result](../benchmarks/rust-resource-number-scanner-2026-10-06/model-decoding.json) records source, fixture and reference hashes. The oracle uses actual client classes; those rendering APIs are absent from the server. The decoder, parent resolver and baker now feed the development gallery. Blockstate selection, transformed diff --git a/docs/rust-parity.md b/docs/rust-parity.md index 950e8f0f1..023d83016 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -15,7 +15,7 @@ complete chunk generation, entity behavior, networking, rendering and playable integration remain unfinished. The linked subsystem documents and hashed reports record the exact tested scope and remaining gaps. The `horizon-assets` crate now decodes pinned cuboid models, with all 2,883 bundled -block-model JSON files and 2,337 synthetic cases compared against the actual +block-model JSON files and 2,457 synthetic cases compared against the actual client parser. [Decoder scope and validation](native-client.md#validation) also include parent/texture resolution over 5,648 roots and cuboid baking over 7,100 roots with identity blockstate transforms. Blockstate selection, transformed diff --git a/tools/test_cuboid_model_parity.py b/tools/test_cuboid_model_parity.py index bc0b3da57..8d34eef60 100644 --- a/tools/test_cuboid_model_parity.py +++ b/tools/test_cuboid_model_parity.py @@ -78,11 +78,19 @@ def corpus(): '1e2147483647', '1e2147483648', '1e-2147483648', '1.00000005960464477539062500000001', '1e-46', '-1e-46', '3.5e38', '1e9999', '1e10000', '1e-9999', '1e-10000', '1.0e10000', '1.0e10001', - '1' * 1023, '1' * 1024, '1' * 10000, '1' * 10001] + '1' * 1023, '1' * 1024, '1' * 10000, '1' * 10001, + *('1' + '0' * (n - 2) + '1' for n in [20, 64, 65, 66, 100, 1023, 1024]), + '1844674407370955161601', '-1844674407370955161601', + '18446744073709551616.1', '18446744073709551616e-18'] for number in numbers: for field in ['tintindex', 'rotation', 'texture']: yield '{"elements":[{"from":[0,0,0],"to":[16,16,16],"faces":{"up":{"texture":"#all","' + field + '":' + number + '}}}]}' yield '{"display":{"gui":{"rotation":[' + number + ',0,0],"translation":[' + number + ',0,0],"scale":[' + number + ',0,0]}}}' + # Strict stream parsing rejects scanner failures even in ignored fields; + # quoted copies remain ordinary strings. + for number in numbers: + yield '{"unknown":' + number + '}' + yield '{"unknown":"' + number + '"}' rng = random.Random(0x4355424f4944) for _ in range(1200): modified = copy.deepcopy(element) From 54a2b552ee80de1fa14065f6d670cc8664c4bc29 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 21:16:15 +0200 Subject: [PATCH 050/253] Decode vanilla blockstate variants and multipart conditions --- Cargo.lock | 1 + .../scoped-parity.json | 48 ++++ crates/horizon-assets/Cargo.toml | 1 + .../examples/blockstate_model_fixture.rs | 44 ++++ crates/horizon-assets/src/blockstate.rs | 226 ++++++++++++++++++ crates/horizon-assets/src/lib.rs | 1 + docs/native-client.md | 14 ++ docs/rust-parity.md | 4 +- .../parity/VanillaBlockStateModelOracle.java | 48 ++++ tools/test_blockstate_model_parity.py | 83 +++++++ 10 files changed, 469 insertions(+), 1 deletion(-) create mode 100644 benchmarks/rust-blockstate-model-decoding-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-assets/examples/blockstate_model_fixture.rs create mode 100644 crates/horizon-assets/src/blockstate.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateModelOracle.java create mode 100644 tools/test_blockstate_model_parity.py diff --git a/Cargo.lock b/Cargo.lock index 6ae1e0340..1d3c8f0c4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -578,6 +578,7 @@ checksum = "e17592d60ebacc7d5e169f4663c5f84f9161cc90328abcfe8456f41e4dfcb284" name = "horizon-assets" version = "0.1.0" dependencies = [ + "serde", "serde_json", ] diff --git a/benchmarks/rust-blockstate-model-decoding-2026-10-06/scoped-parity.json b/benchmarks/rust-blockstate-model-decoding-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..2a746dff6 --- /dev/null +++ b/benchmarks/rust-blockstate-model-decoding-2026-10-06/scoped-parity.json @@ -0,0 +1,48 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "resource_blockstates": 1288, + "synthetic_definitions": 1351, + "rejected": 468, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateModelOracle.java": "f6e3bacca9dcd04f4dde093c588f4cda435bb0237f57d27521af2dfe409358d2", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCuboidModelOracle.java": "7526f20513c549483122ab0d5ad24b9e87f38dc2f6aae55addd701a91ac85e43", + "tools/test_blockstate_model_parity.py": "adf720719432c677f37bd10ed6e02089195c1fc4dcf227bb01187c3fd5a1747a", + "tools/test_cuboid_model_parity.py": "4a8b1cdcac335751c23413341ae939eea1c49c38d33d70d0708b8904ab8d0461", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "3b8e27b28da541475b05111f24f2ab96d2e5db88e62d34ab848ac057c09d33e7", + "crates/horizon-assets/Cargo.toml": "d09f70e42198d36c97e6f0be9d3c251f649690824f78ac241158e01171d1f81c", + "crates/horizon-assets/examples/blockstate_model_fixture.rs": "8f063322e57abdf9361a5a3a3badce2a7e727ee6d5e3947071cb448dfb38e8fd", + "crates/horizon-assets/examples/cuboid_model_fixture.rs": "97609d90e3f6ce340f3590296db2dc778113bb2b33c7d1b54080a1d6f3023f40", + "crates/horizon-assets/examples/model_baking_fixture.rs": "59caca09dd5afd0b70a2e8fdb8e949deb9322f00adc617918b33d1e7e5b0b522", + "crates/horizon-assets/examples/model_resolution_fixture.rs": "c071067140299e49345a6ebd94e15b3b6d853cb9ae11d8de46e3cbdfb8b01f0e", + "crates/horizon-assets/examples/sprite_animation_fixture.rs": "254314d52deda129ab461221d3d8b95323a60730d374e566c1cd599fba85f072", + "crates/horizon-assets/examples/support/mod.rs": "bcf5a6d8a54845982191e037911c24139237771d6afa4b01b1e83c011489c3f5", + "crates/horizon-assets/src/animation.rs": "ebbf7952146a0e66b41396174492f5702627170b03a57e6cd5a45c97a08c975e", + "crates/horizon-assets/src/bake.rs": "0bc519e93ad8200d89543ceb5c811dd82bbeb0e9003b143385c8a03e758dfe65", + "crates/horizon-assets/src/blockstate.rs": "ec5fef8eb7cf4c5e367c76d394554e97c598371e4d4dc6029b15c6483a75616c", + "crates/horizon-assets/src/json.rs": "99fe8af4fbf5d4eed408a92e829ac1a39597a0d92471a6bff73771fad9c830a8", + "crates/horizon-assets/src/lib.rs": "e39f21c59a2c3e1c53d977b29bd5e0638e5fc41d86ff0fcc1882a6d90fd961e4", + "crates/horizon-assets/src/model.rs": "57ddb3d65e88e7a8aa22c62bc298a2dae7f4e994326a873a31f06c0f36ed051b", + "crates/horizon-assets/src/resolve.rs": "3927ac926cdcbd7d334901cc32d0ecc1e498b1bec98f76a46bca6d4964c13541" + }, + "fixtures_sha256": { + ".local/rust-blockstate-model-parity/inputs.jsonl": "9ac61d1c85d00d1c4ca1246a832359459a055077d04401599534885cd6f341b9" + }, + "rust_output_sha256": "53300626594228aeb6fb75923b49430a26a230f729aa0ead7f05080d039c34b0", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "53300626594228aeb6fb75923b49430a26a230f729aa0ead7f05080d039c34b0", + "matched_output_lines": 2639 + } + ], + "scope": "Actual StrictJsonParser and BlockStateModelDispatcher codec used by the pinned resource loader. Every bundled blockstate JSON plus variants, XYZ quarter turns, UV-lock flags, weighted entries, source order, multipart conditions and malformed synthetic cases. No registry binding, property selection, random draw selection, transformed baking, rendered pixels or gameplay parity claim." +} diff --git a/crates/horizon-assets/Cargo.toml b/crates/horizon-assets/Cargo.toml index c0e9f214d..a530f5baf 100644 --- a/crates/horizon-assets/Cargo.toml +++ b/crates/horizon-assets/Cargo.toml @@ -7,4 +7,5 @@ rust-version.workspace = true description = "Horizon version-specific model and resource decoding" [dependencies] +serde = "1.0.229" serde_json = { version = "1.0.151", features = ["raw_value"] } diff --git a/crates/horizon-assets/examples/blockstate_model_fixture.rs b/crates/horizon-assets/examples/blockstate_model_fixture.rs new file mode 100644 index 000000000..53ec83fd2 --- /dev/null +++ b/crates/horizon-assets/examples/blockstate_model_fixture.rs @@ -0,0 +1,44 @@ +use horizon_assets::blockstate::{BlockStateDefinition, Condition, Variant, VariantSet}; +use serde_json::{Value, json}; +use std::{ + collections::BTreeMap, + fs::File, + io::{BufRead, BufReader, BufWriter, Write}, +}; +fn variant(v: &Variant) -> Value { + json!({"model":v.model,"rotations":v.rotations,"uvlock":v.uv_lock}) +} +fn model(v: &VariantSet) -> Value { + match v { + VariantSet::Single(v) => json!({"single":variant(v)}), + VariantSet::Weighted(entries) => { + json!({"weighted":entries.iter().map(|(v,w)|json!([variant(v),w])).collect::>()}) + } + } +} +fn condition(v: &Condition) -> Value { + match v { + Condition::Or(v) => json!({"or":v.iter().map(condition).collect::>()}), + Condition::And(v) => json!({"and":v.iter().map(condition).collect::>()}), + Condition::Properties(v) => { + json!({"properties":v.iter().map(|(key,terms)| (key, terms.iter().map(|t|json!({"value":t.value,"negated":t.negated})).collect::>())).collect::>()}) + } + } +} +fn definition(v: &BlockStateDefinition) -> Value { + json!({"variants":v.variants.as_ref().map(|v|v.iter().map(|(k,v)|json!([k,model(v)])).collect::>()),"multipart":v.multipart.as_ref().map(|v|v.iter().map(|s|json!({"when":s.condition.as_ref().map(condition),"apply":model(&s.variant)})).collect::>())}) +} +fn main() -> Result<(), Box> { + let args: Vec<_> = std::env::args().collect(); + let input = BufReader::new(File::open(&args[1])?); + let mut output = BufWriter::new(File::create(&args[2])?); + for line in input.lines() { + let row: Vec = serde_json::from_str(&line?)?; + let result = match BlockStateDefinition::from_json(&row[1]) { + Ok(v) => json!({"name":row[0],"definition":definition(&v)}), + Err(_) => json!({"name":row[0],"error":true}), + }; + writeln!(output, "{result}")?; + } + Ok(()) +} diff --git a/crates/horizon-assets/src/blockstate.rs b/crates/horizon-assets/src/blockstate.rs new file mode 100644 index 000000000..7113e60af --- /dev/null +++ b/crates/horizon-assets/src/blockstate.rs @@ -0,0 +1,226 @@ +//! Pinned blockstate resource definitions, before registry binding and baking. +use crate::json::*; +use serde::{ + Deserializer, + de::{MapAccess, Visitor}, +}; +use serde_json::value::RawValue; +use std::{collections::BTreeMap, fmt}; + +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct Variant { + pub model: String, + /// X, Y, Z rotations in quarter turns. + pub rotations: [u8; 3], + pub uv_lock: bool, +} +#[derive(Clone, Debug, PartialEq, Eq)] +pub enum VariantSet { + Single(Variant), + Weighted(Vec<(Variant, i32)>), +} +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct Term { + pub value: String, + pub negated: bool, +} +#[derive(Clone, Debug, PartialEq, Eq)] +pub enum Condition { + Or(Vec), + And(Vec), + Properties(BTreeMap>), +} +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct Selector { + pub condition: Option, + pub variant: VariantSet, +} +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct BlockStateDefinition { + /// Preserve resource order: overlapping variant selectors have order-sensitive + /// native recovery behavior when bound to a registry. + pub variants: Option>, + pub multipart: Option>, +} +fn optional<'a>(fields: &Object<'a>, name: &str) -> Option<&'a RawValue> { + fields.get(name).copied().filter(|v| v.get() != "null") +} +fn ordered_object(raw: &RawValue) -> Result> { + struct Ordered; + impl<'de> Visitor<'de> for Ordered { + type Value = Vec<(String, &'de RawValue)>; + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("an object") + } + fn visit_map>( + self, + mut map: M, + ) -> std::result::Result { + let mut values: Self::Value = Vec::new(); + let mut indices = BTreeMap::new(); + while let Some((name, value)) = map.next_entry::()? { + if let Some(&index) = indices.get(&name) { + values[index] = (name, value); + } else { + indices.insert(name.clone(), values.len()); + values.push((name, value)); + } + } + Ok(values) + } + } + Ok(serde_json::Deserializer::from_str(raw.get()).deserialize_map(Ordered)?) +} +impl BlockStateDefinition { + pub fn from_json(text: &str) -> Result { + let raw: &RawValue = serde_json::from_str(text.strip_prefix('\u{feff}').unwrap_or(text))?; + validate_number_tokens(raw)?; + let fields = object(raw)?; + let variants = optional(&fields, "variants") + .map(|v| { + let values = ordered_object(v)?; + if values.is_empty() { + return Err(error("empty variant map")); + } + values + .into_iter() + .map(|(key, value)| Ok((key, VariantSet::decode(value)?))) + .collect::>>() + }) + .transpose()?; + let multipart = optional(&fields, "multipart") + .map(|v| { + let values = array(v)?; + if values.is_empty() { + return Err(error("empty multipart list")); + } + values + .into_iter() + .map(|v| { + let fields = object(v)?; + Ok(Selector { + condition: optional(&fields, "when") + .map(Condition::decode) + .transpose()?, + variant: VariantSet::decode(required(&fields, "apply")?)?, + }) + }) + .collect::>>() + }) + .transpose()?; + if variants.is_none() && multipart.is_none() { + return Err(error("no variants or multipart")); + } + Ok(Self { + variants, + multipart, + }) + } +} +impl Variant { + fn decode(raw: &RawValue) -> Result { + let fields = object(raw)?; + let mut rotations = [0; 3]; + for (target, name) in rotations.iter_mut().zip(["x", "y", "z"]) { + let angle = optional(&fields, name) + .map(integer) + .transpose()? + .unwrap_or(0) + .rem_euclid(360); + if angle % 90 != 0 { + return Err(error("model rotation must be a multiple of 90")); + } + *target = (angle / 90) as u8; + } + Ok(Self { + model: identifier(&string(required(&fields, "model")?)?)?, + rotations, + uv_lock: optional(&fields, "uvlock") + .map(|v| serde_json::from_str(v.get())) + .transpose()? + .unwrap_or(false), + }) + } +} +impl VariantSet { + fn decode(raw: &RawValue) -> Result { + if !raw.get().starts_with('[') { + return Ok(Self::Single(Variant::decode(raw)?)); + } + let values = array(raw)?; + if values.is_empty() { + return Err(error("empty weighted variants")); + } + let mut total = 0i32; + let entries = values + .into_iter() + .map(|v| { + let fields = object(v)?; + let weight = optional(&fields, "weight") + .map(integer) + .transpose()? + .unwrap_or(1); + if weight <= 0 { + return Err(error("nonpositive variant weight")); + } + total = total + .checked_add(weight) + .ok_or_else(|| error("variant weight overflow"))?; + Ok((Variant::decode(v)?, weight)) + }) + .collect::>>()?; + Ok(Self::Weighted(entries)) + } +} +impl Condition { + fn decode(raw: &RawValue) -> Result { + let fields = object(raw)?; + if fields.len() == 1 { + for name in ["OR", "AND"] { + if let Some(raw) = fields.get(name) { + if let Ok(values) = array(raw).and_then(|values| { + values + .into_iter() + .map(Self::decode) + .collect::>>() + }) { + return Ok(if name == "OR" { + Self::Or(values) + } else { + Self::And(values) + }); + } + } + } + } + if fields.is_empty() { + return Err(error("empty property conditions")); + } + let tests = fields + .into_iter() + .map(|(key, raw)| { + let value = match raw.get().as_bytes().first() { + Some(b'"') => string(raw)?, + Some(b't' | b'f') => raw.get().to_owned(), + _ => integer(raw)?.to_string(), + }; + let terms = value + .split('|') + .map(|v| { + let negated = v.starts_with('!'); + let value = v.strip_prefix('!').unwrap_or(v); + if value.is_empty() { + return Err(error("empty property term")); + } + Ok(Term { + value: value.to_owned(), + negated, + }) + }) + .collect::>>()?; + Ok((key, terms)) + }) + .collect::>()?; + Ok(Self::Properties(tests)) + } +} diff --git a/crates/horizon-assets/src/lib.rs b/crates/horizon-assets/src/lib.rs index f487ac555..e52fe3a32 100644 --- a/crates/horizon-assets/src/lib.rs +++ b/crates/horizon-assets/src/lib.rs @@ -3,6 +3,7 @@ pub mod animation; pub mod bake; +pub mod blockstate; mod json; pub mod model; pub mod resolve; diff --git a/docs/native-client.md b/docs/native-client.md index 4e4ddc78f..873f83e40 100644 --- a/docs/native-client.md +++ b/docs/native-client.md @@ -129,6 +129,20 @@ transparency classification, actual tint/light evaluation and GPU rendering remain separate from the geometry result. Other operating systems still need their native validation runs. +Blockstate resources now decode into ordered variant selectors and multipart +conditions. The [native blockstate comparison](../benchmarks/rust-blockstate-model-decoding-2026-10-06/scoped-parity.json) +covers all 1,288 bundled definitions and 1,351 synthetic cases (2,639 total, +468 expected rejections). It uses the same `StrictJsonParser` and +`BlockStateModelDispatcher.CODEC` as the pinned loader. The Rust representation +preserves single versus weighted variants, all three quarter-turn axes, UV-lock +flags, positive weights and total-weight limits, ordered selectors, nested +AND/OR conditions and per-term negation. Registry binding, property selection, +random draw consumption and transformed baking remain separate work. + +```sh +python3 tools/test_blockstate_model_parity.py +``` + The sprite animation module reproduces the pinned metadata codec's integer conversion, strict primitive types, optional null fields and frame dimensions. It preserves repeated frames, filters out-of-image frame indices, and treats diff --git a/docs/rust-parity.md b/docs/rust-parity.md index 023d83016..307398184 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -19,7 +19,9 @@ block-model JSON files and 2,457 synthetic cases compared against the actual client parser. [Decoder scope and validation](native-client.md#validation) also include parent/texture resolution over 5,648 roots and cuboid baking over 7,100 roots with identity blockstate transforms. Blockstate selection, transformed -models and UV locking remain unfinished. The native renderer now draws an +models and UV locking remain unfinished. Blockstate resource decoding now +matches all 1,288 bundled definitions and 1,351 synthetic cases; registry +binding and model selection are not yet connected to the renderer. The native renderer now draws an inspection gallery from the decoded/resolved/baked models, including binary cutouts and stepped lantern animation; these are not yet gameplay blocks. Animation metadata, frame sequences and tick-state selection now have native diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateModelOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateModelOracle.java new file mode 100644 index 000000000..0ecbe597d --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateModelOracle.java @@ -0,0 +1,48 @@ +package dev.horizonlab.parity; + +import com.google.gson.*; +import com.mojang.serialization.JsonOps; +import java.nio.file.*; +import java.util.*; +import net.minecraft.client.renderer.block.dispatch.*; +import net.minecraft.client.renderer.block.dispatch.multipart.*; +import net.minecraft.util.StrictJsonParser; +import static dev.horizonlab.parity.VanillaCuboidModelOracle.map; + +/** Original adapter around the actual blockstate resource parser and codec. */ +public final class VanillaBlockStateModelOracle { + private static final Gson JSON = new GsonBuilder().serializeNulls().create(); + private static Object variant(Variant value) { + var state=value.modelState(); + return map("model",value.modelLocation().toString(),"rotations",new int[]{state.x().ordinal(),state.y().ordinal(),state.z().ordinal()},"uvlock",state.uvLock()); + } + private static Object model(BlockStateModel.Unbaked value) { + if(value instanceof SingleVariant.Unbaked single)return map("single",variant(single.variant())); + var weighted=(WeightedVariants.Unbaked)value; + return map("weighted",weighted.entries().unwrap().stream().map(e->Arrays.asList(variant(((SingleVariant.Unbaked)e.value()).variant()),e.weight())).toList()); + } + private static Object condition(Condition value) { + if(value instanceof CombinedCondition combined)return map(combined.operation().name().toLowerCase(Locale.ROOT),combined.terms().stream().map(VanillaBlockStateModelOracle::condition).toList()); + var tests=new TreeMap(); + ((KeyValueCondition)value).tests().forEach((key,terms)->tests.put(key,terms.entries().stream().map(t->map("value",t.value(),"negated",t.negated())).toList())); + return map("properties",tests); + } + private static Object definition(BlockStateModelDispatcher value) { + var variants=value.simpleModels().map(m->m.models().entrySet().stream().map(e->Arrays.asList(e.getKey(),model(e.getValue()))).toList()).orElse(null); + var multipart=value.multiPart().map(m->m.selectors().stream().map(s->map("when",s.condition().map(VanillaBlockStateModelOracle::condition).orElse(null),"apply",model(s.variant()))).toList()).orElse(null); + return map("variants",variants,"multipart",multipart); + } + public static void main(String[] args) throws Exception { + net.minecraft.SharedConstants.tryDetectVersion(); + try(var input=Files.newBufferedReader(Path.of(args[0]));var output=Files.newBufferedWriter(Path.of(args[1]))) { + for(String line;(line=input.readLine())!=null;) { + var row=JsonParser.parseString(line).getAsJsonArray();Object result; + BlockStateModelDispatcher decoded; + try { decoded=BlockStateModelDispatcher.CODEC.parse(JsonOps.INSTANCE,StrictJsonParser.parse(row.get(1).getAsString())).getOrThrow(); } + catch(RuntimeException error) {output.write(JSON.toJson(map("name",row.get(0).getAsString(),"error",true)));output.newLine();continue;} + result=map("name",row.get(0).getAsString(),"definition",definition(decoded)); + output.write(JSON.toJson(result));output.newLine(); + } + } + } +} diff --git a/tools/test_blockstate_model_parity.py b/tools/test_blockstate_model_parity.py new file mode 100644 index 000000000..8a2548d53 --- /dev/null +++ b/tools/test_blockstate_model_parity.py @@ -0,0 +1,83 @@ +#!/usr/bin/env python3 +"""Compare blockstate resource decoding with the pinned client loader's codec.""" +import json +import os +from pathlib import Path +import platform +import random +import subprocess +import zipfile +try: + from . import lab, test_rust_parity as base, test_cuboid_model_parity as decoding +except ImportError: + import lab, test_rust_parity as base, test_cuboid_model_parity as decoding + + +def corpus(): + model={'model':'block/stone'} + def root(value): return {'variants':{'':value}} + for value in [None,{},[],False,0,'x',{'variants':{}},{'multipart':[]},{'variants':None},{'variants':None,'multipart':[{'apply':model}]},root(model),root([model]),root([])]:yield json.dumps(value) + values=[None,True,False,0,1,-1,90,90.9,-90,270,360,450,4294967296,4294967386,1e100,'90','true','',[],{},[model]] + for key in ['model','x','y','z','uvlock','weight']: + for value in values: + variant=dict(model);variant[key]=value + yield json.dumps(root(variant));yield json.dumps(root([variant])) + for weights in [[2147483647],[2147483647,1],[2147483646,1],[0,1],[-1,2],[1,1],[1.9,2.9]]: + yield json.dumps(root([dict(model,weight=w) for w in weights])) + for name in ['block/stone',':block/stone',':','minecraft:','a:b:c','A:a','a:é','../a']: + yield json.dumps(root({'model':name})) + for x in [-360,-90,0,90,180,270,360,450]: + for y in [0,90,180,270]: + for z in [0,90,180,270]:yield json.dumps(root(dict(model,x=x,y=y,z=z,uvlock=True))) + terms=[None,True,False,0,1,1.9,-1,4294967297,'true','false','!true','true|false','!true|false','!!true','!','', '|','true|','|true','a||b',' a ',[],{},['true']] + conditions=[{},None,True,[],{'OR':[]},{'AND':[]},{'OR':[{'a':'b'}]},{'AND':[{'a':'b'},{'c':'d'}]},{'OR':'true'},{'OR':[],'AND':[]},{'OR':[],'a':'b'}] + for key in ['a','OR','AND','']: + conditions.extend({key:t} for t in terms) + for condition in conditions: + for apply in [model,[model],[],None]:yield json.dumps({'multipart':[{'when':condition,'apply':apply}]}) + for raw in ['{} trailing','{} {}','\ufeff'+json.dumps(root(model)), '{"variants":{"b":{"model":"b"},"a":{"model":"a"},"b":{"model":"c"}}}', '{"variants":{"":{"model":"a"}},"multipart":[{"apply":{"model":"b"}}]}']: + yield raw + rng=random.Random(0x424c4f434b) + for _ in range(500): + selectors=[] + for _ in range(rng.randrange(1,8)): + condition={rng.choice(['a','b','c']):rng.choice(['x','y','!x','x|y'])} + if rng.randrange(2):condition={rng.choice(['OR','AND']):[condition,{'a':'x'}]} + variants=[dict(model,weight=rng.randrange(1,10),x=rng.randrange(-4,5)*90,y=rng.randrange(4)*90,z=rng.randrange(4)*90,uvlock=bool(rng.randrange(2))) for _ in range(rng.randrange(1,6))] + selectors.append({'when':condition,'apply':variants if rng.randrange(2) else variants[0]}) + yield json.dumps({'multipart':selectors}) + for number in ['1844674407370955161601','18446744073709551616.1','1e10000','1e9999','1' * 1024]: + yield '{"variants":{"":{"model":"block/stone","x":'+number+'}}}' + yield '{"variants":{"":{"model":"block/stone"}},"unknown":'+number+'}' + + +def main(): + lock,jars,libraries=base.verify_artifacts() + build=lab.LOCAL/'rust-blockstate-model-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateModelOracle.java';helper=oracle.with_name('VanillaCuboidModelOracle.java');crate=lab.ROOT/'crates/horizon-assets' + sources=[oracle,helper,Path(__file__),lab.ROOT/'tools/test_cuboid_model_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',crate/'Cargo.toml',*sorted(crate.rglob('*.rs'))] + tested=base.source_hashes(sources) + with zipfile.ZipFile(jars['client']) as archive: + names=sorted(n for n in archive.namelist() if n.startswith('assets/minecraft/blockstates/') and n.endswith('.json')) + rows=[(n,archive.read(n).decode()) for n in names] + synthetic=list(corpus());rows.extend((f'synthetic/{i}',raw) for i,raw in enumerate(synthetic)) + inputs=build/'inputs.jsonl';inputs.write_text(''.join(json.dumps(row)+'\n' for row in rows));fixtures=base.source_hashes([inputs]);classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w') as log:subprocess.run(list(map(str,command)),cwd=lab.ROOT,check=True,timeout=3600,stdout=log,stderr=subprocess.STDOUT) + dependencies=os.pathsep.join(map(str,[jars['client'],*libraries])) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',dependencies,'-d',classes,oracle,helper],'compile-java') + run(['cargo','build','--locked','-p','horizon-assets','--example','blockstate_model_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--locked','--no-deps','--format-version','1'],cwd=lab.ROOT));binary=Path(metadata['target_directory'])/'debug/examples'/('blockstate_model_fixture.exe' if os.name=='nt' else 'blockstate_model_fixture') + run([binary,inputs,build/'rust.jsonl'],'rust');run(['java','-Xmx512M','-cp',str(classes)+os.pathsep+dependencies,'dev.horizonlab.parity.VanillaBlockStateModelOracle',inputs,build/'client.jsonl'],'client') + rejected=decoding.canonicalize(build/'client.jsonl');decoding.canonicalize(build/'rust.jsonl') + native=[json.loads(line) for line in (build/'client.jsonl').read_text().splitlines()];rust=[json.loads(line) for line in (build/'rust.jsonl').read_text().splitlines()] + for left,right in zip(native,rust,strict=True): + if left!=right:raise AssertionError('Blockstate model mismatch: '+left['name']) + matched=base.compare(build/'client.jsonl',build/'rust.jsonl');assert all('error' not in row for row in native[:len(names)]),'Bundled blockstate rejected' + base.ensure_sources_unchanged(sources,tested);base.ensure_sources_unchanged([inputs],fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'resource_blockstates':len(names),'synthetic_definitions':len(synthetic),'rejected':rejected,'sources_sha256':tested,'fixtures_sha256':fixtures,'rust_output_sha256':lab.digest(build/'rust.jsonl','sha256'),'references':[{'side':'client','jar_sha256':lab.digest(jars['client'],'sha256'),'output_sha256':lab.digest(build/'client.jsonl','sha256'),'matched_output_lines':matched}],'scope':'Actual StrictJsonParser and BlockStateModelDispatcher codec used by the pinned resource loader. Every bundled blockstate JSON plus variants, XYZ quarter turns, UV-lock flags, weighted entries, source order, multipart conditions and malformed synthetic cases. No registry binding, property selection, random draw selection, transformed baking, rendered pixels or gameplay parity claim.'} + lab.write_json(report_path,report);print(f'Native blockstate models: {matched:,} definitions match ({rejected:,} rejected); {report_path}',flush=True) + + +if __name__=='__main__':main() From 1d0b537a0a960d0be8959c7b9d7b0723780ead36 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 21:26:47 +0200 Subject: [PATCH 051/253] Bind vanilla blockstate selectors and multipart model parts --- Cargo.lock | 1 + .../scoped-parity.json | 114 ++++++++++ .../shared-integer-codec.json | 203 ++++++++++++++++++ crates/horizon-assets/Cargo.toml | 1 + .../examples/blockstate_binding_fixture.rs | 60 ++++++ crates/horizon-assets/src/blockstate.rs | 1 + crates/horizon-assets/src/blockstate/bind.rs | 160 ++++++++++++++ crates/horizon-core/src/lib.rs | 1 + crates/horizon-core/src/text.rs | 33 +++ crates/horizon-world/src/registry/json.rs | 31 +-- docs/native-client.md | 22 +- docs/rust-parity.md | 4 +- .../VanillaBlockStateBindingOracle.java | 90 ++++++++ tools/test_blockstate_binding_parity.py | 86 ++++++++ 14 files changed, 774 insertions(+), 33 deletions(-) create mode 100644 benchmarks/rust-blockstate-model-binding-2026-10-06/scoped-parity.json create mode 100644 benchmarks/rust-blockstate-model-binding-2026-10-06/shared-integer-codec.json create mode 100644 crates/horizon-assets/examples/blockstate_binding_fixture.rs create mode 100644 crates/horizon-assets/src/blockstate/bind.rs create mode 100644 crates/horizon-core/src/text.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateBindingOracle.java create mode 100644 tools/test_blockstate_binding_parity.py diff --git a/Cargo.lock b/Cargo.lock index 1d3c8f0c4..51f4e52c6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -578,6 +578,7 @@ checksum = "e17592d60ebacc7d5e169f4663c5f84f9161cc90328abcfe8456f41e4dfcb284" name = "horizon-assets" version = "0.1.0" dependencies = [ + "horizon-core", "serde", "serde_json", ] diff --git a/benchmarks/rust-blockstate-model-binding-2026-10-06/scoped-parity.json b/benchmarks/rust-blockstate-model-binding-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..8689367b6 --- /dev/null +++ b/benchmarks/rust-blockstate-model-binding-2026-10-06/scoped-parity.json @@ -0,0 +1,114 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "resource_blockstates": 1288, + "unbound_resource_names": [], + "state_definitions": 1288, + "definition_states": 35727, + "definitions": 3802, + "selected_state_results": 687466, + "rejected": 220, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateBindingOracle.java": "d1390b829759dcf4b1e2261eda0e1d80dcb39fb9f4027cc5c20dd7373926b507", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCuboidModelOracle.java": "7526f20513c549483122ab0d5ad24b9e87f38dc2f6aae55addd701a91ac85e43", + "tools/test_blockstate_binding_parity.py": "d727e749d7e6e76c9855700678c107aabda6b8042d3a986febe9c346b3ece44e", + "tools/test_cuboid_model_parity.py": "4a8b1cdcac335751c23413341ae939eea1c49c38d33d70d0708b8904ab8d0461", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-assets/Cargo.toml": "2f2cffacec0b4e22dd7cb032d594289bc51c94ae6cc4e985fee3e310f441d751", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-assets/examples/blockstate_binding_fixture.rs": "e58fdb432f6bfc1e400729baa9b48d4f00955b3143b98b52506b47dd8b065cf8", + "crates/horizon-assets/examples/blockstate_model_fixture.rs": "8f063322e57abdf9361a5a3a3badce2a7e727ee6d5e3947071cb448dfb38e8fd", + "crates/horizon-assets/examples/cuboid_model_fixture.rs": "97609d90e3f6ce340f3590296db2dc778113bb2b33c7d1b54080a1d6f3023f40", + "crates/horizon-assets/examples/model_baking_fixture.rs": "59caca09dd5afd0b70a2e8fdb8e949deb9322f00adc617918b33d1e7e5b0b522", + "crates/horizon-assets/examples/model_resolution_fixture.rs": "c071067140299e49345a6ebd94e15b3b6d853cb9ae11d8de46e3cbdfb8b01f0e", + "crates/horizon-assets/examples/sprite_animation_fixture.rs": "254314d52deda129ab461221d3d8b95323a60730d374e566c1cd599fba85f072", + "crates/horizon-assets/examples/support/mod.rs": "bcf5a6d8a54845982191e037911c24139237771d6afa4b01b1e83c011489c3f5", + "crates/horizon-assets/src/animation.rs": "ebbf7952146a0e66b41396174492f5702627170b03a57e6cd5a45c97a08c975e", + "crates/horizon-assets/src/bake.rs": "0bc519e93ad8200d89543ceb5c811dd82bbeb0e9003b143385c8a03e758dfe65", + "crates/horizon-assets/src/blockstate/bind.rs": "6278962e55c9786bba8184bdf2939af9c6e3b9002b08c3022129964b49a60009", + "crates/horizon-assets/src/blockstate.rs": "1cf26e437744a5c17c909e58335857427910afd10b29e8c518280fee598cfbd3", + "crates/horizon-assets/src/json.rs": "99fe8af4fbf5d4eed408a92e829ac1a39597a0d92471a6bff73771fad9c830a8", + "crates/horizon-assets/src/lib.rs": "e39f21c59a2c3e1c53d977b29bd5e0638e5fc41d86ff0fcc1882a6d90fd961e4", + "crates/horizon-assets/src/model.rs": "57ddb3d65e88e7a8aa22c62bc298a2dae7f4e994326a873a31f06c0f36ed051b", + "crates/horizon-assets/src/resolve.rs": "3927ac926cdcbd7d334901cc32d0ecc1e498b1bec98f76a46bca6d4964c13541", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb" + }, + "fixtures_sha256": { + ".local/rust-blockstate-binding-parity/inputs.jsonl": "460edd8de45975d342b1587693c76d94782c99f6e61bb7212c1b5655eebb4426", + ".local/rust-blockstate-binding-parity/registry.json": "c400e5438c957d554324afbad198b4baa8ff21d86a59da53d04943a08fb320a5" + }, + "rust_output_sha256": "be66aeb2128b78a5f61f7ee2c48add80e5b31a89eee5a1b5dfa308f16df9f490", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "be66aeb2128b78a5f61f7ee2c48add80e5b31a89eee5a1b5dfa308f16df9f490", + "matched_output_lines": 3802 + } + ], + "scope": "Actual BlockStateModelDispatcher.instantiate and MultiPartModel visual-equality selection on every bundled blockstate definition, including the native fake item-frame definitions, and its native ordered possible states. Synthetic malformed selectors, overlapping recovery, eager multipart errors, per-term negation, combined predicates, integer-property conversion and partial coverage. Property schema and state order are exported from the authenticated client. No weighted random selection, transformed baking, renderer integration or gameplay parity claim." +} diff --git a/benchmarks/rust-blockstate-model-binding-2026-10-06/shared-integer-codec.json b/benchmarks/rust-blockstate-model-binding-2026-10-06/shared-integer-codec.json new file mode 100644 index 000000000..6e14c4cff --- /dev/null +++ b/benchmarks/rust-blockstate-model-binding-2026-10-06/shared-integer-codec.json @@ -0,0 +1,203 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "block_states": 35723, + "blocks": 1286, + "integer_properties": 146, + "codec_inputs": 185538, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "tools/test_block_state_codec_parity.py": "51b8174d92fbf2326362141eb66e3c1d4c302bffc3914ce9405b1eb66d8856bb", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "2995b209aa3dc24cfcbba405cf8b97a398efbc0de97bb04ef2f51abb4cd2b84c", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/block_state_codec_fixture.rs": "c053e44f17b3641bf5c45ed05c2fd0c88c3ac2a20cdf385737502d5a865e7a2b" + }, + "fixtures_sha256": { + ".local/rust-block-state-codec-parity/inputs.txt": "3266a7d8ac5b6afbbcb786f6bd85ba98d876eab589e0d4ed4af9d2212235af5e", + ".local/rust-block-state-codec-parity/facts-client.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-block-state-codec-parity/facts-server.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b" + }, + "rust_output_sha256": "fb4b7c50dcfb93170898f0c378aa3893a6ff8a211c1b8a25725dd898cb45ce5b", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "fb4b7c50dcfb93170898f0c378aa3893a6ff8a211c1b8a25725dd898cb45ce5b", + "matched_output_lines": 221261 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "fb4b7c50dcfb93170898f0c378aa3893a6ff8a211c1b8a25725dd898cb45ce5b", + "matched_output_lines": 221261 + } + ], + "scope": "Actual BlockState.CODEC and FULL_CODEC, every pinned runtime block state, compact/default versus full encoding, canonical object keys, namespaces, property omission/invalid fallback, unknown fields, malformed property containers, Java integer-property parsing including signs/leading zeroes/BMP decimal digits and overflow, invalid identifiers/types, duplicate fields. Registry identities, defaults and integer property kinds are imported from both authenticated JARs and must agree. This ports codec behavior over that metadata, not block gameplay. Native warning text, arbitrary malformed JSON/unpaired surrogate text, registry lifecycle/ownership and full material-rule codecs remain pending." +} diff --git a/crates/horizon-assets/Cargo.toml b/crates/horizon-assets/Cargo.toml index a530f5baf..56d71bd60 100644 --- a/crates/horizon-assets/Cargo.toml +++ b/crates/horizon-assets/Cargo.toml @@ -7,5 +7,6 @@ rust-version.workspace = true description = "Horizon version-specific model and resource decoding" [dependencies] +horizon-core = { path = "../horizon-core" } serde = "1.0.229" serde_json = { version = "1.0.151", features = ["raw_value"] } diff --git a/crates/horizon-assets/examples/blockstate_binding_fixture.rs b/crates/horizon-assets/examples/blockstate_binding_fixture.rs new file mode 100644 index 000000000..c69884a5c --- /dev/null +++ b/crates/horizon-assets/examples/blockstate_binding_fixture.rs @@ -0,0 +1,60 @@ +use horizon_assets::blockstate::{ + BlockStateDefinition, + bind::{Properties, PropertySchema, PropertyValues, SelectedModels}, +}; +use serde_json::{Value, json}; +use std::{ + collections::BTreeMap, + fs::File, + io::{BufRead, BufReader, BufWriter, Write}, +}; +fn main() -> Result<(), Box> { + let args: Vec<_> = std::env::args().collect(); + let facts: BTreeMap = serde_json::from_reader(File::open(&args[3])?)?; + let blocks: BTreeMap<_, _> = facts + .iter() + .map(|(key, value)| { + let schema: PropertySchema = value["schema"] + .as_object() + .unwrap() + .iter() + .map(|(key, value)| { + let values = if let Some(range) = value.get("integer") { + PropertyValues::Integer { + minimum: range[0].as_i64().unwrap() as i32, + maximum: range[1].as_i64().unwrap() as i32, + } + } else { + PropertyValues::Named( + value["named"] + .as_array() + .unwrap() + .iter() + .map(|v| v.as_str().unwrap().to_owned()) + .collect(), + ) + }; + (key.clone(), values) + }) + .collect(); + let states: Vec = serde_json::from_value(value["states"].clone()).unwrap(); + (key, (schema, states)) + }) + .collect(); + let input = BufReader::new(File::open(&args[1])?); + let mut output = BufWriter::new(File::create(&args[2])?); + for line in input.lines() { + let row: Value = serde_json::from_str(&line?)?; + let (schema, states) = &blocks[&row["block"].as_str().unwrap().to_owned()]; + let value = BlockStateDefinition::from_json(row["json"].as_str().unwrap()) + .and_then(|v| v.bind(schema, states)); + let result = match value { + Ok(selected) => { + json!({"name":row["name"],"selected":selected.iter().map(|s| match s {None=>Value::Null,Some(SelectedModels::Variant(index))=>json!({"variant":index}),Some(SelectedModels::Multipart(indices))=>json!({"multipart":indices})}).collect::>()}) + } + Err(_) => json!({"name":row["name"],"error":true}), + }; + writeln!(output, "{result}")?; + } + Ok(()) +} diff --git a/crates/horizon-assets/src/blockstate.rs b/crates/horizon-assets/src/blockstate.rs index 7113e60af..71ceed08e 100644 --- a/crates/horizon-assets/src/blockstate.rs +++ b/crates/horizon-assets/src/blockstate.rs @@ -1,4 +1,5 @@ //! Pinned blockstate resource definitions, before registry binding and baking. +pub mod bind; use crate::json::*; use serde::{ Deserializer, diff --git a/crates/horizon-assets/src/blockstate/bind.rs b/crates/horizon-assets/src/blockstate/bind.rs new file mode 100644 index 000000000..a55245c11 --- /dev/null +++ b/crates/horizon-assets/src/blockstate/bind.rs @@ -0,0 +1,160 @@ +//! Bind resource selectors to a block's property schema and ordered states. +use super::{BlockStateDefinition, Condition, Term}; +use crate::json::{Result, error}; +use horizon_core::text::parse_java_integer; +use std::collections::{BTreeMap, BTreeSet}; + +pub type Properties = BTreeMap; +pub type PropertySchema = BTreeMap; +#[derive(Clone, Debug)] +pub enum PropertyValues { + Named(BTreeSet), + Integer { minimum: i32, maximum: i32 }, +} +impl PropertyValues { + fn parse(&self, text: &str) -> Option { + match self { + Self::Named(values) => values.contains(text).then(|| text.to_owned()), + Self::Integer { minimum, maximum } => { + let value = parse_java_integer(text)?; + (value >= *minimum && value <= *maximum).then(|| value.to_string()) + } + } + } +} +/// Indices into the original definition. An empty multipart selection is distinct +/// from an absent root: the native root exists but contributes no model parts. +#[derive(Clone, Debug, PartialEq, Eq)] +pub enum SelectedModels { + Variant(usize), + Multipart(Vec), +} +#[derive(Clone, Debug)] +enum BoundCondition { + Or(Vec), + And(Vec), + Properties(BTreeMap>), +} +impl BoundCondition { + fn bind(value: &Condition, schema: &PropertySchema) -> Result { + Ok(match value { + Condition::Or(values) => Self::Or( + values + .iter() + .map(|v| Self::bind(v, schema)) + .collect::>()?, + ), + Condition::And(values) => Self::And( + values + .iter() + .map(|v| Self::bind(v, schema)) + .collect::>()?, + ), + Condition::Properties(values) => Self::Properties( + values + .iter() + .map(|(key, terms)| { + let domain = schema + .get(key) + .ok_or_else(|| error("unknown multipart property"))?; + let terms = terms + .iter() + .map(|t| { + Ok(Term { + value: domain + .parse(&t.value) + .ok_or_else(|| error("unknown multipart property value"))?, + negated: t.negated, + }) + }) + .collect::>()?; + Ok((key.clone(), terms)) + }) + .collect::>()?, + ), + }) + } + fn matches(&self, state: &Properties) -> bool { + match self { + Self::Or(values) => values.iter().any(|v| v.matches(state)), + Self::And(values) => values.iter().all(|v| v.matches(state)), + Self::Properties(values) => values.iter().all(|(key, terms)| { + state + .get(key) + .is_some_and(|value| terms.iter().any(|t| (value == &t.value) ^ t.negated)) + }), + } + } +} +fn variant_predicate(text: &str, schema: &PropertySchema) -> Result { + let mut result = Properties::new(); + for clause in text.split(',') { + let (key, value) = clause + .split_once('=') + .map_or((clause, None), |(k, v)| (k, Some(v))); + if let (Some(domain), Some(value)) = (schema.get(key), value) { + result.insert( + key.to_owned(), + domain + .parse(value) + .ok_or_else(|| error("unknown variant property value"))?, + ); + } else if !key.is_empty() { + return Err(error("unknown or incomplete variant property")); + } + } + Ok(result) +} +impl BlockStateDefinition { + /// `states` must be the block's canonical possible states in native order. + /// Invalid variant selectors are skipped. On overlapping selectors, vanilla + /// replaces the first overlapping state before aborting that selector's walk. + /// Multipart predicates bind eagerly, even when variants cover every state. + pub fn bind( + &self, + schema: &PropertySchema, + states: &[Properties], + ) -> Result>> { + let mut result = vec![None; states.len()]; + if let Some(variants) = &self.variants { + for (index, (key, _)) in variants.iter().enumerate() { + let Ok(predicate) = variant_predicate(key, schema) else { + continue; + }; + for (target, state) in result.iter_mut().zip(states) { + if predicate + .iter() + .all(|(key, value)| state.get(key) == Some(value)) + && target.replace(SelectedModels::Variant(index)).is_some() + { + break; + } + } + } + } + if let Some(selectors) = &self.multipart { + let predicates = selectors + .iter() + .map(|s| { + s.condition + .as_ref() + .map(|v| BoundCondition::bind(v, schema)) + .transpose() + }) + .collect::>>()?; + for (target, state) in result.iter_mut().zip(states) { + if target.is_none() { + let selected = predicates + .iter() + .enumerate() + .filter_map(|(index, p)| { + p.as_ref().is_none_or(|p| p.matches(state)).then_some(index) + }) + .collect(); + *target = Some(SelectedModels::Multipart(selected)); + } + } + } + Ok(result) + } +} diff --git a/crates/horizon-core/src/lib.rs b/crates/horizon-core/src/lib.rs index 19c75bc60..01af3f932 100644 --- a/crates/horizon-core/src/lib.rs +++ b/crates/horizon-core/src/lib.rs @@ -12,6 +12,7 @@ pub mod noise; pub mod position; pub mod random; pub mod storage; +pub mod text; pub mod ticks; pub const VANILLA_VERSION: &str = "26.3"; diff --git a/crates/horizon-core/src/text.rs b/crates/horizon-core/src/text.rs new file mode 100644 index 000000000..f6333826f --- /dev/null +++ b/crates/horizon-core/src/text.rs @@ -0,0 +1,33 @@ +//! Java text conversions shared by registry and client resource binding. + +/// JDK 25 Integer.parseInt decimal semantics, including BMP decimal digits. +pub fn parse_java_integer(text: &str) -> Option { + let (negative, text) = if let Some(text) = text.strip_prefix('-') { + (true, text) + } else { + (false, text.strip_prefix('+').unwrap_or(text)) + }; + if text.is_empty() { + return None; + } + // BMP decimal digit runs accepted by Character.digit(char, 10) in JDK 25. + const ZEROES: [u32; 37] = [ + 0x30, 0x660, 0x6f0, 0x7c0, 0x966, 0x9e6, 0xa66, 0xae6, 0xb66, 0xbe6, 0xc66, 0xce6, 0xd66, + 0xde6, 0xe50, 0xed0, 0xf20, 0x1040, 0x1090, 0x17e0, 0x1810, 0x1946, 0x19d0, 0x1a80, 0x1a90, + 0x1b50, 0x1bb0, 0x1c40, 0x1c50, 0xa620, 0xa8d0, 0xa900, 0xa9d0, 0xa9f0, 0xaa50, 0xabf0, + 0xff10, + ]; + let mut value = 0i64; + for c in text.chars() { + let c = c as u32; + let zero = ZEROES + .iter() + .copied() + .find(|zero| c >= *zero && c < *zero + 10)?; + value = value * 10 + i64::from(c - zero); + if value > i64::from(i32::MAX) + i64::from(negative) { + return None; + } + } + Some(if negative { -value } else { value } as i32) +} diff --git a/crates/horizon-world/src/registry/json.rs b/crates/horizon-world/src/registry/json.rs index 63aba578d..21bbba562 100644 --- a/crates/horizon-world/src/registry/json.rs +++ b/crates/horizon-world/src/registry/json.rs @@ -103,33 +103,4 @@ impl<'a> BlockStateJsonCodec<'a> { } } -pub(crate) fn java_integer(text: &str) -> Option { - let (negative, text) = if let Some(text) = text.strip_prefix('-') { - (true, text) - } else { - (false, text.strip_prefix('+').unwrap_or(text)) - }; - if text.is_empty() { - return None; - } - // BMP decimal digit runs accepted by Character.digit(char, 10) in JDK 25. - const ZEROES: [u32; 37] = [ - 0x30, 0x660, 0x6f0, 0x7c0, 0x966, 0x9e6, 0xa66, 0xae6, 0xb66, 0xbe6, 0xc66, 0xce6, 0xd66, - 0xde6, 0xe50, 0xed0, 0xf20, 0x1040, 0x1090, 0x17e0, 0x1810, 0x1946, 0x19d0, 0x1a80, 0x1a90, - 0x1b50, 0x1bb0, 0x1c40, 0x1c50, 0xa620, 0xa8d0, 0xa900, 0xa9d0, 0xa9f0, 0xaa50, 0xabf0, - 0xff10, - ]; - let mut value = 0i64; - for c in text.chars() { - let c = c as u32; - let zero = ZEROES - .iter() - .copied() - .find(|zero| c >= *zero && c < *zero + 10)?; - value = value * 10 + i64::from(c - zero); - if value > i64::from(i32::MAX) + i64::from(negative) { - return None; - } - } - Some(if negative { -value } else { value } as i32) -} +pub(crate) use horizon_core::text::parse_java_integer as java_integer; diff --git a/docs/native-client.md b/docs/native-client.md index 873f83e40..4c408ce34 100644 --- a/docs/native-client.md +++ b/docs/native-client.md @@ -136,13 +136,31 @@ covers all 1,288 bundled definitions and 1,351 synthetic cases (2,639 total, `BlockStateModelDispatcher.CODEC` as the pinned loader. The Rust representation preserves single versus weighted variants, all three quarter-turn axes, UV-lock flags, positive weights and total-weight limits, ordered selectors, nested -AND/OR conditions and per-term negation. Registry binding, property selection, -random draw consumption and transformed baking remain separate work. +AND/OR conditions and per-term negation. Random draw consumption and transformed +baking remain separate work. ```sh python3 tools/test_blockstate_model_parity.py ``` +Property binding now selects variant roots or multipart part indices for an +ordered native state list. The [binding comparison](../benchmarks/rust-blockstate-model-binding-2026-10-06/scoped-parity.json) +covers all 1,288 bundled definitions against 35,723 registered block states plus +the four special item-frame states, followed by synthetic overlap, malformed +selector and predicate cases: 3,802 definitions and 687,466 state results match, +with 220 expected binding errors. It checks the native replacement-before-abort +behavior for overlapping variants, eager multipart validation even when variants +cover every state, integer-property aliases, nested conditions and empty part +selections. The actual renderer has not yet adopted these selections. + +The Java integer-property parser is shared by `horizon-core`, client binding and +world-state decoding. Its [codec regression](../benchmarks/rust-blockstate-model-binding-2026-10-06/shared-integer-codec.json) +matches 221,261 output lines against each authenticated client/server JAR. + +```sh +python3 tools/test_blockstate_binding_parity.py +``` + The sprite animation module reproduces the pinned metadata codec's integer conversion, strict primitive types, optional null fields and frame dimensions. It preserves repeated frames, filters out-of-image frame indices, and treats diff --git a/docs/rust-parity.md b/docs/rust-parity.md index 307398184..d0e66a89b 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -21,7 +21,9 @@ also include parent/texture resolution over 5,648 roots and cuboid baking over 7,100 roots with identity blockstate transforms. Blockstate selection, transformed models and UV locking remain unfinished. Blockstate resource decoding now matches all 1,288 bundled definitions and 1,351 synthetic cases; registry -binding and model selection are not yet connected to the renderer. The native renderer now draws an +binding now also matches native selection across registered and special +item-frame states. Weighted random selection, transformed baking and renderer +integration remain unfinished. The native renderer now draws an inspection gallery from the decoded/resolved/baked models, including binary cutouts and stepped lantern animation; these are not yet gameplay blocks. Animation metadata, frame sequences and tick-state selection now have native diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateBindingOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateBindingOracle.java new file mode 100644 index 000000000..ff391053a --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateBindingOracle.java @@ -0,0 +1,90 @@ +package dev.horizonlab.parity; + +import com.google.gson.*; +import com.mojang.serialization.JsonOps; +import java.nio.file.*; +import java.util.*; +import net.minecraft.client.renderer.block.dispatch.*; +import net.minecraft.client.renderer.block.dispatch.multipart.MultiPartModel; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.resources.Identifier; +import net.minecraft.client.resources.model.BlockStateDefinitions; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.Property; +import net.minecraft.util.StrictJsonParser; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.IntegerProperty; +import static dev.horizonlab.parity.VanillaCuboidModelOracle.map; + +/** Native registry binding and multipart visual-equality selection, without a GPU. */ +public final class VanillaBlockStateBindingOracle { + private static java.util.function.Function> mapper; + private static final Gson JSON = new GsonBuilder().serializeNulls().create(); + private static Object field(Object value,String name) throws Exception { + var f=value.getClass().getDeclaredField(name);f.setAccessible(true);return f.get(value); + } + private static void export(Path path) throws Exception { + var blocks=new TreeMap(); + var ids=new TreeSet<>(BuiltInRegistries.BLOCK.keySet()); + ids.add(Identifier.parse("minecraft:item_frame"));ids.add(Identifier.parse("minecraft:glow_item_frame")); + for(var id:ids) { + var definition=Objects.requireNonNull(mapper.apply(id)); + var schema=new TreeMap(); + for(var property:definition.getProperties()) { + if(property instanceof IntegerProperty integer) { + var values=integer.getPossibleValues();schema.put(property.getName(),map("integer",new int[]{Collections.min(values),Collections.max(values)})); + } else { + var values=values(property); + schema.put(property.getName(),map("named",values)); + } + } + var states=new ArrayList(); + for(var state:definition.getPossibleStates()) { + var properties=new TreeMap(); + for(var property:definition.getProperties())properties.put(property.getName(),value(state,property)); + states.add(properties); + } + blocks.put(id.toString(),map("schema",schema,"states",states)); + } + Files.writeString(path,JSON.toJson(blocks)); + } + private static > Set values(Property property) { + var values=new TreeSet();for(var value:property.getPossibleValues())values.add(property.getName(value));return values; + } + private static > String value(BlockState state,Property property) {return property.getName(state.getValue(property));} + private static Object bind(JsonObject row) throws Exception { + var states=Objects.requireNonNull(mapper.apply(Identifier.parse(row.get("block").getAsString()))); + var definition=BlockStateModelDispatcher.CODEC.parse(JsonOps.INSTANCE,StrictJsonParser.parse(row.get("json").getAsString())).getOrThrow(); + var roots=definition.instantiate(states,()->"horizon:binding_probe"); + var indices=new IdentityHashMap(); + definition.simpleModels().ifPresent(m->{int index=0;for(var value:m.models().values())indices.put(value,index++);}); + var selected=new ArrayList(); + for(var state:states.getPossibleStates()) { + var root=roots.get(state); + if(root==null) {selected.add(null);continue;} + if(root instanceof BlockStateModel.SimpleCachedUnbakedRoot) { + var index=indices.get(field(root,"contents"));if(index==null)throw new AssertionError("unrecognized simple root"); + selected.add(map("variant",index)); + } else if(root instanceof MultiPartModel.Unbaked) { + var group=root.visualEqualityGroup(state);Object parts=null; + for(var f:group.getClass().getDeclaredFields())if(it.unimi.dsi.fastutil.ints.IntList.class.isAssignableFrom(f.getType())) {f.setAccessible(true);parts=f.get(group);} + if(parts==null)throw new AssertionError("unrecognized multipart group"); + selected.add(map("multipart",parts)); + } else throw new AssertionError("unrecognized root "+root.getClass()); + } + return selected; + } + public static void main(String[] args) throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();mapper=BlockStateDefinitions.definitionLocationToBlockStateMapper(); + if(args[0].equals("export")){export(Path.of(args[1]));return;} + try(var input=Files.newBufferedReader(Path.of(args[0]));var output=Files.newBufferedWriter(Path.of(args[1]))) { + for(String line;(line=input.readLine())!=null;) { + var row=JsonParser.parseString(line).getAsJsonObject();Object result; + try {result=map("name",row.get("name").getAsString(),"selected",bind(row));} + catch(RuntimeException error) {result=map("name",row.get("name").getAsString(),"error",true);} + output.write(JSON.toJson(result));output.newLine(); + } + } + } +} diff --git a/tools/test_blockstate_binding_parity.py b/tools/test_blockstate_binding_parity.py new file mode 100644 index 000000000..16ca50ff8 --- /dev/null +++ b/tools/test_blockstate_binding_parity.py @@ -0,0 +1,86 @@ +#!/usr/bin/env python3 +"""Compare blockstate selector binding and multipart parts over the native registry.""" +import json +import os +from pathlib import Path +import platform +import random +import subprocess +import zipfile +try: + from . import lab, test_rust_parity as base, test_cuboid_model_parity as decoding +except ImportError: + import lab, test_rust_parity as base, test_cuboid_model_parity as decoding + + +def corpus(facts): + def variant(i):return {'model':f'horizon:probe_{i}'} + names=['stone','water','oak_stairs','oak_fence','oak_log','oak_door','redstone_wire','item_frame','glow_item_frame'] + for name in names: + block='minecraft:'+name;schema=facts[block]['schema'] + def row(value):return {'block':block,'json':json.dumps(value)} + keys=['',',','=','==','=x','unknown','unknown=x'] + for key,domain in schema.items(): + values=[str(domain['integer'][0]),str(domain['integer'][1])] if 'integer' in domain else domain['named'] + for value in values: + selector=key+'='+value;keys.extend([selector,selector+',',','+selector,selector+','+selector]) + keys.extend([key,key+'=',key+'=unknown',key+'=true=false',key+'= '+values[0],key+'='+values[0]+','+key+'='+values[-1]]) + for key in keys: + yield row({'variants':{key:variant(0)}}) + yield row({'variants':{'':variant(0),key:variant(1)},'multipart':[{'apply':variant(2)}]}) + yield row({'variants':{key:variant(0),'':variant(1)}}) + conditions=[None,{'OR':[]},{'AND':[]},{'unknown':'x'},{'OR':[{'AND':[]},{'unknown':'x'}]},{'AND':[{'OR':[]},{'unknown':'x'}]}] + for key,domain in schema.items(): + values=[str(domain['integer'][0]),str(domain['integer'][1])] if 'integer' in domain else domain['named'] + terms=['unknown',values[0],'!'+values[0],values[0]+'|'+values[-1],'!'+values[0]+'|'+values[-1],values[0]+'|unknown',values[0]+'|!'+values[0]+'|unknown'] + if 'integer' in domain:terms+=['+0','-0','00','+01','-01','1.0','1e0','2147483648','-2147483649','9'*80,'0'*80+'1','\u0661','\uff11','\U0001d7d9'] + for term in terms: + conditions.append({key:term}) + yield row({'variants':{key+'='+term:variant(0)}}) + for condition in conditions: + parts=[{'when':condition,'apply':variant(0)},{'apply':variant(1)}] + yield row({'multipart':parts}) + yield row({'variants':{'':variant(2)},'multipart':parts}) + rng=random.Random(name) + valid=[k for k in keys if k and 'unknown' not in k] + for _ in range(60): + chosen=rng.sample(valid,min(len(valid),rng.randrange(1,8))) + yield row({'variants':{k:variant(i) for i,k in enumerate(chosen)},'multipart':[{'apply':variant(9)}]}) + + +def main(): + lock,jars,libraries=base.verify_artifacts();build=lab.LOCAL/'rust-blockstate-binding-parity';build.mkdir(parents=True,exist_ok=True);report_path=build/'report.json';report_path.unlink(missing_ok=True) + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateBindingOracle.java';helper=oracle.with_name('VanillaCuboidModelOracle.java');crate=lab.ROOT/'crates/horizon-assets' + sources=[oracle,helper,Path(__file__),lab.ROOT/'tools/test_cuboid_model_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',crate/'Cargo.toml',lab.ROOT/'crates/horizon-core/Cargo.toml',*sorted(crate.rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs'))] + tested=base.source_hashes(sources);classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w') as log:subprocess.run(list(map(str,command)),cwd=lab.ROOT,check=True,timeout=3600,stdout=log,stderr=subprocess.STDOUT) + dependencies=os.pathsep.join(map(str,[jars['client'],*libraries]));classpath=str(classes)+os.pathsep+dependencies + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',dependencies,'-d',classes,oracle,helper],'compile-java') + facts_path=build/'registry.json';run(['java','-Xmx512M','-cp',classpath,'dev.horizonlab.parity.VanillaBlockStateBindingOracle','export',facts_path],'export');facts=json.loads(facts_path.read_text()) + rows=[];unbound=[] + with zipfile.ZipFile(jars['client']) as archive: + names=sorted(n for n in archive.namelist() if n.startswith('assets/minecraft/blockstates/') and n.endswith('.json')) + for name in names: + block='minecraft:'+name.removeprefix('assets/minecraft/blockstates/').removesuffix('.json') + if block not in facts:unbound.append(name);continue + rows.append({'name':name,'block':block,'json':archive.read(name).decode()}) + resources=len(rows) + assert not unbound, 'Bundled blockstate lacks native state definition' + assert len(facts)==1288 and sum(len(v['states']) for v in facts.values())==35727, 'Incomplete state definitions' + for i,row in enumerate(corpus(facts)):rows.append(dict(name=f'synthetic/{i}',**row)) + inputs=build/'inputs.jsonl';inputs.write_text(''.join(json.dumps(row)+'\n' for row in rows));fixtures=base.source_hashes([inputs,facts_path]) + run(['cargo','build','--locked','-p','horizon-assets','--example','blockstate_binding_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--locked','--no-deps','--format-version','1'],cwd=lab.ROOT));binary=Path(metadata['target_directory'])/'debug/examples'/('blockstate_binding_fixture.exe' if os.name=='nt' else 'blockstate_binding_fixture') + run([binary,inputs,build/'rust.jsonl',facts_path],'rust');run(['java','-Xmx512M','-cp',classpath,'dev.horizonlab.parity.VanillaBlockStateBindingOracle',inputs,build/'client.jsonl'],'client') + rejected=decoding.canonicalize(build/'client.jsonl');decoding.canonicalize(build/'rust.jsonl');native=[json.loads(line) for line in (build/'client.jsonl').read_text().splitlines()];rust=[json.loads(line) for line in (build/'rust.jsonl').read_text().splitlines()] + for left,right in zip(native,rust,strict=True): + if left!=right:raise AssertionError('Blockstate binding mismatch: '+left['name']) + matched=base.compare(build/'client.jsonl',build/'rust.jsonl');assert all('error' not in row for row in native[:resources]),'Bundled blockstate rejected' + base.ensure_sources_unchanged(sources,tested);base.ensure_sources_unchanged([inputs,facts_path],fixtures) + states=sum(len(row.get('selected',[])) for row in native) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'resource_blockstates':resources,'unbound_resource_names':unbound,'state_definitions':len(facts),'definition_states':sum(len(v['states']) for v in facts.values()),'definitions':len(rows),'selected_state_results':states,'rejected':rejected,'sources_sha256':tested,'fixtures_sha256':fixtures,'rust_output_sha256':lab.digest(build/'rust.jsonl','sha256'),'references':[{'side':'client','jar_sha256':lab.digest(jars['client'],'sha256'),'output_sha256':lab.digest(build/'client.jsonl','sha256'),'matched_output_lines':matched}],'scope':'Actual BlockStateModelDispatcher.instantiate and MultiPartModel visual-equality selection on every bundled blockstate definition, including the native fake item-frame definitions, and its native ordered possible states. Synthetic malformed selectors, overlapping recovery, eager multipart errors, per-term negation, combined predicates, integer-property conversion and partial coverage. Property schema and state order are exported from the authenticated client. No weighted random selection, transformed baking, renderer integration or gameplay parity claim.'} + lab.write_json(report_path,report);print(f'Native blockstate binding: {matched:,} definitions / {states:,} state results match ({rejected:,} rejected); {report_path}',flush=True) + + +if __name__=='__main__':main() From f286aa24e1cd03722d7a873b5c3e0085a9ee91e9 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 21:31:55 +0200 Subject: [PATCH 052/253] Match weighted model choice and multipart random consumption --- .../scoped-parity.json | 112 +++++++++++++++++ .../examples/model_choice_fixture.rs | 97 +++++++++++++++ crates/horizon-assets/src/blockstate.rs | 1 + .../horizon-assets/src/blockstate/choice.rs | 115 ++++++++++++++++++ docs/native-client.md | 18 ++- docs/rust-parity.md | 5 +- .../parity/VanillaModelChoiceOracle.java | 65 ++++++++++ tools/test_model_choice_parity.py | 59 +++++++++ 8 files changed, 468 insertions(+), 4 deletions(-) create mode 100644 benchmarks/rust-blockstate-model-choice-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-assets/examples/model_choice_fixture.rs create mode 100644 crates/horizon-assets/src/blockstate/choice.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaModelChoiceOracle.java create mode 100644 tools/test_model_choice_parity.py diff --git a/benchmarks/rust-blockstate-model-choice-2026-10-06/scoped-parity.json b/benchmarks/rust-blockstate-model-choice-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..c54cba2a8 --- /dev/null +++ b/benchmarks/rust-blockstate-model-choice-2026-10-06/scoped-parity.json @@ -0,0 +1,112 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "bundled_weight_vectors": 7, + "fixtures": 6960, + "collections": 111360, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaModelChoiceOracle.java": "2fa964aab1b822e1d61a856cdbe89075c390c68e0ededdd5f1dd65cf9759f27b", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCuboidModelOracle.java": "7526f20513c549483122ab0d5ad24b9e87f38dc2f6aae55addd701a91ac85e43", + "tools/test_model_choice_parity.py": "ea7d35684dc62fad4a6a3990e116d224059172021f62723b1e73b18e0232d966", + "tools/test_model_baking_parity.py": "392ffec44918fb91740ca4a1316d684480d39f14bd34d46175f7f44946d15bd7", + "tools/test_cuboid_model_parity.py": "4a8b1cdcac335751c23413341ae939eea1c49c38d33d70d0708b8904ab8d0461", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-assets/Cargo.toml": "2f2cffacec0b4e22dd7cb032d594289bc51c94ae6cc4e985fee3e310f441d751", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-assets/examples/blockstate_binding_fixture.rs": "e58fdb432f6bfc1e400729baa9b48d4f00955b3143b98b52506b47dd8b065cf8", + "crates/horizon-assets/examples/blockstate_model_fixture.rs": "8f063322e57abdf9361a5a3a3badce2a7e727ee6d5e3947071cb448dfb38e8fd", + "crates/horizon-assets/examples/cuboid_model_fixture.rs": "97609d90e3f6ce340f3590296db2dc778113bb2b33c7d1b54080a1d6f3023f40", + "crates/horizon-assets/examples/model_baking_fixture.rs": "59caca09dd5afd0b70a2e8fdb8e949deb9322f00adc617918b33d1e7e5b0b522", + "crates/horizon-assets/examples/model_choice_fixture.rs": "a4c8a46501d2b5ae7051f10f2307ade048e96c2d330af51cd2431bb44977a99a", + "crates/horizon-assets/examples/model_resolution_fixture.rs": "c071067140299e49345a6ebd94e15b3b6d853cb9ae11d8de46e3cbdfb8b01f0e", + "crates/horizon-assets/examples/sprite_animation_fixture.rs": "254314d52deda129ab461221d3d8b95323a60730d374e566c1cd599fba85f072", + "crates/horizon-assets/examples/support/mod.rs": "bcf5a6d8a54845982191e037911c24139237771d6afa4b01b1e83c011489c3f5", + "crates/horizon-assets/src/animation.rs": "ebbf7952146a0e66b41396174492f5702627170b03a57e6cd5a45c97a08c975e", + "crates/horizon-assets/src/bake.rs": "0bc519e93ad8200d89543ceb5c811dd82bbeb0e9003b143385c8a03e758dfe65", + "crates/horizon-assets/src/blockstate/bind.rs": "6278962e55c9786bba8184bdf2939af9c6e3b9002b08c3022129964b49a60009", + "crates/horizon-assets/src/blockstate/choice.rs": "5a66c8b9833e2f19dd8b0773f3593d97ff5941d3c5b773896b98049efa1395ba", + "crates/horizon-assets/src/blockstate.rs": "a4299dfd7adaeb4173982ffaa8e9c9eda2925739ae579a714193c99da2e7ce56", + "crates/horizon-assets/src/json.rs": "99fe8af4fbf5d4eed408a92e829ac1a39597a0d92471a6bff73771fad9c830a8", + "crates/horizon-assets/src/lib.rs": "e39f21c59a2c3e1c53d977b29bd5e0638e5fc41d86ff0fcc1882a6d90fd961e4", + "crates/horizon-assets/src/model.rs": "57ddb3d65e88e7a8aa22c62bc298a2dae7f4e994326a873a31f06c0f36ed051b", + "crates/horizon-assets/src/resolve.rs": "3927ac926cdcbd7d334901cc32d0ecc1e498b1bec98f76a46bca6d4964c13541", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb" + }, + "fixtures_sha256": { + ".local/rust-model-choice-parity/inputs.jsonl": "493a8bbd1f9b837401d4ed89df530af253163ed4fc90270fefa3b7d1c9f25c10" + }, + "rust_output_sha256": "d5bb4226fa3f927e4d3dfda4b6cb6746018d7443d2965e3c921693dbdfd31262", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "d5bb4226fa3f927e4d3dfda4b6cb6746018d7443d2965e3c921693dbdfd31262", + "matched_output_lines": 6960 + } + ], + "scope": "Actual WeightedVariants.collectParts and MultiPartModel.collectParts with inert observable leaf models and preselected boolean conditions. Every distinct bundled blockstate weight vector plus synthetic singletons, large totals, empty/partial multipart subsets and random graphs. Legacy and xoroshiro streams, six seeds per graph, repeated collection and subsequent nextLong/nextInt verify model choice and draw consumption. No actual model baking, material evaluation, transformed quads, renderer integration or gameplay parity claim." +} diff --git a/crates/horizon-assets/examples/model_choice_fixture.rs b/crates/horizon-assets/examples/model_choice_fixture.rs new file mode 100644 index 000000000..1bd3aea8b --- /dev/null +++ b/crates/horizon-assets/examples/model_choice_fixture.rs @@ -0,0 +1,97 @@ +use horizon_assets::blockstate::{ + BlockStateDefinition, Selector, Variant, VariantSet, bind::SelectedModels, + choice::CompiledChoices, +}; +use horizon_core::random::{LegacyRandom, RandomSource, XoroshiroRandom}; +use serde_json::{Value, json}; +use std::{ + fs::File, + io::{BufRead, BufReader, BufWriter, Write}, +}; +fn choice(value: &Value, index: usize) -> VariantSet { + let variant = |suffix| Variant { + model: format!("horizon:part{index}_{suffix}"), + rotations: [0; 3], + uv_lock: false, + }; + if value.is_null() { + VariantSet::Single(variant("single".to_owned())) + } else { + VariantSet::Weighted( + value + .as_array() + .unwrap() + .iter() + .enumerate() + .map(|(i, w)| (variant(format!("variant{i}")), w.as_i64().unwrap() as i32)) + .collect(), + ) + } +} +fn trace( + mut random: impl RandomSource, + compiled: &CompiledChoices, + selected: &SelectedModels, + repeats: u64, +) -> Result> { + let mut result = Vec::new(); + let mut output = Vec::new(); + for _ in 0..repeats { + output.clear(); + compiled.collect(selected, &mut random, &mut output)?; + result.push(json!({"models":output.iter().map(|v|&v.model).collect::>(),"next_long":random.next_long(),"next_int":random.next_int()})); + } + Ok(json!(result)) +} +fn main() -> Result<(), Box> { + let args: Vec<_> = std::env::args().collect(); + let input = BufReader::new(File::open(&args[1])?); + let mut output = BufWriter::new(File::create(&args[2])?); + for line in input.lines() { + let row: Value = serde_json::from_str(&line?)?; + let parts = row["parts"].as_array().unwrap(); + let (definition, selected) = if row["multipart"].as_bool().unwrap() { + ( + BlockStateDefinition { + variants: None, + multipart: Some( + parts + .iter() + .enumerate() + .map(|(i, v)| Selector { + condition: None, + variant: choice(v, i), + }) + .collect(), + ), + }, + SelectedModels::Multipart( + row["selected"] + .as_array() + .unwrap() + .iter() + .map(|v| v.as_u64().unwrap() as usize) + .collect(), + ), + ) + } else { + ( + BlockStateDefinition { + variants: Some(vec![(String::new(), choice(&parts[0], 0))]), + multipart: None, + }, + SelectedModels::Variant(0), + ) + }; + let compiled = CompiledChoices::new(&definition)?; + let seed = row["seed"].as_i64().unwrap(); + let repeats = row["repeats"].as_u64().unwrap(); + let result = if row["random"] == "legacy" { + trace(LegacyRandom::new(seed), &compiled, &selected, repeats)? + } else { + trace(XoroshiroRandom::new(seed), &compiled, &selected, repeats)? + }; + writeln!(output, "{}", json!({"name":row["name"],"trace":result}))?; + } + Ok(()) +} diff --git a/crates/horizon-assets/src/blockstate.rs b/crates/horizon-assets/src/blockstate.rs index 71ceed08e..e482aa66f 100644 --- a/crates/horizon-assets/src/blockstate.rs +++ b/crates/horizon-assets/src/blockstate.rs @@ -1,5 +1,6 @@ //! Pinned blockstate resource definitions, before registry binding and baking. pub mod bind; +pub mod choice; use crate::json::*; use serde::{ Deserializer, diff --git a/crates/horizon-assets/src/blockstate/choice.rs b/crates/horizon-assets/src/blockstate/choice.rs new file mode 100644 index 000000000..93e9a4118 --- /dev/null +++ b/crates/horizon-assets/src/blockstate/choice.rs @@ -0,0 +1,115 @@ +//! Prepared model choices with vanilla random draw consumption. +use super::{BlockStateDefinition, Variant, VariantSet, bind::SelectedModels}; +use crate::json::{Result, error}; +use horizon_core::random::RandomSource; + +#[derive(Clone, Debug)] +enum Choice { + Single(Variant), + Weighted { + variants: Vec, + ends: Vec, + total: i32, + }, +} +impl Choice { + fn new(value: &VariantSet) -> Result { + match value { + VariantSet::Single(value) => Ok(Self::Single(value.clone())), + VariantSet::Weighted(entries) => { + let mut total = 0i32; + let mut ends = Vec::with_capacity(entries.len()); + let mut variants = Vec::with_capacity(entries.len()); + for (variant, weight) in entries { + if *weight <= 0 { + return Err(error("nonpositive model weight")); + } + total = total + .checked_add(*weight) + .ok_or_else(|| error("model weight overflow"))?; + ends.push(total); + variants.push(variant.clone()); + } + if total == 0 { + return Err(error("empty weighted model")); + } + Ok(Self::Weighted { + variants, + ends, + total, + }) + } + } + } + fn select(&self, random: &mut impl RandomSource) -> &Variant { + match self { + Self::Single(value) => value, + Self::Weighted { + variants, + ends, + total, + } => { + // A singleton weighted list still consumes the bounded draw. + let index = random + .next_int_bound(*total) + .expect("validated positive model weight"); + &variants[ends.partition_point(|end| *end <= index)] + } + } + } +} +/// Compile once per definition and share across its bound block states. Prefix +/// sums avoid rebuilding weight totals or scanning all entries during selection. +#[derive(Clone, Debug)] +pub struct CompiledChoices { + variants: Vec, + multipart: Vec, +} +impl CompiledChoices { + pub fn new(definition: &BlockStateDefinition) -> Result { + Ok(Self { + variants: definition + .variants + .iter() + .flatten() + .map(|(_, v)| Choice::new(v)) + .collect::>()?, + multipart: definition + .multipart + .iter() + .flatten() + .map(|s| Choice::new(&s.variant)) + .collect::>()?, + }) + } + /// Append selected variants without allocating intermediate part lists. A + /// multipart root consumes nextLong even for an empty selected subset, then + /// resets the same random source to that seed before each selected part. + pub fn collect<'a>( + &'a self, + selected: &SelectedModels, + random: &mut impl RandomSource, + output: &mut Vec<&'a Variant>, + ) -> Result<()> { + match selected { + SelectedModels::Variant(index) => { + let choice = self + .variants + .get(*index) + .ok_or_else(|| error("invalid variant selection"))?; + output.push(choice.select(random)); + } + SelectedModels::Multipart(indices) => { + if indices.iter().any(|index| *index >= self.multipart.len()) { + return Err(error("invalid multipart selection")); + } + let seed = random.next_long(); + for index in indices { + random.set_seed(seed); + output.push(self.multipart[*index].select(random)); + } + } + } + Ok(()) + } +} diff --git a/docs/native-client.md b/docs/native-client.md index 4c408ce34..b983f8325 100644 --- a/docs/native-client.md +++ b/docs/native-client.md @@ -136,8 +136,7 @@ covers all 1,288 bundled definitions and 1,351 synthetic cases (2,639 total, `BlockStateModelDispatcher.CODEC` as the pinned loader. The Rust representation preserves single versus weighted variants, all three quarter-turn axes, UV-lock flags, positive weights and total-weight limits, ordered selectors, nested -AND/OR conditions and per-term negation. Random draw consumption and transformed -baking remain separate work. +AND/OR conditions and per-term negation. Transformed baking remains separate work. ```sh python3 tools/test_blockstate_model_parity.py @@ -161,6 +160,21 @@ matches 221,261 output lines against each authenticated client/server JAR. python3 tools/test_blockstate_binding_parity.py ``` +`CompiledChoices` prepares cumulative weights once per definition and shares +those choices across bound states. Selecting an ordinary single variant consumes +no random draw; a weighted singleton still does. Multipart collection draws a +seed even for an empty subset and resets the same stream before each chosen +part. The [native choice comparison](../benchmarks/rust-blockstate-model-choice-2026-10-06/scoped-parity.json) +uses actual `WeightedVariants.collectParts` and `MultiPartModel.collectParts` +with inert observable leaves. All seven distinct bundled weight patterns, +synthetic large weights and random multipart graphs produce matching selections +and subsequent random values: 6,960 fixtures, 111,360 collections, both legacy +and xoroshiro streams. This does not yet bake or render the selected models. + +```sh +python3 tools/test_model_choice_parity.py +``` + The sprite animation module reproduces the pinned metadata codec's integer conversion, strict primitive types, optional null fields and frame dimensions. It preserves repeated frames, filters out-of-image frame indices, and treats diff --git a/docs/rust-parity.md b/docs/rust-parity.md index d0e66a89b..eaaa60c95 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -22,8 +22,9 @@ also include parent/texture resolution over 5,648 roots and cuboid baking over models and UV locking remain unfinished. Blockstate resource decoding now matches all 1,288 bundled definitions and 1,351 synthetic cases; registry binding now also matches native selection across registered and special -item-frame states. Weighted random selection, transformed baking and renderer -integration remain unfinished. The native renderer now draws an +item-frame states. Weighted selection and multipart random draw consumption +also match native traces. Transformed baking and renderer integration remain +unfinished. The native renderer now draws an inspection gallery from the decoded/resolved/baked models, including binary cutouts and stepped lantern animation; these are not yet gameplay blocks. Animation metadata, frame sequences and tick-state selection now have native diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaModelChoiceOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaModelChoiceOracle.java new file mode 100644 index 000000000..4cf8cb329 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaModelChoiceOracle.java @@ -0,0 +1,65 @@ +package dev.horizonlab.parity; + +import com.google.gson.*; +import java.nio.file.*; +import java.util.*; +import net.minecraft.client.renderer.block.dispatch.*; +import net.minecraft.client.resources.model.sprite.Material; +import net.minecraft.util.RandomSource; +import net.minecraft.util.random.*; +import net.minecraft.world.level.levelgen.*; +import static dev.horizonlab.parity.VanillaCuboidModelOracle.map; + +/** Real weighted and multipart collectParts, with observable inert leaf models. */ +public final class VanillaModelChoiceOracle { + private static final Gson JSON=new GsonBuilder().serializeNulls().create(); + private record Leaf(String tag,List output) implements BlockStateModel { + public Material.Baked particleMaterial(){return null;} + public int materialFlags(){return 0;} + public void collectParts(RandomSource random,List parts){output.add(tag);} + } + private static BlockStateModel choice(JsonElement value,int index,List output) { + if(value.isJsonNull())return new Leaf("horizon:part"+index+"_single",output); + var list=new ArrayList>();int variant=0; + for(var weight:value.getAsJsonArray())list.add(new Weighted<>(new Leaf("horizon:part"+index+"_variant"+variant++,output),weight.getAsInt())); + return new WeightedVariants(WeightedList.of(list)); + } + private static Object probe(JsonObject row) throws Exception { + var emitted=new ArrayList();var values=row.getAsJsonArray("parts"); + BlockStateModel model; + if(!row.get("multipart").getAsBoolean())model=choice(values.get(0),0,emitted); + else { + var selectors=new ArrayList();var selected=new HashSet(); + for(var i:row.getAsJsonArray("selected"))selected.add(i.getAsInt()); + var selectorType=Class.forName("net.minecraft.client.renderer.block.dispatch.multipart.MultiPartModel$Selector"); + var selectorConstructor=selectorType.getDeclaredConstructors()[0];selectorConstructor.setAccessible(true); + for(int i=0;i predicate=state->enabled; + selectors.add(selectorConstructor.newInstance(predicate,choice(values.get(i),i,emitted))); + } + var sharedType=Class.forName("net.minecraft.client.renderer.block.dispatch.multipart.MultiPartModel$SharedBakedState"); + var sharedConstructor=sharedType.getDeclaredConstructors()[0];sharedConstructor.setAccessible(true); + var shared=sharedConstructor.newInstance(selectors); + var constructor=Class.forName("net.minecraft.client.renderer.block.dispatch.multipart.MultiPartModel").getDeclaredConstructors()[0];constructor.setAccessible(true); + model=(BlockStateModel)constructor.newInstance(shared,null); + } + long seed=row.get("seed").getAsLong(); + RandomSource random=row.get("random").getAsString().equals("legacy")?new LegacyRandomSource(seed):new XoroshiroRandomSource(seed); + var traces=new ArrayList();var parts=new ArrayList(); + for(int i=0;i(emitted),"next_long",random.nextLong(),"next_int",random.nextInt())); + } + return traces; + } + public static void main(String[] args) throws Exception { + net.minecraft.SharedConstants.tryDetectVersion(); + try(var input=Files.newBufferedReader(Path.of(args[0]));var output=Files.newBufferedWriter(Path.of(args[1]))) { + for(String line;(line=input.readLine())!=null;) { + var row=JsonParser.parseString(line).getAsJsonObject(); + output.write(JSON.toJson(map("name",row.get("name").getAsString(),"trace",probe(row))));output.newLine(); + } + } + } +} diff --git a/tools/test_model_choice_parity.py b/tools/test_model_choice_parity.py new file mode 100644 index 000000000..f1ff6637d --- /dev/null +++ b/tools/test_model_choice_parity.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python3 +"""Compare weighted model choice and multipart RNG consumption with the client.""" +import json +import os +from pathlib import Path +import platform +import random +import subprocess +import zipfile +try: + from . import lab, test_rust_parity as base, test_model_baking_parity as baking, test_cuboid_model_parity as decoding +except ImportError: + import lab, test_rust_parity as base, test_model_baking_parity as baking, test_cuboid_model_parity as decoding + + +def corpus(weights): + cases=[] + for vector in [None,*weights,(1,),(3,),(1,1),(1,2,7),(1073741824,1),(2147483646,1),(1,2147483646),tuple(range(1,100))]: + cases.append((False,[vector],[0]));cases.append((True,[vector],[]));cases.append((True,[vector],[0])) + cases.append((True,[vector,vector],[0,1]));cases.append((True,[None,vector,None],[0,1,2])) + rng=random.Random(0x43484f494345) + for _ in range(500): + parts=[None if rng.randrange(3)==0 else [rng.randrange(1,1000) for _ in range(rng.randrange(1,20))] for _ in range(rng.randrange(1,20))] + selected=[i for i in range(len(parts)) if rng.randrange(2)] + cases.append((True,parts,selected)) + for i,(multipart,parts,selected) in enumerate(cases): + for random_kind in ['legacy','xoroshiro']: + for seed in [0,1,-1,-(1<<63),(1<<63)-1,rng.randrange(-(1<<63),1<<63)]: + yield {'name':f'{i}/{random_kind}/{seed}','multipart':multipart,'parts':parts,'selected':selected,'random':random_kind,'seed':seed,'repeats':16} + + +def main(): + lock,jars,_=base.verify_artifacts();build=lab.LOCAL/'rust-model-choice-parity';build.mkdir(parents=True,exist_ok=True);report_path=build/'report.json';report_path.unlink(missing_ok=True) + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaModelChoiceOracle.java';helper=oracle.with_name('VanillaCuboidModelOracle.java');crate=lab.ROOT/'crates/horizon-assets' + sources=[oracle,helper,Path(__file__),lab.ROOT/'tools/test_model_baking_parity.py',lab.ROOT/'tools/test_cuboid_model_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',crate/'Cargo.toml',lab.ROOT/'crates/horizon-core/Cargo.toml',*sorted(crate.rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs'))] + tested=base.source_hashes(sources);weights=set() + with zipfile.ZipFile(jars['client']) as archive: + for name in archive.namelist(): + if not name.startswith('assets/minecraft/blockstates/') or not name.endswith('.json'):continue + root=json.loads(archive.read(name));models=[*root.get('variants',{}).values(),*(s['apply'] for s in root.get('multipart',[]))] + for model in models: + if isinstance(model,list):weights.add(tuple(v.get('weight',1) for v in model)) + rows=list(corpus(sorted(weights)));inputs=build/'inputs.jsonl';inputs.write_text(''.join(json.dumps(row)+'\n' for row in rows));fixtures=base.source_hashes([inputs]);classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w') as log:subprocess.run(list(map(str,command)),cwd=lab.ROOT,check=True,timeout=3600,stdout=log,stderr=subprocess.STDOUT) + dependencies=os.pathsep.join(map(str,[jars['client'],*baking.client_libraries()]));classpath=str(classes)+os.pathsep+dependencies + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',dependencies,'-d',classes,oracle,helper],'compile-java') + run(['cargo','build','--locked','-p','horizon-assets','--example','model_choice_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--locked','--no-deps','--format-version','1'],cwd=lab.ROOT));binary=Path(metadata['target_directory'])/'debug/examples'/('model_choice_fixture.exe' if os.name=='nt' else 'model_choice_fixture') + run([binary,inputs,build/'rust.jsonl'],'rust');run(['java','-Xmx512M','-cp',classpath,'dev.horizonlab.parity.VanillaModelChoiceOracle',inputs,build/'client.jsonl'],'client') + decoding.canonicalize(build/'client.jsonl');decoding.canonicalize(build/'rust.jsonl');native=[json.loads(line) for line in (build/'client.jsonl').read_text().splitlines()];rust=[json.loads(line) for line in (build/'rust.jsonl').read_text().splitlines()] + for left,right in zip(native,rust,strict=True): + if left!=right:raise AssertionError('Model choice mismatch: '+left['name']) + matched=base.compare(build/'client.jsonl',build/'rust.jsonl');base.ensure_sources_unchanged(sources,tested);base.ensure_sources_unchanged([inputs],fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'bundled_weight_vectors':len(weights),'fixtures':len(rows),'collections':sum(r['repeats'] for r in rows),'sources_sha256':tested,'fixtures_sha256':fixtures,'rust_output_sha256':lab.digest(build/'rust.jsonl','sha256'),'references':[{'side':'client','jar_sha256':lab.digest(jars['client'],'sha256'),'output_sha256':lab.digest(build/'client.jsonl','sha256'),'matched_output_lines':matched}],'scope':'Actual WeightedVariants.collectParts and MultiPartModel.collectParts with inert observable leaf models and preselected boolean conditions. Every distinct bundled blockstate weight vector plus synthetic singletons, large totals, empty/partial multipart subsets and random graphs. Legacy and xoroshiro streams, six seeds per graph, repeated collection and subsequent nextLong/nextInt verify model choice and draw consumption. No actual model baking, material evaluation, transformed quads, renderer integration or gameplay parity claim.'} + lab.write_json(report_path,report);print(f'Native model choice: {matched:,} fixtures / {report["collections"]:,} collections match; {report_path}',flush=True) + + +if __name__=='__main__':main() From 90a76bc0aa6a9dbc0263031a1b896e304b4376af Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 21:49:27 +0200 Subject: [PATCH 053/253] Match vanilla blockstate transforms and UV-locked baking --- .../identity-regression.json | 54 ++++ .../scoped-parity.json | 58 +++++ .../examples/model_baking_fixture.rs | 18 +- crates/horizon-assets/src/bake.rs | 36 ++- crates/horizon-assets/src/bake/transform.rs | 243 ++++++++++++++++++ docs/native-client.md | 23 +- docs/rust-parity.md | 8 +- .../parity/VanillaModelBakingOracle.java | 27 +- tools/test_blockstate_transform_parity.py | 96 +++++++ 9 files changed, 538 insertions(+), 25 deletions(-) create mode 100644 benchmarks/rust-blockstate-transforms-2026-10-06/identity-regression.json create mode 100644 benchmarks/rust-blockstate-transforms-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-assets/src/bake/transform.rs create mode 100644 tools/test_blockstate_transform_parity.py diff --git a/benchmarks/rust-blockstate-transforms-2026-10-06/identity-regression.json b/benchmarks/rust-blockstate-transforms-2026-10-06/identity-regression.json new file mode 100644 index 000000000..e68f4cdb2 --- /dev/null +++ b/benchmarks/rust-blockstate-transforms-2026-10-06/identity-regression.json @@ -0,0 +1,54 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "resource_models": 2883, + "graph_fixtures": 440, + "rejected_roots": 1039, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaModelBakingOracle.java": "d05e04d25ed5e5aef260ce21cac627a79bdc5376326a5cb34ffb98462b79c79b", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCuboidModelOracle.java": "7526f20513c549483122ab0d5ad24b9e87f38dc2f6aae55addd701a91ac85e43", + "tools/test_model_baking_parity.py": "392ffec44918fb91740ca4a1316d684480d39f14bd34d46175f7f44946d15bd7", + "tools/test_cuboid_model_parity.py": "4a8b1cdcac335751c23413341ae939eea1c49c38d33d70d0708b8904ab8d0461", + "tools/test_model_resolution_parity.py": "d9595f2f1442f1f590b72d2a46600657e79ae103bec3d4c45db98242b964bde0", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-assets/Cargo.toml": "2f2cffacec0b4e22dd7cb032d594289bc51c94ae6cc4e985fee3e310f441d751", + "crates/horizon-assets/examples/blockstate_binding_fixture.rs": "e58fdb432f6bfc1e400729baa9b48d4f00955b3143b98b52506b47dd8b065cf8", + "crates/horizon-assets/examples/blockstate_model_fixture.rs": "8f063322e57abdf9361a5a3a3badce2a7e727ee6d5e3947071cb448dfb38e8fd", + "crates/horizon-assets/examples/cuboid_model_fixture.rs": "97609d90e3f6ce340f3590296db2dc778113bb2b33c7d1b54080a1d6f3023f40", + "crates/horizon-assets/examples/model_baking_fixture.rs": "a762a8b48f09b5ac5e9c48d4a578b18b700810807fe5d3fc50798365cce1c314", + "crates/horizon-assets/examples/model_choice_fixture.rs": "a4c8a46501d2b5ae7051f10f2307ade048e96c2d330af51cd2431bb44977a99a", + "crates/horizon-assets/examples/model_resolution_fixture.rs": "c071067140299e49345a6ebd94e15b3b6d853cb9ae11d8de46e3cbdfb8b01f0e", + "crates/horizon-assets/examples/sprite_animation_fixture.rs": "254314d52deda129ab461221d3d8b95323a60730d374e566c1cd599fba85f072", + "crates/horizon-assets/examples/support/mod.rs": "bcf5a6d8a54845982191e037911c24139237771d6afa4b01b1e83c011489c3f5", + "crates/horizon-assets/src/animation.rs": "ebbf7952146a0e66b41396174492f5702627170b03a57e6cd5a45c97a08c975e", + "crates/horizon-assets/src/bake/transform.rs": "a95e658fef85b21bcb2f9f7512f98f98d57022d62c1199885b7133beae35a09d", + "crates/horizon-assets/src/bake.rs": "f55dda6b6cee5ac6e65a8ee4837fdd2c6674437d59e59b4c45718f6324d4a4d5", + "crates/horizon-assets/src/blockstate/bind.rs": "6278962e55c9786bba8184bdf2939af9c6e3b9002b08c3022129964b49a60009", + "crates/horizon-assets/src/blockstate/choice.rs": "5a66c8b9833e2f19dd8b0773f3593d97ff5941d3c5b773896b98049efa1395ba", + "crates/horizon-assets/src/blockstate.rs": "a4299dfd7adaeb4173982ffaa8e9c9eda2925739ae579a714193c99da2e7ce56", + "crates/horizon-assets/src/json.rs": "99fe8af4fbf5d4eed408a92e829ac1a39597a0d92471a6bff73771fad9c830a8", + "crates/horizon-assets/src/lib.rs": "e39f21c59a2c3e1c53d977b29bd5e0638e5fc41d86ff0fcc1882a6d90fd961e4", + "crates/horizon-assets/src/model.rs": "57ddb3d65e88e7a8aa22c62bc298a2dae7f4e994326a873a31f06c0f36ed051b", + "crates/horizon-assets/src/resolve.rs": "3927ac926cdcbd7d334901cc32d0ecc1e498b1bec98f76a46bca6d4964c13541" + }, + "fixtures_sha256": { + ".local/rust-model-baking-parity/inputs.jsonl": "aba24d38f4fc1af060502f983923c2f279c016d0fd412d40f6d50093fac1d811" + }, + "rust_output_sha256": "9216be3bbae9e59bb89b6ed780ccedc5608cd4583c8e7527e50b165a0d8d30da", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "9216be3bbae9e59bb89b6ed780ccedc5608cd4583c8e7527e50b165a0d8d30da", + "matched_output_lines": 7100 + } + ], + "scope": "Actual client FaceBakery geometry overload with a real unit-atlas sprite and default JOML math options. Identity blockstate transform, all bundled cuboid geometry and synthetic rotations, rescaling, default/explicit UVs, winding, degenerate and reversed bounds, inherited models and missing materials. Positions, UVs and element matrix coefficients compare by float bits. This does not cover blockstate transforms/UV lock, atlas packing, transparency classification, lighting, GPU rendering or gameplay." +} diff --git a/benchmarks/rust-blockstate-transforms-2026-10-06/scoped-parity.json b/benchmarks/rust-blockstate-transforms-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..8870670e8 --- /dev/null +++ b/benchmarks/rust-blockstate-transforms-2026-10-06/scoped-parity.json @@ -0,0 +1,58 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "resource_definitions": 1288, + "resource_model_transform_pairs": 7884, + "synthetic_models_per_all_128_transforms": 81, + "graph_fixtures": 189, + "rejected_roots": 0, + "baked_quads": 148439, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaModelBakingOracle.java": "d05e04d25ed5e5aef260ce21cac627a79bdc5376326a5cb34ffb98462b79c79b", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCuboidModelOracle.java": "7526f20513c549483122ab0d5ad24b9e87f38dc2f6aae55addd701a91ac85e43", + "tools/test_blockstate_transform_parity.py": "5236987f561763571fd4d7b07c6ff72e5a34a065f8fc936d38189763de38a789", + "tools/test_model_baking_parity.py": "392ffec44918fb91740ca4a1316d684480d39f14bd34d46175f7f44946d15bd7", + "tools/test_cuboid_model_parity.py": "4a8b1cdcac335751c23413341ae939eea1c49c38d33d70d0708b8904ab8d0461", + "tools/test_model_resolution_parity.py": "d9595f2f1442f1f590b72d2a46600657e79ae103bec3d4c45db98242b964bde0", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-assets/Cargo.toml": "2f2cffacec0b4e22dd7cb032d594289bc51c94ae6cc4e985fee3e310f441d751", + "crates/horizon-assets/examples/blockstate_binding_fixture.rs": "e58fdb432f6bfc1e400729baa9b48d4f00955b3143b98b52506b47dd8b065cf8", + "crates/horizon-assets/examples/blockstate_model_fixture.rs": "8f063322e57abdf9361a5a3a3badce2a7e727ee6d5e3947071cb448dfb38e8fd", + "crates/horizon-assets/examples/cuboid_model_fixture.rs": "97609d90e3f6ce340f3590296db2dc778113bb2b33c7d1b54080a1d6f3023f40", + "crates/horizon-assets/examples/model_baking_fixture.rs": "a762a8b48f09b5ac5e9c48d4a578b18b700810807fe5d3fc50798365cce1c314", + "crates/horizon-assets/examples/model_choice_fixture.rs": "a4c8a46501d2b5ae7051f10f2307ade048e96c2d330af51cd2431bb44977a99a", + "crates/horizon-assets/examples/model_resolution_fixture.rs": "c071067140299e49345a6ebd94e15b3b6d853cb9ae11d8de46e3cbdfb8b01f0e", + "crates/horizon-assets/examples/sprite_animation_fixture.rs": "254314d52deda129ab461221d3d8b95323a60730d374e566c1cd599fba85f072", + "crates/horizon-assets/examples/support/mod.rs": "bcf5a6d8a54845982191e037911c24139237771d6afa4b01b1e83c011489c3f5", + "crates/horizon-assets/src/animation.rs": "ebbf7952146a0e66b41396174492f5702627170b03a57e6cd5a45c97a08c975e", + "crates/horizon-assets/src/bake/transform.rs": "a95e658fef85b21bcb2f9f7512f98f98d57022d62c1199885b7133beae35a09d", + "crates/horizon-assets/src/bake.rs": "f55dda6b6cee5ac6e65a8ee4837fdd2c6674437d59e59b4c45718f6324d4a4d5", + "crates/horizon-assets/src/blockstate/bind.rs": "6278962e55c9786bba8184bdf2939af9c6e3b9002b08c3022129964b49a60009", + "crates/horizon-assets/src/blockstate/choice.rs": "5a66c8b9833e2f19dd8b0773f3593d97ff5941d3c5b773896b98049efa1395ba", + "crates/horizon-assets/src/blockstate.rs": "a4299dfd7adaeb4173982ffaa8e9c9eda2925739ae579a714193c99da2e7ce56", + "crates/horizon-assets/src/json.rs": "99fe8af4fbf5d4eed408a92e829ac1a39597a0d92471a6bff73771fad9c830a8", + "crates/horizon-assets/src/lib.rs": "e39f21c59a2c3e1c53d977b29bd5e0638e5fc41d86ff0fcc1882a6d90fd961e4", + "crates/horizon-assets/src/model.rs": "57ddb3d65e88e7a8aa22c62bc298a2dae7f4e994326a873a31f06c0f36ed051b", + "crates/horizon-assets/src/resolve.rs": "3927ac926cdcbd7d334901cc32d0ecc1e498b1bec98f76a46bca6d4964c13541" + }, + "fixtures_sha256": { + ".local/rust-blockstate-transform-parity/inputs.jsonl": "4a858b546c52f20ac82911e5f1bbe6f1ce4273a345f4fedb19dfbcfc50782c1d" + }, + "rust_output_sha256": "a0d2017780ea594714a3e623333468d8485b2443f5e7547f8646470754edec4b", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "a0d2017780ea594714a3e623333468d8485b2443f5e7547f8646470754edec4b", + "matched_output_lines": 19704 + } + ], + "scope": "Actual FaceBakery with Variant.SimpleModelState and unit-atlas sprite, default JOML math. Every distinct model/XYZ-rotation/UV-lock tuple in bundled blockstates; all 64 quarter-turn combinations with and without UV lock on synthetic geometry. Exact float bits for positions, UVs, element matrices, orientation and all six inverse UV matrices; native Direction.rotate for culling. Includes identity UV lock, degenerate/reversed geometry, element rotations, signed zero and float overflow. Does not establish atlas packing, shader pixels, lighting, render classification, renderer integration or gameplay parity." +} diff --git a/crates/horizon-assets/examples/model_baking_fixture.rs b/crates/horizon-assets/examples/model_baking_fixture.rs index 548b682f1..63e9b0c79 100644 --- a/crates/horizon-assets/examples/model_baking_fixture.rs +++ b/crates/horizon-assets/examples/model_baking_fixture.rs @@ -1,5 +1,5 @@ use horizon_assets::{ - bake::{ElementMatrix, bake_model}, + bake::{BlockModelTransform, ElementMatrix, bake_model_transformed}, model::*, resolve::ModelLibrary, }; @@ -28,17 +28,29 @@ fn main() -> Result<(), Box> { .map(|(name, raw)| Ok((name.clone(), CuboidModel::from_json(raw.as_str().unwrap())?))) .collect::>()?; let library = ModelLibrary::new(models)?; + let transform = row.get("transform").map(|t| { + BlockModelTransform::new( + std::array::from_fn(|i| t[i].as_u64().unwrap() as u8), + t[3].as_bool().unwrap(), + ) + }); + let state = transform.unwrap_or_else(|| BlockModelTransform::new([0; 3], false)); for root in row["roots"].as_array().unwrap() { let name = root.as_str().unwrap(); let baked = library.resolve(name).and_then(|model| { - let quads = bake_model(&model)?.into_iter().map(|q| json!({ + let quads = bake_model_transformed(&model, state)?.into_iter().map(|q| json!({ "positions":q.positions.map(|v| v.map(bits)),"uv":q.uv.map(|v| v.map(bits)), "facing":q.facing.name(),"cull":q.cull.map(Direction::name),"tint":q.tint_index, "shade":q.shade_direction_override.map(Direction::name),"light":q.light_emission, "material":{"sprite":q.material.sprite,"translucent":q.material.force_translucent} })).collect::>(); let matrices: Vec<_> = model.elements().iter().map(|e| e.as_ref().unwrap().rotation.as_ref().map(|r| ElementMatrix::from_rotation(r).rows.map(|row| row.map(bits)))).collect(); - Ok(json!({"quads":quads,"matrices":matrices})) + let mut value = json!({"quads":quads,"matrices":matrices}); + if transform.is_some() { + value["transform"] = json!({"matrix":state.matrix_rows().map(|r| r.map(bits)), + "inverse_uv":Direction::ALL.map(|d| state.inverse_uv_rows(d).map(|r| r.map(bits)))}); + } + Ok(value) }); let value = match baked { Ok(baked) => json!({"case":index,"name":name,"baked":baked}), diff --git a/crates/horizon-assets/src/bake.rs b/crates/horizon-assets/src/bake.rs index 57b8b5290..e2afe55df 100644 --- a/crates/horizon-assets/src/bake.rs +++ b/crates/horizon-assets/src/bake.rs @@ -1,5 +1,7 @@ -//! Cuboid geometry in block units, before blockstate rotation and UV locking. +//! Cuboid geometry in block units, including blockstate rotation and UV locking. use crate::{json::*, model::*, resolve::ResolvedCuboidModel}; +mod transform; +pub use transform::BlockModelTransform; #[derive(Clone, Debug, PartialEq)] pub struct ModelQuad { @@ -161,6 +163,12 @@ fn facing(vertices: &[[f32; 3]; 4]) -> Option { } pub fn bake_model(model: &ResolvedCuboidModel) -> Result> { + bake_model_transformed(model, BlockModelTransform::new([0; 3], false)) +} +pub fn bake_model_transformed( + model: &ResolvedCuboidModel, + transform: BlockModelTransform, +) -> Result> { let mut output = Vec::new(); for element in model.elements() { let element = element @@ -173,7 +181,9 @@ pub fn bake_model(model: &ResolvedCuboidModel) -> Result> { sprite: "minecraft:missingno".to_owned(), force_translucent: false, }); - output.push(bake_face(element, face, *direction, matrix, material)?); + output.push(bake_face( + element, face, *direction, matrix, material, transform, + )?); } } Ok(output) @@ -184,6 +194,7 @@ fn bake_face( direction: Direction, matrix: Option, material: Material, + transform: BlockModelTransform, ) -> Result { let mut positions = corners(element.from, element.to, direction).map(|v| v.map(|c| c / 16.0)); if let (Some(rotation), Some(matrix)) = (&element.rotation, matrix) { @@ -193,18 +204,23 @@ fn bake_face( *vertex = std::array::from_fn(|i| rotated[i] + rotation.origin[i]); } } + positions = positions.map(|v| transform.position(v)); let bounds = face .uv .unwrap_or_else(|| default_uv(element.from, element.to, direction)); let mut uv = std::array::from_fn(|i| { let corner = (i + usize::from(face.rotation)) % 4; - [ - bounds[if corner < 2 { 0 } else { 2 }] / 16.0, - bounds[if corner == 0 || corner == 3 { 1 } else { 3 }] / 16.0, - ] - // Native TextureAtlasSprite applies origin + extent * coordinate; - // even the unit atlas changes negative zero to positive zero. - .map(|value| 0.0 + value) + transform + .uv( + direction, + [ + bounds[if corner < 2 { 0 } else { 2 }] / 16.0, + bounds[if corner == 0 || corner == 3 { 1 } else { 3 }] / 16.0, + ], + ) + // Native TextureAtlasSprite applies origin + extent * coordinate; + // even the unit atlas changes negative zero to positive zero. + .map(|value| 0.0 + value) }); let normal = facing(&positions); if let (None, Some(facing)) = (&element.rotation, normal) { @@ -232,7 +248,7 @@ fn bake_face( positions, uv, facing: normal.unwrap_or(Direction::Up), - cull: face.cull, + cull: face.cull.map(|d| transform.direction(d)), material, tint_index: face.tint_index, shade_direction_override: element.shade_direction_override, diff --git a/crates/horizon-assets/src/bake/transform.rs b/crates/horizon-assets/src/bake/transform.rs new file mode 100644 index 000000000..f431e3dbd --- /dev/null +++ b/crates/horizon-assets/src/bake/transform.rs @@ -0,0 +1,243 @@ +//! Prepared blockstate transforms. The face basis and inverse arithmetic use +//! the pinned client's default, unfused f32 operations, including UV-lock +//! identity detection and quaternion basis normalization error. +use super::sin_cos; +use crate::model::Direction; +use std::sync::OnceLock; + +#[derive(Clone, Copy, Debug)] +struct Affine { + rows: [[f32; 4]; 3], + identity: bool, +} +impl Affine { + const IDENTITY: Self = Self { + rows: [ + [1.0, 0.0, 0.0, 0.0], + [0.0, 1.0, 0.0, 0.0], + [0.0, 0.0, 1.0, 0.0], + ], + identity: true, + }; + fn position(self, v: [f32; 3]) -> [f32; 3] { + self.rows + .map(|r| r[0] * v[0] + (r[1] * v[1] + (r[2] * v[2] + r[3]))) + } + fn mul(self, b: Self) -> Self { + if self.identity { + return b; + } + if b.identity { + return self; + } + Self { + rows: std::array::from_fn(|r| { + std::array::from_fn(|c| { + self.rows[r][0] * b.rows[0][c] + + (self.rows[r][1] * b.rows[1][c] + + if c == 3 { + self.rows[r][2] * b.rows[2][c] + self.rows[r][3] + } else { + self.rows[r][2] * b.rows[2][c] + }) + }) + }), + identity: false, + } + } + fn inverse(self) -> Self { + let [[a, b, c, x], [d, e, f, y], [g, h, i, z]] = self.rows; + let ae = a * e; + let db = d * b; + let gb = g * b; + let ah = a * h; + let dh = d * h; + let ge = g * e; + let bi = b * i; + let bf = b * f; + let ei = e * i; + let ec = e * c; + let hf = h * f; + let hc = h * c; + let cg = c * g; + let cd = c * d; + let fg = f * g; + let fa = f * a; + let id = i * d; + let ia = i * a; + let inverse = 1.0 / ((ae - db) * i + (gb - ah) * f + (dh - ge) * c); + Self { + rows: [ + [ + (ei - hf) * inverse, + (hc - bi) * inverse, + (bf - ec) * inverse, + (bi * y - bf * z + ec * z - ei * x + hf * x - hc * y) * inverse, + ], + [ + (fg - id) * inverse, + (ia - cg) * inverse, + (cd - fa) * inverse, + (cg * y - cd * z + fa * z - fg * x + id * x - ia * y) * inverse, + ], + [ + (dh - ge) * inverse, + (gb - ah) * inverse, + (ae - db) * inverse, + (ge * x - dh * x + ah * y - gb * y + db * z - ae * z) * inverse, + ], + ], + identity: false, + } + } + fn face_basis(direction: Direction) -> Self { + use Direction::*; + use std::f32::consts::{FRAC_PI_2, PI}; + let (axis, angle) = match direction { + South => return Self::IDENTITY, + Down => (0, FRAC_PI_2), + Up => (0, -FRAC_PI_2), + East => (1, FRAC_PI_2), + West => (1, -FRAC_PI_2), + North => (1, PI), + }; + let (s, c) = sin_cos(angle * 0.5); + // Quaternion.rotateX/Y on an identity quaternion retains signed zeros. + let [x, y, z, w] = if axis == 0 { + [ + s + 0.0 * c, + 0.0 * c + 0.0 * s, + 0.0 * c - 0.0 * s, + c - 0.0 * s, + ] + } else { + [ + 0.0 * c - 0.0 * s, + s + 0.0 * c, + 0.0 * s + 0.0 * c, + c - 0.0 * s, + ] + }; + let (xx, yy, zz, ww) = (x * x, y * y, z * z, w * w); + let (xy, xz, yz, xw, yw, zw) = (x * y, x * z, y * z, x * w, y * w, z * w); + let (xy, xz, yz, xw, yw, zw) = (xy + xy, xz + xz, yz + yz, xw + xw, yw + yw, zw + zw); + Self { + rows: [ + [ww + xx - zz - yy, -zw + xy, yw + xz, 0.0], + [xy + zw, yy - zz + ww - xx, yz - xw, 0.0], + [xz - yw, yz + xw, zz - yy - xx + ww, 0.0], + ], + identity: false, + } + } +} + +/// A blockstate's negative XYZ quarter-turns and optional face UV locking. +/// All 64 rotation combinations are prepared once and reused across models. +#[derive(Clone, Copy, Debug)] +pub struct BlockModelTransform { + orientation: &'static Orientation, + uv_lock: bool, +} +#[derive(Debug)] +struct Orientation { + matrix: Affine, + inverse_uv: [Affine; 6], +} +impl BlockModelTransform { + pub fn new(quarter_turns: [u8; 3], uv_lock: bool) -> Self { + static ORIENTATIONS: OnceLock<[Orientation; 64]> = OnceLock::new(); + let orientations = ORIENTATIONS.get_or_init(|| { + let bases = Direction::ALL.map(Affine::face_basis); + let inverses = bases.map(|b| if b.identity { b } else { b.inverse() }); + std::array::from_fn(|index| { + let turns = [index / 16, index / 4 % 4, index % 4]; + let mut rows = [[1i8, 0, 0], [0, 1, 0], [0, 0, 1]]; + for (axis, turns) in turns.into_iter().enumerate() { + for _ in 0..turns { + let a = (axis + 1) % 3; + let b = (axis + 2) % 3; + let old = rows[a]; + rows[a] = rows[b]; + rows[b] = old.map(|v| -v); + } + } + let matrix = Affine { + identity: rows == [[1, 0, 0], [0, 1, 0], [0, 0, 1]], + rows: rows.map(|r| [f32::from(r[0]), f32::from(r[1]), f32::from(r[2]), 0.0]), + }; + let inverse_uv = bases.map(|b| { + if matrix.identity { + return matrix.inverse(); + } + let transformed = matrix.mul(b); + let normal = transformed.rows.map(|r| r[2]); + inverses[nearest(normal) as usize] + .mul(transformed) + .inverse() + }); + Orientation { matrix, inverse_uv } + }) + }); + let [x, y, z] = quarter_turns.map(|n| usize::from(n % 4)); + Self { + orientation: &orientations[x * 16 + y * 4 + z], + uv_lock, + } + } + pub fn matrix_rows(self) -> [[f32; 4]; 3] { + self.orientation.matrix.rows + } + pub fn inverse_uv_rows(self, direction: Direction) -> [[f32; 4]; 3] { + self.uv_matrix(direction).rows + } + fn uv_matrix(self, direction: Direction) -> Affine { + if self.uv_lock { + self.orientation.inverse_uv[direction as usize] + } else { + Affine::IDENTITY + } + } + pub(super) fn position(self, v: [f32; 3]) -> [f32; 3] { + if self.orientation.matrix.identity { + return v; + } + self.orientation + .matrix + .position(v.map(|c| c - 0.5)) + .map(|c| c + 0.5) + } + pub(super) fn uv(self, direction: Direction, uv: [f32; 2]) -> [f32; 2] { + let matrix = self.uv_matrix(direction); + // MatrixUtil re-determines properties when the identity bit is absent. + // Its numeric comparison treats signed zeros as equal, without changing + // the matrix coefficients retained for later use. + if matrix.rows == Affine::IDENTITY.rows { + return uv; + } + let result = matrix.position([uv[0] - 0.5, uv[1] - 0.5, 0.0]); + [result[0] + 0.5, result[1] + 0.5] + } + pub fn direction(self, direction: Direction) -> Direction { + let v = match direction { + Direction::Down => [0.0, -1.0, 0.0], + Direction::Up => [0.0, 1.0, 0.0], + Direction::North => [0.0, 0.0, -1.0], + Direction::South => [0.0, 0.0, 1.0], + Direction::West => [-1.0, 0.0, 0.0], + Direction::East => [1.0, 0.0, 0.0], + }; + nearest(self.orientation.matrix.position(v)) + } +} +fn nearest([x, y, z]: [f32; 3]) -> Direction { + let mut best = f32::MIN_POSITIVE; + let mut direction = Direction::North; + for (candidate, dot) in Direction::ALL.into_iter().zip([-y, y, -z, z, -x, x]) { + if dot > best { + best = dot; + direction = candidate; + } + } + direction +} diff --git a/docs/native-client.md b/docs/native-client.md index b983f8325..71f4b2e08 100644 --- a/docs/native-client.md +++ b/docs/native-client.md @@ -91,7 +91,8 @@ The [archived decoder result](../benchmarks/rust-resource-number-scanner-2026-10 records source, fixture and reference hashes. The oracle uses actual client classes; those rendering APIs are absent from the server. The decoder, parent resolver and baker now feed the development gallery. Blockstate selection, transformed -models, UV locking and rendered appearance still need their own checks. +models and UV locking have the separate geometry checks described below. Rendered +appearance still needs its own checks. `ModelLibrary` resolves parent geometry, ambient occlusion, GUI lighting and each display context. It shares inherited elements rather than cloning them. @@ -124,11 +125,27 @@ Position, UV and matrix fields compare by exact float bits for these fixtures. python3 tools/test_model_baking_parity.py ``` -This comparison uses the identity blockstate transform. Atlas packing, +That comparison uses the identity blockstate transform. Atlas packing, transparency classification, actual tint/light evaluation and GPU rendering remain separate from the geometry result. Other operating systems still need their native validation runs. +`BlockModelTransform` now prepares all 64 XYZ quarter-turn combinations once +and shares them across baked models. It rotates geometry around the block center, +rotates culling directions and applies UV locking in the original face basis. +The [transformed baking comparison](../benchmarks/rust-blockstate-transforms-2026-10-06/scoped-parity.json) +checks every distinct model/rotation/UV-lock tuple in bundled blockstates and +all 128 rotation/lock combinations on 81 synthetic models, plus further arbitrary +element rotations. Positions, UVs and every orientation/inverse-face matrix +compare by exact float bits: 19,704 roots and 148,439 quads match, including +7,884 bundled model/transform tuples. Quaternion basis rounding and numeric identity +rechecking are retained. This remains geometry validation; renderer integration, +atlas packing and pixel parity are separate work. + +```sh +python3 tools/test_blockstate_transform_parity.py +``` + Blockstate resources now decode into ordered variant selectors and multipart conditions. The [native blockstate comparison](../benchmarks/rust-blockstate-model-decoding-2026-10-06/scoped-parity.json) covers all 1,288 bundled definitions and 1,351 synthetic cases (2,639 total, @@ -136,7 +153,7 @@ covers all 1,288 bundled definitions and 1,351 synthetic cases (2,639 total, `BlockStateModelDispatcher.CODEC` as the pinned loader. The Rust representation preserves single versus weighted variants, all three quarter-turn axes, UV-lock flags, positive weights and total-weight limits, ordered selectors, nested -AND/OR conditions and per-term negation. Transformed baking remains separate work. +AND/OR conditions and per-term negation. ```sh python3 tools/test_blockstate_model_parity.py diff --git a/docs/rust-parity.md b/docs/rust-parity.md index eaaa60c95..8fa299e0f 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -18,13 +18,13 @@ The `horizon-assets` crate now decodes pinned cuboid models, with all 2,883 bund block-model JSON files and 2,457 synthetic cases compared against the actual client parser. [Decoder scope and validation](native-client.md#validation) also include parent/texture resolution over 5,648 roots and cuboid baking over -7,100 roots with identity blockstate transforms. Blockstate selection, transformed -models and UV locking remain unfinished. Blockstate resource decoding now +7,100 roots with identity blockstate transforms. Blockstate resource decoding now matches all 1,288 bundled definitions and 1,351 synthetic cases; registry binding now also matches native selection across registered and special item-frame states. Weighted selection and multipart random draw consumption -also match native traces. Transformed baking and renderer integration remain -unfinished. The native renderer now draws an +also match native traces. Transformed baking now checks every bundled +model/rotation/UV-lock tuple and all XYZ quarter-turn combinations against native +geometry by exact float bits. Renderer integration remains unfinished. The native renderer now draws an inspection gallery from the decoded/resolved/baked models, including binary cutouts and stepped lantern animation; these are not yet gameplay blocks. Animation metadata, frame sequences and tick-state selection now have native diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaModelBakingOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaModelBakingOracle.java index 87265bc76..96ecc8b46 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaModelBakingOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaModelBakingOracle.java @@ -10,6 +10,8 @@ import net.minecraft.client.resources.model.cuboid.*; import net.minecraft.client.resources.model.geometry.*; import net.minecraft.client.resources.model.sprite.Material; import net.minecraft.client.renderer.block.dispatch.ModelState; +import net.minecraft.client.renderer.block.dispatch.Variant; +import com.mojang.math.Quadrant; import net.minecraft.client.renderer.texture.*; import net.minecraft.client.resources.metadata.animation.FrameSize; import net.minecraft.core.Direction; @@ -34,7 +36,7 @@ public final class VanillaModelBakingOracle { return new long[][]{{bits(m.m00()),bits(m.m10()),bits(m.m20())}, {bits(m.m01()),bits(m.m11()),bits(m.m21())},{bits(m.m02()),bits(m.m12()),bits(m.m22())}}; } - private static Object bake(ResolvedModel model, Sprite sprite) throws Exception { + private static Map bake(ResolvedModel model, Sprite sprite, ModelState state) throws Exception { var geometry=model.getTopGeometry(); var quads=new ArrayList(); var matrices=new ArrayList(); if(geometry==UnbakedGeometry.EMPTY)return map("quads",quads,"matrices",matrices); @@ -49,20 +51,25 @@ public final class VanillaModelBakingOracle { var uv=face.uvs(); if(uv==null)uv=(CuboidFace.UVs)defaultUv.invoke(null,element.from(),element.to(),entry.getKey()); var info=new BakedQuad.MaterialInfo(sprite,null,null,null,null,face.tintIndex(),element.shadeDirectionOverride(),element.lightEmission()); - var quad=FaceBakery.bakeQuad(INTERNER,element.from(),element.to(),uv,face.rotation(),info,entry.getKey(),new ModelState(){},element.rotation()); + var quad=FaceBakery.bakeQuad(INTERNER,element.from(),element.to(),uv,face.rotation(),info,entry.getKey(),state,element.rotation()); var positions=new long[4][3];var uvs=new long[4][2]; for(int i=0;i<4;i++) { var p=quad.position(i);positions[i]=new long[]{bits(p.x()),bits(p.y()),bits(p.z())}; long packed=quad.packedUV(i);uvs[i]=new long[]{packed >>> 32,packed & 0xffffffffL}; } quads.add(map("positions",positions,"uv",uvs,"facing",quad.direction().getName(), - "cull",face.cullForDirection()==null?null:face.cullForDirection().getName(),"tint",face.tintIndex(), + "cull",face.cullForDirection()==null?null:Direction.rotate(state.transformation().getMatrix(),face.cullForDirection()).getName(),"tint",face.tintIndex(), "shade",element.shadeDirectionOverride()==null?null:element.shadeDirectionOverride().getName(), "light",element.lightEmission(),"material",map("sprite",material.sprite().toString(),"translucent",material.forceTranslucent()))); } } return map("quads",quads,"matrices",matrices); } + private static Object affine(Matrix4fc matrix) { + var rows=new long[3][4]; + for(int r=0;r<3;r++)for(int c=0;c<4;c++)rows[r][c]=bits(matrix.get(c,r)); + return rows; + } public static void main(String[] args) throws Exception { net.minecraft.SharedConstants.tryDetectVersion(); if(org.joml.Options.FASTMATH || org.joml.Options.USE_MATH_FMA)throw new AssertionError("Expected default JOML math options"); @@ -77,9 +84,19 @@ public final class VanillaModelBakingOracle { var discovery=new ModelDiscovery(models,MissingCuboidModel.missingModel()); discovery.addRoot(resolver->{for(var root:row.getAsJsonArray("roots"))resolver.markDependency(Identifier.parse(root.getAsString()));}); var resolved=discovery.resolve(); + ModelState state=new ModelState(){}; + if(row.has("transform")) { + var t=row.getAsJsonArray("transform"); + state=new Variant.SimpleModelState(Quadrant.values()[t.get(0).getAsInt()],Quadrant.values()[t.get(1).getAsInt()],Quadrant.values()[t.get(2).getAsInt()],t.get(3).getAsBoolean()).asModelState(); + } for(var root:row.getAsJsonArray("roots")) { - String name=root.getAsString();Object value; - try {value=bake(Objects.requireNonNull(resolved.get(Identifier.parse(name))),sprite);} + String name=root.getAsString();Map value; + try {value=bake(Objects.requireNonNull(resolved.get(Identifier.parse(name))),sprite,state); + if(row.has("transform")) { + var inverse=new ArrayList(); + for(var d:Direction.values())inverse.add(affine(state.inverseFaceTransformation(d))); + value.put("transform",map("matrix",affine(state.transformation().getMatrix()),"inverse_uv",inverse)); + }} catch(RuntimeException error) {output.write(JSON.toJson(map("case",index,"name",name,"error",true)));output.newLine();continue;} output.write(JSON.toJson(map("case",index,"name",name,"baked",value)));output.newLine(); } diff --git a/tools/test_blockstate_transform_parity.py b/tools/test_blockstate_transform_parity.py new file mode 100644 index 000000000..4b6e80f4d --- /dev/null +++ b/tools/test_blockstate_transform_parity.py @@ -0,0 +1,96 @@ +#!/usr/bin/env python3 +"""Compare blockstate-transformed cuboid baking against the pinned Java client.""" +import itertools +import json +import os +from pathlib import Path +import platform +import subprocess +import zipfile +try: + from . import lab, test_rust_parity as base, test_model_baking_parity as baking, test_cuboid_model_parity as decoding +except ImportError: + import lab, test_rust_parity as base, test_model_baking_parity as baking, test_cuboid_model_parity as decoding + + +def corpus(archive): + models = {'minecraft:' + name.removeprefix('assets/minecraft/models/').removesuffix('.json'): archive.read(name).decode() + for name in sorted(archive.namelist()) if name.startswith('assets/minecraft/models/block/') and name.endswith('.json')} + groups = {} + definitions = 0 + for name in sorted(archive.namelist()): + if not name.startswith('assets/minecraft/blockstates/') or not name.endswith('.json'): + continue + definitions += 1 + root = json.loads(archive.read(name)) + for choice in [*root.get('variants', {}).values(), *(s['apply'] for s in root.get('multipart', []))]: + for variant in choice if isinstance(choice, list) else [choice]: + state = tuple(variant.get(axis, 0) % 360 // 90 for axis in ['x', 'y', 'z']) + (variant.get('uvlock', False),) + model = variant['model'] + if ':' not in model: + model = 'minecraft:' + model + groups.setdefault(state, set()).add(model) + rows = [{'models': models, 'roots': sorted(roots), 'transform': state} for state, roots in sorted(groups.items())] + resource_pairs = sum(len(roots) for roots in groups.values()) + # All 128 transform/lock combinations on asymmetric, reversed and degenerate + # geometry, explicit/default UVs, signed zero and representative element rotations. + synthetic = list(baking.corpus())[-1]['models'] + names = list(synthetic) + selected = names[:12] + names[12:248:9] + names[248:504:13] + names[504::53] + names[-4:] + focused = {name: synthetic[name] for name in dict.fromkeys(selected)} + for turns in itertools.product(range(4), repeat=3): + for lock in [False, True]: + rows.append({'models': focused, 'roots': list(focused), 'transform': [*turns, lock]}) + # Cover every remaining arbitrary-angle element fixture under a deterministic + # transform; do not multiply the whole large corpus by 128 unnecessarily. + for state in itertools.product(range(4), range(4), [False, True]): + x, y, lock = state + subset = {name: raw for i, (name, raw) in enumerate(synthetic.items()) if i % 32 == x*8+y*2+lock} + rows.append({'models': subset, 'roots': list(subset), 'transform': [x, y, (x+y)%4, lock]}) + return rows, definitions, resource_pairs, len(focused) + + +def main(): + lock, jars, _ = base.verify_artifacts() + build = lab.LOCAL / 'rust-blockstate-transform-parity'; build.mkdir(parents=True, exist_ok=True) + report_path = build / 'report.json'; report_path.unlink(missing_ok=True) + oracle = lab.ROOT / 'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaModelBakingOracle.java' + helper = oracle.with_name('VanillaCuboidModelOracle.java'); crate = lab.ROOT / 'crates/horizon-assets' + sources = [oracle, helper, Path(__file__), lab.ROOT/'tools/test_model_baking_parity.py', + lab.ROOT/'tools/test_cuboid_model_parity.py', lab.ROOT/'tools/test_model_resolution_parity.py', + lab.ROOT/'tools/lab.py', lab.ROOT/'tools/test_rust_parity.py', lab.ROOT/'Cargo.toml', + lab.ROOT/'Cargo.lock', crate/'Cargo.toml', *sorted(crate.rglob('*.rs'))] + tested = base.source_hashes(sources) + with zipfile.ZipFile(jars['client']) as archive: + rows, definitions, resource_pairs, focused = corpus(archive) + inputs = build/'inputs.jsonl'; inputs.write_text(''.join(json.dumps(row)+'\n' for row in rows)) + fixtures = base.source_hashes([inputs]); classes = build/'classes'; classes.mkdir(exist_ok=True) + def run(command, name): + with (build/(name+'.log')).open('w') as log: + subprocess.run(list(map(str, command)), cwd=lab.ROOT, check=True, timeout=3600, stdout=log, stderr=subprocess.STDOUT) + dependencies = os.pathsep.join(map(str, [jars['client'], *baking.client_libraries()])) + run(['javac', '--release', lock['minecraft']['java_major'], '-proc:none', '-cp', dependencies, '-d', classes, oracle, helper], 'compile-java') + run(['cargo', 'build', '--locked', '-p', 'horizon-assets', '--example', 'model_baking_fixture'], 'compile-rust') + metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--locked', '--no-deps', '--format-version', '1'], cwd=lab.ROOT)) + binary = Path(metadata['target_directory'])/'debug/examples'/('model_baking_fixture.exe' if os.name == 'nt' else 'model_baking_fixture') + run([binary, inputs, build/'rust.jsonl'], 'rust') + run(['java', '-Xmx768M', '-cp', str(classes)+os.pathsep+dependencies, 'dev.horizonlab.parity.VanillaModelBakingOracle', inputs, build/'client.jsonl'], 'client') + rejected = decoding.canonicalize(build/'client.jsonl'); decoding.canonicalize(build/'rust.jsonl') + matched = base.compare(build/'client.jsonl', build/'rust.jsonl') + base.ensure_sources_unchanged(sources, tested); base.ensure_sources_unchanged([inputs], fixtures) + quads = sum(len(json.loads(line).get('baked', {}).get('quads', [])) for line in (build/'client.jsonl').open()) + report = {'schema': 1, 'minecraft': lock['minecraft']['version'], 'manifest_sha1': lock['minecraft']['manifest_sha1'], + 'platform': platform.platform(), 'java': subprocess.check_output(['java', '--version'], text=True).splitlines()[0], + 'rustc': subprocess.check_output(['rustc', '--version'], text=True).strip(), 'resource_definitions': definitions, + 'resource_model_transform_pairs': resource_pairs, 'synthetic_models_per_all_128_transforms': focused, + 'graph_fixtures': len(rows), 'rejected_roots': rejected, 'baked_quads': quads, + 'sources_sha256': tested, 'fixtures_sha256': fixtures, 'rust_output_sha256': lab.digest(build/'rust.jsonl', 'sha256'), + 'references': [{'side': 'client', 'jar_sha256': lab.digest(jars['client'], 'sha256'), + 'output_sha256': lab.digest(build/'client.jsonl', 'sha256'), 'matched_output_lines': matched}], + 'scope': 'Actual FaceBakery with Variant.SimpleModelState and unit-atlas sprite, default JOML math. Every distinct model/XYZ-rotation/UV-lock tuple in bundled blockstates; all 64 quarter-turn combinations with and without UV lock on synthetic geometry. Exact float bits for positions, UVs, element matrices, orientation and all six inverse UV matrices; native Direction.rotate for culling. Includes identity UV lock, degenerate/reversed geometry, element rotations, signed zero and float overflow. Does not establish atlas packing, shader pixels, lighting, render classification, renderer integration or gameplay parity.'} + lab.write_json(report_path, report) + print(f'Native transformed baking: {matched:,} roots / {quads:,} quads match ({rejected:,} rejected); {report_path}', flush=True) + + +if __name__ == '__main__': + main() From 1a88d6c300e55dd46160a6a3e242a88f023acd5e Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 21:59:03 +0200 Subject: [PATCH 054/253] Render registry-bound variants and multipart block models --- .../startup-smoke.json | 661 ++++++++++++++++++ crates/horizon-client/src/assets.rs | 6 +- crates/horizon-client/src/main.rs | 2 +- crates/horizon-client/src/models.rs | 147 ++-- crates/horizon-client/src/models/catalog.rs | 214 ++++++ docs/native-client.md | 40 +- docs/rust-parity.md | 10 +- .../parity/VanillaGallerySelectionOracle.java | 95 +++ tools/prepare_native_client.py | 24 +- tools/test_native_client.py | 36 +- 10 files changed, 1138 insertions(+), 97 deletions(-) create mode 100644 benchmarks/rust-native-blockstate-client-2026-10-06/startup-smoke.json create mode 100644 crates/horizon-client/src/models/catalog.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaGallerySelectionOracle.java diff --git a/benchmarks/rust-native-blockstate-client-2026-10-06/startup-smoke.json b/benchmarks/rust-native-blockstate-client-2026-10-06/startup-smoke.json new file mode 100644 index 000000000..e058faef8 --- /dev/null +++ b/benchmarks/rust-native-blockstate-client-2026-10-06/startup-smoke.json @@ -0,0 +1,661 @@ +{ + "adapter": { + "backend": "Vulkan", + "device": 0, + "device_type": "Cpu", + "name": "llvmpipe (LLVM 21.1.8, 256 bits)", + "vendor": 65541 + }, + "animated_sprites": 1, + "animation_uploads": 1, + "arch": "x86_64", + "camera_pitch": -0.3839724354387525, + "camera_position": [ + 25.0, + 18.0, + 25.0 + ], + "camera_yaw": -2.356194490192345, + "elapsed_seconds": 0.636712699, + "error": null, + "merged_quads": 166, + "model_gallery": [ + { + "block": "minecraft:oak_stairs", + "models": [ + { + "model": "minecraft:block/oak_stairs_inner", + "rotations": [ + 2, + 3, + 0 + ], + "uv_lock": true + } + ], + "position": [ + -7, + 4, + 14 + ], + "properties": { + "facing": "north", + "half": "top", + "shape": "inner_left", + "waterlogged": "false" + }, + "state_id": 5466 + }, + { + "block": "minecraft:stone_slab", + "models": [ + { + "model": "minecraft:block/stone_slab_top", + "rotations": [ + 0, + 0, + 0 + ], + "uv_lock": false + } + ], + "position": [ + -3, + 4, + 14 + ], + "properties": { + "type": "top", + "waterlogged": "false" + }, + "state_id": 15250 + }, + { + "block": "minecraft:anvil", + "models": [ + { + "model": "minecraft:block/anvil", + "rotations": [ + 0, + 3, + 0 + ], + "uv_lock": false + } + ], + "position": [ + 1, + 4, + 14 + ], + "properties": { + "facing": "east" + }, + "state_id": 12965 + }, + { + "block": "minecraft:torch", + "models": [ + { + "model": "minecraft:block/torch", + "rotations": [ + 0, + 0, + 0 + ], + "uv_lock": false + } + ], + "position": [ + 5, + 4, + 14 + ], + "properties": {}, + "state_id": 4926 + }, + { + "block": "minecraft:lantern", + "models": [ + { + "model": "minecraft:block/lantern", + "rotations": [ + 0, + 0, + 0 + ], + "uv_lock": false + } + ], + "position": [ + -7, + 4, + 18 + ], + "properties": { + "hanging": "false", + "waterlogged": "false" + }, + "state_id": 24197 + }, + { + "block": "minecraft:oak_fence", + "models": [ + { + "model": "minecraft:block/oak_fence_post", + "rotations": [ + 0, + 0, + 0 + ], + "uv_lock": false + }, + { + "model": "minecraft:block/oak_fence_side", + "rotations": [ + 0, + 0, + 0 + ], + "uv_lock": true + }, + { + "model": "minecraft:block/oak_fence_side", + "rotations": [ + 0, + 1, + 0 + ], + "uv_lock": true + } + ], + "position": [ + -3, + 4, + 18 + ], + "properties": { + "east": "true", + "north": "true", + "south": "false", + "waterlogged": "false", + "west": "false" + }, + "state_id": 8642 + }, + { + "block": "minecraft:oak_fence_gate", + "models": [ + { + "model": "minecraft:block/oak_fence_gate_open", + "rotations": [ + 0, + 1, + 0 + ], + "uv_lock": true + } + ], + "position": [ + 1, + 4, + 18 + ], + "properties": { + "facing": "west", + "in_wall": "false", + "open": "true", + "powered": "false" + }, + "state_id": 10401 + }, + { + "block": "minecraft:iron_bars", + "models": [ + { + "model": "minecraft:block/iron_bars_post_ends", + "rotations": [ + 0, + 0, + 0 + ], + "uv_lock": false + }, + { + "model": "minecraft:block/iron_bars_side", + "rotations": [ + 0, + 0, + 0 + ], + "uv_lock": false + }, + { + "model": "minecraft:block/iron_bars_side_alt", + "rotations": [ + 0, + 0, + 0 + ], + "uv_lock": false + } + ], + "position": [ + 5, + 4, + 18 + ], + "properties": { + "east": "false", + "north": "true", + "south": "true", + "waterlogged": "false", + "west": "false" + }, + "state_id": 9711 + }, + { + "block": "minecraft:cobweb", + "models": [ + { + "model": "minecraft:block/cobweb", + "rotations": [ + 0, + 0, + 0 + ], + "uv_lock": false + } + ], + "position": [ + -7, + 4, + 22 + ], + "properties": {}, + "state_id": 2362 + }, + { + "block": "minecraft:grindstone", + "models": [ + { + "model": "minecraft:block/grindstone", + "rotations": [ + 1, + 3, + 0 + ], + "uv_lock": false + } + ], + "position": [ + -3, + 4, + 22 + ], + "properties": { + "face": "wall", + "facing": "west" + }, + "state_id": 24135 + }, + { + "block": "minecraft:ladder", + "models": [ + { + "model": "minecraft:block/ladder", + "rotations": [ + 0, + 3, + 0 + ], + "uv_lock": false + } + ], + "position": [ + 1, + 4, + 22 + ], + "properties": { + "facing": "west", + "waterlogged": "false" + }, + "state_id": 7312 + }, + { + "block": "minecraft:amethyst_cluster", + "models": [ + { + "model": "minecraft:block/amethyst_cluster", + "rotations": [ + 1, + 1, + 0 + ], + "uv_lock": false + } + ], + "position": [ + 5, + 4, + 22 + ], + "properties": { + "facing": "east", + "waterlogged": "false" + }, + "state_id": 26764 + }, + { + "block": "minecraft:stone", + "models": [ + { + "model": "minecraft:block/stone", + "rotations": [ + 0, + 2, + 0 + ], + "uv_lock": false + } + ], + "position": [ + -7, + 4, + 26 + ], + "properties": {}, + "state_id": 1 + }, + { + "block": "minecraft:stone", + "models": [ + { + "model": "minecraft:block/stone_mirrored", + "rotations": [ + 0, + 2, + 0 + ], + "uv_lock": false + } + ], + "position": [ + -3, + 4, + 26 + ], + "properties": {}, + "state_id": 1 + }, + { + "block": "minecraft:stone", + "models": [ + { + "model": "minecraft:block/stone", + "rotations": [ + 0, + 0, + 0 + ], + "uv_lock": false + } + ], + "position": [ + 1, + 4, + 26 + ], + "properties": {}, + "state_id": 1 + }, + { + "block": "minecraft:stone", + "models": [ + { + "model": "minecraft:block/stone", + "rotations": [ + 0, + 2, + 0 + ], + "uv_lock": false + } + ], + "position": [ + 5, + 4, + 26 + ], + "properties": {}, + "state_id": 1 + } + ], + "model_quads": 209, + "os": "linux", + "presented_frames": 30, + "project": "Horizon", + "resident_chunks": 9, + "schema": 1, + "scope": "Native cube and cuboid-model renderer with binary cutouts, stepped sprite animation and free camera; no gameplay simulation", + "sprite_layers": 18, + "window_size": [ + 1280, + 720 + ], + "native_selection": { + "matched_placements": 16, + "selected_parts": 20, + "client_jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "ea3bc37e515550e33301f8c12b50bb44a5496e5e1382c071eae1e43c4ffb3620", + "scope": "Actual native registry states, blockstate dispatch, root baking with tagged empty geometry, and legacy collection using state.getSeed(position). Model names and transform matrices match scene selections; no shader/pixel parity claim." + }, + "resource_files": { + "files": 5580, + "sha256": "873ea291669e5acbc7cb3e156efa0990c3a9b899a784fc63c16be75b187f5391" + }, + "executable_sha256": "a6f08da44b188cedcb9da2557d9a40c7ecc90a74c5efad8541c57330a2e0519b", + "resource_manifest_sha256": "94ec11d21355ece462b8fdc72da26d84d8fa686ce3e3d932f43b9f7aad8371ff", + "sources": { + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "tools/test_native_client.py": "f796ce17f2d93a7a876db531f178fde92a893338b1e056d649945ca63046005a", + "crates/horizon-client/Cargo.toml": "d56524457d761c2613c0699b20e21ad6977d93e009d59ef150bbd9fc20d7a025", + "crates/horizon-assets/Cargo.toml": "2f2cffacec0b4e22dd7cb032d594289bc51c94ae6cc4e985fee3e310f441d751", + "crates/horizon-client/src/assets.rs": "c1f6ed253c2c043050403b8d57a3f112275887d332d47344e1c157b4a0355de0", + "crates/horizon-client/src/camera.rs": "f9821c8a51a004dd4ad9c0952e746eb07926f6040cf8660bc26da5a0728ae572", + "crates/horizon-client/src/main.rs": "88cf5386ddbf9494d2867ee4c3b3016b7d55ceb6bf7f543362acc2f9e2fe1abd", + "crates/horizon-client/src/mesh.rs": "e2fa00435ec8239ba8a3c6539022bb50a10ff9c3850c6faab72f86aabea896ef", + "crates/horizon-client/src/models/catalog.rs": "35b854021f0bc941f44f76e99e7fcccb3a135157e7272174e84c3907aadbddf7", + "crates/horizon-client/src/models.rs": "63af351c9b48e7a796b2a9591ddb093316f301523b42c6855e5904ddf3ca20d9", + "crates/horizon-client/src/render.rs": "0f8929d9061b20adbc5ddd0adcbe9f90ce76227b7bb9bafe3f4474961ee2984c", + "crates/horizon-client/src/sprites.rs": "4dd10998581f901bd1c72ed49c27671f362f18285e86e795ddadd11cbc255f69", + "crates/horizon-client/src/world.rs": "901aa59c23ea084e926eec014589f4d511c41691a8dc1520534e039c28cfc76c", + "crates/horizon-client/src/world.wgsl": "82873c131f46a31aef35106f89a53589f179048362d0f8877eca6d20aa6274a4", + "crates/horizon-assets/src/animation.rs": "ebbf7952146a0e66b41396174492f5702627170b03a57e6cd5a45c97a08c975e", + "crates/horizon-assets/src/bake/transform.rs": "a95e658fef85b21bcb2f9f7512f98f98d57022d62c1199885b7133beae35a09d", + "crates/horizon-assets/src/bake.rs": "f55dda6b6cee5ac6e65a8ee4837fdd2c6674437d59e59b4c45718f6324d4a4d5", + "crates/horizon-assets/src/blockstate/bind.rs": "6278962e55c9786bba8184bdf2939af9c6e3b9002b08c3022129964b49a60009", + "crates/horizon-assets/src/blockstate/choice.rs": "5a66c8b9833e2f19dd8b0773f3593d97ff5941d3c5b773896b98049efa1395ba", + "crates/horizon-assets/src/blockstate.rs": "a4299dfd7adaeb4173982ffaa8e9c9eda2925739ae579a714193c99da2e7ce56", + "crates/horizon-assets/src/json.rs": "99fe8af4fbf5d4eed408a92e829ac1a39597a0d92471a6bff73771fad9c830a8", + "crates/horizon-assets/src/lib.rs": "e39f21c59a2c3e1c53d977b29bd5e0638e5fc41d86ff0fcc1882a6d90fd961e4", + "crates/horizon-assets/src/model.rs": "57ddb3d65e88e7a8aa22c62bc298a2dae7f4e994326a873a31f06c0f36ed051b", + "crates/horizon-assets/src/resolve.rs": "3927ac926cdcbd7d334901cc32d0ecc1e498b1bec98f76a46bca6d4964c13541", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaGallerySelectionOracle.java": "a0cf45cb96367404ea60c94a7fe25c142fba138df619bbe4396c633770342adc", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCuboidModelOracle.java": "7526f20513c549483122ab0d5ad24b9e87f38dc2f6aae55addd701a91ac85e43", + "tools/test_model_baking_parity.py": "392ffec44918fb91740ca4a1316d684480d39f14bd34d46175f7f44946d15bd7", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "tools/prepare_native_client.py": "87d3f99309ebe54c572fb6b2d3b693da172494eef438e9652c2353b6b00db4a6", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "2995b209aa3dc24cfcbba405cf8b97a398efbc0de97bb04ef2f51abb4cd2b84c", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f" + }, + "visual_inspection": { + "platform": "Linux x86_64, headless Wayland, Vulkan llvmpipe LLVM 21.1.8 CPU renderer", + "presented_frames": 3600, + "error": null, + "observed": "Rotated stairs and top slab, anvil orientation, multipart fence connections, open gate, bars, sideways amethyst, wall grindstone and four stone variants inspected in the controlled scene. Physical keyboard movement/rotation exercised. No native pixel comparison or hardware performance claim.", + "screenshots": "Private under .local/horizon-client/; no game textures or images in Git." + } +} diff --git a/crates/horizon-client/src/assets.rs b/crates/horizon-client/src/assets.rs index 2730fddd1..7c8844045 100644 --- a/crates/horizon-client/src/assets.rs +++ b/crates/horizon-client/src/assets.rs @@ -58,6 +58,7 @@ pub struct Assets { pub pixels: Vec, pub texture_layers: u32, pub model_quads: Vec, + pub model_gallery: Vec, pub animations: Vec, } fn invalid(message: &str) -> io::Error { @@ -181,7 +182,7 @@ impl Assets { let sprite = sprites.insert(root, &format!("minecraft:block/{name}"))?; layers[state.0 as usize] = sprite as i32; } - let model_quads = crate::models::gallery(root, &mut sprites)?; + let gallery = crate::models::gallery(root, ®istry, &mut sprites)?; Ok(Self { registry, properties, @@ -190,7 +191,8 @@ impl Assets { sprite_size: sprites.size, texture_layers: u32::try_from(sprites.layers.len())?, pixels: sprites.pixels, - model_quads, + model_quads: gallery.quads, + model_gallery: gallery.states, animations: sprites.animations, }) } diff --git a/crates/horizon-client/src/main.rs b/crates/horizon-client/src/main.rs index 399969f2d..4bf6274b8 100644 --- a/crates/horizon-client/src/main.rs +++ b/crates/horizon-client/src/main.rs @@ -169,7 +169,7 @@ impl App<'_> { "resident_chunks": self.world.chunks.len(), "merged_quads": self.mesh.len(), "model_quads": self.assets.model_quads.len(), - "model_gallery": models::GALLERY, + "model_gallery": self.assets.model_gallery, "sprite_layers": self.assets.texture_layers, "animated_sprites": self.assets.animations.len(), "animation_uploads": self.renderer.as_ref().map_or(0, |r| r.animation_uploads), diff --git a/crates/horizon-client/src/models.rs b/crates/horizon-client/src/models.rs index 492cbeb70..ec12d568a 100644 --- a/crates/horizon-client/src/models.rs +++ b/crates/horizon-client/src/models.rs @@ -1,25 +1,38 @@ -//! A resource-model inspection gallery. Blockstate dispatch is still separate. +//! A blockstate-driven inspection gallery, separate from gameplay simulation. +mod catalog; use crate::{Result, sprites::Sprites}; -use horizon_assets::{ - bake::bake_model, - model::{CuboidModel, Direction}, - resolve::ModelLibrary, -}; -use std::{collections::BTreeMap, fs, path::Path}; +use catalog::{StateModels, descriptor}; +use horizon_assets::model::Direction; +use horizon_core::position::BlockPos; +use horizon_world::registry::BlockRegistry; +use serde_json::{Value, json}; +use std::path::Path; -pub const GALLERY: [&str; 12] = [ - "oak_stairs", - "stone_slab", - "anvil", - "torch", - "lantern", - "oak_fence_post", - "oak_fence_gate", - "iron_bars_post", - "cobweb", - "grindstone", - "ladder", - "amethyst_cluster", +type Placement = (&'static str, &'static [(&'static str, &'static str)]); +const GALLERY: [Placement; 16] = [ + ( + "oak_stairs", + &[ + ("facing", "north"), + ("half", "top"), + ("shape", "inner_left"), + ], + ), + ("stone_slab", &[("type", "top")]), + ("anvil", &[("facing", "east")]), + ("torch", &[]), + ("lantern", &[]), + ("oak_fence", &[("north", "true"), ("east", "true")]), + ("oak_fence_gate", &[("facing", "west"), ("open", "true")]), + ("iron_bars", &[("north", "true"), ("south", "true")]), + ("cobweb", &[]), + ("grindstone", &[("face", "wall"), ("facing", "west")]), + ("ladder", &[("facing", "west")]), + ("amethyst_cluster", &[("facing", "east")]), + ("stone", &[]), + ("stone", &[]), + ("stone", &[]), + ("stone", &[]), ]; #[repr(C)] @@ -30,55 +43,47 @@ pub struct ModelInstance { pub layer: u32, pub shade: f32, } -pub fn gallery(root: &Path, sprites: &mut Sprites) -> Result> { - let mut models = BTreeMap::new(); - let mut pending: Vec<_> = GALLERY - .iter() - .map(|name| format!("minecraft:block/{name}")) - .collect(); - while let Some(name) = pending.pop() { - if models.contains_key(&name) { - continue; - } - let (namespace, path) = name.split_once(':').ok_or("invalid model identifier")?; - let text = fs::read_to_string(root.join(format!("assets/{namespace}/models/{path}.json")))?; - let model = CuboidModel::from_json(&text)?; - if let Some(parent) = &model.parent { - pending.push(parent.clone()); - } - models.insert(name, model); - } - let library = ModelLibrary::new(models)?; - let mut instances = Vec::new(); - for (index, name) in GALLERY.iter().enumerate() { - let model = library.resolve(&format!("minecraft:block/{name}"))?; - let origin = [ - (index % 4) as f32 * 4.0 - 7.0, - 4.0, - (index / 4) as f32 * 4.0 + 14.0, - ]; - for quad in bake_model(&model)? { - if quad.material.force_translucent || quad.tint_index != -1 { - return Err( - "inspection gallery requires untinted opaque or binary-cutout materials".into(), - ); - } - let layer = sprites.insert(root, &quad.material.sprite)?; - let shade = match quad.shade_direction_override.unwrap_or(quad.facing) { - Direction::Down => 0.5, - Direction::Up => 1.0, - Direction::North | Direction::South => 0.8, - Direction::West | Direction::East => 0.6, - }; - instances.push(ModelInstance { - positions: quad - .positions - .map(|v| std::array::from_fn(|i| v[i] + origin[i])), - uv: quad.uv, - layer, - shade, - }); - } - } - Ok(instances) +pub struct Gallery { + pub quads: Vec, + pub states: Vec, +} +pub fn gallery(root: &Path, registry: &BlockRegistry, sprites: &mut Sprites) -> Result { + let models = StateModels::load(root, registry, &GALLERY.map(|(name, _)| name), sprites)?; + let mut instances = Vec::new(); + let mut states = Vec::new(); + for (index, (name, properties)) in GALLERY.iter().enumerate() { + let state = registry.resolve(&descriptor(name, properties))?; + let actual = registry + .state(state) + .ok_or("missing gallery registry state")?; + let position = BlockPos::new((index % 4) as i32 * 4 - 7, 4, (index / 4) as i32 * 4 + 14); + let origin = [position.x as f32, position.y as f32, position.z as f32]; + let selected = models.collect(state, position)?; + states.push(json!({"block":actual.name,"properties":actual.properties,"state_id":state.0, + "position":[position.x,position.y,position.z], + "models":selected.iter().map(|(v,_)| json!({"model":v.model,"rotations":v.rotations,"uv_lock":v.uv_lock})).collect::>()})); + for (_, faces) in selected { + for face in faces { + let quad = &face.quad; + let shade = match quad.shade_direction_override.unwrap_or(quad.facing) { + Direction::Down => 0.5, + Direction::Up => 1.0, + Direction::North | Direction::South => 0.8, + Direction::West | Direction::East => 0.6, + }; + instances.push(ModelInstance { + positions: quad + .positions + .map(|v| std::array::from_fn(|i| v[i] + origin[i])), + uv: quad.uv, + layer: face.layer, + shade, + }); + } + } + } + Ok(Gallery { + quads: instances, + states, + }) } diff --git a/crates/horizon-client/src/models/catalog.rs b/crates/horizon-client/src/models/catalog.rs new file mode 100644 index 000000000..046ae172d --- /dev/null +++ b/crates/horizon-client/src/models/catalog.rs @@ -0,0 +1,214 @@ +//! Bind prepared registry states to model choices; bake each transformed model +//! once and share its geometry across positions. Resource failure recovery and +//! resource-pack reloads remain separate work. +use crate::{Result, sprites::Sprites}; +use horizon_assets::{ + bake::{BlockModelTransform, ModelQuad, bake_model_transformed}, + blockstate::{ + BlockStateDefinition, Variant, VariantSet, + bind::{Properties, PropertySchema, PropertyValues, SelectedModels}, + choice::CompiledChoices, + }, + model::CuboidModel, + resolve::ModelLibrary, +}; +use horizon_core::{ + position::BlockPos, + random::{LegacyRandom, position_seed}, +}; +use horizon_world::{ + chunk::BlockState, + registry::{BlockRegistry, BlockStateId}, +}; +use serde_json::Value; +use std::{ + collections::{BTreeMap, BTreeSet}, + fs, + path::Path, +}; + +pub struct BakedFace { + pub quad: ModelQuad, + pub layer: u32, +} +type VariantKey = (String, [u8; 3], bool); +pub struct StateModels { + choices: Vec, + states: BTreeMap, + baked: BTreeMap>, +} +fn key(variant: &Variant) -> VariantKey { + (variant.model.clone(), variant.rotations, variant.uv_lock) +} +impl StateModels { + pub fn load( + root: &Path, + registry: &BlockRegistry, + blocks: &[&str], + sprites: &mut Sprites, + ) -> Result { + let facts: BTreeMap = + serde_json::from_reader(fs::File::open(root.join("model-states.json"))?)?; + let mut choices = Vec::new(); + let mut states = BTreeMap::new(); + let mut variants = BTreeSet::new(); + for block in blocks.iter().copied().collect::>() { + let name = format!("minecraft:{block}"); + let facts = facts.get(&name).ok_or("missing block model state schema")?; + let schema: PropertySchema = facts["schema"] + .as_object() + .ok_or("invalid model schema")? + .iter() + .map(|(key, value)| { + let values = if let Some(range) = value.get("integer") { + PropertyValues::Integer { + minimum: i32::try_from( + range[0] + .as_i64() + .ok_or("invalid integer property minimum")?, + )?, + maximum: i32::try_from( + range[1] + .as_i64() + .ok_or("invalid integer property maximum")?, + )?, + } + } else { + PropertyValues::Named( + value["named"] + .as_array() + .ok_or("missing named property values")? + .iter() + .map(|v| { + v.as_str() + .map(str::to_owned) + .ok_or("invalid named property value") + }) + .collect::>()?, + ) + }; + Ok((key.clone(), values)) + }) + .collect::>()?; + let possible: Vec = serde_json::from_value(facts["states"].clone())?; + let resource = fs::read_to_string( + root.join(format!("assets/minecraft/blockstates/{block}.json")), + )?; + let definition = BlockStateDefinition::from_json(&resource)?; + let bound = definition.bind(&schema, &possible)?; + let native_order: Vec<_> = (0..registry.len()) + .filter_map(|i| { + let id = BlockStateId(i as u32); + let state = registry.state(id)?; + (state.name == name).then_some((id, &state.properties)) + }) + .collect(); + if native_order.len() != possible.len() + || native_order + .iter() + .zip(&possible) + .any(|((_, a), b)| *a != b) + { + return Err( + "model state definitions disagree with the imported block registry".into(), + ); + } + for ((id, _), selected) in native_order.into_iter().zip(bound) { + if let Some(selected) = selected { + states.insert(id, (choices.len(), selected)); + } + } + for choice in definition + .variants + .iter() + .flatten() + .map(|(_, choice)| choice) + .chain( + definition + .multipart + .iter() + .flatten() + .map(|selector| &selector.variant), + ) + { + match choice { + VariantSet::Single(v) => { + variants.insert(key(v)); + } + VariantSet::Weighted(v) => variants.extend(v.iter().map(|(v, _)| key(v))), + } + } + choices.push(CompiledChoices::new(&definition)?); + } + let mut models = BTreeMap::new(); + let mut pending: Vec<_> = variants.iter().map(|(name, _, _)| name.clone()).collect(); + while let Some(name) = pending.pop() { + if models.contains_key(&name) { + continue; + } + let (namespace, path) = name.split_once(':').ok_or("invalid model identifier")?; + let text = + fs::read_to_string(root.join(format!("assets/{namespace}/models/{path}.json")))?; + let model = CuboidModel::from_json(&text)?; + if let Some(parent) = &model.parent { + pending.push(parent.clone()); + } + models.insert(name, model); + } + let library = ModelLibrary::new(models)?; + let mut baked = BTreeMap::new(); + for (name, turns, lock) in variants { + let model = library.resolve(&name)?; + let faces = bake_model_transformed(&model, BlockModelTransform::new(turns, lock))?.into_iter().map(|quad| { + if quad.material.force_translucent || quad.tint_index != -1 { + return Err("inspection gallery requires untinted opaque or binary-cutout materials".into()); + } + let layer = sprites.insert(root, &quad.material.sprite)?; + Ok(BakedFace { quad, layer }) + }).collect::>()?; + baked.insert((name, turns, lock), faces); + } + Ok(Self { + choices, + states, + baked, + }) + } + pub fn collect( + &self, + state: BlockStateId, + position: BlockPos, + ) -> Result> { + let (choice, selected) = self + .states + .get(&state) + .ok_or("unbound gallery block state")?; + // These inspection blocks use Block's default position seed. Blocks with + // specialized model seeds (e.g. two-block structures) need their callbacks. + let mut random = LegacyRandom::new(position_seed(position)); + let mut variants = Vec::new(); + self.choices[*choice].collect(selected, &mut random, &mut variants)?; + variants + .into_iter() + .map(|v| { + Ok(( + v, + self.baked + .get(&key(v)) + .ok_or("unbaked block model")? + .as_slice(), + )) + }) + .collect() + } +} + +pub fn descriptor(name: &str, overrides: &[(&str, &str)]) -> BlockState { + BlockState { + name: format!("minecraft:{name}"), + properties: overrides + .iter() + .map(|(k, v)| ((*k).to_owned(), (*v).to_owned())) + .collect(), + } +} diff --git a/docs/native-client.md b/docs/native-client.md index 71f4b2e08..2259d861c 100644 --- a/docs/native-client.md +++ b/docs/native-client.md @@ -1,7 +1,7 @@ # Horizon native development client `horizon-client` opens a native Rust window and renders a controlled block scene -stored in Horizon's resident chunks, alongside twelve real resource models. It +stored in Horizon's resident chunks, alongside sixteen blockstate-driven model placements. It loads the block registry, models and sprites from pinned Java Edition 26.3 resources. A padded chunk mesh culls hidden faces across chunk boundaries and merges adjacent matching faces; @@ -12,14 +12,17 @@ is a free inspection tool. This checkpoint has no player simulation, vanilla world generation, block interaction, inventory, sound, networking or world save/load. It does not meet the [playable-build acceptance criteria](rust-parity.md#completion-criteria-and-playable-builds). -Blockstate dispatch, weighted variants, model transforms/UV locking, fractional +The model gallery now uses blockstate dispatch, weighted variants, multipart +conditions and transformed baking. Chunk-wide model rendering, fractional transparency, tinting, lighting, resource packs, chunk streaming and full visual parity remain unfinished. The resource gallery sits beside the pyramid and includes oak stairs, a slab, -an anvil, a torch, a lantern, fence parts, iron bars, a cobweb, a grindstone, a -ladder and an amethyst cluster. These are explicit model selections for geometry -inspection, not simulated block placements. Binary-alpha cutouts are rendered; +an anvil, a torch, a lantern, connected fences and iron bars, a cobweb, a wall +grindstone, a ladder, a sideways amethyst cluster and four weighted stone +placements. Registry state properties select the models: the stairs are an +upside-down inner corner, the slab is a top slab and the fence gate is open. +These remain static inspection placements without simulation callbacks. Binary-alpha cutouts are rendered; the lantern's three frames advance every eight inspection ticks at 20 ticks/s. The animation metadata codec and frame selection now use the shared `horizon-assets` implementation checked against the pinned client. GPU @@ -31,7 +34,8 @@ Sprites currently require matching square frame dimensions. Use current stable Rust (the locked client dependencies require Rust 1.90 or newer), Python 3.10+ and JDK 25. A native desktop display and compatible graphics driver are required. Resource preparation verifies the pinned game artifacts, -exports the registry using the reference server, and extracts selected client +exports the registry using the reference server and property schemas using the +reference client, and extracts selected client resources into ignored `.local/horizon-client/26.3/`. ```sh @@ -91,7 +95,7 @@ The [archived decoder result](../benchmarks/rust-resource-number-scanner-2026-10 records source, fixture and reference hashes. The oracle uses actual client classes; those rendering APIs are absent from the server. The decoder, parent resolver and baker now feed the development gallery. Blockstate selection, transformed -models and UV locking have the separate geometry checks described below. Rendered +models and UV locking have the separate checks described below. Rendered appearance still needs its own checks. `ModelLibrary` resolves parent geometry, ambient occlusion, GUI lighting and @@ -139,8 +143,7 @@ all 128 rotation/lock combinations on 81 synthetic models, plus further arbitrar element rotations. Positions, UVs and every orientation/inverse-face matrix compare by exact float bits: 19,704 roots and 148,439 quads match, including 7,884 bundled model/transform tuples. Quaternion basis rounding and numeric identity -rechecking are retained. This remains geometry validation; renderer integration, -atlas packing and pixel parity are separate work. +rechecking are retained. This remains geometry validation; atlas packing and pixel parity are separate work. ```sh python3 tools/test_blockstate_transform_parity.py @@ -167,7 +170,8 @@ selector and predicate cases: 3,802 definitions and 687,466 state results match, with 220 expected binding errors. It checks the native replacement-before-abort behavior for overlapping variants, eager multipart validation even when variants cover every state, integer-property aliases, nested conditions and empty part -selections. The actual renderer has not yet adopted these selections. +selections. The development gallery now uses this binder; general chunk model +rendering remains unfinished. The Java integer-property parser is shared by `horizon-core`, client binding and world-state decoding. Its [codec regression](../benchmarks/rust-blockstate-model-binding-2026-10-06/shared-integer-codec.json) @@ -186,7 +190,9 @@ uses actual `WeightedVariants.collectParts` and `MultiPartModel.collectParts` with inert observable leaves. All seven distinct bundled weight patterns, synthetic large weights and random multipart graphs produce matching selections and subsequent random values: 6,960 fixtures, 111,360 collections, both legacy -and xoroshiro streams. This does not yet bake or render the selected models. +and xoroshiro streams. The development gallery now bakes and renders selected +models using the legacy stream and the default block position seed. Specialized +block seed callbacks remain separate work. ```sh python3 tools/test_model_choice_parity.py @@ -225,7 +231,7 @@ python3 tools/test_native_client.py --vscreen The mesh tests compare expanded rectangles against independently enumerated exposed voxel faces, including solid neighbors, cavities, material boundaries, negative chunk origins and random surroundings. The startup runner launches a -nine-chunk scene, requires 30 presented frames and a clean exit, verifies 145 +nine-chunk scene, requires 30 presented frames and a clean exit, verifies 209 baked gallery faces across 18 sprite layers, and writes GPU, platform, binary and source information to ignored `.local/horizon-client/startup-smoke.json`. It has an external timeout as well as @@ -246,3 +252,13 @@ The model gallery was also inspected at close range on Linux/Vulkan llvmpipe. With the camera stationary, screenshot differences were confined to the lantern as its frames changed. The [model-client startup report](../benchmarks/rust-native-model-client-2026-10-06/startup-smoke.json) records the bounded presentation check and the scope of this visual inspection. + +The [blockstate-client report](../benchmarks/rust-native-blockstate-client-2026-10-06/startup-smoke.json) +also checks all 16 gallery placements against actual Java registry binding, root +baking and model collection using `state.getSeed(position)`. A tagged empty +geometry adapter identifies the 20 selected model parts and their transforms; +the separate baking gate covers actual quad geometry. Preparation exports typed +property domains and canonical state order, which the Rust loader checks against +its imported registry before binding. Each distinct transformed model is baked +once during gallery preparation and reused across positions. The selected state +IDs, properties, positions and models are recorded in the startup report. diff --git a/docs/rust-parity.md b/docs/rust-parity.md index 8fa299e0f..e6f6e7e36 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -3,7 +3,7 @@ The behavior target is the repository's pinned **Minecraft Java Edition 26.3**. One-to-one vanilla gameplay parity is the acceptance criterion. It has **not** been reached. Horizon now has a [native development client](native-client.md) -that renders a controlled block scene and twelve baked resource models with a +that renders a controlled block scene and sixteen blockstate-driven model placements with a free camera. It does not run a complete game server or gameplay simulation. The Rust workspace implements core arithmetic/random streams, world data and @@ -24,9 +24,11 @@ binding now also matches native selection across registered and special item-frame states. Weighted selection and multipart random draw consumption also match native traces. Transformed baking now checks every bundled model/rotation/UV-lock tuple and all XYZ quarter-turn combinations against native -geometry by exact float bits. Renderer integration remains unfinished. The native renderer now draws an -inspection gallery from the decoded/resolved/baked models, including binary -cutouts and stepped lantern animation; these are not yet gameplay blocks. +geometry by exact float bits. The native renderer now draws an +inspection gallery from registry-bound, selected and transformed models, including binary +cutouts, multipart connections, weighted stone variants and stepped lantern +animation. All 16 scene selections match native model collection. These are not +yet gameplay blocks; general chunk model rendering remains unfinished. Animation metadata, frame sequences and tick-state selection now have native differential coverage, including all bundled animated texture metadata. GPU interpolation and game-loop synchronization remain unfinished. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaGallerySelectionOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaGallerySelectionOracle.java new file mode 100644 index 000000000..334f3c089 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaGallerySelectionOracle.java @@ -0,0 +1,95 @@ +package dev.horizonlab.parity; + +import com.google.gson.*; +import com.mojang.math.Quadrant; +import com.mojang.serialization.JsonOps; +import java.nio.file.*; +import java.util.*; +import net.minecraft.client.renderer.block.dispatch.*; +import net.minecraft.client.resources.model.*; +import net.minecraft.client.resources.model.geometry.*; +import net.minecraft.client.resources.model.sprite.*; +import net.minecraft.core.*; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.resources.Identifier; +import net.minecraft.util.StrictJsonParser; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.Property; +import net.minecraft.world.level.levelgen.LegacyRandomSource; +import org.joml.Matrix4fc; +import static dev.horizonlab.parity.VanillaCuboidModelOracle.map; + +/** Real registry binding, root baking and model collection for the Rust scene. + * Empty tagged geometry isolates dispatch; FaceBakery has its separate gate. */ +public final class VanillaGallerySelectionOracle { + private static final Gson JSON=new GsonBuilder().serializeNulls().create(); + private static Object matrix(Matrix4fc value) { + var rows=new long[3][4]; + for(int r=0;r<3;r++)for(int c=0;c<4;c++)rows[r][c]=Integer.toUnsignedLong(Float.floatToIntBits(value.get(c,r))); + return rows; + } + private static JsonElement tag(String name,ModelState state) { + var faces=new ArrayList();for(var d:Direction.values())faces.add(matrix(state.inverseFaceTransformation(d))); + return JSON.toJsonTree(map("model",name,"matrix",matrix(state.transformation().getMatrix()),"inverse_uv",faces)); + } + private static final class Baker implements ModelBaker { + final IdentityHashMap tags=new IdentityHashMap<>(); + public ResolvedModel getModel(Identifier id) { + return new ResolvedModel() { + public String debugName(){return id.toString();} + public UnbakedModel wrapped(){throw new AssertionError("unexpected wrapped model access");} + public ResolvedModel parent(){return null;} + public TextureSlots getTopTextureSlots(){return null;} + public boolean getTopAmbientOcclusion(){return true;} + public Material.Baked resolveParticleMaterial(TextureSlots slots,ModelBaker baker){return null;} + public QuadCollection bakeTopGeometry(TextureSlots slots,ModelBaker baker,ModelState state) { + try { + var constructor=QuadCollection.class.getDeclaredConstructors()[0];constructor.setAccessible(true); + var empty=List.of();var result=(QuadCollection)constructor.newInstance(empty,empty,empty,empty,empty,empty,empty,empty); + tags.put(result,tag(id.toString(),state));return result; + } catch(ReflectiveOperationException error){throw new AssertionError(error);} + } + }; + } + public BlockStateModelPart missingBlockModelPart(){throw new AssertionError("unexpected missing model");} + public MaterialBaker materials(){throw new AssertionError("unexpected material bake");} + public ModelBaker.Interner interner(){throw new AssertionError("unexpected interner");} + public T compute(ModelBaker.SharedOperationKey key){return key.compute(this);} + } + private static > BlockState set(BlockState state,Property property,String value) { + return state.setValue(property,property.getValue(value).orElseThrow()); + } + public static void main(String[] args) throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); + var report=JsonParser.parseString(Files.readString(Path.of(args[0]))).getAsJsonObject(); + var results=new ArrayList();int index=0; + for(var item:report.getAsJsonArray("model_gallery")) { + var row=item.getAsJsonObject();var id=Identifier.parse(row.get("block").getAsString()); + var block=BuiltInRegistries.BLOCK.getValue(id);var state=block.defaultBlockState(); + for(var entry:row.getAsJsonObject("properties").entrySet()) + state=set(state,Objects.requireNonNull(block.getStateDefinition().getProperty(entry.getKey())),entry.getValue().getAsString()); + if(Block.getId(state)!=row.get("state_id").getAsInt())throw new AssertionError("state ID mismatch"); + String resource="/assets/"+id.getNamespace()+"/blockstates/"+id.getPath()+".json"; + String raw;try(var input=VanillaGallerySelectionOracle.class.getResourceAsStream(resource)) { + raw=new String(Objects.requireNonNull(input).readAllBytes(),java.nio.charset.StandardCharsets.UTF_8); + } + var definition=BlockStateModelDispatcher.CODEC.parse(JsonOps.INSTANCE,StrictJsonParser.parse(raw)).getOrThrow(); + var root=definition.instantiate(block.getStateDefinition(),id::toString).get(state); + var baker=new Baker();var model=Objects.requireNonNull(root).bake(state,baker); + var pos=row.getAsJsonArray("position");var position=new BlockPos(pos.get(0).getAsInt(),pos.get(1).getAsInt(),pos.get(2).getAsInt()); + var parts=new ArrayList();model.collectParts(new LegacyRandomSource(state.getSeed(position)),parts); + var actual=new ArrayList(); + for(var part:parts)actual.add(Objects.requireNonNull(baker.tags.get(((SimpleModelWrapper)part).quads()))); + var expected=new ArrayList(); + for(var selected:row.getAsJsonArray("models")) { + var v=selected.getAsJsonObject();var t=v.getAsJsonArray("rotations"); + var transform=new Variant.SimpleModelState(Quadrant.values()[t.get(0).getAsInt()],Quadrant.values()[t.get(1).getAsInt()],Quadrant.values()[t.get(2).getAsInt()],v.get("uv_lock").getAsBoolean()).asModelState(); + expected.add(tag(v.get("model").getAsString(),transform)); + } + if(!actual.equals(expected))throw new AssertionError("gallery selection mismatch at "+index+" "+id+": native="+actual+" Rust="+expected); + results.add(map("case",index++,"state_id",Block.getId(state),"models",actual)); + } + Files.writeString(Path.of(args[1]),JSON.toJson(results)); + } +} diff --git a/tools/prepare_native_client.py b/tools/prepare_native_client.py index c670ce65f..285df656a 100644 --- a/tools/prepare_native_client.py +++ b/tools/prepare_native_client.py @@ -7,11 +7,12 @@ from pathlib import Path import subprocess import zipfile try: - from . import lab, test_rust_parity as base, test_worldgen_parity as worldgen + from . import lab, test_rust_parity as base, test_worldgen_parity as worldgen, test_model_baking_parity as baking except ImportError: import lab import test_rust_parity as base import test_worldgen_parity as worldgen + import test_model_baking_parity as baking def main(): @@ -43,6 +44,23 @@ def main(): subprocess.run(['java', '-Xmx512M', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.VanillaHeightmapOracle', 'export', str(facts)], check=True, stdout=log, stderr=subprocess.STDOUT, timeout=3600) + binding = oracle.with_name('VanillaBlockStateBindingOracle.java') + helper = oracle.with_name('VanillaCuboidModelOracle.java') + binding_sources = base.source_hashes([binding, helper]) + model_states = root / 'model-states.json' + if not (previous.get('model_state_exporters_sha256') == binding_sources + and previous.get('client_sha256') == origin['client_sha256'] + and model_states.exists() + and previous.get('model_states_sha256') == lab.digest(model_states, 'sha256')): + classes = root / 'client-classes'; classes.mkdir(exist_ok=True) + dependencies = os.pathsep.join(map(str, [jars['client'], *baking.client_libraries()])) + with (root / 'model-state-export.log').open('w') as log: + subprocess.run(['javac', '--release', str(lock['minecraft']['java_major']), '-proc:none', + '-cp', dependencies, '-d', str(classes), str(binding), str(helper)], + check=True, stdout=log, stderr=subprocess.STDOUT, timeout=3600) + subprocess.run(['java', '-Xmx512M', '-cp', str(classes) + os.pathsep + dependencies, + 'dev.horizonlab.parity.VanillaBlockStateBindingOracle', 'export', str(model_states)], + check=True, stdout=log, stderr=subprocess.STDOUT, timeout=3600) tags = worldgen.tag_resources(jars['server']) if tags != worldgen.tag_resources(jars['client']): raise ValueError('Reference block tags disagree') @@ -64,7 +82,9 @@ def main(): target.parent.mkdir(parents=True, exist_ok=True) target.write_bytes(data) count += 1 - lab.write_json(manifest, {'schema': 1, **origin, 'data_version': version['world_version'], + lab.write_json(manifest, {'schema': 2, **origin, + 'model_state_exporters_sha256': binding_sources, + 'model_states_sha256': lab.digest(model_states, 'sha256'), 'data_version': version['world_version'], 'facts_sha256': lab.digest(facts, 'sha256'), 'block_tags_sha256': lab.digest(root / 'block-tags.json', 'sha256'), 'resource_files': count}) print(f'Prepared Horizon native-client resources: {root}') diff --git a/tools/test_native_client.py b/tools/test_native_client.py index 0244a9b63..cad568f0f 100644 --- a/tools/test_native_client.py +++ b/tools/test_native_client.py @@ -13,13 +13,15 @@ import subprocess import sys try: - from . import lab + from . import lab, test_rust_parity as base, test_model_baking_parity as baking except ImportError: import lab + import test_rust_parity as base + import test_model_baking_parity as baking def resource_fingerprint(root): - files = [root / 'facts.json', root / 'block-tags.json', root / 'horizon-resources.json', + files = [root / 'facts.json', root / 'model-states.json', root / 'block-tags.json', root / 'horizon-resources.json', *sorted(path for path in (root / 'assets').rglob('*') if path.is_file())] digest = hashlib.sha256() for path in files: @@ -44,8 +46,13 @@ def main(): resources = resource_fingerprint(root / '26.3') sources = [lab.ROOT / 'Cargo.toml', lab.ROOT / 'Cargo.lock', Path(__file__).resolve(), lab.ROOT / 'crates/horizon-client/Cargo.toml', lab.ROOT / 'crates/horizon-assets/Cargo.toml', - *sorted((lab.ROOT / 'crates/horizon-client/src').glob('*')), - *sorted((lab.ROOT / 'crates/horizon-assets/src').glob('*.rs'))] + *sorted((lab.ROOT / 'crates/horizon-client/src').rglob('*')), + *sorted((lab.ROOT / 'crates/horizon-assets/src').rglob('*.rs'))] + oracle = lab.ROOT / 'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaGallerySelectionOracle.java' + helper = oracle.with_name('VanillaCuboidModelOracle.java') + sources += [oracle, helper, lab.ROOT/'tools/test_model_baking_parity.py', lab.ROOT/'tools/test_rust_parity.py', lab.ROOT/'tools/lab.py', lab.ROOT/'tools/prepare_native_client.py'] + for crate in ['horizon-core', 'horizon-world']: + sources += [lab.ROOT/'crates'/crate/'Cargo.toml', *sorted((lab.ROOT/'crates'/crate/'src').rglob('*.rs'))] tested_sources = { str(path.relative_to(lab.ROOT)): lab.digest(path, 'sha256') for path in sources @@ -68,10 +75,29 @@ def main(): result = json.loads(report.read_text()) if (result.get('error') is not None or result.get('presented_frames') != 30 or result.get('resident_chunks') != 9 or result.get('merged_quads', 0) <= 0 - or result.get('model_quads') != 145 or len(result.get('model_gallery', [])) != 12 + or result.get('model_quads') != 209 or len(result.get('model_gallery', [])) != 16 or result.get('sprite_layers') != 18 or result.get('animated_sprites') != 1 or not result.get('adapter') or min(result.get('window_size', [0])) <= 0): raise RuntimeError('Incomplete native client presentation: ' + str(report)) + lock, jars, _ = base.verify_artifacts() + classes = root/'gallery-classes'; classes.mkdir(exist_ok=True) + dependencies = os.pathsep.join(map(str, [jars['client'], *baking.client_libraries()])) + native = root/'gallery-selection.json' + with (root/'gallery-selection.log').open('w') as log: + subprocess.run(['javac', '--release', str(lock['minecraft']['java_major']), '-proc:none', '-cp', dependencies, + '-d', str(classes), str(oracle), str(helper)], cwd=lab.ROOT, check=True, + stdout=log, stderr=subprocess.STDOUT, timeout=3600) + subprocess.run(['java', '-Xmx512M', '-cp', str(classes)+os.pathsep+dependencies, + 'dev.horizonlab.parity.VanillaGallerySelectionOracle', str(report), str(native)], + cwd=lab.ROOT, check=True, stdout=log, stderr=subprocess.STDOUT, timeout=3600) + selections = json.loads(native.read_text()) + if len(selections) != len(result['model_gallery']): + raise RuntimeError('Incomplete native gallery selection check') + result['native_selection'] = {'matched_placements': len(selections), + 'selected_parts': sum(len(s['models']) for s in selections), + 'client_jar_sha256': lab.digest(jars['client'], 'sha256'), + 'output_sha256': lab.digest(native, 'sha256'), + 'scope': 'Actual native registry states, blockstate dispatch, root baking with tagged empty geometry, and legacy collection using state.getSeed(position). Model names and transform matrices match scene selections; no shader/pixel parity claim.'} if resource_fingerprint(root / '26.3') != resources: raise RuntimeError('Resources changed during native client verification') result['resource_files'] = resources From f5ba959cdcc62f01a4bb1fc0bc47d258eb182b22 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 22:10:44 +0200 Subject: [PATCH 055/253] Match native neighboring block-face visibility and suppression --- .../scoped-parity.json | 217 ++++++++++++++++++ .../examples/face_visibility_fixture.rs | 85 +++++++ crates/horizon-world/src/block_render.rs | 205 +++++++++++++++++ crates/horizon-world/src/lib.rs | 1 + docs/face-visibility.md | 41 ++++ docs/native-client.md | 4 + docs/rust-parity.md | 2 + .../parity/VanillaFaceVisibilityOracle.java | 68 ++++++ tools/test_face_visibility_parity.py | 94 ++++++++ 9 files changed, 717 insertions(+) create mode 100644 benchmarks/rust-face-visibility-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-world/examples/face_visibility_fixture.rs create mode 100644 crates/horizon-world/src/block_render.rs create mode 100644 docs/face-visibility.md create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceVisibilityOracle.java create mode 100644 tools/test_face_visibility_parity.py diff --git a/benchmarks/rust-face-visibility-2026-10-06/scoped-parity.json b/benchmarks/rust-face-visibility-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..bedf33f29 --- /dev/null +++ b/benchmarks/rust-face-visibility-2026-10-06/scoped-parity.json @@ -0,0 +1,217 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "registry_states": 35723, + "block_definitions": 1286, + "behavior_kinds": [ + "bars", + "leaves", + "liquid", + "mangrove_roots", + "never", + "same_block" + ], + "pairs": 1441816, + "direction_and_leaf_setting_cases": 17301792, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceVisibilityOracle.java": "00f5337317bba7a491bb62bbf07b32637657055c6f3076066bb01edf134169a1", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "60ff9ef7c1d5e23c080f9aec95ab2e7d3b7c5b5bcd67b9efa9518776c400629a", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_face_visibility_parity.py": "3f9bc4ebd8af5e5c600a0bd507210aa757c1e5faca8536f43fffead45fc1e02d", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-world/examples/face_visibility_fixture.rs": "e3e58c9d092fcf11c1e50d971e20f8be3bd3d9d462d48e26f9a550fdb2937218", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "9f254668a237fc2d28a599b0ee6f1eac57cdafa2fd1af67e6a2303ee98fdd5ed", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f" + }, + "fixtures_sha256": { + ".local/rust-face-visibility-parity/pairs.txt": "555ad20f071cfbe3cdcb9533a6ffedd3e44ede8f29e91f6566e8f7256b1ea01c", + ".local/rust-face-visibility-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-face-visibility-parity/occlusion.nbt": "a3ae54c4316613140fb93fabec61e32a11d46185da7abc4e6f453bb900f260a8", + ".local/rust-face-visibility-parity/definitions.json": "7084a7304cb44fdfeea3eb9f8a228d5a4af8a4029ad58f0831a044720eea27f7", + ".local/rust-face-visibility-parity/tags.json": "5e1301e5a9abf7e4de93af5dae3a157e852dbdb4ea345c2eb626305a605d4f98" + }, + "rust_output_sha256": "e537bccb19f4e91569e5389c9578ced9f41fe3f258b8e1881a38f9f69a04e2a6", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "e537bccb19f4e91569e5389c9578ced9f41fe3f258b8e1881a38f9f69a04e2a6", + "matched_output_lines": 2883632 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "e537bccb19f4e91569e5389c9578ced9f41fe3f258b8e1881a38f9f69a04e2a6", + "matched_output_lines": 2883632 + } + ], + "scope": "Actual BlockState.skipRendering and Block.shouldRenderFace for all registered states against representative and seeded random neighbors, exhaustive same-block pairs for override families and every cross-material bars/panes connection state pair. All six directions and both cutout-leaf settings; pinned block tags bound on both Java sides. Rust imports raw occlusion grids, class-rule assignments, definition canOcclude flags and tag membership, then computes face geometry, canonical shortcuts, skip rules and ONLY_FIRST subtraction. Includes waterlogged fluid neighbors, glass identity, vertical roots, bars tag/property checks and partial occlusion. Does not establish chunk mesh integration, lighting, translucent sorting, fluid surfaces, GPU pixels or gameplay parity." +} diff --git a/crates/horizon-world/examples/face_visibility_fixture.rs b/crates/horizon-world/examples/face_visibility_fixture.rs new file mode 100644 index 000000000..b2ef8716c --- /dev/null +++ b/crates/horizon-world/examples/face_visibility_fixture.rs @@ -0,0 +1,85 @@ +use horizon_core::geometry::Direction; +use horizon_world::{ + block_render::{FaceVisibility, RenderDefinition, SkipRendering}, + collision::CachedCollisionRegistry, + nbt::{self, Limits, Tag}, + registry::{BlockRegistry, BlockStateId}, +}; +use serde_json::Value; +use std::{ + collections::BTreeMap, + fs, + io::{BufRead, BufReader, BufWriter, Write}, + path::Path, +}; +fn main() -> Result<(), Box> { + let path = std::env::args().nth(1).ok_or("private fixture directory")?; + let dir = Path::new(&path); + let read = |name: &str| -> Result> { + Ok( + nbt::read_named(&fs::read(dir.join(name))?, Limits::default())? + .0 + .tag, + ) + }; + let registry = BlockRegistry::from_nbt(&read("block-registry.nbt")?)?; + let occlusion = CachedCollisionRegistry::from_nbt(&read("occlusion.nbt")?, ®istry)?; + let definitions: BTreeMap = + serde_json::from_reader(fs::File::open(dir.join("definitions.json"))?)?; + let definitions = definitions + .into_iter() + .map(|(name, v)| { + let skip = match v["rule"].as_str().ok_or("missing rule")? { + "never" => SkipRendering::Never, + "same_block" => SkipRendering::SameBlock, + "bars" => SkipRendering::Bars, + "leaves" => SkipRendering::Leaves, + "liquid" => SkipRendering::Liquid, + "mangrove_roots" => SkipRendering::MangroveRoots, + _ => return Err("unrecognized rendering rule"), + }; + Ok(( + name, + RenderDefinition { + skip, + can_occlude: v["can_occlude"].as_bool().ok_or("missing occlusion flag")?, + bars_tag: v["bars_tag"].as_bool().ok_or("missing bars tag")?, + }, + )) + }) + .collect::>()?; + let mut visibility = FaceVisibility::new(&occlusion, &definitions)?; + for invalid in [registry.len() as u32, u32::MAX] { + assert!( + visibility + .should_render_face(BlockStateId(invalid), BlockStateId(0), Direction::Up, false) + .is_err() + ); + assert!( + visibility + .skip_rendering(BlockStateId(0), BlockStateId(invalid), Direction::Up, false) + .is_err() + ); + } + let mut output = BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in BufReader::new(fs::File::open(dir.join("pairs.txt"))?).lines() { + let line = line?; + let (a, b) = line.split_once(' ').ok_or("invalid pair")?; + let a = BlockStateId(a.parse()?); + let b = BlockStateId(b.parse()?); + for cutout in [false, true] { + let mut skip = 0u8; + let mut visible = 0u8; + for direction in Direction::ALL { + if visibility.skip_rendering(a, b, direction, cutout)? { + skip |= 1 << direction as u8; + } + if visibility.should_render_face(a, b, direction, cutout)? { + visible |= 1 << direction as u8; + } + } + writeln!(output, "{} {} {cutout} {skip} {visible}", a.0, b.0)?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/src/block_render.rs b/crates/horizon-world/src/block_render.rs new file mode 100644 index 000000000..129614cf4 --- /dev/null +++ b/crates/horizon-world/src/block_render.rs @@ -0,0 +1,205 @@ +//! Neighbor face visibility over immutable block definitions and occlusion grids. +//! This decides whether a culled model face is emitted; it does not shade it or +//! implement translucent sorting, fluid meshing, or block updates. +use crate::{ + collision::CachedCollisionRegistry, + compression::invalid, + fluid::{FluidKind, FluidState}, + registry::BlockStateId, +}; +use horizon_core::geometry::{Direction, ShapeOp, VoxelShape}; +use std::{ + collections::{BTreeMap, HashMap}, + io, +}; + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum SkipRendering { + Never, + SameBlock, + Bars, + Leaves, + Liquid, + MangroveRoots, +} +#[derive(Clone, Copy, Debug)] +pub struct RenderDefinition { + pub skip: SkipRendering, + pub can_occlude: bool, + pub bars_tag: bool, +} +#[derive(Clone, Copy)] +struct State { + block: BlockStateId, + faces: [u32; 6], + definition: RenderDefinition, + connections: u8, + connection_properties: u8, + fluid: FluidKind, +} +/// Prepared face geometry and a bounded cache shared across state pairs. Geometry +/// is deduplicated by the imported immutable shape, not copied for every state. +pub struct FaceVisibility { + states: Vec, + faces: Vec, + cache: HashMap<(u32, u32), bool>, +} +impl FaceVisibility { + pub fn new( + occlusion: &CachedCollisionRegistry<'_>, + definitions: &BTreeMap, + ) -> io::Result { + let registry = occlusion.registry(); + let mut states = Vec::with_capacity(registry.len()); + // IDs 0 and 1 represent the canonical empty/full face singletons used + // by BlockState.initCache; other empty-like shapes retain their identity. + let mut faces = vec![VoxelShape::empty(), VoxelShape::block()]; + let mut shape_faces = HashMap::new(); + for id in 0..registry.len() { + let id = BlockStateId(id as u32); + let state = registry + .state(id) + .ok_or_else(|| invalid("unknown render state"))?; + let definition = *definitions + .get(&state.name) + .ok_or_else(|| invalid("missing render definition"))?; + let shape = occlusion + .cached_shape(id)? + .ok_or_else(|| invalid("missing occlusion geometry"))?; + let face_ids = if !definition.can_occlude || shape.is_empty() { + [0; 6] + } else if let Some(ids) = shape_faces.get(&std::ptr::from_ref(shape)) { + *ids + } else { + let mut ids = [1; 6]; + if shape + .join_is_not_empty(&faces[1], ShapeOp::XOR) + .map_err(|e| invalid(e.to_string()))? + { + for direction in Direction::ALL { + let face = shape + .face_shape(direction) + .map_err(|e| invalid(e.to_string()))?; + ids[direction as usize] = if face.same_identity(&faces[0]) { + 0 + } else if face.same_identity(&faces[1]) { + 1 + } else { + let id = faces.len() as u32; + faces.push(face); + id + }; + } + } + shape_faces.insert(std::ptr::from_ref(shape), ids); + ids + }; + let mut connections = 0; + let mut connection_properties = 0; + for (name, direction) in [ + ("north", Direction::North), + ("south", Direction::South), + ("west", Direction::West), + ("east", Direction::East), + ] { + if let Some(value @ ("false" | "true")) = + state.properties.get(name).map(String::as_str) + { + connection_properties |= 1 << direction as u8; + if value == "true" { + connections |= 1 << direction as u8; + } + } + } + if definition.skip == SkipRendering::Bars && connection_properties != 0b111100 { + return Err(invalid("bars rendering requires four boolean connections")); + } + states.push(State { + block: registry + .default_state(&state.name) + .ok_or_else(|| invalid("missing render block identity"))?, + faces: face_ids, + definition, + connections, + connection_properties, + fluid: FluidState::from_block(state)?.kind(), + }); + } + Ok(Self { + states, + faces, + cache: HashMap::new(), + }) + } + fn state(&self, id: BlockStateId) -> io::Result { + self.states + .get(id.0 as usize) + .copied() + .ok_or_else(|| invalid("unknown render state ID")) + } + fn skips(a: State, b: State, direction: Direction, cutout_leaves: bool) -> bool { + let vertical = matches!(direction, Direction::Down | Direction::Up); + let bit = 1 << direction as u8; + let opposite = 1 << direction.opposite() as u8; + match a.definition.skip { + SkipRendering::Never => false, + SkipRendering::SameBlock => a.block == b.block, + SkipRendering::Leaves => !cutout_leaves && b.definition.skip == SkipRendering::Leaves, + SkipRendering::Liquid => a.fluid.same_family(b.fluid), + SkipRendering::MangroveRoots => a.block == b.block && vertical, + SkipRendering::Bars => { + (a.block == b.block + || (a.definition.bars_tag + && b.definition.bars_tag + && b.connection_properties & opposite != 0)) + && (vertical || (a.connections & bit != 0 && b.connections & opposite != 0)) + } + } + } + pub fn skip_rendering( + &self, + state: BlockStateId, + neighbor: BlockStateId, + direction: Direction, + cutout_leaves: bool, + ) -> io::Result { + Ok(Self::skips( + self.state(state)?, + self.state(neighbor)?, + direction, + cutout_leaves, + )) + } + pub fn should_render_face( + &mut self, + state: BlockStateId, + neighbor: BlockStateId, + direction: Direction, + cutout_leaves: bool, + ) -> io::Result { + let a = self.state(state)?; + let b = self.state(neighbor)?; + let neighbor_face = b.faces[direction.opposite() as usize]; + if neighbor_face == 1 || Self::skips(a, b, direction, cutout_leaves) { + return Ok(false); + } + let own_face = a.faces[direction as usize]; + if neighbor_face == 0 || own_face == 0 { + return Ok(true); + } + let key = (own_face, neighbor_face); + if let Some(value) = self.cache.get(&key) { + return Ok(*value); + } + let visible = self.faces[own_face as usize] + .join_is_not_empty(&self.faces[neighbor_face as usize], ShapeOp::ONLY_FIRST) + .map_err(|e| invalid(e.to_string()))?; + // Cache policy affects speed only. Keep bounded memory while retaining + // more shared face pairs than the native 256-entry per-thread cache. + if self.cache.len() == 4096 { + self.cache.clear(); + } + self.cache.insert(key, visible); + Ok(visible) + } +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 04667b337..1ac0957e8 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -5,6 +5,7 @@ pub mod block_collision; pub mod block_entities; pub mod block_placement; pub mod block_properties; +pub mod block_render; pub mod block_support; pub mod block_survival; pub mod chunk; diff --git a/docs/face-visibility.md b/docs/face-visibility.md new file mode 100644 index 000000000..f4112eb70 --- /dev/null +++ b/docs/face-visibility.md @@ -0,0 +1,41 @@ +# Neighboring model-face visibility + +`horizon-world::block_render::FaceVisibility` decides whether to emit a model +quad with a culling direction beside a neighboring block. It prepares immutable +face geometry from the pinned raw occlusion shapes, shares faces across states, +and caches shape-pair subtraction with bounded memory. It is ready for chunk +meshing; it does not yet replace the development scene's cube-only culling. + +The decision preserves the native order: a canonical full neighbor face hides +the quad, block-specific suppression can hide it, canonical empty faces bypass +the shape comparison, and partial faces use `ONLY_FIRST` subtraction. Full +occlusion is computed from geometry, independently of collision or support. + +Block-specific suppression covers every method owner in the pinned registry: +ordinary blocks, same-block glass/ice and powder snow, bars/panes, leaves, +liquids, and mangrove roots. Bars respect the loaded bars tag, facing connections, +and the neighbor's boolean property availability. Leaf suppression is controlled +by the cutout-leaves setting. Liquids compare fluid families, including contained +water in waterlogged neighbors. Mangrove roots suppress vertical internal faces. + +The [native comparison](../benchmarks/rust-face-visibility-2026-10-06/scoped-parity.json) +calls actual `BlockState.skipRendering` and `Block.shouldRenderFace` with pinned +tags bound in both reference JARs. It covers all 35,723 states and 1,286 block +definitions: 1,441,816 ordered state pairs, six directions and two leaf settings +(17,301,792 direction/setting cases). Every overriding family has exhaustive +same-block state pairs; bars and panes also have exhaustive cross-material +connection pairs. Representative and seeded random neighbors exercise partial +occlusion across the rest of the registry. Both references match 2,883,632 output +lines, each containing suppression and visibility masks for all six directions. + +```sh +python3 tools/test_face_visibility_parity.py +cargo clippy --workspace --all-targets --locked -- -D warnings +``` + +The private imports contain raw shape grids, definition flags, class-rule +assignments and tag membership. Rust computes the behavior being compared. +Unknown state IDs produce errors. Native fixture files, reference JARs and traces +stay under ignored `.local/`; only hashed reports are committed. Lighting, +translucent sorting, fluid surfaces, GPU pixels and gameplay remain outside this +comparison. Native macOS and Windows runs are still required. diff --git a/docs/native-client.md b/docs/native-client.md index 2259d861c..de20fac54 100644 --- a/docs/native-client.md +++ b/docs/native-client.md @@ -262,3 +262,7 @@ property domains and canonical state order, which the Rust loader checks against its imported registry before binding. Each distinct transformed model is baked once during gallery preparation and reused across positions. The selected state IDs, properties, positions and models are recorded in the startup report. + +[Neighbor-face visibility](face-visibility.md) now has native client/server +coverage across all registered states and suppression-rule families. Integrating +that result with resident chunk model meshing is the next rendering step. diff --git a/docs/rust-parity.md b/docs/rust-parity.md index e6f6e7e36..ef31caf53 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -29,6 +29,8 @@ inspection gallery from registry-bound, selected and transformed models, includi cutouts, multipart connections, weighted stone variants and stepped lantern animation. All 16 scene selections match native model collection. These are not yet gameplay blocks; general chunk model rendering remains unfinished. +[Neighbor face visibility](face-visibility.md) now matches both reference JARs +across 1,441,816 state pairs, including all pinned suppression-rule families. Animation metadata, frame sequences and tick-state selection now have native differential coverage, including all bundled animated texture metadata. GPU interpolation and game-loop synchronization remain unfinished. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceVisibilityOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceVisibilityOracle.java new file mode 100644 index 000000000..c88bcc7ed --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceVisibilityOracle.java @@ -0,0 +1,68 @@ +package dev.horizonlab.parity; + +import com.google.gson.*; +import java.io.*; +import java.nio.file.*; +import java.util.*; +import net.minecraft.core.Direction; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.nbt.*; +import net.minecraft.tags.BlockTags; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.state.BlockState; + +/** Imports definition kinds and raw geometry; compares actual skipRendering and + * Block.shouldRenderFace on the unmodified native state registry. */ +public final class VanillaFaceVisibilityOracle { + private static final Gson JSON=new GsonBuilder().serializeNulls().create(); + private static String rule(Block block) throws Exception { + for(Class type=block.getClass();type!=null;type=type.getSuperclass()) { + try { + type.getDeclaredMethod("skipRendering",BlockState.class,BlockState.class,Direction.class); + return switch(type.getSimpleName()) { + case "BlockBehaviour" -> "never"; + case "HalfTransparentBlock", "PowderSnowBlock" -> "same_block"; + case "IronBarsBlock" -> "bars"; + case "LeavesBlock" -> "leaves"; + case "LiquidBlock" -> "liquid"; + case "MangroveRootsBlock" -> "mangrove_roots"; + default -> throw new AssertionError("Unhandled skip-rendering owner "+type); + }; + } catch(NoSuchMethodException ignored) {} + } + throw new AssertionError("Missing skip-rendering method"); + } + public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); + var directory=Path.of(args[1]); + VanillaHeightmapOracle.bindTags(JsonParser.parseString(Files.readString(directory.resolve("tags.json"))).getAsJsonObject()); + if(args[0].equals("export")) { + VanillaCollisionOracle.main(new String[]{"generate",args[1]}); + try(var output=new DataOutputStream(Files.newOutputStream(directory.resolve("occlusion.nbt")))) { + NbtIo.write(VanillaCollisionOracle.occlusionDefinitions(),output); + } + var definitions=new TreeMap(); + for(var block:BuiltInRegistries.BLOCK) { + var state=block.defaultBlockState();var ids=new ArrayList(); + for(var value:block.getStateDefinition().getPossibleStates())ids.add(Block.getId(value)); + definitions.put(BuiltInRegistries.BLOCK.getKey(block).toString(),Map.of("rule",rule(block), + "can_occlude",state.canOcclude(),"bars_tag",state.is(BlockTags.BARS),"default",Block.getId(state),"states",ids)); + } + Files.writeString(directory.resolve("definitions.json"),JSON.toJson(definitions));return; + } + try(var inputs=Files.newBufferedReader(directory.resolve("pairs.txt"));var output=Files.newBufferedWriter(directory.resolve(args[0]+".txt"))) { + for(String line;(line=inputs.readLine())!=null;) { + var values=line.split(" ");int a=Integer.parseInt(values[0]),b=Integer.parseInt(values[1]); + var state=Block.stateById(a);var neighbor=Block.stateById(b); + for(boolean cutout:new boolean[]{false,true}) { + LeavesBlock.setCutoutLeaves(cutout);int skip=0,visible=0; + for(var direction:Direction.values()) { + if(state.skipRendering(neighbor,direction))skip|=1< Date: Tue, 6 Oct 2026 22:30:16 +0200 Subject: [PATCH 056/253] Mesh resident block models with native culling and UV-aware merging --- .../startup-smoke.json | 676 ++++++++++++++++++ crates/horizon-client/src/assets.rs | 20 +- crates/horizon-client/src/main.rs | 23 +- crates/horizon-client/src/mesh.rs | 259 +++++-- crates/horizon-client/src/models.rs | 106 ++- crates/horizon-client/src/models/catalog.rs | 47 +- crates/horizon-client/src/models/cube.rs | 158 ++++ crates/horizon-client/src/render.rs | 7 +- crates/horizon-client/src/sprites.rs | 3 + crates/horizon-client/src/world.rs | 22 +- crates/horizon-client/src/world.wgsl | 8 +- docs/face-visibility.md | 4 +- docs/native-client.md | 51 +- docs/rust-parity.md | 13 +- .../parity/VanillaGallerySelectionOracle.java | 70 +- tools/prepare_native_client.py | 27 +- tools/test_native_client.py | 21 +- 17 files changed, 1330 insertions(+), 185 deletions(-) create mode 100644 benchmarks/rust-native-chunk-models-2026-10-06/startup-smoke.json create mode 100644 crates/horizon-client/src/models/cube.rs diff --git a/benchmarks/rust-native-chunk-models-2026-10-06/startup-smoke.json b/benchmarks/rust-native-chunk-models-2026-10-06/startup-smoke.json new file mode 100644 index 000000000..38986e175 --- /dev/null +++ b/benchmarks/rust-native-chunk-models-2026-10-06/startup-smoke.json @@ -0,0 +1,676 @@ +{ + "adapter": { + "backend": "Vulkan", + "device": 0, + "device_type": "Cpu", + "name": "llvmpipe (LLVM 21.1.8, 256 bits)", + "vendor": 65541 + }, + "animated_sprites": 1, + "animation_uploads": 1, + "arch": "x86_64", + "camera_pitch": -0.3839724354387525, + "camera_position": [ + 25.0, + 18.0, + 25.0 + ], + "camera_yaw": -2.356194490192345, + "culled_model_faces": 59636, + "elapsed_seconds": 0.674486099, + "error": null, + "merged_quads": 3169, + "model_blocks": 10919, + "model_gallery": [ + { + "block": "minecraft:oak_stairs", + "models": [ + { + "model": "minecraft:block/oak_stairs_inner", + "rotations": [ + 2, + 3, + 0 + ], + "uv_lock": true + } + ], + "position": [ + -7, + 4, + 14 + ], + "properties": { + "facing": "north", + "half": "top", + "shape": "inner_left", + "waterlogged": "false" + }, + "state_id": 5466 + }, + { + "block": "minecraft:stone_slab", + "models": [ + { + "model": "minecraft:block/stone_slab_top", + "rotations": [ + 0, + 0, + 0 + ], + "uv_lock": false + } + ], + "position": [ + -3, + 4, + 14 + ], + "properties": { + "type": "top", + "waterlogged": "false" + }, + "state_id": 15250 + }, + { + "block": "minecraft:anvil", + "models": [ + { + "model": "minecraft:block/anvil", + "rotations": [ + 0, + 3, + 0 + ], + "uv_lock": false + } + ], + "position": [ + 1, + 4, + 14 + ], + "properties": { + "facing": "east" + }, + "state_id": 12965 + }, + { + "block": "minecraft:torch", + "models": [ + { + "model": "minecraft:block/torch", + "rotations": [ + 0, + 0, + 0 + ], + "uv_lock": false + } + ], + "position": [ + 5, + 4, + 14 + ], + "properties": {}, + "state_id": 4926 + }, + { + "block": "minecraft:lantern", + "models": [ + { + "model": "minecraft:block/lantern", + "rotations": [ + 0, + 0, + 0 + ], + "uv_lock": false + } + ], + "position": [ + -7, + 4, + 18 + ], + "properties": { + "hanging": "false", + "waterlogged": "false" + }, + "state_id": 24197 + }, + { + "block": "minecraft:oak_fence", + "models": [ + { + "model": "minecraft:block/oak_fence_post", + "rotations": [ + 0, + 0, + 0 + ], + "uv_lock": false + }, + { + "model": "minecraft:block/oak_fence_side", + "rotations": [ + 0, + 0, + 0 + ], + "uv_lock": true + }, + { + "model": "minecraft:block/oak_fence_side", + "rotations": [ + 0, + 1, + 0 + ], + "uv_lock": true + } + ], + "position": [ + -3, + 4, + 18 + ], + "properties": { + "east": "true", + "north": "true", + "south": "false", + "waterlogged": "false", + "west": "false" + }, + "state_id": 8642 + }, + { + "block": "minecraft:oak_fence_gate", + "models": [ + { + "model": "minecraft:block/oak_fence_gate_open", + "rotations": [ + 0, + 1, + 0 + ], + "uv_lock": true + } + ], + "position": [ + 1, + 4, + 18 + ], + "properties": { + "facing": "west", + "in_wall": "false", + "open": "true", + "powered": "false" + }, + "state_id": 10401 + }, + { + "block": "minecraft:iron_bars", + "models": [ + { + "model": "minecraft:block/iron_bars_post_ends", + "rotations": [ + 0, + 0, + 0 + ], + "uv_lock": false + }, + { + "model": "minecraft:block/iron_bars_side", + "rotations": [ + 0, + 0, + 0 + ], + "uv_lock": false + }, + { + "model": "minecraft:block/iron_bars_side_alt", + "rotations": [ + 0, + 0, + 0 + ], + "uv_lock": false + } + ], + "position": [ + 5, + 4, + 18 + ], + "properties": { + "east": "false", + "north": "true", + "south": "true", + "waterlogged": "false", + "west": "false" + }, + "state_id": 9711 + }, + { + "block": "minecraft:cobweb", + "models": [ + { + "model": "minecraft:block/cobweb", + "rotations": [ + 0, + 0, + 0 + ], + "uv_lock": false + } + ], + "position": [ + -7, + 4, + 22 + ], + "properties": {}, + "state_id": 2362 + }, + { + "block": "minecraft:grindstone", + "models": [ + { + "model": "minecraft:block/grindstone", + "rotations": [ + 1, + 3, + 0 + ], + "uv_lock": false + } + ], + "position": [ + -3, + 4, + 22 + ], + "properties": { + "face": "wall", + "facing": "west" + }, + "state_id": 24135 + }, + { + "block": "minecraft:ladder", + "models": [ + { + "model": "minecraft:block/ladder", + "rotations": [ + 0, + 3, + 0 + ], + "uv_lock": false + } + ], + "position": [ + 1, + 4, + 22 + ], + "properties": { + "facing": "west", + "waterlogged": "false" + }, + "state_id": 7312 + }, + { + "block": "minecraft:amethyst_cluster", + "models": [ + { + "model": "minecraft:block/amethyst_cluster", + "rotations": [ + 1, + 1, + 0 + ], + "uv_lock": false + } + ], + "position": [ + 5, + 4, + 22 + ], + "properties": { + "facing": "east", + "waterlogged": "false" + }, + "state_id": 26764 + }, + { + "block": "minecraft:stone", + "models": [ + { + "model": "minecraft:block/stone", + "rotations": [ + 0, + 2, + 0 + ], + "uv_lock": false + } + ], + "position": [ + -7, + 4, + 26 + ], + "properties": {}, + "state_id": 1 + }, + { + "block": "minecraft:stone", + "models": [ + { + "model": "minecraft:block/stone_mirrored", + "rotations": [ + 0, + 2, + 0 + ], + "uv_lock": false + } + ], + "position": [ + -3, + 4, + 26 + ], + "properties": {}, + "state_id": 1 + }, + { + "block": "minecraft:stone", + "models": [ + { + "model": "minecraft:block/stone", + "rotations": [ + 0, + 0, + 0 + ], + "uv_lock": false + } + ], + "position": [ + 1, + 4, + 26 + ], + "properties": {}, + "state_id": 1 + }, + { + "block": "minecraft:stone", + "models": [ + { + "model": "minecraft:block/stone", + "rotations": [ + 0, + 2, + 0 + ], + "uv_lock": false + } + ], + "position": [ + 5, + 4, + 26 + ], + "properties": {}, + "state_id": 1 + } + ], + "model_quads": 179, + "os": "linux", + "presented_frames": 30, + "project": "Horizon", + "resident_chunks": 9, + "schema": 1, + "scope": "Native cube and cuboid-model renderer with binary cutouts, stepped sprite animation and free camera; no gameplay simulation", + "sprite_layers": 18, + "visible_model_faces": 5991, + "window_size": [ + 1280, + 720 + ], + "native_scene_culling": { + "blocks": 10919, + "culled_faces": 59636, + "visible_faces": 5991 + }, + "native_selection": { + "matched_placements": 16, + "selected_parts": 20, + "client_jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "a2ff1c890d6f3a5292c3a9402f02ca5404a993dc117853b25cbe64ac92b76d30", + "scope": "Actual native registry states, blockstate dispatch, tagged root baking and legacy collection using state.getSeed(position). All 16 featured placements match model names/transforms. An independently constructed native scene also matches total occupied blocks and visible/culled model faces using native parent resolution, rotated culling directions and Block.shouldRenderFace. No shader/pixel parity claim." + }, + "resource_files": { + "files": 5582, + "sha256": "9b03385cb17f8c75a9031e05c0524c2b50606e149857a44a398fe353a830f756" + }, + "executable_sha256": "6c3bed79f13b82275f8164ce2c98feb11fdf8718be59c90b7bbd139f52f7703b", + "resource_manifest_sha256": "f25499f7b4897feee0f097c065b65541e932611e4de6817210db527532d36c14", + "sources": { + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "tools/test_native_client.py": "95b12bdb90702a5e2253119543f5430fa7a344e0dc5ad312354325feb97c2e79", + "crates/horizon-client/Cargo.toml": "d56524457d761c2613c0699b20e21ad6977d93e009d59ef150bbd9fc20d7a025", + "crates/horizon-assets/Cargo.toml": "2f2cffacec0b4e22dd7cb032d594289bc51c94ae6cc4e985fee3e310f441d751", + "crates/horizon-client/src/assets.rs": "e595afa610e0425d0b3ad694218794bf9e680e46ae80f3925c278ef1a823c914", + "crates/horizon-client/src/camera.rs": "f9821c8a51a004dd4ad9c0952e746eb07926f6040cf8660bc26da5a0728ae572", + "crates/horizon-client/src/main.rs": "e74045bc8f882b55d1861ff87700e517766645596d02dd72f2e16e8165d5b6e5", + "crates/horizon-client/src/mesh.rs": "4ac8d85b30f599b37a98b92adcc016b16434816b93c401bd39b8215f591f9330", + "crates/horizon-client/src/models/catalog.rs": "620103719167fc9ab76e730d68eeacb50014e95b7ad209ae7adf2cbbe69f70f7", + "crates/horizon-client/src/models/cube.rs": "1067229f9dd9b276950bf7ec0c5f67061ce3d40a21932dca8034b9748e7439a4", + "crates/horizon-client/src/models.rs": "98dd3b969947c2b297862a934e6235067ddc1fc8cda5adcc6276d19014d4b048", + "crates/horizon-client/src/render.rs": "db17511223d0b72cf13bbb1bd7cbfca119d249f1d8914e7c1c06a710494c5123", + "crates/horizon-client/src/sprites.rs": "292f844a31f6e8884008df9630e2b8862db1acfbc4640cc07d526e25f21f0bc5", + "crates/horizon-client/src/world.rs": "17bd7127283c5ea27166e0e8079e8c284c6cff426a2fa8994879e48151e1ded4", + "crates/horizon-client/src/world.wgsl": "972a58ccb34e9965515adbb30c47a93fceca5b742390db6d9f69cba1ec31f559", + "crates/horizon-assets/src/animation.rs": "ebbf7952146a0e66b41396174492f5702627170b03a57e6cd5a45c97a08c975e", + "crates/horizon-assets/src/bake/transform.rs": "a95e658fef85b21bcb2f9f7512f98f98d57022d62c1199885b7133beae35a09d", + "crates/horizon-assets/src/bake.rs": "f55dda6b6cee5ac6e65a8ee4837fdd2c6674437d59e59b4c45718f6324d4a4d5", + "crates/horizon-assets/src/blockstate/bind.rs": "6278962e55c9786bba8184bdf2939af9c6e3b9002b08c3022129964b49a60009", + "crates/horizon-assets/src/blockstate/choice.rs": "5a66c8b9833e2f19dd8b0773f3593d97ff5941d3c5b773896b98049efa1395ba", + "crates/horizon-assets/src/blockstate.rs": "a4299dfd7adaeb4173982ffaa8e9c9eda2925739ae579a714193c99da2e7ce56", + "crates/horizon-assets/src/json.rs": "99fe8af4fbf5d4eed408a92e829ac1a39597a0d92471a6bff73771fad9c830a8", + "crates/horizon-assets/src/lib.rs": "e39f21c59a2c3e1c53d977b29bd5e0638e5fc41d86ff0fcc1882a6d90fd961e4", + "crates/horizon-assets/src/model.rs": "57ddb3d65e88e7a8aa22c62bc298a2dae7f4e994326a873a31f06c0f36ed051b", + "crates/horizon-assets/src/resolve.rs": "3927ac926cdcbd7d334901cc32d0ecc1e498b1bec98f76a46bca6d4964c13541", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaGallerySelectionOracle.java": "dc5433f1ce1de629b30cb70f031a43a691fc1df1fb218ce23de89769c164d562", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCuboidModelOracle.java": "7526f20513c549483122ab0d5ad24b9e87f38dc2f6aae55addd701a91ac85e43", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_model_baking_parity.py": "392ffec44918fb91740ca4a1316d684480d39f14bd34d46175f7f44946d15bd7", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "tools/prepare_native_client.py": "712c1de220bea609621b376cdff04e65fa2102dbb214604d556cff7511fb9f7c", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "9f254668a237fc2d28a599b0ee6f1eac57cdafa2fd1af67e6a2303ee98fdd5ed", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f" + }, + "visual_inspection": { + "platform": "Linux x86_64, headless Wayland, Vulkan llvmpipe LLVM 21.1.8 CPU renderer", + "resident_chunks": 81, + "model_blocks": 84647, + "merged_quads": 28071, + "model_quads": 179, + "presented_frames": 3232, + "error": null, + "observed": "Resident terrain and featured models inspected on the virtual screen. Physical movement, arrow rotation, diagnostics toggle and Ctrl+Q exercised; clean exit. No native pixel or hardware FPS comparison.", + "screenshots": "Private under .local/horizon-client/." + } +} diff --git a/crates/horizon-client/src/assets.rs b/crates/horizon-client/src/assets.rs index 7c8844045..40ae1a335 100644 --- a/crates/horizon-client/src/assets.rs +++ b/crates/horizon-client/src/assets.rs @@ -53,11 +53,11 @@ pub struct Assets { pub registry: BlockRegistry, pub properties: Properties, pub material_states: [BlockStateId; 6], - pub layers: Vec, pub sprite_size: u32, pub pixels: Vec, pub texture_layers: u32, - pub model_quads: Vec, + pub model_catalog: crate::models::StateModels, + pub model_placements: Vec<(horizon_core::position::BlockPos, BlockStateId)>, pub model_gallery: Vec, pub animations: Vec, } @@ -167,11 +167,6 @@ impl Assets { }) .collect::>()?, )); - let mut layers: Vec<_> = properties - .0 - .iter() - .map(|state| if state.air { -1 } else { -2 }) - .collect(); let mut material_states = [BlockStateId(0); 6]; let mut sprites = crate::sprites::Sprites::default(); for (layer, name) in MATERIALS.iter().enumerate() { @@ -179,20 +174,19 @@ impl Assets { .default_state(&format!("minecraft:{name}")) .ok_or_else(|| invalid("missing test-scene material"))?; material_states[layer] = state; - let sprite = sprites.insert(root, &format!("minecraft:block/{name}"))?; - layers[state.0 as usize] = sprite as i32; + sprites.insert(root, &format!("minecraft:block/{name}"))?; } - let gallery = crate::models::gallery(root, ®istry, &mut sprites)?; + let models = crate::models::prepare(root, ®istry, &mut sprites)?; Ok(Self { registry, properties, material_states, - layers, sprite_size: sprites.size, texture_layers: u32::try_from(sprites.layers.len())?, pixels: sprites.pixels, - model_quads: gallery.quads, - model_gallery: gallery.states, + model_catalog: models.catalog, + model_placements: models.placements, + model_gallery: models.states, animations: sprites.animations, }) } diff --git a/crates/horizon-client/src/main.rs b/crates/horizon-client/src/main.rs index 4bf6274b8..fc18d484c 100644 --- a/crates/horizon-client/src/main.rs +++ b/crates/horizon-client/src/main.rs @@ -10,7 +10,7 @@ mod sprites; mod world; use assets::Assets; use camera::Camera; -use mesh::Quad; +use mesh::Mesh; use render::Renderer; use std::{ collections::HashSet, @@ -101,7 +101,7 @@ impl Options { struct App<'a> { assets: &'a Assets, world: TestWorld<'a>, - mesh: Vec, + mesh: Mesh, options: Options, window: Option>, renderer: Option, @@ -167,8 +167,11 @@ impl App<'_> { "presented_frames": self.frames, "elapsed_seconds": self.started.elapsed().as_secs_f64(), "resident_chunks": self.world.chunks.len(), - "merged_quads": self.mesh.len(), - "model_quads": self.assets.model_quads.len(), + "merged_quads": self.mesh.cubes.len(), + "model_quads": self.mesh.models.len(), + "visible_model_faces": self.mesh.visible_faces, + "culled_model_faces": self.mesh.culled_faces, + "model_blocks": self.mesh.model_blocks, "model_gallery": self.assets.model_gallery, "sprite_layers": self.assets.texture_layers, "animated_sprites": self.assets.animations.len(), @@ -204,7 +207,8 @@ impl ApplicationHandler for App<'_> { match pollster::block_on(Renderer::new( window.clone(), self.assets, - &self.mesh, + &self.mesh.cubes, + &self.mesh.models, ((self.options.radius + 1) * 16) as f32, )) { Ok(renderer) => self.renderer = Some(renderer), @@ -305,7 +309,7 @@ impl ApplicationHandler for App<'_> { self.window.as_ref().unwrap().set_title(&format!( "Horizon — Development | {fps:.0} FPS | {} chunks | {} quads", self.world.chunks.len(), - self.mesh.len() + self.mesh.cubes.len() )); self.title_at = Instant::now(); self.title_frames = self.frames; @@ -353,12 +357,13 @@ fn run() -> Result<()> { format!("{error}\nPrepare pinned resources with: python3 tools/prepare_native_client.py") })?; let world = TestWorld::new(&assets, options.radius)?; - let mesh = mesh::build(&world)?; + let mut visibility = models::load_visibility(&options.resources, &assets.registry)?; + let mesh = mesh::build(&world, &assets, &mut visibility)?; eprintln!( "Horizon development scene: {} resident chunks, {} merged cube faces, {} baked model faces.\nClick to capture mouse; WASD/Space/Shift move; arrows rotate; Esc releases; Ctrl+Q quits.", world.chunks.len(), - mesh.len(), - assets.model_quads.len() + mesh.cubes.len(), + mesh.models.len() ); let now = Instant::now(); let mut app = App { diff --git a/crates/horizon-client/src/mesh.rs b/crates/horizon-client/src/mesh.rs index 4640d5f98..37213bf29 100644 --- a/crates/horizon-client/src/mesh.rs +++ b/crates/horizon-client/src/mesh.rs @@ -1,6 +1,14 @@ -//! Greedy opaque-cube meshing for the controlled renderer scene. Model geometry, -//! weighted variants, tinting, transparency and lighting are separate work. -use crate::{Result, world::TestWorld}; +//! Resident blockstate model meshing. Greedy rectangles preserve the texture +//! and signed UV basis of eligible unit-cube faces; other geometry stays baked. +use crate::{ + Result, + assets::Assets, + models::{self, CubeStyle, ModelInstance}, + world::TestWorld, +}; +use horizon_core::{geometry::Direction, position::BlockPos}; +use horizon_world::block_render::FaceVisibility; + #[repr(C)] #[derive(Clone, Copy, bytemuck::Pod, bytemuck::Zeroable)] pub struct Quad { @@ -8,6 +16,17 @@ pub struct Quad { pub extent: [f32; 2], pub face: u32, pub layer: u32, + pub uv_origin: [f32; 2], + pub uv_u: [f32; 2], + pub uv_v: [f32; 2], + pub shade: f32, +} +pub struct Mesh { + pub cubes: Vec, + pub models: Vec, + pub visible_faces: usize, + pub culled_faces: usize, + pub model_blocks: usize, } fn position(face: usize, plane: usize, u: usize, v: usize) -> [usize; 3] { match face { @@ -16,36 +35,137 @@ fn position(face: usize, plane: usize, u: usize, v: usize) -> [usize; 3] { _ => [plane, v, u], } } -pub fn build(world: &TestWorld<'_>) -> Result> { - let mut quads = Vec::new(); +pub fn build( + world: &TestWorld<'_>, + assets: &Assets, + visibility: &mut FaceVisibility, +) -> Result { + let mut mesh = Mesh { + cubes: Vec::new(), + models: Vec::new(), + visible_faces: 0, + culled_faces: 0, + model_blocks: 0, + }; for &(cx, cz) in world.chunks.keys() { - let mut cells = [-1_i32; 18 * 18 * 18]; - for y in 0..18 { - for z in 0..18 { - for x in 0..18 { - cells[index(x, y, z)] = world.layer( - cx * 16 + x as i32 - 1, - y as i32 - 1, - cz * 16 + z as i32 - 1, - )?; + let mut masks = vec![[None; 256]; 6 * 16]; + for y in 0..16 { + for z in 0..16 { + for x in 0..16 { + let pos = BlockPos::new(cx * 16 + x, y, cz * 16 + z); + let state = world.block(pos.x, pos.y, pos.z); + if world.is_air(state) { + continue; + } + mesh.model_blocks += 1; + let selected = assets.model_catalog.collect(state, pos)?; + let mut visible = [false; 6]; + for direction in Direction::ALL { + let [dx, dy, dz] = direction.normal(); + let neighbor = world.block(pos.x + dx, pos.y + dy, pos.z + dz); + visible[direction as usize] = + visibility.should_render_face(state, neighbor, direction, true)?; + } + if selected.len() == 1 + && let Some(styles) = selected[0].1.cube + { + for (face, style) in styles.into_iter().enumerate() { + if !visible[face] { + mesh.culled_faces += 1; + continue; + } + mesh.visible_faces += 1; + let (plane, u, v) = match face { + 0 | 1 => (y, x, z), + 2 | 3 => (z, x, y), + _ => (x, z, y), + }; + masks[face * 16 + plane as usize][(u + 16 * v) as usize] = Some(style); + } + } else { + for (_, model) in selected { + for face in &model.faces { + if face.quad.cull.is_some_and(|d| !visible[d as usize]) { + mesh.culled_faces += 1; + continue; + } + mesh.visible_faces += 1; + mesh.models.push(models::instance(face, pos)); + } + } + } } } } - mesh_chunk(&cells, cx, cz, &mut quads); + for (index, mask) in masks.iter_mut().enumerate() { + merge(mask, index / 16, index % 16, cx, cz, &mut mesh.cubes); + } } - Ok(quads) + Ok(mesh) } +fn merge( + mask: &mut [Option; 256], + face: usize, + plane: usize, + cx: i32, + cz: i32, + quads: &mut Vec, +) { + for v in 0..16 { + let mut u = 0; + while u < 16 { + let Some(style) = mask[u + v * 16] else { + u += 1; + continue; + }; + let mut width = 1; + while u + width < 16 && mask[u + width + v * 16] == Some(style) { + width += 1; + } + let mut height = 1; + while v + height < 16 + && (u..u + width).all(|x| mask[x + (v + height) * 16] == Some(style)) + { + height += 1; + } + for y in v..v + height { + for x in u..u + width { + mask[x + y * 16] = None; + } + } + let p = position(face, plane + usize::from(face % 2 == 1), u, v); + let [a, b, c, d, e, f] = style.uv.map(f32::from); + quads.push(Quad { + origin: [ + (cx * 16 + p[0] as i32) as f32, + p[1] as f32, + (cz * 16 + p[2] as i32) as f32, + ], + extent: [width as f32, height as f32], + face: face as u32, + layer: style.layer, + uv_origin: [a, b], + uv_u: [c, d], + uv_v: [e, f], + shade: f32::from_bits(style.shade_bits), + }); + u += width; + } + } +} + +#[cfg(test)] fn index(x: usize, y: usize, z: usize) -> usize { x + 18 * (z + 18 * y) } +#[cfg(test)] fn mesh_chunk(cells: &[i32; 18 * 18 * 18], cx: i32, cz: i32, quads: &mut Vec) { for face in 0..6 { for plane in 0..16 { - let mut mask = [-1_i32; 256]; + let mut mask = [None; 256]; for v in 0..16 { for u in 0..16 { let p = position(face, plane + 1, u + 1, v + 1); - let layer = cells[index(p[0], p[1], p[2])]; let mut adjacent = p; let axis = match face { 0 | 1 => 1, @@ -57,52 +177,20 @@ fn mesh_chunk(cells: &[i32; 18 * 18 * 18], cx: i32, cz: i32, quads: &mut Vec= 0 && cells[index(adjacent[0], adjacent[1], adjacent[2])] < 0 { - mask[u + v * 16] = layer; + mask[u + 16 * v] = Some(CubeStyle { + layer: layer as u32, + uv: [0, 1, 1, 0, 0, -1], + shade_bits: 1f32.to_bits(), + }); } } } - for v in 0..16 { - let mut u = 0; - while u < 16 { - let layer = mask[u + v * 16]; - if layer < 0 { - u += 1; - continue; - } - let mut width = 1; - while u + width < 16 && mask[u + width + v * 16] == layer { - width += 1; - } - let mut height = 1; - while v + height < 16 - && (u..u + width).all(|x| mask[x + (v + height) * 16] == layer) - { - height += 1; - } - for y in v..v + height { - for x in u..u + width { - mask[x + y * 16] = -1; - } - } - let p = position(face, plane + usize::from(face % 2 == 1), u, v); - quads.push(Quad { - origin: [ - (cx * 16 + p[0] as i32) as f32, - p[1] as f32, - (cz * 16 + p[2] as i32) as f32, - ], - extent: [width as f32, height as f32], - face: face as u32, - layer: layer as u32, - }); - u += width; - } - } + merge(&mut mask, face, plane, cx, cz, quads); } } } - #[cfg(test)] mod tests { use super::*; @@ -178,6 +266,63 @@ mod tests { quads } + #[test] + fn merging_preserves_rotation_mirroring_shade_and_texture() { + let bases = [ + [0, 0, 1, 0, 0, 1], + [1, 0, 0, 1, -1, 0], + [1, 1, -1, 0, 0, -1], + [0, 1, 0, -1, 1, 0], + [1, 0, -1, 0, 0, 1], + [0, 1, 1, 0, 0, -1], + [0, 0, 0, 1, 1, 0], + [1, 1, 0, -1, -1, 0], + ]; + let original: [Option; 256] = std::array::from_fn(|i| { + (i % 17 != 0).then_some(CubeStyle { + layer: (i / 64) as u32, + uv: bases[(i / 4) % 8], + shade_bits: if i % 5 == 0 { 0.5f32 } else { 1f32 }.to_bits(), + }) + }); + for face in 0..6 { + let mut mask = original; + let mut quads = Vec::new(); + merge(&mut mask, face, 4, -2, 3, &mut quads); + let mut covered = [false; 256]; + for q in quads { + let p = [q.origin[0] + 32.0, q.origin[1], q.origin[2] - 48.0]; + let (u0, v0) = match face { + 0 | 1 => (p[0] as usize, p[2] as usize), + 2 | 3 => (p[0] as usize, p[1] as usize), + _ => (p[2] as usize, p[1] as usize), + }; + for dv in 0..q.extent[1] as usize { + for du in 0..q.extent[0] as usize { + let index = u0 + du + 16 * (v0 + dv); + assert!(!covered[index]); + covered[index] = true; + let style = original[index].unwrap(); + assert_eq!(q.layer, style.layer); + assert_eq!(q.shade.to_bits(), style.shade_bits); + let [a, b, c, d, e, f] = style.uv.map(f32::from); + let local = [a + c * 0.25 + e * 0.75, b + d * 0.25 + f * 0.75]; + let merged: [f32; 2] = std::array::from_fn(|axis| { + q.uv_origin[axis] + + q.uv_u[axis] * (du as f32 + 0.25) + + q.uv_v[axis] * (dv as f32 + 0.75) + }); + assert_eq!( + local.map(|v| v.rem_euclid(1.0)), + merged.map(|v| v.rem_euclid(1.0)) + ); + } + } + } + assert_eq!(covered, original.map(|v| v.is_some())); + } + } + #[test] fn empty_solid_and_neighbor_seams() { let mut cells = [-1; 18 * 18 * 18]; diff --git a/crates/horizon-client/src/models.rs b/crates/horizon-client/src/models.rs index ec12d568a..5cd6d319e 100644 --- a/crates/horizon-client/src/models.rs +++ b/crates/horizon-client/src/models.rs @@ -1,10 +1,12 @@ //! A blockstate-driven inspection gallery, separate from gameplay simulation. mod catalog; +mod cube; use crate::{Result, sprites::Sprites}; -use catalog::{StateModels, descriptor}; -use horizon_assets::model::Direction; +pub use catalog::StateModels; +use catalog::descriptor; +pub use cube::CubeStyle; use horizon_core::position::BlockPos; -use horizon_world::registry::BlockRegistry; +use horizon_world::registry::{BlockRegistry, BlockStateId}; use serde_json::{Value, json}; use std::path::Path; @@ -43,13 +45,20 @@ pub struct ModelInstance { pub layer: u32, pub shade: f32, } -pub struct Gallery { - pub quads: Vec, +pub struct PreparedModels { + pub catalog: StateModels, + pub placements: Vec<(BlockPos, BlockStateId)>, pub states: Vec, } -pub fn gallery(root: &Path, registry: &BlockRegistry, sprites: &mut Sprites) -> Result { - let models = StateModels::load(root, registry, &GALLERY.map(|(name, _)| name), sprites)?; - let mut instances = Vec::new(); +pub fn prepare( + root: &Path, + registry: &BlockRegistry, + sprites: &mut Sprites, +) -> Result { + let mut blocks = GALLERY.map(|(name, _)| name).to_vec(); + blocks.extend(crate::assets::MATERIALS); + let catalog = StateModels::load(root, registry, &blocks, sprites)?; + let mut placements = Vec::new(); let mut states = Vec::new(); for (index, (name, properties)) in GALLERY.iter().enumerate() { let state = registry.resolve(&descriptor(name, properties))?; @@ -57,33 +66,68 @@ pub fn gallery(root: &Path, registry: &BlockRegistry, sprites: &mut Sprites) -> .state(state) .ok_or("missing gallery registry state")?; let position = BlockPos::new((index % 4) as i32 * 4 - 7, 4, (index / 4) as i32 * 4 + 14); - let origin = [position.x as f32, position.y as f32, position.z as f32]; - let selected = models.collect(state, position)?; + let selected = catalog.collect(state, position)?; states.push(json!({"block":actual.name,"properties":actual.properties,"state_id":state.0, "position":[position.x,position.y,position.z], "models":selected.iter().map(|(v,_)| json!({"model":v.model,"rotations":v.rotations,"uv_lock":v.uv_lock})).collect::>()})); - for (_, faces) in selected { - for face in faces { - let quad = &face.quad; - let shade = match quad.shade_direction_override.unwrap_or(quad.facing) { - Direction::Down => 0.5, - Direction::Up => 1.0, - Direction::North | Direction::South => 0.8, - Direction::West | Direction::East => 0.6, - }; - instances.push(ModelInstance { - positions: quad - .positions - .map(|v| std::array::from_fn(|i| v[i] + origin[i])), - uv: quad.uv, - layer: face.layer, - shade, - }); - } - } + placements.push((position, state)); } - Ok(Gallery { - quads: instances, + Ok(PreparedModels { + catalog, + placements, states, }) } +pub fn instance(face: &catalog::BakedFace, position: BlockPos) -> ModelInstance { + let origin = [position.x as f32, position.y as f32, position.z as f32]; + ModelInstance { + positions: face + .quad + .positions + .map(|v| std::array::from_fn(|i| v[i] + origin[i])), + uv: face.quad.uv, + layer: face.layer, + shade: cube::shade(face), + } +} + +pub fn load_visibility( + root: &Path, + registry: &BlockRegistry, +) -> Result { + use horizon_world::{ + block_render::{FaceVisibility, RenderDefinition, SkipRendering}, + collision::CachedCollisionRegistry, + nbt::{self, Limits}, + }; + use std::{collections::BTreeMap, fs}; + let data = nbt::read_named(&fs::read(root.join("occlusion.nbt"))?, Limits::default())? + .0 + .tag; + let occlusion = CachedCollisionRegistry::from_nbt(&data, registry)?; + let raw: BTreeMap = + serde_json::from_reader(fs::File::open(root.join("render-definitions.json"))?)?; + let definitions = raw + .into_iter() + .map(|(name, v)| { + let skip = match v["rule"].as_str().ok_or("missing render rule")? { + "never" => SkipRendering::Never, + "same_block" => SkipRendering::SameBlock, + "bars" => SkipRendering::Bars, + "leaves" => SkipRendering::Leaves, + "liquid" => SkipRendering::Liquid, + "mangrove_roots" => SkipRendering::MangroveRoots, + _ => return Err("unrecognized render rule"), + }; + Ok(( + name, + RenderDefinition { + skip, + can_occlude: v["can_occlude"].as_bool().ok_or("missing occlusion flag")?, + bars_tag: v["bars_tag"].as_bool().ok_or("missing bars tag")?, + }, + )) + }) + .collect::>()?; + Ok(FaceVisibility::new(&occlusion, &definitions)?) +} diff --git a/crates/horizon-client/src/models/catalog.rs b/crates/horizon-client/src/models/catalog.rs index 046ae172d..087926849 100644 --- a/crates/horizon-client/src/models/catalog.rs +++ b/crates/horizon-client/src/models/catalog.rs @@ -30,12 +30,17 @@ use std::{ pub struct BakedFace { pub quad: ModelQuad, pub layer: u32, + pub opaque: bool, +} +pub struct BakedModel { + pub faces: Vec, + pub cube: Option<[super::cube::CubeStyle; 6]>, } type VariantKey = (String, [u8; 3], bool); pub struct StateModels { choices: Vec, states: BTreeMap, - baked: BTreeMap>, + baked: BTreeMap, } fn key(variant: &Variant) -> VariantKey { (variant.model.clone(), variant.rotations, variant.uv_lock) @@ -159,14 +164,26 @@ impl StateModels { let mut baked = BTreeMap::new(); for (name, turns, lock) in variants { let model = library.resolve(&name)?; - let faces = bake_model_transformed(&model, BlockModelTransform::new(turns, lock))?.into_iter().map(|quad| { - if quad.material.force_translucent || quad.tint_index != -1 { - return Err("inspection gallery requires untinted opaque or binary-cutout materials".into()); - } - let layer = sprites.insert(root, &quad.material.sprite)?; - Ok(BakedFace { quad, layer }) - }).collect::>()?; - baked.insert((name, turns, lock), faces); + let faces: Vec = + bake_model_transformed(&model, BlockModelTransform::new(turns, lock))? + .into_iter() + .map(|quad| { + if quad.material.force_translucent || quad.tint_index != -1 { + return Err( + "inspection gallery requires untinted opaque or binary-cutout materials" + .into(), + ); + } + let layer = sprites.insert(root, &quad.material.sprite)?; + Ok(BakedFace { + quad, + layer, + opaque: sprites.opaque[layer as usize], + }) + }) + .collect::>()?; + let cube = super::cube::cube_styles(&faces); + baked.insert((name, turns, lock), BakedModel { faces, cube }); } Ok(Self { choices, @@ -178,7 +195,7 @@ impl StateModels { &self, state: BlockStateId, position: BlockPos, - ) -> Result> { + ) -> Result> { let (choice, selected) = self .states .get(&state) @@ -190,15 +207,7 @@ impl StateModels { self.choices[*choice].collect(selected, &mut random, &mut variants)?; variants .into_iter() - .map(|v| { - Ok(( - v, - self.baked - .get(&key(v)) - .ok_or("unbaked block model")? - .as_slice(), - )) - }) + .map(|v| Ok((v, self.baked.get(&key(v)).ok_or("unbaked block model")?))) .collect() } } diff --git a/crates/horizon-client/src/models/cube.rs b/crates/horizon-client/src/models/cube.rs new file mode 100644 index 000000000..9192f36d8 --- /dev/null +++ b/crates/horizon-client/src/models/cube.rs @@ -0,0 +1,158 @@ +//! Exact unit-cube faces eligible for repeated-texture greedy rectangles. +use super::catalog::BakedFace; +use horizon_assets::model::Direction; + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct CubeStyle { + pub layer: u32, + /// UV at spatial (u,v)=(0,0), then the two signed unit-axis derivatives. + pub uv: [i8; 6], + pub shade_bits: u32, +} +pub fn shade(face: &BakedFace) -> f32 { + match face + .quad + .shade_direction_override + .unwrap_or(face.quad.facing) + { + Direction::Down => 0.5, + Direction::Up => 1.0, + Direction::North | Direction::South => 0.8, + Direction::West | Direction::East => 0.6, + } +} +pub fn cube_styles(faces: &[BakedFace]) -> Option<[CubeStyle; 6]> { + if faces.len() != 6 { + return None; + } + let mut styles = [None; 6]; + for face in faces { + if !face.opaque || face.quad.light_emission != 0 { + return None; + } + let q = &face.quad; + let direction = q.cull?; + if q.facing != direction || styles[direction as usize].is_some() { + return None; + } + let (axis, u, v) = match direction { + Direction::Down | Direction::Up => (1, 0, 2), + Direction::North | Direction::South => (2, 0, 1), + Direction::West | Direction::East => (0, 2, 1), + }; + let plane = if (direction as usize).is_multiple_of(2) { + 0.0 + } else { + 1.0 + }; + let mut uv = [None; 4]; + for (p, texture) in q.positions.iter().zip(q.uv) { + if p[axis] != plane + || ![p[u], p[v], texture[0], texture[1]] + .iter() + .all(|&x| x == 0.0 || x == 1.0) + { + return None; + } + let index = p[u] as usize + 2 * p[v] as usize; + if uv[index].replace(texture.map(|x| x as i8)).is_some() { + return None; + } + } + let [a, b, c, d] = uv.map(|v| v.unwrap()); + let du = [b[0] - a[0], b[1] - a[1]]; + let dv = [c[0] - a[0], c[1] - a[1]]; + if d != [a[0] + du[0] + dv[0], a[1] + du[1] + dv[1]] + || (du[0] * dv[1] - du[1] * dv[0]).abs() != 1 + { + return None; + } + styles[direction as usize] = Some(CubeStyle { + layer: face.layer, + uv: [a[0], a[1], du[0], du[1], dv[0], dv[1]], + shade_bits: shade(face).to_bits(), + }); + } + Some(styles.map(|v| v.unwrap())) +} + +#[cfg(test)] +mod tests { + use super::*; + use horizon_assets::{ + bake::{BlockModelTransform, bake_model_transformed}, + model::CuboidModel, + resolve::ModelLibrary, + }; + use serde_json::json; + #[test] + fn projected_cube_uvs_match_baked_quarter_turns() { + let faces: serde_json::Map = Direction::ALL + .into_iter() + .map(|d| { + ( + d.name().to_owned(), + json!({"texture":"#all","cullface":d.name()}), + ) + }) + .collect(); + let model = CuboidModel::from_json(&json!({"textures":{"all":"horizon:probe"},"elements":[{"from":[0,0,0],"to":[16,16,16],"faces":faces}]}).to_string()).unwrap(); + let library = ModelLibrary::new([("horizon:cube".to_owned(), model)].into()).unwrap(); + let model = library.resolve("horizon:cube").unwrap(); + let mut eligible = 0; + for x in 0..4 { + for y in 0..4 { + for z in 0..4 { + for lock in [false, true] { + let faces: Vec<_> = bake_model_transformed( + &model, + BlockModelTransform::new([x, y, z], lock), + ) + .unwrap() + .into_iter() + .map(|quad| BakedFace { + quad, + layer: 7, + opaque: true, + }) + .collect(); + let Some(styles) = cube_styles(&faces) else { + assert!(lock); + continue; + }; + eligible += 1; + for face in &faces { + let direction = face.quad.cull.unwrap(); + let (u, v) = match direction { + Direction::Down | Direction::Up => (0, 2), + Direction::North | Direction::South => (0, 1), + _ => (2, 1), + }; + let style = styles[direction as usize]; + let [a, b, c, d, e, f] = style.uv.map(f32::from); + for (p, uv) in face.quad.positions.iter().zip(face.quad.uv) { + assert_eq!([a + c * p[u] + e * p[v], b + d * p[u] + f * p[v]], uv); + } + } + } + } + } + } + assert!(eligible >= 64); + let mut faces: Vec<_> = + bake_model_transformed(&model, BlockModelTransform::new([0; 3], false)) + .unwrap() + .into_iter() + .map(|quad| BakedFace { + quad, + layer: 0, + opaque: true, + }) + .collect(); + faces[0].opaque = false; + assert!(cube_styles(&faces).is_none()); + faces[0].opaque = true; + faces[0].quad.positions[0][0] = 0.25; + assert!(cube_styles(&faces).is_none()); + } +} diff --git a/crates/horizon-client/src/render.rs b/crates/horizon-client/src/render.rs index 631295c61..f9639bc85 100644 --- a/crates/horizon-client/src/render.rs +++ b/crates/horizon-client/src/render.rs @@ -39,6 +39,7 @@ impl Renderer { window: Arc, assets: &Assets, quads: &[Quad], + model_faces: &[ModelInstance], fog_distance: f32, ) -> Result { let instance = @@ -153,7 +154,7 @@ impl Renderer { cache: None, }) }; - let attributes = wgpu::vertex_attr_array![0=>Float32x3,1=>Float32x2,2=>Uint32,3=>Uint32]; + let attributes = wgpu::vertex_attr_array![0=>Float32x3,1=>Float32x2,2=>Uint32,3=>Uint32,4=>Float32x2,5=>Float32x2,6=>Float32x2,7=>Float32]; let pipeline = create_pipeline( "Horizon opaque cubes", "vs_main", @@ -236,10 +237,10 @@ impl Renderer { contents: bytemuck::cast_slice(quads), usage: wgpu::BufferUsages::VERTEX, }); - let model_quad_count = u32::try_from(assets.model_quads.len())?; + let model_quad_count = u32::try_from(model_faces.len())?; let model_quads = device.create_buffer_init(&wgpu::util::BufferInitDescriptor { label: Some("Baked vanilla model faces"), - contents: bytemuck::cast_slice(&assets.model_quads), + contents: bytemuck::cast_slice(model_faces), usage: wgpu::BufferUsages::VERTEX, }); let depth = Self::depth(&device, &config); diff --git a/crates/horizon-client/src/sprites.rs b/crates/horizon-client/src/sprites.rs index b8e9c4eb0..d8804f777 100644 --- a/crates/horizon-client/src/sprites.rs +++ b/crates/horizon-client/src/sprites.rs @@ -30,6 +30,7 @@ pub struct Sprites { pub pixels: Vec, pub layers: BTreeMap, pub animations: Vec, + pub opaque: Vec, } impl Sprites { pub fn insert(&mut self, root: &Path, name: &str) -> Result { @@ -130,6 +131,8 @@ impl Sprites { clip: Arc::new(clip), }); } + self.opaque + .push(pixels.as_chunks::<4>().0.iter().all(|p| p[3] == 255)); self.layers.insert(name.to_owned(), layer); self.size = width; self.pixels.extend_from_slice(&frames[initial]); diff --git a/crates/horizon-client/src/world.rs b/crates/horizon-client/src/world.rs index 036251865..f50afc116 100644 --- a/crates/horizon-client/src/world.rs +++ b/crates/horizon-client/src/world.rs @@ -1,4 +1,4 @@ -//! A controlled opaque-cube scene for exercising the native renderer. This is +//! A controlled blockstate scene for exercising the native renderer. This is //! not the vanilla world generator or an authoritative gameplay simulation. use crate::{ Result, @@ -10,7 +10,6 @@ use std::collections::BTreeMap; pub struct TestWorld<'a> { pub chunks: BTreeMap<(i32, i32), TerrainChunk<'a, Properties>>, - assets: &'a Assets, air: BlockStateId, } impl<'a> TestWorld<'a> { @@ -21,7 +20,6 @@ impl<'a> TestWorld<'a> { .ok_or("missing air state")?; let mut world = Self { chunks: BTreeMap::new(), - assets, air, }; for cz in -radius..=radius { @@ -73,6 +71,9 @@ impl<'a> TestWorld<'a> { } } } + for (position, state) in &assets.model_placements { + world.set(position.x, position.y, position.z, *state)?; + } Ok(world) } fn set(&mut self, x: i32, y: i32, z: i32, state: BlockStateId) -> Result<()> { @@ -82,15 +83,12 @@ impl<'a> TestWorld<'a> { .set_block_worldgen(x, y, z, state)?; Ok(()) } - pub fn layer(&self, x: i32, y: i32, z: i32) -> Result { - let state = self - .chunks + pub fn block(&self, x: i32, y: i32, z: i32) -> BlockStateId { + self.chunks .get(&(x >> 4, z >> 4)) - .map_or(self.air, |chunk| chunk.block(x, y, z)); - let layer = self.assets.layers[state.0 as usize]; - if layer == -2 { - return Err("test scene contains an unsupported non-cube material".into()); - } - Ok(layer) + .map_or(self.air, |chunk| chunk.block(x, y, z)) + } + pub fn is_air(&self, state: BlockStateId) -> bool { + state == self.air } } diff --git a/crates/horizon-client/src/world.wgsl b/crates/horizon-client/src/world.wgsl index 35126504a..16c2b24a9 100644 --- a/crates/horizon-client/src/world.wgsl +++ b/crates/horizon-client/src/world.wgsl @@ -15,7 +15,9 @@ struct VertexOut { } @vertex fn vs_main(@builtin(vertex_index) vertex: u32, @location(0) origin: vec3, @location(1) extent: vec2, - @location(2) face: u32, @location(3) layer: u32) -> VertexOut { + @location(2) face: u32, @location(3) layer: u32, + @location(4) uv_origin: vec2, @location(5) uv_u: vec2, + @location(6) uv_v: vec2, @location(7) shade: f32) -> VertexOut { let corners = array,4>(vec2(0.0,0.0),vec2(1.0,0.0),vec2(1.0,1.0),vec2(0.0,1.0)); let normal_order = array(0u,1u,2u,0u,2u,3u); let reversed_order = array(0u,2u,1u,0u,3u,2u); @@ -28,9 +30,9 @@ struct VertexOut { else { position+=vec3(0.0,offset.y,offset.x); } var output: VertexOut; output.clip=camera.view_projection*vec4(position,1.0); - output.uv=vec2(offset.x,extent.y-offset.y); + output.uv=uv_origin+uv_u*offset.x+uv_v*offset.y; output.layer=layer; - output.shade=select(select(0.8,0.6,face>=4u),select(0.5,1.0,face==1u),face<2u); + output.shade=shade; output.world_position=position; return output; } diff --git a/docs/face-visibility.md b/docs/face-visibility.md index f4112eb70..093695af6 100644 --- a/docs/face-visibility.md +++ b/docs/face-visibility.md @@ -3,8 +3,8 @@ `horizon-world::block_render::FaceVisibility` decides whether to emit a model quad with a culling direction beside a neighboring block. It prepares immutable face geometry from the pinned raw occlusion shapes, shares faces across states, -and caches shape-pair subtraction with bounded memory. It is ready for chunk -meshing; it does not yet replace the development scene's cube-only culling. +and caches shape-pair subtraction with bounded memory. The development client +now uses it for resident chunk model meshing, including cross-chunk neighbors. The decision preserves the native order: a canonical full neighbor face hides the quad, block-specific suppression can hide it, canonical empty faces bypass diff --git a/docs/native-client.md b/docs/native-client.md index de20fac54..dff5146fb 100644 --- a/docs/native-client.md +++ b/docs/native-client.md @@ -1,28 +1,33 @@ # Horizon native development client `horizon-client` opens a native Rust window and renders a controlled block scene -stored in Horizon's resident chunks, alongside sixteen blockstate-driven model placements. It -loads the block registry, models and sprites from pinned Java Edition 26.3 -resources. A padded chunk mesh -culls hidden faces across chunk boundaries and merges adjacent matching faces; -the GPU draws the rectangles as instances. A separate instanced draw renders -baked cuboid faces without expanding them into cube approximations. The camera -is a free inspection tool. +stored in Horizon's resident chunks. Every occupied cell selects models from its +registry state, including the terrain and sixteen featured placements. It loads +block definitions, cuboid models, sprites and occlusion grids from pinned Java +Edition 26.3 resources. Model selection uses the default block position seed; +neighbor visibility uses the validated Rust face rules across chunk boundaries. +The camera remains a free inspection tool. + +Eligible opaque unit-cube faces use greedy rectangles only when texture layer, +UV rotation/mirroring and shading match. Each rectangle retains its signed UV +basis, so weighted texture variation survives merging. Other baked geometry and +binary-alpha cutouts use the separate model-face instance pipeline. Geometry +with nonintegral UV-lock rounding also stays on that path. This checkpoint has no player simulation, vanilla world generation, block interaction, inventory, sound, networking or world save/load. It does not meet the [playable-build acceptance criteria](rust-parity.md#completion-criteria-and-playable-builds). -The model gallery now uses blockstate dispatch, weighted variants, multipart -conditions and transformed baking. Chunk-wide model rendering, fractional -transparency, tinting, lighting, resource packs, chunk streaming and full visual -parity remain unfinished. +The controlled chunk scene now uses blockstate dispatch, weighted variants, +multipart conditions and transformed baking. Full block-catalog material support, +fractional transparency, tinting, lighting, resource packs, chunk streaming and +full visual parity remain unfinished. The resource gallery sits beside the pyramid and includes oak stairs, a slab, an anvil, a torch, a lantern, connected fences and iron bars, a cobweb, a wall grindstone, a ladder, a sideways amethyst cluster and four weighted stone placements. Registry state properties select the models: the stairs are an upside-down inner corner, the slab is a top slab and the fence gate is open. -These remain static inspection placements without simulation callbacks. Binary-alpha cutouts are rendered; +These are resident chunk states; simulation callbacks remain unfinished. Binary-alpha cutouts are rendered; the lantern's three frames advance every eight inspection ticks at 20 ticks/s. The animation metadata codec and frame selection now use the shared `horizon-assets` implementation checked against the pinned client. GPU @@ -170,8 +175,8 @@ selector and predicate cases: 3,802 definitions and 687,466 state results match, with 220 expected binding errors. It checks the native replacement-before-abort behavior for overlapping variants, eager multipart validation even when variants cover every state, integer-property aliases, nested conditions and empty part -selections. The development gallery now uses this binder; general chunk model -rendering remains unfinished. +selections. The controlled chunk renderer now uses this binder for its model +catalog. The Java integer-property parser is shared by `horizon-core`, client binding and world-state decoding. Its [codec regression](../benchmarks/rust-blockstate-model-binding-2026-10-06/shared-integer-codec.json) @@ -231,8 +236,8 @@ python3 tools/test_native_client.py --vscreen The mesh tests compare expanded rectangles against independently enumerated exposed voxel faces, including solid neighbors, cavities, material boundaries, negative chunk origins and random surroundings. The startup runner launches a -nine-chunk scene, requires 30 presented frames and a clean exit, verifies 209 -baked gallery faces across 18 sprite layers, and writes GPU, +nine-chunk scene, requires 30 presented frames and a clean exit, verifies 3,169 +greedy cube rectangles and 179 other model faces across 18 sprite layers, and writes GPU, platform, binary and source information to ignored `.local/horizon-client/startup-smoke.json`. It has an external timeout as well as the application's frame deadline. These checks do not establish gameplay or @@ -265,4 +270,16 @@ IDs, properties, positions and models are recorded in the startup report. [Neighbor-face visibility](face-visibility.md) now has native client/server coverage across all registered states and suppression-rule families. Integrating -that result with resident chunk model meshing is the next rendering step. +that result with resident chunk model meshing is now covered by the scene check +below. + +The [resident-model report](../benchmarks/rust-native-chunk-models-2026-10-06/startup-smoke.json) +checks all 10,919 occupied cells in the bounded startup scene against a separately +constructed native scene. Actual Java state-model selection, parent geometry, +rotated culling directions and `Block.shouldRenderFace` produce the same 5,991 +visible and 59,636 culled model faces. The sixteen featured model selections also +retain their direct native comparison. Expanded greedy-rectangle tests cover +rotated and mirrored UV bases, texture and shade boundaries, negative origins, +neighbor seams and cavities; cube projection tests cover all XYZ quarter turns. +These checks cover CPU mesh behavior and GPU startup, not native shader pixels +or a hardware performance comparison. diff --git a/docs/rust-parity.md b/docs/rust-parity.md index ef31caf53..9a85a7658 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -3,8 +3,8 @@ The behavior target is the repository's pinned **Minecraft Java Edition 26.3**. One-to-one vanilla gameplay parity is the acceptance criterion. It has **not** been reached. Horizon now has a [native development client](native-client.md) -that renders a controlled block scene and sixteen blockstate-driven model placements with a -free camera. It does not run a +that renders a controlled resident-chunk scene with blockstate-selected models +and a free camera. It does not run a complete game server or gameplay simulation. The Rust workspace implements core arithmetic/random streams, world data and resident sections, scheduled tick ordering, geometry, contained fluid states, @@ -24,11 +24,14 @@ binding now also matches native selection across registered and special item-frame states. Weighted selection and multipart random draw consumption also match native traces. Transformed baking now checks every bundled model/rotation/UV-lock tuple and all XYZ quarter-turn combinations against native -geometry by exact float bits. The native renderer now draws an -inspection gallery from registry-bound, selected and transformed models, including binary +geometry by exact float bits. The native renderer now draws its controlled +resident chunks from registry-bound, selected and transformed models, including binary cutouts, multipart connections, weighted stone variants and stepped lantern animation. All 16 scene selections match native model collection. These are not -yet gameplay blocks; general chunk model rendering remains unfinished. +yet simulated gameplay blocks. Resident chunk meshing now preserves weighted +variants and UV orientation when greedily merging matching cube faces, and uses +native-checked neighbor visibility. Full block-catalog material support, lighting +and chunk streaming remain unfinished. [Neighbor face visibility](face-visibility.md) now matches both reference JARs across 1,441,816 state pairs, including all pinned suppression-rule families. Animation metadata, frame sequences and tick-state selection now have native diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaGallerySelectionOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaGallerySelectionOracle.java index 334f3c089..290425f1e 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaGallerySelectionOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaGallerySelectionOracle.java @@ -8,12 +8,13 @@ import java.util.*; import net.minecraft.client.renderer.block.dispatch.*; import net.minecraft.client.resources.model.*; import net.minecraft.client.resources.model.geometry.*; +import net.minecraft.client.resources.model.cuboid.*; import net.minecraft.client.resources.model.sprite.*; import net.minecraft.core.*; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.Identifier; import net.minecraft.util.StrictJsonParser; -import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.*; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.Property; import net.minecraft.world.level.levelgen.LegacyRandomSource; @@ -33,8 +34,9 @@ public final class VanillaGallerySelectionOracle { var faces=new ArrayList();for(var d:Direction.values())faces.add(matrix(state.inverseFaceTransformation(d))); return JSON.toJsonTree(map("model",name,"matrix",matrix(state.transformation().getMatrix()),"inverse_uv",faces)); } + private record PartTag(Identifier model,ModelState transform,JsonElement signature) {} private static final class Baker implements ModelBaker { - final IdentityHashMap tags=new IdentityHashMap<>(); + final IdentityHashMap tags=new IdentityHashMap<>(); public ResolvedModel getModel(Identifier id) { return new ResolvedModel() { public String debugName(){return id.toString();} @@ -47,7 +49,7 @@ public final class VanillaGallerySelectionOracle { try { var constructor=QuadCollection.class.getDeclaredConstructors()[0];constructor.setAccessible(true); var empty=List.of();var result=(QuadCollection)constructor.newInstance(empty,empty,empty,empty,empty,empty,empty,empty); - tags.put(result,tag(id.toString(),state));return result; + tags.put(result,new PartTag(id,state,tag(id.toString(),state)));return result; } catch(ReflectiveOperationException error){throw new AssertionError(error);} } }; @@ -60,9 +62,67 @@ public final class VanillaGallerySelectionOracle { private static > BlockState set(BlockState state,Property property,String value) { return state.setValue(property,property.getValue(value).orElseThrow()); } + private static Object scene(JsonObject report)throws Exception { + int chunks=report.get("resident_chunks").getAsInt();int diameter=(int)Math.sqrt(chunks); + if(diameter*diameter!=chunks || diameter%2==0)throw new AssertionError("unsupported scene grid"); + int radius=diameter/2;var world=new HashMap(); + String[] layers={"bedrock","dirt","stone","sand","oak_planks","bricks"}; + var materials=new ArrayList();for(var name:layers)materials.add(BuiltInRegistries.BLOCK.getValue(Identifier.parse(name)).defaultBlockState()); + for(int cz=-radius;cz<=radius;cz++)for(int cx=-radius;cx<=radius;cx++) + for(int z=0;z<16;z++)for(int x=0;x<16;x++)for(int y=0;y<4;y++) { + int layer=y==0?0:y<3?1:((cx+cz)&1)==0?2:3; + world.put(new BlockPos(cx*16+x,y,cz*16+z),materials.get(layer)); + } + for(int y=4;y<11;y++)for(int z=-10;z<=10;z++)for(int x=-10;x<=10;x++) + if(Math.max(Math.abs(x),Math.abs(z))<=14-y)world.put(new BlockPos(x,y,z),materials.get((y&1)==0?4:5)); + for(var item:report.getAsJsonArray("model_gallery")) { + var row=item.getAsJsonObject();var p=row.getAsJsonArray("position"); + world.put(new BlockPos(p.get(0).getAsInt(),p.get(1).getAsInt(),p.get(2).getAsInt()),Block.stateById(row.get("state_id").getAsInt())); + } + var roots=new HashMap(); + for(var state:new HashSet<>(world.values())) { + var id=BuiltInRegistries.BLOCK.getKey(state.getBlock()); + try(var input=VanillaGallerySelectionOracle.class.getResourceAsStream("/assets/"+id.getNamespace()+"/blockstates/"+id.getPath()+".json")) { + var raw=new String(Objects.requireNonNull(input).readAllBytes(),java.nio.charset.StandardCharsets.UTF_8); + roots.putAll(BlockStateModelDispatcher.CODEC.parse(JsonOps.INSTANCE,StrictJsonParser.parse(raw)).getOrThrow().instantiate(state.getBlock().getStateDefinition(),id::toString)); + } + } + var baker=new Baker();var models=new HashMap(); + for(var state:new HashSet<>(world.values()))models.put(state,Objects.requireNonNull(roots.get(state)).bake(state,baker)); + var unbaked=new HashMap();var pending=new ArrayList(); + for(var part:baker.tags.values())pending.add(part.model()); + for(int i=0;i{for(var id:unbaked.keySet())resolver.markDependency(id);});var resolved=discovery.resolve(); + int visible=0,culled=0;LeavesBlock.setCutoutLeaves(true); + var parts=new ArrayList(); + for(var entry:world.entrySet()) { + var pos=entry.getKey();var state=entry.getValue();parts.clear(); + models.get(state).collectParts(new LegacyRandomSource(state.getSeed(pos)),parts); + for(var selected:parts) { + var part=baker.tags.get(((SimpleModelWrapper)selected).quads()); + var geometry=resolved.get(part.model()).getTopGeometry();if(geometry==UnbakedGeometry.EMPTY)continue; + for(var element:((UnbakedCuboidGeometry)geometry).elements())for(var face:element.faces().values()) { + var direction=face.cullForDirection(); + if(direction!=null)direction=Direction.rotate(part.transform().transformation().getMatrix(),direction); + if(direction==null || Block.shouldRenderFace(state,world.getOrDefault(pos.relative(direction),Blocks.AIR.defaultBlockState()),direction))visible++;else culled++; + } + } + } + if(visible!=report.get("visible_model_faces").getAsInt() || culled!=report.get("culled_model_faces").getAsInt() || world.size()!=report.get("model_blocks").getAsInt()) + throw new AssertionError("native chunk model totals disagree: "+world.size()+" blocks / "+visible+" visible / "+culled+" culled"); + return map("blocks",world.size(),"visible_faces",visible,"culled_faces",culled); + } public static void main(String[] args) throws Exception { net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); var report=JsonParser.parseString(Files.readString(Path.of(args[0]))).getAsJsonObject(); + VanillaHeightmapOracle.bindTags(JsonParser.parseString(Files.readString(Path.of(args[2]).resolve("block-tags.json"))).getAsJsonObject()); var results=new ArrayList();int index=0; for(var item:report.getAsJsonArray("model_gallery")) { var row=item.getAsJsonObject();var id=Identifier.parse(row.get("block").getAsString()); @@ -80,7 +140,7 @@ public final class VanillaGallerySelectionOracle { var pos=row.getAsJsonArray("position");var position=new BlockPos(pos.get(0).getAsInt(),pos.get(1).getAsInt(),pos.get(2).getAsInt()); var parts=new ArrayList();model.collectParts(new LegacyRandomSource(state.getSeed(position)),parts); var actual=new ArrayList(); - for(var part:parts)actual.add(Objects.requireNonNull(baker.tags.get(((SimpleModelWrapper)part).quads()))); + for(var part:parts)actual.add(Objects.requireNonNull(baker.tags.get(((SimpleModelWrapper)part).quads())).signature()); var expected=new ArrayList(); for(var selected:row.getAsJsonArray("models")) { var v=selected.getAsJsonObject();var t=v.getAsJsonArray("rotations"); @@ -90,6 +150,6 @@ public final class VanillaGallerySelectionOracle { if(!actual.equals(expected))throw new AssertionError("gallery selection mismatch at "+index+" "+id+": native="+actual+" Rust="+expected); results.add(map("case",index++,"state_id",Block.getId(state),"models",actual)); } - Files.writeString(Path.of(args[1]),JSON.toJson(results)); + Files.writeString(Path.of(args[1]),JSON.toJson(map("gallery",results,"scene",scene(report)))); } } diff --git a/tools/prepare_native_client.py b/tools/prepare_native_client.py index 285df656a..23aad9a5c 100644 --- a/tools/prepare_native_client.py +++ b/tools/prepare_native_client.py @@ -65,6 +65,29 @@ def main(): if tags != worldgen.tag_resources(jars['client']): raise ValueError('Reference block tags disagree') lab.write_json(root / 'block-tags.json', tags) + visibility = oracle.with_name('VanillaFaceVisibilityOracle.java') + collision = oracle.with_name('VanillaCollisionOracle.java') + render_sources = base.source_hashes([visibility, collision, oracle]) + render_files = ['render-definitions.json', 'occlusion.nbt'] + tag_hash = lab.digest(root/'block-tags.json', 'sha256') + if not (previous.get('render_exporters_sha256') == render_sources + and previous.get('server_sha256') == origin['server_sha256'] + and previous.get('block_tags_sha256') == tag_hash + and all((root/name).exists() and previous.get('render_files_sha256', {}).get(name) + == lab.digest(root/name, 'sha256') for name in render_files)): + export = lab.LOCAL/'horizon-client-render'; export.mkdir(exist_ok=True) + lab.write_json(export/'tags.json', tags) + classes = export/'classes'; classes.mkdir(exist_ok=True) + dependencies = os.pathsep.join(map(str, [jars['server'], *libraries])) + with (export/'export.log').open('w') as log: + subprocess.run(['javac', '--release', str(lock['minecraft']['java_major']), '-proc:none', + '-cp', dependencies, '-d', str(classes), str(visibility), str(collision), str(oracle)], + check=True, stdout=log, stderr=subprocess.STDOUT, timeout=3600) + subprocess.run(['java', '-Xmx768M', '-cp', str(classes)+os.pathsep+dependencies, + 'dev.horizonlab.parity.VanillaFaceVisibilityOracle', 'export', str(export)], + check=True, stdout=log, stderr=subprocess.STDOUT, timeout=3600) + (root/'render-definitions.json').write_bytes((export/'definitions.json').read_bytes()) + (root/'occlusion.nbt').write_bytes((export/'occlusion.nbt').read_bytes()) count = 0 prefixes = ('assets/minecraft/blockstates/', 'assets/minecraft/models/block/', 'assets/minecraft/textures/block/') @@ -82,7 +105,9 @@ def main(): target.parent.mkdir(parents=True, exist_ok=True) target.write_bytes(data) count += 1 - lab.write_json(manifest, {'schema': 2, **origin, + lab.write_json(manifest, {'schema': 3, **origin, + 'render_exporters_sha256': render_sources, + 'render_files_sha256': {name: lab.digest(root/name, 'sha256') for name in render_files}, 'model_state_exporters_sha256': binding_sources, 'model_states_sha256': lab.digest(model_states, 'sha256'), 'data_version': version['world_version'], 'facts_sha256': lab.digest(facts, 'sha256'), diff --git a/tools/test_native_client.py b/tools/test_native_client.py index cad568f0f..282ec3e4a 100644 --- a/tools/test_native_client.py +++ b/tools/test_native_client.py @@ -21,7 +21,7 @@ except ImportError: def resource_fingerprint(root): - files = [root / 'facts.json', root / 'model-states.json', root / 'block-tags.json', root / 'horizon-resources.json', + files = [root / 'facts.json', root / 'model-states.json', root / 'render-definitions.json', root / 'occlusion.nbt', root / 'block-tags.json', root / 'horizon-resources.json', *sorted(path for path in (root / 'assets').rglob('*') if path.is_file())] digest = hashlib.sha256() for path in files: @@ -50,7 +50,8 @@ def main(): *sorted((lab.ROOT / 'crates/horizon-assets/src').rglob('*.rs'))] oracle = lab.ROOT / 'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaGallerySelectionOracle.java' helper = oracle.with_name('VanillaCuboidModelOracle.java') - sources += [oracle, helper, lab.ROOT/'tools/test_model_baking_parity.py', lab.ROOT/'tools/test_rust_parity.py', lab.ROOT/'tools/lab.py', lab.ROOT/'tools/prepare_native_client.py'] + heightmap = oracle.with_name('VanillaHeightmapOracle.java') + sources += [oracle, helper, heightmap, lab.ROOT/'tools/test_model_baking_parity.py', lab.ROOT/'tools/test_rust_parity.py', lab.ROOT/'tools/lab.py', lab.ROOT/'tools/prepare_native_client.py'] for crate in ['horizon-core', 'horizon-world']: sources += [lab.ROOT/'crates'/crate/'Cargo.toml', *sorted((lab.ROOT/'crates'/crate/'src').rglob('*.rs'))] tested_sources = { @@ -74,8 +75,10 @@ def main(): stdout=log, stderr=subprocess.STDOUT, timeout=120) result = json.loads(report.read_text()) if (result.get('error') is not None or result.get('presented_frames') != 30 - or result.get('resident_chunks') != 9 or result.get('merged_quads', 0) <= 0 - or result.get('model_quads') != 209 or len(result.get('model_gallery', [])) != 16 + or result.get('resident_chunks') != 9 or result.get('merged_quads') != 3169 + or result.get('visible_model_faces') != 5991 or result.get('culled_model_faces') != 59636 + or result.get('model_blocks') != 10919 + or result.get('model_quads') != 179 or len(result.get('model_gallery', [])) != 16 or result.get('sprite_layers') != 18 or result.get('animated_sprites') != 1 or not result.get('adapter') or min(result.get('window_size', [0])) <= 0): raise RuntimeError('Incomplete native client presentation: ' + str(report)) @@ -85,19 +88,21 @@ def main(): native = root/'gallery-selection.json' with (root/'gallery-selection.log').open('w') as log: subprocess.run(['javac', '--release', str(lock['minecraft']['java_major']), '-proc:none', '-cp', dependencies, - '-d', str(classes), str(oracle), str(helper)], cwd=lab.ROOT, check=True, + '-d', str(classes), str(oracle), str(helper), str(heightmap)], cwd=lab.ROOT, check=True, stdout=log, stderr=subprocess.STDOUT, timeout=3600) subprocess.run(['java', '-Xmx512M', '-cp', str(classes)+os.pathsep+dependencies, - 'dev.horizonlab.parity.VanillaGallerySelectionOracle', str(report), str(native)], + 'dev.horizonlab.parity.VanillaGallerySelectionOracle', str(report), str(native), str(root/'26.3')], cwd=lab.ROOT, check=True, stdout=log, stderr=subprocess.STDOUT, timeout=3600) - selections = json.loads(native.read_text()) + native_result = json.loads(native.read_text()) + selections = native_result['gallery'] + result['native_scene_culling'] = native_result['scene'] if len(selections) != len(result['model_gallery']): raise RuntimeError('Incomplete native gallery selection check') result['native_selection'] = {'matched_placements': len(selections), 'selected_parts': sum(len(s['models']) for s in selections), 'client_jar_sha256': lab.digest(jars['client'], 'sha256'), 'output_sha256': lab.digest(native, 'sha256'), - 'scope': 'Actual native registry states, blockstate dispatch, root baking with tagged empty geometry, and legacy collection using state.getSeed(position). Model names and transform matrices match scene selections; no shader/pixel parity claim.'} + 'scope': 'Actual native registry states, blockstate dispatch, tagged root baking and legacy collection using state.getSeed(position). All 16 featured placements match model names/transforms. An independently constructed native scene also matches total occupied blocks and visible/culled model faces using native parent resolution, rotated culling directions and Block.shouldRenderFace. No shader/pixel parity claim.'} if resource_fingerprint(root / '26.3') != resources: raise RuntimeError('Resources changed during native client verification') result['resource_files'] = resources From 3e65f86fde48d0b06f6cb3fa3c1b5fdbb878cf09 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 22:41:23 +0200 Subject: [PATCH 057/253] Match vanilla entity collision context queries and factories --- .../scoped-parity.json | 200 ++++++++++++++++++ .../examples/collision_context_fixture.rs | 120 +++++++++++ crates/horizon-world/src/collision_context.rs | 160 ++++++++++++++ crates/horizon-world/src/lib.rs | 1 + docs/collision-geometry.md | 33 ++- .../parity/VanillaCollisionContextOracle.java | 91 ++++++++ tools/test_collision_context_parity.py | 74 +++++++ 7 files changed, 674 insertions(+), 5 deletions(-) create mode 100644 benchmarks/rust-collision-context-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-world/examples/collision_context_fixture.rs create mode 100644 crates/horizon-world/src/collision_context.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java create mode 100644 tools/test_collision_context_parity.py diff --git a/benchmarks/rust-collision-context-2026-10-06/scoped-parity.json b/benchmarks/rust-collision-context-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..ca770cfbd --- /dev/null +++ b/benchmarks/rust-collision-context-2026-10-06/scoped-parity.json @@ -0,0 +1,200 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 8338, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java": "54b2963408f81f6997e6830b2f04a873043e02659a3c14404f71b42285331ebc", + "tools/test_collision_context_parity.py": "82503f4141885200a7593a5e5b6d6f5890b42d471507043816fd4339be5edf2e", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "cec2af81d212d5eed7a2196e4cf0be2daf4cecf53248f78cc68f2190e4d83f9a", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/collision_context.rs": "3053db15dff5776571a2c919634362fe43100978867f9e3ac46b2299563a6d4d", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "e799b31e5120cfdb04e0b342f2097d610ed98ef8c4be031620ee00368d82df59", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "8f77b4a1c5e25ecf9336477c12e3141fafc0cd8884f3b198f2ec93b0eb47ae49", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/collision_context_fixture.rs": "edca46a99ddcb267422d5f2f248346fc6f227bd6cd23727ba5a12cc6c63d68b8" + }, + "fixtures_sha256": { + ".local/rust-collision-context-parity/inputs.txt": "60b49e91a7a4999cfb8eb6ac3fbc6ec0a931d68cd53f9737959a2bd2b42be7a5" + }, + "rust_output_sha256": "7b23eb34c86c3db5a9e90bdd8ef772b79b2a06c8460542e032589f7962fd8f64", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "7b23eb34c86c3db5a9e90bdd8ef772b79b2a06c8460542e032589f7962fd8f64", + "matched_output_lines": 225126 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "7b23eb34c86c3db5a9e90bdd8ef772b79b2a06c8460542e032589f7962fd8f64", + "matched_output_lines": 225126 + } + ], + "scope": "Actual CollisionContext factories and EntityCollisionContext/Empty/PositionCollisionContext queries on controlled player and marker snapshots. Checks entity identity, captured descending and placement flags, fluid collision flags, empty-stack AIR identity, height thresholds including f32 epsilon, null factories, callback arguments/order/failures and all five fluid type pairs. Entity lifecycle, inventory mutations after capture, experimental minecart contexts, contextual block shape dispatch and live movement integration remain pending." +} diff --git a/crates/horizon-world/examples/collision_context_fixture.rs b/crates/horizon-world/examples/collision_context_fixture.rs new file mode 100644 index 000000000..dc83fb8e6 --- /dev/null +++ b/crates/horizon-world/examples/collision_context_fixture.rs @@ -0,0 +1,120 @@ +use horizon_core::{ + geometry::{Aabb, Vec3, VoxelShape}, + position::BlockPos, +}; +use horizon_world::{ + collision_context::{CollisionContext, CollisionEntity, CollisionItem}, + entity_obstruction::EntityIdentity, + fluid::{FluidKind, FluidState}, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +const ITEMS: [&str; 5] = [ + "minecraft:air", + "minecraft:stone", + "minecraft:scaffolding", + "minecraft:powder_snow_bucket", + "minecraft:leather_boots", +]; +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + let fluids = FluidKind::ALL + .map(|kind| FluidState::from_json(&format!("{{\"id\":\"{}\"}}", kind.name())).unwrap()); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let player = CollisionEntity { + identity: EntityIdentity(1), + y: number(&f["y"]), + descending: f["descending"].as_bool().unwrap(), + main_hand: Some(CollisionItem { + item: ITEMS[f["item"].as_u64().unwrap() as usize], + count: f["count"].as_i64().unwrap() as i32, + }), + }; + let marker = CollisionEntity { + identity: EntityIdentity(2), + main_hand: None, + ..player + }; + let always = f["always"].as_bool().unwrap(); + let other = number(&f["other"]); + let context = match f["mode"].as_str().unwrap() { + "empty" => CollisionContext::empty(always), + "position" => CollisionContext::position(player.y), + "player" => CollisionContext::for_entity(player, always), + "marker" => CollisionContext::for_entity(marker, always), + "factory_player" => CollisionContext::for_entity(player, false), + "factory_marker" => CollisionContext::for_entity(marker, false), + "placement" => CollisionContext::placement(Some(player)), + "placement_null" => CollisionContext::placement(None), + "with_player" => CollisionContext::with_position(Some(player), other), + "with_marker" => CollisionContext::with_position(Some(marker), other), + "with_null" => CollisionContext::with_position(None, other), + _ => unreachable!(), + }; + let held = ITEMS.iter().enumerate().fold(0, |mask, (i, item)| { + mask | (u32::from(context.is_holding_item(item)) << i) + }); + writeln!( + out, + "context {} {} {} {} {}", + context.is_descending(), + context.is_placement(), + context.always_collide_with_fluid(), + context.entity().map_or(0, |id| id.0), + held + )?; + write!(out, "above ")?; + for query in f["above"].as_array().unwrap() { + let top = number(&query[1]); + let shape = if query[2].as_bool().unwrap() { + VoxelShape::empty() + } else { + VoxelShape::from_box(Aabb::new( + Vec3::new(0.0, top - 0.25, 0.0), + Vec3::new(1.0, top, 1.0), + ))? + }; + for fallback in [false, true] { + write!( + out, + "{}", + u8::from(context.is_above( + &shape, + BlockPos::new(0, query[0].as_i64().unwrap() as i32, 0), + fallback + )) + )?; + } + } + writeln!(out)?; + for first in fluids { + for second in fluids { + let mut calls = 0; + let mut last = -1; + let result = context.can_stand_on_fluid(first, second, |entity, fluid| { + assert_eq!(entity, player.identity); + calls += 1; + last = fluid.kind() as i32; + if f["fail"].as_bool().unwrap() { + Err(()) + } else { + Ok(f["stand"].as_bool().unwrap()) + } + }); + let result = result.map_or_else(|()| "error".into(), |v| v.to_string()); + writeln!(out, "fluid {result} {calls} {last}")?; + } + } + } + Ok(()) +} diff --git a/crates/horizon-world/src/collision_context.rs b/crates/horizon-world/src/collision_context.rs new file mode 100644 index 000000000..0f8e37f86 --- /dev/null +++ b/crates/horizon-world/src/collision_context.rs @@ -0,0 +1,160 @@ +//! Collision queries over a captured entity state. Entity lifecycle, mutable +//! inventory ownership and experimental minecart contexts are supplied separately. +use crate::{entity_obstruction::EntityIdentity, fluid::FluidState}; +use horizon_core::{ + geometry::{Axis, VoxelShape}, + position::BlockPos, +}; + +/// A main-hand stack snapshot. Item names must be canonical registry identifiers. +#[derive(Clone, Copy, Debug)] +pub struct CollisionItem<'a> { + pub item: &'a str, + pub count: i32, +} +impl CollisionItem<'_> { + pub const EMPTY: Self = Self { + item: "minecraft:air", + count: 0, + }; + + pub fn is_item(self, item: &str) -> bool { + // ItemStack.typeHolder substitutes AIR for every empty stack, including + // stacks whose stored item is non-air but whose count is nonpositive. + let held = if self.count <= 0 { + "minecraft:air" + } else { + self.item + }; + held == item + } +} + +#[derive(Clone, Copy, Debug)] +pub struct CollisionEntity<'a> { + pub identity: EntityIdentity, + /// Entity.getY(), not the minimum Y of its bounding box. + pub y: f64, + pub descending: bool, + /// None for nonliving entities; Some(EMPTY) for an empty-handed living one. + pub main_hand: Option>, +} + +#[derive(Clone, Copy, Debug)] +enum Height { + Default, + Bottom(f64), +} + +#[derive(Clone, Copy, Debug)] +pub struct CollisionContext<'a> { + height: Height, + descending: bool, + placement: bool, + always_fluid: bool, + held: CollisionItem<'a>, + entity: Option, + living: bool, + position_only: bool, +} +impl<'a> CollisionContext<'a> { + pub const fn empty(always_fluid: bool) -> Self { + Self { + height: Height::Default, + descending: false, + placement: false, + always_fluid, + held: CollisionItem::EMPTY, + entity: None, + living: false, + position_only: false, + } + } + + pub const fn position(y: f64) -> Self { + Self { + height: Height::Bottom(y), + position_only: true, + ..Self::empty(false) + } + } + + /// Ordinary EntityCollisionContext. The native factory overload taking an + /// explicit fluid flag also uses this path for experimental minecarts. + pub fn for_entity(entity: CollisionEntity<'a>, always_fluid: bool) -> Self { + Self { + height: Height::Bottom(entity.y), + descending: entity.descending, + placement: false, + always_fluid, + held: entity.main_hand.unwrap_or(CollisionItem::EMPTY), + entity: Some(entity.identity), + living: entity.main_hand.is_some(), + position_only: false, + } + } + + /// `player`, when present, must describe a player (and thus a living entity). + pub fn placement(player: Option>) -> Self { + let y = player.map_or(-f64::MAX, |player| player.y); + Self::with_position(player, y) + } + + /// Native withPosition is a placement context. A missing entity ignores y. + pub fn with_position(entity: Option>, y: f64) -> Self { + let mut context = entity.map_or_else( + || Self { + height: Height::Bottom(-f64::MAX), + ..Self::empty(false) + }, + |entity| Self { + height: Height::Bottom(y), + ..Self::for_entity(entity, false) + }, + ); + context.placement = true; + context + } + + pub fn entity(&self) -> Option { + self.entity + } + pub fn is_descending(&self) -> bool { + self.descending + } + pub fn is_placement(&self) -> bool { + self.placement + } + pub fn always_collide_with_fluid(&self) -> bool { + self.always_fluid + } + pub fn is_holding_item(&self, item: &str) -> bool { + !self.position_only && self.held.is_item(item) + } + + pub fn is_above(&self, shape: &VoxelShape, position: BlockPos, default: bool) -> bool { + match self.height { + Height::Default => default, + Height::Bottom(bottom) => { + bottom > (f64::from(position.y) + shape.max(Axis::Y) - f64::from(1.0e-5f32)) + } + } + } + + /// The living-entity callback receives the second fluid even when both fluid + /// types belong to the same family. Preserve its side effects and failures. + pub fn can_stand_on_fluid( + &self, + first: FluidState, + second: FluidState, + mut entity_can_stand: impl FnMut(EntityIdentity, FluidState) -> Result, + ) -> Result { + if !self.living { + return Ok(false); + } + Ok( + entity_can_stand(self.entity.expect("living context has an entity"), second)? + && !first.kind().same_family(second.kind()), + ) + } +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 1ac0957e8..b59809678 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -11,6 +11,7 @@ pub mod block_survival; pub mod chunk; pub mod chunk_status; pub mod collision; +pub mod collision_context; pub mod compression; pub mod dynamic_support; pub mod entity_obstruction; diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 716ff38e9..930242e17 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1,7 +1,8 @@ # Horizon collision geometry The version target is Minecraft Java Edition **26.3**. Geometry is a simulation -foundation; Horizon still has no Rust client, live world, or entity simulation. +foundation; Horizon has a native client for inspecting a controlled block scene. +Live gameplay and entity simulation remain unfinished. `horizon-core::geometry` provides `Vec3`, `Aabb`, `Axis`, `Direction`, `BlockHit`, and immutable `VoxelShape` values. Coordinates are doubles. Arithmetic keeps @@ -38,7 +39,7 @@ disjoint and epsilon-merger behavior. Shape operations reject truth tables that fill two empty cells, as vanilla does. Per-axis cube-coordinate metadata survives partial merges and is checked when importing cached shapes. Box construction preserves thin-box rejection and up to 1/8 cube quantization. Optimized joins -reconstruct greedy boxes in vanilla order. Face/edge extraction and shape rotations remain absent. +reconstruct greedy boxes in vanilla order. Face extraction is implemented; edge extraction and shape rotations remain absent. Discrete axis extrema are retained separately from occupied cells. A box can quantize to no occupied cells while retaining a finite minimum/maximum on other @@ -107,9 +108,9 @@ must select it, while a cached empty shape is a valid `Some` value. This covers the cached branch of the **no-context** `BlockState.getCollisionShape` method. Vanilla's overload taking `CollisionContext` always calls block behavior; -the cache cannot establish entity collision parity. Dynamic and entity-dependent -selection, neighboring blocks, world borders, movement integration, fluids, block -effects, and live collision broad-phase queries still need implementation. +the cache cannot establish entity collision parity. Dynamic no-context selection is implemented as described below. Entity-dependent +block selection, world borders, movement integration, fluids, block effects and +live collision broad-phase queries still need implementation. Run the comparisons after preparing the pinned artifacts: @@ -284,3 +285,25 @@ definition metadata; survival results are calculated in Rust. Workspace tests, Clippy and the **147-test Python suite** passed. This establishes the recorded survival scope; full placement, neighbor updates, scheduled behavior and complete block gameplay remain pending. + + +Collision contexts now preserve empty-context fallback heights, position-only +queries, and captured entity position, descending, main-hand and placement flags. +Height comparisons retain the native float epsilon widened to double. Null +placement factories use `-Double.MAX_VALUE`; `withPosition` sets the placement +flag and ignores the supplied height when the entity is absent. Empty item stacks +match AIR in entity/empty contexts, while position-only contexts never report a +held item. Living-entity fluid callbacks run before the same-family exclusion, +with the second fluid as their argument, and propagate failures. + +`python3 tools/test_collision_context_parity.py` exercises actual native factories +and queries over **8,338 context snapshots**, comparing **225,126 output lines per +JAR**. The [context report](../benchmarks/rust-collision-context-2026-10-06/scoped-parity.json) +records the pinned artifacts and exact source/input/output hashes. The corpus +includes adjacent representable values around height thresholds, empty shapes, +integer-coordinate extremes, NaN/infinity, null entities, item count boundaries, +all five fluid types and callback failures. Native entity and stack snapshots are +allocated privately without their constructors; this checks query behavior, not +entity construction or inventory lifecycle. Inventory changes after context +capture, experimental minecart contexts, contextual block-shape dispatch and live +movement integration remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java new file mode 100644 index 000000000..a67dde830 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java @@ -0,0 +1,91 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*; +import java.nio.file.*; +import net.minecraft.core.BlockPos; +import net.minecraft.world.entity.*; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.*; +import net.minecraft.world.level.GameType; +import net.minecraft.world.level.material.*; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.shapes.*; +/** Executes native collision-context factories and queries over controlled snapshots. */ +public final class VanillaCollisionContextOracle { + static { net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); } + private static final Item[] ITEMS={Items.AIR,Items.STONE,Items.SCAFFOLDING,Items.POWDER_SNOW_BUCKET,Items.LEATHER_BOOTS}; + private static final Fluid[] FLUIDS={Fluids.EMPTY,Fluids.FLOWING_WATER,Fluids.WATER,Fluids.FLOWING_LAVA,Fluids.LAVA}; + private static final class Stop extends RuntimeException {} + public static class PlayerSnapshot extends Player { + boolean descending,stand,fail; + ItemStack held; + int calls,lastFluid; + public PlayerSnapshot(){super(null,null);} + @Override public GameType gameMode(){return GameType.SURVIVAL;} + @Override public boolean isDescending(){return descending;} + @Override public ItemStack getMainHandItem(){return held;} + @Override public boolean canStandOnFluid(FluidState state){ + calls++;lastFluid=-1;for(int i=0;i)inputs::iterator){ + var f=JsonParser.parseString(line).getAsJsonObject(); + var player=(PlayerSnapshot)allocate.invoke(unsafe,PlayerSnapshot.class); + var marker=(MarkerSnapshot)allocate.invoke(unsafe,MarkerSnapshot.class); + player.descending=marker.descending=f.get("descending").getAsBoolean(); + // Query only item identity/count; component loading and inventory lifecycle are outside this fixture. + player.held=(ItemStack)allocate.invoke(unsafe,ItemStack.class); + stackItem.set(player.held,ITEMS[f.get("item").getAsInt()].builtInRegistryHolder()); + stackCount.setInt(player.held,f.get("count").getAsInt()); + player.stand=f.get("stand").getAsBoolean();player.fail=f.get("fail").getAsBoolean(); + double y=number(f.get("y")),other=number(f.get("other")); + position.set(player,new Vec3(0,y,0));position.set(marker,new Vec3(0,y,0)); + boolean always=f.get("always").getAsBoolean(); + var context=switch(f.get("mode").getAsString()){ + case "empty"->always?CollisionContext.emptyWithFluidCollisions():CollisionContext.empty(); + case "position"->CollisionContext.positionContext(y); + case "player"->CollisionContext.of(player,always); + case "marker"->CollisionContext.of(marker,always); + case "factory_player"->CollisionContext.of(player); + case "factory_marker"->CollisionContext.of(marker); + case "placement"->CollisionContext.placementContext(player); + case "placement_null"->CollisionContext.placementContext(null); + case "with_player"->CollisionContext.withPosition(player,other); + case "with_marker"->CollisionContext.withPosition(marker,other); + case "with_null"->CollisionContext.withPosition(null,other); + default->throw new AssertionError(); + }; + int entity=context instanceof EntityCollisionContext ec?(ec.getEntity()==player?1:ec.getEntity()==marker?2:0):0; + int held=0;for(int i=0;id',value).hex() + epsilon=struct.unpack('>f',struct.pack('>f',1e-5))[0] + positions=[-2147483648,-64,-1,0,1,320,2147483647] + tops=[-0.5,0.0,0.5,1.0,1.5] + queries=[[y,bits(top),False] for y in positions for top in tops] + queries += [[y,bits(0.0),True] for y in positions] + heights=[] + for y in positions: + for top in tops: + threshold=(y+top)-epsilon + heights += [math.nextafter(threshold,-math.inf),threshold,math.nextafter(threshold,math.inf),y+top-1e-5,y+top] + heights += [-float.fromhex('0x1.fffffffffffffp1023'),float.fromhex('0x1.fffffffffffffp1023'),-math.inf,math.inf,math.nan,-0.0,0.0] + modes=['empty','position','player','marker','factory_player','factory_marker','placement','placement_null','with_player','with_marker','with_null'] + counts=[-2147483648,-1,0,1,64,2147483647] + for mode in modes: + for i,y in enumerate(heights): + for flags in range(4): + yield {'mode':mode,'y':bits(y),'other':bits(heights[-1-i]),'descending':bool(flags&1),'always':bool(flags&2),'item':i%5,'count':counts[(i//5)%len(counts)],'stand':bool(i%2),'fail':i%7==0,'above':queries} + for item in range(5): + for count in counts: + yield {'mode':mode,'y':bits(1.0),'other':bits(-1.0),'descending':True,'always':True,'item':item,'count':count,'stand':True,'fail':False,'above':queries} + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-collision-context-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/collision_context_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaCollisionContextOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','collision_context_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('collision_context_fixture.exe' if os.name=='nt' else 'collision_context_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} collision-context output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual CollisionContext factories and EntityCollisionContext/Empty/PositionCollisionContext queries on controlled player and marker snapshots. Checks entity identity, captured descending and placement flags, fluid collision flags, empty-stack AIR identity, height thresholds including f32 epsilon, null factories, callback arguments/order/failures and all five fluid type pairs. Entity lifecycle, inventory mutations after capture, experimental minecart contexts, contextual block shape dispatch and live movement integration remain pending.'} + lab.write_json(report_path,report);print(f'Scoped collision-context parity passed: {report_path}') + + +if __name__=='__main__':main() From 609cc1430e6687ccc58931faa0dce4ffb83fa13d Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 22:45:14 +0200 Subject: [PATCH 058/253] Match contextual scaffolding collision shapes and height boundaries --- .../context-regression.json | 201 +++++++++++++++++ .../scoped-parity.json | 203 ++++++++++++++++++ .../examples/collision_context_fixture.rs | 90 +++++++- crates/horizon-world/src/block_collision.rs | 67 +++++- crates/horizon-world/src/dynamic_support.rs | 33 +-- docs/collision-geometry.md | 20 +- .../parity/VanillaCollisionContextOracle.java | 12 ++ tools/test_collision_context_parity.py | 5 +- tools/test_scaffolding_collision_parity.py | 71 ++++++ 9 files changed, 680 insertions(+), 22 deletions(-) create mode 100644 benchmarks/rust-scaffolding-collision-2026-10-06/context-regression.json create mode 100644 benchmarks/rust-scaffolding-collision-2026-10-06/scoped-parity.json create mode 100644 tools/test_scaffolding_collision_parity.py diff --git a/benchmarks/rust-scaffolding-collision-2026-10-06/context-regression.json b/benchmarks/rust-scaffolding-collision-2026-10-06/context-regression.json new file mode 100644 index 000000000..b69f4739a --- /dev/null +++ b/benchmarks/rust-scaffolding-collision-2026-10-06/context-regression.json @@ -0,0 +1,201 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 8338, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java": "ee1525cc998c8b49fbc5318efffcec7b98cc8be3e4755d3bfc8458ac3c5e64c2", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceSupportOracle.java": "9ce939a435842867786fed648951bbe77f6ab843f6df09af15f3deb1948c4877", + "tools/test_collision_context_parity.py": "75d6f01e072867d2bd286d2e518e123fcfe055a11ac1705ec99ecec3975cb8d2", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "a40c9d7a4e0a734c124dc856e31359fd4d8de3d1bfc79c86787afa8e8e05e480", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/collision_context.rs": "3053db15dff5776571a2c919634362fe43100978867f9e3ac46b2299563a6d4d", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "8f77b4a1c5e25ecf9336477c12e3141fafc0cd8884f3b198f2ec93b0eb47ae49", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/collision_context_fixture.rs": "c4df3b01bf9d7e58076c848fbb41f93677ea4f0fdaab768a131d9e77c7bee5cd" + }, + "fixtures_sha256": { + ".local/rust-collision-context-parity/inputs.txt": "60b49e91a7a4999cfb8eb6ac3fbc6ec0a931d68cd53f9737959a2bd2b42be7a5" + }, + "rust_output_sha256": "7b23eb34c86c3db5a9e90bdd8ef772b79b2a06c8460542e032589f7962fd8f64", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "7b23eb34c86c3db5a9e90bdd8ef772b79b2a06c8460542e032589f7962fd8f64", + "matched_output_lines": 225126 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "7b23eb34c86c3db5a9e90bdd8ef772b79b2a06c8460542e032589f7962fd8f64", + "matched_output_lines": 225126 + } + ], + "scope": "Actual CollisionContext factories and EntityCollisionContext/Empty/PositionCollisionContext queries on controlled player and marker snapshots. Checks entity identity, captured descending and placement flags, fluid collision flags, empty-stack AIR identity, height thresholds including f32 epsilon, null factories, callback arguments/order/failures and all five fluid type pairs. Entity lifecycle, inventory mutations after capture, experimental minecart contexts, contextual block shape dispatch and live movement integration remain pending." +} diff --git a/benchmarks/rust-scaffolding-collision-2026-10-06/scoped-parity.json b/benchmarks/rust-scaffolding-collision-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..dc224cf8b --- /dev/null +++ b/benchmarks/rust-scaffolding-collision-2026-10-06/scoped-parity.json @@ -0,0 +1,203 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 56448, + "block_states": 32, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java": "ee1525cc998c8b49fbc5318efffcec7b98cc8be3e4755d3bfc8458ac3c5e64c2", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceSupportOracle.java": "9ce939a435842867786fed648951bbe77f6ab843f6df09af15f3deb1948c4877", + "tools/test_collision_context_parity.py": "75d6f01e072867d2bd286d2e518e123fcfe055a11ac1705ec99ecec3975cb8d2", + "tools/test_scaffolding_collision_parity.py": "bab75e2cad68a3193035a87497eaa372466c405293cc547e39dbd7bd4450d69d", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "a40c9d7a4e0a734c124dc856e31359fd4d8de3d1bfc79c86787afa8e8e05e480", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/collision_context.rs": "3053db15dff5776571a2c919634362fe43100978867f9e3ac46b2299563a6d4d", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "8f77b4a1c5e25ecf9336477c12e3141fafc0cd8884f3b198f2ec93b0eb47ae49", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/collision_context_fixture.rs": "c4df3b01bf9d7e58076c848fbb41f93677ea4f0fdaab768a131d9e77c7bee5cd" + }, + "fixtures_sha256": { + ".local/rust-scaffolding-collision-parity/inputs.txt": "5945054e86700237a7b6de6b362a37a98bdc8afaa67004e8aaa92da1421b552c" + }, + "rust_output_sha256": "33a33cd612c999ab21f1acbbdee522f2ec2b3f877d62f922c665715e3012e207", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "33a33cd612c999ab21f1acbbdee522f2ec2b3f877d62f922c665715e3012e207", + "matched_output_lines": 524300 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "33a33cd612c999ab21f1acbbdee522f2ec2b3f877d62f922c665715e3012e207", + "matched_output_lines": 524300 + } + ], + "scope": "Actual CollisionContext.getCollisionShape dispatch and native scaffolding behavior for all 32 scaffolding states, nine context variants, descending flags, integer Y extremes, nonfinite positions and adjacent double values around the top/bottom float-epsilon thresholds. Full shape coordinates, extrema, box ordering and cube metadata match. A rejecting world proxy verifies selection performs no world reads. Scaffolding placement/update/falling behavior and live movement remain pending." +} diff --git a/crates/horizon-world/examples/collision_context_fixture.rs b/crates/horizon-world/examples/collision_context_fixture.rs index dc83fb8e6..309c9d268 100644 --- a/crates/horizon-world/examples/collision_context_fixture.rs +++ b/crates/horizon-world/examples/collision_context_fixture.rs @@ -1,5 +1,5 @@ use horizon_core::{ - geometry::{Aabb, Vec3, VoxelShape}, + geometry::{Aabb, Axis, Vec3, VoxelShape}, position::BlockPos, }; use horizon_world::{ @@ -23,6 +23,70 @@ const ITEMS: [&str; 5] = [ fn number(v: &Value) -> f64 { f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) } +fn values( + out: &mut impl Write, + label: &str, + values: impl IntoIterator, +) -> io::Result<()> { + write!(out, "{label}")?; + for v in values { + let bits = if v.is_nan() { + 0x7ff8_0000_0000_0000 + } else { + v.to_bits() + }; + write!(out, " {bits:016x}")?; + } + writeln!(out) +} +fn box_values(out: &mut impl Write, label: &str, b: Aabb) -> io::Result<()> { + values( + out, + label, + [ + b.min(Axis::X), + b.min(Axis::Y), + b.min(Axis::Z), + b.max(Axis::X), + b.max(Axis::Y), + b.max(Axis::Z), + ], + ) +} +fn emit(out: &mut impl Write, shape: &VoxelShape) -> io::Result<()> { + writeln!( + out, + "shape {} {} {}", + shape.is_empty(), + shape.boxes().len(), + shape.is_cube() + )?; + for (axis, name) in Axis::ALL.into_iter().zip(["x", "y", "z"]) { + values(out, name, shape.coordinates(axis).iter().copied())?; + } + let axes = shape.cube_coordinate_axes(); + writeln!( + out, + "axes {}", + u8::from(axes[0]) + 2 * u8::from(axes[1]) + 4 * u8::from(axes[2]) + )?; + values( + out, + "extrema", + Axis::ALL + .map(|a| shape.min(a)) + .into_iter() + .chain(Axis::ALL.map(|a| shape.max(a))), + )?; + match shape.bounds() { + Some(b) => box_values(out, "bounds", b)?, + None => writeln!(out, "bounds none")?, + } + for b in shape.boxes() { + box_values(out, "box", *b)?; + } + Ok(()) +} fn main() -> Result<(), Box> { let arg = std::env::args().nth(1).expect("private fixture directory"); let dir = Path::new(&arg); @@ -73,6 +137,30 @@ fn main() -> Result<(), Box> { context.entity().map_or(0, |id| id.0), held )?; + if let Some(config) = f.get("scaffolding") { + let state = horizon_world::chunk::BlockState { + name: "minecraft:scaffolding".into(), + properties: [ + ("distance".into(), config[0].as_i64().unwrap().to_string()), + ("bottom".into(), config[1].as_bool().unwrap().to_string()), + ( + "waterlogged".into(), + config[2].as_bool().unwrap().to_string(), + ), + ] + .into(), + }; + let rule = + horizon_world::block_collision::ScaffoldingCollision::from_state(&state)?.unwrap(); + emit( + &mut out, + &rule.shape( + &context, + BlockPos::new(17, config[3].as_i64().unwrap() as i32, -33), + ), + )?; + continue; + } write!(out, "above ")?; for query in f["above"].as_array().unwrap() { let top = number(&query[1]); diff --git a/crates/horizon-world/src/block_collision.rs b/crates/horizon-world/src/block_collision.rs index 965e63512..e82811f10 100644 --- a/crates/horizon-world/src/block_collision.rs +++ b/crates/horizon-world/src/block_collision.rs @@ -1,5 +1,5 @@ -//! No-entity-context block collision queries over cached and dynamic definitions. -//! Entity movement contexts select different shapes and are separate queries. +//! Cached/dynamic no-context collision queries and explicit contextual block rules. +//! Contextual selection must not fall back to the no-context cache. use crate::{ collision::CachedCollisionRegistry, dynamic_support::{DynamicSupport, DynamicSupportError, DynamicSupportWorld}, @@ -110,3 +110,66 @@ impl<'r> BlockCollisionRegistry<'r> { .map_err(CollisionQueryError::Dynamic) } } + +/// Entity-context scaffold selection, independent of world queries. Construction +/// validates the descriptor so missing properties cannot silently change behavior. +#[derive(Clone, Copy, Debug)] +pub struct ScaffoldingCollision { + supported: bool, + bottom: bool, +} +impl ScaffoldingCollision { + pub fn from_state(state: &crate::chunk::BlockState) -> io::Result> { + if state.name != "minecraft:scaffolding" { + return Ok(None); + } + let distance = state + .properties + .get("distance") + .and_then(|v| crate::registry::java_integer(v)) + .filter(|v| (0..=7).contains(v)) + .ok_or_else(|| crate::compression::invalid("invalid scaffold distance"))?; + let bottom = match state.properties.get("bottom").map(String::as_str) { + Some("true") => true, + Some("false") => false, + _ => return Err(crate::compression::invalid("invalid scaffold bottom")), + }; + Ok(Some(Self { + supported: distance == 0, + bottom, + })) + } + + pub fn shape( + &self, + context: &crate::collision_context::CollisionContext<'_>, + position: horizon_core::position::BlockPos, + ) -> VoxelShape { + use std::sync::OnceLock; + if context.is_placement() { + return VoxelShape::empty(); + } + if context.is_above(&VoxelShape::block(), position, true) && !context.is_descending() { + return crate::dynamic_support::scaffolding_stable_shape(); + } + if !self.supported && self.bottom { + static BELOW: OnceLock = OnceLock::new(); + let below = BELOW.get_or_init(|| { + VoxelShape::block() + .moved(Vec3::new(0.0, -1.0, 0.0)) + .optimized() + .expect("bounded scaffold below shape") + }); + if context.is_above(below, position, true) { + static BOTTOM: OnceLock = OnceLock::new(); + return BOTTOM + .get_or_init(|| { + VoxelShape::from_box(Aabb::new(Vec3::ZERO, Vec3::new(1.0, 0.125, 1.0))) + .expect("bounded scaffold bottom") + }) + .clone(); + } + } + VoxelShape::empty() + } +} diff --git a/crates/horizon-world/src/dynamic_support.rs b/crates/horizon-world/src/dynamic_support.rs index 835ac4817..5a3e12afd 100644 --- a/crates/horizon-world/src/dynamic_support.rs +++ b/crates/horizon-world/src/dynamic_support.rs @@ -136,21 +136,7 @@ impl DynamicSupport { })[index] .moved(self.offset(position)) } - Kind::Scaffolding => { - static SHAPE: OnceLock = OnceLock::new(); - SHAPE - .get_or_init(|| { - let mut legs = VoxelShape::empty(); - for [x, z] in [[0.0, 0.0], [0.875, 0.0], [0.875, 0.875], [0.0, 0.875]] { - let leg = box_shape([x, 0.0, z], [x + 0.125, 1.0, z + 0.125]); - legs = legs.join(&leg, ShapeOp::OR).expect("bounded scaffold legs"); - } - column(16.0, 14.0, 16.0) - .join(&legs, ShapeOp::OR) - .expect("bounded scaffold support") - }) - .clone() - } + Kind::Scaffolding => scaffolding_stable_shape(), Kind::PowderSnow => VoxelShape::empty(), Kind::Shulker(facing) => { if world @@ -215,6 +201,23 @@ impl DynamicSupport { .map_err(DynamicSupportError::Shape) } } +/// Shared no-context support and context-selected stable scaffold geometry. +pub(crate) fn scaffolding_stable_shape() -> VoxelShape { + static SHAPE: OnceLock = OnceLock::new(); + SHAPE + .get_or_init(|| { + let mut legs = VoxelShape::empty(); + for [x, z] in [[0.0, 0.0], [0.875, 0.0], [0.875, 0.875], [0.0, 0.875]] { + let leg = box_shape([x, 0.0, z], [x + 0.125, 1.0, z + 0.125]); + legs = legs.join(&leg, ShapeOp::OR).expect("bounded scaffold legs"); + } + column(16.0, 14.0, 16.0) + .join(&legs, ShapeOp::OR) + .expect("bounded scaffold support") + }) + .clone() +} + fn box_shape(min: [f64; 3], max: [f64; 3]) -> VoxelShape { VoxelShape::from_box(Aabb::new( Vec3::new(min[0], min[1], min[2]), diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 930242e17..28a0d4899 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -305,5 +305,21 @@ integer-coordinate extremes, NaN/infinity, null entities, item count boundaries, all five fluid types and callback failures. Native entity and stack snapshots are allocated privately without their constructors; this checks query behavior, not entity construction or inventory lifecycle. Inventory changes after context -capture, experimental minecart contexts, contextual block-shape dispatch and live -movement integration remain pending. +capture, experimental minecart contexts and live movement integration remain +pending. Contextual block-shape selection is being added separately. + + +`ScaffoldingCollision` now selects stable scaffold geometry, the unstable bottom +platform, or an empty shape using the collision context. Placement contexts are +always empty. Descending affects the top surface check; the bottom platform also +requires nonzero support distance, the bottom flag and the lower height check. +No-context support and contextual collision share the same immutable stable shape. + +`python3 tools/test_scaffolding_collision_parity.py` compares all **32 states** +across **56,448 fixtures**, producing **524,300 matching lines per JAR** in the +[scaffolding report](../benchmarks/rust-scaffolding-collision-2026-10-06/scoped-parity.json). +The native context dispatch executes against a world proxy that rejects all +queries. Full shape coordinates, bounds, ordered boxes and cube metadata match +for empty, position, entity and placement contexts, including adjacent doubles +at both height thresholds. Block placement, distance updates, collapse and live +entity motion through scaffolding are separate work. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java index a67dde830..6debecf1d 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java @@ -7,6 +7,9 @@ import net.minecraft.world.entity.*; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.*; import net.minecraft.world.level.GameType; +import net.minecraft.world.level.CollisionGetter; +import net.minecraft.world.level.block.*; +import java.lang.reflect.Proxy; import net.minecraft.world.level.material.*; import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.*; @@ -73,6 +76,15 @@ public final class VanillaCollisionContextOracle { int entity=context instanceof EntityCollisionContext ec?(ec.getEntity()==player?1:ec.getEntity()==marker?2:0):0; int held=0;for(int i=0;i[]{CollisionGetter.class},(proxy,method,values)->{throw new AssertionError("unexpected world query: "+method);}); + var emit=VanillaFaceSupportOracle.class.getDeclaredMethod("emit",PrintWriter.class,VoxelShape.class);emit.setAccessible(true); + emit.invoke(null,out,context.getCollisionShape(state,world,pos)); + continue; + } var above=new StringBuilder(); for(var query:f.getAsJsonArray("above")){ var q=query.getAsJsonArray();int blockY=q.get(0).getAsInt();double top=number(q.get(1)); diff --git a/tools/test_collision_context_parity.py b/tools/test_collision_context_parity.py index 8a3a986ee..5841b475a 100644 --- a/tools/test_collision_context_parity.py +++ b/tools/test_collision_context_parity.py @@ -47,13 +47,14 @@ def main(): if args.prepare:lab.prepare() lock,jars,libraries=base.verify_artifacts() oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java' - sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/collision_context_fixture.rs'] + helpers=[oracle.with_name('VanillaFaceSupportOracle.java')] + sources=[oracle,*helpers,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/collision_context_fixture.rs'] tested_sources=base.source_hashes(sources) classes=build/'classes';classes.mkdir(exist_ok=True) def run(command,name): with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) dependency_path=os.pathsep.join(map(str,libraries)) - run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle,*helpers],'compile-java') def java(side,mode,path): run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaCollisionContextOracle',mode,path],side+'-'+mode) fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') diff --git a/tools/test_scaffolding_collision_parity.py b/tools/test_scaffolding_collision_parity.py new file mode 100644 index 000000000..0d956437e --- /dev/null +++ b/tools/test_scaffolding_collision_parity.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python3 +"""Compare contextual scaffolding collision selection with pinned vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + import math + def bits(value):return struct.pack('>d',value).hex() + epsilon=struct.unpack('>f',struct.pack('>f',1e-5))[0] + positions=[-2147483648,-64,-1,0,1,320,2147483647] + modes=['empty','position','player','marker','placement','placement_null','with_player','with_marker','with_null'] + for block_y in positions: + heights=[-math.inf,math.inf,math.nan,block_y-0.5,block_y+0.5,block_y+1.5] + for top in [0.0,1.0]: + threshold=(block_y+top)-epsilon + heights += [math.nextafter(threshold,-math.inf),threshold,math.nextafter(threshold,math.inf),block_y+top] + for mode in modes: + for i,y in enumerate(heights): + for descending in [False,True]: + for distance in range(8): + for bottom in [False,True]: + for water in [False,True]: + yield {'mode':mode,'y':bits(y),'other':bits(y),'descending':descending,'always':bool(i%2),'item':2,'count':1,'stand':False,'fail':False,'scaffolding':[distance,bottom,water,block_y]} + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-scaffolding-collision-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java' + helpers=[oracle.with_name('VanillaFaceSupportOracle.java')] + runner=lab.ROOT/'tools/test_collision_context_parity.py' + sources=[oracle,*helpers,runner,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/collision_context_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle,*helpers],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaCollisionContextOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','collision_context_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('collision_context_fixture.exe' if os.name=='nt' else 'collision_context_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} scaffolding-collision output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'block_states':32,'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual CollisionContext.getCollisionShape dispatch and native scaffolding behavior for all 32 scaffolding states, nine context variants, descending flags, integer Y extremes, nonfinite positions and adjacent double values around the top/bottom float-epsilon thresholds. Full shape coordinates, extrema, box ordering and cube metadata match. A rejecting world proxy verifies selection performs no world reads. Scaffolding placement/update/falling behavior and live movement remain pending.'} + lab.write_json(report_path,report);print(f'Scoped scaffolding collision parity passed: {report_path}') + + +if __name__=='__main__':main() From 6aa1c55d7f9bf51cbfbe96c0aa2649f51345d6c7 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 22:49:50 +0200 Subject: [PATCH 059/253] Match contextual liquid collision selection and query ordering --- .../context-regression.json | 202 +++++++++++++++++ .../scaffolding-regression.json | 204 ++++++++++++++++++ .../scoped-parity.json | 204 ++++++++++++++++++ .../examples/collision_context_fixture.rs | 89 ++++++++ crates/horizon-world/src/collision_context.rs | 3 + crates/horizon-world/src/lib.rs | 1 + crates/horizon-world/src/liquid_collision.rs | 63 ++++++ docs/collision-geometry.md | 16 ++ .../parity/VanillaCollisionContextOracle.java | 25 +++ tools/test_liquid_collision_parity.py | 86 ++++++++ 10 files changed, 893 insertions(+) create mode 100644 benchmarks/rust-liquid-collision-2026-10-06/context-regression.json create mode 100644 benchmarks/rust-liquid-collision-2026-10-06/scaffolding-regression.json create mode 100644 benchmarks/rust-liquid-collision-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-world/src/liquid_collision.rs create mode 100644 tools/test_liquid_collision_parity.py diff --git a/benchmarks/rust-liquid-collision-2026-10-06/context-regression.json b/benchmarks/rust-liquid-collision-2026-10-06/context-regression.json new file mode 100644 index 000000000..0c1a8af9f --- /dev/null +++ b/benchmarks/rust-liquid-collision-2026-10-06/context-regression.json @@ -0,0 +1,202 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 8338, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java": "d2f5b022be1ee2111c38acf6710c21b59da09506e246fb22b8c7c8eeb253a7d9", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceSupportOracle.java": "9ce939a435842867786fed648951bbe77f6ab843f6df09af15f3deb1948c4877", + "tools/test_collision_context_parity.py": "75d6f01e072867d2bd286d2e518e123fcfe055a11ac1705ec99ecec3975cb8d2", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "a40c9d7a4e0a734c124dc856e31359fd4d8de3d1bfc79c86787afa8e8e05e480", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "e321bed47d34ef1fdcdd99dad07cc537d34ed3cfbc07f10f10ec8b6848daf208", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/collision_context_fixture.rs": "22701112922a2f806a1d6906f0e56bfbff309093bbbc7c140bf077d9686e854f" + }, + "fixtures_sha256": { + ".local/rust-collision-context-parity/inputs.txt": "60b49e91a7a4999cfb8eb6ac3fbc6ec0a931d68cd53f9737959a2bd2b42be7a5" + }, + "rust_output_sha256": "7b23eb34c86c3db5a9e90bdd8ef772b79b2a06c8460542e032589f7962fd8f64", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "7b23eb34c86c3db5a9e90bdd8ef772b79b2a06c8460542e032589f7962fd8f64", + "matched_output_lines": 225126 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "7b23eb34c86c3db5a9e90bdd8ef772b79b2a06c8460542e032589f7962fd8f64", + "matched_output_lines": 225126 + } + ], + "scope": "Actual CollisionContext factories and EntityCollisionContext/Empty/PositionCollisionContext queries on controlled player and marker snapshots. Checks entity identity, captured descending and placement flags, fluid collision flags, empty-stack AIR identity, height thresholds including f32 epsilon, null factories, callback arguments/order/failures and all five fluid type pairs. Entity lifecycle, inventory mutations after capture, experimental minecart contexts, contextual block shape dispatch and live movement integration remain pending." +} diff --git a/benchmarks/rust-liquid-collision-2026-10-06/scaffolding-regression.json b/benchmarks/rust-liquid-collision-2026-10-06/scaffolding-regression.json new file mode 100644 index 000000000..8d5f58051 --- /dev/null +++ b/benchmarks/rust-liquid-collision-2026-10-06/scaffolding-regression.json @@ -0,0 +1,204 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 56448, + "block_states": 32, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java": "d2f5b022be1ee2111c38acf6710c21b59da09506e246fb22b8c7c8eeb253a7d9", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceSupportOracle.java": "9ce939a435842867786fed648951bbe77f6ab843f6df09af15f3deb1948c4877", + "tools/test_collision_context_parity.py": "75d6f01e072867d2bd286d2e518e123fcfe055a11ac1705ec99ecec3975cb8d2", + "tools/test_scaffolding_collision_parity.py": "bab75e2cad68a3193035a87497eaa372466c405293cc547e39dbd7bd4450d69d", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "a40c9d7a4e0a734c124dc856e31359fd4d8de3d1bfc79c86787afa8e8e05e480", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "e321bed47d34ef1fdcdd99dad07cc537d34ed3cfbc07f10f10ec8b6848daf208", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/collision_context_fixture.rs": "22701112922a2f806a1d6906f0e56bfbff309093bbbc7c140bf077d9686e854f" + }, + "fixtures_sha256": { + ".local/rust-scaffolding-collision-parity/inputs.txt": "5945054e86700237a7b6de6b362a37a98bdc8afaa67004e8aaa92da1421b552c" + }, + "rust_output_sha256": "33a33cd612c999ab21f1acbbdee522f2ec2b3f877d62f922c665715e3012e207", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "33a33cd612c999ab21f1acbbdee522f2ec2b3f877d62f922c665715e3012e207", + "matched_output_lines": 524300 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "33a33cd612c999ab21f1acbbdee522f2ec2b3f877d62f922c665715e3012e207", + "matched_output_lines": 524300 + } + ], + "scope": "Actual CollisionContext.getCollisionShape dispatch and native scaffolding behavior for all 32 scaffolding states, nine context variants, descending flags, integer Y extremes, nonfinite positions and adjacent double values around the top/bottom float-epsilon thresholds. Full shape coordinates, extrema, box ordering and cube metadata match. A rejecting world proxy verifies selection performs no world reads. Scaffolding placement/update/falling behavior and live movement remain pending." +} diff --git a/benchmarks/rust-liquid-collision-2026-10-06/scoped-parity.json b/benchmarks/rust-liquid-collision-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..cd4618a83 --- /dev/null +++ b/benchmarks/rust-liquid-collision-2026-10-06/scoped-parity.json @@ -0,0 +1,204 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 58344, + "block_states": 32, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java": "d2f5b022be1ee2111c38acf6710c21b59da09506e246fb22b8c7c8eeb253a7d9", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceSupportOracle.java": "9ce939a435842867786fed648951bbe77f6ab843f6df09af15f3deb1948c4877", + "tools/test_collision_context_parity.py": "75d6f01e072867d2bd286d2e518e123fcfe055a11ac1705ec99ecec3975cb8d2", + "tools/test_liquid_collision_parity.py": "dd77dfef7d3a66e81d92b66680d9626b6d69c54fc742bf5122674f05342fe788", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "a40c9d7a4e0a734c124dc856e31359fd4d8de3d1bfc79c86787afa8e8e05e480", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "e321bed47d34ef1fdcdd99dad07cc537d34ed3cfbc07f10f10ec8b6848daf208", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/collision_context_fixture.rs": "22701112922a2f806a1d6906f0e56bfbff309093bbbc7c140bf077d9686e854f" + }, + "fixtures_sha256": { + ".local/rust-liquid-collision-parity/inputs.txt": "564e80e9a55a186cd70c21a1db14abf59849be90bc5493346e9e64ff9d3c9d8b" + }, + "rust_output_sha256": "d845ce538e9ce157f6455b32e73e03e9d7df86ebc5c9ab80ebf94705500748ab", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "d845ce538e9ce157f6455b32e73e03e9d7df86ebc5c9ab80ebf94705500748ab", + "matched_output_lines": 571179 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "d845ce538e9ce157f6455b32e73e03e9d7df86ebc5c9ab80ebf94705500748ab", + "matched_output_lines": 571179 + } + ], + "scope": "Native contextual LiquidBlock collision dispatch for all 32 water/lava states. Checks the always-fluid bypass, source-only selection, living-entity gating, supplied entity standing shapes, exact height boundaries, all 33 above-block fluid states, callback order and failure propagation, null/placement contexts and wrapping above-block coordinates. Full selected shape data and callback traces are compared. Entity-specific standing shape implementations, liquid simulation and live movement remain pending." +} diff --git a/crates/horizon-world/examples/collision_context_fixture.rs b/crates/horizon-world/examples/collision_context_fixture.rs index 309c9d268..a2cb52e88 100644 --- a/crates/horizon-world/examples/collision_context_fixture.rs +++ b/crates/horizon-world/examples/collision_context_fixture.rs @@ -3,9 +3,11 @@ use horizon_core::{ position::BlockPos, }; use horizon_world::{ + chunk::BlockState, collision_context::{CollisionContext, CollisionEntity, CollisionItem}, entity_obstruction::EntityIdentity, fluid::{FluidKind, FluidState}, + liquid_collision::{LiquidCollision, LiquidCollisionWorld}, }; use serde_json::Value; use std::{ @@ -87,6 +89,67 @@ fn emit(out: &mut impl Write, shape: &VoxelShape) -> io::Result<()> { } Ok(()) } +struct LiquidWorld<'a, W> { + out: &'a mut W, + calls: i32, + fail: i32, + shape: VoxelShape, + above: FluidState, + stand: bool, +} +impl LiquidWorld<'_, W> { + fn query(&mut self, value: &str) -> io::Result<()> { + writeln!(self.out, "{value}")?; + let index = self.calls; + self.calls += 1; + if index == self.fail { + return Err(io::Error::other("injected liquid query failure")); + } + Ok(()) + } +} +impl LiquidCollisionWorld for LiquidWorld<'_, W> { + type Error = io::Error; + fn entity_liquid_shape(&mut self, entity: EntityIdentity) -> io::Result { + self.query(&format!("liquid_shape {}", entity.0))?; + Ok(self.shape.clone()) + } + fn fluid(&mut self, p: BlockPos) -> io::Result { + self.query(&format!("fluid_at {} {} {}", p.x, p.y, p.z))?; + Ok(self.above) + } + fn entity_can_stand(&mut self, entity: EntityIdentity, fluid: FluidState) -> io::Result { + self.query(&format!( + "stand {} {} {} {}", + entity.0, + fluid.kind() as u8, + fluid.amount(), + fluid.falling() + ))?; + Ok(self.stand) + } +} +fn liquid_state(lava: bool, level: i64) -> BlockState { + BlockState { + name: if lava { + "minecraft:lava" + } else { + "minecraft:water" + } + .into(), + properties: [("level".into(), level.to_string())].into(), + } +} +fn liquid_shape(index: i64) -> VoxelShape { + let (min, max) = match index { + 0 => return VoxelShape::empty(), + 1 => return VoxelShape::block(), + 2 => (Vec3::ZERO, Vec3::new(1.0, 0.5, 1.0)), + 3 => (Vec3::new(0.25, -0.5, 0.25), Vec3::new(0.75, 1.5, 0.75)), + _ => unreachable!(), + }; + VoxelShape::from_box(Aabb::new(min, max)).unwrap() +} fn main() -> Result<(), Box> { let arg = std::env::args().nth(1).expect("private fixture directory"); let dir = Path::new(&arg); @@ -137,6 +200,32 @@ fn main() -> Result<(), Box> { context.entity().map_or(0, |id| id.0), held )?; + if let Some(config) = f.get("liquid") { + let state = liquid_state(config[1].as_bool().unwrap(), config[0].as_i64().unwrap()); + let above = config[3].as_i64().unwrap(); + let mut world = LiquidWorld { + out: &mut out, + calls: 0, + fail: config[5].as_i64().unwrap() as i32, + shape: liquid_shape(config[4].as_i64().unwrap()), + above: if above < 0 { + FluidState::EMPTY + } else { + FluidState::from_block(&liquid_state(above >= 16, above % 16))? + }, + stand: f["stand"].as_bool().unwrap(), + }; + let p = BlockPos::new(17, config[2].as_i64().unwrap() as i32, -33); + match LiquidCollision::from_state(&state)? + .unwrap() + .shape(&mut world, p, &context) + { + Ok(shape) => emit(world.out, &shape)?, + Err(_) => writeln!(world.out, "shape error")?, + } + writeln!(world.out, "queries {}", world.calls)?; + continue; + } if let Some(config) = f.get("scaffolding") { let state = horizon_world::chunk::BlockState { name: "minecraft:scaffolding".into(), diff --git a/crates/horizon-world/src/collision_context.rs b/crates/horizon-world/src/collision_context.rs index 0f8e37f86..70362f3bb 100644 --- a/crates/horizon-world/src/collision_context.rs +++ b/crates/horizon-world/src/collision_context.rs @@ -119,6 +119,9 @@ impl<'a> CollisionContext<'a> { pub fn entity(&self) -> Option { self.entity } + pub fn living_entity(&self) -> Option { + self.entity.filter(|_| self.living) + } pub fn is_descending(&self) -> bool { self.descending } diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index b59809678..a14086a94 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -17,6 +17,7 @@ pub mod dynamic_support; pub mod entity_obstruction; pub mod fluid; pub mod heightmap; +pub mod liquid_collision; pub mod nbt; pub mod piston_shape; pub mod region; diff --git a/crates/horizon-world/src/liquid_collision.rs b/crates/horizon-world/src/liquid_collision.rs new file mode 100644 index 000000000..89bc88f62 --- /dev/null +++ b/crates/horizon-world/src/liquid_collision.rs @@ -0,0 +1,63 @@ +//! Contextual water/lava collision selection. Fluid simulation and entity-specific +//! standing shapes are supplied by the caller; no-context caches are not used. +use crate::{ + chunk::BlockState, collision_context::CollisionContext, entity_obstruction::EntityIdentity, + fluid::FluidState, +}; +use horizon_core::{geometry::VoxelShape, position::BlockPos}; +use std::io; + +pub trait LiquidCollisionWorld { + type Error; + fn entity_liquid_shape(&mut self, entity: EntityIdentity) -> Result; + fn fluid(&mut self, position: BlockPos) -> Result; + fn entity_can_stand( + &mut self, + entity: EntityIdentity, + fluid: FluidState, + ) -> Result; +} + +#[derive(Clone, Copy, Debug)] +pub struct LiquidCollision { + fluid: FluidState, +} +impl LiquidCollision { + pub fn from_state(state: &BlockState) -> io::Result> { + if !matches!(state.name.as_str(), "minecraft:water" | "minecraft:lava") { + return Ok(None); + } + Ok(Some(Self { + fluid: FluidState::from_block(state)?, + })) + } + + pub fn shape( + &self, + world: &mut W, + position: BlockPos, + context: &CollisionContext<'_>, + ) -> Result { + if context.always_collide_with_fluid() { + return Ok(VoxelShape::block()); + } + if !self.fluid.is_source() { + return Ok(VoxelShape::empty()); + } + let Some(entity) = context.living_entity() else { + return Ok(VoxelShape::empty()); + }; + let shape = world.entity_liquid_shape(entity)?; + if context.is_above(&shape, position, true) { + // The above-block query precedes the entity callback, even if the + // candidate shape is empty or the two fluid types are equivalent. + let above = world.fluid(position.offset(0, 1, 0))?; + if context.can_stand_on_fluid(above, self.fluid, |entity, fluid| { + world.entity_can_stand(entity, fluid) + })? { + return Ok(shape); + } + } + Ok(VoxelShape::empty()) + } +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 28a0d4899..be42ac928 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -323,3 +323,19 @@ queries. Full shape coordinates, bounds, ordered boxes and cube metadata match for empty, position, entity and placement contexts, including adjacent doubles at both height thresholds. Block placement, distance updates, collapse and live entity motion through scaffolding are separate work. + + +`LiquidCollision` implements contextual water/lava collision selection. The +always-fluid flag returns a full cube before querying entities or neighbors. +Otherwise, flowing block levels and nonliving contexts return empty. Source +blocks request the living entity's standing shape, check its height, then read the +fluid above and invoke the entity's standing predicate. Empty candidate shapes +still follow those query rules. Above-block coordinates wrap as Java integers. + +`python3 tools/test_liquid_collision_parity.py` compares all **32 water/lava block +states**, all **33 possible above-block liquid/empty states**, full selected shape +data and ordered callback traces, including failures at each query. The +[liquid-collision report](../benchmarks/rust-liquid-collision-2026-10-06/scoped-parity.json) +records **571,179 matching lines per JAR**. Standing shapes and fluid abilities are +controlled inputs in this suite; each entity type still needs its implementation. +Fluid spreading, swimming, drowning and live movement remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java index 6debecf1d..cf69f0e92 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java @@ -19,7 +19,14 @@ public final class VanillaCollisionContextOracle { private static final Item[] ITEMS={Items.AIR,Items.STONE,Items.SCAFFOLDING,Items.POWDER_SNOW_BUCKET,Items.LEATHER_BOOTS}; private static final Fluid[] FLUIDS={Fluids.EMPTY,Fluids.FLOWING_WATER,Fluids.WATER,Fluids.FLOWING_LAVA,Fluids.LAVA}; private static final class Stop extends RuntimeException {} + private static final class Trace { + PrintWriter out;int calls,fail; + void query(String value){out.println(value);if(calls++==fail)throw new Stop();} + } public static class PlayerSnapshot extends Player { + Trace trace;VoxelShape liquidShape; + @Override public VoxelShape getLiquidCollisionShape(){trace.query("liquid_shape 1");return liquidShape;} + boolean descending,stand,fail; ItemStack held; int calls,lastFluid; @@ -28,6 +35,7 @@ public final class VanillaCollisionContextOracle { @Override public boolean isDescending(){return descending;} @Override public ItemStack getMainHandItem(){return held;} @Override public boolean canStandOnFluid(FluidState state){ + if(trace!=null)trace.query("stand 1 "+fluidIndex(state)+" "+state.getAmount()+" "+state.getValueOrElse(FlowingFluid.FALLING,false)); calls++;lastFluid=-1;for(int i=0;iShapes.empty();case 1->Shapes.block();case 2->Shapes.box(0,0,0,1,0.5,1);case 3->Shapes.box(0.25,-0.5,0.25,0.75,1.5,0.75);default->throw new AssertionError();};} private static double number(JsonElement value){return Double.longBitsToDouble(Long.parseUnsignedLong(value.getAsString(),16));} public static void main(String[] args)throws Exception { net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); @@ -76,6 +87,20 @@ public final class VanillaCollisionContextOracle { int entity=context instanceof EntityCollisionContext ec?(ec.getEntity()==player?1:ec.getEntity()==marker?2:0):0; int held=0;for(int i=0;i[]{CollisionGetter.class},(proxy,method,values)->{ + if(!method.getName().equals("getFluidState"))throw new AssertionError(method); + var at=(BlockPos)values[0];trace.query("fluid_at "+at.getX()+" "+at.getY()+" "+at.getZ());return liquidAbove(config.get(3).getAsInt()); + }); + var emit=VanillaFaceSupportOracle.class.getDeclaredMethod("emit",PrintWriter.class,VoxelShape.class);emit.setAccessible(true); + try{emit.invoke(null,out,context.getCollisionShape(state,world,pos));}catch(Stop error){out.println("shape error");} + out.println("queries "+trace.calls); + continue; + } if(f.has("scaffolding")) { var config=f.getAsJsonArray("scaffolding"); var state=Blocks.SCAFFOLDING.defaultBlockState().setValue(ScaffoldingBlock.DISTANCE,config.get(0).getAsInt()).setValue(ScaffoldingBlock.BOTTOM,config.get(1).getAsBoolean()).setValue(ScaffoldingBlock.WATERLOGGED,config.get(2).getAsBoolean()); diff --git a/tools/test_liquid_collision_parity.py b/tools/test_liquid_collision_parity.py new file mode 100644 index 000000000..f832c39ac --- /dev/null +++ b/tools/test_liquid_collision_parity.py @@ -0,0 +1,86 @@ +#!/usr/bin/env python3 +"""Compare contextual liquid collision selection with pinned vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + import math + def bits(value):return struct.pack('>d',value).hex() + epsilon=struct.unpack('>f',struct.pack('>f',1e-5))[0] + modes=['empty','position','player','marker','factory_player','factory_marker','placement','placement_null','with_player','with_marker','with_null'] + def row(mode,y,lava,level,block_y,above,shape,stand,fail,always=False): + return {'mode':mode,'y':bits(y),'other':bits(y),'descending':True,'always':always,'item':0,'count':0,'stand':stand,'fail':False,'liquid':[level,lava,block_y,above,shape,fail]} + # Every liquid block level and context, including the always-fluid bypass. + for lava in [False,True]: + for level in range(16): + for mode in modes: + for always in [False,True]: + for block_y in [-2147483648,0,2147483647]: + for shape in range(4): + for fail in [-1,0,1,2]: + yield row(mode,block_y+2.0,lava,level,block_y,0,shape,True,fail,always) + # Exact top boundaries and all source/flowing fluid states above the block. + for lava in [False,True]: + for mode in ['player','placement','with_player']: + for block_y in [-64,0,2147483647]: + for shape,top in enumerate([-math.inf,1.0,0.5,1.5]): + threshold=(block_y+top)-epsilon + heights=[math.nextafter(threshold,-math.inf),threshold,math.nextafter(threshold,math.inf),math.inf,math.nan] + for y in heights: + for above in range(-1,32): + for stand in [False,True]: + yield row(mode,y,lava,0,block_y,above,shape,stand,-1) + # Inject failures after height checks on an allowed candidate. + for mode in ['player','placement','with_player']: + for lava in [False,True]: + for above in range(-1,32): + for fail in [0,1,2,3]: + yield row(mode,4.0,lava,0,0,above,1,True,fail) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-liquid-collision-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java' + helpers=[oracle.with_name('VanillaFaceSupportOracle.java')] + runner=lab.ROOT/'tools/test_collision_context_parity.py' + sources=[oracle,*helpers,runner,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/collision_context_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle,*helpers],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaCollisionContextOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','collision_context_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('collision_context_fixture.exe' if os.name=='nt' else 'collision_context_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} liquid-collision output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'block_states':32,'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Native contextual LiquidBlock collision dispatch for all 32 water/lava states. Checks the always-fluid bypass, source-only selection, living-entity gating, supplied entity standing shapes, exact height boundaries, all 33 above-block fluid states, callback order and failure propagation, null/placement contexts and wrapping above-block coordinates. Full selected shape data and callback traces are compared. Entity-specific standing shape implementations, liquid simulation and live movement remain pending.'} + lab.write_json(report_path,report);print(f'Scoped liquid collision parity passed: {report_path}') + + +if __name__=='__main__':main() From 87d7005231f551b7cc82da58701891647eb102cd Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 22:56:30 +0200 Subject: [PATCH 060/253] Match powder snow collision and lazy walkability queries --- .../context-regression.json | 203 +++++++++++++++++ .../liquid-regression.json | 205 ++++++++++++++++++ .../scaffolding-regression.json | 205 ++++++++++++++++++ .../scoped-parity.json | 205 ++++++++++++++++++ .../examples/collision_context_fixture.rs | 63 ++++++ crates/horizon-world/src/lib.rs | 1 + .../src/powder_snow_collision.rs | 74 +++++++ docs/collision-geometry.md | 16 ++ .../parity/VanillaCollisionContextOracle.java | 37 +++- tools/test_powder_snow_collision_parity.py | 78 +++++++ 10 files changed, 1082 insertions(+), 5 deletions(-) create mode 100644 benchmarks/rust-powder-snow-collision-2026-10-06/context-regression.json create mode 100644 benchmarks/rust-powder-snow-collision-2026-10-06/liquid-regression.json create mode 100644 benchmarks/rust-powder-snow-collision-2026-10-06/scaffolding-regression.json create mode 100644 benchmarks/rust-powder-snow-collision-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-world/src/powder_snow_collision.rs create mode 100644 tools/test_powder_snow_collision_parity.py diff --git a/benchmarks/rust-powder-snow-collision-2026-10-06/context-regression.json b/benchmarks/rust-powder-snow-collision-2026-10-06/context-regression.json new file mode 100644 index 000000000..26c56fc1e --- /dev/null +++ b/benchmarks/rust-powder-snow-collision-2026-10-06/context-regression.json @@ -0,0 +1,203 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 8338, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java": "b9c34e7f7a7c14001e03373cbbd468a228c5301eb639460b4ce465d14e946113", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceSupportOracle.java": "9ce939a435842867786fed648951bbe77f6ab843f6df09af15f3deb1948c4877", + "tools/test_collision_context_parity.py": "75d6f01e072867d2bd286d2e518e123fcfe055a11ac1705ec99ecec3975cb8d2", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "a40c9d7a4e0a734c124dc856e31359fd4d8de3d1bfc79c86787afa8e8e05e480", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "f0997b21c8083de75f4f8883e8855e1d2d9f1876a2053a8a97b081deed5b0bcd", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/collision_context_fixture.rs": "b7bf0f48f7dc0129c1ebe43c11cb4cad00194b501c2bcbb3220bc8779e695ba4" + }, + "fixtures_sha256": { + ".local/rust-collision-context-parity/inputs.txt": "60b49e91a7a4999cfb8eb6ac3fbc6ec0a931d68cd53f9737959a2bd2b42be7a5" + }, + "rust_output_sha256": "7b23eb34c86c3db5a9e90bdd8ef772b79b2a06c8460542e032589f7962fd8f64", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "7b23eb34c86c3db5a9e90bdd8ef772b79b2a06c8460542e032589f7962fd8f64", + "matched_output_lines": 225126 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "7b23eb34c86c3db5a9e90bdd8ef772b79b2a06c8460542e032589f7962fd8f64", + "matched_output_lines": 225126 + } + ], + "scope": "Actual CollisionContext factories and EntityCollisionContext/Empty/PositionCollisionContext queries on controlled player and marker snapshots. Checks entity identity, captured descending and placement flags, fluid collision flags, empty-stack AIR identity, height thresholds including f32 epsilon, null factories, callback arguments/order/failures and all five fluid type pairs. Entity lifecycle, inventory mutations after capture, experimental minecart contexts, contextual block shape dispatch and live movement integration remain pending." +} diff --git a/benchmarks/rust-powder-snow-collision-2026-10-06/liquid-regression.json b/benchmarks/rust-powder-snow-collision-2026-10-06/liquid-regression.json new file mode 100644 index 000000000..2f96d816d --- /dev/null +++ b/benchmarks/rust-powder-snow-collision-2026-10-06/liquid-regression.json @@ -0,0 +1,205 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 58344, + "block_states": 32, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java": "b9c34e7f7a7c14001e03373cbbd468a228c5301eb639460b4ce465d14e946113", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceSupportOracle.java": "9ce939a435842867786fed648951bbe77f6ab843f6df09af15f3deb1948c4877", + "tools/test_collision_context_parity.py": "75d6f01e072867d2bd286d2e518e123fcfe055a11ac1705ec99ecec3975cb8d2", + "tools/test_liquid_collision_parity.py": "dd77dfef7d3a66e81d92b66680d9626b6d69c54fc742bf5122674f05342fe788", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "a40c9d7a4e0a734c124dc856e31359fd4d8de3d1bfc79c86787afa8e8e05e480", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "f0997b21c8083de75f4f8883e8855e1d2d9f1876a2053a8a97b081deed5b0bcd", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/collision_context_fixture.rs": "b7bf0f48f7dc0129c1ebe43c11cb4cad00194b501c2bcbb3220bc8779e695ba4" + }, + "fixtures_sha256": { + ".local/rust-liquid-collision-parity/inputs.txt": "564e80e9a55a186cd70c21a1db14abf59849be90bc5493346e9e64ff9d3c9d8b" + }, + "rust_output_sha256": "d845ce538e9ce157f6455b32e73e03e9d7df86ebc5c9ab80ebf94705500748ab", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "d845ce538e9ce157f6455b32e73e03e9d7df86ebc5c9ab80ebf94705500748ab", + "matched_output_lines": 571179 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "d845ce538e9ce157f6455b32e73e03e9d7df86ebc5c9ab80ebf94705500748ab", + "matched_output_lines": 571179 + } + ], + "scope": "Native contextual LiquidBlock collision dispatch for all 32 water/lava states. Checks the always-fluid bypass, source-only selection, living-entity gating, supplied entity standing shapes, exact height boundaries, all 33 above-block fluid states, callback order and failure propagation, null/placement contexts and wrapping above-block coordinates. Full selected shape data and callback traces are compared. Entity-specific standing shape implementations, liquid simulation and live movement remain pending." +} diff --git a/benchmarks/rust-powder-snow-collision-2026-10-06/scaffolding-regression.json b/benchmarks/rust-powder-snow-collision-2026-10-06/scaffolding-regression.json new file mode 100644 index 000000000..74e66d686 --- /dev/null +++ b/benchmarks/rust-powder-snow-collision-2026-10-06/scaffolding-regression.json @@ -0,0 +1,205 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 56448, + "block_states": 32, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java": "b9c34e7f7a7c14001e03373cbbd468a228c5301eb639460b4ce465d14e946113", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceSupportOracle.java": "9ce939a435842867786fed648951bbe77f6ab843f6df09af15f3deb1948c4877", + "tools/test_collision_context_parity.py": "75d6f01e072867d2bd286d2e518e123fcfe055a11ac1705ec99ecec3975cb8d2", + "tools/test_scaffolding_collision_parity.py": "bab75e2cad68a3193035a87497eaa372466c405293cc547e39dbd7bd4450d69d", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "a40c9d7a4e0a734c124dc856e31359fd4d8de3d1bfc79c86787afa8e8e05e480", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "f0997b21c8083de75f4f8883e8855e1d2d9f1876a2053a8a97b081deed5b0bcd", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/collision_context_fixture.rs": "b7bf0f48f7dc0129c1ebe43c11cb4cad00194b501c2bcbb3220bc8779e695ba4" + }, + "fixtures_sha256": { + ".local/rust-scaffolding-collision-parity/inputs.txt": "5945054e86700237a7b6de6b362a37a98bdc8afaa67004e8aaa92da1421b552c" + }, + "rust_output_sha256": "33a33cd612c999ab21f1acbbdee522f2ec2b3f877d62f922c665715e3012e207", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "33a33cd612c999ab21f1acbbdee522f2ec2b3f877d62f922c665715e3012e207", + "matched_output_lines": 524300 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "33a33cd612c999ab21f1acbbdee522f2ec2b3f877d62f922c665715e3012e207", + "matched_output_lines": 524300 + } + ], + "scope": "Actual CollisionContext.getCollisionShape dispatch and native scaffolding behavior for all 32 scaffolding states, nine context variants, descending flags, integer Y extremes, nonfinite positions and adjacent double values around the top/bottom float-epsilon thresholds. Full shape coordinates, extrema, box ordering and cube metadata match. A rejecting world proxy verifies selection performs no world reads. Scaffolding placement/update/falling behavior and live movement remain pending." +} diff --git a/benchmarks/rust-powder-snow-collision-2026-10-06/scoped-parity.json b/benchmarks/rust-powder-snow-collision-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..267fa9712 --- /dev/null +++ b/benchmarks/rust-powder-snow-collision-2026-10-06/scoped-parity.json @@ -0,0 +1,205 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 63336, + "block_states": 1, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java": "b9c34e7f7a7c14001e03373cbbd468a228c5301eb639460b4ce465d14e946113", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceSupportOracle.java": "9ce939a435842867786fed648951bbe77f6ab843f6df09af15f3deb1948c4877", + "tools/test_collision_context_parity.py": "75d6f01e072867d2bd286d2e518e123fcfe055a11ac1705ec99ecec3975cb8d2", + "tools/test_powder_snow_collision_parity.py": "ac06f4c6e62c4e95b2c0dbc9da6904e9d91c5389cb7278593f856fc44c43195d", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "a40c9d7a4e0a734c124dc856e31359fd4d8de3d1bfc79c86787afa8e8e05e480", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "f0997b21c8083de75f4f8883e8855e1d2d9f1876a2053a8a97b081deed5b0bcd", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/collision_context_fixture.rs": "b7bf0f48f7dc0129c1ebe43c11cb4cad00194b501c2bcbb3220bc8779e695ba4" + }, + "fixtures_sha256": { + ".local/rust-powder-snow-collision-parity/inputs.txt": "77bee44008a03ed3b55e5cf3d7cb640569dafd2878cc82c339d30f9c24d1420c" + }, + "rust_output_sha256": "08a59aca4df47cab9eb9bbf783291b5356ffb9887dc7b136a16e319ac7e0d358", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "08a59aca4df47cab9eb9bbf783291b5356ffb9887dc7b136a16e319ac7e0d358", + "matched_output_lines": 599180 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "08a59aca4df47cab9eb9bbf783291b5356ffb9887dc7b136a16e319ac7e0d358", + "matched_output_lines": 599180 + } + ], + "scope": "Native PowderSnowBlock contextual collision and canEntityWalkOnPowderSnow decisions with controlled entity metadata, entity-tag membership and equipment snapshots. Checks empty/position/player/nonliving/falling-block/placement contexts, fall-distance and top-height adjacent doubles, nonfinite values, descending, boot identity/count and lazy tag/equipment callbacks with injected failures. Full selected shape geometry and query traces match. Entity tag loading, entity lifecycle, freezing/sinking and live movement remain pending." +} diff --git a/crates/horizon-world/examples/collision_context_fixture.rs b/crates/horizon-world/examples/collision_context_fixture.rs index a2cb52e88..c5f6e90c1 100644 --- a/crates/horizon-world/examples/collision_context_fixture.rs +++ b/crates/horizon-world/examples/collision_context_fixture.rs @@ -8,6 +8,7 @@ use horizon_world::{ entity_obstruction::EntityIdentity, fluid::{FluidKind, FluidState}, liquid_collision::{LiquidCollision, LiquidCollisionWorld}, + powder_snow_collision::{PowderSnowEntity, PowderSnowWorld, powder_snow_collision_shape}, }; use serde_json::Value; use std::{ @@ -150,6 +151,39 @@ fn liquid_shape(index: i64) -> VoxelShape { }; VoxelShape::from_box(Aabb::new(min, max)).unwrap() } +struct PowderWorld<'a, W> { + out: &'a mut W, + calls: i32, + fail: i32, + snapshot: PowderSnowEntity, + tag: bool, + feet: CollisionItem<'a>, +} +impl PowderWorld<'_, W> { + fn query(&mut self, value: &str) -> io::Result<()> { + writeln!(self.out, "{value}")?; + let index = self.calls; + self.calls += 1; + if index == self.fail { + return Err(io::Error::other("injected powder query failure")); + } + Ok(()) + } +} +impl PowderSnowWorld for PowderWorld<'_, W> { + type Error = io::Error; + fn powder_snow_entity(&mut self, _: EntityIdentity) -> io::Result { + Ok(self.snapshot) + } + fn powder_snow_walkable_tag(&mut self, entity: EntityIdentity) -> io::Result { + self.query(&format!("walkable_tag {}", entity.0))?; + Ok(self.tag) + } + fn feet_are_leather_boots(&mut self, entity: EntityIdentity) -> io::Result { + self.query(&format!("feet {}", entity.0))?; + Ok(self.feet.is_item("minecraft:leather_boots")) + } +} fn main() -> Result<(), Box> { let arg = std::env::args().nth(1).expect("private fixture directory"); let dir = Path::new(&arg); @@ -172,6 +206,10 @@ fn main() -> Result<(), Box> { main_hand: None, ..player }; + let falling = CollisionEntity { + identity: EntityIdentity(3), + ..marker + }; let always = f["always"].as_bool().unwrap(); let other = number(&f["other"]); let context = match f["mode"].as_str().unwrap() { @@ -179,6 +217,8 @@ fn main() -> Result<(), Box> { "position" => CollisionContext::position(player.y), "player" => CollisionContext::for_entity(player, always), "marker" => CollisionContext::for_entity(marker, always), + "falling" => CollisionContext::for_entity(falling, always), + "with_falling" => CollisionContext::with_position(Some(falling), other), "factory_player" => CollisionContext::for_entity(player, false), "factory_marker" => CollisionContext::for_entity(marker, false), "placement" => CollisionContext::placement(Some(player)), @@ -200,6 +240,29 @@ fn main() -> Result<(), Box> { context.entity().map_or(0, |id| id.0), held )?; + if let Some(config) = f.get("powder") { + let p = BlockPos::new(17, config[0].as_i64().unwrap() as i32, -33); + let mut world = PowderWorld { + out: &mut out, + calls: 0, + fail: config[5].as_i64().unwrap() as i32, + snapshot: PowderSnowEntity { + fall_distance: number(&config[1]), + falling_block: context.entity() == Some(falling.identity), + }, + tag: config[2].as_bool().unwrap(), + feet: CollisionItem { + item: ITEMS[config[3].as_u64().unwrap() as usize], + count: config[4].as_i64().unwrap() as i32, + }, + }; + match powder_snow_collision_shape(&mut world, p, &context) { + Ok(shape) => emit(world.out, &shape)?, + Err(_) => writeln!(world.out, "shape error")?, + } + writeln!(world.out, "queries {}", world.calls)?; + continue; + } if let Some(config) = f.get("liquid") { let state = liquid_state(config[1].as_bool().unwrap(), config[0].as_i64().unwrap()); let above = config[3].as_i64().unwrap(); diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index a14086a94..1cf570f5b 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -20,6 +20,7 @@ pub mod heightmap; pub mod liquid_collision; pub mod nbt; pub mod piston_shape; +pub mod powder_snow_collision; pub mod region; pub mod registry; pub mod retrogen; diff --git a/crates/horizon-world/src/powder_snow_collision.rs b/crates/horizon-world/src/powder_snow_collision.rs new file mode 100644 index 000000000..f9098e6f8 --- /dev/null +++ b/crates/horizon-world/src/powder_snow_collision.rs @@ -0,0 +1,74 @@ +//! Powder snow collision over entity metadata and lazily queried walkability. +use crate::{collision_context::CollisionContext, entity_obstruction::EntityIdentity}; +use horizon_core::{ + geometry::{Aabb, Vec3, VoxelShape}, + position::BlockPos, +}; +use std::sync::OnceLock; + +#[derive(Clone, Copy, Debug)] +pub struct PowderSnowEntity { + pub fall_distance: f64, + pub falling_block: bool, +} + +pub trait PowderSnowWorld { + type Error; + /// Snapshot of the entity's fallDistance field and FallingBlockEntity type. + fn powder_snow_entity( + &mut self, + entity: EntityIdentity, + ) -> Result; + fn powder_snow_walkable_tag(&mut self, entity: EntityIdentity) -> Result; + /// Invoke only for a living entity; item identity follows ItemStack.is, + /// including its empty-stack normalization. + fn feet_are_leather_boots(&mut self, entity: EntityIdentity) -> Result; +} + +pub fn can_walk_on_powder_snow( + world: &mut W, + entity: EntityIdentity, + living: bool, +) -> Result { + if world.powder_snow_walkable_tag(entity)? { + return Ok(true); + } + if living { + return world.feet_are_leather_boots(entity); + } + Ok(false) +} + +pub fn powder_snow_collision_shape( + world: &mut W, + position: BlockPos, + context: &CollisionContext<'_>, +) -> Result { + if context.is_placement() { + return Ok(VoxelShape::empty()); + } + let Some(entity) = context.entity() else { + return Ok(VoxelShape::empty()); + }; + let snapshot = world.powder_snow_entity(entity)?; + if snapshot.fall_distance > 2.5 { + static FALLING: OnceLock = OnceLock::new(); + return Ok(FALLING + .get_or_init(|| { + VoxelShape::from_box(Aabb::new( + Vec3::ZERO, + Vec3::new(1.0, f64::from(0.9f32), 1.0), + )) + .expect("bounded falling powder snow shape") + }) + .clone()); + } + if snapshot.falling_block + || (can_walk_on_powder_snow(world, entity, context.living_entity().is_some())? + && context.is_above(&VoxelShape::block(), position, false) + && !context.is_descending()) + { + return Ok(VoxelShape::block()); + } + Ok(VoxelShape::empty()) +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index be42ac928..56f5102f6 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -339,3 +339,19 @@ data and ordered callback traces, including failures at each query. The records **571,179 matching lines per JAR**. Standing shapes and fluid abilities are controlled inputs in this suite; each entity type still needs its implementation. Fluid spreading, swimming, drowning and live movement remain pending. + + +Powder snow now selects the native `0.9f`-high falling shape when fall distance +exceeds 2.5, a full cube for falling-block entities, and a full cube for entities +that can walk on it, are above it and are not descending. Placement and absent +entity contexts are empty. Walkability checks the entity-type tag first, then +leather boots only for living entities; successful tags skip equipment queries. +The API takes current entity metadata and lazy tag/equipment providers. + +`python3 tools/test_powder_snow_collision_parity.py` compares **63,336 fixtures** +and **599,180 matching lines per JAR** in the +[powder-snow report](../benchmarks/rust-powder-snow-collision-2026-10-06/scoped-parity.json). +The native block method and walkability predicate execute over controlled entity +snapshots. The corpus covers fall-distance and top-height boundaries, nonfinite +values, falling-block instances, item counts, query failures and skipped queries. +Entity tag loading, freezing, sinking and live movement remain separate work. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java index cf69f0e92..7c63b7209 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java @@ -5,6 +5,8 @@ import java.nio.file.*; import net.minecraft.core.BlockPos; import net.minecraft.world.entity.*; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.item.FallingBlockEntity; +import net.minecraft.tags.*; import net.minecraft.world.item.*; import net.minecraft.world.level.GameType; import net.minecraft.world.level.CollisionGetter; @@ -24,7 +26,10 @@ public final class VanillaCollisionContextOracle { void query(String value){out.println(value);if(calls++==fail)throw new Stop();} } public static class PlayerSnapshot extends Player { - Trace trace;VoxelShape liquidShape; + Trace trace;VoxelShape liquidShape;boolean powderTag;ItemStack feet; + @Override public boolean is(TagKey> tag){if(tag!=EntityTypeTags.POWDER_SNOW_WALKABLE_MOBS)throw new AssertionError(tag);trace.query("walkable_tag 1");return powderTag;} + @Override public ItemStack getItemBySlot(EquipmentSlot slot){if(slot!=EquipmentSlot.FEET)throw new AssertionError(slot);trace.query("feet 1");return feet;} + @Override public VoxelShape getLiquidCollisionShape(){trace.query("liquid_shape 1");return liquidShape;} boolean descending,stand,fail; @@ -41,10 +46,16 @@ public final class VanillaCollisionContextOracle { } } public static class MarkerSnapshot extends Marker { - boolean descending; + boolean descending,powderTag;Trace trace; + @Override public boolean is(TagKey> tag){if(tag!=EntityTypeTags.POWDER_SNOW_WALKABLE_MOBS)throw new AssertionError(tag);trace.query("walkable_tag 2");return powderTag;} public MarkerSnapshot(){super(null,null);} @Override public boolean isDescending(){return descending;} } + public static class FallingSnapshot extends FallingBlockEntity { + boolean descending; + public FallingSnapshot(){super(null,null);} + @Override public boolean isDescending(){return descending;} + } private static int fluidIndex(FluidState state){for(int i=0;iShapes.empty();case 1->Shapes.block();case 2->Shapes.box(0,0,0,1,0.5,1);case 3->Shapes.box(0.25,-0.5,0.25,0.75,1.5,0.75);default->throw new AssertionError();};} @@ -61,20 +72,23 @@ public final class VanillaCollisionContextOracle { var f=JsonParser.parseString(line).getAsJsonObject(); var player=(PlayerSnapshot)allocate.invoke(unsafe,PlayerSnapshot.class); var marker=(MarkerSnapshot)allocate.invoke(unsafe,MarkerSnapshot.class); - player.descending=marker.descending=f.get("descending").getAsBoolean(); + var falling=(FallingSnapshot)allocate.invoke(unsafe,FallingSnapshot.class); + player.descending=marker.descending=falling.descending=f.get("descending").getAsBoolean(); // Query only item identity/count; component loading and inventory lifecycle are outside this fixture. player.held=(ItemStack)allocate.invoke(unsafe,ItemStack.class); stackItem.set(player.held,ITEMS[f.get("item").getAsInt()].builtInRegistryHolder()); stackCount.setInt(player.held,f.get("count").getAsInt()); player.stand=f.get("stand").getAsBoolean();player.fail=f.get("fail").getAsBoolean(); double y=number(f.get("y")),other=number(f.get("other")); - position.set(player,new Vec3(0,y,0));position.set(marker,new Vec3(0,y,0)); + position.set(player,new Vec3(0,y,0));position.set(marker,new Vec3(0,y,0));position.set(falling,new Vec3(0,y,0)); boolean always=f.get("always").getAsBoolean(); var context=switch(f.get("mode").getAsString()){ case "empty"->always?CollisionContext.emptyWithFluidCollisions():CollisionContext.empty(); case "position"->CollisionContext.positionContext(y); case "player"->CollisionContext.of(player,always); case "marker"->CollisionContext.of(marker,always); + case "falling"->CollisionContext.of(falling,always); + case "with_falling"->CollisionContext.withPosition(falling,other); case "factory_player"->CollisionContext.of(player); case "factory_marker"->CollisionContext.of(marker); case "placement"->CollisionContext.placementContext(player); @@ -84,9 +98,22 @@ public final class VanillaCollisionContextOracle { case "with_null"->CollisionContext.withPosition(null,other); default->throw new AssertionError(); }; - int entity=context instanceof EntityCollisionContext ec?(ec.getEntity()==player?1:ec.getEntity()==marker?2:0):0; + int entity=context instanceof EntityCollisionContext ec?(ec.getEntity()==player?1:ec.getEntity()==marker?2:ec.getEntity()==falling?3:0):0; int held=0;for(int i=0;i[]{CollisionGetter.class},(proxy,method,values)->{throw new AssertionError("unexpected powder world query: "+method);}); + var emit=VanillaFaceSupportOracle.class.getDeclaredMethod("emit",PrintWriter.class,VoxelShape.class);emit.setAccessible(true); + try{emit.invoke(null,out,context.getCollisionShape(Blocks.POWDER_SNOW.defaultBlockState(),world,pos));}catch(Stop error){out.println("shape error");} + out.println("queries "+trace.calls); + continue; + } if(f.has("liquid")) { var config=f.getAsJsonArray("liquid"); var state=(config.get(1).getAsBoolean()?Blocks.LAVA:Blocks.WATER).defaultBlockState().setValue(LiquidBlock.LEVEL,config.get(0).getAsInt()); diff --git a/tools/test_powder_snow_collision_parity.py b/tools/test_powder_snow_collision_parity.py new file mode 100644 index 000000000..07055aa89 --- /dev/null +++ b/tools/test_powder_snow_collision_parity.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python3 +"""Compare contextual powder-snow collision selection with pinned vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + import math + def bits(value):return struct.pack('>d',value).hex() + epsilon=struct.unpack('>f',struct.pack('>f',1e-5))[0] + modes=['empty','position','player','marker','falling','factory_player','factory_marker','placement','placement_null','with_player','with_marker','with_falling','with_null'] + distances=[-math.inf,-1.0,-0.0,0.0,math.nextafter(2.5,-math.inf),2.5,math.nextafter(2.5,math.inf),100.0,math.inf,math.nan] + def row(mode,y,block_y,fall,tag,item,count,descending,fail=-1): + return {'mode':mode,'y':bits(y),'other':bits(y),'descending':descending,'always':True,'item':0,'count':0,'stand':False,'fail':False,'powder':[block_y,bits(fall),tag,item,count,fail]} + for block_y in [-2147483648,0,2147483647]: + threshold=(block_y+1.0)-epsilon + heights=[math.nextafter(threshold,-math.inf),threshold,math.nextafter(threshold,math.inf),block_y+1.0,block_y-0.5,block_y+2.0,math.inf,math.nan] + for mode in modes: + for fall in distances: + for tag in [False,True]: + for item,count in [(0,0),(4,0),(4,1),(4,-1),(1,1)]: + for descending in [False,True]: + for y in heights: + yield row(mode,y,block_y,fall,tag,item,count,descending) + for mode in modes: + for fall in [0.0,2.5,3.0]: + for tag in [False,True]: + for item in [1,4]: + for descending in [False,True]: + for fail in [0,1,2]: + yield row(mode,1.0,0,fall,tag,item,1,descending,fail) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-powder-snow-collision-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java' + helpers=[oracle.with_name('VanillaFaceSupportOracle.java')] + runner=lab.ROOT/'tools/test_collision_context_parity.py' + sources=[oracle,*helpers,runner,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/collision_context_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle,*helpers],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaCollisionContextOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','collision_context_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('collision_context_fixture.exe' if os.name=='nt' else 'collision_context_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} powder-snow-collision output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'block_states':1,'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Native PowderSnowBlock contextual collision and canEntityWalkOnPowderSnow decisions with controlled entity metadata, entity-tag membership and equipment snapshots. Checks empty/position/player/nonliving/falling-block/placement contexts, fall-distance and top-height adjacent doubles, nonfinite values, descending, boot identity/count and lazy tag/equipment callbacks with injected failures. Full selected shape geometry and query traces match. Entity tag loading, entity lifecycle, freezing/sinking and live movement remain pending.'} + lab.write_json(report_path,report);print(f'Scoped powder-snow collision parity passed: {report_path}') + + +if __name__=='__main__':main() From 31b484ae2dc3fe7c623f1b0bb819f05fd6ed3718 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 23:05:40 +0200 Subject: [PATCH 061/253] Integrate contextual collision selection across the vanilla block registry --- .../scoped-parity.json | 218 ++++++++++++++++++ .../examples/collision_context_fixture.rs | 150 +++++++++++- crates/horizon-world/src/block_collision.rs | 57 ++++- docs/collision-geometry.md | 26 ++- .../parity/VanillaCollisionContextOracle.java | 19 ++ .../VanillaContextualCollisionAudit.java | 64 +++++ tools/test_contextual_collision_parity.py | 66 ++++++ 7 files changed, 594 insertions(+), 6 deletions(-) create mode 100644 benchmarks/rust-contextual-collision-2026-10-06/scoped-parity.json create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaContextualCollisionAudit.java create mode 100644 tools/test_contextual_collision_parity.py diff --git a/benchmarks/rust-contextual-collision-2026-10-06/scoped-parity.json b/benchmarks/rust-contextual-collision-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..3cd22dd0a --- /dev/null +++ b/benchmarks/rust-contextual-collision-2026-10-06/scoped-parity.json @@ -0,0 +1,218 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 785906, + "block_states": 35723, + "independent_cached_states": 35492, + "context_sensitive_cached_states": 32, + "uncached_states": 199, + "audit_positions_per_cached_state": 7, + "audit_context_types": 2, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java": "bcc421fd7948ae7385e346e3de19c58222a2cad6b39122cac241cf70f9cc6071", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceSupportOracle.java": "9ce939a435842867786fed648951bbe77f6ab843f6df09af15f3deb1948c4877", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "60ff9ef7c1d5e23c080f9aec95ab2e7d3b7c5b5bcd67b9efa9518776c400629a", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaContextualCollisionAudit.java": "f53402c8830a82defe82538ec4c894df769aafdc644b43c824240adc4af7745d", + "tools/test_collision_context_parity.py": "75d6f01e072867d2bd286d2e518e123fcfe055a11ac1705ec99ecec3975cb8d2", + "tools/test_contextual_collision_parity.py": "6108a0d9e0c4e1592a336c35d096fb623eccff8ed136e31d8984c2365f66d6e9", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "5d0f5ded49d34bb999d73a4e1b89a318fa66c0246e9904d3cbf810d3aa370312", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "05313e0c1f3089524fe029f9aac3e439cd47f1c9584c8c7e154c9adcfa88c335", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "f0997b21c8083de75f4f8883e8855e1d2d9f1876a2053a8a97b081deed5b0bcd", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/collision_context_fixture.rs": "cf777882b8999174682c1c29fa8df7202b67acf2ca6dc063f674a52996341d4b" + }, + "fixtures_sha256": { + ".local/rust-contextual-collision-parity/inputs.txt": "394a00fda537f7af0840ed7dd6664581c04f4af9b383107db81df21ca9d0915f", + ".local/rust-contextual-collision-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-contextual-collision-parity/cached-collision.nbt": "f3a5c6a5b2d51dad6c52e486e2b9989e79fd55db1a9bda6196db399550b04078" + }, + "rust_output_sha256": "9b328cde8c73c2e54870991bf847c966093f067b41980e1e7daa1a26558e424d", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "9b328cde8c73c2e54870991bf847c966093f067b41980e1e7daa1a26558e424d", + "matched_output_lines": 2391334, + "audited_states": 35723, + "audit_sha256": "c109c808ca5b2314fc5fdfce744296e7ae0de45c00d31d38bd701a493ae6c4c5" + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "9b328cde8c73c2e54870991bf847c966093f067b41980e1e7daa1a26558e424d", + "matched_output_lines": 2391334, + "audited_states": 35723, + "audit_sha256": "c109c808ca5b2314fc5fdfce744296e7ae0de45c00d31d38bd701a493ae6c4c5" + } + ], + "scope": "Integrated contextual dispatcher across every pinned block state, eleven context variants and both always-fluid flag inputs. The native audit verifies 35,492 cached states return the identical cached shape without world/context queries at seven positions with interface and entity context providers that reject queries; liquid states query context instead. Integrated outputs compare cache-relative shape equality or full uncached geometry and ordered entity/world callbacks. Missing block entities are used here; active shulker/piston states retain separate coverage. Experimental minecart contexts, entity lifecycle and live movement remain pending." +} diff --git a/crates/horizon-world/examples/collision_context_fixture.rs b/crates/horizon-world/examples/collision_context_fixture.rs index c5f6e90c1..32d9df7a6 100644 --- a/crates/horizon-world/examples/collision_context_fixture.rs +++ b/crates/horizon-world/examples/collision_context_fixture.rs @@ -1,14 +1,19 @@ use horizon_core::{ - geometry::{Aabb, Axis, Vec3, VoxelShape}, + geometry::{Aabb, Axis, ShapeOp, Vec3, VoxelShape}, position::BlockPos, }; use horizon_world::{ + block_collision::{BlockCollisionRegistry, DynamicCollisionWorld, ShulkerCollisionState}, chunk::BlockState, + collision::CachedCollisionRegistry, collision_context::{CollisionContext, CollisionEntity, CollisionItem}, + dynamic_support::DynamicSupportWorld, entity_obstruction::EntityIdentity, fluid::{FluidKind, FluidState}, liquid_collision::{LiquidCollision, LiquidCollisionWorld}, + nbt::{self, Limits}, powder_snow_collision::{PowderSnowEntity, PowderSnowWorld, powder_snow_collision_shape}, + registry::{BlockRegistry, BlockStateId}, }; use serde_json::Value; use std::{ @@ -184,10 +189,111 @@ impl PowderSnowWorld for PowderWorld<'_, W> { Ok(self.feet.is_item("minecraft:leather_boots")) } } +struct RegistryWorld<'a, W> { + liquid: LiquidWorld<'a, W>, + powder: PowderSnowEntity, + tag: bool, + feet: CollisionItem<'a>, +} +impl DynamicSupportWorld for RegistryWorld<'_, W> { + type Error = io::Error; + fn shulker_is_closed(&mut self, p: [i32; 3]) -> io::Result> { + self.liquid + .query(&format!("block_entity {} {} {}", p[0], p[1], p[2]))?; + Ok(None) + } + fn moving_piston_shape(&mut self, p: [i32; 3]) -> io::Result> { + self.liquid + .query(&format!("block_entity {} {} {}", p[0], p[1], p[2]))?; + Ok(None) + } +} +impl DynamicCollisionWorld for RegistryWorld<'_, W> { + fn shulker_collision_state( + &mut self, + p: [i32; 3], + ) -> io::Result> { + self.liquid + .query(&format!("block_entity {} {} {}", p[0], p[1], p[2]))?; + Ok(None) + } +} +impl LiquidCollisionWorld for RegistryWorld<'_, W> { + type Error = io::Error; + fn entity_liquid_shape(&mut self, entity: EntityIdentity) -> io::Result { + self.liquid.entity_liquid_shape(entity) + } + fn fluid(&mut self, p: BlockPos) -> io::Result { + self.liquid.fluid(p) + } + fn entity_can_stand(&mut self, entity: EntityIdentity, fluid: FluidState) -> io::Result { + self.liquid.entity_can_stand(entity, fluid) + } +} +impl PowderSnowWorld for RegistryWorld<'_, W> { + type Error = io::Error; + fn powder_snow_entity(&mut self, _: EntityIdentity) -> io::Result { + Ok(self.powder) + } + fn powder_snow_walkable_tag(&mut self, entity: EntityIdentity) -> io::Result { + self.liquid.query(&format!("walkable_tag {}", entity.0))?; + Ok(self.tag) + } + fn feet_are_leather_boots(&mut self, entity: EntityIdentity) -> io::Result { + self.liquid.query(&format!("feet {}", entity.0))?; + Ok(self.feet.is_item("minecraft:leather_boots")) + } +} fn main() -> Result<(), Box> { let arg = std::env::args().nth(1).expect("private fixture directory"); let dir = Path::new(&arg); + let registry = if dir.join("block-registry.nbt").exists() { + Some(BlockRegistry::from_nbt( + &nbt::read_named( + &fs::read(dir.join("block-registry.nbt"))?, + Limits::default(), + )? + .0 + .tag, + )?) + } else { + None + }; + let cached = registry + .as_ref() + .map(|registry| { + let tag = nbt::read_named( + &fs::read(dir.join("cached-collision.nbt"))?, + Limits::default(), + ) + .map_err(io::Error::other)? + .0 + .tag; + CachedCollisionRegistry::from_nbt(&tag, registry).map(std::sync::Arc::new) + }) + .transpose()?; + let collisions = cached + .as_ref() + .map(|cached| BlockCollisionRegistry::new(cached.clone())) + .transpose()?; let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + if let (Some(registry), Some(cached)) = (®istry, &cached) { + let mut audit = io::BufWriter::new(fs::File::create(dir.join("rust-audit.txt"))?); + for index in 0..registry.len() { + let id = BlockStateId(index as u32); + let label = if cached.cached_shape(id)?.is_none() { + "uncached" + } else if matches!( + registry.state(id).unwrap().name.as_str(), + "minecraft:water" | "minecraft:lava" + ) { + "fluid" + } else { + "independent" + }; + writeln!(audit, "audit {index} {label}")?; + } + } let fluids = FluidKind::ALL .map(|kind| FluidState::from_json(&format!("{{\"id\":\"{}\"}}", kind.name())).unwrap()); for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { @@ -240,6 +346,48 @@ fn main() -> Result<(), Box> { context.entity().map_or(0, |id| id.0), held )?; + if let Some(config) = f.get("registry") { + let state = BlockStateId(config[0].as_u64().unwrap() as u32); + let p = BlockPos::new( + config[1].as_i64().unwrap() as i32, + config[2].as_i64().unwrap() as i32, + config[3].as_i64().unwrap() as i32, + ); + let mut world = RegistryWorld { + liquid: LiquidWorld { + out: &mut out, + calls: 0, + fail: -1, + shape: liquid_shape(2), + above: FluidState::EMPTY, + stand: f["stand"].as_bool().unwrap(), + }, + powder: PowderSnowEntity { + fall_distance: if always { 3.0 } else { 0.0 }, + falling_block: context.entity() == Some(falling.identity), + }, + tag: false, + feet: CollisionItem { + item: "minecraft:leather_boots", + count: 1, + }, + }; + let shape = collisions + .as_ref() + .unwrap() + .collision_shape_with_context(&mut world, state, p, &context)?; + if let Some(reference) = cached.as_ref().unwrap().cached_shape(state)? { + writeln!( + world.liquid.out, + "cache_equal {}", + !shape.join_is_not_empty(reference, ShapeOp::XOR)? + )?; + } else { + emit(world.liquid.out, &shape)?; + } + writeln!(world.liquid.out, "queries {}", world.liquid.calls)?; + continue; + } if let Some(config) = f.get("powder") { let p = BlockPos::new(17, config[0].as_i64().unwrap() as i32, -33); let mut world = PowderWorld { diff --git a/crates/horizon-world/src/block_collision.rs b/crates/horizon-world/src/block_collision.rs index e82811f10..c360654ae 100644 --- a/crates/horizon-world/src/block_collision.rs +++ b/crates/horizon-world/src/block_collision.rs @@ -1,8 +1,11 @@ //! Cached/dynamic no-context collision queries and explicit contextual block rules. -//! Contextual selection must not fall back to the no-context cache. +//! Context-sensitive families override the no-context cache explicitly. use crate::{ collision::CachedCollisionRegistry, + collision_context::CollisionContext, dynamic_support::{DynamicSupport, DynamicSupportError, DynamicSupportWorld}, + liquid_collision::{LiquidCollision, LiquidCollisionWorld}, + powder_snow_collision::{PowderSnowWorld, powder_snow_collision_shape}, registry::{BlockRegistry, BlockStateId}, }; use horizon_core::geometry::{Aabb, Direction, Vec3, VoxelShape}; @@ -55,6 +58,7 @@ pub trait DynamicCollisionWorld: DynamicSupportWorld { pub enum CollisionQueryError { Data(io::Error), Dynamic(DynamicSupportError), + Context(E), Unsupported(BlockStateId), } impl std::fmt::Display for CollisionQueryError { @@ -62,6 +66,7 @@ impl std::fmt::Display for CollisionQueryError { match self { Self::Data(error) => error.fmt(f), Self::Dynamic(error) => error.fmt(f), + Self::Context(error) => error.fmt(f), Self::Unsupported(state) => write!(f, "unsupported block collision state {}", state.0), } } @@ -71,12 +76,27 @@ impl std::error::Error for CollisionQueryError { cached: Arc>, dynamic: HashMap, + contextual: HashMap, +} +enum ContextualRule { + Scaffolding(ScaffoldingCollision), + Liquid(LiquidCollision), + PowderSnow, } impl<'r> BlockCollisionRegistry<'r> { pub fn new(cached: Arc>) -> io::Result { let mut dynamic = HashMap::new(); + let mut contextual = HashMap::new(); for index in 0..cached.registry().len() { let id = BlockStateId(index as u32); + let state = cached.registry().state(id).unwrap(); + if let Some(rule) = ScaffoldingCollision::from_state(state)? { + contextual.insert(id, ContextualRule::Scaffolding(rule)); + } else if let Some(rule) = LiquidCollision::from_state(state)? { + contextual.insert(id, ContextualRule::Liquid(rule)); + } else if state.name == "minecraft:powder_snow" { + contextual.insert(id, ContextualRule::PowderSnow); + } if cached.cached_shape(id)?.is_none() { if let Some(rule) = DynamicSupport::from_state(cached.registry().state(id).unwrap())? @@ -85,7 +105,11 @@ impl<'r> BlockCollisionRegistry<'r> { } } } - Ok(Self { cached, dynamic }) + Ok(Self { + cached, + dynamic, + contextual, + }) } pub fn registry(&self) -> &'r BlockRegistry { self.cached.registry() @@ -109,6 +133,35 @@ impl<'r> BlockCollisionRegistry<'r> { .collision_shape(world, position) .map_err(CollisionQueryError::Dynamic) } + + /// Ordinary entity/position/placement contexts. The remaining pinned block + /// families share their no-context geometry; the native registry audit checks + /// cached states with rejecting context/world providers before using that path. + /// Experimental minecart position exclusions are a separate context layer. + pub fn collision_shape_with_context( + &self, + world: &mut W, + state: BlockStateId, + position: horizon_core::position::BlockPos, + context: &CollisionContext<'_>, + ) -> Result> + where + W: DynamicCollisionWorld + + LiquidCollisionWorld + + PowderSnowWorld, + { + match self.contextual.get(&state) { + Some(ContextualRule::Scaffolding(rule)) => Ok(rule.shape(context, position)), + Some(ContextualRule::Liquid(rule)) => rule + .shape(world, position, context) + .map_err(CollisionQueryError::Context), + Some(ContextualRule::PowderSnow) => { + powder_snow_collision_shape(world, position, context) + .map_err(CollisionQueryError::Context) + } + None => self.collision_shape(world, state, [position.x, position.y, position.z]), + } + } } /// Entity-context scaffold selection, independent of world queries. Construction diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 56f5102f6..3b403b0d0 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -108,9 +108,9 @@ must select it, while a cached empty shape is a valid `Some` value. This covers the cached branch of the **no-context** `BlockState.getCollisionShape` method. Vanilla's overload taking `CollisionContext` always calls block behavior; -the cache cannot establish entity collision parity. Dynamic no-context selection is implemented as described below. Entity-dependent -block selection, world borders, movement integration, fluids, block effects and -live collision broad-phase queries still need implementation. +the cache cannot establish entity collision parity. Dynamic and ordinary entity-context selection are implemented as described below. +Experimental minecart contexts, world borders, movement integration, fluid +simulation, block effects and live collision broad-phase queries remain pending. Run the comparisons after preparing the pinned artifacts: @@ -355,3 +355,23 @@ The native block method and walkability predicate execute over controlled entity snapshots. The corpus covers fall-distance and top-height boundaries, nonfinite values, falling-block instances, item counts, query failures and skipped queries. Entity tag loading, freezing, sinking and live movement remain separate work. + + +`BlockCollisionRegistry::collision_shape_with_context` now combines the contextual +scaffolding, liquid and powder-snow rules with the existing cached/dynamic paths. +It dispatches these overrides before consulting cached geometry. The pinned +native audit checks **35,492 context-independent cached states** at seven positions +with both interface and entity contexts that reject every query: each returns the +identical cache object without world reads. The **32 cached liquid states** query +the context and take their separate behavior path. The **199 uncached states** +continue through explicit behavior implementations. + +`python3 tools/test_contextual_collision_parity.py` validates integrated dispatch +for all **35,723 states**, **11 contexts** and both fluid-flag inputs: +**785,906 fixtures** and **2,391,334 matching output lines per JAR** in the +[contextual-registry report](../benchmarks/rust-contextual-collision-2026-10-06/scoped-parity.json). +Outputs compare cache-relative shape equality or full uncached geometry, plus +ordered world/entity callbacks. This integration corpus supplies missing block +entities; active shulker and piston snapshots retain their separate suites. +These checks establish the recorded collision-query scope, not entity movement +or whole-game parity. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java index 7c63b7209..b9a9b3a93 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java @@ -101,6 +101,25 @@ public final class VanillaCollisionContextOracle { int entity=context instanceof EntityCollisionContext ec?(ec.getEntity()==player?1:ec.getEntity()==marker?2:ec.getEntity()==falling?3:0):0; int held=0;for(int i=0;i[]{CollisionGetter.class},(proxy,method,values)->{ + var at=(BlockPos)values[0]; + if(method.getName().equals("getFluidState")){trace.query("fluid_at "+at.getX()+" "+at.getY()+" "+at.getZ());return Fluids.EMPTY.defaultFluidState();} + if(method.getName().equals("getBlockEntity")){trace.query("block_entity "+at.getX()+" "+at.getY()+" "+at.getZ());return null;} + throw new AssertionError(method); + }); + var shape=context.getCollisionShape(state,world,pos); + var cacheField=net.minecraft.world.level.block.state.BlockBehaviour.BlockStateBase.class.getDeclaredField("cache");cacheField.setAccessible(true);var cache=cacheField.get(state); + if(cache!=null){var shapeField=cache.getClass().getDeclaredField("collisionShape");shapeField.setAccessible(true);out.println("cache_equal "+!Shapes.joinIsNotEmpty(shape,(VoxelShape)shapeField.get(cache),BooleanOp.NOT_SAME));} + else{var emit=VanillaFaceSupportOracle.class.getDeclaredMethod("emit",PrintWriter.class,VoxelShape.class);emit.setAccessible(true);emit.invoke(null,out,shape);} + out.println("queries "+trace.calls); + continue; + } if(f.has("powder")) { var config=f.getAsJsonArray("powder"); var pos=new BlockPos(17,config.get(0).getAsInt(),-33); diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaContextualCollisionAudit.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaContextualCollisionAudit.java new file mode 100644 index 000000000..f58dbcde0 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaContextualCollisionAudit.java @@ -0,0 +1,64 @@ +package dev.horizonlab.parity; +import java.io.*; +import java.lang.reflect.*; +import java.nio.file.*; +import net.minecraft.core.BlockPos; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.item.*; +import net.minecraft.world.level.*; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.state.*; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.phys.shapes.*; +/** Verifies that the pinned cached families used by the contextual dispatcher + * return the exact cache object without reading world or context providers. */ +public final class VanillaContextualCollisionAudit { + static final class Query extends RuntimeException { Query(String name){super(name);} } + static class RejectContext implements CollisionContext { + public boolean isDescending(){throw new Query("descending");} + public boolean isAbove(VoxelShape s,BlockPos p,boolean d){throw new Query("above");} + public boolean isHoldingItem(Item i){throw new Query("item");} + public boolean alwaysCollideWithFluid(){throw new Query("fluid");} + public boolean canStandOnFluid(FluidState a,FluidState b){throw new Query("stand");} + public boolean isPlacement(){throw new Query("placement");} + public VoxelShape getCollisionShape(BlockState s,CollisionGetter w,BlockPos p){throw new Query("shape");} + } + static class RejectEntityContext extends EntityCollisionContext { + RejectEntityContext(){super(false,false,0.0,ItemStack.EMPTY,false,null);} + public boolean isDescending(){throw new Query("descending");} + public boolean isAbove(VoxelShape s,BlockPos p,boolean d){throw new Query("above");} + public boolean isHoldingItem(Item i){throw new Query("item");} + public boolean alwaysCollideWithFluid(){throw new Query("fluid");} + public boolean canStandOnFluid(FluidState a,FluidState b){throw new Query("stand");} + public boolean isPlacement(){throw new Query("placement");} + public Entity getEntity(){throw new Query("entity");} + public VoxelShape getCollisionShape(BlockState s,CollisionGetter w,BlockPos p){throw new Query("shape");} + } + public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); + var cache=BlockBehaviour.BlockStateBase.class.getDeclaredField("cache");cache.setAccessible(true); + var collision=cache.getType().getDeclaredField("collisionShape");collision.setAccessible(true); + var world=(BlockGetter)Proxy.newProxyInstance(BlockGetter.class.getClassLoader(),new Class[]{BlockGetter.class},(p,m,v)->{throw new AssertionError("unexpected world read: "+m);}); + var contexts=new CollisionContext[]{new RejectContext(),new RejectEntityContext()}; + var positions=new BlockPos[]{BlockPos.ZERO,new BlockPos(17,-64,-33),new BlockPos(-17,320,33),new BlockPos(30000000,63,-30000000),new BlockPos(Integer.MIN_VALUE,Integer.MIN_VALUE,Integer.MIN_VALUE),new BlockPos(Integer.MAX_VALUE,Integer.MAX_VALUE,Integer.MAX_VALUE),new BlockPos(-1,-1,-1)}; + int independent=0,contextual=0,uncached=0; + try(var out=new PrintWriter(Files.newBufferedWriter(Path.of(args[1]).resolve(args[0]+"-audit.txt")))) { + for(var state:Block.BLOCK_STATE_REGISTRY) { + var c=cache.get(state);String label="uncached"; + if(c==null)uncached++; + else { + String expected=state.getBlock() instanceof LiquidBlock?"fluid":"independent"; + for(var p:positions)for(var context:contexts){ + String result; + try{var shape=state.getCollisionShape(world,p,context);if(shape!=collision.get(c))throw new AssertionError("different shape identity: "+state);result="independent";} + catch(Query query){result=query.getMessage();} + if(!result.equals(expected))throw new AssertionError(state+" unexpected query "+result); + } + label=expected;if(label.equals("independent"))independent++;else contextual++; + } + out.println("audit "+Block.getId(state)+" "+label); + } + } + if(independent!=35492||contextual!=32||uncached!=199)throw new AssertionError("registry classification changed"); + } +} diff --git a/tools/test_contextual_collision_parity.py b/tools/test_contextual_collision_parity.py new file mode 100644 index 000000000..60a1ad7f8 --- /dev/null +++ b/tools/test_contextual_collision_parity.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python3 +"""Compare integrated contextual block collision selection with pinned vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + def bits(value):return struct.pack('>d',value).hex() + modes=['empty','position','player','marker','falling','placement','placement_null','with_player','with_marker','with_falling','with_null'] + positions=[[0,0,0],[17,-64,-33],[2147483647,2147483647,-2147483648]] + for state in range(35723): + for i,mode in enumerate(modes): + for always in [False,True]: + p=positions[(state+i)%len(positions)] + y=p[1]+[0.5,1.0,1.5][(state+i)%3] + yield {'mode':mode,'y':bits(y),'other':bits(y),'descending':bool(i%2),'always':always,'item':2,'count':1,'stand':True,'fail':False,'registry':[state,*p]} + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-contextual-collision-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java' + helpers=[oracle.with_name(name+'.java') for name in ['VanillaFaceSupportOracle','VanillaCollisionOracle','VanillaContextualCollisionAudit']] + runner=lab.ROOT/'tools/test_collision_context_parity.py' + sources=[oracle,*helpers,runner,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/collision_context_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle,*helpers],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaCollisionContextOracle',mode,path],side+'-'+mode) + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars['server']),dependency_path]),'dev.horizonlab.parity.VanillaCollisionOracle','generate',build],'export') + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs,build/'block-registry.nbt',build/'cached-collision.nbt'];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','collision_context_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('collision_context_fixture.exe' if os.name=='nt' else 'collision_context_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jar),dependency_path]),'dev.horizonlab.parity.VanillaContextualCollisionAudit',side,build],side+'-audit') + audited=base.compare(build/(side+'-audit.txt'),build/'rust-audit.txt') + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched,'audited_states':audited,'audit_sha256':lab.digest(build/(side+'-audit.txt'),'sha256')}) + print(f'{side}: {matched:,} contextual-collision output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'block_states':35723,'independent_cached_states':35492,'context_sensitive_cached_states':32,'uncached_states':199,'audit_positions_per_cached_state':7,'audit_context_types':2,'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Integrated contextual dispatcher across every pinned block state, eleven context variants and both always-fluid flag inputs. The native audit verifies 35,492 cached states return the identical cached shape without world/context queries at seven positions with interface and entity context providers that reject queries; liquid states query context instead. Integrated outputs compare cache-relative shape equality or full uncached geometry and ordered entity/world callbacks. Missing block entities are used here; active shulker/piston states retain separate coverage. Experimental minecart contexts, entity lifecycle and live movement remain pending.'} + lab.write_json(report_path,report);print(f'Scoped contextual collision parity passed: {report_path}') + + +if __name__=='__main__':main() From 75e835558c8ea45e12c1f86a561e7ad9eadde610 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 23:13:27 +0200 Subject: [PATCH 062/253] Preserve canonical collision shape identities in registry imports --- .../contextual-regression.json | 218 ++++++++++++++++++ .../scoped-parity.json | 215 +++++++++++++++++ .../examples/collision_fixture.rs | 7 + crates/horizon-world/src/collision.rs | 107 ++++++--- crates/horizon-world/tests/collision_data.rs | 78 +++++++ docs/collision-geometry.md | 17 ++ .../parity/VanillaCollisionOracle.java | 4 +- tools/test_collision_parity.py | 10 +- 8 files changed, 624 insertions(+), 32 deletions(-) create mode 100644 benchmarks/rust-canonical-collision-2026-10-06/contextual-regression.json create mode 100644 benchmarks/rust-canonical-collision-2026-10-06/scoped-parity.json diff --git a/benchmarks/rust-canonical-collision-2026-10-06/contextual-regression.json b/benchmarks/rust-canonical-collision-2026-10-06/contextual-regression.json new file mode 100644 index 000000000..2f1e5a243 --- /dev/null +++ b/benchmarks/rust-canonical-collision-2026-10-06/contextual-regression.json @@ -0,0 +1,218 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 785906, + "block_states": 35723, + "independent_cached_states": 35492, + "context_sensitive_cached_states": 32, + "uncached_states": 199, + "audit_positions_per_cached_state": 7, + "audit_context_types": 2, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java": "bcc421fd7948ae7385e346e3de19c58222a2cad6b39122cac241cf70f9cc6071", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceSupportOracle.java": "9ce939a435842867786fed648951bbe77f6ab843f6df09af15f3deb1948c4877", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "f2b4f440a5bbce4224a4b3cee494b0f7ddcafbf72db12592c94ef9fb94fbc8a6", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaContextualCollisionAudit.java": "f53402c8830a82defe82538ec4c894df769aafdc644b43c824240adc4af7745d", + "tools/test_collision_context_parity.py": "75d6f01e072867d2bd286d2e518e123fcfe055a11ac1705ec99ecec3975cb8d2", + "tools/test_contextual_collision_parity.py": "6108a0d9e0c4e1592a336c35d096fb623eccff8ed136e31d8984c2365f66d6e9", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "5d0f5ded49d34bb999d73a4e1b89a318fa66c0246e9904d3cbf810d3aa370312", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "f0997b21c8083de75f4f8883e8855e1d2d9f1876a2053a8a97b081deed5b0bcd", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/collision_context_fixture.rs": "cf777882b8999174682c1c29fa8df7202b67acf2ca6dc063f674a52996341d4b" + }, + "fixtures_sha256": { + ".local/rust-contextual-collision-parity/inputs.txt": "394a00fda537f7af0840ed7dd6664581c04f4af9b383107db81df21ca9d0915f", + ".local/rust-contextual-collision-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-contextual-collision-parity/cached-collision.nbt": "4a274cd720a1bda585b02f50f16e90246576679e1e173c214548c5cbf607ab2d" + }, + "rust_output_sha256": "9b328cde8c73c2e54870991bf847c966093f067b41980e1e7daa1a26558e424d", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "9b328cde8c73c2e54870991bf847c966093f067b41980e1e7daa1a26558e424d", + "matched_output_lines": 2391334, + "audited_states": 35723, + "audit_sha256": "c109c808ca5b2314fc5fdfce744296e7ae0de45c00d31d38bd701a493ae6c4c5" + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "9b328cde8c73c2e54870991bf847c966093f067b41980e1e7daa1a26558e424d", + "matched_output_lines": 2391334, + "audited_states": 35723, + "audit_sha256": "c109c808ca5b2314fc5fdfce744296e7ae0de45c00d31d38bd701a493ae6c4c5" + } + ], + "scope": "Integrated contextual dispatcher across every pinned block state, eleven context variants and both always-fluid flag inputs. The native audit verifies 35,492 cached states return the identical cached shape without world/context queries at seven positions with interface and entity context providers that reject queries; liquid states query context instead. Integrated outputs compare cache-relative shape equality or full uncached geometry and ordered entity/world callbacks. Missing block entities are used here; active shulker/piston states retain separate coverage. Experimental minecart contexts, entity lifecycle and live movement remain pending." +} diff --git a/benchmarks/rust-canonical-collision-2026-10-06/scoped-parity.json b/benchmarks/rust-canonical-collision-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..a04d1a01f --- /dev/null +++ b/benchmarks/rust-canonical-collision-2026-10-06/scoped-parity.json @@ -0,0 +1,215 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "inputs_sha256": "ec4d8458f10935a5e68dd27e69af493bd38463eb0a59747741cc7a5bd49957c7", + "rust_output_sha256": "834038ea44d19d97fd11c165cfab2f2fea84b434fea57dc1aa94182548bd3a98", + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "f2b4f440a5bbce4224a4b3cee494b0f7ddcafbf72db12592c94ef9fb94fbc8a6", + "tools/test_collision_parity.py": "d030af509ae46aeb10c6257ac03bb324821ca09d2eeb10787a2eb17e9f7727c5", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "5d0f5ded49d34bb999d73a4e1b89a318fa66c0246e9904d3cbf810d3aa370312", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "f0997b21c8083de75f4f8883e8855e1d2d9f1876a2053a8a97b081deed5b0bcd", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/collision_fixture.rs": "2cc76249dc8bdb57b9ff490e582ebf9924c592c43eab20f1f6a0770763985e86" + }, + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "834038ea44d19d97fd11c165cfab2f2fea84b434fea57dc1aa94182548bd3a98", + "matched_output_lines": 1132980, + "registry_states": 35723, + "cached_states": 35524, + "uncached_states": 199, + "unique_shapes": 6093, + "unique_grids": 330, + "queries": 213144 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "834038ea44d19d97fd11c165cfab2f2fea84b434fea57dc1aa94182548bd3a98", + "matched_output_lines": 1132980, + "registry_states": 35723, + "cached_states": 35524, + "uncached_states": 199, + "unique_shapes": 6093, + "unique_grids": 330, + "queries": 213144 + } + ], + "canonical_identities": { + "empty_states": 5566, + "block_states": 3348, + "other_cached_states": 26610 + }, + "scope": "Pinned no-context cached collision branch only. Registry identity validation, resident section lookup, grids, native canonical empty/block identities distinct from equal geometry, discrete extrema including empty shapes, greedy boxes, bounds, translated collide, ray hits, closest points and moved cell lookup. Uncached and entity-context behavior have separate comparison suites." +} diff --git a/crates/horizon-world/examples/collision_fixture.rs b/crates/horizon-world/examples/collision_fixture.rs index 95c7ad73c..f8f2651c9 100644 --- a/crates/horizon-world/examples/collision_fixture.rs +++ b/crates/horizon-world/examples/collision_fixture.rs @@ -72,6 +72,7 @@ fn main() -> Result<(), Box> { Limits::default(), )?; let collisions = CachedCollisionRegistry::from_nbt(&root.tag, ®istry)?; + assert!(collisions.has_canonical_identities()); let mut section = BlockSection::uniform(BlockStateId(0), ®istry)?; let mut out = std::io::BufWriter::new(fs::File::create(base.join("rust.txt"))?); let mut identities = std::collections::HashMap::new(); @@ -85,6 +86,12 @@ fn main() -> Result<(), Box> { let count = identities.len(); let identity = *identities.entry(std::ptr::from_ref(shape)).or_insert(count); writeln!(out, "identity {identity}")?; + writeln!( + out, + "canonical {} {}", + shape.same_identity(&horizon_core::geometry::VoxelShape::empty()), + shape.same_identity(&horizon_core::geometry::VoxelShape::block()) + )?; let flags = shape.cube_coordinate_axes(); writeln!( out, diff --git a/crates/horizon-world/src/collision.rs b/crates/horizon-world/src/collision.rs index b5e27c11b..694264a5e 100644 --- a/crates/horizon-world/src/collision.rs +++ b/crates/horizon-world/src/collision.rs @@ -28,6 +28,7 @@ pub struct CachedCollisionRegistry<'r> { shapes: Vec, state_shapes: Vec, grid_count: usize, + canonical_identities: bool, } impl<'r> CachedCollisionRegistry<'r> { pub fn registry(&self) -> &'r BlockRegistry { @@ -55,8 +56,24 @@ impl<'r> CachedCollisionRegistry<'r> { return Err(invalid("too many cached collision shapes")); } let mut shapes = Vec::with_capacity(entries.len()); + let mut canonical_identities = true; + let mut seen_canonical = [false; 3]; let mut grids = HashMap::::new(); for entry in entries { + let canonical = match entry.get("canonical") { + None => { + canonical_identities = false; + 0 + } + Some(Tag::Byte(value @ 0..=2)) => *value as usize, + _ => return Err(invalid("invalid canonical collision identity")), + }; + if canonical != 0 { + if seen_canonical[canonical] { + return Err(invalid("duplicate canonical collision identity")); + } + seen_canonical[canonical] = true; + } let mut coords: [Vec; 3] = std::array::from_fn(|_| Vec::new()); for (i, axis) in ["x", "y", "z"].into_iter().enumerate() { let Some(Tag::LongArray(bits)) = entry.get(axis) else { @@ -102,40 +119,66 @@ impl<'r> CachedCollisionRegistry<'r> { min, max, }; - if let Some(existing) = grids.get(&key) { - shapes.push(existing.fresh_identity()); - continue; - } - let shape = match entry.get("cube") { - Some(Tag::Byte(0)) => { - VoxelShape::from_mixed_grid(coords, &occupied, coordinate_cubes) - } - Some(Tag::Byte(1)) => { - if *cube_axes != 7 { - return Err(invalid("cube shape has array-coordinate metadata")); + let shape = if let Some(existing) = grids.get(&key) { + existing.fresh_identity() + } else { + match entry.get("cube") { + Some(Tag::Byte(0)) => { + VoxelShape::from_mixed_grid(coords, &occupied, coordinate_cubes) } - let sizes = std::array::from_fn(|i| coords[i].len().saturating_sub(1)); - let shape = VoxelShape::from_cube(sizes, &occupied) - .map_err(|e| invalid(e.to_string()))?; - for axis in Axis::ALL { - if shape - .coordinates(axis) - .iter() - .map(|v| v.to_bits()) - .ne(coords[axis as usize].iter().map(|v| v.to_bits())) - { - return Err(invalid("cube collision coordinates differ")); + Some(Tag::Byte(1)) => { + if *cube_axes != 7 { + return Err(invalid("cube shape has array-coordinate metadata")); } + let sizes = std::array::from_fn(|i| coords[i].len().saturating_sub(1)); + let shape = VoxelShape::from_cube(sizes, &occupied) + .map_err(|e| invalid(e.to_string()))?; + for axis in Axis::ALL { + if shape + .coordinates(axis) + .iter() + .map(|v| v.to_bits()) + .ne(coords[axis as usize].iter().map(|v| v.to_bits())) + { + return Err(invalid("cube collision coordinates differ")); + } + } + Ok(shape) } - Ok(shape) + _ => return Err(invalid("invalid collision cube flag")), } - _ => return Err(invalid("invalid collision cube flag")), - } - .map_err(|e| invalid(e.to_string()))?; - let shape = shape + .map_err(|e| invalid(e.to_string()))? .with_discrete_bounds(min, max) - .map_err(|e| invalid(e.to_string()))?; - grids.insert(key, shape.clone()); + .map_err(|e| invalid(e.to_string()))? + }; + let shape = if canonical == 0 { + shape + } else { + let reference = if canonical == 1 { + VoxelShape::empty() + } else { + VoxelShape::block() + }; + let expected_count = usize::from(canonical == 2); + if cube != reference.is_cube() + || coordinate_cubes != reference.cube_coordinate_axes() + || occupied != vec![true; expected_count] + || min != [0; 3] + || max != [expected_count as i32; 3] + || Axis::ALL.into_iter().any(|axis| { + key.coords[axis as usize] + .iter() + .copied() + .ne(reference.coordinates(axis).iter().map(|v| v.to_bits())) + }) + { + return Err(invalid( + "canonical collision identity has different geometry", + )); + } + reference + }; + grids.entry(key).or_insert_with(|| shape.clone()); shapes.push(shape); } let Some(Tag::IntArray(state_shapes)) = tag.get("cached_shapes") else { @@ -153,8 +196,14 @@ impl<'r> CachedCollisionRegistry<'r> { shapes, state_shapes: state_shapes.clone(), grid_count: grids.len(), + canonical_identities, }) } + /// Older exports omit native canonical identities. Such imports retain their + /// local alias graph but cannot support identity-dependent world iteration. + pub fn has_canonical_identities(&self) -> bool { + self.canonical_identities + } pub fn shape_count(&self) -> usize { self.shapes.len() } diff --git a/crates/horizon-world/tests/collision_data.rs b/crates/horizon-world/tests/collision_data.rs index 35ec3c569..f6384c329 100644 --- a/crates/horizon-world/tests/collision_data.rs +++ b/crates/horizon-world/tests/collision_data.rs @@ -155,3 +155,81 @@ fn equal_grids_share_storage_without_collapsing_shape_identities() { )); assert!(first.same_identity(collision.cached_shape(BlockStateId(1)).unwrap().unwrap())); } + +fn canonical_marker(shape: &mut Tag, value: Tag) { + let Tag::Compound(fields) = shape else { + unreachable!() + }; + fields.insert("canonical".into(), value); +} + +#[test] +fn canonical_shapes_restore_global_identity_without_normalizing_equal_grids() { + use horizon_core::geometry::VoxelShape; + let (registry_tag, mut collision_tag) = fixture(); + let registry = BlockRegistry::from_nbt(®istry_tag).unwrap(); + assert!( + !CachedCollisionRegistry::from_nbt(&collision_tag, ®istry) + .unwrap() + .has_canonical_identities() + ); + let Some(Tag::List(shapes)) = collision_tag.get_mut("shapes") else { + unreachable!() + }; + canonical_marker(&mut shapes[0], Tag::Byte(1)); + canonical_marker(&mut shapes[1], Tag::Byte(2)); + let mut equal_block = shapes[1].clone(); + canonical_marker(&mut equal_block, Tag::Byte(0)); + shapes.push(equal_block); + *collision_tag.get_mut("cached_shapes").unwrap() = Tag::IntArray(vec![0, 1, 2]); + let collision = CachedCollisionRegistry::from_nbt(&collision_tag, ®istry).unwrap(); + assert!(collision.has_canonical_identities()); + assert_eq!(collision.unique_grid_count(), 2); + let empty = collision.cached_shape(BlockStateId(0)).unwrap().unwrap(); + let block = collision.cached_shape(BlockStateId(1)).unwrap().unwrap(); + let separate = collision.cached_shape(BlockStateId(2)).unwrap().unwrap(); + assert!(empty.same_identity(&VoxelShape::empty())); + assert!(block.same_identity(&VoxelShape::block())); + assert!(!separate.same_identity(&VoxelShape::block())); + assert_eq!(block.boxes(), separate.boxes()); + assert!(std::ptr::eq( + block.boxes().as_ptr(), + separate.boxes().as_ptr() + )); +} + +#[test] +fn canonical_identity_claims_require_exact_geometry_and_unique_exports() { + let (registry_tag, valid) = fixture(); + let registry = BlockRegistry::from_nbt(®istry_tag).unwrap(); + for (index, marker) in [ + (0, Tag::Byte(2)), + (1, Tag::Byte(1)), + (1, Tag::Byte(3)), + (1, Tag::Int(2)), + ] { + let mut data = valid.clone(); + let Some(Tag::List(shapes)) = data.get_mut("shapes") else { + unreachable!() + }; + canonical_marker(&mut shapes[index], marker); + assert!(CachedCollisionRegistry::from_nbt(&data, ®istry).is_err()); + } + let mut duplicate = valid.clone(); + let Some(Tag::List(shapes)) = duplicate.get_mut("shapes") else { + unreachable!() + }; + canonical_marker(&mut shapes[1], Tag::Byte(2)); + shapes.push(shapes[1].clone()); + assert!(CachedCollisionRegistry::from_nbt(&duplicate, ®istry).is_err()); + let mut noncanonical_zero = valid; + let Some(Tag::List(shapes)) = noncanonical_zero.get_mut("shapes") else { + unreachable!() + }; + canonical_marker(&mut shapes[1], Tag::Byte(2)); + let Some(Tag::LongArray(coords)) = shapes[1].get_mut("x") else { + unreachable!() + }; + coords[0] = (-0.0f64).to_bits() as i64; + assert!(CachedCollisionRegistry::from_nbt(&noncanonical_zero, ®istry).is_err()); +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 3b403b0d0..cd80c418d 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -375,3 +375,20 @@ ordered world/entity callbacks. This integration corpus supplies missing block entities; active shulker and piston snapshots retain their separate suites. These checks establish the recorded collision-query scope, not entity movement or whole-game parity. + + +Private shape exports now carry explicit canonical-identity markers. The importer +restores the global empty/full-block shapes only when their complete grid metadata +matches, and rejects duplicate or malformed canonical claims. Equal unmarked +shapes keep distinct identities. Older exports remain readable and report +`has_canonical_identities() == false`; they cannot establish the canonical identity +needed by vanilla's block-collision iterator fast path. + +The [canonical-identity report](../benchmarks/rust-canonical-collision-2026-10-06/scoped-parity.json) +adds identity checks for every cached state: **5,566 canonical empty**, **3,348 +canonical full-block** and **26,610 other cached states**, with **1,132,980 matching +output lines per JAR**. The integrated contextual comparison also passes again +with **2,391,334 lines per JAR** in its +[regression report](../benchmarks/rust-canonical-collision-2026-10-06/contextual-regression.json). +Five import tests cover legacy data, equal-but-distinct grids, canonical restoration +and malformed identity metadata. Workspace Clippy passes without warnings. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java index 318bb1251..3466606cd 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java @@ -38,6 +38,7 @@ public final class VanillaCollisionOracle { } private static CompoundTag grid(VoxelShape shape) throws ReflectiveOperationException { CompoundTag tag = new CompoundTag(); + tag.putByte("canonical",(byte)(shape==Shapes.empty()?1:shape==Shapes.block()?2:0)); tag.putByte("cube", (byte)(shape instanceof CubeVoxelShape ? 1 : 0)); int cubeAxes=0;for(Direction.Axis axis:Direction.Axis.values())if(shape.getCoords(axis) instanceof CubePointRange)cubeAxes|=1< boxes=shape.toAabbs(); out.printf("state %d cached %d%n",id,boxes.size()); out.printf("identity %d%n",identities.computeIfAbsent(shape,key->identities.size())); + out.printf("canonical %b %b%n",shape==Shapes.empty(),shape==Shapes.block()); int cubeAxes=0;for(Direction.Axis axis:Direction.Axis.values())if(shape.getCoords(axis) instanceof CubePointRange)cubeAxes|=1< Date: Tue, 6 Oct 2026 23:24:57 +0200 Subject: [PATCH 063/253] Match lazy block collision scanning and provider query order --- .../scoped-parity.json | 204 +++++++++++++++ .../examples/block_collision_scan_fixture.rs | 239 ++++++++++++++++++ .../horizon-world/src/block_collision_scan.rs | 237 +++++++++++++++++ crates/horizon-world/src/lib.rs | 1 + .../tests/block_collision_scan.rs | 108 ++++++++ docs/collision-geometry.md | 21 ++ .../VanillaBlockCollisionScanOracle.java | 73 ++++++ tools/test_block_collision_scan_parity.py | 84 ++++++ 8 files changed, 967 insertions(+) create mode 100644 benchmarks/rust-block-collision-scan-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-world/examples/block_collision_scan_fixture.rs create mode 100644 crates/horizon-world/src/block_collision_scan.rs create mode 100644 crates/horizon-world/tests/block_collision_scan.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockCollisionScanOracle.java create mode 100644 tools/test_block_collision_scan_parity.py diff --git a/benchmarks/rust-block-collision-scan-2026-10-06/scoped-parity.json b/benchmarks/rust-block-collision-scan-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..8c914b16e --- /dev/null +++ b/benchmarks/rust-block-collision-scan-2026-10-06/scoped-parity.json @@ -0,0 +1,204 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 4176, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockCollisionScanOracle.java": "ee34da34195df5a0cdd4a24a4faf7154200b674d6523eba4700381439d556b2d", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceSupportOracle.java": "9ce939a435842867786fed648951bbe77f6ab843f6df09af15f3deb1948c4877", + "tools/test_block_collision_scan_parity.py": "5289ba6c555367d4dbfe7cbf8e577705c16a8426dfcc431c787aeed3e513970d", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "5d0f5ded49d34bb999d73a4e1b89a318fa66c0246e9904d3cbf810d3aa370312", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "3f574287b721b86f39d976d98a69b632b87658cd38f4a7dc0e6c1b6623d5a6a3", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/block_collision_scan_fixture.rs": "509420fc9601ece4ad17d4eec67a2d2ad4de0c653c55cbf01ba746a354575f17" + }, + "fixtures_sha256": { + ".local/rust-block-collision-scan-parity/inputs.txt": "d87e1a985430aab7a9fd77e6f3a70e4810d19241c74a9fe8c324348d5c0737dc" + }, + "rust_output_sha256": "f975369ad065b5417dbeacbfa554fc3f27ddaa4f2e634e57f5380e070b355d72", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "f975369ad065b5417dbeacbfa554fc3f27ddaa4f2e634e57f5380e070b355d72", + "matched_output_lines": 517820 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "f975369ad065b5417dbeacbfa554fc3f27ddaa4f2e634e57f5380e070b355d72", + "matched_output_lines": 517820 + } + ], + "scope": "Actual BlockCollisions cursor and selection algorithm over controlled block metadata, chunk providers and context shapes. Compares ordered chunk/state/suffocation/shape calls, missing-chunk retries, cached chunk reuse, face/edge/corner filtering, canonical full-block versus equal noncanonical shape behavior, exact emitted shape data, early consumer termination and injected provider failures. Finite bounded scans include thin/zero-size boxes, chunk crossings and wrapped integer positions. Registry-specific metadata/shape dispatch, live chunk loading and entity movement are separate integration work; unsupported cursor volumes and caller budgets use typed Rust errors." +} diff --git a/crates/horizon-world/examples/block_collision_scan_fixture.rs b/crates/horizon-world/examples/block_collision_scan_fixture.rs new file mode 100644 index 000000000..cc52dc6ec --- /dev/null +++ b/crates/horizon-world/examples/block_collision_scan_fixture.rs @@ -0,0 +1,239 @@ +use horizon_core::{ + geometry::{Aabb, Axis, ShapeOp, Vec3, VoxelShape}, + position::{BlockPos, ChunkPos}, +}; +use horizon_world::{ + block_collision_scan::{BlockCollisionScan, BlockCollisionWorld, CollisionBlock}, + collision_context::CollisionContext, + registry::BlockStateId, +}; +use serde_json::Value; +use std::{ + cell::RefCell, + fs, + io::{self, Write}, + path::Path, + rc::Rc, +}; +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn values( + out: &mut impl Write, + label: &str, + values: impl IntoIterator, +) -> io::Result<()> { + write!(out, "{label}")?; + for v in values { + let bits = if v.is_nan() { + 0x7ff8_0000_0000_0000 + } else { + v.to_bits() + }; + write!(out, " {bits:016x}")?; + } + writeln!(out) +} +fn box_values(out: &mut impl Write, label: &str, b: Aabb) -> io::Result<()> { + values( + out, + label, + [ + b.min(Axis::X), + b.min(Axis::Y), + b.min(Axis::Z), + b.max(Axis::X), + b.max(Axis::Y), + b.max(Axis::Z), + ], + ) +} +fn emit(out: &mut impl Write, shape: &VoxelShape) -> io::Result<()> { + writeln!( + out, + "shape {} {} {}", + shape.is_empty(), + shape.boxes().len(), + shape.is_cube() + )?; + for (axis, name) in Axis::ALL.into_iter().zip(["x", "y", "z"]) { + values(out, name, shape.coordinates(axis).iter().copied())?; + } + let axes = shape.cube_coordinate_axes(); + writeln!( + out, + "axes {}", + u8::from(axes[0]) + 2 * u8::from(axes[1]) + 4 * u8::from(axes[2]) + )?; + values( + out, + "extrema", + Axis::ALL + .map(|a| shape.min(a)) + .into_iter() + .chain(Axis::ALL.map(|a| shape.max(a))), + )?; + match shape.bounds() { + Some(b) => box_values(out, "bounds", b)?, + None => writeln!(out, "bounds none")?, + } + for b in shape.boxes() { + box_values(out, "box", *b)?; + } + Ok(()) +} + +fn shape(index: u64) -> VoxelShape { + let cuboid = |min, max| VoxelShape::from_box(Aabb::new(min, max)).unwrap(); + match index { + 0 => VoxelShape::empty(), + 1 => VoxelShape::block(), + 2 => VoxelShape::block().moved(Vec3::ZERO), + 3 => cuboid(Vec3::ZERO, Vec3::new(1.0, 0.5, 1.0)), + 4 => cuboid(Vec3::new(-0.25, -0.5, -0.25), Vec3::new(1.25, 1.5, 1.25)), + 5 => cuboid(Vec3::ZERO, Vec3::new(1e-8, 1.0, 1.0)), + 6 => cuboid(Vec3::ZERO, Vec3::new(0.25, 1.0, 0.25)) + .join( + &cuboid(Vec3::new(0.75, 0.0, 0.75), Vec3::new(1.0, 1.0, 1.0)), + ShapeOp::OR, + ) + .unwrap(), + _ => unreachable!(), + } +} +struct Entry { + block: CollisionBlock, + shape: VoxelShape, + suffocating: bool, +} +struct World { + out: Rc>, + calls: i32, + fail: i32, + missing: i32, + seed: i32, + palette: Vec, +} +impl World { + fn query(&mut self, value: &str) -> io::Result<()> { + writeln!(self.out.borrow_mut(), "{value}")?; + let index = self.calls; + self.calls += 1; + if index == self.fail { + return Err(io::Error::other("injected collision scan failure")); + } + Ok(()) + } +} +impl BlockCollisionWorld for World { + type Error = io::Error; + type Chunk = ChunkPos; + fn collision_chunk(&mut self, p: ChunkPos) -> io::Result> { + self.query(&format!("chunk {} {}", p.x, p.z))?; + Ok( + if self.missing == 1 || self.missing == 2 && (p.x ^ p.z) & 1 != 0 { + None + } else { + Some(p) + }, + ) + } + fn collision_block(&mut self, chunk: ChunkPos, p: BlockPos) -> io::Result { + assert_eq!(chunk, p.chunk()); + self.query(&format!("block {} {} {}", p.x, p.y, p.z))?; + let hash = + p.x.wrapping_mul(3) + .wrapping_add(p.y.wrapping_mul(5)) + .wrapping_add(p.z.wrapping_mul(7)) + .wrapping_add(self.seed) + & i32::MAX; + Ok(self.palette[hash as usize % self.palette.len()].block) + } + fn is_suffocating( + &mut self, + chunk: ChunkPos, + block: CollisionBlock, + p: BlockPos, + ) -> io::Result { + assert_eq!(chunk, p.chunk()); + self.query(&format!( + "suffocating {} {} {} {}", + p.x, p.y, p.z, block.state.0 + ))?; + Ok(self.palette[block.state.0 as usize].suffocating) + } + fn context_shape( + &mut self, + block: CollisionBlock, + p: BlockPos, + _: &CollisionContext<'_>, + ) -> io::Result { + self.query(&format!("shape {} {} {} {}", p.x, p.y, p.z, block.state.0))?; + Ok(self.palette[block.state.0 as usize].shape.clone()) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let out = Rc::new(RefCell::new(io::BufWriter::new(fs::File::create( + dir.join("rust.txt"), + )?))); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let palette = f["palette"] + .as_array() + .unwrap() + .iter() + .enumerate() + .map(|(i, v)| Entry { + block: CollisionBlock { + state: BlockStateId(i as u32), + large_collision_shape: v[1].as_bool().unwrap(), + moving_piston: v[2].as_bool().unwrap(), + }, + shape: shape(v[0].as_u64().unwrap()), + suffocating: v[3].as_bool().unwrap(), + }) + .collect(); + let mut world = World { + out: out.clone(), + calls: 0, + fail: f["fail"].as_i64().unwrap() as i32, + missing: f["missing"].as_i64().unwrap() as i32, + seed: f["seed"].as_i64().unwrap() as i32, + palette, + }; + let v = &f["box"]; + let bounds = Aabb::new( + Vec3::new(number(&v[0]), number(&v[1]), number(&v[2])), + Vec3::new(number(&v[3]), number(&v[4]), number(&v[5])), + ); + let mut hits = 0; + { + let mut scan = BlockCollisionScan::new( + &mut world, + CollisionContext::empty(false), + bounds, + f["suffocating"].as_bool().unwrap(), + 1_000_000, + )?; + for _ in 0..f["limit"].as_u64().unwrap() { + match scan.next() { + None => break, + Some(Ok(hit)) => { + let p = hit.position; + writeln!(out.borrow_mut(), "hit {} {} {}", p.x, p.y, p.z)?; + emit(&mut *out.borrow_mut(), &hit.shape)?; + hits += 1; + } + Some(Err(_)) => { + writeln!(out.borrow_mut(), "error")?; + break; + } + } + } + } + writeln!(out.borrow_mut(), "done {hits} {}", world.calls)?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/block_collision_scan.rs b/crates/horizon-world/src/block_collision_scan.rs new file mode 100644 index 000000000..3b03a64ab --- /dev/null +++ b/crates/horizon-world/src/block_collision_scan.rs @@ -0,0 +1,237 @@ +//! Lazy block collision selection in vanilla cursor/query order. Providers own +//! chunk availability, state metadata, suffocation predicates and context dispatch. +use crate::{collision_context::CollisionContext, registry::BlockStateId}; +use horizon_core::{ + geometry::{Aabb, ShapeError, ShapeOp, Vec3, VoxelShape}, + position::{BlockPos, ChunkPos}, +}; + +#[derive(Clone, Copy, Debug)] +pub struct CollisionBlock { + pub state: BlockStateId, + pub large_collision_shape: bool, + pub moving_piston: bool, +} + +pub trait BlockCollisionWorld { + type Error; + type Chunk: Copy; + /// None is a missing collision chunk; native iteration retries missing chunks. + fn collision_chunk(&mut self, position: ChunkPos) -> Result, Self::Error>; + fn collision_block( + &mut self, + chunk: Self::Chunk, + position: BlockPos, + ) -> Result; + fn is_suffocating( + &mut self, + chunk: Self::Chunk, + block: CollisionBlock, + position: BlockPos, + ) -> Result; + /// Query against the global collision world, not the cached chunk provider. + /// Shapes must preserve canonical block identity (including imported shapes). + fn context_shape( + &mut self, + block: CollisionBlock, + position: BlockPos, + context: &CollisionContext<'_>, + ) -> Result; +} + +#[derive(Debug)] +pub enum CollisionScanError { + InvalidBounds, + TooLarge, + VisitBudget, + World(E), + Shape(ShapeError), +} +impl std::fmt::Display for CollisionScanError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::InvalidBounds => f.write_str("collision scan bounds must be finite"), + Self::TooLarge => { + f.write_str("collision scan exceeds the positive Java-int cursor domain") + } + Self::VisitBudget => f.write_str("collision scan candidate budget exhausted"), + Self::World(error) => error.fmt(f), + Self::Shape(error) => error.fmt(f), + } + } +} +impl std::error::Error for CollisionScanError {} + +#[derive(Debug)] +pub struct BlockCollisionHit { + pub position: BlockPos, + pub shape: VoxelShape, +} + +pub struct BlockCollisionScan<'w, 'c, W: BlockCollisionWorld> { + world: &'w mut W, + context: CollisionContext<'c>, + bounds: Aabb, + entity_shape: VoxelShape, + only_suffocating: bool, + start: BlockPos, + sizes: [usize; 3], + index: usize, + count: usize, + budget: usize, + chunk: Option<(ChunkPos, W::Chunk)>, + failed: bool, +} +impl<'w, 'c, W: BlockCollisionWorld> BlockCollisionScan<'w, 'c, W> { + /// Finite bounds and a positive-Java-int candidate volume are supported. + /// Budget counts every cursor cell, including skipped corners. After an error + /// iteration terminates; already performed queries are not rolled back. + pub fn new( + world: &'w mut W, + context: CollisionContext<'c>, + bounds: Aabb, + only_suffocating: bool, + candidate_budget: usize, + ) -> Result> { + let min = bounds.min_position(); + let max = bounds.max_position(); + if !min.is_finite() || !max.is_finite() { + return Err(CollisionScanError::InvalidBounds); + } + let start = BlockPos::containing(Vec3::new(min.x - 1.0e-7, min.y - 1.0e-7, min.z - 1.0e-7)) + .offset(-1, -1, -1); + let end = BlockPos::containing(Vec3::new(max.x + 1.0e-7, max.y + 1.0e-7, max.z + 1.0e-7)) + .offset(1, 1, 1); + let sizes = [ + end.x.wrapping_sub(start.x).wrapping_add(1), + end.y.wrapping_sub(start.y).wrapping_add(1), + end.z.wrapping_sub(start.z).wrapping_add(1), + ]; + if sizes.iter().any(|size| *size <= 0) { + return Err(CollisionScanError::TooLarge); + } + let count = sizes + .into_iter() + .try_fold(1u64, |n, size| { + n.checked_mul(size as u64).filter(|n| *n <= i32::MAX as u64) + }) + .ok_or(CollisionScanError::TooLarge)? as usize; + Ok(Self { + world, + context, + bounds, + entity_shape: VoxelShape::from_box(bounds).map_err(CollisionScanError::Shape)?, + only_suffocating, + start, + sizes: sizes.map(|s| s as usize), + index: 0, + count, + budget: candidate_budget, + chunk: None, + failed: false, + }) + } + + fn find_next(&mut self) -> Result, CollisionScanError> { + while self.index < self.count { + if self.index >= self.budget { + return Err(CollisionScanError::VisitBudget); + } + let [width, height, _] = self.sizes; + let relative = [ + self.index % width, + self.index / width % height, + self.index / width / height, + ]; + self.index += 1; + let kind = relative + .into_iter() + .zip(self.sizes) + .filter(|(p, size)| *p == 0 || *p == size - 1) + .count(); + if kind == 3 { + continue; + } + let p = self + .start + .offset(relative[0] as i32, relative[1] as i32, relative[2] as i32); + let chunk_position = p.chunk(); + let chunk = match self.chunk { + Some((at, chunk)) if at == chunk_position => Some(chunk), + _ => { + let chunk = self + .world + .collision_chunk(chunk_position) + .map_err(CollisionScanError::World)?; + self.chunk = chunk.map(|chunk| (chunk_position, chunk)); + chunk + } + }; + let Some(chunk) = chunk else { + continue; + }; + let block = self + .world + .collision_block(chunk, p) + .map_err(CollisionScanError::World)?; + if self.only_suffocating + && !self + .world + .is_suffocating(chunk, block, p) + .map_err(CollisionScanError::World)? + { + continue; + } + if kind == 1 && !block.large_collision_shape || kind == 2 && !block.moving_piston { + continue; + } + let shape = self + .world + .context_shape(block, p, &self.context) + .map_err(CollisionScanError::World)?; + let offset = Vec3::new(f64::from(p.x), f64::from(p.y), f64::from(p.z)); + let moved = if shape.same_identity(&VoxelShape::block()) { + // Native adds one in floating point, including at i32::MAX. + let unit = Aabb::new( + offset, + Vec3::new(offset.x + 1.0, offset.y + 1.0, offset.z + 1.0), + ); + if !self.bounds.intersects(unit) { + continue; + } + shape.moved(offset) + } else { + let moved = shape.moved(offset); + if moved.is_empty() + || !moved + .join_is_not_empty(&self.entity_shape, ShapeOp::AND) + .map_err(CollisionScanError::Shape)? + { + continue; + } + moved + }; + return Ok(Some(BlockCollisionHit { + position: p, + shape: moved, + })); + } + Ok(None) + } +} +impl Iterator for BlockCollisionScan<'_, '_, W> { + type Item = Result>; + fn next(&mut self) -> Option { + if self.failed { + return None; + } + match self.find_next() { + Ok(hit) => hit.map(Ok), + Err(error) => { + self.failed = true; + Some(Err(error)) + } + } + } +} +impl std::iter::FusedIterator for BlockCollisionScan<'_, '_, W> {} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 1cf570f5b..ddb1b473c 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -2,6 +2,7 @@ #![forbid(unsafe_code)] pub mod block_collision; +pub mod block_collision_scan; pub mod block_entities; pub mod block_placement; pub mod block_properties; diff --git a/crates/horizon-world/tests/block_collision_scan.rs b/crates/horizon-world/tests/block_collision_scan.rs new file mode 100644 index 000000000..d9f4a9fd5 --- /dev/null +++ b/crates/horizon-world/tests/block_collision_scan.rs @@ -0,0 +1,108 @@ +use horizon_core::{ + geometry::{Aabb, Vec3, VoxelShape}, + position::{BlockPos, ChunkPos}, +}; +use horizon_world::{ + block_collision_scan::{ + BlockCollisionScan, BlockCollisionWorld, CollisionBlock, CollisionScanError, + }, + collision_context::CollisionContext, +}; +use std::io; + +struct FailedChunk { + calls: usize, +} +impl BlockCollisionWorld for FailedChunk { + type Error = io::Error; + type Chunk = (); + fn collision_chunk(&mut self, _: ChunkPos) -> io::Result> { + self.calls += 1; + Err(io::Error::other("missing test provider")) + } + fn collision_block(&mut self, _: (), _: BlockPos) -> io::Result { + unreachable!() + } + fn is_suffocating(&mut self, _: (), _: CollisionBlock, _: BlockPos) -> io::Result { + unreachable!() + } + fn context_shape( + &mut self, + _: CollisionBlock, + _: BlockPos, + _: &CollisionContext<'_>, + ) -> io::Result { + unreachable!() + } +} +fn bounds() -> Aabb { + Aabb::new(Vec3::ZERO, Vec3::new(1.0, 1.0, 1.0)) +} + +#[test] +fn budgets_include_skipped_corners_and_errors_fuse_iteration() { + for budget in [0, 1] { + let mut world = FailedChunk { calls: 0 }; + let mut scan = BlockCollisionScan::new( + &mut world, + CollisionContext::empty(false), + bounds(), + false, + budget, + ) + .unwrap(); + assert!(matches!( + scan.next(), + Some(Err(CollisionScanError::VisitBudget)) + )); + assert!(scan.next().is_none()); + drop(scan); + assert_eq!(world.calls, 0); + } + let mut world = FailedChunk { calls: 0 }; + let mut scan = BlockCollisionScan::new( + &mut world, + CollisionContext::empty(false), + bounds(), + false, + 1000, + ) + .unwrap(); + assert!(matches!( + scan.next(), + Some(Err(CollisionScanError::World(_))) + )); + assert!(scan.next().is_none()); + drop(scan); + assert_eq!(world.calls, 1); +} + +#[test] +fn invalid_or_excessive_domains_fail_before_world_queries() { + let mut world = FailedChunk { calls: 0 }; + for coordinate in [f64::NAN, f64::INFINITY, f64::NEG_INFINITY] { + let bounds = Aabb::new(Vec3::ZERO, Vec3::new(coordinate, 1.0, 1.0)); + assert!(matches!( + BlockCollisionScan::new( + &mut world, + CollisionContext::empty(false), + bounds, + false, + 1000 + ), + Err(CollisionScanError::InvalidBounds) + )); + } + let bounds = Aabb::new(Vec3::ZERO, Vec3::new(100000.0, 100000.0, 100000.0)); + assert!(matches!( + BlockCollisionScan::new( + &mut world, + CollisionContext::empty(false), + bounds, + false, + 1000 + ), + Err(CollisionScanError::TooLarge) + )); + assert_eq!(world.calls, 0); +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index cd80c418d..8d662f88e 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -392,3 +392,24 @@ with **2,391,334 lines per JAR** in its [regression report](../benchmarks/rust-canonical-collision-2026-10-06/contextual-regression.json). Five import tests cover legacy data, equal-but-distinct grids, canonical restoration and malformed identity metadata. Workspace Clippy passes without warnings. + + +`BlockCollisionScan` now implements lazy cursor selection around entity bounds. +It retains the native epsilon-expanded cursor, X/Y/Z visit order, skipped corners, +large-shape face filtering, moving-piston edge filtering and suffocation-before- +shape query order. Only successful chunk lookups are reused; absent chunks are +queried again. Shape selection uses the global collision world, while suffocation +uses the selected chunk. Canonical full blocks use native AABB intersection; +other shapes use moved voxel intersection. Returned positions are independent +values. Providers supply current block metadata and contextual shape selection. + +`python3 tools/test_block_collision_scan_parity.py` compares **4,176 fixtures** +and **517,820 matching lines per JAR** in the +[collision-scan report](../benchmarks/rust-block-collision-scan-2026-10-06/scoped-parity.json). +The native iterator runs over controlled metadata, shapes and chunk availability; +traces cover early termination, missing chunks, query failures, thin/zero-width +bounds, integer-coordinate wrapping and equal shapes with different canonical +identities. Two Rust API tests cover finite/bounded input requirements, cursor +visit budgets and termination after errors. Unsupported cursor volumes return +errors; Java's overflowing iteration counts are outside this bounded API. +Registry/world integration and live movement still need implementation. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockCollisionScanOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockCollisionScanOracle.java new file mode 100644 index 000000000..6850b0e20 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockCollisionScanOracle.java @@ -0,0 +1,73 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*; +import java.lang.reflect.*; +import java.nio.file.*; +import net.minecraft.core.BlockPos; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.*; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.phys.*; +import net.minecraft.world.phys.shapes.*; +/** Runs native BlockCollisions with controlled block metadata and traced providers. */ +public final class VanillaBlockCollisionScanOracle { + static final class Stop extends RuntimeException {} + static final class Trace { + PrintWriter out;int calls,fail;CollisionGetter global; + void query(String value){out.println(value);if(calls++==fail)throw new Stop();} + } + public static class State extends BlockState { + int id;boolean large,moving,suffocating;VoxelShape shape;Trace trace;BlockGetter readFrom; + public State(){super(null,null,null);} + @Override public Block getBlock(){return moving?Blocks.MOVING_PISTON:Blocks.STONE;} + @Override public boolean hasLargeCollisionShape(){return large;} + @Override public boolean isSuffocating(BlockGetter world,BlockPos p){if(world!=readFrom||world==trace.global)throw new AssertionError("wrong suffocation world");trace.query("suffocating "+p.getX()+" "+p.getY()+" "+p.getZ()+" "+id);return suffocating;} + } + static VoxelShape shape(int index){return switch(index){ + case 0->Shapes.empty();case 1->Shapes.block();case 2->Shapes.block().move(0,0,0); + case 3->Shapes.box(0,0,0,1,0.5,1);case 4->Shapes.box(-0.25,-0.5,-0.25,1.25,1.5,1.25); + case 5->Shapes.box(0,0,0,1e-8,1,1); + case 6->Shapes.or(Shapes.box(0,0,0,0.25,1,0.25),Shapes.box(0.75,0,0.75,1,1,1)); + default->throw new AssertionError(index); + };} + static double number(JsonElement value){return Double.longBitsToDouble(Long.parseUnsignedLong(value.getAsString(),16));} + public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); + var allocator=Class.forName("sun.misc.Unsafe");var access=allocator.getDeclaredField("theUnsafe");access.setAccessible(true);var unsafe=access.get(null);var allocate=allocator.getMethod("allocateInstance",Class.class); + var emit=VanillaFaceSupportOracle.class.getDeclaredMethod("emit",PrintWriter.class,VoxelShape.class);emit.setAccessible(true); + Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){ + for(var line:(Iterable)lines::iterator){ + var f=JsonParser.parseString(line).getAsJsonObject();var trace=new Trace();trace.out=out;trace.fail=f.get("fail").getAsInt(); + var palette=f.getAsJsonArray("palette");var states=new State[palette.size()]; + for(int i=0;i[]{CollisionGetter.class},(proxy,method,values)->{ + if(!method.getName().equals("getChunkForCollisions"))throw new AssertionError(method); + int cx=(int)values[0],cz=(int)values[1];trace.query("chunk "+cx+" "+cz); + if(missing==1||missing==2&&((cx^cz)&1)!=0)return null; + return Proxy.newProxyInstance(BlockGetter.class.getClassLoader(),new Class[]{BlockGetter.class},(chunk,m,a)->{ + if(!m.getName().equals("getBlockState"))throw new AssertionError(m); + var p=(BlockPos)a[0];trace.query("block "+p.getX()+" "+p.getY()+" "+p.getZ()); + var state=states[((p.getX()*3+p.getY()*5+p.getZ()*7+seed)&Integer.MAX_VALUE)%states.length];state.readFrom=(BlockGetter)chunk;return state; + }); + });trace.global=world; + var context=new CollisionContext(){ + public boolean isDescending(){throw new AssertionError();} + public boolean isAbove(VoxelShape s,BlockPos p,boolean d){throw new AssertionError();} + public boolean isHoldingItem(Item i){throw new AssertionError();} + public boolean alwaysCollideWithFluid(){throw new AssertionError();} + public boolean canStandOnFluid(FluidState a,FluidState b){throw new AssertionError();} + public VoxelShape getCollisionShape(BlockState state,CollisionGetter collision,BlockPos p){if(collision!=world)throw new AssertionError("wrong collision world");var s=(State)state;trace.query("shape "+p.getX()+" "+p.getY()+" "+p.getZ()+" "+s.id);return s.shape;} + }; + var v=f.getAsJsonArray("box");var box=new AABB(number(v.get(0)),number(v.get(1)),number(v.get(2)),number(v.get(3)),number(v.get(4)),number(v.get(5))); + var scan=new BlockCollisions(world,context,box,f.get("suffocating").getAsBoolean(),(p,s)->{out.println("hit "+p.getX()+" "+p.getY()+" "+p.getZ());return s;}); + int hits=0,limit=f.get("limit").getAsInt(); + try{while(hitsd',float(v)).hex() for v in values] + boxes=[ + [0.2,0.2,0.2,0.8,0.8,0.8],[-0.3,0,0.3,0.3,1.8,0.9],[0,0,0,1,1,1], + [0.5,0.2,0.2,0.5,0.8,0.8],[0.5,0.2,0.2,0.5+1e-8,0.8,0.8], + [0.5,0.2,0.2,0.5+2e-7,0.8,0.8],[1-1e-8,0.2,0.2,1+1e-8,0.8,0.8], + [15.8,63.2,-0.3,16.2,64.8,0.3],[-16.2,-64.3,-16.2,-15.8,-62.5,-15.8], + [0.5,0.5,0.5,0.5,0.5,0.5],[1e-7,1e-7,1e-7,1-1e-7,1-1e-7,1-1e-7], + [2,2,2,-1,-1,-1],[-20.2,0.2,0.2,20.2,0.8,0.8], + [2147483647.2,0.2,0.2,2147483647.8,0.8,0.8], + [-2147483648.8,-0.5,-0.5,-2147483648.2,0.5,0.5], + [0.2,2147483647.2,0.2,0.8,2147483647.8,0.8], + [-0.0,-0.0,-0.0,1e-8,1e-8,1e-8],[-1e-8,-1e-8,-1e-8,0,0,0], + ] + palettes=[[shape,large,moving,suffocating] for shape in range(7) for large in [False,True] for moving in [False,True] for suffocating in [False,True]] + def row(bounds,palette,suffocating=False,missing=0,fail=-1,limit=100000,seed=0): + return {'box':box(bounds),'palette':palette,'suffocating':suffocating,'missing':missing,'fail':fail,'limit':limit,'seed':seed} + for entry in palettes: + for bounds in boxes: + for suffocating in [False,True]:yield row(bounds,[entry],suffocating) + for fail in [0,1,2,5,15,50]: + for suffocating in [False,True]:yield row(boxes[7],[entry],suffocating,fail=fail) + for missing in [1,2]: + for bounds in boxes: + for suffocating in [False,True]: + for limit in [0,1,4,100000]:yield row(bounds,palettes,suffocating,missing,limit=limit) + rng=random.Random(0x434f4c4c4953494f4e) + for index in range(1200): + low=[rng.choice([-16,-1,0,15,16])+rng.random() for _ in range(3)] + high=[v+rng.choice([0,1e-8,2e-7,0.25,0.6,1.8,2.5]) for v in low] + palette=rng.sample(palettes,rng.randrange(1,13)) + yield row([*low,*high],palette,bool(index%2),rng.randrange(3),rng.choice([-1,-1,-1,0,3,10,50]),rng.choice([0,1,3,100000]),rng.randrange(-2147483648,2147483648)) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-block-collision-scan-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockCollisionScanOracle.java' + helpers=[oracle.with_name('VanillaFaceSupportOracle.java')] + sources=[oracle,*helpers,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/block_collision_scan_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle,*helpers],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaBlockCollisionScanOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','block_collision_scan_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('block_collision_scan_fixture.exe' if os.name=='nt' else 'block_collision_scan_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} block-collision-scan output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual BlockCollisions cursor and selection algorithm over controlled block metadata, chunk providers and context shapes. Compares ordered chunk/state/suffocation/shape calls, missing-chunk retries, cached chunk reuse, face/edge/corner filtering, canonical full-block versus equal noncanonical shape behavior, exact emitted shape data, early consumer termination and injected provider failures. Finite bounded scans include thin/zero-size boxes, chunk crossings and wrapped integer positions. Registry-specific metadata/shape dispatch, live chunk loading and entity movement are separate integration work; unsupported cursor volumes and caller budgets use typed Rust errors.'} + lab.write_json(report_path,report);print(f'Scoped block collision scan parity passed: {report_path}') + + +if __name__=='__main__':main() From a5da90542f3aa36555051d2382c6a617799b25af Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 23:43:16 +0200 Subject: [PATCH 064/253] Match registry collision flags and suffocation predicates --- .../contextual-regression.json | 220 +++++++++++++++++ .../scoped-parity.json | 224 ++++++++++++++++++ .../examples/collision_context_fixture.rs | 7 +- .../examples/suffocation_fixture.rs | 144 +++++++++++ crates/horizon-world/src/block_collision.rs | 28 ++- crates/horizon-world/src/lib.rs | 1 + crates/horizon-world/src/suffocation.rs | 116 +++++++++ docs/collision-geometry.md | 21 ++ .../VanillaContextualCollisionAudit.java | 2 +- .../parity/VanillaSuffocationOracle.java | 68 ++++++ tools/test_suffocation_parity.py | 97 ++++++++ 11 files changed, 925 insertions(+), 3 deletions(-) create mode 100644 benchmarks/rust-suffocation-2026-10-06/contextual-regression.json create mode 100644 benchmarks/rust-suffocation-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-world/examples/suffocation_fixture.rs create mode 100644 crates/horizon-world/src/suffocation.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSuffocationOracle.java create mode 100644 tools/test_suffocation_parity.py diff --git a/benchmarks/rust-suffocation-2026-10-06/contextual-regression.json b/benchmarks/rust-suffocation-2026-10-06/contextual-regression.json new file mode 100644 index 000000000..53e27ae08 --- /dev/null +++ b/benchmarks/rust-suffocation-2026-10-06/contextual-regression.json @@ -0,0 +1,220 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 785906, + "block_states": 35723, + "independent_cached_states": 35492, + "context_sensitive_cached_states": 32, + "uncached_states": 199, + "audit_positions_per_cached_state": 7, + "audit_context_types": 2, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java": "bcc421fd7948ae7385e346e3de19c58222a2cad6b39122cac241cf70f9cc6071", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceSupportOracle.java": "9ce939a435842867786fed648951bbe77f6ab843f6df09af15f3deb1948c4877", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "f2b4f440a5bbce4224a4b3cee494b0f7ddcafbf72db12592c94ef9fb94fbc8a6", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaContextualCollisionAudit.java": "7546f37e4c818bd8574bd4f1359be0ea49e0fff3cd58b0b29b1e176f7f6bf6b6", + "tools/test_collision_context_parity.py": "75d6f01e072867d2bd286d2e518e123fcfe055a11ac1705ec99ecec3975cb8d2", + "tools/test_contextual_collision_parity.py": "6108a0d9e0c4e1592a336c35d096fb623eccff8ed136e31d8984c2365f66d6e9", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "2bfc6f358d3843984f70aff3a90b50fef979e866a1cad9cedfe139ef29946826", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "8dd7163be91058ac887064245f62c992caae4901a2502ab98797b1c8335d0e19", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/collision_context_fixture.rs": "2350eced6e6639490ee131d3da41416ea2e949d33583d15c2a601a8fd20ab98d" + }, + "fixtures_sha256": { + ".local/rust-contextual-collision-parity/inputs.txt": "394a00fda537f7af0840ed7dd6664581c04f4af9b383107db81df21ca9d0915f", + ".local/rust-contextual-collision-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-contextual-collision-parity/cached-collision.nbt": "4a274cd720a1bda585b02f50f16e90246576679e1e173c214548c5cbf607ab2d" + }, + "rust_output_sha256": "9b328cde8c73c2e54870991bf847c966093f067b41980e1e7daa1a26558e424d", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "9b328cde8c73c2e54870991bf847c966093f067b41980e1e7daa1a26558e424d", + "matched_output_lines": 2391334, + "audited_states": 35723, + "audit_sha256": "d50b5aa0729d1b4af7df1e1cc33c8c4f2fa927ad33f8e5ece994e58e9a90abe1" + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "9b328cde8c73c2e54870991bf847c966093f067b41980e1e7daa1a26558e424d", + "matched_output_lines": 2391334, + "audited_states": 35723, + "audit_sha256": "d50b5aa0729d1b4af7df1e1cc33c8c4f2fa927ad33f8e5ece994e58e9a90abe1" + } + ], + "scope": "Integrated contextual dispatcher across every pinned block state, eleven context variants and both always-fluid flag inputs. The native audit verifies 35,492 cached states return the identical cached shape without world/context queries at seven positions with interface and entity context providers that reject queries; liquid states query context instead. Integrated outputs compare cache-relative shape equality or full uncached geometry and ordered entity/world callbacks. Missing block entities are used here; active shulker/piston states retain separate coverage. Experimental minecart contexts, entity lifecycle and live movement remain pending." +} diff --git a/benchmarks/rust-suffocation-2026-10-06/scoped-parity.json b/benchmarks/rust-suffocation-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..a5aa8ad80 --- /dev/null +++ b/benchmarks/rust-suffocation-2026-10-06/scoped-parity.json @@ -0,0 +1,224 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "registry_states": 35723, + "block_definitions": 1286, + "definition_counts": { + "tagged_full": 1221, + "never": 42, + "closed_shulker": 17, + "always": 4, + "not_extended": 2 + }, + "tag_variants": 3, + "positions": 4, + "fixtures": 557877, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSuffocationOracle.java": "8dd870e65807bac4234085958830321061f0a3805dcf2b1219514107ba710503", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "f2b4f440a5bbce4224a4b3cee494b0f7ddcafbf72db12592c94ef9fb94fbc8a6", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "tools/test_suffocation_parity.py": "7c7fbcd79f932839b32f3cd8e8feb02e458dc16213e310ee901cda4422ef8e10", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-world/examples/suffocation_fixture.rs": "49471d8eb0e706b8fd0f283117bd723650cd9f1f9b68305785f4ef011573b798", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "2bfc6f358d3843984f70aff3a90b50fef979e866a1cad9cedfe139ef29946826", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "8dd7163be91058ac887064245f62c992caae4901a2502ab98797b1c8335d0e19", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f" + }, + "fixtures_sha256": { + ".local/rust-suffocation-parity/inputs.txt": "ea94ccd833782d435cd18ab63dbd0a03b81af1c6e4ea97b3a742ec760e822667", + ".local/rust-suffocation-parity/facts.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-suffocation-parity/definitions.json": "9cac3c650353104db1648050621057bfe104dec1f44b53d0b7875f7bc20e6eec", + ".local/rust-suffocation-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-suffocation-parity/cached-collision.nbt": "4a274cd720a1bda585b02f50f16e90246576679e1e173c214548c5cbf607ab2d", + ".local/rust-suffocation-parity/tags.json": "5e1301e5a9abf7e4de93af5dae3a157e852dbdb4ea345c2eb626305a605d4f98" + }, + "rust_output_sha256": "e45ba479197c25078e02f307eabb93a87ed6f28602e94d5a6cb1038580875212", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "e45ba479197c25078e02f307eabb93a87ed6f28602e94d5a6cb1038580875212", + "matched_output_lines": 1697193 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "e45ba479197c25078e02f307eabb93a87ed6f28602e94d5a6cb1038580875212", + "matched_output_lines": 1697193 + } + ], + "scope": "Actual BlockState.isSuffocating, hasLargeCollisionShape and moving-piston identity for every registered state, natural/empty/all-block causes_suffocation tags and four positions including integer extremes. Native predicate identity and constant overrides are independently classified. Rust computes cached fullness, dynamic collision fullness, piston extension and lazy shulker state queries. Every shulker state covers absent/wrong block entities, all animation states and injected query failures; all other states test provider short circuits. This does not establish live chunk/provider integration, entity movement, damage or full gameplay parity." +} diff --git a/crates/horizon-world/examples/collision_context_fixture.rs b/crates/horizon-world/examples/collision_context_fixture.rs index 32d9df7a6..e99673e11 100644 --- a/crates/horizon-world/examples/collision_context_fixture.rs +++ b/crates/horizon-world/examples/collision_context_fixture.rs @@ -291,7 +291,12 @@ fn main() -> Result<(), Box> { } else { "independent" }; - writeln!(audit, "audit {index} {label}")?; + let block = collisions.as_ref().unwrap().collision_block(id)?; + writeln!( + audit, + "audit {index} {label} {} {}", + block.large_collision_shape, block.moving_piston + )?; } } let fluids = FluidKind::ALL diff --git a/crates/horizon-world/examples/suffocation_fixture.rs b/crates/horizon-world/examples/suffocation_fixture.rs new file mode 100644 index 000000000..79a3ccfa0 --- /dev/null +++ b/crates/horizon-world/examples/suffocation_fixture.rs @@ -0,0 +1,144 @@ +use horizon_core::geometry::VoxelShape; +use horizon_world::{ + block_collision::{BlockCollisionRegistry, DynamicCollisionWorld, ShulkerCollisionState}, + collision::CachedCollisionRegistry, + dynamic_support::DynamicSupportWorld, + nbt::{self, Limits}, + registry::{BlockRegistry, BlockStateId}, + suffocation::{SuffocationDefinition, SuffocationRegistry}, + worldgen::tags::TagDefinitions, +}; +use serde_json::Value; +use std::{ + collections::{BTreeMap, BTreeSet}, + fs, + io::{self, Write}, + path::Path, + sync::Arc, +}; +struct World<'a, W> { + out: &'a mut W, + calls: i32, + fail: i32, + entity: &'a str, +} +impl World<'_, W> { + fn query(&mut self, p: [i32; 3]) -> io::Result<()> { + writeln!(self.out, "entity {} {} {}", p[0], p[1], p[2])?; + let count = self.calls; + self.calls += 1; + if count == self.fail { + Err(io::Error::other("injected suffocation query failure")) + } else { + Ok(()) + } + } +} +impl DynamicSupportWorld for World<'_, W> { + type Error = io::Error; + fn shulker_is_closed(&mut self, p: [i32; 3]) -> io::Result> { + self.query(p)?; + Ok(match self.entity { + "none" | "other" => None, + "closed" => Some(true), + _ => Some(false), + }) + } + fn moving_piston_shape(&mut self, p: [i32; 3]) -> io::Result> { + self.query(p)?; + Ok(None) + } +} +impl DynamicCollisionWorld for World<'_, W> { + fn shulker_collision_state( + &mut self, + p: [i32; 3], + ) -> io::Result> { + self.query(p)?; + Ok(None) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let read = |name| -> Result<_, Box> { + Ok( + nbt::read_named(&fs::read(dir.join(name))?, Limits::default())? + .0 + .tag, + ) + }; + let registry = BlockRegistry::from_nbt(&read("block-registry.nbt")?)?; + let cached = Arc::new(CachedCollisionRegistry::from_nbt( + &read("cached-collision.nbt")?, + ®istry, + )?); + let collisions = Arc::new(BlockCollisionRegistry::new(cached)?); + let definitions: BTreeMap = + serde_json::from_str(&fs::read_to_string(dir.join("definitions.json"))?)?; + let definitions = definitions + .into_iter() + .map(|(name, kind)| { + Ok(( + name, + match kind.as_str() { + "tagged_full" => SuffocationDefinition::TaggedFullCollision, + "always" => SuffocationDefinition::Always, + "never" => SuffocationDefinition::Never, + "not_extended" => SuffocationDefinition::NotExtendedPiston, + "closed_shulker" => SuffocationDefinition::ClosedShulker, + _ => return Err(io::Error::other("unknown suffocation rule")), + }, + )) + }) + .collect::>>()?; + let resources: BTreeMap = + serde_json::from_str(&fs::read_to_string(dir.join("tags.json"))?)?; + let mut tags = TagDefinitions::default(); + for (name, json) in resources { + tags.apply_json(&name, "vanilla", &json)?; + } + let built = tags.build(|name, _| registry.default_state(name).map(|_| name.to_owned()))?; + if !built.missing.is_empty() { + return Err("unresolved native block tags".into()); + } + let natural = built + .tags + .get("minecraft:causes_suffocation") + .ok_or("missing suffocation tag")? + .iter() + .cloned() + .collect::>(); + let all = (0..registry.len()) + .map(|i| registry.state(BlockStateId(i as u32)).unwrap().name.clone()) + .collect::>(); + let bindings = [ + SuffocationRegistry::new(collisions.clone(), &definitions, &natural)?, + SuffocationRegistry::new(collisions.clone(), &definitions, &BTreeSet::new())?, + SuffocationRegistry::new(collisions.clone(), &definitions, &all)?, + ]; + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let state = BlockStateId(f["state"].as_u64().unwrap() as u32); + let p = std::array::from_fn(|i| f["position"][i].as_i64().unwrap() as i32); + let block = collisions.collision_block(state)?; + writeln!( + out, + "metadata {} {} {}", + state.0, block.large_collision_shape, block.moving_piston + )?; + let mut world = World { + out: &mut out, + calls: 0, + fail: f["fail"].as_i64().unwrap() as i32, + entity: f["entity"].as_str().unwrap(), + }; + match bindings[f["tags"].as_u64().unwrap() as usize].is_suffocating(&mut world, state, p) { + Ok(v) => writeln!(world.out, "suffocating {v}")?, + Err(_) => writeln!(world.out, "suffocating error")?, + } + writeln!(world.out, "queries {}", world.calls)?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/block_collision.rs b/crates/horizon-world/src/block_collision.rs index c360654ae..73617de71 100644 --- a/crates/horizon-world/src/block_collision.rs +++ b/crates/horizon-world/src/block_collision.rs @@ -1,6 +1,7 @@ //! Cached/dynamic no-context collision queries and explicit contextual block rules. //! Context-sensitive families override the no-context cache explicitly. use crate::{ + block_collision_scan::CollisionBlock, collision::CachedCollisionRegistry, collision_context::CollisionContext, dynamic_support::{DynamicSupport, DynamicSupportError, DynamicSupportWorld}, @@ -8,7 +9,7 @@ use crate::{ powder_snow_collision::{PowderSnowWorld, powder_snow_collision_shape}, registry::{BlockRegistry, BlockStateId}, }; -use horizon_core::geometry::{Aabb, Direction, Vec3, VoxelShape}; +use horizon_core::geometry::{Aabb, Axis, Direction, Vec3, VoxelShape}; use std::{collections::HashMap, io, sync::Arc}; #[derive(Clone, Copy, Debug)] @@ -77,6 +78,7 @@ pub struct BlockCollisionRegistry<'r> { cached: Arc>, dynamic: HashMap, contextual: HashMap, + scan_flags: Vec, } enum ContextualRule { Scaffolding(ScaffoldingCollision), @@ -87,9 +89,17 @@ impl<'r> BlockCollisionRegistry<'r> { pub fn new(cached: Arc>) -> io::Result { let mut dynamic = HashMap::new(); let mut contextual = HashMap::new(); + let mut scan_flags = Vec::with_capacity(cached.registry().len()); for index in 0..cached.registry().len() { let id = BlockStateId(index as u32); let state = cached.registry().state(id).unwrap(); + let large = cached.cached_shape(id)?.is_none_or(|shape| { + Axis::ALL + .into_iter() + .any(|axis| shape.min(axis) < 0.0 || shape.max(axis) > 1.0) + }); + scan_flags + .push(u8::from(large) | (u8::from(state.name == "minecraft:moving_piston") << 1)); if let Some(rule) = ScaffoldingCollision::from_state(state)? { contextual.insert(id, ContextualRule::Scaffolding(rule)); } else if let Some(rule) = LiquidCollision::from_state(state)? { @@ -109,11 +119,27 @@ impl<'r> BlockCollisionRegistry<'r> { cached, dynamic, contextual, + scan_flags, }) } pub fn registry(&self) -> &'r BlockRegistry { self.cached.registry() } + pub fn cached_shapes(&self) -> &CachedCollisionRegistry<'r> { + &self.cached + } + /// Immutable cursor-filter metadata, prepared once for this registry. + pub fn collision_block(&self, state: BlockStateId) -> io::Result { + let flags = *self + .scan_flags + .get(state.0 as usize) + .ok_or_else(|| crate::compression::invalid("collision scan state outside registry"))?; + Ok(CollisionBlock { + state, + large_collision_shape: flags & 1 != 0, + moving_piston: flags & 2 != 0, + }) + } pub fn collision_shape( &self, world: &mut W, diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index ddb1b473c..66d2a0811 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -25,6 +25,7 @@ pub mod powder_snow_collision; pub mod region; pub mod registry; pub mod retrogen; +pub mod suffocation; pub mod tick_data; pub mod worldgen; diff --git a/crates/horizon-world/src/suffocation.rs b/crates/horizon-world/src/suffocation.rs new file mode 100644 index 000000000..a17d9eea8 --- /dev/null +++ b/crates/horizon-world/src/suffocation.rs @@ -0,0 +1,116 @@ +//! Native suffocation predicates bound to a registry and a resolved block-tag set. +use crate::{ + block_collision::{BlockCollisionRegistry, CollisionQueryError, DynamicCollisionWorld}, + compression::invalid, + registry::BlockStateId, +}; +use horizon_core::geometry::{ShapeOp, VoxelShape}; +use std::{ + collections::{BTreeMap, BTreeSet, HashMap}, + io, + sync::Arc, +}; + +#[derive(Clone, Copy, Debug)] +pub enum SuffocationDefinition { + TaggedFullCollision, + Always, + Never, + NotExtendedPiston, + ClosedShulker, +} +#[derive(Clone, Copy, Debug)] +enum Rule { + Constant(bool), + DynamicFull, + Shulker, +} + +pub struct SuffocationRegistry<'r> { + collisions: Arc>, + rules: Vec, +} +impl<'r> SuffocationRegistry<'r> { + /// Rebind after the causes_suffocation tag changes. Definition keys and tag + /// members are canonical block identifiers from the same pinned registry. + pub fn new( + collisions: Arc>, + definitions: &BTreeMap, + causes_suffocation: &BTreeSet, + ) -> io::Result { + let registry = collisions.registry(); + if definitions + .keys() + .chain(causes_suffocation) + .any(|name| registry.default_state(name).is_none()) + { + return Err(invalid("unknown suffocation definition or tag member")); + } + let mut full_shapes = HashMap::new(); + let mut rules = Vec::with_capacity(registry.len()); + for index in 0..registry.len() { + let id = BlockStateId(index as u32); + let state = registry.state(id).unwrap(); + let definition = definitions + .get(&state.name) + .ok_or_else(|| invalid("missing suffocation definition"))?; + let rule = match definition { + SuffocationDefinition::Always => Rule::Constant(true), + SuffocationDefinition::Never => Rule::Constant(false), + SuffocationDefinition::NotExtendedPiston => { + Rule::Constant(match state.properties.get("extended").map(String::as_str) { + Some("false") => true, + Some("true") => false, + _ => return Err(invalid("invalid piston suffocation property")), + }) + } + SuffocationDefinition::ClosedShulker => Rule::Shulker, + SuffocationDefinition::TaggedFullCollision => { + if !causes_suffocation.contains(&state.name) { + Rule::Constant(false) + } else if let Some(shape) = collisions.cached_shapes().cached_shape(id)? { + let identity = std::ptr::from_ref(shape); + let full = if let Some(full) = full_shapes.get(&identity) { + *full + } else { + let full = !shape + .join_is_not_empty(&VoxelShape::block(), ShapeOp::XOR) + .map_err(|e| invalid(e.to_string()))?; + full_shapes.insert(identity, full); + full + }; + Rule::Constant(full) + } else { + Rule::DynamicFull + } + } + }; + rules.push(rule); + } + Ok(Self { collisions, rules }) + } + + pub fn is_suffocating( + &self, + world: &mut W, + state: BlockStateId, + position: [i32; 3], + ) -> Result> { + let rule = self.rules.get(state.0 as usize).ok_or_else(|| { + CollisionQueryError::Data(invalid("suffocation state outside registry")) + })?; + match rule { + Rule::Constant(value) => Ok(*value), + Rule::Shulker => world + .shulker_is_closed(position) + .map(|closed| closed != Some(false)) + .map_err(CollisionQueryError::Context), + Rule::DynamicFull => self + .collisions + .collision_shape(world, state, position)? + .join_is_not_empty(&VoxelShape::block(), ShapeOp::XOR) + .map(|different| !different) + .map_err(|error| CollisionQueryError::Data(invalid(error.to_string()))), + } + } +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 8d662f88e..28b20079b 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -413,3 +413,24 @@ identities. Two Rust API tests cover finite/bounded input requirements, cursor visit budgets and termination after errors. Unsupported cursor volumes return errors; Java's overflowing iteration counts are outside this bounded API. Registry/world integration and live movement still need implementation. + + +`BlockCollisionRegistry` now prepares native cursor-filter flags for every state: +uncached shapes are large, while cached shapes are large when any axis extends +outside the unit block. Moving-piston identity is bound to the same registry. +`SuffocationRegistry` binds the native predicate definitions and resolved +`causes_suffocation` tag. Default predicates combine tag membership with full +collision geometry; overrides preserve piston extension, constant predicates and +lazy shulker block-entity checks. Missing or wrong-type shulker block entities +count as suffocating. Tag changes require rebinding the suffocation registry. + +`python3 tools/test_suffocation_parity.py` checks all **35,723 states** with natural, +empty and all-block tag bindings at four positions, including integer extremes. +Every shulker state also covers absent/wrong block entities, all animation states +and query failures. The [suffocation report](../benchmarks/rust-suffocation-2026-10-06/scoped-parity.json) +records **1,697,193 matching lines per JAR**, including scan flags and query traces. +These are registry predicates; live collision-world binding, movement and +suffocation damage remain separate integration work. +The [contextual regression](../benchmarks/rust-suffocation-2026-10-06/contextual-regression.json) +also passes again with **2,391,334 lines per JAR**, and its all-state native audit +now compares large-shape and moving-piston flags. Workspace Clippy passes. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaContextualCollisionAudit.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaContextualCollisionAudit.java index f58dbcde0..8a71a9b76 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaContextualCollisionAudit.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaContextualCollisionAudit.java @@ -56,7 +56,7 @@ public final class VanillaContextualCollisionAudit { } label=expected;if(label.equals("independent"))independent++;else contextual++; } - out.println("audit "+Block.getId(state)+" "+label); + out.println("audit "+Block.getId(state)+" "+label+" "+state.hasLargeCollisionShape()+" "+state.is(Blocks.MOVING_PISTON)); } } if(independent!=35492||contextual!=32||uncached!=199)throw new AssertionError("registry classification changed"); diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSuffocationOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSuffocationOracle.java new file mode 100644 index 000000000..550500319 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSuffocationOracle.java @@ -0,0 +1,68 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*; +import java.lang.reflect.*; +import java.nio.file.*; +import java.util.*; +import net.minecraft.core.*; +import net.minecraft.core.registries.*; +import net.minecraft.tags.*; +import net.minecraft.world.level.*; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.entity.*; +import net.minecraft.world.level.block.piston.PistonMovingBlockEntity; +import net.minecraft.world.level.block.state.*; +/** Native suffocation predicates, tag rebinding, cursor flags and traced block entities. */ +public final class VanillaSuffocationOracle { + static final class Stop extends RuntimeException {} + static Object field(Class type,String name,Object instance)throws Exception{var f=type.getDeclaredField(name);f.setAccessible(true);return f.get(instance);} + static void definitions(Path dir)throws Exception { + var defaults=field(BlockBehaviour.Properties.class,"isSuffocating",BlockBehaviour.Properties.of()); + var piston=field(Blocks.class,"NOT_EXTENDED_PISTON",null);var shulker=field(Blocks.class,"NOT_CLOSED_SHULKER",null); + var predicate=BlockBehaviour.BlockStateBase.class.getDeclaredField("isSuffocating");predicate.setAccessible(true); + var rejecting=(BlockGetter)Proxy.newProxyInstance(BlockGetter.class.getClassLoader(),new Class[]{BlockGetter.class},(p,m,v)->{throw new AssertionError("unexpected constant predicate query: "+m);}); + var result=new TreeMap(); + for(var state:Block.BLOCK_STATE_REGISTRY){ + var selected=predicate.get(state);String rule; + if(selected==defaults)rule="tagged_full";else if(selected==piston)rule="not_extended";else if(selected==shulker)rule="closed_shulker"; + else { + Boolean constant=null; + for(var p:new BlockPos[]{BlockPos.ZERO,new BlockPos(17,-64,-33),new BlockPos(Integer.MIN_VALUE,Integer.MAX_VALUE,-1)}){ + boolean value=state.isSuffocating(rejecting,p);if(constant!=null&&value!=constant)throw new AssertionError("position-dependent suffocation override");constant=value; + } + rule=constant?"always":"never"; + } + String name=BuiltInRegistries.BLOCK.getKey(state.getBlock()).toString();var previous=result.put(name,rule);if(previous!=null&&!previous.equals(rule))throw new AssertionError("unclassified state-dependent predicate: "+name); + } + Files.writeString(dir.resolve("definitions.json"),new Gson().toJson(result)); + } + public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();Path dir=Path.of(args[1]); + VanillaHeightmapOracle.bindTags(JsonParser.parseString(Files.readString(dir.resolve("tags.json"))).getAsJsonObject()); + if(args[0].equals("export")){ + VanillaCollisionOracle.main(new String[]{"generate",args[1]});VanillaBlockStateCodecOracle.main(new String[]{"export",dir.resolve("facts.json").toString()});definitions(dir);return; + } + var registry=BuiltInRegistries.BLOCK;var natural=new ArrayList>();var all=new ArrayList>(); + for(var block:registry){var holder=block.builtInRegistryHolder();all.add(holder);if(block.defaultBlockState().is(BlockTags.CAUSES_SUFFOCATION))natural.add(holder);} + var allocator=Class.forName("sun.misc.Unsafe");var access=allocator.getDeclaredField("theUnsafe");access.setAccessible(true);var unsafe=access.get(null);var allocate=allocator.getMethod("allocateInstance",Class.class); + var animation=ShulkerBoxBlockEntity.class.getDeclaredField("animationStatus");animation.setAccessible(true);int activeTag=-1; + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){ + for(var line:(Iterable)lines::iterator){ + var f=JsonParser.parseString(line).getAsJsonObject();int tag=f.get("tags").getAsInt(); + if(activeTag!=tag){List> members=tag==0?natural:tag==1?List.of():all;registry.prepareTagReload(new TagLoader.LoadResult<>(Registries.BLOCK,Map.of(BlockTags.CAUSES_SUFFOCATION,members))).apply();activeTag=tag;} + var state=Block.stateById(f.get("state").getAsInt());var xyz=f.getAsJsonArray("position");var p=new BlockPos(xyz.get(0).getAsInt(),xyz.get(1).getAsInt(),xyz.get(2).getAsInt());String mode=f.get("entity").getAsString();Object entity=null; + if(mode.equals("other"))entity=allocate.invoke(unsafe,PistonMovingBlockEntity.class); + else if(!mode.equals("none")){ + entity=allocate.invoke(unsafe,ShulkerBoxBlockEntity.class);Object status=null;for(var value:animation.getType().getEnumConstants())if(((Enum)value).name().equals(mode.toUpperCase(Locale.ROOT)))status=value;if(status==null)throw new AssertionError(mode);animation.set(entity,status); + } + Object selected=entity;int[] calls={0}; + var world=(BlockGetter)Proxy.newProxyInstance(BlockGetter.class.getClassLoader(),new Class[]{BlockGetter.class},(proxy,method,values)->{ + if(!method.getName().equals("getBlockEntity"))throw new AssertionError(method);var at=(BlockPos)values[0];out.println("entity "+at.getX()+" "+at.getY()+" "+at.getZ());if(calls[0]++==f.get("fail").getAsInt())throw new Stop();return selected; + }); + out.println("metadata "+Block.getId(state)+" "+state.hasLargeCollisionShape()+" "+state.is(Blocks.MOVING_PISTON)); + try{out.println("suffocating "+state.isSuffocating(world,p));}catch(Stop error){out.println("suffocating error");} + out.println("queries "+calls[0]); + } + } + } +} diff --git a/tools/test_suffocation_parity.py b/tools/test_suffocation_parity.py new file mode 100644 index 000000000..bd118ee34 --- /dev/null +++ b/tools/test_suffocation_parity.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python3 +"""Compare registry collision flags and suffocation predicates with pinned vanilla.""" +import collections +import json +import os +from pathlib import Path +import platform +import subprocess +try: + from . import lab, test_rust_parity as base, test_worldgen_parity as worldgen +except ImportError: + import lab + import test_rust_parity as base + import test_worldgen_parity as worldgen + + +def corpus(facts): + positions = [[0, 0, 0], [17, -64, -33], + [2147483647, -2147483648, -2147483648], + [-2147483648, 2147483647, 2147483647]] + # Keep each tag binding contiguous to avoid testing registry reload costs. + for tags in range(3): + for state, value in enumerate(facts['states']): + for position in positions: + yield dict(state=state, position=position, entity='none', fail=-1, tags=tags) + # Predicate short circuits must suppress failure-producing providers. + yield dict(state=state, position=positions[1], entity='none', fail=0, tags=tags) + if value['id'].endswith('shulker_box'): + for position in positions: + for entity in ['none', 'other', 'closed', 'opening', 'opened', 'closing']: + for fail in [-1, 0, 1]: + yield dict(state=state, position=position, entity=entity, fail=fail, tags=tags) + + +def main(): + lock, jars, libraries = base.verify_artifacts() + build = lab.LOCAL/'rust-suffocation-parity';build.mkdir(exist_ok=True) + report_path = build/'report.json';report_path.unlink(missing_ok=True) + oracle = lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSuffocationOracle.java' + helpers = [oracle.with_name(name+'.java') for name in + ['VanillaHeightmapOracle', 'VanillaCollisionOracle', 'VanillaBlockStateCodecOracle']] + sources = [oracle, *helpers, Path(__file__), lab.ROOT/'tools/test_rust_parity.py', + lab.ROOT/'tools/test_worldgen_parity.py', lab.ROOT/'tools/lab.py', + lab.ROOT/'Cargo.toml', lab.ROOT/'Cargo.lock', + lab.ROOT/'crates/horizon-world/examples/suffocation_fixture.rs'] + for crate in ['horizon-core', 'horizon-world']: + sources += [lab.ROOT/'crates'/crate/'Cargo.toml', + *sorted((lab.ROOT/'crates'/crate/'src').rglob('*.rs'))] + tested = base.source_hashes(sources) + tags = worldgen.tag_resources(jars['server']) + if tags != worldgen.tag_resources(jars['client']):raise AssertionError('Client/server block tags differ') + lab.write_json(build/'tags.json', tags) + classes = build/'classes';classes.mkdir(exist_ok=True) + dependencies = os.pathsep.join(map(str, libraries)) + def run(command, name): + with (build/(name+'.log')).open('w') as log: + subprocess.run(list(map(str, command)), cwd=lab.ROOT, check=True, timeout=3600, + stdout=log, stderr=subprocess.STDOUT) + run(['javac', '--release', lock['minecraft']['java_major'], '-proc:none', '-cp', + str(jars['server'])+os.pathsep+dependencies, '-d', classes, oracle, *helpers], 'compile-java') + def java(side, mode): + run(['java', '-Xmx768M', '-cp', os.pathsep.join([str(classes), str(jars[side]), dependencies]), + 'dev.horizonlab.parity.VanillaSuffocationOracle', mode, build], side+'-'+mode) + java('server', 'export') + facts = json.loads((build/'facts.json').read_text()) + if len(facts['states']) != 35723:raise AssertionError('Incomplete pinned registry') + definitions = json.loads((build/'definitions.json').read_text()) + count = 0 + with (build/'inputs.txt').open('w') as output: + for fixture in corpus(facts): + output.write(json.dumps(fixture, separators=(',', ':'))+'\n');count += 1 + fixture_paths = [build/name for name in ['inputs.txt', 'facts.json', 'definitions.json', + 'block-registry.nbt', 'cached-collision.nbt', 'tags.json']] + fixtures = base.source_hashes(fixture_paths) + run(['cargo', 'build', '--locked', '--release', '-p', 'horizon-world', '--example', 'suffocation_fixture'], 'compile-rust') + metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--locked', '--no-deps', '--format-version', '1'], cwd=lab.ROOT)) + binary = Path(metadata['target_directory'])/'release/examples'/('suffocation_fixture.exe' if os.name=='nt' else 'suffocation_fixture') + run([binary, build], 'rust');references = [] + for side, jar in jars.items(): + java(side, side) + matched = base.compare(build/(side+'.txt'), build/'rust.txt') + references.append({'side':side, 'jar_sha256':lab.digest(jar, 'sha256'), + 'output_sha256':lab.digest(build/(side+'.txt'), 'sha256'), 'matched_output_lines':matched}) + print(f'{side}: {matched:,} suffocation and collision-metadata lines match', flush=True) + base.ensure_sources_unchanged(sources, tested);base.ensure_sources_unchanged(fixture_paths, fixtures) + report = {'schema':1, 'minecraft':lock['minecraft']['version'], 'manifest_sha1':lock['minecraft']['manifest_sha1'], + 'platform':platform.platform(), 'java':subprocess.check_output(['java', '--version'], text=True).splitlines()[0], + 'rustc':subprocess.check_output(['rustc', '--version'], text=True).strip(), + 'registry_states':len(facts['states']), 'block_definitions':len(definitions), + 'definition_counts':dict(collections.Counter(definitions.values())), + 'tag_variants':3, 'positions':4, 'fixtures':count, 'sources_sha256':tested, 'fixtures_sha256':fixtures, + 'rust_output_sha256':lab.digest(build/'rust.txt', 'sha256'), 'references':references, + 'scope':'Actual BlockState.isSuffocating, hasLargeCollisionShape and moving-piston identity for every registered state, natural/empty/all-block causes_suffocation tags and four positions including integer extremes. Native predicate identity and constant overrides are independently classified. Rust computes cached fullness, dynamic collision fullness, piston extension and lazy shulker state queries. Every shulker state covers absent/wrong block entities, all animation states and injected query failures; all other states test provider short circuits. This does not establish live chunk/provider integration, entity movement, damage or full gameplay parity.'} + lab.write_json(report_path, report);print(f'Scoped suffocation parity passed: {report_path}', flush=True) + + +if __name__ == '__main__':main() From a2df9158cab23abad5ae57f21162c5c07ebd4310 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 6 Oct 2026 23:53:34 +0200 Subject: [PATCH 065/253] Bind collision scans to registry behavior and resident chunk providers --- .../scoped-parity.json | 227 ++++++++++ .../registry_collision_scan_fixture.rs | 408 ++++++++++++++++++ crates/horizon-world/src/lib.rs | 1 + .../src/registry_collision_scan.rs | 102 +++++ crates/horizon-world/src/suffocation.rs | 4 + crates/horizon-world/tests/collision_data.rs | 34 ++ docs/collision-geometry.md | 19 + .../VanillaRegistryCollisionScanOracle.java | 67 +++ tools/test_registry_collision_scan_parity.py | 121 ++++++ 9 files changed, 983 insertions(+) create mode 100644 benchmarks/rust-resident-collision-scan-2026-10-06/scoped-parity.json create mode 100644 crates/horizon-world/examples/registry_collision_scan_fixture.rs create mode 100644 crates/horizon-world/src/registry_collision_scan.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryCollisionScanOracle.java create mode 100644 tools/test_registry_collision_scan_parity.py diff --git a/benchmarks/rust-resident-collision-scan-2026-10-06/scoped-parity.json b/benchmarks/rust-resident-collision-scan-2026-10-06/scoped-parity.json new file mode 100644 index 000000000..99c2af3eb --- /dev/null +++ b/benchmarks/rust-resident-collision-scan-2026-10-06/scoped-parity.json @@ -0,0 +1,227 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "registry_states": 35723, + "block_definitions": 1286, + "definition_counts": { + "tagged_full": 1221, + "never": 42, + "closed_shulker": 17, + "always": 4, + "not_extended": 2 + }, + "native_chunk_storage": "ProtoChunk", + "rust_chunk_storage": "TerrainChunk", + "fixtures": 91254, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryCollisionScanOracle.java": "d6f6016cf0e2ab378303dc09496dc94aefd3b74e30384e585c05f5c03bddfe17", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "f2b4f440a5bbce4224a4b3cee494b0f7ddcafbf72db12592c94ef9fb94fbc8a6", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSuffocationOracle.java": "8dd870e65807bac4234085958830321061f0a3805dcf2b1219514107ba710503", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceSupportOracle.java": "9ce939a435842867786fed648951bbe77f6ab843f6df09af15f3deb1948c4877", + "tools/test_registry_collision_scan_parity.py": "50983b0502efac97a619eec2732cd2a3ba25e53a0bfc469c924108a95e30a93b", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-world/examples/registry_collision_scan_fixture.rs": "b8d5b9693d8ffd9e2ce8d0065d931113c4da3df6c10d4cff4c281e85c923fb15", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "dc92f73885dd0a7760743bf74f1ab8afa839d61cef2dfef890f8a23b67b4742e", + "crates/horizon-core/src/geometry/movement.rs": "930e34abef6f6eeec1ee7a6c920b5ba01bfe37b90678884490f4be53241f6b96", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "2c95e78b7dba5128b831bc16a7eb75317148f21bd135c757b883c149d6349f16", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "c5026e43c735599d9e761510cba690db3546570092f3446e6a250f6a65db629a", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f" + }, + "fixtures_sha256": { + ".local/rust-registry-collision-scan-parity/inputs.txt": "ce49ec76735a25422fda271743a1651961242092f14b1e92ee3c6e5d6af6a410", + ".local/rust-registry-collision-scan-parity/facts.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-registry-collision-scan-parity/definitions.json": "9cac3c650353104db1648050621057bfe104dec1f44b53d0b7875f7bc20e6eec", + ".local/rust-registry-collision-scan-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-registry-collision-scan-parity/cached-collision.nbt": "4a274cd720a1bda585b02f50f16e90246576679e1e173c214548c5cbf607ab2d", + ".local/rust-registry-collision-scan-parity/tags.json": "5e1301e5a9abf7e4de93af5dae3a157e852dbdb4ea345c2eb626305a605d4f98" + }, + "rust_output_sha256": "380675ae1ae8e6b159782b9db2bc1e1900e531a6a1ef6e882e742b1e85552d39", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "380675ae1ae8e6b159782b9db2bc1e1900e531a6a1ef6e882e742b1e85552d39", + "matched_output_lines": 3046929 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "380675ae1ae8e6b159782b9db2bc1e1900e531a6a1ef6e882e742b1e85552d39", + "matched_output_lines": 3046929 + } + ], + "scope": "Native BlockCollisions over actual registered block behavior and resident ProtoChunk sections compared with RegistryCollisionWorld, contextual dispatch and TerrainChunk storage. All states cover ordinary and suffocating-only selection. Context variants include empty, always-fluid, position and placement; dynamic and representative partial shapes cover positive/negative chunk boundaries. Shulker cases distinguish chunk-local suffocation entities from global collision entities, with ordered failure injection. Seeded scenes cover resident/missing chunks, build-height edges, block replacements and early consumer termination. This validates registry/storage integration for these snapshots, not chunk loading, entity lifecycle, experimental minecarts or gameplay movement." +} diff --git a/crates/horizon-world/examples/registry_collision_scan_fixture.rs b/crates/horizon-world/examples/registry_collision_scan_fixture.rs new file mode 100644 index 000000000..fae91f595 --- /dev/null +++ b/crates/horizon-world/examples/registry_collision_scan_fixture.rs @@ -0,0 +1,408 @@ +//! Integrated registry/cursor differential transport using resident TerrainChunk storage. +use horizon_core::{ + geometry::{Aabb, Axis, Vec3, VoxelShape}, + position::{BlockPos, ChunkPos}, +}; +use horizon_world::{ + block_collision::{BlockCollisionRegistry, DynamicCollisionWorld, ShulkerCollisionState}, + block_collision_scan::BlockCollisionScan, + collision::CachedCollisionRegistry, + collision_context::CollisionContext, + dynamic_support::DynamicSupportWorld, + entity_obstruction::EntityIdentity, + fluid::FluidState, + heightmap::HeightmapState, + liquid_collision::LiquidCollisionWorld, + nbt::{self, Limits}, + powder_snow_collision::{PowderSnowEntity, PowderSnowWorld}, + registry::{BlockRegistry, BlockStateId}, + registry_collision_scan::{CollisionChunks, RegistryCollisionWorld}, + suffocation::{SuffocationDefinition, SuffocationRegistry}, + worldgen::{ + tags::TagDefinitions, + terrain::{TerrainBlockStates, TerrainChunk}, + }, +}; +use serde_json::Value; +use std::{ + cell::RefCell, + collections::{BTreeMap, BTreeSet}, + fs, + io::{self, Write}, + path::Path, + rc::Rc, + sync::Arc, +}; +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn values( + out: &mut impl Write, + label: &str, + values: impl IntoIterator, +) -> io::Result<()> { + write!(out, "{label}")?; + for v in values { + let bits = if v.is_nan() { + 0x7ff8_0000_0000_0000 + } else { + v.to_bits() + }; + write!(out, " {bits:016x}")?; + } + writeln!(out) +} +fn box_values(out: &mut impl Write, label: &str, b: Aabb) -> io::Result<()> { + values( + out, + label, + [ + b.min(Axis::X), + b.min(Axis::Y), + b.min(Axis::Z), + b.max(Axis::X), + b.max(Axis::Y), + b.max(Axis::Z), + ], + ) +} +fn emit(out: &mut impl Write, shape: &VoxelShape) -> io::Result<()> { + writeln!( + out, + "shape {} {} {}", + shape.is_empty(), + shape.boxes().len(), + shape.is_cube() + )?; + for (axis, name) in Axis::ALL.into_iter().zip(["x", "y", "z"]) { + values(out, name, shape.coordinates(axis).iter().copied())?; + } + let axes = shape.cube_coordinate_axes(); + writeln!( + out, + "axes {}", + u8::from(axes[0]) + 2 * u8::from(axes[1]) + 4 * u8::from(axes[2]) + )?; + values( + out, + "extrema", + Axis::ALL + .map(|a| shape.min(a)) + .into_iter() + .chain(Axis::ALL.map(|a| shape.max(a))), + )?; + match shape.bounds() { + Some(b) => box_values(out, "bounds", b)?, + None => writeln!(out, "bounds none")?, + } + for b in shape.boxes() { + box_values(out, "box", *b)?; + } + Ok(()) +} +struct Trace { + out: io::BufWriter, + calls: i32, + fail: i32, +} +impl Trace { + fn query(&mut self, text: String) -> io::Result<()> { + writeln!(self.out, "{text}")?; + let call = self.calls; + self.calls += 1; + if call == self.fail { + Err(io::Error::other("injected resident world failure")) + } else { + Ok(()) + } + } +} +type SharedTrace = Rc>; +struct Entities { + mode: u64, + scope: &'static str, + trace: SharedTrace, +} +impl Entities { + fn query(&mut self, p: [i32; 3]) -> io::Result<()> { + self.trace + .borrow_mut() + .query(format!("entity {} {} {} {}", self.scope, p[0], p[1], p[2])) + } +} +impl DynamicSupportWorld for Entities { + type Error = io::Error; + fn shulker_is_closed(&mut self, p: [i32; 3]) -> io::Result> { + self.query(p)?; + Ok(if self.mode == 0 { + None + } else { + Some(self.mode == 1) + }) + } + fn moving_piston_shape(&mut self, p: [i32; 3]) -> io::Result> { + self.query(p)?; + Ok(None) + } +} +impl DynamicCollisionWorld for Entities { + fn shulker_collision_state( + &mut self, + p: [i32; 3], + ) -> io::Result> { + self.query(p)?; + let progress = if self.mode == 1 { 0.0 } else { 0.5 }; + Ok((self.mode != 0).then_some(ShulkerCollisionState { + previous_progress: progress, + progress, + })) + } +} +#[derive(Clone, Copy)] +struct Air(bool); +impl HeightmapState for Air { + fn is_air(self) -> bool { + self.0 + } + fn is_air_block(self) -> bool { + self.0 + } + fn has_fluid(self) -> bool { + false + } + fn blocks_motion_in_heightmap(self) -> bool { + false + } + fn blocks_motion_in_heightmap_no_leaves(self) -> bool { + false + } +} +#[derive(Clone)] +struct Properties(Arc>); +impl TerrainBlockStates for Properties { + type State = Air; + fn heightmap_state(&self, id: BlockStateId) -> Air { + Air(self.0[id.0 as usize]) + } +} +struct World<'r> { + chunks: BTreeMap<(i32, i32), (TerrainChunk<'r, Properties>, Entities)>, + global: Entities, + trace: SharedTrace, +} +impl DynamicSupportWorld for World<'_> { + type Error = io::Error; + fn shulker_is_closed(&mut self, p: [i32; 3]) -> io::Result> { + self.global.shulker_is_closed(p) + } + fn moving_piston_shape(&mut self, p: [i32; 3]) -> io::Result> { + self.global.moving_piston_shape(p) + } +} +impl DynamicCollisionWorld for World<'_> { + fn shulker_collision_state( + &mut self, + p: [i32; 3], + ) -> io::Result> { + self.global.shulker_collision_state(p) + } +} +impl LiquidCollisionWorld for World<'_> { + type Error = io::Error; + fn entity_liquid_shape(&mut self, _: EntityIdentity) -> io::Result { + panic!("unexpected entity query") + } + fn fluid(&mut self, _: BlockPos) -> io::Result { + panic!("unexpected fluid query") + } + fn entity_can_stand(&mut self, _: EntityIdentity, _: FluidState) -> io::Result { + panic!("unexpected entity query") + } +} +impl PowderSnowWorld for World<'_> { + type Error = io::Error; + fn powder_snow_entity(&mut self, _: EntityIdentity) -> io::Result { + panic!("unexpected entity query") + } + fn powder_snow_walkable_tag(&mut self, _: EntityIdentity) -> io::Result { + panic!("unexpected entity query") + } + fn feet_are_leather_boots(&mut self, _: EntityIdentity) -> io::Result { + panic!("unexpected entity query") + } +} +impl CollisionChunks for World<'_> { + type Chunk = ChunkPos; + type ChunkWorld = Entities; + fn collision_chunk(&mut self, p: ChunkPos) -> io::Result> { + self.trace + .borrow_mut() + .query(format!("chunk {} {}", p.x, p.z))?; + Ok(self.chunks.contains_key(&(p.x, p.z)).then_some(p)) + } + fn block_state(&mut self, chunk: ChunkPos, p: BlockPos) -> io::Result { + assert_eq!(chunk, p.chunk()); + self.trace + .borrow_mut() + .query(format!("block {} {} {}", p.x, p.y, p.z))?; + Ok(self.chunks[&(chunk.x, chunk.z)].0.block(p.x, p.y, p.z)) + } + fn chunk_world(&mut self, p: ChunkPos) -> &mut Entities { + &mut self.chunks.get_mut(&(p.x, p.z)).unwrap().1 + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let read = |name| -> Result<_, Box> { + Ok( + nbt::read_named(&fs::read(dir.join(name))?, Limits::default())? + .0 + .tag, + ) + }; + let registry = BlockRegistry::from_nbt(&read("block-registry.nbt")?)?; + let cached = Arc::new(CachedCollisionRegistry::from_nbt( + &read("cached-collision.nbt")?, + ®istry, + )?); + let collisions = Arc::new(BlockCollisionRegistry::new(cached)?); + let definitions: BTreeMap = + serde_json::from_str(&fs::read_to_string(dir.join("definitions.json"))?)?; + let definitions = definitions + .into_iter() + .map(|(name, kind)| { + Ok(( + name, + match kind.as_str() { + "tagged_full" => SuffocationDefinition::TaggedFullCollision, + "always" => SuffocationDefinition::Always, + "never" => SuffocationDefinition::Never, + "not_extended" => SuffocationDefinition::NotExtendedPiston, + "closed_shulker" => SuffocationDefinition::ClosedShulker, + _ => return Err(io::Error::other("unknown suffocation rule")), + }, + )) + }) + .collect::>>()?; + let resources: BTreeMap = + serde_json::from_str(&fs::read_to_string(dir.join("tags.json"))?)?; + let mut tags = TagDefinitions::default(); + for (name, json) in resources { + tags.apply_json(&name, "vanilla", &json)?; + } + let built = tags.build(|name, _| registry.default_state(name).map(|_| name.to_owned()))?; + if !built.missing.is_empty() { + return Err("unresolved native block tags".into()); + } + let natural = built + .tags + .get("minecraft:causes_suffocation") + .ok_or("missing suffocation tag")? + .iter() + .cloned() + .collect::>(); + let binding = SuffocationRegistry::new(collisions, &definitions, &natural)?; + let properties = Properties(Arc::new( + (0..registry.len()) + .map(|id| { + matches!( + registry + .state(BlockStateId(id as u32)) + .unwrap() + .name + .as_str(), + "minecraft:air" | "minecraft:cave_air" | "minecraft:void_air" + ) + }) + .collect(), + )); + let trace = Rc::new(RefCell::new(Trace { + out: io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?), + calls: 0, + fail: -1, + })); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + { + let mut t = trace.borrow_mut(); + t.calls = 0; + t.fail = f["fail"].as_i64().unwrap() as i32; + } + let mut chunks = BTreeMap::new(); + for c in f["chunks"].as_array().unwrap() { + let x = c[0].as_i64().unwrap() as i32; + let z = c[1].as_i64().unwrap() as i32; + chunks.insert( + (x, z), + ( + TerrainChunk::new(ChunkPos::new(x, z), -16, 48, ®istry, properties.clone())?, + Entities { + mode: f["entities"][1].as_u64().unwrap(), + scope: "chunk", + trace: trace.clone(), + }, + ), + ); + } + for b in f["blocks"].as_array().unwrap() { + let x = b[0].as_i64().unwrap() as i32; + let y = b[1].as_i64().unwrap() as i32; + let z = b[2].as_i64().unwrap() as i32; + chunks + .get_mut(&(x >> 4, z >> 4)) + .unwrap() + .0 + .set_block_worldgen(x, y, z, BlockStateId(b[3].as_u64().unwrap() as u32))?; + } + let mut world = World { + chunks, + global: Entities { + mode: f["entities"][0].as_u64().unwrap(), + scope: "global", + trace: trace.clone(), + }, + trace: trace.clone(), + }; + let mut bound = RegistryCollisionWorld::new(&binding, &mut world)?; + let context = match f["context"].as_u64().unwrap() { + 0 => CollisionContext::empty(false), + 1 => CollisionContext::empty(true), + 2 => CollisionContext::position(number(&f["y"])), + _ => CollisionContext::placement(None), + }; + let v = &f["box"]; + let bounds = Aabb::new( + Vec3::new(number(&v[0]), number(&v[1]), number(&v[2])), + Vec3::new(number(&v[3]), number(&v[4]), number(&v[5])), + ); + let mut scan = BlockCollisionScan::new( + &mut bound, + context, + bounds, + f["suffocating"].as_bool().unwrap(), + 1_000_000, + )?; + let mut hits = 0; + for _ in 0..f["limit"].as_u64().unwrap() { + match scan.next() { + None => break, + Some(Ok(hit)) => { + let mut t = trace.borrow_mut(); + let p = hit.position; + writeln!(t.out, "hit {} {} {}", p.x, p.y, p.z)?; + emit(&mut t.out, &hit.shape)?; + hits += 1; + } + Some(Err(_)) => { + writeln!(trace.borrow_mut().out, "error")?; + break; + } + } + } + let mut t = trace.borrow_mut(); + let calls = t.calls; + writeln!(t.out, "done {hits} {calls}")?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 66d2a0811..a6705b6d6 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -24,6 +24,7 @@ pub mod piston_shape; pub mod powder_snow_collision; pub mod region; pub mod registry; +pub mod registry_collision_scan; pub mod retrogen; pub mod suffocation; pub mod tick_data; diff --git a/crates/horizon-world/src/registry_collision_scan.rs b/crates/horizon-world/src/registry_collision_scan.rs new file mode 100644 index 000000000..df0067bce --- /dev/null +++ b/crates/horizon-world/src/registry_collision_scan.rs @@ -0,0 +1,102 @@ +//! Bind the native cursor to actual registry behavior and chunk providers. +use crate::{ + block_collision::{CollisionQueryError, DynamicCollisionWorld}, + block_collision_scan::{BlockCollisionWorld, CollisionBlock}, + collision_context::CollisionContext, + liquid_collision::LiquidCollisionWorld, + powder_snow_collision::PowderSnowWorld, + registry::BlockStateId, + suffocation::SuffocationRegistry, +}; +use horizon_core::{ + geometry::VoxelShape, + position::{BlockPos, ChunkPos}, +}; + +/// A collision world's resident chunk access. State IDs must belong to the +/// binding's registry. Handles remain valid for the +/// duration of a scan. The chunk-local block-entity provider is deliberately +/// distinct from the global world used for contextual collision shapes. +pub trait CollisionChunks: DynamicCollisionWorld { + type Chunk: Copy; + type ChunkWorld: DynamicCollisionWorld; + fn collision_chunk(&mut self, position: ChunkPos) -> Result, Self::Error>; + fn block_state( + &mut self, + chunk: Self::Chunk, + position: BlockPos, + ) -> Result; + /// Borrowing the provider must not perform a world query. Constant + /// suffocation predicates do not read any block entity. + fn chunk_world(&mut self, chunk: Self::Chunk) -> &mut Self::ChunkWorld; +} + +pub struct RegistryCollisionWorld<'a, 'r, W> { + binding: &'a SuffocationRegistry<'r>, + world: &'a mut W, +} +impl<'a, 'r, W> RegistryCollisionWorld<'a, 'r, W> { + pub fn new(binding: &'a SuffocationRegistry<'r>, world: &'a mut W) -> std::io::Result { + if !binding + .collisions() + .cached_shapes() + .has_canonical_identities() + { + return Err(crate::compression::invalid( + "collision scanning requires canonical shape identities", + )); + } + Ok(Self { binding, world }) + } +} +impl BlockCollisionWorld for RegistryCollisionWorld<'_, '_, W> +where + W: CollisionChunks + LiquidCollisionWorld + PowderSnowWorld, +{ + type Error = CollisionQueryError; + type Chunk = W::Chunk; + fn collision_chunk(&mut self, position: ChunkPos) -> Result, Self::Error> { + self.world + .collision_chunk(position) + .map_err(CollisionQueryError::Context) + } + fn collision_block( + &mut self, + chunk: Self::Chunk, + position: BlockPos, + ) -> Result { + let state = self + .world + .block_state(chunk, position) + .map_err(CollisionQueryError::Context)?; + self.binding + .collisions() + .collision_block(state) + .map_err(CollisionQueryError::Data) + } + fn is_suffocating( + &mut self, + chunk: Self::Chunk, + block: CollisionBlock, + position: BlockPos, + ) -> Result { + self.binding.is_suffocating( + self.world.chunk_world(chunk), + block.state, + [position.x, position.y, position.z], + ) + } + fn context_shape( + &mut self, + block: CollisionBlock, + position: BlockPos, + context: &CollisionContext<'_>, + ) -> Result { + self.binding.collisions().collision_shape_with_context( + self.world, + block.state, + position, + context, + ) + } +} diff --git a/crates/horizon-world/src/suffocation.rs b/crates/horizon-world/src/suffocation.rs index a17d9eea8..bb5fa9b71 100644 --- a/crates/horizon-world/src/suffocation.rs +++ b/crates/horizon-world/src/suffocation.rs @@ -31,6 +31,10 @@ pub struct SuffocationRegistry<'r> { rules: Vec, } impl<'r> SuffocationRegistry<'r> { + pub fn collisions(&self) -> &BlockCollisionRegistry<'r> { + &self.collisions + } + /// Rebind after the causes_suffocation tag changes. Definition keys and tag /// members are canonical block identifiers from the same pinned registry. pub fn new( diff --git a/crates/horizon-world/tests/collision_data.rs b/crates/horizon-world/tests/collision_data.rs index f6384c329..3738edf1a 100644 --- a/crates/horizon-world/tests/collision_data.rs +++ b/crates/horizon-world/tests/collision_data.rs @@ -233,3 +233,37 @@ fn canonical_identity_claims_require_exact_geometry_and_unique_exports() { coords[0] = (-0.0f64).to_bits() as i64; assert!(CachedCollisionRegistry::from_nbt(&noncanonical_zero, ®istry).is_err()); } + +#[test] +fn registry_scan_binding_requires_complete_canonical_metadata() { + use horizon_world::{ + block_collision::BlockCollisionRegistry, + registry_collision_scan::RegistryCollisionWorld, + suffocation::{SuffocationDefinition, SuffocationRegistry}, + }; + use std::{collections::BTreeSet, sync::Arc}; + let (registry_tag, mut collision_tag) = fixture(); + let registry = BlockRegistry::from_nbt(®istry_tag).unwrap(); + let definitions = ["minecraft:air", "minecraft:stone", "minecraft:context"] + .map(|name| (name.to_owned(), SuffocationDefinition::Never)) + .into_iter() + .collect(); + for marked in [false, true] { + if marked { + let Some(Tag::List(shapes)) = collision_tag.get_mut("shapes") else { + unreachable!() + }; + canonical_marker(&mut shapes[0], Tag::Byte(1)); + canonical_marker(&mut shapes[1], Tag::Byte(2)); + } + let cached = + Arc::new(CachedCollisionRegistry::from_nbt(&collision_tag, ®istry).unwrap()); + let collisions = Arc::new(BlockCollisionRegistry::new(cached).unwrap()); + assert!(collisions.collision_block(BlockStateId(3)).is_err()); + let binding = SuffocationRegistry::new(collisions, &definitions, &BTreeSet::new()).unwrap(); + assert_eq!( + RegistryCollisionWorld::new(&binding, &mut ()).is_ok(), + marked + ); + } +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 28b20079b..089db96f9 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -434,3 +434,22 @@ suffocation damage remain separate integration work. The [contextual regression](../benchmarks/rust-suffocation-2026-10-06/contextual-regression.json) also passes again with **2,391,334 lines per JAR**, and its all-state native audit now compares large-shape and moving-piston flags. Workspace Clippy passes. + + +`RegistryCollisionWorld` now binds `BlockCollisionScan` directly to registered +metadata, contextual shapes and suffocation rules. Chunk providers return current +state IDs and a chunk-local block-entity provider; contextual collision uses the +global world. Construction rejects legacy collision exports without complete +canonical identity metadata, because their unit-block fast paths can differ. + +`python3 tools/test_registry_collision_scan_parity.py` compares native +`BlockCollisions` over resident `ProtoChunk` sections with the Rust binding over +`TerrainChunk` sections. All registered states cover ordinary and suffocating-only +selection. Additional scenes cover partial/dynamic blocks, chunk and build-height +boundaries, missing chunks, replacements, early termination and query failures. +Shulker fixtures deliberately give the chunk and global providers different +entities to check routing. The [resident collision report](../benchmarks/rust-resident-collision-scan-2026-10-06/scoped-parity.json) +records **3,046,929 matching output lines per JAR**. Six collision import/binding +tests pass, including legacy-metadata rejection; workspace Clippy passes. +Live chunk loading, entity lifecycle, movement and the playable client remain +separate integration work. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryCollisionScanOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryCollisionScanOracle.java new file mode 100644 index 000000000..e15f71c45 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryCollisionScanOracle.java @@ -0,0 +1,67 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*; +import java.lang.reflect.*; +import java.nio.file.*; +import java.util.*; +import net.minecraft.core.*; +import net.minecraft.world.level.*; +import net.minecraft.world.level.biome.*; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.entity.*; +import net.minecraft.world.level.block.state.*; +import net.minecraft.world.level.chunk.*; +import net.minecraft.world.phys.*; +import net.minecraft.world.phys.shapes.*; +/** Native registry behavior and BlockCollisions over resident ProtoChunk sections. */ +public final class VanillaRegistryCollisionScanOracle { + static final class Stop extends RuntimeException {} + static final class Trace { + PrintWriter out;int calls,fail; + void query(String text){out.println(text);if(calls++==fail)throw new Stop();} + } + static PalettedContainerFactory factory; + static class Chunk extends ProtoChunk { + Trace trace;BlockEntity entity; + Chunk(int x,int z,Trace trace,BlockEntity entity){super(new ChunkPos(x,z),UpgradeData.EMPTY,LevelHeightAccessor.create(-16,48),factory,null);this.trace=trace;this.entity=entity;} + @Override public BlockState getBlockState(BlockPos p){trace.query("block "+p.getX()+" "+p.getY()+" "+p.getZ());return super.getBlockState(p);} + @Override public BlockEntity getBlockEntity(BlockPos p){trace.query("entity chunk "+p.getX()+" "+p.getY()+" "+p.getZ());return entity;} + void write(BlockPos p,int id){getSection(getSectionIndex(p.getY())).setBlockState(p.getX()&15,p.getY()&15,p.getZ()&15,Block.stateById(id),false);} + } + static long key(int x,int z){return (long)x<<32|Integer.toUnsignedLong(z);} + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + public static void main(String[] args)throws Exception { + if(args[0].equals("export")){VanillaSuffocationOracle.main(args);return;} + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();Path dir=Path.of(args[1]); + VanillaHeightmapOracle.bindTags(JsonParser.parseString(Files.readString(dir.resolve("tags.json"))).getAsJsonObject()); + Holder biome=Holder.Reference.createStandAlone(new HolderOwner(){},Biomes.PLAINS);var ids=new IdMapper>();ids.add(biome); + factory=new PalettedContainerFactory(Strategy.createForBlockStates(Block.BLOCK_STATE_REGISTRY),Blocks.AIR.defaultBlockState(),null,Strategy.createForBiomes(ids),biome,null); + var allocator=Class.forName("sun.misc.Unsafe");var access=allocator.getDeclaredField("theUnsafe");access.setAccessible(true);var unsafe=access.get(null);var allocate=allocator.getMethod("allocateInstance",Class.class); + var animation=ShulkerBoxBlockEntity.class.getDeclaredField("animationStatus");animation.setAccessible(true); + var progress=ShulkerBoxBlockEntity.class.getDeclaredField("progress");progress.setAccessible(true);var previous=ShulkerBoxBlockEntity.class.getDeclaredField("progressOld");previous.setAccessible(true); + BlockEntity[] entities={null,(BlockEntity)allocate.invoke(unsafe,ShulkerBoxBlockEntity.class),(BlockEntity)allocate.invoke(unsafe,ShulkerBoxBlockEntity.class)}; + for(int i=1;i<3;i++){ + for(var status:animation.getType().getEnumConstants())if(((Enum)status).name().equals(i==1?"CLOSED":"OPENED"))animation.set(entities[i],status); + progress.setFloat(entities[i],i==1?0:0.5f);previous.setFloat(entities[i],i==1?0:0.5f); + } + var emit=VanillaFaceSupportOracle.class.getDeclaredMethod("emit",PrintWriter.class,VoxelShape.class);emit.setAccessible(true); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){ + for(var line:(Iterable)lines::iterator){ + var f=JsonParser.parseString(line).getAsJsonObject();var trace=new Trace();trace.out=out;trace.fail=f.get("fail").getAsInt(); + var chunks=new HashMap();var modes=f.getAsJsonArray("entities"); + for(var value:f.getAsJsonArray("chunks")){var v=value.getAsJsonArray();int x=v.get(0).getAsInt(),z=v.get(1).getAsInt();chunks.put(key(x,z),new Chunk(x,z,trace,entities[modes.get(1).getAsInt()]));} + for(var value:f.getAsJsonArray("blocks")){var v=value.getAsJsonArray();var p=new BlockPos(v.get(0).getAsInt(),v.get(1).getAsInt(),v.get(2).getAsInt());chunks.get(key(p.getX()>>4,p.getZ()>>4)).write(p,v.get(3).getAsInt());} + var world=(CollisionGetter)Proxy.newProxyInstance(CollisionGetter.class.getClassLoader(),new Class[]{CollisionGetter.class},(proxy,method,values)->{ + if(method.getName().equals("getChunkForCollisions")){int x=(int)values[0],z=(int)values[1];trace.query("chunk "+x+" "+z);return chunks.get(key(x,z));} + if(method.getName().equals("getBlockEntity")){var p=(BlockPos)values[0];trace.query("entity global "+p.getX()+" "+p.getY()+" "+p.getZ());return entities[modes.get(0).getAsInt()];} + throw new AssertionError(method); + }); + int mode=f.get("context").getAsInt();var context=mode==0?CollisionContext.empty():mode==1?CollisionContext.emptyWithFluidCollisions():mode==2?CollisionContext.positionContext(number(f.get("y"))):CollisionContext.placementContext(null); + var v=f.getAsJsonArray("box");var bounds=new AABB(number(v.get(0)),number(v.get(1)),number(v.get(2)),number(v.get(3)),number(v.get(4)),number(v.get(5))); + var scan=new BlockCollisions(world,context,bounds,f.get("suffocating").getAsBoolean(),(p,s)->{out.println("hit "+p.getX()+" "+p.getY()+" "+p.getZ());return s;});int hits=0; + try{while(hitsd',float(v)).hex() + def row(state, context=0, suffocating=False, at=(0,0,0), bounds=None, entities=(0,0), fail=-1, limit=100000): + x,y,z=at + chunks=[[cx,cz] for cx in range((x>>4)-1,(x>>4)+2) for cz in range((z>>4)-1,(z>>4)+2)] + if bounds is None:bounds=[x+0.2,y+0.2,z+0.2,x+0.8,y+0.8,z+0.8] + return dict(chunks=chunks,blocks=[[*at,state]],context=context,suffocating=suffocating, + box=list(map(bits,bounds)),y=bits(y+1.0),entities=entities,fail=fail,limit=limit) + states=facts['states'] + for state in range(len(states)): + for suffocating in [False,True]:yield row(state,state%4,suffocating) + dynamic=[i for i,s in enumerate(states) if s['id'].endswith('shulker_box') or s['id'] in + ['minecraft:scaffolding','minecraft:water','minecraft:lava','minecraft:powder_snow', + 'minecraft:moving_piston','minecraft:bamboo','minecraft:pointed_dripstone','minecraft:sulfur_spike', + 'minecraft:piston','minecraft:sticky_piston','minecraft:oak_stairs','minecraft:stone_slab']] + for state in dynamic: + for context in range(4): + for suffocating in [False,True]: + for at in [(15,0,15),(-16,-1,-16)]:yield row(state,context,suffocating,at=at) + if states[state]['id'].endswith('shulker_box'): + for global_mode in range(3): + for chunk_mode in range(3): + for suffocating in [False,True]: + for fail in [-1,0,1,8,15,20,24]: + yield row(state,suffocating=suffocating,entities=(global_mode,chunk_mode),fail=fail) + rng=random.Random(0x5245534944454e54) + for index in range(1500): + at=rng.choice([(15,0,15),(-16,0,-16),(0,-16,0),(0,31,0)]) + x,y,z=at + f=row(rng.randrange(len(states)),context=index%4,suffocating=bool(index%2),at=at, + bounds=[x-0.2,y-0.2,z-0.2,x+1.2,y+1.2,z+1.2], + entities=(rng.randrange(3),rng.randrange(3)),fail=rng.choice([-1,-1,0,5,20,50]),limit=rng.choice([0,1,3,100000])) + f['chunks']=[c for c in f['chunks'] if c==[x>>4,z>>4] or rng.randrange(2)] + for _ in range(12): + px,pz=x+rng.randrange(-1,2),z+rng.randrange(-1,2) + py=min(31,max(-16,y+rng.randrange(-1,2))) + if [px>>4,pz>>4] in f['chunks']:f['blocks'].append([px,py,pz,rng.choice(dynamic)]) + yield f + + +def main(): + lock, jars, libraries = base.verify_artifacts() + build = lab.LOCAL/'rust-registry-collision-scan-parity';build.mkdir(exist_ok=True) + report_path = build/'report.json';report_path.unlink(missing_ok=True) + oracle = lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryCollisionScanOracle.java' + helpers = [oracle.with_name(name+'.java') for name in + ['VanillaHeightmapOracle', 'VanillaCollisionOracle', 'VanillaBlockStateCodecOracle', 'VanillaSuffocationOracle', 'VanillaFaceSupportOracle']] + sources = [oracle, *helpers, Path(__file__), lab.ROOT/'tools/test_rust_parity.py', + lab.ROOT/'tools/test_worldgen_parity.py', lab.ROOT/'tools/lab.py', + lab.ROOT/'Cargo.toml', lab.ROOT/'Cargo.lock', + lab.ROOT/'crates/horizon-world/examples/registry_collision_scan_fixture.rs'] + for crate in ['horizon-core', 'horizon-world']: + sources += [lab.ROOT/'crates'/crate/'Cargo.toml', + *sorted((lab.ROOT/'crates'/crate/'src').rglob('*.rs'))] + tested = base.source_hashes(sources) + tags = worldgen.tag_resources(jars['server']) + if tags != worldgen.tag_resources(jars['client']):raise AssertionError('Client/server block tags differ') + lab.write_json(build/'tags.json', tags) + classes = build/'classes';classes.mkdir(exist_ok=True) + dependencies = os.pathsep.join(map(str, libraries)) + def run(command, name): + with (build/(name+'.log')).open('w') as log: + subprocess.run(list(map(str, command)), cwd=lab.ROOT, check=True, timeout=3600, + stdout=log, stderr=subprocess.STDOUT) + run(['javac', '--release', lock['minecraft']['java_major'], '-proc:none', '-cp', + str(jars['server'])+os.pathsep+dependencies, '-d', classes, oracle, *helpers], 'compile-java') + def java(side, mode): + run(['java', '-Xmx768M', '-cp', os.pathsep.join([str(classes), str(jars[side]), dependencies]), + 'dev.horizonlab.parity.VanillaRegistryCollisionScanOracle', mode, build], side+'-'+mode) + java('server', 'export') + facts = json.loads((build/'facts.json').read_text()) + if len(facts['states']) != 35723:raise AssertionError('Incomplete pinned registry') + definitions = json.loads((build/'definitions.json').read_text()) + count = 0 + with (build/'inputs.txt').open('w') as output: + for fixture in corpus(facts): + output.write(json.dumps(fixture, separators=(',', ':'))+'\n');count += 1 + fixture_paths = [build/name for name in ['inputs.txt', 'facts.json', 'definitions.json', + 'block-registry.nbt', 'cached-collision.nbt', 'tags.json']] + fixtures = base.source_hashes(fixture_paths) + run(['cargo', 'build', '--locked', '--release', '-p', 'horizon-world', '--example', 'registry_collision_scan_fixture'], 'compile-rust') + metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--locked', '--no-deps', '--format-version', '1'], cwd=lab.ROOT)) + binary = Path(metadata['target_directory'])/'release/examples'/('registry_collision_scan_fixture.exe' if os.name=='nt' else 'registry_collision_scan_fixture') + run([binary, build], 'rust');references = [] + for side, jar in jars.items(): + java(side, side) + matched = base.compare(build/(side+'.txt'), build/'rust.txt') + references.append({'side':side, 'jar_sha256':lab.digest(jar, 'sha256'), + 'output_sha256':lab.digest(build/(side+'.txt'), 'sha256'), 'matched_output_lines':matched}) + print(f'{side}: {matched:,} resident collision-scan lines match', flush=True) + base.ensure_sources_unchanged(sources, tested);base.ensure_sources_unchanged(fixture_paths, fixtures) + report = {'schema':1, 'minecraft':lock['minecraft']['version'], 'manifest_sha1':lock['minecraft']['manifest_sha1'], + 'platform':platform.platform(), 'java':subprocess.check_output(['java', '--version'], text=True).splitlines()[0], + 'rustc':subprocess.check_output(['rustc', '--version'], text=True).strip(), + 'registry_states':len(facts['states']), 'block_definitions':len(definitions), + 'definition_counts':dict(collections.Counter(definitions.values())), + 'native_chunk_storage':'ProtoChunk', 'rust_chunk_storage':'TerrainChunk', 'fixtures':count, 'sources_sha256':tested, 'fixtures_sha256':fixtures, + 'rust_output_sha256':lab.digest(build/'rust.txt', 'sha256'), 'references':references, + 'scope':'Native BlockCollisions over actual registered block behavior and resident ProtoChunk sections compared with RegistryCollisionWorld, contextual dispatch and TerrainChunk storage. All states cover ordinary and suffocating-only selection. Context variants include empty, always-fluid, position and placement; dynamic and representative partial shapes cover positive/negative chunk boundaries. Shulker cases distinguish chunk-local suffocation entities from global collision entities, with ordered failure injection. Seeded scenes cover resident/missing chunks, build-height edges, block replacements and early consumer termination. This validates registry/storage integration for these snapshots, not chunk loading, entity lifecycle, experimental minecarts or gameplay movement.'} + lab.write_json(report_path, report);print(f'Scoped registry collision-scan parity passed: {report_path}', flush=True) + + +if __name__ == '__main__':main() From b4837fac8d9acf8ce67d102c8944d042fbd93eb8 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 00:02:37 +0200 Subject: [PATCH 066/253] Resolve entity step movement against resident world collision queries --- .../geometry-regression.json | 112 +++++++++ .../scoped-parity.json | 228 ++++++++++++++++++ crates/horizon-core/src/geometry/mod.rs | 2 +- crates/horizon-core/src/geometry/movement.rs | 96 +++++++- .../registry_collision_scan_fixture.rs | 91 +++++++ crates/horizon-world/src/lib.rs | 1 + .../src/registry_collision_scan.rs | 24 ++ crates/horizon-world/src/world_movement.rs | 81 +++++++ docs/collision-geometry.md | 26 ++ .../VanillaRegistryCollisionScanOracle.java | 31 +++ tools/test_world_movement_parity.py | 121 ++++++++++ 11 files changed, 802 insertions(+), 11 deletions(-) create mode 100644 benchmarks/rust-world-movement-2026-10-07/geometry-regression.json create mode 100644 benchmarks/rust-world-movement-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/src/world_movement.rs create mode 100644 tools/test_world_movement_parity.py diff --git a/benchmarks/rust-world-movement-2026-10-07/geometry-regression.json b/benchmarks/rust-world-movement-2026-10-07/geometry-regression.json new file mode 100644 index 000000000..b8f01cb16 --- /dev/null +++ b/benchmarks/rust-world-movement-2026-10-07/geometry-regression.json @@ -0,0 +1,112 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "commands": { + "traverse": 8448, + "trig-table": 1, + "rotation": 16000, + "vec": 7256, + "box": 7006, + "block-box": 100, + "grid": 201, + "query": 52500, + "many": 2500, + "motion": 12000, + "join": 5652, + "make-box": 600, + "optimize": 500, + "join-optimized": 500, + "step-motion": 17680, + "block-iterate": 2400, + "box-iterate": 2400, + "sweep": 9022, + "floor-height": 12000 + }, + "inputs_sha256": "95abe82bf9f328e8b51aafb84a3e97954073f743b963a3d2fa4892cc120f49f1", + "rust_output_sha256": "ebb938b5288e05a291b6e1039f286aa7565821f8de46afb1d853d8112c079dd5", + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaGeometryOracle.java": "48c233ec1a5684cbd5a9edb5d7972aa4647465045ef298dce14a91de45cc4809", + "tools/test_geometry_parity.py": "38ce169dc520535c217a01705510b71ef3ee81128376640e849f47bc999ef64d", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "b00bfa09225e5de0a9199a405fe0a4bec5017da833432e5915dbf1941b8fb098", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb" + }, + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "ebb938b5288e05a291b6e1039f286aa7565821f8de46afb1d853d8112c079dd5", + "matched_output_lines": 1320187 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "ebb938b5288e05a291b6e1039f286aa7565821f8de46afb1d853d8112c079dd5", + "matched_output_lines": 1320187 + } + ], + "scope": "Selected Vec3/AABB operations, sine table entries, quantized trig, rotations and look directions; finite block-ray traversal; bounded inclusive/directional block iteration and finite swept-block visits with step indices; immutable cube/array voxel-grid bounds, column minima/maxima, greedy boxes, collide, ray hits, closest points and cell lookup; lazy floor-height selection; box quantization, optimized/unoptimized Boolean joins, alias identity and joinIsNotEmpty; Entity.collideWithShapes, candidate step heights and Entity.collide step-up decisions/query bounds with caller-controlled block/entity/border shape lists. No live entities, actual world shape selection, grounding/velocity side effects, fluids or block behavior." +} diff --git a/benchmarks/rust-world-movement-2026-10-07/scoped-parity.json b/benchmarks/rust-world-movement-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..8d24c8618 --- /dev/null +++ b/benchmarks/rust-world-movement-2026-10-07/scoped-parity.json @@ -0,0 +1,228 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "registry_states": 35723, + "block_definitions": 1286, + "definition_counts": { + "tagged_full": 1221, + "never": 42, + "closed_shulker": 17, + "always": 4, + "not_extended": 2 + }, + "native_chunk_storage": "ProtoChunk", + "rust_chunk_storage": "TerrainChunk", + "fixtures": 45163, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryCollisionScanOracle.java": "48ea6354fe17eeb1ccead6bd644dbb2a1823397b86173a025f2699b2bf8acb21", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "f2b4f440a5bbce4224a4b3cee494b0f7ddcafbf72db12592c94ef9fb94fbc8a6", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSuffocationOracle.java": "8dd870e65807bac4234085958830321061f0a3805dcf2b1219514107ba710503", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceSupportOracle.java": "9ce939a435842867786fed648951bbe77f6ab843f6df09af15f3deb1948c4877", + "tools/test_world_movement_parity.py": "c70470c10421ba93688aac821cdd45ac97f106162fd4b8a4e5823ab6eedb98bd", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-world/examples/registry_collision_scan_fixture.rs": "3bf73ec0bfd8d2a364882aa64080c4635314b094dcae571d6e824033abaaf6bd", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "b00bfa09225e5de0a9199a405fe0a4bec5017da833432e5915dbf1941b8fb098", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "befe4f7a8bf5399ccc2bbbfd2c8d6c016ecce28d53a699c42d021b83c80b7bb9", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "a5021a168adcedc37d77f533a8921c02f09c59f46a01737586aaa33c5908b8d0", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "8ac9e90fe899855036658afd862ff20c4dcd15d1bd3f92a763c4795fecf0549f", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f" + }, + "fixtures_sha256": { + ".local/rust-world-movement-parity/inputs.txt": "bbe9f6e31b141231e9726858c4490335c6c563f845bb25ce43afa5bf2486b3f0", + ".local/rust-world-movement-parity/facts.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-world-movement-parity/definitions.json": "9cac3c650353104db1648050621057bfe104dec1f44b53d0b7875f7bc20e6eec", + ".local/rust-world-movement-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-world-movement-parity/cached-collision.nbt": "4a274cd720a1bda585b02f50f16e90246576679e1e173c214548c5cbf607ab2d", + ".local/rust-world-movement-parity/tags.json": "5e1301e5a9abf7e4de93af5dae3a157e852dbdb4ea345c2eb626305a605d4f98" + }, + "rust_output_sha256": "622f8c8bd0dc6ae6f8ce9606c1ecf15b163f75a6ee3241d43564d707f7d61497", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "622f8c8bd0dc6ae6f8ce9606c1ecf15b163f75a6ee3241d43564d707f7d61497", + "matched_output_lines": 7062798 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "622f8c8bd0dc6ae6f8ce9606c1ecf15b163f75a6ee3241d43564d707f7d61497", + "matched_output_lines": 7062798 + } + ], + "scope": "Actual native Entity.collide executes initial collision and step-up decisions over BlockCollisions, registered block shapes and resident ProtoChunk sections. Rust combines owned/fallible step resolution with registry-bound TerrainChunk scanning. All registered states are used as obstacles, plus step heights, falling/grounded motion, zero and underflow motion, partial blocks, fluids, dynamic blocks, ceilings, chunk boundaries and query failures. Entity collider lists and world-border proximity/shape are controlled inputs; query order and reuse, shape collection and resulting displacement are compared. Contexts are deliberately supplied empty/position/placement snapshots in both worlds. This does not establish entity broad-phase selection, actual world-border proximity, travel/gravity/velocity or grounded side effects, experimental minecarts or a playable game." +} diff --git a/crates/horizon-core/src/geometry/mod.rs b/crates/horizon-core/src/geometry/mod.rs index b41c36af9..8d65fec93 100644 --- a/crates/horizon-core/src/geometry/mod.rs +++ b/crates/horizon-core/src/geometry/mod.rs @@ -11,7 +11,7 @@ pub mod trig; use crate::position::BlockPos; pub use movement::{ block_floor_height, candidate_step_heights, entity_collision_bounds, resolve_shape_movement, - resolve_step_movement, + resolve_step_movement, try_resolve_step_movement, }; pub use shape::{ShapeError, ShapeOp, VoxelShape}; pub use sweep::sweep_intersected_blocks; diff --git a/crates/horizon-core/src/geometry/movement.rs b/crates/horizon-core/src/geometry/movement.rs index e89c77ba0..ec0843203 100644 --- a/crates/horizon-core/src/geometry/movement.rs +++ b/crates/horizon-core/src/geometry/movement.rs @@ -37,11 +37,27 @@ pub fn resolve_step_movement<'s>( on_ground: bool, mut collect: impl FnMut(Aabb) -> Vec<&'s VoxelShape>, ) -> Vec3 { + try_resolve_step_movement(movement, aabb, max_step, on_ground, |bounds| { + Ok::<_, std::convert::Infallible>(collect(bounds)) + }) + .unwrap_or_else(|never| match never {}) +} + +/// The same movement/step decision with fallible, owned or borrowed collider +/// collections. A provider failure stops before the next query and returns no +/// movement result. Existing world-query side effects are not rolled back. +pub fn try_resolve_step_movement, E>( + movement: Vec3, + aabb: Aabb, + max_step: f32, + on_ground: bool, + mut collect: impl FnMut(Aabb) -> Result, E>, +) -> Result { let resolved = if movement.length_squared() == 0.0 { movement } else { - let shapes = collect(aabb.expand_towards(movement)); - resolve_shape_movement(movement, aabb, &shapes) + let shapes = collect(aabb.expand_towards(movement))?; + resolve_borrowed_shape_movement(movement, aabb, &shapes) }; let landed = movement.y != resolved.y && movement.y < 0.0; if max_step > 0.0 @@ -57,23 +73,23 @@ pub fn resolve_step_movement<'s>( if !landed { query = query.expand_towards(Vec3::new(0.0, -(1.0e-5_f32 as f64), 0.0)); } - let shapes = collect(query); - for height in candidate_step_heights(step_box, &shapes, max_step, resolved.y as f32) { - let candidate = resolve_shape_movement( + let shapes = collect(query)?; + for height in borrowed_step_heights(step_box, &shapes, max_step, resolved.y as f32) { + let candidate = resolve_borrowed_shape_movement( Vec3::new(movement.x, height as f64, movement.z), step_box, &shapes, ); if candidate.horizontal_distance_squared() > resolved.horizontal_distance_squared() { - return candidate.subtract(Vec3::new( + return Ok(candidate.subtract(Vec3::new( 0.0, aabb.min(Axis::Y) - step_box.min(Axis::Y), 0.0, - )); + ))); } } } - resolved + Ok(resolved) } /// Resolve vanilla's Y-first, magnitude-dependent horizontal axis ordering. @@ -82,6 +98,13 @@ pub fn resolve_step_movement<'s>( /// This helper does not collect shapes, step up, set grounded flags, modify /// velocity, or apply inside-block effects. pub fn resolve_shape_movement(movement: Vec3, aabb: Aabb, shapes: &[&VoxelShape]) -> Vec3 { + resolve_borrowed_shape_movement(movement, aabb, shapes) +} +fn resolve_borrowed_shape_movement>( + movement: Vec3, + aabb: Aabb, + shapes: &[S], +) -> Vec3 { if shapes.is_empty() { return movement; } @@ -92,8 +115,12 @@ pub fn resolve_shape_movement(movement: Vec3, aabb: Aabb, shapes: &[&VoxelShape] continue; } let moved = aabb.move_by(Vec3::new(result[0], result[1], result[2])); - result[axis as usize] = - VoxelShape::collide_all(axis, moved, shapes.iter().copied(), amount); + result[axis as usize] = VoxelShape::collide_all( + axis, + moved, + shapes.iter().map(std::borrow::Borrow::borrow), + amount, + ); } Vec3::new(result[0], result[1], result[2]) } @@ -106,9 +133,19 @@ pub fn candidate_step_heights( shapes: &[&VoxelShape], max_step: f32, current_y: f32, +) -> Vec { + borrowed_step_heights(aabb, shapes, max_step, current_y) +} + +fn borrowed_step_heights>( + aabb: Aabb, + shapes: &[S], + max_step: f32, + current_y: f32, ) -> Vec { let mut heights = Vec::::with_capacity(4); for shape in shapes { + let shape = shape.borrow(); for coordinate in shape.coordinates(Axis::Y) { let height = (*coordinate - aabb.min(Axis::Y)) as f32; if height < 0.0 || height == current_y { @@ -206,3 +243,42 @@ mod tests { assert_eq!(block_floor_height(&empty, || &empty), f64::NEG_INFINITY); } } + +#[cfg(test)] +mod fallible_tests { + use super::*; + #[test] + fn owned_collision_queries_stop_at_first_failure() { + let bounds = Aabb::new(Vec3::new(-0.6, 0.0, 0.2), Vec3::new(-0.2, 1.8, 0.8)); + let ledge = VoxelShape::from_box(Aabb::new(Vec3::ZERO, Vec3::new(1.0, 0.5, 1.0))).unwrap(); + for fail in [0, 1] { + let mut queries = 0; + let result = + try_resolve_step_movement(Vec3::new(1.0, 0.0, 0.0), bounds, 0.6, true, |_| { + let call = queries; + queries += 1; + if call == fail { + Err(call) + } else { + Ok(vec![ledge.clone()]) + } + }); + assert_eq!(result, Err(fail)); + assert_eq!(queries, fail + 1); + } + let result = try_resolve_step_movement( + Vec3::new(-0.0, -0.0, -0.0), + bounds, + 0.6, + true, + |_| -> Result, ()> { + panic!("zero movement must skip shape collection") + }, + ) + .unwrap(); + assert_eq!( + [result.x.to_bits(), result.y.to_bits(), result.z.to_bits()], + [(-0.0f64).to_bits(); 3] + ); + } +} diff --git a/crates/horizon-world/examples/registry_collision_scan_fixture.rs b/crates/horizon-world/examples/registry_collision_scan_fixture.rs index fae91f595..71ff88f73 100644 --- a/crates/horizon-world/examples/registry_collision_scan_fixture.rs +++ b/crates/horizon-world/examples/registry_collision_scan_fixture.rs @@ -18,6 +18,7 @@ use horizon_world::{ registry::{BlockRegistry, BlockStateId}, registry_collision_scan::{CollisionChunks, RegistryCollisionWorld}, suffocation::{SuffocationDefinition, SuffocationRegistry}, + world_movement::{EntityMovementWorld, MovementRequest, resolve_world_movement}, worldgen::{ tags::TagDefinitions, terrain::{TerrainBlockStates, TerrainChunk}, @@ -185,11 +186,59 @@ impl TerrainBlockStates for Properties { Air(self.0[id.0 as usize]) } } +struct MovementShapes { + entities: Vec, + border: Option, +} struct World<'r> { + movement: Option, chunks: BTreeMap<(i32, i32), (TerrainChunk<'r, Properties>, Entities)>, global: Entities, trace: SharedTrace, } +fn query_bounds(trace: &SharedTrace, label: &str, b: Aabb) -> io::Result<()> { + let text = format!( + "{label} {:016x} {:016x} {:016x} {:016x} {:016x} {:016x}", + b.min(Axis::X).to_bits(), + b.min(Axis::Y).to_bits(), + b.min(Axis::Z).to_bits(), + b.max(Axis::X).to_bits(), + b.max(Axis::Y).to_bits(), + b.max(Axis::Z).to_bits() + ); + trace.borrow_mut().query(text) +} +fn box_shape(v: &Value) -> io::Result { + VoxelShape::from_box(Aabb::new( + Vec3::new(number(&v[0]), number(&v[1]), number(&v[2])), + Vec3::new(number(&v[3]), number(&v[4]), number(&v[5])), + )) + .map_err(io::Error::other) +} +impl EntityMovementWorld for World<'_> { + type Error = io::Error; + fn entity_collisions( + &mut self, + _: EntityIdentity, + bounds: Aabb, + ) -> io::Result> { + query_bounds(&self.trace, "entities", bounds)?; + Ok(self.movement.as_ref().unwrap().entities.clone()) + } + fn movement_border( + &mut self, + _: EntityIdentity, + bounds: Aabb, + ) -> io::Result> { + self.trace.borrow_mut().query("border".to_owned())?; + query_bounds(&self.trace, "border-test", bounds)?; + let border = &self.movement.as_ref().unwrap().border; + if border.is_some() { + self.trace.borrow_mut().query("border-shape".to_owned())?; + } + Ok(border.clone()) + } +} impl DynamicSupportWorld for World<'_> { type Error = io::Error; fn shulker_is_closed(&mut self, p: [i32; 3]) -> io::Result> { @@ -355,7 +404,26 @@ fn main() -> Result<(), Box> { .0 .set_block_worldgen(x, y, z, BlockStateId(b[3].as_u64().unwrap() as u32))?; } + let movement = f + .get("movement") + .map(|m| -> io::Result<_> { + Ok(MovementShapes { + entities: m["entities"] + .as_array() + .unwrap() + .iter() + .map(box_shape) + .collect::>()?, + border: if m["border"].is_null() { + None + } else { + Some(box_shape(&m["border"])?) + }, + }) + }) + .transpose()?; let mut world = World { + movement, chunks, global: Entities { mode: f["entities"][0].as_u64().unwrap(), @@ -376,6 +444,29 @@ fn main() -> Result<(), Box> { Vec3::new(number(&v[0]), number(&v[1]), number(&v[2])), Vec3::new(number(&v[3]), number(&v[4]), number(&v[5])), ); + if let Some(m) = f.get("movement") { + let v = &m["delta"]; + let result = resolve_world_movement( + &mut bound, + MovementRequest { + entity: EntityIdentity(1), + context, + bounds, + movement: Vec3::new(number(&v[0]), number(&v[1]), number(&v[2])), + max_step: number(&m["step"]) as f32, + on_ground: m["grounded"].as_bool().unwrap(), + candidate_budget: 1_000_000, + }, + ); + let mut t = trace.borrow_mut(); + match result { + Ok(v) => values(&mut t.out, "movement", [v.x, v.y, v.z])?, + Err(_) => writeln!(t.out, "error")?, + } + let calls = t.calls; + writeln!(t.out, "done movement {calls}")?; + continue; + } let mut scan = BlockCollisionScan::new( &mut bound, context, diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index a6705b6d6..5a3122110 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -28,6 +28,7 @@ pub mod registry_collision_scan; pub mod retrogen; pub mod suffocation; pub mod tick_data; +pub mod world_movement; pub mod worldgen; pub const DATA_VERSION: i32 = 5023; diff --git a/crates/horizon-world/src/registry_collision_scan.rs b/crates/horizon-world/src/registry_collision_scan.rs index df0067bce..f0f0f14a7 100644 --- a/crates/horizon-world/src/registry_collision_scan.rs +++ b/crates/horizon-world/src/registry_collision_scan.rs @@ -100,3 +100,27 @@ where ) } } + +impl crate::world_movement::EntityMovementWorld + for RegistryCollisionWorld<'_, '_, W> +{ + type Error = CollisionQueryError; + fn entity_collisions( + &mut self, + entity: crate::entity_obstruction::EntityIdentity, + bounds: horizon_core::geometry::Aabb, + ) -> Result, Self::Error> { + self.world + .entity_collisions(entity, bounds) + .map_err(CollisionQueryError::Context) + } + fn movement_border( + &mut self, + entity: crate::entity_obstruction::EntityIdentity, + bounds: horizon_core::geometry::Aabb, + ) -> Result, Self::Error> { + self.world + .movement_border(entity, bounds) + .map_err(CollisionQueryError::Context) + } +} diff --git a/crates/horizon-world/src/world_movement.rs b/crates/horizon-world/src/world_movement.rs new file mode 100644 index 000000000..5b6f0761a --- /dev/null +++ b/crates/horizon-world/src/world_movement.rs @@ -0,0 +1,81 @@ +//! Entity.collide collection order and step resolution over a collision world. +//! Travel, velocity, grounded flags and inside-block effects remain caller work. +use crate::{ + block_collision_scan::{BlockCollisionScan, BlockCollisionWorld, CollisionScanError}, + collision_context::CollisionContext, + entity_obstruction::EntityIdentity, +}; +use horizon_core::geometry::{ + Aabb, Vec3, VoxelShape, entity_collision_bounds, try_resolve_step_movement, +}; + +pub trait EntityMovementWorld { + type Error; + /// Return native-selected entity shapes in query order. Selection occurs + /// once, even for zero movement, and the list is reused during stepping. + fn entity_collisions( + &mut self, + entity: EntityIdentity, + bounds: Aabb, + ) -> Result, Self::Error>; + /// Obtain the border, check isInsideCloseToBorder and fetch its shape only + /// when applicable. Called before block iteration for each collision query. + fn movement_border( + &mut self, + entity: EntityIdentity, + bounds: Aabb, + ) -> Result, Self::Error>; +} + +pub struct MovementRequest<'a> { + pub entity: EntityIdentity, + /// Captured context for this entity. Experimental minecart exclusions need + /// their separate context layer; ordinary captured contexts are supported. + pub context: CollisionContext<'a>, + pub bounds: Aabb, + pub movement: Vec3, + pub max_step: f32, + pub on_ground: bool, + /// Per block scan, including skipped cursor cells. + pub candidate_budget: usize, +} + +pub fn resolve_world_movement( + world: &mut W, + request: MovementRequest<'_>, +) -> Result> +where + W: BlockCollisionWorld + EntityMovementWorld, +{ + let entities = world + .entity_collisions( + request.entity, + entity_collision_bounds(request.movement, request.bounds, request.max_step), + ) + .map_err(CollisionScanError::World)?; + try_resolve_step_movement( + request.movement, + request.bounds, + request.max_step, + request.on_ground, + |bounds| { + let mut shapes = entities.clone(); + if let Some(border) = world + .movement_border(request.entity, bounds) + .map_err(CollisionScanError::World)? + { + shapes.push(border); + } + for hit in BlockCollisionScan::new( + world, + request.context, + bounds, + false, + request.candidate_budget, + )? { + shapes.push(hit?.shape); + } + Ok(shapes) + }, + ) +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 089db96f9..8a246caa6 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -453,3 +453,29 @@ records **3,046,929 matching output lines per JAR**. Six collision import/bindin tests pass, including legacy-metadata rejection; workspace Clippy passes. Live chunk loading, entity lifecycle, movement and the playable client remain separate integration work. + + +`resolve_world_movement` now joins registry-backed block scanning to the native +step-up decision. It selects entity colliders once, including for zero/underflow +movement, then collects applicable border and block shapes in native order for +the initial and optional step query. `try_resolve_step_movement` accepts owned or +borrowed collider lists and propagates provider failures without returning a +partial displacement. The shared implementation avoids allocating reference +lists for owned shapes; existing borrowed callers retain the same API. + +`python3 tools/test_world_movement_parity.py` runs actual `Entity.collide` over +registered blocks and resident Java sections, comparing the Rust world collector +and step solver. Every registered state appears as an obstacle; additional cases +cover step heights, grounded/falling motion, ceilings, partial/dynamic blocks, +chunk boundaries, zero/underflow motion and failures during collection. The +[world movement report](../benchmarks/rust-world-movement-2026-10-07/scoped-parity.json) +records **7,062,798 matching lines per JAR**. Entity collider lists, border +proximity/shapes and collision contexts are controlled fixture inputs. Actual +entity selection, border state, travel/gravity/velocity, grounded side effects +and playable integration remain pending. + +The [geometry regression](../benchmarks/rust-world-movement-2026-10-07/geometry-regression.json) +passes again with **1,320,187 lines per JAR**, including the existing native step +fixtures. All six movement unit tests and workspace Clippy pass. New tests cover +owned-query failures during both initial and step collection and signed zero +preservation when collection is skipped. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryCollisionScanOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryCollisionScanOracle.java index e15f71c45..73f8ca9b0 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryCollisionScanOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryCollisionScanOracle.java @@ -28,6 +28,27 @@ public final class VanillaRegistryCollisionScanOracle { @Override public BlockEntity getBlockEntity(BlockPos p){trace.query("entity chunk "+p.getX()+" "+p.getY()+" "+p.getZ());return entity;} void write(BlockPos p,int id){getSection(getSectionIndex(p.getY())).setBlockState(p.getX()&15,p.getY()&15,p.getZ()&15,Block.stateById(id),false);} } + static String boxText(String label,AABB b){return label+String.format(" %016x %016x %016x %016x %016x %016x",Double.doubleToLongBits(b.minX),Double.doubleToLongBits(b.minY),Double.doubleToLongBits(b.minZ),Double.doubleToLongBits(b.maxX),Double.doubleToLongBits(b.maxY),Double.doubleToLongBits(b.maxZ));} + static VoxelShape boxShape(JsonElement input){var v=input.getAsJsonArray();return Shapes.box(number(v.get(0)),number(v.get(1)),number(v.get(2)),number(v.get(3)),number(v.get(4)),number(v.get(5)));} + static final class StepBorder extends net.minecraft.world.level.border.WorldBorder { + Trace trace;VoxelShape shape; + @Override public boolean isInsideCloseToBorder(net.minecraft.world.entity.Entity entity,AABB bounds){trace.query(boxText("border-test",bounds));return shape!=null;} + @Override public VoxelShape getCollisionShape(){trace.query("border-shape");return shape;} + } + static final class StepLevel extends net.minecraft.server.level.ServerLevel { + Trace trace;StepBorder border;List entities;CollisionGetter world;CollisionContext context; + private StepLevel(){super(null,null,null,null,null,null,false,0L,List.of(),false);} + @Override public net.minecraft.world.level.border.WorldBorder getWorldBorder(){trace.query("border");return border;} + @Override public List getEntityCollisions(net.minecraft.world.entity.Entity entity,AABB bounds){trace.query(boxText("entities",bounds));return entities;} + @Override public Iterable getBlockCollisions(net.minecraft.world.entity.Entity entity,AABB bounds){return ()->new BlockCollisions(world,context,bounds,false,(p,shape)->shape);} + } + static final class StepEntity extends net.minecraft.world.entity.decoration.ArmorStand { + float step;boolean grounded; + private StepEntity(){super(null,null);} + @Override public float maxUpStep(){return step;} + @Override public boolean onGround(){return grounded;} + void configure(StepLevel level,AABB bounds,float step,boolean grounded){setLevel(level);setBoundingBox(bounds);this.step=step;this.grounded=grounded;} + } static long key(int x,int z){return (long)x<<32|Integer.toUnsignedLong(z);} static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} public static void main(String[] args)throws Exception { @@ -44,6 +65,7 @@ public final class VanillaRegistryCollisionScanOracle { for(var status:animation.getType().getEnumConstants())if(((Enum)status).name().equals(i==1?"CLOSED":"OPENED"))animation.set(entities[i],status); progress.setFloat(entities[i],i==1?0:0.5f);previous.setFloat(entities[i],i==1?0:0.5f); } + var collide=net.minecraft.world.entity.Entity.class.getDeclaredMethod("collide",Vec3.class);collide.setAccessible(true); var emit=VanillaFaceSupportOracle.class.getDeclaredMethod("emit",PrintWriter.class,VoxelShape.class);emit.setAccessible(true); try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){ for(var line:(Iterable)lines::iterator){ @@ -58,6 +80,15 @@ public final class VanillaRegistryCollisionScanOracle { }); int mode=f.get("context").getAsInt();var context=mode==0?CollisionContext.empty():mode==1?CollisionContext.emptyWithFluidCollisions():mode==2?CollisionContext.positionContext(number(f.get("y"))):CollisionContext.placementContext(null); var v=f.getAsJsonArray("box");var bounds=new AABB(number(v.get(0)),number(v.get(1)),number(v.get(2)),number(v.get(3)),number(v.get(4)),number(v.get(5))); + if(f.has("movement")){ + var m=f.getAsJsonObject("movement");var level=(StepLevel)allocate.invoke(unsafe,StepLevel.class);level.trace=trace;level.world=world;level.context=context; + level.entities=new ArrayList<>();for(var shape:m.getAsJsonArray("entities"))level.entities.add(boxShape(shape)); + level.border=new StepBorder();level.border.trace=trace;level.border.shape=m.get("border").isJsonNull()?null:boxShape(m.get("border")); + var entity=(StepEntity)allocate.invoke(unsafe,StepEntity.class);entity.configure(level,bounds,(float)number(m.get("step")),m.get("grounded").getAsBoolean());var delta=m.getAsJsonArray("delta"); + try{var result=(Vec3)collide.invoke(entity,new Vec3(number(delta.get(0)),number(delta.get(1)),number(delta.get(2))));out.printf("movement %016x %016x %016x%n",Double.doubleToLongBits(result.x),Double.doubleToLongBits(result.y),Double.doubleToLongBits(result.z));} + catch(InvocationTargetException error){if(error.getCause() instanceof Stop)out.println("error");else throw error;} + out.println("done movement "+trace.calls);continue; + } var scan=new BlockCollisions(world,context,bounds,f.get("suffocating").getAsBoolean(),(p,s)->{out.println("hit "+p.getX()+" "+p.getY()+" "+p.getZ());return s;});int hits=0; try{while(hitsd',float(v)).hex() + def row(state,delta=(1,-0.08,0),step=0.6,grounded=True,context=2,offset=0,fail=-1,extra=(),entities=(),border=None): + blocks=[[x+offset,-1,z,facts['defaults']['minecraft:stone']] for x in range(-2,4) for z in range(-2,3)] + blocks.append([offset,0,0,state]);blocks.extend(extra) + return dict(chunks=[[x,z] for x in range((offset>>4)-1,(offset>>4)+2) for z in range(-1,2)], + blocks=blocks,context=context,y=bits(0),entities=[0,0],fail=fail,limit=100000,suffocating=False, + box=list(map(bits,[-0.6+offset,0,0.2,-0.2+offset,1.8,0.8])), + movement=dict(delta=list(map(bits,delta)),step=bits(step),grounded=grounded, + entities=[list(map(bits,b)) for b in entities],border=None if border is None else list(map(bits,border)))) + states=facts['states'] + for state in range(len(states)): + yield row(state,context=state%4) + defaults=facts['defaults'] + obstacles=[i for i,s in enumerate(states) if s['id'] in ['minecraft:oak_stairs','minecraft:stone_slab', + 'minecraft:snow','minecraft:scaffolding','minecraft:powder_snow','minecraft:water', + 'minecraft:shulker_box','minecraft:moving_piston','minecraft:piston','minecraft:soul_sand', + 'minecraft:mud','minecraft:farmland','minecraft:bamboo','minecraft:pointed_dripstone']] + for state in obstacles: + for step in [0,0.5,0.6,1.0,1.5]: + for dy in [0,-0.08,-0.5,0.25]: + yield row(state,delta=(1,dy,0),step=step) + for delta in [(0,0,0),(-0.0,-0.0,-0.0),(1e-200,0,0),(1e-8,-1e-8,0),(1,0,0),(0,0,1),(1,-0.08,1)]: + for state in [defaults['minecraft:stone_slab'],defaults['minecraft:oak_stairs']]: + for fail in [-1,0,1,2,3,8,50,100,150,250]:yield row(state,delta=delta,fail=fail) + rng=random.Random(0x4d4f56454d454e54) + for index in range(5000): + offset=rng.choice([-16,0,15]);state=rng.choice(obstacles) + delta=[rng.choice([-1.25,-0.5,0,0.5,1.0,1.8]),rng.choice([-0.75,-0.08,0,0.25]),rng.choice([-1.0,-0.2,0,0.2,1.0])] + entities=[] + for _ in range(rng.randrange(4)): + x=offset+rng.uniform(-1,2);z=rng.uniform(-1,2);y=rng.choice([-1,0,0.5,1.0,2.0]);entities.append([x,y,z,x+0.6,y+rng.choice([0.5,1.0,1.8]),z+0.6]) + border=[offset+0.8,-2,-2,offset+1.2,4,3] if index%4==0 else None + extra=[[offset,2,0,defaults['minecraft:stone']]] if index%3==0 else [] + f=row(state,delta,step=rng.choice([0,0.5,0.6,1.0,1.5]),grounded=bool(index%2),context=index%4, + offset=offset,fail=rng.choice([-1,-1,-1,0,1,2,3,8,50,100,150,250]),extra=extra,entities=entities,border=border) + f['entities']=[rng.randrange(3),rng.randrange(3)] + yield f + + +def main(): + lock, jars, libraries = base.verify_artifacts() + build = lab.LOCAL/'rust-world-movement-parity';build.mkdir(exist_ok=True) + report_path = build/'report.json';report_path.unlink(missing_ok=True) + oracle = lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryCollisionScanOracle.java' + helpers = [oracle.with_name(name+'.java') for name in + ['VanillaHeightmapOracle', 'VanillaCollisionOracle', 'VanillaBlockStateCodecOracle', 'VanillaSuffocationOracle', 'VanillaFaceSupportOracle']] + sources = [oracle, *helpers, Path(__file__), lab.ROOT/'tools/test_rust_parity.py', + lab.ROOT/'tools/test_worldgen_parity.py', lab.ROOT/'tools/lab.py', + lab.ROOT/'Cargo.toml', lab.ROOT/'Cargo.lock', + lab.ROOT/'crates/horizon-world/examples/registry_collision_scan_fixture.rs'] + for crate in ['horizon-core', 'horizon-world']: + sources += [lab.ROOT/'crates'/crate/'Cargo.toml', + *sorted((lab.ROOT/'crates'/crate/'src').rglob('*.rs'))] + tested = base.source_hashes(sources) + tags = worldgen.tag_resources(jars['server']) + if tags != worldgen.tag_resources(jars['client']):raise AssertionError('Client/server block tags differ') + lab.write_json(build/'tags.json', tags) + classes = build/'classes';classes.mkdir(exist_ok=True) + dependencies = os.pathsep.join(map(str, libraries)) + def run(command, name): + with (build/(name+'.log')).open('w') as log: + subprocess.run(list(map(str, command)), cwd=lab.ROOT, check=True, timeout=3600, + stdout=log, stderr=subprocess.STDOUT) + run(['javac', '--release', lock['minecraft']['java_major'], '-proc:none', '-cp', + str(jars['server'])+os.pathsep+dependencies, '-d', classes, oracle, *helpers], 'compile-java') + def java(side, mode): + run(['java', '-Xmx768M', '-cp', os.pathsep.join([str(classes), str(jars[side]), dependencies]), + 'dev.horizonlab.parity.VanillaRegistryCollisionScanOracle', mode, build], side+'-'+mode) + java('server', 'export') + facts = json.loads((build/'facts.json').read_text()) + if len(facts['states']) != 35723:raise AssertionError('Incomplete pinned registry') + definitions = json.loads((build/'definitions.json').read_text()) + count = 0 + with (build/'inputs.txt').open('w') as output: + for fixture in corpus(facts): + output.write(json.dumps(fixture, separators=(',', ':'))+'\n');count += 1 + fixture_paths = [build/name for name in ['inputs.txt', 'facts.json', 'definitions.json', + 'block-registry.nbt', 'cached-collision.nbt', 'tags.json']] + fixtures = base.source_hashes(fixture_paths) + run(['cargo', 'build', '--locked', '--release', '-p', 'horizon-world', '--example', 'registry_collision_scan_fixture'], 'compile-rust') + metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--locked', '--no-deps', '--format-version', '1'], cwd=lab.ROOT)) + binary = Path(metadata['target_directory'])/'release/examples'/('registry_collision_scan_fixture.exe' if os.name=='nt' else 'registry_collision_scan_fixture') + run([binary, build], 'rust');references = [] + for side, jar in jars.items(): + java(side, side) + matched = base.compare(build/(side+'.txt'), build/'rust.txt') + references.append({'side':side, 'jar_sha256':lab.digest(jar, 'sha256'), + 'output_sha256':lab.digest(build/(side+'.txt'), 'sha256'), 'matched_output_lines':matched}) + print(f'{side}: {matched:,} world movement lines match', flush=True) + base.ensure_sources_unchanged(sources, tested);base.ensure_sources_unchanged(fixture_paths, fixtures) + report = {'schema':1, 'minecraft':lock['minecraft']['version'], 'manifest_sha1':lock['minecraft']['manifest_sha1'], + 'platform':platform.platform(), 'java':subprocess.check_output(['java', '--version'], text=True).splitlines()[0], + 'rustc':subprocess.check_output(['rustc', '--version'], text=True).strip(), + 'registry_states':len(facts['states']), 'block_definitions':len(definitions), + 'definition_counts':dict(collections.Counter(definitions.values())), + 'native_chunk_storage':'ProtoChunk', 'rust_chunk_storage':'TerrainChunk', 'fixtures':count, 'sources_sha256':tested, 'fixtures_sha256':fixtures, + 'rust_output_sha256':lab.digest(build/'rust.txt', 'sha256'), 'references':references, + 'scope':'Actual native Entity.collide executes initial collision and step-up decisions over BlockCollisions, registered block shapes and resident ProtoChunk sections. Rust combines owned/fallible step resolution with registry-bound TerrainChunk scanning. All registered states are used as obstacles, plus step heights, falling/grounded motion, zero and underflow motion, partial blocks, fluids, dynamic blocks, ceilings, chunk boundaries and query failures. Entity collider lists and world-border proximity/shape are controlled inputs; query order and reuse, shape collection and resulting displacement are compared. Contexts are deliberately supplied empty/position/placement snapshots in both worlds. This does not establish entity broad-phase selection, actual world-border proximity, travel/gravity/velocity or grounded side effects, experimental minecarts or a playable game.'} + lab.write_json(report_path, report);print(f'Scoped world movement parity passed: {report_path}', flush=True) + + +if __name__ == '__main__':main() From 782a3cbee0e9151d3b27daf8c407a22b8ea6729e Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 00:08:21 +0200 Subject: [PATCH 067/253] Match entity collision selection and lazy policy queries --- .../scoped-parity.json | 208 ++++++++++++++++++ .../examples/entity_collision_fixture.rs | 191 ++++++++++++++++ crates/horizon-world/src/entity_collision.rs | 77 +++++++ crates/horizon-world/src/lib.rs | 1 + docs/collision-geometry.md | 18 ++ .../parity/VanillaEntityCollisionOracle.java | 55 +++++ tools/test_entity_collision_parity.py | 81 +++++++ 7 files changed, 631 insertions(+) create mode 100644 benchmarks/rust-entity-collision-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/entity_collision_fixture.rs create mode 100644 crates/horizon-world/src/entity_collision.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityCollisionOracle.java create mode 100644 tools/test_entity_collision_parity.py diff --git a/benchmarks/rust-entity-collision-2026-10-07/scoped-parity.json b/benchmarks/rust-entity-collision-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..dc3c48b46 --- /dev/null +++ b/benchmarks/rust-entity-collision-2026-10-07/scoped-parity.json @@ -0,0 +1,208 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 30648, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityCollisionOracle.java": "413f1dcf0702e8096e388ad1334121421f8293bc0e305271102d24dc38d3ab38", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceSupportOracle.java": "9ce939a435842867786fed648951bbe77f6ab843f6df09af15f3deb1948c4877", + "tools/test_entity_collision_parity.py": "11718ec84b9d6dc15b08c74e00246f3cbba6de2f9e8b028fa1e1c3cf596d9b3b", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/mod.rs": "b00bfa09225e5de0a9199a405fe0a4bec5017da833432e5915dbf1941b8fb098", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "434f48e310beb66490f6d861d326a5382a04dfb30b253676710b3f9fed6ca0c8", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "a5021a168adcedc37d77f533a8921c02f09c59f46a01737586aaa33c5908b8d0", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "8ac9e90fe899855036658afd862ff20c4dcd15d1bd3f92a763c4795fecf0549f", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/entity_collision_fixture.rs": "f3c59abaedbb151b35aa9681ffca9a75c45224fb197250e849b6621fbf703944" + }, + "fixtures_sha256": { + ".local/rust-entity-collision-parity/inputs.txt": "42236d8e4ac40fed731a339502d724d19a2d1d371998f4992b7582d2a1f77815" + }, + "rust_output_sha256": "c7a1f9e35271672cb8e5b0800d5c228e0564ca00f0efb49e95c1890c9be52dab", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "c7a1f9e35271672cb8e5b0800d5c228e0564ca00f0efb49e95c1890c9be52dab", + "matched_output_lines": 158558 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "c7a1f9e35271672cb8e5b0800d5c228e0564ca00f0efb49e95c1890c9be52dab", + "matched_output_lines": 158558 + } + ], + "scope": "Actual EntityGetter.getEntityCollisions over privately allocated ordered entity snapshots. Compares average-size short circuits, epsilon-inflated query bounds, exact intersection/exclusion and spectator filtering, default canCollideWith including shared vehicle roots, overridden source policies, null-source canBeCollidedWith and emitted shape geometry. Policy callbacks are traced and can fail after each query; candidate lists and vehicle relationships are supplied snapshots. This does not establish live entity storage, broad-phase indexing, entity-type-specific collision policies, lifecycle or gameplay parity." +} diff --git a/crates/horizon-world/examples/entity_collision_fixture.rs b/crates/horizon-world/examples/entity_collision_fixture.rs new file mode 100644 index 000000000..edf258069 --- /dev/null +++ b/crates/horizon-world/examples/entity_collision_fixture.rs @@ -0,0 +1,191 @@ +use horizon_core::geometry::{Aabb, Axis, Vec3, VoxelShape}; +use horizon_world::{ + entity_collision::{CollisionCandidate, EntityCollisionWorld, entity_collision_shapes}, + entity_obstruction::EntityIdentity, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn values( + out: &mut impl Write, + label: &str, + values: impl IntoIterator, +) -> io::Result<()> { + write!(out, "{label}")?; + for v in values { + let bits = if v.is_nan() { + 0x7ff8_0000_0000_0000 + } else { + v.to_bits() + }; + write!(out, " {bits:016x}")?; + } + writeln!(out) +} +fn box_values(out: &mut impl Write, label: &str, b: Aabb) -> io::Result<()> { + values( + out, + label, + [ + b.min(Axis::X), + b.min(Axis::Y), + b.min(Axis::Z), + b.max(Axis::X), + b.max(Axis::Y), + b.max(Axis::Z), + ], + ) +} +fn emit(out: &mut impl Write, shape: &VoxelShape) -> io::Result<()> { + writeln!( + out, + "shape {} {} {}", + shape.is_empty(), + shape.boxes().len(), + shape.is_cube() + )?; + for (axis, name) in Axis::ALL.into_iter().zip(["x", "y", "z"]) { + values(out, name, shape.coordinates(axis).iter().copied())?; + } + let axes = shape.cube_coordinate_axes(); + writeln!( + out, + "axes {}", + u8::from(axes[0]) + 2 * u8::from(axes[1]) + 4 * u8::from(axes[2]) + )?; + values( + out, + "extrema", + Axis::ALL + .map(|a| shape.min(a)) + .into_iter() + .chain(Axis::ALL.map(|a| shape.max(a))), + )?; + match shape.bounds() { + Some(b) => box_values(out, "bounds", b)?, + None => writeln!(out, "bounds none")?, + } + for b in shape.boxes() { + box_values(out, "box", *b)?; + } + Ok(()) +} +fn bounds(v: &Value) -> Aabb { + Aabb::new( + Vec3::new(number(&v[0]), number(&v[1]), number(&v[2])), + Vec3::new(number(&v[3]), number(&v[4]), number(&v[5])), + ) +} +struct Entity { + candidate: CollisionCandidate, + root: EntityIdentity, + collidable: bool, + policy: u64, +} +struct World<'a, W> { + out: &'a mut W, + entities: Vec, + calls: i32, + fail: i32, +} +impl World<'_, W> { + fn query(&mut self, line: String) -> io::Result<()> { + writeln!(self.out, "{line}")?; + let call = self.calls; + self.calls += 1; + if call == self.fail { + Err(io::Error::other("injected entity collision query failure")) + } else { + Ok(()) + } + } +} +impl EntityCollisionWorld for World<'_, W> { + type Error = io::Error; + fn collision_candidates( + &mut self, + source: Option, + b: Aabb, + ) -> io::Result> { + let id = source.map_or(-1, |e| e.0 as i64); + let mut output = Vec::new(); + box_values(&mut output, &format!("query {id}"), b)?; + let line = String::from_utf8(output).unwrap(); + self.query(line.trim_end().to_owned())?; + Ok(self.entities.iter().map(|e| e.candidate).collect()) + } + fn can_collide( + &mut self, + source: Option, + candidate: EntityIdentity, + ) -> io::Result { + if let Some(source) = source { + self.query(format!("collide {} {}", source.0, candidate.0))?; + let policy = self.entities[source.0 as usize - 1].policy; + if policy != 0 { + return Ok(policy == 1); + } + } + self.query(format!( + "collidable {} {}", + candidate.0, + source.map_or(-1, |e| e.0 as i64) + ))?; + let entity = &self.entities[candidate.0 as usize - 1]; + Ok(entity.collidable + && source.is_none_or(|id| self.entities[id.0 as usize - 1].root != entity.root)) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut entities: Vec = Vec::new(); + for v in f["entities"].as_array().unwrap() { + let id = EntityIdentity(entities.len() as u64 + 1); + let parent = v["parent"].as_i64().unwrap(); + let root = if parent < 0 { + id + } else { + entities[parent as usize].root + }; + entities.push(Entity { + candidate: CollisionCandidate { + identity: id, + bounds: bounds(&v["box"]), + spectator: v["spectator"].as_bool().unwrap(), + }, + root, + collidable: v["collidable"].as_bool().unwrap(), + policy: v["policy"].as_u64().unwrap(), + }); + } + let mut world = World { + out: &mut out, + entities, + calls: 0, + fail: f["fail"].as_i64().unwrap() as i32, + }; + let source = f["source"].as_i64().unwrap(); + let source = (source >= 0).then_some(EntityIdentity(source.wrapping_add(1) as u64)); + match entity_collision_shapes(&mut world, source, bounds(&f["box"])) { + Ok(shapes) => { + writeln!(world.out, "selected {}", shapes.len())?; + for shape in shapes { + emit(world.out, &shape)?; + } + } + Err(_) => writeln!(world.out, "error")?, + } + writeln!(world.out, "queries {}", world.calls)?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/entity_collision.rs b/crates/horizon-world/src/entity_collision.rs new file mode 100644 index 000000000..8ef42b648 --- /dev/null +++ b/crates/horizon-world/src/entity_collision.rs @@ -0,0 +1,77 @@ +//! EntityGetter collision shape selection over an ordered entity snapshot. +use crate::entity_obstruction::EntityIdentity; +use horizon_core::geometry::{Aabb, ShapeError, Vec3, VoxelShape}; + +#[derive(Clone, Copy, Debug)] +pub struct CollisionCandidate { + pub identity: EntityIdentity, + pub bounds: Aabb, + pub spectator: bool, +} +pub trait EntityCollisionWorld { + type Error; + /// Query the inflated bounds, preserving native entity iteration order. + /// The implementation may return a broad-phase superset. Snapshot entities + /// must remain available for the following collision-policy callbacks. + fn collision_candidates( + &mut self, + source: Option, + bounds: Aabb, + ) -> Result, Self::Error>; + /// With a source, invoke source.canCollideWith(candidate). Without one, + /// invoke candidate.canBeCollidedWith(null). Entity-specific policies and + /// vehicle relationships belong to the provider, and run only after filters. + fn can_collide( + &mut self, + source: Option, + candidate: EntityIdentity, + ) -> Result; +} +#[derive(Debug)] +pub enum EntityCollisionError { + World(E), + Shape(ShapeError), +} +impl std::fmt::Display for EntityCollisionError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::World(e) => e.fmt(f), + Self::Shape(e) => e.fmt(f), + } + } +} +impl std::error::Error for EntityCollisionError {} + +pub fn entity_collision_shapes( + world: &mut W, + source: Option, + bounds: Aabb, +) -> Result, EntityCollisionError> { + let size = bounds.size(); + if (size.x + size.y + size.z) / 3.0 < 1.0e-7 { + return Ok(Vec::new()); + } + let query = bounds.inflate(Vec3::new(1.0e-7, 1.0e-7, 1.0e-7)); + let candidates = world + .collision_candidates(source, query) + .map_err(EntityCollisionError::World)?; + let mut selected = Vec::new(); + for candidate in candidates { + if source == Some(candidate.identity) + || !candidate.bounds.intersects(query) + || candidate.spectator + { + continue; + } + if world + .can_collide(source, candidate.identity) + .map_err(EntityCollisionError::World)? + { + selected.push(candidate.bounds); + } + } + selected + .into_iter() + .map(|bounds| VoxelShape::from_box(bounds).map_err(EntityCollisionError::Shape)) + .collect() +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 5a3122110..14e4ff30c 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -15,6 +15,7 @@ pub mod collision; pub mod collision_context; pub mod compression; pub mod dynamic_support; +pub mod entity_collision; pub mod entity_obstruction; pub mod fluid; pub mod heightmap; diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 8a246caa6..b1274b109 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -479,3 +479,21 @@ passes again with **1,320,187 lines per JAR**, including the existing native ste fixtures. All six movement unit tests and workspace Clippy pass. New tests cover owned-query failures during both initial and step collection and signed zero preservation when collection is skipped. + + +`entity_collision_shapes` now implements `EntityGetter.getEntityCollisions` +selection over ordered entity snapshots: average-size short circuit, epsilon +inflation, exact bounds/excluded-identity filtering, spectator suppression and +lazy collision-policy callbacks. With a source entity it invokes that entity's +`canCollideWith`; without one it invokes each candidate's +`canBeCollidedWith(null)`. Selected bounds become shapes after policy evaluation. +Providers retain responsibility for live storage and each entity type's policy. + +`python3 tools/test_entity_collision_parity.py` compares the actual native getter, +default vehicle-root checks and controlled policy overrides, including failures +at query/callback boundaries. Tiny/zero-width and nonfinite query boxes, inflated +boundary contacts, spectators, shared vehicles, null sources and ordered shape +outputs are covered. The [entity collision report](../benchmarks/rust-entity-collision-2026-10-07/scoped-parity.json) +records **158,558 matching lines per JAR**. Workspace Clippy passes. This adds the +selection helper needed by movement; live entity indexing, lifecycle and +entity-type policy implementations remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityCollisionOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityCollisionOracle.java new file mode 100644 index 000000000..d313bd4b4 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityCollisionOracle.java @@ -0,0 +1,55 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*; +import java.lang.reflect.*; +import java.nio.file.*; +import java.util.*; +import java.util.function.Predicate; +import net.minecraft.world.entity.*; +import net.minecraft.world.level.EntityGetter; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.shapes.*; +/** Actual EntityGetter collision selection with traced entity policy overrides. */ +public final class VanillaEntityCollisionOracle { + static final class Stop extends RuntimeException {} + static final class Trace { + PrintWriter out;int calls,fail; + void query(String text){out.println(text);if(calls++==fail)throw new Stop();} + } + public static class Snapshot extends Marker { + boolean spectator,collidable;int policy;Trace trace; + public Snapshot(){super(null,null);} + @Override public boolean isSpectator(){return spectator;} + @Override public boolean canBeCollidedWith(Entity source){trace.query("collidable "+getId()+" "+(source==null?-1:source.getId()));return collidable;} + @Override public boolean canCollideWith(Entity candidate){trace.query("collide "+getId()+" "+candidate.getId());return policy==0?super.canCollideWith(candidate):policy==1;} + } + static AABB box(JsonElement value){var v=value.getAsJsonArray();double[] d=new double[6];for(int i=0;i<6;i++)d[i]=Double.longBitsToDouble(Long.parseUnsignedLong(v.get(i).getAsString(),16));return new AABB(d[0],d[1],d[2],d[3],d[4],d[5]);} + @SuppressWarnings("unchecked") + public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); + var allocator=Class.forName("sun.misc.Unsafe");var field=allocator.getDeclaredField("theUnsafe");field.setAccessible(true);var unsafe=field.get(null);var allocate=allocator.getMethod("allocateInstance",Class.class); + var vehicle=Entity.class.getDeclaredField("vehicle");vehicle.setAccessible(true); + var emit=VanillaFaceSupportOracle.class.getDeclaredMethod("emit",PrintWriter.class,VoxelShape.class);emit.setAccessible(true); + Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){ + for(var line:(Iterable)lines::iterator){ + var f=JsonParser.parseString(line).getAsJsonObject();var trace=new Trace();trace.out=out;trace.fail=f.get("fail").getAsInt();var entities=new ArrayList(); + for(var item:f.getAsJsonArray("entities")){ + var v=item.getAsJsonObject();var entity=(Snapshot)allocate.invoke(unsafe,Snapshot.class);entity.setId(entities.size()+1);entity.setBoundingBox(box(v.get("box")));entity.spectator=v.get("spectator").getAsBoolean();entity.collidable=v.get("collidable").getAsBoolean();entity.policy=v.get("policy").getAsInt();entity.trace=trace; + int parent=v.get("parent").getAsInt();if(parent>=0)vehicle.set(entity,entities.get(parent));entities.add(entity); + } + var world=(EntityGetter)Proxy.newProxyInstance(EntityGetter.class.getClassLoader(),new Class[]{EntityGetter.class},(proxy,method,values)->{ + if(method.isDefault())return InvocationHandler.invokeDefault(proxy,method,values); + if(!method.getName().equals("getEntities")||values.length!=3)throw new AssertionError(method); + var source=(Entity)values[0];var bounds=(AABB)values[1];var predicate=(Predicate)values[2]; + trace.query(String.format("query %d %016x %016x %016x %016x %016x %016x",source==null?-1:source.getId(),Double.doubleToLongBits(bounds.minX),Double.doubleToLongBits(bounds.minY),Double.doubleToLongBits(bounds.minZ),Double.doubleToLongBits(bounds.maxX),Double.doubleToLongBits(bounds.maxY),Double.doubleToLongBits(bounds.maxZ))); + var selected=new ArrayList();for(var entity:entities)if(entity!=source&&entity.getBoundingBox().intersects(bounds)&&predicate.test(entity))selected.add(entity);return selected; + }); + int source=f.get("source").getAsInt(); + try{var shapes=world.getEntityCollisions(source<0?null:entities.get(source),box(f.get("box")));out.println("selected "+shapes.size());for(var shape:shapes)emit.invoke(null,out,shape);} + catch(Stop error){out.println("error");} + out.println("queries "+trace.calls); + } + } + } +} diff --git a/tools/test_entity_collision_parity.py b/tools/test_entity_collision_parity.py new file mode 100644 index 000000000..609981351 --- /dev/null +++ b/tools/test_entity_collision_parity.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python3 +"""Compare entity collision shape selection and policy queries with pinned vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + def box(v):return [struct.pack('>d',float(x)).hex() for x in v] + def entity(bounds,collidable=True,spectator=False,policy=0,parent=-1): + return dict(box=box(bounds),collidable=collidable,spectator=spectator,policy=policy,parent=parent) + unit=[0,0,0,1,1,1] + queries=[unit,[-0.0,-0.0,-0.0,0,0,0],[-1,-1,-1,2,2,2],[0,0,0,0,1,1], + [0,0,0,float('nan'),1,1],[-float('inf'),-1,-1,float('inf'),2,2]] + for width in [1e-8,math.nextafter(1e-7,0),1e-7,math.nextafter(1e-7,1),2e-7]: + queries.extend([[0,0,0,width,width,width],[0,0,0,3*width,0,0]]) + boxes=[unit,[0.2,0.2,0.2,0.8,0.8,0.8],[1,0,0,2,1,1],[1+1e-7,0,0,2,1,1], + [math.nextafter(1+1e-7,0),0,0,2,1,1],[0,0,0,1e-8,1,1], + [0.5,0.5,0.5,0.5,0.75,0.75],[3,3,3,4,4,4]] + for bounds in queries: + for candidate in boxes: + for collidable in [False,True]: + for spectator in [False,True]: + for policy in range(3): + entities=[entity(unit,policy=policy),entity(candidate,collidable,spectator),entity(candidate,collidable,spectator,parent=0)] + for source in [-1,0,1]: + for fail in [-1,0,1,2,3,4]:yield dict(box=box(bounds),entities=entities,source=source,fail=fail) + rng=random.Random(0x454e54434f4c4c) + extents=[0,1e-8,1e-7,0.125,0.5,1.0,2.0] + def random_box(): + low=[rng.choice([-1,-1e-8,0,0.5,1-1e-8,1,2]) for _ in range(3)] + return [*low,*[v+rng.choice(extents) for v in low]] + for index in range(3000): + entities=[entity(random_box(),rng.choice([False,True]),rng.randrange(4)==0,rng.randrange(3),rng.randrange(-1,i) if i else -1) for i in range(rng.randrange(15))] + yield dict(box=box(random_box()),entities=entities,source=rng.randrange(-1,len(entities)),fail=rng.choice([-1,-1,0,1,2,5,10])) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-entity-collision-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityCollisionOracle.java' + helper=oracle.with_name('VanillaFaceSupportOracle.java') + sources=[oracle,helper,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/entity_collision_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle,helper],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaEntityCollisionOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','entity_collision_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('entity_collision_fixture.exe' if os.name=='nt' else 'entity_collision_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} entity-collision output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual EntityGetter.getEntityCollisions over privately allocated ordered entity snapshots. Compares average-size short circuits, epsilon-inflated query bounds, exact intersection/exclusion and spectator filtering, default canCollideWith including shared vehicle roots, overridden source policies, null-source canBeCollidedWith and emitted shape geometry. Policy callbacks are traced and can fail after each query; candidate lists and vehicle relationships are supplied snapshots. This does not establish live entity storage, broad-phase indexing, entity-type-specific collision policies, lifecycle or gameplay parity.'} + lab.write_json(report_path,report);print(f'Scoped entity-collision parity passed: {report_path}') + + +if __name__=='__main__':main() From 7ac3d313137ef9d4c505052f52b75cb25f66f5a6 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 00:15:16 +0200 Subject: [PATCH 068/253] Match world border extent geometry and tick-driven interpolation --- .../scoped-parity.json | 209 ++++++++++++++ crates/horizon-core/src/geometry/border.rs | 266 ++++++++++++++++++ crates/horizon-core/src/geometry/mod.rs | 1 + .../examples/world_border_fixture.rs | 154 ++++++++++ docs/collision-geometry.md | 22 ++ .../parity/VanillaWorldBorderOracle.java | 43 +++ tools/test_world_border_parity.py | 86 ++++++ 7 files changed, 781 insertions(+) create mode 100644 benchmarks/rust-world-border-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-core/src/geometry/border.rs create mode 100644 crates/horizon-world/examples/world_border_fixture.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaWorldBorderOracle.java create mode 100644 tools/test_world_border_parity.py diff --git a/benchmarks/rust-world-border-2026-10-07/scoped-parity.json b/benchmarks/rust-world-border-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..39228449f --- /dev/null +++ b/benchmarks/rust-world-border-2026-10-07/scoped-parity.json @@ -0,0 +1,209 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 1072, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaWorldBorderOracle.java": "d3366aacd9e6ea415046007dc1047ad44d15722cca5db2a685a0649642b91d50", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceSupportOracle.java": "9ce939a435842867786fed648951bbe77f6ab843f6df09af15f3deb1948c4877", + "tools/test_world_border_parity.py": "29d3935d6c9fa77f4ddad8ebd9ce611421dbbc1a4eb80fd145bb24b3c0bb3313", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "434f48e310beb66490f6d861d326a5382a04dfb30b253676710b3f9fed6ca0c8", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "a5021a168adcedc37d77f533a8921c02f09c59f46a01737586aaa33c5908b8d0", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "8ac9e90fe899855036658afd862ff20c4dcd15d1bd3f92a763c4795fecf0549f", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/world_border_fixture.rs": "2ee668ec9b6a81167eeeac16990914ded015057d02f35e9f1885b5ba3130b74e" + }, + "fixtures_sha256": { + ".local/rust-world-border-parity/inputs.txt": "17e5d1494da670d8b9856a212486e433f4e449f54b018ed807dff656554d9deb" + }, + "rust_output_sha256": "5216f1c366de17cdc9a9de1bf1ede19ac83c14363a57729de755e27faa18a446", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "5216f1c366de17cdc9a9de1bf1ede19ac83c14363a57729de755e27faa18a446", + "matched_output_lines": 1138830 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "5216f1c366de17cdc9a9de1bf1ede19ac83c14363a57729de755e27faa18a446", + "matched_output_lines": 1138830 + } + ], + "scope": "Actual WorldBorder stationary/moving extents, center/absolute-limit updates, tick progression, size/target/time/speed/status, float partial-tick bounds, full collision shape grids and proximity predicates. Covers finite nonnegative sizes, finite centers, nonnegative absolute limits and durations, signed zero, zero and very large durations, wrapping start timestamps, tick completion, retargeting, fractional boundaries and nonfinite predicate/partial-tick inputs. Rust returns typed errors for parameters outside this supported domain. Border saved-data codecs, listeners, dirty-state events, damage, networking and live movement integration remain pending." +} diff --git a/crates/horizon-core/src/geometry/border.rs b/crates/horizon-core/src/geometry/border.rs new file mode 100644 index 000000000..156b5804d --- /dev/null +++ b/crates/horizon-core/src/geometry/border.rs @@ -0,0 +1,266 @@ +//! Pinned world-border extent geometry and tick-driven size interpolation. +//! Saved-data codecs, listeners, damage and synchronization are separate layers. +use super::{Aabb, ShapeError, ShapeOp, Vec3, VoxelShape, clamp, java_max, java_min}; + +#[derive(Debug)] +pub enum BorderError { + InvalidParameters, + Shape(ShapeError), +} +impl std::fmt::Display for BorderError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self {Self::InvalidParameters=>f.write_str("border requires finite nonnegative sizes, finite centers and nonnegative limits/duration"),Self::Shape(e)=>e.fmt(f)} + } +} +impl std::error::Error for BorderError {} +impl From for BorderError { + fn from(e: ShapeError) -> Self { + Self::Shape(e) + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum BorderStatus { + Stationary, + Growing, + Shrinking, +} +#[derive(Clone)] +enum Extent { + Static { + size: f64, + bounds: [f64; 4], + shape: VoxelShape, + }, + Moving { + from: f64, + to: f64, + duration: i64, + remaining: i64, + size: f64, + previous: f64, + }, +} +pub struct BorderGeometry { + center: [f64; 2], + absolute_max: i32, + extent: Extent, +} +impl BorderGeometry { + pub fn new(center: [f64; 2], size: f64, absolute_max: i32) -> Result { + if !center.into_iter().all(f64::is_finite) + || !size.is_finite() + || size < 0.0 + || absolute_max < 0 + { + return Err(BorderError::InvalidParameters); + } + Ok(Self { + center, + absolute_max, + extent: Self::stationary(center, size, absolute_max)?, + }) + } + fn stationary(center: [f64; 2], size: f64, absolute_max: i32) -> Result { + let bounds = Self::extent_bounds(center, size, absolute_max); + Ok(Extent::Static { + size, + bounds, + shape: Self::shape_for(bounds)?, + }) + } + fn extent_bounds(center: [f64; 2], size: f64, absolute_max: i32) -> [f64; 4] { + let limit = f64::from(absolute_max); + let lower = f64::from(-absolute_max); + [ + clamp(center[0] - size / 2.0, lower, limit), + clamp(center[1] - size / 2.0, lower, limit), + clamp(center[0] + size / 2.0, lower, limit), + clamp(center[1] + size / 2.0, lower, limit), + ] + } + fn shape_for([min_x, min_z, max_x, max_z]: [f64; 4]) -> Result { + let infinity = VoxelShape::from_box(Aabb::new( + Vec3::new(f64::NEG_INFINITY, f64::NEG_INFINITY, f64::NEG_INFINITY), + Vec3::new(f64::INFINITY, f64::INFINITY, f64::INFINITY), + ))?; + let inside = VoxelShape::from_box(Aabb::new( + Vec3::new(min_x.floor(), f64::NEG_INFINITY, min_z.floor()), + Vec3::new(max_x.ceil(), f64::INFINITY, max_z.ceil()), + ))?; + infinity.join(&inside, ShapeOp::ONLY_FIRST) + } + pub fn center(&self) -> [f64; 2] { + self.center + } + pub fn set_center(&mut self, center: [f64; 2]) -> Result<(), BorderError> { + if !center.into_iter().all(f64::is_finite) { + return Err(BorderError::InvalidParameters); + } + if let Extent::Static { size, .. } = self.extent { + self.extent = Self::stationary(center, size, self.absolute_max)?; + } + self.center = center; + Ok(()) + } + pub fn set_absolute_max(&mut self, limit: i32) -> Result<(), BorderError> { + if limit < 0 { + return Err(BorderError::InvalidParameters); + } + if let Extent::Static { size, .. } = self.extent { + self.extent = Self::stationary(self.center, size, limit)?; + } + self.absolute_max = limit; + Ok(()) + } + pub fn set_size(&mut self, size: f64) -> Result<(), BorderError> { + if !size.is_finite() || size < 0.0 { + return Err(BorderError::InvalidParameters); + } + self.extent = Self::stationary(self.center, size, self.absolute_max)?; + Ok(()) + } + /// Native start/end tick timestamps cancel in the exposed speed calculation; + /// progress itself advances by one per tick, independently of wall time. + pub fn lerp_size_between( + &mut self, + from: f64, + to: f64, + duration: i64, + ) -> Result<(), BorderError> { + if !from.is_finite() || !to.is_finite() || from < 0.0 || to < 0.0 || duration < 0 { + return Err(BorderError::InvalidParameters); + } + if from == to { + return self.set_size(to); + } + let size = Self::moving_size(from, to, duration, duration); + self.extent = Extent::Moving { + from, + to, + duration, + remaining: duration, + size, + previous: size, + }; + Ok(()) + } + fn moving_size(from: f64, to: f64, duration: i64, remaining: i64) -> f64 { + let fraction = (duration as f64 - remaining as f64) / duration as f64; + if fraction < 1.0 { + from + fraction * (to - from) + } else { + to + } + } + pub fn tick(&mut self) -> Result<(), BorderError> { + if let Extent::Moving { + from, + to, + duration, + remaining, + size, + previous, + } = &mut self.extent + { + *remaining = remaining.wrapping_sub(1); + *previous = *size; + *size = Self::moving_size(*from, *to, *duration, *remaining); + if *remaining <= 0 { + self.extent = Self::stationary(self.center, *to, self.absolute_max)?; + } + } + Ok(()) + } + pub fn size(&self) -> f64 { + match self.extent { + Extent::Static { size, .. } | Extent::Moving { size, .. } => size, + } + } + pub fn lerp_target(&self) -> f64 { + match self.extent { + Extent::Static { size, .. } => size, + Extent::Moving { to, .. } => to, + } + } + pub fn lerp_time(&self) -> i64 { + match self.extent { + Extent::Static { .. } => 0, + Extent::Moving { remaining, .. } => remaining, + } + } + pub fn lerp_speed(&self) -> f64 { + match self.extent { + Extent::Static { .. } => 0.0, + Extent::Moving { + from, to, duration, .. + } => (from - to).abs() / duration as f64, + } + } + pub fn status(&self) -> BorderStatus { + match self.extent { + Extent::Static { .. } => BorderStatus::Stationary, + Extent::Moving { from, to, .. } => { + if to < from { + BorderStatus::Shrinking + } else { + BorderStatus::Growing + } + } + } + } + /// [minX, minZ, maxX, maxZ]. Ordinary collision bounds use partial_tick=0, + /// hence the previous size while moving. Static extents ignore partial_tick. + pub fn bounds(&self, partial_tick: f32) -> [f64; 4] { + match self.extent { + Extent::Static { bounds, .. } => bounds, + Extent::Moving { size, previous, .. } => Self::extent_bounds( + self.center, + previous + f64::from(partial_tick) * (size - previous), + self.absolute_max, + ), + } + } + pub fn collision_shape(&self) -> Result { + match &self.extent { + Extent::Static { shape, .. } => Ok(shape.clone()), + Extent::Moving { .. } => Self::shape_for(self.bounds(0.0)), + } + } + pub fn distance_to_border(&self, x: f64, z: f64) -> f64 { + let [min_x, min_z, max_x, max_z] = self.bounds(0.0); + java_min( + java_min(java_min(x - min_x, max_x - x), z - min_z), + max_z - z, + ) + } + pub fn is_within_bounds(&self, x: f64, z: f64, margin: f64) -> bool { + let [min_x, min_z, max_x, max_z] = self.bounds(0.0); + x >= min_x - margin && x < max_x + margin && z >= min_z - margin && z < max_z + margin + } + pub fn is_inside_close_to_border(&self, entity_x: f64, entity_z: f64, bounds: Aabb) -> bool { + let size = bounds.size(); + let margin = java_max(java_max(size.x.abs(), size.z.abs()), 1.0); + self.distance_to_border(entity_x, entity_z) < margin * 2.0 + && self.is_within_bounds(entity_x, entity_z, margin) + } +} + +#[cfg(test)] +mod tests { + use super::*; + #[test] + fn invalid_parameters_leave_existing_extent_unchanged() { + let mut border = BorderGeometry::new([1.0, 2.0], 10.0, 100).unwrap(); + let bounds = border.bounds(0.0); + assert!(border.set_center([f64::NAN, 0.0]).is_err()); + assert!(border.set_size(-1.0).is_err()); + assert!(border.set_size(f64::INFINITY).is_err()); + assert!(border.set_absolute_max(-1).is_err()); + assert!(border.lerp_size_between(10.0, 20.0, -1).is_err()); + assert!(border.lerp_size_between(10.0, f64::NAN, 1).is_err()); + assert_eq!(border.bounds(0.0), bounds); + assert_eq!(border.center(), [1.0, 2.0]); + assert_eq!(border.size(), 10.0); + assert_eq!(border.status(), BorderStatus::Stationary); + } +} diff --git a/crates/horizon-core/src/geometry/mod.rs b/crates/horizon-core/src/geometry/mod.rs index 8d65fec93..f8ad81331 100644 --- a/crates/horizon-core/src/geometry/mod.rs +++ b/crates/horizon-core/src/geometry/mod.rs @@ -3,6 +3,7 @@ //! Operation order and Java floating-point edge cases are deliberate. These are //! simulation coordinates; rendering may use a separate camera-relative format. +pub mod border; mod movement; mod shape; mod sweep; diff --git a/crates/horizon-world/examples/world_border_fixture.rs b/crates/horizon-world/examples/world_border_fixture.rs new file mode 100644 index 000000000..60cabdd3d --- /dev/null +++ b/crates/horizon-world/examples/world_border_fixture.rs @@ -0,0 +1,154 @@ +use horizon_core::geometry::{ + Aabb, Axis, Vec3, VoxelShape, + border::{BorderGeometry, BorderStatus}, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn values( + out: &mut impl Write, + label: &str, + values: impl IntoIterator, +) -> io::Result<()> { + write!(out, "{label}")?; + for v in values { + let bits = if v.is_nan() { + 0x7ff8_0000_0000_0000 + } else { + v.to_bits() + }; + write!(out, " {bits:016x}")?; + } + writeln!(out) +} +fn box_values(out: &mut impl Write, label: &str, b: Aabb) -> io::Result<()> { + values( + out, + label, + [ + b.min(Axis::X), + b.min(Axis::Y), + b.min(Axis::Z), + b.max(Axis::X), + b.max(Axis::Y), + b.max(Axis::Z), + ], + ) +} +fn emit(out: &mut impl Write, shape: &VoxelShape) -> io::Result<()> { + writeln!( + out, + "shape {} {} {}", + shape.is_empty(), + shape.boxes().len(), + shape.is_cube() + )?; + for (axis, name) in Axis::ALL.into_iter().zip(["x", "y", "z"]) { + values(out, name, shape.coordinates(axis).iter().copied())?; + } + let axes = shape.cube_coordinate_axes(); + writeln!( + out, + "axes {}", + u8::from(axes[0]) + 2 * u8::from(axes[1]) + 4 * u8::from(axes[2]) + )?; + values( + out, + "extrema", + Axis::ALL + .map(|a| shape.min(a)) + .into_iter() + .chain(Axis::ALL.map(|a| shape.max(a))), + )?; + match shape.bounds() { + Some(b) => box_values(out, "bounds", b)?, + None => writeln!(out, "bounds none")?, + } + for b in shape.boxes() { + box_values(out, "box", *b)?; + } + Ok(()) +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut border = BorderGeometry::new([0.0, 0.0], 59999968.0, 29999984)?; + let mut limit = 29999984; + for op in f["ops"].as_array().unwrap() { + match op[0].as_str().unwrap() { + "center" => border.set_center([number(&op[1]), number(&op[2])])?, + "size" => border.set_size(number(&op[1]))?, + "limit" => { + limit = op[1].as_i64().unwrap() as i32; + border.set_absolute_max(limit)?; + } + "lerp" => border.lerp_size_between( + number(&op[1]), + number(&op[2]), + op[3].as_i64().unwrap(), + )?, + "tick" => { + for _ in 0..op[1].as_u64().unwrap() { + border.tick()?; + } + } + _ => panic!("unknown border operation"), + } + let status = match border.status() { + BorderStatus::Stationary => "STATIONARY", + BorderStatus::Growing => "GROWING", + BorderStatus::Shrinking => "SHRINKING", + }; + writeln!(out, "status {status} {} {limit}", border.lerp_time())?; + let [x, z] = border.center(); + values( + &mut out, + "state", + [ + x, + z, + border.size(), + border.lerp_target(), + border.lerp_speed(), + ], + )?; + for partial in f["partials"].as_array().unwrap() { + values( + &mut out, + "bounds", + border.bounds(f32::from_bits(u32::from_str_radix( + partial.as_str().unwrap(), + 16, + )?)), + )?; + } + emit(&mut out, &border.collision_shape()?)?; + for q in f["queries"].as_array().unwrap() { + let x = number(&q[0]); + let z = number(&q[1]); + let margin = number(&q[2]); + let b = Aabb::new( + Vec3::new(number(&q[3]), number(&q[4]), number(&q[5])), + Vec3::new(number(&q[6]), number(&q[7]), number(&q[8])), + ); + values(&mut out, "distance", [border.distance_to_border(x, z)])?; + writeln!( + out, + "inside {} {}", + border.is_within_bounds(x, z, margin), + border.is_inside_close_to_border(x, z, b) + )?; + } + } + } + Ok(()) +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index b1274b109..7d32f1218 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -497,3 +497,25 @@ outputs are covered. The [entity collision report](../benchmarks/rust-entity-col records **158,558 matching lines per JAR**. Workspace Clippy passes. This adds the selection helper needed by movement; live entity indexing, lifecycle and entity-type policy implementations remain pending. + + +`BorderGeometry` now models stationary and moving world-border extents, cached +stationary collision geometry, center/absolute-limit changes, tick progression, +partial-tick bounds and movement proximity. The pinned version decrements size +transition progress once per tick. Ordinary bounds and collision shapes use the +previous size while moving; completing the transition installs a stationary +extent at the target. Collision geometry subtracts the floor/ceil-rounded inner +column from the infinite outer shape. Boundary predicates retain their asymmetric +inclusive minimum/exclusive maximum tests and native floating-point order. + +`python3 tools/test_world_border_parity.py` compares actual `WorldBorder` mutation +sequences, extent metadata, complete shape geometry and proximity predicates. +The [border report](../benchmarks/rust-world-border-2026-10-07/scoped-parity.json) +records **1,138,830 matching lines per JAR**, including zero/large durations, +wrapping start timestamps, completion, retargeting, signed zero, extreme finite +centers/sizes and nonfinite query/interpolation inputs. The supported construction +and mutation domain requires finite nonnegative sizes, finite centers and +nonnegative absolute limits/durations. A unit test verifies invalid parameters +leave the existing extent unchanged; workspace Clippy passes. Saved-data codecs, +listeners, dirty-state events, damage, synchronization and live movement binding +remain separate work. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaWorldBorderOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaWorldBorderOracle.java new file mode 100644 index 000000000..5014bac92 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaWorldBorderOracle.java @@ -0,0 +1,43 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*; +import java.lang.reflect.*; +import java.nio.file.*; +import net.minecraft.world.entity.*; +import net.minecraft.world.level.border.WorldBorder; +import net.minecraft.world.phys.*; +import net.minecraft.world.phys.shapes.*; +/** Native border extents, interpolation ticks, collision shape and proximity. */ +public final class VanillaWorldBorderOracle { + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + static void values(PrintWriter out,String label,double... values){out.print(label);for(double v:values)out.printf(" %016x",Double.doubleToLongBits(v));out.println();} + public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); + var allocator=Class.forName("sun.misc.Unsafe");var access=allocator.getDeclaredField("theUnsafe");access.setAccessible(true);var unsafe=access.get(null);var allocate=allocator.getMethod("allocateInstance",Class.class); + var entity=(Marker)allocate.invoke(unsafe,Marker.class);var position=Entity.class.getDeclaredField("position");position.setAccessible(true); + var emit=VanillaFaceSupportOracle.class.getDeclaredMethod("emit",PrintWriter.class,VoxelShape.class);emit.setAccessible(true);Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){ + for(var line:(Iterable)lines::iterator){ + var f=JsonParser.parseString(line).getAsJsonObject();var border=new WorldBorder(); + for(var value:f.getAsJsonArray("ops")){ + var op=value.getAsJsonArray();switch(op.get(0).getAsString()){ + case "center"->border.setCenter(number(op.get(1)),number(op.get(2))); + case "size"->border.setSize(number(op.get(1))); + case "limit"->border.setAbsoluteMaxSize(op.get(1).getAsInt()); + case "lerp"->border.lerpSizeBetween(number(op.get(1)),number(op.get(2)),op.get(3).getAsLong(),op.get(4).getAsLong()); + case "tick"->{for(int i=0;ithrow new AssertionError(op); + } + out.println("status "+border.getStatus().name()+" "+border.getLerpTime()+" "+border.getAbsoluteMaxSize());values(out,"state",border.getCenterX(),border.getCenterZ(),border.getSize(),border.getLerpTarget(),border.getLerpSpeed()); + for(var partial:f.getAsJsonArray("partials")){float t=Float.intBitsToFloat(Integer.parseUnsignedInt(partial.getAsString(),16));values(out,"bounds",border.getMinX(t),border.getMinZ(t),border.getMaxX(t),border.getMaxZ(t));} + emit.invoke(null,out,border.getCollisionShape()); + for(var item:f.getAsJsonArray("queries")){ + var q=item.getAsJsonArray();double x=number(q.get(0)),z=number(q.get(1)),margin=number(q.get(2));position.set(entity,new Vec3(x,0,z)); + var b=new AABB(number(q.get(3)),number(q.get(4)),number(q.get(5)),number(q.get(6)),number(q.get(7)),number(q.get(8))); + values(out,"distance",border.getDistanceToBorder(x,z));out.println("inside "+border.isWithinBounds(x,z,margin)+" "+border.isInsideCloseToBorder(entity,b)); + } + } + } + } + } +} diff --git a/tools/test_world_border_parity.py b/tools/test_world_border_parity.py new file mode 100644 index 000000000..472404582 --- /dev/null +++ b/tools/test_world_border_parity.py @@ -0,0 +1,86 @@ +#!/usr/bin/env python3 +"""Compare world-border extents, tick interpolation and collision geometry with pinned vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + def bits(v):return struct.pack('>d',float(v)).hex() + partials=[struct.pack('>f',v).hex() for v in [0,-0.0,0.25,0.5,1,-1,2,float('nan'),float('inf')]] + def row(ops,center=0,size=10): + points=[0,-0.0,-1,1,-5,5,-6,6,center,center-size/2,center+size/2,math.nextafter(center+size/2,-float('inf')),float('nan'),float('inf')] + queries=[] + for i,x in enumerate(points): + z=0 if i%2 else x + for margin in [0,1,-0.5]: + width=[0,0.6,1,3][i%4] + queries.append(list(map(bits,[x,z,margin,0,0,0,width,1.8,width]))) + return dict(ops=ops,partials=partials,queries=queries) + for center in [0,-0.0,0.25,-0.25,29999984,-29999984,1.7e308]: + for size in [0,-0.0,1e-8,0.125,1,5.5,59999968,1.7e308]: + for limit in [0,1,8,29999984,2147483647]: + yield row([['center',bits(center),bits(-center)],['size',bits(size)],['limit',limit]],center,size) + for start,target in [(0,10),(10,0),(3.25,17.75),(59999968,0),(0,59999968),(1.7e308,0),(0,1.7e308),(0,-0.0)]: + for duration in [0,1,2,7,20,(1<<53)-1,1<<53,(1<<63)-1]: + for begin in [0,(1<<63)-1,-(1<<63)]: + ops=[['lerp',bits(start),bits(target),duration,begin],['tick',1],['center',bits(0.25),bits(-0.75)],['tick',1],['limit',8],['tick',2],['tick',4],['tick',12]] + yield row(ops,0,start) + rng=random.Random(0x424f52444552) + for index in range(600): + center=rng.uniform(-100,100);size=rng.uniform(0,200) + ops=[['center',bits(center),bits(rng.uniform(-100,100))],['size',bits(size)]] + for _ in range(12): + action=rng.randrange(5) + if action==0:ops.append(['center',bits(rng.uniform(-100,100)),bits(rng.uniform(-100,100))]) + elif action==1:ops.append(['size',bits(rng.uniform(0,200))]) + elif action==2:ops.append(['limit',rng.randrange(0,201)]) + elif action==3:ops.append(['lerp',bits(rng.uniform(0,200)),bits(rng.uniform(0,200)),rng.randrange(0,30),rng.randrange(-(1<<63),(1<<63))]) + else:ops.append(['tick',rng.randrange(0,10)]) + yield row(ops,center,size) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-world-border-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaWorldBorderOracle.java' + helper=oracle.with_name('VanillaFaceSupportOracle.java') + sources=[oracle,helper,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/world_border_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle,helper],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaWorldBorderOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','world_border_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('world_border_fixture.exe' if os.name=='nt' else 'world_border_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} world-border output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual WorldBorder stationary/moving extents, center/absolute-limit updates, tick progression, size/target/time/speed/status, float partial-tick bounds, full collision shape grids and proximity predicates. Covers finite nonnegative sizes, finite centers, nonnegative absolute limits and durations, signed zero, zero and very large durations, wrapping start timestamps, tick completion, retargeting, fractional boundaries and nonfinite predicate/partial-tick inputs. Rust returns typed errors for parameters outside this supported domain. Border saved-data codecs, listeners, dirty-state events, damage, networking and live movement integration remain pending.'} + lab.write_json(report_path,report);print(f'Scoped world-border parity passed: {report_path}') + + +if __name__=='__main__':main() From cebf0c0e0650e9f52d0f3a2241fecbab9eef6c0e Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 00:23:13 +0200 Subject: [PATCH 069/253] Match post-collision restitution and bounce side-effect ordering --- .../scoped-parity.json | 209 ++++++++++++++++++ .../examples/restitution_fixture.rs | 162 ++++++++++++++ crates/horizon-world/src/lib.rs | 1 + .../horizon-world/src/movement_restitution.rs | 100 +++++++++ docs/collision-geometry.md | 18 ++ .../parity/VanillaRestitutionOracle.java | 78 +++++++ tools/test_restitution_parity.py | 78 +++++++ 7 files changed, 646 insertions(+) create mode 100644 benchmarks/rust-restitution-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/restitution_fixture.rs create mode 100644 crates/horizon-world/src/movement_restitution.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRestitutionOracle.java create mode 100644 tools/test_restitution_parity.py diff --git a/benchmarks/rust-restitution-2026-10-07/scoped-parity.json b/benchmarks/rust-restitution-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..26667829b --- /dev/null +++ b/benchmarks/rust-restitution-2026-10-07/scoped-parity.json @@ -0,0 +1,209 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 19784, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRestitutionOracle.java": "7e63393bf0590fc7b1b2ec6c3e4afa8f3a84b555e25744ac94705fcb67be85d0", + "tools/test_restitution_parity.py": "db7090350723ac66ae9ec0bf106dff3e7a8961fcda2bf2132c71eb9e35d7ae7b", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "f2c399b48e8489cf1d9c659e6855967778e3b2e23b05c94b7e33c3e22c1912ec", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "a5021a168adcedc37d77f533a8921c02f09c59f46a01737586aaa33c5908b8d0", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "8ac9e90fe899855036658afd862ff20c4dcd15d1bd3f92a763c4795fecf0549f", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/restitution_fixture.rs": "1c970701dc434155f8c830626ef5ad4cc9ac20330ceb2c91c3e351215b8dedf3" + }, + "fixtures_sha256": { + ".local/rust-restitution-parity/inputs.txt": "c123b46f42604e661c867d1ecf22f3ce1d84b19cb79dd11869aa7d92e6bba9a7" + }, + "rust_output_sha256": "94ab544d2c4c0a2644907521b96b913eeed376863b26912dda56755b48255cb5", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "94ab544d2c4c0a2644907521b96b913eeed376863b26912dda56755b48255cb5", + "matched_output_lines": 177090 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "94ab544d2c4c0a2644907521b96b913eeed376863b26912dda56755b48255cb5", + "matched_output_lines": 177090 + } + ], + "scope": "Actual Entity.restituteMovementAfterCollisions over living/nonliving snapshots and controlled block restitution/tag behavior. Compares horizontal/vertical bounce, effective-gravity threshold, nonliving float scaling, air-drag interpolation, signed zero/nonfinite values and ordered lazy queries. Bounce callbacks can change velocity and fail; final velocity and syncPosition are checked after every injected failure boundary. This does not establish registered block restitution/tag provisioning, actual bounce sound/game-event effects, Entity.move guard conditions, fall damage, grounding or full gameplay." +} diff --git a/crates/horizon-world/examples/restitution_fixture.rs b/crates/horizon-world/examples/restitution_fixture.rs new file mode 100644 index 000000000..d32532a82 --- /dev/null +++ b/crates/horizon-world/examples/restitution_fixture.rs @@ -0,0 +1,162 @@ +use horizon_core::{geometry::Vec3, position::BlockPos}; +use horizon_world::{ + movement_restitution::{RestitutionInput, RestitutionWorld, restitute_movement}, + registry::BlockStateId, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn single(v: &Value) -> f32 { + f32::from_bits(u32::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn vector(v: &Value) -> Vec3 { + Vec3::new(number(&v[0]), number(&v[1]), number(&v[2])) +} +fn bits(v: f64) -> u64 { + if v.is_nan() { + 0x7ff8000000000000 + } else { + v.to_bits() + } +} +fn vector_text(prefix: &str, v: Vec3) -> String { + format!( + "{prefix} {:016x} {:016x} {:016x}", + bits(v.x), + bits(v.y), + bits(v.z) + ) +} +struct World<'a, W> { + f: &'a Value, + out: &'a mut W, + calls: i32, + suppress_calls: usize, + gravity_calls: usize, + velocity: Vec3, + sync: bool, +} +impl World<'_, W> { + fn query(&mut self, text: &str) -> io::Result<()> { + writeln!(self.out, "{text}")?; + let call = self.calls; + self.calls += 1; + if call == self.f["fail"].as_i64().unwrap() as i32 { + Err(io::Error::other("injected restitution failure")) + } else { + Ok(()) + } + } +} +impl RestitutionWorld for World<'_, W> { + type Error = io::Error; + fn suppressing_bounce(&mut self) -> io::Result { + self.query("suppress")?; + let values = self.f["suppress"].as_array().unwrap(); + let result = values[self.suppress_calls.min(values.len() - 1)] + .as_bool() + .unwrap(); + self.suppress_calls += 1; + Ok(result) + } + fn entity_bounciness(&mut self) -> io::Result { + self.query("entity-bounce")?; + Ok(number(&self.f["entity"])) + } + fn velocity(&mut self) -> io::Result { + self.query("velocity")?; + Ok(self.velocity) + } + fn effective_gravity(&mut self) -> io::Result { + self.query("gravity")?; + let values = self.f["gravity"].as_array().unwrap(); + let result = number(&values[self.gravity_calls.min(values.len() - 1)]); + self.gravity_calls += 1; + Ok(result) + } + fn block_suppresses_bounce(&mut self, _: BlockStateId) -> io::Result { + self.query("block-suppresses")?; + Ok(self.f["tag"].as_bool().unwrap()) + } + fn block_bounce_restitution(&mut self, _: BlockStateId) -> io::Result { + self.query("block-bounce")?; + Ok(single(&self.f["block"])) + } + fn air_drag(&mut self) -> io::Result { + self.query("drag")?; + Ok(single(&self.f["drag"])) + } + fn movement_support_position(&mut self) -> io::Result { + self.query("support-position")?; + Ok(BlockPos::new(17, -64, -33)) + } + fn bounce_on(&mut self, _: BlockStateId, p: BlockPos, fall: f64) -> io::Result<()> { + self.query(&format!( + "bounce-on {} {} {} {:016x}", + p.x, + p.y, + p.z, + bits(fall) + ))?; + if self.f["mutate"].as_bool().unwrap() { + self.velocity = Vec3::new(17.0, 18.0, 19.0); + } + Ok(()) + } + fn bounce_event(&mut self) -> io::Result<()> { + self.query("bounce-event") + } + fn mark_position_for_sync(&mut self) { + self.sync = true; + } + fn set_velocity(&mut self, v: Vec3) -> io::Result<()> { + self.query(&vector_text("set-velocity", v))?; + self.velocity = v; + Ok(()) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut world = World { + f: &f, + out: &mut out, + calls: 0, + suppress_calls: 0, + gravity_calls: 0, + velocity: vector(&f["velocity"]), + sync: f["sync"].as_bool().unwrap(), + }; + let result = restitute_movement( + &mut world, + RestitutionInput { + block: BlockStateId(1), + collided_x: f["x"].as_bool().unwrap(), + collided_z: f["z"].as_bool().unwrap(), + vertical_collision: f["vertical"].as_bool().unwrap(), + collision_below: f["below"].as_bool().unwrap(), + living: f["living"].as_bool().unwrap(), + resolved_movement: vector(&f["resolved"]), + fall_distance: number(&f["fall"]), + }, + ); + writeln!( + world.out, + "result {}", + if result.is_ok() { "ok" } else { "error" } + )?; + writeln!(world.out, "{}", vector_text("final", world.velocity))?; + writeln!(world.out, "sync {}", world.sync)?; + writeln!(world.out, "queries {}", world.calls)?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 14e4ff30c..02e769397 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -20,6 +20,7 @@ pub mod entity_obstruction; pub mod fluid; pub mod heightmap; pub mod liquid_collision; +pub mod movement_restitution; pub mod nbt; pub mod piston_shape; pub mod powder_snow_collision; diff --git a/crates/horizon-world/src/movement_restitution.rs b/crates/horizon-world/src/movement_restitution.rs new file mode 100644 index 000000000..f994548ff --- /dev/null +++ b/crates/horizon-world/src/movement_restitution.rs @@ -0,0 +1,100 @@ +//! Native post-collision restitution, including lazy bounce queries and effects. +use crate::registry::BlockStateId; +use horizon_core::{geometry::Vec3, position::BlockPos}; + +pub struct RestitutionInput { + pub block: BlockStateId, + pub collided_x: bool, + pub collided_z: bool, + pub vertical_collision: bool, + pub collision_below: bool, + pub living: bool, + pub resolved_movement: Vec3, + pub fall_distance: f64, +} +pub trait RestitutionWorld { + type Error; + fn suppressing_bounce(&mut self) -> Result; + fn entity_bounciness(&mut self) -> Result; + fn velocity(&mut self) -> Result; + fn effective_gravity(&mut self) -> Result; + fn block_suppresses_bounce(&mut self, block: BlockStateId) -> Result; + fn block_bounce_restitution(&mut self, block: BlockStateId) -> Result; + fn air_drag(&mut self) -> Result; + fn movement_support_position(&mut self) -> Result; + fn bounce_on( + &mut self, + block: BlockStateId, + position: BlockPos, + fall_distance: f64, + ) -> Result<(), Self::Error>; + fn bounce_event(&mut self) -> Result<(), Self::Error>; + /// Native field write after bounce callbacks and before setting velocity. + fn mark_position_for_sync(&mut self); + fn set_velocity(&mut self, velocity: Vec3) -> Result<(), Self::Error>; +} +fn java_max(a: f64, b: f64) -> f64 { + if a.is_nan() { + a + } else if b.is_nan() { + b + } else if a == 0.0 && b == 0.0 { + f64::from_bits(a.to_bits() & b.to_bits()) + } else { + a.max(b) + } +} +/// Provider errors preserve already performed effects; no rollback is attempted. +/// Call only when Entity.move's simulation/collision guards request restitution. +pub fn restitute_movement( + world: &mut W, + input: RestitutionInput, +) -> Result<(), W::Error> { + let mut bounce = if world.suppressing_bounce()? { + 0.0 + } else { + world.entity_bounciness()? + }; + let old = world.velocity()?; + let mut velocity = old; + if input.collided_x { + velocity.x = -old.x * bounce; + } + if input.collided_z { + velocity.z = -old.z * bounce; + } + let mut emit = bounce > 0.0 && (input.collided_x || input.collided_z); + if input.vertical_collision { + if input.collision_below { + if -old.y <= world.effective_gravity()? + || world.suppressing_bounce()? + || world.block_suppresses_bounce(input.block)? + { + bounce = 0.0; + } else { + let mut block = world.block_bounce_restitution(input.block)?; + if !input.living { + block *= 0.8f32; + } + bounce = java_max(bounce, f64::from(block)); + } + } + let (gravity, drag) = if bounce > 0.0 { + let fraction = input.resolved_movement.y / old.y; + let gravity = fraction * world.effective_gravity()?; + let drag = 1.0 + fraction * (f64::from(world.air_drag()?) - 1.0); + emit = true; + (gravity, drag) + } else { + (0.0, 1.0) + }; + velocity.y = (gravity - old.y) * drag * bounce; + } + if emit { + let position = world.movement_support_position()?; + world.bounce_on(input.block, position, input.fall_distance)?; + world.bounce_event()?; + world.mark_position_for_sync(); + } + world.set_velocity(velocity) +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 7d32f1218..6a1c5d52e 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -519,3 +519,21 @@ nonnegative absolute limits/durations. A unit test verifies invalid parameters leave the existing extent unchanged; workspace Clippy passes. Saved-data codecs, listeners, dirty-state events, damage, synchronization and live movement binding remain separate work. + + +`restitute_movement` now implements the pinned post-collision velocity calculation +with lazy entity/block bounce queries, gravity thresholds, nonliving float +scaling and air-drag interpolation. It preserves horizontal/vertical collision +branches, callback ordering, the position-sync field write and final velocity +assignment. Errors retain already performed effects instead of rolling back the +world or returning a fabricated successful velocity. + +`python3 tools/test_restitution_parity.py` executes actual +`Entity.restituteMovementAfterCollisions` on living and nonliving snapshots with +controlled block restitution and suppression tags. The +[restitution report](../benchmarks/rust-restitution-2026-10-07/scoped-parity.json) +records **177,090 matching lines per JAR**. Fixtures cover changing lazy getter +values, signed zero/nonfinite arithmetic, bounce callbacks that alter velocity, +and failures before/after each side effect. Workspace Clippy passes. Registered +block property/tag provisioning, actual bounce sounds/events, `Entity.move` +guards, fall damage, grounding and full player simulation remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRestitutionOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRestitutionOracle.java new file mode 100644 index 000000000..1beb0c182 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRestitutionOracle.java @@ -0,0 +1,78 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*; +import java.lang.reflect.*; +import java.nio.file.*; +import net.minecraft.core.*; +import net.minecraft.tags.*; +import net.minecraft.world.entity.*; +import net.minecraft.world.entity.decoration.ArmorStand; +import net.minecraft.world.level.*; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.state.*; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.phys.Vec3; +/** Actual Entity restitution with traced provider methods and bounce effects. */ +public final class VanillaRestitutionOracle { + static final class Stop extends RuntimeException {} + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + static float single(JsonElement v){return Float.intBitsToFloat(Integer.parseUnsignedInt(v.getAsString(),16));} + static Vec3 vector(JsonElement v){var a=v.getAsJsonArray();return new Vec3(number(a.get(0)),number(a.get(1)),number(a.get(2)));} + static String vectorText(String prefix,Vec3 v){return String.format("%s %016x %016x %016x",prefix,Double.doubleToLongBits(v.x),Double.doubleToLongBits(v.y),Double.doubleToLongBits(v.z));} + static final class Data { + JsonObject input;PrintWriter out;int calls,suppressCalls,gravityCalls;Vec3 velocity; + void query(String text){out.println(text);if(calls++==input.get("fail").getAsInt())throw new Stop();} + boolean suppress(){query("suppress");var values=input.getAsJsonArray("suppress");return values.get(Math.min(suppressCalls++,values.size()-1)).getAsBoolean();} + double gravity(){query("gravity");var values=input.getAsJsonArray("gravity");return number(values.get(Math.min(gravityCalls++,values.size()-1)));} + } + static class BounceBlock extends Block { + Data d;BounceBlock(){super(BlockBehaviour.Properties.of());} + @Override public float getBounceRestitution(){d.query("block-bounce");return single(d.input.get("block"));} + @Override public void bounceOn(Level level,BlockState state,BlockPos p,Entity entity,double distance){d.query(String.format("bounce-on %d %d %d %016x",p.getX(),p.getY(),p.getZ(),Double.doubleToLongBits(distance)));if(d.input.get("mutate").getAsBoolean())d.velocity=new Vec3(17,18,19);} + } + static class State extends BlockState { + Data d;BounceBlock block;State(){super(null,null,null);} + @Override public Block getBlock(){return block;} + @Override public boolean is(TagKey tag){if(tag!=BlockTags.SUPPRESSES_BOUNCE)throw new AssertionError(tag);d.query("block-suppresses");return d.input.get("tag").getAsBoolean();} + } + static class NonLiving extends Marker { + NonLiving(){super(null,null);} + Data d; + @Override public boolean isSuppressingBounce(){return d.suppress();} + @Override protected double getEntityBounciness(){d.query("entity-bounce");return number(d.input.get("entity"));} + @Override public Vec3 getDeltaMovement(){d.query("velocity");return d.velocity;} + @Override protected double getEffectiveGravity(){return d.gravity();} + @Override protected float getAirDrag(){d.query("drag");return single(d.input.get("drag"));} + @Override public BlockPos getBlockPosBelowThatAffectsMyMovement(){d.query("support-position");return new BlockPos(17,-64,-33);} + @Override public void gameEvent(Holder event){if(event!=GameEvent.BOUNCE)throw new AssertionError(event);d.query("bounce-event");} + @Override public void setDeltaMovement(Vec3 velocity){d.query(vectorText("set-velocity",velocity));d.velocity=velocity;} + } + static class Living extends ArmorStand { + Living(){super(null,null);} + Data d; + @Override public boolean isSuppressingBounce(){return d.suppress();} + @Override protected double getEntityBounciness(){d.query("entity-bounce");return number(d.input.get("entity"));} + @Override public Vec3 getDeltaMovement(){d.query("velocity");return d.velocity;} + @Override protected double getEffectiveGravity(){return d.gravity();} + @Override protected float getAirDrag(){d.query("drag");return single(d.input.get("drag"));} + @Override public BlockPos getBlockPosBelowThatAffectsMyMovement(){d.query("support-position");return new BlockPos(17,-64,-33);} + @Override public void gameEvent(Holder event){if(event!=GameEvent.BOUNCE)throw new AssertionError(event);d.query("bounce-event");} + @Override public void setDeltaMovement(Vec3 velocity){d.query(vectorText("set-velocity",velocity));d.velocity=velocity;} + } + public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); + var allocator=Class.forName("sun.misc.Unsafe");var access=allocator.getDeclaredField("theUnsafe");access.setAccessible(true);var unsafe=access.get(null);var allocate=allocator.getMethod("allocateInstance",Class.class); + var method=Entity.class.getDeclaredMethod("restituteMovementAfterCollisions",BlockState.class,boolean.class,boolean.class,Vec3.class);method.setAccessible(true);Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){ + for(var line:(Iterable)lines::iterator){ + var f=JsonParser.parseString(line).getAsJsonObject();var d=new Data();d.input=f;d.out=out;d.velocity=vector(f.get("velocity"));Entity entity; + if(f.get("living").getAsBoolean()){var e=(Living)allocate.invoke(unsafe,Living.class);e.d=d;entity=e;}else{var e=(NonLiving)allocate.invoke(unsafe,NonLiving.class);e.d=d;entity=e;} + entity.verticalCollision=f.get("vertical").getAsBoolean();entity.verticalCollisionBelow=f.get("below").getAsBoolean();entity.fallDistance=number(f.get("fall"));entity.syncPosition=f.get("sync").getAsBoolean(); + var block=(BounceBlock)allocate.invoke(unsafe,BounceBlock.class);block.d=d;var state=(State)allocate.invoke(unsafe,State.class);state.d=d;state.block=block; + try{method.invoke(entity,state,f.get("x").getAsBoolean(),f.get("z").getAsBoolean(),vector(f.get("resolved")));out.println("result ok");} + catch(InvocationTargetException error){if(error.getCause() instanceof Stop)out.println("result error");else throw error;} + out.println(vectorText("final",d.velocity));out.println("sync "+entity.syncPosition);out.println("queries "+d.calls); + } + } + } +} diff --git a/tools/test_restitution_parity.py b/tools/test_restitution_parity.py new file mode 100644 index 000000000..78fd9b939 --- /dev/null +++ b/tools/test_restitution_parity.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python3 +"""Compare post-collision restitution, bounce callbacks and partial failure state with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + def bits(v):return struct.pack('>d',float(v)).hex() + def single(v):return struct.pack('>f',float(v)).hex() + def row(flags=31,entity=0,block=1,vy=-2,gravity=(0.08,0.08),suppress=(False,False),tag=False,drag=0.98,fail=-1,mutate=False,dx=0.3,dz=-0.2,resolved=-0.1): + return dict(x=bool(flags&1),z=bool(flags&2),vertical=bool(flags&4),below=bool(flags&8),living=bool(flags&16),sync=bool(flags&32), + entity=bits(entity),block=single(block),velocity=list(map(bits,[dx,vy,dz])),resolved=list(map(bits,[0,resolved,0])), + gravity=list(map(bits,gravity)),suppress=list(suppress),tag=tag,drag=single(drag),fail=fail,mutate=mutate,fall=bits(3.25)) + for flags in range(64): + for entity in [0,-0.0,0.5,1,-1,float('nan'),float('inf')]: + for block in [0,0.1,0.8,1,float('nan')]: + for suppress in [(False,False),(True,),(False,True)]: + for tag in [False,True]:yield row(flags,entity,block,vy=[-2,-0.08,0][flags%3],suppress=suppress,tag=tag) + for vy in [-float('inf'),-2,-math.nextafter(0.08,1),-0.08,-math.nextafter(0.08,0),-0.0,0,0.08,2,float('nan'),float('inf')]: + for gravity in [(0,0),(.08,.08),(.08,.3),(float('nan'),.08)]: + for flags in [4,12,15,31]: + for entity in [0,.5]: + for resolved in [0,-0.1,vy]:yield row(flags,entity,vy=vy,gravity=gravity,resolved=resolved) + for flags in [0,1,3,4,12,15,31,63]: + for fail in range(-1,17): + for mutate in [False,True]:yield row(flags,entity=.5,fail=fail,mutate=mutate) + rng=random.Random(0x5245535449545554) + for index in range(5000): + values=[-2,-.08,-0.0,0,.08,.5,1,2,float('nan'),float('inf'),-float('inf')] + yield row(rng.randrange(64),rng.choice(values),rng.choice(values),rng.choice(values),gravity=(rng.choice(values),rng.choice(values)), + suppress=(bool(rng.randrange(2)),bool(rng.randrange(2))),tag=bool(index%3==0),drag=rng.choice(values), + fail=rng.choice([-1,-1,-1,0,2,5,8,12]),mutate=bool(index%2),dx=rng.choice(values),dz=rng.choice(values),resolved=rng.choice(values)) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-restitution-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRestitutionOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/restitution_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaRestitutionOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','restitution_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('restitution_fixture.exe' if os.name=='nt' else 'restitution_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} restitution output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual Entity.restituteMovementAfterCollisions over living/nonliving snapshots and controlled block restitution/tag behavior. Compares horizontal/vertical bounce, effective-gravity threshold, nonliving float scaling, air-drag interpolation, signed zero/nonfinite values and ordered lazy queries. Bounce callbacks can change velocity and fail; final velocity and syncPosition are checked after every injected failure boundary. This does not establish registered block restitution/tag provisioning, actual bounce sound/game-event effects, Entity.move guard conditions, fall damage, grounding or full gameplay.'} + lab.write_json(report_path,report);print(f'Scoped restitution parity passed: {report_path}') + + +if __name__=='__main__':main() From 6101518b5e71a348f966155e8a87d4454ebefe10 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 00:30:53 +0200 Subject: [PATCH 070/253] Match supporting block selection and ground state transitions --- .../scan-regression.json | 211 +++++++++++++++ .../scoped-parity.json | 241 ++++++++++++++++++ .../examples/block_collision_scan_fixture.rs | 23 +- .../examples/ground_state_fixture.rs | 117 +++++++++ crates/horizon-world/src/ground_support.rs | 97 +++++++ crates/horizon-world/src/lib.rs | 1 + docs/collision-geometry.md | 21 ++ .../VanillaBlockCollisionScanOracle.java | 12 + .../parity/VanillaGroundStateOracle.java | 39 +++ tools/test_ground_support_parity.py | 100 ++++++++ 10 files changed, 861 insertions(+), 1 deletion(-) create mode 100644 benchmarks/rust-ground-support-2026-10-07/scan-regression.json create mode 100644 benchmarks/rust-ground-support-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/ground_state_fixture.rs create mode 100644 crates/horizon-world/src/ground_support.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaGroundStateOracle.java create mode 100644 tools/test_ground_support_parity.py diff --git a/benchmarks/rust-ground-support-2026-10-07/scan-regression.json b/benchmarks/rust-ground-support-2026-10-07/scan-regression.json new file mode 100644 index 000000000..42bde44e1 --- /dev/null +++ b/benchmarks/rust-ground-support-2026-10-07/scan-regression.json @@ -0,0 +1,211 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 4176, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockCollisionScanOracle.java": "7334a1f96bcf04cdf24e52424d2d805af2303da681705c2ee3235f74c3850b02", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceSupportOracle.java": "9ce939a435842867786fed648951bbe77f6ab843f6df09af15f3deb1948c4877", + "tools/test_block_collision_scan_parity.py": "5289ba6c555367d4dbfe7cbf8e577705c16a8426dfcc431c787aeed3e513970d", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "31abb34c77ebe15f1a00c4480178f6eefea861fc4f395cbeeeea15d9861af7b6", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "a5021a168adcedc37d77f533a8921c02f09c59f46a01737586aaa33c5908b8d0", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "8ac9e90fe899855036658afd862ff20c4dcd15d1bd3f92a763c4795fecf0549f", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/block_collision_scan_fixture.rs": "5dfc5b7e156481ac92c3daf8093272171e8fc6cb1970ca7879cd22f7c7b4aaef" + }, + "fixtures_sha256": { + ".local/rust-block-collision-scan-parity/inputs.txt": "d87e1a985430aab7a9fd77e6f3a70e4810d19241c74a9fe8c324348d5c0737dc" + }, + "rust_output_sha256": "f975369ad065b5417dbeacbfa554fc3f27ddaa4f2e634e57f5380e070b355d72", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "f975369ad065b5417dbeacbfa554fc3f27ddaa4f2e634e57f5380e070b355d72", + "matched_output_lines": 517820 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "f975369ad065b5417dbeacbfa554fc3f27ddaa4f2e634e57f5380e070b355d72", + "matched_output_lines": 517820 + } + ], + "scope": "Actual BlockCollisions cursor and selection algorithm over controlled block metadata, chunk providers and context shapes. Compares ordered chunk/state/suffocation/shape calls, missing-chunk retries, cached chunk reuse, face/edge/corner filtering, canonical full-block versus equal noncanonical shape behavior, exact emitted shape data, early consumer termination and injected provider failures. Finite bounded scans include thin/zero-size boxes, chunk crossings and wrapped integer positions. Registry-specific metadata/shape dispatch, live chunk loading and entity movement are separate integration work; unsupported cursor volumes and caller budgets use typed Rust errors." +} diff --git a/benchmarks/rust-ground-support-2026-10-07/scoped-parity.json b/benchmarks/rust-ground-support-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..2bc36cba6 --- /dev/null +++ b/benchmarks/rust-ground-support-2026-10-07/scoped-parity.json @@ -0,0 +1,241 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": { + "selection": 2799, + "state": 11216 + }, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockCollisionScanOracle.java": "7334a1f96bcf04cdf24e52424d2d805af2303da681705c2ee3235f74c3850b02", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaGroundStateOracle.java": "b66f4ea0c2a8f4fea73499841a4de41d3fa42de45ad699c6cef47be472d0e558", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceSupportOracle.java": "9ce939a435842867786fed648951bbe77f6ab843f6df09af15f3deb1948c4877", + "tools/test_ground_support_parity.py": "dc61b7e0a187bdce428d4105dcc30b2c9d5a2c4cba07929130ec79644dc825fd", + "tools/test_block_collision_scan_parity.py": "5289ba6c555367d4dbfe7cbf8e577705c16a8426dfcc431c787aeed3e513970d", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "31abb34c77ebe15f1a00c4480178f6eefea861fc4f395cbeeeea15d9861af7b6", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "a5021a168adcedc37d77f533a8921c02f09c59f46a01737586aaa33c5908b8d0", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "8ac9e90fe899855036658afd862ff20c4dcd15d1bd3f92a763c4795fecf0549f", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/block_collision_scan_fixture.rs": "5dfc5b7e156481ac92c3daf8093272171e8fc6cb1970ca7879cd22f7c7b4aaef", + "crates/horizon-world/examples/ground_state_fixture.rs": "74d55848842ea561a54226e302334c71598b61037877a729698c0f1fab1a72a9" + }, + "fixtures_sha256": { + ".local/rust-ground-support-parity/selection/inputs.txt": "75d3cfe0b18dcd520fd304e4c98f626d0c60eb2159300d13480f7f0efbec3ebd", + ".local/rust-ground-support-parity/state/inputs.txt": "e1c76cc6ad45610b1f7b1e2e22036a2d47783f6da58b85f80361bc34256aa434" + }, + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "results": [ + { + "group": "selection", + "matched_output_lines": 342709, + "output_sha256": "5b9cd5243a8284273de5f564284c7ce4669cd01d74eb5d58737afa77b8e4b283", + "rust_output_sha256": "5b9cd5243a8284273de5f564284c7ce4669cd01d74eb5d58737afa77b8e4b283" + }, + { + "group": "state", + "matched_output_lines": 151444, + "output_sha256": "fedac9d5408449d6a8fc400ed2625ad9a800f715ddcdb93ead13243297e3b497", + "rust_output_sha256": "fedac9d5408449d6a8fc400ed2625ad9a800f715ddcdb93ead13243297e3b497" + } + ] + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "results": [ + { + "group": "selection", + "matched_output_lines": 342709, + "output_sha256": "5b9cd5243a8284273de5f564284c7ce4669cd01d74eb5d58737afa77b8e4b283", + "rust_output_sha256": "5b9cd5243a8284273de5f564284c7ce4669cd01d74eb5d58737afa77b8e4b283" + }, + { + "group": "state", + "matched_output_lines": 151444, + "output_sha256": "fedac9d5408449d6a8fc400ed2625ad9a800f715ddcdb93ead13243297e3b497", + "rust_output_sha256": "fedac9d5408449d6a8fc400ed2625ad9a800f715ddcdb93ead13243297e3b497" + } + ] + } + ], + "scope": "Actual CollisionGetter.findSupportingBlock over controlled collision metadata/shapes/providers, plus Entity.checkSupportingBlock and both setOnGroundWithMovement overloads over sequential support-query snapshots. Selection compares nearest block-center distance, ties, full scan order and failures. Ground-state checks compare thin foot bounds, previous-horizontal-footprint fallback, null movement, retained/cleared support, flags and partial state on errors across mutation sequences. Registry/context scanning has separate integration coverage; live player grounding, movement lifecycle and gameplay remain pending." +} diff --git a/crates/horizon-world/examples/block_collision_scan_fixture.rs b/crates/horizon-world/examples/block_collision_scan_fixture.rs index cc52dc6ec..40fbd2182 100644 --- a/crates/horizon-world/examples/block_collision_scan_fixture.rs +++ b/crates/horizon-world/examples/block_collision_scan_fixture.rs @@ -4,7 +4,9 @@ use horizon_core::{ }; use horizon_world::{ block_collision_scan::{BlockCollisionScan, BlockCollisionWorld, CollisionBlock}, - collision_context::CollisionContext, + collision_context::{CollisionContext, CollisionEntity}, + entity_obstruction::EntityIdentity, + ground_support::find_supporting_block, registry::BlockStateId, }; use serde_json::Value; @@ -208,6 +210,25 @@ fn main() -> Result<(), Box> { Vec3::new(number(&v[0]), number(&v[1]), number(&v[2])), Vec3::new(number(&v[3]), number(&v[4]), number(&v[5])), ); + if let Some(p) = f.get("support_position") { + let position = Vec3::new(number(&p[0]), number(&p[1]), number(&p[2])); + let context = CollisionContext::for_entity( + CollisionEntity { + identity: EntityIdentity(1), + y: position.y, + descending: false, + main_hand: None, + }, + false, + ); + match find_supporting_block(&mut world, context, position, bounds, 1_000_000) { + Ok(Some(p)) => writeln!(out.borrow_mut(), "support {} {} {}", p.x, p.y, p.z)?, + Ok(None) => writeln!(out.borrow_mut(), "support none")?, + Err(_) => writeln!(out.borrow_mut(), "support error")?, + } + writeln!(out.borrow_mut(), "done support {}", world.calls)?; + continue; + } let mut hits = 0; { let mut scan = BlockCollisionScan::new( diff --git a/crates/horizon-world/examples/ground_state_fixture.rs b/crates/horizon-world/examples/ground_state_fixture.rs new file mode 100644 index 000000000..7b41515b3 --- /dev/null +++ b/crates/horizon-world/examples/ground_state_fixture.rs @@ -0,0 +1,117 @@ +use horizon_core::{ + geometry::{Aabb, Axis, Vec3}, + position::BlockPos, +}; +use horizon_world::ground_support::GroundState; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn vector(v: &Value) -> Vec3 { + Vec3::new(number(&v[0]), number(&v[1]), number(&v[2])) +} +fn bits(v: f64) -> u64 { + if v.is_nan() { + 0x7ff8000000000000 + } else { + v.to_bits() + } +} +fn position(v: &Value) -> Option { + if v.is_null() { + None + } else { + Some(BlockPos::new( + v[0].as_i64().unwrap() as i32, + v[1].as_i64().unwrap() as i32, + v[2].as_i64().unwrap() as i32, + )) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let initial = &f["initial"]; + let mut state = GroundState { + on_ground: initial["grounded"].as_bool().unwrap(), + horizontal_collision: initial["horizontal"].as_bool().unwrap(), + on_ground_no_blocks: initial["empty"].as_bool().unwrap(), + supporting_block: position(&initial["support"]), + }; + for op in f["ops"].as_array().unwrap() { + let v = &op["box"]; + let bounds = Aabb::new( + Vec3::new(number(&v[0]), number(&v[1]), number(&v[2])), + Vec3::new(number(&v[3]), number(&v[4]), number(&v[5])), + ); + let movement = if op["movement"].is_null() { + None + } else { + Some(vector(&op["movement"])) + }; + let mut calls = 0i32; + let find = |b: Aabb| -> io::Result> { + writeln!( + out, + "find {:016x} {:016x} {:016x} {:016x} {:016x} {:016x}", + bits(b.min(Axis::X)), + bits(b.min(Axis::Y)), + bits(b.min(Axis::Z)), + bits(b.max(Axis::X)), + bits(b.max(Axis::Y)), + bits(b.max(Axis::Z)) + )?; + let call = calls; + calls += 1; + if call == op["fail"].as_i64().unwrap() as i32 { + return Err(io::Error::other("injected support query failure")); + } + Ok(position(&op["results"][call as usize])) + }; + let ground = op["grounded"].as_bool().unwrap(); + let result = match op["mode"].as_u64().unwrap() { + 0 => state.check_support(ground, bounds, movement, find), + 1 => state.set_with_movement( + ground, + state.horizontal_collision, + bounds, + movement, + find, + ), + 2 => state.set_with_movement( + ground, + op["horizontal"].as_bool().unwrap(), + bounds, + movement, + find, + ), + _ => panic!("unknown ground state mode"), + }; + writeln!( + out, + "result {}", + if result.is_ok() { "ok" } else { "error" } + )?; + writeln!( + out, + "flags {} {} {}", + state.on_ground, state.horizontal_collision, state.on_ground_no_blocks + )?; + if let Some(p) = state.supporting_block { + writeln!(out, "support {} {} {}", p.x, p.y, p.z)?; + } else { + writeln!(out, "support none")?; + } + writeln!(out, "queries {calls}")?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/src/ground_support.rs b/crates/horizon-world/src/ground_support.rs new file mode 100644 index 000000000..123332f0a --- /dev/null +++ b/crates/horizon-world/src/ground_support.rs @@ -0,0 +1,97 @@ +//! Supporting-block selection and Entity ground-state transitions. +use crate::{ + block_collision_scan::{BlockCollisionScan, BlockCollisionWorld, CollisionScanError}, + collision_context::CollisionContext, +}; +use horizon_core::{ + geometry::{Aabb, Axis, Vec3}, + position::BlockPos, +}; + +fn compare_positions(left: BlockPos, right: BlockPos) -> i32 { + // Vec3i.compareTo uses signed wrapping subtraction in Y/Z/X order. + if left.y != right.y { + left.y.wrapping_sub(right.y) + } else if left.z != right.z { + left.z.wrapping_sub(right.z) + } else { + left.x.wrapping_sub(right.x) + } +} +pub fn find_supporting_block( + world: &mut W, + context: CollisionContext<'_>, + entity_position: Vec3, + bounds: Aabb, + candidate_budget: usize, +) -> Result, CollisionScanError> { + let mut selected = None; + let mut closest = f64::MAX; + for hit in BlockCollisionScan::new(world, context, bounds, false, candidate_budget)? { + let p = hit?.position; + let dx = f64::from(p.x) + 0.5 - entity_position.x; + let dy = f64::from(p.y) + 0.5 - entity_position.y; + let dz = f64::from(p.z) + 0.5 - entity_position.z; + let distance = dx * dx + dy * dy + dz * dz; + if distance < closest + || distance == closest && selected.is_none_or(|old| compare_positions(old, p) < 0) + { + selected = Some(p); + closest = distance; + } + } + Ok(selected) +} +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +pub struct GroundState { + pub on_ground: bool, + pub horizontal_collision: bool, + pub on_ground_no_blocks: bool, + pub supporting_block: Option, +} +impl GroundState { + /// Entity.setOnGroundWithMovement writes these flags before support queries. + /// A failed query preserves any earlier writes, as in the native method. + pub fn set_with_movement( + &mut self, + on_ground: bool, + horizontal_collision: bool, + bounds: Aabb, + movement: Option, + find: impl FnMut(Aabb) -> Result, E>, + ) -> Result<(), E> { + self.on_ground = on_ground; + self.horizontal_collision = horizontal_collision; + self.check_support(on_ground, bounds, movement, find) + } + /// The optional movement is native's nullable movement argument. When the + /// first query misses, it can retry at the pre-horizontal-movement footprint. + pub fn check_support( + &mut self, + on_ground: bool, + bounds: Aabb, + movement: Option, + mut find: impl FnMut(Aabb) -> Result, E>, + ) -> Result<(), E> { + if on_ground { + let min = bounds.min_position(); + let max = bounds.max_position(); + let foot = Aabb::new( + Vec3::new(min.x, min.y - 1.0e-6, min.z), + Vec3::new(max.x, bounds.min(Axis::Y), max.z), + ); + let mut found = find(foot)?; + if found.is_some() || self.on_ground_no_blocks { + self.supporting_block = found; + } else if let Some(movement) = movement { + found = find(foot.move_by(Vec3::new(-movement.x, 0.0, -movement.z)))?; + self.supporting_block = found; + } + self.on_ground_no_blocks = found.is_none(); + } else { + self.on_ground_no_blocks = false; + self.supporting_block = None; + } + Ok(()) + } +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 02e769397..614aa2aa2 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -18,6 +18,7 @@ pub mod dynamic_support; pub mod entity_collision; pub mod entity_obstruction; pub mod fluid; +pub mod ground_support; pub mod heightmap; pub mod liquid_collision; pub mod movement_restitution; diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 6a1c5d52e..1bb915ef4 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -537,3 +537,24 @@ values, signed zero/nonfinite arithmetic, bounce callbacks that alter velocity, and failures before/after each side effect. Workspace Clippy passes. Registered block property/tag provisioning, actual bounce sounds/events, `Entity.move` guards, fall damage, grounding and full player simulation remain pending. + + +`find_supporting_block` now selects the nearest colliding block center using the +native distance arithmetic and wrapping Y/Z/X position tie-break. `GroundState` +implements the thin foot query, previous-horizontal-footprint fallback and both +ground/collision flag updates. Null movement preserves the prior support in the +native branch where no fallback query can run; query failures retain preceding +flag writes. + +`python3 tools/test_ground_support_parity.py` compares actual +`CollisionGetter.findSupportingBlock`, `Entity.checkSupportingBlock` and both +`setOnGroundWithMovement` overloads. The +[ground support report](../benchmarks/rust-ground-support-2026-10-07/scoped-parity.json) +records **342,709 selection lines and 151,444 state-transition lines per JAR**, +covering ties, nonfinite entity positions, missing chunks, query errors, nullable +movement and sequential changes of support. Shape/context snapshots are controlled; +registry-backed scanning has separate integration coverage. Workspace Clippy +passes. Full live entity movement, support-dependent effects and gameplay remain +pending. +The [shared scanner regression](../benchmarks/rust-ground-support-2026-10-07/scan-regression.json) +also passes with **517,820 matching lines per JAR** after extending its fixtures. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockCollisionScanOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockCollisionScanOracle.java index 6850b0e20..53002e6f0 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockCollisionScanOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockCollisionScanOracle.java @@ -21,10 +21,15 @@ public final class VanillaBlockCollisionScanOracle { public static class State extends BlockState { int id;boolean large,moving,suffocating;VoxelShape shape;Trace trace;BlockGetter readFrom; public State(){super(null,null,null);} + @Override public VoxelShape getCollisionShape(BlockGetter world,BlockPos p,CollisionContext context){if(world!=trace.global)throw new AssertionError("wrong collision world");trace.query("shape "+p.getX()+" "+p.getY()+" "+p.getZ()+" "+id);return shape;} @Override public Block getBlock(){return moving?Blocks.MOVING_PISTON:Blocks.STONE;} @Override public boolean hasLargeCollisionShape(){return large;} @Override public boolean isSuffocating(BlockGetter world,BlockPos p){if(world!=readFrom||world==trace.global)throw new AssertionError("wrong suffocation world");trace.query("suffocating "+p.getX()+" "+p.getY()+" "+p.getZ()+" "+id);return suffocating;} } + public static class SupportingEntity extends net.minecraft.world.entity.Marker { + public SupportingEntity(){super(null,null);} + @Override public boolean isDescending(){return false;} + } static VoxelShape shape(int index){return switch(index){ case 0->Shapes.empty();case 1->Shapes.block();case 2->Shapes.block().move(0,0,0); case 3->Shapes.box(0,0,0,1,0.5,1);case 4->Shapes.box(-0.25,-0.5,-0.25,1.25,1.5,1.25); @@ -36,6 +41,7 @@ public final class VanillaBlockCollisionScanOracle { public static void main(String[] args)throws Exception { net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); var allocator=Class.forName("sun.misc.Unsafe");var access=allocator.getDeclaredField("theUnsafe");access.setAccessible(true);var unsafe=access.get(null);var allocate=allocator.getMethod("allocateInstance",Class.class); + var entityPosition=net.minecraft.world.entity.Entity.class.getDeclaredField("position");entityPosition.setAccessible(true); var emit=VanillaFaceSupportOracle.class.getDeclaredMethod("emit",PrintWriter.class,VoxelShape.class);emit.setAccessible(true); Path dir=Path.of(args[1]); try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){ @@ -45,6 +51,7 @@ public final class VanillaBlockCollisionScanOracle { for(int i=0;i[]{CollisionGetter.class},(proxy,method,values)->{ + if(method.isDefault())return InvocationHandler.invokeDefault(proxy,method,values); if(!method.getName().equals("getChunkForCollisions"))throw new AssertionError(method); int cx=(int)values[0],cz=(int)values[1];trace.query("chunk "+cx+" "+cz); if(missing==1||missing==2&&((cx^cz)&1)!=0)return null; @@ -63,6 +70,11 @@ public final class VanillaBlockCollisionScanOracle { public VoxelShape getCollisionShape(BlockState state,CollisionGetter collision,BlockPos p){if(collision!=world)throw new AssertionError("wrong collision world");var s=(State)state;trace.query("shape "+p.getX()+" "+p.getY()+" "+p.getZ()+" "+s.id);return s.shape;} }; var v=f.getAsJsonArray("box");var box=new AABB(number(v.get(0)),number(v.get(1)),number(v.get(2)),number(v.get(3)),number(v.get(4)),number(v.get(5))); + if(f.has("support_position")){ + var entity=(SupportingEntity)allocate.invoke(unsafe,SupportingEntity.class);var pos=f.getAsJsonArray("support_position");entityPosition.set(entity,new Vec3(number(pos.get(0)),number(pos.get(1)),number(pos.get(2)))); + try{var support=world.findSupportingBlock(entity,box);if(support.isEmpty())out.println("support none");else{var p=support.get();out.println("support "+p.getX()+" "+p.getY()+" "+p.getZ());}}catch(Stop error){out.println("support error");} + out.println("done support "+trace.calls);continue; + } var scan=new BlockCollisions(world,context,box,f.get("suffocating").getAsBoolean(),(p,s)->{out.println("hit "+p.getX()+" "+p.getY()+" "+p.getZ());return s;}); int hits=0,limit=f.get("limit").getAsInt(); try{while(hits position(JsonElement v){if(v.isJsonNull())return Optional.empty();var a=v.getAsJsonArray();return Optional.of(new BlockPos(a.get(0).getAsInt(),a.get(1).getAsInt(),a.get(2).getAsInt()));} + static final class Level extends net.minecraft.server.level.ServerLevel { + JsonObject op;PrintWriter out;int calls; + private Level(){super(null,null,null,null,null,null,false,0L,List.of(),false);} + @Override public Optional findSupportingBlock(Entity entity,AABB b){out.printf("find %016x %016x %016x %016x %016x %016x%n",Double.doubleToLongBits(b.minX),Double.doubleToLongBits(b.minY),Double.doubleToLongBits(b.minZ),Double.doubleToLongBits(b.maxX),Double.doubleToLongBits(b.maxY),Double.doubleToLongBits(b.maxZ));int call=calls++;if(call==op.get("fail").getAsInt())throw new Stop();return position(op.getAsJsonArray("results").get(call));} + } + static final class Actor extends Marker {Actor(){super(null,null);}void configure(Level level){setLevel(level);}} + public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); + var allocator=Class.forName("sun.misc.Unsafe");var field=allocator.getDeclaredField("theUnsafe");field.setAccessible(true);var unsafe=field.get(null);var allocate=allocator.getMethod("allocateInstance",Class.class); + var ground=Entity.class.getDeclaredField("onGround");ground.setAccessible(true);var empty=Entity.class.getDeclaredField("onGroundNoBlocks");empty.setAccessible(true);var support=Entity.class.getDeclaredField("mainSupportingBlockPos");support.setAccessible(true); + var check=Entity.class.getDeclaredMethod("checkSupportingBlock",boolean.class,Vec3.class);check.setAccessible(true);Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){ + for(var line:(Iterable)lines::iterator){ + var f=JsonParser.parseString(line).getAsJsonObject();var initial=f.getAsJsonObject("initial");var level=(Level)allocate.invoke(unsafe,Level.class);level.out=out;var entity=(Actor)allocate.invoke(unsafe,Actor.class);entity.configure(level);ground.setBoolean(entity,initial.get("grounded").getAsBoolean());entity.horizontalCollision=initial.get("horizontal").getAsBoolean();empty.setBoolean(entity,initial.get("empty").getAsBoolean());support.set(entity,position(initial.get("support"))); + for(var value:f.getAsJsonArray("ops")){ + var op=value.getAsJsonObject();level.op=op;level.calls=0;var b=op.getAsJsonArray("box");entity.setBoundingBox(new AABB(number(b.get(0)),number(b.get(1)),number(b.get(2)),number(b.get(3)),number(b.get(4)),number(b.get(5))));Vec3 movement=op.get("movement").isJsonNull()?null:vector(op.get("movement"));boolean onGround=op.get("grounded").getAsBoolean(); + try{switch(op.get("mode").getAsInt()){case 0->check.invoke(entity,onGround,movement);case 1->entity.setOnGroundWithMovement(onGround,movement);case 2->entity.setOnGroundWithMovement(onGround,op.get("horizontal").getAsBoolean(),movement);default->throw new AssertionError();}out.println("result ok");} + catch(InvocationTargetException error){if(error.getCause() instanceof Stop)out.println("result error");else throw error;}catch(Stop error){out.println("result error");} + out.println("flags "+entity.onGround()+" "+entity.horizontalCollision+" "+empty.getBoolean(entity));var selected=(Optional)support.get(entity);if(selected.isEmpty())out.println("support none");else{var p=(BlockPos)selected.get();out.println("support "+p.getX()+" "+p.getY()+" "+p.getZ());}out.println("queries "+level.calls); + } + } + } + } +} diff --git a/tools/test_ground_support_parity.py b/tools/test_ground_support_parity.py new file mode 100644 index 000000000..967ac9a96 --- /dev/null +++ b/tools/test_ground_support_parity.py @@ -0,0 +1,100 @@ +#!/usr/bin/env python3 +"""Compare native supporting-block selection and ground-state transitions.""" +import json +import os +from pathlib import Path +import platform +import random +import struct +import subprocess +try: + from . import lab, test_rust_parity as base, test_block_collision_scan_parity as scans +except ImportError: + import lab + import test_rust_parity as base + import test_block_collision_scan_parity as scans + + +def bits(value):return struct.pack('>d',float(value)).hex() + + +def selection_corpus(): + for index,f in enumerate(scans.corpus()): + if f['suffocating']:continue + v=[struct.unpack('>d',bytes.fromhex(x))[0] for x in f['box']] + center=[(v[i]+v[i+3])/2 for i in range(3)] + positions=[center] + if index%17==0:positions += [[0,0,0],[0.5,0.5,0.5],[float('nan'),0,0],[float('inf'),0,0],[1e154,0,0]] + for p in positions:yield dict(f,support_position=list(map(bits,p))) + for shape in [1,3,4,6]: + for p in [[0,0,0],[0.5,0.5,0.5],[1,1,1],[-0.5,-0.5,-0.5]]: + for seed in range(6): + yield dict(box=list(map(bits,[-2,-2,-2,2,2,2])),palette=[[shape,True,True,True],[1,False,False,True]],suffocating=False,missing=0,fail=-1,limit=100000,seed=seed,support_position=list(map(bits,p))) + + +def state_corpus(): + def initial(flags):return dict(grounded=bool(flags&1),horizontal=bool(flags&2),empty=bool(flags&4),support=[17,-64,-33] if flags&8 else None) + def op(mode,grounded,horizontal,movement,results,fail,bounds=None): + return dict(mode=mode,grounded=grounded,horizontal=horizontal,movement=None if movement is None else list(map(bits,movement)),results=results,fail=fail,box=list(map(bits,bounds or [-.3,1,-.3,.3,2.8,.3]))) + for flags in range(16): + for mode in range(3): + for grounded in [False,True]: + for horizontal in [False,True]: + for movement in [None,[0,0,0],[.2,-.5,.3]]: + for first in [None,[1,2,3]]: + for second in [None,[-4,-5,-6]]: + for fail in [-1,0,1,2]:yield dict(initial=initial(flags),ops=[op(mode,grounded,horizontal,movement,[first,second],fail)]) + rng=random.Random(0x47524f554e445354) + points=[None,[0,0,0],[17,-64,-33],[2147483647,-2147483648,2147483647]] + choices=[-1,-0.0,0,1e-8,.3,1,1e16,float('nan')] + for _ in range(2000): + ops=[] + for _ in range(12): + low=[rng.choice(choices) for _ in range(3)];high=[v+rng.choice([0,1e-8,1e-6,.6,1.8]) for v in low] + movement=None if rng.randrange(3)==0 else [rng.choice(choices) for _ in range(3)] + ops.append(op(rng.randrange(3),bool(rng.randrange(2)),bool(rng.randrange(2)),movement,[rng.choice(points),rng.choice(points)],rng.choice([-1,-1,0,1,2]),[*low,*high])) + yield dict(initial=initial(rng.randrange(16)),ops=ops) + + +def main(): + lock,jars,libraries=base.verify_artifacts() + build=lab.LOCAL/'rust-ground-support-parity';build.mkdir(exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + oracle_dir=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity' + oracles=[oracle_dir/(name+'.java') for name in ['VanillaBlockCollisionScanOracle','VanillaGroundStateOracle','VanillaFaceSupportOracle']] + sources=[*oracles,Path(__file__),lab.ROOT/'tools/test_block_collision_scan_parity.py',lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock'] + for crate in ['horizon-core','horizon-world']:sources += [lab.ROOT/'crates'/crate/'Cargo.toml',*sorted((lab.ROOT/'crates'/crate/'src').rglob('*.rs'))] + names=['block_collision_scan_fixture','ground_state_fixture'] + sources += [lab.ROOT/'crates/horizon-world/examples'/(name+'.rs') for name in names] + tested=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True);dependencies=os.pathsep.join(map(str,libraries)) + def run(command,name): + with (build/(name+'.log')).open('w') as log:subprocess.run(list(map(str,command)),cwd=lab.ROOT,check=True,timeout=3600,stdout=log,stderr=subprocess.STDOUT) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependencies,'-d',classes,*oracles],'compile-java') + counts={};fixture_paths=[] + for name,corpus in [('selection',selection_corpus),('state',state_corpus)]: + directory=build/name;directory.mkdir(exist_ok=True);path=directory/'inputs.txt';count=0 + with path.open('w') as output: + for f in corpus():output.write(json.dumps(f,separators=(',',':'))+'\n');count+=1 + counts[name]=count;fixture_paths.append(path) + fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--locked','--release','-p','horizon-world','--example',names[0],'--example',names[1]],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--locked','--no-deps','--format-version','1'],cwd=lab.ROOT)) + for group,name in zip(['selection','state'],names): + binary=Path(metadata['target_directory'])/'release/examples'/(name+'.exe' if os.name=='nt' else name);run([binary,build/group],'rust-'+group) + references=[] + for side,jar in jars.items(): + results=[] + for group,oracle in zip(['selection','state'],['VanillaBlockCollisionScanOracle','VanillaGroundStateOracle']): + directory=build/group + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jar),dependencies]),'dev.horizonlab.parity.'+oracle,side,directory],side+'-'+group) + reference=directory/(side+'.txt');matched=base.compare(reference,directory/'rust.txt') + results.append(dict(group=group,matched_output_lines=matched,output_sha256=lab.digest(reference,'sha256'),rust_output_sha256=lab.digest(directory/'rust.txt','sha256'))) + print(f'{side}: {matched:,} ground-{group} lines match',flush=True) + references.append(dict(side=side,jar_sha256=lab.digest(jar,'sha256'),results=results)) + base.ensure_sources_unchanged(sources,tested);base.ensure_sources_unchanged(fixture_paths,fixtures) + report=dict(schema=1,minecraft=lock['minecraft']['version'],manifest_sha1=lock['minecraft']['manifest_sha1'],platform=platform.platform(),java=subprocess.check_output(['java','--version'],text=True).splitlines()[0],rustc=subprocess.check_output(['rustc','--version'],text=True).strip(),fixtures=counts,sources_sha256=tested,fixtures_sha256=fixtures,references=references,scope='Actual CollisionGetter.findSupportingBlock over controlled collision metadata/shapes/providers, plus Entity.checkSupportingBlock and both setOnGroundWithMovement overloads over sequential support-query snapshots. Selection compares nearest block-center distance, ties, full scan order and failures. Ground-state checks compare thin foot bounds, previous-horizontal-footprint fallback, null movement, retained/cleared support, flags and partial state on errors across mutation sequences. Registry/context scanning has separate integration coverage; live player grounding, movement lifecycle and gameplay remain pending.') + lab.write_json(report_path,report);print(f'Scoped ground support parity passed: {report_path}',flush=True) + + +if __name__=='__main__':main() From d78565ab063f8cc18d737cb8376e773ae0d4ca32 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 00:38:02 +0200 Subject: [PATCH 071/253] Match support-dependent movement positions and block factors --- .../scoped-parity.json | 211 ++++++++++++++++++ .../examples/movement_support_fixture.rs | 149 +++++++++++++ crates/horizon-world/src/lib.rs | 1 + crates/horizon-world/src/movement_support.rs | 95 ++++++++ docs/collision-geometry.md | 16 ++ .../parity/VanillaMovementSupportOracle.java | 61 +++++ tools/test_movement_support_parity.py | 75 +++++++ 7 files changed, 608 insertions(+) create mode 100644 benchmarks/rust-movement-support-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/movement_support_fixture.rs create mode 100644 crates/horizon-world/src/movement_support.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMovementSupportOracle.java create mode 100644 tools/test_movement_support_parity.py diff --git a/benchmarks/rust-movement-support-2026-10-07/scoped-parity.json b/benchmarks/rust-movement-support-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..b2d933324 --- /dev/null +++ b/benchmarks/rust-movement-support-2026-10-07/scoped-parity.json @@ -0,0 +1,211 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 12392, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMovementSupportOracle.java": "64fa67e3b56e41baaa7e858eada1c640b28f22f2d1908729c434ef366b17eb0a", + "tools/test_movement_support_parity.py": "7e18f5b72b6160c0b9ba2ea1479ab718d4c068c0411926f146f0d3b7dc0a91c7", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "4656150b8935049b526c8342ef842cf1f691d13aeaf6429d3c9872810cc93254", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "a5021a168adcedc37d77f533a8921c02f09c59f46a01737586aaa33c5908b8d0", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "8ac9e90fe899855036658afd862ff20c4dcd15d1bd3f92a763c4795fecf0549f", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/movement_support_fixture.rs": "e43fdcebf23d39fb072c9d81a812fbc2b51dfd45501f0ed697250e44d47fc639" + }, + "fixtures_sha256": { + ".local/rust-movement-support-parity/inputs.txt": "4bc148e12dee21d1fd4ff0704cd8968491bfa9f1852541a828c15c32336e5b0c" + }, + "rust_output_sha256": "249eb9ea77c304c45bbcfd0e93d7f6066e5baad89b49197bf08db218f1d5f481", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "249eb9ea77c304c45bbcfd0e93d7f6066e5baad89b49197bf08db218f1d5f481", + "matched_output_lines": 51572 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "249eb9ea77c304c45bbcfd0e93d7f6066e5baad89b49197bf08db218f1d5f481", + "matched_output_lines": 51572 + } + ], + "scope": "Actual Entity.getOnPos(float), all three public support-position wrappers, getBlockJumpFactor and getBlockSpeedFactor. Controlled block providers vary fence/wall tags, gate type, water/bubble identities and float factors. Compares lazy query order, cached block position, support-coordinate retention, float offset widening, floor behavior, nonfinite inputs and failures. Jump queries the lower block unconditionally; speed can short-circuit. This does not establish registered movement property provisioning, LivingEntity movement efficiency, live entity storage or full gameplay." +} diff --git a/crates/horizon-world/examples/movement_support_fixture.rs b/crates/horizon-world/examples/movement_support_fixture.rs new file mode 100644 index 000000000..096559250 --- /dev/null +++ b/crates/horizon-world/examples/movement_support_fixture.rs @@ -0,0 +1,149 @@ +use horizon_core::{geometry::Vec3, position::BlockPos}; +use horizon_world::movement_support::{self as support, MovementBlockWorld, MovementLocation}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn single(v: &Value) -> f32 { + f32::from_bits(u32::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn position(v: &Value) -> BlockPos { + BlockPos::new( + v[0].as_i64().unwrap() as i32, + v[1].as_i64().unwrap() as i32, + v[2].as_i64().unwrap() as i32, + ) +} +struct World<'a> { + input: &'a Value, + out: &'a mut dyn Write, + calls: i64, + reads: usize, +} +impl World<'_> { + fn query(&mut self, text: String) -> io::Result<()> { + writeln!(self.out, "{text}")?; + let call = self.calls; + self.calls += 1; + if call == self.input["fail"].as_i64().unwrap() { + Err(io::Error::other("injected query failure")) + } else { + Ok(()) + } + } + fn flag(&self, id: usize, name: &str) -> bool { + self.input["states"][id][name].as_bool().unwrap() + } + fn predicate(&mut self, id: usize, name: &str) -> io::Result { + self.query(format!("{name} {id}"))?; + Ok(self.flag(id, name)) + } + fn factor(&mut self, id: usize, name: &str) -> io::Result { + self.query(format!("block {id}"))?; + if self.flag(id, "gate") { + return Ok(1.0); + } + self.query(format!("{name} {id}"))?; + Ok(single(&self.input["states"][id][name])) + } +} +impl MovementBlockWorld for World<'_> { + type Error = io::Error; + type State = usize; + fn block_state(&mut self, p: BlockPos) -> io::Result { + self.query(format!("state {} {} {}", p.x, p.y, p.z))?; + let id = self.reads % self.input["states"].as_array().unwrap().len(); + self.reads += 1; + Ok(id) + } + fn is_fence(&mut self, id: usize) -> io::Result { + self.predicate(id, "fence") + } + fn is_wall(&mut self, id: usize) -> io::Result { + self.predicate(id, "wall") + } + fn is_fence_gate(&mut self, id: usize) -> io::Result { + self.query(format!("block {id}"))?; + Ok(self.flag(id, "gate")) + } + fn is_water(&mut self, id: usize) -> io::Result { + self.predicate(id, "water") + } + fn is_bubble_column(&mut self, id: usize) -> io::Result { + self.predicate(id, "bubble") + } + fn jump_factor(&mut self, id: usize) -> io::Result { + self.factor(id, "jump") + } + fn speed_factor(&mut self, id: usize) -> io::Result { + self.factor(id, "speed") + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let p = &f["position"]; + let location = MovementLocation { + position: Vec3::new(number(&p[0]), number(&p[1]), number(&p[2])), + block_position: position(&f["cached"]), + supporting_block: if f["support"].is_null() { + None + } else { + Some(position(&f["support"])) + }, + }; + let mut world = World { + input: &f, + out: &mut out, + calls: 0, + reads: 0, + }; + let mode = f["mode"].as_u64().unwrap(); + if mode < 4 { + let offset = match mode { + 0 => single(&f["offset"]), + 1 => support::LEGACY_SUPPORT_OFFSET, + 2 => support::ON_SUPPORT_OFFSET, + 3 => support::MOVEMENT_SUPPORT_OFFSET, + _ => unreachable!(), + }; + match support::support_position( + &mut world, + location.position, + location.supporting_block, + offset, + ) { + Ok(p) => writeln!(world.out, "position {} {} {}", p.x, p.y, p.z)?, + Err(_) => writeln!(world.out, "error")?, + } + } else { + let result = if mode == 4 { + support::block_jump_factor(&mut world, location) + } else { + support::block_speed_factor(&mut world, location) + }; + match result { + Ok(factor) => writeln!( + world.out, + "factor {:08x}", + if factor.is_nan() { + 0x7fc00000 + } else { + factor.to_bits() + } + )?, + Err(_) => writeln!(world.out, "error")?, + } + } + writeln!(world.out, "queries {}", world.calls)?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 614aa2aa2..a82e33092 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -22,6 +22,7 @@ pub mod ground_support; pub mod heightmap; pub mod liquid_collision; pub mod movement_restitution; +pub mod movement_support; pub mod nbt; pub mod piston_shape; pub mod powder_snow_collision; diff --git a/crates/horizon-world/src/movement_support.rs b/crates/horizon-world/src/movement_support.rs new file mode 100644 index 000000000..d42f5d008 --- /dev/null +++ b/crates/horizon-world/src/movement_support.rs @@ -0,0 +1,95 @@ +//! Support-dependent block positions and Entity movement factors. +use horizon_core::{geometry::Vec3, position::BlockPos}; + +pub const LEGACY_SUPPORT_OFFSET: f32 = 0.2; +pub const MOVEMENT_SUPPORT_OFFSET: f32 = 0.500001; +pub const ON_SUPPORT_OFFSET: f32 = 1.0e-5; + +/// State handles must remain valid for the duration of a query. Tag predicates +/// are separate to preserve native short circuits and reloadable tag membership. +pub trait MovementBlockWorld { + type Error; + type State: Copy; + fn block_state(&mut self, position: BlockPos) -> Result; + fn is_fence(&mut self, state: Self::State) -> Result; + fn is_wall(&mut self, state: Self::State) -> Result; + fn is_fence_gate(&mut self, state: Self::State) -> Result; + fn is_water(&mut self, state: Self::State) -> Result; + fn is_bubble_column(&mut self, state: Self::State) -> Result; + fn jump_factor(&mut self, state: Self::State) -> Result; + fn speed_factor(&mut self, state: Self::State) -> Result; +} +#[derive(Clone, Copy, Debug)] +pub struct MovementLocation { + pub position: Vec3, + /// Entity.blockPosition's captured value; do not recompute it here. + pub block_position: BlockPos, + pub supporting_block: Option, +} +/// Entity.getOnPos(float). The offset is a float widened before subtraction. +pub fn support_position( + world: &mut W, + position: Vec3, + supporting_block: Option, + offset: f32, +) -> Result { + if let Some(support) = supporting_block { + if offset > ON_SUPPORT_OFFSET { + let block = world.block_state(support)?; + if (f64::from(offset) <= 0.5 && world.is_fence(block)?) + || world.is_wall(block)? + || world.is_fence_gate(block)? + { + return Ok(support); + } + Ok(BlockPos::new( + support.x, + (position.y - f64::from(offset)).floor() as i32, + support.z, + )) + } else { + Ok(support) + } + } else { + Ok(BlockPos::new( + position.x.floor() as i32, + (position.y - f64::from(offset)).floor() as i32, + position.z.floor() as i32, + )) + } +} +fn below( + world: &mut W, + location: MovementLocation, +) -> Result { + let position = support_position( + world, + location.position, + location.supporting_block, + MOVEMENT_SUPPORT_OFFSET, + )?; + world.block_state(position) +} +pub fn block_jump_factor( + world: &mut W, + location: MovementLocation, +) -> Result { + let current = world.block_state(location.block_position)?; + let current = world.jump_factor(current)?; + // Native always evaluates the lower block, even if current is not one. + let lower = below(world, location)?; + let lower = world.jump_factor(lower)?; + Ok(if current == 1.0 { lower } else { current }) +} +pub fn block_speed_factor( + world: &mut W, + location: MovementLocation, +) -> Result { + let current = world.block_state(location.block_position)?; + let factor = world.speed_factor(current)?; + if world.is_water(current)? || world.is_bubble_column(current)? || factor != 1.0 { + return Ok(factor); + } + let lower = below(world, location)?; + world.speed_factor(lower) +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 1bb915ef4..2df60e233 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -558,3 +558,19 @@ passes. Full live entity movement, support-dependent effects and gameplay remain pending. The [shared scanner regression](../benchmarks/rust-ground-support-2026-10-07/scan-regression.json) also passes with **517,820 matching lines per JAR** after extending its fixtures. + + +`movement_support` now implements support-dependent positions, the three public +offset variants and base-entity block jump/speed factors. It preserves the support +X/Z coordinates, conditional fence/wall/gate lookup, float-to-double offset +widening, cached entity block position and lazy block queries. Jump-factor lookup +always reads the lower block; speed lookup can short-circuit for water, bubble +columns or a non-unit current factor. + +`python3 tools/test_movement_support_parity.py` compares the actual native methods +with controlled state/tag/property snapshots. The +[movement support report](../benchmarks/rust-movement-support-2026-10-07/scoped-parity.json) +records **51,572 matching lines per JAR**, including float boundaries, nonfinite +positions/offsets/factors, tag/type short circuits and errors at every query. +Workspace Clippy passes. Registered movement-property provisioning, living-entity +efficiency and the full movement lifecycle remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMovementSupportOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMovementSupportOracle.java new file mode 100644 index 000000000..fe55429c2 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMovementSupportOracle.java @@ -0,0 +1,61 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*; +import java.lang.reflect.*; +import java.nio.file.*; +import java.util.*; +import net.minecraft.core.BlockPos; +import net.minecraft.tags.*; +import net.minecraft.world.entity.*; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.state.*; +import net.minecraft.world.phys.Vec3; +/** Native support positions and movement factors with traced world/tag queries. */ +public final class VanillaMovementSupportOracle { + static final class Stop extends RuntimeException {} + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + static float single(JsonElement v){return Float.intBitsToFloat(Integer.parseUnsignedInt(v.getAsString(),16));} + static BlockPos position(JsonElement v){var a=v.getAsJsonArray();return new BlockPos(a.get(0).getAsInt(),a.get(1).getAsInt(),a.get(2).getAsInt());} + static final class Data { + JsonObject input;PrintWriter out;int calls,reads; + void query(String text){out.println(text);if(calls++==input.get("fail").getAsInt())throw new Stop();} + } + static class FactorBlock extends Block { + Data d;int id;FactorBlock(){super(BlockBehaviour.Properties.of());} + @Override public float getJumpFactor(){d.query("jump "+id);return single(d.input.getAsJsonArray("states").get(id).getAsJsonObject().get("jump"));} + @Override public float getSpeedFactor(){d.query("speed "+id);return single(d.input.getAsJsonArray("states").get(id).getAsJsonObject().get("speed"));} + } + static class State extends BlockState { + Data d;int id;FactorBlock block;State(){super(null,null,null);} + boolean flag(String name){return d.input.getAsJsonArray("states").get(id).getAsJsonObject().get(name).getAsBoolean();} + @Override public Block getBlock(){d.query("block "+id);return flag("gate")?Blocks.OAK_FENCE_GATE:block;} + @Override public boolean is(TagKey tag){String name=tag==BlockTags.FENCES?"fence":tag==BlockTags.WALLS?"wall":null;if(name==null)throw new AssertionError(tag);d.query(name+" "+id);return flag(name);} + @Override public boolean is(Block block){String name=block==Blocks.WATER?"water":block==Blocks.BUBBLE_COLUMN?"bubble":null;if(name==null)throw new AssertionError(block);d.query(name+" "+id);return flag(name);} + } + static final class Level extends net.minecraft.server.level.ServerLevel { + Data d;State[] states; + private Level(){super(null,null,null,null,null,null,false,0L,List.of(),false);} + @Override public BlockState getBlockState(BlockPos p){d.query("state "+p.getX()+" "+p.getY()+" "+p.getZ());return states[d.reads++ % states.length];} + } + static final class Actor extends Marker { + Actor(){super(null,null);}void configure(Level level){setLevel(level);} + BlockPos cached; + @Override public BlockPos blockPosition(){return cached;} + BlockPos support(float offset){return getOnPos(offset);} + float jump(){return getBlockJumpFactor();}float speed(){return getBlockSpeedFactor();} + } + public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); + var allocator=Class.forName("sun.misc.Unsafe");var field=allocator.getDeclaredField("theUnsafe");field.setAccessible(true);var unsafe=field.get(null);var allocate=allocator.getMethod("allocateInstance",Class.class); + var support=Entity.class.getDeclaredField("mainSupportingBlockPos");support.setAccessible(true);var pos=Entity.class.getDeclaredField("position");pos.setAccessible(true);Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){ + for(var line:(Iterable)lines::iterator){ + var f=JsonParser.parseString(line).getAsJsonObject();var d=new Data();d.input=f;d.out=out;var level=(Level)allocate.invoke(unsafe,Level.class);level.d=d;level.states=new State[f.getAsJsonArray("states").size()]; + for(int i=0;ientity.support(single(f.get("offset")));case 1->entity.getOnPosLegacy();case 2->entity.getOnPos();case 3->entity.getBlockPosBelowThatAffectsMyMovement();default->throw new AssertionError();};out.printf("position %d %d %d%n",p.getX(),p.getY(),p.getZ());}else{float factor=mode==4?entity.jump():entity.speed();out.printf("factor %08x%n",Float.floatToIntBits(factor));}} + catch(Stop error){out.println("error");}out.println("queries "+d.calls); + } + } + } +} diff --git a/tools/test_movement_support_parity.py b/tools/test_movement_support_parity.py new file mode 100644 index 000000000..e055d2850 --- /dev/null +++ b/tools/test_movement_support_parity.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python3 +"""Compare support positions and Entity block movement factors with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + def bits(v):return struct.pack('>d',float(v)).hex() + def single(v):return struct.pack('>f',float(v)).hex() + def state(flags,jump=1,speed=1):return dict(fence=bool(flags&1),wall=bool(flags&2),gate=bool(flags&4),water=bool(flags&8),bubble=bool(flags&16),jump=single(jump),speed=single(speed)) + def row(mode=0,offset=0.2,position=(0.3,1.5,-0.3),support=(17,-64,-33),states=None,fail=-1): + return dict(mode=mode,offset=single(offset),position=list(map(bits,position)),cached=[23,75,-81],support=support,states=states or [state(0)],fail=fail) + offsets=[-float('inf'),-1,-0.0,0,1e-6,1e-5,struct.unpack('>f',bytes.fromhex('3727c5ad'))[0],0.2,0.5,0.500001,1,float('inf'),float('nan')] + coords=[-float('inf'),-2147483649,-64,-0.5,-0.0,0,0.2,0.5,0.500001,1,1.5,2147483648,float('inf'),float('nan')] + for flags in range(8): + for offset in offsets: + for y in coords: + for support in [None,[17,-64,-33]]:yield row(offset=offset,position=(y,y,-y),support=support,states=[state(flags)]) + for mode in range(1,6): + for flags in range(32): + for support in [None,[17,-64,-33]]: + for factor in [-1,-0.0,0,0.4,1,2,float('nan'),float('inf')]: + yield row(mode=mode,support=support,states=[state(flags,factor,factor),state(flags^7,.8,.6),state(0,.25,.125)]) + for mode in [0,3,4,5]: + for flags in range(32): + for fail in range(-1,14):yield row(mode=mode,states=[state(flags),state(flags^7,.8,.6),state(0,.25,.125)],fail=fail) + rng=random.Random(0x535550504f5254) + for _ in range(5000): + yield row(mode=rng.randrange(6),offset=rng.choice(offsets),position=[rng.choice(coords) for _ in range(3)],support=rng.choice([None,[17,-64,-33],[2147483647,-2147483648,2147483647]]),states=[state(rng.randrange(32),rng.choice([0,.5,1,2]),rng.choice([0,.5,1,2])) for _ in range(3)],fail=rng.choice([-1,-1,-1,0,1,2,5,8,12])) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-movement-support-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMovementSupportOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/movement_support_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaMovementSupportOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','movement_support_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('movement_support_fixture.exe' if os.name=='nt' else 'movement_support_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} movement-support output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual Entity.getOnPos(float), all three public support-position wrappers, getBlockJumpFactor and getBlockSpeedFactor. Controlled block providers vary fence/wall tags, gate type, water/bubble identities and float factors. Compares lazy query order, cached block position, support-coordinate retention, float offset widening, floor behavior, nonfinite inputs and failures. Jump queries the lower block unconditionally; speed can short-circuit. This does not establish registered movement property provisioning, LivingEntity movement efficiency, live entity storage or full gameplay.'} + lab.write_json(report_path,report);print(f'Scoped movement support parity passed: {report_path}') + + +if __name__=='__main__':main() From 0a6c77781506fc842b146b301e0441c4b125baf1 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 00:43:56 +0200 Subject: [PATCH 072/253] Bind registered block movement properties and reloadable tags --- .../scoped-parity.json | 220 ++++++++++++++++++ .../examples/movement_registry_fixture.rs | 184 +++++++++++++++ crates/horizon-world/src/lib.rs | 1 + .../horizon-world/src/movement_properties.rs | 202 ++++++++++++++++ .../tests/movement_properties.rs | 144 ++++++++++++ docs/collision-geometry.md | 16 ++ .../parity/VanillaMovementRegistryOracle.java | 61 +++++ tools/test_movement_registry_parity.py | 87 +++++++ 8 files changed, 915 insertions(+) create mode 100644 benchmarks/rust-movement-registry-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/movement_registry_fixture.rs create mode 100644 crates/horizon-world/src/movement_properties.rs create mode 100644 crates/horizon-world/tests/movement_properties.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMovementRegistryOracle.java create mode 100644 tools/test_movement_registry_parity.py diff --git a/benchmarks/rust-movement-registry-2026-10-07/scoped-parity.json b/benchmarks/rust-movement-registry-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..038fb976e --- /dev/null +++ b/benchmarks/rust-movement-registry-2026-10-07/scoped-parity.json @@ -0,0 +1,220 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "registry_states": 35723, + "registry_blocks": 1286, + "fixtures": 648054, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMovementRegistryOracle.java": "49fcc1f4348a8e279dcb916ae149de8c97f15df54ff1a675826b7c6c3dda06d9", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_movement_registry_parity.py": "537dd0aa67e16d31e433351cf61820f5916bc8b98654deb45015e26df7639baa", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-world/examples/movement_registry_fixture.rs": "97640fdbacfc94464cec8904fe7b4e8b912e3160d91d40234d77eaa1d7ccd1a0", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "c81f2a9a49dd889333894af2498cd1b44c17932bd0d5df026f27346acd6b5436", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_properties.rs": "9c78bed0d30c8b9cfaa413b9b81b0bf94861605c13b26754e09b24e83d75a227", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "a5021a168adcedc37d77f533a8921c02f09c59f46a01737586aaa33c5908b8d0", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "8ac9e90fe899855036658afd862ff20c4dcd15d1bd3f92a763c4795fecf0549f", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f" + }, + "fixtures_sha256": { + ".local/rust-movement-registry-parity/inputs.txt": "9b94e30e101bf16b40a74685515b2ff3467c8bac92f6fcc4450c49789198f7a5", + ".local/rust-movement-registry-parity/registry-info.json": "58c9ad06a3b4af632e45a65d7fe2b930d0b05a5a17a490267dc3c7e98d9e23f7", + ".local/rust-movement-registry-parity/movement-properties.nbt": "4b5646cbb675025efc9ac6e24b024ac2edddfa6725eb8e158357beda622a3888", + ".local/rust-movement-registry-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-movement-registry-parity/tags.json": "5e1301e5a9abf7e4de93af5dae3a157e852dbdb4ea345c2eb626305a605d4f98" + }, + "rust_output_sha256": "81c05fbffc18b7eef6fbc778afbdb6032b782d1d245d900093a07efe7b7f7006", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "81c05fbffc18b7eef6fbc778afbdb6032b782d1d245d900093a07efe7b7f7006", + "matched_output_lines": 2300888 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "81c05fbffc18b7eef6fbc778afbdb6032b782d1d245d900093a07efe7b7f7006", + "matched_output_lines": 2300888 + } + ], + "scope": "Imports raw registered friction/speed/jump/bounce/fall-distance coefficients and fence-gate type; binds resolved fence/wall/bounce-suppression tags. Actual native getters independently verify every state. Entity support positions and jump/speed factors run every registered state with natural, empty and universal tags; additional mixed-block queries, null support and failures exercise lazy behavior. Does not establish live player travel, bounce effects or full gameplay." +} diff --git a/crates/horizon-world/examples/movement_registry_fixture.rs b/crates/horizon-world/examples/movement_registry_fixture.rs new file mode 100644 index 000000000..a04f5c124 --- /dev/null +++ b/crates/horizon-world/examples/movement_registry_fixture.rs @@ -0,0 +1,184 @@ +use horizon_core::{geometry::Vec3, position::BlockPos}; +use horizon_world::movement_support::{self as support, MovementLocation}; +use horizon_world::{ + movement_properties::{ + MovementBlockProvider, MovementProperties, MovementTags, RegistryMovementWorld, + }, + nbt::{self, Limits, Tag}, + registry::{BlockRegistry, BlockStateId}, + worldgen::tags::TagDefinitions, +}; +use serde_json::Value; +use std::collections::{BTreeMap, BTreeSet}; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn single(v: &Value) -> f32 { + f32::from_bits(u32::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn position(v: &Value) -> BlockPos { + BlockPos::new( + v[0].as_i64().unwrap() as i32, + v[1].as_i64().unwrap() as i32, + v[2].as_i64().unwrap() as i32, + ) +} +struct World<'a> { + input: &'a Value, + out: &'a mut dyn Write, + calls: i64, +} +impl MovementBlockProvider for World<'_> { + type Error = io::Error; + fn movement_block_state(&mut self, p: BlockPos) -> io::Result { + writeln!(self.out, "state {} {} {}", p.x, p.y, p.z)?; + let call = self.calls; + self.calls += 1; + if call == self.input["fail"].as_i64().unwrap() { + return Err(io::Error::other("injected block read failure")); + } + let states = self.input["states"].as_array().unwrap(); + Ok(BlockStateId( + states[call as usize % states.len()].as_u64().unwrap() as u32, + )) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + let read = |name: &str| -> Result> { + Ok( + nbt::read_named(&fs::read(dir.join(name))?, Limits::default())? + .0 + .tag, + ) + }; + let registry = BlockRegistry::from_nbt(&read("block-registry.nbt")?)?; + let data = read("movement-properties.nbt")?; + let properties = MovementProperties::from_nbt(&data, ®istry)?; + let resources: BTreeMap = + serde_json::from_str(&fs::read_to_string(dir.join("tags.json"))?)?; + let mut tags = TagDefinitions::default(); + for (name, json) in resources { + tags.apply_json(&name, "vanilla", &json)?; + } + let built = tags.build(|name, _| registry.default_state(name).map(|_| name.to_owned()))?; + assert!(built.missing.is_empty()); + let members = |name: &str| -> BTreeSet { + built.tags.get(name).unwrap().iter().cloned().collect() + }; + let natural = MovementTags { + fences: members("minecraft:fences"), + walls: members("minecraft:walls"), + suppresses_bounce: members("minecraft:suppresses_bounce"), + }; + let all: BTreeSet = (0..registry.len()) + .map(|id| { + registry + .state(BlockStateId(id as u32)) + .unwrap() + .name + .clone() + }) + .collect(); + let bindings = [ + properties.bind(&natural)?, + properties.bind(&MovementTags::default())?, + properties.bind(&MovementTags { + fences: all.clone(), + walls: all.clone(), + suppresses_bounce: all, + })?, + ]; + assert!( + bindings[0] + .get(BlockStateId(registry.len() as u32)) + .is_err() + ); + for id in 0..registry.len() { + let s = bindings[0].get(BlockStateId(id as u32))?; + let c = s.coefficients; + writeln!( + out, + "properties {id} {:08x} {:08x} {:08x} {:08x} {:08x} {} {} {} {} {} {}", + c.friction.to_bits(), + c.speed_factor.to_bits(), + c.jump_factor.to_bits(), + c.bounce_restitution.to_bits(), + c.fall_distance_reduction.to_bits(), + c.fence_gate, + s.fence, + s.wall, + s.suppresses_bounce, + s.water, + s.bubble_column + )?; + } + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let p = &f["position"]; + let location = MovementLocation { + position: Vec3::new(number(&p[0]), number(&p[1]), number(&p[2])), + block_position: position(&f["cached"]), + supporting_block: if f["support"].is_null() { + None + } else { + Some(position(&f["support"])) + }, + }; + let mut world = World { + input: &f, + out: &mut out, + calls: 0, + }; + let mut bound = RegistryMovementWorld { + properties: &bindings[f["tags"].as_u64().unwrap() as usize], + world: &mut world, + }; + let mode = f["mode"].as_u64().unwrap(); + if mode < 4 { + let offset = match mode { + 0 => single(&f["offset"]), + 1 => support::LEGACY_SUPPORT_OFFSET, + 2 => support::ON_SUPPORT_OFFSET, + 3 => support::MOVEMENT_SUPPORT_OFFSET, + _ => unreachable!(), + }; + match support::support_position( + &mut bound, + location.position, + location.supporting_block, + offset, + ) { + Ok(p) => writeln!(world.out, "position {} {} {}", p.x, p.y, p.z)?, + Err(_) => writeln!(world.out, "error")?, + } + } else { + let result = if mode == 4 { + support::block_jump_factor(&mut bound, location) + } else { + support::block_speed_factor(&mut bound, location) + }; + match result { + Ok(factor) => writeln!( + world.out, + "factor {:08x}", + if factor.is_nan() { + 0x7fc00000 + } else { + factor.to_bits() + } + )?, + Err(_) => writeln!(world.out, "error")?, + } + } + writeln!(world.out, "queries {}", world.calls)?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index a82e33092..6f93ab394 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -21,6 +21,7 @@ pub mod fluid; pub mod ground_support; pub mod heightmap; pub mod liquid_collision; +pub mod movement_properties; pub mod movement_restitution; pub mod movement_support; pub mod nbt; diff --git a/crates/horizon-world/src/movement_properties.rs b/crates/horizon-world/src/movement_properties.rs new file mode 100644 index 000000000..0b4b673ac --- /dev/null +++ b/crates/horizon-world/src/movement_properties.rs @@ -0,0 +1,202 @@ +//! Registry-bound block movement coefficients, identities and reloadable tags. +use crate::{ + DATA_VERSION, + chunk::BlockState, + compression::invalid, + movement_support::MovementBlockWorld, + nbt::Tag, + registry::{BlockRegistry, BlockStateId}, +}; +use horizon_core::position::BlockPos; +use std::{ + collections::{BTreeMap, BTreeSet}, + fmt, io, +}; + +#[derive(Clone, Copy, Debug)] +pub struct MovementCoefficients { + pub friction: f32, + pub speed_factor: f32, + pub jump_factor: f32, + pub bounce_restitution: f32, + pub fall_distance_reduction: f32, + pub fence_gate: bool, +} +#[derive(Clone, Copy, Debug)] +pub struct MovementBlock { + pub coefficients: MovementCoefficients, + pub fence: bool, + pub wall: bool, + pub suppresses_bounce: bool, + pub water: bool, + pub bubble_column: bool, +} +#[derive(Default)] +pub struct MovementTags { + pub fences: BTreeSet, + pub walls: BTreeSet, + pub suppresses_bounce: BTreeSet, +} +/// Definitions are private version-specific data; no runtime Java is required. +pub struct MovementProperties<'r> { + registry: &'r BlockRegistry, + definitions: BTreeMap, +} +impl<'r> MovementProperties<'r> { + pub fn from_nbt(tag: &Tag, registry: &'r BlockRegistry) -> io::Result { + if tag.get("DataVersion") != Some(&Tag::Int(DATA_VERSION)) { + return Err(invalid("movement properties DataVersion mismatch")); + } + let Some(Tag::List(states)) = tag.get("states") else { + return Err(invalid("missing movement state identities")); + }; + if states.len() != registry.len() { + return Err(invalid("movement registry size mismatch")); + } + for (id, state) in states.iter().enumerate() { + if registry.state(BlockStateId(id as u32)) != Some(&BlockState::from_nbt(state)?) { + return Err(invalid("movement state identities differ")); + } + } + let Some(Tag::Compound(blocks)) = tag.get("blocks") else { + return Err(invalid("missing movement definitions")); + }; + let mut definitions = BTreeMap::new(); + for (name, properties) in blocks { + let name = name.to_string().map_err(|e| invalid(e.to_string()))?; + if registry.default_state(&name).is_none() { + return Err(invalid("unknown movement definition")); + } + let float = |key: &str| -> io::Result { + match properties.get(key) { + Some(Tag::Float(bits)) => Ok(f32::from_bits(*bits)), + _ => Err(invalid(format!("missing or invalid movement {key}"))), + } + }; + let fence_gate = match properties.get("fenceGate") { + Some(Tag::Byte(0)) => false, + Some(Tag::Byte(1)) => true, + _ => return Err(invalid("invalid movement gate identity")), + }; + definitions.insert( + name, + MovementCoefficients { + friction: float("friction")?, + speed_factor: float("speedFactor")?, + jump_factor: float("jumpFactor")?, + bounce_restitution: float("bounceRestitution")?, + fall_distance_reduction: float("fallDistanceReduction")?, + fence_gate, + }, + ); + } + for id in 0..registry.len() { + if !definitions.contains_key(®istry.state(BlockStateId(id as u32)).unwrap().name) { + return Err(invalid("missing movement definition")); + } + } + Ok(Self { + registry, + definitions, + }) + } + /// Bind again when tags reload; existing bindings retain their old snapshot. + pub fn bind(&self, tags: &MovementTags) -> io::Result { + for name in tags + .fences + .iter() + .chain(&tags.walls) + .chain(&tags.suppresses_bounce) + { + if self.registry.default_state(name).is_none() { + return Err(invalid("unknown movement tag member")); + } + } + let states = (0..self.registry.len()) + .map(|id| { + let name = &self.registry.state(BlockStateId(id as u32)).unwrap().name; + MovementBlock { + coefficients: self.definitions[name], + fence: tags.fences.contains(name), + wall: tags.walls.contains(name), + suppresses_bounce: tags.suppresses_bounce.contains(name), + water: name == "minecraft:water", + bubble_column: name == "minecraft:bubble_column", + } + }) + .collect(); + Ok(BoundMovementProperties { states }) + } +} +pub struct BoundMovementProperties { + states: Vec, +} +impl BoundMovementProperties { + pub fn get(&self, state: BlockStateId) -> io::Result { + self.states + .get(state.0 as usize) + .copied() + .ok_or_else(|| invalid("movement state outside registry")) + } +} +pub trait MovementBlockProvider { + type Error; + fn movement_block_state(&mut self, position: BlockPos) -> Result; +} +#[derive(Debug)] +pub enum MovementBlockError { + Data(io::Error), + World(E), +} +impl fmt::Display for MovementBlockError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::Data(e) => e.fmt(f), + Self::World(e) => e.fmt(f), + } + } +} +impl std::error::Error for MovementBlockError { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + Some(match self { + Self::Data(e) => e, + Self::World(e) => e, + }) + } +} +pub struct RegistryMovementWorld<'a, W> { + pub properties: &'a BoundMovementProperties, + pub world: &'a mut W, +} +impl MovementBlockWorld for RegistryMovementWorld<'_, W> { + type Error = MovementBlockError; + type State = MovementBlock; + fn block_state(&mut self, p: BlockPos) -> Result { + let state = self + .world + .movement_block_state(p) + .map_err(MovementBlockError::World)?; + self.properties.get(state).map_err(MovementBlockError::Data) + } + fn is_fence(&mut self, s: MovementBlock) -> Result { + Ok(s.fence) + } + fn is_wall(&mut self, s: MovementBlock) -> Result { + Ok(s.wall) + } + fn is_fence_gate(&mut self, s: MovementBlock) -> Result { + Ok(s.coefficients.fence_gate) + } + fn is_water(&mut self, s: MovementBlock) -> Result { + Ok(s.water) + } + fn is_bubble_column(&mut self, s: MovementBlock) -> Result { + Ok(s.bubble_column) + } + fn jump_factor(&mut self, s: MovementBlock) -> Result { + Ok(s.coefficients.jump_factor) + } + fn speed_factor(&mut self, s: MovementBlock) -> Result { + Ok(s.coefficients.speed_factor) + } +} diff --git a/crates/horizon-world/tests/movement_properties.rs b/crates/horizon-world/tests/movement_properties.rs new file mode 100644 index 000000000..e6e84bdc4 --- /dev/null +++ b/crates/horizon-world/tests/movement_properties.rs @@ -0,0 +1,144 @@ +use horizon_core::position::BlockPos; +use horizon_world::{ + DATA_VERSION, + movement_properties::{ + MovementBlockError, MovementBlockProvider, MovementProperties, MovementTags, + RegistryMovementWorld, + }, + movement_support::MovementBlockWorld, + nbt::Tag, + registry::{BlockRegistry, BlockStateId}, +}; +fn fixture() -> (Tag, Tag) { + let states = Tag::List(vec![ + Tag::String("minecraft:stone".into()), + Tag::String("minecraft:water".into()), + ]); + let registry = Tag::compound([ + ("DataVersion", Tag::Int(DATA_VERSION)), + ("states", states.clone()), + ( + "defaults", + Tag::compound([ + ("minecraft:stone", Tag::Int(0)), + ("minecraft:water", Tag::Int(1)), + ]), + ), + ]); + let definition = Tag::compound([ + ("friction", Tag::Float(0.6f32.to_bits())), + ("speedFactor", Tag::Float((-0.0f32).to_bits())), + ("jumpFactor", Tag::Float(1f32.to_bits())), + ("bounceRestitution", Tag::Float(0)), + ("fallDistanceReduction", Tag::Float(0)), + ("fenceGate", Tag::Byte(0)), + ]); + let movement = Tag::compound([ + ("DataVersion", Tag::Int(DATA_VERSION)), + ("states", states), + ( + "blocks", + Tag::compound([ + ("minecraft:stone", definition.clone()), + ("minecraft:water", definition), + ]), + ), + ]); + (registry, movement) +} +#[test] +fn rejects_foreign_incomplete_and_malformed_definitions() { + let (r, valid) = fixture(); + let registry = BlockRegistry::from_nbt(&r).unwrap(); + for (key, value) in [ + ("DataVersion", Tag::Int(0)), + ("states", Tag::List(vec![])), + ( + "states", + Tag::List(vec![ + Tag::String("minecraft:water".into()), + Tag::String("minecraft:stone".into()), + ]), + ), + ("blocks", Tag::compound([] as [(&str, Tag); 0])), + ] { + let mut bad = valid.clone(); + *bad.get_mut(key).unwrap() = value; + assert!(MovementProperties::from_nbt(&bad, ®istry).is_err()); + } + for (key, value) in [("friction", Tag::Int(1)), ("fenceGate", Tag::Byte(2))] { + let mut bad = valid.clone(); + *bad.get_mut("blocks") + .unwrap() + .get_mut("minecraft:stone") + .unwrap() + .get_mut(key) + .unwrap() = value; + assert!(MovementProperties::from_nbt(&bad, ®istry).is_err()); + } + let mut bad = valid.clone(); + let Tag::Compound(blocks) = bad.get_mut("blocks").unwrap() else { + unreachable!() + }; + blocks.insert( + "minecraft:unknown".into(), + blocks.values().next().unwrap().clone(), + ); + assert!(MovementProperties::from_nbt(&bad, ®istry).is_err()); +} +#[test] +fn reloaded_tags_preserve_previous_binding_and_coefficients() { + let (r, data) = fixture(); + let registry = BlockRegistry::from_nbt(&r).unwrap(); + let properties = MovementProperties::from_nbt(&data, ®istry).unwrap(); + let empty = properties.bind(&MovementTags::default()).unwrap(); + let mut tags = MovementTags::default(); + tags.fences.insert("minecraft:stone".into()); + tags.suppresses_bounce.insert("minecraft:water".into()); + let changed = properties.bind(&tags).unwrap(); + assert!(!empty.get(BlockStateId(0)).unwrap().fence); + assert!(changed.get(BlockStateId(0)).unwrap().fence); + let water = changed.get(BlockStateId(1)).unwrap(); + assert!(water.water && water.suppresses_bounce); + assert_eq!( + water.coefficients.speed_factor.to_bits(), + (-0.0f32).to_bits() + ); + tags.walls.insert("minecraft:missing".into()); + assert!(properties.bind(&tags).is_err()); + assert!(empty.get(BlockStateId(2)).is_err()); +} +#[test] +fn provider_errors_and_unknown_states_remain_distinct() { + struct Provider(bool); + impl MovementBlockProvider for Provider { + type Error = &'static str; + fn movement_block_state(&mut self, _: BlockPos) -> Result { + if self.0 { + Err("missing chunk") + } else { + Ok(BlockStateId(2)) + } + } + } + let (r, data) = fixture(); + let registry = BlockRegistry::from_nbt(&r).unwrap(); + let properties = MovementProperties::from_nbt(&data, ®istry) + .unwrap() + .bind(&MovementTags::default()) + .unwrap(); + let mut provider = Provider(true); + let mut world = RegistryMovementWorld { + properties: &properties, + world: &mut provider, + }; + assert!(matches!( + world.block_state(BlockPos::default()), + Err(MovementBlockError::World("missing chunk")) + )); + world.world.0 = false; + assert!(matches!( + world.block_state(BlockPos::default()), + Err(MovementBlockError::Data(_)) + )); +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 2df60e233..eb82372fc 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -574,3 +574,19 @@ records **51,572 matching lines per JAR**, including float boundaries, nonfinite positions/offsets/factors, tag/type short circuits and errors at every query. Workspace Clippy passes. Registered movement-property provisioning, living-entity efficiency and the full movement lifecycle remain pending. + + +`MovementProperties` imports version-bound raw friction, speed, jump, bounce and +fall-distance-reduction fields plus fence-gate type. `BoundMovementProperties` +binds resolved fence/wall/bounce-suppression tags; rebinding leaves previous +snapshots unchanged. `RegistryMovementWorld` connects real state IDs from a block +provider to the support-position and factor calculations, rejecting unknown IDs. + +`python3 tools/test_movement_registry_parity.py` independently checks native +property getters for every state, then runs actual entity support/factor queries +over all **35,723 states / 1,286 blocks** under normal, empty and universal tags. +Mixed-block scenes and failing providers check query order. The +[registered movement report](../benchmarks/rust-movement-registry-2026-10-07/scoped-parity.json) +records **2,300,888 matching lines per JAR**. Three import/binding tests and +workspace Clippy pass. This provisions movement data; full player travel, live +entity state and block bounce effects remain separate integration work. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMovementRegistryOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMovementRegistryOracle.java new file mode 100644 index 000000000..d25ff5d36 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMovementRegistryOracle.java @@ -0,0 +1,61 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*; +import java.lang.reflect.*; +import java.nio.file.*; +import java.util.*; +import net.minecraft.core.*; +import net.minecraft.core.registries.*; +import net.minecraft.nbt.*; +import net.minecraft.tags.*; +import net.minecraft.world.entity.*; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.state.*; +import net.minecraft.world.phys.Vec3; +/** Exports raw block fields; compares registered movement queries independently. */ +public final class VanillaMovementRegistryOracle { + static final class Stop extends RuntimeException {} + static final String[] PROPERTIES={"friction","speedFactor","jumpFactor","bounceRestitution","fallDistanceReduction"}; + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + static BlockPos position(JsonElement v){var a=v.getAsJsonArray();return new BlockPos(a.get(0).getAsInt(),a.get(1).getAsInt(),a.get(2).getAsInt());} + static void export(Path dir)throws Exception { + var fields=new Field[PROPERTIES.length];for(int i=0;i,List>>();var all=new ArrayList>(); + var tags=List.of(BlockTags.FENCES,BlockTags.WALLS,BlockTags.SUPPRESSES_BOUNCE); + for(var tag:tags){var values=new ArrayList>();for(var block:registry){if(block.defaultBlockState().is(tag))values.add(block.builtInRegistryHolder());}natural.put(tag,values);}for(var block:registry)all.add(block.builtInRegistryHolder()); + var allocator=Class.forName("sun.misc.Unsafe");var field=allocator.getDeclaredField("theUnsafe");field.setAccessible(true);var unsafe=field.get(null);var allocate=allocator.getMethod("allocateInstance",Class.class); + var support=Entity.class.getDeclaredField("mainSupportingBlockPos");support.setAccessible(true);var pos=Entity.class.getDeclaredField("position");pos.setAccessible(true); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){ + for(var state:Block.BLOCK_STATE_REGISTRY){var b=state.getBlock();out.printf("properties %d %08x %08x %08x %08x %08x %s %s %s %s %s %s%n",Block.getId(state),Float.floatToIntBits(b.getFriction()),Float.floatToIntBits(b.getSpeedFactor()),Float.floatToIntBits(b.getJumpFactor()),Float.floatToIntBits(b.getBounceRestitution()),Float.floatToIntBits(b.getFallDistanceReduction()),b instanceof FenceGateBlock,state.is(BlockTags.FENCES),state.is(BlockTags.WALLS),state.is(BlockTags.SUPPRESSES_BOUNCE),state.is(Blocks.WATER),state.is(Blocks.BUBBLE_COLUMN));} + int active=-1; + for(var line:(Iterable)lines::iterator){ + var f=JsonParser.parseString(line).getAsJsonObject();int tagMode=f.get("tags").getAsInt();if(active!=tagMode){var selected=new HashMap,List>>();for(var tag:tags)selected.put(tag,tagMode==0?natural.get(tag):tagMode==1?List.of():all);registry.prepareTagReload(new TagLoader.LoadResult<>(Registries.BLOCK,selected)).apply();active=tagMode;} + var level=(Level)allocate.invoke(unsafe,Level.class);level.input=f;level.out=out;var entity=(Actor)allocate.invoke(unsafe,Actor.class);entity.configure(level);entity.cached=position(f.get("cached"));support.set(entity,f.get("support").isJsonNull()?Optional.empty():Optional.of(position(f.get("support"))));var v=f.getAsJsonArray("position");pos.set(entity,new Vec3(number(v.get(0)),number(v.get(1)),number(v.get(2)))); + try{int mode=f.get("mode").getAsInt();if(mode<4){BlockPos p=switch(mode){case 0->entity.support(Float.intBitsToFloat(Integer.parseUnsignedInt(f.get("offset").getAsString(),16)));case 1->entity.getOnPosLegacy();case 2->entity.getOnPos();case 3->entity.getBlockPosBelowThatAffectsMyMovement();default->throw new AssertionError();};out.printf("position %d %d %d%n",p.getX(),p.getY(),p.getZ());}else{float factor=mode==4?entity.jump():entity.speed();out.printf("factor %08x%n",Float.floatToIntBits(factor));}} + catch(Stop error){out.println("error");}out.println("queries "+level.calls); + } + } + } +} diff --git a/tools/test_movement_registry_parity.py b/tools/test_movement_registry_parity.py new file mode 100644 index 000000000..c0a194b04 --- /dev/null +++ b/tools/test_movement_registry_parity.py @@ -0,0 +1,87 @@ +#!/usr/bin/env python3 +"""Compare registered movement properties, support positions and block factors with pinned vanilla.""" +import collections +import json +import os +from pathlib import Path +import platform +import subprocess +try: + from . import lab, test_rust_parity as base, test_worldgen_parity as worldgen +except ImportError: + import lab + import test_rust_parity as base + import test_worldgen_parity as worldgen + + +def corpus(info): + import struct + def bits(value):return struct.pack('>d',value).hex() + defaults=info['defaults'];stone=defaults['minecraft:stone'];honey=defaults['minecraft:honey_block'];soul=defaults['minecraft:soul_sand'] + def row(state,mode,tags=0,support=[17,-64,-33],fail=-1,others=None):return dict(states=[state,*(others or [honey,soul])],mode=mode,tags=tags,position=list(map(bits,[17.3,1.5,-33.3])),cached=[17,1,-34],support=support,offset='3f000000',fail=fail) + for tag in range(3): + for state in range(info['states']): + for mode in [0,1,2,3,4,5]:yield row(state,mode,tag) + for name in ['stone','water','bubble_column','soul_sand','honey_block','slime_block','oak_fence','cobblestone_wall','oak_fence_gate','ice','packed_ice','blue_ice','bedrock','white_bed']: + for mode in range(6): + for support in [None,[17,-64,-33]]: + for fail in range(-1,4): + for first in [stone,defaults['minecraft:'+name]]: + yield row(first,mode,tag,support,fail,[defaults['minecraft:'+name],soul]) + + +def main(): + lock, jars, libraries = base.verify_artifacts() + build = lab.LOCAL/'rust-movement-registry-parity';build.mkdir(exist_ok=True) + report_path = build/'report.json';report_path.unlink(missing_ok=True) + oracle = lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMovementRegistryOracle.java' + helpers = [oracle.with_name(name+'.java') for name in + ['VanillaHeightmapOracle']] + sources = [oracle, *helpers, Path(__file__), lab.ROOT/'tools/test_rust_parity.py', + lab.ROOT/'tools/test_worldgen_parity.py', lab.ROOT/'tools/lab.py', + lab.ROOT/'Cargo.toml', lab.ROOT/'Cargo.lock', + lab.ROOT/'crates/horizon-world/examples/movement_registry_fixture.rs'] + for crate in ['horizon-core', 'horizon-world']: + sources += [lab.ROOT/'crates'/crate/'Cargo.toml', + *sorted((lab.ROOT/'crates'/crate/'src').rglob('*.rs'))] + tested = base.source_hashes(sources) + tags = worldgen.tag_resources(jars['server']) + if tags != worldgen.tag_resources(jars['client']):raise AssertionError('Client/server block tags differ') + lab.write_json(build/'tags.json', tags) + classes = build/'classes';classes.mkdir(exist_ok=True) + dependencies = os.pathsep.join(map(str, libraries)) + def run(command, name): + with (build/(name+'.log')).open('w') as log: + subprocess.run(list(map(str, command)), cwd=lab.ROOT, check=True, timeout=3600, + stdout=log, stderr=subprocess.STDOUT) + run(['javac', '--release', lock['minecraft']['java_major'], '-proc:none', '-cp', + str(jars['server'])+os.pathsep+dependencies, '-d', classes, oracle, *helpers], 'compile-java') + def java(side, mode): + run(['java', '-Xmx768M', '-cp', os.pathsep.join([str(classes), str(jars[side]), dependencies]), + 'dev.horizonlab.parity.VanillaMovementRegistryOracle', mode, build], side+'-'+mode) + java('server', 'export') + facts = json.loads((build/'registry-info.json').read_text()) + if facts['states'] != 35723:raise AssertionError('Incomplete pinned registry') + count = 0 + with (build/'inputs.txt').open('w') as output: + for fixture in corpus(facts): + output.write(json.dumps(fixture, separators=(',', ':'))+'\n');count += 1 + fixture_paths = [build/name for name in ['inputs.txt', 'registry-info.json', 'movement-properties.nbt', + 'block-registry.nbt', 'tags.json']] + fixtures = base.source_hashes(fixture_paths) + run(['cargo', 'build', '--locked', '--release', '-p', 'horizon-world', '--example', 'movement_registry_fixture'], 'compile-rust') + metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--locked', '--no-deps', '--format-version', '1'], cwd=lab.ROOT)) + binary = Path(metadata['target_directory'])/'release/examples'/('movement_registry_fixture.exe' if os.name=='nt' else 'movement_registry_fixture') + run([binary, build], 'rust');references = [] + for side, jar in jars.items(): + java(side, side) + matched = base.compare(build/(side+'.txt'), build/'rust.txt') + references.append({'side':side, 'jar_sha256':lab.digest(jar, 'sha256'), + 'output_sha256':lab.digest(build/(side+'.txt'), 'sha256'), 'matched_output_lines':matched}) + print(f'{side}: {matched:,} suffocation and collision-metadata lines match', flush=True) + base.ensure_sources_unchanged(sources, tested);base.ensure_sources_unchanged(fixture_paths, fixtures) + report = dict(schema=1,minecraft=lock['minecraft']['version'],manifest_sha1=lock['minecraft']['manifest_sha1'],platform=platform.platform(),java=subprocess.check_output(['java','--version'],text=True).splitlines()[0],rustc=subprocess.check_output(['rustc','--version'],text=True).strip(),registry_states=facts['states'],registry_blocks=len(facts['defaults']),fixtures=count,sources_sha256=tested,fixtures_sha256=fixtures,rust_output_sha256=lab.digest(build/'rust.txt','sha256'),references=references,scope='Imports raw registered friction/speed/jump/bounce/fall-distance coefficients and fence-gate type; binds resolved fence/wall/bounce-suppression tags. Actual native getters independently verify every state. Entity support positions and jump/speed factors run every registered state with natural, empty and universal tags; additional mixed-block queries, null support and failures exercise lazy behavior. Does not establish live player travel, bounce effects or full gameplay.') + lab.write_json(report_path,report);print(f'Scoped movement registry parity passed: {report_path}',flush=True) + + +if __name__=='__main__':main() From f153c64ffef1b7f3c19cce966852f74549f3b5a9 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 00:47:39 +0200 Subject: [PATCH 073/253] Match per-tick piston movement accumulation and limits --- .../movement-registry-regression.json | 221 ++++++++++++++++++ .../scoped-parity.json | 213 +++++++++++++++++ .../examples/piston_movement_fixture.rs | 66 ++++++ crates/horizon-world/src/lib.rs | 1 + crates/horizon-world/src/piston_movement.rs | 50 ++++ docs/collision-geometry.md | 16 ++ .../parity/VanillaPistonMovementOracle.java | 31 +++ tools/test_movement_registry_parity.py | 2 +- tools/test_piston_movement_parity.py | 76 ++++++ 9 files changed, 675 insertions(+), 1 deletion(-) create mode 100644 benchmarks/rust-piston-movement-2026-10-07/movement-registry-regression.json create mode 100644 benchmarks/rust-piston-movement-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/piston_movement_fixture.rs create mode 100644 crates/horizon-world/src/piston_movement.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPistonMovementOracle.java create mode 100644 tools/test_piston_movement_parity.py diff --git a/benchmarks/rust-piston-movement-2026-10-07/movement-registry-regression.json b/benchmarks/rust-piston-movement-2026-10-07/movement-registry-regression.json new file mode 100644 index 000000000..c15b8ae5e --- /dev/null +++ b/benchmarks/rust-piston-movement-2026-10-07/movement-registry-regression.json @@ -0,0 +1,221 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "registry_states": 35723, + "registry_blocks": 1286, + "fixtures": 648054, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMovementRegistryOracle.java": "49fcc1f4348a8e279dcb916ae149de8c97f15df54ff1a675826b7c6c3dda06d9", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_movement_registry_parity.py": "a06e7e6bb194c4ac1476aaa8eadf1b31b7e5ebc18c01e02fa3011bb7ebe49a27", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-world/examples/movement_registry_fixture.rs": "97640fdbacfc94464cec8904fe7b4e8b912e3160d91d40234d77eaa1d7ccd1a0", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "c37ea9eb157c24d9c91eec8edfef652f12b9b6b4d7f64da5ad0179fe5259a674", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_properties.rs": "9c78bed0d30c8b9cfaa413b9b81b0bf94861605c13b26754e09b24e83d75a227", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "a5021a168adcedc37d77f533a8921c02f09c59f46a01737586aaa33c5908b8d0", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "8ac9e90fe899855036658afd862ff20c4dcd15d1bd3f92a763c4795fecf0549f", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f" + }, + "fixtures_sha256": { + ".local/rust-movement-registry-parity/inputs.txt": "9b94e30e101bf16b40a74685515b2ff3467c8bac92f6fcc4450c49789198f7a5", + ".local/rust-movement-registry-parity/registry-info.json": "58c9ad06a3b4af632e45a65d7fe2b930d0b05a5a17a490267dc3c7e98d9e23f7", + ".local/rust-movement-registry-parity/movement-properties.nbt": "4b5646cbb675025efc9ac6e24b024ac2edddfa6725eb8e158357beda622a3888", + ".local/rust-movement-registry-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-movement-registry-parity/tags.json": "5e1301e5a9abf7e4de93af5dae3a157e852dbdb4ea345c2eb626305a605d4f98" + }, + "rust_output_sha256": "81c05fbffc18b7eef6fbc778afbdb6032b782d1d245d900093a07efe7b7f7006", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "81c05fbffc18b7eef6fbc778afbdb6032b782d1d245d900093a07efe7b7f7006", + "matched_output_lines": 2300888 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "81c05fbffc18b7eef6fbc778afbdb6032b782d1d245d900093a07efe7b7f7006", + "matched_output_lines": 2300888 + } + ], + "scope": "Imports raw registered friction/speed/jump/bounce/fall-distance coefficients and fence-gate type; binds resolved fence/wall/bounce-suppression tags. Actual native getters independently verify every state. Entity support positions and jump/speed factors run every registered state with natural, empty and universal tags; additional mixed-block queries, null support and failures exercise lazy behavior. Does not establish live player travel, bounce effects or full gameplay." +} diff --git a/benchmarks/rust-piston-movement-2026-10-07/scoped-parity.json b/benchmarks/rust-piston-movement-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..e8725102d --- /dev/null +++ b/benchmarks/rust-piston-movement-2026-10-07/scoped-parity.json @@ -0,0 +1,213 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 5723, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPistonMovementOracle.java": "f20f5f0a7bb604c4b034cefaa9725cea29b650380aceb317a85f6e479dd4d4d6", + "tools/test_piston_movement_parity.py": "69425e452501ca63bab35d371e4afc29fef5e61f4aa7bfaacf8d2c36b04b108f", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "c37ea9eb157c24d9c91eec8edfef652f12b9b6b4d7f64da5ad0179fe5259a674", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_properties.rs": "9c78bed0d30c8b9cfaa413b9b81b0bf94861605c13b26754e09b24e83d75a227", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "a5021a168adcedc37d77f533a8921c02f09c59f46a01737586aaa33c5908b8d0", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "8ac9e90fe899855036658afd862ff20c4dcd15d1bd3f92a763c4795fecf0549f", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/piston_movement_fixture.rs": "88629fbf24e34822853cf10152e6e2d668cbb1267d530272a9dd178e03d65324" + }, + "fixtures_sha256": { + ".local/rust-piston-movement-parity/inputs.txt": "9bfb74b2783c96b1608390065f5e3e90c485fc79ed51bb9aff40c78ce526ebe4" + }, + "rust_output_sha256": "f2c7e4e5d146ffb382a5092a3b9eaab0395c2015d48a1e561ca8cbe3ee8d74dc", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "f2c7e4e5d146ffb382a5092a3b9eaab0395c2015d48a1e561ca8cbe3ee8d74dc", + "matched_output_lines": 325197 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "f2c7e4e5d146ffb382a5092a3b9eaab0395c2015d48a1e561ca8cbe3ee8d74dc", + "matched_output_lines": 325197 + } + ], + "scope": "Actual Entity.limitPistonMovement over sequential displacement and game-time snapshots. Compares lazy time queries, length and displacement thresholds, per-tick resets, first-nonzero-axis selection, clamped accumulation, signed zero/nonfinite values and state after injected time-query failures. This does not establish piston block event simulation, entity pushing, Entity.move guards or full gameplay." +} diff --git a/crates/horizon-world/examples/piston_movement_fixture.rs b/crates/horizon-world/examples/piston_movement_fixture.rs new file mode 100644 index 000000000..3c324aa00 --- /dev/null +++ b/crates/horizon-world/examples/piston_movement_fixture.rs @@ -0,0 +1,66 @@ +use horizon_core::geometry::Vec3; +use horizon_world::piston_movement::PistonMovement; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn vector(v: &Value) -> Vec3 { + Vec3::new(number(&v[0]), number(&v[1]), number(&v[2])) +} +fn bits(v: f64) -> u64 { + if v.is_nan() { + 0x7ff8000000000000 + } else { + v.to_bits() + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let d = vector(&f["deltas"]); + let mut state = PistonMovement { + game_time: f["time"].as_i64().unwrap(), + deltas: [d.x, d.y, d.z], + }; + for op in f["ops"].as_array().unwrap() { + let mut calls = 0; + let result = state.limit(vector(&op["movement"]), || -> io::Result { + writeln!(out, "time")?; + calls += 1; + if op["fail"].as_bool().unwrap() { + Err(io::Error::other("injected time failure")) + } else { + Ok(op["time"].as_i64().unwrap()) + } + }); + match result { + Ok(v) => writeln!( + out, + "movement {:016x} {:016x} {:016x}", + bits(v.x), + bits(v.y), + bits(v.z) + )?, + Err(_) => writeln!(out, "error")?, + } + writeln!( + out, + "deltas {:016x} {:016x} {:016x}", + bits(state.deltas[0]), + bits(state.deltas[1]), + bits(state.deltas[2]) + )?; + writeln!(out, "tick {}", state.game_time)?; + writeln!(out, "queries {calls}")?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 6f93ab394..3e36221aa 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -25,6 +25,7 @@ pub mod movement_properties; pub mod movement_restitution; pub mod movement_support; pub mod nbt; +pub mod piston_movement; pub mod piston_shape; pub mod powder_snow_collision; pub mod region; diff --git a/crates/horizon-world/src/piston_movement.rs b/crates/horizon-world/src/piston_movement.rs new file mode 100644 index 000000000..bf94ff87b --- /dev/null +++ b/crates/horizon-world/src/piston_movement.rs @@ -0,0 +1,50 @@ +//! Per-tick Entity piston movement accumulation and displacement limiting. +use horizon_core::geometry::Vec3; + +#[derive(Clone, Copy, Debug, Default, PartialEq)] +pub struct PistonMovement { + pub game_time: i64, + pub deltas: [f64; 3], +} +impl PistonMovement { + /// Native queries game time only after the length threshold. A failed time + /// query leaves this accumulator unchanged. Tiny motion passes + /// through before either the query or per-tick reset. + pub fn limit( + &mut self, + movement: Vec3, + game_time: impl FnOnce() -> Result, + ) -> Result { + let length = movement.x * movement.x + movement.y * movement.y + movement.z * movement.z; + if length <= 1.0e-7 { + return Ok(movement); + } + let time = game_time()?; + if self.game_time != time { + self.deltas = [0.0; 3]; + self.game_time = time; + } + for (axis, value) in [movement.x, movement.y, movement.z].into_iter().enumerate() { + if value != 0.0 { + let sum = value + self.deltas[axis]; + // Math.min in native Mth.clamp preserves NaN. + let next = if sum < -0.51 { + -0.51 + } else if sum.is_nan() { + sum + } else { + sum.min(0.51) + }; + let change = next - self.deltas[axis]; + self.deltas[axis] = next; + if change.abs() <= f64::from(1.0e-5f32) { + return Ok(Vec3::new(0.0, 0.0, 0.0)); + } + let mut result = [0.0; 3]; + result[axis] = change; + return Ok(Vec3::new(result[0], result[1], result[2])); + } + } + Ok(Vec3::new(0.0, 0.0, 0.0)) + } +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index eb82372fc..5365ffe48 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -590,3 +590,19 @@ Mixed-block scenes and failing providers check query order. The records **2,300,888 matching lines per JAR**. Three import/binding tests and workspace Clippy pass. This provisions movement data; full player travel, live entity state and block bounce effects remain separate integration work. + + +`PistonMovement` now accumulates displacement per axis and resets it when the +game tick changes. It preserves the initial squared-length short circuit, lazy +time lookup, first nonzero axis, the +/-0.51 cumulative clamp and float-derived +small-displacement threshold. A failed time lookup leaves the accumulator intact. + +`python3 tools/test_piston_movement_parity.py` runs actual +`Entity.limitPistonMovement` across sequential tick/push inputs. The +[piston movement report](../benchmarks/rust-piston-movement-2026-10-07/scoped-parity.json) +records **325,197 matching lines per JAR**, including repeated/opposing pushes, +threshold neighbors, signed zero, nonfinite inputs and injected failures. +Workspace Clippy passes. Piston block events, entity pushing and the surrounding +`Entity.move` lifecycle remain pending. +The [registered movement regression](../benchmarks/rust-piston-movement-2026-10-07/movement-registry-regression.json) +passes again with **2,300,888 lines per JAR** on the integrated sources. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPistonMovementOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPistonMovementOracle.java new file mode 100644 index 000000000..feb36cda5 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPistonMovementOracle.java @@ -0,0 +1,31 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*; +import java.lang.reflect.*; +import java.nio.file.*; +import java.util.*; +import net.minecraft.world.entity.*; +import net.minecraft.world.phys.Vec3; +/** Actual Entity piston limiter with sequential tick/movement inputs. */ +public final class VanillaPistonMovementOracle { + static final class Stop extends RuntimeException {} + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + static Vec3 vector(JsonElement v){var a=v.getAsJsonArray();return new Vec3(number(a.get(0)),number(a.get(1)),number(a.get(2)));} + static final class Level extends net.minecraft.server.level.ServerLevel { + JsonObject op;PrintWriter out;int calls; + private Level(){super(null,null,null,null,null,null,false,0L,List.of(),false);} + @Override public long getGameTime(){out.println("time");calls++;if(op.get("fail").getAsBoolean())throw new Stop();return op.get("time").getAsLong();} + } + static final class Actor extends Marker {Actor(){super(null,null);}void configure(Level level){setLevel(level);}Vec3 limit(Vec3 v){return limitPistonMovement(v);}} + public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); + var allocator=Class.forName("sun.misc.Unsafe");var field=allocator.getDeclaredField("theUnsafe");field.setAccessible(true);var unsafe=field.get(null);var allocate=allocator.getMethod("allocateInstance",Class.class); + var deltas=Entity.class.getDeclaredField("pistonDeltas");deltas.setAccessible(true);var time=Entity.class.getDeclaredField("pistonDeltasGameTime");time.setAccessible(true);Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){ + for(var line:(Iterable)lines::iterator){ + var f=JsonParser.parseString(line).getAsJsonObject();var level=(Level)allocate.invoke(unsafe,Level.class);level.out=out;var entity=(Actor)allocate.invoke(unsafe,Actor.class);entity.configure(level);var d=vector(f.get("deltas"));deltas.set(entity,new double[]{d.x,d.y,d.z});time.setLong(entity,f.get("time").getAsLong()); + for(var value:f.getAsJsonArray("ops")){var op=value.getAsJsonObject();level.op=op;level.calls=0;try{var result=entity.limit(vector(op.get("movement")));out.printf("movement %016x %016x %016x%n",Double.doubleToLongBits(result.x),Double.doubleToLongBits(result.y),Double.doubleToLongBits(result.z));}catch(Stop error){out.println("error");}var accumulated=(double[])deltas.get(entity);out.printf("deltas %016x %016x %016x%n",Double.doubleToLongBits(accumulated[0]),Double.doubleToLongBits(accumulated[1]),Double.doubleToLongBits(accumulated[2]));out.println("tick "+time.getLong(entity));out.println("queries "+level.calls);} + } + } + } +} diff --git a/tools/test_movement_registry_parity.py b/tools/test_movement_registry_parity.py index c0a194b04..6ebca905f 100644 --- a/tools/test_movement_registry_parity.py +++ b/tools/test_movement_registry_parity.py @@ -78,7 +78,7 @@ def main(): matched = base.compare(build/(side+'.txt'), build/'rust.txt') references.append({'side':side, 'jar_sha256':lab.digest(jar, 'sha256'), 'output_sha256':lab.digest(build/(side+'.txt'), 'sha256'), 'matched_output_lines':matched}) - print(f'{side}: {matched:,} suffocation and collision-metadata lines match', flush=True) + print(f'{side}: {matched:,} registered movement lines match', flush=True) base.ensure_sources_unchanged(sources, tested);base.ensure_sources_unchanged(fixture_paths, fixtures) report = dict(schema=1,minecraft=lock['minecraft']['version'],manifest_sha1=lock['minecraft']['manifest_sha1'],platform=platform.platform(),java=subprocess.check_output(['java','--version'],text=True).splitlines()[0],rustc=subprocess.check_output(['rustc','--version'],text=True).strip(),registry_states=facts['states'],registry_blocks=len(facts['defaults']),fixtures=count,sources_sha256=tested,fixtures_sha256=fixtures,rust_output_sha256=lab.digest(build/'rust.txt','sha256'),references=references,scope='Imports raw registered friction/speed/jump/bounce/fall-distance coefficients and fence-gate type; binds resolved fence/wall/bounce-suppression tags. Actual native getters independently verify every state. Entity support positions and jump/speed factors run every registered state with natural, empty and universal tags; additional mixed-block queries, null support and failures exercise lazy behavior. Does not establish live player travel, bounce effects or full gameplay.') lab.write_json(report_path,report);print(f'Scoped movement registry parity passed: {report_path}',flush=True) diff --git a/tools/test_piston_movement_parity.py b/tools/test_piston_movement_parity.py new file mode 100644 index 000000000..37b151b61 --- /dev/null +++ b/tools/test_piston_movement_parity.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python3 +"""Compare per-tick piston movement limits and accumulator state with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + def bits(v):return struct.pack('>d',float(v)).hex() + def op(v,time=0,fail=False):return dict(movement=list(map(bits,v)),time=time,fail=fail) + def row(ops,deltas=(0,0,0),time=0):return dict(ops=ops,deltas=list(map(bits,deltas)),time=time) + threshold=float(struct.unpack('>f',struct.pack('>f',1e-5))[0]) + values=[-float('inf'),-1,-.51,-.5,-threshold,-0.0,0,threshold,math.sqrt(1e-7),math.nextafter(math.sqrt(1e-7),0),math.nextafter(math.sqrt(1e-7),1),.5,.51,1,float('inf'),float('nan')] + for x in values: + for y in values: + for z in [0,-0.0,.2,float('nan')]: + for time in [0,1]:yield row([op([x,y,z],time)]) + for axis in range(3): + for value in values: + for initial in [0,-.51,.51,.51-threshold,math.nextafter(.51-threshold,0),float('nan'),float('inf')]: + v=[0,0,0];v[axis]=value;d=[0,0,0];d[axis]=initial + for fail in [False,True]:yield row([op(v,0,fail),op(v),op(v,1),op(v,1),op([-q for q in v],1)],d) + for axis in range(3): + v=[0,0,0];v[axis]=.1;yield row([op(v,0) for _ in range(12)]+[op([-q for q in v],0) for _ in range(12)]+[op(v,1),op(v,-1)]) + rng=random.Random(0x504953544f4e) + for _ in range(3000): + ops=[];time=rng.choice([0,1,-1,9223372036854775807,-9223372036854775808]) + for index in range(20): + if index%5==0:time=rng.choice([0,1,-1,9223372036854775807,-9223372036854775808]) + ops.append(op([rng.choice(values) for _ in range(3)],time,rng.randrange(8)==0)) + yield row(ops,[rng.choice(values) for _ in range(3)],rng.choice([0,1])) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-piston-movement-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPistonMovementOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/piston_movement_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaPistonMovementOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','piston_movement_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('piston_movement_fixture.exe' if os.name=='nt' else 'piston_movement_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} piston movement output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual Entity.limitPistonMovement over sequential displacement and game-time snapshots. Compares lazy time queries, length and displacement thresholds, per-tick resets, first-nonzero-axis selection, clamped accumulation, signed zero/nonfinite values and state after injected time-query failures. This does not establish piston block event simulation, entity pushing, Entity.move guards or full gameplay.'} + lab.write_json(report_path,report);print(f'Scoped piston movement parity passed: {report_path}') + + +if __name__=='__main__':main() From 6d419678a956d05c9b6da2ad80483cba9e5081b6 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 00:53:14 +0200 Subject: [PATCH 074/253] Match world collision-free query ordering and short circuits --- .../movement-regression.json | 235 ++++++++++++++++++ .../scoped-parity.json | 235 ++++++++++++++++++ .../registry_collision_scan_fixture.rs | 24 +- crates/horizon-world/src/world_movement.rs | 47 ++++ docs/collision-geometry.md | 17 ++ .../VanillaRegistryCollisionScanOracle.java | 1 + tools/test_world_collision_check_parity.py | 105 ++++++++ 7 files changed, 663 insertions(+), 1 deletion(-) create mode 100644 benchmarks/rust-world-collision-check-2026-10-07/movement-regression.json create mode 100644 benchmarks/rust-world-collision-check-2026-10-07/scoped-parity.json create mode 100644 tools/test_world_collision_check_parity.py diff --git a/benchmarks/rust-world-collision-check-2026-10-07/movement-regression.json b/benchmarks/rust-world-collision-check-2026-10-07/movement-regression.json new file mode 100644 index 000000000..ab8a4a92c --- /dev/null +++ b/benchmarks/rust-world-collision-check-2026-10-07/movement-regression.json @@ -0,0 +1,235 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "registry_states": 35723, + "block_definitions": 1286, + "definition_counts": { + "tagged_full": 1221, + "never": 42, + "closed_shulker": 17, + "always": 4, + "not_extended": 2 + }, + "native_chunk_storage": "ProtoChunk", + "rust_chunk_storage": "TerrainChunk", + "fixtures": 45163, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryCollisionScanOracle.java": "b53149d097a934f814c2374f26f27e5fbca485c58216d325744eaddfb074e60f", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "f2b4f440a5bbce4224a4b3cee494b0f7ddcafbf72db12592c94ef9fb94fbc8a6", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSuffocationOracle.java": "8dd870e65807bac4234085958830321061f0a3805dcf2b1219514107ba710503", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceSupportOracle.java": "9ce939a435842867786fed648951bbe77f6ab843f6df09af15f3deb1948c4877", + "tools/test_world_movement_parity.py": "c70470c10421ba93688aac821cdd45ac97f106162fd4b8a4e5823ab6eedb98bd", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-world/examples/registry_collision_scan_fixture.rs": "8aa40f2056f8dccb7166757dc08219a0331acfa5b6b489c1817c1393b10bb2c0", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "c37ea9eb157c24d9c91eec8edfef652f12b9b6b4d7f64da5ad0179fe5259a674", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_properties.rs": "9c78bed0d30c8b9cfaa413b9b81b0bf94861605c13b26754e09b24e83d75a227", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "a5021a168adcedc37d77f533a8921c02f09c59f46a01737586aaa33c5908b8d0", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f" + }, + "fixtures_sha256": { + ".local/rust-world-movement-parity/inputs.txt": "bbe9f6e31b141231e9726858c4490335c6c563f845bb25ce43afa5bf2486b3f0", + ".local/rust-world-movement-parity/facts.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-world-movement-parity/definitions.json": "9cac3c650353104db1648050621057bfe104dec1f44b53d0b7875f7bc20e6eec", + ".local/rust-world-movement-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-world-movement-parity/cached-collision.nbt": "4a274cd720a1bda585b02f50f16e90246576679e1e173c214548c5cbf607ab2d", + ".local/rust-world-movement-parity/tags.json": "5e1301e5a9abf7e4de93af5dae3a157e852dbdb4ea345c2eb626305a605d4f98" + }, + "rust_output_sha256": "622f8c8bd0dc6ae6f8ce9606c1ecf15b163f75a6ee3241d43564d707f7d61497", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "622f8c8bd0dc6ae6f8ce9606c1ecf15b163f75a6ee3241d43564d707f7d61497", + "matched_output_lines": 7062798 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "622f8c8bd0dc6ae6f8ce9606c1ecf15b163f75a6ee3241d43564d707f7d61497", + "matched_output_lines": 7062798 + } + ], + "scope": "Actual native Entity.collide executes initial collision and step-up decisions over BlockCollisions, registered block shapes and resident ProtoChunk sections. Rust combines owned/fallible step resolution with registry-bound TerrainChunk scanning. All registered states are used as obstacles, plus step heights, falling/grounded motion, zero and underflow motion, partial blocks, fluids, dynamic blocks, ceilings, chunk boundaries and query failures. Entity collider lists and world-border proximity/shape are controlled inputs; query order and reuse, shape collection and resulting displacement are compared. Contexts are deliberately supplied empty/position/placement snapshots in both worlds. This does not establish entity broad-phase selection, actual world-border proximity, travel/gravity/velocity or grounded side effects, experimental minecarts or a playable game." +} diff --git a/benchmarks/rust-world-collision-check-2026-10-07/scoped-parity.json b/benchmarks/rust-world-collision-check-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..27e100115 --- /dev/null +++ b/benchmarks/rust-world-collision-check-2026-10-07/scoped-parity.json @@ -0,0 +1,235 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "registry_states": 35723, + "block_definitions": 1286, + "definition_counts": { + "tagged_full": 1221, + "never": 42, + "closed_shulker": 17, + "always": 4, + "not_extended": 2 + }, + "native_chunk_storage": "ProtoChunk", + "rust_chunk_storage": "TerrainChunk", + "fixtures": 80270, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryCollisionScanOracle.java": "b53149d097a934f814c2374f26f27e5fbca485c58216d325744eaddfb074e60f", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "f2b4f440a5bbce4224a4b3cee494b0f7ddcafbf72db12592c94ef9fb94fbc8a6", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSuffocationOracle.java": "8dd870e65807bac4234085958830321061f0a3805dcf2b1219514107ba710503", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceSupportOracle.java": "9ce939a435842867786fed648951bbe77f6ab843f6df09af15f3deb1948c4877", + "tools/test_world_collision_check_parity.py": "3b8a82f72220e20f96e33e2ac09030fd82cb6c3a7511e7b11387de413be6452e", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-world/examples/registry_collision_scan_fixture.rs": "8aa40f2056f8dccb7166757dc08219a0331acfa5b6b489c1817c1393b10bb2c0", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "c37ea9eb157c24d9c91eec8edfef652f12b9b6b4d7f64da5ad0179fe5259a674", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_properties.rs": "9c78bed0d30c8b9cfaa413b9b81b0bf94861605c13b26754e09b24e83d75a227", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "a5021a168adcedc37d77f533a8921c02f09c59f46a01737586aaa33c5908b8d0", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f" + }, + "fixtures_sha256": { + ".local/rust-world-collision-check-parity/inputs.txt": "210f1473983831ae93949eae6f5eae01ace1c729c46125e44f76143d23fa49ff", + ".local/rust-world-collision-check-parity/facts.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-world-collision-check-parity/definitions.json": "9cac3c650353104db1648050621057bfe104dec1f44b53d0b7875f7bc20e6eec", + ".local/rust-world-collision-check-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-world-collision-check-parity/cached-collision.nbt": "4a274cd720a1bda585b02f50f16e90246576679e1e173c214548c5cbf607ab2d", + ".local/rust-world-collision-check-parity/tags.json": "5e1301e5a9abf7e4de93af5dae3a157e852dbdb4ea345c2eb626305a605d4f98" + }, + "rust_output_sha256": "fadc86b51a80004c49117311fbe87d2d44405681ceb26bf71593784261ff214c", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "fadc86b51a80004c49117311fbe87d2d44405681ceb26bf71593784261ff214c", + "matched_output_lines": 4793095 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "fadc86b51a80004c49117311fbe87d2d44405681ceb26bf71593784261ff214c", + "matched_output_lines": 4793095 + } + ], + "scope": "Actual native CollisionGetter.noCollision for an entity executes lazy BlockCollisions over registered blocks and resident ProtoChunk sections, then entity list and applicable border shape checks. Rust uses the registry-bound TerrainChunk scan in the same short-circuit order. All registered states, controlled context variants, degenerate entity shapes, empty/disjoint borders, missing chunks, chunk/height boundaries and failures are compared. Entity list contents and border applicability/shapes are controlled; null-entity overloads, live entity indexing, experimental minecarts and player ledge behavior remain separate work." +} diff --git a/crates/horizon-world/examples/registry_collision_scan_fixture.rs b/crates/horizon-world/examples/registry_collision_scan_fixture.rs index 71ff88f73..2867bb544 100644 --- a/crates/horizon-world/examples/registry_collision_scan_fixture.rs +++ b/crates/horizon-world/examples/registry_collision_scan_fixture.rs @@ -18,7 +18,10 @@ use horizon_world::{ registry::{BlockRegistry, BlockStateId}, registry_collision_scan::{CollisionChunks, RegistryCollisionWorld}, suffocation::{SuffocationDefinition, SuffocationRegistry}, - world_movement::{EntityMovementWorld, MovementRequest, resolve_world_movement}, + world_movement::{ + CollisionCheckRequest, EntityMovementWorld, MovementRequest, no_world_collision, + resolve_world_movement, + }, worldgen::{ tags::TagDefinitions, terrain::{TerrainBlockStates, TerrainChunk}, @@ -446,6 +449,25 @@ fn main() -> Result<(), Box> { ); if let Some(m) = f.get("movement") { let v = &m["delta"]; + if m.get("check").and_then(Value::as_bool) == Some(true) { + let result = no_world_collision( + &mut bound, + CollisionCheckRequest { + entity: EntityIdentity(1), + context, + bounds, + candidate_budget: 1_000_000, + }, + ); + let mut t = trace.borrow_mut(); + match result { + Ok(value) => writeln!(t.out, "clear {value}")?, + Err(_) => writeln!(t.out, "error")?, + }; + let calls = t.calls; + writeln!(t.out, "done check {calls}")?; + continue; + } let result = resolve_world_movement( &mut bound, MovementRequest { diff --git a/crates/horizon-world/src/world_movement.rs b/crates/horizon-world/src/world_movement.rs index 5b6f0761a..c925203d7 100644 --- a/crates/horizon-world/src/world_movement.rs +++ b/crates/horizon-world/src/world_movement.rs @@ -79,3 +79,50 @@ where }, ) } + +/// Entity-bearing CollisionGetter.noCollision, with block/context selection +/// supplied by the caller (including an always-fluid context when requested). +/// Native short-circuits blocks, then entity selection, then border geometry. +pub struct CollisionCheckRequest<'a> { + pub entity: EntityIdentity, + pub context: CollisionContext<'a>, + pub bounds: Aabb, + pub candidate_budget: usize, +} +pub fn no_world_collision( + world: &mut W, + request: CollisionCheckRequest<'_>, +) -> Result> +where + W: BlockCollisionWorld + EntityMovementWorld, +{ + for hit in BlockCollisionScan::new( + world, + request.context, + request.bounds, + false, + request.candidate_budget, + )? { + if !hit?.shape.is_empty() { + return Ok(false); + } + } + if !world + .entity_collisions(request.entity, request.bounds) + .map_err(CollisionScanError::World)? + .is_empty() + { + return Ok(false); + } + if let Some(border) = world + .movement_border(request.entity, request.bounds) + .map_err(CollisionScanError::World)? + { + let entity = VoxelShape::from_box(request.bounds).map_err(CollisionScanError::Shape)?; + return border + .join_is_not_empty(&entity, horizon_core::geometry::ShapeOp::AND) + .map(|overlap| !overlap) + .map_err(CollisionScanError::Shape); + } + Ok(true) +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 5365ffe48..2c09b5c52 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -606,3 +606,20 @@ Workspace Clippy passes. Piston block events, entity pushing and the surrounding `Entity.move` lifecycle remain pending. The [registered movement regression](../benchmarks/rust-piston-movement-2026-10-07/movement-registry-regression.json) passes again with **2,300,888 lines per JAR** on the integrated sources. + + +`no_world_collision` implements the entity-bearing collision-free query over the +registry-bound world. It consumes block collisions lazily, then checks whether +the selected entity list is empty, then tests applicable border geometry. Each +stage short-circuits the later providers; a nonempty entity list blocks the query +even if its supplied shape is empty. Collision contexts are supplied explicitly. + +`python3 tools/test_world_collision_check_parity.py` executes native +`CollisionGetter.noCollision` over registered blocks and resident Java sections. +The [world collision-check report](../benchmarks/rust-world-collision-check-2026-10-07/scoped-parity.json) +records **4,793,095 matching lines per JAR**. All states, context variants, empty +and disjoint controlled entity/border shapes, missing chunks, boundaries and +provider failures are covered. Workspace Clippy passes. Null-entity overloads, +actual entity-list/border providers and live player ledge behavior remain pending. +The [shared movement regression](../benchmarks/rust-world-collision-check-2026-10-07/movement-regression.json) +also passes with **7,062,798 matching lines per JAR**. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryCollisionScanOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryCollisionScanOracle.java index 73f8ca9b0..7a35b2622 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryCollisionScanOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryCollisionScanOracle.java @@ -85,6 +85,7 @@ public final class VanillaRegistryCollisionScanOracle { level.entities=new ArrayList<>();for(var shape:m.getAsJsonArray("entities"))level.entities.add(boxShape(shape)); level.border=new StepBorder();level.border.trace=trace;level.border.shape=m.get("border").isJsonNull()?null:boxShape(m.get("border")); var entity=(StepEntity)allocate.invoke(unsafe,StepEntity.class);entity.configure(level,bounds,(float)number(m.get("step")),m.get("grounded").getAsBoolean());var delta=m.getAsJsonArray("delta"); + if(m.has("check")&&m.get("check").getAsBoolean()){try{out.println("clear "+level.noCollision(entity,bounds));}catch(Stop error){out.println("error");}out.println("done check "+trace.calls);continue;} try{var result=(Vec3)collide.invoke(entity,new Vec3(number(delta.get(0)),number(delta.get(1)),number(delta.get(2))));out.printf("movement %016x %016x %016x%n",Double.doubleToLongBits(result.x),Double.doubleToLongBits(result.y),Double.doubleToLongBits(result.z));} catch(InvocationTargetException error){if(error.getCause() instanceof Stop)out.println("error");else throw error;} out.println("done movement "+trace.calls);continue; diff --git a/tools/test_world_collision_check_parity.py b/tools/test_world_collision_check_parity.py new file mode 100644 index 000000000..d3b53f30d --- /dev/null +++ b/tools/test_world_collision_check_parity.py @@ -0,0 +1,105 @@ +#!/usr/bin/env python3 +"""Compare short-circuit block/entity/border collision-free queries with pinned vanilla.""" +import collections +import json +import os +from pathlib import Path +import platform +import subprocess +import struct +import random +try: + from . import lab, test_rust_parity as base, test_worldgen_parity as worldgen +except ImportError: + import lab + import test_rust_parity as base + import test_worldgen_parity as worldgen + + +def corpus(facts): + def bits(v):return struct.pack('>d',float(v)).hex() + def row(state,bounds=(-.3,0,.2,.3,1.8,.8),context=0,entities=(),border=None,fail=-1,blocks=None): + return dict(chunks=[[x,z] for x in [-1,0,1] for z in [-1,0,1]],blocks=blocks if blocks is not None else [[0,0,0,state]],context=context,y=bits(0),entities=[0,0],fail=fail,limit=100000,suffocating=False,box=list(map(bits,bounds)),movement=dict(check=True,delta=list(map(bits,[0,0,0])),step=bits(.6),grounded=True,entities=[list(map(bits,b)) for b in entities],border=None if border is None else list(map(bits,border)))) + for state in range(len(facts['states'])): + yield row(state,context=state%4) + yield row(state,bounds=(-.6,0,.2,-.2,1.8,.8),context=state%4,border=[-.5,-1,-1,-.4,3,1]) + defaults=facts['defaults'];names=['air','stone','water','lava','scaffolding','powder_snow','shulker_box','moving_piston','stone_slab','oak_stairs','snow','cobweb','bamboo'] + boxes=[[-.3,0,.2,.3,1.8,.8],[0,0,0,1,1,1],[0,0,0,0,0,0],[1,0,0,1.6,1.8,.6],[-16,-16,-16,-15,0,-15],[15.8,0,15.8,16.4,1.8,16.4]] + entity_lists=[[],[[0,0,0,0,0,0]],[[0,0,0,1,1,1]],[[100,100,100,101,101,101]]] + borders=[None,[-.5,-1,-1,-.4,3,1],[0,0,0,0,0,0],[100,100,100,101,101,101]] + for name in names: + for context in range(4): + for entities in entity_lists: + for border in borders: + for fail in [-1,0,1,3,12,25,50]:yield row(defaults['minecraft:'+name],context=context,entities=entities,border=border,fail=fail) + rng=random.Random(0x434c454152) + for _ in range(3000): + state=rng.randrange(len(facts['states']));f=row(state,bounds=rng.choice(boxes),context=rng.randrange(4),entities=rng.choice(entity_lists),border=rng.choice(borders),fail=rng.choice([-1,-1,0,3,12,50])) + f['entities']=[rng.randrange(3),rng.randrange(3)] + if rng.randrange(3)==0:f['chunks']=[];f['blocks']=[] + yield f + + +def main(): + lock, jars, libraries = base.verify_artifacts() + build = lab.LOCAL/'rust-world-collision-check-parity';build.mkdir(exist_ok=True) + report_path = build/'report.json';report_path.unlink(missing_ok=True) + oracle = lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryCollisionScanOracle.java' + helpers = [oracle.with_name(name+'.java') for name in + ['VanillaHeightmapOracle', 'VanillaCollisionOracle', 'VanillaBlockStateCodecOracle', 'VanillaSuffocationOracle', 'VanillaFaceSupportOracle']] + sources = [oracle, *helpers, Path(__file__), lab.ROOT/'tools/test_rust_parity.py', + lab.ROOT/'tools/test_worldgen_parity.py', lab.ROOT/'tools/lab.py', + lab.ROOT/'Cargo.toml', lab.ROOT/'Cargo.lock', + lab.ROOT/'crates/horizon-world/examples/registry_collision_scan_fixture.rs'] + for crate in ['horizon-core', 'horizon-world']: + sources += [lab.ROOT/'crates'/crate/'Cargo.toml', + *sorted((lab.ROOT/'crates'/crate/'src').rglob('*.rs'))] + tested = base.source_hashes(sources) + tags = worldgen.tag_resources(jars['server']) + if tags != worldgen.tag_resources(jars['client']):raise AssertionError('Client/server block tags differ') + lab.write_json(build/'tags.json', tags) + classes = build/'classes';classes.mkdir(exist_ok=True) + dependencies = os.pathsep.join(map(str, libraries)) + def run(command, name): + with (build/(name+'.log')).open('w') as log: + subprocess.run(list(map(str, command)), cwd=lab.ROOT, check=True, timeout=3600, + stdout=log, stderr=subprocess.STDOUT) + run(['javac', '--release', lock['minecraft']['java_major'], '-proc:none', '-cp', + str(jars['server'])+os.pathsep+dependencies, '-d', classes, oracle, *helpers], 'compile-java') + def java(side, mode): + run(['java', '-Xmx768M', '-cp', os.pathsep.join([str(classes), str(jars[side]), dependencies]), + 'dev.horizonlab.parity.VanillaRegistryCollisionScanOracle', mode, build], side+'-'+mode) + java('server', 'export') + facts = json.loads((build/'facts.json').read_text()) + if len(facts['states']) != 35723:raise AssertionError('Incomplete pinned registry') + definitions = json.loads((build/'definitions.json').read_text()) + count = 0 + with (build/'inputs.txt').open('w') as output: + for fixture in corpus(facts): + output.write(json.dumps(fixture, separators=(',', ':'))+'\n');count += 1 + fixture_paths = [build/name for name in ['inputs.txt', 'facts.json', 'definitions.json', + 'block-registry.nbt', 'cached-collision.nbt', 'tags.json']] + fixtures = base.source_hashes(fixture_paths) + run(['cargo', 'build', '--locked', '--release', '-p', 'horizon-world', '--example', 'registry_collision_scan_fixture'], 'compile-rust') + metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--locked', '--no-deps', '--format-version', '1'], cwd=lab.ROOT)) + binary = Path(metadata['target_directory'])/'release/examples'/('registry_collision_scan_fixture.exe' if os.name=='nt' else 'registry_collision_scan_fixture') + run([binary, build], 'rust');references = [] + for side, jar in jars.items(): + java(side, side) + matched = base.compare(build/(side+'.txt'), build/'rust.txt') + references.append({'side':side, 'jar_sha256':lab.digest(jar, 'sha256'), + 'output_sha256':lab.digest(build/(side+'.txt'), 'sha256'), 'matched_output_lines':matched}) + print(f'{side}: {matched:,} world collision-check lines match', flush=True) + base.ensure_sources_unchanged(sources, tested);base.ensure_sources_unchanged(fixture_paths, fixtures) + report = {'schema':1, 'minecraft':lock['minecraft']['version'], 'manifest_sha1':lock['minecraft']['manifest_sha1'], + 'platform':platform.platform(), 'java':subprocess.check_output(['java', '--version'], text=True).splitlines()[0], + 'rustc':subprocess.check_output(['rustc', '--version'], text=True).strip(), + 'registry_states':len(facts['states']), 'block_definitions':len(definitions), + 'definition_counts':dict(collections.Counter(definitions.values())), + 'native_chunk_storage':'ProtoChunk', 'rust_chunk_storage':'TerrainChunk', 'fixtures':count, 'sources_sha256':tested, 'fixtures_sha256':fixtures, + 'rust_output_sha256':lab.digest(build/'rust.txt', 'sha256'), 'references':references, + 'scope':'Actual native CollisionGetter.noCollision for an entity executes lazy BlockCollisions over registered blocks and resident ProtoChunk sections, then entity list and applicable border shape checks. Rust uses the registry-bound TerrainChunk scan in the same short-circuit order. All registered states, controlled context variants, degenerate entity shapes, empty/disjoint borders, missing chunks, chunk/height boundaries and failures are compared. Entity list contents and border applicability/shapes are controlled; null-entity overloads, live entity indexing, experimental minecarts and player ledge behavior remain separate work.'} + lab.write_json(report_path, report);print(f'Scoped world collision-check parity passed: {report_path}', flush=True) + + +if __name__ == '__main__':main() From e45980b5c71c9b109a4062e0a8953b9587b7c058 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 00:56:02 +0200 Subject: [PATCH 075/253] Match player crouching edge backoff and collision probe bounds --- .../scoped-parity.json | 214 ++++++++++++++++++ .../examples/edge_backoff_fixture.rs | 117 ++++++++++ crates/horizon-world/src/edge_backoff.rs | 108 +++++++++ crates/horizon-world/src/lib.rs | 1 + crates/horizon-world/tests/edge_backoff.rs | 62 +++++ docs/collision-geometry.md | 16 ++ .../parity/VanillaEdgeBackoffOracle.java | 43 ++++ tools/test_edge_backoff_parity.py | 72 ++++++ 8 files changed, 633 insertions(+) create mode 100644 benchmarks/rust-edge-backoff-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/edge_backoff_fixture.rs create mode 100644 crates/horizon-world/src/edge_backoff.rs create mode 100644 crates/horizon-world/tests/edge_backoff.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEdgeBackoffOracle.java create mode 100644 tools/test_edge_backoff_parity.py diff --git a/benchmarks/rust-edge-backoff-2026-10-07/scoped-parity.json b/benchmarks/rust-edge-backoff-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..b6f01a985 --- /dev/null +++ b/benchmarks/rust-edge-backoff-2026-10-07/scoped-parity.json @@ -0,0 +1,214 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 11168, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEdgeBackoffOracle.java": "43b1c6d4f812b64a9173ec9ad4418181195809f13bdd9b40dc51d422e178ca72", + "tools/test_edge_backoff_parity.py": "c1e53b422dac7df5b52de1367c0896f629a81cb377ff4ea678afdbf71f7fddcf", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "60097645dd2641eb53cde248b7d833bbe8e44ca53a3de4278aed6ccccc14e733", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_properties.rs": "9c78bed0d30c8b9cfaa413b9b81b0bf94861605c13b26754e09b24e83d75a227", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "a5021a168adcedc37d77f533a8921c02f09c59f46a01737586aaa33c5908b8d0", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/edge_backoff_fixture.rs": "6f8d84bd0690cebca4f9b2b21e75fda68682a2b16b4d6b47006bac8bfba8f7ff" + }, + "fixtures_sha256": { + ".local/rust-edge-backoff-parity/inputs.txt": "a6175306f75e66a432d74d13a3e489a0a1c046441f66a572ed6880a41a42082b" + }, + "rust_output_sha256": "e116ab9948901cc27a78a82a3a8b5ce171b5f10587e01022d91d8467af656276", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "e116ab9948901cc27a78a82a3a8b5ce171b5f10587e01022d91d8467af656276", + "matched_output_lines": 46578 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "e116ab9948901cc27a78a82a3a8b5ce171b5f10587e01022d91d8467af656276", + "matched_output_lines": 46578 + } + ], + "scope": "Actual Player.maybeBackOffFromEdge, isAboveGround and canFallAtLeast with controlled step/staying/ground getters and ordered collision-free query results. Compares mover and flight guards, fall-distance boundaries, float step widening, exact thin probe bounds, X/Z/diagonal reductions, signed zero/nonfinite inputs and injected query errors. This does not establish live player crouching state, attribute provisioning or integrated registered-world ledge behavior; those need separate integration checks." +} diff --git a/crates/horizon-world/examples/edge_backoff_fixture.rs b/crates/horizon-world/examples/edge_backoff_fixture.rs new file mode 100644 index 000000000..f12ce4431 --- /dev/null +++ b/crates/horizon-world/examples/edge_backoff_fixture.rs @@ -0,0 +1,117 @@ +use horizon_core::geometry::{Aabb, Axis, Vec3}; +use horizon_world::edge_backoff::{EdgeBackoffInput, EdgeBackoffWorld, back_off_from_edge}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn vector(v: &Value) -> Vec3 { + Vec3::new(number(&v[0]), number(&v[1]), number(&v[2])) +} +fn bits(v: f64) -> u64 { + if v.is_nan() { + 0x7ff8000000000000 + } else { + v.to_bits() + } +} +struct World<'a> { + input: &'a Value, + out: &'a mut dyn Write, + calls: i64, + probes: usize, +} +impl World<'_> { + fn query(&mut self, text: String) -> io::Result<()> { + writeln!(self.out, "{text}")?; + let call = self.calls; + self.calls += 1; + if call == self.input["fail"].as_i64().unwrap() { + Err(io::Error::other("injected edge query failure")) + } else { + Ok(()) + } + } +} +impl EdgeBackoffWorld for World<'_> { + type Error = io::Error; + fn max_up_step(&mut self) -> io::Result { + self.query("step".into())?; + Ok(f32::from_bits( + u32::from_str_radix(self.input["step"].as_str().unwrap(), 16).unwrap(), + )) + } + fn staying_on_ground_surface(&mut self) -> io::Result { + self.query("staying".into())?; + Ok(self.input["staying"].as_bool().unwrap()) + } + fn on_ground(&mut self) -> io::Result { + self.query("ground".into())?; + Ok(self.input["ground"].as_bool().unwrap()) + } + fn no_collision(&mut self, b: Aabb) -> io::Result { + self.query(format!( + "clear {:016x} {:016x} {:016x} {:016x} {:016x} {:016x}", + bits(b.min(Axis::X)), + bits(b.min(Axis::Y)), + bits(b.min(Axis::Z)), + bits(b.max(Axis::X)), + bits(b.max(Axis::Y)), + bits(b.max(Axis::Z)) + ))?; + let p = self.probes; + self.probes += 1; + Ok(self.input["clear"] + .as_array() + .unwrap() + .get(p) + .and_then(Value::as_bool) + .unwrap_or(false)) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let b = &f["box"]; + let bounds = Aabb::new( + Vec3::new(number(&b[0]), number(&b[1]), number(&b[2])), + Vec3::new(number(&b[3]), number(&b[4]), number(&b[5])), + ); + let mut world = World { + input: &f, + out: &mut out, + calls: 0, + probes: 0, + }; + let result = back_off_from_edge( + &mut world, + EdgeBackoffInput { + movement: vector(&f["movement"]), + bounds, + flying: f["flying"].as_bool().unwrap(), + self_or_player: matches!(f["mover"].as_str().unwrap(), "SELF" | "PLAYER"), + fall_distance: number(&f["fall"]), + query_budget: 10000, + }, + ); + match result { + Ok(v) => writeln!( + world.out, + "movement {:016x} {:016x} {:016x}", + bits(v.x), + bits(v.y), + bits(v.z) + )?, + Err(_) => writeln!(world.out, "error")?, + }; + writeln!(world.out, "queries {}", world.calls)?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/edge_backoff.rs b/crates/horizon-world/src/edge_backoff.rs new file mode 100644 index 000000000..7299d8c14 --- /dev/null +++ b/crates/horizon-world/src/edge_backoff.rs @@ -0,0 +1,108 @@ +//! Player crouching edge backoff and its lazy collision-free probes. +use horizon_core::geometry::{Aabb, Vec3}; + +pub trait EdgeBackoffWorld { + type Error; + fn max_up_step(&mut self) -> Result; + fn staying_on_ground_surface(&mut self) -> Result; + fn on_ground(&mut self) -> Result; + fn no_collision(&mut self, bounds: Aabb) -> Result; +} +pub struct EdgeBackoffInput { + pub movement: Vec3, + pub bounds: Aabb, + pub flying: bool, + /// True only for native SELF and PLAYER mover types. + pub self_or_player: bool, + pub fall_distance: f64, + pub query_budget: usize, +} +#[derive(Debug)] +pub enum EdgeBackoffError { + World(E), + QueryBudget, +} +impl std::fmt::Display for EdgeBackoffError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::World(e) => e.fmt(f), + Self::QueryBudget => f.write_str("edge backoff collision query budget exhausted"), + } + } +} +impl std::error::Error for EdgeBackoffError {} +fn signum(v: f64) -> f64 { + if v == 0.0 || v.is_nan() { + v + } else { + v.signum() + } +} +fn decrease(v: f64, step: f64) -> f64 { + if v.abs() <= 0.05 { 0.0 } else { v - step } +} +/// The budget bounds pathological/nonconverging motion. Exhaustion is an error, +/// never a successful clamped displacement; earlier provider effects remain. +pub fn back_off_from_edge( + world: &mut W, + input: EdgeBackoffInput, +) -> Result> { + let step = f64::from(world.max_up_step().map_err(EdgeBackoffError::World)?); + if input.flying + || input.movement.y > 0.0 + || !input.self_or_player + || !world + .staying_on_ground_surface() + .map_err(EdgeBackoffError::World)? + { + return Ok(input.movement); + } + let grounded = world.on_ground().map_err(EdgeBackoffError::World)?; + let mut queries = 0usize; + let mut can_fall = + |dx: f64, dz: f64, amount: f64| -> Result> { + if queries == input.query_budget { + return Err(EdgeBackoffError::QueryBudget); + } + queries += 1; + let min = input.bounds.min_position(); + let max = input.bounds.max_position(); + let bounds = Aabb::new( + Vec3::new( + min.x + 1.0e-7 + dx, + min.y - amount - 1.0e-7, + min.z + 1.0e-7 + dz, + ), + Vec3::new(max.x - 1.0e-7 + dx, min.y, max.z - 1.0e-7 + dz), + ); + world.no_collision(bounds).map_err(EdgeBackoffError::World) + }; + if !grounded + && !(input.fall_distance < step && !can_fall(0.0, 0.0, step - input.fall_distance)?) + { + return Ok(input.movement); + } + let mut x = input.movement.x; + let mut z = input.movement.z; + let dx = signum(x) * 0.05; + let dz = signum(z) * 0.05; + while x != 0.0 && can_fall(x, 0.0, step)? { + if x.abs() <= 0.05 { + x = 0.0; + break; + } + x -= dx; + } + while z != 0.0 && can_fall(0.0, z, step)? { + if z.abs() <= 0.05 { + z = 0.0; + break; + } + z -= dz; + } + while x != 0.0 && z != 0.0 && can_fall(x, z, step)? { + x = decrease(x, dx); + z = decrease(z, dz); + } + Ok(Vec3::new(x, input.movement.y, z)) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 3e36221aa..2fada8379 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -15,6 +15,7 @@ pub mod collision; pub mod collision_context; pub mod compression; pub mod dynamic_support; +pub mod edge_backoff; pub mod entity_collision; pub mod entity_obstruction; pub mod fluid; diff --git a/crates/horizon-world/tests/edge_backoff.rs b/crates/horizon-world/tests/edge_backoff.rs new file mode 100644 index 000000000..501bc625d --- /dev/null +++ b/crates/horizon-world/tests/edge_backoff.rs @@ -0,0 +1,62 @@ +use horizon_core::geometry::{Aabb, Vec3}; +use horizon_world::edge_backoff::{ + EdgeBackoffError, EdgeBackoffInput, EdgeBackoffWorld, back_off_from_edge, +}; +struct World { + calls: usize, +} +impl EdgeBackoffWorld for World { + type Error = std::convert::Infallible; + fn max_up_step(&mut self) -> Result { + Ok(0.6) + } + fn staying_on_ground_surface(&mut self) -> Result { + Ok(true) + } + fn on_ground(&mut self) -> Result { + Ok(true) + } + fn no_collision(&mut self, _: Aabb) -> Result { + self.calls += 1; + Ok(true) + } +} +fn input() -> EdgeBackoffInput { + EdgeBackoffInput { + movement: Vec3::new(f64::INFINITY, 0.0, 0.0), + bounds: Aabb::new(Vec3::new(-0.3, 1.0, -0.3), Vec3::new(0.3, 2.8, 0.3)), + flying: false, + self_or_player: true, + fall_distance: 0.0, + query_budget: 3, + } +} +#[test] +fn nonconverging_motion_exhausts_budget_without_successful_displacement() { + let mut world = World { calls: 0 }; + assert!(matches!( + back_off_from_edge(&mut world, input()), + Err(EdgeBackoffError::QueryBudget) + )); + assert_eq!(world.calls, 3); +} +#[test] +fn zero_budget_only_fails_when_a_probe_is_needed() { + let mut world = World { calls: 0 }; + let mut request = input(); + request.query_budget = 0; + request.flying = true; + assert!( + back_off_from_edge(&mut world, request) + .unwrap() + .x + .is_infinite() + ); + let mut request = input(); + request.query_budget = 0; + assert!(matches!( + back_off_from_edge(&mut world, request), + Err(EdgeBackoffError::QueryBudget) + )); + assert_eq!(world.calls, 0); +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 2c09b5c52..50b9a06a6 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -623,3 +623,19 @@ provider failures are covered. Workspace Clippy passes. Null-entity overloads, actual entity-list/border providers and live player ledge behavior remain pending. The [shared movement regression](../benchmarks/rust-world-collision-check-2026-10-07/movement-regression.json) also passes with **7,062,798 matching lines per JAR**. + + +`back_off_from_edge` implements the player ledge guards, above-ground test and +X/Z/diagonal displacement reductions. It retains lazy step/staying/grounded +queries, float step widening, signed-zero behavior and the exact thin collision +probe arithmetic. A caller-supplied query budget bounds nonconverging inputs and +returns an error without fabricating a successful displacement. + +`python3 tools/test_edge_backoff_parity.py` executes actual player methods with +controlled collision-free query results. The +[edge backoff report](../benchmarks/rust-edge-backoff-2026-10-07/scoped-parity.json) +records **46,578 matching lines per JAR**, covering all mover types, flight/crouch +guards, fall/step and 0.05 thresholds, nonfinite values and query failures. Two +query-budget unit tests and workspace Clippy pass. Registered-world ledge probes, +live crouching/attribute state and the complete player movement loop are separate +integration work. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEdgeBackoffOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEdgeBackoffOracle.java new file mode 100644 index 000000000..a3c116891 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEdgeBackoffOracle.java @@ -0,0 +1,43 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*; +import java.lang.reflect.*; +import java.nio.file.*; +import java.util.*; +import net.minecraft.world.entity.*; +import net.minecraft.world.entity.player.*; +import net.minecraft.world.level.GameType; +import net.minecraft.world.phys.*; +/** Actual Player edge-backoff decisions and probe bounds with controlled collisions. */ +public final class VanillaEdgeBackoffOracle { + static final class Stop extends RuntimeException {} + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + static Vec3 vector(JsonElement v){var a=v.getAsJsonArray();return new Vec3(number(a.get(0)),number(a.get(1)),number(a.get(2)));} + static final class Data { + JsonObject input;PrintWriter out;int calls,probes; + void query(String text){out.println(text);if(calls++==input.get("fail").getAsInt())throw new Stop();} + } + static final class Level extends net.minecraft.server.level.ServerLevel { + Data d; + private Level(){super(null,null,null,null,null,null,false,0L,List.of(),false);} + @Override public boolean noCollision(Entity entity,AABB b){d.query(String.format("clear %016x %016x %016x %016x %016x %016x",Double.doubleToLongBits(b.minX),Double.doubleToLongBits(b.minY),Double.doubleToLongBits(b.minZ),Double.doubleToLongBits(b.maxX),Double.doubleToLongBits(b.maxY),Double.doubleToLongBits(b.maxZ)));var values=d.input.getAsJsonArray("clear");int index=d.probes++;return index)lines::iterator){ + var f=JsonParser.parseString(line).getAsJsonObject();var d=new Data();d.input=f;d.out=out;var level=(Level)allocate.invoke(unsafe,Level.class);level.d=d;var entity=(Actor)allocate.invoke(unsafe,Actor.class);entity.d=d;entity.configure(level);var a=new Abilities();a.flying=f.get("flying").getAsBoolean();abilities.set(entity,a);entity.fallDistance=number(f.get("fall"));var b=f.getAsJsonArray("box");entity.setBoundingBox(new AABB(number(b.get(0)),number(b.get(1)),number(b.get(2)),number(b.get(3)),number(b.get(4)),number(b.get(5)))); + try{var result=entity.backoff(vector(f.get("movement")),MoverType.valueOf(f.get("mover").getAsString()));out.printf("movement %016x %016x %016x%n",Double.doubleToLongBits(result.x),Double.doubleToLongBits(result.y),Double.doubleToLongBits(result.z));}catch(Stop error){out.println("error");}out.println("queries "+d.calls); + } + } + } +} diff --git a/tools/test_edge_backoff_parity.py b/tools/test_edge_backoff_parity.py new file mode 100644 index 000000000..859ea2d7f --- /dev/null +++ b/tools/test_edge_backoff_parity.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python3 +"""Compare player crouching edge-backoff probes and lazy guards with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + def bits(v):return struct.pack('>d',float(v)).hex() + def single(v):return struct.pack('>f',float(v)).hex() + def row(flags=6,mover='SELF',movement=(.3,-.08,.2),step=.6,fall=0,clear=None,fail=-1,bounds=(-.3,1,-.3,.3,2.8,.3)): + return dict(flying=bool(flags&1),staying=bool(flags&2),ground=bool(flags&4),mover=mover,movement=list(map(bits,movement)),step=single(step),fall=bits(fall),clear=clear if clear is not None else [True]*30,fail=fail,box=list(map(bits,bounds))) + for flags in range(8): + for mover in ['SELF','PLAYER','PISTON','SHULKER','SHULKER_BOX']: + for y in [-.1,-0.0,0,.1,float('nan')]: + for fall in [0,.2,.6,1,float('nan')]: + for clear in [[],[False],[True],[False]+[True]*30]:yield row(flags,mover,(.3,y,.2),fall=fall,clear=clear) + values=[-.6,-.1,-math.nextafter(.05,1),-.05,-math.nextafter(.05,0),-1e-9,-0.0,0,1e-9,math.nextafter(.05,0),.05,math.nextafter(.05,1),.1,.6,float('nan'),float('inf')] + for x in values: + for z in values: + for clear in [[],[True]*30,[False,True,False]+[True]*10,[True,False,True,False]+[True]*10]:yield row(movement=(x,-.08,z),clear=clear) + for fail in range(-1,35): + for flags in [0,2,6,7]:yield row(flags=flags,clear=[False]+[True]*40,fail=fail) + rng=random.Random(0x45444745) + for _ in range(6000): + low=[rng.choice([-16,-1,-0.0,0,.1,1,1e8,float('nan')]) for _ in range(3)];high=[v+rng.choice([0,1e-8,.6,1.8]) for v in low] + yield row(flags=rng.randrange(8),mover=rng.choice(['SELF','SELF','PLAYER','PISTON']),movement=[rng.choice(values),rng.choice([-.1,0,.1,float('nan')]),rng.choice(values)],step=rng.choice([0,.5,.6,1,float('nan'),float('inf')]),fall=rng.choice([0,.2,.6,1,float('nan')]),clear=[bool(rng.randrange(2)) for _ in range(50)],fail=rng.choice([-1,-1,0,1,2,3,10]),bounds=(*low,*high)) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-edge-backoff-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEdgeBackoffOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/edge_backoff_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaEdgeBackoffOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','edge_backoff_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('edge_backoff_fixture.exe' if os.name=='nt' else 'edge_backoff_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} edge-backoff output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual Player.maybeBackOffFromEdge, isAboveGround and canFallAtLeast with controlled step/staying/ground getters and ordered collision-free query results. Compares mover and flight guards, fall-distance boundaries, float step widening, exact thin probe bounds, X/Z/diagonal reductions, signed zero/nonfinite inputs and injected query errors. This does not establish live player crouching state, attribute provisioning or integrated registered-world ledge behavior; those need separate integration checks.'} + lab.write_json(report_path,report);print(f'Scoped edge backoff parity passed: {report_path}') + + +if __name__=='__main__':main() From e39e0b56c0b3ba6e4a63f60c44d1306d7a466770 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 00:58:39 +0200 Subject: [PATCH 076/253] Verify player ledge backoff through registered resident world collisions --- .../scoped-parity.json | 236 ++++++++++++++++++ .../registry_collision_scan_fixture.rs | 67 ++++- docs/collision-geometry.md | 15 ++ .../VanillaRegistryCollisionScanOracle.java | 15 ++ tools/test_world_edge_backoff_parity.py | 106 ++++++++ 5 files changed, 438 insertions(+), 1 deletion(-) create mode 100644 benchmarks/rust-world-edge-backoff-2026-10-07/scoped-parity.json create mode 100644 tools/test_world_edge_backoff_parity.py diff --git a/benchmarks/rust-world-edge-backoff-2026-10-07/scoped-parity.json b/benchmarks/rust-world-edge-backoff-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..3dc8ef1a0 --- /dev/null +++ b/benchmarks/rust-world-edge-backoff-2026-10-07/scoped-parity.json @@ -0,0 +1,236 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "registry_states": 35723, + "block_definitions": 1286, + "definition_counts": { + "tagged_full": 1221, + "never": 42, + "closed_shulker": 17, + "always": 4, + "not_extended": 2 + }, + "native_chunk_storage": "ProtoChunk", + "rust_chunk_storage": "TerrainChunk", + "fixtures": 42083, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryCollisionScanOracle.java": "b016ca233f662ebac4730ae9af58e0b63aaeef16599106326376da7314114c48", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "f2b4f440a5bbce4224a4b3cee494b0f7ddcafbf72db12592c94ef9fb94fbc8a6", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSuffocationOracle.java": "8dd870e65807bac4234085958830321061f0a3805dcf2b1219514107ba710503", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceSupportOracle.java": "9ce939a435842867786fed648951bbe77f6ab843f6df09af15f3deb1948c4877", + "tools/test_world_edge_backoff_parity.py": "94094c0186c417062bc682e0860a54980805f3dcd3510f7380a153e572c707c4", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-world/examples/registry_collision_scan_fixture.rs": "19fd82abca9058d03f23cbdefb5c6f4ff78c8e5d024977bd287380528386d4ec", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "60097645dd2641eb53cde248b7d833bbe8e44ca53a3de4278aed6ccccc14e733", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_properties.rs": "9c78bed0d30c8b9cfaa413b9b81b0bf94861605c13b26754e09b24e83d75a227", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "a5021a168adcedc37d77f533a8921c02f09c59f46a01737586aaa33c5908b8d0", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f" + }, + "fixtures_sha256": { + ".local/rust-world-edge-backoff-parity/inputs.txt": "869a645642747489fb1b26442383c684eed938ea164a326b6d60cc9d5bedfbd5", + ".local/rust-world-edge-backoff-parity/facts.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-world-edge-backoff-parity/definitions.json": "9cac3c650353104db1648050621057bfe104dec1f44b53d0b7875f7bc20e6eec", + ".local/rust-world-edge-backoff-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-world-edge-backoff-parity/cached-collision.nbt": "4a274cd720a1bda585b02f50f16e90246576679e1e173c214548c5cbf607ab2d", + ".local/rust-world-edge-backoff-parity/tags.json": "5e1301e5a9abf7e4de93af5dae3a157e852dbdb4ea345c2eb626305a605d4f98" + }, + "rust_output_sha256": "867e26dc548afc0e892725e62091517032f18e9de6cf9b796a44e37c32464f7c", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "867e26dc548afc0e892725e62091517032f18e9de6cf9b796a44e37c32464f7c", + "matched_output_lines": 27109699 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "867e26dc548afc0e892725e62091517032f18e9de6cf9b796a44e37c32464f7c", + "matched_output_lines": 27109699 + } + ], + "scope": "Actual Player.maybeBackOffFromEdge issues native noCollision queries over registered block states in resident ProtoChunk storage. Rust combines edge-backoff guards/probe geometry with short-circuit entity-bearing no_world_collision and registry-bound TerrainChunk scanning. Every state is used as the supporting block; additional falling, step-height, chunk-edge, diagonal, partial/dynamic block, mover/flight/crouch and failing-provider cases are compared. Entity collider lists, border applicability/shapes and empty/position/placement contexts remain controlled inputs. This is registered-world ledge integration, not a complete Player.move/travel loop or full playable game." +} diff --git a/crates/horizon-world/examples/registry_collision_scan_fixture.rs b/crates/horizon-world/examples/registry_collision_scan_fixture.rs index 2867bb544..dff872908 100644 --- a/crates/horizon-world/examples/registry_collision_scan_fixture.rs +++ b/crates/horizon-world/examples/registry_collision_scan_fixture.rs @@ -5,10 +5,11 @@ use horizon_core::{ }; use horizon_world::{ block_collision::{BlockCollisionRegistry, DynamicCollisionWorld, ShulkerCollisionState}, - block_collision_scan::BlockCollisionScan, + block_collision_scan::{BlockCollisionScan, BlockCollisionWorld, CollisionScanError}, collision::CachedCollisionRegistry, collision_context::CollisionContext, dynamic_support::DynamicSupportWorld, + edge_backoff::{EdgeBackoffInput, EdgeBackoffWorld, back_off_from_edge}, entity_obstruction::EntityIdentity, fluid::FluidState, heightmap::HeightmapState, @@ -242,6 +243,39 @@ impl EntityMovementWorld for World<'_> { Ok(border.clone()) } } +struct EdgeWorld<'w, 'c, W> { + world: &'w mut W, + context: CollisionContext<'c>, + step: f32, + grounded: bool, + staying: bool, +} +impl EdgeBackoffWorld for EdgeWorld<'_, '_, W> +where + W: BlockCollisionWorld + EntityMovementWorld, +{ + type Error = CollisionScanError; + fn max_up_step(&mut self) -> Result { + Ok(self.step) + } + fn staying_on_ground_surface(&mut self) -> Result { + Ok(self.staying) + } + fn on_ground(&mut self) -> Result { + Ok(self.grounded) + } + fn no_collision(&mut self, bounds: Aabb) -> Result { + no_world_collision( + self.world, + CollisionCheckRequest { + entity: EntityIdentity(1), + context: self.context, + bounds, + candidate_budget: 1_000_000, + }, + ) + } +} impl DynamicSupportWorld for World<'_> { type Error = io::Error; fn shulker_is_closed(&mut self, p: [i32; 3]) -> io::Result> { @@ -449,6 +483,37 @@ fn main() -> Result<(), Box> { ); if let Some(m) = f.get("movement") { let v = &m["delta"]; + if let Some(edge) = m.get("edge") { + let mut world = EdgeWorld { + world: &mut bound, + context, + step: number(&m["step"]) as f32, + grounded: m["grounded"].as_bool().unwrap(), + staying: edge["staying"].as_bool().unwrap(), + }; + let result = back_off_from_edge( + &mut world, + EdgeBackoffInput { + movement: Vec3::new(number(&v[0]), number(&v[1]), number(&v[2])), + bounds, + flying: edge["flying"].as_bool().unwrap(), + self_or_player: matches!( + edge["mover"].as_str().unwrap(), + "SELF" | "PLAYER" + ), + fall_distance: number(&edge["fall"]), + query_budget: 10000, + }, + ); + let mut t = trace.borrow_mut(); + match result { + Ok(v) => values(&mut t.out, "edge", [v.x, v.y, v.z])?, + Err(_) => writeln!(t.out, "error")?, + }; + let calls = t.calls; + writeln!(t.out, "done edge {calls}")?; + continue; + } if m.get("check").and_then(Value::as_bool) == Some(true) { let result = no_world_collision( &mut bound, diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 50b9a06a6..de744df5c 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -639,3 +639,18 @@ guards, fall/step and 0.05 thresholds, nonfinite values and query failures. Two query-budget unit tests and workspace Clippy pass. Registered-world ledge probes, live crouching/attribute state and the complete player movement loop are separate integration work. + + +Registered-world ledge integration now runs `back_off_from_edge` through +`no_world_collision` and registry-bound resident chunk scans. The native side +executes actual `Player.maybeBackOffFromEdge` and its collision probes over +`ProtoChunk` sections. Every state is used as a supporting block, with additional +falling, step-height, chunk-edge, diagonal, dynamic-block and guard/error cases. + +`python3 tools/test_world_edge_backoff_parity.py` passes with +**27,109,699 matching lines per JAR** in the +[world ledge report](../benchmarks/rust-world-edge-backoff-2026-10-07/scoped-parity.json). +The shared fixture now supports player probes alongside direct movement and +collision checks; workspace Clippy passes. Entity lists, border applicability and +collision contexts remain controlled snapshots. A complete player movement/travel +loop and playable client remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryCollisionScanOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryCollisionScanOracle.java index 7a35b2622..093fc522a 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryCollisionScanOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryCollisionScanOracle.java @@ -49,6 +49,16 @@ public final class VanillaRegistryCollisionScanOracle { @Override public boolean onGround(){return grounded;} void configure(StepLevel level,AABB bounds,float step,boolean grounded){setLevel(level);setBoundingBox(bounds);this.step=step;this.grounded=grounded;} } + static final class EdgePlayer extends net.minecraft.world.entity.player.Player { + float step;boolean grounded,staying; + private EdgePlayer(){super(null,null);} + @Override public GameType gameMode(){return GameType.SURVIVAL;} + @Override public float maxUpStep(){return step;} + @Override public boolean onGround(){return grounded;} + @Override protected boolean isStayingOnGroundSurface(){return staying;} + void configure(StepLevel level,AABB bounds,float step,boolean grounded,boolean staying){setLevel(level);setBoundingBox(bounds);this.step=step;this.grounded=grounded;this.staying=staying;} + Vec3 backoff(Vec3 delta,net.minecraft.world.entity.MoverType mover){return maybeBackOffFromEdge(delta,mover);} + } static long key(int x,int z){return (long)x<<32|Integer.toUnsignedLong(z);} static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} public static void main(String[] args)throws Exception { @@ -65,6 +75,7 @@ public final class VanillaRegistryCollisionScanOracle { for(var status:animation.getType().getEnumConstants())if(((Enum)status).name().equals(i==1?"CLOSED":"OPENED"))animation.set(entities[i],status); progress.setFloat(entities[i],i==1?0:0.5f);previous.setFloat(entities[i],i==1?0:0.5f); } + var abilities=net.minecraft.world.entity.player.Player.class.getDeclaredField("abilities");abilities.setAccessible(true); var collide=net.minecraft.world.entity.Entity.class.getDeclaredMethod("collide",Vec3.class);collide.setAccessible(true); var emit=VanillaFaceSupportOracle.class.getDeclaredMethod("emit",PrintWriter.class,VoxelShape.class);emit.setAccessible(true); try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){ @@ -85,6 +96,10 @@ public final class VanillaRegistryCollisionScanOracle { level.entities=new ArrayList<>();for(var shape:m.getAsJsonArray("entities"))level.entities.add(boxShape(shape)); level.border=new StepBorder();level.border.trace=trace;level.border.shape=m.get("border").isJsonNull()?null:boxShape(m.get("border")); var entity=(StepEntity)allocate.invoke(unsafe,StepEntity.class);entity.configure(level,bounds,(float)number(m.get("step")),m.get("grounded").getAsBoolean());var delta=m.getAsJsonArray("delta"); + if(m.has("edge")){ + var e=m.getAsJsonObject("edge");var player=(EdgePlayer)allocate.invoke(unsafe,EdgePlayer.class);player.configure(level,bounds,(float)number(m.get("step")),m.get("grounded").getAsBoolean(),e.get("staying").getAsBoolean());player.fallDistance=number(e.get("fall"));var a=new net.minecraft.world.entity.player.Abilities();a.flying=e.get("flying").getAsBoolean();abilities.set(player,a); + try{var result=player.backoff(new Vec3(number(delta.get(0)),number(delta.get(1)),number(delta.get(2))),net.minecraft.world.entity.MoverType.valueOf(e.get("mover").getAsString()));out.printf("edge %016x %016x %016x%n",Double.doubleToLongBits(result.x),Double.doubleToLongBits(result.y),Double.doubleToLongBits(result.z));}catch(Stop error){out.println("error");}out.println("done edge "+trace.calls);continue; + } if(m.has("check")&&m.get("check").getAsBoolean()){try{out.println("clear "+level.noCollision(entity,bounds));}catch(Stop error){out.println("error");}out.println("done check "+trace.calls);continue;} try{var result=(Vec3)collide.invoke(entity,new Vec3(number(delta.get(0)),number(delta.get(1)),number(delta.get(2))));out.printf("movement %016x %016x %016x%n",Double.doubleToLongBits(result.x),Double.doubleToLongBits(result.y),Double.doubleToLongBits(result.z));} catch(InvocationTargetException error){if(error.getCause() instanceof Stop)out.println("error");else throw error;} diff --git a/tools/test_world_edge_backoff_parity.py b/tools/test_world_edge_backoff_parity.py new file mode 100644 index 000000000..eee2b8fb5 --- /dev/null +++ b/tools/test_world_edge_backoff_parity.py @@ -0,0 +1,106 @@ +#!/usr/bin/env python3 +"""Compare player ledge backoff through registered world collision probes with pinned vanilla.""" +import collections +import json +import os +from pathlib import Path +import platform +import subprocess +import struct +import random +try: + from . import lab, test_rust_parity as base, test_worldgen_parity as worldgen +except ImportError: + import lab + import test_rust_parity as base + import test_worldgen_parity as worldgen + + +def corpus(facts): + def bits(v):return struct.pack('>d',float(v)).hex() + def row(state,delta=(.8,-.08,.8),step=.6,grounded=True,context=0,offset=0,fail=-1,extra=(),entities=(),border=None,fall=0,staying=True,flying=False,mover='SELF'): + blocks=[[offset,-1,0,state],*extra] + return dict(chunks=[[x,z] for x in range((offset>>4)-1,(offset>>4)+2) for z in [-1,0,1]],blocks=blocks,context=context,y=bits(0),entities=[0,0],fail=fail,limit=100000,suffocating=False,box=list(map(bits,[offset+.2,0,.2,offset+.8,1.8,.8])),movement=dict(delta=list(map(bits,delta)),step=bits(step),grounded=grounded,entities=[list(map(bits,b)) for b in entities],border=None if border is None else list(map(bits,border)),edge=dict(staying=staying,flying=flying,mover=mover,fall=bits(fall)))) + states=facts['states'];defaults=facts['defaults'] + for state in range(len(states)):yield row(state,context=state%4) + obstacles=[i for i,s in enumerate(states) if s['id'] in ['minecraft:oak_stairs','minecraft:stone_slab','minecraft:snow','minecraft:scaffolding','minecraft:powder_snow','minecraft:water','minecraft:shulker_box','minecraft:moving_piston','minecraft:piston','minecraft:soul_sand','minecraft:mud','minecraft:farmland','minecraft:bamboo','minecraft:pointed_dripstone']] + for state in obstacles: + for step in [0,.5,.6,1.0]: + for fall in [0,.2,.6,1.0]:yield row(state,step=step,grounded=False,fall=fall,context=state%4) + for mover in ['SELF','PLAYER','PISTON','SHULKER','SHULKER_BOX']: + for flying in [False,True]: + for staying in [False,True]: + for y in [-.08,0,.1]: + for fail in [-1,0,1,3,10,30,100]:yield row(defaults['minecraft:stone'],delta=(.8,y,.8),mover=mover,flying=flying,staying=staying,fail=fail) + rng=random.Random(0x574f524c44454447) + for index in range(2500): + offset=rng.choice([-16,0,15]);state=rng.choice(obstacles);delta=[rng.choice([-1,-.05,-0.0,0,.05,.5,.8,1]),rng.choice([-.5,-.08,0,.1]),rng.choice([-1,-.5,0,.5,.8,1])] + entities=[] if index%3 else [[offset+.2,-1,.2,offset+.8,0,.8]] + border=None if index%4 else [offset+1,-2,-2,offset+1.2,3,3] + extra=[] if index%2 else [[offset+1,-1,1,defaults['minecraft:stone']]] + f=row(state,delta,step=rng.choice([0,.5,.6,1]),grounded=bool(index%2),context=index%4,offset=offset,fail=rng.choice([-1,-1,0,3,15,50]),entities=entities,border=border,extra=extra,fall=rng.choice([0,.2,.6,1]));f['entities']=[rng.randrange(3),rng.randrange(3)];yield f + + +def main(): + lock, jars, libraries = base.verify_artifacts() + build = lab.LOCAL/'rust-world-edge-backoff-parity';build.mkdir(exist_ok=True) + report_path = build/'report.json';report_path.unlink(missing_ok=True) + oracle = lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryCollisionScanOracle.java' + helpers = [oracle.with_name(name+'.java') for name in + ['VanillaHeightmapOracle', 'VanillaCollisionOracle', 'VanillaBlockStateCodecOracle', 'VanillaSuffocationOracle', 'VanillaFaceSupportOracle']] + sources = [oracle, *helpers, Path(__file__), lab.ROOT/'tools/test_rust_parity.py', + lab.ROOT/'tools/test_worldgen_parity.py', lab.ROOT/'tools/lab.py', + lab.ROOT/'Cargo.toml', lab.ROOT/'Cargo.lock', + lab.ROOT/'crates/horizon-world/examples/registry_collision_scan_fixture.rs'] + for crate in ['horizon-core', 'horizon-world']: + sources += [lab.ROOT/'crates'/crate/'Cargo.toml', + *sorted((lab.ROOT/'crates'/crate/'src').rglob('*.rs'))] + tested = base.source_hashes(sources) + tags = worldgen.tag_resources(jars['server']) + if tags != worldgen.tag_resources(jars['client']):raise AssertionError('Client/server block tags differ') + lab.write_json(build/'tags.json', tags) + classes = build/'classes';classes.mkdir(exist_ok=True) + dependencies = os.pathsep.join(map(str, libraries)) + def run(command, name): + with (build/(name+'.log')).open('w') as log: + subprocess.run(list(map(str, command)), cwd=lab.ROOT, check=True, timeout=3600, + stdout=log, stderr=subprocess.STDOUT) + run(['javac', '--release', lock['minecraft']['java_major'], '-proc:none', '-cp', + str(jars['server'])+os.pathsep+dependencies, '-d', classes, oracle, *helpers], 'compile-java') + def java(side, mode): + run(['java', '-Xmx768M', '-cp', os.pathsep.join([str(classes), str(jars[side]), dependencies]), + 'dev.horizonlab.parity.VanillaRegistryCollisionScanOracle', mode, build], side+'-'+mode) + java('server', 'export') + facts = json.loads((build/'facts.json').read_text()) + if len(facts['states']) != 35723:raise AssertionError('Incomplete pinned registry') + definitions = json.loads((build/'definitions.json').read_text()) + count = 0 + with (build/'inputs.txt').open('w') as output: + for fixture in corpus(facts): + output.write(json.dumps(fixture, separators=(',', ':'))+'\n');count += 1 + fixture_paths = [build/name for name in ['inputs.txt', 'facts.json', 'definitions.json', + 'block-registry.nbt', 'cached-collision.nbt', 'tags.json']] + fixtures = base.source_hashes(fixture_paths) + run(['cargo', 'build', '--locked', '--release', '-p', 'horizon-world', '--example', 'registry_collision_scan_fixture'], 'compile-rust') + metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--locked', '--no-deps', '--format-version', '1'], cwd=lab.ROOT)) + binary = Path(metadata['target_directory'])/'release/examples'/('registry_collision_scan_fixture.exe' if os.name=='nt' else 'registry_collision_scan_fixture') + run([binary, build], 'rust');references = [] + for side, jar in jars.items(): + java(side, side) + matched = base.compare(build/(side+'.txt'), build/'rust.txt') + references.append({'side':side, 'jar_sha256':lab.digest(jar, 'sha256'), + 'output_sha256':lab.digest(build/(side+'.txt'), 'sha256'), 'matched_output_lines':matched}) + print(f'{side}: {matched:,} world edge-backoff lines match', flush=True) + base.ensure_sources_unchanged(sources, tested);base.ensure_sources_unchanged(fixture_paths, fixtures) + report = {'schema':1, 'minecraft':lock['minecraft']['version'], 'manifest_sha1':lock['minecraft']['manifest_sha1'], + 'platform':platform.platform(), 'java':subprocess.check_output(['java', '--version'], text=True).splitlines()[0], + 'rustc':subprocess.check_output(['rustc', '--version'], text=True).strip(), + 'registry_states':len(facts['states']), 'block_definitions':len(definitions), + 'definition_counts':dict(collections.Counter(definitions.values())), + 'native_chunk_storage':'ProtoChunk', 'rust_chunk_storage':'TerrainChunk', 'fixtures':count, 'sources_sha256':tested, 'fixtures_sha256':fixtures, + 'rust_output_sha256':lab.digest(build/'rust.txt', 'sha256'), 'references':references, + 'scope':'Actual Player.maybeBackOffFromEdge issues native noCollision queries over registered block states in resident ProtoChunk storage. Rust combines edge-backoff guards/probe geometry with short-circuit entity-bearing no_world_collision and registry-bound TerrainChunk scanning. Every state is used as the supporting block; additional falling, step-height, chunk-edge, diagonal, partial/dynamic block, mover/flight/crouch and failing-provider cases are compared. Entity collider lists, border applicability/shapes and empty/position/placement contexts remain controlled inputs. This is registered-world ledge integration, not a complete Player.move/travel loop or full playable game.'} + lab.write_json(report_path, report);print(f'Scoped world edge backoff parity passed: {report_path}', flush=True) + + +if __name__ == '__main__':main() From 38d60eef9e92f3d65175598d7e990d8527d1f72c Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 01:01:15 +0200 Subject: [PATCH 077/253] Match base entity fall accumulation and landing callback order --- .../scoped-parity.json | 215 ++++++++++++++++++ .../examples/fall_damage_fixture.rs | 146 ++++++++++++ crates/horizon-world/src/fall_damage.rs | 49 ++++ crates/horizon-world/src/lib.rs | 1 + docs/collision-geometry.md | 15 ++ .../parity/VanillaFallDamageOracle.java | 53 +++++ tools/test_fall_damage_parity.py | 73 ++++++ 7 files changed, 552 insertions(+) create mode 100644 benchmarks/rust-fall-damage-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/fall_damage_fixture.rs create mode 100644 crates/horizon-world/src/fall_damage.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFallDamageOracle.java create mode 100644 tools/test_fall_damage_parity.py diff --git a/benchmarks/rust-fall-damage-2026-10-07/scoped-parity.json b/benchmarks/rust-fall-damage-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..5252c4586 --- /dev/null +++ b/benchmarks/rust-fall-damage-2026-10-07/scoped-parity.json @@ -0,0 +1,215 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 7248, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFallDamageOracle.java": "b6e64a1f319cbddbc2037a9cdd966b996fc806ba22e2240ab5c50482d2da7321", + "tools/test_fall_damage_parity.py": "b390a613e0e930ec8d26439833b81fa0f4a7d4a009845ec020d4114f595b2f7d", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "10b940e19011465eb9beb1cf87248b3c2bc6842c326974f365be753d0ba97822", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_properties.rs": "9c78bed0d30c8b9cfaa413b9b81b0bf94861605c13b26754e09b24e83d75a227", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "a5021a168adcedc37d77f533a8921c02f09c59f46a01737586aaa33c5908b8d0", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/fall_damage_fixture.rs": "98a4dcdf23b2666bf46bac38513c84a83fdc4de1c014b01b59f678fe3f82a560" + }, + "fixtures_sha256": { + ".local/rust-fall-damage-parity/inputs.txt": "4981d3a5a00c29308102c51f8dd093a9f37900501ff13fe4c61abfad1374ad2b" + }, + "rust_output_sha256": "3d272db7c9407a6984e855b9126bf877188624edeb00f123b9ba145707db89de", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "3d272db7c9407a6984e855b9126bf877188624edeb00f123b9ba145707db89de", + "matched_output_lines": 44566 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "3d272db7c9407a6984e855b9126bf877188624edeb00f123b9ba145707db89de", + "matched_output_lines": 44566 + } + ], + "scope": "Actual base Entity.checkFallDamage with controlled water state, block landing callback, supporting-block lookup, HIT_GROUND emission and reset. Compares float-narrowed downward displacement accumulation, grounded branches, state/position/support mutations during landing, callback order, nonfinite arithmetic and partial state after failures. LivingEntity fluid updates/particles, registered Block.fallOn behavior, health/damage/attributes and the full movement lifecycle are not established by this scoped check." +} diff --git a/crates/horizon-world/examples/fall_damage_fixture.rs b/crates/horizon-world/examples/fall_damage_fixture.rs new file mode 100644 index 000000000..092208c95 --- /dev/null +++ b/crates/horizon-world/examples/fall_damage_fixture.rs @@ -0,0 +1,146 @@ +use horizon_core::{geometry::Vec3, position::BlockPos}; +use horizon_world::fall_damage::{FallDamageWorld, check_fall_damage}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn bits(v: f64) -> u64 { + if v.is_nan() { + 0x7ff8000000000000 + } else { + v.to_bits() + } +} +fn support(v: &Value) -> Option { + if v.is_null() { + None + } else { + Some(BlockPos::new( + v[0].as_i64().unwrap() as i32, + v[1].as_i64().unwrap() as i32, + v[2].as_i64().unwrap() as i32, + )) + } +} +struct World<'a> { + input: &'a Value, + out: &'a mut dyn Write, + calls: i64, + fall: f64, + position: Vec3, + support: Option, +} +impl World<'_> { + fn query(&mut self, text: String) -> io::Result<()> { + writeln!(self.out, "{text}")?; + let call = self.calls; + self.calls += 1; + if call == self.input["fail"].as_i64().unwrap() { + Err(io::Error::other("injected fall query failure")) + } else { + Ok(()) + } + } +} +impl FallDamageWorld for World<'_> { + type Error = io::Error; + type State = u8; + fn is_in_water(&mut self) -> io::Result { + self.query("water".into())?; + Ok(self.input["water"].as_bool().unwrap()) + } + fn fall_distance(&self) -> f64 { + self.fall + } + fn set_fall_distance(&mut self, v: f64) { + self.fall = v; + } + fn fall_on(&mut self, _: u8, p: BlockPos, distance: f64) -> io::Result<()> { + self.query(format!( + "fall-on {} {} {} {:016x}", + p.x, + p.y, + p.z, + bits(distance) + ))?; + if self.input["mutate"].as_bool().unwrap() { + self.fall = 17.25; + self.position = Vec3::new(17.0, 18.0, 19.0); + self.support = support(&self.input["after_support"]); + } + Ok(()) + } + fn position(&self) -> Vec3 { + self.position + } + fn supporting_block(&self) -> Option { + self.support + } + fn block_state(&mut self, p: BlockPos) -> io::Result { + self.query(format!("state {} {} {}", p.x, p.y, p.z))?; + Ok(1) + } + fn hit_ground(&mut self, p: Vec3, s: u8) -> io::Result<()> { + self.query(format!( + "hit-ground {:016x} {:016x} {:016x} {}", + bits(p.x), + bits(p.y), + bits(p.z), + if s == 1 { "queried" } else { "input" } + )) + } + fn reset_fall_distance(&mut self) -> io::Result<()> { + self.query("reset".into())?; + self.fall = 0.0; + Ok(()) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut world = World { + input: &f, + out: &mut out, + calls: 0, + fall: number(&f["fall"]), + position: Vec3::new(0.3, 1.5, -0.3), + support: support(&f["support"]), + }; + let result = check_fall_damage( + &mut world, + number(&f["dy"]), + f["ground"].as_bool().unwrap(), + 0, + BlockPos::new(3, 4, 5), + ); + writeln!( + world.out, + "result {}", + if result.is_ok() { "ok" } else { "error" } + )?; + let p = world.position; + writeln!( + world.out, + "final {:016x} {:016x} {:016x} {:016x}", + bits(world.fall), + bits(p.x), + bits(p.y), + bits(p.z) + )?; + if let Some(p) = world.support { + writeln!(world.out, "support {} {} {}", p.x, p.y, p.z)?; + } else { + writeln!(world.out, "support none")?; + } + writeln!(world.out, "queries {}", world.calls)?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/fall_damage.rs b/crates/horizon-world/src/fall_damage.rs new file mode 100644 index 000000000..d3a1dca42 --- /dev/null +++ b/crates/horizon-world/src/fall_damage.rs @@ -0,0 +1,49 @@ +//! Base Entity fall-distance accumulation and landing callback ordering. +use horizon_core::{geometry::Vec3, position::BlockPos}; + +pub trait FallDamageWorld { + type Error; + type State: Copy; + fn is_in_water(&mut self) -> Result; + fn fall_distance(&self) -> f64; + fn set_fall_distance(&mut self, distance: f64); + fn fall_on( + &mut self, + state: Self::State, + position: BlockPos, + distance: f64, + ) -> Result<(), Self::Error>; + fn position(&self) -> Vec3; + fn supporting_block(&self) -> Option; + fn block_state(&mut self, position: BlockPos) -> Result; + fn hit_ground(&mut self, position: Vec3, state: Self::State) -> Result<(), Self::Error>; + fn reset_fall_distance(&mut self) -> Result<(), Self::Error>; +} +/// LivingEntity's fluid update, landing particles and other overrides wrap this +/// base method separately. Errors preserve prior field changes and callbacks. +pub fn check_fall_damage( + world: &mut W, + dy: f64, + on_ground: bool, + state: W::State, + position: BlockPos, +) -> Result<(), W::Error> { + if !world.is_in_water()? && dy < 0.0 { + world.set_fall_distance(world.fall_distance() - f64::from(dy as f32)); + } + if on_ground { + if world.fall_distance() > 0.0 { + world.fall_on(state, position, world.fall_distance())?; + // Landing callbacks may move the entity or replace its support. + let position = world.position(); + let state = if let Some(support) = world.supporting_block() { + world.block_state(support)? + } else { + state + }; + world.hit_ground(position, state)?; + } + world.reset_fall_distance()?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 2fada8379..d41afce90 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -18,6 +18,7 @@ pub mod dynamic_support; pub mod edge_backoff; pub mod entity_collision; pub mod entity_obstruction; +pub mod fall_damage; pub mod fluid; pub mod ground_support; pub mod heightmap; diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index de744df5c..ade4bde01 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -654,3 +654,18 @@ The shared fixture now supports player probes alongside direct movement and collision checks; workspace Clippy passes. Entity lists, border applicability and collision contexts remain controlled snapshots. A complete player movement/travel loop and playable client remain pending. + + +`check_fall_damage` now implements base-entity fall-distance accumulation and +landing order. Downward displacement narrows to float before being subtracted +from the double fall distance. Grounded landings call the block, read the +possibly changed position/support, emit the ground event and reset fall distance. +Errors preserve completed field writes and callback effects. + +`python3 tools/test_fall_damage_parity.py` runs actual `Entity.checkFallDamage` +with controlled water, landing and event providers. The +[base fall report](../benchmarks/rust-fall-damage-2026-10-07/scoped-parity.json) +records **44,566 matching lines per JAR**, including nonfinite arithmetic, float +underflow, callback mutations and failures at every boundary. Workspace Clippy +passes. Living-entity fluid/particle behavior, registered block landing effects, +health/damage and full movement remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFallDamageOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFallDamageOracle.java new file mode 100644 index 000000000..7c16307dc --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFallDamageOracle.java @@ -0,0 +1,53 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*; +import java.lang.reflect.*; +import java.nio.file.*; +import java.util.*; +import net.minecraft.core.*; +import net.minecraft.world.entity.*; +import net.minecraft.world.level.*; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.state.*; +import net.minecraft.world.level.gameevent.*; +import net.minecraft.world.phys.Vec3; +/** Actual base Entity checkFallDamage with traced landing callbacks and mutations. */ +public final class VanillaFallDamageOracle { + static final class Stop extends RuntimeException {} + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + static Optional support(JsonElement value){if(value.isJsonNull())return Optional.empty();var a=value.getAsJsonArray();return Optional.of(new BlockPos(a.get(0).getAsInt(),a.get(1).getAsInt(),a.get(2).getAsInt()));} + static Field positionField,supportField; + static final class Data { + JsonObject input;PrintWriter out;int calls;Actor actor; + void query(String text){out.println(text);if(calls++==input.get("fail").getAsInt())throw new Stop();} + void mutate() {if(input.get("mutate").getAsBoolean()){try{actor.fallDistance=17.25;positionField.set(actor,new Vec3(17,18,19));supportField.set(actor,support(input.get("after_support")));}catch(ReflectiveOperationException e){throw new AssertionError(e);}}} + } + static final class FallBlock extends Block { + Data d;FallBlock(){super(BlockBehaviour.Properties.of());} + @Override public void fallOn(net.minecraft.world.level.Level level,BlockState state,BlockPos p,Entity entity,double distance){d.query(String.format("fall-on %d %d %d %016x",p.getX(),p.getY(),p.getZ(),Double.doubleToLongBits(distance)));d.mutate();} + } + static final class State extends BlockState {Block block;State(){super(null,null,null);}@Override public Block getBlock(){return block;}} + static final class Level extends net.minecraft.server.level.ServerLevel { + Data d;BlockState queried; + private Level(){super(null,null,null,null,null,null,false,0L,List.of(),false);} + @Override public BlockState getBlockState(BlockPos p){d.query("state "+p.getX()+" "+p.getY()+" "+p.getZ());return queried;} + @Override public void gameEvent(Holder event,Vec3 p,GameEvent.Context context){if(event!=GameEvent.HIT_GROUND)throw new AssertionError(event);d.query(String.format("hit-ground %016x %016x %016x %s",Double.doubleToLongBits(p.x),Double.doubleToLongBits(p.y),Double.doubleToLongBits(p.z),context.affectedState()==queried?"queried":"input"));} + } + static final class Actor extends Marker { + Data d;Actor(){super(null,null);}void configure(Level level){setLevel(level);} + @Override public boolean isInWater(){d.query("water");return d.input.get("water").getAsBoolean();} + @Override public void resetFallDistance(){d.query("reset");super.resetFallDistance();} + void check(double dy,boolean ground,BlockState state,BlockPos p){checkFallDamage(dy,ground,state,p);} + } + public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); + var allocator=Class.forName("sun.misc.Unsafe");var field=allocator.getDeclaredField("theUnsafe");field.setAccessible(true);var unsafe=field.get(null);var allocate=allocator.getMethod("allocateInstance",Class.class);positionField=Entity.class.getDeclaredField("position");positionField.setAccessible(true);supportField=Entity.class.getDeclaredField("mainSupportingBlockPos");supportField.setAccessible(true);Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){ + for(var line:(Iterable)lines::iterator){ + var f=JsonParser.parseString(line).getAsJsonObject();var d=new Data();d.input=f;d.out=out;var level=(Level)allocate.invoke(unsafe,Level.class);level.d=d;level.queried=Blocks.STONE.defaultBlockState();var entity=(Actor)allocate.invoke(unsafe,Actor.class);entity.d=d;d.actor=entity;entity.configure(level);entity.fallDistance=number(f.get("fall"));positionField.set(entity,new Vec3(.3,1.5,-.3));supportField.set(entity,support(f.get("support")));var block=(FallBlock)allocate.invoke(unsafe,FallBlock.class);block.d=d;var state=(State)allocate.invoke(unsafe,State.class);state.block=block; + try{entity.check(number(f.get("dy")),f.get("ground").getAsBoolean(),state,new BlockPos(3,4,5));out.println("result ok");}catch(Stop error){out.println("result error");} + var p=(Vec3)positionField.get(entity);out.printf("final %016x %016x %016x %016x%n",Double.doubleToLongBits(entity.fallDistance),Double.doubleToLongBits(p.x),Double.doubleToLongBits(p.y),Double.doubleToLongBits(p.z));var selected=(Optional)supportField.get(entity);if(selected.isEmpty())out.println("support none");else{var pos=(BlockPos)selected.get();out.println("support "+pos.getX()+" "+pos.getY()+" "+pos.getZ());}out.println("queries "+d.calls); + } + } + } +} diff --git a/tools/test_fall_damage_parity.py b/tools/test_fall_damage_parity.py new file mode 100644 index 000000000..73443c4af --- /dev/null +++ b/tools/test_fall_damage_parity.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python3 +"""Compare base Entity fall accumulation and landing callbacks with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + def bits(v):return struct.pack('>d',float(v)).hex() + def row(fall=2,dy=-.08,ground=True,water=False,support=None,after_support=None,mutate=False,fail=-1):return dict(fall=bits(fall),dy=bits(dy),ground=ground,water=water,support=support,after_support=after_support,mutate=mutate,fail=fail) + values=[-float('inf'),-1e40,-1,-.08,-1e-46,-0.0,0,1e-46,.08,1,1e40,float('inf'),float('nan')] + for fall in values: + for dy in values: + for ground in [False,True]: + for water in [False,True]: + for support in [None,[17,-64,-33]]:yield row(fall,dy,ground,water,support) + for fall in [-1,0,2,float('nan')]: + for dy in [-1,-1e-46,0,1]: + for support in [None,[17,-64,-33]]: + for after in [None,[31,15,-1]]: + for mutate in [False,True]: + for fail in range(-1,6):yield row(fall,dy,support=support,after_support=after,mutate=mutate,fail=fail) + rng=random.Random(0x46414c4c) + for _ in range(5000): + fall=rng.uniform(-.5,10);dy=rng.uniform(-2,1) + if rng.randrange(4)==0:fall=rng.choice(values) + if rng.randrange(4)==0:dy=rng.choice(values) + yield row(fall,dy,bool(rng.randrange(2)),bool(rng.randrange(2)),rng.choice([None,[17,-64,-33]]),rng.choice([None,[31,15,-1]]),bool(rng.randrange(2)),rng.choice([-1,-1,0,1,2,3,4,5])) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-fall-damage-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFallDamageOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/fall_damage_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaFallDamageOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','fall_damage_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('fall_damage_fixture.exe' if os.name=='nt' else 'fall_damage_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} fall-damage output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual base Entity.checkFallDamage with controlled water state, block landing callback, supporting-block lookup, HIT_GROUND emission and reset. Compares float-narrowed downward displacement accumulation, grounded branches, state/position/support mutations during landing, callback order, nonfinite arithmetic and partial state after failures. LivingEntity fluid updates/particles, registered Block.fallOn behavior, health/damage/attributes and the full movement lifecycle are not established by this scoped check.'} + lab.write_json(report_path,report);print(f'Scoped fall damage parity passed: {report_path}') + + +if __name__=='__main__':main() From 219f0ee1de178dd4c4d6609a3e6565395f691a51 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 01:07:11 +0200 Subject: [PATCH 078/253] Match living fall damage decisions and impulse context transitions --- .../scoped-parity.json | 216 ++++++++++++++++++ .../examples/living_fall_fixture.rs | 197 ++++++++++++++++ crates/horizon-world/src/lib.rs | 1 + crates/horizon-world/src/living_fall.rs | 115 ++++++++++ docs/collision-geometry.md | 19 ++ .../parity/VanillaLivingFallOracle.java | 49 ++++ tools/test_living_fall_parity.py | 75 ++++++ 7 files changed, 672 insertions(+) create mode 100644 benchmarks/rust-living-fall-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/living_fall_fixture.rs create mode 100644 crates/horizon-world/src/living_fall.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingFallOracle.java create mode 100644 tools/test_living_fall_parity.py diff --git a/benchmarks/rust-living-fall-2026-10-07/scoped-parity.json b/benchmarks/rust-living-fall-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..2a923a023 --- /dev/null +++ b/benchmarks/rust-living-fall-2026-10-07/scoped-parity.json @@ -0,0 +1,216 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 11096, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingFallOracle.java": "bb29b1f99030f1407d7c25b1553433508a9fbeb5227d236b71ab14ffb8ec7ad9", + "tools/test_living_fall_parity.py": "e18fee2458dcda91c11f1e8226ad078aae1080e1ce3990b29e7e9bf18b52d370", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "3beb1feaf4f2972efb4eb242d6deebe6c3c0a953892b03c8ca4abeea8b5adf59", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_properties.rs": "9c78bed0d30c8b9cfaa413b9b81b0bf94861605c13b26754e09b24e83d75a227", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "a5021a168adcedc37d77f533a8921c02f09c59f46a01737586aaa33c5908b8d0", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/living_fall_fixture.rs": "1e11e704754fbebea9513f17aa3d781fa4498d89fd186240495d16c08c7fbf9d" + }, + "fixtures_sha256": { + ".local/rust-living-fall-parity/inputs.txt": "f8502f8d94827af3aa569327bc15fb1c461d29b2a421d6033ceb37600c1d31c0" + }, + "rust_output_sha256": "4404a6eb6e61bb51c0b96b092739defc07925149451bf0aa8e054deae1b402b9", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "4404a6eb6e61bb51c0b96b092739defc07925149451bf0aa8e054deae1b402b9", + "matched_output_lines": 153025 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "4404a6eb6e61bb51c0b96b092739defc07925149451bf0aa8e054deae1b402b9", + "matched_output_lines": 153025 + } + ], + "scope": "Actual LivingEntity.calculateFallDamage, causeFallDamage and impulse-context setter/reset/grace methods. Controlled immunity/attribute getters, passenger callback, sounds and server hurt callback expose native query order and failure state. Includes changing immunity, passenger mutations, impulse-height limiting, zero/negative/large grace values, float multiplier widening, floor/saturation, signed zero/nonfinite values and setter sequences. Hurt return values do not change the causeFallDamage result. A null level snapshot exercises the native non-server hurt no-op; actual client entity lifecycle, passenger storage/recursion, health/damage processing, attribute provisioning and tick/save/network integration remain pending." +} diff --git a/crates/horizon-world/examples/living_fall_fixture.rs b/crates/horizon-world/examples/living_fall_fixture.rs new file mode 100644 index 000000000..64dc1f2df --- /dev/null +++ b/crates/horizon-world/examples/living_fall_fixture.rs @@ -0,0 +1,197 @@ +use horizon_core::geometry::Vec3; +use horizon_world::living_fall::{ + ImpulseContext, LivingFallWorld, calculate_fall_damage, cause_living_fall_damage, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn single(v: &Value) -> f32 { + f32::from_bits(u32::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn bits(v: f64) -> u64 { + if v.is_nan() { + 0x7ff8000000000000 + } else { + v.to_bits() + } +} +fn vector(v: &Value) -> Option { + if v.is_null() { + None + } else { + Some(Vec3::new(number(&v[0]), number(&v[1]), number(&v[2]))) + } +} +struct World<'a> { + f: &'a Value, + out: &'a mut dyn Write, + calls: i64, + immune_calls: usize, + hurt: usize, + impulse: ImpulseContext, +} +impl World<'_> { + fn query(&mut self, s: String) -> io::Result<()> { + writeln!(self.out, "{s}")?; + let call = self.calls; + self.calls += 1; + if call == self.f["fail"].as_i64().unwrap() { + Err(io::Error::other("injected living fall query failure")) + } else { + Ok(()) + } + } + fn emit(&mut self) -> io::Result<()> { + let i = self.impulse; + writeln!( + self.out, + "grace {} {} {}", + i.reset_grace_time, + i.is_in_grace_time(), + i.ignores_fall_damage() + )?; + if let Some(p) = i.impact_position { + writeln!( + self.out, + "impact {:016x} {:016x} {:016x}", + bits(p.x), + bits(p.y), + bits(p.z) + ) + } else { + writeln!(self.out, "impact none") + } + } +} +impl LivingFallWorld for World<'_> { + type Error = io::Error; + type Sound = bool; + fn impact_position(&self) -> Option { + self.impulse.impact_position + } + fn y(&self) -> f64 { + number(&self.f["y"]) + } + fn reset_impulse(&mut self) -> io::Result<()> { + self.query("reset".into())?; + self.impulse.reset(); + Ok(()) + } + fn try_reset_impulse(&mut self) -> io::Result<()> { + self.query("try-reset".into())?; + if self.impulse.reset_grace_time == 0 { + self.reset_impulse()?; + } + Ok(()) + } + fn immune_to_fall_damage(&mut self) -> io::Result { + self.query("immune".into())?; + let v = self.f["immune"].as_array().unwrap(); + let value = v[self.immune_calls.min(v.len() - 1)].as_bool().unwrap(); + self.immune_calls += 1; + Ok(value) + } + fn propagate_fall_to_passengers(&mut self, d: f64, m: f32) -> io::Result<()> { + self.query(format!( + "passengers {:016x} {:08x}", + bits(d), + if m.is_nan() { 0x7fc00000 } else { m.to_bits() } + ))?; + if self.f["mutate"].as_bool().unwrap() { + self.impulse.reset_grace_time = 17; + self.impulse.impact_position = Some(Vec3::new(17.0, 18.0, 19.0)); + } + Ok(()) + } + fn safe_fall_distance(&mut self) -> io::Result { + self.query("safe".into())?; + Ok(number(&self.f["safe"])) + } + fn fall_damage_multiplier(&mut self) -> io::Result { + self.query("damage-factor".into())?; + Ok(number(&self.f["damage-factor"])) + } + fn fall_sound(&mut self, big: bool) -> io::Result { + self.query("sounds".into())?; + Ok(big) + } + fn play_fall_sound(&mut self, big: bool) -> io::Result<()> { + self.query(format!("sound {}", if big { "big" } else { "small" })) + } + fn play_block_fall_sound(&mut self) -> io::Result<()> { + self.query("block-sound".into()) + } + fn hurt(&mut self, damage: f32) -> io::Result<()> { + if self.f["server"].as_bool().unwrap() { + self.query(format!("hurt {:08x}", damage.to_bits()))?; + self.hurt += 1; + } + Ok(()) + } +} +fn run(world: &mut World<'_>) -> io::Result<()> { + let f = world.f; + match f["mode"].as_u64().unwrap() { + 0 => { + let value = + calculate_fall_damage(world, number(&f["distance"]), single(&f["multiplier"]))?; + writeln!(world.out, "damage {value}")?; + } + 1 => { + let value = + cause_living_fall_damage(world, number(&f["distance"]), single(&f["multiplier"]))?; + writeln!(world.out, "caused {value}")?; + } + 2 => { + for op in f["ops"].as_array().unwrap() { + match op["mode"].as_u64().unwrap() { + 0 => world.impulse.set_ignore_fall_damage( + op["ignore"].as_bool().unwrap(), + vector(&op["position"]), + ), + 1 => world + .impulse + .apply_grace_time(op["ticks"].as_i64().unwrap() as i32), + 2 => world.try_reset_impulse()?, + 3 => world.reset_impulse()?, + _ => unreachable!(), + }; + world.emit()?; + } + } + _ => unreachable!(), + }; + Ok(()) +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut world = World { + f: &f, + out: &mut out, + calls: 0, + immune_calls: 0, + hurt: 0, + impulse: ImpulseContext { + reset_grace_time: f["grace"].as_i64().unwrap() as i32, + impact_position: vector(&f["impact"]), + }, + }; + if run(&mut world).is_err() { + writeln!(world.out, "error")?; + } + world.emit()?; + writeln!(world.out, "hurt-count {}", world.hurt)?; + writeln!(world.out, "queries {}", world.calls)?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index d41afce90..3c17872c6 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -23,6 +23,7 @@ pub mod fluid; pub mod ground_support; pub mod heightmap; pub mod liquid_collision; +pub mod living_fall; pub mod movement_properties; pub mod movement_restitution; pub mod movement_support; diff --git a/crates/horizon-world/src/living_fall.rs b/crates/horizon-world/src/living_fall.rs new file mode 100644 index 000000000..7a650239a --- /dev/null +++ b/crates/horizon-world/src/living_fall.rs @@ -0,0 +1,115 @@ +//! Living-entity fall damage calculation, impulse exemption and callback order. +use horizon_core::geometry::Vec3; + +#[derive(Clone, Copy, Debug, Default, PartialEq)] +pub struct ImpulseContext { + pub reset_grace_time: i32, + pub impact_position: Option, +} +impl ImpulseContext { + pub fn set_ignore_fall_damage(&mut self, ignore: bool, position: Option) { + if ignore { + self.apply_grace_time(40); + self.impact_position = position; + } else { + self.reset_grace_time = 0; + } + } + pub fn apply_grace_time(&mut self, ticks: i32) { + self.reset_grace_time = self.reset_grace_time.max(ticks); + } + pub fn reset(&mut self) { + self.reset_grace_time = 0; + self.impact_position = None; + } + pub fn try_reset(&mut self) { + if self.reset_grace_time == 0 { + self.reset(); + } + } + pub fn is_in_grace_time(&self) -> bool { + self.reset_grace_time > 0 + } + pub fn ignores_fall_damage(&self) -> bool { + self.impact_position.is_some() + } +} +pub trait LivingFallWorld { + type Error; + type Sound: Copy; + fn impact_position(&self) -> Option; + fn y(&self) -> f64; + fn reset_impulse(&mut self) -> Result<(), Self::Error>; + fn try_reset_impulse(&mut self) -> Result<(), Self::Error>; + fn immune_to_fall_damage(&mut self) -> Result; + fn propagate_fall_to_passengers( + &mut self, + distance: f64, + multiplier: f32, + ) -> Result<(), Self::Error>; + fn safe_fall_distance(&mut self) -> Result; + fn fall_damage_multiplier(&mut self) -> Result; + /// Select the entity type's small/big fall sound. Big applies above four. + fn fall_sound(&mut self, big: bool) -> Result; + fn play_fall_sound(&mut self, sound: Self::Sound) -> Result<(), Self::Error>; + fn play_block_fall_sound(&mut self) -> Result<(), Self::Error>; + /// Dispatch native Entity.hurt semantics (server-only), preserving its source. + fn hurt(&mut self, damage: f32) -> Result<(), Self::Error>; +} +pub fn calculate_fall_damage( + world: &mut W, + distance: f64, + multiplier: f32, +) -> Result { + if world.immune_to_fall_damage()? { + return Ok(0); + } + let power = distance + 1.0e-6 - world.safe_fall_distance()?; + Ok((power * f64::from(multiplier) * world.fall_damage_multiplier()?).floor() as i32) +} +fn java_min(a: f64, b: f64) -> f64 { + if a.is_nan() { + a + } else if b.is_nan() { + b + } else if a == 0.0 && b == 0.0 { + f64::from_bits(a.to_bits() | b.to_bits()) + } else { + a.min(b) + } +} +/// Default LivingEntity and Entity fall behavior. Entity-type overrides of the +/// calculation/parent method are a separate dispatch layer. The same damage +/// source must be retained by the provider for riders and the final hurt call. +pub fn cause_living_fall_damage( + world: &mut W, + distance: f64, + multiplier: f32, +) -> Result { + let distance = if let Some(impact) = world.impact_position() { + let distance = java_min(distance, impact.y - world.y()); + if distance <= 0.0 { + world.reset_impulse()?; + } else { + world.try_reset_impulse()?; + } + distance + } else { + distance + }; + // Base Entity.causeFallDamage returns false, even after notifying riders. + if !world.immune_to_fall_damage()? { + world.propagate_fall_to_passengers(distance, multiplier)?; + } + let damage = calculate_fall_damage(world, distance, multiplier)?; + if damage > 0 { + world.reset_impulse()?; + let sound = world.fall_sound(damage > 4)?; + world.play_fall_sound(sound)?; + world.play_block_fall_sound()?; + world.hurt(damage as f32)?; + Ok(true) + } else { + Ok(false) + } +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index ade4bde01..0f3b586ba 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -669,3 +669,22 @@ records **44,566 matching lines per JAR**, including nonfinite arithmetic, float underflow, callback mutations and failures at every boundary. Workspace Clippy passes. Living-entity fluid/particle behavior, registered block landing effects, health/damage and full movement remain pending. + + +`living_fall` implements default living-entity fall power/damage calculation, +impulse-height exemption and landing damage callback order. It retains separate +immunity checks for passenger propagation and damage calculation, double/float +arithmetic and saturating floor-to-int conversion. Positive damage resets the +impulse context, selects the fall sound, plays block landing sound and dispatches +hurt. A rejected hurt callback does not change the native positive-damage result. +`ImpulseContext` also models setter, grace-extension and reset behavior; disabling +ignore clears grace time while retaining the impact position until a later reset. + +`python3 tools/test_living_fall_parity.py` compares actual living methods and +sequential impulse changes. The +[living fall report](../benchmarks/rust-living-fall-2026-10-07/scoped-parity.json) +records **153,025 matching lines per JAR**, including changing immunity, passenger +callback mutations, nonfinite arithmetic, sound threshold selection and failures +after partial state changes. Workspace Clippy passes. Attribute provisioning, +passenger storage/recursion, actual health processing, tick/save/network behavior +and the complete movement lifecycle remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingFallOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingFallOracle.java new file mode 100644 index 000000000..18eebac2c --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingFallOracle.java @@ -0,0 +1,49 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*; +import java.lang.reflect.*; +import java.nio.file.*; +import java.util.*; +import net.minecraft.core.*; +import net.minecraft.tags.*; +import net.minecraft.sounds.*; +import net.minecraft.world.entity.*; +import net.minecraft.world.entity.decoration.ArmorStand; +import net.minecraft.world.entity.ai.attributes.*; +import net.minecraft.world.damagesource.*; +import net.minecraft.world.phys.Vec3; +/** Actual living fall calculation/cause methods and impulse context transitions. */ +public final class VanillaLivingFallOracle { + static final class Stop extends RuntimeException {} + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + static float single(JsonElement v){return Float.intBitsToFloat(Integer.parseUnsignedInt(v.getAsString(),16));} + static Vec3 vector(JsonElement v){if(v.isJsonNull())return null;var a=v.getAsJsonArray();return new Vec3(number(a.get(0)),number(a.get(1)),number(a.get(2)));} + static Field grace,impact; + static final class Data {JsonObject f;PrintWriter out;int calls,immuneCalls,hurt;void query(String s){out.println(s);if(calls++==f.get("fail").getAsInt())throw new Stop();}} + static final class Level extends net.minecraft.server.level.ServerLevel {private Level(){super(null,null,null,null,null,null,false,0L,List.of(),false);}} + static final class Actor extends ArmorStand { + Data d;Actor(){super(null,null);}void configure(Level level){setLevel(level);} + @Override public boolean is(TagKey> tag){if(tag!=EntityTypeTags.FALL_DAMAGE_IMMUNE)throw new AssertionError(tag);d.query("immune");var values=d.f.getAsJsonArray("immune");return values.get(Math.min(d.immuneCalls++,values.size()-1)).getAsBoolean();} + @Override public double getAttributeValue(Holder attribute){String name=attribute==Attributes.SAFE_FALL_DISTANCE?"safe":attribute==Attributes.FALL_DAMAGE_MULTIPLIER?"damage-factor":null;if(name==null)throw new AssertionError(attribute);d.query(name);return number(d.f.get(name));} + @Override public void resetCurrentImpulseContext(){d.query("reset");super.resetCurrentImpulseContext();} + @Override public void tryResetCurrentImpulseContext(){d.query("try-reset");super.tryResetCurrentImpulseContext();} + @Override protected void propagateFallToPassengers(double distance,float multiplier,DamageSource source){d.query(String.format("passengers %016x %08x",Double.doubleToLongBits(distance),Float.floatToIntBits(multiplier)));if(d.f.get("mutate").getAsBoolean()){try{grace.setInt(this,17);impact.set(this,new Vec3(17,18,19));}catch(ReflectiveOperationException e){throw new AssertionError(e);}}} + @Override public Fallsounds getFallSounds(){d.query("sounds");return new Fallsounds(SoundEvents.GENERIC_SMALL_FALL,SoundEvents.GENERIC_BIG_FALL);} + @Override public void playSound(SoundEvent sound,float volume,float pitch){if(volume!=1||pitch!=1)throw new AssertionError();d.query("sound "+(sound==SoundEvents.GENERIC_BIG_FALL?"big":"small"));} + @Override protected void playBlockFallSound(){d.query("block-sound");} + @Override public boolean hurtServer(net.minecraft.server.level.ServerLevel level,DamageSource source,float damage){d.query(String.format("hurt %08x",Float.floatToIntBits(damage)));d.hurt++;return d.f.get("hurt_result").getAsBoolean();} + int calculate(double distance,float multiplier){return calculateFallDamage(distance,multiplier);} + } + public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();var allocator=Class.forName("sun.misc.Unsafe");var field=allocator.getDeclaredField("theUnsafe");field.setAccessible(true);var unsafe=field.get(null);var allocate=allocator.getMethod("allocateInstance",Class.class); + grace=LivingEntity.class.getDeclaredField("currentImpulseContextResetGraceTime");grace.setAccessible(true);impact=LivingEntity.class.getDeclaredField("currentImpulseImpactPos");impact.setAccessible(true);var position=Entity.class.getDeclaredField("position");position.setAccessible(true);Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){ + for(var line:(Iterable)lines::iterator){ + var f=JsonParser.parseString(line).getAsJsonObject();var d=new Data();d.f=f;d.out=out;var entity=(Actor)allocate.invoke(unsafe,Actor.class);entity.d=d;entity.configure(f.get("server").getAsBoolean()?(Level)allocate.invoke(unsafe,Level.class):null);grace.setInt(entity,f.get("grace").getAsInt());impact.set(entity,vector(f.get("impact")));position.set(entity,new Vec3(0,number(f.get("y")),0)); + try{int mode=f.get("mode").getAsInt();if(mode==0)out.println("damage "+entity.calculate(number(f.get("distance")),single(f.get("multiplier"))));else if(mode==1)out.println("caused "+entity.causeFallDamage(number(f.get("distance")),single(f.get("multiplier")),null));else for(var value:f.getAsJsonArray("ops")){var op=value.getAsJsonObject();switch(op.get("mode").getAsInt()){case 0->entity.setIgnoreFallDamageFromCurrentImpulse(op.get("ignore").getAsBoolean(),vector(op.get("position")));case 1->entity.applyPostImpulseGraceTime(op.get("ticks").getAsInt());case 2->entity.tryResetCurrentImpulseContext();case 3->entity.resetCurrentImpulseContext();default->throw new AssertionError();}emit(out,entity);} } + catch(Stop error){out.println("error");}emit(out,entity);out.println("hurt-count "+d.hurt);out.println("queries "+d.calls); + } + } + } + static void emit(PrintWriter out,Actor entity)throws Exception{var p=(Vec3)impact.get(entity);out.println("grace "+grace.getInt(entity)+" "+entity.isInPostImpulseGraceTime()+" "+entity.isIgnoringFallDamageFromCurrentImpulse());if(p==null)out.println("impact none");else out.printf("impact %016x %016x %016x%n",Double.doubleToLongBits(p.x),Double.doubleToLongBits(p.y),Double.doubleToLongBits(p.z));} +} diff --git a/tools/test_living_fall_parity.py b/tools/test_living_fall_parity.py new file mode 100644 index 000000000..f57932f89 --- /dev/null +++ b/tools/test_living_fall_parity.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python3 +"""Compare living fall damage calculation, callbacks and impulse context with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + def bits(v):return struct.pack('>d',float(v)).hex() + def single(v): + try:return struct.pack('>f',float(v)).hex() + except OverflowError:return struct.pack('>f',math.copysign(float('inf'),v)).hex() + def vector(v):return None if v is None else list(map(bits,v)) + def row(mode=1,distance=10,multiplier=1,safe=3,damage=1,immune=(False,False),impact=None,grace=0,y=0,mutate=False,fail=-1,server=True,hurt_result=True,ops=()):return dict(mode=mode,distance=bits(distance),multiplier=single(multiplier),safe=bits(safe),**{'damage-factor':bits(damage)},immune=list(immune),impact=vector(impact),grace=grace,y=bits(y),mutate=mutate,fail=fail,server=server,hurt_result=hurt_result,ops=list(ops)) + values=[-float('inf'),-1,-0.0,0,2.999999,3,3.999999,4,7,8,10,1e40,float('inf'),float('nan')] + for mode in [0,1]: + for distance in values: + for multiplier in [-1,-0.0,0,.5,1,2,float('nan')]: + for safe in [0,3,5,float('nan')]: + for immune in [(False,False),(True,True),(False,True),(True,False)]:yield row(mode,distance,multiplier,safe,immune=immune) + for distance in [-0.0,0,4,10,float('nan')]: + for impact in [None,[0,-1,0],[0,-0.0,0],[0,0,0],[0,2,0],[0,10,0],[0,float('nan'),0]]: + for grace in [-1,0,1,40]: + for fail in range(-1,13):yield row(distance=distance,impact=impact,grace=grace,fail=fail,mutate=True) + rng=random.Random(0x4c4956494e474641) + for _ in range(4000):yield row(mode=rng.randrange(2),distance=rng.choice(values),multiplier=rng.choice(values),safe=rng.choice(values),damage=rng.choice(values),immune=(bool(rng.randrange(2)),bool(rng.randrange(2))),impact=rng.choice([None,[0,0,0],[1,5,2],[0,float('inf'),0]]),grace=rng.choice([-1,0,1,40]),y=rng.choice(values),mutate=bool(rng.randrange(2)),fail=rng.choice([-1,-1,0,1,2,4,7,10]),server=bool(rng.randrange(2)),hurt_result=bool(rng.randrange(2))) + for _ in range(2000): + ops=[] + for _ in range(20):ops.append(dict(mode=rng.randrange(4),ignore=bool(rng.randrange(2)),position=vector(rng.choice([None,[0,0,0],[17,-64,-33]])),ticks=rng.choice([-2147483648,-1,0,1,40,100,2147483647]))) + yield row(mode=2,impact=rng.choice([None,[1,2,3]]),grace=rng.choice([-1,0,1,40,2147483647]),ops=ops,fail=rng.choice([-1,-1,0,3,7,12])) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-living-fall-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingFallOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/living_fall_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaLivingFallOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','living_fall_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('living_fall_fixture.exe' if os.name=='nt' else 'living_fall_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} living-fall output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual LivingEntity.calculateFallDamage, causeFallDamage and impulse-context setter/reset/grace methods. Controlled immunity/attribute getters, passenger callback, sounds and server hurt callback expose native query order and failure state. Includes changing immunity, passenger mutations, impulse-height limiting, zero/negative/large grace values, float multiplier widening, floor/saturation, signed zero/nonfinite values and setter sequences. Hurt return values do not change the causeFallDamage result. A null level snapshot exercises the native non-server hurt no-op; actual client entity lifecycle, passenger storage/recursion, health/damage processing, attribute provisioning and tick/save/network integration remain pending.'} + lab.write_json(report_path,report);print(f'Scoped living fall parity passed: {report_path}') + + +if __name__=='__main__':main() From 2e3866837caee4655c9d481a7d2bef1e6b724de1 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 01:13:45 +0200 Subject: [PATCH 079/253] Match entity pushes from replacement block collision shapes --- .../scoped-parity.json | 217 ++++++++++++++++++ .../examples/block_push_fixture.rs | 129 +++++++++++ crates/horizon-world/src/block_entity_push.rs | 75 ++++++ crates/horizon-world/src/lib.rs | 1 + docs/collision-geometry.md | 16 ++ .../parity/VanillaBlockPushOracle.java | 41 ++++ tools/test_block_push_parity.py | 69 ++++++ 7 files changed, 548 insertions(+) create mode 100644 benchmarks/rust-block-push-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/block_push_fixture.rs create mode 100644 crates/horizon-world/src/block_entity_push.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPushOracle.java create mode 100644 tools/test_block_push_parity.py diff --git a/benchmarks/rust-block-push-2026-10-07/scoped-parity.json b/benchmarks/rust-block-push-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..b671b862d --- /dev/null +++ b/benchmarks/rust-block-push-2026-10-07/scoped-parity.json @@ -0,0 +1,217 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 10082, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPushOracle.java": "4c32767ff21d84bda040384671a51704cf669f4d60dee774ca9d4304a40e30b8", + "tools/test_block_push_parity.py": "383488606ac26dd01719e2daccffa2afe704fd5bce07d067f67345f061ac034e", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "9dbc40b69e90a4938cd5a4c9efdf45d22d2115e7255e8c0898d3a9eb2155a7ce", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_properties.rs": "9c78bed0d30c8b9cfaa413b9b81b0bf94861605c13b26754e09b24e83d75a227", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "a5021a168adcedc37d77f533a8921c02f09c59f46a01737586aaa33c5908b8d0", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/block_push_fixture.rs": "2fb7fd276f09c2cb691a6f90faa1e8163c6c8bd46024141b7152039f1c5803d7" + }, + "fixtures_sha256": { + ".local/rust-block-push-parity/inputs.txt": "9b2aaef7924c303135e638199a314bd6af20a2b0460220cc036c7803b4ef8206" + }, + "rust_output_sha256": "3ff6d08b527186665c2287304d735c8939a90e8359e8a5b1eae48ab5fc7ff612", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "3ff6d08b527186665c2287304d735c8939a90e8359e8a5b1eae48ab5fc7ff612", + "matched_output_lines": 101006 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "3ff6d08b527186665c2287304d735c8939a90e8359e8a5b1eae48ab5fc7ff612", + "matched_output_lines": 101006 + } + ], + "scope": "Actual Block.pushEntitiesUp with old/new collision shape queries and ordered selected entity lists. Compares unoptimized added-space geometry, world translation, entity query bounds, upward collision displacement, zero-distance teleports, current bounds after previous callbacks and partial state after provider failures. Empty/redundant shapes, partial shapes, large coordinates, degenerate/nonfinite entity boxes and callbacks moving later entities are covered. Collision shapes and entity selections are controlled snapshots; registered replacement dispatch, live entity indexing and actual teleport/network behavior remain separate integration work." +} diff --git a/crates/horizon-world/examples/block_push_fixture.rs b/crates/horizon-world/examples/block_push_fixture.rs new file mode 100644 index 000000000..8871b1070 --- /dev/null +++ b/crates/horizon-world/examples/block_push_fixture.rs @@ -0,0 +1,129 @@ +use horizon_core::{ + geometry::{Aabb, Axis, ShapeOp, Vec3, VoxelShape}, + position::BlockPos, +}; +use horizon_world::{ + block_entity_push::{BlockPushWorld, push_entities_up}, + entity_obstruction::EntityIdentity, + registry::BlockStateId, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn bits(v: f64) -> u64 { + if v.is_nan() { + 0x7ff8000000000000 + } else { + v.to_bits() + } +} +fn bbox(v: &Value) -> Aabb { + Aabb::new( + Vec3::new(number(&v[0]), number(&v[1]), number(&v[2])), + Vec3::new(number(&v[3]), number(&v[4]), number(&v[5])), + ) +} +fn bounds(label: &str, b: Aabb) -> String { + format!( + "{label} {:016x} {:016x} {:016x} {:016x} {:016x} {:016x}", + bits(b.min(Axis::X)), + bits(b.min(Axis::Y)), + bits(b.min(Axis::Z)), + bits(b.max(Axis::X)), + bits(b.max(Axis::Y)), + bits(b.max(Axis::Z)) + ) +} +fn shape(v: &Value) -> Result> { + let mut s = VoxelShape::empty(); + for b in v.as_array().unwrap() { + s = s.join(&VoxelShape::from_box(bbox(b))?, ShapeOp::OR)?; + } + Ok(s) +} +struct World<'a> { + f: &'a Value, + out: &'a mut dyn Write, + calls: i64, + shapes: [VoxelShape; 2], + entities: Vec, +} +impl World<'_> { + fn query(&mut self, s: String) -> io::Result<()> { + writeln!(self.out, "{s}")?; + let call = self.calls; + self.calls += 1; + if call == self.f["fail"].as_i64().unwrap() { + Err(io::Error::other("injected push failure")) + } else { + Ok(()) + } + } +} +impl BlockPushWorld for World<'_> { + type Error = io::Error; + fn collision_shape(&mut self, s: BlockStateId, p: BlockPos) -> io::Result { + self.query(format!("shape {} {} {} {}", s.0, p.x, p.y, p.z))?; + Ok(self.shapes[s.0 as usize].clone()) + } + fn entities(&mut self, b: Aabb) -> io::Result> { + self.query(bounds("entities", b))?; + Ok((0..self.entities.len()) + .map(|i| EntityIdentity(i as u64)) + .collect()) + } + fn entity_bounds(&self, e: EntityIdentity) -> Aabb { + self.entities[e.0 as usize] + } + fn teleport_relative(&mut self, e: EntityIdentity, v: Vec3) -> io::Result<()> { + self.query(format!( + "teleport {} {:016x} {:016x} {:016x}", + e.0, + bits(v.x), + bits(v.y), + bits(v.z) + ))?; + let index = e.0 as usize; + self.entities[index] = self.entities[index].move_by(v); + if self.f["mutate"].as_bool().unwrap() && index + 1 < self.entities.len() { + self.entities[index + 1] = self.entities[index + 1].move_by(Vec3::new(0.0, 0.125, 0.0)); + } + Ok(()) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let p = &f["position"]; + let pos = BlockPos::new( + p[0].as_i64().unwrap() as i32, + p[1].as_i64().unwrap() as i32, + p[2].as_i64().unwrap() as i32, + ); + let mut world = World { + f: &f, + out: &mut out, + calls: 0, + shapes: [shape(&f["old"])?, shape(&f["new"])?], + entities: f["entities"].as_array().unwrap().iter().map(bbox).collect(), + }; + match push_entities_up(&mut world, BlockStateId(0), BlockStateId(1), pos) { + Ok(state) => writeln!(world.out, "result {}", state == BlockStateId(1))?, + Err(_) => writeln!(world.out, "error")?, + }; + for (i, b) in world.entities.iter().enumerate() { + writeln!(world.out, "{}", bounds(&format!("final {i}"), *b))?; + } + writeln!(world.out, "queries {}", world.calls)?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/block_entity_push.rs b/crates/horizon-world/src/block_entity_push.rs new file mode 100644 index 000000000..986d12b65 --- /dev/null +++ b/crates/horizon-world/src/block_entity_push.rs @@ -0,0 +1,75 @@ +//! Block.pushEntitiesUp when replacement collision geometry adds occupied space. +use crate::{entity_obstruction::EntityIdentity, registry::BlockStateId}; +use horizon_core::{ + geometry::{Aabb, Axis, ShapeError, ShapeOp, Vec3, VoxelShape}, + position::BlockPos, +}; + +pub trait BlockPushWorld { + type Error; + /// Native no-context block collision query, first old state, then new state. + fn collision_shape( + &mut self, + state: BlockStateId, + position: BlockPos, + ) -> Result; + /// Return the native-selected nonspectator entities in query order. Selection + /// excludes no entity and uses the added shape's bounds, not exact overlap. + fn entities(&mut self, bounds: Aabb) -> Result, Self::Error>; + /// Read each current box just before its teleport: an earlier teleport can + /// change later entities. Handles must remain valid throughout this call. + fn entity_bounds(&self, entity: EntityIdentity) -> Aabb; + fn teleport_relative( + &mut self, + entity: EntityIdentity, + movement: Vec3, + ) -> Result<(), Self::Error>; +} +#[derive(Debug)] +pub enum BlockPushError { + World(E), + Shape(ShapeError), +} +impl std::fmt::Display for BlockPushError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::World(e) => e.fmt(f), + Self::Shape(e) => e.fmt(f), + } + } +} +impl std::error::Error for BlockPushError {} +pub fn push_entities_up( + world: &mut W, + old: BlockStateId, + new: BlockStateId, + position: BlockPos, +) -> Result> { + let old_shape = world + .collision_shape(old, position) + .map_err(BlockPushError::World)?; + let new_shape = world + .collision_shape(new, position) + .map_err(BlockPushError::World)?; + let added = old_shape + .join_unoptimized(&new_shape, ShapeOp::ONLY_SECOND) + .map_err(BlockPushError::Shape)? + .moved(Vec3::new( + f64::from(position.x), + f64::from(position.y), + f64::from(position.z), + )); + if let Some(bounds) = added.bounds() { + let entities = world.entities(bounds).map_err(BlockPushError::World)?; + for entity in entities { + let bounds = world + .entity_bounds(entity) + .move_by(Vec3::new(0.0, 1.0, 0.0)); + let dy = added.collide(Axis::Y, bounds, -1.0); + world + .teleport_relative(entity, Vec3::new(0.0, 1.0 + dy, 0.0)) + .map_err(BlockPushError::World)?; + } + } + Ok(new) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 3c17872c6..002f9d0c2 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -4,6 +4,7 @@ pub mod block_collision; pub mod block_collision_scan; pub mod block_entities; +pub mod block_entity_push; pub mod block_placement; pub mod block_properties; pub mod block_render; diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 0f3b586ba..2949cb3bf 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -688,3 +688,19 @@ callback mutations, nonfinite arithmetic, sound threshold selection and failures after partial state changes. Workspace Clippy passes. Attribute provisioning, passenger storage/recursion, actual health processing, tick/save/network behavior and the complete movement lifecycle remain pending. + + +`push_entities_up` implements the block-replacement push: query old/new shapes, +subtract old occupied space without optimizing the join, translate to world +coordinates and select entities using the added shape's bounds. It reads each +current entity box before calculating its upward displacement and invokes a +relative teleport even when that displacement is zero. + +`python3 tools/test_block_push_parity.py` compares actual `Block.pushEntitiesUp` +with controlled shapes and selected entity lists. The +[block push report](../benchmarks/rust-block-push-2026-10-07/scoped-parity.json) +records **101,006 matching lines per JAR**, including empty/redundant geometry, +partial shapes, large coordinates, nonfinite entity boxes, mutations of later +entities and failures after partial effects. Workspace Clippy passes. Registered +replacement dispatch, actual entity selection and teleport/network semantics +remain separate integration work. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPushOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPushOracle.java new file mode 100644 index 000000000..2e10246b7 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPushOracle.java @@ -0,0 +1,41 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*; +import java.lang.reflect.*; +import java.nio.file.*; +import java.util.*; +import net.minecraft.core.BlockPos; +import net.minecraft.world.entity.*; +import net.minecraft.world.level.*; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.state.*; +import net.minecraft.world.phys.*; +import net.minecraft.world.phys.shapes.*; +/** Actual Block.pushEntitiesUp with controlled shapes and selected entity lists. */ +public final class VanillaBlockPushOracle { + static final class Stop extends RuntimeException {} + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + static AABB box(JsonElement v){var a=v.getAsJsonArray();return new AABB(number(a.get(0)),number(a.get(1)),number(a.get(2)),number(a.get(3)),number(a.get(4)),number(a.get(5)));} + static String bounds(String label,AABB b){return String.format("%s %016x %016x %016x %016x %016x %016x",label,Double.doubleToLongBits(b.minX),Double.doubleToLongBits(b.minY),Double.doubleToLongBits(b.minZ),Double.doubleToLongBits(b.maxX),Double.doubleToLongBits(b.maxY),Double.doubleToLongBits(b.maxZ));} + static VoxelShape shape(JsonElement v){VoxelShape s=Shapes.empty();for(var b:v.getAsJsonArray())s=Shapes.or(s,Shapes.create(box(b)));return s;} + static final class Data{JsonObject f;PrintWriter out;int calls;List actors;void query(String text){out.println(text);if(calls++==f.get("fail").getAsInt())throw new Stop();}} + static final class State extends BlockState { + Data d;int id;VoxelShape shape;State(){super(null,null,null);} + @Override public VoxelShape getCollisionShape(BlockGetter world,BlockPos p){d.query("shape "+id+" "+p.getX()+" "+p.getY()+" "+p.getZ());return shape;} + } + static final class Actor extends Marker { + Data d;int id;Actor(){super(null,null);} + @Override public void teleportRelative(double x,double y,double z){d.query(String.format("teleport %d %016x %016x %016x",id,Double.doubleToLongBits(x),Double.doubleToLongBits(y),Double.doubleToLongBits(z)));setBoundingBox(getBoundingBox().move(x,y,z));if(d.f.get("mutate").getAsBoolean()&&id+1)lines::iterator){ + var f=JsonParser.parseString(line).getAsJsonObject();var d=new Data();d.f=f;d.out=out;d.actors=new ArrayList<>();for(var b:f.getAsJsonArray("entities")){var actor=(Actor)allocate.invoke(unsafe,Actor.class);actor.d=d;actor.id=d.actors.size();actor.setBoundingBox(box(b));d.actors.add(actor);} + var old=(State)allocate.invoke(unsafe,State.class);old.d=d;old.id=0;old.shape=shape(f.get("old"));var next=(State)allocate.invoke(unsafe,State.class);next.d=d;next.id=1;next.shape=shape(f.get("new")); + var world=(LevelAccessor)Proxy.newProxyInstance(LevelAccessor.class.getClassLoader(),new Class[]{LevelAccessor.class},(proxy,method,values)->{if(method.getName().equals("getEntities")&&values.length==2){if(values[0]!=null)throw new AssertionError();d.query(bounds("entities",(AABB)values[1]));return d.actors;}throw new AssertionError(method);});var p=f.getAsJsonArray("position");var pos=new BlockPos(p.get(0).getAsInt(),p.get(1).getAsInt(),p.get(2).getAsInt()); + try{out.println("result "+(Block.pushEntitiesUp(old,next,world,pos)==next));}catch(Stop error){out.println("error");}for(var actor:d.actors)out.println(bounds("final "+actor.id,actor.getBoundingBox()));out.println("queries "+d.calls); + } + } + } +} diff --git a/tools/test_block_push_parity.py b/tools/test_block_push_parity.py new file mode 100644 index 000000000..602c8772e --- /dev/null +++ b/tools/test_block_push_parity.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python3 +"""Compare entity pushes caused by replacement block collision geometry with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + def bits(v):return struct.pack('>d',float(v)).hex() + def row(old,new,position=(0,0,0),entities=(),mutate=False,fail=-1):return dict(old=[list(map(bits,b)) for b in old],new=[list(map(bits,b)) for b in new],position=position,entities=[list(map(bits,b)) for b in entities],mutate=mutate,fail=fail) + shapes=[[],[[0,0,0,1,1,1]],[[0,0,0,1,.9375,1]],[[0,0,0,1,.5,1]],[[0,.5,0,1,1,1]],[[0,0,0,.1,1,1]],[[0,0,0,1,1e-8,1]],[[0,0,0,1,1e-7,1]],[[-.5,-.5,-.5,1.5,1.5,1.5]],[[0,0,0,.25,.5,1],[.75,0,0,1,1,1]],[[0,0,0,0,0,0]]] + for old in shapes: + for new in shapes: + for p in [(0,0,0),(17,-64,-33),(2147483647,0,-2147483648)]: + entities=[[p[0]+.2,p[1]+y,p[2]+.2,p[0]+.8,p[1]+y+1.8,p[2]+.8] for y in [-1,0,.5,.9375,1,1.1]] + for mutate in [False,True]: + for fail in [-1,0,1,2,3,5,8]:yield row(old,new,p,entities,mutate,fail) + rng=random.Random(0x505553485550) + for _ in range(5000): + old=rng.choice(shapes);new=rng.choice(shapes);p=rng.choice([(0,0,0),(17,-64,-33)]) + entities=[] + for _ in range(rng.randrange(8)): + low=[rng.choice([-1,-0.0,0,.2,.5,1,1.5,float('nan')])+p[i] for i in range(3)];high=[v+rng.choice([0,1e-8,1e-7,.3,.6,1.8]) for v in low];entities.append([*low,*high]) + yield row(old,new,p,entities,bool(rng.randrange(2)),rng.choice([-1,-1,0,1,2,3,6,10])) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-block-push-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPushOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/block_push_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaBlockPushOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','block_push_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('block_push_fixture.exe' if os.name=='nt' else 'block_push_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} block-push output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual Block.pushEntitiesUp with old/new collision shape queries and ordered selected entity lists. Compares unoptimized added-space geometry, world translation, entity query bounds, upward collision displacement, zero-distance teleports, current bounds after previous callbacks and partial state after provider failures. Empty/redundant shapes, partial shapes, large coordinates, degenerate/nonfinite entity boxes and callbacks moving later entities are covered. Collision shapes and entity selections are controlled snapshots; registered replacement dispatch, live entity indexing and actual teleport/network behavior remain separate integration work.'} + lab.write_json(report_path,report);print(f'Scoped block push parity passed: {report_path}') + + +if __name__=='__main__':main() From 6cea2835e040bbb8a9e4ab24aa698e74f32738ad Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 01:37:33 +0200 Subject: [PATCH 080/253] Match registered block landing and bounce reactions --- .../scoped-parity.json | 228 +++++++++ .../examples/block_landing_fixture.rs | 326 +++++++++++++ crates/horizon-world/src/block_landing.rs | 437 ++++++++++++++++++ crates/horizon-world/src/lib.rs | 1 + .../horizon-world/src/movement_properties.rs | 11 + docs/collision-geometry.md | 17 + .../parity/VanillaBlockLandingOracle.java | 218 +++++++++ tools/test_block_landing_parity.py | 82 ++++ 8 files changed, 1320 insertions(+) create mode 100644 benchmarks/rust-block-landing-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/block_landing_fixture.rs create mode 100644 crates/horizon-world/src/block_landing.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockLandingOracle.java create mode 100644 tools/test_block_landing_parity.py diff --git a/benchmarks/rust-block-landing-2026-10-07/scoped-parity.json b/benchmarks/rust-block-landing-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..58f9211de --- /dev/null +++ b/benchmarks/rust-block-landing-2026-10-07/scoped-parity.json @@ -0,0 +1,228 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "registry_states": 35723, + "registry_blocks": 1286, + "fixtures": 712544, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockLandingOracle.java": "e397acdbaf2702f358c90ba53a804afa26d7f29a278884c0e779b18f1ae40e63", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMovementRegistryOracle.java": "49fcc1f4348a8e279dcb916ae149de8c97f15df54ff1a675826b7c6c3dda06d9", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "f2b4f440a5bbce4224a4b3cee494b0f7ddcafbf72db12592c94ef9fb94fbc8a6", + "tools/test_block_landing_parity.py": "6785ecf77217ec5698db4ee532624401955eabeaa8b545175b4ccca7250f1f52", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-world/examples/block_landing_fixture.rs": "7bbcacc9b67321d1d12684c488c73f4935e3a22f4c8e5141f93673d5918b4efb", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "525f4245d9125f7007a3c1d63ab1ac327aac6e6e4134fb25f56a996bf8859c41", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "a5021a168adcedc37d77f533a8921c02f09c59f46a01737586aaa33c5908b8d0", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f" + }, + "fixtures_sha256": { + ".local/rust-block-landing-parity/inputs.txt": "44b0aec7dc5b05175f1562b0afa6b64c67cf0fc5370c8006341cb9f45da54119", + ".local/rust-block-landing-parity/landing-states.json": "f4a8503a3d5a141b158971fb9bc37bcc90086401b3f5b6b37f2352fa9beb41a4", + ".local/rust-block-landing-parity/landing-definitions.json": "03f7a3aaa6e52c0fabb845fb7a43054538771d14e47e5d8f9a88bb907b7780a9", + ".local/rust-block-landing-parity/movement-properties.nbt": "4b5646cbb675025efc9ac6e24b024ac2edddfa6725eb8e158357beda622a3888", + ".local/rust-block-landing-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-block-landing-parity/cached-collision.nbt": "4a274cd720a1bda585b02f50f16e90246576679e1e173c214548c5cbf607ab2d" + }, + "rust_output_sha256": "dca0477ebdf14f4da98f71d1c77a0df01db9c04dd8a381d9b2426de6a4659feb", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "dca0477ebdf14f4da98f71d1c77a0df01db9c04dd8a381d9b2426de6a4659feb", + "matched_output_lines": 3524267 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "dca0477ebdf14f4da98f71d1c77a0df01db9c04dd8a381d9b2426de6a4659feb", + "matched_output_lines": 3524267 + } + ], + "scope": "Actual registered Block.fallOn and bounceOn across all states and eight entity class families, plus client/server distinctions, damage return, bounce suppression, protection/rules, random boundaries, NaN/infinity and failures at each observable callback. Farmland replacement uses native registered collision shapes and ordered occupant pushes; turtle egg changes preserve hatch and compare write flags, event order and effects after failed writes. Entity damage, randomness, selected entities, sounds, world writes and events are controlled providers. Live health, entity storage, network, audio and full movement lifecycle integration remain separate work." +} diff --git a/crates/horizon-world/examples/block_landing_fixture.rs b/crates/horizon-world/examples/block_landing_fixture.rs new file mode 100644 index 000000000..9e20d5a1b --- /dev/null +++ b/crates/horizon-world/examples/block_landing_fixture.rs @@ -0,0 +1,326 @@ +use horizon_core::{ + geometry::{Aabb, Axis, Vec3, VoxelShape}, + position::BlockPos, +}; +use horizon_world::{ + block_entity_push::BlockPushWorld, + block_landing::*, + collision::CachedCollisionRegistry, + entity_obstruction::EntityIdentity, + movement_properties::MovementProperties, + nbt::{self, Limits, Tag}, + registry::{BlockRegistry, BlockStateId}, +}; +use serde_json::Value; +use std::{ + collections::BTreeMap, + fs, + io::{self, Write}, + path::Path, +}; +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn single(v: &Value) -> f32 { + f32::from_bits(u32::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn bits(v: f64) -> u64 { + if v.is_nan() { + 0x7ff8000000000000 + } else { + v.to_bits() + } +} +fn fbits(v: f32) -> u32 { + if v.is_nan() { 0x7fc00000 } else { v.to_bits() } +} +fn pos(p: BlockPos) -> String { + format!("{} {} {}", p.x, p.y, p.z) +} +fn bbox(v: &Value) -> Aabb { + Aabb::new( + Vec3::new(number(&v[0]), number(&v[1]), number(&v[2])), + Vec3::new(number(&v[3]), number(&v[4]), number(&v[5])), + ) +} +fn bounds(label: &str, b: Aabb) -> String { + format!( + "{label} {:016x} {:016x} {:016x} {:016x} {:016x} {:016x}", + bits(b.min(Axis::X)), + bits(b.min(Axis::Y)), + bits(b.min(Axis::Z)), + bits(b.max(Axis::X)), + bits(b.max(Axis::Y)), + bits(b.max(Axis::Z)) + ) +} +struct World<'a, 'r> { + f: &'a Value, + out: &'a mut dyn Write, + calls: i64, + state: BlockStateId, + air: BlockStateId, + collision: &'a CachedCollisionRegistry<'r>, + entities: Vec, +} +impl World<'_, '_> { + fn flag(&self, k: &str) -> bool { + self.f[k].as_bool().unwrap() + } + fn query(&mut self, s: String) -> io::Result<()> { + writeln!(self.out, "{s}")?; + let call = self.calls; + self.calls += 1; + if call == self.f["fail"].as_i64().unwrap() { + Err(io::Error::other("injected landing failure")) + } else { + Ok(()) + } + } +} +impl BlockPushWorld for World<'_, '_> { + type Error = io::Error; + fn collision_shape(&mut self, s: BlockStateId, _: BlockPos) -> io::Result { + Ok(self + .collision + .cached_shape(s)? + .expect("registered farmland/base shapes cached") + .clone()) + } + fn entities(&mut self, b: Aabb) -> io::Result> { + self.query(bounds("entities", b))?; + Ok((0..self.entities.len()) + .map(|i| EntityIdentity(i as u64)) + .collect()) + } + fn entity_bounds(&self, e: EntityIdentity) -> Aabb { + self.entities[e.0 as usize] + } + fn teleport_relative(&mut self, e: EntityIdentity, v: Vec3) -> io::Result<()> { + self.query(format!( + "teleport {} {:016x} {:016x} {:016x}", + e.0, + bits(v.x), + bits(v.y), + bits(v.z) + ))?; + let i = e.0 as usize; + self.entities[i] = self.entities[i].move_by(v); + if self.flag("mutate") && i + 1 < self.entities.len() { + self.entities[i + 1] = self.entities[i + 1].move_by(Vec3::new(0.0, 0.125, 0.0)); + } + Ok(()) + } +} +impl BlockLandingWorld for World<'_, '_> { + type DamageSource = &'static str; + type Sound = &'static str; + fn is_server_level(&self) -> bool { + self.flag("server") + } + fn is_client_side(&mut self) -> io::Result { + self.query("client".into())?; + Ok(self.flag("client")) + } + fn random_float(&mut self) -> io::Result { + self.query("random".into())?; + self.query("float".into())?; + Ok(single(&self.f["random_float"])) + } + fn random_int(&mut self, b: i32) -> io::Result { + self.query("random".into())?; + self.query(format!("int {b}"))?; + Ok(self.f["random_int"].as_i64().unwrap() as i32) + } + fn under_spawn_protection(&mut self, p: BlockPos) -> io::Result { + self.query("server".into())?; + self.query(format!("protection {}", pos(p)))?; + Ok(self.flag("protected")) + } + fn mob_griefing(&mut self) -> io::Result { + self.query("rules".into())?; + self.query("mob-griefing".into())?; + Ok(self.flag("griefing")) + } + fn entity_dimensions(&self) -> (f32, f32) { + (single(&self.f["width"]), single(&self.f["height"])) + } + fn suppressing_bounce(&mut self) -> io::Result { + self.query("suppress".into())?; + Ok(self.flag("suppress")) + } + fn damage_source( + &mut self, + o: DamageSourceOwner, + k: LandingDamage, + ) -> io::Result { + self.query( + match o { + DamageSourceOwner::Entity => "entity-sources", + DamageSourceOwner::Level => "level-sources", + } + .into(), + )?; + let k = match k { + LandingDamage::Fall => "fall", + LandingDamage::Stalagmite => "stalagmite", + }; + self.query(format!("{k}-source"))?; + Ok(k) + } + fn cause_fall_damage(&mut self, d: f64, m: f32, s: Self::DamageSource) -> io::Result { + self.query(format!("damage {:016x} {:08x} {s}", bits(d), fbits(m)))?; + Ok(self.flag("damage")) + } + fn known_sound(&self, s: LandingSound) -> Self::Sound { + match s { + LandingSound::HoneySlide => "honey-slide", + LandingSound::HoneyFall => "honey-fall", + LandingSound::TurtleEggBreak => "egg-break", + LandingSound::ShelfMushroomBounce => "mushroom", + } + } + fn living_fall_sound(&mut self, big: bool) -> io::Result { + self.query("fall-sounds".into())?; + Ok(if big { "big" } else { "small" }) + } + fn entity_sound(&mut self, s: Self::Sound, v: f32, p: f32) -> io::Result<()> { + self.query(format!( + "entity-sound {s} {:08x} {:08x}", + fbits(v), + fbits(p) + )) + } + fn block_sound(&mut self, p: BlockPos, s: Self::Sound, v: f32, pitch: f32) -> io::Result<()> { + self.query(format!( + "block-sound {} {s} {:08x} {:08x}", + pos(p), + fbits(v), + fbits(pitch) + )) + } + fn broadcast_entity_event(&mut self, e: u8) -> io::Result<()> { + self.query(format!("broadcast {e}")) + } + fn destroy_block(&mut self, p: BlockPos, drops: bool) -> io::Result { + self.query(format!("destroy {} {drops}", pos(p)))?; + if self.flag("write") { + self.state = self.air; + } + Ok(self.flag("write")) + } + fn set_block(&mut self, p: BlockPos, s: BlockStateId, flags: u32) -> io::Result { + self.query(format!("set {} {} {flags}", pos(p), s.0))?; + if self.flag("write") { + self.state = s; + } + Ok(self.flag("write")) + } + fn block_event( + &mut self, + e: LandingEvent, + p: BlockPos, + s: BlockStateId, + entity: bool, + ) -> io::Result<()> { + self.query(format!( + "event {} {} {} {entity}", + match e { + LandingEvent::BlockChange => "change", + LandingEvent::BlockDestroy => "destroy", + }, + pos(p), + s.0 + )) + } + fn level_event(&mut self, e: i32, p: BlockPos, d: i32) -> io::Result<()> { + self.query(format!("level-event {e} {} {d}", pos(p))) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + let read = |name: &str| -> Result> { + Ok( + nbt::read_named(&fs::read(dir.join(name))?, Limits::default())? + .0 + .tag, + ) + }; + let registry = BlockRegistry::from_nbt(&read("block-registry.nbt")?)?; + let data = read("movement-properties.nbt")?; + let properties = MovementProperties::from_nbt(&data, ®istry)?; + let collision = CachedCollisionRegistry::from_nbt(&read("cached-collision.nbt")?, ®istry)?; + let raw: BTreeMap = + serde_json::from_str(&fs::read_to_string(dir.join("landing-definitions.json"))?)?; + let mut definitions = BTreeMap::new(); + for (name, d) in raw { + let fall = match d["fall"].as_str().unwrap() { + "Block" => FallDefinition::Default, + "HayBlock" => FallDefinition::Hay, + "HoneyBlock" => FallDefinition::Honey { + volume: single(&d["volume"]), + pitch: single(&d["pitch"]), + }, + "SlimeBlock" => FallDefinition::Slime, + "PowderSnowBlock" => FallDefinition::PowderSnow, + "PointedDripstoneBlock" => FallDefinition::PointedDripstone, + "FarmlandBlock" => FallDefinition::Farmland { + base_block: d["base"].as_str().unwrap().into(), + }, + "TurtleEggBlock" => FallDefinition::TurtleEgg, + _ => panic!("unknown landing family"), + }; + definitions.insert( + name, + LandingDefinition { + fall, + shelf_mushroom_bounce: d["bounce"].as_bool().unwrap(), + }, + ); + } + let landing = BlockLandingRegistry::new(&properties, &definitions)?; + let kinds = [ + LandingEntityKind::Other, + LandingEntityKind::Living, + LandingEntityKind::Player, + LandingEntityKind::Zombie, + LandingEntityKind::Turtle, + LandingEntityKind::Bat, + LandingEntityKind::Item, + LandingEntityKind::PrimedTnt, + ]; + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let s = BlockStateId(f["state"].as_u64().unwrap() as u32); + let p = &f["position"]; + let p = BlockPos::new( + p[0].as_i64().unwrap() as i32, + p[1].as_i64().unwrap() as i32, + p[2].as_i64().unwrap() as i32, + ); + let kind = kinds[f["kind"].as_u64().unwrap() as usize]; + let mut world = World { + f: &f, + out: &mut out, + calls: 0, + state: s, + air: registry.default_state("minecraft:air").unwrap(), + collision: &collision, + entities: f["entities"].as_array().unwrap().iter().map(bbox).collect(), + }; + let result = if world.flag("bounce") { + landing.bounce_on(&mut world, s, p, kind) + } else { + landing.fall_on(&mut world, s, p, kind, number(&f["distance"])) + }; + writeln!(world.out, "{}", if result.is_ok() { "ok" } else { "error" })?; + writeln!(world.out, "state {}", world.state.0)?; + for (i, b) in world.entities.iter().enumerate() { + writeln!(world.out, "{}", bounds(&format!("final {i}"), *b))?; + } + writeln!(world.out, "queries {}", world.calls)?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/block_landing.rs b/crates/horizon-world/src/block_landing.rs new file mode 100644 index 000000000..ebcd78e29 --- /dev/null +++ b/crates/horizon-world/src/block_landing.rs @@ -0,0 +1,437 @@ +//! Registered block landing/bounce reactions and their ordered world effects. +use crate::{ + block_entity_push::{BlockPushError, BlockPushWorld, push_entities_up}, + compression::invalid, + movement_properties::MovementProperties, + registry::BlockStateId, +}; +use horizon_core::position::BlockPos; +use std::{collections::BTreeMap, fmt, io}; +#[derive(Clone, Debug)] +pub enum FallDefinition { + Default, + Hay, + Honey { volume: f32, pitch: f32 }, + Slime, + PowderSnow, + PointedDripstone, + Farmland { base_block: String }, + TurtleEgg, +} +#[derive(Clone, Debug)] +pub struct LandingDefinition { + pub fall: FallDefinition, + pub shelf_mushroom_bounce: bool, +} +#[derive(Clone, Copy, Debug)] +enum Rule { + Default, + Hay, + Honey { volume: f32, pitch: f32 }, + Slime, + PowderSnow, + DripstoneTip, + Farmland { base: BlockStateId }, + TurtleEgg { remaining: Option }, +} +#[derive(Clone, Copy, Debug)] +struct State { + rule: Rule, + reduction: f32, + shelf_mushroom_bounce: bool, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum LandingEntityKind { + Other, + Living, + Player, + Zombie, + Turtle, + Bat, + Item, + PrimedTnt, +} +impl LandingEntityKind { + fn living(self) -> bool { + matches!( + self, + Self::Living | Self::Player | Self::Zombie | Self::Turtle | Self::Bat + ) + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum LandingSound { + HoneySlide, + HoneyFall, + TurtleEggBreak, + ShelfMushroomBounce, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum LandingDamage { + Fall, + Stalagmite, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum DamageSourceOwner { + Entity, + Level, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum LandingEvent { + BlockChange, + BlockDestroy, +} + +pub trait BlockLandingWorld: BlockPushWorld { + type DamageSource: Copy; + type Sound: Copy; + fn is_server_level(&self) -> bool; + fn is_client_side(&mut self) -> Result; + fn random_float(&mut self) -> Result; + fn random_int(&mut self, bound: i32) -> Result; + fn under_spawn_protection(&mut self, position: BlockPos) -> Result; + fn mob_griefing(&mut self) -> Result; + fn entity_dimensions(&self) -> (f32, f32); + fn suppressing_bounce(&mut self) -> Result; + fn damage_source( + &mut self, + owner: DamageSourceOwner, + kind: LandingDamage, + ) -> Result; + fn cause_fall_damage( + &mut self, + distance: f64, + multiplier: f32, + source: Self::DamageSource, + ) -> Result; + fn known_sound(&self, sound: LandingSound) -> Self::Sound; + fn living_fall_sound(&mut self, big: bool) -> Result; + fn entity_sound( + &mut self, + sound: Self::Sound, + volume: f32, + pitch: f32, + ) -> Result<(), Self::Error>; + /// Sound source BLOCKS, with no excluded/source entity. + fn block_sound( + &mut self, + position: BlockPos, + sound: Self::Sound, + volume: f32, + pitch: f32, + ) -> Result<(), Self::Error>; + fn broadcast_entity_event(&mut self, event: u8) -> Result<(), Self::Error>; + fn destroy_block(&mut self, position: BlockPos, drops: bool) -> Result; + fn set_block( + &mut self, + position: BlockPos, + state: BlockStateId, + flags: u32, + ) -> Result; + fn block_event( + &mut self, + event: LandingEvent, + position: BlockPos, + state: BlockStateId, + with_entity: bool, + ) -> Result<(), Self::Error>; + fn level_event(&mut self, event: i32, position: BlockPos, data: i32) + -> Result<(), Self::Error>; +} +#[derive(Debug)] +pub enum LandingError { + Data(io::Error), + World(E), + Push(BlockPushError), +} +impl fmt::Display for LandingError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::Data(e) => e.fmt(f), + Self::World(e) => e.fmt(f), + Self::Push(e) => e.fmt(f), + } + } +} +impl std::error::Error for LandingError {} +pub struct BlockLandingRegistry { + states: Vec, +} +impl BlockLandingRegistry { + pub fn new( + properties: &MovementProperties<'_>, + definitions: &BTreeMap, + ) -> io::Result { + let registry = properties.registry(); + if definitions + .keys() + .any(|name| registry.default_state(name).is_none()) + { + return Err(invalid("unknown landing definition")); + } + let mut states = Vec::with_capacity(registry.len()); + for index in 0..registry.len() { + let id = BlockStateId(index as u32); + let state = registry.state(id).unwrap(); + let definition = definitions + .get(&state.name) + .ok_or_else(|| invalid("missing landing definition"))?; + let rule = match &definition.fall { + FallDefinition::Default => Rule::Default, + FallDefinition::Hay => Rule::Hay, + FallDefinition::Honey { volume, pitch } => Rule::Honey { + volume: *volume, + pitch: *pitch, + }, + FallDefinition::Slime => Rule::Slime, + FallDefinition::PowderSnow => Rule::PowderSnow, + FallDefinition::PointedDripstone => { + let direction = state + .properties + .get("vertical_direction") + .map(String::as_str); + let thickness = state.properties.get("thickness").map(String::as_str); + if !matches!(direction, Some("up" | "down")) + || !matches!( + thickness, + Some("tip" | "tip_merge" | "frustum" | "middle" | "base") + ) + { + return Err(invalid("invalid landing dripstone state")); + } + if direction == Some("up") && thickness == Some("tip") { + Rule::DripstoneTip + } else { + Rule::Default + } + } + FallDefinition::Farmland { base_block } => Rule::Farmland { + base: registry + .default_state(base_block) + .ok_or_else(|| invalid("unknown farmland base block"))?, + }, + FallDefinition::TurtleEgg => { + let eggs = state + .properties + .get("eggs") + .and_then(|s| s.parse::().ok()) + .filter(|v| (1..=4).contains(v)) + .ok_or_else(|| invalid("invalid landing egg count"))?; + let remaining = if eggs == 1 { + None + } else { + let mut next = state.clone(); + next.properties + .insert("eggs".into(), (eggs - 1).to_string()); + Some( + registry + .id(&next) + .ok_or_else(|| invalid("missing decremented egg state"))?, + ) + }; + Rule::TurtleEgg { remaining } + } + }; + states.push(State { + rule, + reduction: properties.coefficients(id)?.fall_distance_reduction, + shelf_mushroom_bounce: definition.shelf_mushroom_bounce, + }); + } + Ok(Self { states }) + } + fn state(&self, id: BlockStateId) -> Result> { + self.states + .get(id.0 as usize) + .copied() + .ok_or_else(|| LandingError::Data(invalid("landing state outside registry"))) + } + pub fn bounce_on( + &self, + world: &mut W, + state: BlockStateId, + position: BlockPos, + entity: LandingEntityKind, + ) -> Result<(), LandingError> { + if self.state(state)?.shelf_mushroom_bounce + && !matches!( + entity, + LandingEntityKind::Item | LandingEntityKind::PrimedTnt + ) + { + let sound = world.known_sound(LandingSound::ShelfMushroomBounce); + world + .block_sound(position, sound, 1.0, 1.0) + .map_err(LandingError::World)?; + } + Ok(()) + } + pub fn fall_on( + &self, + world: &mut W, + state: BlockStateId, + position: BlockPos, + entity: LandingEntityKind, + distance: f64, + ) -> Result<(), LandingError> { + let data = self.state(state)?; + match data.rule { + Rule::Default => {} + Rule::Hay => { + cause( + world, + DamageSourceOwner::Level, + LandingDamage::Fall, + distance, + 0.2, + )?; + return Ok(()); + } + Rule::Honey { volume, pitch } => { + let sound = world.known_sound(LandingSound::HoneySlide); + world + .entity_sound(sound, 1.0, 1.0) + .map_err(LandingError::World)?; + if !world.is_client_side().map_err(LandingError::World)? { + world + .broadcast_entity_event(54) + .map_err(LandingError::World)?; + } + if cause( + world, + DamageSourceOwner::Level, + LandingDamage::Fall, + distance, + 0.2, + )? { + let sound = world.known_sound(LandingSound::HoneyFall); + world + .entity_sound(sound, volume * 0.5, pitch * 0.75) + .map_err(LandingError::World)?; + } + return Ok(()); + } + Rule::Slime => { + if !world.suppressing_bounce().map_err(LandingError::World)? { + cause( + world, + DamageSourceOwner::Level, + LandingDamage::Fall, + distance, + 0.0, + )?; + } + return Ok(()); + } + Rule::PowderSnow => { + if (distance >= 4.0 || distance.is_nan()) && entity.living() { + let sound = world + .living_fall_sound(distance >= 7.0 || distance.is_nan()) + .map_err(LandingError::World)?; + world + .entity_sound(sound, 1.0, 1.0) + .map_err(LandingError::World)?; + } + return Ok(()); + } + Rule::DripstoneTip => { + cause( + world, + DamageSourceOwner::Level, + LandingDamage::Stalagmite, + distance + 2.5, + 2.0, + )?; + return Ok(()); + } + Rule::Farmland { base } => { + if world.is_server_level() + && f64::from(world.random_float().map_err(LandingError::World)?) + < distance - 0.5 + && entity.living() + { + let allowed = if entity == LandingEntityKind::Player { + !world + .under_spawn_protection(position) + .map_err(LandingError::World)? + } else { + world.mob_griefing().map_err(LandingError::World)? + }; + if allowed { + let (width, height) = world.entity_dimensions(); + if width * width * height > 0.512f32 { + let next = push_entities_up(world, state, base, position) + .map_err(LandingError::Push)?; + world + .set_block(position, next, 3) + .map_err(LandingError::World)?; + world + .block_event(LandingEvent::BlockChange, position, next, true) + .map_err(LandingError::World)?; + } + } + } + } + Rule::TurtleEgg { remaining } => { + if !matches!( + entity, + LandingEntityKind::Zombie | LandingEntityKind::Turtle | LandingEntityKind::Bat + ) && world.is_server_level() + { + let allowed = if entity == LandingEntityKind::Player { + !world + .under_spawn_protection(position) + .map_err(LandingError::World)? + } else { + entity.living() && world.mob_griefing().map_err(LandingError::World)? + }; + if allowed && world.random_int(3).map_err(LandingError::World)? == 0 { + let sound = world.known_sound(LandingSound::TurtleEggBreak); + let pitch = + 0.9f32 + world.random_float().map_err(LandingError::World)? * 0.2f32; + world + .block_sound(position, sound, 0.7, pitch) + .map_err(LandingError::World)?; + if let Some(next) = remaining { + world + .set_block(position, next, 2) + .map_err(LandingError::World)?; + world + .block_event(LandingEvent::BlockDestroy, position, state, false) + .map_err(LandingError::World)?; + world + .level_event(2001, position, state.0 as i32) + .map_err(LandingError::World)?; + } else { + world + .destroy_block(position, false) + .map_err(LandingError::World)?; + } + } + } + } + } + cause( + world, + DamageSourceOwner::Entity, + LandingDamage::Fall, + distance * f64::from(1.0f32 - data.reduction), + 1.0, + )?; + Ok(()) + } +} +fn cause( + world: &mut W, + owner: DamageSourceOwner, + kind: LandingDamage, + distance: f64, + multiplier: f32, +) -> Result> { + let source = world + .damage_source(owner, kind) + .map_err(LandingError::World)?; + world + .cause_fall_damage(distance, multiplier, source) + .map_err(LandingError::World) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 002f9d0c2..bc46a0893 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -5,6 +5,7 @@ pub mod block_collision; pub mod block_collision_scan; pub mod block_entities; pub mod block_entity_push; +pub mod block_landing; pub mod block_placement; pub mod block_properties; pub mod block_render; diff --git a/crates/horizon-world/src/movement_properties.rs b/crates/horizon-world/src/movement_properties.rs index 0b4b673ac..84cafae1e 100644 --- a/crates/horizon-world/src/movement_properties.rs +++ b/crates/horizon-world/src/movement_properties.rs @@ -43,6 +43,17 @@ pub struct MovementProperties<'r> { definitions: BTreeMap, } impl<'r> MovementProperties<'r> { + pub fn registry(&self) -> &'r BlockRegistry { + self.registry + } + pub fn coefficients(&self, state: BlockStateId) -> io::Result { + let state = self + .registry + .state(state) + .ok_or_else(|| invalid("movement state outside registry"))?; + Ok(self.definitions[&state.name]) + } + pub fn from_nbt(tag: &Tag, registry: &'r BlockRegistry) -> io::Result { if tag.get("DataVersion") != Some(&Tag::Int(DATA_VERSION)) { return Err(invalid("movement properties DataVersion mismatch")); diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 2949cb3bf..ba0569a3f 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -704,3 +704,20 @@ partial shapes, large coordinates, nonfinite entity boxes, mutations of later entities and failures after partial effects. Workspace Clippy passes. Registered replacement dispatch, actual entity selection and teleport/network semantics remain separate integration work. + + +`block_landing` binds audited native landing/bounce families to every registered +state. It implements fall-distance reduction, hay/honey damage multipliers, +slime suppression, powder-snow fall sounds, upward dripstone tips, farmland +replacement with occupant pushes, turtle-egg destruction/decrement and shelf +mushroom bounce sounds. Random draws, server-class checks, client flags, spawn +protection, mob griefing, sounds, writes and events retain native order. + +`python3 tools/test_block_landing_parity.py` invokes registered native methods for +all **35,723 states / 1,286 blocks** with eight entity class families. The +[registered landing report](../benchmarks/rust-block-landing-2026-10-07/scoped-parity.json) +records **3,524,267 matching lines per JAR**, including float/double boundaries, +NaN/infinity, failed writes, callback failures, egg hatch preservation and +farmland collision pushes. Targeted Clippy passes. Actual health, live entity +selection/storage, teleport/network behavior, audio playback and full movement +lifecycle integration remain separate work. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockLandingOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockLandingOracle.java new file mode 100644 index 000000000..250a8bf3d --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockLandingOracle.java @@ -0,0 +1,218 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*; +import java.lang.reflect.*; +import java.nio.file.*; +import java.util.*; +import net.minecraft.core.*; +import net.minecraft.core.registries.*; +import net.minecraft.sounds.*; +import net.minecraft.util.RandomSource; +import net.minecraft.world.entity.*; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.damagesource.*; +import net.minecraft.world.level.*; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.state.*; +import net.minecraft.world.level.gamerules.*; +import net.minecraft.world.level.gameevent.*; +import net.minecraft.world.phys.*; +/** Runs registered native landing/bounce methods with controlled observable providers. */ +public final class VanillaBlockLandingOracle { + static final class Stop extends RuntimeException {} + static Object unsafe;static Method allocate; + static T make(Class type){try{return type.cast(allocate.invoke(unsafe,type));}catch(Exception e){throw new AssertionError(e);}} + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + static float single(JsonElement v){return Float.intBitsToFloat(Integer.parseUnsignedInt(v.getAsString(),16));} + static String pos(BlockPos p){return p.getX()+" "+p.getY()+" "+p.getZ();} + static String bounds(String label,AABB b){return String.format("%s %016x %016x %016x %016x %016x %016x",label,Double.doubleToLongBits(b.minX),Double.doubleToLongBits(b.minY),Double.doubleToLongBits(b.minZ),Double.doubleToLongBits(b.maxX),Double.doubleToLongBits(b.maxY),Double.doubleToLongBits(b.maxZ));} + static AABB box(JsonElement v){var a=v.getAsJsonArray();return new AABB(number(a.get(0)),number(a.get(1)),number(a.get(2)),number(a.get(3)),number(a.get(4)),number(a.get(5)));} + static String sound(SoundEvent s){if(s==SoundEvents.HONEY_BLOCK_SLIDE)return "honey-slide";if(s==SoundEvents.HONEY_BLOCK_FALL)return "honey-fall";if(s==SoundEvents.TURTLE_EGG_BREAK)return "egg-break";if(s==SoundEvents.SHELF_MUSHROOM_BOUNCE)return "mushroom";if(s==SoundEvents.GENERIC_SMALL_FALL)return "small";if(s==SoundEvents.GENERIC_BIG_FALL)return "big";throw new AssertionError(s);} + static final class Data { + JsonObject f;PrintWriter out;int calls;BlockState state;Sources sources;Rules rules;Server server;RandomSource random;List occupants; + boolean flag(String name){return f.get(name).getAsBoolean();} + void query(String s){out.println(s);if(calls++==f.get("fail").getAsInt())throw new Stop();} + boolean damage(double distance,float multiplier,DamageSource source){query(String.format("damage %016x %08x %s",Double.doubleToLongBits(distance),Float.floatToIntBits(multiplier),source==sources.fall?"fall":source==sources.stalagmite?"stalagmite":"unknown"));return flag("damage");} + void entitySound(SoundEvent s,float volume,float pitch){query(String.format("entity-sound %s %08x %08x",sound(s),Float.floatToIntBits(volume),Float.floatToIntBits(pitch)));} + boolean set(BlockPos p,BlockState next,int flags){query("set "+pos(p)+" "+Block.getId(next)+" "+flags);if(flag("write"))state=next;return flag("write");} + boolean destroy(BlockPos p,boolean drops){query("destroy "+pos(p)+" "+drops);if(flag("write"))state=Blocks.AIR.defaultBlockState();return flag("write");} + void event(Holder event,BlockPos p,GameEvent.Context c){query("event "+(event==GameEvent.BLOCK_CHANGE?"change":event==GameEvent.BLOCK_DESTROY?"destroy":"unknown")+" "+pos(p)+" "+Block.getId(c.affectedState())+" "+(c.sourceEntity()!=null));} + void blockSound(Entity entity,BlockPos p,SoundEvent sound,SoundSource source,float volume,float pitch){if(entity!=null||source!=SoundSource.BLOCKS)throw new AssertionError();query(String.format("block-sound %s %s %08x %08x",pos(p),sound(sound),Float.floatToIntBits(volume),Float.floatToIntBits(pitch)));} + List entities(Entity excluded,AABB bounds){if(excluded!=null)throw new AssertionError();query(bounds("entities",bounds));return new ArrayList(occupants);} + } + static final class Sources extends DamageSources { + Data d;DamageSource fall,stalagmite;Sources(){super(null);} + @Override public DamageSource fall(){d.query("fall-source");return fall;} + @Override public DamageSource stalagmite(){d.query("stalagmite-source");return stalagmite;} + } + static final class Rules extends GameRules { + Data d;Rules(){super(net.minecraft.world.flag.FeatureFlagSet.of());} + @SuppressWarnings("unchecked") @Override public T get(GameRule rule){if(rule!=GameRules.MOB_GRIEFING)throw new AssertionError();d.query("mob-griefing");return (T)Boolean.valueOf(d.flag("griefing"));} + } + static final class Server extends net.minecraft.server.MinecraftServer { + @Override public int getMaxPlayers(){throw new UnsupportedOperationException();} + Data d;Server(){super(null,null,null,null,Optional.empty(),null,null,null,null,false,null);} + @Override public boolean isUnderSpawnProtection(net.minecraft.server.level.ServerLevel level,BlockPos p,Player player){d.query("protection "+pos(p));return d.flag("protected");} + @Override public boolean initServer(){throw new UnsupportedOperationException();} + @Override public net.minecraft.server.permissions.LevelBasedPermissionSet operatorUserPermissions(){throw new UnsupportedOperationException();} + @Override public net.minecraft.server.permissions.PermissionSet getFunctionCompilationPermissions(){throw new UnsupportedOperationException();} + @Override public boolean shouldRconBroadcast(){throw new UnsupportedOperationException();} + @Override public net.minecraft.util.debugchart.SampleLogger getTickTimeLogger(){throw new UnsupportedOperationException();} + @Override public boolean isTickTimeLoggingEnabled(){throw new UnsupportedOperationException();} + @Override public net.minecraft.SystemReport fillServerSystemReport(net.minecraft.SystemReport p0){throw new UnsupportedOperationException();} + @Override public boolean isDedicatedServer(){throw new UnsupportedOperationException();} + @Override public int getRateLimitPacketsPerSecond(){throw new UnsupportedOperationException();} + @Override public int getCommandSpamThresholdSeconds(){throw new UnsupportedOperationException();} + @Override public int getChatSpamThresholdSeconds(){throw new UnsupportedOperationException();} + @Override public boolean useNativeTransport(){throw new UnsupportedOperationException();} + @Override public boolean isPublished(){throw new UnsupportedOperationException();} + @Override public boolean shouldInformAdmins(){throw new UnsupportedOperationException();} + @Override public boolean isSingleplayerOwner(net.minecraft.server.players.NameAndId p0){throw new UnsupportedOperationException();} + } + static final class ServerWorld extends net.minecraft.server.level.ServerLevel { + Data d;ServerWorld(){super(null,null,null,null,null,null,false,0L,List.of(),false);} + @Override public GameRules getGameRules(){d.query("rules");return d.rules;} + + @Override public boolean isClientSide(){d.query("client");return d.flag("client");} + @Override public RandomSource getRandom(){d.query("random");return d.random;} + @Override public DamageSources damageSources(){d.query("level-sources");return d.sources;} + @Override public net.minecraft.server.MinecraftServer getServer(){d.query("server");return d.server;} + @Override public void playSound(Entity e,BlockPos p,SoundEvent s,SoundSource source,float volume,float pitch){d.blockSound(e,p,s,source,volume,pitch);} + @Override public void broadcastEntityEvent(Entity e,byte event){d.query("broadcast "+event);} + @Override public boolean setBlock(BlockPos p,BlockState state,int flags){return d.set(p,state,flags);} + @Override public boolean destroyBlock(BlockPos p,boolean drops){return d.destroy(p,drops);} + @Override public void gameEvent(Holder e,BlockPos p,GameEvent.Context c){d.event(e,p,c);} + @Override public void levelEvent(int event,BlockPos p,int data){d.query("level-event "+event+" "+pos(p)+" "+data);} + @Override public List getEntities(Entity excluded,AABB bounds){return d.entities(excluded,bounds);} + } + static final class ClientWorld extends Level { + Data d;ClientWorld(){super(null,null,null,null,false,false,0L,0);} + + @Override public boolean isClientSide(){d.query("client");return d.flag("client");} + @Override public RandomSource getRandom(){d.query("random");return d.random;} + @Override public DamageSources damageSources(){d.query("level-sources");return d.sources;} + @Override public net.minecraft.server.MinecraftServer getServer(){d.query("server");return d.server;} + @Override public void playSound(Entity e,BlockPos p,SoundEvent s,SoundSource source,float volume,float pitch){d.blockSound(e,p,s,source,volume,pitch);} + @Override public void broadcastEntityEvent(Entity e,byte event){d.query("broadcast "+event);} + @Override public boolean setBlock(BlockPos p,BlockState state,int flags){return d.set(p,state,flags);} + @Override public boolean destroyBlock(BlockPos p,boolean drops){return d.destroy(p,drops);} + @Override public void gameEvent(Holder e,BlockPos p,GameEvent.Context c){d.event(e,p,c);} + @Override public void levelEvent(int event,BlockPos p,int data){d.query("level-event "+event+" "+pos(p)+" "+data);} + @Override public List getEntities(Entity excluded,AABB bounds){return d.entities(excluded,bounds);} +@Override public net.minecraft.world.clock.ClockManager clockManager(){throw new UnsupportedOperationException();} +@Override public void destroyBlockProgress(int p0,net.minecraft.core.BlockPos p1,int p2){throw new UnsupportedOperationException();} +@Override public java.util.Collection dragonParts(){throw new UnsupportedOperationException();} +@Override public net.minecraft.world.flag.FeatureFlagSet enabledFeatures(){throw new UnsupportedOperationException();} +@Override public net.minecraft.world.attribute.EnvironmentAttributeSystem environmentAttributes(){throw new UnsupportedOperationException();} +@Override public void explode(net.minecraft.world.entity.Entity p0,net.minecraft.world.damagesource.DamageSource p1,net.minecraft.world.level.ExplosionDamageCalculator p2,double p3,double p4,double p5,float p6,boolean p7,net.minecraft.world.level.Level.ExplosionInteraction p8,net.minecraft.core.particles.ParticleOptions p9,net.minecraft.core.particles.ParticleOptions p10,net.minecraft.util.random.WeightedList p11,net.minecraft.core.Holder p12){throw new UnsupportedOperationException();} +@Override public void gameEvent(net.minecraft.core.Holder p0,net.minecraft.world.phys.Vec3 p1,net.minecraft.world.level.gameevent.GameEvent.Context p2){throw new UnsupportedOperationException();} +@Override public java.lang.String gatherChunkSourceStats(){throw new UnsupportedOperationException();} +@Override public net.minecraft.world.ticks.LevelTickAccess getBlockTicks(){throw new UnsupportedOperationException();} +@Override public net.minecraft.world.level.chunk.ChunkSource getChunkSource(){throw new UnsupportedOperationException();} +@Override public net.minecraft.world.level.entity.LevelEntityGetter getEntities(){throw new UnsupportedOperationException();} +@Override public net.minecraft.world.entity.Entity getEntity(int p0){throw new UnsupportedOperationException();} +@Override public net.minecraft.world.ticks.LevelTickAccess getFluidTicks(){throw new UnsupportedOperationException();} +@Override public net.minecraft.world.level.saveddata.maps.MapItemSavedData getMapData(net.minecraft.world.level.saveddata.maps.MapId p0){throw new UnsupportedOperationException();} +@Override public net.minecraft.world.level.storage.LevelData.RespawnData getRespawnData(){throw new UnsupportedOperationException();} +@Override public net.minecraft.world.scores.Scoreboard getScoreboard(){throw new UnsupportedOperationException();} +@Override public int getSeaLevel(){throw new UnsupportedOperationException();} +@Override public net.minecraft.core.Holder getUncachedNoiseBiome(int p0,int p1,int p2){throw new UnsupportedOperationException();} +@Override public net.minecraft.world.level.border.WorldBorder getWorldBorder(){throw new UnsupportedOperationException();} +@Override public void levelEvent(net.minecraft.world.entity.Entity p0,int p1,net.minecraft.core.BlockPos p2,int p3){throw new UnsupportedOperationException();} +@Override public void playSeededSound(net.minecraft.world.entity.Entity p0,net.minecraft.world.entity.Entity p1,net.minecraft.core.Holder p2,net.minecraft.sounds.SoundSource p3,float p4,float p5,long p6){throw new UnsupportedOperationException();} +@Override public void playSeededSound(net.minecraft.world.entity.Entity p0,double p1,double p2,double p3,net.minecraft.core.Holder p4,net.minecraft.sounds.SoundSource p5,float p6,float p7,long p8){throw new UnsupportedOperationException();} +@Override public java.util.List players(){throw new UnsupportedOperationException();} +@Override public net.minecraft.world.item.crafting.RecipeAccess recipeAccess(){throw new UnsupportedOperationException();} +@Override public void sendBlockUpdated(net.minecraft.core.BlockPos p0,net.minecraft.world.level.block.state.BlockState p1,net.minecraft.world.level.block.state.BlockState p2,int p3){throw new UnsupportedOperationException();} +@Override public void setRespawnData(net.minecraft.world.level.storage.LevelData.RespawnData p0){throw new UnsupportedOperationException();} +@Override public net.minecraft.world.TickRateManager tickRateManager(){throw new UnsupportedOperationException();} + } + static final class Other extends Marker { + Data d;Other(){super(null,null);} + @Override public boolean causeFallDamage(double distance,float multiplier,DamageSource source){return d.damage(distance,multiplier,source);} + @Override public boolean isSuppressingBounce(){d.query("suppress");return d.flag("suppress");} + @Override public DamageSources damageSources(){d.query("entity-sources");return d.sources;} + @Override public void playSound(SoundEvent s,float volume,float pitch){d.entitySound(s,volume,pitch);} + } + static final class Living extends net.minecraft.world.entity.decoration.ArmorStand { + Data d;Living(){super(null,null);} + @Override public boolean causeFallDamage(double distance,float multiplier,DamageSource source){return d.damage(distance,multiplier,source);} + @Override public boolean isSuppressingBounce(){d.query("suppress");return d.flag("suppress");} + @Override public DamageSources damageSources(){d.query("entity-sources");return d.sources;} + @Override public void playSound(SoundEvent s,float volume,float pitch){d.entitySound(s,volume,pitch);} + @Override public Fallsounds getFallSounds(){d.query("fall-sounds");return new Fallsounds(SoundEvents.GENERIC_SMALL_FALL,SoundEvents.GENERIC_BIG_FALL);} + } + static final class Human extends Player { + Data d;Human(){super(null,null);} + @Override public boolean causeFallDamage(double distance,float multiplier,DamageSource source){return d.damage(distance,multiplier,source);} + @Override public boolean isSuppressingBounce(){d.query("suppress");return d.flag("suppress");} + @Override public DamageSources damageSources(){d.query("entity-sources");return d.sources;} + @Override public void playSound(SoundEvent s,float volume,float pitch){d.entitySound(s,volume,pitch);} + @Override public Fallsounds getFallSounds(){d.query("fall-sounds");return new Fallsounds(SoundEvents.GENERIC_SMALL_FALL,SoundEvents.GENERIC_BIG_FALL);} + @Override public GameType gameMode(){return GameType.SURVIVAL;} + } + static final class Undead extends net.minecraft.world.entity.monster.zombie.Zombie { + Data d;Undead(){super(null,null);} + @Override public boolean causeFallDamage(double distance,float multiplier,DamageSource source){return d.damage(distance,multiplier,source);} + @Override public boolean isSuppressingBounce(){d.query("suppress");return d.flag("suppress");} + @Override public DamageSources damageSources(){d.query("entity-sources");return d.sources;} + @Override public void playSound(SoundEvent s,float volume,float pitch){d.entitySound(s,volume,pitch);} + @Override public Fallsounds getFallSounds(){d.query("fall-sounds");return new Fallsounds(SoundEvents.GENERIC_SMALL_FALL,SoundEvents.GENERIC_BIG_FALL);} + } + static final class Reptile extends net.minecraft.world.entity.animal.turtle.Turtle { + Data d;Reptile(){super(null,null);} + @Override public boolean causeFallDamage(double distance,float multiplier,DamageSource source){return d.damage(distance,multiplier,source);} + @Override public boolean isSuppressingBounce(){d.query("suppress");return d.flag("suppress");} + @Override public DamageSources damageSources(){d.query("entity-sources");return d.sources;} + @Override public void playSound(SoundEvent s,float volume,float pitch){d.entitySound(s,volume,pitch);} + @Override public Fallsounds getFallSounds(){d.query("fall-sounds");return new Fallsounds(SoundEvents.GENERIC_SMALL_FALL,SoundEvents.GENERIC_BIG_FALL);} + } + static final class Flying extends net.minecraft.world.entity.ambient.Bat { + Data d;Flying(){super(null,null);} + @Override public boolean causeFallDamage(double distance,float multiplier,DamageSource source){return d.damage(distance,multiplier,source);} + @Override public boolean isSuppressingBounce(){d.query("suppress");return d.flag("suppress");} + @Override public DamageSources damageSources(){d.query("entity-sources");return d.sources;} + @Override public void playSound(SoundEvent s,float volume,float pitch){d.entitySound(s,volume,pitch);} + @Override public Fallsounds getFallSounds(){d.query("fall-sounds");return new Fallsounds(SoundEvents.GENERIC_SMALL_FALL,SoundEvents.GENERIC_BIG_FALL);} + } + static final class Item extends net.minecraft.world.entity.item.ItemEntity { + Data d;Item(){super(null,null);} + @Override public boolean causeFallDamage(double distance,float multiplier,DamageSource source){return d.damage(distance,multiplier,source);} + @Override public boolean isSuppressingBounce(){d.query("suppress");return d.flag("suppress");} + @Override public DamageSources damageSources(){d.query("entity-sources");return d.sources;} + @Override public void playSound(SoundEvent s,float volume,float pitch){d.entitySound(s,volume,pitch);} + } + static final class Tnt extends net.minecraft.world.entity.item.PrimedTnt { + Data d;Tnt(){super(null,null);} + @Override public boolean causeFallDamage(double distance,float multiplier,DamageSource source){return d.damage(distance,multiplier,source);} + @Override public boolean isSuppressingBounce(){d.query("suppress");return d.flag("suppress");} + @Override public DamageSources damageSources(){d.query("entity-sources");return d.sources;} + @Override public void playSound(SoundEvent s,float volume,float pitch){d.entitySound(s,volume,pitch);} + } + static final class Occupant extends Marker { + Data d;int id;Occupant(){super(null,null);} + @Override public void teleportRelative(double x,double y,double z){d.query(String.format("teleport %d %016x %016x %016x",id,Double.doubleToLongBits(x),Double.doubleToLongBits(y),Double.doubleToLongBits(z)));setBoundingBox(getBoundingBox().move(x,y,z));if(d.flag("mutate")&&id+1[]{Other.class,Living.class,Human.class,Undead.class,Reptile.class,Flying.class,Item.class,Tnt.class}; + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){ + var f=JsonParser.parseString(line).getAsJsonObject();var d=new Data();d.f=f;d.out=out;d.state=Block.stateById(f.get("state").getAsInt());d.sources=make(Sources.class);d.sources.d=d;d.sources.fall=make(DamageSource.class);d.sources.stalagmite=make(DamageSource.class);d.rules=make(Rules.class);d.rules.d=d;d.server=make(Server.class);d.server.d=d; + d.random=(RandomSource)Proxy.newProxyInstance(RandomSource.class.getClassLoader(),new Class[]{RandomSource.class},(proxy,method,values)->{if(method.getName().equals("nextFloat")){d.query("float");return single(f.get("random_float"));}if(method.getName().equals("nextInt")&&values.length==1){d.query("int "+values[0]);return f.get("random_int").getAsInt();}throw new AssertionError(method);}); + Level world;if(d.flag("server")){var w=make(ServerWorld.class);w.d=d;world=w;}else{var w=make(ClientWorld.class);w.d=d;world=w;} + var kind=kinds[f.get("kind").getAsInt()];var entity=(Entity)make(kind);var dataField=kind.getDeclaredField("d");dataField.set(entity,d);dimensions.set(entity,EntityDimensions.scalable(single(f.get("width")),single(f.get("height"))));d.occupants=new ArrayList<>();for(var box:f.getAsJsonArray("entities")){var e=make(Occupant.class);e.d=d;e.id=d.occupants.size();e.setBoundingBox(box(box));d.occupants.add(e);} + var p=f.getAsJsonArray("position");var position=new BlockPos(p.get(0).getAsInt(),p.get(1).getAsInt(),p.get(2).getAsInt());var state=d.state; + try{if(d.flag("bounce"))state.getBlock().bounceOn(world,state,position,entity,number(f.get("distance")));else state.getBlock().fallOn(world,state,position,entity,number(f.get("distance")));out.println("ok");}catch(Stop e){out.println("error");} + out.println("state "+Block.getId(d.state));for(var e:d.occupants)out.println(bounds("final "+e.id,e.getBoundingBox()));out.println("queries "+d.calls); + }} + } +} diff --git a/tools/test_block_landing_parity.py b/tools/test_block_landing_parity.py new file mode 100644 index 000000000..50c8922ad --- /dev/null +++ b/tools/test_block_landing_parity.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python3 +"""Compare every registered block landing/bounce family with pinned vanilla.""" +import json +import math +import os +from pathlib import Path +import platform +import random +import struct +import subprocess +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(states, definitions): + def bits(v):return struct.pack('>d',float(v)).hex() + def single(v):return struct.pack('>f',float(v)).hex() + def row(state,kind=2,**kw): + f=dict(state=state,kind=kind,bounce=False,server=True,client=False,distance=bits(8),random_float=single(.25),random_int=0,width=single(.6),height=single(1.8),damage=True,suppress=False,protected=False,griefing=True,write=True,position=[17,-64,-33],entities=[],mutate=False,fail=-1) + f.update(kw);return f + for state in states: + for kind in range(8): + for bounce in [False,True]:yield row(state['id'],kind,bounce=bounce) + special=[s for s in states if definitions[s['name']]['fall']!='Block' or definitions[s['name']]['bounce']] + distances=[-math.inf,-1.,-0.,0.,.5,math.nextafter(.75,0),.75,math.nextafter(.75,1),1.,math.nextafter(4.,0),4.,math.nextafter(4.,5),math.nextafter(7.,0),7.,math.nextafter(7.,8),1e40,math.inf,math.nan] + for state in special: + for kind in range(8): + for distance in distances: + for server,client in [(True,False),(True,True),(False,True),(False,False)]:yield row(state['id'],kind,distance=bits(distance),server=server,client=client) + for flag in ['damage','suppress','protected','griefing','write']: + for value in [False,True]: + for fail in range(-1,18):yield row(state['id'],kind,**{flag:value,'fail':fail}) + for bounce in [False,True]: + for fail in range(-1,4):yield row(state['id'],kind,bounce=bounce,fail=fail) + rng=random.Random(0x4c414e44494e47) + for _ in range(18000): + state=rng.choice(special);p=rng.choice([[0,0,0],[17,-64,-33],[2147483647,0,-2147483648]]) + entities=[] + if definitions[state['name']]['fall']=='FarmlandBlock': + for _ in range(rng.randrange(5)): + y=rng.choice([0,.5,.9375,1,1.1]);low=[p[0]+.2,p[1]+y,p[2]+.2];entities.append([*low,low[0]+.6,low[1]+1.8,low[2]+.6]) + yield row(state['id'],rng.randrange(8),server=bool(rng.randrange(2)),client=bool(rng.randrange(2)),distance=bits(rng.choice(distances+[rng.uniform(-1,12)])),random_float=single(rng.choice([0.,.25,.5,.99999994,math.nan])),random_int=rng.randrange(3),width=single(rng.choice([0.,.6,.8,1.,2.,math.nan,math.inf])),height=single(rng.choice([0.,.8,1.,1.8,math.nan,math.inf])),damage=bool(rng.randrange(2)),suppress=bool(rng.randrange(2)),protected=bool(rng.randrange(2)),griefing=bool(rng.randrange(2)),write=bool(rng.randrange(2)),position=p,entities=[[bits(v) for v in b] for b in entities],mutate=bool(rng.randrange(2)),fail=rng.choice([-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12])) + # Complete successful farmland pushes, all mutation/failure cut points and volume threshold. + farms=[s['id'] for s in states if definitions[s['name']]['fall']=='FarmlandBlock'] + for state in farms: + for width,height in [(.8,.8),(.8,math.nextafter(.8,1)),(.6,1.8),(1.,.512),(1.,.5120001),(1.,.5119999),(-.8,1.),(math.inf,0.),(math.nan,1.)]: + for kind in [1,2]: + for fail in range(-1,18): + for mutate in [False,True]:yield row(state,kind,width=single(width),height=single(height),entities=[[bits(v) for v in b] for b in [[17.2,-63.0625,-32.8,17.8,-61.2,-32.2],[17.2,-63.5,-32.8,17.8,-61.7,-32.2]]],mutate=mutate,fail=fail) + + +def main(): + lock,jars,libraries=base.verify_artifacts();build=lab.LOCAL/'rust-block-landing-parity';build.mkdir(exist_ok=True);report_path=build/'report.json';report_path.unlink(missing_ok=True) + root=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity' + oracles=[root/(n+'.java') for n in ['VanillaBlockLandingOracle','VanillaMovementRegistryOracle','VanillaHeightmapOracle','VanillaCollisionOracle']] + sources=[*oracles,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-world/examples/block_landing_fixture.rs'] + for crate in ['horizon-core','horizon-world']:sources += [lab.ROOT/'crates'/crate/'Cargo.toml',*sorted((lab.ROOT/'crates'/crate/'src').rglob('*.rs'))] + tested=base.source_hashes(sources);classes=build/'classes';classes.mkdir(exist_ok=True);dependencies=os.pathsep.join(map(str,libraries)) + def run(command,name): + with (build/(name+'.log')).open('w') as log:subprocess.run(list(map(str,command)),cwd=lab.ROOT,check=True,timeout=3600,stdout=log,stderr=subprocess.STDOUT) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependencies,'-d',classes,*oracles],'compile-java') + def java(side,mode):run(['java','-Xmx768M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependencies]),'dev.horizonlab.parity.VanillaBlockLandingOracle',mode,build],side+'-'+mode) + java('server','export');states=json.loads((build/'landing-states.json').read_text());definitions=json.loads((build/'landing-definitions.json').read_text()) + if len(states)!=35723 or len(definitions)!=1286:raise AssertionError('Incomplete pinned registry') + count=0 + with (build/'inputs.txt').open('w') as output: + for f in corpus(states,definitions):output.write(json.dumps(f,separators=(',',':'))+'\n');count+=1 + fixture_paths=[build/n for n in ['inputs.txt','landing-states.json','landing-definitions.json','movement-properties.nbt','block-registry.nbt','cached-collision.nbt']];fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--locked','--release','-p','horizon-world','--example','block_landing_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--locked','--no-deps','--format-version','1'],cwd=lab.ROOT));binary=Path(metadata['target_directory'])/'release/examples'/('block_landing_fixture.exe' if os.name=='nt' else 'block_landing_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side);matched=base.compare(build/(side+'.txt'),build/'rust.txt');references.append(dict(side=side,jar_sha256=lab.digest(jar,'sha256'),output_sha256=lab.digest(build/(side+'.txt'),'sha256'),matched_output_lines=matched));print(f'{side}: {matched:,} registered block landing lines match',flush=True) + base.ensure_sources_unchanged(sources,tested);base.ensure_sources_unchanged(fixture_paths,fixtures) + report=dict(schema=1,minecraft=lock['minecraft']['version'],manifest_sha1=lock['minecraft']['manifest_sha1'],platform=platform.platform(),java=subprocess.check_output(['java','--version'],text=True).splitlines()[0],rustc=subprocess.check_output(['rustc','--version'],text=True).strip(),registry_states=len(states),registry_blocks=len(definitions),fixtures=count,sources_sha256=tested,fixtures_sha256=fixtures,rust_output_sha256=lab.digest(build/'rust.txt','sha256'),references=references,scope='Actual registered Block.fallOn and bounceOn across all states and eight entity class families, plus client/server distinctions, damage return, bounce suppression, protection/rules, random boundaries, NaN/infinity and failures at each observable callback. Farmland replacement uses native registered collision shapes and ordered occupant pushes; turtle egg changes preserve hatch and compare write flags, event order and effects after failed writes. Entity damage, randomness, selected entities, sounds, world writes and events are controlled providers. Live health, entity storage, network, audio and full movement lifecycle integration remain separate work.') + lab.write_json(report_path,report);print(f'Scoped registered landing parity passed: {report_path}',flush=True) + + +if __name__=='__main__':main() From 4c12bb22cce7b151675fc8887ed1e726a4d85f8c Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 01:43:13 +0200 Subject: [PATCH 081/253] Match movement distance and step swim flap emission dispatch --- .../scoped-parity.json | 219 +++++++++++++++++ .../examples/movement_emission_fixture.rs | 222 ++++++++++++++++++ crates/horizon-world/src/lib.rs | 1 + crates/horizon-world/src/movement_emission.rs | 158 +++++++++++++ docs/collision-geometry.md | 16 ++ .../parity/VanillaMovementEmissionOracle.java | 68 ++++++ tools/test_movement_emission_parity.py | 73 ++++++ 7 files changed, 757 insertions(+) create mode 100644 benchmarks/rust-movement-emission-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/movement_emission_fixture.rs create mode 100644 crates/horizon-world/src/movement_emission.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMovementEmissionOracle.java create mode 100644 tools/test_movement_emission_parity.py diff --git a/benchmarks/rust-movement-emission-2026-10-07/scoped-parity.json b/benchmarks/rust-movement-emission-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..6d0994a6c --- /dev/null +++ b/benchmarks/rust-movement-emission-2026-10-07/scoped-parity.json @@ -0,0 +1,219 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 53036, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMovementEmissionOracle.java": "8f19d72b0d7ef53dead2be1b97a36c129182bb9849d75c9eddca5075112f4edf", + "tools/test_movement_emission_parity.py": "eed6f8507308a7c7a785abe4bb017bec0e206f63672834e00957b208066915b9", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "c875482eb6dd1783e01b3c223464b08e9b6d52c259ac83b17f960b5c6558068e", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "a5021a168adcedc37d77f533a8921c02f09c59f46a01737586aaa33c5908b8d0", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/movement_emission_fixture.rs": "d511ef20357c6231b13f85c5bf8d7554d080ea0ce927247a935aca38c65c1eca" + }, + "fixtures_sha256": { + ".local/rust-movement-emission-parity/inputs.txt": "28788ffb694d89eda22a5c3ef510d2258ffe0827e53e526ae83bc5bd76d8e6e6" + }, + "rust_output_sha256": "eb84dc864380d2b7830b71ec8bb7391a86f79d0eb6e9f9872e495b8601cbf544", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "eb84dc864380d2b7830b71ec8bb7391a86f79d0eb6e9f9872e495b8601cbf544", + "matched_output_lines": 598611 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "eb84dc864380d2b7830b71ec8bb7391a86f79d0eb6e9f9872e495b8601cbf544", + "matched_output_lines": 598611 + } + ], + "scope": "Actual Entity movement emission, private block vibration/step dispatch, flapping dispatch and native next-step arithmetic. Compares distance accumulation, climbable/powder predicates, legacy/current support ordering, ground/crouch/rail/swimming guards, sound/event emissions, float boundaries, NaN/infinity, callback mutations and partial state on failures. Block predicates, world reads and sound callbacks are controlled; crystal sound predicate is false in this scope. Registered sound selection, audio playback, full entity movement and gameplay remain separate work." +} diff --git a/crates/horizon-world/examples/movement_emission_fixture.rs b/crates/horizon-world/examples/movement_emission_fixture.rs new file mode 100644 index 000000000..36439e118 --- /dev/null +++ b/crates/horizon-world/examples/movement_emission_fixture.rs @@ -0,0 +1,222 @@ +use horizon_core::{geometry::Vec3, position::BlockPos}; +use horizon_world::movement_emission::*; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn single(v: &Value) -> f32 { + f32::from_bits(u32::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn vector(v: &Value) -> Vec3 { + Vec3::new(number(&v[0]), number(&v[1]), number(&v[2])) +} +fn position(v: &Value) -> BlockPos { + BlockPos::new( + v[0].as_i64().unwrap() as i32, + v[1].as_i64().unwrap() as i32, + v[2].as_i64().unwrap() as i32, + ) +} +fn pos(p: BlockPos) -> String { + format!("{} {} {}", p.x, p.y, p.z) +} +fn bits(v: f64) -> u64 { + if v.is_nan() { + 0x7ff8000000000000 + } else { + v.to_bits() + } +} +fn fbits(v: f32) -> u32 { + if v.is_nan() { 0x7fc00000 } else { v.to_bits() } +} +fn emission(v: &Value) -> MovementEmission { + [ + MovementEmission::None, + MovementEmission::Sounds, + MovementEmission::Events, + MovementEmission::All, + ][v.as_u64().unwrap() as usize] +} +struct World<'a> { + f: &'a Value, + out: &'a mut dyn Write, + calls: i64, + distances: MovementDistances, +} +impl World<'_> { + fn flag(&self, n: &str) -> bool { + self.f[n].as_bool().unwrap() + } + fn query(&mut self, s: String) -> io::Result<()> { + writeln!(self.out, "{s}")?; + let call = self.calls; + self.calls += 1; + if call == self.f["fail"].as_i64().unwrap() { + Err(io::Error::other("injected emission failure")) + } else { + Ok(()) + } + } + fn mutate(&mut self) { + if self.flag("mutate") { + self.distances = MovementDistances { + movement: single(&self.f["mutated_move"]), + flight: single(&self.f["mutated_fly"]), + next_step: single(&self.f["mutated_next"]), + }; + } + } + fn predicate(&mut self, n: &str, key: &str, s: usize) -> io::Result { + self.query(format!("{n} {s}"))?; + Ok(self.f["states"][s][key].as_bool().unwrap()) + } + fn boolean(&mut self, n: &str) -> io::Result { + self.query(n.into())?; + Ok(self.flag(n)) + } +} +impl MovementEmissionWorld for World<'_> { + type Error = io::Error; + type State = usize; + fn distances(&self) -> MovementDistances { + self.distances + } + fn set_movement_distance(&mut self, v: f32) { + self.distances.movement = v; + } + fn set_flight_distance(&mut self, v: f32) { + self.distances.flight = v; + } + fn set_next_step(&mut self, v: f32) { + self.distances.next_step = v; + } + fn on_position(&mut self) -> io::Result { + self.query("on-pos".into())?; + Ok(position(&self.f["on_pos"])) + } + fn block_state(&mut self, p: BlockPos) -> io::Result { + self.query(format!("state {}", pos(p)))?; + Ok(1) + } + fn is_air(&mut self, s: usize) -> io::Result { + self.predicate("air", "air", s) + } + fn climbable_tag(&mut self, s: usize) -> io::Result { + self.predicate("climbable", "climbable", s) + } + fn is_powder_snow(&mut self, s: usize) -> io::Result { + self.predicate("powder", "powder", s) + } + fn on_ground(&mut self) -> io::Result { + self.boolean("ground") + } + fn crouching(&mut self) -> io::Result { + self.boolean("crouch") + } + fn on_rails(&mut self) -> io::Result { + self.boolean("rails") + } + fn swimming(&mut self) -> io::Result { + self.boolean("swimming") + } + fn in_water(&mut self) -> io::Result { + self.boolean("water") + } + fn walking_step_sound(&mut self, p: BlockPos, s: usize) -> io::Result<()> { + self.query(format!("walking {} {s}", pos(p)))?; + self.mutate(); + self.query(format!("crystal {s}")) + } + fn step_event(&mut self, s: usize) -> io::Result<()> { + let p = vector(&self.f["position"]); + self.query(format!( + "step {s} {:016x} {:016x} {:016x}", + bits(p.x), + bits(p.y), + bits(p.z) + ))?; + self.mutate(); + Ok(()) + } + fn next_step(&mut self) -> io::Result { + self.query("next-step".into())?; + Ok(self.distances.next_step()) + } + fn water_swim_sound(&mut self) -> io::Result<()> { + self.query("water-sound".into())?; + self.mutate(); + Ok(()) + } + fn entity_event(&mut self, e: MovementEvent) -> io::Result<()> { + self.query(format!( + "event {}", + match e { + MovementEvent::Step => "step", + MovementEvent::Swim => "swim", + MovementEvent::Flap => "flap", + } + ))?; + self.mutate(); + Ok(()) + } + fn flapping(&mut self) -> io::Result { + self.boolean("flapping") + } + fn on_flap(&mut self) -> io::Result<()> { + self.query("on-flap".into())?; + self.mutate(); + Ok(()) + } + fn movement_emission(&mut self) -> io::Result { + self.query("emission".into())?; + Ok(emission(&self.f["flap_emission"])) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut w = World { + f: &f, + out: &mut out, + calls: 0, + distances: MovementDistances { + movement: single(&f["move"]), + flight: single(&f["fly"]), + next_step: single(&f["next"]), + }, + }; + let p = position(&f["legacy"]); + let m = vector(&f["movement"]); + if w.flag("block") { + let sounds = w.flag("sounds"); + let events = w.flag("events"); + match block_movement_effects(&mut w, p, 0, sounds, events, m) { + Ok(v) => writeln!(w.out, "result {v}")?, + Err(_) => writeln!(w.out, "error")?, + } + } else { + match apply_movement_emission(&mut w, emission(&f["emission"]), m, p, 0) { + Ok(()) => writeln!(w.out, "ok")?, + Err(_) => writeln!(w.out, "error")?, + } + } + writeln!( + w.out, + "distances {:08x} {:08x} {:08x}", + fbits(w.distances.movement), + fbits(w.distances.flight), + fbits(w.distances.next_step) + )?; + writeln!(w.out, "queries {}", w.calls)?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index bc46a0893..e6ac16b88 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -26,6 +26,7 @@ pub mod ground_support; pub mod heightmap; pub mod liquid_collision; pub mod living_fall; +pub mod movement_emission; pub mod movement_properties; pub mod movement_restitution; pub mod movement_support; diff --git a/crates/horizon-world/src/movement_emission.rs b/crates/horizon-world/src/movement_emission.rs new file mode 100644 index 000000000..f762ced22 --- /dev/null +++ b/crates/horizon-world/src/movement_emission.rs @@ -0,0 +1,158 @@ +//! Movement distances, footsteps, swimming and flapping event dispatch. +use horizon_core::{geometry::Vec3, position::BlockPos}; + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum MovementEmission { + None, + Sounds, + Events, + All, +} +impl MovementEmission { + pub fn sounds(self) -> bool { + matches!(self, Self::Sounds | Self::All) + } + pub fn events(self) -> bool { + matches!(self, Self::Events | Self::All) + } + pub fn anything(self) -> bool { + self != Self::None + } +} +#[derive(Clone, Copy, Debug, Default)] +pub struct MovementDistances { + pub movement: f32, + pub flight: f32, + pub next_step: f32, +} +impl MovementDistances { + /// Java narrows to int, adds with wrapping overflow, then widens to float. + pub fn next_step(&self) -> f32 { + (self.movement as i32).wrapping_add(1) as f32 + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum MovementEvent { + Step, + Swim, + Flap, +} +pub trait MovementEmissionWorld { + type Error; + type State: Copy; + fn distances(&self) -> MovementDistances; + fn set_movement_distance(&mut self, value: f32); + fn set_flight_distance(&mut self, value: f32); + fn set_next_step(&mut self, value: f32); + fn on_position(&mut self) -> Result; + fn block_state(&mut self, p: BlockPos) -> Result; + fn is_air(&mut self, s: Self::State) -> Result; + fn climbable_tag(&mut self, s: Self::State) -> Result; + fn is_powder_snow(&mut self, s: Self::State) -> Result; + fn on_ground(&mut self) -> Result; + fn crouching(&mut self) -> Result; + fn on_rails(&mut self) -> Result; + fn swimming(&mut self) -> Result; + fn in_water(&mut self) -> Result; + fn walking_step_sound(&mut self, p: BlockPos, s: Self::State) -> Result<(), Self::Error>; + /// STEP uses current entity position and a context including this state. + fn step_event(&mut self, s: Self::State) -> Result<(), Self::Error>; + fn next_step(&mut self) -> Result; + fn water_swim_sound(&mut self) -> Result<(), Self::Error>; + fn entity_event(&mut self, event: MovementEvent) -> Result<(), Self::Error>; + fn flapping(&mut self) -> Result; + fn on_flap(&mut self) -> Result<(), Self::Error>; + fn movement_emission(&mut self) -> Result; +} +fn climbable(world: &mut W, state: W::State) -> Result { + Ok(world.climbable_tag(state)? || world.is_powder_snow(state)?) +} +pub fn block_movement_effects( + world: &mut W, + p: BlockPos, + state: W::State, + sounds: bool, + events: bool, + movement: Vec3, +) -> Result { + if world.is_air(state)? { + return Ok(false); + } + let climbable = climbable(world, state)?; + if (world.on_ground()? + || climbable + || world.crouching()? && movement.y == 0.0 + || world.on_rails()?) + && !world.swimming()? + { + if sounds { + world.walking_step_sound(p, state)?; + } + if events { + world.step_event(state)?; + } + Ok(true) + } else { + Ok(false) + } +} +pub fn process_flapping_movement(world: &mut W) -> Result<(), W::Error> { + if world.flapping()? { + world.on_flap()?; + if world.movement_emission()?.events() { + world.entity_event(MovementEvent::Flap)?; + } + } + Ok(()) +} +/// The caller applies Entity.move's authority, emission and passenger guards. +/// Provider callbacks can change distance fields; subsequent reads see changes. +pub fn apply_movement_emission( + world: &mut W, + emission: MovementEmission, + movement: Vec3, + legacy_position: BlockPos, + legacy_state: W::State, +) -> Result<(), W::Error> { + let full = (movement.length() * f64::from(0.6f32)) as f32; + let horizontal = + ((movement.x * movement.x + movement.z * movement.z).sqrt() * f64::from(0.6f32)) as f32; + let p = world.on_position()?; + let state = world.block_state(p)?; + let climbable = climbable(world, state)?; + world.set_movement_distance( + world.distances().movement + if climbable { full } else { horizontal }, + ); + world.set_flight_distance(world.distances().flight + full); + if world.distances().movement > world.distances().next_step && !world.is_air(state)? { + let same = p == legacy_position; + // The native legacy call uses `same` for events even for sound-only emission. + let mut emitted = block_movement_effects( + world, + legacy_position, + legacy_state, + emission.sounds(), + same, + movement, + )?; + if !same { + emitted |= block_movement_effects(world, p, state, false, emission.events(), movement)?; + } + if emitted { + let next = world.next_step()?; + world.set_next_step(next); + } else if world.in_water()? { + let next = world.next_step()?; + world.set_next_step(next); + if emission.sounds() { + world.water_swim_sound()?; + } + if emission.events() { + world.entity_event(MovementEvent::Swim)?; + } + } + } else if world.is_air(state)? { + process_flapping_movement(world)?; + } + Ok(()) +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index ba0569a3f..7be42378c 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -721,3 +721,19 @@ NaN/infinity, failed writes, callback failures, egg hatch preservation and farmland collision pushes. Targeted Clippy passes. Actual health, live entity selection/storage, teleport/network behavior, audio playback and full movement lifecycle integration remain separate work. + + +`movement_emission` accumulates native movement/flight distances, evaluates +climbable and powder-snow states, and dispatches step/swim/flap effects. Legacy +and current support blocks retain their separate sound/event rules. Threshold +updates use Java float-to-int saturation and wrapping integer addition, and +sound/event callbacks can change fields observed by subsequent operations. + +`python3 tools/test_movement_emission_parity.py` compares actual native movement +emission, block vibration dispatch, flapping and next-step arithmetic. The +[movement emission report](../benchmarks/rust-movement-emission-2026-10-07/scoped-parity.json) +records **598,611 matching lines per JAR** across **53,036 fixtures**, including +predicate combinations, sound/event modes, differing support blocks, nonfinite +numbers, mutations and provider failures. Targeted Clippy passes. Sound callbacks +are controlled and the crystal-sound predicate is false in this gate; registered +sound selection, audio playback and full movement integration remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMovementEmissionOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMovementEmissionOracle.java new file mode 100644 index 000000000..6ad610cc7 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMovementEmissionOracle.java @@ -0,0 +1,68 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*; +import java.lang.reflect.*; +import java.nio.file.*; +import java.util.*; +import net.minecraft.core.*; +import net.minecraft.tags.*; +import net.minecraft.world.entity.*; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.state.*; +import net.minecraft.world.level.gameevent.*; +import net.minecraft.world.phys.Vec3; +/** Invokes native movement emission, including its private block effect dispatch. */ +public final class VanillaMovementEmissionOracle { + static final class Stop extends RuntimeException {} + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + static float single(JsonElement v){return Float.intBitsToFloat(Integer.parseUnsignedInt(v.getAsString(),16));} + static Vec3 vector(JsonElement v){var a=v.getAsJsonArray();return new Vec3(number(a.get(0)),number(a.get(1)),number(a.get(2)));} + static BlockPos position(JsonElement v){var a=v.getAsJsonArray();return new BlockPos(a.get(0).getAsInt(),a.get(1).getAsInt(),a.get(2).getAsInt());} + static String pos(BlockPos p){return p.getX()+" "+p.getY()+" "+p.getZ();} + static Field moveDist,flyDist,nextStep; + static final class Data { + JsonObject f;PrintWriter out;int calls;Actor actor;State[] states; + boolean flag(String n){return f.get(n).getAsBoolean();} + void query(String text){out.println(text);if(calls++==f.get("fail").getAsInt())throw new Stop();} + void mutate(){if(flag("mutate")){try{moveDist.setFloat(actor,single(f.get("mutated_move")));flyDist.setFloat(actor,single(f.get("mutated_fly")));nextStep.setFloat(actor,single(f.get("mutated_next")));}catch(Exception e){throw new AssertionError(e);}}} + } + static final class State extends BlockState { + Data d;int id;State(){super(null,null,null);} + boolean flag(String n){return d.f.getAsJsonArray("states").get(id).getAsJsonObject().get(n).getAsBoolean();} + @Override public boolean isAir(){d.query("air "+id);return flag("air");} + @Override public boolean is(TagKey tag){if(tag==BlockTags.CRYSTAL_SOUND_BLOCKS){d.query("crystal "+id);return false;}if(tag!=BlockTags.CLIMBABLE)throw new AssertionError(tag);d.query("climbable "+id);return flag("climbable");} + @Override public boolean is(Block block){if(block!=Blocks.POWDER_SNOW)throw new AssertionError(block);d.query("powder "+id);return flag("powder");} + } + static final class Level extends net.minecraft.server.level.ServerLevel { + Data d;Level(){super(null,null,null,null,null,null,false,0L,List.of(),false);} + @Override public BlockState getBlockState(BlockPos p){d.query("state "+pos(p));return d.states[1];} + @Override public void gameEvent(Holder e,Vec3 p,GameEvent.Context c){if(e!=GameEvent.STEP||c.sourceEntity()!=d.actor)throw new AssertionError();d.query(String.format("step %d %016x %016x %016x",((State)c.affectedState()).id,Double.doubleToLongBits(p.x),Double.doubleToLongBits(p.y),Double.doubleToLongBits(p.z)));d.mutate();} + } + static final class Actor extends Marker { + Data d;Actor(){super(null,null);}void configure(Level w){setLevel(w);} + @Override public BlockPos getOnPos(){d.query("on-pos");return VanillaMovementEmissionOracle.position(d.f.get("on_pos"));} + @Override public boolean onGround(){d.query("ground");return d.flag("ground");} + @Override public boolean isCrouching(){d.query("crouch");return d.flag("crouch");} + @Override public boolean isOnRails(){d.query("rails");return d.flag("rails");} + @Override public boolean isSwimming(){d.query("swimming");return d.flag("swimming");} + @Override public boolean isInWater(){d.query("water");return d.flag("water");} + @Override protected void playStepSound(BlockPos p,BlockState s){d.query("walking "+pos(p)+" "+((State)s).id);d.mutate();} + @Override protected float nextStep(){d.query("next-step");return super.nextStep();} + @Override protected void waterSwimSound(){d.query("water-sound");d.mutate();} + @Override public void gameEvent(Holder e){d.query("event "+(e==GameEvent.SWIM?"swim":e==GameEvent.FLAP?"flap":"unknown"));d.mutate();} + @Override protected boolean isFlapping(){d.query("flapping");return d.flag("flapping");} + @Override protected void onFlap(){d.query("on-flap");d.mutate();} + @Override protected MovementEmission getMovementEmission(){d.query("emission");return MovementEmission.values()[d.f.get("flap_emission").getAsInt()];} + } + public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();var allocator=Class.forName("sun.misc.Unsafe");var field=allocator.getDeclaredField("theUnsafe");field.setAccessible(true);var unsafe=field.get(null);var allocate=allocator.getMethod("allocateInstance",Class.class); + moveDist=Entity.class.getDeclaredField("moveDist");moveDist.setAccessible(true);flyDist=Entity.class.getDeclaredField("flyDist");flyDist.setAccessible(true);nextStep=Entity.class.getDeclaredField("nextStep");nextStep.setAccessible(true);var position=Entity.class.getDeclaredField("position");position.setAccessible(true); + var apply=Entity.class.getDeclaredMethod("applyMovementEmissionAndPlaySound",Entity.MovementEmission.class,Vec3.class,BlockPos.class,BlockState.class);apply.setAccessible(true);var block=Entity.class.getDeclaredMethod("vibrationAndSoundEffectsFromBlock",BlockPos.class,BlockState.class,boolean.class,boolean.class,Vec3.class);block.setAccessible(true);Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){ + var f=JsonParser.parseString(line).getAsJsonObject();var d=new Data();d.f=f;d.out=out;var actor=(Actor)allocate.invoke(unsafe,Actor.class);actor.d=d;d.actor=actor;var level=(Level)allocate.invoke(unsafe,Level.class);level.d=d;actor.configure(level);d.states=new State[2];for(int i=0;i<2;i++){var s=(State)allocate.invoke(unsafe,State.class);s.d=d;s.id=i;d.states[i]=s;} + moveDist.setFloat(actor,single(f.get("move")));flyDist.setFloat(actor,single(f.get("fly")));nextStep.setFloat(actor,single(f.get("next")));position.set(actor,vector(f.get("position"))); + try{if(f.get("block").getAsBoolean())out.println("result "+block.invoke(actor,position(f.get("legacy")),d.states[0],d.flag("sounds"),d.flag("events"),vector(f.get("movement"))));else{apply.invoke(actor,Entity.MovementEmission.values()[f.get("emission").getAsInt()],vector(f.get("movement")),position(f.get("legacy")),d.states[0]);out.println("ok");}}catch(InvocationTargetException e){if(e.getCause() instanceof Stop)out.println("error");else throw e;} + out.printf("distances %08x %08x %08x%n",Float.floatToIntBits(moveDist.getFloat(actor)),Float.floatToIntBits(flyDist.getFloat(actor)),Float.floatToIntBits(nextStep.getFloat(actor)));out.println("queries "+d.calls); + }} + } +} diff --git a/tools/test_movement_emission_parity.py b/tools/test_movement_emission_parity.py new file mode 100644 index 000000000..99c6e28af --- /dev/null +++ b/tools/test_movement_emission_parity.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python3 +"""Compare movement distance, step, swim and flap event dispatch with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + import itertools + def bits(v):return struct.pack('>d',float(v)).hex() + def single(v):return struct.pack('>f',float(v)).hex() + def state(mask):return dict(air=bool(mask&1),climbable=bool(mask&2),powder=bool(mask&4)) + def row(**kw): + f=dict(block=False,states=[state(0),state(0)],emission=3,flap_emission=3,movement=list(map(bits,[1.,.2,1.])),position=list(map(bits,[17.3,-63.,-32.3])),on_pos=[17,-64,-33],legacy=[17,-64,-33],ground=True,crouch=False,rails=False,swimming=False,water=False,flapping=False,sounds=True,events=True,move=single(1.),fly=single(0.),next=single(1.),mutate=False,mutated_move=single(12.5),mutated_fly=single(-3.),mutated_next=single(9.),fail=-1) + f.update(kw);return f + for old,new,flags,emission,same in itertools.product(range(8),range(8),range(64),range(4),[False,True]): + yield row(states=[state(old),state(new)],emission=emission,flap_emission=emission,legacy=[17,-64,-33] if same else [17,-65,-33],ground=bool(flags&1),crouch=bool(flags&2),rails=bool(flags&4),swimming=bool(flags&8),water=bool(flags&16),flapping=bool(flags&32)) + for st,flags,y,sounds,events in itertools.product(range(8),range(16),[-0.,.1,math.nan],[False,True],[False,True]): + yield row(block=True,states=[state(st),state(0)],movement=list(map(bits,[1,y,1])),ground=bool(flags&1),crouch=bool(flags&2),rails=bool(flags&4),swimming=bool(flags&8),sounds=sounds,events=events) + values=[-math.inf,-1e30,-1.,-0.,0.,1e-38,1e-7,.99999994,1.,1.00000012,2147483520.,2147483648.,1e30,math.inf,math.nan] + for move,next_value,y,st in itertools.product(values,values,[-0.,.1,math.nan],range(4)): + yield row(move=single(move),next=single(next_value),fly=single(move),movement=list(map(bits,[1.,y,1.])),states=[state(0),state(st)]) + # Failures before and after state writes and sound/event callbacks. + for old,new,flags,fail,mutate in itertools.product([0,1,2],[0,1,2],range(8),range(-1,27),[False,True]): + yield row(states=[state(old),state(new)],ground=bool(flags&1),water=bool(flags&2),flapping=bool(flags&4),legacy=[17,-65,-33],fail=fail,mutate=mutate) + rng=random.Random(0x454d495353494f4e) + for _ in range(12000): + yield row(block=bool(rng.randrange(2)),states=[state(rng.randrange(8)),state(rng.randrange(8))],emission=rng.randrange(4),flap_emission=rng.randrange(4),movement=[bits(rng.choice(values+[1e200,1e-200])) for _ in range(3)],ground=bool(rng.randrange(2)),crouch=bool(rng.randrange(2)),rails=bool(rng.randrange(2)),swimming=bool(rng.randrange(2)),water=bool(rng.randrange(2)),flapping=bool(rng.randrange(2)),sounds=bool(rng.randrange(2)),events=bool(rng.randrange(2)),move=single(rng.choice(values)),fly=single(rng.choice(values)),next=single(rng.choice(values)),mutate=bool(rng.randrange(2)),mutated_move=single(rng.choice(values)),mutated_fly=single(rng.choice(values)),mutated_next=single(rng.choice(values)),fail=rng.randrange(-1,23)) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-movement-emission-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMovementEmissionOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/movement_emission_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaMovementEmissionOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','movement_emission_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('movement_emission_fixture.exe' if os.name=='nt' else 'movement_emission_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} movement-emission output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual Entity movement emission, private block vibration/step dispatch, flapping dispatch and native next-step arithmetic. Compares distance accumulation, climbable/powder predicates, legacy/current support ordering, ground/crouch/rail/swimming guards, sound/event emissions, float boundaries, NaN/infinity, callback mutations and partial state on failures. Block predicates, world reads and sound callbacks are controlled; crystal sound predicate is false in this scope. Registered sound selection, audio playback, full entity movement and gameplay remain separate work.'} + lab.write_json(report_path,report);print(f'Scoped movement emission parity passed: {report_path}') + + +if __name__=='__main__':main() From 7e693725179870ea79e006ed55365525bde80d9c Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 01:52:30 +0200 Subject: [PATCH 082/253] Match entity move lifecycle ordering and retained movement records --- .../scoped-parity.json | 220 +++++++++ .../examples/entity_move_fixture.rs | 418 ++++++++++++++++++ crates/horizon-world/src/entity_move.rs | 217 +++++++++ crates/horizon-world/src/lib.rs | 1 + docs/collision-geometry.md | 18 + .../parity/VanillaEntityMoveOracle.java | 92 ++++ tools/test_entity_move_parity.py | 72 +++ 7 files changed, 1038 insertions(+) create mode 100644 benchmarks/rust-entity-move-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/entity_move_fixture.rs create mode 100644 crates/horizon-world/src/entity_move.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityMoveOracle.java create mode 100644 tools/test_entity_move_parity.py diff --git a/benchmarks/rust-entity-move-2026-10-07/scoped-parity.json b/benchmarks/rust-entity-move-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..fcef52f24 --- /dev/null +++ b/benchmarks/rust-entity-move-2026-10-07/scoped-parity.json @@ -0,0 +1,220 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 21656, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityMoveOracle.java": "8e7abd89ab8fe5c64d5608f1e9218127c546a1cfcbe08d784492c9b021cd8e70", + "tools/test_entity_move_parity.py": "3fc4497b90559a59ec8d74f0ebb413585499516dd698d534c2e7db0ad6109cb8", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "c27984bbc003c31f60ff60f7bf01d928f3eaf8ba977c3bf0b3102b2cb0faeced", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "a5021a168adcedc37d77f533a8921c02f09c59f46a01737586aaa33c5908b8d0", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/entity_move_fixture.rs": "dc26dffa594a9c6d7fcc39ae03b254a2a45398db513b34f6b30867818539ff53" + }, + "fixtures_sha256": { + ".local/rust-entity-move-parity/inputs.txt": "b7dd8870db34cf8a5c178ee0fa709e8a6eff7196b25cc95f931072283bdc69a7" + }, + "rust_output_sha256": "23db36cb04444bef7e7bcab15c976a698b247a6de7a0192acf43a592b095b70c", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "23db36cb04444bef7e7bcab15c976a698b247a6de7a0192acf43a592b095b70c", + "matched_output_lines": 543653 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "23db36cb04444bef7e7bcab15c976a698b247a6de7a0192acf43a592b095b70c", + "matched_output_lines": 543653 + } + ], + "scope": "Actual Entity.move with native shape collision resolution (zero step height), native zero-restitution handling and final authority checks. Compares no-physics and piston early exits including signed zero, stuck multiplier reset, edge callback, fall-reset clip endpoints, movement recording cap, collision flag writes, ground/fall callback ordering, removal, passenger emission guard, speed multiplication and failures after partial state changes. Providers control piston/edge decisions, ground support, ray hits, landing effects and sound policy; live world integration and non-passenger movement emission remain separate work." +} diff --git a/crates/horizon-world/examples/entity_move_fixture.rs b/crates/horizon-world/examples/entity_move_fixture.rs new file mode 100644 index 000000000..fbcbb8ed1 --- /dev/null +++ b/crates/horizon-world/examples/entity_move_fixture.rs @@ -0,0 +1,418 @@ +use horizon_core::{ + geometry::{Aabb, Axis, Vec3, VoxelShape, resolve_shape_movement}, + position::BlockPos, +}; +use horizon_world::{ + entity_move::*, + movement_emission::MovementEmission, + movement_restitution::{RestitutionInput, RestitutionWorld, restitute_movement}, + registry::BlockStateId, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn single(v: &Value) -> f32 { + f32::from_bits(u32::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn vector(v: &Value) -> Vec3 { + Vec3::new(number(&v[0]), number(&v[1]), number(&v[2])) +} +fn bits(v: f64) -> u64 { + if v.is_nan() { + 0x7ff8000000000000 + } else { + v.to_bits() + } +} +fn vec(label: &str, v: Vec3) -> String { + format!( + "{label} {:016x} {:016x} {:016x}", + bits(v.x), + bits(v.y), + bits(v.z) + ) +} +fn bounds(label: &str, b: Aabb) -> String { + format!( + "{label} {:016x} {:016x} {:016x} {:016x} {:016x} {:016x}", + bits(b.min(Axis::X)), + bits(b.min(Axis::Y)), + bits(b.min(Axis::Z)), + bits(b.max(Axis::X)), + bits(b.max(Axis::Y)), + bits(b.max(Axis::Z)) + ) +} +fn pos(p: BlockPos) -> String { + format!("{} {} {}", p.x, p.y, p.z) +} +struct World<'a> { + f: &'a Value, + out: &'a mut dyn Write, + calls: i64, + position: Vec3, + velocity: Vec3, + stuck: Vec3, + bounds: Aabb, + flags: CollisionFlags, + grounded: bool, + removed: bool, + fall: f64, + history: MovementHistory, + shapes: Vec, +} +impl World<'_> { + fn flag(&self, n: &str) -> bool { + self.f[n].as_bool().unwrap() + } + fn query(&mut self, s: String) -> io::Result<()> { + writeln!(self.out, "{s}")?; + let call = self.calls; + self.calls += 1; + if call == self.f["fail"].as_i64().unwrap() { + Err(io::Error::other("injected move failure")) + } else { + Ok(()) + } + } +} +impl EntityMoveWorld for World<'_> { + type Error = io::Error; + fn no_physics(&self) -> bool { + self.flag("no_physics") + } + fn position(&self) -> Vec3 { + self.position + } + fn set_position(&mut self, p: Vec3) -> io::Result<()> { + self.query(vec("set-position", p))?; + self.bounds = self.bounds.move_by(p.subtract(self.position)); + self.position = p; + Ok(()) + } + fn record_movement(&mut self, t: MoverType, v: Vec3) -> io::Result<()> { + self.query(vec(&format!("record {}", t as u32), v)) + } + fn collision_flags(&self) -> CollisionFlags { + self.flags + } + fn set_collision_flags(&mut self, f: CollisionFlags) { + self.flags = f; + } + fn limit_piston_movement(&mut self, v: Vec3) -> io::Result { + self.query(vec("piston", v))?; + Ok(vector(&self.f["piston_result"])) + } + fn stuck_multiplier(&self) -> Vec3 { + self.stuck + } + fn set_stuck_multiplier(&mut self, v: Vec3) { + self.stuck = v; + } + fn velocity(&mut self) -> io::Result { + self.query("velocity".into())?; + Ok(self.velocity) + } + fn set_velocity(&mut self, v: Vec3) -> io::Result<()> { + self.query(vec("set-velocity", v))?; + self.velocity = v; + Ok(()) + } + fn back_off_edge(&mut self, v: Vec3, t: MoverType) -> io::Result { + self.query(vec(&format!("edge {}", t as u32), v))?; + Ok(if self.flag("edge_override") { + vector(&self.f["edge_result"]) + } else { + v + }) + } + fn collide(&mut self, v: Vec3) -> io::Result { + let b = self.bounds.expand_towards(v); + self.query(bounds("entities", b))?; + if v.length_squared() == 0.0 { + return Ok(v); + } + self.query("border".into())?; + self.query(bounds("border-test", b))?; + self.query(bounds("blocks", b))?; + Ok(resolve_shape_movement( + v, + self.bounds, + &self.shapes.iter().collect::>(), + )) + } + fn fall_distance(&self) -> f64 { + self.fall + } + fn fall_reset_clip(&mut self, from: Vec3, to: Vec3) -> io::Result { + self.query(vec("clip-from", from))?; + self.query(vec("clip-to", to))?; + Ok(self.flag("clip_hit")) + } + fn reset_fall_distance(&mut self) -> io::Result<()> { + self.query("reset-fall".into())?; + self.fall = 0.0; + Ok(()) + } + fn movement_history(&mut self) -> &mut MovementHistory { + &mut self.history + } + fn locally_authoritative(&mut self) -> io::Result { + let client = self.client_side()?; + self.query( + if client { + "local-client-authority" + } else { + "client-authority" + } + .into(), + )?; + Ok(if client { + self.flag("local_client") + } else { + !self.flag("client_authority") + }) + } + fn set_on_ground_with_movement( + &mut self, + below: bool, + horizontal: bool, + v: Vec3, + ) -> io::Result<()> { + self.query(vec(&format!("ground-set {below} {horizontal}"), v))?; + self.grounded = below; + self.flags.horizontal = horizontal; + Ok(()) + } + fn minor_horizontal_collision(&mut self, v: Vec3) -> io::Result { + self.query(vec("minor", v))?; + Ok(self.flag("minor_result")) + } + fn legacy_on_position(&mut self) -> io::Result { + self.query("legacy".into())?; + Ok(BlockPos::new(17, -64, -33)) + } + fn block_state(&mut self, p: BlockPos) -> io::Result { + self.query(format!("block {}", pos(p)))?; + Ok(BlockStateId(0)) + } + fn on_ground(&mut self) -> io::Result { + self.query("ground".into())?; + Ok(self.grounded) + } + fn check_fall_damage( + &mut self, + dy: f64, + ground: bool, + _: BlockStateId, + p: BlockPos, + ) -> io::Result<()> { + self.query(format!("fall {:016x} {ground} {}", bits(dy), pos(p)))?; + if self.flag("fall_mutates") { + self.fall = 3.0; + self.velocity = Vec3::new(17.0, 18.0, 19.0); + self.flags.horizontal = self.flag("mutated_horizontal"); + self.flags.vertical = self.flag("mutated_vertical"); + self.flags.below = self.flag("mutated_below"); + } + if self.flag("fall_removes") { + self.removed = true; + } + Ok(()) + } + fn removed(&mut self) -> io::Result { + Ok(self.removed) + } + fn can_simulate(&mut self) -> io::Result { + self.query("simulation".into())?; + Ok(true) + } + fn restitute( + &mut self, + state: BlockStateId, + x: bool, + z: bool, + resolved: Vec3, + ) -> io::Result<()> { + let input = RestitutionInput { + block: state, + collided_x: x, + collided_z: z, + vertical_collision: self.flags.vertical, + collision_below: self.flags.below, + living: false, + resolved_movement: resolved, + fall_distance: self.fall, + }; + restitute_movement(&mut Bounce(self), input) + } + fn client_side(&mut self) -> io::Result { + self.query("client".into())?; + Ok(self.flag("client")) + } + fn movement_emission(&mut self) -> io::Result { + self.query("emission".into())?; + Ok(if self.flag("emits") { + MovementEmission::All + } else { + MovementEmission::None + }) + } + fn passenger(&mut self) -> io::Result { + self.query("passenger".into())?; + Ok(true) + } + fn apply_movement_emission( + &mut self, + _: MovementEmission, + _: Vec3, + _: BlockPos, + _: BlockStateId, + ) -> io::Result<()> { + panic!("passenger guard must skip emission in this fixture") + } + fn block_speed_factor(&mut self) -> io::Result { + self.query("speed".into())?; + Ok(single(&self.f["speed"])) + } +} +struct Bounce<'a, 'b>(&'a mut World<'b>); +impl RestitutionWorld for Bounce<'_, '_> { + type Error = io::Error; + fn suppressing_bounce(&mut self) -> io::Result { + self.0.query("suppress".into())?; + Ok(false) + } + fn entity_bounciness(&mut self) -> io::Result { + self.0.query("entity-bounce".into())?; + Ok(0.0) + } + fn velocity(&mut self) -> io::Result { + self.0.velocity() + } + fn effective_gravity(&mut self) -> io::Result { + self.0.query("gravity".into())?; + Ok(0.08) + } + fn block_suppresses_bounce(&mut self, _: BlockStateId) -> io::Result { + self.0.query("block-suppresses".into())?; + Ok(false) + } + fn block_bounce_restitution(&mut self, _: BlockStateId) -> io::Result { + self.0.query("block-bounce".into())?; + Ok(0.0) + } + fn air_drag(&mut self) -> io::Result { + panic!("no positive restitution") + } + fn movement_support_position(&mut self) -> io::Result { + panic!("no bounce event") + } + fn bounce_on(&mut self, _: BlockStateId, _: BlockPos, _: f64) -> io::Result<()> { + panic!("no bounce event") + } + fn bounce_event(&mut self) -> io::Result<()> { + panic!("no bounce event") + } + fn mark_position_for_sync(&mut self) { + panic!("no bounce event") + } + fn set_velocity(&mut self, v: Vec3) -> io::Result<()> { + self.0.set_velocity(v) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let p = vector(&f["position"]); + let flag = |n: &str| f[n].as_bool().unwrap(); + let shapes = f["shapes"] + .as_array() + .unwrap() + .iter() + .map(|v| { + VoxelShape::from_box(Aabb::new( + Vec3::new(number(&v[0]), number(&v[1]), number(&v[2])), + Vec3::new(number(&v[3]), number(&v[4]), number(&v[5])), + )) + }) + .collect::, _>>()?; + let mut history = MovementHistory::default(); + for i in 0..f["history"].as_u64().unwrap() { + history.add(MovementRecord { + from: Vec3::new(i as f64, 0.0, 0.0), + to: Vec3::new((i + 1) as f64, 0.0, 0.0), + original: Some(Vec3::new(1.0, 0.0, 0.0)), + }); + } + let mut w = World { + f: &f, + out: &mut out, + calls: 0, + position: p, + velocity: vector(&f["velocity"]), + stuck: vector(&f["stuck"]), + bounds: Aabb::new( + Vec3::new(p.x - 0.3, p.y, p.z - 0.3), + Vec3::new(p.x + 0.3, p.y + 1.8, p.z + 0.3), + ), + flags: CollisionFlags { + horizontal: flag("horizontal"), + vertical: flag("vertical"), + below: flag("below"), + minor: flag("minor"), + }, + grounded: flag("ground"), + removed: flag("removed"), + fall: number(&f["distance"]), + history, + shapes, + }; + let mover = [ + MoverType::SelfMovement, + MoverType::Player, + MoverType::Piston, + MoverType::ShulkerBox, + MoverType::Shulker, + ][f["mover"].as_u64().unwrap() as usize]; + let result = move_entity(&mut w, mover, vector(&f["movement"])); + writeln!(w.out, "{}", if result.is_ok() { "ok" } else { "error" })?; + writeln!(w.out, "{}", vec("position", w.position))?; + writeln!(w.out, "{}", vec("velocity-final", w.velocity))?; + writeln!(w.out, "{}", vec("stuck", w.stuck))?; + writeln!(w.out, "{}", bounds("bounds", w.bounds))?; + writeln!( + w.out, + "flags {} {} {} {} {} {} {:016x}", + w.flags.horizontal, + w.flags.vertical, + w.flags.below, + w.flags.minor, + w.grounded, + w.removed, + bits(w.fall) + )?; + writeln!(w.out, "history {}", w.history.records().len())?; + for r in w.history.records() { + writeln!(w.out, "{}", vec("from", r.from))?; + writeln!(w.out, "{}", vec("to", r.to))?; + writeln!( + w.out, + "{}", + r.original + .map_or_else(|| "original none".to_string(), |v| vec("original", v)) + )?; + } + writeln!(w.out, "queries {}", w.calls)?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/entity_move.rs b/crates/horizon-world/src/entity_move.rs new file mode 100644 index 000000000..b3b189df0 --- /dev/null +++ b/crates/horizon-world/src/entity_move.rs @@ -0,0 +1,217 @@ +//! Entity.move ordering around collision, support, landing and movement effects. +use crate::{movement_emission::MovementEmission, registry::BlockStateId}; +use horizon_core::{geometry::Vec3, position::BlockPos}; +use std::collections::VecDeque; + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum MoverType { + SelfMovement, + Player, + Piston, + ShulkerBox, + Shulker, +} +#[derive(Clone, Copy, Debug, Default)] +pub struct CollisionFlags { + pub horizontal: bool, + pub vertical: bool, + pub below: bool, + pub minor: bool, +} +#[derive(Clone, Copy, Debug)] +pub struct MovementRecord { + pub from: Vec3, + pub to: Vec3, + pub original: Option, +} +#[derive(Clone, Debug, Default)] +pub struct MovementHistory { + records: VecDeque, +} +impl MovementHistory { + pub fn records(&self) -> &VecDeque { + &self.records + } + pub fn add(&mut self, record: MovementRecord) { + if self.records.len() >= 100 { + let first = self.records.pop_front().unwrap(); + let second = self.records.pop_front().unwrap(); + self.records.push_front(MovementRecord { + from: first.from, + to: second.to, + original: None, + }); + } + self.records.push_back(record); + } + pub fn remove_latest(&mut self) { + self.records.pop_back(); + } + pub fn clear(&mut self) { + self.records.clear(); + } +} +/// The provider retains entity fields so callbacks can mutate them. Hooks below +/// are native phase boundaries; bind collision, support, landing, restitution +/// and emission hooks to their corresponding world modules. +pub trait EntityMoveWorld { + type Error; + fn no_physics(&self) -> bool; + fn position(&self) -> Vec3; + fn set_position(&mut self, position: Vec3) -> Result<(), Self::Error>; + fn record_movement(&mut self, mover: MoverType, movement: Vec3) -> Result<(), Self::Error>; + fn collision_flags(&self) -> CollisionFlags; + fn set_collision_flags(&mut self, flags: CollisionFlags); + fn limit_piston_movement(&mut self, movement: Vec3) -> Result; + fn stuck_multiplier(&self) -> Vec3; + fn set_stuck_multiplier(&mut self, value: Vec3); + fn velocity(&mut self) -> Result; + fn set_velocity(&mut self, value: Vec3) -> Result<(), Self::Error>; + fn back_off_edge(&mut self, movement: Vec3, mover: MoverType) -> Result; + fn collide(&mut self, movement: Vec3) -> Result; + fn fall_distance(&self) -> f64; + /// FALLDAMAGE_RESETTING blocks and WATER fluids, entity collision context. + /// Return true for a non-MISS hit. + fn fall_reset_clip(&mut self, from: Vec3, to: Vec3) -> Result; + fn reset_fall_distance(&mut self) -> Result<(), Self::Error>; + fn movement_history(&mut self) -> &mut MovementHistory; + fn locally_authoritative(&mut self) -> Result; + fn set_on_ground_with_movement( + &mut self, + below: bool, + horizontal: bool, + movement: Vec3, + ) -> Result<(), Self::Error>; + fn minor_horizontal_collision(&mut self, movement: Vec3) -> Result; + fn legacy_on_position(&mut self) -> Result; + fn block_state(&mut self, p: BlockPos) -> Result; + fn on_ground(&mut self) -> Result; + fn check_fall_damage( + &mut self, + dy: f64, + on_ground: bool, + state: BlockStateId, + p: BlockPos, + ) -> Result<(), Self::Error>; + fn removed(&mut self) -> Result; + fn can_simulate(&mut self) -> Result; + fn restitute( + &mut self, + state: BlockStateId, + collided_x: bool, + collided_z: bool, + resolved: Vec3, + ) -> Result<(), Self::Error>; + fn client_side(&mut self) -> Result; + fn movement_emission(&mut self) -> Result; + fn passenger(&mut self) -> Result; + fn apply_movement_emission( + &mut self, + emission: MovementEmission, + resolved: Vec3, + p: BlockPos, + state: BlockStateId, + ) -> Result<(), Self::Error>; + fn block_speed_factor(&mut self) -> Result; +} +fn java_zero(v: Vec3) -> bool { + v.x.to_bits() == 0 && v.y.to_bits() == 0 && v.z.to_bits() == 0 +} +fn different(a: f64, b: f64) -> bool { + let delta = (b - a).abs(); + delta >= f64::from(1.0e-5f32) || delta.is_nan() +} +/// Release behavior; native IDE-only invalid-simulation assertions and profiler +/// callbacks do not form part of this gameplay transition. +pub fn move_entity( + world: &mut W, + mover: MoverType, + mut movement: Vec3, +) -> Result<(), W::Error> { + if world.no_physics() { + world.set_position(world.position().add_vector(movement))?; + world.record_movement(mover, movement)?; + world.set_collision_flags(CollisionFlags::default()); + return Ok(()); + } + if mover == MoverType::Piston { + movement = world.limit_piston_movement(movement)?; + if java_zero(movement) { + return Ok(()); + } + } + let stuck = world.stuck_multiplier(); + if stuck.length_squared() > 1.0e-7 { + if mover != MoverType::Piston { + movement = movement.multiply(stuck); + } + world.set_stuck_multiplier(Vec3::ZERO); + world.set_velocity(Vec3::ZERO)?; + } + movement = world.back_off_edge(movement, mover)?; + let resolved = world.collide(movement)?; + let length = resolved.length_squared(); + if length > 1.0e-7 || movement.length_squared() - length < 1.0e-7 { + if world.fall_distance() != 0.0 && length >= 1.0 { + let distance = resolved.length().min(8.0); + let from = world.position(); + let to = from.add_vector(resolved.normalize().scale(distance)); + if world.fall_reset_clip(from, to)? { + world.reset_fall_distance()?; + } + } + let from = world.position(); + let to = from.add_vector(resolved); + world.movement_history().add(MovementRecord { + from, + to, + original: Some(movement), + }); + world.set_position(to)?; + world.record_movement(mover, resolved)?; + } + let x = different(movement.x, resolved.x); + let z = different(movement.z, resolved.z); + let mut flags = world.collision_flags(); + flags.horizontal = x || z; + world.set_collision_flags(flags); + let nonzero_y = movement.y.abs() > 0.0; + if nonzero_y || world.locally_authoritative()? { + flags = world.collision_flags(); + flags.vertical = movement.y != resolved.y; + flags.below = flags.vertical && movement.y < 0.0; + world.set_collision_flags(flags); + world.set_on_ground_with_movement(flags.below, flags.horizontal, resolved)?; + } + let minor = if world.collision_flags().horizontal { + world.minor_horizontal_collision(resolved)? + } else { + false + }; + flags = world.collision_flags(); + flags.minor = minor; + world.set_collision_flags(flags); + let p = world.legacy_on_position()?; + let state = world.block_state(p)?; + if world.locally_authoritative()? { + let grounded = world.on_ground()?; + world.check_fall_damage(resolved.y, grounded, state, p)?; + } + if world.removed()? { + return Ok(()); + } + if world.can_simulate()? + && (nonzero_y && world.collision_flags().vertical || world.collision_flags().horizontal) + { + world.restitute(state, x, z, resolved)?; + } + if !world.client_side()? || world.locally_authoritative()? { + let emission = world.movement_emission()?; + if emission.anything() && !world.passenger()? { + world.apply_movement_emission(emission, resolved, p, state)?; + } + } + let factor = f64::from(world.block_speed_factor()?); + let velocity = world.velocity()?.multiply(Vec3::new(factor, 1.0, factor)); + world.set_velocity(velocity) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index e6ac16b88..e4d6daf09 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -19,6 +19,7 @@ pub mod compression; pub mod dynamic_support; pub mod edge_backoff; pub mod entity_collision; +pub mod entity_move; pub mod entity_obstruction; pub mod fall_damage; pub mod fluid; diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 7be42378c..bc8fc6050 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -737,3 +737,21 @@ predicate combinations, sound/event modes, differing support blocks, nonfinite numbers, mutations and provider failures. Targeted Clippy passes. Sound callbacks are controlled and the crystal-sound predicate is false in this gate; registered sound selection, audio playback and full movement integration remain pending. + + +`entity_move` sequences native movement phases: no-physics/piston early exits, +stuck multiplier reset, edge backoff, collision resolution, fall-reset clipping, +position/recording writes, collision/ground flags, landing, removal, restitution, +movement emission and block speed multiplication. `MovementHistory` retains at +most 100 records by merging the oldest pair and dropping their original-axis +movement metadata. Callbacks can change fields read by later phases. + +`python3 tools/test_entity_move_parity.py` invokes actual `Entity.move` with native +shape resolution and zero restitution. The +[movement lifecycle report](../benchmarks/rust-entity-move-2026-10-07/scoped-parity.json) +records **543,653 matching lines per JAR**, covering signed zero, tiny/nonfinite +movement, collisions, early exits, recording cap, authority guards, landing +mutations/removal and failures after partial writes. Targeted Clippy passes. +This gate controls piston/edge decisions, ground support, ray hits and landing +callbacks; step height is zero and non-passenger emission is tested separately. +Binding all phases to a live entity/world and player travel remains pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityMoveOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityMoveOracle.java new file mode 100644 index 000000000..8c40f26c4 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityMoveOracle.java @@ -0,0 +1,92 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*; +import java.lang.reflect.*; +import java.nio.file.*; +import java.util.*; +import net.minecraft.core.*; +import net.minecraft.tags.*; +import net.minecraft.world.entity.*; +import net.minecraft.world.level.*; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.state.*; +import net.minecraft.world.level.border.WorldBorder; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.phys.*; +import net.minecraft.world.phys.shapes.*; +/** Actual Entity.move with controlled lifecycle providers and native collision resolution. */ +public final class VanillaEntityMoveOracle { + static final class Stop extends RuntimeException {} + static Field position,stuck,history,removal; + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + static float single(JsonElement v){return Float.intBitsToFloat(Integer.parseUnsignedInt(v.getAsString(),16));} + static Vec3 vector(JsonElement v){var a=v.getAsJsonArray();return new Vec3(number(a.get(0)),number(a.get(1)),number(a.get(2)));} + static String vec(String label,Vec3 v){return String.format("%s %016x %016x %016x",label,Double.doubleToLongBits(v.x),Double.doubleToLongBits(v.y),Double.doubleToLongBits(v.z));} + static String box(String label,AABB b){return String.format("%s %016x %016x %016x %016x %016x %016x",label,Double.doubleToLongBits(b.minX),Double.doubleToLongBits(b.minY),Double.doubleToLongBits(b.minZ),Double.doubleToLongBits(b.maxX),Double.doubleToLongBits(b.maxY),Double.doubleToLongBits(b.maxZ));} + static String pos(BlockPos p){return p.getX()+" "+p.getY()+" "+p.getZ();} + static void write(Field f,Object o,Object v){try{f.set(o,v);}catch(Exception e){throw new AssertionError(e);}} + static final class Data { + JsonObject f;PrintWriter out;int calls;Vec3 velocity;boolean grounded;Actor actor;State state;List shapes; + boolean flag(String n){return f.get(n).getAsBoolean();} + void query(String s){out.println(s);if(calls++==f.get("fail").getAsInt())throw new Stop();} + } + static final class BounceBlock extends Block { + Data d;BounceBlock(){super(BlockBehaviour.Properties.of());} + @Override public float getBounceRestitution(){d.query("block-bounce");return 0;} + } + static final class State extends BlockState { + Data d;BounceBlock block;State(){super(null,null,null);} + @Override public Block getBlock(){return block;} + @Override public boolean is(TagKey tag){if(tag!=BlockTags.SUPPRESSES_BOUNCE)throw new AssertionError();d.query("block-suppresses");return false;} + } + static final class Border extends WorldBorder { + Data d;@Override public boolean isInsideCloseToBorder(Entity e,AABB b){d.query(box("border-test",b));return false;} + } + static final class Level extends net.minecraft.server.level.ServerLevel { + Data d;Border border;Level(){super(null,null,null,null,null,null,false,0L,List.of(),false);} + @Override public boolean isClientSide(){d.query("client");return d.flag("client");} + @Override public BlockState getBlockState(BlockPos p){d.query("block "+pos(p));return d.state;} + @Override public WorldBorder getWorldBorder(){d.query("border");return border;} + @Override public List getEntityCollisions(Entity e,AABB b){d.query(box("entities",b));return List.of();} + @Override public Iterable getBlockCollisions(Entity e,AABB b){d.query(box("blocks",b));return d.shapes;} + @Override public BlockHitResult clip(ClipContext c){d.query(vec("clip-from",c.getFrom()));d.query(vec("clip-to",c.getTo()));return d.flag("clip_hit")?new BlockHitResult(c.getTo(),Direction.UP,BlockPos.ZERO,false):BlockHitResult.miss(c.getTo(),Direction.UP,BlockPos.ZERO);} + } + static final class Actor extends Marker { + Data d;Actor(){super(null,null);}void configure(Level level){setLevel(level);} + @Override public void setPos(double x,double y,double z){var next=new Vec3(x,y,z);d.query(vec("set-position",next));setBoundingBox(getBoundingBox().move(next.subtract(position())));write(position,this,next);} + @Override public void recordMovement(MoverType mover,Vec3 v){d.query(vec("record "+mover.ordinal(),v));} + @Override protected Vec3 limitPistonMovement(Vec3 v){d.query(vec("piston",v));return vector(d.f.get("piston_result"));} + @Override public Vec3 getDeltaMovement(){d.query("velocity");return d.velocity;} + @Override public void setDeltaMovement(Vec3 v){d.query(vec("set-velocity",v));d.velocity=v;} + @Override protected Vec3 maybeBackOffFromEdge(Vec3 v,MoverType mover){d.query(vec("edge "+mover.ordinal(),v));return d.flag("edge_override")?vector(d.f.get("edge_result")):v;} + @Override public float maxUpStep(){return 0;} + @Override public boolean isDescending(){return false;} + @Override protected boolean isLocalClientAuthoritative(){d.query("local-client-authority");return d.flag("local_client");} + @Override public boolean isClientAuthoritative(){d.query("client-authority");return d.flag("client_authority");} + @Override public MoveSimulationType getMoveSimulationType(){d.query("simulation");return MoveSimulationType.SERVER_AND_CLIENT;} + @Override public boolean onGround(){d.query("ground");return d.grounded;} + @Override public void setOnGroundWithMovement(boolean below,boolean horizontal,Vec3 v){d.query(vec("ground-set "+below+" "+horizontal,v));d.grounded=below;horizontalCollision=horizontal;} + @Override protected boolean isHorizontalCollisionMinor(Vec3 v){d.query(vec("minor",v));return d.flag("minor_result");} + @Override public BlockPos getOnPosLegacy(){d.query("legacy");return new BlockPos(17,-64,-33);} + @Override protected void checkFallDamage(double dy,boolean ground,BlockState s,BlockPos p){d.query(String.format("fall %016x %s %s",Double.doubleToLongBits(dy),ground,pos(p)));if(d.flag("fall_mutates")){fallDistance=3;d.velocity=new Vec3(17,18,19);horizontalCollision=d.flag("mutated_horizontal");verticalCollision=d.flag("mutated_vertical");verticalCollisionBelow=d.flag("mutated_below");}if(d.flag("fall_removes"))write(removal,this,Entity.RemovalReason.DISCARDED);} + @Override public void resetFallDistance(){d.query("reset-fall");fallDistance=0;} + @Override public boolean isSuppressingBounce(){d.query("suppress");return false;} + @Override protected double getEntityBounciness(){d.query("entity-bounce");return 0;} + @Override protected double getEffectiveGravity(){d.query("gravity");return .08;} + @Override protected MovementEmission getMovementEmission(){d.query("emission");return d.flag("emits")?MovementEmission.ALL:MovementEmission.NONE;} + @Override public boolean isPassenger(){d.query("passenger");return true;} + @Override protected float getBlockSpeedFactor(){d.query("speed");return single(d.f.get("speed"));} + } + public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();var allocator=Class.forName("sun.misc.Unsafe");var field=allocator.getDeclaredField("theUnsafe");field.setAccessible(true);var unsafe=field.get(null);var allocate=allocator.getMethod("allocateInstance",Class.class); + position=Entity.class.getDeclaredField("position");position.setAccessible(true);stuck=Entity.class.getDeclaredField("stuckSpeedMultiplier");stuck.setAccessible(true);history=Entity.class.getDeclaredField("movementThisTick");history.setAccessible(true);removal=Entity.class.getDeclaredField("removalReason");removal.setAccessible(true); + var record=Class.forName("net.minecraft.world.entity.Entity$Movement");var constructor=record.getDeclaredConstructor(Vec3.class,Vec3.class,Vec3.class);constructor.setAccessible(true);var from=record.getDeclaredMethod("from");from.setAccessible(true);var to=record.getDeclaredMethod("to");to.setAccessible(true);var original=record.getDeclaredMethod("axisDependentOriginalMovement");original.setAccessible(true);Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){ + var f=JsonParser.parseString(line).getAsJsonObject();var d=new Data();d.f=f;d.out=out;d.velocity=vector(f.get("velocity"));d.grounded=d.flag("ground");var actor=(Actor)allocate.invoke(unsafe,Actor.class);actor.d=d;d.actor=actor;var level=(Level)allocate.invoke(unsafe,Level.class);level.d=d;actor.configure(level);var border=(Border)allocate.invoke(unsafe,Border.class);border.d=d;level.border=border;var state=(State)allocate.invoke(unsafe,State.class);state.d=d;var block=(BounceBlock)allocate.invoke(unsafe,BounceBlock.class);block.d=d;state.block=block;d.state=state; + var p=vector(f.get("position"));position.set(actor,p);actor.setBoundingBox(new AABB(p.x-.3,p.y,p.z-.3,p.x+.3,p.y+1.8,p.z+.3));stuck.set(actor,vector(f.get("stuck")));actor.noPhysics=d.flag("no_physics");actor.fallDistance=number(f.get("distance"));actor.horizontalCollision=d.flag("horizontal");actor.verticalCollision=d.flag("vertical");actor.verticalCollisionBelow=d.flag("below");actor.minorHorizontalCollision=d.flag("minor");removal.set(actor,d.flag("removed")?Entity.RemovalReason.DISCARDED:null); + var movements=new ArrayDeque();for(int i=0;i();for(var v:f.getAsJsonArray("shapes")){var a=v.getAsJsonArray();d.shapes.add(Shapes.box(number(a.get(0)),number(a.get(1)),number(a.get(2)),number(a.get(3)),number(a.get(4)),number(a.get(5))));} + try{actor.move(MoverType.values()[f.get("mover").getAsInt()],vector(f.get("movement")));out.println("ok");}catch(Stop e){out.println("error");} + out.println(vec("position",actor.position()));out.println(vec("velocity-final",d.velocity));out.println(vec("stuck",(Vec3)stuck.get(actor)));out.println(box("bounds",actor.getBoundingBox()));out.printf("flags %s %s %s %s %s %s %016x%n",actor.horizontalCollision,actor.verticalCollision,actor.verticalCollisionBelow,actor.minorHorizontalCollision,d.grounded,actor.isRemoved(),Double.doubleToLongBits(actor.fallDistance));out.println("history "+movements.size());for(var r:movements){out.println(vec("from",(Vec3)from.invoke(r)));out.println(vec("to",(Vec3)to.invoke(r)));var v=(Optional)original.invoke(r);out.println(v.isEmpty()?"original none":vec("original",(Vec3)v.get()));}out.println("queries "+d.calls); + }} + } +} diff --git a/tools/test_entity_move_parity.py b/tools/test_entity_move_parity.py new file mode 100644 index 000000000..662ca393f --- /dev/null +++ b/tools/test_entity_move_parity.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python3 +"""Compare Entity.move lifecycle ordering, state writes and recording with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + import itertools + def bits(v):return struct.pack('>d',float(v)).hex() + def single(v):return struct.pack('>f',float(v)).hex() + def row(**kw): + f=dict(movement=list(map(bits,[.4,-.2,.3])),position=list(map(bits,[.5,1.,.5])),velocity=list(map(bits,[.1,-.8,.2])),stuck=list(map(bits,[0,0,0])),piston_result=list(map(bits,[.25,0,0])),edge_result=list(map(bits,[.1,0,.2])),edge_override=False,no_physics=False,mover=0,client=False,client_authority=False,local_client=False,ground=True,horizontal=False,vertical=False,below=False,minor=False,minor_result=True,removed=False,distance=bits(5),clip_hit=False,fall_mutates=False,fall_removes=False,mutated_horizontal=False,mutated_vertical=False,mutated_below=False,emits=False,speed=single(.4),history=0,shapes=[],fail=-1) + f.update(kw);return f + scenes=[[],[[0,0,0,1,1,1]],[[1,0,0,2,3,1]],[[0,3,0,1,4,1]],[[0,0,1,1,3,2]],[[0,0,0,1,.9375,1]],[[0,0,0,1,1,1],[1,0,0,2,3,1],[0,0,1,1,3,2]]] + motions=[[0,0,0],[-0.,0,0],[1e-200,-1e-200,1e-200],[1e-4,-1e-4,1e-4],[.4,-.2,.3],[2,-1,2],[-2,-5,-2],[0,9,0],[1e-5,0,-1e-5],[0,0,math.nan],[0,math.nan,0],[math.inf,0,0]] + for shapes,motion,mover,client,authority,local in itertools.product(scenes,motions,range(5),[False,True],[False,True],[False,True]): + yield row(shapes=[[bits(v) for v in b] for b in shapes],movement=list(map(bits,motion)),mover=mover,client=client,client_authority=authority,local_client=local,emits=True) + for mover,no_physics,stuck,piston,fail in itertools.product(range(5),[False,True],[[0,0,0],[1e-200,0,0],[.1,.2,.3],[math.nan,1,1],[math.inf,0,0]],[[0,0,0],[-0.,0,0],[0,-0.,0],[0,0,-0.],[.25,0,0]],range(-1,12)): + yield row(mover=mover,no_physics=no_physics,stuck=list(map(bits,stuck)),piston_result=list(map(bits,piston)),fail=fail,horizontal=True,vertical=True,below=True,minor=True) + for shapes,flags,fail in itertools.product(scenes,range(32),range(-1,38)): + yield row(shapes=[[bits(v) for v in b] for b in shapes],fall_mutates=True,fall_removes=bool(flags&1),mutated_horizontal=bool(flags&2),mutated_vertical=bool(flags&4),mutated_below=bool(flags&8),clip_hit=bool(flags&16),movement=list(map(bits,[2,-2,2])),fail=fail) + for count,fail,no_physics in itertools.product([0,1,98,99,100],range(-1,30),[False,True]):yield row(history=count,fail=fail,no_physics=no_physics) + rng=random.Random(0x4d4f56454d454e54) + values=[-math.inf,-1e30,-2.,-0.,0.,1e-200,1e-7,1.,1e30,math.inf,math.nan] + for _ in range(6000): + yield row(movement=list(map(bits,rng.choice(motions))),shapes=[[bits(v) for v in b] for b in rng.choice(scenes)],mover=rng.randrange(5),stuck=[bits(rng.choice([0,.5,1,math.nan])) for _ in range(3)],piston_result=[bits(rng.choice(values)) for _ in range(3)],edge_override=bool(rng.randrange(2)),edge_result=[bits(rng.choice(values)) for _ in range(3)],velocity=[bits(rng.choice(values)) for _ in range(3)],no_physics=bool(rng.randrange(2)),client=bool(rng.randrange(2)),client_authority=bool(rng.randrange(2)),local_client=bool(rng.randrange(2)),ground=bool(rng.randrange(2)),horizontal=bool(rng.randrange(2)),vertical=bool(rng.randrange(2)),below=bool(rng.randrange(2)),minor=bool(rng.randrange(2)),minor_result=bool(rng.randrange(2)),removed=bool(rng.randrange(2)),distance=bits(rng.choice(values)),clip_hit=bool(rng.randrange(2)),fall_mutates=bool(rng.randrange(2)),fall_removes=bool(rng.randrange(2)),mutated_horizontal=bool(rng.randrange(2)),mutated_vertical=bool(rng.randrange(2)),mutated_below=bool(rng.randrange(2)),emits=bool(rng.randrange(2)),speed=single(rng.choice(values)),fail=rng.randrange(-1,34)) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-entity-move-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityMoveOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/entity_move_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaEntityMoveOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','entity_move_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('entity_move_fixture.exe' if os.name=='nt' else 'entity_move_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} entity-move output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual Entity.move with native shape collision resolution (zero step height), native zero-restitution handling and final authority checks. Compares no-physics and piston early exits including signed zero, stuck multiplier reset, edge callback, fall-reset clip endpoints, movement recording cap, collision flag writes, ground/fall callback ordering, removal, passenger emission guard, speed multiplication and failures after partial state changes. Providers control piston/edge decisions, ground support, ray hits, landing effects and sound policy; live world integration and non-passenger movement emission remain separate work.'} + lab.write_json(report_path,report);print(f'Scoped entity move parity passed: {report_path}') + + +if __name__=='__main__':main() From fe4688c8caa4c7d2b7fd88a5660409ff9a01dd1f Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 01:59:47 +0200 Subject: [PATCH 083/253] Match world ray clipping and fall distance reset selection --- .../scoped-parity.json | 221 ++++++++++++++++++ .../examples/world_ray_fixture.rs | 201 ++++++++++++++++ crates/horizon-world/src/lib.rs | 1 + crates/horizon-world/src/world_ray.rs | 194 +++++++++++++++ .../horizon-world/tests/world_ray_limits.rs | 101 ++++++++ docs/collision-geometry.md | 17 ++ .../parity/VanillaWorldRayOracle.java | 78 +++++++ tools/test_world_ray_parity.py | 76 ++++++ 8 files changed, 889 insertions(+) create mode 100644 benchmarks/rust-world-ray-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/world_ray_fixture.rs create mode 100644 crates/horizon-world/src/world_ray.rs create mode 100644 crates/horizon-world/tests/world_ray_limits.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaWorldRayOracle.java create mode 100644 tools/test_world_ray_parity.py diff --git a/benchmarks/rust-world-ray-2026-10-07/scoped-parity.json b/benchmarks/rust-world-ray-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..ab9e89fac --- /dev/null +++ b/benchmarks/rust-world-ray-2026-10-07/scoped-parity.json @@ -0,0 +1,221 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 13896, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaWorldRayOracle.java": "9b6ad079ee7b826dd60fb180a3bdeae02f2d034f3c9e3549e292add94faa152f", + "tools/test_world_ray_parity.py": "f36ada99750efedf3a8e3ef59a0080967ccfe61f902608587532e8c09f5ddb22", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "24cf8b3b172e576838ffc5693c86e50e586080cec1dfca4e595081f54a065c5c", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "a5021a168adcedc37d77f533a8921c02f09c59f46a01737586aaa33c5908b8d0", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/world_ray_fixture.rs": "3e4d9cd496b3df69130dd124116b2778a14c19837d515489c103e3c779a8e8c7" + }, + "fixtures_sha256": { + ".local/rust-world-ray-parity/inputs.txt": "3f67bb952a1528123cf2858e23590d68bddd8350f636f4fea2b515fe65d7a5c6" + }, + "rust_output_sha256": "e45310cc0ecebb8330a86e6798735b4360cdde0100db9b283d619c5280c8694a", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "e45310cc0ecebb8330a86e6798735b4360cdde0100db9b283d619c5280c8694a", + "matched_output_lines": 248725 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "e45310cc0ecebb8330a86e6798735b4360cdde0100db9b283d619c5280c8694a", + "matched_output_lines": 248725 + } + ], + "scope": "Actual BlockGetter.clip, clipWithInteractionOverride and native ClipContext block/fluid selection. Covers collision/outline/visual/fall-reset modes, none/source/any/water fluid modes, nearest-hit ties, face-only interaction overrides, inside hits, misses, zero/signed-zero/tiny rays, ordered block/fluid reads and provider failures. Fall-reset tests include block tag, entity type identity, end gateways/portals and server nether-portal delay with lazy rule queries. Shapes and state predicates are controlled providers; registered outline/visual/interaction shapes, live world binding and gameplay integration remain separate work. Nonfinite rays and exhausted visit budgets return explicit Rust errors rather than fabricated misses." +} diff --git a/crates/horizon-world/examples/world_ray_fixture.rs b/crates/horizon-world/examples/world_ray_fixture.rs new file mode 100644 index 000000000..b418785b0 --- /dev/null +++ b/crates/horizon-world/examples/world_ray_fixture.rs @@ -0,0 +1,201 @@ +use horizon_core::{ + geometry::{Aabb, ShapeOp, Vec3, VoxelShape}, + position::BlockPos, +}; +use horizon_world::{entity_obstruction::EntityIdentity, world_ray::*}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn vector(v: &Value) -> Vec3 { + Vec3::new(number(&v[0]), number(&v[1]), number(&v[2])) +} +fn bits(v: f64) -> u64 { + if v.is_nan() { + 0x7ff8000000000000 + } else { + v.to_bits() + } +} +fn pos(p: BlockPos) -> String { + format!("{} {} {}", p.x, p.y, p.z) +} +fn shape(v: &Value) -> Result> { + let mut result = VoxelShape::empty(); + for b in v.as_array().unwrap() { + result = result.join( + &VoxelShape::from_box(Aabb::new( + Vec3::new(number(&b[0]), number(&b[1]), number(&b[2])), + Vec3::new(number(&b[3]), number(&b[4]), number(&b[5])), + ))?, + ShapeOp::OR, + )?; + } + Ok(result) +} +struct World<'a> { + f: &'a Value, + out: &'a mut dyn Write, + calls: i64, + shapes: Vec<[VoxelShape; 5]>, +} +impl World<'_> { + fn flag(&self, n: &str) -> bool { + self.f[n].as_bool().unwrap() + } + fn query(&mut self, s: String) -> io::Result<()> { + writeln!(self.out, "{s}")?; + let call = self.calls; + self.calls += 1; + if call == self.f["fail"].as_i64().unwrap() { + Err(io::Error::other("injected ray failure")) + } else { + Ok(()) + } + } + fn index(&self, p: BlockPos) -> usize { + self.f["cells"][pos(p)].as_u64().unwrap_or(0) as usize + } + fn predicate(&mut self, n: &str, key: &str, s: usize) -> io::Result { + self.query(format!("{n} {s}"))?; + Ok(self.f["states"][s][key].as_bool().unwrap()) + } +} +impl FallResetWorld for World<'_> { + type Error = io::Error; + type Block = usize; + fn fall_reset_tag(&mut self, s: usize) -> io::Result { + self.predicate("reset-tag", "reset", s) + } + fn entity_is_player(&mut self, _: EntityIdentity) -> io::Result { + self.query("player".into())?; + Ok(self.flag("player")) + } + fn is_portal(&mut self, s: usize, p: ResetPortal) -> io::Result { + let n = match p { + ResetPortal::EndGateway => "gateway", + ResetPortal::EndPortal => "end", + ResetPortal::NetherPortal => "nether", + }; + self.predicate(n, n, s) + } + fn is_server_level(&self) -> bool { + self.flag("server") + } + fn players_nether_portal_delay(&mut self) -> io::Result { + self.query("rules".into())?; + self.query("portal-delay".into())?; + Ok(self.f["delay"].as_i64().unwrap() as i32) + } +} +impl RayWorld for World<'_> { + type Error = io::Error; + type Block = usize; + type Fluid = usize; + fn block_state(&mut self, p: BlockPos) -> io::Result { + self.query(format!("block {}", pos(p)))?; + Ok(self.index(p)) + } + fn fluid_state(&mut self, p: BlockPos) -> io::Result { + self.query(format!("fluid {}", pos(p)))?; + Ok(self.index(p)) + } + fn block_shape(&mut self, s: usize, p: BlockPos, m: RayBlockMode) -> io::Result { + if m == RayBlockMode::FallDamageResetting { + let entity = self.flag("entity").then_some(EntityIdentity(0)); + return fall_reset_shape(self, s, entity); + } + let (n, i) = match m { + RayBlockMode::Collider => ("collider", 0), + RayBlockMode::Outline => ("outline", 1), + RayBlockMode::Visual => ("visual", 2), + RayBlockMode::FallDamageResetting => unreachable!(), + }; + self.query(format!("{n} {s} {}", pos(p)))?; + Ok(self.shapes[s][i].clone()) + } + fn interaction_shape(&mut self, s: usize, p: BlockPos) -> io::Result { + self.query(format!("interaction {s} {}", pos(p)))?; + Ok(self.shapes[s][3].clone()) + } + fn fluid_is_source(&mut self, s: usize) -> io::Result { + self.predicate("source", "source", s) + } + fn fluid_is_empty(&mut self, s: usize) -> io::Result { + self.predicate("empty", "empty", s) + } + fn fluid_is_water(&mut self, s: usize) -> io::Result { + self.predicate("water", "water", s) + } + fn fluid_shape(&mut self, s: usize, p: BlockPos) -> io::Result { + self.query(format!("fluid-shape {s} {}", pos(p)))?; + Ok(self.shapes[s][4].clone()) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut shapes = Vec::new(); + for s in f["states"].as_array().unwrap() { + shapes.push([ + shape(&s["collider"])?, + shape(&s["outline"])?, + shape(&s["visual"])?, + shape(&s["interaction"])?, + shape(&s["fluid_shape"])?, + ]); + } + let mut w = World { + f: &f, + out: &mut out, + calls: 0, + shapes, + }; + let block_mode = [ + RayBlockMode::Collider, + RayBlockMode::Outline, + RayBlockMode::Visual, + RayBlockMode::FallDamageResetting, + ][f["block_mode"].as_u64().unwrap() as usize]; + let fluid_mode = [ + RayFluidMode::None, + RayFluidMode::SourceOnly, + RayFluidMode::Any, + RayFluidMode::Water, + ][f["fluid_mode"].as_u64().unwrap() as usize]; + match clip_world( + &mut w, + vector(&f["from"]), + vector(&f["to"]), + block_mode, + fluid_mode, + 10000, + ) { + Ok(r) => { + let h = r.hit; + writeln!( + w.out, + "hit {} {:016x} {:016x} {:016x} {} {} {}", + r.miss, + bits(h.location.x), + bits(h.location.y), + bits(h.location.z), + format!("{:?}", h.direction).to_lowercase(), + pos(h.block), + h.inside + )?; + } + Err(_) => writeln!(w.out, "error")?, + } + writeln!(w.out, "queries {}", w.calls)?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index e4d6daf09..43b722934 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -42,6 +42,7 @@ pub mod retrogen; pub mod suffocation; pub mod tick_data; pub mod world_movement; +pub mod world_ray; pub mod worldgen; pub const DATA_VERSION: i32 = 5023; diff --git a/crates/horizon-world/src/world_ray.rs b/crates/horizon-world/src/world_ray.rs new file mode 100644 index 000000000..302f043d6 --- /dev/null +++ b/crates/horizon-world/src/world_ray.rs @@ -0,0 +1,194 @@ +//! BlockGetter clipping: ordered block/fluid queries and interaction-face override. +use crate::entity_obstruction::EntityIdentity; +use horizon_core::{ + geometry::{BlockHit, Direction, TraversalError, Vec3, VoxelShape, traverse_blocks}, + position::BlockPos, +}; +use std::fmt; +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum RayBlockMode { + Collider, + Outline, + Visual, + FallDamageResetting, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum RayFluidMode { + None, + SourceOnly, + Any, + Water, +} +#[derive(Clone, Copy, Debug, PartialEq)] +pub struct RayResult { + pub hit: BlockHit, + pub miss: bool, +} +#[derive(Debug)] +pub enum RayError { + Traversal(TraversalError), + World(E), +} +impl fmt::Display for RayError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::Traversal(e) => e.fmt(f), + Self::World(e) => e.fmt(f), + } + } +} +impl std::error::Error for RayError {} +/// Block/shape providers retain the captured collision context for the query. +/// State handles must remain valid when later provider calls change the world. +pub trait RayWorld { + type Error; + type Block: Copy; + type Fluid: Copy; + fn block_state(&mut self, p: BlockPos) -> Result; + fn fluid_state(&mut self, p: BlockPos) -> Result; + fn block_shape( + &mut self, + state: Self::Block, + p: BlockPos, + mode: RayBlockMode, + ) -> Result; + fn interaction_shape( + &mut self, + state: Self::Block, + p: BlockPos, + ) -> Result; + fn fluid_is_source(&mut self, state: Self::Fluid) -> Result; + fn fluid_is_empty(&mut self, state: Self::Fluid) -> Result; + fn fluid_is_water(&mut self, state: Self::Fluid) -> Result; + fn fluid_shape(&mut self, state: Self::Fluid, p: BlockPos) -> Result; +} +pub fn clip_with_interaction( + world: &mut W, + start: Vec3, + end: Vec3, + p: BlockPos, + shape: &VoxelShape, + state: W::Block, +) -> Result, W::Error> { + let mut hit = shape.clip(start, end, p); + if let Some(hit) = &mut hit { + if let Some(interaction) = world.interaction_shape(state, p)?.clip(start, end, p) { + if interaction.location.subtract(start).length_squared() + < hit.location.subtract(start).length_squared() + { + hit.direction = interaction.direction; + } + } + } + Ok(hit) +} +fn pick_fluid( + world: &mut W, + state: W::Fluid, + mode: RayFluidMode, +) -> Result { + match mode { + RayFluidMode::None => Ok(false), + RayFluidMode::SourceOnly => world.fluid_is_source(state), + RayFluidMode::Any => Ok(!world.fluid_is_empty(state)?), + RayFluidMode::Water => world.fluid_is_water(state), + } +} +/// Finite rays only, with an explicit traversal budget. Budget/provider failures +/// preserve preceding queries and return an error rather than a fabricated miss. +pub fn clip_world( + world: &mut W, + start: Vec3, + end: Vec3, + blocks: RayBlockMode, + fluids: RayFluidMode, + max_visits: usize, +) -> Result> { + let result = traverse_blocks(start, end, max_visits, |p| { + let mut query = || -> Result, W::Error> { + let block = world.block_state(p)?; + let fluid = world.fluid_state(p)?; + let shape = world.block_shape(block, p, blocks)?; + let solid = clip_with_interaction(world, start, end, p, &shape, block)?; + let liquid = if pick_fluid(world, fluid, fluids)? { + world.fluid_shape(fluid, p)?.clip(start, end, p) + } else { + None + }; + let solid_distance = solid.map_or(f64::MAX, |h| start.distance_squared(h.location)); + let liquid_distance = liquid.map_or(f64::MAX, |h| start.distance_squared(h.location)); + Ok(if solid_distance <= liquid_distance { + solid + } else { + liquid + }) + }; + match query() { + Ok(Some(hit)) => Some(Ok(hit)), + Ok(None) => None, + Err(e) => Some(Err(e)), + } + }) + .map_err(RayError::Traversal)?; + match result { + Some(hit) => Ok(RayResult { + hit: hit.map_err(RayError::World)?, + miss: false, + }), + None => Ok(RayResult { + hit: BlockHit { + location: end, + direction: Direction::approximate_nearest(start.subtract(end)), + block: BlockPos::new( + end.x.floor() as i32, + end.y.floor() as i32, + end.z.floor() as i32, + ), + inside: false, + }, + miss: true, + }), + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum ResetPortal { + EndGateway, + EndPortal, + NetherPortal, +} +pub trait FallResetWorld { + type Error; + type Block: Copy; + fn fall_reset_tag(&mut self, state: Self::Block) -> Result; + fn entity_is_player(&mut self, entity: EntityIdentity) -> Result; + fn is_portal(&mut self, state: Self::Block, portal: ResetPortal) -> Result; + fn is_server_level(&self) -> bool; + fn players_nether_portal_delay(&mut self) -> Result; +} +/// Supply an entity only when the native context is an EntityCollisionContext +/// containing one. Player testing is entity type identity, not a class check. +pub fn fall_reset_shape( + world: &mut W, + state: W::Block, + entity: Option, +) -> Result { + if world.fall_reset_tag(state)? { + return Ok(VoxelShape::block()); + } + if let Some(entity) = entity { + if world.entity_is_player(entity)? { + if world.is_portal(state, ResetPortal::EndGateway)? + || world.is_portal(state, ResetPortal::EndPortal)? + { + return Ok(VoxelShape::block()); + } + if world.is_server_level() + && world.is_portal(state, ResetPortal::NetherPortal)? + && world.players_nether_portal_delay()? == 0 + { + return Ok(VoxelShape::block()); + } + } + } + Ok(VoxelShape::empty()) +} diff --git a/crates/horizon-world/tests/world_ray_limits.rs b/crates/horizon-world/tests/world_ray_limits.rs new file mode 100644 index 000000000..cc999867b --- /dev/null +++ b/crates/horizon-world/tests/world_ray_limits.rs @@ -0,0 +1,101 @@ +use horizon_core::{ + geometry::{TraversalError, Vec3, VoxelShape}, + position::BlockPos, +}; +use horizon_world::world_ray::{RayBlockMode, RayError, RayFluidMode, RayWorld, clip_world}; +#[derive(Default)] +struct World { + reads: usize, + fail_fluid: bool, +} +impl RayWorld for World { + type Error = &'static str; + type Block = (); + type Fluid = (); + fn block_state(&mut self, _: BlockPos) -> Result<(), Self::Error> { + self.reads += 1; + Ok(()) + } + fn fluid_state(&mut self, _: BlockPos) -> Result<(), Self::Error> { + self.reads += 1; + if self.fail_fluid { + Err("fluid unavailable") + } else { + Ok(()) + } + } + fn block_shape( + &mut self, + _: (), + _: BlockPos, + _: RayBlockMode, + ) -> Result { + Ok(VoxelShape::empty()) + } + fn interaction_shape(&mut self, _: (), _: BlockPos) -> Result { + panic!("empty block cannot have interaction hit") + } + fn fluid_is_source(&mut self, _: ()) -> Result { + panic!("fluid mode is NONE") + } + fn fluid_is_empty(&mut self, _: ()) -> Result { + panic!("fluid mode is NONE") + } + fn fluid_is_water(&mut self, _: ()) -> Result { + panic!("fluid mode is NONE") + } + fn fluid_shape(&mut self, _: (), _: BlockPos) -> Result { + panic!("fluid mode is NONE") + } +} +#[test] +fn visit_limit_retains_queries_and_does_not_report_miss() { + let mut world = World::default(); + let result = clip_world( + &mut world, + Vec3::new(0.5, 0.5, 0.5), + Vec3::new(3.5, 0.5, 0.5), + RayBlockMode::Collider, + RayFluidMode::None, + 1, + ); + assert!(matches!( + result, + Err(RayError::Traversal(TraversalError::VisitLimit)) + )); + assert_eq!(world.reads, 2); +} +#[test] +fn nonfinite_ray_fails_before_world_reads() { + let mut world = World::default(); + let result = clip_world( + &mut world, + Vec3::ZERO, + Vec3::new(f64::INFINITY, 0., 0.), + RayBlockMode::Collider, + RayFluidMode::None, + 10, + ); + assert!(matches!( + result, + Err(RayError::Traversal(TraversalError::NonFinite)) + )); + assert_eq!(world.reads, 0); +} +#[test] +fn provider_failure_is_distinct_from_traversal_failure() { + let mut world = World { + fail_fluid: true, + ..Default::default() + }; + let result = clip_world( + &mut world, + Vec3::ZERO, + Vec3::new(1., 0., 0.), + RayBlockMode::Collider, + RayFluidMode::None, + 10, + ); + assert!(matches!(result, Err(RayError::World("fluid unavailable")))); + assert_eq!(world.reads, 2); +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index bc8fc6050..9de95ebee 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -755,3 +755,20 @@ mutations/removal and failures after partial writes. Targeted Clippy passes. This gate controls piston/edge decisions, ground support, ray hits and landing callbacks; step height is zero and non-passenger emission is tested separately. Binding all phases to a live entity/world and player travel remains pending. + + +`world_ray` implements ordered block/fluid ray clipping, nearest-hit selection +with block precedence on ties, and interaction-shape overrides that replace only +the hit face. It also implements native fluid pick modes and fall-reset shape +selection, including player type identity, end portals/gateways and server-side +zero-delay Nether portals. Traversal limits and invalid geometry return errors. + +`python3 tools/test_world_ray_parity.py` compares actual `BlockGetter.clip` and +native `ClipContext` modes. The +[world ray report](../benchmarks/rust-world-ray-2026-10-07/scoped-parity.json) +records **248,725 matching lines per JAR**, including inside hits, ties, misses, +interaction geometry, short/signed-zero rays, lazy predicates/rules and provider +failures. Targeted Clippy passes. Separate limit tests distinguish a miss from +nonfinite geometry, exhausted traversal budget and failed world reads. Shapes +and state predicates are controlled; registered shape binding, actual fluid +shape caching and full entity/world integration remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaWorldRayOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaWorldRayOracle.java new file mode 100644 index 000000000..ff7bddd90 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaWorldRayOracle.java @@ -0,0 +1,78 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*; +import java.lang.reflect.*; +import java.nio.file.*; +import java.util.*; +import net.minecraft.core.*; +import net.minecraft.core.registries.*; +import net.minecraft.tags.*; +import net.minecraft.world.entity.*; +import net.minecraft.world.level.*; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.state.*; +import net.minecraft.world.level.gamerules.*; +import net.minecraft.world.level.material.*; +import net.minecraft.world.phys.*; +import net.minecraft.world.phys.shapes.*; +/** Actual BlockGetter.clip with native context modes and controlled shape providers. */ +public final class VanillaWorldRayOracle { + static final class Stop extends RuntimeException {} + static Object unsafe;static Method allocate; + static T make(Class type){try{return type.cast(allocate.invoke(unsafe,type));}catch(Exception e){throw new AssertionError(e);}} + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + static Vec3 vector(JsonElement v){var a=v.getAsJsonArray();return new Vec3(number(a.get(0)),number(a.get(1)),number(a.get(2)));} + static String pos(BlockPos p){return p.getX()+" "+p.getY()+" "+p.getZ();} + static VoxelShape shape(JsonElement v){var result=Shapes.empty();for(var value:v.getAsJsonArray()){var a=value.getAsJsonArray();result=Shapes.or(result,Shapes.box(number(a.get(0)),number(a.get(1)),number(a.get(2)),number(a.get(3)),number(a.get(4)),number(a.get(5))));}return result;} + static final class Data { + JsonObject f;PrintWriter out;int calls;State[] states;FluidState[] fluids;Rules rules; + void query(String s){out.println(s);if(calls++==f.get("fail").getAsInt())throw new Stop();} + int index(BlockPos p){var cells=f.getAsJsonObject("cells");var id=cells.get(pos(p));return id==null?0:id.getAsInt();} + BlockState block(BlockPos p){query("block "+pos(p));return states[index(p)];} + FluidState fluid(BlockPos p){query("fluid "+pos(p));return fluids[index(p)];} + } + static final class State extends BlockState { + Data d;int id;VoxelShape[] shapes;State(){super(null,null,null);} + boolean flag(String n){return d.f.getAsJsonArray("states").get(id).getAsJsonObject().get(n).getAsBoolean();} + @Override public boolean is(TagKey tag){if(tag!=BlockTags.FALL_DAMAGE_RESETTING)throw new AssertionError();d.query("reset-tag "+id);return flag("reset");} + @Override public boolean is(Block block){String n=block==Blocks.END_GATEWAY?"gateway":block==Blocks.END_PORTAL?"end":block==Blocks.NETHER_PORTAL?"nether":null;if(n==null)throw new AssertionError();d.query(n+" "+id);return flag(n);} + @Override public VoxelShape getCollisionShape(BlockGetter w,BlockPos p,CollisionContext c){d.query("collider "+id+" "+pos(p));return shapes[0];} + @Override public VoxelShape getShape(BlockGetter w,BlockPos p,CollisionContext c){d.query("outline "+id+" "+pos(p));return shapes[1];} + @Override public VoxelShape getVisualShape(BlockGetter w,BlockPos p,CollisionContext c){d.query("visual "+id+" "+pos(p));return shapes[2];} + @Override public VoxelShape getInteractionShape(BlockGetter w,BlockPos p){d.query("interaction "+id+" "+pos(p));return shapes[3];} + } + static final class Fluid extends WaterFluid.Source { + Data d;int id;VoxelShape shape; + boolean flag(String n){return d.f.getAsJsonArray("states").get(id).getAsJsonObject().get(n).getAsBoolean();} + @Override public boolean isSource(FluidState state){d.query("source "+id);return flag("source");} + @Override protected boolean isEmpty(){d.query("empty "+id);return flag("empty");} + @Override public Holder.Reference builtInRegistryHolder(){d.query("water "+id);return (flag("water")?Fluids.WATER:Fluids.LAVA).builtInRegistryHolder();} + @Override public VoxelShape getShape(FluidState state,BlockGetter w,BlockPos p){d.query("fluid-shape "+id+" "+pos(p));return shape;} + } + static final class Rules extends GameRules { + Data d;Rules(){super(net.minecraft.world.flag.FeatureFlagSet.of());} + @SuppressWarnings("unchecked") @Override public T get(GameRule rule){if(rule!=GameRules.PLAYERS_NETHER_PORTAL_DEFAULT_DELAY)throw new AssertionError();d.query("portal-delay");return (T)Integer.valueOf(d.f.get("delay").getAsInt());} + } + static final class ServerWorld extends net.minecraft.server.level.ServerLevel { + Data d;ServerWorld(){super(null,null,null,null,null,null,false,0L,List.of(),false);} + @Override public BlockState getBlockState(BlockPos p){return d.block(p);} + @Override public FluidState getFluidState(BlockPos p){return d.fluid(p);} + @Override public GameRules getGameRules(){d.query("rules");return d.rules;} + } + static final class Actor extends Marker { + Data d;Actor(){super(null,null);} + @Override public boolean is(EntityType type){if(type!=EntityTypes.PLAYER)throw new AssertionError();d.query("player");return d.f.get("player").getAsBoolean();} + @Override public boolean isDescending(){return false;} + } + public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();var allocator=Class.forName("sun.misc.Unsafe");var field=allocator.getDeclaredField("theUnsafe");field.setAccessible(true);unsafe=field.get(null);allocate=allocator.getMethod("allocateInstance",Class.class); + BuiltInRegistries.FLUID.prepareTagReload(new TagLoader.LoadResult<>(Registries.FLUID,Map.of(FluidTags.WATER,List.of(Fluids.WATER.builtInRegistryHolder())))).apply();var position=Entity.class.getDeclaredField("position");position.setAccessible(true);Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){ + var f=JsonParser.parseString(line).getAsJsonObject();var d=new Data();d.f=f;d.out=out;var entries=f.getAsJsonArray("states");d.states=new State[entries.size()];d.fluids=new FluidState[entries.size()];for(int i=0;i[0],new Comparable[0]);} + d.rules=make(Rules.class);d.rules.d=d;BlockGetter world;if(f.get("server").getAsBoolean()){var w=make(ServerWorld.class);w.d=d;world=w;}else{world=(BlockGetter)Proxy.newProxyInstance(BlockGetter.class.getClassLoader(),new Class[]{BlockGetter.class},(proxy,method,values)->{if(method.getName().equals("getBlockState"))return d.block((BlockPos)values[0]);if(method.getName().equals("getFluidState"))return d.fluid((BlockPos)values[0]);if(method.isDefault())return InvocationHandler.invokeDefault(proxy,method,values);throw new AssertionError(method);});} + CollisionContext context=CollisionContext.empty();if(f.get("entity").getAsBoolean()){var actor=make(Actor.class);actor.d=d;position.set(actor,Vec3.ZERO);context=CollisionContext.of(actor);} + var c=new ClipContext(vector(f.get("from")),vector(f.get("to")),ClipContext.Block.values()[f.get("block_mode").getAsInt()],ClipContext.Fluid.values()[f.get("fluid_mode").getAsInt()],context); + try{var hit=world.clip(c);var v=hit.getLocation();out.printf("hit %s %016x %016x %016x %s %s %s%n",hit.getType()==HitResult.Type.MISS,Double.doubleToLongBits(v.x),Double.doubleToLongBits(v.y),Double.doubleToLongBits(v.z),hit.getDirection().getSerializedName(),pos(hit.getBlockPos()),hit.isInside());}catch(Stop e){out.println("error");}out.println("queries "+d.calls); + }} + } +} diff --git a/tools/test_world_ray_parity.py b/tools/test_world_ray_parity.py new file mode 100644 index 000000000..9168b4674 --- /dev/null +++ b/tools/test_world_ray_parity.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python3 +"""Compare world ray clipping, interaction faces and fall-reset selection with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + import itertools + def bits(v):return struct.pack('>d',float(v)).hex() + def shape(boxes):return [[bits(v) for v in b] for b in boxes] + def state(**kw): + f=dict(collider=[],outline=[],visual=[],interaction=[],fluid_shape=[],reset=False,gateway=False,end=False,nether=False,source=False,empty=True,water=False);f.update(kw);return f + full=shape([[0,0,0,1,1,1]]) + def row(s=None,**kw): + f=dict(states=[state(),s or state(collider=full,outline=full,visual=full)],cells={'0 0 0':1},block_mode=0,fluid_mode=0,entity=False,player=False,server=False,delay=80,fail=-1,**{'from':list(map(bits,[-2,.5,.5])),'to':list(map(bits,[2,.5,.5]))});f.update(kw);return f + shapes=[[],full,shape([[0,0,0,1,.5,1]]),shape([[.5,0,0,1,1,1]]),shape([[0,.25,0,1,.75,1]]),shape([[0,0,0,.25,1,1],[.75,0,0,1,1,1]]),shape([[-.5,-.5,-.5,1.5,1.5,1.5]]),shape([[0,0,0,0,0,0]])] + rays=[([-2,.5,.5],[2,.5,.5]),([.5,2,.5],[.5,-2,.5]),([.5,.5,.5],[2,2,2]),([-1,-1,-1],[2,2,2]),([0,0,0],[0,0,0]),([-0.,0,0],[0,0,0]),([1,.5,.5],[0,.5,.5]),([.5,.5,.5],[.5+1e-8,.5,.5]),([.5,.5,.5],[.5+.001,.5,.5]),([2,2,2],[3,3,3])] + for block,fluid,interaction,mode,fluid_mode in itertools.product(shapes,shapes,shapes[:5],range(3),range(4)): + ray=rays[(mode+fluid_mode)%len(rays)] + yield row(state(collider=block,outline=block,visual=block,interaction=interaction,fluid_shape=fluid,source=True,empty=False,water=True),block_mode=mode,fluid_mode=fluid_mode,**{'from':list(map(bits,ray[0])),'to':list(map(bits,ray[1]))}) + for flags,entity,player,server,delay,fluid_mode in itertools.product(range(16),[False,True],[False,True],[False,True],[-1,0,1,80],range(4)): + yield row(state(reset=bool(flags&1),gateway=bool(flags&2),end=bool(flags&4),nether=bool(flags&8),interaction=full,fluid_shape=full,source=True,empty=False,water=True),block_mode=3,fluid_mode=fluid_mode,entity=entity,player=player,server=server,delay=delay) + for ray,mask,mode in itertools.product(rays,range(8),range(4)): + yield row(state(collider=full,outline=shapes[2],visual=shapes[3],interaction=shapes[4],fluid_shape=full,source=bool(mask&1),empty=bool(mask&2),water=bool(mask&4)),fluid_mode=mode,**{'from':list(map(bits,ray[0])),'to':list(map(bits,ray[1]))}) + for mode,fluid_mode,fail in itertools.product(range(4),range(4),range(-1,42)): + yield row(state(collider=full,outline=full,visual=full,interaction=full,fluid_shape=full,nether=True,source=True,empty=False,water=True),block_mode=mode,fluid_mode=fluid_mode,fail=fail,entity=True,player=True,server=True,delay=0) + rng=random.Random(0x524159434c4950) + for _ in range(7000): + sh=[rng.choice(shapes) for _ in range(5)];p=[rng.choice([-2,-1,-0.,0.,.25,.5,1.,2.,3.]) for _ in range(3)];q=[rng.choice([-2,-1,-0.,0.,.25,.5,1.,2.,3.]) for _ in range(3)] + yield row(state(collider=sh[0],outline=sh[1],visual=sh[2],interaction=sh[3],fluid_shape=sh[4],reset=bool(rng.randrange(2)),gateway=bool(rng.randrange(2)),end=bool(rng.randrange(2)),nether=bool(rng.randrange(2)),source=bool(rng.randrange(2)),empty=bool(rng.randrange(2)),water=bool(rng.randrange(2))),block_mode=rng.randrange(4),fluid_mode=rng.randrange(4),entity=bool(rng.randrange(2)),player=bool(rng.randrange(2)),server=bool(rng.randrange(2)),delay=rng.choice([-1,0,1,80]),cells={rng.choice(['0 0 0','-1 -1 -1','1 1 1']):1 for _ in range(3)},fail=rng.randrange(-1,30),**{'from':list(map(bits,p)),'to':list(map(bits,q))}) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-world-ray-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaWorldRayOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/world_ray_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaWorldRayOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','world_ray_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('world_ray_fixture.exe' if os.name=='nt' else 'world_ray_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} world-ray output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual BlockGetter.clip, clipWithInteractionOverride and native ClipContext block/fluid selection. Covers collision/outline/visual/fall-reset modes, none/source/any/water fluid modes, nearest-hit ties, face-only interaction overrides, inside hits, misses, zero/signed-zero/tiny rays, ordered block/fluid reads and provider failures. Fall-reset tests include block tag, entity type identity, end gateways/portals and server nether-portal delay with lazy rule queries. Shapes and state predicates are controlled providers; registered outline/visual/interaction shapes, live world binding and gameplay integration remain separate work. Nonfinite rays and exhausted visit budgets return explicit Rust errors rather than fabricated misses.'} + lab.write_json(report_path,report);print(f'Scoped world ray parity passed: {report_path}') + + +if __name__=='__main__':main() From c958b6f82329761376216c9ec37039b3b3c6c55e Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 02:03:42 +0200 Subject: [PATCH 084/253] Match registered fluid shape caches and query-dependent initialization --- .../scoped-parity.json | 223 ++++++++++++++++++ .../examples/fluid_shape_fixture.rs | 97 ++++++++ crates/horizon-world/src/fluid_shape.rs | 47 ++++ crates/horizon-world/src/lib.rs | 1 + docs/collision-geometry.md | 16 ++ .../parity/VanillaFluidShapeOracle.java | 27 +++ tools/test_fluid_shape_parity.py | 64 +++++ 7 files changed, 475 insertions(+) create mode 100644 benchmarks/rust-fluid-shape-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/fluid_shape_fixture.rs create mode 100644 crates/horizon-world/src/fluid_shape.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFluidShapeOracle.java create mode 100644 tools/test_fluid_shape_parity.py diff --git a/benchmarks/rust-fluid-shape-2026-10-07/scoped-parity.json b/benchmarks/rust-fluid-shape-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..75d8b18c9 --- /dev/null +++ b/benchmarks/rust-fluid-shape-2026-10-07/scoped-parity.json @@ -0,0 +1,223 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 5181, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFluidShapeOracle.java": "8786e6c36ea74e816a2d8b7b1ed6796f839ed0e047c35006d5f04d6f9f9bca65", + "tools/test_fluid_shape_parity.py": "a4a8c64bb5d5e62675fdad889fa7a2729946a5e5dc07bff9acc70cba99b9c4bd", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/lib.rs": "48b091add554656ccbcb94ba3822f140f4669719013a411b4875404db43f36aa", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "a5021a168adcedc37d77f533a8921c02f09c59f46a01737586aaa33c5908b8d0", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/fluid_shape_fixture.rs": "7187c803bfbc53bc9694c6f3dedacb8fcf9e43129b505ad6d6847273ecdbc400" + }, + "fixtures_sha256": { + ".local/rust-fluid-shape-parity/inputs.txt": "9585317fda212bee3f6acc7129447e1a7fd190be10584691bcc72f04351d8fb2", + ".local/rust-fluid-shape-parity/fluid-states.json": "f888b2d7adf0ee194a08900e6df9909933734b5d8dab648dc3e866d70ef3b659" + }, + "rust_output_sha256": "82e11af0b7abd2dd60e288e4af1d2c1becf910476600c199f4f0bb7eadb292d1", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "82e11af0b7abd2dd60e288e4af1d2c1becf910476600c199f4f0bb7eadb292d1", + "matched_output_lines": 387950 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "82e11af0b7abd2dd60e288e4af1d2c1becf910476600c199f4f0bb7eadb292d1", + "matched_output_lines": 387950 + } + ], + "scope": "Actual registered FluidState.getShape and FlowingFluid first-query shape caches over every native fluid state. Compares ordered above-fluid queries, cached-state counts, shape geometry, canonical empty/full identities and aliases across repeated states. Sequences change above fluids, positions, failure points and query order; failed height reads do not populate a cache. Caches are reset between sequences and shared across world views within each sequence. Fluid propagation, entity immersion, registered world ray binding and full gameplay remain separate work." +} diff --git a/crates/horizon-world/examples/fluid_shape_fixture.rs b/crates/horizon-world/examples/fluid_shape_fixture.rs new file mode 100644 index 000000000..7e42203ec --- /dev/null +++ b/crates/horizon-world/examples/fluid_shape_fixture.rs @@ -0,0 +1,97 @@ +use horizon_core::{ + geometry::{Axis, VoxelShape}, + position::BlockPos, +}; +use horizon_world::{ + fluid::{FluidHeightWorld, FluidState}, + fluid_shape::FluidShapeCache, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +struct World<'a> { + out: &'a mut dyn Write, + calls: i64, + fail: i64, + above: FluidState, +} +impl FluidHeightWorld for World<'_> { + type Error = io::Error; + fn fluid(&mut self, p: [i32; 3]) -> io::Result { + writeln!(self.out, "fluid {} {} {}", p[0], p[1], p[2])?; + let call = self.calls; + self.calls += 1; + if call == self.fail { + Err(io::Error::other("injected fluid height failure")) + } else { + Ok(self.above) + } + } + fn sturdy_down(&mut self, _: [i32; 3]) -> io::Result { + panic!("ray shape does not use camera immersion support") + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut cache = FluidShapeCache::default(); + let mut identities = Vec::::new(); + for op in f["ops"].as_array().unwrap() { + let state = FluidState::from_json(&op["state"].to_string())?; + let above = FluidState::from_json(&op["above"].to_string())?; + let p = &op["position"]; + let p = BlockPos::new( + p[0].as_i64().unwrap() as i32, + p[1].as_i64().unwrap() as i32, + p[2].as_i64().unwrap() as i32, + ); + let mut world = World { + out: &mut out, + calls: 0, + fail: op["fail"].as_i64().unwrap(), + above, + }; + match cache.shape(&mut world, state, p) { + Ok(s) => { + let id = identities + .iter() + .position(|old| old.same_identity(&s)) + .unwrap_or_else(|| { + identities.push(s.clone()); + identities.len() - 1 + }); + writeln!(world.out, "identity {id}")?; + writeln!( + world.out, + "shape {} {} {}", + s.same_identity(&VoxelShape::empty()), + s.same_identity(&VoxelShape::block()), + s.boxes().len() + )?; + for b in s.boxes() { + writeln!( + world.out, + "box {:016x} {:016x} {:016x} {:016x} {:016x} {:016x}", + b.min(Axis::X).to_bits(), + b.min(Axis::Y).to_bits(), + b.min(Axis::Z).to_bits(), + b.max(Axis::X).to_bits(), + b.max(Axis::Y).to_bits(), + b.max(Axis::Z).to_bits() + )?; + } + } + Err(_) => writeln!(world.out, "error")?, + } + writeln!(world.out, "cached {}", cache.cached_states())?; + writeln!(world.out, "queries {}", world.calls)?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/src/fluid_shape.rs b/crates/horizon-world/src/fluid_shape.rs new file mode 100644 index 000000000..7df0a3b2d --- /dev/null +++ b/crates/horizon-world/src/fluid_shape.rs @@ -0,0 +1,47 @@ +//! Persistent pinned-fluid collision/ray shapes, including first-query caching. +use crate::fluid::{FluidHeightWorld, FluidKind, FluidState}; +use horizon_core::{ + geometry::{Aabb, Vec3, VoxelShape}, + position::BlockPos, +}; + +/// Share this cache across world views using the same fluid registry, as native +/// registered Fluid instances retain their shape maps across world queries. +/// The pinned registry has no amount-nine state; amounts are zero through eight. +pub struct FluidShapeCache { + shapes: Vec>, +} +impl Default for FluidShapeCache { + fn default() -> Self { + Self { + shapes: vec![None; 5 * 18], + } + } +} +impl FluidShapeCache { + pub fn cached_states(&self) -> usize { + self.shapes.iter().filter(|v| v.is_some()).count() + } + pub fn shape( + &mut self, + world: &mut W, + state: FluidState, + position: BlockPos, + ) -> Result { + if state.kind() == FluidKind::Empty { + return Ok(VoxelShape::empty()); + } + let index = state.kind() as usize * 18 + + usize::from(state.falling()) * 9 + + usize::from(state.amount()); + if let Some(shape) = &self.shapes[index] { + return Ok(shape.clone()); + } + let height = f64::from(state.height_at(world, [position.x, position.y, position.z])?); + // FluidState validates all amounts and height_at returns [0,1]. + let shape = VoxelShape::from_box(Aabb::new(Vec3::ZERO, Vec3::new(1.0, height, 1.0))) + .expect("validated pinned fluid height"); + self.shapes[index] = Some(shape.clone()); + Ok(shape) + } +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 43b722934..5736ff6bf 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -23,6 +23,7 @@ pub mod entity_move; pub mod entity_obstruction; pub mod fall_damage; pub mod fluid; +pub mod fluid_shape; pub mod ground_support; pub mod heightmap; pub mod liquid_collision; diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 9de95ebee..f59b15de4 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -772,3 +772,19 @@ failures. Targeted Clippy passes. Separate limit tests distinguish a miss from nonfinite geometry, exhausted traversal budget and failed world reads. Shapes and state predicates are controlled; registered shape binding, actual fluid shape caching and full entity/world integration remain pending. + + +`FluidShapeCache` matches native registered-fluid shape caching. The first +successful lookup of a nonempty fluid state samples the fluid above and retains +its resulting shape across later positions/world views. Failed reads leave the +state uncached. Empty and full cube shapes preserve canonical identity; distinct +noncanonical cached shapes retain their own identities. + +`python3 tools/test_fluid_shape_parity.py` runs every registered native fluid state +in changing query sequences. The +[fluid shape report](../benchmarks/rust-fluid-shape-2026-10-07/scoped-parity.json) +records **387,950 matching lines per JAR** across **5,181 sequences**, comparing +geometry, cache population, canonical/alias identities, query suppression and +failures. Targeted Clippy passes. The pinned registry has no amount-nine state; +unsupported custom fluid definitions are outside this module. Fluid propagation, +entity immersion and live world/ray integration remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFluidShapeOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFluidShapeOracle.java new file mode 100644 index 000000000..ac2d7fe10 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFluidShapeOracle.java @@ -0,0 +1,27 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import com.mojang.serialization.JsonOps; +import java.io.*; +import java.lang.reflect.*; +import java.nio.file.*; +import java.util.*; +import net.minecraft.core.*; +import net.minecraft.world.level.*; +import net.minecraft.world.level.material.*; +import net.minecraft.world.phys.shapes.*; +/** Native registered fluid shapes over changing world snapshots and shared caches. */ +public final class VanillaFluidShapeOracle { + static final class Stop extends RuntimeException {} + static FluidState state(JsonElement v){return FluidState.CODEC.parse(JsonOps.INSTANCE,v).getOrThrow();} + static void emit(PrintWriter out,VoxelShape shape,IdentityHashMap ids){out.println("identity "+ids.computeIfAbsent(shape,k->ids.size()));out.println("shape "+(shape==Shapes.empty())+" "+(shape==Shapes.block())+" "+shape.toAabbs().size());for(var b:shape.toAabbs())out.printf("box %016x %016x %016x %016x %016x %016x%n",Double.doubleToLongBits(b.minX),Double.doubleToLongBits(b.minY),Double.doubleToLongBits(b.minZ),Double.doubleToLongBits(b.maxX),Double.doubleToLongBits(b.maxY),Double.doubleToLongBits(b.maxZ));} + public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();Path dir=Path.of(args[1]);var caches=FlowingFluid.class.getDeclaredField("shapes");caches.setAccessible(true); + if(args[0].equals("export")){var states=new JsonArray();for(var s:Fluid.FLUID_STATE_REGISTRY){if(s.getAmount()>8)throw new AssertionError("new fluid amount");states.add(FluidState.CODEC.encodeStart(JsonOps.INSTANCE,s).getOrThrow());}Files.writeString(dir.resolve("fluid-states.json"),states.toString());return;} + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){ + var f=JsonParser.parseString(line).getAsJsonObject();for(var fluid:List.of(Fluids.WATER,Fluids.FLOWING_WATER,Fluids.LAVA,Fluids.FLOWING_LAVA))((Map)caches.get(fluid)).clear(); + var identities=new IdentityHashMap();for(var value:f.getAsJsonArray("ops")){var op=value.getAsJsonObject();int[] calls={0};var s=state(op.get("state"));var above=state(op.get("above"));var p=op.getAsJsonArray("position");var position=new BlockPos(p.get(0).getAsInt(),p.get(1).getAsInt(),p.get(2).getAsInt());var world=(BlockGetter)Proxy.newProxyInstance(BlockGetter.class.getClassLoader(),new Class[]{BlockGetter.class},(proxy,method,values)->{if(method.getName().equals("getFluidState")){var q=(BlockPos)values[0];out.println("fluid "+q.getX()+" "+q.getY()+" "+q.getZ());if(calls[0]++==op.get("fail").getAsInt())throw new Stop();return above;}throw new AssertionError(method);}); + try{emit(out,s.getShape(world,position),identities);}catch(Stop e){out.println("error");}int count=0;for(var fluid:List.of(Fluids.WATER,Fluids.FLOWING_WATER,Fluids.LAVA,Fluids.FLOWING_LAVA))count+=((Map)caches.get(fluid)).size();out.println("cached "+count);out.println("queries "+calls[0]); + } + }} + } +} diff --git a/tools/test_fluid_shape_parity.py b/tools/test_fluid_shape_parity.py new file mode 100644 index 000000000..870438d59 --- /dev/null +++ b/tools/test_fluid_shape_parity.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python3 +"""Compare cached registered fluid shapes and lazy height queries with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(states): + empty=next(s for s in states if s['id']=='minecraft:empty') + def op(state,above,p=(17,-64,-33),fail=-1):return dict(state=state,above=above,position=p,fail=fail) + for state in states: + for above in states: + for fail in [-1,0,1]: + yield dict(ops=[op(state,above,fail=fail),op(state,empty,p=(1,2,3),fail=0),op(state,above,p=(-1,-2,-3)),op(state,empty)]) + for above in states: + for fail in [-1,0]: + yield dict(ops=[*[op(state,above,p=(2147483647,2147483647,-2147483648),fail=fail) for state in states],*[op(state,empty,p=(-2147483648,-2147483648,2147483647)) for state in reversed(states)],*[op(state,above,fail=0) for state in states]]) + rng=random.Random(0x464c554944534850) + for _ in range(1000):yield dict(ops=[op(rng.choice(states),rng.choice(states),p=rng.choice([(17,-64,-33),(0,0,0),(2147483647,2147483647,-2147483648)]),fail=rng.choice([-1,-1,0,1])) for _ in range(rng.randrange(1,100))]) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-fluid-shape-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFluidShapeOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/fluid_shape_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaFluidShapeOracle',mode,path],side+'-'+mode) + java('server','export',build);states=json.loads((build/'fluid-states.json').read_text());fixtures=list(corpus(states));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs,build/'fluid-states.json'];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','fluid_shape_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('fluid_shape_fixture.exe' if os.name=='nt' else 'fluid_shape_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} fluid-shape output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual registered FluidState.getShape and FlowingFluid first-query shape caches over every native fluid state. Compares ordered above-fluid queries, cached-state counts, shape geometry, canonical empty/full identities and aliases across repeated states. Sequences change above fluids, positions, failure points and query order; failed height reads do not populate a cache. Caches are reset between sequences and shared across world views within each sequence. Fluid propagation, entity immersion, registered world ray binding and full gameplay remain separate work.'} + lab.write_json(report_path,report);print(f'Scoped fluid shape parity passed: {report_path}') + + +if __name__=='__main__':main() From 39dcb0cbcee641eb1da485c98325d2b9e15e0d9a Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 02:08:32 +0200 Subject: [PATCH 085/253] Bind complete registered interaction shapes with native identity --- .../scoped-parity.json | 227 ++++++++++++++++++ .../examples/interaction_shape_fixture.rs | 176 ++++++++++++++ .../horizon-world/src/interaction_shapes.rs | 36 +++ crates/horizon-world/src/lib.rs | 1 + docs/collision-geometry.md | 16 ++ .../parity/VanillaInteractionShapeOracle.java | 35 +++ tools/test_interaction_shape_parity.py | 63 +++++ 7 files changed, 554 insertions(+) create mode 100644 benchmarks/rust-interaction-shape-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/interaction_shape_fixture.rs create mode 100644 crates/horizon-world/src/interaction_shapes.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaInteractionShapeOracle.java create mode 100644 tools/test_interaction_shape_parity.py diff --git a/benchmarks/rust-interaction-shape-2026-10-07/scoped-parity.json b/benchmarks/rust-interaction-shape-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..c665ad183 --- /dev/null +++ b/benchmarks/rust-interaction-shape-2026-10-07/scoped-parity.json @@ -0,0 +1,227 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 152892, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaInteractionShapeOracle.java": "8f55d6fb9152decf0c76dc417ce6b5b10ac4bdfc3d00aeee514c7b8f967fb1f1", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "f2b4f440a5bbce4224a4b3cee494b0f7ddcafbf72db12592c94ef9fb94fbc8a6", + "tools/test_interaction_shape_parity.py": "f8939b6a9405724d75c799f4e35efc3746d4067300ffc9215f61230219c2d507", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "d7cc985e4c6d4e6319c69790f1f3b21cb139eaf08ddffc088326f75b4b87345e", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "a5021a168adcedc37d77f533a8921c02f09c59f46a01737586aaa33c5908b8d0", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/interaction_shape_fixture.rs": "88a27887eab518cba1ce24eebef7d72b3723cd066a798e88ff1a05e3ebbd64ca" + }, + "fixtures_sha256": { + ".local/rust-interaction-shape-parity/inputs.txt": "b9d64891c8f3acd08fa9d8e15748c47a303f839775a9380f6894934b0b0fb95a", + ".local/rust-interaction-shape-parity/info.json": "3866ea4f5e10ed265bc86f883169c7f1100fefd915433047e0d5d17d9b7f6030", + ".local/rust-interaction-shape-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-interaction-shape-parity/interaction-shapes.nbt": "2cd47ffc580026355ee763ab6fca6bda8dc131cdabeab763113aeb33c61f161e" + }, + "rust_output_sha256": "be473875e8dff8167fce4f5c5a8737e70d4d81360172492b0e7762ae76aa4b99", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "be473875e8dff8167fce4f5c5a8737e70d4d81360172492b0e7762ae76aa4b99", + "matched_output_lines": 188682 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "be473875e8dff8167fce4f5c5a8737e70d4d81360172492b0e7762ae76aa4b99", + "matched_output_lines": 188682 + } + ], + "scope": "Complete registered interaction shape table with audited native implementation owners: default empty, cauldron, composter, hopper and scaffolding. Compares every state geometry, canonical/alias identity and actual BlockGetter.clipWithInteractionOverride with supplied collision shapes at multiple positions. World queries are rejected during native interaction-shape lookup. Imports reject wrong table kind, incomplete mapping, missing canonical identities, foreign state ordering and invalid state IDs. Outline/visual shape binding, complete ray-world binding and gameplay remain separate work." +} diff --git a/crates/horizon-world/examples/interaction_shape_fixture.rs b/crates/horizon-world/examples/interaction_shape_fixture.rs new file mode 100644 index 000000000..60b9742b8 --- /dev/null +++ b/crates/horizon-world/examples/interaction_shape_fixture.rs @@ -0,0 +1,176 @@ +use horizon_core::{ + geometry::{Aabb, Axis, ShapeOp, Vec3, VoxelShape}, + position::BlockPos, +}; +use horizon_world::{ + interaction_shapes::InteractionShapes, + nbt::{self, Limits, Tag}, + registry::{BlockRegistry, BlockStateId}, + world_ray::{RayBlockMode, RayWorld, clip_with_interaction}, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn vector(v: &Value) -> Vec3 { + Vec3::new(number(&v[0]), number(&v[1]), number(&v[2])) +} +fn bits(v: f64) -> u64 { + if v.is_nan() { + 0x7ff8000000000000 + } else { + v.to_bits() + } +} +fn shape(v: &Value) -> Result> { + let mut result = VoxelShape::empty(); + for b in v.as_array().unwrap() { + result = result.join( + &VoxelShape::from_box(Aabb::new( + Vec3::new(number(&b[0]), number(&b[1]), number(&b[2])), + Vec3::new(number(&b[3]), number(&b[4]), number(&b[5])), + ))?, + ShapeOp::OR, + )?; + } + Ok(result) +} +struct World<'a, 'r> { + shapes: &'a InteractionShapes<'r>, +} +impl RayWorld for World<'_, '_> { + type Error = io::Error; + type Block = BlockStateId; + type Fluid = (); + fn block_state(&mut self, _: BlockPos) -> io::Result { + panic!("direct interaction clip") + } + fn fluid_state(&mut self, _: BlockPos) -> io::Result<()> { + panic!("direct interaction clip") + } + fn block_shape( + &mut self, + _: BlockStateId, + _: BlockPos, + _: RayBlockMode, + ) -> io::Result { + panic!("direct interaction clip") + } + fn interaction_shape(&mut self, s: BlockStateId, _: BlockPos) -> io::Result { + Ok(self.shapes.shape(s)?.clone()) + } + fn fluid_is_source(&mut self, _: ()) -> io::Result { + panic!("direct interaction clip") + } + fn fluid_is_empty(&mut self, _: ()) -> io::Result { + panic!("direct interaction clip") + } + fn fluid_is_water(&mut self, _: ()) -> io::Result { + panic!("direct interaction clip") + } + fn fluid_shape(&mut self, _: (), _: BlockPos) -> io::Result { + panic!("direct interaction clip") + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + let read = |n: &str| -> Result> { + Ok(nbt::read_named(&fs::read(dir.join(n))?, Limits::default())? + .0 + .tag) + }; + let registry = BlockRegistry::from_nbt(&read("block-registry.nbt")?)?; + let data = read("interaction-shapes.nbt")?; + let shapes = InteractionShapes::from_nbt(&data, ®istry)?; + assert!(shapes.shape(BlockStateId(registry.len() as u32)).is_err()); + let mut bad = data.clone(); + *bad.get_mut("kind").unwrap() = Tag::String("collision".into()); + assert!(InteractionShapes::from_nbt(&bad, ®istry).is_err()); + let mut bad = data.clone(); + if let Some(Tag::IntArray(ids)) = bad.get_mut("cached_shapes") { + ids[0] = -1; + } + assert!(InteractionShapes::from_nbt(&bad, ®istry).is_err()); + let mut bad = data.clone(); + if let Some(Tag::List(shapes)) = bad.get_mut("shapes") { + if let Tag::Compound(first) = &mut shapes[0] { + first.remove(&"canonical".into()); + } + } + assert!(InteractionShapes::from_nbt(&bad, ®istry).is_err()); + let mut bad = data.clone(); + if let Some(Tag::List(states)) = bad.get_mut("states") { + states.swap(0, 1); + } + assert!(InteractionShapes::from_nbt(&bad, ®istry).is_err()); + let mut identities = Vec::::new(); + for state in 0..registry.len() { + let s = shapes.shape(BlockStateId(state as u32))?; + let id = identities + .iter() + .position(|old| old.same_identity(s)) + .unwrap_or_else(|| { + identities.push(s.clone()); + identities.len() - 1 + }); + writeln!( + out, + "state {state} {id} {} {} {}", + s.same_identity(&VoxelShape::empty()), + s.same_identity(&VoxelShape::block()), + s.boxes().len() + )?; + for b in s.boxes() { + writeln!( + out, + "box {:016x} {:016x} {:016x} {:016x} {:016x} {:016x}", + bits(b.min(Axis::X)), + bits(b.min(Axis::Y)), + bits(b.min(Axis::Z)), + bits(b.max(Axis::X)), + bits(b.max(Axis::Y)), + bits(b.max(Axis::Z)) + )?; + } + } + let mut w = World { shapes: &shapes }; + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let p = &f["position"]; + let p = BlockPos::new( + p[0].as_i64().unwrap() as i32, + p[1].as_i64().unwrap() as i32, + p[2].as_i64().unwrap() as i32, + ); + match clip_with_interaction( + &mut w, + vector(&f["from"]), + vector(&f["to"]), + p, + &shape(&f["shape"])?, + BlockStateId(f["state"].as_u64().unwrap() as u32), + )? { + Some(h) => writeln!( + out, + "hit {:016x} {:016x} {:016x} {} {} {} {} {}", + bits(h.location.x), + bits(h.location.y), + bits(h.location.z), + format!("{:?}", h.direction).to_lowercase(), + h.block.x, + h.block.y, + h.block.z, + h.inside + )?, + None => writeln!(out, "none")?, + } + } + Ok(()) +} diff --git a/crates/horizon-world/src/interaction_shapes.rs b/crates/horizon-world/src/interaction_shapes.rs new file mode 100644 index 000000000..faf7b84a3 --- /dev/null +++ b/crates/horizon-world/src/interaction_shapes.rs @@ -0,0 +1,36 @@ +//! Complete registry-bound interaction shapes for ray-face overrides. +use crate::{ + collision::CachedCollisionRegistry, + compression::invalid, + nbt::Tag, + registry::{BlockRegistry, BlockStateId}, +}; +use horizon_core::geometry::VoxelShape; +use std::io; +/// The pinned implementation audit establishes that every interaction shape is +/// static per state. The import retains native alias/canonical shape identity. +pub struct InteractionShapes<'r> { + shapes: CachedCollisionRegistry<'r>, +} +impl<'r> InteractionShapes<'r> { + pub fn from_nbt(tag: &Tag, registry: &'r BlockRegistry) -> io::Result { + if tag.get("kind") != Some(&Tag::String("interaction".into())) { + return Err(invalid("not an interaction shape table")); + } + let shapes = CachedCollisionRegistry::from_nbt(tag, registry)?; + if !shapes.has_canonical_identities() || shapes.cached_state_count() != registry.len() { + return Err(invalid( + "interaction shape table must bind every state with canonical identities", + )); + } + Ok(Self { shapes }) + } + pub fn registry(&self) -> &'r BlockRegistry { + self.shapes.registry() + } + pub fn shape(&self, state: BlockStateId) -> io::Result<&VoxelShape> { + self.shapes + .cached_shape(state)? + .ok_or_else(|| invalid("missing interaction shape")) + } +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 5736ff6bf..5960dc573 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -26,6 +26,7 @@ pub mod fluid; pub mod fluid_shape; pub mod ground_support; pub mod heightmap; +pub mod interaction_shapes; pub mod liquid_collision; pub mod living_fall; pub mod movement_emission; diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index f59b15de4..c45112bd6 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -788,3 +788,19 @@ geometry, cache population, canonical/alias identities, query suppression and failures. Targeted Clippy passes. The pinned registry has no amount-nine state; unsupported custom fluid definitions are outside this module. Fluid propagation, entity immersion and live world/ray integration remain pending. + + +`InteractionShapes` imports a complete state-bound table with a distinct table +kind and mandatory canonical identity metadata. The pinned owner audit finds +only default empty, cauldron, composter, hopper and scaffolding implementations; +all are static per state. Geometry uses the existing validated discrete shape +importer while preserving eight native shape identities. + +`python3 tools/test_interaction_shape_parity.py` compares every registered state +and actual native interaction-face overrides with supplied collision geometry. +The [interaction shape report](../benchmarks/rust-interaction-shape-2026-10-07/scoped-parity.json) +records **188,682 matching lines per JAR** across all **35,723 states**. Native +interaction-shape world queries are rejected by the fixture. Import checks reject +wrong table kind, partial mappings, missing canonical metadata, foreign state +ordering and invalid IDs. Targeted Clippy passes. Registered outline/visual +shapes, complete ray-world binding and gameplay integration remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaInteractionShapeOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaInteractionShapeOracle.java new file mode 100644 index 000000000..0c2520ccb --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaInteractionShapeOracle.java @@ -0,0 +1,35 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*; +import java.lang.reflect.*; +import java.nio.file.*; +import java.util.*; +import net.minecraft.core.*; +import net.minecraft.core.registries.*; +import net.minecraft.nbt.*; +import net.minecraft.world.level.*; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.state.*; +import net.minecraft.world.phys.*; +import net.minecraft.world.phys.shapes.*; +/** Audits static registered interaction shapes and invokes actual ray-face overrides. */ +public final class VanillaInteractionShapeOracle { + static BlockGetter world=(BlockGetter)Proxy.newProxyInstance(BlockGetter.class.getClassLoader(),new Class[]{BlockGetter.class},(proxy,method,values)->{if(method.isDefault())return InvocationHandler.invokeDefault(proxy,method,values);throw new AssertionError("interaction shape unexpectedly queried world: "+method);}); + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + static Vec3 vector(JsonElement v){var a=v.getAsJsonArray();return new Vec3(number(a.get(0)),number(a.get(1)),number(a.get(2)));} + static VoxelShape shape(JsonElement v){var result=Shapes.empty();for(var value:v.getAsJsonArray()){var a=value.getAsJsonArray();result=Shapes.or(result,Shapes.box(number(a.get(0)),number(a.get(1)),number(a.get(2)),number(a.get(3)),number(a.get(4)),number(a.get(5))));}return result;} + static Class owner(Class type)throws Exception{for(;type!=null;type=type.getSuperclass())try{return type.getDeclaredMethod("getInteractionShape",BlockState.class,BlockGetter.class,BlockPos.class).getDeclaringClass();}catch(NoSuchMethodException ignored){}throw new AssertionError();} + static void export(Path dir)throws Exception{ + var allowed=Set.of(BlockBehaviour.class,AbstractCauldronBlock.class,ComposterBlock.class,HopperBlock.class,ScaffoldingBlock.class);for(var block:BuiltInRegistries.BLOCK)if(!allowed.contains(owner(block.getClass())))throw new AssertionError("new interaction implementation"); + var grid=VanillaCollisionOracle.class.getDeclaredMethod("grid",VoxelShape.class);grid.setAccessible(true);var states=new ListTag();var defaults=new CompoundTag();var shapes=new ListTag();var identities=new IdentityHashMap();var mapping=new int[Block.BLOCK_STATE_REGISTRY.size()]; + for(var state:Block.BLOCK_STATE_REGISTRY){int id=Block.getId(state);states.add(BlockState.FULL_CODEC.encodeStart(NbtOps.INSTANCE,state).getOrThrow());if(state==state.getBlock().defaultBlockState())defaults.putInt(BuiltInRegistries.BLOCK.getKey(state.getBlock()).toString(),id);var shape=state.getInteractionShape(world,BlockPos.ZERO);Integer index=identities.get(shape);if(index==null){index=shapes.size();identities.put(shape,index);shapes.add((CompoundTag)grid.invoke(null,shape));}mapping[id]=index;} + var registry=new CompoundTag();registry.putInt("DataVersion",net.minecraft.SharedConstants.getCurrentVersion().dataVersion().version());registry.put("states",states);registry.put("defaults",defaults);var data=new CompoundTag();data.putInt("DataVersion",net.minecraft.SharedConstants.getCurrentVersion().dataVersion().version());data.putString("kind","interaction");data.put("states",states);data.put("shapes",shapes);data.putIntArray("cached_shapes",mapping); + try(var out=new DataOutputStream(Files.newOutputStream(dir.resolve("block-registry.nbt")))){NbtIo.write(registry,out);}try(var out=new DataOutputStream(Files.newOutputStream(dir.resolve("interaction-shapes.nbt")))){NbtIo.write(data,out);}var info=new JsonObject();info.addProperty("states",states.size());info.addProperty("shapes",shapes.size());Files.writeString(dir.resolve("info.json"),info.toString()); + } + public static void main(String[] args)throws Exception{ + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();Path dir=Path.of(args[1]);if(args[0].equals("export")){export(dir);return;} + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){var identities=new IdentityHashMap();for(var state:Block.BLOCK_STATE_REGISTRY){var shape=state.getInteractionShape(world,BlockPos.ZERO);out.println("state "+Block.getId(state)+" "+identities.computeIfAbsent(shape,k->identities.size())+" "+(shape==Shapes.empty())+" "+(shape==Shapes.block())+" "+shape.toAabbs().size());for(var b:shape.toAabbs())out.printf("box %016x %016x %016x %016x %016x %016x%n",Double.doubleToLongBits(b.minX),Double.doubleToLongBits(b.minY),Double.doubleToLongBits(b.minZ),Double.doubleToLongBits(b.maxX),Double.doubleToLongBits(b.maxY),Double.doubleToLongBits(b.maxZ));} + for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();var p=f.getAsJsonArray("position");var position=new BlockPos(p.get(0).getAsInt(),p.get(1).getAsInt(),p.get(2).getAsInt());var state=Block.stateById(f.get("state").getAsInt());var hit=world.clipWithInteractionOverride(vector(f.get("from")),vector(f.get("to")),position,shape(f.get("shape")),state);if(hit==null)out.println("none");else{var v=hit.getLocation();out.printf("hit %016x %016x %016x %s %d %d %d %s%n",Double.doubleToLongBits(v.x),Double.doubleToLongBits(v.y),Double.doubleToLongBits(v.z),hit.getDirection().getSerializedName(),hit.getBlockPos().getX(),hit.getBlockPos().getY(),hit.getBlockPos().getZ(),hit.isInside());}} + } + } +} diff --git a/tools/test_interaction_shape_parity.py b/tools/test_interaction_shape_parity.py new file mode 100644 index 000000000..7a229606c --- /dev/null +++ b/tools/test_interaction_shape_parity.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python3 +"""Compare registered interaction shapes and ray-face overrides with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(info): + def bits(v):return struct.pack('>d',float(v)).hex() + shapes=[[],[[0,0,0,1,1,1]],[[.5,0,0,1,1,1]],[[0,.5,0,1,1,1]],[[0,0,0,.25,1,1],[.75,0,0,1,1,1]]] + rays=[([-1,.5,.5],[2,.5,.5]),([-.5,-.25,.5],[1.5,1.75,.5]),([.5,.5,.5],[2,2,2]),([.5,2,.5],[.5,-1,.5])] + def row(state,index,p=(0,0,0),shape=None): + a,b=rays[index%len(rays)];return dict(state=state,position=p,shape=[[bits(v) for v in b] for b in (shape if shape is not None else shapes[1+index%4])],**{'from':[bits(v+p[i]) for i,v in enumerate(a)],'to':[bits(v+p[i]) for i,v in enumerate(b)]}) + for state in range(info['states']): + for i in range(4):yield row(state,i,p=(0,0,0) if i%2==0 else (17,-64,-33)) + rng=random.Random(0x494e544552414354) + for _ in range(10000):yield row(rng.randrange(info['states']),rng.randrange(4),p=rng.choice([(0,0,0),(17,-64,-33),(30000000,-64,-30000000)]),shape=rng.choice(shapes)) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-interaction-shape-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaInteractionShapeOracle.java' + helper=oracle.with_name('VanillaCollisionOracle.java') + sources=[oracle,helper,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/interaction_shape_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle,helper],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaInteractionShapeOracle',mode,path],side+'-'+mode) + java('server','export',build);info=json.loads((build/'info.json').read_text());fixtures=list(corpus(info));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs,build/'info.json',build/'block-registry.nbt',build/'interaction-shapes.nbt'];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','interaction_shape_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('interaction_shape_fixture.exe' if os.name=='nt' else 'interaction_shape_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} interaction-shape output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Complete registered interaction shape table with audited native implementation owners: default empty, cauldron, composter, hopper and scaffolding. Compares every state geometry, canonical/alias identity and actual BlockGetter.clipWithInteractionOverride with supplied collision shapes at multiple positions. World queries are rejected during native interaction-shape lookup. Imports reject wrong table kind, incomplete mapping, missing canonical identities, foreign state ordering and invalid state IDs. Outline/visual shape binding, complete ray-world binding and gameplay remain separate work.'} + lab.write_json(report_path,report);print(f'Scoped interaction shape parity passed: {report_path}') + + +if __name__=='__main__':main() From 73fe41f53111075d4fffa1b3b464a51e516eda77 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 02:15:30 +0200 Subject: [PATCH 086/253] Bind registered fall-reset rays with native fluid cache behavior --- .../scoped-parity.json | 235 ++++++++++++++++++ .../examples/registry_fall_ray_fixture.rs | 199 +++++++++++++++ crates/horizon-world/src/lib.rs | 1 + crates/horizon-world/src/registry_fall_ray.rs | 216 ++++++++++++++++ docs/collision-geometry.md | 16 ++ .../parity/VanillaRegistryFallRayOracle.java | 80 ++++++ tools/test_registry_fall_ray_parity.py | 72 ++++++ 7 files changed, 819 insertions(+) create mode 100644 benchmarks/rust-registry-fall-ray-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/registry_fall_ray_fixture.rs create mode 100644 crates/horizon-world/src/registry_fall_ray.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryFallRayOracle.java create mode 100644 tools/test_registry_fall_ray_parity.py diff --git a/benchmarks/rust-registry-fall-ray-2026-10-07/scoped-parity.json b/benchmarks/rust-registry-fall-ray-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..904c3fb29 --- /dev/null +++ b/benchmarks/rust-registry-fall-ray-2026-10-07/scoped-parity.json @@ -0,0 +1,235 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 120297, + "registry_states": 35723, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryFallRayOracle.java": "029e91ed2e9b293dd8634071cb72ce2496bf9c43e136575a19310a6407d70f65", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaInteractionShapeOracle.java": "8f55d6fb9152decf0c76dc417ce6b5b10ac4bdfc3d00aeee514c7b8f967fb1f1", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "f2b4f440a5bbce4224a4b3cee494b0f7ddcafbf72db12592c94ef9fb94fbc8a6", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_registry_fall_ray_parity.py": "3cc30b5039da8a72b301dee9d45eb510f43df64fc614d8ca0cba81be21ae5a1c", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-world/examples/registry_fall_ray_fixture.rs": "52336bdb6ea2ead412cae1bcaf5035c6002112d582474bc4f0402a2486772f3e", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "a211900291762261c224b8197b81f573375a7ca67f2cd41fb32ae6a45e05599f", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "a5021a168adcedc37d77f533a8921c02f09c59f46a01737586aaa33c5908b8d0", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f" + }, + "fixtures_sha256": { + ".local/rust-registry-fall-ray-parity/inputs.txt": "3486ba60b5e2774dada5dbea681fb7ca47e1d34b7fbcedfeafd16f3d3abdd8c1", + ".local/rust-registry-fall-ray-parity/info.json": "e0cd14358b3d79a84cac9dda2f5baf4988a4cf9047ea16c941867b4dbcf4e93c", + ".local/rust-registry-fall-ray-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-registry-fall-ray-parity/interaction-shapes.nbt": "2cd47ffc580026355ee763ab6fca6bda8dc131cdabeab763113aeb33c61f161e", + ".local/rust-registry-fall-ray-parity/tags.json": "5e1301e5a9abf7e4de93af5dae3a157e852dbdb4ea345c2eb626305a605d4f98", + ".local/rust-registry-fall-ray-parity/fluid-tags.json": "1b543d69635937491aacb39096bf76959e11029076b8217c25fcadd480686440", + ".local/rust-registry-fall-ray-parity/bound-tags.json": "44b31f637645d96d133f72ce54b33c685274533e051b37cee2e550203205848f" + }, + "rust_output_sha256": "6d5351cc317f27187e058cbcd1fe62949c13c89fa3832bbacaa85d026a21fbbb", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "6d5351cc317f27187e058cbcd1fe62949c13c89fa3832bbacaa85d026a21fbbb", + "matched_output_lines": 3024623 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "6d5351cc317f27187e058cbcd1fe62949c13c89fa3832bbacaa85d026a21fbbb", + "matched_output_lines": 3024623 + } + ], + "scope": "Actual BlockGetter.clip with registered block/interaction/fluid shapes, FALLDAMAGE_RESETTING/WATER context and native tag reloads. Every block state runs natural, empty and universal reset tags; additional fluid tag modes, entity/player/server distinctions, portal delays, multiple ray positions, above-fluid changes, cache reuse and failures compare complete traces/results. Binding rejects unknown tag members and invalid block IDs. World block/fluid reads use controlled snapshots; live resident-world binding, actual player storage, movement integration and complete gameplay remain pending." +} diff --git a/crates/horizon-world/examples/registry_fall_ray_fixture.rs b/crates/horizon-world/examples/registry_fall_ray_fixture.rs new file mode 100644 index 000000000..3f2ebce75 --- /dev/null +++ b/crates/horizon-world/examples/registry_fall_ray_fixture.rs @@ -0,0 +1,199 @@ +use horizon_core::{geometry::Vec3, position::BlockPos}; +use horizon_world::{ + entity_obstruction::EntityIdentity, + fluid::{FluidKind, FluidState}, + fluid_shape::FluidShapeCache, + interaction_shapes::InteractionShapes, + nbt::{self, Limits, Tag}, + registry::{BlockRegistry, BlockStateId}, + registry_fall_ray::{FallRayRegistry, FallRayWorld, fall_reset_ray}, +}; +use serde_json::Value; +use std::{ + collections::BTreeSet, + fs, + io::{self, Write}, + path::Path, +}; +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn vector(v: &Value) -> Vec3 { + Vec3::new(number(&v[0]), number(&v[1]), number(&v[2])) +} +fn bits(v: f64) -> u64 { + if v.is_nan() { + 0x7ff8000000000000 + } else { + v.to_bits() + } +} +fn pos(p: BlockPos) -> String { + format!("{} {} {}", p.x, p.y, p.z) +} +struct World<'a, 's, 'r> { + f: &'a Value, + op: &'a Value, + out: &'a mut dyn Write, + calls: i64, + p: BlockPos, + registry: &'a FallRayRegistry<'s, 'r>, +} +impl World<'_, '_, '_> { + fn flag(&self, n: &str) -> bool { + self.f[n].as_bool().unwrap() + } + fn query(&mut self, s: String) -> io::Result<()> { + writeln!(self.out, "{s}")?; + let call = self.calls; + self.calls += 1; + if call == self.op["fail"].as_i64().unwrap() { + Err(io::Error::other("injected registered ray failure")) + } else { + Ok(()) + } + } + fn at(&self, p: BlockPos) -> BlockStateId { + BlockStateId(if p == self.p { + self.f["state"].as_u64().unwrap() as u32 + } else if p == self.p.offset(0, 1, 0) { + self.op["above"].as_u64().unwrap() as u32 + } else { + 0 + }) + } +} +impl FallRayWorld for World<'_, '_, '_> { + type Error = io::Error; + fn block_state(&mut self, p: BlockPos) -> io::Result { + self.query(format!("block {}", pos(p)))?; + Ok(self.at(p)) + } + fn fluid_state(&mut self, p: BlockPos) -> io::Result { + self.query(format!("fluid {}", pos(p)))?; + self.registry.fluid_for_block(self.at(p)) + } + fn is_server_level(&self) -> bool { + self.flag("server") + } + fn entity_is_player(&mut self, _: EntityIdentity) -> io::Result { + self.query("player".into())?; + Ok(self.flag("player")) + } + fn players_nether_portal_delay(&mut self) -> io::Result { + self.query("rules".into())?; + self.query("portal-delay".into())?; + Ok(self.f["delay"].as_i64().unwrap() as i32) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + let read = |n: &str| -> Result> { + Ok(nbt::read_named(&fs::read(dir.join(n))?, Limits::default())? + .0 + .tag) + }; + let registry = BlockRegistry::from_nbt(&read("block-registry.nbt")?)?; + let interactions = InteractionShapes::from_nbt(&read("interaction-shapes.nbt")?, ®istry)?; + let tags: Value = serde_json::from_str(&fs::read_to_string(dir.join("bound-tags.json"))?)?; + let names = |n: &str| -> BTreeSet { + tags[n] + .as_array() + .unwrap() + .iter() + .map(|v| v.as_str().unwrap().to_owned()) + .collect() + }; + let all = (0..registry.len()) + .map(|i| registry.state(BlockStateId(i as u32)).unwrap().name.clone()) + .collect(); + let blocks = [names("reset"), BTreeSet::new(), all]; + let fluids = [ + names("water"), + BTreeSet::new(), + FluidKind::ALL + .into_iter() + .map(|f| f.name().to_owned()) + .collect(), + ]; + let mut bindings = Vec::new(); + for b in &blocks { + for f in &fluids { + bindings.push(FallRayRegistry::new(&interactions, b, f)?); + } + } + assert!( + FallRayRegistry::new( + &interactions, + &BTreeSet::from(["minecraft:missing".into()]), + &fluids[0] + ) + .is_err() + ); + assert!( + FallRayRegistry::new( + &interactions, + &blocks[0], + &BTreeSet::from(["minecraft:missing".into()]) + ) + .is_err() + ); + assert!( + bindings[0] + .fluid_for_block(BlockStateId(registry.len() as u32)) + .is_err() + ); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let p = &f["position"]; + let p = BlockPos::new( + p[0].as_i64().unwrap() as i32, + p[1].as_i64().unwrap() as i32, + p[2].as_i64().unwrap() as i32, + ); + let binding = &bindings + [(f["block_tags"].as_u64().unwrap() * 3 + f["fluid_tags"].as_u64().unwrap()) as usize]; + let entity = f["entity"].as_bool().unwrap().then_some(EntityIdentity(0)); + let mut cache = FluidShapeCache::default(); + for op in f["ops"].as_array().unwrap() { + let mut w = World { + f: &f, + op, + out: &mut out, + calls: 0, + p, + registry: binding, + }; + match fall_reset_ray( + &mut w, + binding, + &mut cache, + entity, + vector(&op["from"]), + vector(&op["to"]), + 10000, + ) { + Ok(r) => { + let h = r.hit; + writeln!( + w.out, + "hit {} {:016x} {:016x} {:016x} {} {} {}", + r.miss, + bits(h.location.x), + bits(h.location.y), + bits(h.location.z), + format!("{:?}", h.direction).to_lowercase(), + pos(h.block), + h.inside + )?; + } + Err(_) => writeln!(w.out, "error")?, + } + writeln!(w.out, "cached {}", cache.cached_states())?; + writeln!(w.out, "queries {}", w.calls)?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 5960dc573..3a105c82d 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -40,6 +40,7 @@ pub mod powder_snow_collision; pub mod region; pub mod registry; pub mod registry_collision_scan; +pub mod registry_fall_ray; pub mod retrogen; pub mod suffocation; pub mod tick_data; diff --git a/crates/horizon-world/src/registry_fall_ray.rs b/crates/horizon-world/src/registry_fall_ray.rs new file mode 100644 index 000000000..f78c4dfe6 --- /dev/null +++ b/crates/horizon-world/src/registry_fall_ray.rs @@ -0,0 +1,216 @@ +//! Fall-reset rays bound to registered interactions, fluid states and live queries. +use crate::{ + compression::invalid, + entity_obstruction::EntityIdentity, + fluid::{FluidHeightWorld, FluidKind, FluidState}, + fluid_shape::FluidShapeCache, + interaction_shapes::InteractionShapes, + registry::BlockStateId, + world_ray::{ + self, FallResetWorld, RayBlockMode, RayError, RayFluidMode, RayResult, RayWorld, + ResetPortal, + }, +}; +use horizon_core::{ + geometry::{Vec3, VoxelShape}, + position::BlockPos, +}; +use std::{collections::BTreeSet, fmt, io}; +#[derive(Clone, Copy)] +struct State { + reset: bool, + portal: Option, + fluid: FluidState, +} +pub struct FallRayRegistry<'s, 'r> { + interactions: &'s InteractionShapes<'r>, + states: Vec, + water_mask: u8, +} +impl<'s, 'r> FallRayRegistry<'s, 'r> { + /// Tags are resolved snapshots; build a new binding after a tag reload. + pub fn new( + interactions: &'s InteractionShapes<'r>, + reset_blocks: &BTreeSet, + water_fluids: &BTreeSet, + ) -> io::Result { + let registry = interactions.registry(); + if reset_blocks + .iter() + .any(|name| registry.default_state(name).is_none()) + { + return Err(invalid("unknown fall-reset block tag member")); + } + let mut water_mask = 0; + for name in water_fluids { + water_mask |= FluidKind::from_name(name) + .ok_or_else(|| invalid("unknown water fluid tag member"))? + .mask(); + } + let mut states = Vec::with_capacity(registry.len()); + for i in 0..registry.len() { + let state = registry.state(BlockStateId(i as u32)).unwrap(); + states.push(State { + reset: reset_blocks.contains(&state.name), + portal: match state.name.as_str() { + "minecraft:end_gateway" => Some(ResetPortal::EndGateway), + "minecraft:end_portal" => Some(ResetPortal::EndPortal), + "minecraft:nether_portal" => Some(ResetPortal::NetherPortal), + _ => None, + }, + fluid: FluidState::from_block(state)?, + }); + } + Ok(Self { + interactions, + states, + water_mask, + }) + } + fn state(&self, id: BlockStateId) -> io::Result { + self.states + .get(id.0 as usize) + .copied() + .ok_or_else(|| invalid("ray block state outside registry")) + } + pub fn fluid_for_block(&self, id: BlockStateId) -> io::Result { + Ok(self.state(id)?.fluid) + } +} +pub trait FallRayWorld { + type Error; + fn block_state(&mut self, p: BlockPos) -> Result; + fn fluid_state(&mut self, p: BlockPos) -> Result; + fn is_server_level(&self) -> bool; + fn entity_is_player(&mut self, e: EntityIdentity) -> Result; + fn players_nether_portal_delay(&mut self) -> Result; +} +#[derive(Debug)] +pub enum FallRayError { + Data(io::Error), + World(E), +} +impl fmt::Display for FallRayError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::Data(e) => e.fmt(f), + Self::World(e) => e.fmt(f), + } + } +} +impl std::error::Error for FallRayError {} +struct Bound<'a, 's, 'r, W> { + registry: &'a FallRayRegistry<'s, 'r>, + cache: &'a mut FluidShapeCache, + entity: Option, + world: &'a mut W, +} +impl FallResetWorld for Bound<'_, '_, '_, W> { + type Error = FallRayError; + type Block = BlockStateId; + fn fall_reset_tag(&mut self, s: BlockStateId) -> Result { + Ok(self.registry.state(s).map_err(FallRayError::Data)?.reset) + } + fn entity_is_player(&mut self, e: EntityIdentity) -> Result { + self.world.entity_is_player(e).map_err(FallRayError::World) + } + fn is_portal(&mut self, s: BlockStateId, p: ResetPortal) -> Result { + Ok(self.registry.state(s).map_err(FallRayError::Data)?.portal == Some(p)) + } + fn is_server_level(&self) -> bool { + self.world.is_server_level() + } + fn players_nether_portal_delay(&mut self) -> Result { + self.world + .players_nether_portal_delay() + .map_err(FallRayError::World) + } +} +struct Height<'a, W>(&'a mut W); +impl FluidHeightWorld for Height<'_, W> { + type Error = FallRayError; + fn fluid(&mut self, p: [i32; 3]) -> Result { + self.0 + .fluid_state(BlockPos::new(p[0], p[1], p[2])) + .map_err(FallRayError::World) + } + fn sturdy_down(&mut self, _: [i32; 3]) -> Result { + Err(FallRayError::Data(invalid( + "camera support is outside a fluid shape query", + ))) + } +} +impl RayWorld for Bound<'_, '_, '_, W> { + type Error = FallRayError; + type Block = BlockStateId; + type Fluid = FluidState; + fn block_state(&mut self, p: BlockPos) -> Result { + let state = self.world.block_state(p).map_err(FallRayError::World)?; + self.registry.state(state).map_err(FallRayError::Data)?; + Ok(state) + } + fn fluid_state(&mut self, p: BlockPos) -> Result { + self.world.fluid_state(p).map_err(FallRayError::World) + } + fn block_shape( + &mut self, + s: BlockStateId, + _: BlockPos, + mode: RayBlockMode, + ) -> Result { + if mode != RayBlockMode::FallDamageResetting { + return Err(FallRayError::Data(invalid("fall ray block mode mismatch"))); + } + let entity = self.entity; + world_ray::fall_reset_shape(self, s, entity) + } + fn interaction_shape( + &mut self, + s: BlockStateId, + _: BlockPos, + ) -> Result { + Ok(self + .registry + .interactions + .shape(s) + .map_err(FallRayError::Data)? + .clone()) + } + fn fluid_is_source(&mut self, s: FluidState) -> Result { + Ok(s.is_source()) + } + fn fluid_is_empty(&mut self, s: FluidState) -> Result { + Ok(s.kind() == FluidKind::Empty) + } + fn fluid_is_water(&mut self, s: FluidState) -> Result { + Ok(self.registry.water_mask & s.kind().mask() != 0) + } + fn fluid_shape(&mut self, s: FluidState, p: BlockPos) -> Result { + self.cache.shape(&mut Height(self.world), s, p) + } +} +/// `entity` represents the optional entity in a native EntityCollisionContext. +/// Keep the cache shared across calls to preserve native first-query behavior. +pub fn fall_reset_ray( + world: &mut W, + registry: &FallRayRegistry<'_, '_>, + cache: &mut FluidShapeCache, + entity: Option, + from: Vec3, + to: Vec3, + max_visits: usize, +) -> Result>> { + world_ray::clip_world( + &mut Bound { + world, + registry, + cache, + entity, + }, + from, + to, + RayBlockMode::FallDamageResetting, + RayFluidMode::Water, + max_visits, + ) +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index c45112bd6..c4dd5cc12 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -804,3 +804,19 @@ interaction-shape world queries are rejected by the fixture. Import checks rejec wrong table kind, partial mappings, missing canonical metadata, foreign state ordering and invalid IDs. Targeted Clippy passes. Registered outline/visual shapes, complete ray-world binding and gameplay integration remain pending. + + +`FallRayRegistry` binds fall-reset tags, portal identities, interaction geometry +and fluid states to the complete registered block-state table. `fall_reset_ray` +uses that binding with the shared fluid-shape cache and native water selection. +Tag reloads produce new validated registry snapshots; unknown tag members and +invalid state IDs are rejected. + +`python3 tools/test_registry_fall_ray_parity.py` compares actual registered +`BlockGetter.clip` behavior with native block/fluid tags and shape getters. The +[registered fall-ray report](../benchmarks/rust-registry-fall-ray-2026-10-07/scoped-parity.json) +records **3,024,623 matching lines per JAR** across **120,297 fixtures**, including +all **35,723 states**, tag reloads, server/client distinctions, player type checks, +portal delays, changing above-fluid states, shared cache reuse and failures. +Targeted Clippy passes. World storage is controlled; live entity movement and +complete player/world gameplay integration remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryFallRayOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryFallRayOracle.java new file mode 100644 index 000000000..256083a33 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryFallRayOracle.java @@ -0,0 +1,80 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import com.mojang.serialization.JsonOps; +import java.io.*; +import java.lang.reflect.*; +import java.nio.file.*; +import java.util.*; +import net.minecraft.core.*; +import net.minecraft.core.registries.*; +import net.minecraft.resources.Identifier; +import net.minecraft.tags.*; +import net.minecraft.world.entity.*; +import net.minecraft.world.level.*; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.state.*; +import net.minecraft.world.level.gamerules.*; +import net.minecraft.world.level.material.*; +import net.minecraft.world.phys.*; +import net.minecraft.world.phys.shapes.*; +/** Registered fall-reset rays with actual block interactions, fluid shapes and tags. */ +public final class VanillaRegistryFallRayOracle { + static final class Stop extends RuntimeException {} + static Object unsafe;static Method allocate; + static T make(Class type){try{return type.cast(allocate.invoke(unsafe,type));}catch(Exception e){throw new AssertionError(e);}} + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + static Vec3 vector(JsonElement v){var a=v.getAsJsonArray();return new Vec3(number(a.get(0)),number(a.get(1)),number(a.get(2)));} + static String pos(BlockPos p){return p.getX()+" "+p.getY()+" "+p.getZ();} + static final class Data { + JsonObject f,op;PrintWriter out;int calls;BlockPos position;Rules rules; + void query(String s){out.println(s);if(calls++==op.get("fail").getAsInt())throw new Stop();} + BlockState at(BlockPos p){return Block.stateById(p.equals(position)?f.get("state").getAsInt():p.equals(position.above())?op.get("above").getAsInt():0);} + BlockState block(BlockPos p){query("block "+pos(p));return at(p);} + FluidState fluid(BlockPos p){query("fluid "+pos(p));return at(p).getFluidState();} + } + static final class Rules extends GameRules { + Data d;Rules(){super(net.minecraft.world.flag.FeatureFlagSet.of());} + @SuppressWarnings("unchecked") @Override public T get(GameRule rule){if(rule!=GameRules.PLAYERS_NETHER_PORTAL_DEFAULT_DELAY)throw new AssertionError();d.query("portal-delay");return (T)Integer.valueOf(d.f.get("delay").getAsInt());} + } + static final class ServerWorld extends net.minecraft.server.level.ServerLevel { + Data d;ServerWorld(){super(null,null,null,null,null,null,false,0L,List.of(),false);} + @Override public BlockState getBlockState(BlockPos p){return d.block(p);} + @Override public FluidState getFluidState(BlockPos p){return d.fluid(p);} + @Override public GameRules getGameRules(){d.query("rules");return d.rules;} + } + static final class Actor extends Marker { + Data d;Actor(){super(null,null);} + @Override public boolean is(EntityType type){if(type!=EntityTypes.PLAYER)throw new AssertionError();d.query("player");return d.f.get("player").getAsBoolean();} + @Override public boolean isDescending(){return false;} + } + private static void bindFluidTags(JsonObject resources) { + var registry=BuiltInRegistries.FLUID; + var loader=new TagLoader>((id,required)->registry.get(id).map(value->(Holder)value),"tags/fluid"); + var definitions=new HashMap>(); + for(var item:resources.entrySet()) { + var file=TagFile.CODEC.parse(JsonOps.INSTANCE,JsonParser.parseString(item.getValue().getAsString())).getOrThrow(); + var entries=new ArrayList(); + for(var entry:file.entries())entries.add(new TagLoader.EntryWithSource(entry,"vanilla")); + definitions.put(Identifier.parse(item.getKey()),entries); + } + var tags=new HashMap,List>>(); + loader.build(definitions).forEach((id,values)->tags.put(TagKey.create(Registries.FLUID,id),List.copyOf(values))); + if(tags.size()!=resources.size())throw new AssertionError("incomplete fluid tags"); + registry.prepareTagReload(new TagLoader.LoadResult<>(Registries.FLUID,tags)).apply(); + } + + public static void main(String[] args)throws Exception{ + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();Path dir=Path.of(args[1]);VanillaHeightmapOracle.bindTags(JsonParser.parseString(Files.readString(dir.resolve("tags.json"))).getAsJsonObject());bindFluidTags(JsonParser.parseString(Files.readString(dir.resolve("fluid-tags.json"))).getAsJsonObject()); + var blocks=new ArrayList>();var reset=new ArrayList>();var fluids=new ArrayList>();var water=new ArrayList>();var resetNames=new JsonArray();var waterNames=new JsonArray();for(var b:BuiltInRegistries.BLOCK){blocks.add(b.builtInRegistryHolder());if(b.defaultBlockState().is(BlockTags.FALL_DAMAGE_RESETTING)){reset.add(b.builtInRegistryHolder());resetNames.add(BuiltInRegistries.BLOCK.getKey(b).toString());}}for(var f:BuiltInRegistries.FLUID){fluids.add(f.builtInRegistryHolder());if(f.is(FluidTags.WATER)){water.add(f.builtInRegistryHolder());waterNames.add(BuiltInRegistries.FLUID.getKey(f).toString());}} + if(args[0].equals("export")){VanillaInteractionShapeOracle.main(args);var bound=new JsonObject();bound.add("reset",resetNames);bound.add("water",waterNames);Files.writeString(dir.resolve("bound-tags.json"),bound.toString());var info=JsonParser.parseString(Files.readString(dir.resolve("info.json"))).getAsJsonObject();var defaults=new JsonObject();for(var b:BuiltInRegistries.BLOCK)defaults.addProperty(BuiltInRegistries.BLOCK.getKey(b).toString(),Block.getId(b.defaultBlockState()));info.add("defaults",defaults);Files.writeString(dir.resolve("info.json"),info.toString());return;} + var allocator=Class.forName("sun.misc.Unsafe");var field=allocator.getDeclaredField("theUnsafe");field.setAccessible(true);unsafe=field.get(null);allocate=allocator.getMethod("allocateInstance",Class.class);var entityPosition=Entity.class.getDeclaredField("position");entityPosition.setAccessible(true);var caches=FlowingFluid.class.getDeclaredField("shapes");caches.setAccessible(true);int oldBlocks=-1,oldFluids=-1; + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){ + var f=JsonParser.parseString(line).getAsJsonObject();int bt=f.get("block_tags").getAsInt(),ft=f.get("fluid_tags").getAsInt();if(bt!=oldBlocks){BuiltInRegistries.BLOCK.prepareTagReload(new TagLoader.LoadResult<>(Registries.BLOCK,Map.of(BlockTags.FALL_DAMAGE_RESETTING,bt==0?reset:bt==1?List.>of():blocks))).apply();oldBlocks=bt;}if(ft!=oldFluids){BuiltInRegistries.FLUID.prepareTagReload(new TagLoader.LoadResult<>(Registries.FLUID,Map.of(FluidTags.WATER,ft==0?water:ft==1?List.>of():fluids))).apply();oldFluids=ft;} + for(var fluid:List.of(Fluids.WATER,Fluids.FLOWING_WATER,Fluids.LAVA,Fluids.FLOWING_LAVA))((Map)caches.get(fluid)).clear();var d=new Data();d.f=f;d.out=out;var p=f.getAsJsonArray("position");d.position=new BlockPos(p.get(0).getAsInt(),p.get(1).getAsInt(),p.get(2).getAsInt());d.rules=make(Rules.class);d.rules.d=d;BlockGetter world;if(f.get("server").getAsBoolean()){var w=make(ServerWorld.class);w.d=d;world=w;}else{world=(BlockGetter)Proxy.newProxyInstance(BlockGetter.class.getClassLoader(),new Class[]{BlockGetter.class},(proxy,method,values)->{if(method.getName().equals("getBlockState"))return d.block((BlockPos)values[0]);if(method.getName().equals("getFluidState"))return d.fluid((BlockPos)values[0]);if(method.isDefault())return InvocationHandler.invokeDefault(proxy,method,values);throw new AssertionError(method);});} + CollisionContext context=CollisionContext.empty();if(f.get("entity").getAsBoolean()){var actor=make(Actor.class);actor.d=d;entityPosition.set(actor,Vec3.ZERO);context=CollisionContext.of(actor);} + for(var value:f.getAsJsonArray("ops")){d.op=value.getAsJsonObject();d.calls=0;var c=new ClipContext(vector(d.op.get("from")),vector(d.op.get("to")),ClipContext.Block.FALLDAMAGE_RESETTING,ClipContext.Fluid.WATER,context); + try{var hit=world.clip(c);var v=hit.getLocation();out.printf("hit %s %016x %016x %016x %s %s %s%n",hit.getType()==HitResult.Type.MISS,Double.doubleToLongBits(v.x),Double.doubleToLongBits(v.y),Double.doubleToLongBits(v.z),hit.getDirection().getSerializedName(),pos(hit.getBlockPos()),hit.isInside());}catch(Stop e){out.println("error");}int count=0;for(var fluid:List.of(Fluids.WATER,Fluids.FLOWING_WATER,Fluids.LAVA,Fluids.FLOWING_LAVA))count+=((Map)caches.get(fluid)).size();out.println("cached "+count);out.println("queries "+d.calls); + } + }} + } +} diff --git a/tools/test_registry_fall_ray_parity.py b/tools/test_registry_fall_ray_parity.py new file mode 100644 index 000000000..1ae37546c --- /dev/null +++ b/tools/test_registry_fall_ray_parity.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python3 +"""Compare registered fall-reset world rays with native blocks, fluids and tags.""" +import itertools +import json +import os +from pathlib import Path +import platform +import random +import struct +import subprocess +import zipfile +try: + from . import lab, test_rust_parity as base, test_worldgen_parity as worldgen +except ImportError: + import lab + import test_rust_parity as base + import test_worldgen_parity as worldgen + + +def fluid_tags(jar): + with zipfile.ZipFile(jar) as archive: + prefix='data/minecraft/tags/fluid/' + return {'minecraft:'+n[len(prefix):-5]:archive.read(n).decode('utf-8') for n in sorted(archive.namelist()) if n.startswith(prefix) and n.endswith('.json')} + + +def corpus(info): + def bits(v):return struct.pack('>d',float(v)).hex() + defaults=info['defaults'];water=defaults['minecraft:water'];lava=defaults['minecraft:lava'] + def op(above=0,p=(0,0,0),ray=0,fail=-1): + a,b=[([.5,.5,.5],[2,.5,.5]),([-.2,.5,.5],[1.2,.5,.5]),([.5,1.5,.5],[.5,-1,.5]),([-.5,-.25,.5],[1.5,1.75,.5]),([.5,.5,.5],[.5,.5,.5])][ray] + return dict(above=above,fail=fail,**{'from':[bits(v+p[i]) for i,v in enumerate(a)],'to':[bits(v+p[i]) for i,v in enumerate(b)]}) + def row(state,**kw): + f=dict(state=state,position=[0,0,0],block_tags=0,fluid_tags=0,server=True,entity=True,player=True,delay=0,ops=[op(),op(water),op()]);f.update(kw);return f + for tags in range(3): + for state in range(info['states']):yield row(state,block_tags=tags) + special=[defaults['minecraft:'+n] for n in ['air','stone','water','lava','cobweb','sweet_berry_bush','slime_block','honey_block','hay_block','powder_snow','end_gateway','end_portal','nether_portal','cauldron','water_cauldron','composter','hopper','scaffolding']] + for state,bt,ft,entity,player,server,delay in itertools.product(special,range(3),range(3),[False,True],[False,True],[False,True],[-1,0,1,80]): + yield row(state,block_tags=bt,fluid_tags=ft,entity=entity,player=player,server=server,delay=delay,ops=[op(0,ray=1),op(water,ray=2),op(lava,ray=3)]) + for state,ft,fail in itertools.product(special,range(3),range(-1,35)): + yield row(state,fluid_tags=ft,ops=[op(0,ray=1,fail=fail),op(water,ray=2,fail=fail),op(0)]) + rng=random.Random(0x46414c4c524159) + for _ in range(6000): + p=rng.choice([(0,0,0),(17,-64,-33),(30000000,0,-30000000)]) + yield row(rng.randrange(info['states']),position=p,block_tags=rng.randrange(3),fluid_tags=rng.randrange(3),entity=bool(rng.randrange(2)),player=bool(rng.randrange(2)),server=bool(rng.randrange(2)),delay=rng.choice([-1,0,1,80]),ops=[op(rng.choice([0,water,lava,rng.randrange(info['states'])]),p,ray=rng.randrange(5),fail=rng.randrange(-1,20)) for _ in range(4)]) + + +def main(): + lock,jars,libraries=base.verify_artifacts();build=lab.LOCAL/'rust-registry-fall-ray-parity';build.mkdir(exist_ok=True);report_path=build/'report.json';report_path.unlink(missing_ok=True) + root=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity';oracles=[root/(n+'.java') for n in ['VanillaRegistryFallRayOracle','VanillaInteractionShapeOracle','VanillaCollisionOracle','VanillaHeightmapOracle']] + sources=[*oracles,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/test_worldgen_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-world/examples/registry_fall_ray_fixture.rs'] + for crate in ['horizon-core','horizon-world']:sources += [lab.ROOT/'crates'/crate/'Cargo.toml',*sorted((lab.ROOT/'crates'/crate/'src').rglob('*.rs'))] + tested=base.source_hashes(sources);tags=worldgen.tag_resources(jars['server']);fluids=fluid_tags(jars['server']) + if tags!=worldgen.tag_resources(jars['client']) or fluids!=fluid_tags(jars['client']):raise AssertionError('Native tags differ between artifacts') + lab.write_json(build/'tags.json',tags);lab.write_json(build/'fluid-tags.json',fluids);classes=build/'classes';classes.mkdir(exist_ok=True);dependencies=os.pathsep.join(map(str,libraries)) + def run(command,name): + with (build/(name+'.log')).open('w') as log:subprocess.run(list(map(str,command)),cwd=lab.ROOT,check=True,timeout=3600,stdout=log,stderr=subprocess.STDOUT) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependencies,'-d',classes,*oracles],'compile-java') + def java(side,mode):run(['java','-Xmx768M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependencies]),'dev.horizonlab.parity.VanillaRegistryFallRayOracle',mode,build],side+'-'+mode) + java('server','export');info=json.loads((build/'info.json').read_text());count=0 + if info['states']!=35723:raise AssertionError('Incomplete pinned registry') + with (build/'inputs.txt').open('w') as output: + for f in corpus(info):output.write(json.dumps(f,separators=(',',':'))+'\n');count+=1 + fixture_paths=[build/n for n in ['inputs.txt','info.json','block-registry.nbt','interaction-shapes.nbt','tags.json','fluid-tags.json','bound-tags.json']];fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--locked','--release','-p','horizon-world','--example','registry_fall_ray_fixture'],'compile-rust');metadata=json.loads(subprocess.check_output(['cargo','metadata','--locked','--no-deps','--format-version','1'],cwd=lab.ROOT));binary=Path(metadata['target_directory'])/'release/examples'/('registry_fall_ray_fixture.exe' if os.name=='nt' else 'registry_fall_ray_fixture');run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side);matched=base.compare(build/(side+'.txt'),build/'rust.txt');references.append(dict(side=side,jar_sha256=lab.digest(jar,'sha256'),output_sha256=lab.digest(build/(side+'.txt'),'sha256'),matched_output_lines=matched));print(f'{side}: {matched:,} registered fall-ray output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested);base.ensure_sources_unchanged(fixture_paths,fixtures) + report=dict(schema=1,minecraft=lock['minecraft']['version'],manifest_sha1=lock['minecraft']['manifest_sha1'],platform=platform.platform(),java=subprocess.check_output(['java','--version'],text=True).splitlines()[0],rustc=subprocess.check_output(['rustc','--version'],text=True).strip(),fixtures=count,registry_states=info['states'],sources_sha256=tested,fixtures_sha256=fixtures,rust_output_sha256=lab.digest(build/'rust.txt','sha256'),references=references,scope='Actual BlockGetter.clip with registered block/interaction/fluid shapes, FALLDAMAGE_RESETTING/WATER context and native tag reloads. Every block state runs natural, empty and universal reset tags; additional fluid tag modes, entity/player/server distinctions, portal delays, multiple ray positions, above-fluid changes, cache reuse and failures compare complete traces/results. Binding rejects unknown tag members and invalid block IDs. World block/fluid reads use controlled snapshots; live resident-world binding, actual player storage, movement integration and complete gameplay remain pending.') + lab.write_json(report_path,report);print(f'Scoped registered fall ray parity passed: {report_path}',flush=True) + + +if __name__=='__main__':main() From 921f092c0fa2ebb427e75a26b67b0b113e564ef4 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 02:19:25 +0200 Subject: [PATCH 087/253] Match living entity landing particles and fall callback ordering --- .../scoped-parity.json | 225 ++++++++++++++++++ .../examples/living_landing_fixture.rs | 215 +++++++++++++++++ crates/horizon-world/src/lib.rs | 1 + crates/horizon-world/src/living_landing.rs | 69 ++++++ docs/collision-geometry.md | 16 ++ .../parity/VanillaLivingLandingOracle.java | 90 +++++++ tools/test_living_landing_parity.py | 82 +++++++ 7 files changed, 698 insertions(+) create mode 100644 benchmarks/rust-living-landing-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/living_landing_fixture.rs create mode 100644 crates/horizon-world/src/living_landing.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingLandingOracle.java create mode 100644 tools/test_living_landing_parity.py diff --git a/benchmarks/rust-living-landing-2026-10-07/scoped-parity.json b/benchmarks/rust-living-landing-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..df4192da2 --- /dev/null +++ b/benchmarks/rust-living-landing-2026-10-07/scoped-parity.json @@ -0,0 +1,225 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 26460, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingLandingOracle.java": "6c0f8109aa685f04e94ee642459fe27573667e0076ec181b0371b88356ac9f7a", + "tools/test_living_landing_parity.py": "039d18708631d1c139f2590bd0cc8cf0dae95439ba56fb338e6b9c5e8769a7b4", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "5aa09a6af45a1cbba716343b1ae9cdb565e32086bf837bdbc449140268c82595", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "a5021a168adcedc37d77f533a8921c02f09c59f46a01737586aaa33c5908b8d0", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/living_landing_fixture.rs": "929d423377667e5f1b7145150dabfc4706c8f73e509c37c0a91173816870d1c7" + }, + "fixtures_sha256": { + ".local/rust-living-landing-parity/inputs.txt": "b01850d7cb4a55b36f59b0848a5445f1f1bd78cea2a68593a4f693cce74601b8" + }, + "rust_output_sha256": "83eba3422733039e35adac26da5020d02b0df640746b5cb5c80fd82c57a09120", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "83eba3422733039e35adac26da5020d02b0df640746b5cb5c80fd82c57a09120", + "matched_output_lines": 244844 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "83eba3422733039e35adac26da5020d02b0df640746b5cb5c80fd82c57a09120", + "matched_output_lines": 244844 + } + ], + "scope": "Actual LivingEntity.checkFallDamage including its base Entity fall handling. Controlled fluid update, onChangedBlock, attribute, state, particle and block landing providers exercise callback order, mutations, server class identity, particle positions/counts, nonfinite arithmetic, climbing cleanup and partial state after failures. Full fluid immersion, enchantment hooks, particle rendering and player/world integration remain pending." +} diff --git a/crates/horizon-world/examples/living_landing_fixture.rs b/crates/horizon-world/examples/living_landing_fixture.rs new file mode 100644 index 000000000..156f8a2bd --- /dev/null +++ b/crates/horizon-world/examples/living_landing_fixture.rs @@ -0,0 +1,215 @@ +use horizon_core::{geometry::Vec3, position::BlockPos}; +use horizon_world::fall_damage::FallDamageWorld; +use horizon_world::living_landing::{LivingLandingWorld, check_living_fall_damage}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn bits(v: f64) -> u64 { + if v.is_nan() { + 0x7ff8000000000000 + } else { + v.to_bits() + } +} +fn support(v: &Value) -> Option { + if v.is_null() { + None + } else { + Some(BlockPos::new( + v[0].as_i64().unwrap() as i32, + v[1].as_i64().unwrap() as i32, + v[2].as_i64().unwrap() as i32, + )) + } +} +struct World<'a> { + input: &'a Value, + out: &'a mut dyn Write, + calls: i64, + fall: f64, + position: Vec3, + support: Option, + water: bool, + climbable: bool, +} +impl World<'_> { + fn query(&mut self, text: String) -> io::Result<()> { + writeln!(self.out, "{text}")?; + let call = self.calls; + self.calls += 1; + if call == self.input["fail"].as_i64().unwrap() { + Err(io::Error::other("injected fall query failure")) + } else { + Ok(()) + } + } +} +impl FallDamageWorld for World<'_> { + type Error = io::Error; + type State = u8; + fn is_in_water(&mut self) -> io::Result { + self.query("water".into())?; + Ok(self.water) + } + fn fall_distance(&self) -> f64 { + self.fall + } + fn set_fall_distance(&mut self, v: f64) { + self.fall = v; + } + fn fall_on(&mut self, _: u8, p: BlockPos, distance: f64) -> io::Result<()> { + self.query(format!( + "fall-on {} {} {} {:016x}", + p.x, + p.y, + p.z, + bits(distance) + ))?; + if self.input["mutate"].as_bool().unwrap() { + self.fall = 17.25; + self.position = Vec3::new(17.0, 18.0, 19.0); + self.support = support(&self.input["after_support"]); + } + Ok(()) + } + fn position(&self) -> Vec3 { + self.position + } + fn supporting_block(&self) -> Option { + self.support + } + fn block_state(&mut self, p: BlockPos) -> io::Result { + self.query(format!("state {} {} {}", p.x, p.y, p.z))?; + Ok(1) + } + fn hit_ground(&mut self, p: Vec3, s: u8) -> io::Result<()> { + self.query(format!( + "hit-ground {:016x} {:016x} {:016x} {}", + bits(p.x), + bits(p.y), + bits(p.z), + if s == 1 { "queried" } else { "input" } + )) + } + fn reset_fall_distance(&mut self) -> io::Result<()> { + self.query("reset".into())?; + self.fall = 0.0; + Ok(()) + } +} +impl LivingLandingWorld for World<'_> { + fn update_fluid_interaction(&mut self) -> io::Result { + self.query("fluid-update".into())?; + self.water = self.input["after_water"].as_bool().unwrap(); + if self.input["fluid_mutate"].as_bool().unwrap() { + self.fall = number(&self.input["after_fall"]); + } + Ok(self.input["fluid_result"].as_bool().unwrap()) + } + fn is_server_level(&self) -> bool { + self.input["server"].as_bool().unwrap() + } + fn on_changed_block(&mut self, p: BlockPos) -> io::Result<()> { + self.query(format!("changed {} {} {}", p.x, p.y, p.z))?; + if self.input["changed_mutate"].as_bool().unwrap() { + self.fall = number(&self.input["after_fall"]); + self.position = Vec3::new(17.0, 18.0, 19.0); + } + Ok(()) + } + fn safe_fall_distance(&mut self) -> io::Result { + self.query("safe".into())?; + Ok(number(&self.input["safe"])) + } + fn state_is_air(&mut self, _: u8) -> io::Result { + self.query("air".into())?; + Ok(self.input["air"].as_bool().unwrap()) + } + fn block_position(&mut self) -> io::Result { + self.query("block-position".into())?; + if self.input["block_mutate"].as_bool().unwrap() { + self.position = Vec3::new(31.0, 32.0, 33.0); + } + Ok(support(&self.input["block_position"]).unwrap()) + } + fn landing_particles(&mut self, s: u8, p: Vec3, count: i32, speed: f64) -> io::Result<()> { + assert_eq!(s, 0); + self.query(format!( + "particles {:016x} {:016x} {:016x} {} {:016x}", + bits(p.x), + bits(p.y), + bits(p.z), + count, + bits(speed) + ))?; + if self.input["particle_mutate"].as_bool().unwrap() { + self.fall = number(&self.input["after_fall"]); + self.water = !self.water; + } + Ok(()) + } + fn clear_last_climbable_position(&mut self) { + self.climbable = false; + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut world = World { + input: &f, + out: &mut out, + calls: 0, + fall: number(&f["fall"]), + position: Vec3::new( + number(&f["position"][0]), + number(&f["position"][1]), + number(&f["position"][2]), + ), + water: f["water"].as_bool().unwrap(), + climbable: true, + support: support(&f["support"]), + }; + let result = check_living_fall_damage( + &mut world, + number(&f["dy"]), + f["ground"].as_bool().unwrap(), + 0, + support(&f["landing"]).unwrap(), + ); + writeln!( + world.out, + "result {}", + if result.is_ok() { "ok" } else { "error" } + )?; + let p = world.position; + writeln!( + world.out, + "final {:016x} {:016x} {:016x} {:016x}", + bits(world.fall), + bits(p.x), + bits(p.y), + bits(p.z) + )?; + if let Some(p) = world.support { + writeln!(world.out, "support {} {} {}", p.x, p.y, p.z)?; + } else { + writeln!(world.out, "support none")?; + } + writeln!( + world.out, + "climbable {} water {}", + world.climbable, world.water + )?; + writeln!(world.out, "queries {}", world.calls)?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 3a105c82d..aca7020db 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -29,6 +29,7 @@ pub mod heightmap; pub mod interaction_shapes; pub mod liquid_collision; pub mod living_fall; +pub mod living_landing; pub mod movement_emission; pub mod movement_properties; pub mod movement_restitution; diff --git a/crates/horizon-world/src/living_landing.rs b/crates/horizon-world/src/living_landing.rs new file mode 100644 index 000000000..cb28df84c --- /dev/null +++ b/crates/horizon-world/src/living_landing.rs @@ -0,0 +1,69 @@ +//! LivingEntity's fluid refresh and landing effects around base fall handling. +use crate::fall_damage::{FallDamageWorld, check_fall_damage}; +use horizon_core::{geometry::Vec3, position::BlockPos}; + +pub trait LivingLandingWorld: FallDamageWorld { + fn update_fluid_interaction(&mut self) -> Result; + /// Native level type identity, independent of its client-side flag. + fn is_server_level(&self) -> bool; + fn on_changed_block(&mut self, position: BlockPos) -> Result<(), Self::Error>; + fn safe_fall_distance(&mut self) -> Result; + fn state_is_air(&mut self, state: Self::State) -> Result; + fn block_position(&mut self) -> Result; + /// Dispatch BLOCK particles with zero axis spread and the supplied speed. + fn landing_particles( + &mut self, + state: Self::State, + position: Vec3, + count: i32, + speed: f64, + ) -> Result<(), Self::Error>; + fn clear_last_climbable_position(&mut self); +} + +/// Preserve callbacks' field mutations and partial state on failure. The +/// landing position and state are the original movement phase's arguments. +pub fn check_living_fall_damage( + world: &mut W, + dy: f64, + on_ground: bool, + state: W::State, + landing: BlockPos, +) -> Result<(), W::Error> { + if !world.is_in_water()? { + world.update_fluid_interaction()?; + } + if world.is_server_level() && on_ground && world.fall_distance() > 0.0 { + world.on_changed_block(landing)?; + let power = world.fall_distance() + 1.0e-6 - world.safe_fall_distance()?; + let power = f64::from((power.floor() as i32).max(0)); + if power > 0.0 && !world.state_is_air(state)? { + let mut position = world.position(); + let current = world.block_position()?; + if landing.x != current.x || landing.z != current.z { + let dx = position.x - f64::from(landing.x) - 0.5; + let dz = position.z - f64::from(landing.z) - 0.5; + // Math.max propagates NaN; Rust's max selects the other operand. + let scale = if dx.is_nan() || dz.is_nan() { + f64::NAN + } else { + dx.abs().max(dz.abs()) + }; + position.x = f64::from(landing.x) + 0.5 + dx / scale * 0.5; + position.z = f64::from(landing.z) + 0.5 + dz / scale * 0.5; + } + let magnitude = (f64::from(0.2f32) + power / 15.0).min(2.5); + world.landing_particles( + state, + position, + (150.0 * magnitude) as i32, + f64::from(0.15f32), + )?; + } + } + check_fall_damage(world, dy, on_ground, state, landing)?; + if on_ground { + world.clear_last_climbable_position(); + } + Ok(()) +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index c4dd5cc12..8708b9265 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -820,3 +820,19 @@ all **35,723 states**, tag reloads, server/client distinctions, player type chec portal delays, changing above-fluid states, shared cache reuse and failures. Targeted Clippy passes. World storage is controlled; live entity movement and complete player/world gameplay integration remain pending. + + +`living_landing` wraps base fall handling with fluid refresh, server-only changed +block notification and landing particles, followed by climbing-position cleanup. +Particle positions preserve the native support-block edge projection and capture +entity coordinates before later callbacks. Attribute, fluid, particle and block +callbacks can mutate fields; failures retain preceding writes. + +`python3 tools/test_living_landing_parity.py` invokes actual +`LivingEntity.checkFallDamage` and its base implementation. The +[living landing report](../benchmarks/rust-living-landing-2026-10-07/scoped-parity.json) +records **244,844 matching lines per JAR**, including server/nonserver levels, +water changes, numeric boundaries, particle locations/counts, callback failures, +field mutations and climbing cleanup. Targeted Clippy passes. Fluid immersion, +changed-block enchantments, particle rendering and live gameplay binding remain +pending; those providers are controlled by this gate. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingLandingOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingLandingOracle.java new file mode 100644 index 000000000..b5f354b86 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingLandingOracle.java @@ -0,0 +1,90 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*; +import java.lang.reflect.*; +import java.nio.file.*; +import java.util.*; +import net.minecraft.core.*; +import net.minecraft.world.entity.*; +import net.minecraft.world.level.*; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.state.*; +import net.minecraft.world.level.gameevent.*; +import net.minecraft.world.phys.Vec3; +/** Actual LivingEntity landing wrapper with native base fall handling. */ +public final class VanillaLivingLandingOracle { + static final class Stop extends RuntimeException {} + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + static Optional support(JsonElement value){if(value.isJsonNull())return Optional.empty();var a=value.getAsJsonArray();return Optional.of(new BlockPos(a.get(0).getAsInt(),a.get(1).getAsInt(),a.get(2).getAsInt()));} + static Field positionField,supportField,climbableField; + static final class Data { + JsonObject input;PrintWriter out;int calls;Actor actor;boolean water;BlockState inputState; + void setPosition(Vec3 p){try{positionField.set(actor,p);}catch(ReflectiveOperationException e){throw new AssertionError(e);}} + void query(String text){out.println(text);if(calls++==input.get("fail").getAsInt())throw new Stop();} + void mutate() {if(input.get("mutate").getAsBoolean()){try{actor.fallDistance=17.25;positionField.set(actor,new Vec3(17,18,19));supportField.set(actor,support(input.get("after_support")));}catch(ReflectiveOperationException e){throw new AssertionError(e);}}} + } + static final class FallBlock extends Block { + Data d;FallBlock(){super(BlockBehaviour.Properties.of());} + @Override public void fallOn(net.minecraft.world.level.Level level,BlockState state,BlockPos p,Entity entity,double distance){d.query(String.format("fall-on %d %d %d %016x",p.getX(),p.getY(),p.getZ(),Double.doubleToLongBits(distance)));d.mutate();} + } + static final class State extends BlockState {Block block;Data d;@Override public boolean isAir(){d.query("air");return d.input.get("air").getAsBoolean();}State(){super(null,null,null);}@Override public Block getBlock(){return block;}} + static final class Level extends net.minecraft.server.level.ServerLevel { + Data d;BlockState queried; + private Level(){super(null,null,null,null,null,null,false,0L,List.of(),false);} + @Override public int sendParticles(T particle,double x,double y,double z,int count,double dx,double dy,double dz,double speed){if(!(particle instanceof net.minecraft.core.particles.BlockParticleOption b)||b.getState()!=d.inputState||b.getType()!=net.minecraft.core.particles.ParticleTypes.BLOCK||dx!=0||dy!=0||dz!=0)throw new AssertionError(particle);d.query(String.format("particles %016x %016x %016x %d %016x",Double.doubleToLongBits(x),Double.doubleToLongBits(y),Double.doubleToLongBits(z),count,Double.doubleToLongBits(speed)));if(d.input.get("particle_mutate").getAsBoolean()){d.actor.fallDistance=number(d.input.get("after_fall"));d.water=!d.water;}return -1;} + @Override public BlockState getBlockState(BlockPos p){d.query("state "+p.getX()+" "+p.getY()+" "+p.getZ());return queried;} + @Override public void gameEvent(Holder event,Vec3 p,GameEvent.Context context){if(event!=GameEvent.HIT_GROUND)throw new AssertionError(event);d.query(String.format("hit-ground %016x %016x %016x %s",Double.doubleToLongBits(p.x),Double.doubleToLongBits(p.y),Double.doubleToLongBits(p.z),context.affectedState()==queried?"queried":"input"));} + } + static final class ClientLevel extends net.minecraft.world.level.Level { + Data d;BlockState queried;ClientLevel(){super(null,null,null,null,false,false,0L,0);} + @Override public BlockState getBlockState(BlockPos p){d.query("state "+p.getX()+" "+p.getY()+" "+p.getZ());return queried;} + @Override public void gameEvent(Holder event,Vec3 p,GameEvent.Context context){if(event!=GameEvent.HIT_GROUND)throw new AssertionError(event);d.query(String.format("hit-ground %016x %016x %016x %s",Double.doubleToLongBits(p.x),Double.doubleToLongBits(p.y),Double.doubleToLongBits(p.z),context.affectedState()==queried?"queried":"input"));} +@Override public net.minecraft.world.clock.ClockManager clockManager(){throw new UnsupportedOperationException();} +@Override public void destroyBlockProgress(int p0,net.minecraft.core.BlockPos p1,int p2){throw new UnsupportedOperationException();} +@Override public java.util.Collection dragonParts(){throw new UnsupportedOperationException();} +@Override public net.minecraft.world.flag.FeatureFlagSet enabledFeatures(){throw new UnsupportedOperationException();} +@Override public net.minecraft.world.attribute.EnvironmentAttributeSystem environmentAttributes(){throw new UnsupportedOperationException();} +@Override public void explode(net.minecraft.world.entity.Entity p0,net.minecraft.world.damagesource.DamageSource p1,net.minecraft.world.level.ExplosionDamageCalculator p2,double p3,double p4,double p5,float p6,boolean p7,net.minecraft.world.level.Level.ExplosionInteraction p8,net.minecraft.core.particles.ParticleOptions p9,net.minecraft.core.particles.ParticleOptions p10,net.minecraft.util.random.WeightedList p11,net.minecraft.core.Holder p12){throw new UnsupportedOperationException();} +@Override public java.lang.String gatherChunkSourceStats(){throw new UnsupportedOperationException();} +@Override public net.minecraft.world.ticks.LevelTickAccess getBlockTicks(){throw new UnsupportedOperationException();} +@Override public net.minecraft.world.level.chunk.ChunkSource getChunkSource(){throw new UnsupportedOperationException();} +@Override public net.minecraft.world.level.entity.LevelEntityGetter getEntities(){throw new UnsupportedOperationException();} +@Override public net.minecraft.world.entity.Entity getEntity(int p0){throw new UnsupportedOperationException();} +@Override public net.minecraft.world.ticks.LevelTickAccess getFluidTicks(){throw new UnsupportedOperationException();} +@Override public net.minecraft.world.level.saveddata.maps.MapItemSavedData getMapData(net.minecraft.world.level.saveddata.maps.MapId p0){throw new UnsupportedOperationException();} +@Override public net.minecraft.world.level.storage.LevelData.RespawnData getRespawnData(){throw new UnsupportedOperationException();} +@Override public net.minecraft.world.scores.Scoreboard getScoreboard(){throw new UnsupportedOperationException();} +@Override public int getSeaLevel(){throw new UnsupportedOperationException();} +@Override public net.minecraft.core.Holder getUncachedNoiseBiome(int p0,int p1,int p2){throw new UnsupportedOperationException();} +@Override public net.minecraft.world.level.border.WorldBorder getWorldBorder(){throw new UnsupportedOperationException();} +@Override public void levelEvent(net.minecraft.world.entity.Entity p0,int p1,net.minecraft.core.BlockPos p2,int p3){throw new UnsupportedOperationException();} +@Override public void playSeededSound(net.minecraft.world.entity.Entity p0,net.minecraft.world.entity.Entity p1,net.minecraft.core.Holder p2,net.minecraft.sounds.SoundSource p3,float p4,float p5,long p6){throw new UnsupportedOperationException();} +@Override public void playSeededSound(net.minecraft.world.entity.Entity p0,double p1,double p2,double p3,net.minecraft.core.Holder p4,net.minecraft.sounds.SoundSource p5,float p6,float p7,long p8){throw new UnsupportedOperationException();} +@Override public java.util.List players(){throw new UnsupportedOperationException();} +@Override public net.minecraft.world.item.crafting.RecipeAccess recipeAccess(){throw new UnsupportedOperationException();} +@Override public void sendBlockUpdated(net.minecraft.core.BlockPos p0,net.minecraft.world.level.block.state.BlockState p1,net.minecraft.world.level.block.state.BlockState p2,int p3){throw new UnsupportedOperationException();} +@Override public void setRespawnData(net.minecraft.world.level.storage.LevelData.RespawnData p0){throw new UnsupportedOperationException();} +@Override public net.minecraft.world.TickRateManager tickRateManager(){throw new UnsupportedOperationException();} + } + static final class Actor extends net.minecraft.world.entity.decoration.ArmorStand { + Data d;Actor(){super(null,null);}void configure(net.minecraft.world.level.Level level){setLevel(level);} + @Override public boolean isInWater(){d.query("water");return d.water;} + @Override public void resetFallDistance(){d.query("reset");super.resetFallDistance();} + @Override public boolean updateFluidInteraction(){d.query("fluid-update");d.water=d.input.get("after_water").getAsBoolean();if(d.input.get("fluid_mutate").getAsBoolean())fallDistance=number(d.input.get("after_fall"));return d.input.get("fluid_result").getAsBoolean();} + @Override protected void onChangedBlock(net.minecraft.server.level.ServerLevel level,BlockPos p){d.query("changed "+p.getX()+" "+p.getY()+" "+p.getZ());if(d.input.get("changed_mutate").getAsBoolean()){fallDistance=number(d.input.get("after_fall"));d.setPosition(new Vec3(17,18,19));}} + @Override public double getAttributeValue(Holder attribute){if(attribute!=net.minecraft.world.entity.ai.attributes.Attributes.SAFE_FALL_DISTANCE)throw new AssertionError(attribute);d.query("safe");return number(d.input.get("safe"));} + @Override public BlockPos blockPosition(){d.query("block-position");if(d.input.get("block_mutate").getAsBoolean())d.setPosition(new Vec3(31,32,33));return support(d.input.get("block_position")).orElseThrow();} + void check(double dy,boolean ground,BlockState state,BlockPos p){checkFallDamage(dy,ground,state,p);} + } + public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); + var allocator=Class.forName("sun.misc.Unsafe");var field=allocator.getDeclaredField("theUnsafe");field.setAccessible(true);var unsafe=field.get(null);var allocate=allocator.getMethod("allocateInstance",Class.class);positionField=Entity.class.getDeclaredField("position");positionField.setAccessible(true);supportField=Entity.class.getDeclaredField("mainSupportingBlockPos");supportField.setAccessible(true);climbableField=LivingEntity.class.getDeclaredField("lastClimbablePos");climbableField.setAccessible(true);Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){ + for(var line:(Iterable)lines::iterator){ + var f=JsonParser.parseString(line).getAsJsonObject();var d=new Data();d.input=f;d.out=out;d.water=f.get("water").getAsBoolean();net.minecraft.world.level.Level level;if(f.get("server").getAsBoolean()){var l=(Level)allocate.invoke(unsafe,Level.class);l.d=d;l.queried=Blocks.STONE.defaultBlockState();level=l;}else{var l=(ClientLevel)allocate.invoke(unsafe,ClientLevel.class);l.d=d;l.queried=Blocks.STONE.defaultBlockState();level=l;}var entity=(Actor)allocate.invoke(unsafe,Actor.class);entity.d=d;d.actor=entity;entity.configure(level);entity.fallDistance=number(f.get("fall"));var xyz=f.getAsJsonArray("position");positionField.set(entity,new Vec3(number(xyz.get(0)),number(xyz.get(1)),number(xyz.get(2))));climbableField.set(entity,Optional.of(new BlockPos(7,8,9)));supportField.set(entity,support(f.get("support")));var block=(FallBlock)allocate.invoke(unsafe,FallBlock.class);block.d=d;var state=(State)allocate.invoke(unsafe,State.class);state.block=block;state.d=d;d.inputState=state; + try{entity.check(number(f.get("dy")),f.get("ground").getAsBoolean(),state,support(f.get("landing")).orElseThrow());out.println("result ok");}catch(Stop error){out.println("result error");} + var p=(Vec3)positionField.get(entity);out.printf("final %016x %016x %016x %016x%n",Double.doubleToLongBits(entity.fallDistance),Double.doubleToLongBits(p.x),Double.doubleToLongBits(p.y),Double.doubleToLongBits(p.z));var selected=(Optional)supportField.get(entity);if(selected.isEmpty())out.println("support none");else{var pos=(BlockPos)selected.get();out.println("support "+pos.getX()+" "+pos.getY()+" "+pos.getZ());}out.println("climbable "+((Optional)climbableField.get(entity)).isPresent()+" water "+d.water);out.println("queries "+d.calls); + } + } + } +} diff --git a/tools/test_living_landing_parity.py b/tools/test_living_landing_parity.py new file mode 100644 index 000000000..aca33601f --- /dev/null +++ b/tools/test_living_landing_parity.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python3 +"""Compare LivingEntity landing wrapper and base fall callbacks with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + def bits(v): return struct.pack('>d',float(v)).hex() + def row(**kw): + f=dict(fall=6,dy=-.08,ground=True,water=False,after_water=False,support=None,after_support=None,mutate=False,fail=-1,server=True,fluid_mutate=False,fluid_result=False,changed_mutate=False,particle_mutate=False,block_mutate=False,after_fall=12,safe=3,air=False,position=[.3,1.5,-.3],block_position=[0,1,-1],landing=[3,4,5]) + f.update(kw) + for k in ['fall','dy','after_fall','safe']:f[k]=bits(f[k]) + f['position']=[bits(v) for v in f['position']] + return f + values=[-float('inf'),-1e40,-1,-1e-46,-0.0,0,1e-46,2.9999989,2.999999,3,3.999999,4,4.000001,6,7,37.5,100,1e40,float('inf'),float('nan')] + for fall in values: + for safe in values: + for server in [False,True]: + for ground in [False,True]: + for water in [False,True]: + for after_water in [False,True]: + for air in [False,True]:yield row(fall=fall,safe=safe,server=server,ground=ground,water=water,after_water=after_water,air=air) + positions=[[.3,1.5,-.3],[3.5,0,5.5],[3.5,0,10],[8,0,5.5],[4.5,0,6.5],[float('nan'),1,5.5],[3.5,float('inf'),float('nan')],[float('inf'),0,-float('inf')],[30000000.5,-64,-30000000.5],[-0.0,0,-0.0]] + for position in positions: + for landing in [[3,4,5],[0,1,-1],[30000000,-64,-30000000],[-2147483648,0,2147483647]]: + for block_position in [landing,[0,0,0]]: + for block_mutate in [False,True]:yield row(position=position,landing=landing,block_position=block_position,block_mutate=block_mutate) + for field in ['fluid_mutate','changed_mutate','particle_mutate','block_mutate','mutate']: + for after in values: + for fail in range(-1,14):yield row(**{field:True},after_fall=after,fail=fail,support=[17,-64,-33],after_support=[31,15,-1]) + rng=random.Random(0x4c414e44) + flags=['ground','water','after_water','mutate','server','fluid_mutate','fluid_result','changed_mutate','particle_mutate','block_mutate','air'] + for _ in range(12000): + f={k:bool(rng.randrange(2)) for k in flags} + for k in ['fall','dy','after_fall','safe']:f[k]=rng.choice(values) if rng.randrange(3)==0 else rng.uniform(-5,80) + yield row(**f,position=rng.choice(positions),support=rng.choice([None,[17,-64,-33]]),after_support=rng.choice([None,[31,15,-1]]),fail=rng.choice([-1,-1,*range(14)])) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-living-landing-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingLandingOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/living_landing_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaLivingLandingOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','living_landing_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('living_landing_fixture.exe' if os.name=='nt' else 'living_landing_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} living-landing output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual LivingEntity.checkFallDamage including its base Entity fall handling. Controlled fluid update, onChangedBlock, attribute, state, particle and block landing providers exercise callback order, mutations, server class identity, particle positions/counts, nonfinite arithmetic, climbing cleanup and partial state after failures. Full fluid immersion, enchantment hooks, particle rendering and player/world integration remain pending.'} + lab.write_json(report_path,report);print(f'Scoped living landing parity passed: {report_path}') + + +if __name__=='__main__':main() From b43c468a6fda1b12740f17f3ba77ad778ab4eb59 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 02:28:48 +0200 Subject: [PATCH 088/253] Match living entity input, climbing and air travel phases --- .../scoped-parity.json | 226 ++++++++++++++++ .../examples/living_air_fixture.rs | 246 ++++++++++++++++++ crates/horizon-world/src/lib.rs | 1 + crates/horizon-world/src/living_air.rs | 171 ++++++++++++ docs/collision-geometry.md | 18 ++ .../parity/VanillaLivingAirOracle.java | 84 ++++++ tools/test_living_air_parity.py | 97 +++++++ 7 files changed, 843 insertions(+) create mode 100644 benchmarks/rust-living-air-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/living_air_fixture.rs create mode 100644 crates/horizon-world/src/living_air.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingAirOracle.java create mode 100644 tools/test_living_air_parity.py diff --git a/benchmarks/rust-living-air-2026-10-07/scoped-parity.json b/benchmarks/rust-living-air-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..a4adb3c4a --- /dev/null +++ b/benchmarks/rust-living-air-2026-10-07/scoped-parity.json @@ -0,0 +1,226 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 35655, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingAirOracle.java": "787aa79779b3bf2445a566840759d15dfc85f57e2d80d2d41948cfc5694b68b7", + "tools/test_living_air_parity.py": "e629186b1e4bd8faa1c535fe469a084ac0f5ccf04b2961b3e8cfc322417adac3", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "6c3ba8a4db5b04508f5bc0633fd864095c7afbcc024523c9a6219134210489a2", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "a5021a168adcedc37d77f533a8921c02f09c59f46a01737586aaa33c5908b8d0", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/living_air_fixture.rs": "4736e209a6772840a953b1aabd736cbc4eef064b9658300aa152f081345190c1" + }, + "fixtures_sha256": { + ".local/rust-living-air-parity/inputs.txt": "975ea006fdc523f37ccef52b654630ed653a0766ab1a5faf0b006f829bc73618" + }, + "rust_output_sha256": "c1f207978d91c4ee96a148c47f1a5962270d0272b0c9aa9f7829714821bc511c", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "c1f207978d91c4ee96a148c47f1a5962270d0272b0c9aa9f7829714821bc511c", + "matched_output_lines": 443554 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "c1f207978d91c4ee96a148c47f1a5962270d0272b0c9aa9f7829714821bc511c", + "matched_output_lines": 443554 + } + ], + "scope": "Actual LivingEntity.travelInAir, handleRelativeFrictionAndCalculateMovement, handleOnClimbable, getFrictionInfluencedSpeed, computeModifiedFriction and Entity.getInputVector. Traces native moveRelative and state writes, both Player/nonplayer ladder guards, registered scaffolding/boots checks, levitation, missing client chunks, float friction/drag, callback mutations and failures. Entity.move, effective gravity, ground/climb predicates and attributes use controlled providers; live world integration and complete player travel remain pending." +} diff --git a/crates/horizon-world/examples/living_air_fixture.rs b/crates/horizon-world/examples/living_air_fixture.rs new file mode 100644 index 000000000..fe581f54f --- /dev/null +++ b/crates/horizon-world/examples/living_air_fixture.rs @@ -0,0 +1,246 @@ +use horizon_core::{geometry::Vec3, position::BlockPos}; +use horizon_world::living_air::*; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn single(v: &Value) -> f32 { + f32::from_bits(u32::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn vec(v: &Value) -> Vec3 { + Vec3::new(number(&v[0]), number(&v[1]), number(&v[2])) +} +fn bits(v: f64) -> u64 { + if v.is_nan() { + 0x7ff8000000000000 + } else { + v.to_bits() + } +} +fn fbits(v: f32) -> u32 { + if v.is_nan() { 0x7fc00000 } else { v.to_bits() } +} +fn vector(v: Vec3) -> String { + format!("{:016x} {:016x} {:016x}", bits(v.x), bits(v.y), bits(v.z)) +} +struct World<'a> { + f: &'a Value, + out: &'a mut dyn Write, + calls: i64, + ground_calls: usize, + climb_calls: usize, + velocity: Vec3, + fall: f64, + moved: bool, +} +impl World<'_> { + fn flag(&self, k: &str) -> bool { + self.f[k].as_bool().unwrap() + } + fn query(&mut self, s: impl AsRef) -> io::Result<()> { + writeln!(self.out, "{}", s.as_ref())?; + let n = self.calls; + self.calls += 1; + if n == self.f["fail"].as_i64().unwrap() { + Err(io::Error::other("injected travel failure")) + } else { + Ok(()) + } + } + fn sequence(&self, k: &str, n: usize) -> bool { + let a = self.f[k].as_array().unwrap(); + a[n.min(a.len() - 1)].as_bool().unwrap() + } +} +impl LivingAirWorld for World<'_> { + type Error = io::Error; + fn movement_support_position(&mut self) -> io::Result { + self.query("support")?; + Ok(BlockPos::new(17, -64, -33)) + } + fn on_ground(&mut self) -> io::Result { + self.query("ground")?; + let b = self.sequence("ground", self.ground_calls); + self.ground_calls += 1; + Ok(b) + } + fn block_friction(&mut self, p: BlockPos) -> io::Result { + self.query(format!("state {} {} {}", p.x, p.y, p.z))?; + self.query("friction")?; + Ok(single(&self.f["friction"])) + } + fn friction_modifier(&mut self) -> io::Result { + self.query("friction-modifier")?; + Ok(number(&self.f["friction_modifier"])) + } + fn speed(&mut self) -> io::Result { + self.query("speed")?; + Ok(single(&self.f["speed"])) + } + fn flying_speed(&mut self) -> io::Result { + self.query("flying-speed")?; + Ok(single(&self.f["flying_speed"])) + } + fn yaw(&mut self) -> io::Result { + self.query("yaw")?; + if self.flag("yaw_mutate") { + self.velocity = Vec3::new(17.0, 18.0, 19.0); + } + Ok(single(&self.f["yaw"])) + } + fn velocity(&self) -> Vec3 { + self.velocity + } + fn set_velocity(&mut self, v: Vec3) -> io::Result<()> { + self.query(format!("set {}", vector(v)))?; + self.velocity = v; + Ok(()) + } + fn on_climbable(&mut self) -> io::Result { + self.query("climb")?; + let b = self.sequence("climb", self.climb_calls); + self.climb_calls += 1; + Ok(b) + } + fn reset_fall_distance(&mut self) -> io::Result<()> { + self.query("reset")?; + self.fall = 0.0; + Ok(()) + } + fn in_scaffolding(&mut self) -> io::Result { + self.query("in-block")?; + Ok(self.flag("scaffolding")) + } + fn suppressing_ladder_slide(&mut self) -> io::Result { + self.query("suppress")?; + Ok(self.flag("suppress")) + } + fn is_player_class(&self) -> bool { + self.flag("player") + } + fn move_self(&mut self, v: Vec3) -> io::Result<()> { + self.query(format!("move {}", vector(v)))?; + self.moved = true; + if self.flag("move_mutate") { + self.velocity = vec(&self.f["after_velocity"]); + } + Ok(()) + } + fn horizontal_collision(&self) -> bool { + self.flag(if self.moved { + "after_horizontal" + } else { + "horizontal" + }) + } + fn jumping(&self) -> bool { + self.flag(if self.moved { + "after_jumping" + } else { + "jumping" + }) + } + fn was_in_powder_snow(&self) -> bool { + self.flag(if self.moved { "after_snow" } else { "snow" }) + } + fn can_walk_powder_snow(&mut self) -> io::Result { + self.query("powder-tag")?; + if self.flag("powder_tag") { + Ok(true) + } else { + self.query("feet")?; + Ok(self.flag("boots")) + } + } + fn levitation_amplifier(&mut self) -> io::Result> { + self.query("levitation")?; + Ok(self.f["levitation"].as_i64().map(|v| v as i32)) + } + fn is_client_side(&mut self) -> io::Result { + self.query("client")?; + Ok(self.flag("client")) + } + fn has_chunk_at(&mut self, p: BlockPos) -> io::Result { + self.query(format!("chunk {} {} {}", p.x, p.y, p.z))?; + Ok(self.flag("chunk")) + } + fn effective_gravity(&mut self) -> io::Result { + self.query("gravity")?; + Ok(number(&self.f["gravity"])) + } + fn y(&self) -> f64 { + number(&self.f["y"]) + } + fn minimum_y(&mut self) -> io::Result { + self.query("min-y")?; + Ok(self.f["min_y"].as_i64().unwrap() as i32) + } + fn discard_friction(&mut self) -> io::Result { + self.query("discard")?; + Ok(self.flag("discard")) + } + fn air_drag_modifier(&mut self) -> io::Result { + self.query("drag-modifier")?; + Ok(number(&self.f["drag_modifier"])) + } + fn omnidirectional_air_mover(&mut self) -> io::Result { + self.query("omni")?; + Ok(self.flag("omni")) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut w = World { + f: &f, + out: &mut out, + calls: 0, + ground_calls: 0, + climb_calls: 0, + velocity: vec(&f["velocity"]), + fall: number(&f["fall"]), + moved: false, + }; + let input = vec(&f["input"]); + let friction = single(&f["friction"]); + let result: io::Result<()> = match f["mode"].as_str().unwrap() { + "air" => travel_in_air(&mut w, input), + "relative" => relative_friction_movement(&mut w, input, friction) + .and_then(|v| writeln!(w.out, "vector {}", vector(v))), + "climb" => handle_on_climbable(&mut w, input) + .and_then(|v| writeln!(w.out, "vector {}", vector(v))), + "speed" => friction_influenced_speed(&mut w, friction) + .and_then(|v| writeln!(w.out, "float {:08x}", fbits(v))), + "input" => writeln!( + w.out, + "vector {}", + vector(input_vector(input, single(&f["speed"]), single(&f["yaw"]))) + ), + "friction" => writeln!( + w.out, + "float {:08x}", + fbits(modified_friction( + friction, + number(&f["friction_modifier"]) as f32 + )) + ), + _ => panic!("unknown mode"), + }; + writeln!( + w.out, + "result {}", + if result.is_ok() { "ok" } else { "error" } + )?; + writeln!(w.out, "final {} {:016x}", vector(w.velocity), bits(w.fall))?; + writeln!(w.out, "queries {}", w.calls)?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index aca7020db..8c9bd40c1 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -28,6 +28,7 @@ pub mod ground_support; pub mod heightmap; pub mod interaction_shapes; pub mod liquid_collision; +pub mod living_air; pub mod living_fall; pub mod living_landing; pub mod movement_emission; diff --git a/crates/horizon-world/src/living_air.rs b/crates/horizon-world/src/living_air.rs new file mode 100644 index 000000000..dec52f4bc --- /dev/null +++ b/crates/horizon-world/src/living_air.rs @@ -0,0 +1,171 @@ +//! LivingEntity walking, climbing and airborne velocity integration. +use horizon_core::{ + geometry::{Vec3, trig}, + position::BlockPos, +}; + +pub trait LivingAirWorld { + type Error; + fn movement_support_position(&mut self) -> Result; + fn on_ground(&mut self) -> Result; + fn block_friction(&mut self, position: BlockPos) -> Result; + fn friction_modifier(&mut self) -> Result; + fn speed(&mut self) -> Result; + /// Includes entity-type overrides (notably Player). + fn flying_speed(&mut self) -> Result; + fn yaw(&mut self) -> Result; + fn velocity(&self) -> Vec3; + fn set_velocity(&mut self, velocity: Vec3) -> Result<(), Self::Error>; + fn on_climbable(&mut self) -> Result; + fn reset_fall_distance(&mut self) -> Result<(), Self::Error>; + fn in_scaffolding(&mut self) -> Result; + fn suppressing_ladder_slide(&mut self) -> Result; + fn is_player_class(&self) -> bool; + /// Bind to Entity.move(SELF, movement), including collision and landing. + fn move_self(&mut self, movement: Vec3) -> Result<(), Self::Error>; + fn horizontal_collision(&self) -> bool; + fn jumping(&self) -> bool; + fn was_in_powder_snow(&self) -> bool; + fn can_walk_powder_snow(&mut self) -> Result; + fn levitation_amplifier(&mut self) -> Result, Self::Error>; + fn is_client_side(&mut self) -> Result; + fn has_chunk_at(&mut self, position: BlockPos) -> Result; + fn effective_gravity(&mut self) -> Result; + fn y(&self) -> f64; + fn minimum_y(&mut self) -> Result; + fn discard_friction(&mut self) -> Result; + fn air_drag_modifier(&mut self) -> Result; + fn omnidirectional_air_mover(&mut self) -> Result; +} + +pub fn modified_friction(friction: f32, modifier: f32) -> f32 { + (1.0 - (1.0 - friction) * modifier).clamp(0.0, 1.0) +} +/// Entity.getInputVector: normalize only above unit length, then rotate using +/// the native float-angle sine table. Tiny input returns canonical positive zero. +pub fn input_vector(input: Vec3, speed: f32, yaw: f32) -> Vec3 { + let length = input.length_squared(); + if length < 1.0e-7 { + return Vec3::ZERO; + } + let input = if length > 1.0 { + input.normalize() + } else { + input + }; + let input = input.scale(f64::from(speed)); + let angle = f64::from(yaw * trig::DEG_TO_RAD); + let sin = f64::from(trig::sin(angle)); + let cos = f64::from(trig::cos(angle)); + Vec3::new( + input.x * cos - input.z * sin, + input.y, + input.z * cos + input.x * sin, + ) +} +pub fn move_relative( + world: &mut W, + input: Vec3, + speed: f32, +) -> Result<(), W::Error> { + let input = input_vector(input, speed, world.yaw()?); + let old = world.velocity(); + world.set_velocity(Vec3::new(old.x + input.x, old.y + input.y, old.z + input.z)) +} +pub fn handle_on_climbable( + world: &mut W, + mut velocity: Vec3, +) -> Result { + if world.on_climbable()? { + world.reset_fall_distance()?; + let limit = f64::from(0.15f32); + velocity.x = velocity.x.clamp(-limit, limit); + velocity.z = velocity.z.clamp(-limit, limit); + // Math.max must propagate NaN. + if !velocity.y.is_nan() { + velocity.y = velocity.y.max(-limit); + } + if velocity.y < 0.0 + && !world.in_scaffolding()? + && world.suppressing_ladder_slide()? + && world.is_player_class() + { + velocity.y = 0.0; + } + } + Ok(velocity) +} +pub fn friction_influenced_speed( + world: &mut W, + friction: f32, +) -> Result { + if world.on_ground()? { + let speed = world.speed()?; + if f64::from(friction) > 0.6 { + Ok(speed * (0.21600002f32 / (friction * friction * friction))) + } else { + Ok(speed) + } + } else { + world.flying_speed() + } +} +pub fn relative_friction_movement( + world: &mut W, + input: Vec3, + friction: f32, +) -> Result { + let speed = friction_influenced_speed(world, friction)?; + move_relative(world, input, speed)?; + let velocity = handle_on_climbable(world, world.velocity())?; + world.set_velocity(velocity)?; + world.move_self(world.velocity())?; + let mut velocity = world.velocity(); + if (world.horizontal_collision() || world.jumping()) + && (world.on_climbable()? + || (world.was_in_powder_snow() && world.can_walk_powder_snow()?)) + { + velocity.y = 0.2; + } + Ok(velocity) +} +/// Ground friction is captured before movement; drag and gravity are queried +/// afterwards. This distinction preserves movement callbacks' field changes. +pub fn travel_in_air(world: &mut W, input: Vec3) -> Result<(), W::Error> { + let support = world.movement_support_position()?; + let friction = if world.on_ground()? { + let friction = world.block_friction(support)?; + modified_friction(friction, world.friction_modifier()? as f32) + } else { + 1.0 + }; + let mut velocity = relative_friction_movement(world, input, friction)?; + if let Some(amplifier) = world.levitation_amplifier()? { + velocity.y += (0.05 * f64::from(amplifier.wrapping_add(1)) - velocity.y) * 0.2; + } else if !world.is_client_side()? || world.has_chunk_at(support)? { + velocity.y -= world.effective_gravity()?; + } else { + let y = world.y(); + velocity.y = if y > f64::from(world.minimum_y()?) { + -0.1 + } else { + 0.0 + }; + } + if !world.discard_friction()? { + let modifier = world.air_drag_modifier()? as f32; + let drag = modified_friction(0.91, modifier); + let horizontal = friction * drag; + let vertical = if world.omnidirectional_air_mover()? { + drag + } else { + modified_friction(0.98, modifier) + }; + velocity = Vec3::new( + velocity.x * f64::from(horizontal), + velocity.y * f64::from(vertical), + velocity.z * f64::from(horizontal), + ); + } + world.set_velocity(velocity) +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 8708b9265..c4939e3cb 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -836,3 +836,21 @@ water changes, numeric boundaries, particle locations/counts, callback failures, field mutations and climbing cleanup. Targeted Clippy passes. Fluid immersion, changed-block enchantments, particle rendering and live gameplay binding remain pending; those providers are controlled by this gate. + + +`living_air` implements input normalization/rotation, friction-influenced speed, +ladder/scaffolding limits, relative movement, collision-triggered climbing and +air travel. Ground friction is captured before movement while levitation, +gravity and drag are sampled afterwards. Player class identity controls ladder +slide suppression. Native float arithmetic and quantized trigonometry are kept. + +`python3 tools/test_living_air_parity.py` invokes the actual native private air, +relative movement, climbing, speed, friction and input-vector methods. The +[air travel report](../benchmarks/rust-living-air-2026-10-07/scoped-parity.json) +records **443,554 matching lines per JAR**, including both player/nonplayer +classes, changed ground/climbing predicates, missing client chunks, levitation, +nonfinite boundaries, callback mutations and failures. Targeted Clippy passes. +Extreme effect amplifiers are injected directly for integer-boundary checks; +normal constructor clamping is outside this gate. Collision movement, gravity, +attributes and immersion remain controlled providers; live gameplay binding and +complete player travel are pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingAirOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingAirOracle.java new file mode 100644 index 000000000..143d926cc --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingAirOracle.java @@ -0,0 +1,84 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*;import java.lang.reflect.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.*;import net.minecraft.tags.*;import net.minecraft.world.entity.*;import net.minecraft.world.entity.ai.attributes.*;import net.minecraft.world.effect.*;import net.minecraft.world.item.*;import net.minecraft.world.level.block.*;import net.minecraft.world.level.block.state.*;import net.minecraft.world.phys.Vec3; +/** Actual native private air travel, relative movement and climbing helpers. */ +public final class VanillaLivingAirOracle { + static ItemStack BOOTS;static Field amplifier; + static MobEffectInstance effect(Data d,Holder type){if(d.f.get("levitation").isJsonNull())return null;var e=new MobEffectInstance(type,100,0);try{amplifier.setInt(e,d.f.get("levitation").getAsInt());}catch(ReflectiveOperationException ex){throw new AssertionError(ex);}return e;} + static final class Stop extends RuntimeException {} + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + static float single(JsonElement v){return Float.intBitsToFloat(Integer.parseUnsignedInt(v.getAsString(),16));} + static Vec3 vec(JsonElement v){var a=v.getAsJsonArray();return new Vec3(number(a.get(0)),number(a.get(1)),number(a.get(2)));} + static String vector(Vec3 v){return String.format("%016x %016x %016x",Double.doubleToLongBits(v.x),Double.doubleToLongBits(v.y),Double.doubleToLongBits(v.z));} + static final class Data {JsonObject f;PrintWriter out;int calls,groundCalls,climbCalls;Vec3 velocity; + void query(String s){out.println(s);if(calls++==f.get("fail").getAsInt())throw new Stop();} + boolean flag(String k){return f.get(k).getAsBoolean();} + boolean sequence(String k,int n){var a=f.getAsJsonArray(k);return a.get(Math.min(n,a.size()-1)).getAsBoolean();}} + static final class FrictionBlock extends Block {Data d;FrictionBlock(){super(BlockBehaviour.Properties.of());}@Override public float getFriction(){d.query("friction");return single(d.f.get("friction"));}} + static final class State extends BlockState {Block block;State(){super(null,null,null);}@Override public Block getBlock(){return block;}} + static final class Level extends net.minecraft.server.level.ServerLevel {Data d;BlockState state;Level(){super(null,null,null,null,null,null,false,0L,List.of(),false);} + @Override public BlockState getBlockState(BlockPos p){d.query("state "+p.getX()+" "+p.getY()+" "+p.getZ());return state;} + @Override public boolean isClientSide(){d.query("client");return d.flag("client");} + @Override public boolean hasChunkAt(BlockPos p){d.query("chunk "+p.getX()+" "+p.getY()+" "+p.getZ());return d.flag("chunk");} + @Override public int getMinY(){d.query("min-y");return d.f.get("min_y").getAsInt();}} + static final class Actor extends net.minecraft.world.entity.decoration.ArmorStand {Actor(){super(null,null);} + Data d; + void configure(Level l){setLevel(l);} + @Override public BlockPos getBlockPosBelowThatAffectsMyMovement(){d.query("support");return new BlockPos(17,-64,-33);} + @Override public boolean onGround(){d.query("ground");return d.sequence("ground",d.groundCalls++);} + @Override public double getAttributeValue(Holder attribute){String n=attribute==Attributes.FRICTION_MODIFIER?"friction":attribute==Attributes.AIR_DRAG_MODIFIER?"drag":null;if(n==null)throw new AssertionError(attribute);d.query(n+"-modifier");return number(d.f.get(n+"_modifier"));} + @Override public float getSpeed(){d.query("speed");return single(d.f.get("speed"));} + @Override protected float getFlyingSpeed(){d.query("flying-speed");return single(d.f.get("flying_speed"));} + @Override public float getYRot(){d.query("yaw");if(d.flag("yaw_mutate"))d.velocity=new Vec3(17,18,19);return single(d.f.get("yaw"));} + @Override public Vec3 getDeltaMovement(){return d.velocity;} + @Override public void setDeltaMovement(Vec3 v){d.query("set "+vector(v));d.velocity=v;} + @Override public boolean onClimbable(){d.query("climb");return d.sequence("climb",d.climbCalls++);} + @Override public void resetFallDistance(){d.query("reset");fallDistance=0;} + @Override public BlockState getInBlockState(){d.query("in-block");return (d.flag("scaffolding")?Blocks.SCAFFOLDING:Blocks.STONE).defaultBlockState();} + @Override public boolean isSuppressingSlidingDownLadder(){d.query("suppress");return d.flag("suppress");} + @Override public void move(MoverType type,Vec3 v){if(type!=MoverType.SELF)throw new AssertionError(type);d.query("move "+vector(v));horizontalCollision=d.flag("after_horizontal");jumping=d.flag("after_jumping");wasInPowderSnow=d.flag("after_snow");if(d.flag("move_mutate"))d.velocity=vec(d.f.get("after_velocity"));} + @Override public boolean is(TagKey> tag){if(tag!=EntityTypeTags.POWDER_SNOW_WALKABLE_MOBS)throw new AssertionError(tag);d.query("powder-tag");return d.flag("powder_tag");} + @Override public ItemStack getItemBySlot(EquipmentSlot slot){if(slot!=EquipmentSlot.FEET)throw new AssertionError(slot);d.query("feet");return d.flag("boots")?BOOTS:ItemStack.EMPTY;} + @Override public MobEffectInstance getEffect(Holder effect){if(effect!=MobEffects.LEVITATION)throw new AssertionError(effect);d.query("levitation");return effect(d,effect);} + @Override protected double getEffectiveGravity(){d.query("gravity");return number(d.f.get("gravity"));} + @Override public boolean shouldDiscardFriction(){d.query("discard");return d.flag("discard");} + @Override protected boolean omnidirectionalAirMover(){d.query("omni");return d.flag("omni");} + } + static final class Human extends net.minecraft.world.entity.player.Player {Human(){super(null,null);} + Data d; + void configure(Level l){setLevel(l);} + @Override public BlockPos getBlockPosBelowThatAffectsMyMovement(){d.query("support");return new BlockPos(17,-64,-33);} + @Override public boolean onGround(){d.query("ground");return d.sequence("ground",d.groundCalls++);} + @Override public double getAttributeValue(Holder attribute){String n=attribute==Attributes.FRICTION_MODIFIER?"friction":attribute==Attributes.AIR_DRAG_MODIFIER?"drag":null;if(n==null)throw new AssertionError(attribute);d.query(n+"-modifier");return number(d.f.get(n+"_modifier"));} + @Override public float getSpeed(){d.query("speed");return single(d.f.get("speed"));} + @Override protected float getFlyingSpeed(){d.query("flying-speed");return single(d.f.get("flying_speed"));} + @Override public float getYRot(){d.query("yaw");if(d.flag("yaw_mutate"))d.velocity=new Vec3(17,18,19);return single(d.f.get("yaw"));} + @Override public Vec3 getDeltaMovement(){return d.velocity;} + @Override public void setDeltaMovement(Vec3 v){d.query("set "+vector(v));d.velocity=v;} + @Override public boolean onClimbable(){d.query("climb");return d.sequence("climb",d.climbCalls++);} + @Override public void resetFallDistance(){d.query("reset");fallDistance=0;} + @Override public BlockState getInBlockState(){d.query("in-block");return (d.flag("scaffolding")?Blocks.SCAFFOLDING:Blocks.STONE).defaultBlockState();} + @Override public boolean isSuppressingSlidingDownLadder(){d.query("suppress");return d.flag("suppress");} + @Override public void move(MoverType type,Vec3 v){if(type!=MoverType.SELF)throw new AssertionError(type);d.query("move "+vector(v));horizontalCollision=d.flag("after_horizontal");jumping=d.flag("after_jumping");wasInPowderSnow=d.flag("after_snow");if(d.flag("move_mutate"))d.velocity=vec(d.f.get("after_velocity"));} + @Override public boolean is(TagKey> tag){if(tag!=EntityTypeTags.POWDER_SNOW_WALKABLE_MOBS)throw new AssertionError(tag);d.query("powder-tag");return d.flag("powder_tag");} + @Override public ItemStack getItemBySlot(EquipmentSlot slot){if(slot!=EquipmentSlot.FEET)throw new AssertionError(slot);d.query("feet");return d.flag("boots")?BOOTS:ItemStack.EMPTY;} + @Override public MobEffectInstance getEffect(Holder effect){if(effect!=MobEffects.LEVITATION)throw new AssertionError(effect);d.query("levitation");return effect(d,effect);} + @Override protected double getEffectiveGravity(){d.query("gravity");return number(d.f.get("gravity"));} + @Override public boolean shouldDiscardFriction(){d.query("discard");return d.flag("discard");} + @Override protected boolean omnidirectionalAirMover(){d.query("omni");return d.flag("omni");} + @Override public net.minecraft.world.level.GameType gameMode(){return net.minecraft.world.level.GameType.SURVIVAL;} + } + static Method method(Class owner,String name,Class... args)throws Exception{var m=owner.getDeclaredMethod(name,args);m.setAccessible(true);return m;} + public static void main(String[] args)throws Exception{ + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();var u=Class.forName("sun.misc.Unsafe");var uf=u.getDeclaredField("theUnsafe");uf.setAccessible(true);var unsafe=uf.get(null);var allocate=u.getMethod("allocateInstance",Class.class); + amplifier=MobEffectInstance.class.getDeclaredField("amplifier");amplifier.setAccessible(true);BOOTS=(ItemStack)allocate.invoke(unsafe,ItemStack.class);var stackItem=ItemStack.class.getDeclaredField("item");stackItem.setAccessible(true);stackItem.set(BOOTS,Items.LEATHER_BOOTS.builtInRegistryHolder());var stackCount=ItemStack.class.getDeclaredField("count");stackCount.setAccessible(true);stackCount.setInt(BOOTS,1); + var air=method(LivingEntity.class,"travelInAir",Vec3.class);var relative=method(LivingEntity.class,"handleRelativeFrictionAndCalculateMovement",Vec3.class,float.class);var climb=method(LivingEntity.class,"handleOnClimbable",Vec3.class);var speed=method(LivingEntity.class,"getFrictionInfluencedSpeed",float.class);var input=method(Entity.class,"getInputVector",Vec3.class,float.class,float.class);var friction=method(LivingEntity.class,"computeModifiedFriction",float.class,float.class);var position=Entity.class.getDeclaredField("position");position.setAccessible(true);var jumping=LivingEntity.class.getDeclaredField("jumping");jumping.setAccessible(true);Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){ + var f=JsonParser.parseString(line).getAsJsonObject();var d=new Data();d.f=f;d.out=out;d.velocity=vec(f.get("velocity"));var level=(Level)allocate.invoke(unsafe,Level.class);level.d=d;var block=(FrictionBlock)allocate.invoke(unsafe,FrictionBlock.class);block.d=d;var state=(State)allocate.invoke(unsafe,State.class);state.block=block;level.state=state; + LivingEntity entity;if(d.flag("player")){var e=(Human)allocate.invoke(unsafe,Human.class);e.d=d;e.configure(level);entity=e;}else{var e=(Actor)allocate.invoke(unsafe,Actor.class);e.d=d;e.configure(level);entity=e;}position.set(entity,new Vec3(0,number(f.get("y")),0));entity.fallDistance=number(f.get("fall"));entity.horizontalCollision=d.flag("horizontal");jumping.setBoolean(entity,d.flag("jumping"));entity.wasInPowderSnow=d.flag("snow"); + try{Object result=switch(f.get("mode").getAsString()){case "air"->air.invoke(entity,vec(f.get("input")));case "relative"->relative.invoke(entity,vec(f.get("input")),single(f.get("friction")));case "climb"->climb.invoke(entity,vec(f.get("input")));case "speed"->speed.invoke(entity,single(f.get("friction")));case "input"->input.invoke(null,vec(f.get("input")),single(f.get("speed")),single(f.get("yaw")));case "friction"->friction.invoke(null,single(f.get("friction")),(float)number(f.get("friction_modifier")));default->throw new AssertionError();};if(result instanceof Vec3 v)out.println("vector "+vector(v));else if(result instanceof Float v)out.printf("float %08x%n",Float.floatToIntBits(v));out.println("result ok");}catch(InvocationTargetException e){if(e.getCause() instanceof Stop)out.println("result error");else throw e;} + out.printf("final %s %016x%n",vector(d.velocity),Double.doubleToLongBits(entity.fallDistance));out.println("queries "+d.calls); + }} + } +} diff --git a/tools/test_living_air_parity.py b/tools/test_living_air_parity.py new file mode 100644 index 000000000..d2ab0e597 --- /dev/null +++ b/tools/test_living_air_parity.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python3 +"""Compare LivingEntity air travel, climbing and input movement with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + def bits(v):return struct.pack('>d',float(v)).hex() + def single(v):return struct.pack('>f',float(v)).hex() + def row(**kw): + f=dict(mode='air',input=[.4,0,.8],velocity=[.1,-.08,-.2],after_velocity=[.3,-.6,.9],fall=6,friction=.6,friction_modifier=1,drag_modifier=1,speed=.1,flying_speed=.02,yaw=37,ground=[True,True],climb=[False,False],scaffolding=False,suppress=False,player=False,horizontal=False,jumping=False,snow=False,after_horizontal=False,after_jumping=False,after_snow=False,powder_tag=False,boots=False,levitation=None,client=False,chunk=True,gravity=.08,y=64,min_y=-64,discard=False,omni=False,yaw_mutate=False,move_mutate=False,fail=-1) + f.update(kw) + for k in ['input','velocity','after_velocity']:f[k]=[bits(v) for v in f[k]] + for k in ['fall','friction_modifier','drag_modifier','gravity','y']:f[k]=bits(f[k]) + for k in ['friction','speed','flying_speed','yaw']:f[k]=single(f[k]) + return f + vals=[-float('inf'),-1e30,-1,-.15,-1e-40,-0.0,0,1e-40,.02,.1,.15,.6,.91,.98,1,2,1e30,float('inf'),float('nan')] + for friction in vals: + for modifier in vals:yield row(mode='friction',friction=friction,friction_modifier=modifier) + for friction in vals+[.59999996,.60000002]: + for speed in vals: + for ground in [False,True]:yield row(mode='speed',friction=friction,speed=speed,flying_speed=speed,ground=[ground]) + vectors=[[0,0,0],[-0.0,-0.0,-0.0],[.0001,0,0],[math.sqrt(1e-7),0,0],[1,0,0],[0,0,1],[1,1,1],[float('inf'),0,0],[float('nan'),.1,0],[0,-.15000000596046448,0],[0,-float('inf'),0]] + for i in range(4096):yield row(mode='input',yaw=i*360/4096,input=[.7,.3,-.8]) + for v in vectors: + for yaw in vals+[90,180,270,360,-360]: + for speed in [.1,-0.0,float('inf'),float('nan')]:yield row(mode='input',input=v,yaw=yaw,speed=speed) + for v in vectors+[[.5,-.7,-.5],[0,-0.0,0]]: + for climb in [False,True]: + for player in [False,True]: + for scaffolding in [False,True]: + for suppress in [False,True]: + for fail in range(-1,5):yield row(mode='climb',input=v,climb=[climb],player=player,scaffolding=scaffolding,suppress=suppress,fail=fail) + for ground in [[False],[True],[True,False],[False,True]]: + for climb in [[False],[True],[False,True],[True,False]]: + for bits_mask in range(256): + flags={k:bool(bits_mask&(1< Date: Wed, 7 Oct 2026 02:32:09 +0200 Subject: [PATCH 089/253] Match living water and lava travel with escape and buoyancy --- .../scoped-parity.json | 227 ++++++++++++ .../examples/living_fluid_fixture.rs | 327 ++++++++++++++++++ crates/horizon-world/src/lib.rs | 1 + crates/horizon-world/src/living_fluid.rs | 154 +++++++++ docs/collision-geometry.md | 16 + .../parity/VanillaLivingFluidOracle.java | 101 ++++++ tools/test_living_fluid_parity.py | 93 +++++ 7 files changed, 919 insertions(+) create mode 100644 benchmarks/rust-living-fluid-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/living_fluid_fixture.rs create mode 100644 crates/horizon-world/src/living_fluid.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingFluidOracle.java create mode 100644 tools/test_living_fluid_parity.py diff --git a/benchmarks/rust-living-fluid-2026-10-07/scoped-parity.json b/benchmarks/rust-living-fluid-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..7f4ce3c57 --- /dev/null +++ b/benchmarks/rust-living-fluid-2026-10-07/scoped-parity.json @@ -0,0 +1,227 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 26642, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingFluidOracle.java": "aee079a665cf8191a61ac26fb4598e4064a455611c0b933cffaa99e4b0797299", + "tools/test_living_fluid_parity.py": "aace76dd9c048825791e4548c07d4e9f9dc359764ebd884b5726b0067d0748ec", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "9eb870cad873b1e0be6c4e42fecffe73c0267f862d0f257ad78bb63409de1de0", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "a5021a168adcedc37d77f533a8921c02f09c59f46a01737586aaa33c5908b8d0", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/living_fluid_fixture.rs": "38768bcc98b9c741863fbe7d3bfa5a3068325a7caafa0b8f0be0e650f131dd6a" + }, + "fixtures_sha256": { + ".local/rust-living-fluid-parity/inputs.txt": "dcdb7bf9e12914bca107e8e283768495426e51db46c740c7cb409ee9f8ebf3ae" + }, + "rust_output_sha256": "228ecd8dbcbdd845995eec1642dd88ec6493be64442a402d494e3c51732cb498", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "228ecd8dbcbdd845995eec1642dd88ec6493be64442a402d494e3c51732cb498", + "matched_output_lines": 265100 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "228ecd8dbcbdd845995eec1642dd88ec6493be64442a402d494e3c51732cb498", + "matched_output_lines": 265100 + } + ], + "scope": "Actual LivingEntity water/lava travel, fluid falling adjustment, shallow-fluid branch, fluid escape and ridden buoyancy. Includes native input acceleration and field write ordering, sprint changes, efficiency/dolphin effects, movement and free-space mutations, nonfinite arithmetic and injected failures. Controlled collision movement, immersion depths, free-space results, attributes and gravity; live fluid propagation, player/world binding and complete gameplay remain pending." +} diff --git a/crates/horizon-world/examples/living_fluid_fixture.rs b/crates/horizon-world/examples/living_fluid_fixture.rs new file mode 100644 index 000000000..55ccdd8f5 --- /dev/null +++ b/crates/horizon-world/examples/living_fluid_fixture.rs @@ -0,0 +1,327 @@ +use horizon_core::{geometry::Vec3, position::BlockPos}; +use horizon_world::living_air::*; +use horizon_world::living_fluid::*; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn single(v: &Value) -> f32 { + f32::from_bits(u32::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn vec(v: &Value) -> Vec3 { + Vec3::new(number(&v[0]), number(&v[1]), number(&v[2])) +} +fn bits(v: f64) -> u64 { + if v.is_nan() { + 0x7ff8000000000000 + } else { + v.to_bits() + } +} +fn fbits(v: f32) -> u32 { + if v.is_nan() { 0x7fc00000 } else { v.to_bits() } +} +fn vector(v: Vec3) -> String { + format!("{:016x} {:016x} {:016x}", bits(v.x), bits(v.y), bits(v.z)) +} +struct World<'a> { + f: &'a Value, + out: &'a mut dyn Write, + calls: i64, + ground_calls: usize, + climb_calls: usize, + velocity: Vec3, + fall: f64, + moved: bool, + y: f64, + sprint_calls: usize, +} +impl World<'_> { + fn flag(&self, k: &str) -> bool { + self.f[k].as_bool().unwrap() + } + fn query(&mut self, s: impl AsRef) -> io::Result<()> { + writeln!(self.out, "{}", s.as_ref())?; + let n = self.calls; + self.calls += 1; + if n == self.f["fail"].as_i64().unwrap() { + Err(io::Error::other("injected travel failure")) + } else { + Ok(()) + } + } + fn sequence(&self, k: &str, n: usize) -> bool { + let a = self.f[k].as_array().unwrap(); + a[n.min(a.len() - 1)].as_bool().unwrap() + } +} +impl LivingAirWorld for World<'_> { + type Error = io::Error; + fn movement_support_position(&mut self) -> io::Result { + self.query("support")?; + Ok(BlockPos::new(17, -64, -33)) + } + fn on_ground(&mut self) -> io::Result { + self.query("ground")?; + let b = self.sequence("ground", self.ground_calls); + self.ground_calls += 1; + Ok(b) + } + fn block_friction(&mut self, p: BlockPos) -> io::Result { + self.query(format!("state {} {} {}", p.x, p.y, p.z))?; + self.query("friction")?; + Ok(single(&self.f["friction"])) + } + fn friction_modifier(&mut self) -> io::Result { + self.query("friction-modifier")?; + Ok(number(&self.f["friction_modifier"])) + } + fn speed(&mut self) -> io::Result { + self.query("speed")?; + Ok(single(&self.f["speed"])) + } + fn flying_speed(&mut self) -> io::Result { + self.query("flying-speed")?; + Ok(single(&self.f["flying_speed"])) + } + fn yaw(&mut self) -> io::Result { + self.query("yaw")?; + if self.flag("yaw_mutate") { + self.velocity = Vec3::new(17.0, 18.0, 19.0); + } + Ok(single(&self.f["yaw"])) + } + fn velocity(&self) -> Vec3 { + self.velocity + } + fn set_velocity(&mut self, v: Vec3) -> io::Result<()> { + self.query(format!("set {}", vector(v)))?; + self.velocity = v; + Ok(()) + } + fn on_climbable(&mut self) -> io::Result { + self.query("climb")?; + let b = self.sequence("climb", self.climb_calls); + self.climb_calls += 1; + Ok(b) + } + fn reset_fall_distance(&mut self) -> io::Result<()> { + self.query("reset")?; + self.fall = 0.0; + Ok(()) + } + fn in_scaffolding(&mut self) -> io::Result { + self.query("in-block")?; + Ok(self.flag("scaffolding")) + } + fn suppressing_ladder_slide(&mut self) -> io::Result { + self.query("suppress")?; + Ok(self.flag("suppress")) + } + fn is_player_class(&self) -> bool { + self.flag("player") + } + fn move_self(&mut self, v: Vec3) -> io::Result<()> { + self.query(format!("move {}", vector(v)))?; + self.moved = true; + self.y = number(&self.f["after_y"]); + if self.flag("move_mutate") { + self.velocity = vec(&self.f["after_velocity"]); + } + Ok(()) + } + fn horizontal_collision(&self) -> bool { + self.flag(if self.moved { + "after_horizontal" + } else { + "horizontal" + }) + } + fn jumping(&self) -> bool { + self.flag(if self.moved { + "after_jumping" + } else { + "jumping" + }) + } + fn was_in_powder_snow(&self) -> bool { + self.flag(if self.moved { "after_snow" } else { "snow" }) + } + fn can_walk_powder_snow(&mut self) -> io::Result { + self.query("powder-tag")?; + if self.flag("powder_tag") { + Ok(true) + } else { + self.query("feet")?; + Ok(self.flag("boots")) + } + } + fn levitation_amplifier(&mut self) -> io::Result> { + self.query("levitation")?; + Ok(self.f["levitation"].as_i64().map(|v| v as i32)) + } + fn is_client_side(&mut self) -> io::Result { + self.query("client")?; + Ok(self.flag("client")) + } + fn has_chunk_at(&mut self, p: BlockPos) -> io::Result { + self.query(format!("chunk {} {} {}", p.x, p.y, p.z))?; + Ok(self.flag("chunk")) + } + fn effective_gravity(&mut self) -> io::Result { + self.query("gravity")?; + Ok(number(&self.f["gravity"])) + } + fn y(&self) -> f64 { + self.y + } + fn minimum_y(&mut self) -> io::Result { + self.query("min-y")?; + Ok(self.f["min_y"].as_i64().unwrap() as i32) + } + fn discard_friction(&mut self) -> io::Result { + self.query("discard")?; + Ok(self.flag("discard")) + } + fn air_drag_modifier(&mut self) -> io::Result { + self.query("drag-modifier")?; + Ok(number(&self.f["drag_modifier"])) + } + fn omnidirectional_air_mover(&mut self) -> io::Result { + self.query("omni")?; + Ok(self.flag("omni")) + } +} +impl LivingFluidWorld for World<'_> { + fn in_water(&mut self) -> io::Result { + self.query("water")?; + Ok(self.flag("water")) + } + fn sprinting(&mut self) -> io::Result { + self.query("sprint")?; + let b = self.sequence("sprint", self.sprint_calls); + self.sprint_calls += 1; + Ok(b) + } + fn water_slow_down(&mut self) -> io::Result { + self.query("slow-down")?; + Ok(single(&self.f["slow_down"])) + } + fn water_movement_efficiency(&mut self) -> io::Result { + self.query("efficiency")?; + Ok(number(&self.f["efficiency"])) + } + fn dolphins_grace(&mut self) -> io::Result { + self.query("dolphin")?; + Ok(self.flag("dolphin")) + } + fn fluid_height(&mut self, tag: TravelFluidTag) -> io::Result { + let key = match tag { + TravelFluidTag::Lava => "lava", + TravelFluidTag::EntityFloatable => "floatable", + }; + self.query(format!("height {key}"))?; + Ok(number(&self.f[format!("{key}_height")])) + } + fn fluid_jump_threshold(&mut self) -> io::Result { + self.query("threshold")?; + Ok(number(&self.f["threshold"])) + } + fn is_free(&mut self, v: Vec3) -> io::Result { + self.query(format!("free {}", vector(v)))?; + if self.flag("free_mutate") { + self.velocity = Vec3::new(31.0, 32.0, 33.0); + } + Ok(self.flag("free")) + } + fn is_vehicle(&mut self) -> io::Result { + self.query("vehicle")?; + Ok(self.flag("vehicle")) + } + fn can_float_while_ridden(&mut self) -> io::Result { + self.query("float-tag")?; + Ok(self.flag("float_tag")) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut w = World { + f: &f, + out: &mut out, + calls: 0, + ground_calls: 0, + climb_calls: 0, + velocity: vec(&f["velocity"]), + fall: number(&f["fall"]), + moved: false, + y: number(&f["y"]), + sprint_calls: 0, + }; + let input = vec(&f["input"]); + let friction = single(&f["friction"]); + let result: io::Result<()> = match f["mode"].as_str().unwrap() { + "fluid" => travel_in_fluid(&mut w, input), + "water" => travel_in_water( + &mut w, + input, + number(&f["gravity"]), + f["falling"].as_bool().unwrap(), + number(&f["old_y"]), + ), + "lava" => travel_in_lava( + &mut w, + input, + number(&f["gravity"]), + f["falling"].as_bool().unwrap(), + number(&f["old_y"]), + ), + "adjust" => fluid_falling_adjusted_movement( + &mut w, + number(&f["gravity"]), + f["falling"].as_bool().unwrap(), + input, + ) + .and_then(|v| writeln!(w.out, "vector {}", vector(v))), + "jump" => jump_out_of_fluid(&mut w, number(&f["old_y"])), + "float" => float_in_liquid_while_ridden(&mut w, TravelFluidTag::EntityFloatable), + "air" => travel_in_air(&mut w, input), + "relative" => relative_friction_movement(&mut w, input, friction) + .and_then(|v| writeln!(w.out, "vector {}", vector(v))), + "climb" => handle_on_climbable(&mut w, input) + .and_then(|v| writeln!(w.out, "vector {}", vector(v))), + "speed" => friction_influenced_speed(&mut w, friction) + .and_then(|v| writeln!(w.out, "float {:08x}", fbits(v))), + "input" => writeln!( + w.out, + "vector {}", + vector(input_vector(input, single(&f["speed"]), single(&f["yaw"]))) + ), + "friction" => writeln!( + w.out, + "float {:08x}", + fbits(modified_friction( + friction, + number(&f["friction_modifier"]) as f32 + )) + ), + _ => panic!("unknown mode"), + }; + writeln!( + w.out, + "result {}", + if result.is_ok() { "ok" } else { "error" } + )?; + writeln!(w.out, "final {} {:016x}", vector(w.velocity), bits(w.fall))?; + writeln!(w.out, "queries {}", w.calls)?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 8c9bd40c1..4a5e7848a 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -30,6 +30,7 @@ pub mod interaction_shapes; pub mod liquid_collision; pub mod living_air; pub mod living_fall; +pub mod living_fluid; pub mod living_landing; pub mod movement_emission; pub mod movement_properties; diff --git a/crates/horizon-world/src/living_fluid.rs b/crates/horizon-world/src/living_fluid.rs new file mode 100644 index 000000000..44cf7be24 --- /dev/null +++ b/crates/horizon-world/src/living_fluid.rs @@ -0,0 +1,154 @@ +//! LivingEntity water/lava travel and fluid escape/buoyancy velocity updates. +use crate::living_air::{LivingAirWorld, move_relative}; +use horizon_core::geometry::Vec3; + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum TravelFluidTag { + Lava, + EntityFloatable, +} +pub trait LivingFluidWorld: LivingAirWorld { + fn in_water(&mut self) -> Result; + fn sprinting(&mut self) -> Result; + fn water_slow_down(&mut self) -> Result; + fn water_movement_efficiency(&mut self) -> Result; + fn dolphins_grace(&mut self) -> Result; + fn fluid_height(&mut self, tag: TravelFluidTag) -> Result; + fn fluid_jump_threshold(&mut self) -> Result; + fn is_free(&mut self, offset: Vec3) -> Result; + fn is_vehicle(&mut self) -> Result; + fn can_float_while_ridden(&mut self) -> Result; +} + +pub fn fluid_falling_adjusted_movement( + world: &mut W, + gravity: f64, + falling: bool, + mut velocity: Vec3, +) -> Result { + if gravity != 0.0 && !world.sprinting()? { + velocity.y = if falling + && (velocity.y - 0.005).abs() >= 0.003 + && (velocity.y - gravity / 16.0).abs() < 0.003 + { + -0.003 + } else { + velocity.y - gravity / 16.0 + }; + } + Ok(velocity) +} +pub fn jump_out_of_fluid(world: &mut W, old_y: f64) -> Result<(), W::Error> { + let mut velocity = world.velocity(); + if world.horizontal_collision() { + let probe = Vec3::new( + velocity.x, + velocity.y + f64::from(0.6f32) - world.y() + old_y, + velocity.z, + ); + if world.is_free(probe)? { + velocity.y = f64::from(0.3f32); + world.set_velocity(velocity)?; + } + } + Ok(()) +} +pub fn travel_in_water( + world: &mut W, + input: Vec3, + gravity: f64, + falling: bool, + old_y: f64, +) -> Result<(), W::Error> { + let mut slowdown = if world.sprinting()? { + 0.9f32 + } else { + world.water_slow_down()? + }; + let mut speed = 0.02f32; + let mut efficiency = world.water_movement_efficiency()? as f32; + if !world.on_ground()? { + efficiency *= 0.5; + } + if efficiency > 0.0 { + slowdown += (0.54600006f32 - slowdown) * efficiency; + speed += (world.speed()? - speed) * efficiency; + } + if world.dolphins_grace()? { + slowdown = 0.96; + } + move_relative(world, input, speed)?; + world.move_self(world.velocity())?; + let mut velocity = world.velocity(); + if world.horizontal_collision() && world.on_climbable()? { + velocity.y = 0.2; + } + velocity = Vec3::new( + velocity.x * f64::from(slowdown), + velocity.y * f64::from(0.8f32), + velocity.z * f64::from(slowdown), + ); + let velocity = fluid_falling_adjusted_movement(world, gravity, falling, velocity)?; + world.set_velocity(velocity)?; + jump_out_of_fluid(world, old_y) +} +pub fn travel_in_lava( + world: &mut W, + input: Vec3, + gravity: f64, + falling: bool, + old_y: f64, +) -> Result<(), W::Error> { + move_relative(world, input, 0.02)?; + world.move_self(world.velocity())?; + let height = world.fluid_height(TravelFluidTag::Lava)?; + if height <= world.fluid_jump_threshold()? { + let velocity = world.velocity(); + world.set_velocity(Vec3::new( + velocity.x * 0.5, + velocity.y * f64::from(0.8f32), + velocity.z * 0.5, + ))?; + let velocity = fluid_falling_adjusted_movement(world, gravity, falling, world.velocity())?; + world.set_velocity(velocity)?; + } else { + world.set_velocity(world.velocity().scale(0.5))?; + } + if gravity != 0.0 { + let velocity = world.velocity(); + world.set_velocity(Vec3::new( + velocity.x + 0.0, + velocity.y + -gravity / 4.0, + velocity.z + 0.0, + ))?; + } + jump_out_of_fluid(world, old_y) +} +pub fn float_in_liquid_while_ridden( + world: &mut W, + tag: TravelFluidTag, +) -> Result<(), W::Error> { + if world.is_vehicle()? && world.can_float_while_ridden()? { + let threshold = world.fluid_jump_threshold()?; + if world.fluid_height(tag)? > threshold { + let velocity = world.velocity(); + world.set_velocity(Vec3::new( + velocity.x + 0.0, + velocity.y + f64::from(0.04f32), + velocity.z + 0.0, + ))?; + } + } + Ok(()) +} +pub fn travel_in_fluid(world: &mut W, input: Vec3) -> Result<(), W::Error> { + let falling = world.velocity().y <= 0.0; + let old_y = world.y(); + let gravity = world.effective_gravity()?; + if world.in_water()? { + travel_in_water(world, input, gravity, falling, old_y)?; + } else { + travel_in_lava(world, input, gravity, falling, old_y)?; + } + float_in_liquid_while_ridden(world, TravelFluidTag::EntityFloatable) +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index c4939e3cb..128a9b8a7 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -854,3 +854,19 @@ Extreme effect amplifiers are injected directly for integer-boundary checks; normal constructor clamping is outside this gate. Collision movement, gravity, attributes and immersion remain controlled providers; live gameplay binding and complete player travel are pending. + + +`living_fluid` adds native water/lava acceleration, slowdown, falling adjustment, +shallow-lava handling, collision escape and ridden buoyancy. It shares input +rotation with air movement. Fluid heights and escape queries remain lazy, with +movement mutations visible to subsequent velocity updates. + +`python3 tools/test_living_fluid_parity.py` compares the actual native travel and +fluid helper methods. The +[fluid travel report](../benchmarks/rust-living-fluid-2026-10-07/scoped-parity.json) +records **265,100 matching lines per JAR**, including sprint changes, movement +efficiency, dolphin effects, shallow-fluid boundaries, escape probes, ridden +float guards, nonfinite values, callback mutations and failures. Targeted Clippy +passes. Collision movement, immersion depths, free-space queries, attributes and +gravity are controlled; live fluid propagation and gameplay binding remain +pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingFluidOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingFluidOracle.java new file mode 100644 index 000000000..b37df7384 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingFluidOracle.java @@ -0,0 +1,101 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*;import java.lang.reflect.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.*;import net.minecraft.tags.*;import net.minecraft.world.entity.*;import net.minecraft.world.entity.ai.attributes.*;import net.minecraft.world.effect.*;import net.minecraft.world.item.*;import net.minecraft.world.level.block.*;import net.minecraft.world.level.block.state.*;import net.minecraft.world.phys.Vec3; +/** Actual native private air travel, relative movement and climbing helpers. */ +public final class VanillaLivingFluidOracle { + static ItemStack BOOTS;static Field position;static Field amplifier; + static MobEffectInstance effect(Data d,Holder type){if(d.f.get("levitation").isJsonNull())return null;var e=new MobEffectInstance(type,100,0);try{amplifier.setInt(e,d.f.get("levitation").getAsInt());}catch(ReflectiveOperationException ex){throw new AssertionError(ex);}return e;} + static final class Stop extends RuntimeException {} + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + static float single(JsonElement v){return Float.intBitsToFloat(Integer.parseUnsignedInt(v.getAsString(),16));} + static Vec3 vec(JsonElement v){var a=v.getAsJsonArray();return new Vec3(number(a.get(0)),number(a.get(1)),number(a.get(2)));} + static String vector(Vec3 v){return String.format("%016x %016x %016x",Double.doubleToLongBits(v.x),Double.doubleToLongBits(v.y),Double.doubleToLongBits(v.z));} + static final class Data {JsonObject f;PrintWriter out;int calls,groundCalls,climbCalls,sprintCalls;Vec3 velocity; + void query(String s){out.println(s);if(calls++==f.get("fail").getAsInt())throw new Stop();} + boolean flag(String k){return f.get(k).getAsBoolean();} + boolean sequence(String k,int n){var a=f.getAsJsonArray(k);return a.get(Math.min(n,a.size()-1)).getAsBoolean();}} + static final class FrictionBlock extends Block {Data d;FrictionBlock(){super(BlockBehaviour.Properties.of());}@Override public float getFriction(){d.query("friction");return single(d.f.get("friction"));}} + static final class State extends BlockState {Block block;State(){super(null,null,null);}@Override public Block getBlock(){return block;}} + static final class Level extends net.minecraft.server.level.ServerLevel {Data d;BlockState state;Level(){super(null,null,null,null,null,null,false,0L,List.of(),false);} + @Override public BlockState getBlockState(BlockPos p){d.query("state "+p.getX()+" "+p.getY()+" "+p.getZ());return state;} + @Override public boolean isClientSide(){d.query("client");return d.flag("client");} + @Override public boolean hasChunkAt(BlockPos p){d.query("chunk "+p.getX()+" "+p.getY()+" "+p.getZ());return d.flag("chunk");} + @Override public int getMinY(){d.query("min-y");return d.f.get("min_y").getAsInt();}} + static final class Actor extends net.minecraft.world.entity.decoration.ArmorStand {Actor(){super(null,null);} + Data d; + void configure(Level l){setLevel(l);} + @Override public BlockPos getBlockPosBelowThatAffectsMyMovement(){d.query("support");return new BlockPos(17,-64,-33);} + @Override public boolean onGround(){d.query("ground");return d.sequence("ground",d.groundCalls++);} + @Override public double getAttributeValue(Holder attribute){if(attribute==Attributes.WATER_MOVEMENT_EFFICIENCY){d.query("efficiency");return number(d.f.get("efficiency"));}String n=attribute==Attributes.FRICTION_MODIFIER?"friction":attribute==Attributes.AIR_DRAG_MODIFIER?"drag":null;if(n==null)throw new AssertionError(attribute);d.query(n+"-modifier");return number(d.f.get(n+"_modifier"));} + @Override public float getSpeed(){d.query("speed");return single(d.f.get("speed"));} + @Override protected float getFlyingSpeed(){d.query("flying-speed");return single(d.f.get("flying_speed"));} + @Override public float getYRot(){d.query("yaw");if(d.flag("yaw_mutate"))d.velocity=new Vec3(17,18,19);return single(d.f.get("yaw"));} + @Override public Vec3 getDeltaMovement(){return d.velocity;} + @Override public void setDeltaMovement(Vec3 v){d.query("set "+vector(v));d.velocity=v;} + @Override public boolean onClimbable(){d.query("climb");return d.sequence("climb",d.climbCalls++);} + @Override public void resetFallDistance(){d.query("reset");fallDistance=0;} + @Override public BlockState getInBlockState(){d.query("in-block");return (d.flag("scaffolding")?Blocks.SCAFFOLDING:Blocks.STONE).defaultBlockState();} + @Override public boolean isSuppressingSlidingDownLadder(){d.query("suppress");return d.flag("suppress");} + @Override public void move(MoverType type,Vec3 v){if(type!=MoverType.SELF)throw new AssertionError(type);d.query("move "+vector(v));try{position.set(this,new Vec3(0,number(d.f.get("after_y")),0));}catch(ReflectiveOperationException e){throw new AssertionError(e);}horizontalCollision=d.flag("after_horizontal");jumping=d.flag("after_jumping");wasInPowderSnow=d.flag("after_snow");if(d.flag("move_mutate"))d.velocity=vec(d.f.get("after_velocity"));} + @Override public boolean is(TagKey> tag){if(tag==EntityTypeTags.CAN_FLOAT_WHILE_RIDDEN){d.query("float-tag");return d.flag("float_tag");}if(tag!=EntityTypeTags.POWDER_SNOW_WALKABLE_MOBS)throw new AssertionError(tag);d.query("powder-tag");return d.flag("powder_tag");} + @Override public ItemStack getItemBySlot(EquipmentSlot slot){if(slot!=EquipmentSlot.FEET)throw new AssertionError(slot);d.query("feet");return d.flag("boots")?BOOTS:ItemStack.EMPTY;} + @Override public MobEffectInstance getEffect(Holder effect){if(effect!=MobEffects.LEVITATION)throw new AssertionError(effect);d.query("levitation");return effect(d,effect);} + @Override protected double getEffectiveGravity(){d.query("gravity");return number(d.f.get("gravity"));} + @Override public boolean shouldDiscardFriction(){d.query("discard");return d.flag("discard");} + @Override public boolean isInWater(){d.query("water");return d.flag("water");} + @Override public boolean isSprinting(){d.query("sprint");return d.sequence("sprint",d.sprintCalls++);} + @Override protected float getWaterSlowDown(){d.query("slow-down");return single(d.f.get("slow_down"));} + @Override public boolean hasEffect(Holder effect){if(effect!=MobEffects.DOLPHINS_GRACE)throw new AssertionError(effect);d.query("dolphin");return d.flag("dolphin");} + @Override public double getFluidHeight(TagKey tag){String name=tag==FluidTags.LAVA?"lava":tag==FluidTags.ENTITY_FLOATABLE?"floatable":null;if(name==null)throw new AssertionError(tag);d.query("height "+name);return number(d.f.get(name+"_height"));} + @Override public double getFluidJumpThreshold(){d.query("threshold");return number(d.f.get("threshold"));} + @Override public boolean isFree(double x,double y,double z){d.query("free "+vector(new Vec3(x,y,z)));if(d.flag("free_mutate"))d.velocity=new Vec3(31,32,33);return d.flag("free");} + @Override public boolean isVehicle(){d.query("vehicle");return d.flag("vehicle");} + @Override protected boolean omnidirectionalAirMover(){d.query("omni");return d.flag("omni");} + } + static final class Human extends net.minecraft.world.entity.player.Player {Human(){super(null,null);} + Data d; + void configure(Level l){setLevel(l);} + @Override public BlockPos getBlockPosBelowThatAffectsMyMovement(){d.query("support");return new BlockPos(17,-64,-33);} + @Override public boolean onGround(){d.query("ground");return d.sequence("ground",d.groundCalls++);} + @Override public double getAttributeValue(Holder attribute){if(attribute==Attributes.WATER_MOVEMENT_EFFICIENCY){d.query("efficiency");return number(d.f.get("efficiency"));}String n=attribute==Attributes.FRICTION_MODIFIER?"friction":attribute==Attributes.AIR_DRAG_MODIFIER?"drag":null;if(n==null)throw new AssertionError(attribute);d.query(n+"-modifier");return number(d.f.get(n+"_modifier"));} + @Override public float getSpeed(){d.query("speed");return single(d.f.get("speed"));} + @Override protected float getFlyingSpeed(){d.query("flying-speed");return single(d.f.get("flying_speed"));} + @Override public float getYRot(){d.query("yaw");if(d.flag("yaw_mutate"))d.velocity=new Vec3(17,18,19);return single(d.f.get("yaw"));} + @Override public Vec3 getDeltaMovement(){return d.velocity;} + @Override public void setDeltaMovement(Vec3 v){d.query("set "+vector(v));d.velocity=v;} + @Override public boolean onClimbable(){d.query("climb");return d.sequence("climb",d.climbCalls++);} + @Override public void resetFallDistance(){d.query("reset");fallDistance=0;} + @Override public BlockState getInBlockState(){d.query("in-block");return (d.flag("scaffolding")?Blocks.SCAFFOLDING:Blocks.STONE).defaultBlockState();} + @Override public boolean isSuppressingSlidingDownLadder(){d.query("suppress");return d.flag("suppress");} + @Override public void move(MoverType type,Vec3 v){if(type!=MoverType.SELF)throw new AssertionError(type);d.query("move "+vector(v));try{position.set(this,new Vec3(0,number(d.f.get("after_y")),0));}catch(ReflectiveOperationException e){throw new AssertionError(e);}horizontalCollision=d.flag("after_horizontal");jumping=d.flag("after_jumping");wasInPowderSnow=d.flag("after_snow");if(d.flag("move_mutate"))d.velocity=vec(d.f.get("after_velocity"));} + @Override public boolean is(TagKey> tag){if(tag==EntityTypeTags.CAN_FLOAT_WHILE_RIDDEN){d.query("float-tag");return d.flag("float_tag");}if(tag!=EntityTypeTags.POWDER_SNOW_WALKABLE_MOBS)throw new AssertionError(tag);d.query("powder-tag");return d.flag("powder_tag");} + @Override public ItemStack getItemBySlot(EquipmentSlot slot){if(slot!=EquipmentSlot.FEET)throw new AssertionError(slot);d.query("feet");return d.flag("boots")?BOOTS:ItemStack.EMPTY;} + @Override public MobEffectInstance getEffect(Holder effect){if(effect!=MobEffects.LEVITATION)throw new AssertionError(effect);d.query("levitation");return effect(d,effect);} + @Override protected double getEffectiveGravity(){d.query("gravity");return number(d.f.get("gravity"));} + @Override public boolean shouldDiscardFriction(){d.query("discard");return d.flag("discard");} + @Override public boolean isInWater(){d.query("water");return d.flag("water");} + @Override public boolean isSprinting(){d.query("sprint");return d.sequence("sprint",d.sprintCalls++);} + @Override protected float getWaterSlowDown(){d.query("slow-down");return single(d.f.get("slow_down"));} + @Override public boolean hasEffect(Holder effect){if(effect!=MobEffects.DOLPHINS_GRACE)throw new AssertionError(effect);d.query("dolphin");return d.flag("dolphin");} + @Override public double getFluidHeight(TagKey tag){String name=tag==FluidTags.LAVA?"lava":tag==FluidTags.ENTITY_FLOATABLE?"floatable":null;if(name==null)throw new AssertionError(tag);d.query("height "+name);return number(d.f.get(name+"_height"));} + @Override public double getFluidJumpThreshold(){d.query("threshold");return number(d.f.get("threshold"));} + @Override public boolean isFree(double x,double y,double z){d.query("free "+vector(new Vec3(x,y,z)));if(d.flag("free_mutate"))d.velocity=new Vec3(31,32,33);return d.flag("free");} + @Override public boolean isVehicle(){d.query("vehicle");return d.flag("vehicle");} + @Override protected boolean omnidirectionalAirMover(){d.query("omni");return d.flag("omni");} + @Override public net.minecraft.world.level.GameType gameMode(){return net.minecraft.world.level.GameType.SURVIVAL;} + } + static Method method(Class owner,String name,Class... args)throws Exception{var m=owner.getDeclaredMethod(name,args);m.setAccessible(true);return m;} + public static void main(String[] args)throws Exception{ + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();var u=Class.forName("sun.misc.Unsafe");var uf=u.getDeclaredField("theUnsafe");uf.setAccessible(true);var unsafe=uf.get(null);var allocate=u.getMethod("allocateInstance",Class.class); + amplifier=MobEffectInstance.class.getDeclaredField("amplifier");amplifier.setAccessible(true);BOOTS=(ItemStack)allocate.invoke(unsafe,ItemStack.class);var stackItem=ItemStack.class.getDeclaredField("item");stackItem.setAccessible(true);stackItem.set(BOOTS,Items.LEATHER_BOOTS.builtInRegistryHolder());var stackCount=ItemStack.class.getDeclaredField("count");stackCount.setAccessible(true);stackCount.setInt(BOOTS,1); + var fluid=method(LivingEntity.class,"travelInFluid",Vec3.class);var water=method(LivingEntity.class,"travelInWater",Vec3.class,double.class,boolean.class,double.class);var lava=method(LivingEntity.class,"travelInLava",Vec3.class,double.class,boolean.class,double.class);var adjust=method(LivingEntity.class,"getFluidFallingAdjustedMovement",double.class,boolean.class,Vec3.class);var jump=method(LivingEntity.class,"jumpOutOfFluid",double.class);var floatLiquid=method(LivingEntity.class,"floatInLiquidWhileRidden",TagKey.class); + var air=method(LivingEntity.class,"travelInAir",Vec3.class);var relative=method(LivingEntity.class,"handleRelativeFrictionAndCalculateMovement",Vec3.class,float.class);var climb=method(LivingEntity.class,"handleOnClimbable",Vec3.class);var speed=method(LivingEntity.class,"getFrictionInfluencedSpeed",float.class);var input=method(Entity.class,"getInputVector",Vec3.class,float.class,float.class);var friction=method(LivingEntity.class,"computeModifiedFriction",float.class,float.class);position=Entity.class.getDeclaredField("position");position.setAccessible(true);var jumping=LivingEntity.class.getDeclaredField("jumping");jumping.setAccessible(true);Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){ + var f=JsonParser.parseString(line).getAsJsonObject();var d=new Data();d.f=f;d.out=out;d.velocity=vec(f.get("velocity"));var level=(Level)allocate.invoke(unsafe,Level.class);level.d=d;var block=(FrictionBlock)allocate.invoke(unsafe,FrictionBlock.class);block.d=d;var state=(State)allocate.invoke(unsafe,State.class);state.block=block;level.state=state; + LivingEntity entity;if(d.flag("player")){var e=(Human)allocate.invoke(unsafe,Human.class);e.d=d;e.configure(level);entity=e;}else{var e=(Actor)allocate.invoke(unsafe,Actor.class);e.d=d;e.configure(level);entity=e;}position.set(entity,new Vec3(0,number(f.get("y")),0));entity.fallDistance=number(f.get("fall"));entity.horizontalCollision=d.flag("horizontal");jumping.setBoolean(entity,d.flag("jumping"));entity.wasInPowderSnow=d.flag("snow"); + try{Object result=switch(f.get("mode").getAsString()){case "fluid"->fluid.invoke(entity,vec(f.get("input")));case "water"->water.invoke(entity,vec(f.get("input")),number(f.get("gravity")),d.flag("falling"),number(f.get("old_y")));case "lava"->lava.invoke(entity,vec(f.get("input")),number(f.get("gravity")),d.flag("falling"),number(f.get("old_y")));case "adjust"->adjust.invoke(entity,number(f.get("gravity")),d.flag("falling"),vec(f.get("input")));case "jump"->jump.invoke(entity,number(f.get("old_y")));case "float"->floatLiquid.invoke(entity,FluidTags.ENTITY_FLOATABLE);case "air"->air.invoke(entity,vec(f.get("input")));case "relative"->relative.invoke(entity,vec(f.get("input")),single(f.get("friction")));case "climb"->climb.invoke(entity,vec(f.get("input")));case "speed"->speed.invoke(entity,single(f.get("friction")));case "input"->input.invoke(null,vec(f.get("input")),single(f.get("speed")),single(f.get("yaw")));case "friction"->friction.invoke(null,single(f.get("friction")),(float)number(f.get("friction_modifier")));default->throw new AssertionError();};if(result instanceof Vec3 v)out.println("vector "+vector(v));else if(result instanceof Float v)out.printf("float %08x%n",Float.floatToIntBits(v));out.println("result ok");}catch(InvocationTargetException e){if(e.getCause() instanceof Stop)out.println("result error");else throw e;} + out.printf("final %s %016x%n",vector(d.velocity),Double.doubleToLongBits(entity.fallDistance));out.println("queries "+d.calls); + }} + } +} diff --git a/tools/test_living_fluid_parity.py b/tools/test_living_fluid_parity.py new file mode 100644 index 000000000..297c1de47 --- /dev/null +++ b/tools/test_living_fluid_parity.py @@ -0,0 +1,93 @@ +#!/usr/bin/env python3 +"""Compare LivingEntity water/lava travel and fluid velocity updates with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + def bits(v):return struct.pack('>d',float(v)).hex() + def single(v):return struct.pack('>f',float(v)).hex() + def row(**kw): + f=dict(mode='fluid',input=[.4,0,.8],velocity=[.1,-.08,-.2],after_velocity=[.3,-.6,.9],fall=6,friction=.6,friction_modifier=1,drag_modifier=1,speed=.1,flying_speed=.02,yaw=37,ground=[True,True],climb=[False,False],scaffolding=False,suppress=False,player=False,horizontal=False,jumping=False,snow=False,after_horizontal=False,after_jumping=False,after_snow=False,powder_tag=False,boots=False,levitation=None,client=False,chunk=True,gravity=.08,y=64,min_y=-64,discard=False,omni=False,yaw_mutate=False,move_mutate=False,fail=-1) + f.update(water=True,sprint=[False],slow_down=.8,efficiency=0,dolphin=False,lava_height=1,floatable_height=0,threshold=.4,free=False,vehicle=False,float_tag=False,free_mutate=False,falling=True,old_y=64,after_y=64) + f.update(kw) + for k in ['input','velocity','after_velocity']:f[k]=[bits(v) for v in f[k]] + for k in ['fall','friction_modifier','drag_modifier','gravity','y','efficiency','lava_height','floatable_height','threshold','old_y','after_y']:f[k]=bits(f[k]) + for k in ['friction','speed','flying_speed','yaw','slow_down']:f[k]=single(f[k]) + return f + vals=[-float('inf'),-1e30,-1,-.15,-.003,-1e-40,-0.0,0,1e-40,.002,.003,.005,.008,.08,.15,.6,.91,.98,1,2,1e30,float('inf'),float('nan')] + for gravity in vals: + for y in vals+[math.nextafter(.002,0),math.nextafter(.002,1),math.nextafter(.008,0),math.nextafter(.008,1)]: + for falling in [False,True]: + for sprint in [False,True]:yield row(mode='adjust',input=[-0.0,y,float('nan')],gravity=gravity,falling=falling,sprint=[sprint]) + for efficiency in vals: + for slowdown in vals: + for ground in [False,True]: + for dolphin in [False,True]: + for sprint in [[False],[True],[False,True],[True,False]]:yield row(mode='water',efficiency=efficiency,slow_down=slowdown,ground=[ground],dolphin=dolphin,sprint=sprint) + for height in vals: + for threshold in vals: + for gravity in [-0.0,.08,float('nan')]: + for falling in [False,True]:yield row(mode='lava',lava_height=height,threshold=threshold,gravity=gravity,falling=falling,move_mutate=True) + for mode in ['water','lava','fluid','jump','float']: + for mask in range(256): + f={k:bool(mask&(1< Date: Wed, 7 Oct 2026 02:36:01 +0200 Subject: [PATCH 090/253] Match living jump, gravity and flight parameter calculations --- .../scoped-parity.json | 228 ++++++++++++++++++ .../examples/living_motion_fixture.rs | 164 +++++++++++++ crates/horizon-world/src/lib.rs | 1 + crates/horizon-world/src/living_motion.rs | 124 ++++++++++ docs/collision-geometry.md | 15 ++ .../parity/VanillaLivingMotionOracle.java | 42 ++++ tools/test_living_motion_parity.py | 96 ++++++++ 7 files changed, 670 insertions(+) create mode 100644 benchmarks/rust-living-motion-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/living_motion_fixture.rs create mode 100644 crates/horizon-world/src/living_motion.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingMotionOracle.java create mode 100644 tools/test_living_motion_parity.py diff --git a/benchmarks/rust-living-motion-2026-10-07/scoped-parity.json b/benchmarks/rust-living-motion-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..5860939d5 --- /dev/null +++ b/benchmarks/rust-living-motion-2026-10-07/scoped-parity.json @@ -0,0 +1,228 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 18610, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingMotionOracle.java": "535cf4290c65b268fa7a258098fe6b687716ea3b4abf882cd60324c98f278d9d", + "tools/test_living_motion_parity.py": "8fe13a4f06beeb2e9edf322aee0120355a946fe8e0849c7ecee27dd6521d08ae", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "898a89475695fe1ca7f206f1d18cc548588f804899caa43c4a308edfa2a72d06", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "a5021a168adcedc37d77f533a8921c02f09c59f46a01737586aaa33c5908b8d0", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/living_motion_fixture.rs": "f1ea835163c5b8168116f7b1e1af8e3c3312d5e8ab0f34c4dbde86dae6f4547e" + }, + "fixtures_sha256": { + ".local/rust-living-motion-parity/inputs.txt": "8603f89da46ca7e28eb08aa3e7ad314eeb3ae3ef572232361fb1d15d49c47822" + }, + "rust_output_sha256": "2d3b0d5b24dcc43fae025ec2b617ad433234634be55d9440ccbab8dba3eea1c6", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "2d3b0d5b24dcc43fae025ec2b617ad433234634be55d9440ccbab8dba3eea1c6", + "matched_output_lines": 113623 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "2d3b0d5b24dcc43fae025ec2b617ad433234634be55d9440ccbab8dba3eea1c6", + "matched_output_lines": 113623 + } + ], + "scope": "Actual default living jump power/boost/from-ground, gravity/effective-gravity, vertical liquid inputs, rider flight speed, air drag, Entity.applyGravity and finite addDeltaMovement. Traces field writes and lazy attribute/effect callbacks, both passenger classes, signed zero/nonfinite arithmetic, integer amplifier edges, callback mutations and failures. Effect amplifier fields are injected directly at boundaries. Entity-type jump/flight overrides, full effect/attribute storage, registered jump-factor binding and live gameplay integration remain pending." +} diff --git a/crates/horizon-world/examples/living_motion_fixture.rs b/crates/horizon-world/examples/living_motion_fixture.rs new file mode 100644 index 000000000..92b4db938 --- /dev/null +++ b/crates/horizon-world/examples/living_motion_fixture.rs @@ -0,0 +1,164 @@ +use horizon_core::geometry::Vec3; +use horizon_world::living_motion::*; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn single(v: &Value) -> f32 { + f32::from_bits(u32::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn vec(v: &Value) -> Vec3 { + Vec3::new(number(&v[0]), number(&v[1]), number(&v[2])) +} +fn bits(v: f64) -> u64 { + if v.is_nan() { + 0x7ff8000000000000 + } else { + v.to_bits() + } +} +fn fbits(v: f32) -> u32 { + if v.is_nan() { 0x7fc00000 } else { v.to_bits() } +} +fn vector(v: Vec3) -> String { + format!("{:016x} {:016x} {:016x}", bits(v.x), bits(v.y), bits(v.z)) +} +struct World<'a> { + f: &'a Value, + out: &'a mut dyn Write, + calls: i64, + velocity: Vec3, + sync: bool, +} +impl World<'_> { + fn flag(&self, k: &str) -> bool { + self.f[k].as_bool().unwrap() + } + fn query(&mut self, s: impl AsRef) -> io::Result<()> { + writeln!(self.out, "{}", s.as_ref())?; + let n = self.calls; + self.calls += 1; + if n == self.f["fail"].as_i64().unwrap() { + return Err(io::Error::other("injected motion failure")); + } + if n == self.f["mutate_at"].as_i64().unwrap() { + self.velocity = vec(&self.f["after_velocity"]); + } + Ok(()) + } +} +impl LivingMotionWorld for World<'_> { + type Error = io::Error; + fn velocity(&self) -> Vec3 { + self.velocity + } + fn set_velocity(&mut self, v: Vec3) -> io::Result<()> { + self.query(format!("set {}", vector(v)))?; + self.velocity = v; + Ok(()) + } + fn jump_strength(&mut self) -> io::Result { + self.query("strength")?; + Ok(number(&self.f["strength"])) + } + fn block_jump_factor(&mut self) -> io::Result { + self.query("block-factor")?; + Ok(single(&self.f["block_factor"])) + } + fn has_jump_boost(&mut self) -> io::Result { + self.query("has-boost")?; + Ok(self.flag("boost")) + } + fn jump_boost_amplifier(&mut self) -> io::Result { + self.query("get-boost")?; + Ok(self.f["amplifier"].as_i64().unwrap() as i32) + } + fn sprinting(&mut self) -> io::Result { + self.query("sprint")?; + Ok(self.flag("sprint")) + } + fn yaw(&mut self) -> io::Result { + self.query("yaw")?; + Ok(single(&self.f["yaw"])) + } + fn mark_needs_sync(&mut self) { + self.sync = true; + } + fn no_gravity(&mut self) -> io::Result { + self.query("no-gravity")?; + Ok(self.flag("no_gravity")) + } + fn gravity_attribute(&mut self) -> io::Result { + self.query("gravity")?; + Ok(number(&self.f["gravity"])) + } + fn has_slow_falling(&mut self) -> io::Result { + self.query("slow-falling")?; + Ok(self.flag("slow_falling")) + } + fn controlling_passenger_is_player(&mut self) -> io::Result { + self.query("passenger")?; + Ok(self.f["passenger"].as_i64().unwrap() == 2) + } + fn speed(&mut self) -> io::Result { + self.query("speed")?; + Ok(single(&self.f["speed"])) + } + fn omnidirectional_air_mover(&mut self) -> io::Result { + self.query("omni")?; + Ok(self.flag("omni")) + } + fn air_drag_modifier(&mut self) -> io::Result { + self.query("drag-modifier")?; + Ok(number(&self.f["drag_modifier"])) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut w = World { + f: &f, + out: &mut out, + calls: 0, + velocity: vec(&f["velocity"]), + sync: f["sync"].as_bool().unwrap(), + }; + let result: io::Result<()> = match f["mode"].as_str().unwrap() { + "boost" => { + jump_boost_power(&mut w).and_then(|v| writeln!(w.out, "float {:08x}", fbits(v))) + } + "power" => jump_power(&mut w, single(&f["scale"])) + .and_then(|v| writeln!(w.out, "float {:08x}", fbits(v))), + "jump" => jump_from_ground(&mut w), + "gravity" => gravity(&mut w).and_then(|v| writeln!(w.out, "double {:016x}", bits(v))), + "effective" => { + effective_gravity(&mut w).and_then(|v| writeln!(w.out, "double {:016x}", bits(v))) + } + "apply" => apply_gravity(&mut w), + "up" => swim_vertical(&mut w, true), + "down" => swim_vertical(&mut w, false), + "speed" => { + default_flying_speed(&mut w).and_then(|v| writeln!(w.out, "float {:08x}", fbits(v))) + } + "drag" => air_drag(&mut w).and_then(|v| writeln!(w.out, "float {:08x}", fbits(v))), + "add" => add_delta_movement(&mut w, vec(&f["delta"])), + _ => panic!("mode"), + }; + writeln!( + w.out, + "result {}", + if result.is_ok() { "ok" } else { "error" } + )?; + writeln!(w.out, "final {} {}", vector(w.velocity), w.sync)?; + writeln!(w.out, "queries {}", w.calls)?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 4a5e7848a..24458928c 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -32,6 +32,7 @@ pub mod living_air; pub mod living_fall; pub mod living_fluid; pub mod living_landing; +pub mod living_motion; pub mod movement_emission; pub mod movement_properties; pub mod movement_restitution; diff --git a/crates/horizon-world/src/living_motion.rs b/crates/horizon-world/src/living_motion.rs new file mode 100644 index 000000000..b44da8b7b --- /dev/null +++ b/crates/horizon-world/src/living_motion.rs @@ -0,0 +1,124 @@ +//! Default living jump, gravity, flight-speed and air-drag calculations. +use crate::living_air::modified_friction; +use horizon_core::geometry::{Vec3, trig}; + +pub trait LivingMotionWorld { + type Error; + fn velocity(&self) -> Vec3; + fn set_velocity(&mut self, velocity: Vec3) -> Result<(), Self::Error>; + fn jump_strength(&mut self) -> Result; + fn block_jump_factor(&mut self) -> Result; + fn has_jump_boost(&mut self) -> Result; + fn jump_boost_amplifier(&mut self) -> Result; + fn sprinting(&mut self) -> Result; + fn yaw(&mut self) -> Result; + fn mark_needs_sync(&mut self); + fn no_gravity(&mut self) -> Result; + fn gravity_attribute(&mut self) -> Result; + fn has_slow_falling(&mut self) -> Result; + fn controlling_passenger_is_player(&mut self) -> Result; + fn speed(&mut self) -> Result; + fn omnidirectional_air_mover(&mut self) -> Result; + fn air_drag_modifier(&mut self) -> Result; +} +pub fn jump_boost_power(world: &mut W) -> Result { + Ok(if world.has_jump_boost()? { + 0.1f32 * (world.jump_boost_amplifier()? as f32 + 1.0) + } else { + 0.0 + }) +} +pub fn jump_power(world: &mut W, scale: f32) -> Result { + let strength = world.jump_strength()? as f32 * scale; + let strength = strength * world.block_jump_factor()?; + Ok(strength + jump_boost_power(world)?) +} +/// Native addDeltaMovement ignores nonfinite additions, but does not reject +/// a nonfinite existing velocity or overflow in the resulting sum. +pub fn add_delta_movement( + world: &mut W, + delta: Vec3, +) -> Result<(), W::Error> { + if delta.x.is_finite() && delta.y.is_finite() && delta.z.is_finite() { + let old = world.velocity(); + world.set_velocity(Vec3::new(old.x + delta.x, old.y + delta.y, old.z + delta.z))?; + } + Ok(()) +} +pub fn jump_from_ground(world: &mut W) -> Result<(), W::Error> { + let power = jump_power(world, 1.0)?; + if power <= 1.0e-5f32 { + return Ok(()); + } + let mut velocity = world.velocity(); + velocity.y = if power.is_nan() || velocity.y.is_nan() { + f64::NAN + } else { + f64::from(power).max(velocity.y) + }; + world.set_velocity(velocity)?; + if world.sprinting()? { + let angle = f64::from(world.yaw()? * trig::DEG_TO_RAD); + add_delta_movement( + world, + Vec3::new( + f64::from(-trig::sin(angle)) * 0.2, + 0.0, + f64::from(trig::cos(angle)) * 0.2, + ), + )?; + } + world.mark_needs_sync(); + Ok(()) +} +pub fn gravity(world: &mut W) -> Result { + if world.no_gravity()? { + Ok(0.0) + } else { + world.gravity_attribute() + } +} +pub fn effective_gravity(world: &mut W) -> Result { + if world.velocity().y <= 0.0 && world.has_slow_falling()? { + let gravity = gravity(world)?; + Ok(if gravity.is_nan() { + gravity + } else { + gravity.min(0.01) + }) + } else { + gravity(world) + } +} +pub fn apply_gravity(world: &mut W) -> Result<(), W::Error> { + let gravity = gravity(world)?; + if gravity != 0.0 { + let old = world.velocity(); + world.set_velocity(Vec3::new(old.x + 0.0, old.y - gravity, old.z + 0.0))?; + } + Ok(()) +} +pub fn swim_vertical(world: &mut W, up: bool) -> Result<(), W::Error> { + let old = world.velocity(); + let amount = f64::from(0.04f32); + world.set_velocity(Vec3::new( + old.x + 0.0, + old.y + if up { amount } else { -amount }, + old.z + 0.0, + )) +} +pub fn default_flying_speed(world: &mut W) -> Result { + if world.controlling_passenger_is_player()? { + Ok(world.speed()? * 0.1f32) + } else { + Ok(0.02) + } +} +pub fn air_drag(world: &mut W) -> Result { + let drag = if world.omnidirectional_air_mover()? { + 0.91 + } else { + 0.98 + }; + Ok(modified_friction(drag, world.air_drag_modifier()? as f32)) +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 128a9b8a7..33b8ebcc7 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -870,3 +870,18 @@ float guards, nonfinite values, callback mutations and failures. Targeted Clippy passes. Collision movement, immersion depths, free-space queries, attributes and gravity are controlled; live fluid propagation and gameplay binding remain pending. + + +`living_motion` implements default living jump strength/boost, sprint jump +impulses, gravity and slow falling, vertical liquid input, rider flight speed +and air drag. Native finite-addition filtering and delayed synchronization flags +preserve partial writes when providers fail. + +`python3 tools/test_living_motion_parity.py` compares the corresponding actual +living methods plus `Entity.applyGravity` and `addDeltaMovement`. The +[jump and gravity report](../benchmarks/rust-living-motion-2026-10-07/scoped-parity.json) +records **113,623 matching lines per JAR**, including float thresholds, extreme +raw effect amplifiers, signed zero/nonfinite values, rider classes, callback +mutations and failures. Targeted Clippy passes. Entity-type jump/flight overrides, +effect and attribute storage, registered jump-factor binding and live gameplay +integration remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingMotionOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingMotionOracle.java new file mode 100644 index 000000000..1a05fa578 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingMotionOracle.java @@ -0,0 +1,42 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*;import java.lang.reflect.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.*;import net.minecraft.world.entity.*;import net.minecraft.world.entity.ai.attributes.*;import net.minecraft.world.effect.*;import net.minecraft.world.phys.Vec3; +/** Native default living jump, gravity and flight parameter methods. */ +public final class VanillaLivingMotionOracle { + static final class Stop extends RuntimeException {} + static Field amplifier; + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + static float single(JsonElement v){return Float.intBitsToFloat(Integer.parseUnsignedInt(v.getAsString(),16));} + static Vec3 vec(JsonElement v){var a=v.getAsJsonArray();return new Vec3(number(a.get(0)),number(a.get(1)),number(a.get(2)));} + static String vector(Vec3 v){return String.format("%016x %016x %016x",Double.doubleToLongBits(v.x),Double.doubleToLongBits(v.y),Double.doubleToLongBits(v.z));} + static final class Data {JsonObject f;PrintWriter out;int calls;Vec3 velocity;LivingEntity passenger; + void query(String s){out.println(s);int n=calls++;if(n==f.get("fail").getAsInt())throw new Stop();if(n==f.get("mutate_at").getAsInt())velocity=vec(f.get("after_velocity"));} + boolean flag(String k){return f.get(k).getAsBoolean();}} + static final class Human extends net.minecraft.world.entity.player.Player {Human(){super(null,null);}@Override public net.minecraft.world.level.GameType gameMode(){return net.minecraft.world.level.GameType.SURVIVAL;}} + static final class Actor extends net.minecraft.world.entity.decoration.ArmorStand { + Data d;Actor(){super(null,null);} + @Override public Vec3 getDeltaMovement(){return d.velocity;} + @Override public void setDeltaMovement(Vec3 v){d.query("set "+vector(v));d.velocity=v;} + @Override public double getAttributeValue(Holder attribute){String name=attribute==Attributes.JUMP_STRENGTH?"strength":attribute==Attributes.GRAVITY?"gravity":attribute==Attributes.AIR_DRAG_MODIFIER?"drag-modifier":null;if(name==null)throw new AssertionError(attribute);d.query(name);return number(d.f.get(name.replace('-','_')));} + @Override protected float getBlockJumpFactor(){d.query("block-factor");return single(d.f.get("block_factor"));} + @Override public boolean hasEffect(Holder effect){if(effect==MobEffects.JUMP_BOOST){d.query("has-boost");return d.flag("boost");}if(effect==MobEffects.SLOW_FALLING){d.query("slow-falling");return d.flag("slow_falling");}throw new AssertionError(effect);} + @Override public MobEffectInstance getEffect(Holder effect){if(effect!=MobEffects.JUMP_BOOST)throw new AssertionError(effect);d.query("get-boost");var e=new MobEffectInstance(effect,100,0);try{amplifier.setInt(e,d.f.get("amplifier").getAsInt());}catch(ReflectiveOperationException ex){throw new AssertionError(ex);}return e;} + @Override public boolean isSprinting(){d.query("sprint");return d.flag("sprint");} + @Override public float getYRot(){d.query("yaw");return single(d.f.get("yaw"));} + @Override public boolean isNoGravity(){d.query("no-gravity");return d.flag("no_gravity");} + @Override public LivingEntity getControllingPassenger(){d.query("passenger");return d.passenger;} + @Override public float getSpeed(){d.query("speed");return single(d.f.get("speed"));} + @Override protected boolean omnidirectionalAirMover(){d.query("omni");return d.flag("omni");} + } + static Method method(Class c,String name,Class... args)throws Exception{var m=c.getDeclaredMethod(name,args);m.setAccessible(true);return m;} + public static void main(String[] args)throws Exception{ + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();var u=Class.forName("sun.misc.Unsafe");var uf=u.getDeclaredField("theUnsafe");uf.setAccessible(true);var unsafe=uf.get(null);var allocate=u.getMethod("allocateInstance",Class.class);amplifier=MobEffectInstance.class.getDeclaredField("amplifier");amplifier.setAccessible(true); + var power=method(LivingEntity.class,"getJumpPower",float.class);var effective=method(LivingEntity.class,"getEffectiveGravity");var apply=method(Entity.class,"applyGravity");var up=method(LivingEntity.class,"jumpInLiquid",net.minecraft.tags.TagKey.class);var down=method(LivingEntity.class,"goDownInWater");var speed=method(LivingEntity.class,"getFlyingSpeed");var drag=method(LivingEntity.class,"getAirDrag");Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){ + var f=JsonParser.parseString(line).getAsJsonObject();var d=new Data();d.f=f;d.out=out;d.velocity=vec(f.get("velocity"));int p=f.get("passenger").getAsInt();d.passenger=p==0?null:(LivingEntity)allocate.invoke(unsafe,p==2?Human.class:Actor.class);var entity=(Actor)allocate.invoke(unsafe,Actor.class);entity.d=d;entity.needsSync=d.flag("sync"); + try{Object result=switch(f.get("mode").getAsString()){case "boost"->entity.getJumpBoostPower();case "power"->power.invoke(entity,single(f.get("scale")));case "jump"->{entity.jumpFromGround();yield null;}case "gravity"->entity.getGravity();case "effective"->effective.invoke(entity);case "apply"->apply.invoke(entity);case "up"->up.invoke(entity,net.minecraft.tags.FluidTags.WATER);case "down"->down.invoke(entity);case "speed"->speed.invoke(entity);case "drag"->drag.invoke(entity);case "add"->{entity.addDeltaMovement(vec(f.get("delta")));yield null;}default->throw new AssertionError();};if(result instanceof Float v)out.printf("float %08x%n",Float.floatToIntBits(v));else if(result instanceof Double v)out.printf("double %016x%n",Double.doubleToLongBits(v));out.println("result ok");}catch(Stop e){out.println("result error");}catch(InvocationTargetException e){if(e.getCause() instanceof Stop)out.println("result error");else throw e;} + out.println("final "+vector(d.velocity)+" "+entity.needsSync);out.println("queries "+d.calls); + }} + } +} diff --git a/tools/test_living_motion_parity.py b/tools/test_living_motion_parity.py new file mode 100644 index 000000000..8d0de6de7 --- /dev/null +++ b/tools/test_living_motion_parity.py @@ -0,0 +1,96 @@ +#!/usr/bin/env python3 +"""Compare default living jump, gravity and flight parameters with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + def bits(v):return struct.pack('>d',float(v)).hex() + def single(v):return struct.pack('>f',float(v)).hex() + def row(**kw): + f=dict(mode='jump',velocity=[.1,-.08,.2],delta=[0,.2,0],after_velocity=[17,18,19],strength=.42,block_factor=1,scale=1,boost=False,amplifier=0,sprint=False,yaw=37,sync=False,no_gravity=False,gravity=.08,slow_falling=False,passenger=0,speed=.1,omni=False,drag_modifier=1,fail=-1,mutate_at=-1) + f.update(kw) + for k in ['velocity','delta','after_velocity']:f[k]=[bits(v) for v in f[k]] + for k in ['strength','gravity','drag_modifier']:f[k]=bits(f[k]) + for k in ['block_factor','scale','yaw','speed']:f[k]=single(f[k]) + return f + vals=[-float('inf'),-1e30,-1,-.01,-1e-40,-0.0,0,1e-40,1e-5,.01,.1,.42,1,2,1e30,float('inf'),float('nan')] + for strength in vals+[.000009999999,.000010000001]: + for factor in vals: + for scale in [-1,0,.5,1,float('nan')]: + for boost in [False,True]:yield row(mode='power',strength=strength,block_factor=factor,scale=scale,boost=boost,amplifier=2) + for amplifier in [-2147483648,-1,0,1,255,16777215,16777216,2147483647]: + for boost in [False,True]:yield row(mode='boost',amplifier=amplifier,boost=boost) + for strength in vals+[.000009999999,.000010000001]: + for vy in vals: + for sprint in [False,True]: + for sync in [False,True]:yield row(strength=strength,velocity=[-0.0,vy,-0.0],sprint=sprint,sync=sync) + for yaw in [*vals,*[i*360/1024 for i in range(1024)]]:yield row(sprint=True,yaw=yaw) + for mode in ['gravity','effective','apply']: + for gravity in vals: + for vy in vals: + for no_gravity in [False,True]: + for slow_falling in [False,True]:yield row(mode=mode,gravity=gravity,velocity=[-0.0,vy,-0.0],no_gravity=no_gravity,slow_falling=slow_falling) + for speed in vals: + for passenger in [0,1,2]:yield row(mode='speed',speed=speed,passenger=passenger) + for drag_modifier in vals: + for omni in [False,True]:yield row(mode='drag',drag_modifier=drag_modifier,omni=omni) + vectors=[[0,0,0],[-0.0,-0.0,-0.0],[.1,.2,.3],[1,float('nan'),2],[float('inf'),0,0],[-float('inf'),1,0],[1.7976931348623157e308,1.7976931348623157e308,1.7976931348623157e308]] + for v in vectors: + for delta in vectors: + for mode in ['add','up','down']:yield row(mode=mode,velocity=v,delta=delta) + modes=['boost','power','jump','gravity','effective','apply','up','down','speed','drag','add'] + for mode in modes: + for fail in range(-1,10): + for mutate_at in range(-1,10):yield row(mode=mode,fail=fail,mutate_at=mutate_at,boost=True,sprint=True,slow_falling=True,passenger=2) + rng=random.Random(0x4a554d50) + for _ in range(8000): + f={k:bool(rng.randrange(2)) for k in ['boost','sprint','sync','no_gravity','slow_falling','omni']} + for k in ['strength','gravity','drag_modifier','block_factor','scale','yaw','speed']:f[k]=rng.choice(vals) if rng.randrange(3)==0 else rng.uniform(-1,2) + yield row(**f,mode=rng.choice(modes),velocity=rng.choice(vectors),delta=rng.choice(vectors),after_velocity=rng.choice(vectors),amplifier=rng.choice([-2147483648,-1,0,1,255,2147483647]),passenger=rng.randrange(3),fail=rng.choice([-1,-1,*range(10)]),mutate_at=rng.randrange(-1,10)) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-living-motion-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingMotionOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/living_motion_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaLivingMotionOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','living_motion_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('living_motion_fixture.exe' if os.name=='nt' else 'living_motion_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} living-motion output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual default living jump power/boost/from-ground, gravity/effective-gravity, vertical liquid inputs, rider flight speed, air drag, Entity.applyGravity and finite addDeltaMovement. Traces field writes and lazy attribute/effect callbacks, both passenger classes, signed zero/nonfinite arithmetic, integer amplifier edges, callback mutations and failures. Effect amplifier fields are injected directly at boundaries. Entity-type jump/flight overrides, full effect/attribute storage, registered jump-factor binding and live gameplay integration remain pending.'} + lab.write_json(report_path,report);print(f'Scoped living motion parity passed: {report_path}') + + +if __name__=='__main__':main() From 8df023babffde3af4ff2f991568f3ccf79f4e8d4 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 02:39:16 +0200 Subject: [PATCH 091/253] Match player swimming and ability-flight travel wrapper --- .../scoped-parity.json | 229 ++++++++++++++++++ .../examples/player_travel_fixture.rs | 156 ++++++++++++ crates/horizon-world/src/lib.rs | 1 + crates/horizon-world/src/player_travel.rs | 71 ++++++ docs/collision-geometry.md | 16 ++ .../parity/VanillaPlayerTravelOracle.java | 42 ++++ tools/test_player_travel_parity.py | 82 +++++++ 7 files changed, 597 insertions(+) create mode 100644 benchmarks/rust-player-travel-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/player_travel_fixture.rs create mode 100644 crates/horizon-world/src/player_travel.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerTravelOracle.java create mode 100644 tools/test_player_travel_parity.py diff --git a/benchmarks/rust-player-travel-2026-10-07/scoped-parity.json b/benchmarks/rust-player-travel-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..1f6dffdf8 --- /dev/null +++ b/benchmarks/rust-player-travel-2026-10-07/scoped-parity.json @@ -0,0 +1,229 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 15446, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerTravelOracle.java": "67c4086332ff24e387e5bdf2d57a0cf600a2af602661d0a8f9db5b882a0a1a82", + "tools/test_player_travel_parity.py": "37026a8eae60f6f6198f980f634215b8ae1ace3a223c790be9d9b4d9d2b8a0c3", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "b567c6026fc08791caf85df55cfaa06b9e1413d51e0a593427ade6e025f7eba1", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "a5021a168adcedc37d77f533a8921c02f09c59f46a01737586aaa33c5908b8d0", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/player_travel_fixture.rs": "c52773da7223773565fe5685653caffec97d0ab83713ab91fcdbb1683b440f94" + }, + "fixtures_sha256": { + ".local/rust-player-travel-parity/inputs.txt": "8ab97e056004d2291ac9b66d1e89aed823c1236b2fbcc46b100e9b0d581cbd30" + }, + "rust_output_sha256": "e00866cdc3ebc3d82e51b1b6ecf9d57ea6b4ff526a5e92698152bd3fef490d5a", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "e00866cdc3ebc3d82e51b1b6ecf9d57ea6b4ff526a5e92698152bd3fef490d5a", + "matched_output_lines": 120933 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "e00866cdc3ebc3d82e51b1b6ecf9d57ea6b4ff526a5e92698152bd3fef490d5a", + "matched_output_lines": 120933 + } + ], + "scope": "Actual Player.travel, getFlyingSpeed and isAffectedByFluids. Covers passenger bypass, swim look pitch and head-fluid queries, flying vertical preservation, sprint speed, lazy ability access, provider mutations/failures, signed zero and nonfinite coordinates/velocity. Parent LivingEntity.travel selects an instrumented fluid branch; actual air/fluid collision simulation and full player/world gameplay remain separately pending integration." +} diff --git a/crates/horizon-world/examples/player_travel_fixture.rs b/crates/horizon-world/examples/player_travel_fixture.rs new file mode 100644 index 000000000..47adeaeb7 --- /dev/null +++ b/crates/horizon-world/examples/player_travel_fixture.rs @@ -0,0 +1,156 @@ +use horizon_core::{geometry::Vec3, position::BlockPos}; +use horizon_world::player_travel::*; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn single(v: &Value) -> f32 { + f32::from_bits(u32::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn vec(v: &Value) -> Vec3 { + Vec3::new(number(&v[0]), number(&v[1]), number(&v[2])) +} +fn bits(v: f64) -> u64 { + if v.is_nan() { + 0x7ff8000000000000 + } else { + v.to_bits() + } +} +fn fbits(v: f32) -> u32 { + if v.is_nan() { 0x7fc00000 } else { v.to_bits() } +} +fn vector(v: Vec3) -> String { + format!("{:016x} {:016x} {:016x}", bits(v.x), bits(v.y), bits(v.z)) +} +struct World<'a> { + f: &'a Value, + out: &'a mut dyn Write, + calls: i64, + velocity: Vec3, + position: Vec3, + flying: bool, +} +impl World<'_> { + fn flag(&self, k: &str) -> bool { + self.f[k].as_bool().unwrap() + } + fn query(&mut self, s: impl AsRef) -> io::Result<()> { + writeln!(self.out, "{}", s.as_ref())?; + let n = self.calls; + self.calls += 1; + if n == self.f["fail"].as_i64().unwrap() { + return Err(io::Error::other("injected player travel failure")); + } + if n == self.f["mutate_at"].as_i64().unwrap() { + self.velocity = vec(&self.f["after_velocity"]); + self.position = vec(&self.f["after_position"]); + self.flying = self.flag("after_flying"); + } + Ok(()) + } +} +impl PlayerTravelWorld for World<'_> { + type Error = io::Error; + fn is_passenger(&mut self) -> io::Result { + self.query("passenger")?; + Ok(self.flag("passenger")) + } + fn is_swimming(&mut self) -> io::Result { + self.query("swimming")?; + Ok(self.flag("swimming")) + } + fn look_angle(&mut self) -> io::Result { + self.query("look")?; + Ok(vec(&self.f["look"])) + } + fn jumping(&self) -> bool { + self.flag("jumping") + } + fn position(&self) -> Vec3 { + self.position + } + fn fluid_is_empty(&mut self, p: BlockPos) -> io::Result { + self.query(format!("fluid {} {} {}", p.x, p.y, p.z))?; + Ok(self.flag("empty")) + } + fn velocity(&self) -> Vec3 { + self.velocity + } + fn set_velocity(&mut self, v: Vec3) -> io::Result<()> { + self.query(format!("set {}", vector(v)))?; + self.velocity = v; + Ok(()) + } + fn query_flying_ability(&mut self) -> io::Result { + self.query("abilities")?; + Ok(self.flying) + } + fn flying_ability(&self) -> bool { + self.flying + } + fn ability_flying_speed(&mut self) -> io::Result { + self.query("ability-speed")?; + Ok(single(&self.f["speed"])) + } + fn sprinting(&mut self) -> io::Result { + self.query("sprint")?; + Ok(self.flag("sprint")) + } + fn living_travel(&mut self, input: Vec3) -> io::Result<()> { + // Native parent dispatch is exercised through a controlled fluid branch. + self.query("block-position")?; + self.query("fluid 17 -64 -33")?; + self.query("should-fluid")?; + self.query(format!("base {}", vector(input)))?; + if self.flag("base_mutate") { + self.velocity = vec(&self.f["base_velocity"]); + self.flying = self.flag("base_flying"); + } + Ok(()) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut w = World { + f: &f, + out: &mut out, + calls: 0, + velocity: vec(&f["velocity"]), + position: vec(&f["position"]), + flying: f["flying"].as_bool().unwrap(), + }; + let result: io::Result<()> = match f["mode"].as_str().unwrap() { + "travel" => travel(&mut w, vec(&f["input"])), + "speed" => flying_speed(&mut w).and_then(|v| writeln!(w.out, "float {:08x}", fbits(v))), + "affected" => { + let b = affected_by_fluids(&w); + writeln!(w.out, "bool {b}") + } + _ => panic!("mode"), + }; + writeln!( + w.out, + "result {}", + if result.is_ok() { "ok" } else { "error" } + )?; + writeln!( + w.out, + "final {} {} {}", + vector(w.velocity), + vector(w.position), + w.flying + )?; + writeln!(w.out, "queries {}", w.calls)?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 24458928c..765fa4968 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -40,6 +40,7 @@ pub mod movement_support; pub mod nbt; pub mod piston_movement; pub mod piston_shape; +pub mod player_travel; pub mod powder_snow_collision; pub mod region; pub mod registry; diff --git a/crates/horizon-world/src/player_travel.rs b/crates/horizon-world/src/player_travel.rs new file mode 100644 index 000000000..31fa31fd8 --- /dev/null +++ b/crates/horizon-world/src/player_travel.rs @@ -0,0 +1,71 @@ +//! Player-specific swimming and ability-flight behavior around living travel. +use horizon_core::{geometry::Vec3, position::BlockPos}; +pub trait PlayerTravelWorld { + type Error; + fn is_passenger(&mut self) -> Result; + fn is_swimming(&mut self) -> Result; + fn look_angle(&mut self) -> Result; + fn jumping(&self) -> bool; + fn position(&self) -> Vec3; + fn fluid_is_empty(&mut self, position: BlockPos) -> Result; + fn velocity(&self) -> Vec3; + fn set_velocity(&mut self, velocity: Vec3) -> Result<(), Self::Error>; + /// Virtual getAbilities(), as distinct from direct abilities-field reads. + fn query_flying_ability(&mut self) -> Result; + fn flying_ability(&self) -> bool; + fn ability_flying_speed(&mut self) -> Result; + fn sprinting(&mut self) -> Result; + fn living_travel(&mut self, input: Vec3) -> Result<(), Self::Error>; +} +pub fn travel(world: &mut W, input: Vec3) -> Result<(), W::Error> { + if world.is_passenger()? { + return world.living_travel(input); + } + if world.is_swimming()? { + let look_y = world.look_angle()?.y; + let scale = if look_y < -0.2 { 0.085 } else { 0.06 }; + let apply = if look_y <= 0.0 || world.jumping() { + true + } else { + let p = world.position(); + !world.fluid_is_empty(BlockPos::new( + p.x.floor() as i32, + (p.y + 1.0 - 0.1).floor() as i32, + p.z.floor() as i32, + ))? + }; + if apply { + let v = world.velocity(); + world.set_velocity(Vec3::new( + v.x + 0.0, + v.y + (look_y - v.y) * scale, + v.z + 0.0, + ))?; + } + } + if world.query_flying_ability()? { + let y = world.velocity().y; + world.living_travel(input)?; + let v = world.velocity(); + world.set_velocity(Vec3::new(v.x, y * 0.6, v.z))?; + } else { + world.living_travel(input)?; + } + Ok(()) +} +pub fn flying_speed(world: &mut W) -> Result { + if world.flying_ability() && !world.is_passenger()? { + let sprinting = world.sprinting()?; + let speed = world.ability_flying_speed()?; + Ok(if sprinting { speed * 2.0 } else { speed }) + } else { + Ok(if world.sprinting()? { + 0.025999999f32 + } else { + 0.02 + }) + } +} +pub fn affected_by_fluids(world: &W) -> bool { + !world.flying_ability() +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 33b8ebcc7..285e526c2 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -885,3 +885,19 @@ raw effect amplifiers, signed zero/nonfinite values, rider classes, callback mutations and failures. Targeted Clippy passes. Entity-type jump/flight overrides, effect and attribute storage, registered jump-factor binding and live gameplay integration remain pending. + + +`player_travel` wraps living travel with passenger bypass, swimming pitch +adjustment, head-fluid checks and preservation of creative-flight vertical +velocity. It also binds player flight speed to sprint/passenger/ability rules +and implements the flying ability's fluid-affection predicate. + +`python3 tools/test_player_travel_parity.py` invokes actual `Player.travel`, +`getFlyingSpeed` and `isAffectedByFluids`. The +[player travel report](../benchmarks/rust-player-travel-2026-10-07/scoped-parity.json) +records **120,933 matching lines per JAR**, including ability and velocity +mutations, callback failures, signed zero/nonfinite positions and the distinction +between direct ability fields and virtual ability access. Targeted Clippy passes. +Parent travel is selected through a controlled fluid callback; connecting the +verified living phases and collision movement to the live player/world remains +pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerTravelOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerTravelOracle.java new file mode 100644 index 000000000..d6a87ca73 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerTravelOracle.java @@ -0,0 +1,42 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*;import java.lang.reflect.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.*;import net.minecraft.world.entity.*;import net.minecraft.world.entity.player.*;import net.minecraft.world.level.material.*;import net.minecraft.world.phys.Vec3; +/** Actual Player travel wrapper and flight speed, with controlled parent fluid travel. */ +public final class VanillaPlayerTravelOracle { + static final class Stop extends RuntimeException {} + static Field position; + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + static float single(JsonElement v){return Float.intBitsToFloat(Integer.parseUnsignedInt(v.getAsString(),16));} + static Vec3 vec(JsonElement v){var a=v.getAsJsonArray();return new Vec3(number(a.get(0)),number(a.get(1)),number(a.get(2)));} + static String vector(Vec3 v){return String.format("%016x %016x %016x",Double.doubleToLongBits(v.x),Double.doubleToLongBits(v.y),Double.doubleToLongBits(v.z));} + static final class Data {JsonObject f;PrintWriter out;int calls;Vec3 velocity;Actor actor;Ability ability; + void query(String s){out.println(s);int n=calls++;if(n==f.get("fail").getAsInt())throw new Stop();if(n==f.get("mutate_at").getAsInt()){velocity=vec(f.get("after_velocity"));try{position.set(actor,vec(f.get("after_position")));}catch(ReflectiveOperationException e){throw new AssertionError(e);}ability.flying=flag("after_flying");}} + boolean flag(String k){return f.get(k).getAsBoolean();}} + static final class Ability extends Abilities {Data d;@Override public float getFlyingSpeed(){d.query("ability-speed");return single(d.f.get("speed"));}} + static final class Level extends net.minecraft.server.level.ServerLevel {Data d;Level(){super(null,null,null,null,null,null,false,0L,List.of(),false);} + @Override public FluidState getFluidState(BlockPos p){d.query("fluid "+p.getX()+" "+p.getY()+" "+p.getZ());return (d.flag("empty")?Fluids.EMPTY:Fluids.WATER).defaultFluidState();}} + static final class Actor extends Player { + Data d;Actor(){super(null,null);}void configure(Level l){setLevel(l);} + @Override public net.minecraft.world.level.GameType gameMode(){return net.minecraft.world.level.GameType.SURVIVAL;} + @Override public boolean isPassenger(){d.query("passenger");return d.flag("passenger");} + @Override public boolean isSwimming(){d.query("swimming");return d.flag("swimming");} + @Override public Vec3 getLookAngle(){d.query("look");return vec(d.f.get("look"));} + @Override public Vec3 getDeltaMovement(){return d.velocity;} + @Override public void setDeltaMovement(Vec3 v){d.query("set "+vector(v));d.velocity=v;} + @Override public Abilities getAbilities(){d.query("abilities");return d.ability;} + @Override public boolean isSprinting(){d.query("sprint");return d.flag("sprint");} + @Override public BlockPos blockPosition(){d.query("block-position");return new BlockPos(17,-64,-33);} + @Override protected boolean shouldTravelInFluid(FluidState fluid){d.query("should-fluid");return true;} + @Override protected void travelInFluid(Vec3 input){d.query("base "+vector(input));if(d.flag("base_mutate")){d.velocity=vec(d.f.get("base_velocity"));d.ability.flying=d.flag("base_flying");}} + float flightSpeed(){return getFlyingSpeed();} + } + public static void main(String[] args)throws Exception{ + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();var u=Class.forName("sun.misc.Unsafe");var uf=u.getDeclaredField("theUnsafe");uf.setAccessible(true);var unsafe=uf.get(null);var allocate=u.getMethod("allocateInstance",Class.class);position=Entity.class.getDeclaredField("position");position.setAccessible(true);var abilities=Player.class.getDeclaredField("abilities");abilities.setAccessible(true);var jumping=LivingEntity.class.getDeclaredField("jumping");jumping.setAccessible(true);Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){ + var f=JsonParser.parseString(line).getAsJsonObject();var d=new Data();d.f=f;d.out=out;d.velocity=vec(f.get("velocity"));var entity=(Actor)allocate.invoke(unsafe,Actor.class);d.actor=entity;entity.d=d;var level=(Level)allocate.invoke(unsafe,Level.class);level.d=d;entity.configure(level);var ability=new Ability();ability.d=d;ability.flying=d.flag("flying");d.ability=ability;abilities.set(entity,ability);position.set(entity,vec(f.get("position")));jumping.setBoolean(entity,d.flag("jumping")); + try{switch(f.get("mode").getAsString()){case "travel"->entity.travel(vec(f.get("input")));case "speed"->out.printf("float %08x%n",Float.floatToIntBits(entity.flightSpeed()));case "affected"->out.println("bool "+entity.isAffectedByFluids());default->throw new AssertionError();}out.println("result ok");}catch(Stop e){out.println("result error");} + out.println("final "+vector(d.velocity)+" "+vector((Vec3)position.get(entity))+" "+ability.flying);out.println("queries "+d.calls); + }} + } +} diff --git a/tools/test_player_travel_parity.py b/tools/test_player_travel_parity.py new file mode 100644 index 000000000..22926f6f0 --- /dev/null +++ b/tools/test_player_travel_parity.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python3 +"""Compare Player travel wrapper and flying speed with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + def bits(v):return struct.pack('>d',float(v)).hex() + def single(v):return struct.pack('>f',float(v)).hex() + def row(**kw): + f=dict(mode='travel',input=[.2,0,.8],velocity=[.1,-.08,.2],position=[.3,64,-.3],look=[0,.5,1],after_velocity=[17,18,19],after_position=[17,-64,-33],after_flying=False,base_velocity=[31,32,33],base_flying=False,base_mutate=True,passenger=False,swimming=True,jumping=False,empty=False,flying=True,sprint=False,speed=.05,fail=-1,mutate_at=-1) + f.update(kw) + for k in ['input','velocity','position','look','after_velocity','after_position','base_velocity']:f[k]=[bits(v) for v in f[k]] + f['speed']=single(f['speed']);return f + vals=[-float('inf'),-1e30,-1,-.20000000001,-.2,-.19999999999,-1e-40,-0.0,0,1e-40,.1,.5,1,1e30,float('inf'),float('nan')] + for y in vals: + for mask in range(128): + flags={k:bool(mask&(1< Date: Wed, 7 Oct 2026 02:43:07 +0200 Subject: [PATCH 092/253] Bind native climbing tags and trapdoor ladder support --- .../scoped-parity.json | 236 ++++++++++++++++++ .../examples/climbing_fixture.rs | 152 +++++++++++ crates/horizon-world/src/climbing.rs | 137 ++++++++++ crates/horizon-world/src/lib.rs | 1 + docs/collision-geometry.md | 16 ++ .../parity/VanillaClimbingOracle.java | 35 +++ tools/test_climbing_parity.py | 65 +++++ 7 files changed, 642 insertions(+) create mode 100644 benchmarks/rust-climbing-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/climbing_fixture.rs create mode 100644 crates/horizon-world/src/climbing.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaClimbingOracle.java create mode 100644 tools/test_climbing_parity.py diff --git a/benchmarks/rust-climbing-2026-10-07/scoped-parity.json b/benchmarks/rust-climbing-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..7a582732a --- /dev/null +++ b/benchmarks/rust-climbing-2026-10-07/scoped-parity.json @@ -0,0 +1,236 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 236234, + "registry_states": 35723, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaClimbingOracle.java": "ef4e58f3a1688e247998f2bc7126a73f6ec78c6fbf0682defecd7f063203d3cb", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "tools/test_climbing_parity.py": "d9c8c3b7e55db977ff346bd10aea14493de594a953696e84de65e422f96be54d", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-world/examples/climbing_fixture.rs": "e46c1bd290d579bb66491b353be0530b9d4779fbbd728ccff50fd8d843e6c178", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "8843e6f48dbbc4245ce4e95564dfba3a4d7a051ba0b1577fb038c07adb0ff0f9", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "790e073b2407ee80bd53556d780eaf8ba83da5c58fcef191cacf59eefd772b26", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "a5021a168adcedc37d77f533a8921c02f09c59f46a01737586aaa33c5908b8d0", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f" + }, + "fixtures_sha256": { + ".local/rust-climbing-parity/inputs.txt": "d0e60c8dee10288a70cc74745c3dc007e117c3523bdcc7f0d73717d540382b90", + ".local/rust-climbing-parity/info.json": "4b05610806620583f70f14cb7c049903e05f18cb5811b3de24418a1b95c00f9d", + ".local/rust-climbing-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-climbing-parity/tags.json": "5e1301e5a9abf7e4de93af5dae3a157e852dbdb4ea345c2eb626305a605d4f98" + }, + "rust_output_sha256": "a2413388f3d87ff48369f8252d0b91fc6ce79c0b60db5fce0b3489f2a84c8290", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "a2413388f3d87ff48369f8252d0b91fc6ce79c0b60db5fce0b3489f2a84c8290", + "matched_output_lines": 3820054 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "a2413388f3d87ff48369f8252d0b91fc6ce79c0b60db5fce0b3489f2a84c8290", + "matched_output_lines": 3820054 + } + ], + "scope": "Actual registered LivingEntity.onClimbable and trapdoorUsableAsLadder with native CLIMBABLE/CAN_GLIDE_THROUGH tags. Every registered state, natural/empty/universal tag snapshots, all trapdoor states against every ladder facing, gliding and spectator guards, captured positions, retained climb history, integer-coordinate wrapping, mutations and failures. Rust binding validates members/properties/state IDs. Entity/world queries are controlled; live movement binding, equipment-based glide eligibility and complete gameplay remain pending." +} diff --git a/crates/horizon-world/examples/climbing_fixture.rs b/crates/horizon-world/examples/climbing_fixture.rs new file mode 100644 index 000000000..19badd19b --- /dev/null +++ b/crates/horizon-world/examples/climbing_fixture.rs @@ -0,0 +1,152 @@ +use horizon_core::position::BlockPos; +use horizon_world::{ + climbing::{ClimbingRegistry, ClimbingWorld, on_climbable}, + nbt::{self, Limits}, + registry::{BlockRegistry, BlockStateId}, +}; +use serde_json::Value; +use std::{ + collections::BTreeSet, + fs, + io::{self, Write}, + path::Path, +}; +fn pos(v: &Value) -> BlockPos { + BlockPos::new( + v[0].as_i64().unwrap() as i32, + v[1].as_i64().unwrap() as i32, + v[2].as_i64().unwrap() as i32, + ) +} +fn text(p: BlockPos) -> String { + format!("{} {} {}", p.x, p.y, p.z) +} +struct World<'a> { + op: &'a Value, + out: &'a mut dyn Write, + calls: i64, + position: BlockPos, + last: Option, +} +impl World<'_> { + fn query(&mut self, s: impl AsRef) -> io::Result<()> { + writeln!(self.out, "{}", s.as_ref())?; + let n = self.calls; + self.calls += 1; + if n == self.op["fail"].as_i64().unwrap() { + return Err(io::Error::other("injected climbing failure")); + } + if n == self.op["mutate_at"].as_i64().unwrap() { + self.position = BlockPos::new(31, 32, 33); + self.last = Some(BlockPos::new(-8, -9, -10)); + } + Ok(()) + } +} +impl ClimbingWorld for World<'_> { + type Error = io::Error; + fn is_spectator(&mut self) -> io::Result { + self.query("spectator")?; + Ok(self.op["spectator"].as_bool().unwrap()) + } + fn block_position(&mut self) -> io::Result { + self.query("position")?; + Ok(self.position) + } + fn in_block_state(&mut self) -> io::Result { + self.query("in-state")?; + Ok(BlockStateId(self.op["state"].as_u64().unwrap() as u32)) + } + fn is_fall_flying(&mut self) -> io::Result { + self.query("gliding")?; + Ok(self.op["gliding"].as_bool().unwrap()) + } + fn block_state(&mut self, p: BlockPos) -> io::Result { + self.query(format!("below {}", text(p)))?; + Ok(BlockStateId(self.op["below"].as_u64().unwrap() as u32)) + } + fn set_last_climbable_position(&mut self, p: BlockPos) { + self.last = Some(p); + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let registry = BlockRegistry::from_nbt( + &nbt::read_named( + &fs::read(dir.join("block-registry.nbt"))?, + Limits::default(), + )? + .0 + .tag, + )?; + let info: Value = serde_json::from_str(&fs::read_to_string(dir.join("info.json"))?)?; + let names = |key: &str| -> BTreeSet { + info[key] + .as_array() + .unwrap() + .iter() + .map(|v| v.as_str().unwrap().to_owned()) + .collect() + }; + let all: BTreeSet = (0..registry.len()) + .map(|i| registry.state(BlockStateId(i as u32)).unwrap().name.clone()) + .collect(); + let trapdoors = names("trapdoors"); + let climb = [names("climbable"), BTreeSet::new(), all.clone()]; + let glide = [names("glide_through"), BTreeSet::new(), all]; + let mut bindings = Vec::new(); + for c in &climb { + for g in &glide { + bindings.push(ClimbingRegistry::new(®istry, &trapdoors, c, g)?); + } + } + let invalid = BTreeSet::from(["horizon:missing".to_owned()]); + assert!(ClimbingRegistry::new(®istry, &invalid, &climb[0], &glide[0]).is_err()); + assert!(ClimbingRegistry::new(®istry, &trapdoors, &invalid, &glide[0]).is_err()); + assert!(ClimbingRegistry::new(®istry, &trapdoors, &climb[0], &invalid).is_err()); + assert!( + ClimbingRegistry::new( + ®istry, + &BTreeSet::from(["minecraft:stone".to_owned()]), + &climb[0], + &glide[0] + ) + .is_err() + ); + assert!( + bindings[0] + .is_climbable_tag(BlockStateId(u32::MAX)) + .is_err() + ); + assert!(std::ptr::eq(bindings[0].registry(), ®istry)); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut last = Some(BlockPos::new(7, 8, 9)); + let binding = &bindings[f["climb_tags"].as_u64().unwrap() as usize * 3 + + f["glide_tags"].as_u64().unwrap() as usize]; + for op in f["ops"].as_array().unwrap() { + let mut w = World { + op, + out: &mut out, + calls: 0, + position: pos(&op["position"]), + last, + }; + match on_climbable(&mut w, binding) { + Ok(b) => writeln!(w.out, "result {b}")?, + Err(_) => writeln!(w.out, "error")?, + }; + writeln!(w.out, "position {}", text(w.position))?; + if let Some(p) = w.last { + writeln!(w.out, "last {}", text(p))?; + } else { + writeln!(w.out, "last none")?; + } + writeln!(w.out, "queries {}", w.calls)?; + last = w.last; + } + } + Ok(()) +} diff --git a/crates/horizon-world/src/climbing.rs b/crates/horizon-world/src/climbing.rs new file mode 100644 index 000000000..d0af2e1d5 --- /dev/null +++ b/crates/horizon-world/src/climbing.rs @@ -0,0 +1,137 @@ +//! Registered climbing tags and trapdoor/ladder support with entity state order. +use crate::{ + compression::invalid, + registry::{BlockRegistry, BlockStateId}, +}; +use horizon_core::position::BlockPos; +use std::{collections::BTreeSet, fmt, io}; +#[derive(Clone, Copy)] +struct State { + climbable: bool, + glide_through: bool, + open_trapdoor: Option, + ladder: Option, +} +pub struct ClimbingRegistry<'r> { + registry: &'r BlockRegistry, + states: Vec, +} +impl<'r> ClimbingRegistry<'r> { + /// Trapdoor names are imported class identities, not inferred from spelling. + /// Rebuild this immutable snapshot when either resolved block tag reloads. + pub fn new( + registry: &'r BlockRegistry, + trapdoors: &BTreeSet, + climbable: &BTreeSet, + glide_through: &BTreeSet, + ) -> io::Result { + for names in [trapdoors, climbable, glide_through] { + if names.iter().any(|n| registry.default_state(n).is_none()) { + return Err(invalid("unknown climbing block member")); + } + } + let mut states = Vec::with_capacity(registry.len()); + for i in 0..registry.len() { + let s = registry.state(BlockStateId(i as u32)).unwrap(); + let facing = || -> io::Result { + match s.properties.get("facing").map(String::as_str) { + Some("north") => Ok(0), + Some("south") => Ok(1), + Some("west") => Ok(2), + Some("east") => Ok(3), + _ => Err(invalid("invalid climbing facing")), + } + }; + let open_trapdoor = if trapdoors.contains(&s.name) { + let f = facing()?; + match s.properties.get("open").map(String::as_str) { + Some("true") => Some(f), + Some("false") => None, + _ => return Err(invalid("invalid trapdoor open state")), + } + } else { + None + }; + states.push(State { + climbable: climbable.contains(&s.name), + glide_through: glide_through.contains(&s.name), + open_trapdoor, + ladder: if s.name == "minecraft:ladder" { + Some(facing()?) + } else { + None + }, + }); + } + Ok(Self { registry, states }) + } + pub fn registry(&self) -> &'r BlockRegistry { + self.registry + } + fn state(&self, id: BlockStateId) -> io::Result { + self.states + .get(id.0 as usize) + .copied() + .ok_or_else(|| invalid("climbing state outside registry")) + } + pub fn is_climbable_tag(&self, id: BlockStateId) -> io::Result { + Ok(self.state(id)?.climbable) + } +} +pub trait ClimbingWorld { + type Error; + fn is_spectator(&mut self) -> Result; + fn block_position(&mut self) -> Result; + fn in_block_state(&mut self) -> Result; + fn is_fall_flying(&mut self) -> Result; + fn block_state(&mut self, position: BlockPos) -> Result; + fn set_last_climbable_position(&mut self, position: BlockPos); +} +#[derive(Debug)] +pub enum ClimbingError { + Data(io::Error), + World(E), +} +impl fmt::Display for ClimbingError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::Data(e) => e.fmt(f), + Self::World(e) => e.fmt(f), + } + } +} +impl std::error::Error for ClimbingError {} +/// Failed/negative queries retain the existing last-climbable position. Only a +/// positive result overwrites it, using the position captured before state reads. +pub fn on_climbable( + world: &mut W, + registry: &ClimbingRegistry<'_>, +) -> Result> { + use ClimbingError::{Data, World}; + if world.is_spectator().map_err(World)? { + return Ok(false); + } + let position = world.block_position().map_err(World)?; + let state = registry + .state(world.in_block_state().map_err(World)?) + .map_err(Data)?; + if world.is_fall_flying().map_err(World)? && state.glide_through { + return Ok(false); + } + let climbable = if state.climbable { + true + } else if let Some(facing) = state.open_trapdoor { + let below = BlockPos::new(position.x, position.y.wrapping_sub(1), position.z); + registry + .state(world.block_state(below).map_err(World)?) + .map_err(Data)? + .ladder + == Some(facing) + } else { + false + }; + if climbable { + world.set_last_climbable_position(position); + } + Ok(climbable) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 765fa4968..3f78f9333 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -13,6 +13,7 @@ pub mod block_support; pub mod block_survival; pub mod chunk; pub mod chunk_status; +pub mod climbing; pub mod collision; pub mod collision_context; pub mod compression; diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 285e526c2..78e689522 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -901,3 +901,19 @@ between direct ability fields and virtual ability access. Targeted Clippy passes Parent travel is selected through a controlled fluid callback; connecting the verified living phases and collision movement to the live player/world remains pending. + + +`ClimbingRegistry` binds resolved climbing/glide-through tags and actual trapdoor +class identities to all registered states. `on_climbable` preserves spectator +and gliding guards, open-trapdoor/ladder facing checks, wrapping below-position +arithmetic and last-climbable position writes. Negative or failed checks retain +the previous climbing position. Unknown members/properties and IDs are rejected. + +`python3 tools/test_climbing_parity.py` invokes actual registered +`LivingEntity.onClimbable` and trapdoor support checks. The +[climbing report](../benchmarks/rust-climbing-2026-10-07/scoped-parity.json) +records **3,820,054 matching lines per JAR** across all **35,723 states**, including +all trapdoor states against every registered ladder facing, tag reloads, +spectator/gliding guards, captured positions, mutations and failures. Targeted +Clippy passes. Entity/world storage is controlled; live movement binding and +equipment-based glide eligibility remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaClimbingOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaClimbingOracle.java new file mode 100644 index 000000000..b0eeb5399 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaClimbingOracle.java @@ -0,0 +1,35 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*;import java.lang.reflect.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.*;import net.minecraft.core.registries.*;import net.minecraft.nbt.*;import net.minecraft.tags.*;import net.minecraft.world.entity.*;import net.minecraft.world.level.block.*;import net.minecraft.world.level.block.state.*; +/** Actual registered LivingEntity climbing and trapdoor ladder predicates. */ +public final class VanillaClimbingOracle { + static final class Stop extends RuntimeException {} + static Field last; + static BlockPos pos(JsonElement v){var a=v.getAsJsonArray();return new BlockPos(a.get(0).getAsInt(),a.get(1).getAsInt(),a.get(2).getAsInt());} + static String text(BlockPos p){return p.getX()+" "+p.getY()+" "+p.getZ();} + static final class Data {JsonObject op;PrintWriter out;int calls;BlockPos position;Actor actor; + void query(String s){out.println(s);int n=calls++;if(n==op.get("fail").getAsInt())throw new Stop();if(n==op.get("mutate_at").getAsInt()){position=new BlockPos(31,32,33);try{last.set(actor,Optional.of(new BlockPos(-8,-9,-10)));}catch(ReflectiveOperationException e){throw new AssertionError(e);}}}} + static final class Level extends net.minecraft.server.level.ServerLevel {Data d;Level(){super(null,null,null,null,null,null,false,0L,List.of(),false);}@Override public BlockState getBlockState(BlockPos p){d.query("below "+text(p));return Block.stateById(d.op.get("below").getAsInt());}} + static final class Actor extends net.minecraft.world.entity.decoration.ArmorStand {Data d;Actor(){super(null,null);}void configure(Level l){setLevel(l);} + @Override public boolean isSpectator(){d.query("spectator");return d.op.get("spectator").getAsBoolean();} + @Override public BlockPos blockPosition(){d.query("position");return d.position;} + @Override public BlockState getInBlockState(){d.query("in-state");return Block.stateById(d.op.get("state").getAsInt());} + @Override public boolean isFallFlying(){d.query("gliding");return d.op.get("gliding").getAsBoolean();}} + static void export(Path dir,JsonArray climb,JsonArray glide)throws Exception{ + var states=new ListTag();var defaults=new CompoundTag();var trapdoors=new JsonArray();var trapdoorStates=new JsonArray();var ladderStates=new JsonArray();var names=new JsonObject(); + for(var block:BuiltInRegistries.BLOCK){String name=BuiltInRegistries.BLOCK.getKey(block).toString();defaults.putInt(name,Block.getId(block.defaultBlockState()));names.addProperty(name,Block.getId(block.defaultBlockState()));if(block instanceof TrapDoorBlock)trapdoors.add(name);} + for(var state:Block.BLOCK_STATE_REGISTRY){states.add(BlockState.FULL_CODEC.encodeStart(NbtOps.INSTANCE,state).getOrThrow());if(state.getBlock() instanceof TrapDoorBlock)trapdoorStates.add(Block.getId(state));if(state.is(Blocks.LADDER))ladderStates.add(Block.getId(state));} + var data=new CompoundTag();data.putInt("DataVersion",net.minecraft.SharedConstants.getCurrentVersion().dataVersion().version());data.put("states",states);data.put("defaults",defaults);try(var out=new DataOutputStream(Files.newOutputStream(dir.resolve("block-registry.nbt")))){NbtIo.write(data,out);} + var info=new JsonObject();info.addProperty("states",states.size());info.add("defaults",names);info.add("trapdoors",trapdoors);info.add("trapdoor_states",trapdoorStates);info.add("ladder_states",ladderStates);info.add("climbable",climb);info.add("glide_through",glide);Files.writeString(dir.resolve("info.json"),info.toString()); + } + public static void main(String[] args)throws Exception{ + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();Path dir=Path.of(args[1]);VanillaHeightmapOracle.bindTags(JsonParser.parseString(Files.readString(dir.resolve("tags.json"))).getAsJsonObject());var all=new ArrayList>();var climb=new ArrayList>();var glide=new ArrayList>();var cn=new JsonArray();var gn=new JsonArray();for(var block:BuiltInRegistries.BLOCK){var h=block.builtInRegistryHolder();String name=BuiltInRegistries.BLOCK.getKey(block).toString();all.add(h);if(block.defaultBlockState().is(BlockTags.CLIMBABLE)){climb.add(h);cn.add(name);}if(block.defaultBlockState().is(BlockTags.CAN_GLIDE_THROUGH)){glide.add(h);gn.add(name);}} + if(args[0].equals("export")){export(dir,cn,gn);return;} + var u=Class.forName("sun.misc.Unsafe");var uf=u.getDeclaredField("theUnsafe");uf.setAccessible(true);var unsafe=uf.get(null);var allocate=u.getMethod("allocateInstance",Class.class);last=LivingEntity.class.getDeclaredField("lastClimbablePos");last.setAccessible(true);int oldC=-1,oldG=-1; + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();int c=f.get("climb_tags").getAsInt(),g=f.get("glide_tags").getAsInt();if(c!=oldC||g!=oldG){BuiltInRegistries.BLOCK.prepareTagReload(new TagLoader.LoadResult<>(Registries.BLOCK,Map.of(BlockTags.CLIMBABLE,c==0?climb:c==1?List.>of():all,BlockTags.CAN_GLIDE_THROUGH,g==0?glide:g==1?List.>of():all))).apply();oldC=c;oldG=g;} + var d=new Data();d.out=out;var level=(Level)allocate.invoke(unsafe,Level.class);level.d=d;var actor=(Actor)allocate.invoke(unsafe,Actor.class);actor.d=d;actor.configure(level);d.actor=actor;last.set(actor,Optional.of(new BlockPos(7,8,9))); + for(var v:f.getAsJsonArray("ops")){d.op=v.getAsJsonObject();d.calls=0;d.position=pos(d.op.get("position"));try{out.println("result "+actor.onClimbable());}catch(Stop e){out.println("error");}out.println("position "+text(d.position));var p=(Optional)last.get(actor);out.println(p.isEmpty()?"last none":"last "+text((BlockPos)p.get()));out.println("queries "+d.calls);} + }} + } +} diff --git a/tools/test_climbing_parity.py b/tools/test_climbing_parity.py new file mode 100644 index 000000000..0d836d745 --- /dev/null +++ b/tools/test_climbing_parity.py @@ -0,0 +1,65 @@ +#!/usr/bin/env python3 +"""Compare registered climbing and trapdoor ladder behavior.""" +import itertools +import json +import os +from pathlib import Path +import platform +import random +import struct +import subprocess +import zipfile +try: + from . import lab, test_rust_parity as base, test_worldgen_parity as worldgen +except ImportError: + import lab + import test_rust_parity as base + import test_worldgen_parity as worldgen + + +def corpus(info): + defaults=info['defaults'];air=defaults['minecraft:air'];ladder=defaults['minecraft:ladder'];stone=defaults['minecraft:stone'] + def op(state,**kw): + f=dict(state=state,below=ladder,position=[17,-64,-33],spectator=False,gliding=False,fail=-1,mutate_at=-1);f.update(kw);return f + def row(state,ct=0,gt=0,**kw):return dict(climb_tags=ct,glide_tags=gt,ops=[op(state,**kw),op(air)]) + for tags in range(3): + for state in range(info['states']): + for gliding in [False,True]:yield row(state,ct=tags,gt=tags,gliding=gliding) + for state in info['trapdoor_states']: + for below in [air,stone,*info['ladder_states']]:yield row(state,ct=1,gt=1,below=below) + special=[defaults['minecraft:'+n] for n in ['air','stone','ladder','scaffolding','vine','oak_trapdoor','iron_trapdoor','powder_snow']] + for ct,gt,state,spectator,gliding in itertools.product(range(3),range(3),special,[False,True],[False,True]):yield row(state,ct=ct,gt=gt,spectator=spectator,gliding=gliding) + for state in special+[s for s in info['trapdoor_states'][:64]]: + for fail in range(-1,6): + for mutate_at in range(-1,6):yield row(state,fail=fail,mutate_at=mutate_at,position=[2147483647,-2147483648,-2147483648]) + rng=random.Random(0x434c494d42) + for _ in range(4000): + yield dict(climb_tags=rng.randrange(3),glide_tags=rng.randrange(3),ops=[op(rng.randrange(info['states']),below=rng.choice(info['ladder_states']+[air,stone]),spectator=bool(rng.randrange(2)),gliding=bool(rng.randrange(2)),fail=rng.randrange(-1,6),mutate_at=rng.randrange(-1,6),position=rng.choice([[0,0,0],[17,-64,-33],[2147483647,-2147483648,-2147483648]])) for _ in range(4)]) + + +def main(): + lock,jars,libraries=base.verify_artifacts();build=lab.LOCAL/'rust-climbing-parity';build.mkdir(exist_ok=True);report_path=build/'report.json';report_path.unlink(missing_ok=True) + root=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity';oracles=[root/(n+'.java') for n in ['VanillaClimbingOracle','VanillaHeightmapOracle']] + sources=[*oracles,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/test_worldgen_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-world/examples/climbing_fixture.rs'] + for crate in ['horizon-core','horizon-world']:sources += [lab.ROOT/'crates'/crate/'Cargo.toml',*sorted((lab.ROOT/'crates'/crate/'src').rglob('*.rs'))] + tested=base.source_hashes(sources);tags=worldgen.tag_resources(jars['server']) + if tags!=worldgen.tag_resources(jars['client']):raise AssertionError('Native tags differ between artifacts') + lab.write_json(build/'tags.json',tags);classes=build/'classes';classes.mkdir(exist_ok=True);dependencies=os.pathsep.join(map(str,libraries)) + def run(command,name): + with (build/(name+'.log')).open('w') as log:subprocess.run(list(map(str,command)),cwd=lab.ROOT,check=True,timeout=3600,stdout=log,stderr=subprocess.STDOUT) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependencies,'-d',classes,*oracles],'compile-java') + def java(side,mode):run(['java','-Xmx768M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependencies]),'dev.horizonlab.parity.VanillaClimbingOracle',mode,build],side+'-'+mode) + java('server','export');info=json.loads((build/'info.json').read_text());count=0 + if info['states']!=35723:raise AssertionError('Incomplete pinned registry') + with (build/'inputs.txt').open('w') as output: + for f in corpus(info):output.write(json.dumps(f,separators=(',',':'))+'\n');count+=1 + fixture_paths=[build/n for n in ['inputs.txt','info.json','block-registry.nbt','tags.json']];fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--locked','--release','-p','horizon-world','--example','climbing_fixture'],'compile-rust');metadata=json.loads(subprocess.check_output(['cargo','metadata','--locked','--no-deps','--format-version','1'],cwd=lab.ROOT));binary=Path(metadata['target_directory'])/'release/examples'/('climbing_fixture.exe' if os.name=='nt' else 'climbing_fixture');run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side);matched=base.compare(build/(side+'.txt'),build/'rust.txt');references.append(dict(side=side,jar_sha256=lab.digest(jar,'sha256'),output_sha256=lab.digest(build/(side+'.txt'),'sha256'),matched_output_lines=matched));print(f'{side}: {matched:,} climbing output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested);base.ensure_sources_unchanged(fixture_paths,fixtures) + report=dict(schema=1,minecraft=lock['minecraft']['version'],manifest_sha1=lock['minecraft']['manifest_sha1'],platform=platform.platform(),java=subprocess.check_output(['java','--version'],text=True).splitlines()[0],rustc=subprocess.check_output(['rustc','--version'],text=True).strip(),fixtures=count,registry_states=info['states'],sources_sha256=tested,fixtures_sha256=fixtures,rust_output_sha256=lab.digest(build/'rust.txt','sha256'),references=references,scope='Actual registered LivingEntity.onClimbable and trapdoorUsableAsLadder with native CLIMBABLE/CAN_GLIDE_THROUGH tags. Every registered state, natural/empty/universal tag snapshots, all trapdoor states against every ladder facing, gliding and spectator guards, captured positions, retained climb history, integer-coordinate wrapping, mutations and failures. Rust binding validates members/properties/state IDs. Entity/world queries are controlled; live movement binding, equipment-based glide eligibility and complete gameplay remain pending.') + lab.write_json(report_path,report);print(f'Scoped climbing parity passed: {report_path}',flush=True) + + +if __name__=='__main__':main() From 3e1b4862aa29bd03ebd33435af671df233533cd8 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 02:49:12 +0200 Subject: [PATCH 093/253] Match liquid occupancy scans over resident chunk sections --- .../scoped-parity.json | 235 ++++++++++++++++++ .../examples/fluid_occupancy_fixture.rs | 177 +++++++++++++ crates/horizon-world/src/chunk.rs | 8 + crates/horizon-world/src/fluid_occupancy.rs | 140 +++++++++++ crates/horizon-world/src/lib.rs | 1 + docs/collision-geometry.md | 19 ++ .../parity/VanillaFluidOccupancyOracle.java | 24 ++ tools/test_fluid_occupancy_parity.py | 68 +++++ 8 files changed, 672 insertions(+) create mode 100644 benchmarks/rust-fluid-occupancy-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/fluid_occupancy_fixture.rs create mode 100644 crates/horizon-world/src/fluid_occupancy.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFluidOccupancyOracle.java create mode 100644 tools/test_fluid_occupancy_parity.py diff --git a/benchmarks/rust-fluid-occupancy-2026-10-07/scoped-parity.json b/benchmarks/rust-fluid-occupancy-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..21b646324 --- /dev/null +++ b/benchmarks/rust-fluid-occupancy-2026-10-07/scoped-parity.json @@ -0,0 +1,235 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 4349, + "registry_states": 35723, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFluidOccupancyOracle.java": "3c0d14ae24b5bed27e1798003f6a5579f06ba651a9fc04e29895d30d22982809", + "tools/test_fluid_occupancy_parity.py": "e80c63373ee20954380bfb2e242b721ad6219989e1d8b7dc70e0bfb6faa5b47a", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-world/examples/fluid_occupancy_fixture.rs": "40147a8197d4ebd87210482e4b0c4a7bc993e611cd5086e55a5501503f335b24", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "d82c07d89e7aa4236de955134008cefd85532d96b0b0354bc37266bd832b489e", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "a5021a168adcedc37d77f533a8921c02f09c59f46a01737586aaa33c5908b8d0", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f" + }, + "fixtures_sha256": { + ".local/rust-fluid-occupancy-parity/inputs.txt": "a39fbf688b0df119b1571db03bf3d7920211f50b43446950f49755c4c41ebbfd", + ".local/rust-fluid-occupancy-parity/info.json": "58c9ad06a3b4af632e45a65d7fe2b930d0b05a5a17a490267dc3c7e98d9e23f7", + ".local/rust-fluid-occupancy-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb" + }, + "rust_output_sha256": "a34d7cd8e5e5946c064656f097dff1405bf52bf0f2485b7af4d8d713fcceb306", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "a34d7cd8e5e5946c064656f097dff1405bf52bf0f2485b7af4d8d713fcceb306", + "matched_output_lines": 116664 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "a34d7cd8e5e5946c064656f097dff1405bf52bf0f2485b7af4d8d713fcceb306", + "matched_output_lines": 116664 + } + ], + "scope": "Actual LevelReader.containsAnyLiquid and native BoxBlockMatcher/BlockScanUtils over real ProtoChunk sections and palettes. All registered block fluid-presence values, inclusive AABB floors, chunk/section scan order, height limits, palette changes/compaction, nonfinite rejection and explicit Rust query budgets. Public query traces and results match; Rust skips dry active palettes without unpacking cells. Controlled repeating resident chunk snapshots; Entity.isFree collision composition and live world integration remain pending." +} diff --git a/crates/horizon-world/examples/fluid_occupancy_fixture.rs b/crates/horizon-world/examples/fluid_occupancy_fixture.rs new file mode 100644 index 000000000..bb178e300 --- /dev/null +++ b/crates/horizon-world/examples/fluid_occupancy_fixture.rs @@ -0,0 +1,177 @@ +use horizon_core::geometry::{Aabb, Vec3}; +use horizon_world::{ + chunk::BlockSection, + fluid_occupancy::*, + nbt::{self, Limits}, + registry::{BlockRegistry, BlockStateId}, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn bounds(v: &Value) -> Aabb { + Aabb::new( + Vec3::new(number(&v[0]), number(&v[1]), number(&v[2])), + Vec3::new(number(&v[3]), number(&v[4]), number(&v[5])), + ) +} +struct World<'a, 'r> { + out: &'a mut dyn Write, + calls: i64, + fail: i64, + min: i32, + height: i32, + sections: Vec>, +} +impl World<'_, '_> { + fn query(&mut self, s: impl AsRef) -> io::Result<()> { + writeln!(self.out, "{}", s.as_ref())?; + let n = self.calls; + self.calls += 1; + if n == self.fail { + Err(io::Error::other("injected occupancy failure")) + } else { + Ok(()) + } + } +} +impl FluidOccupancyWorld for World<'_, '_> { + type Error = io::Error; + type Chunk = (); + fn minimum_section_y(&mut self) -> io::Result { + self.query("min-section")?; + Ok(self.min >> 4) + } + fn maximum_section_y(&mut self) -> io::Result { + self.query("max-section")?; + Ok((self.min + self.height - 1) >> 4) + } + fn chunk(&mut self, x: i32, z: i32) -> io::Result<()> { + self.query(format!("chunk {x} {z}")) + } + fn section(&mut self, _: (), y: i32) -> io::Result<&BlockSection<'_>> { + self.query(format!("section {y}"))?; + Ok(&self.sections[(y - (self.min >> 4)) as usize]) + } + fn minimum_y(&mut self) -> io::Result { + self.query("min-y")?; + Ok(self.min) + } + fn maximum_y(&mut self) -> io::Result { + self.query("max-y")?; + Ok(self.min + self.height - 1) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let registry = BlockRegistry::from_nbt( + &nbt::read_named( + &fs::read(dir.join("block-registry.nbt"))?, + Limits::default(), + )? + .0 + .tag, + )?; + let fluid = FluidPresence::new(®istry)?; + assert!(fluid.has_fluid(BlockStateId(u32::MAX)).is_err()); + assert!(std::ptr::eq(fluid.registry(), ®istry)); + { + let air = registry.default_state("minecraft:air").unwrap(); + let mut sink = io::sink(); + let mut w = World { + out: &mut sink, + calls: 0, + fail: -1, + min: 0, + height: 16, + sections: vec![BlockSection::uniform(air, ®istry)?], + }; + let bad = Aabb::new(Vec3::new(f64::NAN, 0.0, 0.0), Vec3::new(1.0, 1.0, 1.0)); + assert!(matches!( + contains_any_liquid(&mut w, &fluid, bad, 100), + Err(FluidOccupancyError::NonFiniteBounds) + )); + assert_eq!(w.calls, 0); + let box_ = Aabb::new(Vec3::ZERO, Vec3::new(1.0, 1.0, 1.0)); + assert!(matches!( + contains_any_liquid(&mut w, &fluid, box_, 0), + Err(FluidOccupancyError::BudgetExceeded) + )); + assert_eq!(w.calls, 2); + w.calls = 0; + assert!(matches!( + contains_any_liquid(&mut w, &fluid, box_, 1), + Err(FluidOccupancyError::BudgetExceeded) + )); + assert_eq!(w.calls, 3); + assert!(!contains_any_liquid(&mut w, &fluid, box_, 2)?); + let foreign = BlockRegistry::from_nbt( + &nbt::read_named( + &fs::read(dir.join("block-registry.nbt"))?, + Limits::default(), + )? + .0 + .tag, + )?; + let foreign_presence = FluidPresence::new(&foreign)?; + assert!(matches!( + contains_any_liquid(&mut w, &foreign_presence, box_, 100), + Err(FluidOccupancyError::Data(_)) + )); + } + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for i in 0..registry.len() { + writeln!( + out, + "state {i} {}", + fluid.has_fluid(BlockStateId(i as u32))? + )?; + } + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let min = f["min"].as_i64().unwrap() as i32; + let height = f["height"].as_i64().unwrap() as i32; + let base = BlockStateId(f["base"].as_u64().unwrap() as u32); + let mut w = World { + out: &mut out, + calls: 0, + fail: -1, + min, + height, + sections: (0..height / 16) + .map(|_| BlockSection::uniform(base, ®istry)) + .collect::>>()?, + }; + for op in f["ops"].as_array().unwrap() { + for v in op["writes"].as_array().unwrap() { + let x = v[0].as_i64().unwrap() as i32; + let y = v[1].as_i64().unwrap() as i32; + let z = v[2].as_i64().unwrap() as i32; + w.sections[((y - min) >> 4) as usize].set( + ((y & 15) * 256 + (z & 15) * 16 + (x & 15)) as usize, + BlockStateId(v[3].as_u64().unwrap() as u32), + )?; + } + if op["compact"].as_bool().unwrap() { + for section in &mut w.sections { + section.compact()?; + } + } + w.calls = 0; + w.fail = op["fail"].as_i64().unwrap(); + match contains_any_liquid(&mut w, &fluid, bounds(&op["bounds"]), 1000000) { + Ok(b) => writeln!(w.out, "result {b}")?, + Err(FluidOccupancyError::World(_)) => writeln!(w.out, "error")?, + Err(e) => return Err(e.into()), + }; + writeln!(w.out, "queries {}", w.calls)?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/src/chunk.rs b/crates/horizon-world/src/chunk.rs index 600113b32..f049334f6 100644 --- a/crates/horizon-world/src/chunk.rs +++ b/crates/horizon-world/src/chunk.rs @@ -403,6 +403,14 @@ impl<'r> BlockSection<'r> { section.extra = container.extra; Ok(section) } + /// Test current distinct states without unpacking all 4,096 cells. The + /// predicate should be pure; unused palette slots are intentionally skipped. + pub fn any_state(&self, mut predicate: impl FnMut(BlockStateId) -> bool) -> bool { + self.palette + .iter() + .zip(&self.counts) + .any(|(&state, &count)| count != 0 && predicate(state)) + } pub fn bits(&self) -> u8 { self.storage.as_ref().map_or(0, PackedStorage::bits) } diff --git a/crates/horizon-world/src/fluid_occupancy.rs b/crates/horizon-world/src/fluid_occupancy.rs new file mode 100644 index 000000000..4432eca3b --- /dev/null +++ b/crates/horizon-world/src/fluid_occupancy.rs @@ -0,0 +1,140 @@ +//! Native section-ordered liquid occupancy over resident registered block states. +use crate::{ + chunk::BlockSection, + compression::invalid, + fluid::FluidState, + registry::{BlockRegistry, BlockStateId}, +}; +use horizon_core::{geometry::Aabb, position::BlockPos}; +use std::{fmt, io}; + +pub struct FluidPresence<'r> { + registry: &'r BlockRegistry, + present: Vec, +} +impl<'r> FluidPresence<'r> { + pub fn new(registry: &'r BlockRegistry) -> io::Result { + let present = (0..registry.len()) + .map(|i| { + FluidState::from_block(registry.state(BlockStateId(i as u32)).unwrap()) + .map(|f| f != FluidState::EMPTY) + }) + .collect::>>()?; + Ok(Self { registry, present }) + } + pub fn registry(&self) -> &'r BlockRegistry { + self.registry + } + pub fn has_fluid(&self, state: BlockStateId) -> io::Result { + self.present + .get(state.0 as usize) + .copied() + .ok_or_else(|| invalid("fluid presence state outside registry")) + } +} +pub trait FluidOccupancyWorld { + type Error; + type Chunk: Copy; + fn minimum_section_y(&mut self) -> Result; + fn maximum_section_y(&mut self) -> Result; + /// Native getChunk, including calls when the requested Y interval is empty. + fn chunk(&mut self, x: i32, z: i32) -> Result; + fn section(&mut self, chunk: Self::Chunk, y: i32) -> Result<&BlockSection<'_>, Self::Error>; + fn minimum_y(&mut self) -> Result; + fn maximum_y(&mut self) -> Result; +} +#[derive(Debug)] +pub enum FluidOccupancyError { + World(E), + Data(io::Error), + NonFiniteBounds, + BudgetExceeded, +} +impl fmt::Display for FluidOccupancyError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::World(e) => e.fmt(f), + Self::Data(e) => e.fmt(f), + Self::NonFiniteBounds => f.write_str("nonfinite fluid query bounds"), + Self::BudgetExceeded => f.write_str("fluid query budget exceeded"), + } + } +} +impl std::error::Error for FluidOccupancyError {} +fn spend(budget: &mut usize) -> Result<(), FluidOccupancyError> { + if *budget == 0 { + return Err(FluidOccupancyError::BudgetExceeded); + } + *budget -= 1; + Ok(()) +} +/// Inclusive floored AABB endpoints, as in LevelReader.findBlocksIn. Budget +/// counts chunk requests, section requests and inspected cells. Exhaustion is an +/// explicit error, never an empty-world result. Dry palettes avoid cell scans. +pub fn contains_any_liquid( + world: &mut W, + registry: &FluidPresence<'_>, + bounds: Aabb, + mut budget: usize, +) -> Result> { + use FluidOccupancyError::{Data, World}; + let a = bounds.min_position(); + let b = bounds.max_position(); + if [a.x, a.y, a.z, b.x, b.y, b.z] + .iter() + .any(|v| !v.is_finite()) + { + return Err(FluidOccupancyError::NonFiniteBounds); + } + let a = BlockPos::new(a.x.floor() as i32, a.y.floor() as i32, a.z.floor() as i32); + let b = BlockPos::new(b.x.floor() as i32, b.y.floor() as i32, b.z.floor() as i32); + let low = BlockPos::new(a.x.min(b.x), a.y.min(b.y), a.z.min(b.z)); + let high = BlockPos::new(a.x.max(b.x), a.y.max(b.y), a.z.max(b.z)); + let min_y = world.minimum_section_y().map_err(World)?.max(low.y >> 4); + let max_y = world.maximum_section_y().map_err(World)?.min(high.y >> 4); + for x in (low.x >> 4)..=(high.x >> 4) { + for z in (low.z >> 4)..=(high.z >> 4) { + spend(&mut budget)?; + let chunk = world.chunk(x, z).map_err(World)?; + for y in min_y..=max_y { + spend(&mut budget)?; + let section = world.section(chunk, y).map_err(World)?; + if !std::ptr::eq(section.registry(), registry.registry) { + return Err(Data(invalid("fluid query section registry mismatch"))); + } + if !section.any_state(|id| registry.present[id.0 as usize]) { + continue; + } + let origin = BlockPos::new(x.wrapping_shl(4), y.wrapping_shl(4), z.wrapping_shl(4)); + let min = BlockPos::new( + origin.x.max(low.x) & 15, + origin.y.max(low.y) & 15, + origin.z.max(low.z) & 15, + ); + let max = BlockPos::new( + origin.x.wrapping_add(15).min(high.x) & 15, + origin.y.wrapping_add(15).min(high.y) & 15, + origin.z.wrapping_add(15).min(high.z) & 15, + ); + for sy in min.y..=max.y { + for sz in min.z..=max.z { + for sx in min.x..=max.x { + spend(&mut budget)?; + let id = section + .get((sy * 256 + sz * 16 + sx) as usize) + .map_err(Data)?; + if registry.present[id.0 as usize] { + return Ok(true); + } + } + } + } + } + } + } + // Native scans outside world height only if the predicate accepts air. It + // still evaluates both height guards; the liquid predicate rejects air. + world.minimum_y().map_err(World)?; + world.maximum_y().map_err(World)?; + Ok(false) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 3f78f9333..4a6ec7a4f 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -24,6 +24,7 @@ pub mod entity_move; pub mod entity_obstruction; pub mod fall_damage; pub mod fluid; +pub mod fluid_occupancy; pub mod fluid_shape; pub mod ground_support; pub mod heightmap; diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 78e689522..30e342989 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -917,3 +917,22 @@ all trapdoor states against every registered ladder facing, tag reloads, spectator/gliding guards, captured positions, mutations and failures. Targeted Clippy passes. Entity/world storage is controlled; live movement binding and equipment-based glide eligibility remain pending. + + +`fluid_occupancy` implements section-ordered liquid checks over resident block +sections with a complete registered fluid-presence table. `BlockSection.any_state` +checks active palette entries so dry sections skip cell unpacking. Bounds use +inclusive floored endpoints, and chunk requests retain native behavior even when +no requested vertical section is within world height. Invalid geometry, foreign +registries and query-budget exhaustion return explicit errors. + +`python3 tools/test_fluid_occupancy_parity.py` compares actual +`LevelReader.containsAnyLiquid`, `BoxBlockMatcher` and `BlockScanUtils` with +native ProtoChunk sections. The +[liquid occupancy report](../benchmarks/rust-fluid-occupancy-2026-10-07/scoped-parity.json) +records **116,664 matching lines per JAR**, including fluid presence for all +**35,723 states**, public chunk/section query order, height boundaries, palette +changes/compaction and failures. Rust-only checks verify typed budget, nonfinite +and registry errors. Targeted Clippy passes. Chunk snapshots repeat controlled +resident data; collision composition for `Entity.isFree` and live world binding +remain pending. No performance gain is claimed without measurement. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFluidOccupancyOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFluidOccupancyOracle.java new file mode 100644 index 000000000..aa43ea1c8 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFluidOccupancyOracle.java @@ -0,0 +1,24 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*;import java.lang.reflect.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.*;import net.minecraft.core.registries.*;import net.minecraft.nbt.*;import net.minecraft.world.level.*;import net.minecraft.world.level.biome.*;import net.minecraft.world.level.block.*;import net.minecraft.world.level.block.state.*;import net.minecraft.world.level.chunk.*;import net.minecraft.world.phys.AABB; +/** Native containsAnyLiquid through actual chunk sections and palette filtering. */ +public final class VanillaFluidOccupancyOracle { + static final class Stop extends RuntimeException {} + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + static AABB bounds(JsonArray a){return new AABB(number(a.get(0)),number(a.get(1)),number(a.get(2)),number(a.get(3)),number(a.get(4)),number(a.get(5)));} + static final class Data {PrintWriter out;int min,height,calls,fail;boolean trace; + void query(String s){if(!trace)return;out.println(s);if(calls++==fail)throw new Stop();}} + static final class Chunk extends ProtoChunk {Data d; + Chunk(Data d,PalettedContainerFactory factory){super(new ChunkPos(0,0),UpgradeData.EMPTY,LevelHeightAccessor.create(d.min,d.height),factory,null);this.d=d;} + @Override public LevelChunkSection getSection(int index){if(d!=null)d.query("section "+((d.min>>4)+index));return super.getSection(index);}} + static void export(Path dir)throws Exception{var states=new ListTag();var defaults=new CompoundTag();var names=new JsonObject();for(var state:Block.BLOCK_STATE_REGISTRY){states.add(BlockState.FULL_CODEC.encodeStart(NbtOps.INSTANCE,state).getOrThrow());if(state==state.getBlock().defaultBlockState()){String n=BuiltInRegistries.BLOCK.getKey(state.getBlock()).toString();defaults.putInt(n,Block.getId(state));names.addProperty(n,Block.getId(state));}}var data=new CompoundTag();data.putInt("DataVersion",net.minecraft.SharedConstants.getCurrentVersion().dataVersion().version());data.put("states",states);data.put("defaults",defaults);try(var out=new DataOutputStream(Files.newOutputStream(dir.resolve("block-registry.nbt")))){NbtIo.write(data,out);}var info=new JsonObject();info.addProperty("states",states.size());info.add("defaults",names);Files.writeString(dir.resolve("info.json"),info.toString());} + public static void main(String[] args)throws Exception{ + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();Path dir=Path.of(args[1]);if(args[0].equals("export")){export(dir);return;} + Holder biome=Holder.Reference.createStandAlone(new HolderOwner(){},Biomes.PLAINS);var ids=new IdMapper>();ids.add(biome); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var state:Block.BLOCK_STATE_REGISTRY)out.println("state "+Block.getId(state)+" "+!state.getFluidState().isEmpty());for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();var d=new Data();d.out=out;d.min=f.get("min").getAsInt();d.height=f.get("height").getAsInt();var factory=new PalettedContainerFactory(Strategy.createForBlockStates(Block.BLOCK_STATE_REGISTRY),Block.stateById(f.get("base").getAsInt()),null,Strategy.createForBiomes(ids),biome,null);var chunk=new Chunk(d,factory); + var world=(LevelReader)Proxy.newProxyInstance(LevelReader.class.getClassLoader(),new Class[]{LevelReader.class},(proxy,method,values)->{switch(method.getName()){case "getMinSectionY":d.query("min-section");return d.min>>4;case "getMaxSectionY":d.query("max-section");return(d.min+d.height-1)>>4;case "getMinY":d.query("min-y");return d.min;case "getMaxY":d.query("max-y");return d.min+d.height-1;case "getChunk":if(values.length!=2)throw new AssertionError(method);d.query("chunk "+values[0]+" "+values[1]);return chunk;default:if(method.isDefault())return InvocationHandler.invokeDefault(proxy,method,values);throw new AssertionError(method);}}); + for(var v:f.getAsJsonArray("ops")){var op=v.getAsJsonObject();d.trace=false;for(var write:op.getAsJsonArray("writes")){var a=write.getAsJsonArray();int x=a.get(0).getAsInt(),y=a.get(1).getAsInt(),z=a.get(2).getAsInt();chunk.getSection((y-d.min)>>4).setBlockState(x&15,y&15,z&15,Block.stateById(a.get(3).getAsInt()),false);}d.calls=0;d.fail=op.get("fail").getAsInt();d.trace=true;try{out.println("result "+world.containsAnyLiquid(bounds(op.getAsJsonArray("bounds"))));}catch(Stop e){out.println("error");}out.println("queries "+d.calls);} + }} + } +} diff --git a/tools/test_fluid_occupancy_parity.py b/tools/test_fluid_occupancy_parity.py new file mode 100644 index 000000000..490d72471 --- /dev/null +++ b/tools/test_fluid_occupancy_parity.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python3 +"""Compare section-based liquid occupancy and registered fluid presence.""" +import itertools +import json +import os +from pathlib import Path +import platform +import random +import struct +import subprocess +import zipfile +try: + from . import lab, test_rust_parity as base, test_worldgen_parity as worldgen +except ImportError: + import lab + import test_rust_parity as base + import test_worldgen_parity as worldgen + + +def corpus(info): + d=info['defaults'];air=d['minecraft:air'];water=d['minecraft:water'];stone=d['minecraft:stone'] + def bits(v):return struct.pack('>d',float(v)).hex() + def op(bounds=(0,0,0,1,1,1),writes=(),fail=-1,compact=False):return dict(bounds=[bits(v) for v in bounds],writes=list(writes),fail=fail,compact=compact) + def row(base=air,min=-16,height=48,ops=None):return dict(base=base,min=min,height=height,ops=ops or [op()]) + boxes=[(0,0,0,1,1,1),(-.5,-.5,-.5,.5,.5,.5),(0,0,0,0,0,0),(15.5,-.1,15.5,16.5,16.1,16.5),(-16,-16,-16,16,32,16),(0,-32,0,1,-17,1),(0,32,0,1,64,1),(0,-32,0,1,64,1),(16,16,16,15,15,15),(30000000,-64,-30000000,30000001,1,-29999999)] + bases=[d['minecraft:'+n] for n in ['air','stone','water','lava','bubble_column','kelp','seagrass','oak_slab','oak_stairs','mangrove_roots','water_cauldron','powder_snow']] + for base in bases: + for box in boxes: + for fail in range(-1,20):yield row(base=base,ops=[op(box,fail=fail)]) + positions=[(0,0,0),(1,1,1),(15,15,15),(0,-16,0),(15,31,15),(0,16,0)] + for p in positions: + for box in boxes: + yield row(ops=[op(box,[(*p,water)]),op(box,[(*p,stone)]),op(box,[(*p,air)],compact=True),op(box,[(*p,water)])]) + for state in range(0,info['states'],97):yield row(base=state,ops=[op(boxes[1]),op(boxes[4])]) + rng=random.Random(0x4c4951554944) + for _ in range(1400): + minimum=rng.choice([-64,-16,0,16]);height=rng.choice([16,32,64]);ops=[] + for _ in range(4): + y=rng.randrange(minimum,minimum+height);box=rng.choice(boxes) + ops.append(op(box,[(rng.randrange(16),y,rng.randrange(16),rng.randrange(info['states'])) for _ in range(rng.randrange(12))],fail=rng.choice([-1,-1,*range(20)]),compact=bool(rng.randrange(2)))) + yield row(base=rng.choice(bases),min=minimum,height=height,ops=ops) + + +def main(): + lock,jars,libraries=base.verify_artifacts();build=lab.LOCAL/'rust-fluid-occupancy-parity';build.mkdir(exist_ok=True);report_path=build/'report.json';report_path.unlink(missing_ok=True) + root=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity';oracles=[root/(n+'.java') for n in ['VanillaFluidOccupancyOracle']] + sources=[*oracles,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/test_worldgen_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-world/examples/fluid_occupancy_fixture.rs'] + for crate in ['horizon-core','horizon-world']:sources += [lab.ROOT/'crates'/crate/'Cargo.toml',*sorted((lab.ROOT/'crates'/crate/'src').rglob('*.rs'))] + tested=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True);dependencies=os.pathsep.join(map(str,libraries)) + def run(command,name): + with (build/(name+'.log')).open('w') as log:subprocess.run(list(map(str,command)),cwd=lab.ROOT,check=True,timeout=3600,stdout=log,stderr=subprocess.STDOUT) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependencies,'-d',classes,*oracles],'compile-java') + def java(side,mode):run(['java','-Xmx768M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependencies]),'dev.horizonlab.parity.VanillaFluidOccupancyOracle',mode,build],side+'-'+mode) + java('server','export');info=json.loads((build/'info.json').read_text());count=0 + if info['states']!=35723:raise AssertionError('Incomplete pinned registry') + with (build/'inputs.txt').open('w') as output: + for f in corpus(info):output.write(json.dumps(f,separators=(',',':'))+'\n');count+=1 + fixture_paths=[build/n for n in ['inputs.txt','info.json','block-registry.nbt']];fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--locked','--release','-p','horizon-world','--example','fluid_occupancy_fixture'],'compile-rust');metadata=json.loads(subprocess.check_output(['cargo','metadata','--locked','--no-deps','--format-version','1'],cwd=lab.ROOT));binary=Path(metadata['target_directory'])/'release/examples'/('fluid_occupancy_fixture.exe' if os.name=='nt' else 'fluid_occupancy_fixture');run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side);matched=base.compare(build/(side+'.txt'),build/'rust.txt');references.append(dict(side=side,jar_sha256=lab.digest(jar,'sha256'),output_sha256=lab.digest(build/(side+'.txt'),'sha256'),matched_output_lines=matched));print(f'{side}: {matched:,} fluid-occupancy output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested);base.ensure_sources_unchanged(fixture_paths,fixtures) + report=dict(schema=1,minecraft=lock['minecraft']['version'],manifest_sha1=lock['minecraft']['manifest_sha1'],platform=platform.platform(),java=subprocess.check_output(['java','--version'],text=True).splitlines()[0],rustc=subprocess.check_output(['rustc','--version'],text=True).strip(),fixtures=count,registry_states=info['states'],sources_sha256=tested,fixtures_sha256=fixtures,rust_output_sha256=lab.digest(build/'rust.txt','sha256'),references=references,scope='Actual LevelReader.containsAnyLiquid and native BoxBlockMatcher/BlockScanUtils over real ProtoChunk sections and palettes. All registered block fluid-presence values, inclusive AABB floors, chunk/section scan order, height limits, palette changes/compaction, nonfinite rejection and explicit Rust query budgets. Public query traces and results match; Rust skips dry active palettes without unpacking cells. Controlled repeating resident chunk snapshots; Entity.isFree collision composition and live world integration remain pending.') + lab.write_json(report_path,report);print(f'Scoped fluid occupancy parity passed: {report_path}',flush=True) + + +if __name__=='__main__':main() From afd85d246d9aa51812807ab3ebe3f4770bc9cdc2 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 02:53:17 +0200 Subject: [PATCH 094/253] Compose entity free-space checks over registered collisions and fluids --- .../collision-regression.json | 254 ++++++++++++++++++ .../scoped-parity.json | 254 ++++++++++++++++++ .../registry_collision_scan_fixture.rs | 68 +++++ crates/horizon-world/src/free_space.rs | 43 +++ crates/horizon-world/src/lib.rs | 1 + .../src/registry_collision_scan.rs | 35 +++ docs/collision-geometry.md | 19 ++ .../VanillaRegistryCollisionScanOracle.java | 9 +- tools/test_free_space_parity.py | 119 ++++++++ 9 files changed, 800 insertions(+), 2 deletions(-) create mode 100644 benchmarks/rust-free-space-2026-10-07/collision-regression.json create mode 100644 benchmarks/rust-free-space-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/src/free_space.rs create mode 100644 tools/test_free_space_parity.py diff --git a/benchmarks/rust-free-space-2026-10-07/collision-regression.json b/benchmarks/rust-free-space-2026-10-07/collision-regression.json new file mode 100644 index 000000000..74cdc1534 --- /dev/null +++ b/benchmarks/rust-free-space-2026-10-07/collision-regression.json @@ -0,0 +1,254 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "registry_states": 35723, + "block_definitions": 1286, + "definition_counts": { + "tagged_full": 1221, + "never": 42, + "closed_shulker": 17, + "always": 4, + "not_extended": 2 + }, + "native_chunk_storage": "ProtoChunk", + "rust_chunk_storage": "TerrainChunk", + "fixtures": 80270, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryCollisionScanOracle.java": "61c320ce05a96cc0f4bf7a1526cb51a912e03bc64d8423f2dfd70513ce4f00a0", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "f2b4f440a5bbce4224a4b3cee494b0f7ddcafbf72db12592c94ef9fb94fbc8a6", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSuffocationOracle.java": "8dd870e65807bac4234085958830321061f0a3805dcf2b1219514107ba710503", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceSupportOracle.java": "9ce939a435842867786fed648951bbe77f6ab843f6df09af15f3deb1948c4877", + "tools/test_world_collision_check_parity.py": "3b8a82f72220e20f96e33e2ac09030fd82cb6c3a7511e7b11387de413be6452e", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-world/examples/registry_collision_scan_fixture.rs": "e35aed3ae18c08c31f35ec0e9f8cfe6691dea587b587c95725610d9aa48b7daa", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "302223c3742241915db90aa99a8c0c440871907dbcf9a40166b72dac33a37554", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f" + }, + "fixtures_sha256": { + ".local/rust-world-collision-check-parity/inputs.txt": "210f1473983831ae93949eae6f5eae01ace1c729c46125e44f76143d23fa49ff", + ".local/rust-world-collision-check-parity/facts.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-world-collision-check-parity/definitions.json": "9cac3c650353104db1648050621057bfe104dec1f44b53d0b7875f7bc20e6eec", + ".local/rust-world-collision-check-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-world-collision-check-parity/cached-collision.nbt": "4a274cd720a1bda585b02f50f16e90246576679e1e173c214548c5cbf607ab2d", + ".local/rust-world-collision-check-parity/tags.json": "5e1301e5a9abf7e4de93af5dae3a157e852dbdb4ea345c2eb626305a605d4f98" + }, + "rust_output_sha256": "fadc86b51a80004c49117311fbe87d2d44405681ceb26bf71593784261ff214c", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "fadc86b51a80004c49117311fbe87d2d44405681ceb26bf71593784261ff214c", + "matched_output_lines": 4793095 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "fadc86b51a80004c49117311fbe87d2d44405681ceb26bf71593784261ff214c", + "matched_output_lines": 4793095 + } + ], + "scope": "Actual native CollisionGetter.noCollision for an entity executes lazy BlockCollisions over registered blocks and resident ProtoChunk sections, then entity list and applicable border shape checks. Rust uses the registry-bound TerrainChunk scan in the same short-circuit order. All registered states, controlled context variants, degenerate entity shapes, empty/disjoint borders, missing chunks, chunk/height boundaries and failures are compared. Entity list contents and border applicability/shapes are controlled; null-entity overloads, live entity indexing, experimental minecarts and player ledge behavior remain separate work." +} diff --git a/benchmarks/rust-free-space-2026-10-07/scoped-parity.json b/benchmarks/rust-free-space-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..2d901545f --- /dev/null +++ b/benchmarks/rust-free-space-2026-10-07/scoped-parity.json @@ -0,0 +1,254 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "registry_states": 35723, + "block_definitions": 1286, + "definition_counts": { + "tagged_full": 1221, + "never": 42, + "closed_shulker": 17, + "always": 4, + "not_extended": 2 + }, + "native_chunk_storage": "ProtoChunk", + "rust_chunk_storage": "TerrainChunk", + "fixtures": 83630, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryCollisionScanOracle.java": "61c320ce05a96cc0f4bf7a1526cb51a912e03bc64d8423f2dfd70513ce4f00a0", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "f2b4f440a5bbce4224a4b3cee494b0f7ddcafbf72db12592c94ef9fb94fbc8a6", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSuffocationOracle.java": "8dd870e65807bac4234085958830321061f0a3805dcf2b1219514107ba710503", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceSupportOracle.java": "9ce939a435842867786fed648951bbe77f6ab843f6df09af15f3deb1948c4877", + "tools/test_free_space_parity.py": "76ae9d58af21ff174c04d9c893c24a2389d3432cf420c207870043052fb83311", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-world/examples/registry_collision_scan_fixture.rs": "e35aed3ae18c08c31f35ec0e9f8cfe6691dea587b587c95725610d9aa48b7daa", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "302223c3742241915db90aa99a8c0c440871907dbcf9a40166b72dac33a37554", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f" + }, + "fixtures_sha256": { + ".local/rust-free-space-parity/inputs.txt": "4481c0be8f29cc72059c31d803e99ec294c6e40fda20d048feb40ae50b596e5e", + ".local/rust-free-space-parity/facts.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-free-space-parity/definitions.json": "9cac3c650353104db1648050621057bfe104dec1f44b53d0b7875f7bc20e6eec", + ".local/rust-free-space-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-free-space-parity/cached-collision.nbt": "4a274cd720a1bda585b02f50f16e90246576679e1e173c214548c5cbf607ab2d", + ".local/rust-free-space-parity/tags.json": "5e1301e5a9abf7e4de93af5dae3a157e852dbdb4ea345c2eb626305a605d4f98" + }, + "rust_output_sha256": "dd887986afcfa9211283cee730efa39cbb0cee844dff4a9f07dfb763ca724334", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "dd887986afcfa9211283cee730efa39cbb0cee844dff4a9f07dfb763ca724334", + "matched_output_lines": 5764046 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "dd887986afcfa9211283cee730efa39cbb0cee844dff4a9f07dfb763ca724334", + "matched_output_lines": 5764046 + } + ], + "scope": "Actual Entity.isFree offsets its AABB, invokes native block/entity/border noCollision and only then section-based containsAnyLiquid over resident ProtoChunk storage. Rust composes registry-bound collision resolution and FluidPresence over the same TerrainChunk storage. Covers all registered states, offsets, context variants, height/chunk boundaries, fluids, missing required chunks and partial query failures. Entity collision lists, border applicability and contexts are controlled; chunk generation, live entity indexing and full playable integration remain pending." +} diff --git a/crates/horizon-world/examples/registry_collision_scan_fixture.rs b/crates/horizon-world/examples/registry_collision_scan_fixture.rs index dff872908..9e3a19914 100644 --- a/crates/horizon-world/examples/registry_collision_scan_fixture.rs +++ b/crates/horizon-world/examples/registry_collision_scan_fixture.rs @@ -12,6 +12,8 @@ use horizon_world::{ edge_backoff::{EdgeBackoffInput, EdgeBackoffWorld, back_off_from_edge}, entity_obstruction::EntityIdentity, fluid::FluidState, + fluid_occupancy::{FluidOccupancyWorld, FluidPresence}, + free_space::offset_is_free, heightmap::HeightmapState, liquid_collision::LiquidCollisionWorld, nbt::{self, Limits}, @@ -219,6 +221,49 @@ fn box_shape(v: &Value) -> io::Result { )) .map_err(io::Error::other) } +impl FluidOccupancyWorld for World<'_> { + type Error = io::Error; + type Chunk = (i32, i32); + fn minimum_section_y(&mut self) -> io::Result { + self.trace.borrow_mut().query("liquid-min-section".into())?; + Ok(-1) + } + fn maximum_section_y(&mut self) -> io::Result { + self.trace.borrow_mut().query("liquid-max-section".into())?; + Ok(1) + } + fn chunk(&mut self, x: i32, z: i32) -> io::Result { + self.trace + .borrow_mut() + .query(format!("liquid-chunk {x} {z}"))?; + if self.chunks.contains_key(&(x, z)) { + Ok((x, z)) + } else { + Err(io::Error::other("missing required liquid chunk")) + } + } + fn section( + &mut self, + chunk: Self::Chunk, + y: i32, + ) -> io::Result<&horizon_world::chunk::BlockSection<'_>> { + self.trace + .borrow_mut() + .query(format!("liquid-section {y}"))?; + self.chunks[&chunk] + .0 + .section((y + 1) as usize) + .ok_or_else(|| io::Error::other("missing section")) + } + fn minimum_y(&mut self) -> io::Result { + self.trace.borrow_mut().query("liquid-min-y".into())?; + Ok(-16) + } + fn maximum_y(&mut self) -> io::Result { + self.trace.borrow_mut().query("liquid-max-y".into())?; + Ok(31) + } +} impl EntityMovementWorld for World<'_> { type Error = io::Error; fn entity_collisions( @@ -389,6 +434,7 @@ fn main() -> Result<(), Box> { .cloned() .collect::>(); let binding = SuffocationRegistry::new(collisions, &definitions, &natural)?; + let fluids = FluidPresence::new(®istry)?; let properties = Properties(Arc::new( (0..registry.len()) .map(|id| { @@ -514,6 +560,28 @@ fn main() -> Result<(), Box> { writeln!(t.out, "done edge {calls}")?; continue; } + if m.get("free").and_then(Value::as_bool) == Some(true) { + let result = offset_is_free( + &mut bound, + &fluids, + CollisionCheckRequest { + entity: EntityIdentity(1), + context, + bounds, + candidate_budget: 1_000_000, + }, + Vec3::new(number(&v[0]), number(&v[1]), number(&v[2])), + 1_000_000, + ); + let mut t = trace.borrow_mut(); + match result { + Ok(b) => writeln!(t.out, "free {b}")?, + Err(_) => writeln!(t.out, "error")?, + }; + let calls = t.calls; + writeln!(t.out, "done free {calls}")?; + continue; + } if m.get("check").and_then(Value::as_bool) == Some(true) { let result = no_world_collision( &mut bound, diff --git a/crates/horizon-world/src/free_space.rs b/crates/horizon-world/src/free_space.rs new file mode 100644 index 000000000..0d0b48d0f --- /dev/null +++ b/crates/horizon-world/src/free_space.rs @@ -0,0 +1,43 @@ +//! Entity.isFree: offset collision clearance followed by resident liquid checks. +use crate::{ + block_collision_scan::{BlockCollisionWorld, CollisionScanError}, + fluid_occupancy::{ + FluidOccupancyError, FluidOccupancyWorld, FluidPresence, contains_any_liquid, + }, + world_movement::{CollisionCheckRequest, EntityMovementWorld, no_world_collision}, +}; +use horizon_core::geometry::Vec3; +use std::fmt; +#[derive(Debug)] +pub enum FreeSpaceError { + Collision(CollisionScanError), + Fluid(FluidOccupancyError), +} +impl fmt::Display for FreeSpaceError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::Collision(e) => e.fmt(f), + Self::Fluid(e) => e.fmt(f), + } + } +} +impl std::error::Error for FreeSpaceError {} +pub fn offset_is_free( + world: &mut W, + fluids: &FluidPresence<'_>, + mut request: CollisionCheckRequest<'_>, + offset: Vec3, + fluid_budget: usize, +) -> Result> +where + W: BlockCollisionWorld + + EntityMovementWorld + + FluidOccupancyWorld, +{ + request.bounds = request.bounds.move_by(offset); + let bounds = request.bounds; + if !no_world_collision(world, request).map_err(FreeSpaceError::Collision)? { + return Ok(false); + } + Ok(!contains_any_liquid(world, fluids, bounds, fluid_budget).map_err(FreeSpaceError::Fluid)?) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 4a6ec7a4f..46aac9c2c 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -26,6 +26,7 @@ pub mod fall_damage; pub mod fluid; pub mod fluid_occupancy; pub mod fluid_shape; +pub mod free_space; pub mod ground_support; pub mod heightmap; pub mod interaction_shapes; diff --git a/crates/horizon-world/src/registry_collision_scan.rs b/crates/horizon-world/src/registry_collision_scan.rs index f0f0f14a7..ebc70a2e2 100644 --- a/crates/horizon-world/src/registry_collision_scan.rs +++ b/crates/horizon-world/src/registry_collision_scan.rs @@ -124,3 +124,38 @@ impl crate::world_movement::Entit .map_err(CollisionQueryError::Context) } } + +impl crate::fluid_occupancy::FluidOccupancyWorld + for RegistryCollisionWorld<'_, '_, W> +{ + type Error = CollisionQueryError; + type Chunk = W::Chunk; + fn minimum_section_y(&mut self) -> Result { + self.world + .minimum_section_y() + .map_err(CollisionQueryError::Context) + } + fn maximum_section_y(&mut self) -> Result { + self.world + .maximum_section_y() + .map_err(CollisionQueryError::Context) + } + fn chunk(&mut self, x: i32, z: i32) -> Result { + self.world.chunk(x, z).map_err(CollisionQueryError::Context) + } + fn section( + &mut self, + chunk: Self::Chunk, + y: i32, + ) -> Result<&crate::chunk::BlockSection<'_>, Self::Error> { + self.world + .section(chunk, y) + .map_err(CollisionQueryError::Context) + } + fn minimum_y(&mut self) -> Result { + self.world.minimum_y().map_err(CollisionQueryError::Context) + } + fn maximum_y(&mut self) -> Result { + self.world.maximum_y().map_err(CollisionQueryError::Context) + } +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 30e342989..95335fd8f 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -936,3 +936,22 @@ changes/compaction and failures. Rust-only checks verify typed budget, nonfinite and registry errors. Targeted Clippy passes. Chunk snapshots repeat controlled resident data; collision composition for `Entity.isFree` and live world binding remain pending. No performance gain is claimed without measurement. + + +`free_space.offset_is_free` composes native offset bounds, registry-bound +block/entity/border collision clearance and resident liquid occupancy. The +liquid scan runs only after collision clearance succeeds. Both phases share +resident TerrainChunk storage through `RegistryCollisionWorld`; their typed +errors and separate query budgets remain visible to the caller. + +`python3 tools/test_free_space_parity.py` invokes actual `Entity.isFree`, native +collision iteration and liquid scanning on the corresponding resident ProtoChunk +storage. The [free-space report](../benchmarks/rust-free-space-2026-10-07/scoped-parity.json) +records **5,764,046 matching lines per JAR** across all **35,723 states**, offsets, +fluid/context variants, height boundaries, required missing chunks and failures. +Targeted Clippy passes. Entity lists, border applicability and collision contexts +are controlled; chunk generation, live entity indexing and full playable +integration remain pending. +The [collision-only regression](../benchmarks/rust-free-space-2026-10-07/collision-regression.json) +also passes **4,793,095 matching lines per JAR** after extending the shared +fixture and registry binding. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryCollisionScanOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryCollisionScanOracle.java index 093fc522a..9096f5aa9 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryCollisionScanOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryCollisionScanOracle.java @@ -22,10 +22,11 @@ public final class VanillaRegistryCollisionScanOracle { } static PalettedContainerFactory factory; static class Chunk extends ProtoChunk { - Trace trace;BlockEntity entity; + Trace trace;BlockEntity entity;boolean liquidTrace; Chunk(int x,int z,Trace trace,BlockEntity entity){super(new ChunkPos(x,z),UpgradeData.EMPTY,LevelHeightAccessor.create(-16,48),factory,null);this.trace=trace;this.entity=entity;} @Override public BlockState getBlockState(BlockPos p){trace.query("block "+p.getX()+" "+p.getY()+" "+p.getZ());return super.getBlockState(p);} @Override public BlockEntity getBlockEntity(BlockPos p){trace.query("entity chunk "+p.getX()+" "+p.getY()+" "+p.getZ());return entity;} + @Override public LevelChunkSection getSection(int index){if(liquidTrace)trace.query("liquid-section "+(index-1));return super.getSection(index);} void write(BlockPos p,int id){getSection(getSectionIndex(p.getY())).setBlockState(p.getX()&15,p.getY()&15,p.getZ()&15,Block.stateById(id),false);} } static String boxText(String label,AABB b){return label+String.format(" %016x %016x %016x %016x %016x %016x",Double.doubleToLongBits(b.minX),Double.doubleToLongBits(b.minY),Double.doubleToLongBits(b.minZ),Double.doubleToLongBits(b.maxX),Double.doubleToLongBits(b.maxY),Double.doubleToLongBits(b.maxZ));} @@ -36,8 +37,9 @@ public final class VanillaRegistryCollisionScanOracle { @Override public VoxelShape getCollisionShape(){trace.query("border-shape");return shape;} } static final class StepLevel extends net.minecraft.server.level.ServerLevel { - Trace trace;StepBorder border;List entities;CollisionGetter world;CollisionContext context; + Trace trace;StepBorder border;List entities;CollisionGetter world;CollisionContext context;LevelReader liquidWorld;Collection chunks; private StepLevel(){super(null,null,null,null,null,null,false,0L,List.of(),false);} + @Override public boolean containsAnyLiquid(AABB bounds){for(var c:chunks)c.liquidTrace=true;try{return liquidWorld.containsAnyLiquid(bounds);}finally{for(var c:chunks)c.liquidTrace=false;}} @Override public net.minecraft.world.level.border.WorldBorder getWorldBorder(){trace.query("border");return border;} @Override public List getEntityCollisions(net.minecraft.world.entity.Entity entity,AABB bounds){trace.query(boxText("entities",bounds));return entities;} @Override public Iterable getBlockCollisions(net.minecraft.world.entity.Entity entity,AABB bounds){return ()->new BlockCollisions(world,context,bounds,false,(p,shape)->shape);} @@ -93,6 +95,8 @@ public final class VanillaRegistryCollisionScanOracle { var v=f.getAsJsonArray("box");var bounds=new AABB(number(v.get(0)),number(v.get(1)),number(v.get(2)),number(v.get(3)),number(v.get(4)),number(v.get(5))); if(f.has("movement")){ var m=f.getAsJsonObject("movement");var level=(StepLevel)allocate.invoke(unsafe,StepLevel.class);level.trace=trace;level.world=world;level.context=context; + level.chunks=chunks.values();level.liquidWorld=(LevelReader)Proxy.newProxyInstance(LevelReader.class.getClassLoader(),new Class[]{LevelReader.class},(proxy,method,values)->{switch(method.getName()){case "getMinSectionY":trace.query("liquid-min-section");return -1;case "getMaxSectionY":trace.query("liquid-max-section");return 1;case "getMinY":trace.query("liquid-min-y");return -16;case "getMaxY":trace.query("liquid-max-y");return 31;case "getChunk":if(values.length!=2)throw new AssertionError(method);int x=(int)values[0],z=(int)values[1];trace.query("liquid-chunk "+x+" "+z);var c=chunks.get(key(x,z));if(c==null)throw new Stop();return c;default:if(method.isDefault())return InvocationHandler.invokeDefault(proxy,method,values);throw new AssertionError(method);}}); + level.entities=new ArrayList<>();for(var shape:m.getAsJsonArray("entities"))level.entities.add(boxShape(shape)); level.border=new StepBorder();level.border.trace=trace;level.border.shape=m.get("border").isJsonNull()?null:boxShape(m.get("border")); var entity=(StepEntity)allocate.invoke(unsafe,StepEntity.class);entity.configure(level,bounds,(float)number(m.get("step")),m.get("grounded").getAsBoolean());var delta=m.getAsJsonArray("delta"); @@ -100,6 +104,7 @@ public final class VanillaRegistryCollisionScanOracle { var e=m.getAsJsonObject("edge");var player=(EdgePlayer)allocate.invoke(unsafe,EdgePlayer.class);player.configure(level,bounds,(float)number(m.get("step")),m.get("grounded").getAsBoolean(),e.get("staying").getAsBoolean());player.fallDistance=number(e.get("fall"));var a=new net.minecraft.world.entity.player.Abilities();a.flying=e.get("flying").getAsBoolean();abilities.set(player,a); try{var result=player.backoff(new Vec3(number(delta.get(0)),number(delta.get(1)),number(delta.get(2))),net.minecraft.world.entity.MoverType.valueOf(e.get("mover").getAsString()));out.printf("edge %016x %016x %016x%n",Double.doubleToLongBits(result.x),Double.doubleToLongBits(result.y),Double.doubleToLongBits(result.z));}catch(Stop error){out.println("error");}out.println("done edge "+trace.calls);continue; } + if(m.has("free")&&m.get("free").getAsBoolean()){try{out.println("free "+entity.isFree(number(delta.get(0)),number(delta.get(1)),number(delta.get(2))));}catch(Stop error){out.println("error");}out.println("done free "+trace.calls);continue;} if(m.has("check")&&m.get("check").getAsBoolean()){try{out.println("clear "+level.noCollision(entity,bounds));}catch(Stop error){out.println("error");}out.println("done check "+trace.calls);continue;} try{var result=(Vec3)collide.invoke(entity,new Vec3(number(delta.get(0)),number(delta.get(1)),number(delta.get(2))));out.printf("movement %016x %016x %016x%n",Double.doubleToLongBits(result.x),Double.doubleToLongBits(result.y),Double.doubleToLongBits(result.z));} catch(InvocationTargetException error){if(error.getCause() instanceof Stop)out.println("error");else throw error;} diff --git a/tools/test_free_space_parity.py b/tools/test_free_space_parity.py new file mode 100644 index 000000000..5fe5e0e70 --- /dev/null +++ b/tools/test_free_space_parity.py @@ -0,0 +1,119 @@ +#!/usr/bin/env python3 +"""Compare integrated entity free-space queries with collisions and resident fluids with pinned vanilla.""" +import collections +import json +import os +from pathlib import Path +import platform +import subprocess +import struct +import random +try: + from . import lab, test_rust_parity as base, test_worldgen_parity as worldgen +except ImportError: + import lab + import test_rust_parity as base + import test_worldgen_parity as worldgen + + +def collision_corpus(facts): + def bits(v):return struct.pack('>d',float(v)).hex() + def row(state,bounds=(-.3,0,.2,.3,1.8,.8),context=0,entities=(),border=None,fail=-1,blocks=None): + return dict(chunks=[[x,z] for x in [-1,0,1] for z in [-1,0,1]],blocks=blocks if blocks is not None else [[0,0,0,state]],context=context,y=bits(0),entities=[0,0],fail=fail,limit=100000,suffocating=False,box=list(map(bits,bounds)),movement=dict(check=True,delta=list(map(bits,[0,0,0])),step=bits(.6),grounded=True,entities=[list(map(bits,b)) for b in entities],border=None if border is None else list(map(bits,border)))) + for state in range(len(facts['states'])): + yield row(state,context=state%4) + yield row(state,bounds=(-.6,0,.2,-.2,1.8,.8),context=state%4,border=[-.5,-1,-1,-.4,3,1]) + defaults=facts['defaults'];names=['air','stone','water','lava','scaffolding','powder_snow','shulker_box','moving_piston','stone_slab','oak_stairs','snow','cobweb','bamboo'] + boxes=[[-.3,0,.2,.3,1.8,.8],[0,0,0,1,1,1],[0,0,0,0,0,0],[1,0,0,1.6,1.8,.6],[-16,-16,-16,-15,0,-15],[15.8,0,15.8,16.4,1.8,16.4]] + entity_lists=[[],[[0,0,0,0,0,0]],[[0,0,0,1,1,1]],[[100,100,100,101,101,101]]] + borders=[None,[-.5,-1,-1,-.4,3,1],[0,0,0,0,0,0],[100,100,100,101,101,101]] + for name in names: + for context in range(4): + for entities in entity_lists: + for border in borders: + for fail in [-1,0,1,3,12,25,50]:yield row(defaults['minecraft:'+name],context=context,entities=entities,border=border,fail=fail) + rng=random.Random(0x434c454152) + for _ in range(3000): + state=rng.randrange(len(facts['states']));f=row(state,bounds=rng.choice(boxes),context=rng.randrange(4),entities=rng.choice(entity_lists),border=rng.choice(borders),fail=rng.choice([-1,-1,0,3,12,50])) + f['entities']=[rng.randrange(3),rng.randrange(3)] + if rng.randrange(3)==0:f['chunks']=[];f['blocks']=[] + yield f + + +def corpus(facts): + def bits(v):return struct.pack('>d',float(v)).hex() + for i,f in enumerate(collision_corpus(facts)): + f['movement'].pop('check');f['movement']['free']=True + f['movement']['delta']=[bits(v) for v in [(0,0,0),(.5,.2,0),(0,.8,.5),(-.2,0,-.2)][i%4]] + yield f + air=facts['defaults']['minecraft:air'] + for state in [facts['defaults']['minecraft:'+n] for n in ['air','water','lava','seagrass','kelp','bubble_column','water_cauldron','scaffolding','powder_snow','stone']]: + for y in [-32,-16,-.1,0,15.9,31,32,64]: + for dx in [-16,-.5,0,.5,16,32]: + for fail in [-1,0,10,30,50,100,150]: + yield dict(chunks=[[x,z] for x in [-1,0,1] for z in [-1,0,1]],blocks=[[0,0,0,state]],context=0,y=bits(0),entities=[0,0],fail=fail,limit=100000,suffocating=False,box=list(map(bits,[0,y,0,1,y+1,1])),movement=dict(free=True,delta=list(map(bits,[dx,0,0])),step=bits(.6),grounded=True,entities=[],border=None)) + + +def main(): + lock, jars, libraries = base.verify_artifacts() + build = lab.LOCAL/'rust-free-space-parity';build.mkdir(exist_ok=True) + report_path = build/'report.json';report_path.unlink(missing_ok=True) + oracle = lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryCollisionScanOracle.java' + helpers = [oracle.with_name(name+'.java') for name in + ['VanillaHeightmapOracle', 'VanillaCollisionOracle', 'VanillaBlockStateCodecOracle', 'VanillaSuffocationOracle', 'VanillaFaceSupportOracle']] + sources = [oracle, *helpers, Path(__file__), lab.ROOT/'tools/test_rust_parity.py', + lab.ROOT/'tools/test_worldgen_parity.py', lab.ROOT/'tools/lab.py', + lab.ROOT/'Cargo.toml', lab.ROOT/'Cargo.lock', + lab.ROOT/'crates/horizon-world/examples/registry_collision_scan_fixture.rs'] + for crate in ['horizon-core', 'horizon-world']: + sources += [lab.ROOT/'crates'/crate/'Cargo.toml', + *sorted((lab.ROOT/'crates'/crate/'src').rglob('*.rs'))] + tested = base.source_hashes(sources) + tags = worldgen.tag_resources(jars['server']) + if tags != worldgen.tag_resources(jars['client']):raise AssertionError('Client/server block tags differ') + lab.write_json(build/'tags.json', tags) + classes = build/'classes';classes.mkdir(exist_ok=True) + dependencies = os.pathsep.join(map(str, libraries)) + def run(command, name): + with (build/(name+'.log')).open('w') as log: + subprocess.run(list(map(str, command)), cwd=lab.ROOT, check=True, timeout=3600, + stdout=log, stderr=subprocess.STDOUT) + run(['javac', '--release', lock['minecraft']['java_major'], '-proc:none', '-cp', + str(jars['server'])+os.pathsep+dependencies, '-d', classes, oracle, *helpers], 'compile-java') + def java(side, mode): + run(['java', '-Xmx768M', '-cp', os.pathsep.join([str(classes), str(jars[side]), dependencies]), + 'dev.horizonlab.parity.VanillaRegistryCollisionScanOracle', mode, build], side+'-'+mode) + java('server', 'export') + facts = json.loads((build/'facts.json').read_text()) + if len(facts['states']) != 35723:raise AssertionError('Incomplete pinned registry') + definitions = json.loads((build/'definitions.json').read_text()) + count = 0 + with (build/'inputs.txt').open('w') as output: + for fixture in corpus(facts): + output.write(json.dumps(fixture, separators=(',', ':'))+'\n');count += 1 + fixture_paths = [build/name for name in ['inputs.txt', 'facts.json', 'definitions.json', + 'block-registry.nbt', 'cached-collision.nbt', 'tags.json']] + fixtures = base.source_hashes(fixture_paths) + run(['cargo', 'build', '--locked', '--release', '-p', 'horizon-world', '--example', 'registry_collision_scan_fixture'], 'compile-rust') + metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--locked', '--no-deps', '--format-version', '1'], cwd=lab.ROOT)) + binary = Path(metadata['target_directory'])/'release/examples'/('registry_collision_scan_fixture.exe' if os.name=='nt' else 'registry_collision_scan_fixture') + run([binary, build], 'rust');references = [] + for side, jar in jars.items(): + java(side, side) + matched = base.compare(build/(side+'.txt'), build/'rust.txt') + references.append({'side':side, 'jar_sha256':lab.digest(jar, 'sha256'), + 'output_sha256':lab.digest(build/(side+'.txt'), 'sha256'), 'matched_output_lines':matched}) + print(f'{side}: {matched:,} free-space lines match', flush=True) + base.ensure_sources_unchanged(sources, tested);base.ensure_sources_unchanged(fixture_paths, fixtures) + report = {'schema':1, 'minecraft':lock['minecraft']['version'], 'manifest_sha1':lock['minecraft']['manifest_sha1'], + 'platform':platform.platform(), 'java':subprocess.check_output(['java', '--version'], text=True).splitlines()[0], + 'rustc':subprocess.check_output(['rustc', '--version'], text=True).strip(), + 'registry_states':len(facts['states']), 'block_definitions':len(definitions), + 'definition_counts':dict(collections.Counter(definitions.values())), + 'native_chunk_storage':'ProtoChunk', 'rust_chunk_storage':'TerrainChunk', 'fixtures':count, 'sources_sha256':tested, 'fixtures_sha256':fixtures, + 'rust_output_sha256':lab.digest(build/'rust.txt', 'sha256'), 'references':references, + 'scope':'Actual Entity.isFree offsets its AABB, invokes native block/entity/border noCollision and only then section-based containsAnyLiquid over resident ProtoChunk storage. Rust composes registry-bound collision resolution and FluidPresence over the same TerrainChunk storage. Covers all registered states, offsets, context variants, height/chunk boundaries, fluids, missing required chunks and partial query failures. Entity collision lists, border applicability and contexts are controlled; chunk generation, live entity indexing and full playable integration remain pending.'} + lab.write_json(report_path, report);print(f'Scoped free space parity passed: {report_path}', flush=True) + + +if __name__ == '__main__':main() From c0a4faa869bc2713051f7757e02eb78ec35ba776 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 03:09:06 +0200 Subject: [PATCH 095/253] Implement vanilla entity fluid immersion and current tracking --- .../scoped-parity.json | 233 ++++++++++++ .../examples/entity_fluid_fixture.rs | 302 ++++++++++++++++ crates/horizon-world/src/entity_fluid.rs | 337 ++++++++++++++++++ crates/horizon-world/src/lib.rs | 1 + docs/collision-geometry.md | 21 ++ .../parity/VanillaEntityFluidOracle.java | 72 ++++ tools/test_entity_fluid_parity.py | 95 +++++ 7 files changed, 1061 insertions(+) create mode 100644 benchmarks/rust-entity-fluid-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/entity_fluid_fixture.rs create mode 100644 crates/horizon-world/src/entity_fluid.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityFluidOracle.java create mode 100644 tools/test_entity_fluid_parity.py diff --git a/benchmarks/rust-entity-fluid-2026-10-07/scoped-parity.json b/benchmarks/rust-entity-fluid-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..d597b4aa6 --- /dev/null +++ b/benchmarks/rust-entity-fluid-2026-10-07/scoped-parity.json @@ -0,0 +1,233 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 7646, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityFluidOracle.java": "79f5da09aa75a833627419619276e275fa2ad79d85eeb7e8e26861d33659c69a", + "tools/test_entity_fluid_parity.py": "34d563a48f30434258cc8f836457f396ee4f1b2973a80b112bda22be1dc90bb8", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "6fdb5605a0c4378587ab29734393a465b4fab0a0ce260731033f44b948f2e889", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/entity_fluid_fixture.rs": "a22f84b7a053d220c7a7fb260ac29f3e12ea1134530d9873c5d64eeaeb3e2b89" + }, + "fixtures_sha256": { + ".local/rust-entity-fluid-parity/inputs.txt": "e9eb2297d21b93c9c25046f240984508fa3593d14833e4f5592a623b8ed85838" + }, + "rust_output_sha256": "a675c1a446e77894680508b5160f2b8ce656ace279ad80352a122fd517efa699", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "a675c1a446e77894680508b5160f2b8ce656ace279ad80352a122fd517efa699", + "matched_output_lines": 607338 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "a675c1a446e77894680508b5160f2b8ce656ace279ad80352a122fd517efa699", + "matched_output_lines": 607338 + } + ], + "scope": "Actual EntityFluidInteraction update, tracker pruning, body/eye depth, loaded-chunk preflight, overlapping/reloaded tags, ordered current accumulation and native Entity.addDeltaMovement. Controlled fluid height/flow and camera-support cells, real ProtoChunk section fluid flags, player versus nonplayer classes, callback mutations and injected failures. Live fluid flow/propagation and full entity/world integration remain pending." +} diff --git a/crates/horizon-world/examples/entity_fluid_fixture.rs b/crates/horizon-world/examples/entity_fluid_fixture.rs new file mode 100644 index 000000000..35daf7ffd --- /dev/null +++ b/crates/horizon-world/examples/entity_fluid_fixture.rs @@ -0,0 +1,302 @@ +use horizon_core::{ + geometry::{Aabb, Vec3}, + position::BlockPos, +}; +use horizon_world::{ + entity_fluid::*, + fluid::{FluidKind, FluidState}, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn single(v: &Value) -> f32 { + f32::from_bits(u32::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn vector(v: &Value) -> Vec3 { + Vec3::new(number(&v[0]), number(&v[1]), number(&v[2])) +} +fn bits(v: f64) -> u64 { + if v.is_nan() { + f64::NAN.to_bits() + } else { + v.to_bits() + } +} +fn show(v: Vec3) -> String { + format!("{:016x} {:016x} {:016x}", bits(v.x), bits(v.y), bits(v.z)) +} +fn pos(p: BlockPos) -> String { + format!("{} {} {}", p.x, p.y, p.z) +} +fn position(v: &Value) -> BlockPos { + BlockPos::new( + v[0].as_i64().unwrap() as i32, + v[1].as_i64().unwrap() as i32, + v[2].as_i64().unwrap() as i32, + ) +} +struct World<'a> { + op: &'a Value, + out: &'a mut dyn Write, + calls: i64, + velocity: Vec3, + block: BlockPos, + wet: Vec, + states: [FluidState; 5], + player: bool, +} +impl World<'_> { + fn query(&mut self, s: String) -> io::Result<()> { + writeln!(self.out, "{s}")?; + let n = self.calls; + self.calls += 1; + if n == self.op["fail"].as_i64().unwrap() { + return Err(io::Error::other("injected query failure")); + } + if n == self.op["mutate_at"].as_i64().unwrap() { + self.velocity = vector(&self.op["after_velocity"]); + self.block = position(&self.op["after_block"]); + } + Ok(()) + } + fn cell(&self, p: BlockPos) -> &Value { + self.op["cells"].get(pos(p)).unwrap_or(&self.op["default"]) + } +} +impl FluidMembership for World<'_> { + fn fluid_in_tag(&self, fluid: FluidKind, tag: FluidTagId) -> bool { + self.op["tags"][tag.0 as usize].as_u64().unwrap() & (1 << (fluid as u8)) != 0 + } +} +impl FluidInteractionWorld for World<'_> { + type Error = io::Error; + type Chunk = (); + fn interaction_box(&mut self) -> io::Result> { + self.query("box".into())?; + let b = &self.op["bounds"]; + Ok(if b.is_null() { + None + } else { + Some(Aabb::new( + Vec3::new(number(&b[0]), number(&b[1]), number(&b[2])), + Vec3::new(number(&b[3]), number(&b[4]), number(&b[5])), + )) + }) + } + fn loaded_chunk(&mut self, x: i32, z: i32) -> io::Result> { + self.query(format!("chunk {x} {z}"))?; + Ok((!self.op["missing"] + .as_array() + .unwrap() + .contains(&Value::String(format!("{x} {z}")))) + .then_some(())) + } + fn chunk_sections(&mut self, _: ()) -> io::Result> { + self.query("sections".into())?; + Ok(FluidSections { + minimum_section_y: self.op["min_section"].as_i64().unwrap() as i32, + has_fluid: &self.wet, + }) + } + fn bounding_box_min_y(&self) -> f64 { + number(&self.op["base_y"]) + } + fn block_x(&self) -> i32 { + self.block.x + } + fn block_z(&self) -> i32 { + self.block.z + } + fn eye_y(&mut self) -> io::Result { + self.query("eye".into())?; + Ok(number(&self.op["eye"])) + } + fn fluid_state(&mut self, p: BlockPos) -> io::Result { + self.query(format!("fluid {}", pos(p)))?; + Ok(self.states[self.cell(p)["kind"].as_u64().unwrap() as usize]) + } + fn fluid_height(&mut self, _: FluidState, p: BlockPos) -> io::Result { + self.query(format!("height {}", pos(p)))?; + Ok(single(&self.cell(p)["height"])) + } + fn camera_height(&mut self, s: FluidState, p: BlockPos) -> io::Result { + if matches!(s.kind(), FluidKind::Water | FluidKind::Lava) { + self.query(format!( + "block {}", + pos(BlockPos::new(p.x, p.y.wrapping_add(1), p.z)) + ))?; + if self.op["sturdy"].as_bool().unwrap() { + return Ok(1.0); + } + } + self.fluid_height(s, p) + } + fn flow(&mut self, _: FluidState, p: BlockPos) -> io::Result { + self.query(format!("flow {}", pos(p)))?; + Ok(vector(&self.cell(p)["flow"])) + } +} +impl CurrentTarget for World<'_> { + type Error = io::Error; + fn is_player_class(&self) -> bool { + self.player + } + fn velocity(&mut self) -> io::Result { + self.query("velocity".into())?; + Ok(self.velocity) + } + fn add_delta_movement(&mut self, v: Vec3) -> io::Result<()> { + if [v.x, v.y, v.z].iter().all(|v| v.is_finite()) { + let old = CurrentTarget::velocity(self)?; + let next = Vec3::new(old.x + v.x, old.y + v.y, old.z + v.z); + self.query(format!("set {}", show(next)))?; + self.velocity = next; + } + Ok(()) + } +} +fn limit_checks(template: &Value, states: [FluidState; 5]) { + let mut op = template.clone(); + op["default"]["kind"] = 2.into(); + op["default"]["height"] = format!("{:08x}", 0.8f32.to_bits()).into(); + op["eye"] = format!("{:016x}", 0.5f64.to_bits()).into(); + let mut sink = io::sink(); + let mut world = World { + op: &op, + out: &mut sink, + calls: 0, + velocity: Vec3::ZERO, + block: BlockPos::new(0, 0, 0), + wet: vec![false, true, false], + states, + player: false, + }; + let mut interaction = EntityFluidInteraction::new([FluidTagId(0)]); + assert!(matches!( + interaction.update(&mut world, false, 0), + Err(FluidInteractionError::BudgetExceeded) + )); + assert_eq!(world.calls, 1); + world.calls = 0; + assert!(matches!( + interaction.update(&mut world, false, 1), + Err(FluidInteractionError::BudgetExceeded) + )); + assert_eq!(world.calls, 3); + world.calls = 0; + assert!(matches!( + interaction.update(&mut world, false, 8), + Err(FluidInteractionError::BudgetExceeded) + )); + assert_eq!(world.calls, 10); + assert!(interaction.trackers().is_empty()); + assert!(interaction.update(&mut world, false, 9).unwrap()); + assert_eq!(interaction.trackers().len(), 1); + assert_eq!(interaction.currents()[0].1.count, 1); + let mut invalid = op.clone(); + invalid["bounds"][0] = format!("{:016x}", f64::NAN.to_bits()).into(); + world.op = &invalid; + world.calls = 0; + assert!(matches!( + interaction.update(&mut world, false, 9), + Err(FluidInteractionError::NonFiniteBounds) + )); + assert_eq!(world.calls, 1); + assert_eq!(interaction.trackers().len(), 1); + assert_eq!(interaction.trackers()[0].height, 0.0); + assert!(!interaction.trackers()[0].eyes_inside); + assert_eq!(interaction.currents()[0].1.count, 0); + let mut absent = op.clone(); + absent["bounds"] = Value::Null; + world.op = &absent; + assert!(!interaction.update(&mut world, false, 0).unwrap()); + assert!(interaction.trackers().is_empty()); +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + let states = FluidKind::ALL + .map(|k| FluidState::from_json(&format!("{{\"id\":\"{}\"}}", k.name())).unwrap()); + let input = fs::read_to_string(dir.join("inputs.txt"))?; + let first: Value = serde_json::from_str(input.lines().next().unwrap())?; + limit_checks(&first["ops"][0], states); + for line in input.lines() { + let f: Value = serde_json::from_str(line)?; + let mut interaction = EntityFluidInteraction::new( + f["order"] + .as_array() + .unwrap() + .iter() + .map(|v| FluidTagId(v.as_u64().unwrap() as u32)), + ); + for op in f["ops"].as_array().unwrap() { + let mut w = World { + op, + out: &mut out, + calls: 0, + velocity: vector(&op["velocity"]), + block: position(&op["block"]), + wet: op["wet"] + .as_array() + .unwrap() + .iter() + .map(|v| v.as_bool().unwrap()) + .collect(), + states, + player: f["player"].as_bool().unwrap(), + }; + if op["mode"].as_str().unwrap() == "update" { + match interaction.update(&mut w, op["ignore"].as_bool().unwrap(), 1_000_000) { + Ok(v) => writeln!(w.out, "result {v}")?, + Err(_) => writeln!(w.out, "error")?, + } + } else { + match interaction.apply_current( + &mut w, + FluidTagId(op["tag"].as_u64().unwrap() as u32), + number(&op["speed"]), + ) { + Ok(()) => writeln!(w.out, "result ok")?, + Err(_) => writeln!(w.out, "error")?, + } + } + writeln!(w.out, "trackers {}", interaction.trackers().len())?; + for t in interaction.trackers() { + writeln!( + w.out, + "tracker {} {:016x} {}", + t.fluid as u8, + bits(t.height), + t.eyes_inside + )?; + } + for (tag, c) in interaction.currents() { + writeln!( + w.out, + "current {} {:016x} {} {}", + tag.0, + bits(c.height), + show(c.accumulated), + c.count + )?; + } + for t in 0..4 { + let tag = FluidTagId(t); + let height = interaction.fluid_height(&w, tag); + let inside = interaction.is_in_fluid(&w, tag); + let eyes = interaction.is_eye_in_fluid(&w, tag); + writeln!(w.out, "tag {t} {:016x} {inside} {eyes}", bits(height))?; + } + writeln!(w.out, "final {}", show(w.velocity))?; + writeln!(w.out, "queries {}", w.calls)?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/src/entity_fluid.rs b/crates/horizon-world/src/entity_fluid.rs new file mode 100644 index 000000000..e3eae3c4b --- /dev/null +++ b/crates/horizon-world/src/entity_fluid.rs @@ -0,0 +1,337 @@ +//! Entity fluid immersion trackers and current accumulation across update ticks. +use crate::fluid::{FluidKind, FluidState}; +use horizon_core::{ + geometry::{Aabb, Vec3}, + position::BlockPos, +}; +use std::fmt; + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct FluidTagId(pub u32); +pub trait FluidMembership { + fn fluid_in_tag(&self, fluid: FluidKind, tag: FluidTagId) -> bool; +} +#[derive(Clone, Copy, Debug)] +pub struct FluidTracker { + pub fluid: FluidKind, + pub height: f64, + pub eyes_inside: bool, +} +#[derive(Clone, Copy, Debug)] +pub struct CurrentAccumulator { + pub height: f64, + pub accumulated: Vec3, + pub count: i32, +} +impl Default for CurrentAccumulator { + fn default() -> Self { + Self { + height: 0.0, + accumulated: Vec3::ZERO, + count: 0, + } + } +} +pub trait CurrentTarget { + type Error; + fn is_player_class(&self) -> bool; + fn velocity(&mut self) -> Result; + /// Entity.addDeltaMovement, including finite-addition filtering and a fresh + /// velocity read. Entity-specific overrides remain the provider's dispatch. + fn add_delta_movement(&mut self, delta: Vec3) -> Result<(), Self::Error>; +} +impl CurrentAccumulator { + pub fn reset(&mut self) { + *self = Self::default(); + } + pub fn accumulate(&mut self, current: Vec3) { + self.accumulated = add(self.accumulated, current); + self.count = self.count.wrapping_add(1); + } + pub fn apply_to(&self, world: &mut W, speed: f64) -> Result<(), W::Error> { + if self.count == 0 || self.accumulated.length_squared() < f64::from(1.0e-5f32) { + return Ok(()); + } + let mut current = if world.is_player_class() { + self.accumulated.scale(1.0 / f64::from(self.count)) + } else { + self.accumulated.normalize() + }; + let velocity = world.velocity()?; + current = current.scale(speed); + if velocity.x.abs() < 0.003 + && velocity.z.abs() < 0.003 + && current.length() < 0.0045000000000000005 + { + current = current.normalize().scale(0.0045000000000000005); + } + world.add_delta_movement(current) + } +} +pub struct FluidSections<'a> { + pub minimum_section_y: i32, + pub has_fluid: &'a [bool], +} +pub trait FluidInteractionWorld: FluidMembership { + type Error; + type Chunk: Copy; + fn interaction_box(&mut self) -> Result, Self::Error>; + /// FULL chunk lookup without generating/loading absent chunks. + fn loaded_chunk(&mut self, x: i32, z: i32) -> Result, Self::Error>; + fn chunk_sections(&mut self, chunk: Self::Chunk) -> Result, Self::Error>; + fn bounding_box_min_y(&self) -> f64; + fn block_x(&self) -> i32; + fn eye_y(&mut self) -> Result; + fn block_z(&self) -> i32; + fn fluid_state(&mut self, position: BlockPos) -> Result; + fn fluid_height(&mut self, state: FluidState, position: BlockPos) -> Result; + fn camera_height(&mut self, state: FluidState, position: BlockPos) -> Result; + fn flow(&mut self, state: FluidState, position: BlockPos) -> Result; +} +#[derive(Debug)] +pub enum FluidInteractionError { + World(E), + NonFiniteBounds, + BudgetExceeded, +} +impl fmt::Display for FluidInteractionError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::World(e) => e.fmt(f), + Self::NonFiniteBounds => f.write_str("nonfinite immersion bounds"), + Self::BudgetExceeded => f.write_str("immersion query budget exceeded"), + } + } +} +impl std::error::Error for FluidInteractionError {} +fn spend(budget: &mut usize) -> Result<(), FluidInteractionError> { + if *budget == 0 { + return Err(FluidInteractionError::BudgetExceeded); + } + *budget -= 1; + Ok(()) +} +fn add(a: Vec3, b: Vec3) -> Vec3 { + Vec3::new(a.x + b.x, a.y + b.y, a.z + b.z) +} +fn java_max(a: f64, b: f64) -> f64 { + if a.is_nan() { + a + } else if b.is_nan() { + b + } else if a == 0.0 && b == 0.0 { + f64::from_bits(a.to_bits() & b.to_bits()) + } else { + a.max(b) + } +} +/// Every required chunk must be loaded, even after a wet section is found. +/// Chunk order is Z then X; section order is ascending Y without early success. +pub fn has_fluid_and_loaded( + world: &mut W, + min: BlockPos, + max: BlockPos, + budget: &mut usize, +) -> Result> { + let mut present = false; + for z in (min.z >> 4)..=(max.z >> 4) { + for x in (min.x >> 4)..=(max.x >> 4) { + spend(budget)?; + let Some(chunk) = world + .loaded_chunk(x, z) + .map_err(FluidInteractionError::World)? + else { + return Ok(false); + }; + let sections = world + .chunk_sections(chunk) + .map_err(FluidInteractionError::World)?; + for y in (min.y >> 4)..=(max.y >> 4) { + spend(budget)?; + let index = y.wrapping_sub(sections.minimum_section_y); + if index >= 0 && (index as usize) < sections.has_fluid.len() { + present |= sections.has_fluid[index as usize]; + } + } + } + } + Ok(present) +} +#[derive(Default)] +pub struct EntityFluidInteraction { + trackers: Vec, + currents: Vec<(FluidTagId, CurrentAccumulator)>, +} +impl EntityFluidInteraction { + /// Preserve the caller's tag-set iteration order: a fluid's current belongs + /// to the first matching tag, even when several tags contain that fluid. + pub fn new(tags: impl IntoIterator) -> Self { + let mut state = Self::default(); + for tag in tags { + if !state.currents.iter().any(|(t, _)| *t == tag) { + state.currents.push((tag, CurrentAccumulator::default())); + } + } + state + } + pub fn trackers(&self) -> &[FluidTracker] { + &self.trackers + } + pub fn currents(&self) -> &[(FluidTagId, CurrentAccumulator)] { + &self.currents + } + pub fn fluid_height(&self, tags: &W, tag: FluidTagId) -> f64 { + let mut height = 0.0; + for t in &self.trackers { + if t.height > height && tags.fluid_in_tag(t.fluid, tag) { + height = t.height; + } + } + height + } + pub fn is_in_fluid(&self, tags: &W, tag: FluidTagId) -> bool { + self.fluid_height(tags, tag) > 0.0 + } + pub fn is_eye_in_fluid(&self, tags: &W, tag: FluidTagId) -> bool { + self.trackers + .iter() + .any(|t| t.eyes_inside && tags.fluid_in_tag(t.fluid, tag)) + } + pub fn apply_current( + &self, + world: &mut W, + tag: FluidTagId, + speed: f64, + ) -> Result<(), W::Error> { + if let Some((_, current)) = self.currents.iter().find(|(t, _)| *t == tag) { + current.apply_to(world, speed)?; + } + Ok(()) + } + /// Reset previous tick state before any query. Provider failures and budget + /// exhaustion retain all preceding tracker/current writes. + pub fn update( + &mut self, + world: &mut W, + ignore_current: bool, + mut budget: usize, + ) -> Result> { + self.trackers.retain_mut(|t| { + if t.height == 0.0 && !t.eyes_inside { + return false; + } + t.height = 0.0; + t.eyes_inside = false; + true + }); + for (_, c) in &mut self.currents { + c.reset(); + } + let Some(bounds) = world + .interaction_box() + .map_err(FluidInteractionError::World)? + else { + return Ok(false); + }; + let a = bounds.min_position(); + let b = bounds.max_position(); + if [a.x, a.y, a.z, b.x, b.y, b.z] + .iter() + .any(|v| !v.is_finite()) + { + return Err(FluidInteractionError::NonFiniteBounds); + } + let low = BlockPos::new(a.x.floor() as i32, a.y.floor() as i32, a.z.floor() as i32); + let high = BlockPos::new( + (b.x.ceil() as i32).wrapping_sub(1), + (b.y.ceil() as i32).wrapping_sub(1), + (b.z.ceil() as i32).wrapping_sub(1), + ); + if !has_fluid_and_loaded( + world, + BlockPos::new(low.x.wrapping_sub(1), low.y, low.z.wrapping_sub(1)), + BlockPos::new(high.x.wrapping_add(1), high.y, high.z.wrapping_add(1)), + &mut budget, + )? { + return Ok(false); + } + let base_y = world.bounding_box_min_y(); + let block_x = world.block_x(); + let eye = world.eye_y().map_err(FluidInteractionError::World)?; + let block_z = world.block_z(); + let mut last: Option<(FluidKind, usize, Option)> = None; + for x in low.x..=high.x { + for y in low.y..=high.y { + for z in low.z..=high.z { + spend(&mut budget)?; + let p = BlockPos::new(x, y, z); + let state = world.fluid_state(p).map_err(FluidInteractionError::World)?; + if state.kind() == FluidKind::Empty { + continue; + } + let surface = f64::from(y) + + f64::from( + world + .fluid_height(state, p) + .map_err(FluidInteractionError::World)?, + ); + if surface < a.y { + continue; + } + let kind = state.kind(); + let (_, index, current) = if let Some(last) = + last.filter(|(k, _, _)| *k == kind) + { + last + } else { + let index = + if let Some(i) = self.trackers.iter().position(|t| t.fluid == kind) { + i + } else { + self.trackers.push(FluidTracker { + fluid: kind, + height: 0.0, + eyes_inside: false, + }); + self.trackers.len() - 1 + }; + let current = if ignore_current { + None + } else { + self.currents + .iter() + .position(|(tag, _)| world.fluid_in_tag(kind, *tag)) + }; + let entry = (kind, index, current); + last = Some(entry); + entry + }; + if x == block_x && z == block_z && eye >= f64::from(y) { + let top = f64::from(y) + + f64::from( + world + .camera_height(state, p) + .map_err(FluidInteractionError::World)?, + ); + if eye <= top { + self.trackers[index].eyes_inside = true; + } + } + self.trackers[index].height = + java_max(surface - base_y, self.trackers[index].height); + if let Some(i) = current { + let mut flow = + world.flow(state, p).map_err(FluidInteractionError::World)?; + let c = &mut self.currents[i].1; + c.height = java_max(self.trackers[index].height, c.height); + if c.height < 0.4 { + flow = flow.scale(c.height); + } + c.accumulate(flow); + } + } + } + } + Ok(last.is_some()) + } +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 46aac9c2c..4f4950d2b 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -20,6 +20,7 @@ pub mod compression; pub mod dynamic_support; pub mod edge_backoff; pub mod entity_collision; +pub mod entity_fluid; pub mod entity_move; pub mod entity_obstruction; pub mod fall_damage; diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 95335fd8f..fe21f11bb 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -955,3 +955,24 @@ integration remain pending. The [collision-only regression](../benchmarks/rust-free-space-2026-10-07/collision-regression.json) also passes **4,793,095 matching lines per JAR** after extending the shared fixture and registry binding. + + +`entity_fluid` tracks body depth, eye immersion and current accumulation across +updates. It preserves one-tick tracker retention, missing-chunk preflight, +ordered cell scans, the first matching current tag, camera support checks and +partial writes on query failure. Current application distinguishes player +averaging from other entities' normalization and dispatches the final velocity +addition with its finite-input filter and fresh velocity read. + +`python3 tools/test_entity_fluid_parity.py` invokes actual +`EntityFluidInteraction` and `Entity.addDeltaMovement`. The +[entity fluid report](../benchmarks/rust-entity-fluid-2026-10-07/scoped-parity.json) +records **607,338 matching lines per JAR** with real ProtoChunk fluid-presence +sections, ordered/reloaded overlapping tags, wet/dry sequences, eye boundaries, +nonfinite heights/current arithmetic, mutations and injected failures. Rust-only +checks cover explicit query-budget/nonfinite errors and reset-before-error +behavior. Targeted Clippy passes. Fluid heights/flows and entity fields are +controlled here; neighboring-cell flow calculation, live world/entity binding +and full playable integration remain pending. Extreme-coordinate Java scans are +bounded by injected callback failures rather than allowed to traverse billions +of cells. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityFluidOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityFluidOracle.java new file mode 100644 index 000000000..0ec7cb085 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityFluidOracle.java @@ -0,0 +1,72 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*;import java.lang.reflect.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.*;import net.minecraft.core.registries.*;import net.minecraft.resources.Identifier;import net.minecraft.tags.*; +import net.minecraft.world.entity.*;import net.minecraft.world.level.*;import net.minecraft.world.level.biome.*;import net.minecraft.world.level.block.*;import net.minecraft.world.level.block.state.*;import net.minecraft.world.level.chunk.*;import net.minecraft.world.level.chunk.status.ChunkStatus;import net.minecraft.world.level.material.*;import net.minecraft.world.phys.*; +/** Actual entity immersion/current state machine with controlled cell providers and real chunk sections. */ +public final class VanillaEntityFluidOracle { + static final class Stop extends RuntimeException {} + static Object unsafe;static Method allocate;static Field blockPosition,level; + static net.minecraft.world.level.material.Fluid[] KINDS; + static T make(Class c){try{return c.cast(allocate.invoke(unsafe,c));}catch(Exception e){throw new AssertionError(e);}} + static Field field(Class c,String n)throws Exception{var f=c.getDeclaredField(n);f.setAccessible(true);return f;} + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + static float single(JsonElement v){return Float.intBitsToFloat(Integer.parseUnsignedInt(v.getAsString(),16));} + static Vec3 vec(JsonElement v){var a=v.getAsJsonArray();return new Vec3(number(a.get(0)),number(a.get(1)),number(a.get(2)));} + static String vector(Vec3 v){return String.format("%016x %016x %016x",Double.doubleToLongBits(v.x),Double.doubleToLongBits(v.y),Double.doubleToLongBits(v.z));} + static String pos(BlockPos p){return p.getX()+" "+p.getY()+" "+p.getZ();} + static BlockPos position(JsonElement v){var a=v.getAsJsonArray();return new BlockPos(a.get(0).getAsInt(),a.get(1).getAsInt(),a.get(2).getAsInt());} + static AABB bounds(JsonElement v){if(v.isJsonNull())return null;var a=v.getAsJsonArray();return new AABB(number(a.get(0)),number(a.get(1)),number(a.get(2)),number(a.get(3)),number(a.get(4)),number(a.get(5)));} + static final class Data {JsonObject op;PrintWriter out;int calls;Vec3 velocity;Entity entity;Chunk chunk;FluidState[] states; + void query(String s){out.println(s);int n=calls++;if(n==op.get("fail").getAsInt())throw new Stop();if(n==op.get("mutate_at").getAsInt()){velocity=vec(op.get("after_velocity"));try{blockPosition.set(entity,position(op.get("after_block")));}catch(Exception e){throw new AssertionError(e);}}} + JsonObject cell(BlockPos p){var c=op.getAsJsonObject("cells").get(pos(p));return(c==null?op.get("default"):c).getAsJsonObject();} + AABB box(){query("box");return bounds(op.get("bounds"));} + double eye(){query("eye");return number(op.get("eye"));} + Vec3 velocity(){query("velocity");return velocity;} + void set(Vec3 v){query("set "+vector(v));velocity=v;} + } + static final class Fluid extends WaterFluid.Source {Data d;int kind; + @Override protected boolean isEmpty(){return kind==0;} + @Override public boolean isSource(FluidState s){return kind==2||kind==4;} + @Override public Holder.Reference builtInRegistryHolder(){return KINDS[kind].builtInRegistryHolder();} + @Override public float getHeight(FluidState s,BlockGetter w,BlockPos p){d.query("height "+pos(p));return single(d.cell(p).get("height"));} + @Override public Vec3 getFlow(BlockGetter w,BlockPos p,FluidState s){d.query("flow "+pos(p));return vec(d.cell(p).get("flow"));} + } + static final class Chunk extends ProtoChunk {Data d; + Chunk(Data d,PalettedContainerFactory factory,int min,int height){super(new ChunkPos(0,0),UpgradeData.EMPTY,LevelHeightAccessor.create(min,height),factory,null);} + @Override public LevelChunkSection[] getSections(){if(d!=null)d.query("sections");return super.getSections();} + } + static final class World extends net.minecraft.server.level.ServerLevel {Data d;World(){super(null,null,null,null,null,null,false,0L,List.of(),false);} + @Override public ChunkAccess getChunk(int x,int z,ChunkStatus status,boolean create){if(status!=ChunkStatus.FULL||create)throw new AssertionError();d.query("chunk "+x+" "+z);return d.op.getAsJsonArray("missing").contains(new JsonPrimitive(x+" "+z))?null:d.chunk;} + @Override public FluidState getFluidState(BlockPos p){d.query("fluid "+pos(p));return d.states[d.cell(p).get("kind").getAsInt()];} + @Override public BlockState getBlockState(BlockPos p){d.query("block "+pos(p));return(d.op.get("sturdy").getAsBoolean()?Blocks.STONE:Blocks.AIR).defaultBlockState();} + } + static final class Actor extends Marker {Data d;Actor(){super(null,null);} + @Override public AABB getFluidInteractionBox(){return d.box();}@Override public double getEyeY(){return d.eye();} + @Override public Vec3 getDeltaMovement(){return d.velocity();}@Override public void setDeltaMovement(Vec3 v){d.set(v);} + } + static final class Human extends net.minecraft.world.entity.player.Player {Data d;Human(){super(null,null);} + @Override public GameType gameMode(){return GameType.SURVIVAL;} + @Override public AABB getFluidInteractionBox(){return d.box();}@Override public double getEyeY(){return d.eye();} + @Override public Vec3 getDeltaMovement(){return d.velocity();}@Override public void setDeltaMovement(Vec3 v){d.set(v);} + } + public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();KINDS=new net.minecraft.world.level.material.Fluid[]{Fluids.EMPTY,Fluids.FLOWING_WATER,Fluids.WATER,Fluids.FLOWING_LAVA,Fluids.LAVA};var u=Class.forName("sun.misc.Unsafe");var uf=field(u,"theUnsafe");unsafe=uf.get(null);allocate=u.getMethod("allocateInstance",Class.class);blockPosition=field(Entity.class,"blockPosition");level=field(Entity.class,"level"); + var trackers=field(EntityFluidInteraction.class,"fluidTrackers");var currents=field(EntityFluidInteraction.class,"currentAccumulators");var trackerClass=Class.forName("net.minecraft.world.entity.EntityFluidInteraction$Tracker");var kind=field(trackerClass,"fluidType");var height=field(trackerClass,"height");var eyes=field(trackerClass,"eyesInside");var currentClass=Class.forName("net.minecraft.world.entity.EntityFluidInteraction$CurrentAccumulator");var depth=field(currentClass,"height");var accumulated=field(currentClass,"accumulatedCurrent");var count=field(currentClass,"currentCount"); + var tags=new ArrayList>();for(int i=0;i<4;i++)tags.add(TagKey.create(Registries.FLUID,Identifier.parse("horizon:immersion_"+i))); + Holder biome=Holder.Reference.createStandAlone(new HolderOwner(){},Biomes.PLAINS);var ids=new IdMapper>();ids.add(biome);var factory=new PalettedContainerFactory(Strategy.createForBlockStates(Block.BLOCK_STATE_REGISTRY),Blocks.AIR.defaultBlockState(),null,Strategy.createForBiomes(ids),biome,null); + Path dir=Path.of(args[1]);try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();var ordered=new LinkedHashSet>();for(var t:f.getAsJsonArray("order"))ordered.add(tags.get(t.getAsInt()));var interaction=new EntityFluidInteraction(ordered); + var d=new Data();d.out=out;d.states=new FluidState[5];for(int i=0;i<5;i++){var fluid=make(Fluid.class);fluid.d=d;fluid.kind=i;d.states[i]=new FluidState(fluid,new net.minecraft.world.level.block.state.properties.Property[0],new Comparable[0]);}var w=make(World.class);w.d=d; + if(f.get("player").getAsBoolean()){var e=make(Human.class);e.d=d;d.entity=e;}else{var e=make(Actor.class);e.d=d;d.entity=e;}level.set(d.entity,w); + for(var value:f.getAsJsonArray("ops")){d.op=value.getAsJsonObject();var op=d.op;d.calls=0;d.velocity=vec(op.get("velocity"));blockPosition.set(d.entity,position(op.get("block")));d.entity.setBoundingBox(new AABB(0,number(op.get("base_y")),0,1,number(op.get("base_y"))+1,1)); + var bindings=new HashMap,List>>();for(int t=0;t<4;t++){var members=new ArrayList>();int mask=op.getAsJsonArray("tags").get(t).getAsInt();for(int k=0;k<5;k++)if((mask&(1<(Registries.FLUID,bindings)).apply(); + var wet=op.getAsJsonArray("wet");d.chunk=new Chunk(d,factory,op.get("min_section").getAsInt()*16,wet.size()*16);for(int i=0;i)trackers.get(interaction);out.println("trackers "+list.size());for(var t:list){Object holder=kind.get(t);int k=-1;for(int i=0;i<5;i++)if(KINDS[i].builtInRegistryHolder()==holder)k=i;out.printf("tracker %d %016x %s%n",k,Double.doubleToLongBits(height.getDouble(t)),eyes.getBoolean(t));} + var map=(Map)currents.get(interaction);for(var tag:ordered){var c=map.get(tag);out.printf("current %d %016x %s %d%n",tags.indexOf(tag),Double.doubleToLongBits(depth.getDouble(c)),vector((Vec3)accumulated.get(c)),count.getInt(c));} + for(int t=0;t<4;t++)out.printf("tag %d %016x %s %s%n",t,Double.doubleToLongBits(interaction.getFluidHeight(tags.get(t))),interaction.isInFluid(tags.get(t)),interaction.isEyeInFluid(tags.get(t))); + out.println("final "+vector(d.velocity));out.println("queries "+d.calls); + } + }} + } +} diff --git a/tools/test_entity_fluid_parity.py b/tools/test_entity_fluid_parity.py new file mode 100644 index 000000000..092ed2426 --- /dev/null +++ b/tools/test_entity_fluid_parity.py @@ -0,0 +1,95 @@ +#!/usr/bin/env python3 +"""Compare EntityFluidInteraction immersion and current accumulation with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + def bits(v):return struct.pack('>d',float(v)).hex() + def single(v):return struct.pack('>f',float(v)).hex() + def cell(kind=2,height=8/9,flow=(1,0,.25)): + return dict(kind=kind,height=single(height),flow=[bits(v) for v in flow]) + def op(**kw): + v=dict(mode='update',bounds=[.1,.1,.1,.9,.9,.9],base_y=0,eye=.8,block=[0,0,0],ignore=False,min_section=-1,wet=[False,True,False],missing=[],sturdy=False,cells={},default=cell(),tags=[6,24,30,0],velocity=[0,0,0],after_velocity=[1,2,3],after_block=[1,0,1],mutate_at=-1,fail=-1,tag=0,speed=.014) + v.update(kw) + for k in ['base_y','eye','speed']:v[k]=bits(v[k]) + for k in ['bounds','velocity','after_velocity']: + if v[k] is not None:v[k]=[bits(n) for n in v[k]] + return v + def row(ops,player=False,order=(0,1,2)):return dict(ops=ops,player=player,order=order) + values=[-float('inf'),-1,-.0,0,.1,.39999998,.4,.40000004,8/9,1,2,float('inf'),float('nan')] + for kind in range(5): + for height in values: + for eye in values: + for sturdy in [False,True]: + yield row([op(default=cell(kind,height),eye=eye,sturdy=sturdy),op(mode='apply'),op(bounds=None),op(bounds=None)]) + for player in [False,True]: + for flow in [(0,0,0),(.0031622776,0,0),(.0031622777,0,0),(1,0,.25),(-1,0,1),(1,float('nan'),2),(float('inf'),0,0)]: + for speed in values+[.003,.0045,.004500000000000001]: + for velocity in [(0,0,0),(.003,0,0),(.0029999999999,0,0),(0,0,.003),(float('nan'),0,0)]: + yield row([op(bounds=[0,0,0,2,1,1],default=cell(flow=flow)),op(mode='apply',speed=speed,velocity=velocity)],player) + cells={'0 0 0':cell(1,.2,(1,0,0)),'0 0 1':cell(2,.3,(0,1,0)),'0 1 0':cell(3,.4,(0,0,1)),'0 1 1':cell(4,.5,(-1,0,0)),'1 0 0':cell(1,.1,(0,-1,0))} + for order in [[],[0],[0,1,2],[2,0,1],[0,0,1],[3,1,0]]: + for ignore in [False,True]: + for fail in range(-1,70): + for mutate in [-1,9]: + yield row([op(bounds=[0,0,0,2,2,2],cells=cells,default=cell(0),ignore=ignore,fail=fail,mutate_at=mutate),*[op(mode='apply',tag=t,mutate_at=0) for t in range(4)],op(default=cell(3),tags=[24,6,30,0]),op(default=cell(0)),op(default=cell(0))],order=order) + for bounds in [[0,0,0,0,0,0],[-17,-17,-17,-16,-16,-16],[-.1,15.9,-.1,.1,16.1,.1],[15,0,15,17,1,17],[17,0,17,15,1,15],[0,32,0,1,33,1]]: + for wet in [[False,False,False],[True,False,False],[False,True,False],[False,False,True],[True,True,True]]: + for missing in [[],['0 0'],['1 1'],['-1 -1']]:yield row([op(bounds=bounds,wet=wet,missing=missing)]) + for lo,hi in [(-2147483649.,-2147483648.),(-1e30,-1e30),(2147483648.,2147483649.),(1e30,1e30)]: + for axis in range(3): + bounds=[0.,0.,0.,1.,1.,1.];bounds[axis]=lo;bounds[axis+3]=hi + yield row([op(bounds=bounds,fail=2)]) + rng=random.Random(0x454e54464c554944) + for _ in range(3000): + ops=[] + for i in range(rng.randrange(1,7)): + ops.append(op(mode=rng.choice(['update','update','apply']),bounds=rng.choice([None,[0,0,0,2,2,2],[.1,.1,.1,.9,.9,.9],[-1,-1,-1,1,1,1]]),cells=cells,default=cell(rng.randrange(5),rng.choice(values),tuple(rng.choice(values) for _ in range(3))),base_y=rng.choice(values),eye=rng.choice(values),sturdy=bool(rng.randrange(2)),ignore=bool(rng.randrange(2)),tags=[rng.randrange(32) for _ in range(4)],fail=rng.choice([-1,-1,*range(25)]),mutate_at=rng.choice([-1,-1,*range(15)]),speed=rng.choice(values),tag=rng.randrange(4))) + yield row(ops,bool(rng.randrange(2)),rng.sample(range(4),rng.randrange(5))) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-entity-fluid-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityFluidOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/entity_fluid_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaEntityFluidOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','entity_fluid_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('entity_fluid_fixture.exe' if os.name=='nt' else 'entity_fluid_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} entity-fluid output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual EntityFluidInteraction update, tracker pruning, body/eye depth, loaded-chunk preflight, overlapping/reloaded tags, ordered current accumulation and native Entity.addDeltaMovement. Controlled fluid height/flow and camera-support cells, real ProtoChunk section fluid flags, player versus nonplayer classes, callback mutations and injected failures. Live fluid flow/propagation and full entity/world integration remain pending.'} + lab.write_json(report_path,report);print(f'Scoped entity fluid parity passed: {report_path}') + + +if __name__=='__main__':main() From becaf59bab10b3430e4997743ff1d18c8a0cd2e3 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 03:12:04 +0200 Subject: [PATCH 096/253] Implement vanilla neighbor-derived fluid current vectors --- .../scoped-parity.json | 235 ++++++++++++++++++ .../examples/fluid_flow_fixture.rs | 113 +++++++++ crates/horizon-world/src/fluid_flow.rs | 108 ++++++++ crates/horizon-world/src/lib.rs | 1 + docs/collision-geometry.md | 16 ++ .../parity/VanillaFluidFlowOracle.java | 29 +++ tools/test_fluid_flow_parity.py | 83 +++++++ 7 files changed, 585 insertions(+) create mode 100644 benchmarks/rust-fluid-flow-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/fluid_flow_fixture.rs create mode 100644 crates/horizon-world/src/fluid_flow.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFluidFlowOracle.java create mode 100644 tools/test_fluid_flow_parity.py diff --git a/benchmarks/rust-fluid-flow-2026-10-07/scoped-parity.json b/benchmarks/rust-fluid-flow-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..90ab6bf07 --- /dev/null +++ b/benchmarks/rust-fluid-flow-2026-10-07/scoped-parity.json @@ -0,0 +1,235 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 51846, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFluidFlowOracle.java": "3a5f524c5d1fd47d22bf45d3c293cccb08ba8abb566cd7be729e816a5d1d3b46", + "tools/test_fluid_flow_parity.py": "7485606cb348c193ada6825cf68238f98e46fb3292f2b9723246cf167ebfb453", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "36ff6f09e8d215eef955262c185853c9e901aa33e0368130c3a4971a30edfcab", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/fluid_flow_fixture.rs": "33ab669c92eddfd0ca3fa074543bada350b8b94d51b0e75a844db4dadc25f8be" + }, + "fixtures_sha256": { + ".local/rust-fluid-flow-parity/inputs.txt": "89be628a59fb7bbe46ab265bcbce7f02e749495ba24ff58aaeea69636adbc5c1", + ".local/rust-fluid-flow-parity/fluid-states.json": "f888b2d7adf0ee194a08900e6df9909933734b5d8dab648dc3e866d70ef3b659" + }, + "rust_output_sha256": "55761f29153f1d25d6ef7ad0bd431a30f8c4e7ed2a12ad7f4bca215404ad5e7b", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "55761f29153f1d25d6ef7ad0bd431a30f8c4e7ed2a12ad7f4bca215404ad5e7b", + "matched_output_lines": 1051071 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "55761f29153f1d25d6ef7ad0bd431a30f8c4e7ed2a12ad7f4bca215404ad5e7b", + "matched_output_lines": 1051071 + } + ], + "scope": "Actual registered FluidState.getFlow / FlowingFluid.getFlow and solid-face helper over every registered fluid state. Ordered horizontal and downward neighbor reads, fluid families, BLOCKS_FLUID_FLOW tag, IceBlock guard, falling-wall deflection, f32 height differences, vector normalization, wrapping coordinates and injected failures. Block flags and face support are controlled; registry/world support binding, spreading and full gameplay remain pending." +} diff --git a/crates/horizon-world/examples/fluid_flow_fixture.rs b/crates/horizon-world/examples/fluid_flow_fixture.rs new file mode 100644 index 000000000..4da9f6a07 --- /dev/null +++ b/crates/horizon-world/examples/fluid_flow_fixture.rs @@ -0,0 +1,113 @@ +use horizon_core::{geometry::Direction, position::BlockPos}; +use horizon_world::{ + fluid::FluidState, + fluid_flow::{self, FluidFlowWorld}, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn pos(p: BlockPos) -> String { + format!("{} {} {}", p.x, p.y, p.z) +} +struct World<'a> { + f: &'a Value, + out: &'a mut dyn Write, + calls: i64, + fluids: Vec, +} +impl World<'_> { + fn query(&mut self, s: String) -> io::Result<()> { + writeln!(self.out, "{s}")?; + let n = self.calls; + self.calls += 1; + if n == self.f["fail"].as_i64().unwrap() { + Err(io::Error::other("injected flow failure")) + } else { + Ok(()) + } + } + fn cell(&self, p: BlockPos) -> usize { + self.f["cells"] + .get(pos(p)) + .unwrap_or(&self.f["default"]) + .as_u64() + .unwrap() as usize + } +} +impl FluidFlowWorld for World<'_> { + type Error = io::Error; + type Block = usize; + fn fluid(&mut self, p: BlockPos) -> io::Result { + self.query(format!("fluid {}", pos(p)))?; + Ok(self.fluids[self.cell(p)]) + } + fn block(&mut self, p: BlockPos) -> io::Result { + self.query(format!("block {}", pos(p)))?; + Ok(self.cell(p)) + } + fn blocks_fluid_flow(&self, s: usize) -> bool { + self.f["states"][s]["blocks_flow"].as_bool().unwrap() + } + fn is_ice_class(&self, s: usize) -> bool { + self.f["states"][s]["ice"].as_bool().unwrap() + } + fn is_face_sturdy(&mut self, s: usize, p: BlockPos, d: Direction) -> io::Result { + let name = ["down", "up", "north", "south", "west", "east"][d as usize]; + self.query(format!("sturdy {} {name}", pos(p)))?; + Ok(self.f["states"][s]["faces"].as_u64().unwrap() & (1 << (d as u8)) != 0) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let fluids = f["states"] + .as_array() + .unwrap() + .iter() + .map(|s| FluidState::from_json(&s["fluid"].to_string())) + .collect::>>()?; + let mut w = World { + f: &f, + out: &mut out, + calls: 0, + fluids, + }; + let a = &f["position"]; + let p = BlockPos::new( + a[0].as_i64().unwrap() as i32, + a[1].as_i64().unwrap() as i32, + a[2].as_i64().unwrap() as i32, + ); + let root = FluidState::from_json(&f["root"].to_string())?; + if f["mode"].as_str().unwrap() == "flow" { + match fluid_flow::flow_at(&mut w, root, p) { + Ok(v) => writeln!( + w.out, + "flow {:016x} {:016x} {:016x}", + v.x.to_bits(), + v.y.to_bits(), + v.z.to_bits() + )?, + Err(_) => writeln!(w.out, "error")?, + } + } else { + match fluid_flow::solid_face( + &mut w, + root.kind(), + p, + Direction::ALL[f["direction"].as_u64().unwrap() as usize], + ) { + Ok(v) => writeln!(w.out, "face {v}")?, + Err(_) => writeln!(w.out, "error")?, + } + } + writeln!(w.out, "queries {}", w.calls)?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/fluid_flow.rs b/crates/horizon-world/src/fluid_flow.rs new file mode 100644 index 000000000..272a51dae --- /dev/null +++ b/crates/horizon-world/src/fluid_flow.rs @@ -0,0 +1,108 @@ +//! Neighbor-derived water/lava currents and falling-fluid wall deflection. +use crate::fluid::{FluidKind, FluidState}; +use horizon_core::{ + geometry::{Direction, Vec3}, + position::BlockPos, +}; + +pub trait FluidFlowWorld { + type Error; + type Block: Copy; + fn fluid(&mut self, position: BlockPos) -> Result; + fn block(&mut self, position: BlockPos) -> Result; + /// Resolved BLOCKS_FLUID_FLOW tag membership for the captured state. + fn blocks_fluid_flow(&self, state: Self::Block) -> bool; + /// Actual IceBlock class membership, including its subclasses. + fn is_ice_class(&self, state: Self::Block) -> bool; + fn is_face_sturdy( + &mut self, + state: Self::Block, + position: BlockPos, + direction: Direction, + ) -> Result; +} +/// Native wall test reads both block and fluid before any early return. The +/// supplied face is the scan direction, rather than its opposite. +pub fn solid_face( + world: &mut W, + kind: FluidKind, + position: BlockPos, + direction: Direction, +) -> Result { + let block = world.block(position)?; + let fluid = world.fluid(position)?; + if fluid.kind().same_family(kind) { + return Ok(false); + } + if direction == Direction::Up { + return Ok(true); + } + if world.is_ice_class(block) { + return Ok(false); + } + world.is_face_sturdy(block, position, direction) +} +fn affects_flow(kind: FluidKind, neighbor: FluidState) -> bool { + neighbor.kind() == FluidKind::Empty || neighbor.kind().same_family(kind) +} +const HORIZONTAL: [Direction; 4] = [ + Direction::North, + Direction::East, + Direction::South, + Direction::West, +]; +/// The height differences and directional products round as f32 before being +/// accumulated in f64. Falling currents normalize before and after the Y push. +pub fn flow_at( + world: &mut W, + state: FluidState, + position: BlockPos, +) -> Result { + if state.kind() == FluidKind::Empty { + return Ok(Vec3::ZERO); + } + let mut x = 0.0; + let mut z = 0.0; + for direction in HORIZONTAL { + let [dx, dy, dz] = direction.normal(); + let p = position.offset(dx, dy, dz); + let neighbor = world.fluid(p)?; + if !affects_flow(state.kind(), neighbor) { + continue; + } + let mut height = neighbor.own_height(); + let mut difference = 0.0f32; + if height == 0.0 { + let block = world.block(p)?; + if !world.blocks_fluid_flow(block) { + let below = world.fluid(p.offset(0, -1, 0))?; + if affects_flow(state.kind(), below) { + height = below.own_height(); + if height > 0.0 { + difference = state.own_height() - (height - 0.8888889f32); + } + } + } + } else if height > 0.0 { + difference = state.own_height() - height; + } + if difference != 0.0 { + x += f64::from(dx as f32 * difference); + z += f64::from(dz as f32 * difference); + } + } + let mut result = Vec3::new(x, 0.0, z); + if state.falling() { + for direction in HORIZONTAL { + let [dx, dy, dz] = direction.normal(); + let p = position.offset(dx, dy, dz); + if solid_face(world, state.kind(), p, direction)? + || solid_face(world, state.kind(), p.offset(0, 1, 0), direction)? + { + result = result.normalize().add_vector(Vec3::new(0.0, -6.0, 0.0)); + break; + } + } + } + Ok(result.normalize()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 4f4950d2b..ccc4766a1 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -25,6 +25,7 @@ pub mod entity_move; pub mod entity_obstruction; pub mod fall_damage; pub mod fluid; +pub mod fluid_flow; pub mod fluid_occupancy; pub mod fluid_shape; pub mod free_space; diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index fe21f11bb..779ed4691 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -976,3 +976,19 @@ controlled here; neighboring-cell flow calculation, live world/entity binding and full playable integration remain pending. Extreme-coordinate Java scans are bounded by injected callback failures rather than allowed to traverse billions of cells. + + +`fluid_flow` computes water/lava current vectors from ordered horizontal and +lower neighbors, preserving f32 height subtraction before f64 accumulation. +Falling fluids apply the native wall deflection, including the same-family, +upward-face and IceBlock guards, then normalize the resulting vector. + +`python3 tools/test_fluid_flow_parity.py` invokes actual registered +`FluidState.getFlow`, `FlowingFluid.getFlow` and its solid-face helper. The +[fluid flow report](../benchmarks/rust-fluid-flow-2026-10-07/scoped-parity.json) +records **1,051,071 matching lines per JAR** from **51,846 fixtures** covering all +registered fluid states, neighboring families/heights, per-face wall flags, +falling deflection, wrapping coordinates and query failures. Targeted Clippy +passes. Block tag/class flags and face support are controlled in this comparison; +binding those to registered block storage and support shapes, fluid spreading +and complete gameplay remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFluidFlowOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFluidFlowOracle.java new file mode 100644 index 000000000..4c41cd934 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFluidFlowOracle.java @@ -0,0 +1,29 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import com.mojang.serialization.JsonOps; +import java.io.*;import java.lang.reflect.*;import java.nio.file.*; +import net.minecraft.core.*;import net.minecraft.core.registries.*;import net.minecraft.tags.*;import net.minecraft.world.level.*;import net.minecraft.world.level.block.*;import net.minecraft.world.level.block.state.*;import net.minecraft.world.level.material.*;import net.minecraft.world.phys.*; +/** Native registered fluid current calculation with independently controlled block/fluid neighbors. */ +public final class VanillaFluidFlowOracle { + static final class Stop extends RuntimeException {} + static String pos(BlockPos p){return p.getX()+" "+p.getY()+" "+p.getZ();} + static final class Data {JsonObject f;PrintWriter out;int calls;State[] blocks;FluidState[] fluids; + void query(String s){out.println(s);if(calls++==f.get("fail").getAsInt())throw new Stop();} + int cell(BlockPos p){var v=f.getAsJsonObject("cells").get(pos(p));return v==null?f.get("default").getAsInt():v.getAsInt();} + } + static final class State extends BlockState {Data d;int id; + State(Block block){super(block,new net.minecraft.world.level.block.state.properties.Property[0],new Comparable[0]);} + @Override public boolean is(TagKey tag){if(tag!=BlockTags.BLOCKS_FLUID_FLOW)throw new AssertionError(tag);return d.f.getAsJsonArray("states").get(id).getAsJsonObject().get("blocks_flow").getAsBoolean();} + @Override public boolean isFaceSturdy(BlockGetter w,BlockPos p,Direction face){d.query("sturdy "+pos(p)+" "+face.getSerializedName());return (d.f.getAsJsonArray("states").get(id).getAsJsonObject().get("faces").getAsInt()&(1<)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();var d=new Data();d.f=f;d.out=out;var states=f.getAsJsonArray("states");d.blocks=new State[states.size()];d.fluids=new FluidState[states.size()];for(int i=0;i[]{BlockGetter.class},(proxy,method,values)->{var p=(BlockPos)values[0];switch(method.getName()){case "getBlockState":d.query("block "+pos(p));return d.blocks[d.cell(p)];case "getFluidState":d.query("fluid "+pos(p));return d.fluids[d.cell(p)];default:throw new AssertionError(method);}}); + var a=f.getAsJsonArray("position");var p=new BlockPos(a.get(0).getAsInt(),a.get(1).getAsInt(),a.get(2).getAsInt());var root=FluidState.CODEC.parse(JsonOps.INSTANCE,f.get("root")).getOrThrow(); + try{if(f.get("mode").getAsString().equals("flow")){var v=root.getFlow(world,p);out.printf("flow %016x %016x %016x%n",Double.doubleToLongBits(v.x),Double.doubleToLongBits(v.y),Double.doubleToLongBits(v.z));}else out.println("face "+solid.invoke(root.getType(),world,p,Direction.values()[f.get("direction").getAsInt()]));}catch(Stop e){out.println("error");}catch(InvocationTargetException e){if(e.getCause() instanceof Stop)out.println("error");else throw e;} + out.println("queries "+d.calls); + }} + } +} diff --git a/tools/test_fluid_flow_parity.py b/tools/test_fluid_flow_parity.py new file mode 100644 index 000000000..2207b5834 --- /dev/null +++ b/tools/test_fluid_flow_parity.py @@ -0,0 +1,83 @@ +#!/usr/bin/env python3 +"""Compare registered fluid current vectors and neighbor queries with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(states): + empty=next(s for s in states if s['id']=='minecraft:empty') + water=next(s for s in states if s['id']=='minecraft:water' and s['properties']['falling']=='false') + def cell(fluid=empty,blocks=False,ice=False,faces=0):return dict(fluid=fluid,blocks_flow=blocks,ice=ice,faces=faces) + def row(root,entries=None,**kw): + f=dict(mode='flow',root=root,states=entries or [cell()],default=0,cells={},position=[0,0,0],fail=-1,direction=2);f.update(kw);return f + neighbors=[(0,0,-1),(1,0,0),(0,0,1),(-1,0,0)] + for root in states: + for neighbor in states: + for blocks in [False,True]: + yield row(root,[cell(neighbor,blocks),cell(empty,False),cell(water,False)],cells={'0 0 -1':1,'0 -1 -1':2}) + for root in states: + for index,p in enumerate(neighbors): + for y in [0,1]: + for mask in range(64): + for ice in [False,True]: + key=f'{p[0]} {y} {p[2]}' + yield row(root,[cell(),cell(empty,False,ice,mask)],cells={key:1}) + for root in states[1:]: + for neighbor in [empty,water,states[-1]]: + for direction in range(6): + for ice in [False,True]: + for mask in [0,63,1< Date: Wed, 7 Oct 2026 03:19:39 +0200 Subject: [PATCH 097/253] Bind fluid heights and currents to registered block support --- .../scoped-parity.json | 246 ++++++++++++++++++ .../examples/registry_fluid_fixture.rs | 172 ++++++++++++ crates/horizon-world/src/lib.rs | 1 + crates/horizon-world/src/registry_fluid.rs | 153 +++++++++++ docs/collision-geometry.md | 18 ++ .../parity/VanillaRegistryFluidOracle.java | 21 ++ tools/test_registry_fluid_parity.py | 73 ++++++ 7 files changed, 684 insertions(+) create mode 100644 benchmarks/rust-registry-fluid-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/registry_fluid_fixture.rs create mode 100644 crates/horizon-world/src/registry_fluid.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryFluidOracle.java create mode 100644 tools/test_registry_fluid_parity.py diff --git a/benchmarks/rust-registry-fluid-2026-10-07/scoped-parity.json b/benchmarks/rust-registry-fluid-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..fc4866047 --- /dev/null +++ b/benchmarks/rust-registry-fluid-2026-10-07/scoped-parity.json @@ -0,0 +1,246 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 409389, + "registry_states": 35723, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryFluidOracle.java": "7d8a721941e1ca04c089fcae3dc0fbd44aeee6f91454993114afdb45379fae6c", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSupportOracle.java": "04350901a2d708fb8fa672de61d058f73f332d2e90df1b93a67781862f89c1ad", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "f2b4f440a5bbce4224a4b3cee494b0f7ddcafbf72db12592c94ef9fb94fbc8a6", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "tools/test_registry_fluid_parity.py": "84b6cd2be73e7c751bacb25fdeeb9434316fb24fe6140ef2ff7e2da5ccf91b35", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-world/examples/registry_fluid_fixture.rs": "86741f2641c2ce3972484fa9790cd44e23c6a77f82200a1ef8204efbc3f7ec66", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "7cf1dda619bbb6781ca812a98c9e667fd2aa3fd95a97ef45beba7e45f9834576", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "2d88983b56513e9b70bc79ef0b9743f5d2250c6e1dd954cc6fb7ea89c601e023", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f" + }, + "fixtures_sha256": { + ".local/rust-registry_fluid-parity/inputs.txt": "6d67e0679b4e9cee9a999c418f9c05792346605a8faea97e6ae3d15dec31a0d6", + ".local/rust-registry_fluid-parity/facts.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-registry_fluid-parity/fluid-info.json": "ec4cae850110a5cdd520374f38f0c6db505bb8310b76017b623ec514db4dc002", + ".local/rust-registry_fluid-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-registry_fluid-parity/cached-support.nbt": "8d16793118cac5b7f6fe8532b8eee98d620641f825d6745b7cecc6de90c33664", + ".local/rust-registry_fluid-parity/tags.json": "5e1301e5a9abf7e4de93af5dae3a157e852dbdb4ea345c2eb626305a605d4f98" + }, + "rust_output_sha256": "a8f20ee7b162e7b2cc81d70d0428647739d99049aa853610cb94875e517858c0", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "a8f20ee7b162e7b2cc81d70d0428647739d99049aa853610cb94875e517858c0", + "matched_output_lines": 2446969 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "a8f20ee7b162e7b2cc81d70d0428647739d99049aa853610cb94875e517858c0", + "matched_output_lines": 2446969 + } + ], + "scope": "Actual registered fluid height/camera-height/current vectors and solid-face selection using all native block states, BLOCKS_FLUID_FLOW tags and IceBlock class identities. Rust composes registered contained fluids with cached/dynamic block support, preserving world query order, directional walls, waterlogged contents, coordinate wrapping and failures. Block storage is controlled and block entities are absent; live entity/world binding, active block-entity lifecycle, fluid spreading and complete gameplay remain pending." +} diff --git a/crates/horizon-world/examples/registry_fluid_fixture.rs b/crates/horizon-world/examples/registry_fluid_fixture.rs new file mode 100644 index 000000000..de6e111a6 --- /dev/null +++ b/crates/horizon-world/examples/registry_fluid_fixture.rs @@ -0,0 +1,172 @@ +use horizon_core::{ + geometry::{Direction, VoxelShape}, + position::BlockPos, +}; +use horizon_world::{ + block_support::BlockSupportRegistry, + dynamic_support::DynamicSupportWorld, + fluid_flow, + nbt::{self, Limits}, + registry::{BlockRegistry, BlockStateId}, + registry_fluid::{FluidBlockWorld, FluidRegistry, RegistryFluidWorld}, +}; +use serde_json::Value; +use std::{ + collections::BTreeSet, + fs, + io::{self, Write}, + path::Path, +}; +fn pos(p: BlockPos) -> String { + format!("{} {} {}", p.x, p.y, p.z) +} +struct World<'a> { + f: &'a Value, + out: &'a mut dyn Write, + calls: i64, +} +impl World<'_> { + fn query(&mut self, s: String) -> io::Result<()> { + writeln!(self.out, "{s}")?; + let n = self.calls; + self.calls += 1; + if n == self.f["fail"].as_i64().unwrap() { + Err(io::Error::other("injected registered fluid query failure")) + } else { + Ok(()) + } + } + fn cell(&self, p: BlockPos) -> BlockStateId { + BlockStateId( + self.f["cells"] + .get(pos(p)) + .unwrap_or(&self.f["default"]) + .as_u64() + .unwrap() as u32, + ) + } +} +impl FluidBlockWorld for World<'_> { + fn block_state(&mut self, p: BlockPos) -> io::Result { + self.query(format!("block {}", pos(p)))?; + Ok(self.cell(p)) + } + fn fluid_block_state(&mut self, p: BlockPos) -> io::Result { + self.query(format!("fluid {}", pos(p)))?; + Ok(self.cell(p)) + } +} +impl DynamicSupportWorld for World<'_> { + type Error = io::Error; + fn shulker_is_closed(&mut self, p: [i32; 3]) -> io::Result> { + self.query(format!("entity {} {} {}", p[0], p[1], p[2]))?; + Ok(None) + } + fn moving_piston_shape(&mut self, p: [i32; 3]) -> io::Result> { + self.query(format!("entity {} {} {}", p[0], p[1], p[2]))?; + Ok(None) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + let load = |n: &str| -> Result<_, Box> { + Ok(nbt::read_named(&fs::read(dir.join(n))?, Limits::default())? + .0 + .tag) + }; + let registry = BlockRegistry::from_nbt(&load("block-registry.nbt")?)?; + let support = BlockSupportRegistry::from_nbt(&load("cached-support.nbt")?, ®istry)?; + let info: Value = serde_json::from_slice(&fs::read(dir.join("fluid-info.json"))?)?; + let names = |v: &Value| -> BTreeSet { + v.as_array() + .unwrap() + .iter() + .map(|v| v.as_str().unwrap().to_owned()) + .collect() + }; + let natural = names(&info["blocks_flow"]); + let ice = names(&info["ice"]); + let all = (0..registry.len()) + .map(|i| registry.state(BlockStateId(i as u32)).unwrap().name.clone()) + .collect(); + let bindings = [ + FluidRegistry::new(®istry, &natural, &ice)?, + FluidRegistry::new(®istry, &BTreeSet::new(), &ice)?, + FluidRegistry::new(®istry, &all, &ice)?, + ]; + assert!(bindings[0].fluid(BlockStateId(u32::MAX)).is_err()); + assert!( + FluidRegistry::new( + ®istry, + &BTreeSet::from(["horizon:absent".to_owned()]), + &ice + ) + .is_err() + ); + let foreign = BlockRegistry::from_nbt(&load("block-registry.nbt")?)?; + let foreign_binding = FluidRegistry::new(&foreign, &natural, &ice)?; + let dummy = serde_json::json!({"fail":-1,"cells":{},"default":u32::MAX}); + let mut sink = io::sink(); + let mut probe = World { + f: &dummy, + out: &mut sink, + calls: 0, + }; + assert!(RegistryFluidWorld::new(&foreign_binding, &support, &mut probe).is_err()); + let mut bound = RegistryFluidWorld::new(&bindings[0], &support, &mut probe)?; + assert!(matches!( + horizon_world::fluid_flow::FluidFlowWorld::fluid(&mut bound, BlockPos::new(0, 0, 0)), + Err(horizon_world::registry_fluid::FluidQueryError::Data(_)) + )); + assert!(matches!( + horizon_world::fluid_flow::FluidFlowWorld::block(&mut bound, BlockPos::new(0, 0, 0)), + Err(horizon_world::registry_fluid::FluidQueryError::Data(_)) + )); + assert_eq!(probe.calls, 2); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let bindings = &bindings[f["tag"].as_u64().unwrap() as usize]; + let mut world = World { + f: &f, + out: &mut out, + calls: 0, + }; + let a = &f["position"]; + let p = BlockPos::new( + a[0].as_i64().unwrap() as i32, + a[1].as_i64().unwrap() as i32, + a[2].as_i64().unwrap() as i32, + ); + let root = bindings.fluid(BlockStateId(f["root"].as_u64().unwrap() as u32))?; + let mut w = RegistryFluidWorld::new(bindings, &support, &mut world)?; + let result = match f["mode"].as_str().unwrap() { + "flow" => fluid_flow::flow_at(&mut w, root, p).map(|v| { + format!( + "flow {:016x} {:016x} {:016x}", + v.x.to_bits(), + v.y.to_bits(), + v.z.to_bits() + ) + }), + "face" => fluid_flow::solid_face( + &mut w, + root.kind(), + p, + Direction::ALL[f["direction"].as_u64().unwrap() as usize], + ) + .map(|v| format!("face {v}")), + "height" => root + .height_at(&mut w, [p.x, p.y, p.z]) + .map(|v| format!("height {:08x}", v.to_bits())), + "camera" => root + .camera_height_at(&mut w, [p.x, p.y, p.z]) + .map(|v| format!("height {:08x}", v.to_bits())), + _ => panic!("fixture mode"), + }; + writeln!(world.out, "{}", result.unwrap_or_else(|_| "error".into()))?; + writeln!(world.out, "queries {}", world.calls)?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index ccc4766a1..f35cc3af7 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -51,6 +51,7 @@ pub mod region; pub mod registry; pub mod registry_collision_scan; pub mod registry_fall_ray; +pub mod registry_fluid; pub mod retrogen; pub mod suffocation; pub mod tick_data; diff --git a/crates/horizon-world/src/registry_fluid.rs b/crates/horizon-world/src/registry_fluid.rs new file mode 100644 index 000000000..329229e18 --- /dev/null +++ b/crates/horizon-world/src/registry_fluid.rs @@ -0,0 +1,153 @@ +//! Registered fluid contents, flow tags and native block support composition. +use crate::{ + block_support::{BlockSupportRegistry, SupportQueryError, SupportType}, + compression::invalid, + dynamic_support::DynamicSupportWorld, + fluid::{FluidHeightWorld, FluidState}, + fluid_flow::FluidFlowWorld, + registry::{BlockRegistry, BlockStateId}, +}; +use horizon_core::{geometry::Direction, position::BlockPos}; +use std::{collections::BTreeSet, fmt, io}; +#[derive(Clone, Copy)] +pub struct FluidBlock { + id: BlockStateId, + fluid: FluidState, + blocks_flow: bool, + ice: bool, +} +pub struct FluidRegistry<'r> { + registry: &'r BlockRegistry, + states: Vec, +} +impl<'r> FluidRegistry<'r> { + /// Rebuild on BLOCKS_FLUID_FLOW tag reload. Ice names come from actual class + /// membership; name suffixes do not distinguish ice from packed/blue ice. + pub fn new( + registry: &'r BlockRegistry, + blocks_flow: &BTreeSet, + ice: &BTreeSet, + ) -> io::Result { + for names in [blocks_flow, ice] { + if names.iter().any(|n| registry.default_state(n).is_none()) { + return Err(invalid("unknown fluid block member")); + } + } + let states = (0..registry.len()) + .map(|i| { + let id = BlockStateId(i as u32); + let s = registry.state(id).unwrap(); + Ok(FluidBlock { + id, + fluid: FluidState::from_block(s)?, + blocks_flow: blocks_flow.contains(&s.name), + ice: ice.contains(&s.name), + }) + }) + .collect::>>()?; + Ok(Self { registry, states }) + } + pub fn registry(&self) -> &'r BlockRegistry { + self.registry + } + fn state(&self, id: BlockStateId) -> io::Result { + self.states + .get(id.0 as usize) + .copied() + .ok_or_else(|| invalid("fluid block state outside registry")) + } + pub fn fluid(&self, id: BlockStateId) -> io::Result { + Ok(self.state(id)?.fluid) + } + pub fn blocks_flow(&self, id: BlockStateId) -> io::Result { + Ok(self.state(id)?.blocks_flow) + } + pub fn is_ice(&self, id: BlockStateId) -> io::Result { + Ok(self.state(id)?.ice) + } +} +/// Both queries return state IDs from the same registry. Separate entry points +/// preserve native world dispatch when reading a block versus its fluid cell. +pub trait FluidBlockWorld: DynamicSupportWorld { + fn block_state(&mut self, position: BlockPos) -> Result; + fn fluid_block_state(&mut self, position: BlockPos) -> Result; +} +#[derive(Debug)] +pub enum FluidQueryError { + World(E), + Data(io::Error), + Support(SupportQueryError), +} +impl fmt::Display for FluidQueryError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::World(e) => e.fmt(f), + Self::Data(e) => e.fmt(f), + Self::Support(e) => e.fmt(f), + } + } +} +impl std::error::Error for FluidQueryError {} +pub struct RegistryFluidWorld<'a, 'r, W> { + registry: &'a FluidRegistry<'r>, + support: &'a BlockSupportRegistry<'r>, + world: &'a mut W, +} +impl<'a, 'r, W> RegistryFluidWorld<'a, 'r, W> { + pub fn new( + registry: &'a FluidRegistry<'r>, + support: &'a BlockSupportRegistry<'r>, + world: &'a mut W, + ) -> io::Result { + if !std::ptr::eq(registry.registry(), support.registry()) { + return Err(invalid("fluid and support registry identities differ")); + } + Ok(Self { + registry, + support, + world, + }) + } +} +impl FluidFlowWorld for RegistryFluidWorld<'_, '_, W> { + type Error = FluidQueryError; + type Block = FluidBlock; + fn fluid(&mut self, p: BlockPos) -> Result { + let id = self + .world + .fluid_block_state(p) + .map_err(FluidQueryError::World)?; + self.registry.fluid(id).map_err(FluidQueryError::Data) + } + fn block(&mut self, p: BlockPos) -> Result { + let id = self.world.block_state(p).map_err(FluidQueryError::World)?; + self.registry.state(id).map_err(FluidQueryError::Data) + } + fn blocks_fluid_flow(&self, s: FluidBlock) -> bool { + s.blocks_flow + } + fn is_ice_class(&self, s: FluidBlock) -> bool { + s.ice + } + fn is_face_sturdy( + &mut self, + s: FluidBlock, + p: BlockPos, + d: Direction, + ) -> Result { + self.support + .is_face_sturdy(self.world, s.id, [p.x, p.y, p.z], d, SupportType::Full) + .map_err(FluidQueryError::Support) + } +} +impl FluidHeightWorld for RegistryFluidWorld<'_, '_, W> { + type Error = FluidQueryError; + fn fluid(&mut self, p: [i32; 3]) -> Result { + FluidFlowWorld::fluid(self, BlockPos::new(p[0], p[1], p[2])) + } + fn sturdy_down(&mut self, p: [i32; 3]) -> Result { + let p = BlockPos::new(p[0], p[1], p[2]); + let s = FluidFlowWorld::block(self, p)?; + self.is_face_sturdy(s, p, Direction::Down) + } +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 779ed4691..fb17444e5 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -992,3 +992,21 @@ falling deflection, wrapping coordinates and query failures. Targeted Clippy passes. Block tag/class flags and face support are controlled in this comparison; binding those to registered block storage and support shapes, fluid spreading and complete gameplay remain pending. + + +`registry_fluid` now binds contained fluid states, resolved flow-blocking tags and +actual IceBlock class membership to the full block registry. Its world adapter +composes current/height/camera queries with cached and dynamic support shapes. +Foreign registry identities, unknown tag members and invalid state IDs are +rejected explicitly; tag reloads use a new immutable binding. + +`python3 tools/test_registry_fluid_parity.py` compares actual registered height, +camera immersion, current vectors and solid-face queries. The +[registered fluid report](../benchmarks/rust-registry-fluid-2026-10-07/scoped-parity.json) +records **2,446,969 matching lines per JAR** from **409,389 fixtures**, covering all +**35,723 block states**, waterlogged contents, cached/dynamic support, natural and +reloaded tags, neighboring fluid families, coordinate wrapping and failures. +Targeted Clippy passes, including checks for typed invalid-ID and foreign-registry +errors. World cells are controlled and block entities are absent in this suite; +active block-entity lifecycle, live entity binding, fluid spreading and complete +playable integration remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryFluidOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryFluidOracle.java new file mode 100644 index 000000000..356004382 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryFluidOracle.java @@ -0,0 +1,21 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*;import java.lang.reflect.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.*;import net.minecraft.core.registries.*;import net.minecraft.tags.*;import net.minecraft.world.level.*;import net.minecraft.world.level.block.*;import net.minecraft.world.level.material.*; +/** Registered fluid contents and cached/dynamic support dispatch in actual height/flow calls. */ +public final class VanillaRegistryFluidOracle { + static final class Stop extends RuntimeException {} + static String pos(BlockPos p){return p.getX()+" "+p.getY()+" "+p.getZ();} + public static void main(String[] args)throws Exception{ + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();Path dir=Path.of(args[1]);VanillaHeightmapOracle.bindTags(JsonParser.parseString(Files.readString(dir.resolve("tags.json"))).getAsJsonObject()); + var natural=new ArrayList>();var all=new ArrayList>();var names=new JsonArray();var ice=new JsonArray();for(var block:BuiltInRegistries.BLOCK){String name=BuiltInRegistries.BLOCK.getKey(block).toString();all.add(block.builtInRegistryHolder());if(block.defaultBlockState().is(BlockTags.BLOCKS_FLUID_FLOW)){names.add(name);natural.add(block.builtInRegistryHolder());}if(block instanceof IceBlock)ice.add(name);} + if(args[0].equals("export")){VanillaBlockSupportOracle.main(args);VanillaBlockStateCodecOracle.main(new String[]{"export",dir.resolve("facts.json").toString()});var info=new JsonObject();info.add("blocks_flow",names);info.add("ice",ice);Files.writeString(dir.resolve("fluid-info.json"),info.toString());return;} + var solid=FlowingFluid.class.getDeclaredMethod("isSolidFace",BlockGetter.class,BlockPos.class,Direction.class);solid.setAccessible(true);int oldTag=-1; + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();int tag=f.get("tag").getAsInt();if(tag!=oldTag){BuiltInRegistries.BLOCK.prepareTagReload(new TagLoader.LoadResult<>(Registries.BLOCK,Map.of(BlockTags.BLOCKS_FLUID_FLOW,tag==0?natural:tag==1?List.>of():all))).apply();oldTag=tag;} + int[] calls={0};var world=(BlockGetter)Proxy.newProxyInstance(BlockGetter.class.getClassLoader(),new Class[]{BlockGetter.class},(proxy,method,values)->{var p=(BlockPos)values[0];String kind=switch(method.getName()){case "getBlockState"->"block";case "getFluidState"->"fluid";case "getBlockEntity"->"entity";default->throw new AssertionError(method);};out.println(kind+" "+pos(p));if(calls[0]++==f.get("fail").getAsInt())throw new Stop();if(kind.equals("entity"))return null;var v=f.getAsJsonObject("cells").get(pos(p));var state=Block.stateById(v==null?f.get("default").getAsInt():v.getAsInt());return kind.equals("block")?state:state.getFluidState();}); + var a=f.getAsJsonArray("position");var p=new BlockPos(a.get(0).getAsInt(),a.get(1).getAsInt(),a.get(2).getAsInt());var root=Block.stateById(f.get("root").getAsInt()).getFluidState(); + try{switch(f.get("mode").getAsString()){case "flow":{var v=root.getFlow(world,p);out.printf("flow %016x %016x %016x%n",Double.doubleToLongBits(v.x),Double.doubleToLongBits(v.y),Double.doubleToLongBits(v.z));break;}case "face":out.println("face "+solid.invoke(root.getType(),world,p,Direction.values()[f.get("direction").getAsInt()]));break;case "height":out.printf("height %08x%n",Float.floatToIntBits(root.getHeight(world,p)));break;case "camera":out.printf("height %08x%n",Float.floatToIntBits(root.getHeightForCamera(world,p)));break;default:throw new AssertionError();}}catch(Stop e){out.println("error");}catch(InvocationTargetException e){if(e.getCause() instanceof Stop)out.println("error");else throw e;} + out.println("queries "+calls[0]); + }} + } +} diff --git a/tools/test_registry_fluid_parity.py b/tools/test_registry_fluid_parity.py new file mode 100644 index 000000000..241f3c3ab --- /dev/null +++ b/tools/test_registry_fluid_parity.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python3 +"""Compare registered fluid contents, height and current support composition.""" +import itertools +import json +import os +from pathlib import Path +import platform +import random +import struct +import subprocess +import zipfile +try: + from . import lab, test_rust_parity as base, test_worldgen_parity as worldgen +except ImportError: + import lab + import test_rust_parity as base + import test_worldgen_parity as worldgen + + +def corpus(info): + defaults=info['defaults'];states=info['states'];air=defaults['minecraft:air'];water=defaults['minecraft:water'];lava=defaults['minecraft:lava'] + flowing=[i for i,s in enumerate(states) if s['id'] in ['minecraft:water','minecraft:lava']] + falling_water=next(i for i in flowing if states[i]['id']=='minecraft:water' and states[i]['properties']['level']=='8') + falling_lava=next(i for i in flowing if states[i]['id']=='minecraft:lava' and states[i]['properties']['level']=='8') + def row(root,**kw): + f=dict(mode='flow',root=root,default=air,cells={},position=[0,0,0],fail=-1,direction=2,tag=0);f.update(kw);return f + for i in range(len(states)): + for mode in ['flow','height','camera']:yield row(i,mode=mode,default=water) + for direction in range(6):yield row(water,mode='face',direction=direction,default=i) + yield row(falling_water,cells={'0 0 -1':i,'1 0 0':water,'-1 -1 0':lava}) + yield row(water,mode='camera',default=i) + for tag in range(3): + for i in defaults.values(): + for root in [falling_water,falling_lava]:yield row(root,tag=tag,cells={'0 0 -1':i,'0 -1 -1':root}) + special=[defaults['minecraft:'+n] for n in ['air','stone','ice','frosted_ice','packed_ice','blue_ice','water','lava','shulker_box','moving_piston','scaffolding','oak_slab','powder_snow','bamboo','pointed_dripstone']] + for i in special: + for root in [falling_water,falling_lava]: + for mode in ['flow','height','camera','face']: + for fail in range(-1,30):yield row(root,mode=mode,default=i,fail=fail) + rng=random.Random(0x524547464c554944) + for _ in range(5000): + p=rng.choice([(0,0,0),(17,-64,-33),(2147483647,-2147483648,-2147483648)]) + def wrap(v):return (v+2**31)%2**32-2**31 + cells={' '.join(str(wrap(a+b)) for a,b in zip(p,(dx,y,dz))):rng.choice(special+flowing) for dx,dz in [(0,-1),(1,0),(0,1),(-1,0)] for y in [-1,0,1]} + yield row(rng.choice(flowing),cells=cells,default=rng.choice(special),position=p,fail=rng.choice([-1,-1,*range(35)]),tag=rng.randrange(3)) + + +def main(): + lock,jars,libraries=base.verify_artifacts();build=lab.LOCAL/'rust-registry_fluid-parity';build.mkdir(exist_ok=True);report_path=build/'report.json';report_path.unlink(missing_ok=True) + root=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity';oracles=[root/(n+'.java') for n in ['VanillaRegistryFluidOracle','VanillaHeightmapOracle','VanillaBlockSupportOracle','VanillaCollisionOracle','VanillaBlockStateCodecOracle']] + sources=[*oracles,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/test_worldgen_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-world/examples/registry_fluid_fixture.rs'] + for crate in ['horizon-core','horizon-world']:sources += [lab.ROOT/'crates'/crate/'Cargo.toml',*sorted((lab.ROOT/'crates'/crate/'src').rglob('*.rs'))] + tested=base.source_hashes(sources);tags=worldgen.tag_resources(jars['server']) + if tags!=worldgen.tag_resources(jars['client']):raise AssertionError('Native tags differ between artifacts') + lab.write_json(build/'tags.json',tags);classes=build/'classes';classes.mkdir(exist_ok=True);dependencies=os.pathsep.join(map(str,libraries)) + def run(command,name): + with (build/(name+'.log')).open('w') as log:subprocess.run(list(map(str,command)),cwd=lab.ROOT,check=True,timeout=3600,stdout=log,stderr=subprocess.STDOUT) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependencies,'-d',classes,*oracles],'compile-java') + def java(side,mode):run(['java','-Xmx768M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependencies]),'dev.horizonlab.parity.VanillaRegistryFluidOracle',mode,build],side+'-'+mode) + java('server','export');info=json.loads((build/'facts.json').read_text());count=0 + if len(info['states'])!=35723:raise AssertionError('Incomplete pinned registry') + with (build/'inputs.txt').open('w') as output: + for f in corpus(info):output.write(json.dumps(f,separators=(',',':'))+'\n');count+=1 + fixture_paths=[build/n for n in ['inputs.txt','facts.json','fluid-info.json','block-registry.nbt','cached-support.nbt','tags.json']];fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--locked','--release','-p','horizon-world','--example','registry_fluid_fixture'],'compile-rust');metadata=json.loads(subprocess.check_output(['cargo','metadata','--locked','--no-deps','--format-version','1'],cwd=lab.ROOT));binary=Path(metadata['target_directory'])/'release/examples'/('registry_fluid_fixture.exe' if os.name=='nt' else 'registry_fluid_fixture');run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side);matched=base.compare(build/(side+'.txt'),build/'rust.txt');references.append(dict(side=side,jar_sha256=lab.digest(jar,'sha256'),output_sha256=lab.digest(build/(side+'.txt'),'sha256'),matched_output_lines=matched));print(f'{side}: {matched:,} registry_fluid output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested);base.ensure_sources_unchanged(fixture_paths,fixtures) + report=dict(schema=1,minecraft=lock['minecraft']['version'],manifest_sha1=lock['minecraft']['manifest_sha1'],platform=platform.platform(),java=subprocess.check_output(['java','--version'],text=True).splitlines()[0],rustc=subprocess.check_output(['rustc','--version'],text=True).strip(),fixtures=count,registry_states=len(info['states']),sources_sha256=tested,fixtures_sha256=fixtures,rust_output_sha256=lab.digest(build/'rust.txt','sha256'),references=references,scope='Actual registered fluid height/camera-height/current vectors and solid-face selection using all native block states, BLOCKS_FLUID_FLOW tags and IceBlock class identities. Rust composes registered contained fluids with cached/dynamic block support, preserving world query order, directional walls, waterlogged contents, coordinate wrapping and failures. Block storage is controlled and block entities are absent; live entity/world binding, active block-entity lifecycle, fluid spreading and complete gameplay remain pending.') + lab.write_json(report_path,report);print(f'Scoped registry_fluid parity passed: {report_path}',flush=True) + + +if __name__=='__main__':main() From 039a9f2461988786570613b51d872d51e93eb95b Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 03:24:42 +0200 Subject: [PATCH 098/253] Compose entity water entry and fluid current updates --- .../immersion-regression.json | 236 +++++++++++++++++ .../scoped-parity.json | 237 ++++++++++++++++++ .../examples/entity_fluid_fixture.rs | 77 +++++- crates/horizon-world/src/entity_fluid_tick.rs | 62 +++++ crates/horizon-world/src/lib.rs | 1 + docs/collision-geometry.md | 19 ++ .../parity/VanillaEntityFluidOracle.java | 26 +- tools/test_entity_fluid_tick_parity.py | 80 ++++++ 8 files changed, 728 insertions(+), 10 deletions(-) create mode 100644 benchmarks/rust-entity-fluid-tick-2026-10-07/immersion-regression.json create mode 100644 benchmarks/rust-entity-fluid-tick-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/src/entity_fluid_tick.rs create mode 100644 tools/test_entity_fluid_tick_parity.py diff --git a/benchmarks/rust-entity-fluid-tick-2026-10-07/immersion-regression.json b/benchmarks/rust-entity-fluid-tick-2026-10-07/immersion-regression.json new file mode 100644 index 000000000..b7cdd18e5 --- /dev/null +++ b/benchmarks/rust-entity-fluid-tick-2026-10-07/immersion-regression.json @@ -0,0 +1,236 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 7646, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityFluidOracle.java": "fc40082864b90f4a7f71fcfcdc400b56e91ab53623876e31736d412d7154b9c5", + "tools/test_entity_fluid_parity.py": "34d563a48f30434258cc8f836457f396ee4f1b2973a80b112bda22be1dc90bb8", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "fd004f993c35707caf1e0f7cdba87f7b615a7c16d2e0bf4b59f952d07488caa7", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "2d88983b56513e9b70bc79ef0b9743f5d2250c6e1dd954cc6fb7ea89c601e023", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/entity_fluid_fixture.rs": "8c7f32671e4eee572d42ad19e29323b7b70670ec8902a0424631857653281bad" + }, + "fixtures_sha256": { + ".local/rust-entity-fluid-parity/inputs.txt": "e9eb2297d21b93c9c25046f240984508fa3593d14833e4f5592a623b8ed85838" + }, + "rust_output_sha256": "a675c1a446e77894680508b5160f2b8ce656ace279ad80352a122fd517efa699", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "a675c1a446e77894680508b5160f2b8ce656ace279ad80352a122fd517efa699", + "matched_output_lines": 607338 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "a675c1a446e77894680508b5160f2b8ce656ace279ad80352a122fd517efa699", + "matched_output_lines": 607338 + } + ], + "scope": "Actual EntityFluidInteraction update, tracker pruning, body/eye depth, loaded-chunk preflight, overlapping/reloaded tags, ordered current accumulation and native Entity.addDeltaMovement. Controlled fluid height/flow and camera-support cells, real ProtoChunk section fluid flags, player versus nonplayer classes, callback mutations and injected failures. Live fluid flow/propagation and full entity/world integration remain pending." +} diff --git a/benchmarks/rust-entity-fluid-tick-2026-10-07/scoped-parity.json b/benchmarks/rust-entity-fluid-tick-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..749f5f581 --- /dev/null +++ b/benchmarks/rust-entity-fluid-tick-2026-10-07/scoped-parity.json @@ -0,0 +1,237 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 17346, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityFluidOracle.java": "fc40082864b90f4a7f71fcfcdc400b56e91ab53623876e31736d412d7154b9c5", + "tools/test_entity_fluid_tick_parity.py": "1417d2fabe648d97ae79f0682d2be26701039fcdc888e36a3c31af139643c142", + "tools/test_entity_fluid_parity.py": "34d563a48f30434258cc8f836457f396ee4f1b2973a80b112bda22be1dc90bb8", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "fd004f993c35707caf1e0f7cdba87f7b615a7c16d2e0bf4b59f952d07488caa7", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "2d88983b56513e9b70bc79ef0b9743f5d2250c6e1dd954cc6fb7ea89c601e023", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/entity_fluid_fixture.rs": "8c7f32671e4eee572d42ad19e29323b7b70670ec8902a0424631857653281bad" + }, + "fixtures_sha256": { + ".local/rust-entity-fluid-tick-parity/inputs.txt": "0d587117237b039d0606d563a75ee23be3099612345dc893b398275d911c0349" + }, + "rust_output_sha256": "f38ab02725a0187c58fceeddb51751b0c2a91f678def80e8b4384aabe91e1ee9", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "f38ab02725a0187c58fceeddb51751b0c2a91f678def80e8b4384aabe91e1ee9", + "matched_output_lines": 953830 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "f38ab02725a0187c58fceeddb51751b0c2a91f678def80e8b4384aabe91e1ee9", + "matched_output_lines": 953830 + } + ], + "scope": "Actual Entity.updateFluidInteraction composing EntityFluidInteraction update and current application. Compares both push predicate calls, water-entry fall reset and splash dispatch, retained touching-water state, first tick, water/lava current coefficients and FAST_LAVA dimension attribute selection. Includes ordered/reloaded tags, controlled cell heights/flows, player/nonplayer classes, mutations and failures before/after partial writes. Splash audio/particles and full live world/entity gameplay binding remain pending." +} diff --git a/crates/horizon-world/examples/entity_fluid_fixture.rs b/crates/horizon-world/examples/entity_fluid_fixture.rs index 35daf7ffd..d40f73bd1 100644 --- a/crates/horizon-world/examples/entity_fluid_fixture.rs +++ b/crates/horizon-world/examples/entity_fluid_fixture.rs @@ -4,6 +4,7 @@ use horizon_core::{ }; use horizon_world::{ entity_fluid::*, + entity_fluid_tick::{self, EntityFluidTickWorld}, fluid::{FluidKind, FluidState}, }; use serde_json::Value; @@ -41,6 +42,12 @@ fn position(v: &Value) -> BlockPos { v[2].as_i64().unwrap() as i32, ) } +#[derive(Clone, Copy, Default)] +struct Tick { + touch: bool, + first: bool, + fall: f64, +} struct World<'a> { op: &'a Value, out: &'a mut dyn Write, @@ -50,6 +57,8 @@ struct World<'a> { wet: Vec, states: [FluidState; 5], player: bool, + tick: Tick, + pushed: usize, } impl World<'_> { fn query(&mut self, s: String) -> io::Result<()> { @@ -62,6 +71,11 @@ impl World<'_> { if n == self.op["mutate_at"].as_i64().unwrap() { self.velocity = vector(&self.op["after_velocity"]); self.block = position(&self.op["after_block"]); + if self.op.get("after_touch").is_some() { + self.tick.touch = self.op["after_touch"].as_bool().unwrap(); + self.tick.first = self.op["after_first"].as_bool().unwrap(); + self.tick.fall = number(&self.op["after_fall"]); + } } Ok(()) } @@ -161,6 +175,36 @@ impl CurrentTarget for World<'_> { Ok(()) } } +impl EntityFluidTickWorld for World<'_> { + fn is_pushed_by_fluid(&mut self) -> io::Result { + self.query("pushed".into())?; + let values = self.op["pushed"].as_array().unwrap(); + let result = values[self.pushed.min(values.len() - 1)].as_bool().unwrap(); + self.pushed += 1; + Ok(result) + } + fn reset_fall_distance(&mut self) -> io::Result<()> { + self.query("reset-fall".into())?; + self.tick.fall = 0.0; + Ok(()) + } + fn was_touching_water(&self) -> bool { + self.tick.touch + } + fn first_tick(&self) -> bool { + self.tick.first + } + fn water_splash(&mut self) -> io::Result<()> { + self.query("splash".into()) + } + fn set_was_touching_water(&mut self, value: bool) { + self.tick.touch = value; + } + fn fast_lava(&mut self) -> io::Result { + self.query("fast-lava".into())?; + Ok(self.op["fast_lava"].as_bool().unwrap()) + } +} fn limit_checks(template: &Value, states: [FluidState; 5]) { let mut op = template.clone(); op["default"]["kind"] = 2.into(); @@ -176,6 +220,8 @@ fn limit_checks(template: &Value, states: [FluidState; 5]) { wet: vec![false, true, false], states, player: false, + tick: Tick::default(), + pushed: 0, }; let mut interaction = EntityFluidInteraction::new([FluidTagId(0)]); assert!(matches!( @@ -236,6 +282,12 @@ fn main() -> Result<(), Box> { .iter() .map(|v| FluidTagId(v.as_u64().unwrap() as u32)), ); + let initial = f.get("tick_initial"); + let mut tick = initial.map_or(Tick::default(), |v| Tick { + touch: v["touch"].as_bool().unwrap(), + first: v["first"].as_bool().unwrap(), + fall: number(&v["fall"]), + }); for op in f["ops"].as_array().unwrap() { let mut w = World { op, @@ -251,8 +303,21 @@ fn main() -> Result<(), Box> { .collect(), states, player: f["player"].as_bool().unwrap(), + tick, + pushed: 0, }; - if op["mode"].as_str().unwrap() == "update" { + if op["mode"].as_str().unwrap() == "tick" { + match entity_fluid_tick::update( + &mut interaction, + &mut w, + FluidTagId(0), + FluidTagId(1), + 1_000_000, + ) { + Ok(v) => writeln!(w.out, "result {v}")?, + Err(_) => writeln!(w.out, "error")?, + } + } else if op["mode"].as_str().unwrap() == "update" { match interaction.update(&mut w, op["ignore"].as_bool().unwrap(), 1_000_000) { Ok(v) => writeln!(w.out, "result {v}")?, Err(_) => writeln!(w.out, "error")?, @@ -296,6 +361,16 @@ fn main() -> Result<(), Box> { } writeln!(w.out, "final {}", show(w.velocity))?; writeln!(w.out, "queries {}", w.calls)?; + tick = w.tick; + if initial.is_some() { + writeln!( + w.out, + "tick {} {} {:016x}", + tick.touch, + tick.first, + bits(tick.fall) + )?; + } } } Ok(()) diff --git a/crates/horizon-world/src/entity_fluid_tick.rs b/crates/horizon-world/src/entity_fluid_tick.rs new file mode 100644 index 000000000..22e6fd4d2 --- /dev/null +++ b/crates/horizon-world/src/entity_fluid_tick.rs @@ -0,0 +1,62 @@ +//! Entity water-entry effects and current forces around immersion updates. +use crate::entity_fluid::{ + CurrentTarget, EntityFluidInteraction, FluidInteractionError, FluidInteractionWorld, FluidTagId, +}; +type WorldError = ::Error; +pub trait EntityFluidTickWorld: + FluidInteractionWorld + CurrentTarget> +{ + fn is_pushed_by_fluid(&mut self) -> Result>; + fn reset_fall_distance(&mut self) -> Result<(), WorldError>; + fn was_touching_water(&self) -> bool; + fn first_tick(&self) -> bool; + fn water_splash(&mut self) -> Result<(), WorldError>; + fn set_was_touching_water(&mut self, value: bool); + fn fast_lava(&mut self) -> Result>; +} +/// The push predicate is queried twice: before resetting immersion state and +/// after water-entry effects. Water/lava membership is captured before effects. +pub fn update( + interaction: &mut EntityFluidInteraction, + world: &mut W, + water: FluidTagId, + lava: FluidTagId, + budget: usize, +) -> Result>> { + let ignore = !world + .is_pushed_by_fluid() + .map_err(FluidInteractionError::World)?; + let changed = interaction.update(world, ignore, budget)?; + let in_water = interaction.is_in_fluid(world, water); + let in_lava = interaction.is_in_fluid(world, lava); + if in_water { + world + .reset_fall_distance() + .map_err(FluidInteractionError::World)?; + if !world.was_touching_water() && !world.first_tick() { + world.water_splash().map_err(FluidInteractionError::World)?; + } + } + world.set_was_touching_water(in_water); + if world + .is_pushed_by_fluid() + .map_err(FluidInteractionError::World)? + { + if in_water { + interaction + .apply_current(world, water, 0.014) + .map_err(FluidInteractionError::World)?; + } + if in_lava { + let speed = if world.fast_lava().map_err(FluidInteractionError::World)? { + 0.007 + } else { + 0.0023333333333333335 + }; + interaction + .apply_current(world, lava, speed) + .map_err(FluidInteractionError::World)?; + } + } + Ok(changed) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index f35cc3af7..2c93d58b5 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -21,6 +21,7 @@ pub mod dynamic_support; pub mod edge_backoff; pub mod entity_collision; pub mod entity_fluid; +pub mod entity_fluid_tick; pub mod entity_move; pub mod entity_obstruction; pub mod fall_damage; diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index fb17444e5..03891dd2d 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1010,3 +1010,22 @@ Targeted Clippy passes, including checks for typed invalid-ID and foreign-regist errors. World cells are controlled and block entities are absent in this suite; active block-entity lifecycle, live entity binding, fluid spreading and complete playable integration remain pending. + + +`entity_fluid_tick` composes immersion updates with entity water-entry behavior +and current application. It captures water/lava membership before effects, +resets fall distance in water, dispatches a splash after the first tick when +newly entering water, updates the touching-water flag and queries the push +predicate again before applying forces. Lava uses the dimension's FAST_LAVA +attribute to select its current coefficient. + +`python3 tools/test_entity_fluid_tick_parity.py` invokes actual +`Entity.updateFluidInteraction` with native immersion and current application. +The [entity fluid tick report](../benchmarks/rust-entity-fluid-tick-2026-10-07/scoped-parity.json) +records **953,830 matching lines per JAR**, including changing push predicates, +first-tick/entry flags, simultaneous water/lava, attribute selection, nonfinite +arithmetic, callback mutations and failures around partial writes. The +[immersion regression](../benchmarks/rust-entity-fluid-tick-2026-10-07/immersion-regression.json) +also passes **607,338 lines per JAR** after extending the shared fixtures. +Targeted Clippy passes. Splash dispatch is controlled; audio/particle generation, +full live entity/world binding and playable integration remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityFluidOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityFluidOracle.java index 0ec7cb085..117e08cb9 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityFluidOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityFluidOracle.java @@ -6,7 +6,7 @@ import net.minecraft.world.entity.*;import net.minecraft.world.level.*;import ne /** Actual entity immersion/current state machine with controlled cell providers and real chunk sections. */ public final class VanillaEntityFluidOracle { static final class Stop extends RuntimeException {} - static Object unsafe;static Method allocate;static Field blockPosition,level; + static Object unsafe;static Method allocate;static Field blockPosition,level,touch,first,interactionField; static net.minecraft.world.level.material.Fluid[] KINDS; static T make(Class c){try{return c.cast(allocate.invoke(unsafe,c));}catch(Exception e){throw new AssertionError(e);}} static Field field(Class c,String n)throws Exception{var f=c.getDeclaredField(n);f.setAccessible(true);return f;} @@ -17,9 +17,10 @@ public final class VanillaEntityFluidOracle { static String pos(BlockPos p){return p.getX()+" "+p.getY()+" "+p.getZ();} static BlockPos position(JsonElement v){var a=v.getAsJsonArray();return new BlockPos(a.get(0).getAsInt(),a.get(1).getAsInt(),a.get(2).getAsInt());} static AABB bounds(JsonElement v){if(v.isJsonNull())return null;var a=v.getAsJsonArray();return new AABB(number(a.get(0)),number(a.get(1)),number(a.get(2)),number(a.get(3)),number(a.get(4)),number(a.get(5)));} - static final class Data {JsonObject op;PrintWriter out;int calls;Vec3 velocity;Entity entity;Chunk chunk;FluidState[] states; - void query(String s){out.println(s);int n=calls++;if(n==op.get("fail").getAsInt())throw new Stop();if(n==op.get("mutate_at").getAsInt()){velocity=vec(op.get("after_velocity"));try{blockPosition.set(entity,position(op.get("after_block")));}catch(Exception e){throw new AssertionError(e);}}} + static final class Data {JsonObject op;PrintWriter out;int calls,pushed;Vec3 velocity;Entity entity;Chunk chunk;FluidState[] states; + void query(String s){out.println(s);int n=calls++;if(n==op.get("fail").getAsInt())throw new Stop();if(n==op.get("mutate_at").getAsInt()){velocity=vec(op.get("after_velocity"));try{blockPosition.set(entity,position(op.get("after_block")));if(op.has("after_touch")){touch.setBoolean(entity,op.get("after_touch").getAsBoolean());first.setBoolean(entity,op.get("after_first").getAsBoolean());entity.fallDistance=number(op.get("after_fall"));}}catch(Exception e){throw new AssertionError(e);}}} JsonObject cell(BlockPos p){var c=op.getAsJsonObject("cells").get(pos(p));return(c==null?op.get("default"):c).getAsJsonObject();} + boolean pushed(){query("pushed");var a=op.getAsJsonArray("pushed");return a.get(Math.min(pushed++,a.size()-1)).getAsBoolean();} AABB box(){query("box");return bounds(op.get("bounds"));} double eye(){query("eye");return number(op.get("eye"));} Vec3 velocity(){query("velocity");return velocity;} @@ -37,35 +38,42 @@ public final class VanillaEntityFluidOracle { @Override public LevelChunkSection[] getSections(){if(d!=null)d.query("sections");return super.getSections();} } static final class World extends net.minecraft.server.level.ServerLevel {Data d;World(){super(null,null,null,null,null,null,false,0L,List.of(),false);} + @Override public net.minecraft.world.attribute.EnvironmentAttributeSystem environmentAttributes(){d.query("fast-lava");return net.minecraft.world.attribute.EnvironmentAttributeSystem.builder().addConstantLayer(net.minecraft.world.attribute.EnvironmentAttributes.FAST_LAVA,previous->d.op.get("fast_lava").getAsBoolean()).build();} @Override public ChunkAccess getChunk(int x,int z,ChunkStatus status,boolean create){if(status!=ChunkStatus.FULL||create)throw new AssertionError();d.query("chunk "+x+" "+z);return d.op.getAsJsonArray("missing").contains(new JsonPrimitive(x+" "+z))?null:d.chunk;} @Override public FluidState getFluidState(BlockPos p){d.query("fluid "+pos(p));return d.states[d.cell(p).get("kind").getAsInt()];} @Override public BlockState getBlockState(BlockPos p){d.query("block "+pos(p));return(d.op.get("sturdy").getAsBoolean()?Blocks.STONE:Blocks.AIR).defaultBlockState();} } static final class Actor extends Marker {Data d;Actor(){super(null,null);} + @Override public boolean isPushedByFluid(){return d.pushed();} + @Override public void resetFallDistance(){d.query("reset-fall");super.resetFallDistance();} + @Override protected void doWaterSplashEffect(){d.query("splash");} @Override public AABB getFluidInteractionBox(){return d.box();}@Override public double getEyeY(){return d.eye();} @Override public Vec3 getDeltaMovement(){return d.velocity();}@Override public void setDeltaMovement(Vec3 v){d.set(v);} } static final class Human extends net.minecraft.world.entity.player.Player {Data d;Human(){super(null,null);} @Override public GameType gameMode(){return GameType.SURVIVAL;} + @Override public boolean isPushedByFluid(){return d.pushed();} + @Override public void resetFallDistance(){d.query("reset-fall");super.resetFallDistance();} + @Override protected void doWaterSplashEffect(){d.query("splash");} @Override public AABB getFluidInteractionBox(){return d.box();}@Override public double getEyeY(){return d.eye();} @Override public Vec3 getDeltaMovement(){return d.velocity();}@Override public void setDeltaMovement(Vec3 v){d.set(v);} } public static void main(String[] args)throws Exception { - net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();KINDS=new net.minecraft.world.level.material.Fluid[]{Fluids.EMPTY,Fluids.FLOWING_WATER,Fluids.WATER,Fluids.FLOWING_LAVA,Fluids.LAVA};var u=Class.forName("sun.misc.Unsafe");var uf=field(u,"theUnsafe");unsafe=uf.get(null);allocate=u.getMethod("allocateInstance",Class.class);blockPosition=field(Entity.class,"blockPosition");level=field(Entity.class,"level"); + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();KINDS=new net.minecraft.world.level.material.Fluid[]{Fluids.EMPTY,Fluids.FLOWING_WATER,Fluids.WATER,Fluids.FLOWING_LAVA,Fluids.LAVA};var u=Class.forName("sun.misc.Unsafe");var uf=field(u,"theUnsafe");unsafe=uf.get(null);allocate=u.getMethod("allocateInstance",Class.class);blockPosition=field(Entity.class,"blockPosition");level=field(Entity.class,"level");touch=field(Entity.class,"wasTouchingWater");first=field(Entity.class,"firstTick");interactionField=field(Entity.class,"fluidInteraction");var tick=Entity.class.getDeclaredMethod("updateFluidInteraction");tick.setAccessible(true); var trackers=field(EntityFluidInteraction.class,"fluidTrackers");var currents=field(EntityFluidInteraction.class,"currentAccumulators");var trackerClass=Class.forName("net.minecraft.world.entity.EntityFluidInteraction$Tracker");var kind=field(trackerClass,"fluidType");var height=field(trackerClass,"height");var eyes=field(trackerClass,"eyesInside");var currentClass=Class.forName("net.minecraft.world.entity.EntityFluidInteraction$CurrentAccumulator");var depth=field(currentClass,"height");var accumulated=field(currentClass,"accumulatedCurrent");var count=field(currentClass,"currentCount"); - var tags=new ArrayList>();for(int i=0;i<4;i++)tags.add(TagKey.create(Registries.FLUID,Identifier.parse("horizon:immersion_"+i))); + var tags=new ArrayList>();for(int i=0;i<4;i++)tags.add(i==0?FluidTags.WATER:i==1?FluidTags.LAVA:TagKey.create(Registries.FLUID,Identifier.parse("horizon:immersion_"+i))); Holder biome=Holder.Reference.createStandAlone(new HolderOwner(){},Biomes.PLAINS);var ids=new IdMapper>();ids.add(biome);var factory=new PalettedContainerFactory(Strategy.createForBlockStates(Block.BLOCK_STATE_REGISTRY),Blocks.AIR.defaultBlockState(),null,Strategy.createForBiomes(ids),biome,null); Path dir=Path.of(args[1]);try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();var ordered=new LinkedHashSet>();for(var t:f.getAsJsonArray("order"))ordered.add(tags.get(t.getAsInt()));var interaction=new EntityFluidInteraction(ordered); var d=new Data();d.out=out;d.states=new FluidState[5];for(int i=0;i<5;i++){var fluid=make(Fluid.class);fluid.d=d;fluid.kind=i;d.states[i]=new FluidState(fluid,new net.minecraft.world.level.block.state.properties.Property[0],new Comparable[0]);}var w=make(World.class);w.d=d; - if(f.get("player").getAsBoolean()){var e=make(Human.class);e.d=d;d.entity=e;}else{var e=make(Actor.class);e.d=d;d.entity=e;}level.set(d.entity,w); - for(var value:f.getAsJsonArray("ops")){d.op=value.getAsJsonObject();var op=d.op;d.calls=0;d.velocity=vec(op.get("velocity"));blockPosition.set(d.entity,position(op.get("block")));d.entity.setBoundingBox(new AABB(0,number(op.get("base_y")),0,1,number(op.get("base_y"))+1,1)); + if(f.get("player").getAsBoolean()){var e=make(Human.class);e.d=d;d.entity=e;}else{var e=make(Actor.class);e.d=d;d.entity=e;}level.set(d.entity,w);interactionField.set(d.entity,interaction);if(f.has("tick_initial")){var initial=f.getAsJsonObject("tick_initial");touch.setBoolean(d.entity,initial.get("touch").getAsBoolean());first.setBoolean(d.entity,initial.get("first").getAsBoolean());d.entity.fallDistance=number(initial.get("fall"));} + for(var value:f.getAsJsonArray("ops")){d.op=value.getAsJsonObject();var op=d.op;d.calls=0;d.pushed=0;d.velocity=vec(op.get("velocity"));blockPosition.set(d.entity,position(op.get("block")));d.entity.setBoundingBox(new AABB(0,number(op.get("base_y")),0,1,number(op.get("base_y"))+1,1)); var bindings=new HashMap,List>>();for(int t=0;t<4;t++){var members=new ArrayList>();int mask=op.getAsJsonArray("tags").get(t).getAsInt();for(int k=0;k<5;k++)if((mask&(1<(Registries.FLUID,bindings)).apply(); var wet=op.getAsJsonArray("wet");d.chunk=new Chunk(d,factory,op.get("min_section").getAsInt()*16,wet.size()*16);for(int i=0;i)trackers.get(interaction);out.println("trackers "+list.size());for(var t:list){Object holder=kind.get(t);int k=-1;for(int i=0;i<5;i++)if(KINDS[i].builtInRegistryHolder()==holder)k=i;out.printf("tracker %d %016x %s%n",k,Double.doubleToLongBits(height.getDouble(t)),eyes.getBoolean(t));} var map=(Map)currents.get(interaction);for(var tag:ordered){var c=map.get(tag);out.printf("current %d %016x %s %d%n",tags.indexOf(tag),Double.doubleToLongBits(depth.getDouble(c)),vector((Vec3)accumulated.get(c)),count.getInt(c));} for(int t=0;t<4;t++)out.printf("tag %d %016x %s %s%n",t,Double.doubleToLongBits(interaction.getFluidHeight(tags.get(t))),interaction.isInFluid(tags.get(t)),interaction.isEyeInFluid(tags.get(t))); - out.println("final "+vector(d.velocity));out.println("queries "+d.calls); + out.println("final "+vector(d.velocity));out.println("queries "+d.calls);if(f.has("tick_initial"))out.printf("tick %s %s %016x%n",touch.getBoolean(d.entity),first.getBoolean(d.entity),Double.doubleToLongBits(d.entity.fallDistance)); } }} } diff --git a/tools/test_entity_fluid_tick_parity.py b/tools/test_entity_fluid_tick_parity.py new file mode 100644 index 000000000..7036e8514 --- /dev/null +++ b/tools/test_entity_fluid_tick_parity.py @@ -0,0 +1,80 @@ +#!/usr/bin/env python3 +"""Compare Entity fluid tick composition, entry effects and current forces with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +try: + from . import test_entity_fluid_parity as immersion +except ImportError: + import test_entity_fluid_parity as immersion + +def corpus(): + import copy + def bits(v):return struct.pack('>d',float(v)).hex() + rng=random.Random(0x464c5549445449434b) + def convert(f,**kw): + f=copy.deepcopy(f);f['tick_initial']=dict(touch=kw.get('touch',False),first=kw.get('first',False),fall=bits(8)) + for op in f['ops']: + if op['mode']=='update':op['mode']='tick' + op.update(pushed=kw.get('pushed',[True,True]),fast_lava=kw.get('fast',False),after_touch=kw.get('after_touch',True),after_first=kw.get('after_first',True),after_fall=bits(-3)) + return f + cases=list(immersion.corpus()) + for f in cases: + yield convert(f,touch=bool(rng.randrange(2)),first=bool(rng.randrange(2)),pushed=rng.choice([[True],[False],[False,True],[True,False]]),fast=bool(rng.randrange(2)),after_touch=bool(rng.randrange(2)),after_first=bool(rng.randrange(2))) + seed=copy.deepcopy(cases[0]);seed['ops']=seed['ops'][:1] + op=seed['ops'][0];op['bounds']=[bits(v) for v in [0,0,0,1,1,2]];op['eye']=bits(.5) + op['cells']={'0 0 0':dict(kind=2,height=struct.pack('>f',.8).hex(),flow=[bits(v) for v in [1,0,0]]),'0 0 1':dict(kind=4,height=struct.pack('>f',.8).hex(),flow=[bits(v) for v in [0,0,1]])} + for flags in range(64): + f=convert(seed,touch=bool(flags&1),first=bool(flags&2),pushed=[bool(flags&4),bool(flags&8)],fast=bool(flags&16),after_touch=bool(flags&32),after_first=False) + for fail in range(-1,29): + for mutate in [-1,0,18,21,24]: + g=copy.deepcopy(f);g['ops'][0]['fail']=fail;g['ops'][0]['mutate_at']=mutate;yield g + for f in cases[:100]: + g=convert(f);g['ops']*=3;yield g + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-entity-fluid-tick-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityFluidOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_entity_fluid_parity.py',lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/entity_fluid_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaEntityFluidOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','entity_fluid_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('entity_fluid_fixture.exe' if os.name=='nt' else 'entity_fluid_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} entity-fluid-tick output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual Entity.updateFluidInteraction composing EntityFluidInteraction update and current application. Compares both push predicate calls, water-entry fall reset and splash dispatch, retained touching-water state, first tick, water/lava current coefficients and FAST_LAVA dimension attribute selection. Includes ordered/reloaded tags, controlled cell heights/flows, player/nonplayer classes, mutations and failures before/after partial writes. Splash audio/particles and full live world/entity gameplay binding remain pending.'} + lab.write_json(report_path,report);print(f'Scoped entity fluid tick parity passed: {report_path}') + + +if __name__=='__main__':main() From 727f662c64378f3c6ac6b4d79b46f3cf3fdaa50a Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 03:33:30 +0200 Subject: [PATCH 099/253] Compose entity immersion with registered fluid and support behavior --- .../immersion-regression.json | 236 +++++++++++++++++ .../scoped-parity.json | 250 ++++++++++++++++++ .../tick-regression.json | 237 +++++++++++++++++ .../examples/entity_fluid_fixture.rs | 108 ++++++++ crates/horizon-world/src/registry_fluid.rs | 59 +++++ docs/collision-geometry.md | 20 ++ .../parity/VanillaEntityFluidOracle.java | 10 +- .../VanillaRegisteredEntityFluidOracle.java | 13 + tools/test_registered_entity_fluid_parity.py | 78 ++++++ 9 files changed, 1007 insertions(+), 4 deletions(-) create mode 100644 benchmarks/rust-registered-entity-fluid-2026-10-07/immersion-regression.json create mode 100644 benchmarks/rust-registered-entity-fluid-2026-10-07/scoped-parity.json create mode 100644 benchmarks/rust-registered-entity-fluid-2026-10-07/tick-regression.json create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegisteredEntityFluidOracle.java create mode 100644 tools/test_registered_entity_fluid_parity.py diff --git a/benchmarks/rust-registered-entity-fluid-2026-10-07/immersion-regression.json b/benchmarks/rust-registered-entity-fluid-2026-10-07/immersion-regression.json new file mode 100644 index 000000000..ae733fd44 --- /dev/null +++ b/benchmarks/rust-registered-entity-fluid-2026-10-07/immersion-regression.json @@ -0,0 +1,236 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 7646, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityFluidOracle.java": "bf1b035389a37c9c6efcf6f30701b54b2377c1229604ea439aaf5a70afc66a0c", + "tools/test_entity_fluid_parity.py": "34d563a48f30434258cc8f836457f396ee4f1b2973a80b112bda22be1dc90bb8", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "fd004f993c35707caf1e0f7cdba87f7b615a7c16d2e0bf4b59f952d07488caa7", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/entity_fluid_fixture.rs": "9bdaccd55f57079fd7dd9ab6b9fd81ae737cb5f05642817869acd71a04fdc5bd" + }, + "fixtures_sha256": { + ".local/rust-entity-fluid-parity/inputs.txt": "e9eb2297d21b93c9c25046f240984508fa3593d14833e4f5592a623b8ed85838" + }, + "rust_output_sha256": "a675c1a446e77894680508b5160f2b8ce656ace279ad80352a122fd517efa699", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "a675c1a446e77894680508b5160f2b8ce656ace279ad80352a122fd517efa699", + "matched_output_lines": 607338 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "a675c1a446e77894680508b5160f2b8ce656ace279ad80352a122fd517efa699", + "matched_output_lines": 607338 + } + ], + "scope": "Actual EntityFluidInteraction update, tracker pruning, body/eye depth, loaded-chunk preflight, overlapping/reloaded tags, ordered current accumulation and native Entity.addDeltaMovement. Controlled fluid height/flow and camera-support cells, real ProtoChunk section fluid flags, player versus nonplayer classes, callback mutations and injected failures. Live fluid flow/propagation and full entity/world integration remain pending." +} diff --git a/benchmarks/rust-registered-entity-fluid-2026-10-07/scoped-parity.json b/benchmarks/rust-registered-entity-fluid-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..0c226bfd3 --- /dev/null +++ b/benchmarks/rust-registered-entity-fluid-2026-10-07/scoped-parity.json @@ -0,0 +1,250 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 78902, + "registry_states": 35723, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegisteredEntityFluidOracle.java": "8ff418de400a73d369a351a49c7f8a6b7cfeb2fd678aae7d15b38cacb1f80b63", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityFluidOracle.java": "bf1b035389a37c9c6efcf6f30701b54b2377c1229604ea439aaf5a70afc66a0c", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegistryFluidOracle.java": "7d8a721941e1ca04c089fcae3dc0fbd44aeee6f91454993114afdb45379fae6c", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaHeightmapOracle.java": "145c943637ed177cc4ef8a85f2484da8afd164868e84a8463882feec1653a860", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSupportOracle.java": "04350901a2d708fb8fa672de61d058f73f332d2e90df1b93a67781862f89c1ad", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java": "f2b4f440a5bbce4224a4b3cee494b0f7ddcafbf72db12592c94ef9fb94fbc8a6", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java": "5c217a8cb72094020082bd4846ed675a6399b9fa371be95a221bd92d227b2e09", + "tools/test_registered_entity_fluid_parity.py": "671763d2c5f1ebe7905654b162b34999bc22e37ffe6acf3200115d777a4a90ab", + "tools/test_entity_fluid_parity.py": "34d563a48f30434258cc8f836457f396ee4f1b2973a80b112bda22be1dc90bb8", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/test_worldgen_parity.py": "b40972ab2ad222aa6d77537cc36b434a217baa1f1b56bbaad945d6e12fe776af", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-world/examples/entity_fluid_fixture.rs": "9bdaccd55f57079fd7dd9ab6b9fd81ae737cb5f05642817869acd71a04fdc5bd", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "fd004f993c35707caf1e0f7cdba87f7b615a7c16d2e0bf4b59f952d07488caa7", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f" + }, + "fixtures_sha256": { + ".local/rust-registered-entity-fluid-parity/inputs.txt": "f7417739296dc2890ac7fbad2ed8efc3ad4f8d6d732224937b13714494a66651", + ".local/rust-registered-entity-fluid-parity/facts.json": "5e89a805514cabfe46e082d651db406b9479781e1d97b65faa2ab9f6f871309b", + ".local/rust-registered-entity-fluid-parity/fluid-info.json": "ec4cae850110a5cdd520374f38f0c6db505bb8310b76017b623ec514db4dc002", + ".local/rust-registered-entity-fluid-parity/block-registry.nbt": "5042073c80753f9548cb8fdb5b1000f0e5a1220127a0cc3c6a75737e180bf9bb", + ".local/rust-registered-entity-fluid-parity/cached-support.nbt": "8d16793118cac5b7f6fe8532b8eee98d620641f825d6745b7cecc6de90c33664", + ".local/rust-registered-entity-fluid-parity/tags.json": "5e1301e5a9abf7e4de93af5dae3a157e852dbdb4ea345c2eb626305a605d4f98" + }, + "rust_output_sha256": "27d9674ad2adbcac96f4b55a781a347e8f3df1557e77b9d71314282f53399692", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "27d9674ad2adbcac96f4b55a781a347e8f3df1557e77b9d71314282f53399692", + "matched_output_lines": 6550126 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "27d9674ad2adbcac96f4b55a781a347e8f3df1557e77b9d71314282f53399692", + "matched_output_lines": 6550126 + } + ], + "scope": "Actual EntityFluidInteraction update and current application with registered contained fluids, native height/camera/current calculations and cached/dynamic block support. All registered states in immersed cells and above-eye support cells; mixed water/lava grids, ordered/reloaded tags, retained trackers, current velocities, callback mutations and failures. Chunk presence/section wet flags and cell storage are controlled; block entities are absent. Live chunk/entity lifecycle, fluid propagation and complete playable gameplay remain pending." +} diff --git a/benchmarks/rust-registered-entity-fluid-2026-10-07/tick-regression.json b/benchmarks/rust-registered-entity-fluid-2026-10-07/tick-regression.json new file mode 100644 index 000000000..fd5ea966c --- /dev/null +++ b/benchmarks/rust-registered-entity-fluid-2026-10-07/tick-regression.json @@ -0,0 +1,237 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 17346, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityFluidOracle.java": "bf1b035389a37c9c6efcf6f30701b54b2377c1229604ea439aaf5a70afc66a0c", + "tools/test_entity_fluid_tick_parity.py": "1417d2fabe648d97ae79f0682d2be26701039fcdc888e36a3c31af139643c142", + "tools/test_entity_fluid_parity.py": "34d563a48f30434258cc8f836457f396ee4f1b2973a80b112bda22be1dc90bb8", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "fd004f993c35707caf1e0f7cdba87f7b615a7c16d2e0bf4b59f952d07488caa7", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/entity_fluid_fixture.rs": "9bdaccd55f57079fd7dd9ab6b9fd81ae737cb5f05642817869acd71a04fdc5bd" + }, + "fixtures_sha256": { + ".local/rust-entity-fluid-tick-parity/inputs.txt": "0d587117237b039d0606d563a75ee23be3099612345dc893b398275d911c0349" + }, + "rust_output_sha256": "f38ab02725a0187c58fceeddb51751b0c2a91f678def80e8b4384aabe91e1ee9", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "f38ab02725a0187c58fceeddb51751b0c2a91f678def80e8b4384aabe91e1ee9", + "matched_output_lines": 953830 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "f38ab02725a0187c58fceeddb51751b0c2a91f678def80e8b4384aabe91e1ee9", + "matched_output_lines": 953830 + } + ], + "scope": "Actual Entity.updateFluidInteraction composing EntityFluidInteraction update and current application. Compares both push predicate calls, water-entry fall reset and splash dispatch, retained touching-water state, first tick, water/lava current coefficients and FAST_LAVA dimension attribute selection. Includes ordered/reloaded tags, controlled cell heights/flows, player/nonplayer classes, mutations and failures before/after partial writes. Splash audio/particles and full live world/entity gameplay binding remain pending." +} diff --git a/crates/horizon-world/examples/entity_fluid_fixture.rs b/crates/horizon-world/examples/entity_fluid_fixture.rs index d40f73bd1..1178c63bf 100644 --- a/crates/horizon-world/examples/entity_fluid_fixture.rs +++ b/crates/horizon-world/examples/entity_fluid_fixture.rs @@ -3,12 +3,18 @@ use horizon_core::{ position::BlockPos, }; use horizon_world::{ + block_support::BlockSupportRegistry, + dynamic_support::DynamicSupportWorld, entity_fluid::*, entity_fluid_tick::{self, EntityFluidTickWorld}, fluid::{FluidKind, FluidState}, + nbt::{self, Limits}, + registry::{BlockRegistry, BlockStateId}, + registry_fluid::{FluidBlockWorld, FluidEntityWorld, FluidRegistry, RegistryFluidWorld}, }; use serde_json::Value; use std::{ + collections::BTreeSet, fs, io::{self, Write}, path::Path, @@ -156,6 +162,54 @@ impl FluidInteractionWorld for World<'_> { Ok(vector(&self.cell(p)["flow"])) } } +impl DynamicSupportWorld for World<'_> { + type Error = io::Error; + fn shulker_is_closed(&mut self, p: [i32; 3]) -> io::Result> { + self.query(format!("entity {} {} {}", p[0], p[1], p[2]))?; + Ok(None) + } + fn moving_piston_shape( + &mut self, + p: [i32; 3], + ) -> io::Result> { + self.query(format!("entity {} {} {}", p[0], p[1], p[2]))?; + Ok(None) + } +} +impl FluidBlockWorld for World<'_> { + fn block_state(&mut self, p: BlockPos) -> io::Result { + self.query(format!("block {}", pos(p)))?; + Ok(BlockStateId(self.cell(p)["state"].as_u64().unwrap() as u32)) + } + fn fluid_block_state(&mut self, p: BlockPos) -> io::Result { + self.query(format!("fluid {}", pos(p)))?; + Ok(BlockStateId(self.cell(p)["state"].as_u64().unwrap() as u32)) + } +} +impl FluidEntityWorld for World<'_> { + type Chunk = (); + fn interaction_box(&mut self) -> io::Result> { + FluidInteractionWorld::interaction_box(self) + } + fn loaded_chunk(&mut self, x: i32, z: i32) -> io::Result> { + FluidInteractionWorld::loaded_chunk(self, x, z) + } + fn chunk_sections(&mut self, c: ()) -> io::Result> { + FluidInteractionWorld::chunk_sections(self, c) + } + fn bounding_box_min_y(&self) -> f64 { + FluidInteractionWorld::bounding_box_min_y(self) + } + fn block_x(&self) -> i32 { + FluidInteractionWorld::block_x(self) + } + fn eye_y(&mut self) -> io::Result { + FluidInteractionWorld::eye_y(self) + } + fn block_z(&self) -> i32 { + FluidInteractionWorld::block_z(self) + } +} impl CurrentTarget for World<'_> { type Error = io::Error; fn is_player_class(&self) -> bool { @@ -207,6 +261,7 @@ impl EntityFluidTickWorld for World<'_> { } fn limit_checks(template: &Value, states: [FluidState; 5]) { let mut op = template.clone(); + op["cells"] = serde_json::json!({}); op["default"]["kind"] = 2.into(); op["default"]["height"] = format!("{:08x}", 0.8f32.to_bits()).into(); op["eye"] = format!("{:016x}", 0.5f64.to_bits()).into(); @@ -268,6 +323,47 @@ fn main() -> Result<(), Box> { let arg = std::env::args().nth(1).expect("private fixture directory"); let dir = Path::new(&arg); let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + let load = |n: &str| -> Result<_, Box> { + Ok(nbt::read_named(&fs::read(dir.join(n))?, Limits::default())? + .0 + .tag) + }; + let registry = if dir.join("block-registry.nbt").exists() { + Some(BlockRegistry::from_nbt(&load("block-registry.nbt")?)?) + } else { + None + }; + let support = registry + .as_ref() + .map(|r| { + Ok::<_, Box>(BlockSupportRegistry::from_nbt( + &load("cached-support.nbt")?, + r, + )?) + }) + .transpose()?; + let bindings = registry + .as_ref() + .map(|r| -> Result<_, Box> { + let info: Value = serde_json::from_slice(&fs::read(dir.join("fluid-info.json"))?)?; + let names = |v: &Value| -> BTreeSet { + v.as_array() + .unwrap() + .iter() + .map(|v| v.as_str().unwrap().to_owned()) + .collect() + }; + let ice = names(&info["ice"]); + let all = (0..r.len()) + .map(|i| r.state(BlockStateId(i as u32)).unwrap().name.clone()) + .collect(); + Ok([ + FluidRegistry::new(r, &names(&info["blocks_flow"]), &ice)?, + FluidRegistry::new(r, &BTreeSet::new(), &ice)?, + FluidRegistry::new(r, &all, &ice)?, + ]) + }) + .transpose()?; let states = FluidKind::ALL .map(|k| FluidState::from_json(&format!("{{\"id\":\"{}\"}}", k.name())).unwrap()); let input = fs::read_to_string(dir.join("inputs.txt"))?; @@ -317,6 +413,18 @@ fn main() -> Result<(), Box> { Ok(v) => writeln!(w.out, "result {v}")?, Err(_) => writeln!(w.out, "error")?, } + } else if op["mode"].as_str().unwrap() == "registered" { + let binding = + &bindings.as_ref().unwrap()[op["block_tag"].as_u64().unwrap() as usize]; + let result = interaction.update( + &mut RegistryFluidWorld::new(binding, support.as_ref().unwrap(), &mut w)?, + op["ignore"].as_bool().unwrap(), + 1_000_000, + ); + match result { + Ok(v) => writeln!(w.out, "result {v}")?, + Err(_) => writeln!(w.out, "error")?, + } } else if op["mode"].as_str().unwrap() == "update" { match interaction.update(&mut w, op["ignore"].as_bool().unwrap(), 1_000_000) { Ok(v) => writeln!(w.out, "result {v}")?, diff --git a/crates/horizon-world/src/registry_fluid.rs b/crates/horizon-world/src/registry_fluid.rs index 329229e18..eb0f4ffe0 100644 --- a/crates/horizon-world/src/registry_fluid.rs +++ b/crates/horizon-world/src/registry_fluid.rs @@ -151,3 +151,62 @@ impl FluidHeightWorld for RegistryFluidWorld<'_, '_, W> { self.is_face_sturdy(s, p, Direction::Down) } } + +use crate::entity_fluid::{FluidInteractionWorld, FluidMembership, FluidSections, FluidTagId}; +use horizon_core::geometry::{Aabb, Vec3}; +/// Entity fields and loaded chunk views needed by the registered immersion scan. +/// Cell height/current behavior comes from this module's registry/support binding. +pub trait FluidEntityWorld: FluidBlockWorld + FluidMembership { + type Chunk: Copy; + fn interaction_box(&mut self) -> Result, Self::Error>; + fn loaded_chunk(&mut self, x: i32, z: i32) -> Result, Self::Error>; + fn chunk_sections(&mut self, chunk: Self::Chunk) -> Result, Self::Error>; + fn bounding_box_min_y(&self) -> f64; + fn block_x(&self) -> i32; + fn eye_y(&mut self) -> Result; + fn block_z(&self) -> i32; +} +impl FluidMembership for RegistryFluidWorld<'_, '_, W> { + fn fluid_in_tag(&self, fluid: crate::fluid::FluidKind, tag: FluidTagId) -> bool { + self.world.fluid_in_tag(fluid, tag) + } +} +impl FluidInteractionWorld for RegistryFluidWorld<'_, '_, W> { + type Error = FluidQueryError; + type Chunk = W::Chunk; + fn interaction_box(&mut self) -> Result, Self::Error> { + self.world.interaction_box().map_err(FluidQueryError::World) + } + fn loaded_chunk(&mut self, x: i32, z: i32) -> Result, Self::Error> { + self.world + .loaded_chunk(x, z) + .map_err(FluidQueryError::World) + } + fn chunk_sections(&mut self, c: Self::Chunk) -> Result, Self::Error> { + self.world.chunk_sections(c).map_err(FluidQueryError::World) + } + fn bounding_box_min_y(&self) -> f64 { + self.world.bounding_box_min_y() + } + fn block_x(&self) -> i32 { + self.world.block_x() + } + fn eye_y(&mut self) -> Result { + self.world.eye_y().map_err(FluidQueryError::World) + } + fn block_z(&self) -> i32 { + self.world.block_z() + } + fn fluid_state(&mut self, p: BlockPos) -> Result { + FluidFlowWorld::fluid(self, p) + } + fn fluid_height(&mut self, s: FluidState, p: BlockPos) -> Result { + s.height_at(self, [p.x, p.y, p.z]) + } + fn camera_height(&mut self, s: FluidState, p: BlockPos) -> Result { + s.camera_height_at(self, [p.x, p.y, p.z]) + } + fn flow(&mut self, s: FluidState, p: BlockPos) -> Result { + crate::fluid_flow::flow_at(self, s, p) + } +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 03891dd2d..31c56f9b3 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1029,3 +1029,23 @@ arithmetic, callback mutations and failures around partial writes. The also passes **607,338 lines per JAR** after extending the shared fixtures. Targeted Clippy passes. Splash dispatch is controlled; audio/particle generation, full live entity/world binding and playable integration remain pending. + + +`RegistryFluidWorld` now implements entity immersion queries through the bound +fluid contents, height calculations, camera support and neighbor-derived current +vectors. Entity fields and loaded chunk/section views remain supplied by the +world provider, preserving captured positions and partial-write order. + +`python3 tools/test_registered_entity_fluid_parity.py` invokes actual +`EntityFluidInteraction` with registered fluid and support behavior. The +[registered immersion report](../benchmarks/rust-registered-entity-fluid-2026-10-07/scoped-parity.json) +records **6,550,126 matching lines per JAR**, including all **35,723 states** in +immersed and above-eye cells, mixed water/lava neighborhoods, waterlogged blocks, +ordered/reloaded tags, current velocities, tracker retention and query failures. +Targeted Clippy passes. Shared-fixture regressions also pass: +[tick composition](../benchmarks/rust-registered-entity-fluid-2026-10-07/tick-regression.json) +(**953,830 lines per JAR**) and +[controlled immersion](../benchmarks/rust-registered-entity-fluid-2026-10-07/immersion-regression.json) +(**607,338 lines per JAR**). Chunk presence and section wet flags are controlled, +and block entities are absent here; full live chunk/entity lifecycle, fluid +propagation and playable gameplay remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityFluidOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityFluidOracle.java index 117e08cb9..10e24407e 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityFluidOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityFluidOracle.java @@ -6,6 +6,7 @@ import net.minecraft.world.entity.*;import net.minecraft.world.level.*;import ne /** Actual entity immersion/current state machine with controlled cell providers and real chunk sections. */ public final class VanillaEntityFluidOracle { static final class Stop extends RuntimeException {} + static java.util.function.Consumer setup; static Object unsafe;static Method allocate;static Field blockPosition,level,touch,first,interactionField; static net.minecraft.world.level.material.Fluid[] KINDS; static T make(Class c){try{return c.cast(allocate.invoke(unsafe,c));}catch(Exception e){throw new AssertionError(e);}} @@ -40,8 +41,9 @@ public final class VanillaEntityFluidOracle { static final class World extends net.minecraft.server.level.ServerLevel {Data d;World(){super(null,null,null,null,null,null,false,0L,List.of(),false);} @Override public net.minecraft.world.attribute.EnvironmentAttributeSystem environmentAttributes(){d.query("fast-lava");return net.minecraft.world.attribute.EnvironmentAttributeSystem.builder().addConstantLayer(net.minecraft.world.attribute.EnvironmentAttributes.FAST_LAVA,previous->d.op.get("fast_lava").getAsBoolean()).build();} @Override public ChunkAccess getChunk(int x,int z,ChunkStatus status,boolean create){if(status!=ChunkStatus.FULL||create)throw new AssertionError();d.query("chunk "+x+" "+z);return d.op.getAsJsonArray("missing").contains(new JsonPrimitive(x+" "+z))?null:d.chunk;} - @Override public FluidState getFluidState(BlockPos p){d.query("fluid "+pos(p));return d.states[d.cell(p).get("kind").getAsInt()];} - @Override public BlockState getBlockState(BlockPos p){d.query("block "+pos(p));return(d.op.get("sturdy").getAsBoolean()?Blocks.STONE:Blocks.AIR).defaultBlockState();} + @Override public FluidState getFluidState(BlockPos p){d.query("fluid "+pos(p));return d.op.get("mode").getAsString().equals("registered")?Block.stateById(d.cell(p).get("state").getAsInt()).getFluidState():d.states[d.cell(p).get("kind").getAsInt()];} + @Override public net.minecraft.world.level.block.entity.BlockEntity getBlockEntity(BlockPos p){d.query("entity "+pos(p));return null;} + @Override public BlockState getBlockState(BlockPos p){d.query("block "+pos(p));return d.op.get("mode").getAsString().equals("registered")?Block.stateById(d.cell(p).get("state").getAsInt()):(d.op.get("sturdy").getAsBoolean()?Blocks.STONE:Blocks.AIR).defaultBlockState();} } static final class Actor extends Marker {Data d;Actor(){super(null,null);} @Override public boolean isPushedByFluid(){return d.pushed();} @@ -66,10 +68,10 @@ public final class VanillaEntityFluidOracle { Path dir=Path.of(args[1]);try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();var ordered=new LinkedHashSet>();for(var t:f.getAsJsonArray("order"))ordered.add(tags.get(t.getAsInt()));var interaction=new EntityFluidInteraction(ordered); var d=new Data();d.out=out;d.states=new FluidState[5];for(int i=0;i<5;i++){var fluid=make(Fluid.class);fluid.d=d;fluid.kind=i;d.states[i]=new FluidState(fluid,new net.minecraft.world.level.block.state.properties.Property[0],new Comparable[0]);}var w=make(World.class);w.d=d; if(f.get("player").getAsBoolean()){var e=make(Human.class);e.d=d;d.entity=e;}else{var e=make(Actor.class);e.d=d;d.entity=e;}level.set(d.entity,w);interactionField.set(d.entity,interaction);if(f.has("tick_initial")){var initial=f.getAsJsonObject("tick_initial");touch.setBoolean(d.entity,initial.get("touch").getAsBoolean());first.setBoolean(d.entity,initial.get("first").getAsBoolean());d.entity.fallDistance=number(initial.get("fall"));} - for(var value:f.getAsJsonArray("ops")){d.op=value.getAsJsonObject();var op=d.op;d.calls=0;d.pushed=0;d.velocity=vec(op.get("velocity"));blockPosition.set(d.entity,position(op.get("block")));d.entity.setBoundingBox(new AABB(0,number(op.get("base_y")),0,1,number(op.get("base_y"))+1,1)); + for(var value:f.getAsJsonArray("ops")){d.op=value.getAsJsonObject();var op=d.op;if(setup!=null)setup.accept(op);d.calls=0;d.pushed=0;d.velocity=vec(op.get("velocity"));blockPosition.set(d.entity,position(op.get("block")));d.entity.setBoundingBox(new AABB(0,number(op.get("base_y")),0,1,number(op.get("base_y"))+1,1)); var bindings=new HashMap,List>>();for(int t=0;t<4;t++){var members=new ArrayList>();int mask=op.getAsJsonArray("tags").get(t).getAsInt();for(int k=0;k<5;k++)if((mask&(1<(Registries.FLUID,bindings)).apply(); var wet=op.getAsJsonArray("wet");d.chunk=new Chunk(d,factory,op.get("min_section").getAsInt()*16,wet.size()*16);for(int i=0;i)trackers.get(interaction);out.println("trackers "+list.size());for(var t:list){Object holder=kind.get(t);int k=-1;for(int i=0;i<5;i++)if(KINDS[i].builtInRegistryHolder()==holder)k=i;out.printf("tracker %d %016x %s%n",k,Double.doubleToLongBits(height.getDouble(t)),eyes.getBoolean(t));} var map=(Map)currents.get(interaction);for(var tag:ordered){var c=map.get(tag);out.printf("current %d %016x %s %d%n",tags.indexOf(tag),Double.doubleToLongBits(depth.getDouble(c)),vector((Vec3)accumulated.get(c)),count.getInt(c));} for(int t=0;t<4;t++)out.printf("tag %d %016x %s %s%n",t,Double.doubleToLongBits(interaction.getFluidHeight(tags.get(t))),interaction.isInFluid(tags.get(t)),interaction.isEyeInFluid(tags.get(t))); diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegisteredEntityFluidOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegisteredEntityFluidOracle.java new file mode 100644 index 000000000..e27b14767 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegisteredEntityFluidOracle.java @@ -0,0 +1,13 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.*;import net.minecraft.core.registries.*;import net.minecraft.tags.*;import net.minecraft.world.level.block.*; +/** Run actual entity immersion with registered fluid heights, flows and support. */ +public final class VanillaRegisteredEntityFluidOracle { + public static void main(String[] args)throws Exception { + if(args[0].equals("export")){VanillaRegistryFluidOracle.main(args);return;} + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();Path dir=Path.of(args[1]);VanillaHeightmapOracle.bindTags(JsonParser.parseString(Files.readString(dir.resolve("tags.json"))).getAsJsonObject()); + var natural=new ArrayList>();var all=new ArrayList>();for(var block:BuiltInRegistries.BLOCK){all.add(block.builtInRegistryHolder());if(block.defaultBlockState().is(BlockTags.BLOCKS_FLUID_FLOW))natural.add(block.builtInRegistryHolder());} + int[] old={-1};VanillaEntityFluidOracle.setup=op->{int tag=op.get("block_tag").getAsInt();if(old[0]!=tag){BuiltInRegistries.BLOCK.prepareTagReload(new TagLoader.LoadResult<>(Registries.BLOCK,Map.of(BlockTags.BLOCKS_FLUID_FLOW,tag==0?natural:tag==1?List.>of():all))).apply();old[0]=tag;}}; + VanillaEntityFluidOracle.main(args); + } +} diff --git a/tools/test_registered_entity_fluid_parity.py b/tools/test_registered_entity_fluid_parity.py new file mode 100644 index 000000000..5b54d8da6 --- /dev/null +++ b/tools/test_registered_entity_fluid_parity.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python3 +"""Compare registered entity immersion, support and current composition.""" +import itertools +import json +import os +from pathlib import Path +import platform +import random +import struct +import subprocess +import zipfile +try: + from . import lab, test_rust_parity as base, test_worldgen_parity as worldgen +except ImportError: + import lab + import test_rust_parity as base + import test_worldgen_parity as worldgen + + +try: + from . import test_entity_fluid_parity as immersion +except ImportError: + import test_entity_fluid_parity as immersion + +def corpus(info): + import copy + seed=next(immersion.corpus())['ops'][0] + defaults=info['defaults'];states=info['states'];air=defaults['minecraft:air'];water=defaults['minecraft:water'];lava=defaults['minecraft:lava'];stone=defaults['minecraft:stone'] + def bits(v):return struct.pack('>d',float(v)).hex() + def cell(state):return dict(seed['default'],state=state) + def op(**kw): + v=copy.deepcopy(seed);v.update(mode='registered',default=cell(air),cells={},eye=bits(.9),block_tag=0);v.update(kw);return v + def row(ops,player=False,order=(0,1,2)):return dict(ops=ops,player=player,order=order) + for state in range(len(states)): + for cells in [{'0 0 0':cell(state)},{'0 0 0':cell(water),'0 1 0':cell(state)}]: + yield row([op(cells=cells),op(mode='apply',tag=0),op(mode='apply',tag=1),op(bounds=None),op(bounds=None)]) + special=[defaults['minecraft:'+n] for n in ['air','stone','water','lava','ice','frosted_ice','blue_ice','packed_ice','shulker_box','moving_piston','scaffolding','bamboo','oak_slab','powder_snow','pointed_dripstone']] + liquids=[i for i,s in enumerate(states) if s['id'] in ['minecraft:water','minecraft:lava']] + rng=random.Random(0x454e54524547464c) + for _ in range(4000): + ops=[] + for i in range(rng.randrange(1,5)): + cells={f'{x} {y} {z}':cell(rng.choice(special+liquids)) for x in range(-1,3) for y in range(-1,3) for z in range(-1,3)} + ops.append(op(bounds=[bits(v) for v in [0,0,0,2,2,2]],cells=cells,base_y=bits(rng.choice([-.1,0,.1,.4,1])),eye=bits(rng.choice([0,.1,.4,8/9,1,1.5,2])),block_tag=rng.randrange(3),tags=[rng.randrange(32) for _ in range(4)],ignore=bool(rng.randrange(2)),fail=rng.choice([-1,-1,*range(50)]),mutate_at=rng.choice([-1,-1,*range(35)]))) + ops.extend([op(mode='apply',tag=0),op(mode='apply',tag=1)]) + yield row(ops,bool(rng.randrange(2)),rng.sample(range(4),rng.randrange(5))) + for root in liquids: + for fail in range(-1,35): + for sturdy in [air,stone,defaults['minecraft:shulker_box']]: + yield row([op(cells={'0 0 0':cell(root),'0 1 0':cell(sturdy),'1 -1 0':cell(root)},fail=fail),op(mode='apply',tag=0),op(mode='apply',tag=1)]) + + +def main(): + lock,jars,libraries=base.verify_artifacts();build=lab.LOCAL/'rust-registered-entity-fluid-parity';build.mkdir(exist_ok=True);report_path=build/'report.json';report_path.unlink(missing_ok=True) + root=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity';oracles=[root/(n+'.java') for n in ['VanillaRegisteredEntityFluidOracle','VanillaEntityFluidOracle','VanillaRegistryFluidOracle','VanillaHeightmapOracle','VanillaBlockSupportOracle','VanillaCollisionOracle','VanillaBlockStateCodecOracle']] + sources=[*oracles,Path(__file__),lab.ROOT/'tools/test_entity_fluid_parity.py',lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/test_worldgen_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-world/examples/entity_fluid_fixture.rs'] + for crate in ['horizon-core','horizon-world']:sources += [lab.ROOT/'crates'/crate/'Cargo.toml',*sorted((lab.ROOT/'crates'/crate/'src').rglob('*.rs'))] + tested=base.source_hashes(sources);tags=worldgen.tag_resources(jars['server']) + if tags!=worldgen.tag_resources(jars['client']):raise AssertionError('Native tags differ between artifacts') + lab.write_json(build/'tags.json',tags);classes=build/'classes';classes.mkdir(exist_ok=True);dependencies=os.pathsep.join(map(str,libraries)) + def run(command,name): + with (build/(name+'.log')).open('w') as log:subprocess.run(list(map(str,command)),cwd=lab.ROOT,check=True,timeout=3600,stdout=log,stderr=subprocess.STDOUT) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependencies,'-d',classes,*oracles],'compile-java') + def java(side,mode):run(['java','-Xmx768M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependencies]),'dev.horizonlab.parity.VanillaRegisteredEntityFluidOracle',mode,build],side+'-'+mode) + java('server','export');info=json.loads((build/'facts.json').read_text());count=0 + if len(info['states'])!=35723:raise AssertionError('Incomplete pinned registry') + with (build/'inputs.txt').open('w') as output: + for f in corpus(info):output.write(json.dumps(f,separators=(',',':'))+'\n');count+=1 + fixture_paths=[build/n for n in ['inputs.txt','facts.json','fluid-info.json','block-registry.nbt','cached-support.nbt','tags.json']];fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--locked','--release','-p','horizon-world','--example','entity_fluid_fixture'],'compile-rust');metadata=json.loads(subprocess.check_output(['cargo','metadata','--locked','--no-deps','--format-version','1'],cwd=lab.ROOT));binary=Path(metadata['target_directory'])/'release/examples'/('entity_fluid_fixture.exe' if os.name=='nt' else 'entity_fluid_fixture');run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side);matched=base.compare(build/(side+'.txt'),build/'rust.txt');references.append(dict(side=side,jar_sha256=lab.digest(jar,'sha256'),output_sha256=lab.digest(build/(side+'.txt'),'sha256'),matched_output_lines=matched));print(f'{side}: {matched:,} registered entity fluid output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested);base.ensure_sources_unchanged(fixture_paths,fixtures) + report=dict(schema=1,minecraft=lock['minecraft']['version'],manifest_sha1=lock['minecraft']['manifest_sha1'],platform=platform.platform(),java=subprocess.check_output(['java','--version'],text=True).splitlines()[0],rustc=subprocess.check_output(['rustc','--version'],text=True).strip(),fixtures=count,registry_states=len(info['states']),sources_sha256=tested,fixtures_sha256=fixtures,rust_output_sha256=lab.digest(build/'rust.txt','sha256'),references=references,scope='Actual EntityFluidInteraction update and current application with registered contained fluids, native height/camera/current calculations and cached/dynamic block support. All registered states in immersed cells and above-eye support cells; mixed water/lava grids, ordered/reloaded tags, retained trackers, current velocities, callback mutations and failures. Chunk presence/section wet flags and cell storage are controlled; block entities are absent. Live chunk/entity lifecycle, fluid propagation and complete playable gameplay remain pending.') + lab.write_json(report_path,report);print(f'Scoped registered entity fluid parity passed: {report_path}',flush=True) + + +if __name__=='__main__':main() From d5eb9f9cfeb808fdd711924a6f93bc35cd3e1113 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 03:37:38 +0200 Subject: [PATCH 100/253] Implement vanilla entity and player swimming transitions --- .../scoped-parity.json | 237 ++++++++++++++++++ .../examples/swimming_fixture.rs | 128 ++++++++++ crates/horizon-world/src/lib.rs | 1 + crates/horizon-world/src/swimming.rs | 50 ++++ docs/collision-geometry.md | 14 ++ .../parity/VanillaSwimmingOracle.java | 37 +++ tools/test_swimming_parity.py | 67 +++++ 7 files changed, 534 insertions(+) create mode 100644 benchmarks/rust-swimming-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/swimming_fixture.rs create mode 100644 crates/horizon-world/src/swimming.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSwimmingOracle.java create mode 100644 tools/test_swimming_parity.py diff --git a/benchmarks/rust-swimming-2026-10-07/scoped-parity.json b/benchmarks/rust-swimming-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..41f9115b0 --- /dev/null +++ b/benchmarks/rust-swimming-2026-10-07/scoped-parity.json @@ -0,0 +1,237 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 39874, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSwimmingOracle.java": "b603f9bb1e69590eb3260c404ed1fc80824efe6b5dfb5e1b954f99bea3356684", + "tools/test_swimming_parity.py": "d0eed88c27baee145c01f0785335c39581257788a2530f8cdf0e7cce33e7340c", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "57b6efae4826d164e4b37849e10615e87e4c8bb01effd8908b9914903506cf94", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/swimming_fixture.rs": "204b8500c592076ec9be9cf73f339bf04a36e253f59b3bee5f682a1aafeeabfb" + }, + "fixtures_sha256": { + ".local/rust-swimming-parity/inputs.txt": "bacfe81a0553ed652dd45bf2174a387313562520a9117c4904e63e303bf9933c" + }, + "rust_output_sha256": "0f3103043c5ea94e65c7f118d15df146891dcd60cbf4a2dd632e01894b1992b2", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "0f3103043c5ea94e65c7f118d15df146891dcd60cbf4a2dd632e01894b1992b2", + "matched_output_lines": 191142 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "0f3103043c5ea94e65c7f118d15df146891dcd60cbf4a2dd632e01894b1992b2", + "matched_output_lines": 191142 + } + ], + "scope": "Actual Entity and Player updateSwimming, isUnderWater, isInShallowWater and fluid jump threshold. Compares previous-eye/body flags, player direct flying ability guard, sprint/passenger branches, direct block-position capture, native fluid tag membership, callbacks mutating fields and injected failures. Entity data and cell fluids are controlled; full synchronized entity storage, boat interaction boxes and playable gameplay remain pending." +} diff --git a/crates/horizon-world/examples/swimming_fixture.rs b/crates/horizon-world/examples/swimming_fixture.rs new file mode 100644 index 000000000..ebf58cf8b --- /dev/null +++ b/crates/horizon-world/examples/swimming_fixture.rs @@ -0,0 +1,128 @@ +use horizon_core::position::BlockPos; +use horizon_world::swimming::{self, PlayerSwimmingWorld, SwimmingWorld}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +struct World<'a> { + f: &'a Value, + out: &'a mut dyn Write, + calls: i64, + swimming: bool, + water: bool, + sprint: bool, + passenger: bool, + eye: bool, + position: BlockPos, +} +impl World<'_> { + fn query(&mut self, s: String) -> io::Result<()> { + writeln!(self.out, "{s}")?; + let n = self.calls; + self.calls += 1; + if n == self.f["fail"].as_i64().unwrap() { + return Err(io::Error::other("injected swimming failure")); + } + if n == self.f["mutate_at"].as_i64().unwrap() { + self.swimming = !self.swimming; + self.water = !self.water; + self.sprint = !self.sprint; + self.passenger = !self.passenger; + self.eye = !self.eye; + self.position = BlockPos::new(31, 32, 33); + } + Ok(()) + } +} +impl SwimmingWorld for World<'_> { + type Error = io::Error; + fn is_swimming(&mut self) -> io::Result { + self.query("swimming".into())?; + Ok(self.swimming) + } + fn is_sprinting(&mut self) -> io::Result { + self.query("sprint".into())?; + Ok(self.sprint) + } + fn is_in_water(&mut self) -> io::Result { + self.query("water".into())?; + Ok(self.water) + } + fn is_under_water(&mut self) -> io::Result { + self.query("under".into())?; + swimming::under_water(self) + } + fn is_passenger(&mut self) -> io::Result { + self.query("passenger".into())?; + Ok(self.passenger) + } + fn was_eye_in_water(&self) -> bool { + self.eye + } + fn block_position(&self) -> BlockPos { + self.position + } + fn water_at(&mut self, p: BlockPos) -> io::Result { + self.query(format!("fluid {} {} {}", p.x, p.y, p.z))?; + Ok(self.f["water_mask"].as_u64().unwrap() & (1 << self.f["fluid"].as_u64().unwrap()) != 0) + } + fn set_swimming(&mut self, v: bool) -> io::Result<()> { + self.query(format!("set {v}"))?; + self.swimming = v; + Ok(()) + } +} +impl PlayerSwimmingWorld for World<'_> { + fn flying_ability(&self) -> bool { + self.f["flying"].as_bool().unwrap() + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut w = World { + f: &f, + out: &mut out, + calls: 0, + swimming: f["swimming"].as_bool().unwrap(), + water: f["water"].as_bool().unwrap(), + sprint: f["sprint"].as_bool().unwrap(), + passenger: f["passenger"].as_bool().unwrap(), + eye: f["eye"].as_bool().unwrap(), + position: BlockPos::new(17, -64, -33), + }; + let player = f["player"].as_bool().unwrap(); + let result: io::Result = match f["mode"].as_str().unwrap() { + "update" => if player { + swimming::update_player(&mut w) + } else { + swimming::update(&mut w) + } + .map(|()| "result ok".into()), + "under" => w.is_under_water().map(|v| format!("result {v}")), + "shallow" => swimming::shallow_water(&mut w).map(|v| format!("result {v}")), + "threshold" => Ok(format!( + "threshold {:016x}", + swimming::fluid_jump_threshold(f32::from_bits(u32::from_str_radix( + f["eye_height"].as_str().unwrap(), + 16 + )?)) + .to_bits() + )), + _ => panic!("fixture mode"), + }; + writeln!(w.out, "{}", result.unwrap_or_else(|_| "error".into()))?; + writeln!( + w.out, + "final {} {} {} {} {}", + w.swimming, w.eye, w.position.x, w.position.y, w.position.z + )?; + writeln!(w.out, "queries {}", w.calls)?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 2c93d58b5..e35904b5f 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -55,6 +55,7 @@ pub mod registry_fall_ray; pub mod registry_fluid; pub mod retrogen; pub mod suffocation; +pub mod swimming; pub mod tick_data; pub mod world_movement; pub mod world_ray; diff --git a/crates/horizon-world/src/swimming.rs b/crates/horizon-world/src/swimming.rs new file mode 100644 index 000000000..107ca14f0 --- /dev/null +++ b/crates/horizon-world/src/swimming.rs @@ -0,0 +1,50 @@ +//! Entity swimming state transitions and the player's flying-ability guard. +use horizon_core::position::BlockPos; +pub trait SwimmingWorld { + type Error; + fn is_swimming(&mut self) -> Result; + fn is_sprinting(&mut self) -> Result; + fn is_in_water(&mut self) -> Result; + fn is_under_water(&mut self) -> Result; + fn is_passenger(&mut self) -> Result; + fn was_eye_in_water(&self) -> bool; + /// Direct blockPosition field, captured after preceding virtual queries. + fn block_position(&self) -> BlockPos; + fn water_at(&mut self, position: BlockPos) -> Result; + fn set_swimming(&mut self, value: bool) -> Result<(), Self::Error>; +} +pub trait PlayerSwimmingWorld: SwimmingWorld { + /// Direct abilities.flying field; do not dispatch getAbilities here. + fn flying_ability(&self) -> bool; +} +pub fn under_water(world: &mut W) -> Result { + Ok(world.was_eye_in_water() && world.is_in_water()?) +} +pub fn shallow_water(world: &mut W) -> Result { + Ok(world.is_in_water()? && !world.is_under_water()?) +} +pub fn update(world: &mut W) -> Result<(), W::Error> { + let next = if world.is_swimming()? { + world.is_sprinting()? && world.is_in_water()? && !world.is_passenger()? + } else { + world.is_sprinting()? + && world.is_under_water()? + && !world.is_passenger()? + && world.water_at(world.block_position())? + }; + world.set_swimming(next) +} +pub fn update_player(world: &mut W) -> Result<(), W::Error> { + if world.flying_ability() { + world.set_swimming(false) + } else { + update(world) + } +} +pub fn fluid_jump_threshold(eye_height: f32) -> f64 { + if f64::from(eye_height) < 0.4 { + 0.0 + } else { + 0.4 + } +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 31c56f9b3..2b21d4886 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1049,3 +1049,17 @@ Targeted Clippy passes. Shared-fixture regressions also pass: (**607,338 lines per JAR**). Chunk presence and section wet flags are controlled, and block entities are absent here; full live chunk/entity lifecycle, fluid propagation and playable gameplay remain pending. + + +`swimming` implements entity/player swimming transitions, underwater/shallow-water +predicates and the fluid jump threshold. The player flying ability disables +swimming directly. Other transitions preserve short-circuit query order, prior +eye-in-water state, passenger guards, captured block position and final state +writes only after all required queries succeed. + +`python3 tools/test_swimming_parity.py` compares actual Entity/Player methods. +The [swimming report](../benchmarks/rust-swimming-2026-10-07/scoped-parity.json) +records **191,142 matching lines per JAR**, including flag combinations, native +fluid tag membership, failures/mutations, and f32 eye-height boundaries/nonfinite +values. Targeted Clippy passes. Synchronized entity storage, full input/tick +integration and playable gameplay remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSwimmingOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSwimmingOracle.java new file mode 100644 index 000000000..8ed5b5401 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSwimmingOracle.java @@ -0,0 +1,37 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.lang.reflect.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.*;import net.minecraft.core.registries.*;import net.minecraft.tags.*;import net.minecraft.world.entity.*;import net.minecraft.world.entity.player.*;import net.minecraft.world.level.*;import net.minecraft.world.level.material.*; +/** Actual Entity/Player swimming transitions and fluid status queries. */ +public final class VanillaSwimmingOracle { + static final class Stop extends RuntimeException {} + static Field eye,position,abilities,eyeHeight; + static float single(JsonElement v){return Float.intBitsToFloat(Integer.parseUnsignedInt(v.getAsString(),16));} + static String pos(BlockPos p){return p.getX()+" "+p.getY()+" "+p.getZ();} + static final class Data {JsonObject f;PrintWriter out;Entity entity;int calls;boolean swimming,water,sprint,passenger; + void query(String s){out.println(s);int n=calls++;if(n==f.get("fail").getAsInt())throw new Stop();if(n==f.get("mutate_at").getAsInt()){swimming=!swimming;water=!water;sprint=!sprint;passenger=!passenger;try{eye.setBoolean(entity,!eye.getBoolean(entity));position.set(entity,new BlockPos(31,32,33));}catch(Exception e){throw new AssertionError(e);}}} + boolean swimming(){query("swimming");return swimming;}boolean water(){query("water");return water;}boolean sprint(){query("sprint");return sprint;}boolean passenger(){query("passenger");return passenger;} + void set(boolean v){query("set "+v);swimming=v;} + } + static final class World extends net.minecraft.server.level.ServerLevel {Data d;FluidState fluid;World(){super(null,null,null,null,null,null,false,0L,List.of(),false);} + @Override public FluidState getFluidState(BlockPos p){d.query("fluid "+pos(p));return fluid;} + } + static final class Actor extends Marker {Data d;Actor(){super(null,null);} + @Override public boolean isSwimming(){return d.swimming();}@Override public boolean isInWater(){return d.water();}@Override public boolean isSprinting(){return d.sprint();}@Override public boolean isPassenger(){return d.passenger();} + @Override public boolean isUnderWater(){d.query("under");return super.isUnderWater();}@Override public void setSwimming(boolean v){d.set(v);} + } + static final class Human extends Player {Data d;Human(){super(null,null);} + @Override public GameType gameMode(){return GameType.SURVIVAL;} + @Override public boolean isSwimming(){return d.swimming();}@Override public boolean isInWater(){return d.water();}@Override public boolean isSprinting(){return d.sprint();}@Override public boolean isPassenger(){return d.passenger();} + @Override public boolean isUnderWater(){d.query("under");return super.isUnderWater();}@Override public void setSwimming(boolean v){d.set(v);} + } + static Field field(Class c,String name)throws Exception{var f=c.getDeclaredField(name);f.setAccessible(true);return f;} + public static void main(String[] args)throws Exception{ + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();var u=Class.forName("sun.misc.Unsafe");var unsafe=field(u,"theUnsafe").get(null);var allocate=u.getMethod("allocateInstance",Class.class);eye=field(Entity.class,"wasEyeInWater");position=field(Entity.class,"blockPosition");abilities=field(Player.class,"abilities");eyeHeight=field(Entity.class,"eyeHeight");var level=field(Entity.class,"level");Fluid[] fluids={Fluids.EMPTY,Fluids.FLOWING_WATER,Fluids.WATER,Fluids.FLOWING_LAVA,Fluids.LAVA};int oldMask=-1;Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();int mask=f.get("water_mask").getAsInt();if(oldMask!=mask){var members=new ArrayList>();for(int i=0;i<5;i++)if((mask&(1<(Registries.FLUID,Map.of(FluidTags.WATER,members))).apply();oldMask=mask;} + var d=new Data();d.f=f;d.out=out;d.swimming=f.get("swimming").getAsBoolean();d.water=f.get("water").getAsBoolean();d.sprint=f.get("sprint").getAsBoolean();d.passenger=f.get("passenger").getAsBoolean();if(f.get("player").getAsBoolean()){var h=(Human)allocate.invoke(unsafe,Human.class);h.d=d;var a=new Abilities();a.flying=f.get("flying").getAsBoolean();abilities.set(h,a);d.entity=h;}else{var a=(Actor)allocate.invoke(unsafe,Actor.class);a.d=d;d.entity=a;} + var w=(World)allocate.invoke(unsafe,World.class);w.d=d;w.fluid=fluids[f.get("fluid").getAsInt()].defaultFluidState();level.set(d.entity,w);position.set(d.entity,new BlockPos(17,-64,-33));eye.setBoolean(d.entity,f.get("eye").getAsBoolean());eyeHeight.setFloat(d.entity,single(f.get("eye_height"))); + try{switch(f.get("mode").getAsString()){case "update":d.entity.updateSwimming();out.println("result ok");break;case "under":out.println("result "+d.entity.isUnderWater());break;case "shallow":out.println("result "+d.entity.isInShallowWater());break;case "threshold":out.printf("threshold %016x%n",Double.doubleToLongBits(d.entity.getFluidJumpThreshold()));break;default:throw new AssertionError();}}catch(Stop e){out.println("error");} + out.println("final "+d.swimming+" "+eye.getBoolean(d.entity)+" "+pos((BlockPos)position.get(d.entity)));out.println("queries "+d.calls); + }} + } +} diff --git a/tools/test_swimming_parity.py b/tools/test_swimming_parity.py new file mode 100644 index 000000000..49366c307 --- /dev/null +++ b/tools/test_swimming_parity.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python3 +"""Compare Entity/Player swimming state transitions and water predicates with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + def row(mask=0,**kw): + f={k:bool(mask&(1<f',1.62).hex(),fail=-1,mutate_at=-1);f.update(kw);return f + for player in [False,True]: + for mask in range(64): + for mode in ['update','under','shallow']: + for fluid in range(5): + for tag in [0,6,31]:yield row(mask,player=player,mode=mode,fluid=fluid,water_mask=tag) + for mode in ['update','under','shallow']: + for fail in range(-1,8): + for mutate_at in range(-1,8):yield row(mask,player=player,mode=mode,fail=fail,mutate_at=mutate_at) + for height in [-float('inf'),-1,-0.,0.,.39999998,.4,.40000004,1,float('inf'),float('nan')]:yield row(mode='threshold',eye_height=struct.pack('>f',height).hex()) + rng=random.Random(0x5357494d) + for _ in range(3000):yield row(mode='threshold',eye_height=f'{rng.getrandbits(32):08x}') + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-swimming-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSwimmingOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/swimming_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaSwimmingOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','swimming_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('swimming_fixture.exe' if os.name=='nt' else 'swimming_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} swimming output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual Entity and Player updateSwimming, isUnderWater, isInShallowWater and fluid jump threshold. Compares previous-eye/body flags, player direct flying ability guard, sprint/passenger branches, direct block-position capture, native fluid tag membership, callbacks mutating fields and injected failures. Entity data and cell fluids are controlled; full synchronized entity storage, boat interaction boxes and playable gameplay remain pending.'} + lab.write_json(report_path,report);print(f'Scoped swimming parity passed: {report_path}') + + +if __name__=='__main__':main() From d325275225f4d977fe0193f5bc3ca710be8524ed Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 03:41:22 +0200 Subject: [PATCH 101/253] Implement entity and boat passenger fluid interaction bounds --- .../scoped-parity.json | 238 ++++++++++++++++++ .../examples/fluid_box_fixture.rs | 122 +++++++++ crates/horizon-world/src/fluid_box.rs | 54 ++++ crates/horizon-world/src/lib.rs | 1 + docs/collision-geometry.md | 14 ++ .../parity/VanillaFluidBoxOracle.java | 25 ++ tools/test_fluid_box_parity.py | 74 ++++++ 7 files changed, 528 insertions(+) create mode 100644 benchmarks/rust-fluid-box-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/fluid_box_fixture.rs create mode 100644 crates/horizon-world/src/fluid_box.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFluidBoxOracle.java create mode 100644 tools/test_fluid_box_parity.py diff --git a/benchmarks/rust-fluid-box-2026-10-07/scoped-parity.json b/benchmarks/rust-fluid-box-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..5ea4774dc --- /dev/null +++ b/benchmarks/rust-fluid-box-2026-10-07/scoped-parity.json @@ -0,0 +1,238 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 17340, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFluidBoxOracle.java": "4382758ae626c107e1c4394ca066ca002d49a30c1a5a6e2df16cb44117878ebf", + "tools/test_fluid_box_parity.py": "0d3ae41c39831cfc2952643f805f672318c15acbee5aa40a4e8ea03c97058a48", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "a092826d9cbb6ea50e5e1635a9bc687cec2e43bb791e3ecbf9e76a16fd1d926f", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/fluid_box_fixture.rs": "c2516d00dc62c998744787f75e7d1dd1808a03eb90ea62ad4b73600f4f0e26ad" + }, + "fixtures_sha256": { + ".local/rust-fluid-box-parity/inputs.txt": "41908a6c6991996db65a814d870885aa40a015eb9259b5f68998d2bf9b1d8741" + }, + "rust_output_sha256": "f9569d67701d680554ab3702c1da5cdb9da37915c29fb6d19c17075b91d54afb", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "f9569d67701d680554ab3702c1da5cdb9da37915c29fb6d19c17075b91d54afb", + "matched_output_lines": 92822 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "f9569d67701d680554ab3702c1da5cdb9da37915c29fb6d19c17075b91d54afb", + "matched_output_lines": 92822 + } + ], + "scope": "Actual Entity.getFluidInteractionBox and AbstractBoat.modifyPassengerFluidInteractionBox. Captured deflated entity bounds, virtual vehicle lookup/modifier dispatch, actual boat status predicate, clipping/null results at the boat waterline, AABB endpoint normalization, nonfinite/signed-zero arithmetic, callback mutations and failures. Entity/vehicle snapshots are controlled; live passenger lifecycle and full gameplay remain pending." +} diff --git a/crates/horizon-world/examples/fluid_box_fixture.rs b/crates/horizon-world/examples/fluid_box_fixture.rs new file mode 100644 index 000000000..50e5b7caf --- /dev/null +++ b/crates/horizon-world/examples/fluid_box_fixture.rs @@ -0,0 +1,122 @@ +use horizon_core::geometry::{Aabb, Vec3}; +use horizon_world::fluid_box::{self, BoatFluidBoxWorld, FluidBoxWorld}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn bounds(v: &Value) -> Aabb { + Aabb::new( + Vec3::new(number(&v[0]), number(&v[1]), number(&v[2])), + Vec3::new(number(&v[3]), number(&v[4]), number(&v[5])), + ) +} +fn show(b: Option) -> String { + let Some(b) = b else { return "none".into() }; + b.min_position() + .components() + .into_iter() + .chain(b.max_position().components()) + .map(|v| { + format!( + "{:016x}", + if v.is_nan() { + f64::NAN.to_bits() + } else { + v.to_bits() + } + ) + }) + .collect::>() + .join(" ") +} +struct World<'a> { + f: &'a Value, + out: &'a mut dyn Write, + calls: i64, + actor: Aabb, + boat: Aabb, + status: i64, +} +impl World<'_> { + fn query(&mut self, s: String) -> io::Result<()> { + writeln!(self.out, "{s}")?; + let n = self.calls; + self.calls += 1; + if n == self.f["fail"].as_i64().unwrap() { + return Err(io::Error::other("injected fluid box failure")); + } + if n == self.f["mutate_at"].as_i64().unwrap() { + self.actor = bounds(&self.f["after_actor"]); + self.boat = bounds(&self.f["after_boat"]); + self.status = self.f["after_status"].as_i64().unwrap(); + } + Ok(()) + } +} +impl FluidBoxWorld for World<'_> { + type Error = io::Error; + type Vehicle = u8; + fn bounding_box(&self) -> Aabb { + self.actor + } + fn vehicle(&mut self) -> io::Result> { + self.query("vehicle".into())?; + let v = self.f["vehicle"].as_u64().unwrap() as u8; + Ok((v != 0).then_some(v)) + } + fn modify_passenger_box(&mut self, vehicle: u8, b: Aabb) -> io::Result> { + match vehicle { + 1 => Ok(Some(b)), + 2 => fluid_box::boat_passenger_box(self, b), + 3 => { + self.query(format!("modifier {}", show(Some(b))))?; + Ok((!self.f["modified"].is_null()).then(|| bounds(&self.f["modified"]))) + } + _ => panic!("vehicle fixture"), + } + } +} +impl BoatFluidBoxWorld for World<'_> { + type Error = io::Error; + fn is_under_water(&mut self) -> io::Result { + self.query("boat-under".into())?; + Ok(self.status == 1 || self.status == 2) + } + fn boat_bounds(&self) -> Aabb { + self.boat + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut w = World { + f: &f, + out: &mut out, + calls: 0, + actor: bounds(&f["actor"]), + boat: bounds(&f["boat"]), + status: f["status"].as_i64().unwrap(), + }; + let result = if f["direct"].as_bool().unwrap() { + fluid_box::boat_passenger_box(&mut w, bounds(&f["input"])) + } else { + fluid_box::interaction_box(&mut w) + }; + match result { + Ok(b) => writeln!(w.out, "result {}", show(b))?, + Err(_) => writeln!(w.out, "error")?, + } + writeln!(w.out, "actor {}", show(Some(w.actor)))?; + writeln!(w.out, "boat {}", show(Some(w.boat)))?; + writeln!(w.out, "queries {}", w.calls)?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/fluid_box.rs b/crates/horizon-world/src/fluid_box.rs new file mode 100644 index 000000000..150bd6133 --- /dev/null +++ b/crates/horizon-world/src/fluid_box.rs @@ -0,0 +1,54 @@ +//! Entity fluid scan bounds and the boat passenger waterline restriction. +use horizon_core::geometry::{Aabb, Vec3}; +pub trait FluidBoxWorld { + type Error; + type Vehicle: Copy; + fn bounding_box(&self) -> Aabb; + fn vehicle(&mut self) -> Result, Self::Error>; + fn modify_passenger_box( + &mut self, + vehicle: Self::Vehicle, + bounds: Aabb, + ) -> Result, Self::Error>; +} +pub fn interaction_box(world: &mut W) -> Result, W::Error> { + let bounds = world.bounding_box().deflate(Vec3::new(0.001, 0.001, 0.001)); + match world.vehicle()? { + None => Ok(Some(bounds)), + Some(vehicle) => world.modify_passenger_box(vehicle, bounds), + } +} +pub trait BoatFluidBoxWorld { + type Error; + fn is_under_water(&mut self) -> Result; + fn boat_bounds(&self) -> Aabb; +} +/// Submerged boats preserve the passenger bounds. Otherwise only the part +/// strictly above the boat's top can interact with fluid; it may be absent. +pub fn boat_passenger_box( + world: &mut W, + bounds: Aabb, +) -> Result, W::Error> { + if world.is_under_water()? { + return Ok(Some(bounds)); + } + let boat_top = world.boat_bounds().max_position().y; + let mut min = bounds.min_position(); + let max = bounds.max_position(); + if boat_top >= max.y { + return Ok(None); + } + min.y = java_max(min.y, boat_top); + Ok(Some(Aabb::new(min, max))) +} +fn java_max(a: f64, b: f64) -> f64 { + if a.is_nan() { + a + } else if b.is_nan() { + b + } else if a == 0.0 && b == 0.0 { + f64::from_bits(a.to_bits() & b.to_bits()) + } else { + a.max(b) + } +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index e35904b5f..7b2619a12 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -26,6 +26,7 @@ pub mod entity_move; pub mod entity_obstruction; pub mod fall_damage; pub mod fluid; +pub mod fluid_box; pub mod fluid_flow; pub mod fluid_occupancy; pub mod fluid_shape; diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 2b21d4886..664cf12ca 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1063,3 +1063,17 @@ records **191,142 matching lines per JAR**, including flag combinations, native fluid tag membership, failures/mutations, and f32 eye-height boundaries/nonfinite values. Targeted Clippy passes. Synchronized entity storage, full input/tick integration and playable gameplay remain pending. + + +`fluid_box` implements default entity immersion bounds and boat passenger +waterline clipping. Entity bounds are deflated and captured before vehicle +lookup. Submerged boats retain those bounds; other boats restrict immersion to +the portion strictly above their top, returning no box when none remains. + +`python3 tools/test_fluid_box_parity.py` compares actual entity/boat methods. The +[fluid box report](../benchmarks/rust-fluid-box-2026-10-07/scoped-parity.json) +records **92,822 matching lines per JAR**, including actual boat status values, +virtual modifier dispatch, thin/inverted bounds, waterline boundaries, signed +zero/nonfinite values and mutations/failures. Targeted Clippy passes. Vehicle +snapshots are controlled; live passenger lifecycle and full gameplay remain +pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFluidBoxOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFluidBoxOracle.java new file mode 100644 index 000000000..97b5fdaab --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFluidBoxOracle.java @@ -0,0 +1,25 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.lang.reflect.*;import java.nio.file.*; +import net.minecraft.world.entity.*;import net.minecraft.world.entity.vehicle.boat.*;import net.minecraft.world.phys.AABB; +/** Actual default and boat passenger fluid-interaction bounds. */ +public final class VanillaFluidBoxOracle { + static final class Stop extends RuntimeException {} + static Field status; + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + static AABB box(JsonElement v){if(v.isJsonNull())return null;var a=v.getAsJsonArray();return new AABB(number(a.get(0)),number(a.get(1)),number(a.get(2)),number(a.get(3)),number(a.get(4)),number(a.get(5)));} + static String text(AABB b){return b==null?"none":String.format("%016x %016x %016x %016x %016x %016x",Double.doubleToLongBits(b.minX),Double.doubleToLongBits(b.minY),Double.doubleToLongBits(b.minZ),Double.doubleToLongBits(b.maxX),Double.doubleToLongBits(b.maxY),Double.doubleToLongBits(b.maxZ));} + static void setStatus(Entity boat,int value){try{status.set(boat,value<0?null:AbstractBoat.Status.values()[value]);}catch(Exception e){throw new AssertionError(e);}} + static final class Data {JsonObject f;PrintWriter out;int calls;Actor actor;ProbeBoat boat;Entity vehicle; + void query(String s){out.println(s);int n=calls++;if(n==f.get("fail").getAsInt())throw new Stop();if(n==f.get("mutate_at").getAsInt()){actor.setBoundingBox(box(f.get("after_actor")));boat.setBoundingBox(box(f.get("after_boat")));setStatus(boat,f.get("after_status").getAsInt());}} + } + static final class Actor extends Marker {Data d;Actor(){super(null,null);}@Override public Entity getVehicle(){d.query("vehicle");return d.vehicle;}} + static final class Modifier extends Marker {Data d;Modifier(){super(null,null);}@Override protected AABB modifyPassengerFluidInteractionBox(AABB b){d.query("modifier "+text(b));return box(d.f.get("modified"));}} + static final class ProbeBoat extends Boat {Data d;ProbeBoat(){super(null,null,null);}@Override public boolean isUnderWater(){d.query("boat-under");return super.isUnderWater();}} + public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();var u=Class.forName("sun.misc.Unsafe");var uf=u.getDeclaredField("theUnsafe");uf.setAccessible(true);var unsafe=uf.get(null);var allocate=u.getMethod("allocateInstance",Class.class);status=AbstractBoat.class.getDeclaredField("status");status.setAccessible(true);var helper=AbstractBoat.class.getDeclaredMethod("modifyPassengerFluidInteractionBox",AABB.class);helper.setAccessible(true);Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();var d=new Data();d.f=f;d.out=out;d.actor=(Actor)allocate.invoke(unsafe,Actor.class);d.actor.d=d;d.actor.setBoundingBox(box(f.get("actor")));d.boat=(ProbeBoat)allocate.invoke(unsafe,ProbeBoat.class);d.boat.d=d;d.boat.setBoundingBox(box(f.get("boat")));setStatus(d.boat,f.get("status").getAsInt());int vehicle=f.get("vehicle").getAsInt();if(vehicle==1)d.vehicle=(Marker)allocate.invoke(unsafe,Marker.class);else if(vehicle==2)d.vehicle=d.boat;else if(vehicle==3){var m=(Modifier)allocate.invoke(unsafe,Modifier.class);m.d=d;d.vehicle=m;} + try{var result=f.get("direct").getAsBoolean()?(AABB)helper.invoke(d.boat,box(f.get("input"))):d.actor.getFluidInteractionBox();out.println("result "+text(result));}catch(Stop e){out.println("error");}catch(InvocationTargetException e){if(e.getCause() instanceof Stop)out.println("error");else throw e;} + out.println("actor "+text(d.actor.getBoundingBox()));out.println("boat "+text(d.boat.getBoundingBox()));out.println("queries "+d.calls); + }} + } +} diff --git a/tools/test_fluid_box_parity.py b/tools/test_fluid_box_parity.py new file mode 100644 index 000000000..0e1d59bf9 --- /dev/null +++ b/tools/test_fluid_box_parity.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python3 +"""Compare entity and boat passenger fluid-interaction bounds with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + def bits(v):return struct.pack('>d',float(v)).hex() + def row(**kw): + f=dict(actor=[-.3,0,-.3,.3,1.8,.3],boat=[-1,0,-1,1,.6,1],input=[-.3,0,-.3,.3,1.8,.3],status=0,vehicle=2,direct=False,fail=-1,mutate_at=-1,after_actor=[7,8,9,10,11,12],after_boat=[-1,0,-1,1,2,1],after_status=1,modified=None) + f.update(kw) + for k in ['actor','boat','input','after_actor','after_boat','modified']: + if f[k] is not None:f[k]=[bits(v) for v in f[k]] + return f + values=[-float('inf'),-1e30,-2,-.001,-0.0,0.0,1e-40,.0005,.001,.0015,.002,.5,.6,1.7989999999999997,1.799,1.7990000000000002,1.8,2,1e30,float('inf'),float('nan')] + for top in values: + for low in values: + for status in range(-1,5): + for direct in [False,True]:yield row(boat=[-1,top,-1,1,top,1],actor=[-.3,low,-.3,.3,1.8,.3],input=[-.3,low,-.3,.3,1.8,.3],status=status,direct=direct) + for component in range(6): + for value in values: + b=[-.3,0,-.3,.3,1.8,.3];b[component]=value + for vehicle in range(4): + for fail in [-1,0,1,2]: + for mutate in [-1,0,1]:yield row(actor=b,vehicle=vehicle,fail=fail,mutate_at=mutate,modified=[1,2,3,4,5,6]) + rng=random.Random(0x464c554944424f58) + for _ in range(6000): + yield row(actor=[rng.choice(values) for _ in range(6)],input=[rng.choice(values) for _ in range(6)],boat=[rng.choice(values) for _ in range(6)],after_boat=[rng.choice(values) for _ in range(6)],vehicle=rng.randrange(4),status=rng.randrange(-1,5),after_status=rng.randrange(-1,5),direct=bool(rng.randrange(2)),fail=rng.choice([-1,-1,0,1,2]),mutate_at=rng.choice([-1,-1,0,1,2])) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-fluid-box-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFluidBoxOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/fluid_box_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaFluidBoxOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','fluid_box_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('fluid_box_fixture.exe' if os.name=='nt' else 'fluid_box_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} fluid-box output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual Entity.getFluidInteractionBox and AbstractBoat.modifyPassengerFluidInteractionBox. Captured deflated entity bounds, virtual vehicle lookup/modifier dispatch, actual boat status predicate, clipping/null results at the boat waterline, AABB endpoint normalization, nonfinite/signed-zero arithmetic, callback mutations and failures. Entity/vehicle snapshots are controlled; live passenger lifecycle and full gameplay remain pending.'} + lab.write_json(report_path,report);print(f'Scoped fluid box parity passed: {report_path}') + + +if __name__=='__main__':main() From 0ced7393efe58529176e788a4a4bb92b551a8bf0 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 03:45:49 +0200 Subject: [PATCH 102/253] Implement vanilla water splash effects and random draw ordering --- .../scoped-parity.json | 239 ++++++++++++++++++ .../examples/water_splash_fixture.rs | 184 ++++++++++++++ crates/horizon-world/src/lib.rs | 1 + crates/horizon-world/src/water_splash.rs | 115 +++++++++ docs/collision-geometry.md | 18 ++ .../parity/VanillaWaterSplashOracle.java | 34 +++ tools/test_water_splash_parity.py | 75 ++++++ 7 files changed, 666 insertions(+) create mode 100644 benchmarks/rust-water-splash-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/water_splash_fixture.rs create mode 100644 crates/horizon-world/src/water_splash.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaWaterSplashOracle.java create mode 100644 tools/test_water_splash_parity.py diff --git a/benchmarks/rust-water-splash-2026-10-07/scoped-parity.json b/benchmarks/rust-water-splash-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..a7960805c --- /dev/null +++ b/benchmarks/rust-water-splash-2026-10-07/scoped-parity.json @@ -0,0 +1,239 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 7840, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaWaterSplashOracle.java": "7cacf25db8f76ffdd183779d7d0c2fe901c050312455c4cedc44fa887d51d501", + "tools/test_water_splash_parity.py": "a81c446ac18bd53c9b71bf0a6533f60d4b63e1d6b95646c65b15bfaad5ae2041", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "13ceccc7110505ffd37705d2941e53bb73864d607031193c37f2ba6b59518918", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/water_splash_fixture.rs": "cc5c5f4c8cfa05acb805a6dc3d82f2a151d6b6385cd87124598606294b96e947" + }, + "fixtures_sha256": { + ".local/rust-water-splash-parity/inputs.txt": "e6ced93a73be331cf1393cf1c50e514c2e7cbfbbf29ca272d7f679d0a92eb26a" + }, + "rust_output_sha256": "9df875aa9277988d3b95bd332abb53468aaf676296c26a4b770f0421f18c7079", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "9df875aa9277988d3b95bd332abb53468aaf676296c26a4b770f0421f18c7079", + "matched_output_lines": 192506 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "9df875aa9277988d3b95bd332abb53468aaf676296c26a4b770f0421f18c7079", + "matched_output_lines": 192506 + } + ], + "scope": "Actual Entity.doWaterSplashEffect with native LegacyRandomSource and XoroshiroRandomSource. Compares controlling-passenger identity, captured velocity, sound selection/volume/pitch, ordered bubble/splash particle requests, float-rounded surface height, random draw continuation and final game event. Includes width/position/velocity mutations, nonfinite arithmetic and injected failures. Sound identities and effect sinks are controlled; audio playback, particle simulation/rendering and complete gameplay remain pending." +} diff --git a/crates/horizon-world/examples/water_splash_fixture.rs b/crates/horizon-world/examples/water_splash_fixture.rs new file mode 100644 index 000000000..dd8c71080 --- /dev/null +++ b/crates/horizon-world/examples/water_splash_fixture.rs @@ -0,0 +1,184 @@ +use horizon_core::{ + geometry::Vec3, + random::{LegacyRandom, RandomSource, XoroshiroRandom}, +}; +use horizon_world::water_splash::{self, SplashError, SplashParticle, WaterSplashWorld}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn single(v: &Value) -> f32 { + f32::from_bits(u32::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn vec(v: &Value) -> Vec3 { + Vec3::new(number(&v[0]), number(&v[1]), number(&v[2])) +} +fn bits(v: f64) -> u64 { + if v.is_nan() { + f64::NAN.to_bits() + } else { + v.to_bits() + } +} +fn float_bits(v: f32) -> u32 { + if v.is_nan() { + f32::NAN.to_bits() + } else { + v.to_bits() + } +} +fn vector(v: Vec3) -> String { + format!("{:016x} {:016x} {:016x}", bits(v.x), bits(v.y), bits(v.z)) +} +struct World<'a, R> { + f: &'a Value, + out: &'a mut dyn Write, + calls: i64, + position: Vec3, + width: f32, + velocity: Vec3, + other: Vec3, + rng: R, +} +impl World<'_, R> { + fn query(&mut self, s: String) -> io::Result<()> { + writeln!(self.out, "{s}")?; + let n = self.calls; + self.calls += 1; + if n == self.f["fail"].as_i64().unwrap() { + return Err(io::Error::other("injected splash failure")); + } + if n == self.f["mutate_at"].as_i64().unwrap() { + self.position = vec(&self.f["after_position"]); + self.width = single(&self.f["after_width"]); + self.velocity = vec(&self.f["after_velocity"]); + self.other = vec(&self.f["after_other_velocity"]); + } + Ok(()) + } +} +impl WaterSplashWorld for World<'_, R> { + type Error = io::Error; + type Entity = u8; + type Sound = bool; + fn this_entity(&self) -> u8 { + 0 + } + fn controlling_passenger(&mut self) -> io::Result> { + self.query("passenger".into())?; + Ok(match self.f["passenger"].as_u64().unwrap() { + 0 => None, + 1 => Some(0), + 2 => Some(1), + _ => panic!("fixture passenger"), + }) + } + fn velocity(&mut self, e: u8) -> io::Result { + self.query(format!( + "velocity {}", + if e == 0 { "self" } else { "other" } + ))?; + Ok(if e == 0 { self.velocity } else { self.other }) + } + fn splash_sound(&mut self, high: bool) -> io::Result { + self.query(format!("sound {}", if high { "high" } else { "low" }))?; + Ok(high) + } + fn random_float(&mut self) -> io::Result { + self.query("float".into())?; + Ok(self.rng.next_float()) + } + fn random_double(&mut self) -> io::Result { + self.query("double".into())?; + Ok(self.rng.next_double()) + } + fn play_sound(&mut self, s: bool, volume: f32, pitch: f32) -> io::Result<()> { + self.query(format!( + "play {} {:08x} {:08x}", + if s { "high" } else { "low" }, + float_bits(volume), + float_bits(pitch) + )) + } + fn position(&self) -> Vec3 { + self.position + } + fn width(&self) -> f32 { + self.width + } + fn particle(&mut self, k: SplashParticle, p: Vec3, v: Vec3) -> io::Result<()> { + self.query(format!( + "particle {} {} {}", + match k { + SplashParticle::Bubble => "bubble", + SplashParticle::Splash => "splash", + }, + vector(p), + vector(v) + )) + } + fn splash_event(&mut self) -> io::Result<()> { + self.query("event splash".into()) + } +} +fn world<'a, R>(f: &'a Value, out: &'a mut dyn Write, rng: R) -> World<'a, R> { + World { + f, + out, + calls: 0, + position: vec(&f["position"]), + width: single(&f["width"]), + velocity: vec(&f["velocity"]), + other: vec(&f["other_velocity"]), + rng, + } +} +fn run(f: &Value, out: &mut dyn Write, rng: R) -> io::Result<()> { + let mut w = world(f, out, rng); + match water_splash::water_splash(&mut w, 10000) { + Ok(()) => writeln!(w.out, "result ok")?, + Err(SplashError::World(_)) => writeln!(w.out, "error")?, + Err(e) => panic!("unexpected fixture limit: {e}"), + }; + writeln!( + w.out, + "final {} {:08x}", + vector(w.position), + float_bits(w.width) + )?; + writeln!(w.out, "next {}", w.rng.next_long())?; + writeln!(w.out, "queries {}", w.calls) +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + let input = fs::read_to_string(dir.join("inputs.txt"))?; + let first: Value = serde_json::from_str(input.lines().next().unwrap())?; + let mut sink = io::sink(); + let mut probe = world(&first, &mut sink, LegacyRandom::new(42)); + assert!(matches!( + water_splash::water_splash(&mut probe, 0), + Err(SplashError::BudgetExceeded) + )); + assert_eq!(probe.calls, 6); + let mut expected = LegacyRandom::new(42); + expected.next_float(); + expected.next_float(); + assert_eq!(probe.rng.next_long(), expected.next_long()); + for line in input.lines() { + let f: Value = serde_json::from_str(line)?; + let seed = f["seed"].as_i64().unwrap(); + if f["legacy"].as_bool().unwrap() { + run(&f, &mut out, LegacyRandom::new(seed))? + } else { + run(&f, &mut out, XoroshiroRandom::new(seed))? + } + } + Ok(()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 7b2619a12..304021db7 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -58,6 +58,7 @@ pub mod retrogen; pub mod suffocation; pub mod swimming; pub mod tick_data; +pub mod water_splash; pub mod world_movement; pub mod world_ray; pub mod worldgen; diff --git a/crates/horizon-world/src/water_splash.rs b/crates/horizon-world/src/water_splash.rs new file mode 100644 index 000000000..fd6b023bd --- /dev/null +++ b/crates/horizon-world/src/water_splash.rs @@ -0,0 +1,115 @@ +//! Water-entry sound, particles and game event, with native random draw order. +use horizon_core::geometry::Vec3; +use std::fmt; +#[derive(Clone, Copy, Debug)] +pub enum SplashParticle { + Bubble, + Splash, +} +pub trait WaterSplashWorld { + type Error; + type Entity: Copy + PartialEq; + type Sound: Copy; + fn this_entity(&self) -> Self::Entity; + fn controlling_passenger(&mut self) -> Result, Self::Error>; + fn velocity(&mut self, entity: Self::Entity) -> Result; + fn splash_sound(&mut self, high_speed: bool) -> Result; + fn random_float(&mut self) -> Result; + fn random_double(&mut self) -> Result; + fn play_sound( + &mut self, + sound: Self::Sound, + volume: f32, + pitch: f32, + ) -> Result<(), Self::Error>; + fn position(&self) -> Vec3; + fn width(&self) -> f32; + fn particle( + &mut self, + kind: SplashParticle, + position: Vec3, + velocity: Vec3, + ) -> Result<(), Self::Error>; + fn splash_event(&mut self) -> Result<(), Self::Error>; +} +#[derive(Debug)] +pub enum SplashError { + World(E), + BudgetExceeded, +} +impl fmt::Display for SplashError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::World(e) => e.fmt(f), + Self::BudgetExceeded => f.write_str("water splash particle budget exceeded"), + } + } +} +impl std::error::Error for SplashError {} +pub fn water_splash( + world: &mut W, + mut budget: usize, +) -> Result<(), SplashError> { + let source = world + .controlling_passenger() + .map_err(SplashError::World)? + .unwrap_or(world.this_entity()); + let scale = if source == world.this_entity() { + 0.2f32 + } else { + 0.9f32 + }; + let velocity = world.velocity(source).map_err(SplashError::World)?; + let energy = velocity.x * velocity.x * f64::from(0.2f32) + + velocity.y * velocity.y + + velocity.z * velocity.z * f64::from(0.2f32); + let volume = energy.sqrt() as f32 * scale; + let volume = if volume.is_nan() { + volume + } else { + 1.0f32.min(volume) + }; + let sound = world + .splash_sound(volume.is_nan() || volume >= 0.25) + .map_err(SplashError::World)?; + let pitch = 1.0 + + (world.random_float().map_err(SplashError::World)? + - world.random_float().map_err(SplashError::World)?) + * 0.4; + world + .play_sound(sound, volume, pitch) + .map_err(SplashError::World)?; + let surface = world.position().y.floor() as i32 as f32; + for kind in [SplashParticle::Bubble, SplashParticle::Splash] { + let mut i = 0i32; + while (i as f32) < 1.0 + world.width() * 20.0 { + if budget == 0 { + return Err(SplashError::BudgetExceeded); + } + budget -= 1; + let dx = (world.random_double().map_err(SplashError::World)? * 2.0 - 1.0) + * f64::from(world.width()); + let dz = (world.random_double().map_err(SplashError::World)? * 2.0 - 1.0) + * f64::from(world.width()); + let position = Vec3::new( + world.position().x + dx, + f64::from(surface + 1.0), + world.position().z + dz, + ); + let particle_velocity = match kind { + SplashParticle::Bubble => Vec3::new( + velocity.x, + velocity.y + - world.random_double().map_err(SplashError::World)? * f64::from(0.2f32), + velocity.z, + ), + SplashParticle::Splash => velocity, + }; + world + .particle(kind, position, particle_velocity) + .map_err(SplashError::World)?; + i = i.wrapping_add(1); + } + } + world.splash_event().map_err(SplashError::World) +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 664cf12ca..f4fca057e 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1077,3 +1077,21 @@ virtual modifier dispatch, thin/inverted bounds, waterline boundaries, signed zero/nonfinite values and mutations/failures. Targeted Clippy passes. Vehicle snapshots are controlled; live passenger lifecycle and full gameplay remain pending. + + +`water_splash` generates native water-entry sound, bubble/splash particle and game +event requests. It preserves controlling-passenger identity, captured velocity, +f32 volume/pitch arithmetic, float-rounded surface height, changing entity width, +and random draws before each emitted effect. A particle budget returns an +explicit error after preserving preceding effects and RNG consumption. + +`python3 tools/test_water_splash_parity.py` invokes actual +`Entity.doWaterSplashEffect` with native legacy and xoroshiro random generators. +The [water splash report](../benchmarks/rust-water-splash-2026-10-07/scoped-parity.json) +records **192,506 matching lines per JAR** across **7,840 fixtures**, including +sound thresholds, self/other passengers, particle positions/velocities, callback +mutations/failures, nonfinite arithmetic and the next RNG value after the effect. +A Rust-only budget check verifies that exhaustion preserves the two sound-pitch +random draws. Targeted Clippy passes. Sound identities and effect sinks are +controlled; audio playback, particle simulation/rendering and full gameplay +integration remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaWaterSplashOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaWaterSplashOracle.java new file mode 100644 index 000000000..47a85e02d --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaWaterSplashOracle.java @@ -0,0 +1,34 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.lang.reflect.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.*;import net.minecraft.core.particles.*;import net.minecraft.resources.Identifier;import net.minecraft.sounds.*;import net.minecraft.util.RandomSource;import net.minecraft.world.entity.*;import net.minecraft.world.level.gameevent.GameEvent;import net.minecraft.world.level.levelgen.*;import net.minecraft.world.phys.Vec3; +/** Actual water-entry splash with native seeded RNG and observable sound/particle requests. */ +public final class VanillaWaterSplashOracle { + static final class Stop extends RuntimeException {} + static Field position,dimensions; + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));}static float single(JsonElement v){return Float.intBitsToFloat(Integer.parseUnsignedInt(v.getAsString(),16));} + static Vec3 vec(JsonElement v){var a=v.getAsJsonArray();return new Vec3(number(a.get(0)),number(a.get(1)),number(a.get(2)));} + static String vector(Vec3 v){return String.format("%016x %016x %016x",Double.doubleToLongBits(v.x),Double.doubleToLongBits(v.y),Double.doubleToLongBits(v.z));} + static final class Data {JsonObject f;PrintWriter out;int calls;Actor actor,other;Vec3 velocity,otherVelocity;SoundEvent low,high; + void query(String s){out.println(s);int n=calls++;if(n==f.get("fail").getAsInt())throw new Stop();if(n==f.get("mutate_at").getAsInt()){velocity=vec(f.get("after_velocity"));otherVelocity=vec(f.get("after_other_velocity"));try{position.set(actor,vec(f.get("after_position")));dimensions.set(actor,EntityDimensions.fixed(single(f.get("after_width")),2));}catch(Exception e){throw new AssertionError(e);}}} + } + static final class World extends net.minecraft.server.level.ServerLevel {Data d;World(){super(null,null,null,null,null,null,false,0L,List.of(),false);} + @Override public void addParticle(ParticleOptions type,double x,double y,double z,double vx,double vy,double vz){d.query("particle "+(type==ParticleTypes.BUBBLE?"bubble":type==ParticleTypes.SPLASH?"splash":"unexpected")+" "+vector(new Vec3(x,y,z))+" "+vector(new Vec3(vx,vy,vz)));} + } + static final class Actor extends net.minecraft.world.entity.decoration.ArmorStand {Data d;boolean other;Actor(){super(null,null);} + @Override public LivingEntity getControllingPassenger(){d.query("passenger");return switch(d.f.get("passenger").getAsInt()){case 0->null;case 1->this;case 2->d.other;default->throw new AssertionError();};} + @Override public Vec3 getDeltaMovement(){d.query("velocity "+(other?"other":"self"));return other?d.otherVelocity:d.velocity;} + @Override protected SoundEvent getSwimSplashSound(){d.query("sound low");return d.low;} + @Override protected SoundEvent getSwimHighSpeedSplashSound(){d.query("sound high");return d.high;} + @Override public void playSound(SoundEvent sound,float volume,float pitch){d.query(String.format("play %s %08x %08x",sound==d.low?"low":"high",Float.floatToIntBits(volume),Float.floatToIntBits(pitch)));} + @Override public void gameEvent(Holder event){if(event!=GameEvent.SPLASH)throw new AssertionError(event);d.query("event splash");} + } + static Field field(Class c,String name)throws Exception{var f=c.getDeclaredField(name);f.setAccessible(true);return f;} + public static void main(String[] args)throws Exception{ + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();var u=Class.forName("sun.misc.Unsafe");var unsafe=field(u,"theUnsafe").get(null);var allocate=u.getMethod("allocateInstance",Class.class);position=field(Entity.class,"position");dimensions=field(Entity.class,"dimensions");var level=field(Entity.class,"level");var random=field(Entity.class,"random");var splash=Entity.class.getDeclaredMethod("doWaterSplashEffect");splash.setAccessible(true);Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();var d=new Data();d.f=f;d.out=out;d.velocity=vec(f.get("velocity"));d.otherVelocity=vec(f.get("other_velocity"));d.low=SoundEvent.createVariableRangeEvent(Identifier.parse("horizon:low"));d.high=SoundEvent.createVariableRangeEvent(Identifier.parse("horizon:high"));d.actor=(Actor)allocate.invoke(unsafe,Actor.class);d.actor.d=d;d.other=(Actor)allocate.invoke(unsafe,Actor.class);d.other.d=d;d.other.other=true;var w=(World)allocate.invoke(unsafe,World.class);w.d=d;level.set(d.actor,w);position.set(d.actor,vec(f.get("position")));dimensions.set(d.actor,EntityDimensions.fixed(single(f.get("width")),2));long seed=f.get("seed").getAsLong();RandomSource rng=f.get("legacy").getAsBoolean()?new LegacyRandomSource(seed):new XoroshiroRandomSource(seed); + var source=(RandomSource)Proxy.newProxyInstance(RandomSource.class.getClassLoader(),new Class[]{RandomSource.class},(proxy,method,values)->{switch(method.getName()){case "nextFloat":d.query("float");return rng.nextFloat();case "nextDouble":d.query("double");return rng.nextDouble();default:throw new AssertionError(method);}});random.set(d.actor,source); + try{splash.invoke(d.actor);out.println("result ok");}catch(InvocationTargetException e){if(e.getCause() instanceof Stop)out.println("error");else throw e;} + out.println("final "+vector((Vec3)position.get(d.actor))+" "+String.format("%08x",Float.floatToIntBits(d.actor.getBbWidth())));out.println("next "+rng.nextLong());out.println("queries "+d.calls); + }} + } +} diff --git a/tools/test_water_splash_parity.py b/tools/test_water_splash_parity.py new file mode 100644 index 000000000..94d177211 --- /dev/null +++ b/tools/test_water_splash_parity.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python3 +"""Compare water-entry sound, particle and random draw ordering with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + def bits(v):return struct.pack('>d',float(v)).hex() + def single(v):return struct.pack('>f',float(v)).hex() + def row(**kw): + f=dict(position=[17.25,64.9,-33.5],width=.6,velocity=[.2,-.3,.1],other_velocity=[.8,-.9,1.2],after_position=[31.5,100.9,-52.25],after_width=.1,after_velocity=[1,2,3],after_other_velocity=[4,5,6],passenger=0,legacy=True,seed=42,fail=-1,mutate_at=-1);f.update(kw) + for k in ['position','velocity','other_velocity','after_position','after_velocity','after_other_velocity']:f[k]=[bits(v) for v in f[k]] + for k in ['width','after_width']:f[k]=single(f[k]) + return f + yield row() + widths=[-float('inf'),-1,-.050000004,-.05,-.049999997,-0.,0.,.0001,.049999997,.05,.050000004,.1,.6,1,2,float('nan')] + vectors=[[0,0,0],[1,0,0],[0,1.2499999,0],[0,1.25,0],[0,1.2500001,0],[0,.2777777777777778,0],[10,20,30],[1,float('nan'),2],[float('inf'),0,0],[-0.,-0.,-0.]] + for passenger in range(3): + for legacy in [False,True]: + for width in widths: + for velocity in vectors:yield row(passenger=passenger,legacy=legacy,width=width,velocity=velocity,other_velocity=velocity) + for legacy in [False,True]: + for passenger in range(3): + for fail in range(-1,45): + for mutate in [-1,0,1,2,3,4,5,6,7,8,9,10,20,30]:yield row(legacy=legacy,passenger=passenger,fail=fail,mutate_at=mutate) + for y in [-float('inf'),-1e30,-2147483649,-.1,-0.,0.,.9,16777215,16777216,2147483648,1e30,float('inf'),float('nan')]:yield row(position=[-0.,y,float('nan')],width=.01) + for width in [100000,float('inf')]:yield row(width=width,fail=7) + rng=random.Random(0x53504c415348) + for _ in range(3000):yield row(seed=rng.randrange(-2**63,2**63),legacy=bool(rng.randrange(2)),passenger=rng.randrange(3),width=rng.choice(widths),velocity=rng.choice(vectors),other_velocity=rng.choice(vectors),after_width=rng.choice(widths),fail=rng.choice([-1,-1,*range(35)]),mutate_at=rng.choice([-1,-1,*range(35)])) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-water-splash-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaWaterSplashOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/water_splash_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaWaterSplashOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','water_splash_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('water_splash_fixture.exe' if os.name=='nt' else 'water_splash_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} water-splash output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual Entity.doWaterSplashEffect with native LegacyRandomSource and XoroshiroRandomSource. Compares controlling-passenger identity, captured velocity, sound selection/volume/pitch, ordered bubble/splash particle requests, float-rounded surface height, random draw continuation and final game event. Includes width/position/velocity mutations, nonfinite arithmetic and injected failures. Sound identities and effect sinks are controlled; audio playback, particle simulation/rendering and complete gameplay remain pending.'} + lab.write_json(report_path,report);print(f'Scoped water splash parity passed: {report_path}') + + +if __name__=='__main__':main() From 39993060ebecd599e1eab086ed30dd9200683507 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 03:56:36 +0200 Subject: [PATCH 103/253] Implement vanilla attribute modifiers, caching and permanent state --- .../scoped-parity.json | 242 ++++++++++++ .../examples/attribute_fixture.rs | 200 ++++++++++ crates/horizon-world/src/attributes/mod.rs | 348 ++++++++++++++++++ .../src/attributes/operation_map.rs | 104 ++++++ crates/horizon-world/src/lib.rs | 1 + docs/collision-geometry.md | 20 + .../parity/VanillaAttributeOracle.java | 43 +++ tools/test_attribute_parity.py | 105 ++++++ 8 files changed, 1063 insertions(+) create mode 100644 benchmarks/rust-attributes-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/attribute_fixture.rs create mode 100644 crates/horizon-world/src/attributes/mod.rs create mode 100644 crates/horizon-world/src/attributes/operation_map.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaAttributeOracle.java create mode 100644 tools/test_attribute_parity.py diff --git a/benchmarks/rust-attributes-2026-10-07/scoped-parity.json b/benchmarks/rust-attributes-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..3d0c8d795 --- /dev/null +++ b/benchmarks/rust-attributes-2026-10-07/scoped-parity.json @@ -0,0 +1,242 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 2391, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaAttributeOracle.java": "90bd04bb58742b9da097bca9cb8bffe164222d18e07adf900755404ce4742c30", + "tools/test_attribute_parity.py": "96433819ea8f1de3344e79bc0521315b1657508ebedb21678918d40f1bbc2fb0", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attributes/mod.rs": "42f1dd4c96d288ad2067fd4024d16f045284a7fe1c66351a8ee6322e5e236a12", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "172ecf965d8ccbe16ed89e8ad1471cf384e2609ab3ca25f309456e726a4d6857", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/attribute_fixture.rs": "b3d25fe70798226cd1dae3efffacb128e019baf505b062de5f01a05a97ed60d0" + }, + "fixtures_sha256": { + ".local/rust-attribute-parity/inputs.txt": "95140374036edd0921d62f633742fed7824b81a6d86cb3a9236a9821e6b7865f", + ".local/rust-attribute-parity/attributes.json": "f65511fdc672dc291a412f7bed816bf1d8dc597fde8466efd95622e028bf8783" + }, + "rust_output_sha256": "223dc3b3155ba637b05757f07fac51cf30138caf66321a056c31ef4fc1da167c", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "223dc3b3155ba637b05757f07fac51cf30138caf66321a056c31ef4fc1da167c", + "matched_output_lines": 1404798 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "223dc3b3155ba637b05757f07fac51cf30138caf66321a056c31ef4fc1da167c", + "matched_output_lines": 1404798 + } + ], + "scope": "Actual AttributeInstance and basic/ranged attributes, with every registered attribute definition. Native modifier identity, global/permanent insertion order, per-operation fastutil hash iteration/rehashing, cache/dirty callbacks, partial writes on observer failure, transient operation changes, duplicate rejection, bulk removal, replacement (including self), pack and merging apply. Includes nonfinite/signed-zero arithmetic, collision clusters and seeded operation sequences. Attribute registry/entity/equipment integration and packed data/network codecs remain pending." +} diff --git a/crates/horizon-world/examples/attribute_fixture.rs b/crates/horizon-world/examples/attribute_fixture.rs new file mode 100644 index 000000000..450400c21 --- /dev/null +++ b/crates/horizon-world/examples/attribute_fixture.rs @@ -0,0 +1,200 @@ +use horizon_world::attributes::{ + AttributeError, Definition, Instance, Modifier, Observer, Operation, Packed, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn bits(v: f64) -> u64 { + if v.is_nan() { + f64::NAN.to_bits() + } else { + v.to_bits() + } +} +fn refs<'a>(mods: impl IntoIterator, pool: &[Modifier]) -> String { + let s = mods + .into_iter() + .map(|m| { + pool.iter() + .position(|p| p.same_identity(m)) + .unwrap() + .to_string() + }) + .collect::>() + .join(","); + if s.is_empty() { "-".into() } else { s } +} +struct Callback<'a> { + out: &'a mut dyn Write, + target: usize, + calls: i64, + op: &'a Value, +} +impl Observer for Callback<'_> { + type Error = io::Error; + fn dirty(&mut self, a: &mut Instance) -> io::Result<()> { + writeln!( + self.out, + "dirty {} {:016x} {} {:016x} {} {}", + self.target, + bits(a.base_value()), + a.is_dirty(), + bits(a.cached_value()), + a.modifiers().len(), + a.permanent_modifiers().len() + )?; + let n = self.calls; + self.calls += 1; + if n == self.op["fail"].as_i64().unwrap() { + return Err(io::Error::other("injected attribute observer failure")); + } + if self.op["read"].as_bool().unwrap() { + writeln!(self.out, "observed {:016x}", bits(a.value()))?; + } + Ok(()) + } +} +fn state(out: &mut dyn Write, id: usize, a: &Instance, pool: &[Modifier]) -> io::Result<()> { + writeln!( + out, + "state {id} {:016x} {} {:016x}", + bits(a.base_value()), + a.is_dirty(), + bits(a.cached_value()) + )?; + writeln!(out, "all {}", refs(a.modifiers(), pool))?; + writeln!(out, "permanent {}", refs(a.permanent_modifiers(), pool))?; + for op in Operation::ALL { + writeln!( + out, + "operation {} {}", + op as u8, + refs(a.operation_modifiers(op), pool) + )?; + } + Ok(()) +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).expect("private fixture directory"); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let definitions = f["definitions"] + .as_array() + .unwrap() + .iter() + .map(|v| { + let d = number(&v["default"]); + if v.get("min").is_some() { + Definition::ranged(d, number(&v["min"]), number(&v["max"])) + } else { + Ok(Definition::basic(d)) + } + }) + .collect::>>(); + let Ok(definitions) = definitions else { + writeln!(out, "definition error")?; + continue; + }; + let mut instances = [Instance::new(definitions[0]), Instance::new(definitions[1])]; + let pool = f["modifiers"] + .as_array() + .unwrap() + .iter() + .map(|v| { + Modifier::new( + v["id"].as_str().unwrap(), + number(&v["amount"]), + Operation::ALL[v["operation"].as_u64().unwrap() as usize], + ) + }) + .collect::>>()?; + let mut packed: Option = None; + for op in f["ops"].as_array().unwrap() { + let target = op["target"].as_u64().unwrap() as usize; + let mut cb = Callback { + out: &mut out, + target, + calls: 0, + op, + }; + let m = || pool[op["modifier"].as_u64().unwrap() as usize].clone(); + let mods = || { + op["modifiers"] + .as_array() + .unwrap() + .iter() + .map(|v| pool[v.as_u64().unwrap() as usize].clone()) + .collect::>() + }; + let result = match op["mode"].as_str().unwrap() { + "base" => instances[target].set_base_value(number(&op["base"]), &mut cb), + "add" => instances[target].add_transient(m(), &mut cb), + "update" => instances[target].add_or_update_transient(m(), &mut cb), + "permanent" => instances[target].add_permanent(m(), &mut cb), + "replace" => instances[target].add_or_replace_permanent(m(), &mut cb), + "remove" => { + let v = instances[target].remove(m().id(), &mut cb); + match v { + Ok(v) => { + writeln!(cb.out, "removed {v}")?; + Ok(()) + } + Err(e) => Err(e), + } + } + "clear" => instances[target].remove_all(&mut cb), + "copy" => { + let source = op["source"].as_u64().unwrap() as usize; + if source == target { + instances[target].replace_from_self(&mut cb) + } else { + let snapshot = instances[source].clone(); + instances[target].replace_from(&snapshot, &mut cb) + } + } + "pack" => { + let p = instances[target].pack(); + writeln!( + cb.out, + "packed {:016x} {}", + bits(p.base), + refs(&p.modifiers, &pool) + )?; + packed = Some(p); + Ok(()) + } + "unpack" => instances[target].apply(packed.as_ref().unwrap(), &mut cb), + "apply" => instances[target].apply( + &Packed { + base: number(&op["base"]), + modifiers: mods(), + }, + &mut cb, + ), + "many" => instances[target].add_permanent_many(mods(), &mut cb), + "value" => { + writeln!(cb.out, "value {:016x}", bits(instances[target].value()))?; + Ok(()) + } + _ => panic!("fixture mode"), + }; + match result { + Ok(()) => writeln!(cb.out, "result ok")?, + Err(AttributeError::DuplicateModifier(_)) => writeln!(cb.out, "error duplicate")?, + Err(AttributeError::Observer(_)) => writeln!(cb.out, "error observer")?, + }; + state(cb.out, 0, &instances[0], &pool)?; + state(cb.out, 1, &instances[1], &pool)?; + writeln!(cb.out, "calls {}", cb.calls)?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/src/attributes/mod.rs b/crates/horizon-world/src/attributes/mod.rs new file mode 100644 index 000000000..9e94cd1c2 --- /dev/null +++ b/crates/horizon-world/src/attributes/mod.rs @@ -0,0 +1,348 @@ +//! Ordered attribute modifiers, native cache invalidation and permanent state. +use crate::compression::invalid; +use std::{fmt, io, sync::Arc}; +mod operation_map; +use operation_map::OperationMap; +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[repr(u8)] +pub enum Operation { + AddValue, + AddMultipliedBase, + AddMultipliedTotal, +} +impl Operation { + pub const ALL: [Self; 3] = [ + Self::AddValue, + Self::AddMultipliedBase, + Self::AddMultipliedTotal, + ]; +} +#[derive(Debug)] +struct ModifierData { + id: String, + hash: u32, + amount: f64, + operation: Operation, +} +/// Clones retain native modifier reference identity. Reconstructing an equal +/// modifier creates a distinct reference for add-or-update dirty notifications. +#[derive(Clone, Debug)] +pub struct Modifier(Arc); +impl Modifier { + pub fn new(id: &str, amount: f64, operation: Operation) -> io::Result { + let (namespace, path) = id.split_once(':').unwrap_or(("minecraft", id)); + let namespace = if namespace.is_empty() { + "minecraft" + } else { + namespace + }; + let valid = |c: u8| c.is_ascii_lowercase() || c.is_ascii_digit() || b"_.-".contains(&c); + if !namespace.bytes().all(valid) || !path.bytes().all(|c| valid(c) || c == b'/') { + return Err(invalid("invalid attribute modifier identifier")); + } + let hash = |s: &str| { + s.bytes() + .fold(0u32, |h, b| h.wrapping_mul(31).wrapping_add(u32::from(b))) + }; + Ok(Self(Arc::new(ModifierData { + id: format!("{namespace}:{path}"), + hash: hash(namespace).wrapping_mul(31).wrapping_add(hash(path)), + amount, + operation, + }))) + } + pub fn id(&self) -> &str { + &self.0.id + } + pub fn amount(&self) -> f64 { + self.0.amount + } + pub fn operation(&self) -> Operation { + self.0.operation + } + pub fn same_identity(&self, other: &Self) -> bool { + Arc::ptr_eq(&self.0, &other.0) + } +} +#[derive(Clone, Copy, Debug)] +pub struct Definition { + default: f64, + range: Option<(f64, f64)>, +} +impl Definition { + pub fn basic(default: f64) -> Self { + Self { + default, + range: None, + } + } + pub fn ranged(default: f64, min: f64, max: f64) -> io::Result { + if min > max || default < min || default > max { + return Err(invalid("invalid ranged attribute bounds/default")); + } + Ok(Self { + default, + range: Some((min, max)), + }) + } + pub fn default_value(self) -> f64 { + self.default + } + pub fn sanitize(self, value: f64) -> f64 { + let Some((min, max)) = self.range else { + return value; + }; + if value.is_nan() || value < min { + min + } else if max.is_nan() { + max + } else if value == 0.0 && max == 0.0 { + f64::from_bits(value.to_bits() | max.to_bits()) + } else { + value.min(max) + } + } +} +pub trait Observer { + type Error; + /// Called after dirty=true and preceding writes. Reading the value here can + /// clear the dirty flag, and an error preserves all writes already made. + fn dirty(&mut self, attribute: &mut Instance) -> Result<(), Self::Error>; +} +#[derive(Debug)] +pub enum AttributeError { + DuplicateModifier(String), + Observer(E), +} +impl fmt::Display for AttributeError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::DuplicateModifier(id) => write!(f, "attribute modifier already applied: {id}"), + Self::Observer(e) => e.fmt(f), + } + } +} +impl std::error::Error for AttributeError {} +#[derive(Clone, Debug)] +pub struct Packed { + pub base: f64, + pub modifiers: Vec, +} +#[derive(Clone, Debug)] +pub struct Instance { + definition: Definition, + base: f64, + dirty: bool, + cached: f64, + by_id: Vec, + permanent: Vec, + operations: [Option; 3], +} +impl Instance { + pub fn new(definition: Definition) -> Self { + Self { + definition, + base: definition.default, + dirty: true, + cached: 0.0, + by_id: Vec::new(), + permanent: Vec::new(), + operations: [None, None, None], + } + } + pub fn base_value(&self) -> f64 { + self.base + } + pub fn is_dirty(&self) -> bool { + self.dirty + } + pub fn cached_value(&self) -> f64 { + self.cached + } + pub fn modifiers(&self) -> &[Modifier] { + &self.by_id + } + pub fn permanent_modifiers(&self) -> &[Modifier] { + &self.permanent + } + pub fn modifier(&self, id: &str) -> Option<&Modifier> { + self.by_id.iter().find(|m| m.id() == id) + } + pub fn operation_modifiers(&self, op: Operation) -> impl Iterator { + self.operations[op as usize].iter().flat_map(|m| m.values()) + } + fn mark_dirty( + &mut self, + observer: &mut O, + ) -> Result<(), AttributeError> { + self.dirty = true; + observer.dirty(self).map_err(AttributeError::Observer) + } + pub fn set_base_value( + &mut self, + value: f64, + observer: &mut O, + ) -> Result<(), AttributeError> { + if value == self.base { + return Ok(()); + } + self.base = value; + self.mark_dirty(observer) + } + fn insert_operation(&mut self, m: Modifier) { + self.operations[m.operation() as usize] + .get_or_insert_with(OperationMap::default) + .put(m); + } + pub fn add_transient( + &mut self, + m: Modifier, + observer: &mut O, + ) -> Result<(), AttributeError> { + if self.modifier(m.id()).is_some() { + return Err(AttributeError::DuplicateModifier(m.id().into())); + } + self.by_id.push(m.clone()); + self.insert_operation(m); + self.mark_dirty(observer) + } + pub fn add_or_update_transient( + &mut self, + m: Modifier, + observer: &mut O, + ) -> Result<(), AttributeError> { + let old = array_put(&mut self.by_id, m.clone()); + if old.is_some_and(|old| m.same_identity(&old)) { + return Ok(()); + } + // Native replacement retains an older operation bucket for the same ID. + self.insert_operation(m); + self.mark_dirty(observer) + } + pub fn add_permanent( + &mut self, + m: Modifier, + observer: &mut O, + ) -> Result<(), AttributeError> { + self.add_transient(m.clone(), observer)?; + array_put(&mut self.permanent, m); + Ok(()) + } + pub fn add_or_replace_permanent( + &mut self, + m: Modifier, + observer: &mut O, + ) -> Result<(), AttributeError> { + self.remove(m.id(), observer)?; + self.add_permanent(m, observer) + } + pub fn add_permanent_many( + &mut self, + mods: impl IntoIterator, + observer: &mut O, + ) -> Result<(), AttributeError> { + for m in mods { + self.add_permanent(m, observer)?; + } + Ok(()) + } + pub fn remove( + &mut self, + id: &str, + observer: &mut O, + ) -> Result> { + let Some(index) = self.by_id.iter().position(|m| m.id() == id) else { + return Ok(false); + }; + let old = self.by_id.remove(index); + self.operations[old.operation() as usize] + .get_or_insert_with(OperationMap::default) + .remove(&old); + if let Some(i) = self.permanent.iter().position(|m| m.id() == id) { + self.permanent.remove(i); + } + self.mark_dirty(observer)?; + Ok(true) + } + pub fn remove_all( + &mut self, + observer: &mut O, + ) -> Result<(), AttributeError> { + let snapshot = self.by_id.clone(); + for m in snapshot { + self.remove(m.id(), observer)?; + } + Ok(()) + } + pub fn value(&mut self) -> f64 { + if self.dirty { + let mut base = self.base; + for m in self.operation_modifiers(Operation::AddValue) { + base += m.amount(); + } + let mut value = base; + for m in self.operation_modifiers(Operation::AddMultipliedBase) { + value += base * m.amount(); + } + for m in self.operation_modifiers(Operation::AddMultipliedTotal) { + value *= 1.0 + m.amount(); + } + self.cached = self.definition.sanitize(value); + self.dirty = false; + } + self.cached + } + pub fn replace_from( + &mut self, + source: &Self, + observer: &mut O, + ) -> Result<(), AttributeError> { + self.base = source.base; + self.by_id = source.by_id.clone(); + self.permanent = source.permanent.clone(); + self.operations = std::array::from_fn(|i| { + source.operations[i] + .as_ref() + .map(OperationMap::copy_for_replace) + }); + self.mark_dirty(observer) + } + /// Java's replaceFrom(this) clears all three maps before copying them. + pub fn replace_from_self( + &mut self, + observer: &mut O, + ) -> Result<(), AttributeError> { + self.by_id.clear(); + self.permanent.clear(); + self.operations = [None, None, None]; + self.mark_dirty(observer) + } + pub fn pack(&self) -> Packed { + Packed { + base: self.base, + modifiers: self.permanent.clone(), + } + } + /// Packed data merges into existing maps; it does not clear transient state. + pub fn apply( + &mut self, + packed: &Packed, + observer: &mut O, + ) -> Result<(), AttributeError> { + self.base = packed.base; + for m in &packed.modifiers { + array_put(&mut self.by_id, m.clone()); + self.insert_operation(m.clone()); + array_put(&mut self.permanent, m.clone()); + } + self.mark_dirty(observer) + } +} +fn array_put(map: &mut Vec, m: Modifier) -> Option { + if let Some(old) = map.iter_mut().find(|v| v.id() == m.id()) { + Some(std::mem::replace(old, m)) + } else { + map.push(m); + None + } +} diff --git a/crates/horizon-world/src/attributes/operation_map.rs b/crates/horizon-world/src/attributes/operation_map.rs new file mode 100644 index 000000000..faa152094 --- /dev/null +++ b/crates/horizon-world/src/attributes/operation_map.rs @@ -0,0 +1,104 @@ +//! The pinned operation buckets use open-addressed maps. Preserve their slot +//! iteration order because reassociating floating-point modifiers changes values. +use super::Modifier; +#[derive(Clone, Debug)] +pub(super) struct OperationMap { + slots: Vec>, + len: usize, +} +impl Default for OperationMap { + fn default() -> Self { + Self { + slots: vec![None; 32], + len: 0, + } + } +} +fn mixed(m: &Modifier) -> usize { + let h = m.0.hash.wrapping_mul(0x9e37_79b9); + (h ^ (h >> 16)) as usize +} +fn capacity(len: usize) -> usize { + ((len as f64 / 0.75).ceil() as usize) + .max(2) + .next_power_of_two() +} +impl OperationMap { + pub(super) fn values(&self) -> impl Iterator { + self.slots.iter().rev().filter_map(Option::as_ref) + } + fn max_fill(&self) -> usize { + self.slots.len() * 3 / 4 + } + fn find(&self, m: &Modifier) -> usize { + let mask = self.slots.len() - 1; + let mut p = mixed(m) & mask; + while self.slots[p].as_ref().is_some_and(|old| old.id() != m.id()) { + p = (p + 1) & mask; + } + p + } + pub(super) fn put(&mut self, m: Modifier) { + let p = self.find(&m); + let new = self.slots[p].is_none(); + self.slots[p] = Some(m); + if new { + let old = self.len; + self.len += 1; + if old >= self.max_fill() { + self.rehash(capacity(self.len + 1)); + } + } + } + fn rehash(&mut self, n: usize) { + let old = std::mem::replace(&mut self.slots, vec![None; n]); + for m in old.into_iter().rev().flatten() { + let p = self.find(&m); + self.slots[p] = Some(m); + } + } + pub(super) fn remove(&mut self, m: &Modifier) { + let p = self.find(m); + if self.slots[p].is_none() { + return; + } + self.len -= 1; + let mask = self.slots.len() - 1; + let mut hole = p; + loop { + let mut p = (hole + 1) & mask; + loop { + let Some(key) = self.slots[p].as_ref() else { + self.slots[hole] = None; + if self.slots.len() > 32 && self.len < self.max_fill() / 4 { + self.rehash(self.slots.len() / 2); + } + return; + }; + let home = mixed(key) & mask; + let moves = if hole <= p { + hole >= home || home > p + } else { + hole >= home && home > p + }; + if moves { + break; + } + p = (p + 1) & mask; + } + self.slots[hole] = self.slots[p].take(); + hole = p; + } + } + pub(super) fn copy_for_replace(&self) -> Self { + let mut result = Self::default(); + let n = capacity(self.len); + if n > result.slots.len() { + result.rehash(n); + } + for m in self.values() { + result.put(m.clone()); + } + result + } +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 304021db7..b941a4012 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -1,6 +1,7 @@ //! Vanilla-compatible world data for Horizon. This crate does not run gameplay. #![forbid(unsafe_code)] +pub mod attributes; pub mod block_collision; pub mod block_collision_scan; pub mod block_entities; diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index f4fca057e..7b3b4088f 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1095,3 +1095,23 @@ A Rust-only budget check verifies that exhaustion preserves the two sound-pitch random draws. Targeted Clippy passes. Sound identities and effect sinks are controlled; audio playback, particle simulation/rendering and full gameplay integration remain pending. + + +`attributes` implements basic/ranged attribute instances, ordered modifiers, +three-stage value calculation, cache invalidation and permanent-state packing. +Modifier clones retain reference identity for transient-update notifications. +Per-operation maps preserve native hash-table iteration, growth and deletion +order because modifier arithmetic is sensitive to floating-point association. +The implementation also retains native partial writes when a dirty observer +fails, stale operation entries after operation-changing updates, merge-on-apply +semantics and self-replacement behavior. + +`python3 tools/test_attribute_parity.py` compares actual `AttributeInstance` +methods using every registered attribute definition. The +[attribute report](../benchmarks/rust-attributes-2026-10-07/scoped-parity.json) +records **1,404,798 matching lines per JAR** across **2,391 fixtures**, including +collision clusters, resize/shrink boundaries, seeded operation sequences, +reference identity, observer cache reads/failures, nonfinite values and signed +zero. The adapter observes iterator order, as native calculation does; Java +stream traversal can differ. Targeted Clippy passes. Registry/entity/equipment +binding, packed data/network codecs and full gameplay integration remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaAttributeOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaAttributeOracle.java new file mode 100644 index 000000000..c10e9f8c4 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaAttributeOracle.java @@ -0,0 +1,43 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.lang.reflect.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.*;import net.minecraft.core.registries.*;import net.minecraft.resources.Identifier;import net.minecraft.world.entity.ai.attributes.*; +/** Actual attribute modifier storage, evaluation order and dirty callbacks. */ +public final class VanillaAttributeOracle { + static final class Stop extends RuntimeException {} + static Field dirty,cached,operations; + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + static String bits(double v){return String.format("%016x",Double.doubleToLongBits(v));} + static final class Basic extends Attribute {Basic(double value){super("horizon.fixture",value);}} + static final class Data {JsonObject op;PrintWriter out;int calls;AttributeInstance[] instances;AttributeModifier[] pool; + int identity(AttributeModifier m){if(m==null)return -1;for(int i=0;i values){var result=new StringJoiner(",");for(var m:values)result.add(Integer.toString(identity(m)));return result.length()==0?"-":result.toString();} + void changed(AttributeInstance a){try{int id=instances[0]==a?0:1;out.println("dirty "+id+" "+bits(a.getBaseValue())+" "+dirty.getBoolean(a)+" "+bits(cached.getDouble(a))+" "+a.getModifiers().size()+" "+a.getPermanentModifiers().size());if(calls++==op.get("fail").getAsInt())throw new Stop();if(op.get("read").getAsBoolean())out.println("observed "+bits(a.getValue()));}catch(IllegalAccessException e){throw new AssertionError(e);}} + @SuppressWarnings("unchecked") void state(int id)throws Exception{var a=instances[id];out.println("state "+id+" "+bits(a.getBaseValue())+" "+dirty.getBoolean(a)+" "+bits(cached.getDouble(a)));out.println("all "+refs(a.getModifiers()));out.println("permanent "+refs(a.getPermanentModifiers()));var map=(Map>)operations.get(a);for(var operation:AttributeModifier.Operation.values()){var bucket=map.get(operation);out.println("operation "+operation.ordinal()+" "+(bucket==null?"-":refs(bucket.values())));}} + } + static Field field(Class c,String name)throws Exception{var f=c.getDeclaredField(name);f.setAccessible(true);return f;} + public static void main(String[] args)throws Exception{ + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();Path dir=Path.of(args[1]);if(args[0].equals("export")){var data=new JsonArray();for(var a:BuiltInRegistries.ATTRIBUTE){var f=new JsonObject();f.addProperty("id",BuiltInRegistries.ATTRIBUTE.getKey(a).toString());f.addProperty("default",bits(a.getDefaultValue()));if(a instanceof RangedAttribute r){f.addProperty("min",bits(r.getMinValue()));f.addProperty("max",bits(r.getMaxValue()));}data.add(f);}Files.writeString(dir.resolve("attributes.json"),data.toString());return;} + dirty=field(AttributeInstance.class,"dirty");cached=field(AttributeInstance.class,"cachedValue");operations=field(AttributeInstance.class,"modifiersByOperation"); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();var d=new Data();d.out=out;var defs=f.getAsJsonArray("definitions");d.instances=new AttributeInstance[2];boolean invalid=false;for(int i=0;i<2;i++){var def=defs.get(i).getAsJsonObject();try{Attribute a=def.has("min")?new RangedAttribute("horizon.fixture",number(def.get("default")),number(def.get("min")),number(def.get("max"))):new Basic(number(def.get("default")));d.instances[i]=new AttributeInstance(Holder.direct(a),d::changed);}catch(IllegalArgumentException e){invalid=true;break;}}if(invalid){out.println("definition error");continue;} + var mods=f.getAsJsonArray("modifiers");d.pool=new AttributeModifier[mods.size()];for(int i=0;i();for(var m:op.getAsJsonArray("modifiers"))values.add(d.pool[m.getAsInt()]);a.apply(new AttributeInstance.Packed(d.instances[1-op.get("target").getAsInt()].getAttribute(),number(op.get("base")),values));break;} + case "many":{var values=new ArrayList();for(var m:op.getAsJsonArray("modifiers"))values.add(d.pool[m.getAsInt()]);a.addPermanentModifiers(values);break;} + case "value":out.println("value "+bits(a.getValue()));break; + default:throw new AssertionError();}out.println("result ok");}catch(Stop e){out.println("error observer");}catch(IllegalArgumentException e){out.println("error duplicate");} + d.state(0);d.state(1);out.println("calls "+d.calls); + } + }} + } +} diff --git a/tools/test_attribute_parity.py b/tools/test_attribute_parity.py new file mode 100644 index 000000000..7bd639ff0 --- /dev/null +++ b/tools/test_attribute_parity.py @@ -0,0 +1,105 @@ +#!/usr/bin/env python3 +"""Compare attribute modifier storage, value calculation and dirty callbacks with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(definitions): + def bits(v):return struct.pack('>d',float(v)).hex() + def definition(default=1,minimum=None,maximum=None): + d=dict(default=bits(default)) + if minimum is not None:d.update(min=bits(minimum),max=bits(maximum)) + return d + def mod(name='horizon:a',amount=.1,operation=0):return dict(id=name,amount=bits(amount),operation=operation) + def op(mode='value',**kw): + f=dict(mode=mode,target=0,source=1,modifier=0,modifiers=[],base=bits(0),fail=-1,read=False);f.update(kw);return f + def row(modifiers,ops,defs=None):return dict(definitions=defs or [definition(),definition(0,-100,100)],modifiers=modifiers,ops=ops) + basic=[mod(),mod(amount=.2,operation=1),mod(amount=.3,operation=2),mod(),mod('horizon:b',2,0)] + sequence=[op('value'),op('permanent'),op('update',modifier=1),op('update',modifier=1),op('update',modifier=3),op('value'),op('remove'),op('value'),op('clear'),op('value'),op('apply',modifiers=[0,1,2,4]),op('pack'),op('unpack',target=1),op('copy',target=1,source=0),op('copy',target=0,source=0),op('value'),op('value',target=1)] + for d in definitions:yield row(basic,sequence,defs=[d,definition()]) + values=[-float('inf'),-1e30,-1,-0.,0.,1e-40,.1,1,2,1e16,1e30,float('inf'),float('nan')] + for value in values: + for amount in values: + for operation in range(3):yield row([mod(amount=amount,operation=operation)],[op('base',base=bits(value)),op('add'),op('value'),op('value'),op('remove'),op('value')]) + for default in values: + for minimum in [-1,-0.,0.,1,float('nan')]: + for maximum in [-1,-0.,0.,1,float('nan')]:yield row([],[op('value'),op('base',base=bits(default)),op('value')],defs=[definition(default,minimum,maximum),definition()]) + for fail in range(-1,5): + for read in [False,True]: + ops=[dict(o,fail=fail,read=read) for o in sequence] + ops.extend([op('replace',modifier=4,fail=fail,read=read),op('many',modifiers=[0,4,0],fail=fail,read=read),op('value')]) + yield row(basic,ops) + names=['a','minecraft:a',':a','','minecraft:',':','horizon:','horizon:/a','a:b.c-_/0'] + yield row([mod(n,i/10,i%3) for i,n in enumerate(names)],[*[op('update',modifier=i) for i in range(len(names))],op('value'),op('clear'),op('value')]) + def java_hash(s): + h=0 + for c in s:h=(h*31+ord(c))&0xffffffff + return h + colliders=[];i=0 + while len(colliders)<128: + name='cluster_'+str(i);h=(31*java_hash('horizon')+java_hash(name))&0xffffffff;h=(h*0x9e3779b9)&0xffffffff + if (h^(h>>16))&31==31:colliders.append('horizon:'+name) + i+=1 + for operation in range(3): + pool=[mod(n,[1e16,-1e16,1,.01,-.01,7][i%6],operation) for i,n in enumerate(colliders)] + for reverse in [False,True]: + order=list(range(len(pool)));order=order[::-1] if reverse else order + ops=[] + for i in order:ops.extend([op('permanent',modifier=i),op('value')]) + ops.extend([op('copy',target=1,source=0),op('value',target=1)]) + for i in order[::2]+order[1::2]:ops.extend([op('remove',modifier=i),op('value')]) + ops.extend([op('apply',modifiers=order),op('value'),op('clear'),op('value')]);yield row(pool,ops) + rng=random.Random(0x415454524942) + for _ in range(1500): + pool=[mod(rng.choice(colliders[:40]),rng.choice(values),rng.randrange(3)) for _ in range(rng.randrange(1,90))] + ops=[op('pack')] + for i in range(rng.randrange(10,100)): + mode=rng.choice(['base','add','update','permanent','replace','remove','clear','copy','pack','unpack','apply','many','value']) + ops.append(op(mode,target=rng.randrange(2),source=rng.randrange(2),modifier=rng.randrange(len(pool)),modifiers=[rng.randrange(len(pool)) for _ in range(rng.randrange(8))],base=bits(rng.choice(values)),fail=rng.choice([-1,-1,-1,0,1,2]),read=bool(rng.randrange(2)))) + yield row(pool,ops,defs=rng.sample(definitions,2) if rng.randrange(2) else [definition(),definition(0,-100,100)]) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-attribute-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaAttributeOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/attribute_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaAttributeOracle',mode,path],side+'-'+mode) + java('server','export',build);states=json.loads((build/'attributes.json').read_text());fixtures=list(corpus(states));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs,build/'attributes.json'];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','attribute_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('attribute_fixture.exe' if os.name=='nt' else 'attribute_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} attribute output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual AttributeInstance and basic/ranged attributes, with every registered attribute definition. Native modifier identity, global/permanent insertion order, per-operation fastutil hash iteration/rehashing, cache/dirty callbacks, partial writes on observer failure, transient operation changes, duplicate rejection, bulk removal, replacement (including self), pack and merging apply. Includes nonfinite/signed-zero arithmetic, collision clusters and seeded operation sequences. Attribute registry/entity/equipment integration and packed data/network codecs remain pending.'} + lab.write_json(report_path,report);print(f'Scoped attribute parity passed: {report_path}') + + +if __name__=='__main__':main() From ddb0077c3acc6ce28adffa77d74d5d36f51fd1ec Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 04:02:38 +0200 Subject: [PATCH 104/253] Bind registered entity attribute defaults and lazy updates --- .../scoped-parity.json | 243 +++++++++++++++++ .../examples/entity_attribute_fixture.rs | 131 +++++++++ crates/horizon-world/src/attributes/entity.rs | 257 ++++++++++++++++++ crates/horizon-world/src/attributes/mod.rs | 1 + docs/collision-geometry.md | 18 ++ .../parity/VanillaEntityAttributeOracle.java | 54 ++++ tools/test_entity_attribute_parity.py | 70 +++++ 7 files changed, 774 insertions(+) create mode 100644 benchmarks/rust-entity-attributes-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/entity_attribute_fixture.rs create mode 100644 crates/horizon-world/src/attributes/entity.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityAttributeOracle.java create mode 100644 tools/test_entity_attribute_parity.py diff --git a/benchmarks/rust-entity-attributes-2026-10-07/scoped-parity.json b/benchmarks/rust-entity-attributes-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..1778d89c7 --- /dev/null +++ b/benchmarks/rust-entity-attributes-2026-10-07/scoped-parity.json @@ -0,0 +1,243 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 4720, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityAttributeOracle.java": "2ad3190a9798ab54bd12e88573028d0ca6a204e2f8a92018aae98b22335213bf", + "tools/test_entity_attribute_parity.py": "cdd15835061eb2ed8d1fbbbf77cf515ec7515b7ff129a3deaf403142ce9caead", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attributes/entity.rs": "d165e952e0ff2d1a1b037c03df5fbc778b7e263b8f9e402cf9b0fa27c933e0c6", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "172ecf965d8ccbe16ed89e8ad1471cf384e2609ab3ca25f309456e726a4d6857", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/entity_attribute_fixture.rs": "f6512186478dc1de5e5b983d81aa23f3834e85875f9fa9bec0b9967117deff95" + }, + "fixtures_sha256": { + ".local/rust-entity-attribute-parity/inputs.txt": "9a45638fedc1b8a70d247acc64dc5b06fa3e2ec550fc4a65d89173fabdd0e886", + ".local/rust-entity-attribute-parity/catalog.json": "d1e488e4f432888beb9f643904c8bca242d1e2093f53e23e07da305d70cf7106" + }, + "rust_output_sha256": "dafe9dce265957c9cafe59a6b830a68fd23a2c2e2d8de3df215ce38252ae0100", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "dafe9dce265957c9cafe59a6b830a68fd23a2c2e2d8de3df215ce38252ae0100", + "matched_output_lines": 1771555 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "dafe9dce265957c9cafe59a6b830a68fd23a2c2e2d8de3df215ce38252ae0100", + "matched_output_lines": 1771555 + } + ], + "scope": "Every registered attribute and entity DefaultAttributes supplier, actual AttributeMap per-attribute queries, lazy creation, mutation, base reset, update/sync membership and independent acknowledgements. Composes the verified attribute arithmetic/cache/modifier engine. Cross-attribute collection order is normalized to registry order; bulk assignment, custom suppliers with modifiers, save/network codecs, live entities and full gameplay remain pending." +} diff --git a/crates/horizon-world/examples/entity_attribute_fixture.rs b/crates/horizon-world/examples/entity_attribute_fixture.rs new file mode 100644 index 000000000..eb1bc8358 --- /dev/null +++ b/crates/horizon-world/examples/entity_attribute_fixture.rs @@ -0,0 +1,131 @@ +use horizon_world::attributes::{ + AttributeError, Modifier, Operation, + entity::{Catalog, LookupError}, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, + sync::Arc, +}; +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn bits(v: f64) -> u64 { + if v.is_nan() { + f64::NAN.to_bits() + } else { + v.to_bits() + } +} +fn lookup(out: &mut dyn Write, label: &str, result: Result) -> io::Result<()> { + match result { + Ok(v) => { + writeln!(out, "{label} {:016x}", bits(v))?; + writeln!(out, "ok") + } + Err(e) => writeln!( + out, + "error {}", + match e { + LookupError::MissingAttribute => "attribute", + LookupError::MissingModifier => "modifier", + LookupError::InstanceMissingModifier => "instance_modifier", + } + ), + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let catalog = Arc::new(Catalog::from_json(&serde_json::from_str( + &fs::read_to_string(dir.join("catalog.json"))?, + )?)?); + let ids: Vec<_> = catalog.attributes().map(|(id, _)| id).collect(); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut map = catalog.create(f["entity"].as_str().unwrap()).unwrap(); + for op in f["ops"].as_array().unwrap() { + let id = ids[op["attribute"].as_u64().unwrap() as usize]; + let mode = op["mode"].as_str().unwrap(); + let modifier = Modifier::new( + op["id"].as_str().unwrap(), + number(&op["amount"]), + Operation::ALL[op["operation"].as_u64().unwrap() as usize], + )?; + match mode { + "value" => lookup(&mut out, "value", map.value(id))?, + "base" => lookup(&mut out, "base", map.base_value(id))?, + "modifier" => lookup(&mut out, "modifier", map.modifier_value(id, modifier.id()))?, + "has" => { + writeln!(out, "has {}\nok", map.has(id))?; + } + "has_modifier" => { + writeln!( + out, + "has_modifier {}\nok", + map.has_modifier(id, modifier.id()) + )?; + } + "ensure" => { + writeln!(out, "ensure {}\nok", map.ensure(id))?; + } + "reset" => { + writeln!(out, "reset {}\nok", map.reset_base(id))?; + } + "ack_update" => { + map.clear_update(id); + writeln!(out, "ok")?; + } + "ack_sync" => { + map.clear_sync(id); + writeln!(out, "ok")?; + } + _ => { + let mut removed = None; + let result = map.edit(id, |a, o| match mode { + "set" => a.set_base_value(number(&op["base"]), o), + "add" => a.add_transient(modifier.clone(), o), + "update" => a.add_or_update_transient(modifier.clone(), o), + "permanent" => a.add_permanent(modifier.clone(), o), + "remove" => a.remove(modifier.id(), o).map(|v| { + removed = Some(v); + }), + "clear" => a.remove_all(o), + _ => panic!("mode"), + }); + if let Some(v) = removed { + writeln!(out, "removed {v}")?; + } + match result { + None => writeln!(out, "absent\nok")?, + Some(Ok(())) => writeln!(out, "ok")?, + Some(Err(AttributeError::DuplicateModifier(_))) => { + writeln!(out, "error duplicate")? + } + Some(Err(AttributeError::Observer(e))) => match e {}, + } + } + } + for (i, id) in ids.iter().copied().enumerate() { + if let Some(a) = map.instance(id) { + writeln!( + out, + "state {i} {:016x} {} {:016x} {} {} {} {}", + bits(a.base_value()), + a.is_dirty(), + bits(a.cached_value()), + map.needs_update(id), + map.needs_sync(id), + a.modifiers().len(), + a.permanent_modifiers().len() + )?; + } + } + writeln!(out, "end")?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/src/attributes/entity.rs b/crates/horizon-world/src/attributes/entity.rs new file mode 100644 index 000000000..0990cf21f --- /dev/null +++ b/crates/horizon-world/src/attributes/entity.rs @@ -0,0 +1,257 @@ +//! Registered entity defaults and lazy attribute instances. Cross-attribute bulk +//! mutation/serialization order is deliberately outside this per-attribute API. +use super::{Definition, Instance, Observer}; +use crate::{DATA_VERSION, compression::invalid}; +use serde_json::Value; +use std::{collections::BTreeMap, convert::Infallible, io, sync::Arc}; + +#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct AttributeId(usize); +#[derive(Debug)] +pub struct RegisteredAttribute { + pub name: String, + pub definition: Definition, + pub syncable: bool, +} +#[derive(Debug)] +pub struct Catalog { + attributes: Vec, + ids: BTreeMap, + defaults: BTreeMap>>, +} +fn string(v: &Value) -> io::Result<&str> { + v.as_str() + .ok_or_else(|| invalid("expected attribute string")) +} +fn number(v: &Value) -> io::Result { + let s = string(v)?; + if s.len() != 16 { + return Err(invalid("expected 16-digit attribute double bits")); + } + Ok(f64::from_bits( + u64::from_str_radix(s, 16).map_err(|e| invalid(e.to_string()))?, + )) +} +impl Catalog { + /// Imports a version-checked export of registered definitions and actual + /// DefaultAttributes suppliers. Defaults contain base values, not instances. + pub fn from_json(v: &Value) -> io::Result { + if v["data_version"].as_i64() != Some(i64::from(DATA_VERSION)) { + return Err(invalid("attribute catalog data version mismatch")); + } + let mut attributes = Vec::new(); + let mut ids = BTreeMap::new(); + for a in v["attributes"] + .as_array() + .ok_or_else(|| invalid("missing attributes"))? + { + let name = string(&a["id"])?; + // Identifier normalization is shared with modifier IDs. + let canonical = super::Modifier::new(name, 0.0, super::Operation::AddValue)?; + if canonical.id() != name + || ids + .insert(name.into(), AttributeId(attributes.len())) + .is_some() + { + return Err(invalid("noncanonical or duplicate attribute identifier")); + } + let default = number(&a["default"])?; + let definition = if a.get("min").is_some() { + Definition::ranged(default, number(&a["min"])?, number(&a["max"])?)? + } else { + Definition::basic(default) + }; + attributes.push(RegisteredAttribute { + name: name.into(), + definition, + syncable: a["syncable"] + .as_bool() + .ok_or_else(|| invalid("missing attribute sync flag"))?, + }); + } + let mut defaults = BTreeMap::new(); + for (entity, values) in v["entities"] + .as_object() + .ok_or_else(|| invalid("missing entity defaults"))? + { + let mut bases = vec![None; attributes.len()]; + for (name, base) in values + .as_object() + .ok_or_else(|| invalid("invalid entity supplier"))? + { + let id = ids + .get(name) + .ok_or_else(|| invalid("unknown supplier attribute"))?; + bases[id.0] = Some(number(base)?); + } + defaults.insert(entity.clone(), bases); + } + Ok(Self { + attributes, + ids, + defaults, + }) + } + pub fn id(&self, name: &str) -> Option { + self.ids.get(name).copied() + } + pub fn attribute(&self, id: AttributeId) -> &RegisteredAttribute { + &self.attributes[id.0] + } + pub fn attributes(&self) -> impl Iterator { + self.attributes + .iter() + .enumerate() + .map(|(i, a)| (AttributeId(i), a)) + } + pub fn entities(&self) -> impl Iterator { + self.defaults.keys().map(String::as_str) + } + pub fn create(self: &Arc, entity: &str) -> Option { + let bases = self.defaults.get(entity)?.clone(); + let n = bases.len(); + Some(EntityAttributes { + catalog: self.clone(), + bases, + instances: vec![None; n], + updates: vec![false; n], + sync: vec![false; n], + }) + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum LookupError { + MissingAttribute, + MissingModifier, + InstanceMissingModifier, +} +/// Membership in the native update/sync sets, with no JVM identity-hash order +/// promise. Clearing a flag acknowledges that particular pending update. +pub struct DirtyObserver<'a> { + update: &'a mut bool, + sync: &'a mut bool, + syncable: bool, +} +impl Observer for DirtyObserver<'_> { + type Error = Infallible; + fn dirty(&mut self, _: &mut Instance) -> Result<(), Infallible> { + *self.update = true; + if self.syncable { + *self.sync = true; + } + Ok(()) + } +} +pub struct EntityAttributes { + catalog: Arc, + bases: Vec>, + instances: Vec>, + updates: Vec, + sync: Vec, +} +impl EntityAttributes { + pub fn catalog(&self) -> &Arc { + &self.catalog + } + pub fn has(&self, id: AttributeId) -> bool { + self.bases[id.0].is_some() + } + pub fn instance(&self, id: AttributeId) -> Option<&Instance> { + self.instances[id.0].as_ref() + } + /// Merely querying a default value must not instantiate or dirty it. + pub fn value(&mut self, id: AttributeId) -> Result { + if let Some(a) = self.instances[id.0].as_mut() { + return Ok(a.value()); + } + let base = self.bases[id.0].ok_or(LookupError::MissingAttribute)?; + Ok(self.catalog.attribute(id).definition.sanitize(base)) + } + pub fn base_value(&self, id: AttributeId) -> Result { + self.instances[id.0] + .as_ref() + .map(Instance::base_value) + .or(self.bases[id.0]) + .ok_or(LookupError::MissingAttribute) + } + pub fn has_modifier(&self, id: AttributeId, modifier: &str) -> bool { + self.instance(id) + .and_then(|a| a.modifier(modifier)) + .is_some() + } + pub fn modifier_value(&self, id: AttributeId, modifier: &str) -> Result { + if let Some(a) = self.instance(id) { + return a + .modifier(modifier) + .map(super::Modifier::amount) + .ok_or(LookupError::InstanceMissingModifier); + } + if self.has(id) { + Err(LookupError::MissingModifier) + } else { + Err(LookupError::MissingAttribute) + } + } + /// Native getInstance copies the supplier on first access and immediately + /// schedules an update, plus a sync when the definition is client-syncable. + pub fn ensure(&mut self, id: AttributeId) -> bool { + if self.instances[id.0].is_some() { + return true; + } + let Some(base) = self.bases[id.0] else { + return false; + }; + let definition = self.catalog.attribute(id); + let mut instance = Instance::new(definition.definition); + let mut observer = DirtyObserver { + update: &mut self.updates[id.0], + sync: &mut self.sync[id.0], + syncable: definition.syncable, + }; + // Registered default suppliers have no modifiers. replaceFrom always + // invalidates even when the supplier base equals the registered default. + let mut source = Instance::new(definition.definition); + source.base = base; + instance.replace_from(&source, &mut observer).unwrap(); + self.instances[id.0] = Some(instance); + true + } + /// Mutations must use the supplied observer to preserve dirty memberships. + pub fn edit( + &mut self, + id: AttributeId, + f: impl FnOnce(&mut Instance, &mut DirtyObserver<'_>) -> R, + ) -> Option { + if !self.ensure(id) { + return None; + } + let mut observer = DirtyObserver { + update: &mut self.updates[id.0], + sync: &mut self.sync[id.0], + syncable: self.catalog.attribute(id).syncable, + }; + Some(f(self.instances[id.0].as_mut().unwrap(), &mut observer)) + } + /// Reset uses the entity supplier's base, without creating a missing instance. + pub fn reset_base(&mut self, id: AttributeId) -> bool { + let Some(base) = self.bases[id.0] else { + return false; + }; + if self.instances[id.0].is_some() { + self.edit(id, |a, o| a.set_base_value(base, o).unwrap()); + } + true + } + pub fn needs_update(&self, id: AttributeId) -> bool { + self.updates[id.0] + } + pub fn needs_sync(&self, id: AttributeId) -> bool { + self.sync[id.0] + } + pub fn clear_update(&mut self, id: AttributeId) { + self.updates[id.0] = false; + } + pub fn clear_sync(&mut self, id: AttributeId) { + self.sync[id.0] = false; + } +} diff --git a/crates/horizon-world/src/attributes/mod.rs b/crates/horizon-world/src/attributes/mod.rs index 9e94cd1c2..9c3d6f20e 100644 --- a/crates/horizon-world/src/attributes/mod.rs +++ b/crates/horizon-world/src/attributes/mod.rs @@ -1,6 +1,7 @@ //! Ordered attribute modifiers, native cache invalidation and permanent state. use crate::compression::invalid; use std::{fmt, io, sync::Arc}; +pub mod entity; mod operation_map; use operation_map::OperationMap; #[derive(Clone, Copy, Debug, PartialEq, Eq)] diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 7b3b4088f..700b7c18b 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1115,3 +1115,21 @@ reference identity, observer cache reads/failures, nonfinite values and signed zero. The adapter observes iterator order, as native calculation does; Java stream traversal can differ. Targeted Clippy passes. Registry/entity/equipment binding, packed data/network codecs and full gameplay integration remain pending. + + +`attributes::entity` imports version-checked attribute definitions and entity +supplier bases, and composes them with the attribute engine. Reads fall back to +the supplier without creating instances; first instance access schedules an +update and a sync for client-syncable attributes. Mutations retain those set +memberships until individually acknowledged. Base resets use the entity's +supplier value and do not instantiate absent entries. Missing attributes and +missing modifiers remain distinguishable, including lookup after instantiation. + +`python3 tools/test_entity_attribute_parity.py` compares actual `AttributeMap` +operations with **40 registered attributes** and **93 entity suppliers**. The +[entity attribute report](../benchmarks/rust-entity-attributes-2026-10-07/scoped-parity.json) +records **1,771,555 matching lines per JAR** across **4,720 fixtures**. Targeted +Clippy passes. The exporter asserts that registered default suppliers contain no +modifiers. Set membership is observed in registry order: this does not establish +JVM identity-hash collection order, cross-attribute bulk assignment/serialization, +custom suppliers, equipment integration or a live entity tick. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityAttributeOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityAttributeOracle.java new file mode 100644 index 000000000..d86f73f78 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityAttributeOracle.java @@ -0,0 +1,54 @@ +package dev.horizonlab.parity; +import com.google.gson.*; +import java.io.*;import java.lang.reflect.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.*;import net.minecraft.core.registries.*; +import net.minecraft.resources.Identifier; +import net.minecraft.world.entity.*; +import net.minecraft.world.entity.ai.attributes.*; +/** Native lazy entity attributes; set membership is observed in registry order. */ +public final class VanillaEntityAttributeOracle { + static String bits(double v){return String.format("%016x",Double.doubleToLongBits(v));} + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + static Field field(Class c,String n)throws Exception{var f=c.getDeclaredField(n);f.setAccessible(true);return f;} + static List> attributes=new ArrayList<>(); + static JsonObject export()throws Exception { + var root=new JsonObject();root.addProperty("data_version",net.minecraft.SharedConstants.getCurrentVersion().dataVersion().version()); + var defs=new JsonArray(); + for(var a:attributes){var v=a.value();var d=new JsonObject();d.addProperty("id",a.getRegisteredName());d.addProperty("default",bits(v.getDefaultValue()));d.addProperty("syncable",v.isClientSyncable());if(v instanceof RangedAttribute r){d.addProperty("min",bits(r.getMinValue()));d.addProperty("max",bits(r.getMaxValue()));}defs.add(d);} + root.add("attributes",defs);var entities=new JsonObject(); + for(var e:BuiltInRegistries.ENTITY_TYPE){if(!DefaultAttributes.hasSupplier(e))continue;var supplier=supplier(e);var bases=new JsonObject();for(var a:attributes)if(supplier.hasAttribute(a)){var instance=supplier.createInstance(v->{},a);if(!instance.getModifiers().isEmpty())throw new AssertionError("default modifiers require export support");bases.addProperty(a.getRegisteredName(),bits(supplier.getBaseValue(a)));}entities.add(BuiltInRegistries.ENTITY_TYPE.getKey(e).toString(),bases);} + root.add("entities",entities);return root; + } + @SuppressWarnings("unchecked") static AttributeSupplier supplier(EntityType e){return DefaultAttributes.getSupplier((EntityType)e);} + @SuppressWarnings("unchecked") public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap(); + for(var a:BuiltInRegistries.ATTRIBUTE)attributes.add(BuiltInRegistries.ATTRIBUTE.wrapAsHolder(a)); + Path dir=Path.of(args[1]);if(args[0].equals("export")){Files.writeString(dir.resolve("catalog.json"),export().toString());return;} + var storage=field(AttributeMap.class,"attributes");var dirty=field(AttributeInstance.class,"dirty");var cached=field(AttributeInstance.class,"cachedValue"); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();var entity=BuiltInRegistries.ENTITY_TYPE.getValue(Identifier.parse(f.get("entity").getAsString()));var map=new AttributeMap(supplier(entity));var instances=(Map,AttributeInstance>)storage.get(map); + for(var ov:f.getAsJsonArray("ops")){var op=ov.getAsJsonObject();var a=attributes.get(op.get("attribute").getAsInt());String mode=op.get("mode").getAsString();var id=Identifier.parse(op.get("id").getAsString()); + try{switch(mode){ + case "value":out.println("value "+bits(map.getValue(a)));break; + case "base":out.println("base "+bits(map.getBaseValue(a)));break; + case "has":out.println("has "+map.hasAttribute(a));break; + case "modifier":out.println("modifier "+bits(map.getModifierValue(a,id)));break; + case "has_modifier":out.println("has_modifier "+map.hasModifier(a,id));break; + case "ensure":out.println("ensure "+(map.getInstance(a)!=null));break; + case "reset":out.println("reset "+map.resetBaseValue(a));break; + case "ack_update":map.getAttributesToUpdate().remove(instances.get(a));break; + case "ack_sync":map.getAttributesToSync().remove(instances.get(a));break; + default:{var instance=map.getInstance(a);if(instance==null){out.println("absent");break;}var modifier=new AttributeModifier(id,number(op.get("amount")),AttributeModifier.Operation.values()[op.get("operation").getAsInt()]);switch(mode){ + case "set":instance.setBaseValue(number(op.get("base")));break; + case "add":instance.addTransientModifier(modifier);break; + case "update":instance.addOrUpdateTransientModifier(modifier);break; + case "permanent":instance.addPermanentModifier(modifier);break; + case "remove":out.println("removed "+instance.removeModifier(id));break; + case "clear":instance.removeModifiers();break; + default:throw new AssertionError(mode); + }} + }out.println("ok");}catch(NullPointerException e){out.println("error instance_modifier");}catch(IllegalArgumentException e){out.println("error "+(mode.equals("modifier")?(map.hasAttribute(a)?"modifier":"attribute"):(mode.equals("value")||mode.equals("base")?"attribute":"duplicate")));} + for(int i=0;id',float(v)).hex() + def op(mode,attribute,**kw): + value=dict(mode=mode,attribute=attribute,id='horizon:a',amount=bits(.125),operation=0,base=bits(7));value.update(kw);return value + n=len(catalog['attributes']) + values=[-float('inf'),-1e30,-1.,-0.,0.,1e-40,.1,1.,2.,1e16,1e30,float('inf'),float('nan')] + for entity in catalog['entities']: + for i in range(n): + ops=[op(mode,i) for mode in ['has','base','value','modifier','has_modifier','reset','ensure','modifier','ack_update','ack_sync','value','set','base','value','reset','value','ack_update','ack_sync','add','value','modifier','has_modifier','add','permanent','update','value','remove','value','permanent','value','reset','value','clear','value','ack_sync','ack_update']] + for operation in range(3):ops.extend([op('update',i,operation=operation),op('value',i)]) + yield dict(entity=entity,ops=ops) + rng=random.Random(0x454e54415454) + entities=list(catalog['entities']) + for _ in range(1000): + entity=rng.choice(entities);ops=[] + for __ in range(rng.randrange(20,160)): + ops.append(op(rng.choice(['has','base','value','modifier','has_modifier','reset','ensure','ack_update','ack_sync','set','add','update','permanent','remove','clear']),rng.randrange(n),id=rng.choice(['horizon:a','horizon:b','horizon:c']),amount=bits(rng.choice(values)),base=bits(rng.choice(values)),operation=rng.randrange(3))) + yield dict(entity=entity,ops=ops) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-entity-attribute-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityAttributeOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/entity_attribute_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaEntityAttributeOracle',mode,path],side+'-'+mode) + java('server','export',build);states=json.loads((build/'catalog.json').read_text());fixtures=list(corpus(states));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs,build/'catalog.json'];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','entity_attribute_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('entity_attribute_fixture.exe' if os.name=='nt' else 'entity_attribute_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} entity attribute output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Every registered attribute and entity DefaultAttributes supplier, actual AttributeMap per-attribute queries, lazy creation, mutation, base reset, update/sync membership and independent acknowledgements. Composes the verified attribute arithmetic/cache/modifier engine. Cross-attribute collection order is normalized to registry order; bulk assignment, custom suppliers with modifiers, save/network codecs, live entities and full gameplay remain pending.'} + lab.write_json(report_path,report);print(f'Scoped entity attribute parity passed: {report_path}') + + +if __name__=='__main__':main() From 691c2e5b973ccea3b427840aa48a5e961c8f7ee1 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 04:07:48 +0200 Subject: [PATCH 105/253] Implement vanilla hunger, exhaustion, regeneration and starvation ticks --- .../rust-food-2026-10-07/scoped-parity.json | 243 ++++++++++++++++++ crates/horizon-world/examples/food_fixture.rs | 145 +++++++++++ crates/horizon-world/src/food.rs | 135 ++++++++++ crates/horizon-world/src/lib.rs | 1 + docs/collision-geometry.md | 16 ++ .../horizonlab/parity/VanillaFoodOracle.java | 48 ++++ tools/test_food_parity.py | 84 ++++++ 7 files changed, 672 insertions(+) create mode 100644 benchmarks/rust-food-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/food_fixture.rs create mode 100644 crates/horizon-world/src/food.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFoodOracle.java create mode 100644 tools/test_food_parity.py diff --git a/benchmarks/rust-food-2026-10-07/scoped-parity.json b/benchmarks/rust-food-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..5226956f0 --- /dev/null +++ b/benchmarks/rust-food-2026-10-07/scoped-parity.json @@ -0,0 +1,243 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 15211, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFoodOracle.java": "9219213c9ff960d0eee7ec250ea920aa4db5d0ef508325553c3e4203d32356a1", + "tools/test_food_parity.py": "c81fcc4430787416da5f0747eb657cee83269eb4ec7a5d35330691303c0e96fe", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attributes/entity.rs": "d165e952e0ff2d1a1b037c03df5fbc778b7e263b8f9e402cf9b0fa27c933e0c6", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "9cec72b2510d3ce46cf7ff844fbbea55e0fc8dbb1995187ee3a964b621fbcbf5", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/food_fixture.rs": "af283fa5c04667da40a283c3c5eafce781d110abdfe274b6f9b18d5a6783ebf0" + }, + "fixtures_sha256": { + ".local/rust-food-parity/inputs.txt": "50837fa91cc6a8354a10cd6a02584ca6e41656eea5e0ecbebe407b04fa6dbe48" + }, + "rust_output_sha256": "5f63f3351ef5c24dc26b3a499eaba730bc4996311cf24d34dd2707632665d464", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "5f63f3351ef5c24dc26b3a499eaba730bc4996311cf24d34dd2707632665d464", + "matched_output_lines": 180878 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "5f63f3351ef5c24dc26b3a499eaba730bc4996311cf24d34dd2707632665d464", + "matched_output_lines": 180878 + } + ], + "scope": "Actual FoodData eating/properties, exhaustion, hunger predicates and server tick, including query order, mutations/failures, regeneration thresholds, starvation difficulty/health guards, signed-zero/nonfinite values and integer overflow. Player healing/damage and world queries are controlled; full damage/health, consumables, persistence and playable integration remain pending." +} diff --git a/crates/horizon-world/examples/food_fixture.rs b/crates/horizon-world/examples/food_fixture.rs new file mode 100644 index 000000000..d0645ea44 --- /dev/null +++ b/crates/horizon-world/examples/food_fixture.rs @@ -0,0 +1,145 @@ +use horizon_world::food::{Difficulty, FoodData, FoodWorld}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn single(v: &Value) -> f32 { + f32::from_bits(u32::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn bits(v: f32) -> u32 { + if v.is_nan() { + f32::NAN.to_bits() + } else { + v.to_bits() + } +} +fn state(v: &Value) -> FoodData { + FoodData { + food: v["food"].as_i64().unwrap() as i32, + saturation: single(&v["saturation"]), + exhaustion: single(&v["exhaustion"]), + timer: v["timer"].as_i64().unwrap() as i32, + } +} +struct World<'a> { + f: &'a Value, + out: &'a mut dyn Write, + calls: i64, + changed: bool, +} +impl World<'_> { + fn query(&mut self, food: &mut FoodData, s: &str) -> io::Result<()> { + writeln!(self.out, "{s}")?; + let n = self.calls; + self.calls += 1; + if n == self.f["fail"].as_i64().unwrap() { + return Err(io::Error::other("injected food callback failure")); + } + if n == self.f["mutate_at"].as_i64().unwrap() { + *food = state(&self.f["after"]); + self.changed = true; + } + Ok(()) + } + fn world(&self) -> &Value { + &self.f[if self.changed { "after_world" } else { "world" }] + } +} +impl FoodWorld for World<'_> { + type Error = io::Error; + type Level = (); + fn level(&mut self, f: &mut FoodData) -> io::Result<()> { + self.query(f, "level") + } + fn difficulty(&mut self, _: (), f: &mut FoodData) -> io::Result { + self.query(f, "difficulty")?; + Ok([ + Difficulty::Peaceful, + Difficulty::Easy, + Difficulty::Normal, + Difficulty::Hard, + ][self.world()["difficulty"].as_u64().unwrap() as usize]) + } + fn natural_regeneration(&mut self, _: (), f: &mut FoodData) -> io::Result { + self.query(f, "rules")?; + self.query(f, "regeneration")?; + Ok(self.world()["regen"].as_bool().unwrap()) + } + fn is_hurt(&mut self, f: &mut FoodData) -> io::Result { + self.query(f, "is-hurt")?; + Ok(self.world()["hurt"].as_bool().unwrap()) + } + fn heal(&mut self, f: &mut FoodData, v: f32) -> io::Result<()> { + self.query(f, &format!("heal {:08x}", bits(v))) + } + fn health(&mut self, f: &mut FoodData) -> io::Result { + self.query(f, "health")?; + Ok(single(&self.world()["health"])) + } + fn hurt_starvation(&mut self, _: (), f: &mut FoodData, v: f32) -> io::Result<()> { + self.query(f, "damage-sources")?; + self.query(f, "starve-source")?; + self.query(f, &format!("hurt {:08x}", bits(v))) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut food = state(&f["initial"]); + let mut w = World { + f: &f, + out: &mut out, + calls: 0, + changed: false, + }; + let mut error = false; + for op in f["ops"].as_array().unwrap() { + match op["mode"].as_str().unwrap() { + "eat" => food.eat( + op["nutrition"].as_i64().unwrap() as i32, + single(&op["amount"]), + ), + "properties" => food.eat_properties( + op["nutrition"].as_i64().unwrap() as i32, + single(&op["amount"]), + ), + "exhaust" => food.add_exhaustion(single(&op["amount"])), + "food" => food.food = op["nutrition"].as_i64().unwrap() as i32, + "saturation" => food.saturation = single(&op["amount"]), + "tick" => { + if food.tick(&mut w).is_err() { + error = true; + break; + } + } + _ => panic!("mode"), + } + writeln!( + w.out, + "state {} {:08x} {:08x} {} {} {}", + food.food, + bits(food.saturation), + bits(food.exhaustion), + food.timer, + food.has_enough_food(), + food.needs_food() + )?; + } + writeln!(w.out, "result {}", if error { "error" } else { "ok" })?; + writeln!( + w.out, + "final {} {:08x} {:08x} {}", + food.food, + bits(food.saturation), + bits(food.exhaustion), + food.timer + )?; + writeln!(w.out, "queries {}", w.calls)?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/food.rs b/crates/horizon-world/src/food.rs new file mode 100644 index 000000000..77c931d6f --- /dev/null +++ b/crates/horizon-world/src/food.rs @@ -0,0 +1,135 @@ +//! Hunger, saturation, exhaustion and server-side natural regeneration. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum Difficulty { + Peaceful, + Easy, + Normal, + Hard, +} +#[derive(Clone, Copy, Debug)] +pub struct FoodData { + pub food: i32, + pub saturation: f32, + pub exhaustion: f32, + pub timer: i32, +} +impl Default for FoodData { + fn default() -> Self { + Self { + food: 20, + saturation: 5.0, + exhaustion: 0.0, + timer: 0, + } + } +} +fn min(a: f32, b: f32) -> f32 { + if a.is_nan() || b.is_nan() { + f32::NAN + } else if a == 0.0 && b == 0.0 { + f32::from_bits(a.to_bits() | b.to_bits()) + } else { + a.min(b) + } +} +fn max(a: f32, b: f32) -> f32 { + if a.is_nan() || b.is_nan() { + f32::NAN + } else if a == 0.0 && b == 0.0 { + f32::from_bits(a.to_bits() & b.to_bits()) + } else { + a.max(b) + } +} +fn clamp(v: f32, lo: f32, hi: f32) -> f32 { + if v < lo { lo } else { min(v, hi) } +} +impl FoodData { + pub fn eat(&mut self, nutrition: i32, saturation_modifier: f32) { + self.eat_properties(nutrition, nutrition as f32 * saturation_modifier * 2.0); + } + pub fn eat_properties(&mut self, nutrition: i32, saturation: f32) { + self.food = nutrition.wrapping_add(self.food).clamp(0, 20); + self.saturation = clamp(saturation + self.saturation, 0.0, self.food as f32); + } + pub fn add_exhaustion(&mut self, value: f32) { + self.exhaustion = min(self.exhaustion + value, 40.0); + } + pub fn has_enough_food(&self) -> bool { + self.food as f32 > 6.0 + } + pub fn needs_food(&self) -> bool { + self.food < 20 + } + pub fn tick(&mut self, world: &mut W) -> Result<(), W::Error> { + let level = world.level(self)?; + let difficulty = world.difficulty(level, self)?; + if self.exhaustion > 4.0 { + self.exhaustion -= 4.0; + if self.saturation > 0.0 { + self.saturation = max(self.saturation - 1.0, 0.0); + } else if difficulty != Difficulty::Peaceful { + self.food = self.food.wrapping_sub(1).max(0); + } + } + let regenerate = world.natural_regeneration(level, self)?; + if regenerate && self.saturation > 0.0 && world.is_hurt(self)? && self.food >= 20 { + self.timer = self.timer.wrapping_add(1); + if self.timer >= 10 { + let amount = min(self.saturation, 6.0); + world.heal(self, amount / 6.0)?; + self.add_exhaustion(amount); + self.timer = 0; + } + } else if regenerate && self.food >= 18 && world.is_hurt(self)? { + self.timer = self.timer.wrapping_add(1); + if self.timer >= 80 { + world.heal(self, 1.0)?; + self.add_exhaustion(6.0); + self.timer = 0; + } + } else if self.food <= 0 { + self.timer = self.timer.wrapping_add(1); + if self.timer >= 80 { + if world.health(self)? > 10.0 + || difficulty == Difficulty::Hard + || (world.health(self)? > 1.0 && difficulty == Difficulty::Normal) + { + world.hurt_starvation(level, self, 1.0)?; + } + self.timer = 0; + } + } else { + self.timer = 0; + } + Ok(()) + } +} +/// World hooks preserve short-circuit query order. Callbacks can mutate food +/// state; errors retain earlier writes and effects. The level is captured once. +pub trait FoodWorld { + type Error; + type Level: Copy; + fn level(&mut self, food: &mut FoodData) -> Result; + fn difficulty( + &mut self, + level: Self::Level, + food: &mut FoodData, + ) -> Result; + fn natural_regeneration( + &mut self, + level: Self::Level, + food: &mut FoodData, + ) -> Result; + fn is_hurt(&mut self, food: &mut FoodData) -> Result; + fn heal(&mut self, food: &mut FoodData, amount: f32) -> Result<(), Self::Error>; + fn health(&mut self, food: &mut FoodData) -> Result; + /// Resolve the player's starvation damage source and dispatch hurtServer on + /// the captured level; the native boolean hurt result is ignored. + fn hurt_starvation( + &mut self, + level: Self::Level, + food: &mut FoodData, + amount: f32, + ) -> Result<(), Self::Error>; +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index b941a4012..3c7b725e5 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -31,6 +31,7 @@ pub mod fluid_box; pub mod fluid_flow; pub mod fluid_occupancy; pub mod fluid_shape; +pub mod food; pub mod free_space; pub mod ground_support; pub mod heightmap; diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 700b7c18b..14ddf5228 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1133,3 +1133,19 @@ Clippy passes. The exporter asserts that registered default suppliers contain no modifiers. Set membership is observed in registry order: this does not establish JVM identity-hash collection order, cross-attribute bulk assignment/serialization, custom suppliers, equipment integration or a live entity tick. + + +`food` implements eating, saturation, exhaustion, hunger predicates and the +server hunger tick. It retains the captured level/difficulty, short-circuit +player queries, fast/slow regeneration timers, starvation health/difficulty +guards, wrapping integer arithmetic, Java float edge behavior and partial state +writes when callbacks fail. Heal and starvation requests use explicit world +hooks, which can mutate food state before subsequent tick work. + +`python3 tools/test_food_parity.py` compares actual `FoodData` methods. The +[food report](../benchmarks/rust-food-2026-10-07/scoped-parity.json) records +**180,878 matching lines per JAR** across **15,211 fixtures**, including 240-tick +sequences, threshold boundaries, all difficulties, callback mutation/failure, +signed zero and nonfinite arithmetic. Targeted Clippy passes. World rules, +player health/healing and damage delivery are controlled; consumables, saved +hunger data and live survival gameplay integration remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFoodOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFoodOracle.java new file mode 100644 index 000000000..8af1580e3 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFoodOracle.java @@ -0,0 +1,48 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.lang.reflect.*;import java.nio.file.*;import java.util.*; +import net.minecraft.world.food.*;import net.minecraft.world.Difficulty;import net.minecraft.server.level.*; +import net.minecraft.world.damagesource.*;import net.minecraft.world.level.gamerules.*; +/** Actual FoodData arithmetic and tick with observable player/world callbacks. */ +public final class VanillaFoodOracle { + static final class Stop extends RuntimeException {} + static Object unsafe;static Method allocate;static Field exhaustion,timer; + static T make(Class c)throws Exception{return c.cast(allocate.invoke(unsafe,c));} + static float single(JsonElement v){return Float.intBitsToFloat(Integer.parseUnsignedInt(v.getAsString(),16));} + static String bits(float v){return String.format("%08x",Float.floatToIntBits(v));} + static Field field(String n)throws Exception{var f=FoodData.class.getDeclaredField(n);f.setAccessible(true);return f;} + static void set(FoodData food,JsonObject v){try{food.setFoodLevel(v.get("food").getAsInt());food.setSaturation(single(v.get("saturation")));exhaustion.setFloat(food,single(v.get("exhaustion")));timer.setInt(food,v.get("timer").getAsInt());}catch(Exception e){throw new AssertionError(e);}} + static final class Data {JsonObject f;PrintWriter out;FoodData food;int calls;boolean changed;Level level;Rules rules;Sources sources; + void query(String s){out.println(s);int n=calls++;if(n==f.get("fail").getAsInt())throw new Stop();if(n==f.get("mutate_at").getAsInt()){set(food,f.getAsJsonObject("after"));changed=true;}} + JsonObject state(){return changed?f.getAsJsonObject("after_world"):f.getAsJsonObject("world");} + } + static final class Rules extends GameRules {Data d;Rules(){super(net.minecraft.world.flag.FeatureFlagSet.of());}@SuppressWarnings("unchecked")@Override public T get(GameRule r){if(r!=GameRules.NATURAL_HEALTH_REGENERATION)throw new AssertionError();d.query("regeneration");return (T)Boolean.valueOf(d.state().get("regen").getAsBoolean());}} + static final class Sources extends DamageSources {Data d;DamageSource source;Sources(){super(null);}@Override public DamageSource starve(){d.query("starve-source");return source;}} + static final class Level extends ServerLevel {Data d;Level(){super(null,null,null,null,null,null,false,0L,List.of(),false);} + @Override public Difficulty getDifficulty(){d.query("difficulty");return Difficulty.values()[d.state().get("difficulty").getAsInt()];} + @Override public GameRules getGameRules(){d.query("rules");return d.rules;} + } + static final class Actor extends ServerPlayer {Data d;Actor(){super(null,null,null,null);} + @Override public ServerLevel level(){d.query("level");return d.level;} + @Override public boolean isHurt(){d.query("is-hurt");return d.state().get("hurt").getAsBoolean();} + @Override public float getHealth(){d.query("health");return single(d.state().get("health"));} + @Override public void heal(float v){d.query("heal "+bits(v));} + @Override public DamageSources damageSources(){d.query("damage-sources");return d.sources;} + @Override public boolean hurtServer(ServerLevel l,DamageSource s,float v){if(l!=d.level||s!=d.sources.source)throw new AssertionError();d.query("hurt "+bits(v));return false;} + } + public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();var u=Class.forName("sun.misc.Unsafe");var uf=u.getDeclaredField("theUnsafe");uf.setAccessible(true);unsafe=uf.get(null);allocate=u.getMethod("allocateInstance",Class.class);exhaustion=field("exhaustionLevel");timer=field("tickTimer");Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();var d=new Data();d.f=f;d.out=out;d.food=new FoodData();set(d.food,f.getAsJsonObject("initial"));d.level=make(Level.class);d.level.d=d;d.rules=make(Rules.class);d.rules.d=d;d.sources=make(Sources.class);d.sources.d=d;d.sources.source=make(DamageSource.class);var actor=make(Actor.class);actor.d=d; + try{for(var v:f.getAsJsonArray("ops")){var op=v.getAsJsonObject();switch(op.get("mode").getAsString()){ + case "eat":d.food.eat(op.get("nutrition").getAsInt(),single(op.get("amount")));break; + case "properties":d.food.eat(new FoodProperties(op.get("nutrition").getAsInt(),single(op.get("amount")),false));break; + case "exhaust":d.food.addExhaustion(single(op.get("amount")));break; + case "food":d.food.setFoodLevel(op.get("nutrition").getAsInt());break; + case "saturation":d.food.setSaturation(single(op.get("amount")));break; + case "tick":d.food.tick(actor);break; + default:throw new AssertionError();} + out.println("state "+d.food.getFoodLevel()+" "+bits(d.food.getSaturationLevel())+" "+bits(exhaustion.getFloat(d.food))+" "+timer.getInt(d.food)+" "+d.food.hasEnoughFood()+" "+d.food.needsFood()); + }out.println("result ok");}catch(Stop e){out.println("result error");} + out.println("final "+d.food.getFoodLevel()+" "+bits(d.food.getSaturationLevel())+" "+bits(exhaustion.getFloat(d.food))+" "+timer.getInt(d.food));out.println("queries "+d.calls); + }} + } +} diff --git a/tools/test_food_parity.py b/tools/test_food_parity.py new file mode 100644 index 000000000..6fa616ca1 --- /dev/null +++ b/tools/test_food_parity.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python3 +"""Compare food arithmetic, exhaustion and server hunger tick with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + def bits(v):return struct.pack('>f',v).hex() + def state(food=20,saturation=5,exhaustion=0,timer=0):return dict(food=food,saturation=bits(saturation),exhaustion=bits(exhaustion),timer=timer) + def world(difficulty=2,regen=True,hurt=True,health=10):return dict(difficulty=difficulty,regen=regen,hurt=hurt,health=bits(health)) + def op(mode='tick',nutrition=0,amount=0):return dict(mode=mode,nutrition=nutrition,amount=bits(amount)) + def row(initial,ops,**kw): + f=dict(initial=initial,ops=ops,world=world(),after=state(0,0,7,79),after_world=world(3,False,False,1),fail=-1,mutate_at=-1);f.update(kw);return f + edges=[-float('inf'),-1e30,-1,-0.,0.,1e-40,.1,1,4,5,6,20,40,1e30,float('inf'),float('nan')] + foods=[-2147483648,-1,0,1,6,17,18,19,20,21,2147483647] + timers=[-2147483648,-1,0,8,9,10,78,79,80,2147483647] + for food in foods: + for nutrition in foods: + for value in edges: + for saturation in [-1.,-0.,0.,5.,float('nan')]: + yield row(state(food,saturation),[op('eat',nutrition,value),op('properties',nutrition,value),op('exhaust',amount=value)]) + for difficulty in range(4): + for regen in [False,True]: + for hurt in [False,True]: + for food in [-1,0,17,18,19,20,21]: + for saturation in [0.,.1,5.,6.,float('nan')]: + for timer in [0,9,79]: + yield row(state(food,saturation,4.000001,timer),[op(),op()],world=world(difficulty,regen,hurt,1)) + for health in edges: + for difficulty in range(4):yield row(state(0,0,0,79),[op()],world=world(difficulty,False,True,health)) + for initial in [state(20,5,0,9),state(18,0,0,79),state(0,0,0,79),state(20,5,5,9)]: + for fail in range(-1,13): + for mutation in range(-1,13):yield row(initial,[op()],fail=fail,mutate_at=mutation) + rng=random.Random(0x464f4f44) + for _ in range(3000): + ops=[op(rng.choice(['tick','tick','tick','eat','properties','exhaust','food','saturation']),rng.choice(foods),rng.choice(edges)) for __ in range(rng.randrange(1,50))] + yield row(state(rng.choice(foods),rng.choice(edges),rng.choice(edges),rng.choice(timers)),ops,world=world(rng.randrange(4),bool(rng.randrange(2)),bool(rng.randrange(2)),rng.choice(edges)),fail=rng.choice([-1,-1,0,3,5,9]),mutate_at=rng.choice([-1,-1,1,4,6,8])) + for initial in [state(20,5),state(18,0),state(0,0)]:yield row(initial,[op() for _ in range(240)]) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-food-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFoodOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/food_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaFoodOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','food_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('food_fixture.exe' if os.name=='nt' else 'food_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} food output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual FoodData eating/properties, exhaustion, hunger predicates and server tick, including query order, mutations/failures, regeneration thresholds, starvation difficulty/health guards, signed-zero/nonfinite values and integer overflow. Player healing/damage and world queries are controlled; full damage/health, consumables, persistence and playable integration remain pending.'} + lab.write_json(report_path,report);print(f'Scoped food parity passed: {report_path}') + + +if __name__=='__main__':main() From a3ce4ad17a099f9c40acaf46b8a74a1c4da44b2e Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 04:11:52 +0200 Subject: [PATCH 106/253] Persist vanilla hunger state with native NBT coercions --- .../scoped-parity.json | 244 ++++++++++++++++++ .../examples/food_storage_fixture.rs | 114 ++++++++ crates/horizon-world/src/food_storage.rs | 47 ++++ crates/horizon-world/src/lib.rs | 1 + docs/collision-geometry.md | 16 ++ .../parity/VanillaFoodStorageOracle.java | 24 ++ tools/test_food_storage_parity.py | 68 +++++ 7 files changed, 514 insertions(+) create mode 100644 benchmarks/rust-food-storage-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/food_storage_fixture.rs create mode 100644 crates/horizon-world/src/food_storage.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFoodStorageOracle.java create mode 100644 tools/test_food_storage_parity.py diff --git a/benchmarks/rust-food-storage-2026-10-07/scoped-parity.json b/benchmarks/rust-food-storage-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..be5db181a --- /dev/null +++ b/benchmarks/rust-food-storage-2026-10-07/scoped-parity.json @@ -0,0 +1,244 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 6565, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFoodStorageOracle.java": "3b1db195691b3b9066380e71e690434ed00798278bd67bbdc7461459e7530fee", + "tools/test_food_storage_parity.py": "bd59d6b825926f5d34fb0e2cd19cbd6ae3cdd889a6d929ca68f122296109dc4a", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attributes/entity.rs": "d165e952e0ff2d1a1b037c03df5fbc778b7e263b8f9e402cf9b0fa27c933e0c6", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "70c198f1bd000d46bff40b05aed9fa2aab99972ccfb2fe94f2002044e4c0df9c", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/food_storage_fixture.rs": "fbd3f05d9720a83d2e9de31d67440054189f1ed9e9faeaf4383188cfd43a2cc8" + }, + "fixtures_sha256": { + ".local/rust-food-storage-parity/inputs.txt": "df6067c6a781554ed5a57e92543bf7acea9e55fc25e5435ddc10fcd58e46436d" + }, + "rust_output_sha256": "df9e3d7ca5293c11fcddb814bd84683135a168b4efb789ec6496e1158dfb3db4", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "df9e3d7ca5293c11fcddb814bd84683135a168b4efb789ec6496e1158dfb3db4", + "matched_output_lines": 45955 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "df9e3d7ca5293c11fcddb814bd84683135a168b4efb789ec6496e1158dfb3db4", + "matched_output_lines": 45955 + } + ], + "scope": "Actual FoodData readAdditionalSaveData/addAdditionalSaveData through native TagValueInput/TagValueOutput; all NBT numeric types, missing/wrong-type defaults, numeric coercion, overflow, nonfinite values, signed-zero normalization, output types and round trips. Other player fields retained. ProblemReporter diagnostics, complete player save lifecycle and playable integration remain pending." +} diff --git a/crates/horizon-world/examples/food_storage_fixture.rs b/crates/horizon-world/examples/food_storage_fixture.rs new file mode 100644 index 000000000..4aafe920e --- /dev/null +++ b/crates/horizon-world/examples/food_storage_fixture.rs @@ -0,0 +1,114 @@ +use horizon_world::{ + food::FoodData, + nbt::{Compound, Tag}, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +const KEYS: [&str; 4] = [ + "foodLevel", + "foodTickTimer", + "foodSaturationLevel", + "foodExhaustionLevel", +]; +fn single(v: &Value) -> f32 { + f32::from_bits(u32::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn bits(v: f32) -> u32 { + if v.is_nan() { + f32::NAN.to_bits() + } else { + v.to_bits() + } +} +fn tag(v: &Value) -> Option { + let value = &v["value"]; + Some(match v["type"].as_i64().unwrap() { + 0 => return None, + 1 => Tag::Byte(value.as_i64().unwrap() as i8), + 2 => Tag::Short(value.as_i64().unwrap() as i16), + 3 => Tag::Int(value.as_i64().unwrap() as i32), + 4 => Tag::Long(value.as_str().unwrap().parse().unwrap()), + 5 => { + let f = single(value); + Tag::Float(if f == 0.0 { 0 } else { f.to_bits() }) + } + 6 => { + let f = f64::from_bits(u64::from_str_radix(value.as_str().unwrap(), 16).unwrap()); + Tag::Double(if f == 0.0 { 0 } else { f.to_bits() }) + } + 7 => Tag::ByteArray(vec![1]), + 8 => Tag::String("17".into()), + 9 => Tag::List(vec![]), + 10 => Tag::Compound(Compound::new()), + 11 => Tag::IntArray(vec![2]), + 12 => Tag::LongArray(vec![3]), + _ => panic!("tag type"), + }) +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut food = FoodData { + food: -9, + saturation: -7., + timer: 83, + exhaustion: 99., + }; + if f["mode"] == "read" { + let mut t = Compound::new(); + for (key, v) in KEYS.iter().zip(f["tags"].as_array().unwrap()) { + if let Some(v) = tag(v) { + t.insert((*key).into(), v); + } + } + food.read_nbt(&t); + } else { + food = FoodData { + food: f["food"].as_i64().unwrap() as i32, + timer: f["timer"].as_i64().unwrap() as i32, + saturation: single(&f["saturation"]), + exhaustion: single(&f["exhaustion"]), + }; + } + writeln!( + out, + "state {} {} {:08x} {:08x}", + food.food, + food.timer, + bits(food.saturation), + bits(food.exhaustion) + )?; + let mut saved = Compound::new(); + saved.insert("unrelated".into(), Tag::Int(42)); + saved.insert("foodLevel".into(), Tag::String("replace".into())); + food.write_nbt(&mut saved); + let Tag::Int(unrelated) = saved[&"unrelated".into()] else { + panic!("preserve unrelated") + }; + writeln!(out, "saved {} {unrelated}", saved.len())?; + for key in KEYS { + match saved[&key.into()] { + Tag::Int(v) => writeln!(out, "tag 3 {v}")?, + Tag::Float(v) => writeln!(out, "tag 5 {:08x}", bits(f32::from_bits(v)))?, + _ => panic!("saved type"), + } + } + food.read_nbt(&saved); + writeln!( + out, + "roundtrip {} {} {:08x} {:08x}", + food.food, + food.timer, + bits(food.saturation), + bits(food.exhaustion) + )?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/food_storage.rs b/crates/horizon-world/src/food_storage.rs new file mode 100644 index 000000000..0401e8158 --- /dev/null +++ b/crates/horizon-world/src/food_storage.rs @@ -0,0 +1,47 @@ +//! FoodData fields in a vanilla player NBT compound. +use crate::{ + food::FoodData, + nbt::{Compound, JavaString, Tag}, +}; +fn int(tag: Option<&Tag>, default: i32) -> i32 { + match tag { + Some(Tag::Byte(v)) => i32::from(*v), + Some(Tag::Short(v)) => i32::from(*v), + Some(Tag::Int(v)) => *v, + Some(Tag::Long(v)) => *v as i32, + Some(Tag::Float(v)) => f32::from_bits(*v).floor() as i32, + Some(Tag::Double(v)) => f64::from_bits(*v).floor() as i32, + _ => default, + } +} +fn float(tag: Option<&Tag>, default: f32) -> f32 { + match tag { + Some(Tag::Byte(v)) => f32::from(*v), + Some(Tag::Short(v)) => f32::from(*v), + Some(Tag::Int(v)) => *v as f32, + Some(Tag::Long(v)) => *v as f32, + Some(Tag::Float(v)) => f32::from_bits(*v), + Some(Tag::Double(v)) => f64::from_bits(*v) as f32, + _ => default, + } +} +impl FoodData { + /// Missing or nonnumeric values reset each field to its native default. + /// Numeric values are converted without clamping the resulting food state. + pub fn read_nbt(&mut self, tag: &Compound) { + let get = |s: &str| tag.get(&JavaString::from(s)); + self.food = int(get("foodLevel"), 20); + self.timer = int(get("foodTickTimer"), 0); + self.saturation = float(get("foodSaturationLevel"), 5.0); + self.exhaustion = float(get("foodExhaustionLevel"), 0.0); + } + /// Writes these four fields while preserving other player data. Java float + /// tag factories normalize both signed zeros to the shared positive zero. + pub fn write_nbt(&self, tag: &mut Compound) { + let float = |v: f32| Tag::Float(if v == 0.0 { 0 } else { v.to_bits() }); + tag.insert("foodLevel".into(), Tag::Int(self.food)); + tag.insert("foodTickTimer".into(), Tag::Int(self.timer)); + tag.insert("foodSaturationLevel".into(), float(self.saturation)); + tag.insert("foodExhaustionLevel".into(), float(self.exhaustion)); + } +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 3c7b725e5..3d4f60e9a 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -32,6 +32,7 @@ pub mod fluid_flow; pub mod fluid_occupancy; pub mod fluid_shape; pub mod food; +pub mod food_storage; pub mod free_space; pub mod ground_support; pub mod heightmap; diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 14ddf5228..405eab9c4 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1149,3 +1149,19 @@ sequences, threshold boundaries, all difficulties, callback mutation/failure, signed zero and nonfinite arithmetic. Targeted Clippy passes. World rules, player health/healing and damage delivery are controlled; consumables, saved hunger data and live survival gameplay integration remain pending. + + +`food_storage` reads/writes hunger state in player NBT compounds. Missing and +nonnumeric fields use native defaults; numeric tags retain vanilla coercions, +including floor-to-int for floats/doubles, truncation of long integer bits and +no post-load clamping. Writes replace the four hunger fields with native int/ +float types, normalize float signed zero and preserve unrelated player fields. + +`python3 tools/test_food_storage_parity.py` compares actual `FoodData` persistence +through `TagValueInput`/`TagValueOutput`. The +[food storage report](../benchmarks/rust-food-storage-2026-10-07/scoped-parity.json) +records **45,955 matching lines per JAR**, covering every NBT numeric type, +missing/wrong-type fields, conversion boundaries, nonfinite values and save/load +round trips. Targeted Clippy passes. ProblemReporter diagnostics and the complete +player save lifecycle remain pending; these results establish the four hunger +fields, not a playable save/load implementation. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFoodStorageOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFoodStorageOracle.java new file mode 100644 index 000000000..02d3595f5 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFoodStorageOracle.java @@ -0,0 +1,24 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.lang.reflect.*;import java.nio.file.*; +import net.minecraft.nbt.*;import net.minecraft.world.food.FoodData;import net.minecraft.world.level.storage.*;import net.minecraft.util.ProblemReporter; +/** Native TagValueInput/Output hunger persistence and numeric coercions. */ +public final class VanillaFoodStorageOracle { + static final String[] KEYS={"foodLevel","foodTickTimer","foodSaturationLevel","foodExhaustionLevel"}; + static String bits(float v){return String.format("%08x",Float.floatToIntBits(v));} + static float single(JsonElement v){return Float.intBitsToFloat(Integer.parseUnsignedInt(v.getAsString(),16));} + static Tag tag(JsonObject o){int type=o.get("type").getAsInt();var v=o.get("value");return switch(type){ + case 1->ByteTag.valueOf(v.getAsByte());case 2->ShortTag.valueOf(v.getAsShort());case 3->IntTag.valueOf(v.getAsInt());case 4->LongTag.valueOf(Long.parseLong(v.getAsString())); + case 5->FloatTag.valueOf(single(v));case 6->DoubleTag.valueOf(Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16))); + case 7->new ByteArrayTag(new byte[]{1});case 8->StringTag.valueOf("17");case 9->new ListTag();case 10->new CompoundTag();case 11->new IntArrayTag(new int[]{2});case 12->new LongArrayTag(new long[]{3});default->throw new AssertionError();};} + static Field field(String n)throws Exception{var f=FoodData.class.getDeclaredField(n);f.setAccessible(true);return f;} + public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();Path dir=Path.of(args[1]);var exhaustion=field("exhaustionLevel");var timer=field("tickTimer"); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();var food=new FoodData();food.setFoodLevel(-9);food.setSaturation(-7);timer.setInt(food,83);exhaustion.setFloat(food,99); + if(f.get("mode").getAsString().equals("read")){var compound=new CompoundTag();var tags=f.getAsJsonArray("tags");for(int i=0;i<4;i++){var t=tags.get(i).getAsJsonObject();if(t.get("type").getAsInt()!=0)compound.put(KEYS[i],tag(t));}food.readAdditionalSaveData(TagValueInput.create(ProblemReporter.DISCARDING,net.minecraft.core.HolderLookup.Provider.create(java.util.stream.Stream.empty()),compound));} + else {food.setFoodLevel(f.get("food").getAsInt());food.setSaturation(single(f.get("saturation")));timer.setInt(food,f.get("timer").getAsInt());exhaustion.setFloat(food,single(f.get("exhaustion")));} + out.println("state "+food.getFoodLevel()+" "+timer.getInt(food)+" "+bits(food.getSaturationLevel())+" "+bits(exhaustion.getFloat(food))); + var output=TagValueOutput.createWithoutContext(ProblemReporter.DISCARDING);output.putInt("unrelated",42);output.putString("foodLevel","replace");food.addAdditionalSaveData(output);var saved=output.buildResult();out.println("saved "+saved.size()+" "+saved.getIntOr("unrelated",-1));for(var key:KEYS){var t=(NumericTag)saved.get(key);out.println("tag "+t.getId()+" "+(t instanceof IntTag?Integer.toString(t.intValue()):bits(t.floatValue())));} + food.readAdditionalSaveData(TagValueInput.create(ProblemReporter.DISCARDING,net.minecraft.core.HolderLookup.Provider.create(java.util.stream.Stream.empty()),saved));out.println("roundtrip "+food.getFoodLevel()+" "+timer.getInt(food)+" "+bits(food.getSaturationLevel())+" "+bits(exhaustion.getFloat(food))); + }} + } +} diff --git a/tools/test_food_storage_parity.py b/tools/test_food_storage_parity.py new file mode 100644 index 000000000..581fb5c9c --- /dev/null +++ b/tools/test_food_storage_parity.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python3 +"""Compare vanilla food NBT persistence and numeric conversions with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + def bits(v):return struct.pack('>f',v).hex() + def double(v):return struct.pack('>d',v).hex() + pool=[dict(type=i,value=0) for i in [0,7,8,9,10,11,12]] + for t,values in [(1,[-128,-1,0,1,127]),(2,[-32768,-129,-1,0,1,32767]),(3,[-2**31,-1,0,1,20,2**31-1]),(4,[-2**63,-2**32-1,-2**31,-1,0,1,2**31,2**32+1,2**63-1])]: + pool.extend(dict(type=t,value=str(v) if t==4 else v) for v in values) + values=[-float('inf'),-1e30,-2147483649.,-1.9,-1.,-0.,0.,1e-40,.1,1.,1.9,20.,2147483647.,2147483648.,1e30,float('inf'),float('nan')] + pool.extend(dict(type=t,value=(bits(v) if t==5 else double(v))) for t in [5,6] for v in values) + pool.extend([dict(type=5,value='7fa12345'),dict(type=6,value='7ff123456789abcd')]) + for slot in range(4): + for item in pool: + tags=[dict(type=0,value=0) for _ in range(4)];tags[slot]=item;yield dict(mode='read',tags=tags) + rng=random.Random(0x464f4f444e4254) + for _ in range(6000):yield dict(mode='read',tags=[rng.choice(pool) for __ in range(4)]) + for a in values: + for b in values:yield dict(mode='write',food=rng.choice([-2**31,-1,0,20,2**31-1]),timer=rng.choice([-2**31,-1,0,79,2**31-1]),saturation=bits(a),exhaustion=bits(b)) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-food-storage-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFoodStorageOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/food_storage_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaFoodStorageOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','food_storage_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('food_storage_fixture.exe' if os.name=='nt' else 'food_storage_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} food storage output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual FoodData readAdditionalSaveData/addAdditionalSaveData through native TagValueInput/TagValueOutput; all NBT numeric types, missing/wrong-type defaults, numeric coercion, overflow, nonfinite values, signed-zero normalization, output types and round trips. Other player fields retained. ProblemReporter diagnostics, complete player save lifecycle and playable integration remain pending.'} + lab.write_json(report_path,report);print(f'Scoped food storage parity passed: {report_path}') + + +if __name__=='__main__':main() From 2288d6b909f324c659d04b41de86d45b60708116 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 04:18:35 +0200 Subject: [PATCH 107/253] Implement living health and synchronized float update semantics --- .../scoped-parity.json | 245 ++++++++++++++++++ .../examples/living_health_fixture.rs | 158 +++++++++++ crates/horizon-world/src/lib.rs | 1 + crates/horizon-world/src/living_health.rs | 110 ++++++++ docs/collision-geometry.md | 18 ++ .../parity/VanillaLivingHealthOracle.java | 43 +++ tools/test_living_health_parity.py | 75 ++++++ 7 files changed, 650 insertions(+) create mode 100644 benchmarks/rust-living-health-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/living_health_fixture.rs create mode 100644 crates/horizon-world/src/living_health.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingHealthOracle.java create mode 100644 tools/test_living_health_parity.py diff --git a/benchmarks/rust-living-health-2026-10-07/scoped-parity.json b/benchmarks/rust-living-health-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..d417a3261 --- /dev/null +++ b/benchmarks/rust-living-health-2026-10-07/scoped-parity.json @@ -0,0 +1,245 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 5087, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingHealthOracle.java": "8f95ea7ee66a8d7330130ab6a91d1f78b20db26a24fa3e0e8ae21c49c8efc8e6", + "tools/test_living_health_parity.py": "0b64f1f87b8e5c0c2e9aa98c58ad8a704f6752d76f3b8dc5086b760bd1bc5a1c", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attributes/entity.rs": "d165e952e0ff2d1a1b037c03df5fbc778b7e263b8f9e402cf9b0fa27c933e0c6", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "ae8773da6061d4b76cf38b0719b87174114b48df719bb0f80a894a32d1e7bd99", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/living_health_fixture.rs": "0044e1beb40f6d432b5288ced93935cdba22728cc6289c977d36af205a2a8ab2" + }, + "fixtures_sha256": { + ".local/rust-living-health-parity/inputs.txt": "95eeb82892b387b083dcc84b56db296feb4e8ec13d65ec3ac13f9a157300c90d" + }, + "rust_output_sha256": "83ad151160fe38f60c9cbda57fda5e21031d93a79172f8218928e551ca862ea7", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "83ad151160fe38f60c9cbda57fda5e21031d93a79172f8218928e551ca862ea7", + "matched_output_lines": 442007 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "83ad151160fe38f60c9cbda57fda5e21031d93a79172f8218928e551ca862ea7", + "matched_output_lines": 442007 + } + ], + "scope": "Actual LivingEntity/Player health, healing, absorption and predicates composed with actual SynchedEntityData Float storage. Checks captured synchronized-data identity, attribute narrowing/clamping, boxed-float equality, callback-before-dirty ordering, partial state after exceptions, mutations and dirty/default extraction. Attribute values and the internal absorption sink are controlled; Player-specific absorption synchronization, full multi-item synchronization, registered attribute binding, damage pipeline and playable entities remain pending." +} diff --git a/crates/horizon-world/examples/living_health_fixture.rs b/crates/horizon-world/examples/living_health_fixture.rs new file mode 100644 index 000000000..958d43b7d --- /dev/null +++ b/crates/horizon-world/examples/living_health_fixture.rs @@ -0,0 +1,158 @@ +use horizon_world::living_health::{self, HealthWorld, SyncedFloat}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn single(v: &Value) -> f32 { + f32::from_bits(u32::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn bits(v: f32) -> u32 { + if v.is_nan() { + f32::NAN.to_bits() + } else { + v.to_bits() + } +} +struct Context<'a> { + f: &'a Value, + out: &'a mut dyn Write, + calls: i64, + changed: bool, + active: usize, +} +impl Context<'_> { + fn query(&mut self, s: &str) -> io::Result<()> { + writeln!(self.out, "{s}")?; + let n = self.calls; + self.calls += 1; + if n == self.f["fail"].as_i64().unwrap() { + return Err(io::Error::other("injected health callback failure")); + } + if n == self.f["mutate_at"].as_i64().unwrap() { + self.changed = true; + self.active = 1; + } + Ok(()) + } + fn world(&self) -> &Value { + &self.f[if self.changed { "after" } else { "world" }] + } +} +struct World<'a> { + ctx: Context<'a>, + stores: [SyncedFloat; 2], + absorption: f32, +} +impl HealthWorld for World<'_> { + type Error = io::Error; + type Data = usize; + fn health(&mut self) -> io::Result { + self.ctx.query("health")?; + Ok(self.stores[self.ctx.active].value()) + } + fn health_data(&self) -> usize { + self.ctx.active + } + fn max_health_attribute(&mut self) -> io::Result { + self.ctx.query("max-health")?; + Ok(number(&self.ctx.world()["max-health"])) + } + fn max_absorption_attribute(&mut self) -> io::Result { + self.ctx.query("max-absorption")?; + Ok(number(&self.ctx.world()["max-absorption"])) + } + fn store_health(&mut self, data: usize, v: f32) -> io::Result<()> { + self.stores[data].set(v, false, |_| self.ctx.query("updated")) + } + fn store_absorption(&mut self, v: f32) -> io::Result<()> { + self.ctx.query(&format!("absorption {:08x}", bits(v)))?; + self.absorption = v; + Ok(()) + } + fn dead_flag(&self) -> bool { + self.ctx.world()["dead"].as_bool().unwrap() + } + fn dispatch_set_health(&mut self, v: f32) -> io::Result<()> { + self.ctx.query(&format!("set {:08x}", bits(v)))?; + living_health::set_health(self, v) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut w = World { + ctx: Context { + f: &f, + out: &mut out, + calls: 0, + changed: false, + active: 0, + }, + stores: [ + SyncedFloat::new(single(&f["health"][0])), + SyncedFloat::new(single(&f["health"][1])), + ], + absorption: single(&f["absorption"]), + }; + for op in f["ops"].as_array().unwrap() { + let v = single(&op["value"]); + let result = match op["mode"].as_str().unwrap() { + "heal" => living_health::heal(&mut w, v), + "set" => w.dispatch_set_health(v), + "base" => living_health::set_health(&mut w, v), + "absorption" => living_health::set_absorption(&mut w, v), + "hurt" => { + living_health::is_hurt(&mut w).and_then(|v| writeln!(w.ctx.out, "bool {v}")) + } + "dead" => living_health::is_dead_or_dying(&mut w) + .and_then(|v| writeln!(w.ctx.out, "bool {v}")), + "sync" => w.stores[w.ctx.active].set(v, op["force"].as_bool().unwrap(), |_| { + w.ctx.query("updated") + }), + "pack" => { + writeln!( + w.ctx.out, + "packed {}", + w.stores[w.ctx.active] + .take_dirty() + .map(|v| format!("{:08x}", bits(v))) + .unwrap_or_else(|| "none".into()) + ) + } + _ => panic!("mode"), + }; + writeln!( + w.ctx.out, + "result {}", + if result.is_ok() { "ok" } else { "error" } + )?; + for (i, s) in w.stores.iter().enumerate() { + writeln!( + w.ctx.out, + "data {i} {:08x} {} {} {}", + bits(s.value()), + s.is_dirty(), + s.item_dirty(), + s.is_default() + )?; + } + let dead = w.dead_flag(); + writeln!( + w.ctx.out, + "state {} {:08x} {dead} {}", + w.ctx.active, + bits(w.absorption), + w.ctx.calls + )?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 3d4f60e9a..523b2dd81 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -41,6 +41,7 @@ pub mod liquid_collision; pub mod living_air; pub mod living_fall; pub mod living_fluid; +pub mod living_health; pub mod living_landing; pub mod living_motion; pub mod movement_emission; diff --git a/crates/horizon-world/src/living_health.rs b/crates/horizon-world/src/living_health.rs new file mode 100644 index 000000000..5b071e93f --- /dev/null +++ b/crates/horizon-world/src/living_health.rs @@ -0,0 +1,110 @@ +//! Living health/absorption limits and healing/query dispatch order. +pub trait HealthWorld { + type Error; + type Data: Copy; + fn health(&mut self) -> Result; + /// Captures the current synchronized-data object before attribute lookup. + fn health_data(&self) -> Self::Data; + fn max_health_attribute(&mut self) -> Result; + fn max_absorption_attribute(&mut self) -> Result; + fn store_health(&mut self, data: Self::Data, value: f32) -> Result<(), Self::Error>; + fn store_absorption(&mut self, value: f32) -> Result<(), Self::Error>; + fn dead_flag(&self) -> bool; + fn dispatch_set_health(&mut self, value: f32) -> Result<(), Self::Error>; +} +fn clamp(value: f32, max: f32) -> f32 { + if value < 0.0 { + 0.0 + } else if value.is_nan() || max.is_nan() { + f32::NAN + } else if value == 0.0 && max == 0.0 { + f32::from_bits(value.to_bits() | max.to_bits()) + } else { + value.min(max) + } +} +pub fn set_health(world: &mut W, value: f32) -> Result<(), W::Error> { + let data = world.health_data(); + let maximum = world.max_health_attribute()? as f32; + world.store_health(data, clamp(value, maximum)) +} +pub fn set_absorption(world: &mut W, value: f32) -> Result<(), W::Error> { + let maximum = world.max_absorption_attribute()? as f32; + world.store_absorption(clamp(value, maximum)) +} +pub fn heal(world: &mut W, amount: f32) -> Result<(), W::Error> { + let health = world.health()?; + if health > 0.0 { + world.dispatch_set_health(health + amount)?; + } + Ok(()) +} +pub fn is_hurt(world: &mut W) -> Result { + Ok(world.health()? > 0.0 && world.health()? < world.max_health_attribute()? as f32) +} +pub fn is_dead_or_dying(world: &mut W) -> Result { + Ok(world.health()? <= 0.0 || world.dead_flag()) +} +/// One synchronized Float data item, using Java boxed-float equality. The native +/// callback observes the new value before dirty flags are set. Exceptions leave +/// that value changed without newly marking it dirty. +#[derive(Clone, Copy, Debug)] +pub struct SyncedFloat { + initial: f32, + value: f32, + item_dirty: bool, + dirty: bool, +} +fn equal(a: f32, b: f32) -> bool { + a.to_bits() == b.to_bits() || (a.is_nan() && b.is_nan()) +} +impl SyncedFloat { + pub fn new(value: f32) -> Self { + Self { + initial: value, + value, + item_dirty: false, + dirty: false, + } + } + pub fn value(&self) -> f32 { + self.value + } + pub fn is_dirty(&self) -> bool { + self.dirty + } + pub fn item_dirty(&self) -> bool { + self.item_dirty + } + pub fn is_default(&self) -> bool { + equal(self.initial, self.value) + } + pub fn set( + &mut self, + value: f32, + force: bool, + updated: impl FnOnce(&mut Self) -> Result<(), E>, + ) -> Result<(), E> { + if force || !equal(value, self.value) { + self.value = value; + updated(self)?; + self.item_dirty = true; + self.dirty = true; + } + Ok(()) + } + /// Extracts this single item's update. Multi-item synchronized storage and + /// network serialization are separate concerns. + pub fn take_dirty(&mut self) -> Option { + if !self.dirty { + return None; + } + self.dirty = false; + if self.item_dirty { + self.item_dirty = false; + Some(self.value) + } else { + None + } + } +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 405eab9c4..c90ddcecd 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1165,3 +1165,21 @@ missing/wrong-type fields, conversion boundaries, nonfinite values and save/load round trips. Targeted Clippy passes. ProblemReporter diagnostics and the complete player save lifecycle remain pending; these results establish the four hunger fields, not a playable save/load implementation. + + +`living_health` implements health/absorption clamping, healing dispatch, player +hurt and living dead-or-dying predicates. Health writes capture synchronized +storage before attribute lookup. `SyncedFloat` preserves Java boxed-float +equality, writes the value before the update callback, and marks dirty only +after that callback succeeds; it also supports default/dirty extraction for a +single float item. + +`python3 tools/test_living_health_parity.py` compares actual LivingEntity/Player +methods and actual `SynchedEntityData` float items. The +[living health report](../benchmarks/rust-living-health-2026-10-07/scoped-parity.json) +records **442,007 matching lines per JAR**, covering nonfinite values, signed +zeros/NaN equality, forced updates, dirty extraction, health-data replacement +during callbacks and partial effects after exceptions. Targeted Clippy passes. +Attribute values and the internal absorption sink are controlled. Player-specific +absorption synchronization, multiple synchronized items, registered attribute +binding, full damage processing and playable entities remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingHealthOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingHealthOracle.java new file mode 100644 index 000000000..e50c50b64 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingHealthOracle.java @@ -0,0 +1,43 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.lang.reflect.*;import java.nio.file.*; +import net.minecraft.core.Holder;import net.minecraft.world.entity.*;import net.minecraft.world.entity.player.Player;import net.minecraft.world.entity.ai.attributes.*;import net.minecraft.network.syncher.*; +/** Native health methods and Float synchronized-data callback semantics. */ +public final class VanillaLivingHealthOracle { + static final class Stop extends RuntimeException {} + static Field entityData,dead,absorption;static EntityDataAccessor healthKey; + static float single(JsonElement v){return Float.intBitsToFloat(Integer.parseUnsignedInt(v.getAsString(),16));} + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + static String bits(float v){return String.format("%08x",Float.floatToIntBits(v));} + static Field field(Class c,String n)throws Exception{var f=c.getDeclaredField(n);f.setAccessible(true);return f;} + static final class Data {JsonObject f;PrintWriter out;int calls,active;boolean changed;Actor actor;SynchedEntityData[] stores;SynchedEntityData.DataItem[] items; + JsonObject world(){return f.getAsJsonObject(changed?"after":"world");} + void query(String text){out.println(text);int n=calls++;if(n==f.get("fail").getAsInt())throw new Stop();if(n==f.get("mutate_at").getAsInt()){changed=true;active=1;try{entityData.set(actor,stores[active]);dead.setBoolean(actor,world().get("dead").getAsBoolean());}catch(Exception e){throw new AssertionError(e);}}} + } + static final class Actor extends Player {Data d;Actor(){super(null,null);} + @Override public net.minecraft.world.level.GameType gameMode(){return net.minecraft.world.level.GameType.SURVIVAL;} + @Override public float getHealth(){d.query("health");return super.getHealth();} + @Override public double getAttributeValue(Holder a){String name=a==Attributes.MAX_HEALTH?"max-health":a==Attributes.MAX_ABSORPTION?"max-absorption":"unknown";d.query(name);return number(d.world().get(name));} + @Override public void setHealth(float v){d.query("set "+bits(v));super.setHealth(v);} + void base(float v){super.setHealth(v);} + @Override protected void internalSetAbsorptionAmount(float v){d.query("absorption "+bits(v));try{absorption.setFloat(this,v);}catch(IllegalAccessException e){throw new AssertionError(e);}} + @Override public void onSyncedDataUpdated(EntityDataAccessor key){if(key!=healthKey)throw new AssertionError();d.query("updated");} + } + @SuppressWarnings("unchecked") public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();var u=Class.forName("sun.misc.Unsafe");var uf=u.getDeclaredField("theUnsafe");uf.setAccessible(true);var unsafe=uf.get(null);var allocate=u.getMethod("allocateInstance",Class.class); + entityData=field(Entity.class,"entityData");dead=field(LivingEntity.class,"dead");healthKey=(EntityDataAccessor)field(LivingEntity.class,"DATA_HEALTH_ID").get(null);absorption=field(LivingEntity.class,"absorptionAmount"); + var ctor=SynchedEntityData.class.getDeclaredConstructor(SyncedDataHolder.class,SynchedEntityData.DataItem[].class);ctor.setAccessible(true);Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();var d=new Data();d.f=f;d.out=out;d.actor=(Actor)allocate.invoke(unsafe,Actor.class);d.actor.d=d;d.stores=new SynchedEntityData[2];d.items=(SynchedEntityData.DataItem[])new SynchedEntityData.DataItem[2]; + for(int s=0;s<2;s++){var items=new SynchedEntityData.DataItem[healthKey.id()+1];for(int i=0;i(new EntityDataAccessor(i,EntityDataSerializers.FLOAT),0f);d.items[s]=new SynchedEntityData.DataItem(healthKey,single(f.getAsJsonArray("health").get(s)));items[healthKey.id()]=d.items[s];d.stores[s]=ctor.newInstance(d.actor,items);} + entityData.set(d.actor,d.stores[0]);dead.setBoolean(d.actor,d.world().get("dead").getAsBoolean());absorption.setFloat(d.actor,single(f.get("absorption"))); + for(var ov:f.getAsJsonArray("ops")){var op=ov.getAsJsonObject();float v=single(op.get("value"));try{switch(op.get("mode").getAsString()){ + case "heal":d.actor.heal(v);break;case "set":d.actor.setHealth(v);break;case "base":d.actor.base(v);break;case "absorption":d.actor.setAbsorptionAmount(v);break; + case "hurt":out.println("bool "+d.actor.isHurt());break;case "dead":out.println("bool "+d.actor.isDeadOrDying());break; + case "sync":d.stores[d.active].set(healthKey,v,op.get("force").getAsBoolean());break; + case "pack":{var packed=d.stores[d.active].packDirty();out.println("packed "+(packed==null?"none":bits((Float)packed.getFirst().value())));break;} + default:throw new AssertionError();}out.println("result ok");}catch(Stop e){out.println("result error");} + for(int s=0;s<2;s++)out.println("data "+s+" "+bits(d.items[s].getValue())+" "+d.stores[s].isDirty()+" "+d.items[s].isDirty()+" "+d.items[s].isSetToDefault()); + out.println("state "+d.active+" "+bits(absorption.getFloat(d.actor))+" "+dead.getBoolean(d.actor)+" "+d.calls); + } + }} + } +} diff --git a/tools/test_living_health_parity.py b/tools/test_living_health_parity.py new file mode 100644 index 000000000..a73e04ebd --- /dev/null +++ b/tools/test_living_health_parity.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python3 +"""Compare living health, absorption and synchronized Float updates with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + def bits(v):return struct.pack('>f',v).hex() + def double(v):return struct.pack('>d',v).hex() + def world(maximum=20,absorption=10,dead=False):return {'max-health':double(maximum),'max-absorption':double(absorption),'dead':dead} + def op(mode,value=0,force=False):return dict(mode=mode,value=bits(value),force=force) + def row(health,ops,**kw): + f=dict(health=[bits(health),bits(7)],absorption=bits(0),world=world(),after=world(5,3,True),fail=-1,mutate_at=-1,ops=ops);f.update(kw);return f + values=[-float('inf'),-1e30,-1,-0.,0.,1e-40,.1,1,5,10,20,1e30,float('inf'),float('nan')] + for health in values: + for limit in values: + for value in values: + yield row(health,[op('hurt'),op('dead'),op('heal',value),op('pack'),op('set',value),op('base',value),op('absorption',value),op('hurt'),op('dead')],world=world(limit,limit)) + for health in values: + for value in values: + for force in [False,True]:yield row(health,[op('sync',value,force),op('sync',value,force),op('pack'),op('pack'),op('sync',health),op('pack')]) + for mode in ['hurt','dead','heal','set','base','absorption','sync']: + for fail in range(-1,7): + for mutation in range(-1,7):yield row(10,[op(mode,6),op('pack'),op('heal',1),op('pack')],fail=fail,mutate_at=mutation) + rng=random.Random(0x4845414c5448) + for _ in range(1500): + yield row(rng.choice(values),[op(rng.choice(['hurt','dead','heal','set','base','absorption','sync','pack']),rng.choice(values),bool(rng.randrange(2))) for __ in range(rng.randrange(1,60))],world=world(rng.choice(values),rng.choice(values),bool(rng.randrange(2))),after=world(rng.choice(values),rng.choice(values),bool(rng.randrange(2))),fail=rng.choice([-1,-1,0,3,7,11]),mutate_at=rng.choice([-1,-1,0,2,4,8])) + for nan in ['7fa12345','7fc00000','ffa12345']: + f=row(0,[op('sync',float('nan')),op('heal',1),op('pack')]);f['health'][0]=nan;yield f + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-living-health-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingHealthOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/living_health_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaLivingHealthOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','living_health_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('living_health_fixture.exe' if os.name=='nt' else 'living_health_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} living health output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual LivingEntity/Player health, healing, absorption and predicates composed with actual SynchedEntityData Float storage. Checks captured synchronized-data identity, attribute narrowing/clamping, boxed-float equality, callback-before-dirty ordering, partial state after exceptions, mutations and dirty/default extraction. Attribute values and the internal absorption sink are controlled; Player-specific absorption synchronization, full multi-item synchronization, registered attribute binding, damage pipeline and playable entities remain pending.'} + lab.write_json(report_path,report);print(f'Scoped living health parity passed: {report_path}') + + +if __name__=='__main__':main() From fd185a68b7809b5fdc52d737a1ed7272c93ef1be Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 04:25:09 +0200 Subject: [PATCH 108/253] Compose registered attributes, synchronized health and hunger regeneration --- .../scoped-parity.json | 248 ++++++++++++++++++ .../examples/attribute_health_fixture.rs | 236 +++++++++++++++++ crates/horizon-world/src/attribute_health.rs | 106 ++++++++ crates/horizon-world/src/lib.rs | 1 + docs/collision-geometry.md | 16 ++ .../parity/VanillaAttributeHealthOracle.java | 53 ++++ tools/test_attribute_health_parity.py | 75 ++++++ 7 files changed, 735 insertions(+) create mode 100644 benchmarks/rust-attribute-health-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/attribute_health_fixture.rs create mode 100644 crates/horizon-world/src/attribute_health.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaAttributeHealthOracle.java create mode 100644 tools/test_attribute_health_parity.py diff --git a/benchmarks/rust-attribute-health-2026-10-07/scoped-parity.json b/benchmarks/rust-attribute-health-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..5de4a377d --- /dev/null +++ b/benchmarks/rust-attribute-health-2026-10-07/scoped-parity.json @@ -0,0 +1,248 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 3918, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaAttributeHealthOracle.java": "0ee2907d85c91895cfd6460de225326e77e30658785be4b3f2737ac4b8edb38e", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityAttributeOracle.java": "2ad3190a9798ab54bd12e88573028d0ca6a204e2f8a92018aae98b22335213bf", + "tools/test_attribute_health_parity.py": "4429f469afccc812ce9ab1556366266ec9920f7595fd60b52e0f66933754afcd", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "d165e952e0ff2d1a1b037c03df5fbc778b7e263b8f9e402cf9b0fa27c933e0c6", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "2702d60f7bf8f8d5f9421d5d4c645d7d748271f8dea12e5ec0e457b3a3f1becf", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/attribute_health_fixture.rs": "53168e1135a337fa29eade20892f84ffd4458ad38fc90df2e8382169fe4db020" + }, + "fixtures_sha256": { + ".local/rust-attribute-health-parity/inputs.txt": "36ab827ee17f1452f7e88cfe26dbe368e5348da25ab6b6905f7a1b62fcfa5b7c", + ".local/rust-attribute-health-parity/catalog.json": "d1e488e4f432888beb9f643904c8bca242d1e2093f53e23e07da305d70cf7106" + }, + "rust_output_sha256": "4f7248d8f06aac71b0de827b26a3e3cfa0920a1181cc92dc9e06257d1c6e783e", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "4f7248d8f06aac71b0de827b26a3e3cfa0920a1181cc92dc9e06257d1c6e783e", + "matched_output_lines": 666082 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "4f7248d8f06aac71b0de827b26a3e3cfa0920a1181cc92dc9e06257d1c6e783e", + "matched_output_lines": 666082 + } + ], + "scope": "Registered entity AttributeMap defaults/modifiers composed with actual LivingEntity/Player health methods, SynchedEntityData float health and FoodData regeneration. All 93 default suppliers; attribute mutations, health limits, actual healing and dirty state, hunger/exhaustion/timers, observer failures and starvation requests. Internal absorption storage and starvation damage delivery are controlled; Player absorption synchronization, attribute-change refresh, full damage and live gameplay remain pending." +} diff --git a/crates/horizon-world/examples/attribute_health_fixture.rs b/crates/horizon-world/examples/attribute_health_fixture.rs new file mode 100644 index 000000000..ef8433fce --- /dev/null +++ b/crates/horizon-world/examples/attribute_health_fixture.rs @@ -0,0 +1,236 @@ +use horizon_world::{ + attribute_health::{AttributeHealth, HealthError, HealthObserver}, + attributes::{ + Modifier, Operation, + entity::{Catalog, EntityAttributes}, + }, + food::{Difficulty, FoodData, FoodWorld}, + living_health::SyncedFloat, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, + sync::Arc, +}; +fn single(v: &Value) -> f32 { + f32::from_bits(u32::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn bits(v: f32) -> u32 { + if v.is_nan() { + f32::NAN.to_bits() + } else { + v.to_bits() + } +} +fn double_bits(v: f64) -> u64 { + if v.is_nan() { + f64::NAN.to_bits() + } else { + v.to_bits() + } +} +struct Observer<'a> { + out: &'a mut dyn Write, + calls: i64, + fail: i64, +} +impl Observer<'_> { + fn effect(&mut self, s: &str) -> io::Result<()> { + writeln!(self.out, "{s}")?; + let n = self.calls; + self.calls += 1; + if n == self.fail { + Err(io::Error::other("injected effect failure")) + } else { + Ok(()) + } + } +} +impl HealthObserver for Observer<'_> { + type Error = io::Error; + fn updated(&mut self, h: &mut SyncedFloat) -> io::Result<()> { + self.effect(&format!("updated {:08x}", bits(h.value()))) + } +} +struct World<'a> { + attributes: EntityAttributes, + health: SyncedFloat, + absorption: f32, + dead: bool, + regen: bool, + difficulty: Difficulty, + observer: Observer<'a>, +} +impl<'a> World<'a> { + fn binding(&mut self) -> AttributeHealth<'_, Observer<'a>> { + AttributeHealth::new( + &mut self.attributes, + &mut self.health, + &mut self.absorption, + self.dead, + &mut self.observer, + ) + .unwrap() + } +} +impl FoodWorld for World<'_> { + type Error = HealthError; + type Level = (); + fn level(&mut self, _: &mut FoodData) -> Result<(), Self::Error> { + Ok(()) + } + fn difficulty(&mut self, _: (), _: &mut FoodData) -> Result { + Ok(self.difficulty) + } + fn natural_regeneration(&mut self, _: (), _: &mut FoodData) -> Result { + Ok(self.regen) + } + fn is_hurt(&mut self, _: &mut FoodData) -> Result { + self.binding().is_hurt() + } + fn heal(&mut self, _: &mut FoodData, v: f32) -> Result<(), Self::Error> { + self.binding().heal(v) + } + fn health(&mut self, _: &mut FoodData) -> Result { + Ok(self.health.value()) + } + fn hurt_starvation(&mut self, _: (), _: &mut FoodData, v: f32) -> Result<(), Self::Error> { + self.observer + .effect(&format!("starve {:08x}", bits(v))) + .map_err(HealthError::Observer) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + let catalog = Arc::new(Catalog::from_json(&serde_json::from_str( + &fs::read_to_string(dir.join("catalog.json"))?, + )?)?); + let keys = [ + catalog.id("minecraft:max_health").unwrap(), + catalog.id("minecraft:max_absorption").unwrap(), + ]; + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut w = World { + attributes: catalog.create(f["entity"].as_str().unwrap()).unwrap(), + health: SyncedFloat::new(single(&f["health"])), + absorption: single(&f["absorption"]), + dead: f["dead"].as_bool().unwrap(), + regen: f["regen"].as_bool().unwrap(), + difficulty: [ + Difficulty::Peaceful, + Difficulty::Easy, + Difficulty::Normal, + Difficulty::Hard, + ][f["difficulty"].as_u64().unwrap() as usize], + observer: Observer { + out: &mut out, + calls: 0, + fail: f["fail"].as_i64().unwrap(), + }, + }; + let t = &f["food"]; + let mut food = FoodData { + food: t["food"].as_i64().unwrap() as i32, + saturation: single(&t["saturation"]), + exhaustion: single(&t["exhaustion"]), + timer: t["timer"].as_i64().unwrap() as i32, + }; + for op in f["ops"].as_array().unwrap() { + let v = single(&op["value"]); + let key = keys[op["attribute"].as_u64().unwrap() as usize]; + let result = match op["mode"].as_str().unwrap() { + "base" => { + w.attributes + .edit(key, |a, o| a.set_base_value(number(&op["amount"]), o)) + .unwrap() + .unwrap(); + Ok(()) + } + "add" => { + let m = Modifier::new( + op["id"].as_str().unwrap(), + number(&op["amount"]), + Operation::ALL[op["operation"].as_u64().unwrap() as usize], + )?; + w.attributes + .edit(key, |a, o| a.add_or_update_transient(m, o)) + .unwrap() + .unwrap(); + Ok(()) + } + "remove" => { + w.attributes + .edit(key, |a, o| a.remove(op["id"].as_str().unwrap(), o)) + .unwrap() + .unwrap(); + Ok(()) + } + "reset" => { + w.attributes.reset_base(key); + Ok(()) + } + "set" => w.binding().set_health(v), + "heal" => w.binding().heal(v), + "absorption" => w.binding().set_absorption(v), + "hurt" => w.binding().is_hurt().and_then(|v| { + writeln!(w.observer.out, "bool {v}").map_err(HealthError::Observer) + }), + "dead" => w.binding().is_dead_or_dying().and_then(|v| { + writeln!(w.observer.out, "bool {v}").map_err(HealthError::Observer) + }), + "tick" => food.tick(&mut w), + "eat" => { + food.eat(op["nutrition"].as_i64().unwrap() as i32, v); + Ok(()) + } + "exhaust" => { + food.add_exhaustion(v); + Ok(()) + } + "pack" => writeln!( + w.observer.out, + "packed {}", + w.health + .take_dirty() + .map(|v| format!("{:08x}", bits(v))) + .unwrap_or_else(|| "none".into()) + ) + .map_err(HealthError::Observer), + _ => panic!("mode"), + }; + writeln!( + w.observer.out, + "result {}", + if result.is_ok() { "ok" } else { "error" } + )?; + writeln!( + w.observer.out, + "state {:08x} {} {} {:08x} {} {:08x} {:08x} {} {}", + bits(w.health.value()), + w.health.is_dirty(), + w.health.is_default(), + bits(w.absorption), + food.food, + bits(food.saturation), + bits(food.exhaustion), + food.timer, + w.observer.calls + )?; + writeln!( + w.observer.out, + "limits {:016x} {:016x}", + double_bits(w.attributes.value(keys[0]).unwrap()), + double_bits(w.attributes.value(keys[1]).unwrap()) + )?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/src/attribute_health.rs b/crates/horizon-world/src/attribute_health.rs new file mode 100644 index 000000000..03fc0945d --- /dev/null +++ b/crates/horizon-world/src/attribute_health.rs @@ -0,0 +1,106 @@ +//! Bind health calculations to registered entity attributes and mutable data. +use crate::{ + attributes::entity::{AttributeId, EntityAttributes, LookupError}, + living_health::{self, HealthWorld, SyncedFloat}, +}; +use std::fmt; + +#[derive(Debug)] +pub enum HealthError { + Attribute(LookupError), + Observer(E), +} +impl fmt::Display for HealthError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::Attribute(e) => write!(f, "health attribute lookup: {e:?}"), + Self::Observer(e) => e.fmt(f), + } + } +} +impl std::error::Error for HealthError {} +pub trait HealthObserver { + type Error; + fn updated(&mut self, health: &mut SyncedFloat) -> Result<(), Self::Error>; +} +/// A borrow of living state, without inventing spawn or save initialization. +/// Absorption here uses base LivingEntity field storage. Player-specific +/// synchronized absorption requires a different storage binding. +pub struct AttributeHealth<'a, O> { + attributes: &'a mut EntityAttributes, + health: &'a mut SyncedFloat, + absorption: &'a mut f32, + dead: bool, + observer: &'a mut O, + max_health: AttributeId, + max_absorption: AttributeId, +} +impl<'a, O: HealthObserver> AttributeHealth<'a, O> { + pub fn new( + attributes: &'a mut EntityAttributes, + health: &'a mut SyncedFloat, + absorption: &'a mut f32, + dead: bool, + observer: &'a mut O, + ) -> Option { + let max_health = attributes.catalog().id("minecraft:max_health")?; + let max_absorption = attributes.catalog().id("minecraft:max_absorption")?; + Some(Self { + attributes, + health, + absorption, + dead, + observer, + max_health, + max_absorption, + }) + } + pub fn heal(&mut self, amount: f32) -> Result<(), HealthError> { + living_health::heal(self, amount) + } + pub fn set_health(&mut self, value: f32) -> Result<(), HealthError> { + living_health::set_health(self, value) + } + pub fn set_absorption(&mut self, value: f32) -> Result<(), HealthError> { + living_health::set_absorption(self, value) + } + pub fn is_hurt(&mut self) -> Result> { + living_health::is_hurt(self) + } + pub fn is_dead_or_dying(&mut self) -> Result> { + living_health::is_dead_or_dying(self) + } +} +impl HealthWorld for AttributeHealth<'_, O> { + type Error = HealthError; + type Data = (); + fn health(&mut self) -> Result { + Ok(self.health.value()) + } + fn health_data(&self) {} + fn max_health_attribute(&mut self) -> Result { + self.attributes + .value(self.max_health) + .map_err(HealthError::Attribute) + } + fn max_absorption_attribute(&mut self) -> Result { + self.attributes + .value(self.max_absorption) + .map_err(HealthError::Attribute) + } + fn store_health(&mut self, _: (), value: f32) -> Result<(), Self::Error> { + self.health + .set(value, false, |health| self.observer.updated(health)) + .map_err(HealthError::Observer) + } + fn store_absorption(&mut self, value: f32) -> Result<(), Self::Error> { + *self.absorption = value; + Ok(()) + } + fn dead_flag(&self) -> bool { + self.dead + } + fn dispatch_set_health(&mut self, value: f32) -> Result<(), Self::Error> { + living_health::set_health(self, value) + } +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 523b2dd81..43afd49b8 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -1,6 +1,7 @@ //! Vanilla-compatible world data for Horizon. This crate does not run gameplay. #![forbid(unsafe_code)] +pub mod attribute_health; pub mod attributes; pub mod block_collision; pub mod block_collision_scan; diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index c90ddcecd..533d7798b 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1183,3 +1183,19 @@ during callbacks and partial effects after exceptions. Targeted Clippy passes. Attribute values and the internal absorption sink are controlled. Player-specific absorption synchronization, multiple synchronized items, registered attribute binding, full damage processing and playable entities remain pending. + + +`attribute_health` binds the health engine to registered entity attributes and +mutable synchronized health. `AttributeHealth` borrows existing state, queries +actual modified MAX_HEALTH/MAX_ABSORPTION values and propagates observer errors +without losing partial health writes. Base living absorption uses field storage. + +`python3 tools/test_attribute_health_parity.py` composes actual registered +`AttributeMap`, LivingEntity/Player health methods, `SynchedEntityData` and +`FoodData`. The [composition report](../benchmarks/rust-attribute-health-2026-10-07/scoped-parity.json) +records **666,082 matching lines per JAR**, including all **93 entity suppliers**, +attribute base/modifier changes, real regeneration health writes, 100-tick hunger +sequences and failed synchronization callbacks. Targeted Clippy passes. The +internal absorption sink and starvation damage delivery are controlled; +player absorption synchronization, attribute-change refresh, full damage and +live gameplay integration remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaAttributeHealthOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaAttributeHealthOracle.java new file mode 100644 index 000000000..18c14f659 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaAttributeHealthOracle.java @@ -0,0 +1,53 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.lang.reflect.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.*;import net.minecraft.core.registries.*;import net.minecraft.resources.Identifier; +import net.minecraft.world.entity.*;import net.minecraft.world.entity.ai.attributes.*;import net.minecraft.server.level.*;import net.minecraft.network.syncher.*; +import net.minecraft.world.food.FoodData;import net.minecraft.world.Difficulty;import net.minecraft.world.damagesource.*;import net.minecraft.world.level.gamerules.*; +/** Actual registered attributes, synchronized health and hunger regeneration. */ +public final class VanillaAttributeHealthOracle { + static final class Stop extends RuntimeException {} + static Object unsafe;static Method allocate;static EntityDataAccessor healthKey;static Field absorption,exhaustion,timer; + static T make(Class c)throws Exception{return c.cast(allocate.invoke(unsafe,c));} + static Field field(Class c,String n)throws Exception{var f=c.getDeclaredField(n);f.setAccessible(true);return f;} + static String bits(float v){return String.format("%08x",Float.floatToIntBits(v));} + static String doubleBits(double v){return String.format("%016x",Double.doubleToLongBits(v));} + static float single(JsonElement v){return Float.intBitsToFloat(Integer.parseUnsignedInt(v.getAsString(),16));} + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + static final class Data {JsonObject f;PrintWriter out;Actor actor;Level level;Rules rules;Sources sources;AttributeMap attributes;FoodData food;int calls; + void effect(String s){out.println(s);if(calls++==f.get("fail").getAsInt())throw new Stop();}} + static final class Rules extends GameRules {Data d;Rules(){super(net.minecraft.world.flag.FeatureFlagSet.of());}@SuppressWarnings("unchecked")@Override public T get(GameRule r){if(r!=GameRules.NATURAL_HEALTH_REGENERATION)throw new AssertionError();return (T)Boolean.valueOf(d.f.get("regen").getAsBoolean());}} + static final class Sources extends DamageSources {DamageSource source;Sources(){super(null);}@Override public DamageSource starve(){return source;}} + static final class Level extends ServerLevel {Data d;Level(){super(null,null,null,null,null,null,false,0L,List.of(),false);}@Override public Difficulty getDifficulty(){return Difficulty.values()[d.f.get("difficulty").getAsInt()];}@Override public GameRules getGameRules(){return d.rules;}} + static final class Actor extends ServerPlayer {Data d;Actor(){super(null,null,null,null);} + @Override public ServerLevel level(){return d.level;} + @Override public double getAttributeValue(Holder a){return d.attributes.getValue(a);} + @Override public void onSyncedDataUpdated(EntityDataAccessor a){if(a!=healthKey)throw new AssertionError();d.effect("updated "+bits(getHealth()));} + @Override protected void internalSetAbsorptionAmount(float v){try{absorption.setFloat(this,v);}catch(Exception e){throw new AssertionError(e);}} + @Override public DamageSources damageSources(){return d.sources;} + @Override public boolean hurtServer(ServerLevel l,DamageSource s,float v){if(l!=d.level||s!=d.sources.source)throw new AssertionError();d.effect("starve "+bits(v));return false;} + } + @SuppressWarnings("unchecked") public static void main(String[] args)throws Exception { + if(args[0].equals("export")){VanillaEntityAttributeOracle.main(args);return;} + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();var u=Class.forName("sun.misc.Unsafe");var uf=u.getDeclaredField("theUnsafe");uf.setAccessible(true);unsafe=uf.get(null);allocate=u.getMethod("allocateInstance",Class.class);healthKey=(EntityDataAccessor)field(LivingEntity.class,"DATA_HEALTH_ID").get(null); + absorption=field(LivingEntity.class,"absorptionAmount");exhaustion=field(FoodData.class,"exhaustionLevel");timer=field(FoodData.class,"tickTimer");var entityData=field(Entity.class,"entityData");var dead=field(LivingEntity.class,"dead"); + var ctor=SynchedEntityData.class.getDeclaredConstructor(SyncedDataHolder.class,SynchedEntityData.DataItem[].class);ctor.setAccessible(true);var keys=List.of(Attributes.MAX_HEALTH,Attributes.MAX_ABSORPTION);Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();var d=new Data();d.f=f;d.out=out;d.actor=make(Actor.class);d.actor.d=d; + var type=BuiltInRegistries.ENTITY_TYPE.getValue(Identifier.parse(f.get("entity").getAsString()));d.attributes=new AttributeMap(VanillaEntityAttributeOracle.supplier(type));d.level=make(Level.class);d.level.d=d;d.rules=make(Rules.class);d.rules.d=d;d.sources=make(Sources.class);d.sources.source=make(DamageSource.class); + var items=new SynchedEntityData.DataItem[healthKey.id()+1];for(int i=0;i(new EntityDataAccessor(i,EntityDataSerializers.FLOAT),0f);var health=new SynchedEntityData.DataItem(healthKey,single(f.get("health")));items[healthKey.id()]=health;var data=ctor.newInstance(d.actor,items);entityData.set(d.actor,data);dead.setBoolean(d.actor,f.get("dead").getAsBoolean());absorption.setFloat(d.actor,single(f.get("absorption"))); + d.food=new FoodData();var food=f.getAsJsonObject("food");d.food.setFoodLevel(food.get("food").getAsInt());d.food.setSaturation(single(food.get("saturation")));exhaustion.setFloat(d.food,single(food.get("exhaustion")));timer.setInt(d.food,food.get("timer").getAsInt()); + for(var ov:f.getAsJsonArray("ops")){var op=ov.getAsJsonObject();var key=keys.get(op.get("attribute").getAsInt());float v=single(op.get("value"));try{switch(op.get("mode").getAsString()){ + case "base":d.attributes.getInstance(key).setBaseValue(number(op.get("amount")));break; + case "add":d.attributes.getInstance(key).addOrUpdateTransientModifier(new AttributeModifier(Identifier.parse(op.get("id").getAsString()),number(op.get("amount")),AttributeModifier.Operation.values()[op.get("operation").getAsInt()]));break; + case "remove":d.attributes.getInstance(key).removeModifier(Identifier.parse(op.get("id").getAsString()));break; + case "reset":d.attributes.resetBaseValue(key);break; + case "set":d.actor.setHealth(v);break;case "heal":d.actor.heal(v);break;case "absorption":d.actor.setAbsorptionAmount(v);break; + case "hurt":out.println("bool "+d.actor.isHurt());break;case "dead":out.println("bool "+d.actor.isDeadOrDying());break; + case "tick":d.food.tick(d.actor);break;case "eat":d.food.eat(op.get("nutrition").getAsInt(),v);break;case "exhaust":d.food.addExhaustion(v);break; + case "pack":{var p=data.packDirty();out.println("packed "+(p==null?"none":bits((Float)p.getFirst().value())));break;} + default:throw new AssertionError();}out.println("result ok");}catch(Stop e){out.println("result error");} + out.println("state "+bits(health.getValue())+" "+data.isDirty()+" "+health.isSetToDefault()+" "+bits(absorption.getFloat(d.actor))+" "+d.food.getFoodLevel()+" "+bits(d.food.getSaturationLevel())+" "+bits(exhaustion.getFloat(d.food))+" "+timer.getInt(d.food)+" "+d.calls); + out.println("limits "+doubleBits(d.attributes.getValue(keys.get(0)))+" "+doubleBits(d.attributes.getValue(keys.get(1)))); + } + }} + } +} diff --git a/tools/test_attribute_health_parity.py b/tools/test_attribute_health_parity.py new file mode 100644 index 000000000..f8b5a9b9c --- /dev/null +++ b/tools/test_attribute_health_parity.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python3 +"""Compare registered health attributes, synchronization and hunger regeneration with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(catalog): + def bits(v):return struct.pack('>f',v).hex() + def double(v):return struct.pack('>d',v).hex() + def op(mode,value=0,attribute=0,amount=0,operation=0,**kw): + o=dict(mode=mode,value=bits(value),attribute=attribute,amount=double(amount),operation=operation,id='horizon:a',nutrition=2);o.update(kw);return o + def food(n=20,s=5,e=0,t=9):return dict(food=n,saturation=bits(s),exhaustion=bits(e),timer=t) + def row(entity,ops,**kw): + f=dict(entity=entity,ops=ops,health=bits(10),absorption=bits(0),dead=False,regen=True,difficulty=2,food=food(),fail=-1);f.update(kw);return f + values=[-float('inf'),-1e30,-1,-0.,0.,1e-40,.1,1,5,10,20,1e30,float('inf'),float('nan')] + entities=list(catalog['entities']) + for entity in entities: + for value in values: + ops=[op('hurt'),op('heal',1),op('base',amount=value),op('heal',1),op('set',value),op('base',attribute=1,amount=value),op('absorption',value),op('reset'),op('tick'),op('pack')] + for operation in range(3):ops.extend([op('add',amount=.25,operation=operation),op('heal',1),op('tick'),op('pack')]) + ops.extend([op('remove'),op('heal',1),op('dead')]);yield row(entity,ops) + for entity in entities: + for n,s,t in [(20,5,9),(18,0,79),(0,0,79)]: + for fail in [-1,0,1,2]:yield row(entity,[op('tick') for _ in range(100)]+[op('pack')],food=food(n,s,0,t),fail=fail) + rng=random.Random(0x4845414c464f4f44) + for _ in range(1500): + ops=[op(rng.choice(['hurt','dead','heal','set','absorption','tick','tick','eat','exhaust','pack','base','add','remove','reset']),rng.choice(values),rng.randrange(2),rng.choice(values),rng.randrange(3),id=rng.choice(['horizon:a','horizon:b']),nutrition=rng.choice([-1,0,1,2,20])) for __ in range(rng.randrange(5,80))] + yield row(rng.choice(entities),ops,health=bits(rng.choice(values)),absorption=bits(rng.choice(values)),dead=bool(rng.randrange(2)),regen=bool(rng.randrange(2)),difficulty=rng.randrange(4),food=food(rng.choice([0,17,18,19,20]),rng.choice(values),rng.choice(values),rng.choice([0,9,79])),fail=rng.choice([-1,-1,0,1,2,5])) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-attribute-health-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaAttributeHealthOracle.java' + helper=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityAttributeOracle.java' + sources=[oracle,helper,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/attribute_health_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle,helper],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaAttributeHealthOracle',mode,path],side+'-'+mode) + java('server','export',build);states=json.loads((build/'catalog.json').read_text());fixtures=list(corpus(states));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs,build/'catalog.json'];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','attribute_health_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('attribute_health_fixture.exe' if os.name=='nt' else 'attribute_health_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} attribute health output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Registered entity AttributeMap defaults/modifiers composed with actual LivingEntity/Player health methods, SynchedEntityData float health and FoodData regeneration. All 93 default suppliers; attribute mutations, health limits, actual healing and dirty state, hunger/exhaustion/timers, observer failures and starvation requests. Internal absorption storage and starvation damage delivery are controlled; Player absorption synchronization, attribute-change refresh, full damage and live gameplay remain pending.'} + lab.write_json(report_path,report);print(f'Scoped attribute health parity passed: {report_path}') + + +if __name__=='__main__':main() From 9c451321a26fd16603a063a34607f86c8f28ed66 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 04:28:50 +0200 Subject: [PATCH 109/253] Reduce entity attribute memory with shared defaults and lazy allocation --- .../after.json | 76 ++++++ .../before.json | 76 ++++++ .../entity-regression.json | 247 +++++++++++++++++ .../health-regression.json | 248 ++++++++++++++++++ .../examples/attribute_memory.rs | 47 ++++ crates/horizon-world/src/attributes/entity.rs | 21 +- docs/collision-geometry.md | 22 ++ tools/measure_attribute_memory.py | 42 +++ 8 files changed, 770 insertions(+), 9 deletions(-) create mode 100644 benchmarks/rust-attribute-memory-2026-10-07/after.json create mode 100644 benchmarks/rust-attribute-memory-2026-10-07/before.json create mode 100644 benchmarks/rust-attribute-memory-2026-10-07/entity-regression.json create mode 100644 benchmarks/rust-attribute-memory-2026-10-07/health-regression.json create mode 100644 crates/horizon-world/examples/attribute_memory.rs create mode 100644 tools/measure_attribute_memory.py diff --git a/benchmarks/rust-attribute-memory-2026-10-07/after.json b/benchmarks/rust-attribute-memory-2026-10-07/after.json new file mode 100644 index 000000000..16672b1d9 --- /dev/null +++ b/benchmarks/rust-attribute-memory-2026-10-07/after.json @@ -0,0 +1,76 @@ +{ + "schema": 1, + "phase": "after", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "catalog_sha256": "d1e488e4f432888beb9f643904c8bca242d1e2093f53e23e07da305d70cf7106", + "sources_sha256": { + "tools/measure_attribute_memory.py": "30920696fdc0868f109b8c6863132810e56297ce9d9af8b917d8d45506fb9620", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/examples/attribute_memory.rs": "29c0944f0a687369eb012f441c7b7f69eac95658be062bf742470f94b2ef6cd8" + }, + "results": [ + { + "mode": "defaults", + "entities": 20000, + "active_per_entity": 0, + "samples_kib": [ + { + "VmRSS": 12852, + "VmHWM": 12852 + }, + { + "VmRSS": 12852, + "VmHWM": 12852 + }, + { + "VmRSS": 12848, + "VmHWM": 12848 + }, + { + "VmRSS": 12840, + "VmHWM": 12840 + }, + { + "VmRSS": 12804, + "VmHWM": 12804 + } + ], + "median_rss_kib": 12848, + "median_peak_kib": 12848 + }, + { + "mode": "active", + "entities": 20000, + "active_per_entity": 4, + "samples_kib": [ + { + "VmRSS": 29076, + "VmHWM": 29076 + }, + { + "VmRSS": 29068, + "VmHWM": 29068 + }, + { + "VmRSS": 29096, + "VmHWM": 29096 + }, + { + "VmRSS": 29092, + "VmHWM": 29092 + }, + { + "VmRSS": 29028, + "VmHWM": 29028 + } + ], + "median_rss_kib": 29076, + "median_peak_kib": 29076 + } + ], + "scope": "Five fresh release-process samples per case, 20,000 held-live zombie attribute maps, no instances or four instantiated attributes. RSS/peak includes allocator/runtime/catalog. Identical health-read checksum. Excludes the rest of entity/world state; no timing, rendering or FPS conclusion." +} diff --git a/benchmarks/rust-attribute-memory-2026-10-07/before.json b/benchmarks/rust-attribute-memory-2026-10-07/before.json new file mode 100644 index 000000000..6f4ea2019 --- /dev/null +++ b/benchmarks/rust-attribute-memory-2026-10-07/before.json @@ -0,0 +1,76 @@ +{ + "schema": 1, + "phase": "before", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "catalog_sha256": "d1e488e4f432888beb9f643904c8bca242d1e2093f53e23e07da305d70cf7106", + "sources_sha256": { + "tools/measure_attribute_memory.py": "30920696fdc0868f109b8c6863132810e56297ce9d9af8b917d8d45506fb9620", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-world/src/attributes/entity.rs": "d165e952e0ff2d1a1b037c03df5fbc778b7e263b8f9e402cf9b0fa27c933e0c6", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/examples/attribute_memory.rs": "29c0944f0a687369eb012f441c7b7f69eac95658be062bf742470f94b2ef6cd8" + }, + "results": [ + { + "mode": "defaults", + "entities": 20000, + "active_per_entity": 0, + "samples_kib": [ + { + "VmRSS": 175824, + "VmHWM": 175824 + }, + { + "VmRSS": 175820, + "VmHWM": 175820 + }, + { + "VmRSS": 175816, + "VmHWM": 175816 + }, + { + "VmRSS": 175812, + "VmHWM": 175812 + }, + { + "VmRSS": 175820, + "VmHWM": 175820 + } + ], + "median_rss_kib": 175820, + "median_peak_kib": 175820 + }, + { + "mode": "active", + "entities": 20000, + "active_per_entity": 4, + "samples_kib": [ + { + "VmRSS": 175788, + "VmHWM": 175788 + }, + { + "VmRSS": 175824, + "VmHWM": 175824 + }, + { + "VmRSS": 175816, + "VmHWM": 175816 + }, + { + "VmRSS": 175800, + "VmHWM": 175800 + }, + { + "VmRSS": 175780, + "VmHWM": 175780 + } + ], + "median_rss_kib": 175800, + "median_peak_kib": 175800 + } + ], + "scope": "Five fresh release-process samples per case, 20,000 held-live zombie attribute maps, no instances or four instantiated attributes. RSS/peak includes allocator/runtime/catalog. Identical health-read checksum. Excludes the rest of entity/world state; no timing, rendering or FPS conclusion." +} diff --git a/benchmarks/rust-attribute-memory-2026-10-07/entity-regression.json b/benchmarks/rust-attribute-memory-2026-10-07/entity-regression.json new file mode 100644 index 000000000..b6d36fa41 --- /dev/null +++ b/benchmarks/rust-attribute-memory-2026-10-07/entity-regression.json @@ -0,0 +1,247 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 4720, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityAttributeOracle.java": "2ad3190a9798ab54bd12e88573028d0ca6a204e2f8a92018aae98b22335213bf", + "tools/test_entity_attribute_parity.py": "cdd15835061eb2ed8d1fbbbf77cf515ec7515b7ff129a3deaf403142ce9caead", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "2702d60f7bf8f8d5f9421d5d4c645d7d748271f8dea12e5ec0e457b3a3f1becf", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/entity_attribute_fixture.rs": "f6512186478dc1de5e5b983d81aa23f3834e85875f9fa9bec0b9967117deff95" + }, + "fixtures_sha256": { + ".local/rust-entity-attribute-parity/inputs.txt": "9a45638fedc1b8a70d247acc64dc5b06fa3e2ec550fc4a65d89173fabdd0e886", + ".local/rust-entity-attribute-parity/catalog.json": "d1e488e4f432888beb9f643904c8bca242d1e2093f53e23e07da305d70cf7106" + }, + "rust_output_sha256": "dafe9dce265957c9cafe59a6b830a68fd23a2c2e2d8de3df215ce38252ae0100", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "dafe9dce265957c9cafe59a6b830a68fd23a2c2e2d8de3df215ce38252ae0100", + "matched_output_lines": 1771555 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "dafe9dce265957c9cafe59a6b830a68fd23a2c2e2d8de3df215ce38252ae0100", + "matched_output_lines": 1771555 + } + ], + "scope": "Every registered attribute and entity DefaultAttributes supplier, actual AttributeMap per-attribute queries, lazy creation, mutation, base reset, update/sync membership and independent acknowledgements. Composes the verified attribute arithmetic/cache/modifier engine. Cross-attribute collection order is normalized to registry order; bulk assignment, custom suppliers with modifiers, save/network codecs, live entities and full gameplay remain pending." +} diff --git a/benchmarks/rust-attribute-memory-2026-10-07/health-regression.json b/benchmarks/rust-attribute-memory-2026-10-07/health-regression.json new file mode 100644 index 000000000..9e06a4a0f --- /dev/null +++ b/benchmarks/rust-attribute-memory-2026-10-07/health-regression.json @@ -0,0 +1,248 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 3918, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaAttributeHealthOracle.java": "0ee2907d85c91895cfd6460de225326e77e30658785be4b3f2737ac4b8edb38e", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityAttributeOracle.java": "2ad3190a9798ab54bd12e88573028d0ca6a204e2f8a92018aae98b22335213bf", + "tools/test_attribute_health_parity.py": "4429f469afccc812ce9ab1556366266ec9920f7595fd60b52e0f66933754afcd", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "2702d60f7bf8f8d5f9421d5d4c645d7d748271f8dea12e5ec0e457b3a3f1becf", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/attribute_health_fixture.rs": "53168e1135a337fa29eade20892f84ffd4458ad38fc90df2e8382169fe4db020" + }, + "fixtures_sha256": { + ".local/rust-attribute-health-parity/inputs.txt": "36ab827ee17f1452f7e88cfe26dbe368e5348da25ab6b6905f7a1b62fcfa5b7c", + ".local/rust-attribute-health-parity/catalog.json": "d1e488e4f432888beb9f643904c8bca242d1e2093f53e23e07da305d70cf7106" + }, + "rust_output_sha256": "4f7248d8f06aac71b0de827b26a3e3cfa0920a1181cc92dc9e06257d1c6e783e", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "4f7248d8f06aac71b0de827b26a3e3cfa0920a1181cc92dc9e06257d1c6e783e", + "matched_output_lines": 666082 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "4f7248d8f06aac71b0de827b26a3e3cfa0920a1181cc92dc9e06257d1c6e783e", + "matched_output_lines": 666082 + } + ], + "scope": "Registered entity AttributeMap defaults/modifiers composed with actual LivingEntity/Player health methods, SynchedEntityData float health and FoodData regeneration. All 93 default suppliers; attribute mutations, health limits, actual healing and dirty state, hunger/exhaustion/timers, observer failures and starvation requests. Internal absorption storage and starvation damage delivery are controlled; Player absorption synchronization, attribute-change refresh, full damage and live gameplay remain pending." +} diff --git a/crates/horizon-world/examples/attribute_memory.rs b/crates/horizon-world/examples/attribute_memory.rs new file mode 100644 index 000000000..b814711ac --- /dev/null +++ b/crates/horizon-world/examples/attribute_memory.rs @@ -0,0 +1,47 @@ +//! Held-live entity attribute allocation workload for external RSS measurement. +use horizon_world::attributes::entity::Catalog; +use std::{ + hint::black_box, + io::{self, Write}, + sync::Arc, +}; +fn main() -> Result<(), Box> { + let args: Vec<_> = std::env::args().collect(); + let catalog = Arc::new(Catalog::from_json(&serde_json::from_str( + &std::fs::read_to_string(&args[1])?, + )?)?); + let count: usize = args[2].parse()?; + let active = args[3] == "active"; + if count > 100_000 { + return Err("allocation workload exceeds limit".into()); + } + let keys = [ + "minecraft:max_health", + "minecraft:max_absorption", + "minecraft:movement_speed", + "minecraft:armor", + ] + .map(|s| catalog.id(s).unwrap()); + let mut entities = Vec::with_capacity(count); + let mut sum = 0.0; + for _ in 0..count { + let mut a = catalog.create("minecraft:zombie").unwrap(); + if active { + for id in keys { + assert!(a.ensure(id)); + } + } + sum += a.value(keys[0]).unwrap(); + entities.push(a); + } + black_box(&entities); + println!( + "{}", + serde_json::json!({"entities":entities.len(),"active_per_entity":if active{4}else{0},"health_sum":sum}) + ); + io::stdout().flush()?; + let mut line = String::new(); + io::stdin().read_line(&mut line)?; + black_box(&entities); + Ok(()) +} diff --git a/crates/horizon-world/src/attributes/entity.rs b/crates/horizon-world/src/attributes/entity.rs index 0990cf21f..63efca2b7 100644 --- a/crates/horizon-world/src/attributes/entity.rs +++ b/crates/horizon-world/src/attributes/entity.rs @@ -17,7 +17,7 @@ pub struct RegisteredAttribute { pub struct Catalog { attributes: Vec, ids: BTreeMap, - defaults: BTreeMap>>, + defaults: BTreeMap]>>, } fn string(v: &Value) -> io::Result<&str> { v.as_str() @@ -84,7 +84,7 @@ impl Catalog { .ok_or_else(|| invalid("unknown supplier attribute"))?; bases[id.0] = Some(number(base)?); } - defaults.insert(entity.clone(), bases); + defaults.insert(entity.clone(), Arc::from(bases)); } Ok(Self { attributes, @@ -144,8 +144,8 @@ impl Observer for DirtyObserver<'_> { } pub struct EntityAttributes { catalog: Arc, - bases: Vec>, - instances: Vec>, + bases: Arc<[Option]>, + instances: Vec>>, updates: Vec, sync: Vec, } @@ -157,11 +157,11 @@ impl EntityAttributes { self.bases[id.0].is_some() } pub fn instance(&self, id: AttributeId) -> Option<&Instance> { - self.instances[id.0].as_ref() + self.instances[id.0].as_deref() } /// Merely querying a default value must not instantiate or dirty it. pub fn value(&mut self, id: AttributeId) -> Result { - if let Some(a) = self.instances[id.0].as_mut() { + if let Some(a) = self.instances[id.0].as_deref_mut() { return Ok(a.value()); } let base = self.bases[id.0].ok_or(LookupError::MissingAttribute)?; @@ -169,7 +169,7 @@ impl EntityAttributes { } pub fn base_value(&self, id: AttributeId) -> Result { self.instances[id.0] - .as_ref() + .as_deref() .map(Instance::base_value) .or(self.bases[id.0]) .ok_or(LookupError::MissingAttribute) @@ -213,7 +213,7 @@ impl EntityAttributes { let mut source = Instance::new(definition.definition); source.base = base; instance.replace_from(&source, &mut observer).unwrap(); - self.instances[id.0] = Some(instance); + self.instances[id.0] = Some(Box::new(instance)); true } /// Mutations must use the supplied observer to preserve dirty memberships. @@ -230,7 +230,10 @@ impl EntityAttributes { sync: &mut self.sync[id.0], syncable: self.catalog.attribute(id).syncable, }; - Some(f(self.instances[id.0].as_mut().unwrap(), &mut observer)) + Some(f( + self.instances[id.0].as_deref_mut().unwrap(), + &mut observer, + )) } /// Reset uses the entity supplier's base, without creating a missing instance. pub fn reset_base(&mut self, id: AttributeId) -> bool { diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 533d7798b..3abb56c31 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1199,3 +1199,25 @@ sequences and failed synchronization callbacks. Targeted Clippy passes. The internal absorption sink and starvation damage delivery are controlled; player absorption synchronization, attribute-change refresh, full damage and live gameplay integration remain pending. + + +Entity attribute storage now shares immutable supplier bases and allocates each +mutable instance only on first access. This retains dense lookup indices while +avoiding space for unused instance objects in every entity. + +`python3 tools/measure_attribute_memory.py --phase before|after` measures a Linux +release-process workload of 20,000 held-live zombie attribute maps, using five +fresh processes per case. Median process RSS changed from **175,820 to 12,848 +KiB** with defaults only, and **175,800 to 29,076 KiB** with four active attributes +per entity. Both cases retain the same health-read checksum. The +[before](../benchmarks/rust-attribute-memory-2026-10-07/before.json) and +[after](../benchmarks/rust-attribute-memory-2026-10-07/after.json) reports record +samples and source hashes; the baseline entity implementation is `fd185a6`. +RSS includes runtime, catalog and allocator overhead. This is not whole-game +memory, a timing benchmark or evidence of an FPS improvement. + +The optimized implementation passes both pinned JAR comparisons again: +[entity attributes](../benchmarks/rust-attribute-memory-2026-10-07/entity-regression.json) +(**1,771,555 lines per JAR**) and +[health/hunger composition](../benchmarks/rust-attribute-memory-2026-10-07/health-regression.json) +(**666,082 lines per JAR**). Targeted Clippy passes. diff --git a/tools/measure_attribute_memory.py b/tools/measure_attribute_memory.py new file mode 100644 index 000000000..ebb8e0202 --- /dev/null +++ b/tools/measure_attribute_memory.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +"""Measure held-live attribute storage RSS on Linux; not a frame-rate benchmark.""" +import argparse,json,os,platform,statistics,subprocess +from pathlib import Path +try: + from . import lab,test_rust_parity as base +except ImportError: + import lab,test_rust_parity as base + +def main(): + parser=argparse.ArgumentParser(description=__doc__) + parser.add_argument('--phase',required=True,choices=['before','after']) + parser.add_argument('--catalog',type=Path,default=lab.LOCAL/'rust-entity-attribute-parity/catalog.json') + args=parser.parse_args() + if platform.system()!='Linux':raise SystemExit('This measurement uses Linux /proc status.') + build=lab.LOCAL/'rust-attribute-memory';build.mkdir(exist_ok=True,parents=True) + sources=[Path(__file__),lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-world/src/attributes/entity.rs',lab.ROOT/'crates/horizon-world/src/attributes/mod.rs',lab.ROOT/'crates/horizon-world/examples/attribute_memory.rs'] + hashes=base.source_hashes(sources);catalog_hash=lab.digest(args.catalog,'sha256') + with (build/'compile.log').open('w') as log:base.run(['cargo','build','--release','-p','horizon-world','--example','attribute_memory'],stdout=log,stderr=subprocess.STDOUT) + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples/attribute_memory' + results=[] + for mode in ['defaults','active']: + samples=[] + for _ in range(5): + process=subprocess.Popen([str(binary),str(args.catalog),'20000',mode],cwd=lab.ROOT,stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=subprocess.PIPE,text=True) + try: + ready=json.loads(process.stdout.readline()) + if ready!={'entities':20000,'active_per_entity':4 if mode=='active' else 0,'health_sum':400000.0}:raise AssertionError(ready) + status={line.split(':',1)[0]:line.split(':',1)[1].strip() for line in Path(f'/proc/{process.pid}/status').read_text().splitlines() if ':' in line} + samples.append({key:int(status[key].split()[0]) for key in ['VmRSS','VmHWM']}) + _,err=process.communicate('\n',timeout=30) + if process.returncode:raise RuntimeError(err) + finally: + if process.poll() is None:process.kill();process.wait() + results.append({'mode':mode,'entities':20000,'active_per_entity':4 if mode=='active' else 0,'samples_kib':samples,'median_rss_kib':statistics.median(s['VmRSS'] for s in samples),'median_peak_kib':statistics.median(s['VmHWM'] for s in samples)}) + base.ensure_sources_unchanged(sources,hashes) + if lab.digest(args.catalog,'sha256')!=catalog_hash:raise RuntimeError('Catalog changed during measurement') + report=dict(schema=1,phase=args.phase,platform=platform.platform(),rustc=subprocess.check_output(['rustc','--version'],text=True).strip(),catalog_sha256=catalog_hash,sources_sha256=hashes,results=results,scope='Five fresh release-process samples per case, 20,000 held-live zombie attribute maps, no instances or four instantiated attributes. RSS/peak includes allocator/runtime/catalog. Identical health-read checksum. Excludes the rest of entity/world state; no timing, rendering or FPS conclusion.') + lab.write_json(build/(args.phase+'.json'),report) + print(json.dumps(results,indent=2)) +if __name__=='__main__':main() From 548827519164426b312a56432051e86ef53b5e10 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 04:32:00 +0200 Subject: [PATCH 110/253] Implement vanilla armor, toughness and magic damage reduction --- .../scoped-parity.json | 247 ++++++++++++++++++ .../examples/combat_rules_fixture.rs | 87 ++++++ crates/horizon-world/src/combat_rules.rs | 51 ++++ crates/horizon-world/src/lib.rs | 1 + docs/collision-geometry.md | 14 + .../parity/VanillaCombatRulesOracle.java | 21 ++ tools/test_combat_rules_parity.py | 73 ++++++ 7 files changed, 494 insertions(+) create mode 100644 benchmarks/rust-combat-rules-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/combat_rules_fixture.rs create mode 100644 crates/horizon-world/src/combat_rules.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCombatRulesOracle.java create mode 100644 tools/test_combat_rules_parity.py diff --git a/benchmarks/rust-combat-rules-2026-10-07/scoped-parity.json b/benchmarks/rust-combat-rules-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..44e6395b0 --- /dev/null +++ b/benchmarks/rust-combat-rules-2026-10-07/scoped-parity.json @@ -0,0 +1,247 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 40656, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCombatRulesOracle.java": "c42f58905c750328b967a631e8a8e7077e974af9223e1bdb8d0b10f7abeb8d4b", + "tools/test_combat_rules_parity.py": "1e50f61d136fc52df588224802cf0cc2a96a9d8d9e455eb4f76cd58420e0fda4", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "bd8c8f81570b7fdb4961954f039bc5d063fff06a4357ebac009771cac359ded7", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/combat_rules_fixture.rs": "8b1467cff4323625f9f176e826399799fd1fbbbce65b4728d4a6b474d52c5798" + }, + "fixtures_sha256": { + ".local/rust-combat-rules-parity/inputs.txt": "25f1cf8b2613906d7188a88703921c24e31a33b69d825535dc0787463511128d" + }, + "rust_output_sha256": "d4fb8f05b3c687c4e113c736c746c422e60e39e5f567a46aa1d1ee764d4d46d2", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "d4fb8f05b3c687c4e113c736c746c422e60e39e5f567a46aa1d1ee764d4d46d2", + "matched_output_lines": 184248 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "d4fb8f05b3c687c4e113c736c746c422e60e39e5f567a46aa1d1ee764d4d46d2", + "matched_output_lines": 184248 + } + ], + "scope": "Actual CombatRules armor/toughness and magic protection arithmetic; null/empty/unenchanted weapons, nonserver/server branches, native no-enchantment helper with explicitly empty stack components, query order/mutations/failures, nonfinite/signed-zero and random float bit patterns. The armor-effectiveness enchantment hook is exposed but enchanted components, damage tags/equipment and the full damage pipeline remain pending." +} diff --git a/crates/horizon-world/examples/combat_rules_fixture.rs b/crates/horizon-world/examples/combat_rules_fixture.rs new file mode 100644 index 000000000..42d01285d --- /dev/null +++ b/crates/horizon-world/examples/combat_rules_fixture.rs @@ -0,0 +1,87 @@ +use horizon_world::combat_rules::{self, ArmorWorld}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn single(v: &Value) -> f32 { + f32::from_bits(u32::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn bits(v: f32) -> u32 { + if v.is_nan() { + f32::NAN.to_bits() + } else { + v.to_bits() + } +} +struct World<'a> { + f: &'a Value, + out: &'a mut dyn Write, + calls: i64, + changed: bool, +} +impl World<'_> { + fn query(&mut self, s: &str) -> io::Result<()> { + writeln!(self.out, "{s}")?; + let n = self.calls; + self.calls += 1; + if n == self.f["fail"].as_i64().unwrap() { + return Err(io::Error::other("injected armor query failure")); + } + if n == self.f["mutate_at"].as_i64().unwrap() { + self.changed = true; + } + Ok(()) + } + fn flag(&self, name: &str) -> bool { + self.f[format!("{}{name}", if self.changed { "after_" } else { "" })] + .as_bool() + .unwrap() + } +} +impl ArmorWorld for World<'_> { + type Error = io::Error; + type Weapon = (); + type ServerLevel = (); + fn weapon(&mut self) -> io::Result> { + self.query("weapon")?; + Ok(self.flag("weapon").then_some(())) + } + fn server_level(&mut self) -> io::Result> { + self.query("level")?; + Ok(self.flag("server").then_some(())) + } + fn modify_armor_effectiveness(&mut self, _: (), _: (), v: f32) -> io::Result { + Ok(v) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut w = World { + f: &f, + out: &mut out, + calls: 0, + changed: false, + }; + let damage = single(&f["damage"]); + let armor = single(&f["armor"]); + let result = if f["mode"] == "magic" { + Ok(combat_rules::after_magic(damage, armor)) + } else { + combat_rules::after_armor(&mut w, damage, armor, single(&f["toughness"])) + }; + match result { + Ok(v) => { + writeln!(w.out, "value {:08x}\nresult ok", bits(v))?; + } + Err(_) => writeln!(w.out, "result error")?, + } + writeln!(w.out, "queries {}", w.calls)?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/combat_rules.rs b/crates/horizon-world/src/combat_rules.rs new file mode 100644 index 000000000..4d8aa424f --- /dev/null +++ b/crates/horizon-world/src/combat_rules.rs @@ -0,0 +1,51 @@ +//! Native armor/toughness and enchantment-protection damage arithmetic. +fn clamp(value: f32, min: f32, max: f32) -> f32 { + if value < min { + min + } else if value.is_nan() || max.is_nan() { + f32::NAN + } else if value == 0.0 && max == 0.0 { + f32::from_bits(value.to_bits() | max.to_bits()) + } else { + value.min(max) + } +} +pub trait ArmorWorld { + type Error; + type Weapon: Copy; + type ServerLevel: Copy; + fn weapon(&mut self) -> Result, Self::Error>; + fn server_level(&mut self) -> Result, Self::Error>; + /// Called only with a nonnull weapon and a server level. Implementations + /// apply the weapon's actual armor-effectiveness enchantment components. + fn modify_armor_effectiveness( + &mut self, + level: Self::ServerLevel, + weapon: Self::Weapon, + effectiveness: f32, + ) -> Result; +} +pub fn after_armor( + world: &mut W, + damage: f32, + armor: f32, + toughness: f32, +) -> Result { + let divisor = 2.0 + toughness / 4.0; + let protection = clamp(armor - damage / divisor, armor * 0.2, 20.0); + let mut effectiveness = protection / 25.0; + if let Some(weapon) = world.weapon()? { + if let Some(level) = world.server_level()? { + effectiveness = clamp( + world.modify_armor_effectiveness(level, weapon, effectiveness)?, + 0.0, + 1.0, + ); + } + } + Ok(damage * (1.0 - effectiveness)) +} +pub fn after_magic(damage: f32, protection: f32) -> f32 { + let protection = clamp(protection, 0.0, 20.0); + damage * (1.0 - protection / 25.0) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 43afd49b8..ab421c457 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -18,6 +18,7 @@ pub mod chunk_status; pub mod climbing; pub mod collision; pub mod collision_context; +pub mod combat_rules; pub mod compression; pub mod dynamic_support; pub mod edge_backoff; diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 3abb56c31..2d04a50f6 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1221,3 +1221,17 @@ The optimized implementation passes both pinned JAR comparisons again: (**1,771,555 lines per JAR**) and [health/hunger composition](../benchmarks/rust-attribute-memory-2026-10-07/health-regression.json) (**666,082 lines per JAR**). Targeted Clippy passes. + + +`combat_rules` implements armor/toughness and magic-protection damage arithmetic. +It preserves the nonnull-weapon/server-level guards and clamps modified armor +effectiveness only after the server enchantment hook. + +`python3 tools/test_combat_rules_parity.py` compares actual `CombatRules` methods. +The [combat rules report](../benchmarks/rust-combat-rules-2026-10-07/scoped-parity.json) +records **184,248 matching lines per JAR**, including armor/toughness boundaries, +random float bit patterns, nonfinite/signed-zero values, query mutations/failures, +null/empty/unenchanted weapons and server/nonserver branches. Native unenchanted +stacks have explicitly empty components. Targeted Clippy passes. Enchanted item +components, damage tags, armor durability and the complete damage pipeline remain +pending; the exposed enchantment hook is not an enchantment implementation. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCombatRulesOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCombatRulesOracle.java new file mode 100644 index 000000000..c77de3c11 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCombatRulesOracle.java @@ -0,0 +1,21 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.nio.file.*;import java.util.*; +import net.minecraft.world.damagesource.*;import net.minecraft.world.entity.player.Player;import net.minecraft.world.item.*;import net.minecraft.world.level.Level;import net.minecraft.server.level.ServerLevel; +/** Actual CombatRules; weapon paths use empty or unenchanted native stacks. */ +public final class VanillaCombatRulesOracle { + static final class Stop extends RuntimeException {} + static float single(JsonElement v){return Float.intBitsToFloat(Integer.parseUnsignedInt(v.getAsString(),16));} + static String bits(float v){return String.format("%08x",Float.floatToIntBits(v));} + static final class Data {JsonObject f;PrintWriter out;int calls;boolean changed;Level level;ItemStack stack; + void query(String text){out.println(text);int n=calls++;if(n==f.get("fail").getAsInt())throw new Stop();if(n==f.get("mutate_at").getAsInt())changed=true;} + boolean flag(String name){return f.get((changed?"after_":"")+name).getAsBoolean();}} + static final class Source extends DamageSource {Data d;Source(){super(null);}@Override public ItemStack getWeaponItem(){d.query("weapon");return d.flag("weapon")?d.stack:null;}} + static final class Actor extends Player {Data d;Actor(){super(null,null);}@Override public net.minecraft.world.level.GameType gameMode(){return net.minecraft.world.level.GameType.SURVIVAL;}@Override public Level level(){d.query("level");return d.flag("server")?d.level:null;}} + static final class Server extends ServerLevel {Server(){super(null,null,null,null,null,null,false,0L,List.of(),false);}} + public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();var u=Class.forName("sun.misc.Unsafe");var uf=u.getDeclaredField("theUnsafe");uf.setAccessible(true);var unsafe=uf.get(null);var allocate=u.getMethod("allocateInstance",Class.class);var level=(Server)allocate.invoke(unsafe,Server.class);var stackConstructor=ItemStack.class.getDeclaredConstructor(net.minecraft.core.Holder.class,int.class,net.minecraft.core.component.PatchedDataComponentMap.class);stackConstructor.setAccessible(true);var unenchanted=(ItemStack)stackConstructor.newInstance(net.minecraft.core.registries.BuiltInRegistries.ITEM.wrapAsHolder(Items.DIAMOND_SWORD),1,new net.minecraft.core.component.PatchedDataComponentMap(net.minecraft.core.component.DataComponentMap.EMPTY));Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();var d=new Data();d.f=f;d.out=out;d.level=level;d.stack=f.get("empty").getAsBoolean()?ItemStack.EMPTY:unenchanted;var source=(Source)allocate.invoke(unsafe,Source.class);source.d=d;var actor=(Actor)allocate.invoke(unsafe,Actor.class);actor.d=d; + try{float value=f.get("mode").getAsString().equals("magic")?CombatRules.getDamageAfterMagicAbsorb(single(f.get("damage")),single(f.get("armor"))):CombatRules.getDamageAfterAbsorb(actor,single(f.get("damage")),source,single(f.get("armor")),single(f.get("toughness")));out.println("value "+bits(value));out.println("result ok");}catch(Stop e){out.println("result error");}out.println("queries "+d.calls); + }} + } +} diff --git a/tools/test_combat_rules_parity.py b/tools/test_combat_rules_parity.py new file mode 100644 index 000000000..b60838a3b --- /dev/null +++ b/tools/test_combat_rules_parity.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python3 +"""Compare native armor, toughness and magic protection arithmetic with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + def bits(v):return struct.pack('>f',v).hex() + def row(damage,armor,toughness,**kw): + f=dict(mode='armor',damage=bits(damage),armor=bits(armor),toughness=bits(toughness),weapon=False,server=False,after_weapon=True,after_server=True,empty=True,fail=-1,mutate_at=-1);f.update(kw);return f + values=[-float('inf'),-1e30,-25,-20,-8,-1,-0.,0.,1e-40,.1,1,2,4,8,20,25,40,1e30,float('inf'),float('nan')] + for damage in values: + for armor in values: + yield row(damage,armor,0,mode='magic') + for toughness in values: + for weapon,server,empty in [(False,False,True),(True,False,True),(True,True,True),(True,True,False)]:yield row(damage,armor,toughness,weapon=weapon,server=server,empty=empty) + for weapon in [False,True]: + for server in [False,True]: + for after_weapon in [False,True]: + for after_server in [False,True]: + for fail in range(-1,3): + for mutation in range(-1,3):yield row(17,20,8,weapon=weapon,server=server,after_weapon=after_weapon,after_server=after_server,fail=fail,mutate_at=mutation) + rng=random.Random(0x41524d4f52) + for _ in range(8000): + f=row(0,0,0,weapon=bool(rng.randrange(2)),server=bool(rng.randrange(2)),empty=bool(rng.randrange(2)),mode=rng.choice(['armor','magic'])) + for key in ['damage','armor','toughness']:f[key]=f'{rng.getrandbits(32):08x}' + yield f + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-combat-rules-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCombatRulesOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/combat_rules_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaCombatRulesOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','combat_rules_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('combat_rules_fixture.exe' if os.name=='nt' else 'combat_rules_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} combat rules output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual CombatRules armor/toughness and magic protection arithmetic; null/empty/unenchanted weapons, nonserver/server branches, native no-enchantment helper with explicitly empty stack components, query order/mutations/failures, nonfinite/signed-zero and random float bit patterns. The armor-effectiveness enchantment hook is exposed but enchanted components, damage tags/equipment and the full damage pipeline remain pending.'} + lab.write_json(report_path,report);print(f'Scoped combat rules parity passed: {report_path}') + + +if __name__=='__main__':main() From f7f4593e04a0db1bf2dc890724e0cca874b8c40f Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 04:36:31 +0200 Subject: [PATCH 111/253] Implement living and player inner damage application ordering --- .../scoped-parity.json | 248 ++++++++++++++++++ .../examples/living_damage_fixture.rs | 192 ++++++++++++++ crates/horizon-world/src/lib.rs | 1 + crates/horizon-world/src/living_damage.rs | 96 +++++++ docs/collision-geometry.md | 17 ++ .../parity/VanillaLivingDamageOracle.java | 60 +++++ tools/test_living_damage_parity.py | 73 ++++++ 7 files changed, 687 insertions(+) create mode 100644 benchmarks/rust-living-damage-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/living_damage_fixture.rs create mode 100644 crates/horizon-world/src/living_damage.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingDamageOracle.java create mode 100644 tools/test_living_damage_parity.py diff --git a/benchmarks/rust-living-damage-2026-10-07/scoped-parity.json b/benchmarks/rust-living-damage-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..d88ddb889 --- /dev/null +++ b/benchmarks/rust-living-damage-2026-10-07/scoped-parity.json @@ -0,0 +1,248 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 14696, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingDamageOracle.java": "f6901c9875488132658fd99410958f072976c553f1badf25c50727873c9240c4", + "tools/test_living_damage_parity.py": "f858e0f3ee9498e0960dc527ac393ebc4154503a8c8ff3971ce64d9430e4111a", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "1322599246b34aa06f8e5908a1d20e6797b5a0e1e2c7f45d7172c1c46e5047ac", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "74b07b8231bdd7ea76350c3172c196ba5bfa3ad09705d5d0555300e20f6e0f8f", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/living_damage_fixture.rs": "c00017fed110ab6ebb229791d59ca7d3dd0ecaa48a8030ae7f156672a88dd02b" + }, + "fixtures_sha256": { + ".local/rust-living-damage-parity/inputs.txt": "5815be47de0e489e8439e61e868595aeb3ace34317841b31cdaab6eecfb4dbff" + }, + "rust_output_sha256": "2d5568691fefb75c1dfb914f390860d6b008d8cef18b743b78277941936dc19b", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "2d5568691fefb75c1dfb914f390860d6b008d8cef18b743b78277941936dc19b", + "matched_output_lines": 161198 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "2d5568691fefb75c1dfb914f390860d6b008d8cef18b743b78277941936dc19b", + "matched_output_lines": 161198 + } + ], + "scope": "Actual LivingEntity and Player actuallyHurt with observable phase/storage/stat/combat/event hooks; real final absorption clamping. Invulnerability, armor/magic dispatch, two absorption reads, absorbed statistics and Java rounding, player exhaustion/taken statistics, base-living second absorption write, health and damage-event ordering, mutation/failure retention. Armor/magic results, storage, combat/stat sinks and exhaustion delivery are controlled; outer hurt gates, full damage binding and live gameplay remain pending." +} diff --git a/crates/horizon-world/examples/living_damage_fixture.rs b/crates/horizon-world/examples/living_damage_fixture.rs new file mode 100644 index 000000000..b77048866 --- /dev/null +++ b/crates/horizon-world/examples/living_damage_fixture.rs @@ -0,0 +1,192 @@ +use horizon_world::{ + living_damage::{self, DamageStat, DamageWorld}, + living_health::{self, HealthWorld}, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn single(v: &Value) -> f32 { + f32::from_bits(u32::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn bits(v: f32) -> u32 { + if v.is_nan() { + f32::NAN.to_bits() + } else { + v.to_bits() + } +} +fn stat(s: DamageStat) -> &'static str { + match s { + DamageStat::Absorbed => "absorbed", + DamageStat::DealtAbsorbed => "dealt-absorbed", + DamageStat::Taken => "taken", + } +} +struct World<'a> { + f: &'a Value, + out: &'a mut dyn Write, + calls: i64, + changed: bool, + health: f32, + absorption: f32, + exhaustion: f32, + recorded: f32, +} +impl World<'_> { + fn state(&self) -> &Value { + &self.f[if self.changed { "after" } else { "initial" }] + } + fn reset(&mut self) { + self.health = single(&self.state()["health"]); + self.absorption = single(&self.state()["absorption"]); + self.exhaustion = single(&self.state()["exhaustion"]); + } + fn query(&mut self, s: &str) -> io::Result<()> { + writeln!(self.out, "{s}")?; + let n = self.calls; + self.calls += 1; + if n == self.f["fail"].as_i64().unwrap() { + return Err(io::Error::other("injected damage callback failure")); + } + if n == self.f["mutate_at"].as_i64().unwrap() { + self.changed = true; + self.reset(); + } + Ok(()) + } +} +impl DamageWorld for World<'_> { + type Error = io::Error; + type Attacker = (); + fn invulnerable(&mut self) -> io::Result { + self.query("invulnerable")?; + Ok(self.state()["invulnerable"].as_bool().unwrap()) + } + fn after_armor(&mut self, v: f32) -> io::Result { + self.query(&format!("armor {:08x}", bits(v)))?; + Ok(single(&self.state()["armor"])) + } + fn after_magic(&mut self, v: f32) -> io::Result { + self.query(&format!("magic {:08x}", bits(v)))?; + Ok(single(&self.state()["magic"])) + } + fn absorption(&mut self) -> io::Result { + self.query("absorption")?; + Ok(self.absorption) + } + fn set_absorption(&mut self, v: f32) -> io::Result<()> { + living_health::set_absorption(self, v) + } + fn server_player_attacker(&mut self) -> io::Result> { + self.query("attacker")?; + Ok((self.state()["attacker"] == 2).then_some(())) + } + fn award_attacker(&mut self, _: (), s: DamageStat, v: i32) -> io::Result<()> { + self.query(&format!("stat attacker {} {v}", stat(s))) + } + fn award_self(&mut self, s: DamageStat, v: i32) -> io::Result<()> { + self.query(&format!("stat self {} {v}", stat(s))) + } + fn source_food_exhaustion(&mut self) -> io::Result { + self.query("food-exhaustion")?; + Ok(single(&self.state()["food_exhaustion"])) + } + fn cause_food_exhaustion(&mut self, v: f32) -> io::Result<()> { + self.query(&format!("exhaust {:08x}", bits(v)))?; + self.exhaustion += v; + Ok(()) + } + fn record_damage(&mut self, v: f32) -> io::Result<()> { + self.query("tracker")?; + self.query(&format!("record {:08x}", bits(v)))?; + self.recorded = v; + Ok(()) + } + fn health(&mut self) -> io::Result { + self.query("health")?; + Ok(self.health) + } + fn set_health(&mut self, v: f32) -> io::Result<()> { + self.query(&format!("set-health {:08x}", bits(v)))?; + self.health = v; + Ok(()) + } + fn damage_event(&mut self) -> io::Result<()> { + self.query("damage-event") + } +} +// Reuse the separately verified final absorption setter for native clamping. +impl HealthWorld for World<'_> { + type Error = io::Error; + type Data = (); + fn health(&mut self) -> io::Result { + DamageWorld::health(self) + } + fn health_data(&self) {} + fn max_health_attribute(&mut self) -> io::Result { + unreachable!("fixture only binds absorption") + } + fn max_absorption_attribute(&mut self) -> io::Result { + self.query("max-absorption")?; + Ok(number(&self.state()["max_absorption"])) + } + fn store_health(&mut self, _: (), v: f32) -> io::Result<()> { + DamageWorld::set_health(self, v) + } + fn store_absorption(&mut self, v: f32) -> io::Result<()> { + self.query(&format!("set-absorption {:08x}", bits(v)))?; + self.absorption = v; + Ok(()) + } + fn dead_flag(&self) -> bool { + false + } + fn dispatch_set_health(&mut self, v: f32) -> io::Result<()> { + DamageWorld::set_health(self, v) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut w = World { + f: &f, + out: &mut out, + calls: 0, + changed: false, + health: 0., + absorption: 0., + exhaustion: 0., + recorded: 0., + }; + w.reset(); + let result = living_damage::actually_hurt( + &mut w, + single(&f["damage"]), + f["player"].as_bool().unwrap(), + ); + writeln!( + w.out, + "result {}", + if result.is_ok() { "ok" } else { "error" } + )?; + writeln!( + w.out, + "final {:08x} {:08x} {:08x} {:08x}", + bits(w.health), + bits(w.absorption), + bits(w.exhaustion), + bits(w.recorded) + )?; + writeln!(w.out, "queries {}", w.calls)?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index ab421c457..c1414d4eb 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -41,6 +41,7 @@ pub mod heightmap; pub mod interaction_shapes; pub mod liquid_collision; pub mod living_air; +pub mod living_damage; pub mod living_fall; pub mod living_fluid; pub mod living_health; diff --git a/crates/horizon-world/src/living_damage.rs b/crates/horizon-world/src/living_damage.rs new file mode 100644 index 000000000..e3dbc96e2 --- /dev/null +++ b/crates/horizon-world/src/living_damage.rs @@ -0,0 +1,96 @@ +//! Inner living/player damage application after the outer hurt gates. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum DamageStat { + Absorbed, + DealtAbsorbed, + Taken, +} +pub trait DamageWorld { + type Error; + type Attacker: Copy; + fn invulnerable(&mut self) -> Result; + fn after_armor(&mut self, damage: f32) -> Result; + fn after_magic(&mut self, damage: f32) -> Result; + fn absorption(&mut self) -> Result; + fn set_absorption(&mut self, value: f32) -> Result<(), Self::Error>; + fn server_player_attacker(&mut self) -> Result, Self::Error>; + fn award_attacker( + &mut self, + attacker: Self::Attacker, + stat: DamageStat, + amount: i32, + ) -> Result<(), Self::Error>; + fn award_self(&mut self, stat: DamageStat, amount: i32) -> Result<(), Self::Error>; + fn source_food_exhaustion(&mut self) -> Result; + fn cause_food_exhaustion(&mut self, amount: f32) -> Result<(), Self::Error>; + fn record_damage(&mut self, amount: f32) -> Result<(), Self::Error>; + fn health(&mut self) -> Result; + fn set_health(&mut self, value: f32) -> Result<(), Self::Error>; + fn damage_event(&mut self) -> Result<(), Self::Error>; +} +fn positive(value: f32) -> f32 { + if value.is_nan() { + value + } else if value <= 0.0 { + 0.0 + } else { + value + } +} +fn stat_amount(value: f32) -> i32 { + let value = value * 10.0; + // Java Math.round(float), including negative ties and integer saturation. + let bits = value.to_bits() as i32; + let shift = 149 - ((bits >> 23) & 0xff); + if (0..32).contains(&shift) { + let mut significand = (bits & 0x7f_ffff) | 0x80_0000; + if bits < 0 { + significand = -significand; + } + ((significand >> shift) + 1) >> 1 + } else { + value as i32 + } +} +const STAT_LIMIT: f32 = 3.402_823_5e37; +pub fn actually_hurt( + world: &mut W, + damage: f32, + player: bool, +) -> Result<(), W::Error> { + if world.invulnerable()? { + return Ok(()); + } + let damage = world.after_armor(damage)?; + let damage = world.after_magic(damage)?; + let remaining = positive(damage - world.absorption()?); + let absorption = world.absorption()? - (damage - remaining); + world.set_absorption(absorption)?; + let absorbed = damage - remaining; + if absorbed > 0.0 && absorbed < STAT_LIMIT { + if player { + world.award_self(DamageStat::Absorbed, stat_amount(absorbed))?; + } else if let Some(attacker) = world.server_player_attacker()? { + world.award_attacker(attacker, DamageStat::DealtAbsorbed, stat_amount(absorbed))?; + } + } + if remaining == 0.0 { + return Ok(()); + } + if player { + let exhaustion = world.source_food_exhaustion()?; + world.cause_food_exhaustion(exhaustion)?; + } + world.record_damage(remaining)?; + let health = world.health()?; + world.set_health(health - remaining)?; + if player { + if remaining < STAT_LIMIT { + world.award_self(DamageStat::Taken, stat_amount(remaining))?; + } + } else { + let absorption = world.absorption()?; + world.set_absorption(absorption - remaining)?; + } + world.damage_event() +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 2d04a50f6..e4ce67866 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1235,3 +1235,20 @@ null/empty/unenchanted weapons and server/nonserver branches. Native unenchanted stacks have explicitly empty components. Targeted Clippy passes. Enchanted item components, damage tags, armor durability and the complete damage pipeline remain pending; the exposed enchantment hook is not an enchantment implementation. + + +`living_damage` implements the inner `actuallyHurt` sequence for base living +entities and players. It preserves invulnerability/armor/magic dispatch, both +absorption reads before the first write, guarded absorbed statistics, Java float +rounding, player exhaustion/taken statistics, base-living second absorption +writes, and combat/health/game-event ordering. Callback failures retain preceding +writes and effects. + +`python3 tools/test_living_damage_parity.py` compares actual LivingEntity/Player +methods with real final absorption clamping and controlled phase/storage sinks. +The [living damage report](../benchmarks/rust-living-damage-2026-10-07/scoped-parity.json) +records **161,198 matching lines per JAR**, including entity/player paths, attacker +types, stat limits/rounding, nonfinite values, mutations and failures at query +boundaries. Targeted Clippy passes. Armor/magic results, health storage, combat/ +stat sinks and exhaustion delivery are controlled. Outer hurt gates, resistance/ +equipment binding, combat tracking and playable damage integration remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingDamageOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingDamageOracle.java new file mode 100644 index 000000000..77d8b1eb3 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingDamageOracle.java @@ -0,0 +1,60 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.lang.reflect.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.Holder;import net.minecraft.resources.Identifier;import net.minecraft.world.entity.*;import net.minecraft.world.entity.ai.attributes.*;import net.minecraft.world.damagesource.*;import net.minecraft.server.level.*;import net.minecraft.world.level.gameevent.GameEvent;import net.minecraft.stats.Stats; +/** Actual LivingEntity/Player inner damage application with controlled phase hooks. */ +public final class VanillaLivingDamageOracle { + static final class Stop extends RuntimeException {} + static Object unsafe;static Method allocate; + static T make(Class c)throws Exception{return c.cast(allocate.invoke(unsafe,c));} + static float single(JsonElement v){return Float.intBitsToFloat(Integer.parseUnsignedInt(v.getAsString(),16));} + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + static String bits(float v){return String.format("%08x",Float.floatToIntBits(v));} + static final class Data {JsonObject f;PrintWriter out;int calls;boolean changed;float health,absorption,exhaustion,recorded;LivingEntity actor;Actor other;Human attacker;Tracker tracker; + JsonObject state(){return f.getAsJsonObject(changed?"after":"initial");} + void reset(){var s=state();health=single(s.get("health"));absorption=single(s.get("absorption"));exhaustion=single(s.get("exhaustion"));} + void query(String s){out.println(s);int n=calls++;if(n==f.get("fail").getAsInt())throw new Stop();if(n==f.get("mutate_at").getAsInt()){changed=true;reset();}} + } + static final class Source extends DamageSource {Data d;Source(){super(null);}@Override public Entity getEntity(){d.query("attacker");return switch(d.state().get("attacker").getAsInt()){case 0->null;case 1->d.other;case 2->d.attacker;default->throw new AssertionError();};}@Override public float getFoodExhaustion(){d.query("food-exhaustion");return single(d.state().get("food_exhaustion"));}} + static final class Tracker extends CombatTracker {Data d;Tracker(){super(null);}@Override public void recordDamage(DamageSource s,float v){d.query("record "+bits(v));d.recorded=v;}} + static final class Level extends ServerLevel {Level(){super(null,null,null,null,null,null,false,0L,List.of(),false);}} + static final class Actor extends net.minecraft.world.entity.decoration.ArmorStand {Actor(){super(null,null);} + + Data d; + @Override public boolean isInvulnerableTo(ServerLevel l,DamageSource s){d.query("invulnerable");return d.state().get("invulnerable").getAsBoolean();} + @Override protected float getDamageAfterArmorAbsorb(DamageSource s,float v){d.query("armor "+bits(v));return single(d.state().get("armor"));} + @Override protected float getDamageAfterMagicAbsorb(DamageSource s,float v){d.query("magic "+bits(v));return single(d.state().get("magic"));} + @Override public float getAbsorptionAmount(){d.query("absorption");return d.absorption;} + @Override public double getAttributeValue(Holder a){if(a!=Attributes.MAX_ABSORPTION)throw new AssertionError();d.query("max-absorption");return number(d.state().get("max_absorption"));} + @Override protected void internalSetAbsorptionAmount(float v){d.query("set-absorption "+bits(v));d.absorption=v;} + @Override public float getHealth(){d.query("health");return d.health;} + @Override public void setHealth(float v){d.query("set-health "+bits(v));d.health=v;} + @Override public CombatTracker getCombatTracker(){d.query("tracker");return d.tracker;} + @Override public void gameEvent(Holder e){if(e!=GameEvent.ENTITY_DAMAGE)throw new AssertionError();d.query("damage-event");} + void run(ServerLevel l,DamageSource s,float v){super.actuallyHurt(l,s,v);} + } + static final class Human extends ServerPlayer {Human(){super(null,null,null,null);} + + Data d; + @Override public boolean isInvulnerableTo(ServerLevel l,DamageSource s){d.query("invulnerable");return d.state().get("invulnerable").getAsBoolean();} + @Override protected float getDamageAfterArmorAbsorb(DamageSource s,float v){d.query("armor "+bits(v));return single(d.state().get("armor"));} + @Override protected float getDamageAfterMagicAbsorb(DamageSource s,float v){d.query("magic "+bits(v));return single(d.state().get("magic"));} + @Override public float getAbsorptionAmount(){d.query("absorption");return d.absorption;} + @Override public double getAttributeValue(Holder a){if(a!=Attributes.MAX_ABSORPTION)throw new AssertionError();d.query("max-absorption");return number(d.state().get("max_absorption"));} + @Override protected void internalSetAbsorptionAmount(float v){d.query("set-absorption "+bits(v));d.absorption=v;} + @Override public float getHealth(){d.query("health");return d.health;} + @Override public void setHealth(float v){d.query("set-health "+bits(v));d.health=v;} + @Override public CombatTracker getCombatTracker(){d.query("tracker");return d.tracker;} + @Override public void gameEvent(Holder e){if(e!=GameEvent.ENTITY_DAMAGE)throw new AssertionError();d.query("damage-event");} + void run(ServerLevel l,DamageSource s,float v){super.actuallyHurt(l,s,v);} + + @Override public void causeFoodExhaustion(float v){d.query("exhaust "+bits(v));d.exhaustion+=v;} + @Override public void awardStat(Identifier stat,int value){String name=stat==Stats.DAMAGE_ABSORBED?"absorbed":stat==Stats.DAMAGE_DEALT_ABSORBED?"dealt-absorbed":stat==Stats.DAMAGE_TAKEN?"taken":"unknown";if(name.equals("unknown"))throw new AssertionError();d.query("stat "+(d.actor==this?"self":"attacker")+" "+name+" "+value);} + } + public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();var u=Class.forName("sun.misc.Unsafe");var uf=u.getDeclaredField("theUnsafe");uf.setAccessible(true);unsafe=uf.get(null);allocate=u.getMethod("allocateInstance",Class.class);var level=make(Level.class);Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();var d=new Data();d.f=f;d.out=out;d.reset();d.other=make(Actor.class);d.other.d=d;d.attacker=make(Human.class);d.attacker.d=d;d.tracker=make(Tracker.class);d.tracker.d=d;var source=make(Source.class);source.d=d;boolean player=f.get("player").getAsBoolean();if(player){var actor=make(Human.class);actor.d=d;d.actor=actor;}else{var actor=make(Actor.class);actor.d=d;d.actor=actor;} + try{if(player)((Human)d.actor).run(level,source,single(f.get("damage")));else ((Actor)d.actor).run(level,source,single(f.get("damage")));out.println("result ok");}catch(Stop e){out.println("result error");} + out.println("final "+bits(d.health)+" "+bits(d.absorption)+" "+bits(d.exhaustion)+" "+bits(d.recorded));out.println("queries "+d.calls); + }} + } +} diff --git a/tools/test_living_damage_parity.py b/tools/test_living_damage_parity.py new file mode 100644 index 000000000..c6805948e --- /dev/null +++ b/tools/test_living_damage_parity.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python3 +"""Compare inner living/player damage application and side-effect ordering with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + def bits(v):return struct.pack('>f',v).hex() + def double(v):return struct.pack('>d',v).hex() + def state(damage=10,absorption=5,health=20,maximum=20,attacker=2,invulnerable=False):return dict(health=bits(health),absorption=bits(absorption),exhaustion=bits(0),max_absorption=double(maximum),armor=bits(damage),magic=bits(damage),food_exhaustion=bits(.1),attacker=attacker,invulnerable=invulnerable) + def row(player,initial,**kw): + f=dict(player=player,initial=initial,after=state(2,3,11,2,2),damage=bits(17),fail=-1,mutate_at=-1);f.update(kw);return f + values=[-float('inf'),-1e30,-1,-0.,0.,1e-40,.049999997,.05,.15,1.,5.,10.,20.,1e30,3.4028233e37,3.4028235e37,float('inf'),float('nan')] + for player in [False,True]: + for damage in values: + for absorption in values: + for maximum in [-1.,-0.,0.,5.,20.,float('nan')]:yield row(player,state(damage,absorption,20,maximum)) + for attacker in range(3): + for invulnerable in [False,True]: + for fail in range(-1,21): + for mutation in range(-1,21):yield row(player,state(attacker=attacker,invulnerable=invulnerable),fail=fail,mutate_at=mutation) + rng=random.Random(0x44414d414745) + for _ in range(5000): + f=row(bool(rng.randrange(2)),state(rng.choice(values),rng.choice(values),rng.choice(values),rng.choice(values),rng.randrange(3)),fail=rng.choice([-1,-1,0,3,7,11,15]),mutate_at=rng.choice([-1,-1,0,4,8,12])) + if rng.randrange(3)==0: + for key in ['armor','magic','health','absorption','food_exhaustion']:f['initial'][key]=f'{rng.getrandbits(32):08x}' + yield f + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-living-damage-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingDamageOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/living_damage_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaLivingDamageOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','living_damage_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('living_damage_fixture.exe' if os.name=='nt' else 'living_damage_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} living damage output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual LivingEntity and Player actuallyHurt with observable phase/storage/stat/combat/event hooks; real final absorption clamping. Invulnerability, armor/magic dispatch, two absorption reads, absorbed statistics and Java rounding, player exhaustion/taken statistics, base-living second absorption write, health and damage-event ordering, mutation/failure retention. Armor/magic results, storage, combat/stat sinks and exhaustion delivery are controlled; outer hurt gates, full damage binding and live gameplay remain pending.'} + lab.write_json(report_path,report);print(f'Scoped living damage parity passed: {report_path}') + + +if __name__=='__main__':main() From 49d630946c006235f8dc403639fd72d1ed45309b Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 04:39:43 +0200 Subject: [PATCH 112/253] Implement player hunger guards and stored exhaustion binding --- .../scoped-parity.json | 249 ++++++++++++++++++ .../examples/player_food_fixture.rs | 145 ++++++++++ crates/horizon-world/src/lib.rs | 1 + crates/horizon-world/src/player_food.rs | 54 ++++ docs/collision-geometry.md | 15 ++ .../parity/VanillaPlayerFoodOracle.java | 26 ++ tools/test_player_food_parity.py | 75 ++++++ 7 files changed, 565 insertions(+) create mode 100644 benchmarks/rust-player-food-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/player_food_fixture.rs create mode 100644 crates/horizon-world/src/player_food.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerFoodOracle.java create mode 100644 tools/test_player_food_parity.py diff --git a/benchmarks/rust-player-food-2026-10-07/scoped-parity.json b/benchmarks/rust-player-food-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..77975f641 --- /dev/null +++ b/benchmarks/rust-player-food-2026-10-07/scoped-parity.json @@ -0,0 +1,249 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 5814, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerFoodOracle.java": "39ac1d8b732a1611f113ee9cd14a90711a29ba605decac75ba015d516a3a2ec8", + "tools/test_player_food_parity.py": "b455568a72be525f251113d1852acec63147c2bded7e96bbd5f293321b5d941f", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "cdb3276e6c4f25103e4ce8a76b31b88e3e6081ea0dea4d74b8c386579eeffbfc", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "74b07b8231bdd7ea76350c3172c196ba5bfa3ad09705d5d0555300e20f6e0f8f", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/player_food_fixture.rs": "98a301cf2e50e53a9431008920e3f23b2069a19f691b2d86cdc9b3d33c2c78b9" + }, + "fixtures_sha256": { + ".local/rust-player-food-parity/inputs.txt": "774b48a764503b5b56f59bf4eb2f47f4ac42a6dfd4d7fe0c1331cf73345451b7" + }, + "rust_output_sha256": "3d639c4634568a9ba8189a45a2266ceae6019582adc48f850c247ed530075377", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "3d639c4634568a9ba8189a45a2266ceae6019582adc48f850c247ed530075377", + "matched_output_lines": 32723 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "3d639c4634568a9ba8189a45a2266ceae6019582adc48f850c247ed530075377", + "matched_output_lines": 32723 + } + ], + "scope": "Actual Player causeFoodExhaustion/canEat/hasEnoughFoodToDoExhaustiveManoeuvres with native FoodData. Direct abilities/food fields versus virtual food/ability getters, captured food identity across callbacks, client/server and invulnerability guards, mutations/failures, nonfinite exhaustion and integer hunger boundaries. Also tests the ordinary stored-food binding. Consumable/item components, abilities persistence and live player tick remain pending." +} diff --git a/crates/horizon-world/examples/player_food_fixture.rs b/crates/horizon-world/examples/player_food_fixture.rs new file mode 100644 index 000000000..7478be35f --- /dev/null +++ b/crates/horizon-world/examples/player_food_fixture.rs @@ -0,0 +1,145 @@ +use horizon_world::{ + food::FoodData, + player_food::{self, PlayerFoodWorld, StoredPlayerFood}, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn single(v: &Value) -> f32 { + f32::from_bits(u32::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn bits(v: f32) -> u32 { + if v.is_nan() { + f32::NAN.to_bits() + } else { + v.to_bits() + } +} +struct World<'a> { + f: &'a Value, + out: &'a mut dyn Write, + calls: i64, + changed: bool, + foods: [FoodData; 2], +} +impl World<'_> { + fn state(&self) -> &Value { + &self.f[if self.changed { "after" } else { "initial" }] + } + fn reset(&mut self) { + for i in 0..2 { + let v = &self.state()["foods"][i]; + self.foods[i] = FoodData { + food: v["food"].as_i64().unwrap() as i32, + exhaustion: single(&v["exhaustion"]), + ..FoodData::default() + }; + } + } + fn index(&self, k: &str) -> usize { + self.state()[k].as_u64().unwrap() as usize + } + fn query(&mut self, s: &str) -> io::Result<()> { + writeln!(self.out, "{s}")?; + let n = self.calls; + self.calls += 1; + if n == self.f["fail"].as_i64().unwrap() { + return Err(io::Error::other("injected food guard failure")); + } + if n == self.f["mutate_at"].as_i64().unwrap() { + self.changed = true; + self.reset(); + } + Ok(()) + } +} +impl PlayerFoodWorld for World<'_> { + type Error = io::Error; + fn invulnerable_direct(&self) -> bool { + self.state()["invulnerable"].as_bool().unwrap() + } + fn level_is_client(&mut self) -> io::Result { + self.query("level")?; + self.query("client")?; + Ok(self.state()["client"].as_bool().unwrap()) + } + fn add_exhaustion_direct(&mut self, v: f32) -> io::Result<()> { + let i = self.index("direct"); + self.query(&format!("exhaust {i} {:08x}", bits(v)))?; + self.foods[i].add_exhaustion(v); + Ok(()) + } + fn needs_food_direct(&mut self) -> io::Result { + let i = self.index("direct"); + self.query(&format!("needs {i}"))?; + Ok(self.foods[i].needs_food()) + } + fn enough_food_virtual(&mut self) -> io::Result { + self.query("food")?; + let i = self.index("virtual"); + self.query(&format!("enough {i}"))?; + Ok(self.foods[i].has_enough_food()) + } + fn may_fly_virtual(&mut self) -> io::Result { + self.query("abilities")?; + Ok(self.state()["mayfly"].as_bool().unwrap()) + } +} +fn run(w: &mut W, f: &Value) -> Result, W::Error> { + match f["mode"].as_str().unwrap() { + "exhaust" => player_food::cause_exhaustion(w, single(&f["amount"])).map(|()| None), + "eat" => player_food::can_eat(w, f["always"].as_bool().unwrap()).map(Some), + "enough" => player_food::enough_food_for_manoeuvres(w).map(Some), + _ => panic!("mode"), + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut w = World { + f: &f, + out: &mut out, + calls: 0, + changed: false, + foods: [FoodData::default(); 2], + }; + w.reset(); + let result = if f["stored"].as_bool().unwrap() { + let s = &f["initial"]; + let mut stored = StoredPlayerFood { + food: &mut w.foods[0], + invulnerable: s["invulnerable"].as_bool().unwrap(), + client_side: s["client"].as_bool().unwrap(), + may_fly: s["mayfly"].as_bool().unwrap(), + }; + Ok(run(&mut stored, &f).unwrap()) + } else { + run(&mut w, &f) + }; + match result { + Ok(v) => { + if let Some(v) = v { + writeln!(w.out, "bool {v}")?; + } + writeln!(w.out, "result ok")?; + } + Err(_) => writeln!(w.out, "result error")?, + } + for (i, food) in w.foods.iter().enumerate() { + writeln!( + w.out, + "food {i} {} {:08x}", + food.food, + bits(food.exhaustion) + )?; + } + writeln!(w.out, "queries {}", w.calls)?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index c1414d4eb..d3a25bc5e 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -54,6 +54,7 @@ pub mod movement_support; pub mod nbt; pub mod piston_movement; pub mod piston_shape; +pub mod player_food; pub mod player_travel; pub mod powder_snow_collision; pub mod region; diff --git a/crates/horizon-world/src/player_food.rs b/crates/horizon-world/src/player_food.rs new file mode 100644 index 000000000..c7869799a --- /dev/null +++ b/crates/horizon-world/src/player_food.rs @@ -0,0 +1,54 @@ +//! Player-specific hunger guards and virtual/direct state access distinctions. +use crate::food::FoodData; +pub trait PlayerFoodWorld { + type Error; + /// Reads the abilities field directly, not the virtual getAbilities method. + fn invulnerable_direct(&self) -> bool; + fn level_is_client(&mut self) -> Result; + fn add_exhaustion_direct(&mut self, value: f32) -> Result<(), Self::Error>; + fn needs_food_direct(&mut self) -> Result; + fn enough_food_virtual(&mut self) -> Result; + fn may_fly_virtual(&mut self) -> Result; +} +pub fn cause_exhaustion(world: &mut W, value: f32) -> Result<(), W::Error> { + if !world.invulnerable_direct() && !world.level_is_client()? { + world.add_exhaustion_direct(value)?; + } + Ok(()) +} +pub fn can_eat(world: &mut W, always_edible: bool) -> Result { + Ok(world.invulnerable_direct() || always_edible || world.needs_food_direct()?) +} +pub fn enough_food_for_manoeuvres(world: &mut W) -> Result { + Ok(world.enough_food_virtual()? || world.may_fly_virtual()?) +} +/// Binding for ordinary stored player state. Specialized entity implementations +/// can supply their own virtual food/ability lookups through PlayerFoodWorld. +pub struct StoredPlayerFood<'a> { + pub food: &'a mut FoodData, + pub invulnerable: bool, + pub client_side: bool, + pub may_fly: bool, +} +impl PlayerFoodWorld for StoredPlayerFood<'_> { + type Error = std::convert::Infallible; + fn invulnerable_direct(&self) -> bool { + self.invulnerable + } + fn level_is_client(&mut self) -> Result { + Ok(self.client_side) + } + fn add_exhaustion_direct(&mut self, value: f32) -> Result<(), Self::Error> { + self.food.add_exhaustion(value); + Ok(()) + } + fn needs_food_direct(&mut self) -> Result { + Ok(self.food.needs_food()) + } + fn enough_food_virtual(&mut self) -> Result { + Ok(self.food.has_enough_food()) + } + fn may_fly_virtual(&mut self) -> Result { + Ok(self.may_fly) + } +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index e4ce67866..85a8261a3 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1252,3 +1252,18 @@ types, stat limits/rounding, nonfinite values, mutations and failures at query boundaries. Targeted Clippy passes. Armor/magic results, health storage, combat/ stat sinks and exhaustion delivery are controlled. Outer hurt gates, resistance/ equipment binding, combat tracking and playable damage integration remain pending. + + +`player_food` implements player exhaustion, eating eligibility and the hunger +threshold for exhaustive manoeuvres. Invulnerability reads the abilities field +directly. Exhaustion additionally checks the client/server side before updating +direct food storage; manoeuvre eligibility uses virtual food and ability lookups. +`StoredPlayerFood` binds these operations to ordinary mutable `FoodData` state. + +`python3 tools/test_player_food_parity.py` compares actual Player methods and +native FoodData. The [player food report](../benchmarks/rust-player-food-2026-10-07/scoped-parity.json) +records **32,723 matching lines per JAR**, covering direct/virtual distinctions, +captured food identity during mutations, guard short-circuiting, injected failures, +nonfinite exhaustion and integer hunger boundaries. The stored-state binding is +also compared. Targeted Clippy passes. Consumable components, full ability storage +and live player tick integration remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerFoodOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerFoodOracle.java new file mode 100644 index 000000000..4ec98769b --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerFoodOracle.java @@ -0,0 +1,26 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.lang.reflect.*;import java.nio.file.*;import java.util.*; +import net.minecraft.world.food.FoodData;import net.minecraft.world.entity.player.*;import net.minecraft.world.level.Level;import net.minecraft.server.level.ServerLevel; +/** Actual player hunger guards, including direct versus virtual storage. */ +public final class VanillaPlayerFoodOracle { + static final class Stop extends RuntimeException {} + static Field foodField,abilitiesField,exhaustion; + static float single(JsonElement v){return Float.intBitsToFloat(Integer.parseUnsignedInt(v.getAsString(),16));} + static String bits(float v){return String.format("%08x",Float.floatToIntBits(v));} + static Field field(Class c,String n)throws Exception{var f=c.getDeclaredField(n);f.setAccessible(true);return f;} + static final class Data {JsonObject f;PrintWriter out;int calls;boolean changed;Actor actor;Food[] foods;Abilities direct,virtual;Level level; + JsonObject state(){return f.getAsJsonObject(changed?"after":"initial");} + void reset(){var s=state();direct.invulnerable=s.get("invulnerable").getAsBoolean();virtual.mayfly=s.get("mayfly").getAsBoolean();virtual.invulnerable=!direct.invulnerable;try{foodField.set(actor,foods[s.get("direct").getAsInt()]);for(int i=0;i<2;i++){var v=s.getAsJsonArray("foods").get(i).getAsJsonObject();foods[i].setFoodLevel(v.get("food").getAsInt());exhaustion.setFloat(foods[i],single(v.get("exhaustion")));}}catch(Exception e){throw new AssertionError(e);}} + void query(String s){if(f.get("stored").getAsBoolean())return;out.println(s);int n=calls++;if(n==f.get("fail").getAsInt())throw new Stop();if(n==f.get("mutate_at").getAsInt()){changed=true;reset();}} + } + static final class Food extends FoodData {Data d;int id;@Override public boolean hasEnoughFood(){d.query("enough "+id);return super.hasEnoughFood();}@Override public boolean needsFood(){d.query("needs "+id);return super.needsFood();}@Override public void addExhaustion(float v){d.query("exhaust "+id+" "+bits(v));super.addExhaustion(v);}} + static final class Server extends ServerLevel {Data d;Server(){super(null,null,null,null,null,null,false,0L,List.of(),false);}@Override public boolean isClientSide(){d.query("client");return d.state().get("client").getAsBoolean();}} + static final class Actor extends Player {Data d;Actor(){super(null,null);}@Override public net.minecraft.world.level.GameType gameMode(){return net.minecraft.world.level.GameType.SURVIVAL;}@Override public Level level(){d.query("level");return d.level;}@Override public FoodData getFoodData(){d.query("food");return d.foods[d.state().get("virtual").getAsInt()];}@Override public Abilities getAbilities(){d.query("abilities");return d.virtual;}boolean enough(){return hasEnoughFoodToDoExhaustiveManoeuvres();}} + public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();var u=Class.forName("sun.misc.Unsafe");var uf=u.getDeclaredField("theUnsafe");uf.setAccessible(true);var unsafe=uf.get(null);var allocate=u.getMethod("allocateInstance",Class.class);foodField=field(Player.class,"foodData");abilitiesField=field(Player.class,"abilities");exhaustion=field(FoodData.class,"exhaustionLevel");Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();var d=new Data();d.f=f;d.out=out;d.actor=(Actor)allocate.invoke(unsafe,Actor.class);d.actor.d=d;var level=(Server)allocate.invoke(unsafe,Server.class);level.d=d;d.level=level;d.foods=new Food[]{new Food(),new Food()};for(int i=0;i<2;i++){d.foods[i].d=d;d.foods[i].id=i;}d.direct=new Abilities();d.virtual=new Abilities();abilitiesField.set(d.actor,d.direct);d.reset(); + try{switch(f.get("mode").getAsString()){case "exhaust":d.actor.causeFoodExhaustion(single(f.get("amount")));break;case "eat":out.println("bool "+d.actor.canEat(f.get("always").getAsBoolean()));break;case "enough":out.println("bool "+d.actor.enough());break;default:throw new AssertionError();}out.println("result ok");}catch(Stop e){out.println("result error");} + for(int i=0;i<2;i++)out.println("food "+i+" "+d.foods[i].getFoodLevel()+" "+bits(exhaustion.getFloat(d.foods[i])));out.println("queries "+d.calls); + }} + } +} diff --git a/tools/test_player_food_parity.py b/tools/test_player_food_parity.py new file mode 100644 index 000000000..489e1787a --- /dev/null +++ b/tools/test_player_food_parity.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python3 +"""Compare player hunger guards, exhaustion and direct/virtual state binding with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + def bits(v):return struct.pack('>f',v).hex() + def state(food=20,other=0,invulnerable=False,mayfly=False,client=False,direct=0,virtual=1,exhaustion=0):return dict(foods=[dict(food=food,exhaustion=bits(exhaustion)),dict(food=other,exhaustion=bits(exhaustion))],invulnerable=invulnerable,mayfly=mayfly,client=client,direct=direct,virtual=virtual) + def row(mode,initial,**kw): + f=dict(mode=mode,initial=initial,after=state(1,20,True,True,False,1,0,7),amount=bits(.1),always=False,stored=False,fail=-1,mutate_at=-1);f.update(kw);return f + foods=[-2**31,-1,0,1,5,6,7,19,20,21,2**31-1] + values=[-float('inf'),-1e30,-1,-0.,0.,1e-40,.1,1,39.9,40,1e30,float('inf'),float('nan')] + for food in foods: + for flags in range(32): + initial=state(food,6,flags&1!=0,flags&2!=0,flags&4!=0,(flags>>3)&1,(flags>>4)&1) + for mode in ['exhaust','eat','enough']: + for always in [False,True]:yield row(mode,initial,always=always) + for flags in range(8): + for mode in ['exhaust','eat','enough']: + for fail in range(-1,5): + for mutation in range(-1,5):yield row(mode,state(0,0,flags&1!=0,flags&2!=0,flags&4!=0),fail=fail,mutate_at=mutation) + for v in values: + for exhaustion in values: + for stored in [False,True]:yield row('exhaust',state(20,0,virtual=0,exhaustion=exhaustion),amount=bits(v),stored=stored) + rng=random.Random(0x504c4159464f4f44) + for _ in range(2500): + stored=bool(rng.randrange(2));initial=state(rng.choice(foods),rng.choice(foods),bool(rng.randrange(2)),bool(rng.randrange(2)),bool(rng.randrange(2)),0 if stored else rng.randrange(2),0 if stored else rng.randrange(2),rng.choice(values)) + yield row(rng.choice(['exhaust','eat','enough']),initial,amount=bits(rng.choice(values)),always=bool(rng.randrange(2)),stored=stored,fail=-1 if stored else rng.choice([-1,-1,0,1,2,3]),mutate_at=-1 if stored else rng.choice([-1,-1,0,1,2])) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-player-food-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerFoodOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/player_food_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaPlayerFoodOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','player_food_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('player_food_fixture.exe' if os.name=='nt' else 'player_food_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} player food output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual Player causeFoodExhaustion/canEat/hasEnoughFoodToDoExhaustiveManoeuvres with native FoodData. Direct abilities/food fields versus virtual food/ability getters, captured food identity across callbacks, client/server and invulnerability guards, mutations/failures, nonfinite exhaustion and integer hunger boundaries. Also tests the ordinary stored-food binding. Consumable/item components, abilities persistence and live player tick remain pending.'} + lab.write_json(report_path,report);print(f'Scoped player food parity passed: {report_path}') + + +if __name__=='__main__':main() From b4ae7cf88d3daefd7b969e91fd25498405c44c7d Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 04:45:25 +0200 Subject: [PATCH 113/253] Implement living armor and resistance damage reduction dispatch --- .../scoped-parity.json | 251 ++++++++++++++++++ .../examples/damage_reduction_fixture.rs | 152 +++++++++++ crates/horizon-world/src/damage_reduction.rs | 78 ++++++ crates/horizon-world/src/lib.rs | 1 + crates/horizon-world/src/living_damage.rs | 6 +- docs/collision-geometry.md | 16 ++ .../parity/VanillaDamageReductionOracle.java | 53 ++++ tools/test_damage_reduction_parity.py | 81 ++++++ 8 files changed, 635 insertions(+), 3 deletions(-) create mode 100644 benchmarks/rust-damage-reduction-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/damage_reduction_fixture.rs create mode 100644 crates/horizon-world/src/damage_reduction.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDamageReductionOracle.java create mode 100644 tools/test_damage_reduction_parity.py diff --git a/benchmarks/rust-damage-reduction-2026-10-07/scoped-parity.json b/benchmarks/rust-damage-reduction-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..88c6a10ce --- /dev/null +++ b/benchmarks/rust-damage-reduction-2026-10-07/scoped-parity.json @@ -0,0 +1,251 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 11974, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDamageReductionOracle.java": "8bfafac378ae9e2d772b23d43f249f606f36c36ab564c3886ba6e6acf08a305c", + "tools/test_damage_reduction_parity.py": "04d9c5fb3f53652354726a73bca76b4465a740d0d8cb5410187ab477c579470d", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "39ced7b0b9cdb284f03e31869d3678dccbad58eefa87dd535245625202eccb9b", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "711e78438ece3e94eb156c0e64cfea06a63f79640a7a81e396ae2c1b277cdce6", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/damage_reduction_fixture.rs": "b4a539d11f4d612e971091bab784a29c1d47e98d2a507e8e0cd590d0dbab39b8" + }, + "fixtures_sha256": { + ".local/rust-damage-reduction-parity/inputs.txt": "4a6c0e106ab47d7bc9caf600614c161fed4369ba314c8cc127106ad0198c5735", + ".local/rust-damage-reduction-parity/slots.json": "29101ebf1ead685029508789eee51c4d4fff65524064d8e32a48efded7036982" + }, + "rust_output_sha256": "e8bdb302517f54a71ee02aa8cfceb68c37dd46af79b620231ecaffe9e8b6cb4f", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "e8bdb302517f54a71ee02aa8cfceb68c37dd46af79b620231ecaffe9e8b6cb4f", + "matched_output_lines": 78069 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "e8bdb302517f54a71ee02aa8cfceb68c37dd46af79b620231ecaffe9e8b6cb4f", + "matched_output_lines": 78069 + } + ], + "scope": "Actual LivingEntity armor-value and armor/magic reduction methods for base living and ServerPlayer receivers. Damage bypass tags, hurtArmor dispatch, floor/narrow attribute arithmetic, native CombatRules, resistance amplifier overflow and resisted statistics, repeated attacker lookup, native empty-equipment protection lookup, mutations/failures and numeric edges. Item enchantments, actual durability/effects/tag registries and full damage integration remain pending." +} diff --git a/crates/horizon-world/examples/damage_reduction_fixture.rs b/crates/horizon-world/examples/damage_reduction_fixture.rs new file mode 100644 index 000000000..16d37af2f --- /dev/null +++ b/crates/horizon-world/examples/damage_reduction_fixture.rs @@ -0,0 +1,152 @@ +use horizon_world::{ + combat_rules::ArmorWorld, + damage_reduction::{self, Bypass, DamageReductionWorld}, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn single(v: &Value) -> f32 { + f32::from_bits(u32::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn bits(v: f32) -> u32 { + if v.is_nan() { + f32::NAN.to_bits() + } else { + v.to_bits() + } +} +struct World<'a> { + f: &'a Value, + out: &'a mut dyn Write, + calls: i64, + changed: bool, + slots: &'a [Value], +} +impl World<'_> { + fn state(&self) -> &Value { + &self.f[if self.changed { "after" } else { "initial" }] + } + fn query(&mut self, s: &str) -> io::Result<()> { + writeln!(self.out, "{s}")?; + let n = self.calls; + self.calls += 1; + if n == self.f["fail"].as_i64().unwrap() { + return Err(io::Error::other("injected damage reduction failure")); + } + if n == self.f["mutate_at"].as_i64().unwrap() { + self.changed = true; + } + Ok(()) + } +} +impl ArmorWorld for World<'_> { + type Error = io::Error; + type Weapon = (); + type ServerLevel = (); + fn weapon(&mut self) -> io::Result> { + self.query("weapon")?; + Ok(self.state()["weapon"].as_bool().unwrap().then_some(())) + } + fn server_level(&mut self) -> io::Result> { + self.query("level")?; + Ok(self.state()["server"].as_bool().unwrap().then_some(())) + } + fn modify_armor_effectiveness(&mut self, _: (), _: (), v: f32) -> io::Result { + Ok(v) + } +} +impl DamageReductionWorld for World<'_> { + fn bypasses(&mut self, b: Bypass) -> io::Result { + let n = match b { + Bypass::Armor => "armor", + Bypass::Effects => "effects", + Bypass::Resistance => "resistance", + Bypass::Enchantments => "enchantments", + }; + self.query(&format!("bypass {n}"))?; + Ok(self.state()[format!("bypass_{n}")].as_bool().unwrap()) + } + fn hurt_armor(&mut self, v: f32) -> io::Result<()> { + self.query(&format!("hurt-armor {:08x}", bits(v))) + } + fn armor_value(&mut self) -> io::Result { + self.query("armor")?; + Ok(damage_reduction::armor_from_attribute(number( + &self.state()["armor"], + ))) + } + fn toughness_attribute(&mut self) -> io::Result { + self.query("toughness")?; + Ok(number(&self.state()["toughness"])) + } + fn has_resistance(&mut self) -> io::Result { + self.query("has-resistance")?; + Ok(self.state()["resistance"].as_bool().unwrap()) + } + fn resistance_amplifier(&mut self) -> io::Result { + self.query("effect")?; + Ok(self.state()["amplifier"].as_i64().unwrap() as i32) + } + fn victim_is_server_player(&self) -> bool { + self.f["player"].as_bool().unwrap() + } + fn award_resisted(&mut self, v: i32) -> io::Result<()> { + self.query(&format!("stat self resisted {v}")) + } + fn attacker_is_server_player(&mut self) -> io::Result { + self.query("attacker")?; + Ok(self.f["attacker"] == 2) + } + fn award_dealt_resisted(&mut self, v: i32) -> io::Result<()> { + self.query("attacker")?; + self.query(&format!("stat attacker dealt-resisted {v}")) + } + fn damage_protection(&mut self, _: ()) -> io::Result { + for i in 0..self.slots.len() { + let slot = self.slots[i].as_i64().unwrap(); + self.query(&format!("slot {slot}"))?; + } + Ok(0.0) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let slots: Value = serde_json::from_str(&fs::read_to_string(dir.join("slots.json"))?)?; + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut w = World { + f: &f, + out: &mut out, + calls: 0, + changed: false, + slots: slots.as_array().unwrap(), + }; + let mode = f["mode"].as_str().unwrap(); + let result = if mode == "armor-value" { + w.armor_value().and_then(|v| writeln!(w.out, "int {v}")) + } else { + let d = single(&f["damage"]); + let r = if mode == "armor" { + damage_reduction::after_armor(&mut w, d) + } else { + damage_reduction::after_magic(&mut w, d) + }; + r.and_then(|v| writeln!(w.out, "float {:08x}", bits(v))) + }; + writeln!( + w.out, + "result {}", + if result.is_ok() { "ok" } else { "error" } + )?; + writeln!(w.out, "queries {}", w.calls)?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/damage_reduction.rs b/crates/horizon-world/src/damage_reduction.rs new file mode 100644 index 000000000..0bcfce5dd --- /dev/null +++ b/crates/horizon-world/src/damage_reduction.rs @@ -0,0 +1,78 @@ +//! Living damage-source bypass, armor and resistance/protection dispatch. +use crate::{ + combat_rules::{self, ArmorWorld}, + living_damage::{STAT_LIMIT, positive, stat_amount}, +}; +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum Bypass { + Armor, + Effects, + Resistance, + Enchantments, +} +pub trait DamageReductionWorld: ArmorWorld { + fn bypasses(&mut self, kind: Bypass) -> Result; + fn hurt_armor(&mut self, damage: f32) -> Result<(), Self::Error>; + fn armor_value(&mut self) -> Result; + fn toughness_attribute(&mut self) -> Result; + fn has_resistance(&mut self) -> Result; + fn resistance_amplifier(&mut self) -> Result; + fn victim_is_server_player(&self) -> bool; + fn award_resisted(&mut self, amount: i32) -> Result<(), Self::Error>; + fn attacker_is_server_player(&mut self) -> Result; + /// Performs the second native attacker lookup before awarding its stat. + fn award_dealt_resisted(&mut self, amount: i32) -> Result<(), Self::Error>; + fn damage_protection(&mut self, level: Self::ServerLevel) -> Result; +} +pub fn armor_from_attribute(value: f64) -> i32 { + value.floor() as i32 +} +pub fn after_armor(world: &mut W, damage: f32) -> Result { + if world.bypasses(Bypass::Armor)? { + return Ok(damage); + } + world.hurt_armor(damage)?; + let armor = world.armor_value()? as f32; + let toughness = world.toughness_attribute()? as f32; + combat_rules::after_armor(world, damage, armor, toughness) +} +pub fn after_magic( + world: &mut W, + mut damage: f32, +) -> Result { + if world.bypasses(Bypass::Effects)? { + return Ok(damage); + } + if world.has_resistance()? && !world.bypasses(Bypass::Resistance)? { + let reduction = world + .resistance_amplifier()? + .wrapping_add(1) + .wrapping_mul(5); + let remainder = 25i32.wrapping_sub(reduction); + let original = damage; + damage = positive((damage * remainder as f32) / 25.0); + let resisted = original - damage; + if resisted > 0.0 && resisted < STAT_LIMIT { + if world.victim_is_server_player() { + world.award_resisted(stat_amount(resisted))?; + } else if world.attacker_is_server_player()? { + world.award_dealt_resisted(stat_amount(resisted))?; + } + } + } + if damage <= 0.0 { + return Ok(0.0); + } + if world.bypasses(Bypass::Enchantments)? { + return Ok(damage); + } + let protection = if let Some(level) = world.server_level()? { + world.damage_protection(level)? + } else { + 0.0 + }; + if protection > 0.0 { + damage = combat_rules::after_magic(damage, protection); + } + Ok(damage) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index d3a25bc5e..54c6a1d28 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -20,6 +20,7 @@ pub mod collision; pub mod collision_context; pub mod combat_rules; pub mod compression; +pub mod damage_reduction; pub mod dynamic_support; pub mod edge_backoff; pub mod entity_collision; diff --git a/crates/horizon-world/src/living_damage.rs b/crates/horizon-world/src/living_damage.rs index e3dbc96e2..11b531a08 100644 --- a/crates/horizon-world/src/living_damage.rs +++ b/crates/horizon-world/src/living_damage.rs @@ -28,7 +28,7 @@ pub trait DamageWorld { fn set_health(&mut self, value: f32) -> Result<(), Self::Error>; fn damage_event(&mut self) -> Result<(), Self::Error>; } -fn positive(value: f32) -> f32 { +pub(crate) fn positive(value: f32) -> f32 { if value.is_nan() { value } else if value <= 0.0 { @@ -37,7 +37,7 @@ fn positive(value: f32) -> f32 { value } } -fn stat_amount(value: f32) -> i32 { +pub(crate) fn stat_amount(value: f32) -> i32 { let value = value * 10.0; // Java Math.round(float), including negative ties and integer saturation. let bits = value.to_bits() as i32; @@ -52,7 +52,7 @@ fn stat_amount(value: f32) -> i32 { value as i32 } } -const STAT_LIMIT: f32 = 3.402_823_5e37; +pub(crate) const STAT_LIMIT: f32 = 3.402_823_5e37; pub fn actually_hurt( world: &mut W, damage: f32, diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 85a8261a3..208f75899 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1267,3 +1267,19 @@ captured food identity during mutations, guard short-circuiting, injected failur nonfinite exhaustion and integer hunger boundaries. The stored-state binding is also compared. Targeted Clippy passes. Consumable components, full ability storage and live player tick integration remain pending. + + +`damage_reduction` composes native armor/toughness arithmetic with living damage +bypass checks and armor-durability dispatch. Its magic-reduction path preserves +resistance amplifier overflow, reduced-damage clamping, resisted statistics, +repeated attacker lookup and the server-only enchantment protection query. +Armor attributes floor to Java's saturated integer range before float conversion. + +`python3 tools/test_damage_reduction_parity.py` compares actual living methods +for base entities and ServerPlayer receivers. The +[damage reduction report](../benchmarks/rust-damage-reduction-2026-10-07/scoped-parity.json) +records **78,069 matching lines per JAR**, covering bypass combinations, +resistance/stat boundaries, numeric edges, query failures/mutations and actual +empty-equipment protection iteration. Targeted Clippy passes. Equipment is empty; +enchanted components, actual armor durability, registered damage/effect bindings +and the full hurt sequence remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDamageReductionOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDamageReductionOracle.java new file mode 100644 index 000000000..78c749562 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDamageReductionOracle.java @@ -0,0 +1,53 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.lang.reflect.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.Holder;import net.minecraft.resources.Identifier;import net.minecraft.tags.*;import net.minecraft.world.entity.*;import net.minecraft.world.entity.ai.attributes.*;import net.minecraft.world.damagesource.*;import net.minecraft.world.effect.*;import net.minecraft.world.item.ItemStack;import net.minecraft.world.level.Level;import net.minecraft.server.level.*;import net.minecraft.stats.Stats; +/** Actual living armor/resistance/protection dispatch, with empty equipment. */ +public final class VanillaDamageReductionOracle { + static final class Stop extends RuntimeException {} + static Object unsafe;static Method allocate;static Field amplifier; + static T make(Class c)throws Exception{return c.cast(allocate.invoke(unsafe,c));} + static float single(JsonElement v){return Float.intBitsToFloat(Integer.parseUnsignedInt(v.getAsString(),16));} + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + static String bits(float v){return String.format("%08x",Float.floatToIntBits(v));} + static final class Data {JsonObject f;PrintWriter out;int calls;boolean changed;LivingEntity actor;Actor other;Human attacker;Server level; + JsonObject state(){return f.getAsJsonObject(changed?"after":"initial");} + void query(String s){out.println(s);int n=calls++;if(n==f.get("fail").getAsInt())throw new Stop();if(n==f.get("mutate_at").getAsInt())changed=true;}} + static final class Source extends DamageSource {Data d;Source(){super(null);} + @Override public boolean is(TagKey tag){String n=tag==DamageTypeTags.BYPASSES_ARMOR?"armor":tag==DamageTypeTags.BYPASSES_EFFECTS?"effects":tag==DamageTypeTags.BYPASSES_RESISTANCE?"resistance":tag==DamageTypeTags.BYPASSES_ENCHANTMENTS?"enchantments":null;if(n==null)throw new AssertionError();d.query("bypass "+n);return d.state().get("bypass_"+n).getAsBoolean();} + @Override public ItemStack getWeaponItem(){d.query("weapon");return d.state().get("weapon").getAsBoolean()?ItemStack.EMPTY:null;} + @Override public Entity getEntity(){d.query("attacker");return switch(d.f.get("attacker").getAsInt()){case 0->null;case 1->d.other;case 2->d.attacker;default->throw new AssertionError();};}} + static final class Server extends ServerLevel {Server(){super(null,null,null,null,null,null,false,0L,List.of(),false);}} + static final class Actor extends net.minecraft.world.entity.decoration.ArmorStand {Actor(){super(null,null);} + + Data d; + @Override public double getAttributeValue(Holder a){String k=a==Attributes.ARMOR?"armor":a==Attributes.ARMOR_TOUGHNESS?"toughness":null;if(k==null)throw new AssertionError();d.query(k);return number(d.state().get(k));} + @Override protected void hurtArmor(DamageSource s,float v){d.query("hurt-armor "+bits(v));} + @Override public boolean hasEffect(Holder e){if(e!=MobEffects.RESISTANCE)throw new AssertionError();d.query("has-resistance");return d.state().get("resistance").getAsBoolean();} + @Override public MobEffectInstance getEffect(Holder e){if(e!=MobEffects.RESISTANCE)throw new AssertionError();d.query("effect");var result=new MobEffectInstance(e,100,0);try{amplifier.setInt(result,d.state().get("amplifier").getAsInt());}catch(Exception ex){throw new AssertionError(ex);}return result;} + @Override public Level level(){d.query("level");return d.state().get("server").getAsBoolean()?d.level:null;} + @Override public ItemStack getItemBySlot(EquipmentSlot slot){d.query("slot "+slot.ordinal());return ItemStack.EMPTY;} + float armor(DamageSource s,float v){return super.getDamageAfterArmorAbsorb(s,v);} + float magic(DamageSource s,float v){return super.getDamageAfterMagicAbsorb(s,v);} + } + static final class Human extends ServerPlayer {Human(){super(null,null,null,null);} + + Data d; + @Override public double getAttributeValue(Holder a){String k=a==Attributes.ARMOR?"armor":a==Attributes.ARMOR_TOUGHNESS?"toughness":null;if(k==null)throw new AssertionError();d.query(k);return number(d.state().get(k));} + @Override protected void hurtArmor(DamageSource s,float v){d.query("hurt-armor "+bits(v));} + @Override public boolean hasEffect(Holder e){if(e!=MobEffects.RESISTANCE)throw new AssertionError();d.query("has-resistance");return d.state().get("resistance").getAsBoolean();} + @Override public MobEffectInstance getEffect(Holder e){if(e!=MobEffects.RESISTANCE)throw new AssertionError();d.query("effect");var result=new MobEffectInstance(e,100,0);try{amplifier.setInt(result,d.state().get("amplifier").getAsInt());}catch(Exception ex){throw new AssertionError(ex);}return result;} + @Override public ServerLevel level(){d.query("level");return d.state().get("server").getAsBoolean()?d.level:null;} + @Override public ItemStack getItemBySlot(EquipmentSlot slot){d.query("slot "+slot.ordinal());return ItemStack.EMPTY;} + float armor(DamageSource s,float v){return super.getDamageAfterArmorAbsorb(s,v);} + float magic(DamageSource s,float v){return super.getDamageAfterMagicAbsorb(s,v);} + + @Override public void awardStat(Identifier stat,int v){String n=stat==Stats.DAMAGE_RESISTED?"resisted":stat==Stats.DAMAGE_DEALT_RESISTED?"dealt-resisted":null;if(n==null)throw new AssertionError();d.query("stat "+(d.actor==this?"self":"attacker")+" "+n+" "+v);} + } + public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();Path dir=Path.of(args[1]);if(args[0].equals("export")){var slots=new JsonArray();for(var slot:EquipmentSlot.VALUES)slots.add(slot.ordinal());Files.writeString(dir.resolve("slots.json"),slots.toString());return;} + var u=Class.forName("sun.misc.Unsafe");var uf=u.getDeclaredField("theUnsafe");uf.setAccessible(true);unsafe=uf.get(null);allocate=u.getMethod("allocateInstance",Class.class);amplifier=MobEffectInstance.class.getDeclaredField("amplifier");amplifier.setAccessible(true);var level=make(Server.class); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();var d=new Data();d.f=f;d.out=out;d.level=level;d.other=make(Actor.class);d.other.d=d;d.attacker=make(Human.class);d.attacker.d=d;var source=make(Source.class);source.d=d;boolean player=f.get("player").getAsBoolean();if(player){var actor=make(Human.class);actor.d=d;d.actor=actor;}else{var actor=make(Actor.class);actor.d=d;d.actor=actor;} + try{String mode=f.get("mode").getAsString();float damage=single(f.get("damage"));if(mode.equals("armor-value"))out.println("int "+d.actor.getArmorValue());else{float result=player?(mode.equals("armor")?((Human)d.actor).armor(source,damage):((Human)d.actor).magic(source,damage)):(mode.equals("armor")?((Actor)d.actor).armor(source,damage):((Actor)d.actor).magic(source,damage));out.println("float "+bits(result));}out.println("result ok");}catch(Stop e){out.println("result error");}out.println("queries "+d.calls); + }} + } +} diff --git a/tools/test_damage_reduction_parity.py b/tools/test_damage_reduction_parity.py new file mode 100644 index 000000000..42eb6b606 --- /dev/null +++ b/tools/test_damage_reduction_parity.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python3 +"""Compare living armor/resistance/protection dispatch and bypass rules with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + def bits(v):return struct.pack('>f',v).hex() + def double(v):return struct.pack('>d',v).hex() + def state(armor=20,toughness=8,amplifier=0,**kw): + s=dict(armor=double(armor),toughness=double(toughness),amplifier=amplifier,resistance=True,server=True,weapon=True,bypass_armor=False,bypass_effects=False,bypass_resistance=False,bypass_enchantments=False);s.update(kw);return s + def row(mode,damage=10,initial=None,**kw): + f=dict(mode=mode,damage=bits(damage),initial=initial or state(),after=state(5,3,4,resistance=False,server=False,weapon=False),player=False,attacker=2,fail=-1,mutate_at=-1);f.update(kw);return f + values=[-float('inf'),-1e30,-20,-1.9,-1,-0.,0.,1e-40,.05,1,5,20,40,1e30,3.4028235e37,float('inf'),float('nan')] + for armor in values+[2147483647.,2147483648.,-2147483649.]:yield row('armor-value',initial=state(armor)) + for damage in values: + for armor in values: + for toughness in [-8.,-1.,0.,8.,float('inf'),float('nan')]:yield row('armor',damage,state(armor,toughness)) + for amplifier in [-2**31,-429496730,-6,-1,0,1,3,4,5,2**31-1]: + for player in [False,True]: + for attacker in range(3):yield row('magic',damage,state(amplifier=amplifier),player=player,attacker=attacker) + for flags in range(128): + initial=state(resistance=flags&1!=0,server=flags&2!=0,weapon=flags&4!=0,bypass_armor=flags&8!=0,bypass_effects=flags&16!=0,bypass_resistance=flags&32!=0,bypass_enchantments=flags&64!=0) + for mode in ['armor','magic']:yield row(mode,initial=initial) + for mode in ['armor-value','armor','magic']: + for player in [False,True]: + for fail in range(-1,17): + for mutation in range(-1,17):yield row(mode,initial=state(amplifier=1),player=player,fail=fail,mutate_at=mutation) + rng=random.Random(0x524553495354) + for _ in range(7000): + initial=state(rng.choice(values),rng.choice(values),rng.randrange(-2**31,2**31),resistance=bool(rng.randrange(2)),server=bool(rng.randrange(2)),weapon=bool(rng.randrange(2)),bypass_armor=bool(rng.randrange(2)),bypass_effects=bool(rng.randrange(2)),bypass_resistance=bool(rng.randrange(2)),bypass_enchantments=bool(rng.randrange(2))) + f=row(rng.choice(['armor-value','armor','magic']),rng.choice(values),initial,player=bool(rng.randrange(2)),attacker=rng.randrange(3),fail=rng.choice([-1,-1,0,4,8,12]),mutate_at=rng.choice([-1,-1,0,3,7,11])) + if rng.randrange(3)==0:f['damage']=f'{rng.getrandbits(32):08x}' + yield f + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-damage-reduction-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDamageReductionOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/damage_reduction_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaDamageReductionOracle',mode,path],side+'-'+mode) + java('server','export',build) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs,build/'slots.json'];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','damage_reduction_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('damage_reduction_fixture.exe' if os.name=='nt' else 'damage_reduction_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} damage reduction output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual LivingEntity armor-value and armor/magic reduction methods for base living and ServerPlayer receivers. Damage bypass tags, hurtArmor dispatch, floor/narrow attribute arithmetic, native CombatRules, resistance amplifier overflow and resisted statistics, repeated attacker lookup, native empty-equipment protection lookup, mutations/failures and numeric edges. Item enchantments, actual durability/effects/tag registries and full damage integration remain pending.'} + lab.write_json(report_path,report);print(f'Scoped damage reduction parity passed: {report_path}') + + +if __name__=='__main__':main() From 5b6ce7faa9a4107131948c08d476953839a75b33 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 04:53:08 +0200 Subject: [PATCH 114/253] Implement synchronized float tables and reentrant update ordering --- .../scoped-parity.json | 251 ++++++++++++++++++ .../examples/synced_floats_fixture.rs | 161 +++++++++++ crates/horizon-world/src/lib.rs | 1 + crates/horizon-world/src/synced_floats.rs | 151 +++++++++++ docs/collision-geometry.md | 16 ++ .../parity/VanillaSyncedFloatsOracle.java | 36 +++ tools/test_synced_floats_parity.py | 77 ++++++ 7 files changed, 693 insertions(+) create mode 100644 benchmarks/rust-synced-floats-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/synced_floats_fixture.rs create mode 100644 crates/horizon-world/src/synced_floats.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSyncedFloatsOracle.java create mode 100644 tools/test_synced_floats_parity.py diff --git a/benchmarks/rust-synced-floats-2026-10-07/scoped-parity.json b/benchmarks/rust-synced-floats-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..c2e22e623 --- /dev/null +++ b/benchmarks/rust-synced-floats-2026-10-07/scoped-parity.json @@ -0,0 +1,251 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 3019, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSyncedFloatsOracle.java": "567a871ed82ad0c0d1fef6f84cc2a68732ddae9110a9926c659af77933c6f61d", + "tools/test_synced_floats_parity.py": "64a2a3ef6c4ab63fcfd18fb3cd0442e2bbe2249481cbf7899aeadb3b6b61256f", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "fc5fe4b491968e0c70c46561cf548138469c93f76629e1f9b20016f94b22e8d2", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "711e78438ece3e94eb156c0e64cfea06a63f79640a7a81e396ae2c1b277cdce6", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "f417aab280331ddd6f0ca265a12c0130c78b9924f407c7e07f198140501e6010", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/synced_floats_fixture.rs": "71858a47a15cb62eb8b53dfb507d6e2e96d23dda04b84bdd660b49301eeb9757" + }, + "fixtures_sha256": { + ".local/rust-synced-floats-parity/inputs.txt": "22904cc4d2748db510a0a5935c1024fb2d8d5bc9ce994b414cf6d265d6ca60c9" + }, + "rust_output_sha256": "80bb47d39c2d89981b03a0dd25715fcf9ab6d3f41671e9074f3a143b0bc78c2b", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "80bb47d39c2d89981b03a0dd25715fcf9ab6d3f41671e9074f3a143b0bc78c2b", + "matched_output_lines": 554909 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "80bb47d39c2d89981b03a0dd25715fcf9ab6d3f41671e9074f3a143b0bc78c2b", + "matched_output_lines": 554909 + } + ], + "scope": "Actual SynchedEntityData Float fields: boxed equality, forced updates, callback-before-dirty flags, ordered dirty/default extraction, received assignment including duplicates, partial unknown-ID/observer failures, batch callbacks and reentrant set/assign/pack. Native table gaps are untouched default dummy Float items; tested keys are explicit configured IDs. Other serializers, type-mismatch errors, wire codecs and player absorption integration remain pending." +} diff --git a/crates/horizon-world/examples/synced_floats_fixture.rs b/crates/horizon-world/examples/synced_floats_fixture.rs new file mode 100644 index 000000000..4eb2e8046 --- /dev/null +++ b/crates/horizon-world/examples/synced_floats_fixture.rs @@ -0,0 +1,161 @@ +use horizon_world::synced_floats::{DataError, FloatValue, Observer, SyncedFloats}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn single(v: &Value) -> f32 { + f32::from_bits(u32::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn bits(v: f32) -> u32 { + if v.is_nan() { + f32::NAN.to_bits() + } else { + v.to_bits() + } +} +fn parse(v: &Value) -> Vec { + v.as_array() + .unwrap() + .iter() + .map(|v| FloatValue { + id: v["id"].as_u64().unwrap() as u8, + value: single(&v["value"]), + }) + .collect() +} +fn values(v: Option<&[FloatValue]>) -> String { + match v { + None => "none".into(), + Some([]) => "empty".into(), + Some(v) => v + .iter() + .map(|v| format!("{}:{:08x}", v.id, bits(v.value))) + .collect::>() + .join(","), + } +} +struct Callback<'a> { + out: &'a mut dyn Write, + op: &'a Value, + calls: i64, + nested: bool, +} +impl Callback<'_> { + fn event(&mut self, s: &str) -> io::Result<()> { + writeln!(self.out, "{s}")?; + let n = self.calls; + self.calls += 1; + if n == self.op["fail"].as_i64().unwrap() { + Err(io::Error::other("injected synchronized callback failure")) + } else { + Ok(()) + } + } +} +impl Observer for Callback<'_> { + type Error = io::Error; + fn updated(&mut self, data: &mut SyncedFloats, id: u8) -> io::Result<()> { + self.event(&format!( + "updated {id} {:08x} {} {}", + bits(data.get(id).unwrap()), + data.is_dirty(), + data.item_dirty(id).unwrap() + ))?; + if self.nested { + return Ok(()); + } + self.nested = true; + let other = self.op["other"].as_u64().unwrap() as u8; + let value = single(&self.op["other_value"]); + let result = match self.op["hook"].as_str().unwrap() { + "none" => Ok(()), + "pack" => writeln!( + self.out, + "callback-pack {}", + values(data.take_dirty().as_deref()) + ), + "set" => data + .set( + other, + value, + self.op["other_force"].as_bool().unwrap(), + self, + ) + .map_err(|e| match e { + DataError::Observer(e) => e, + DataError::UnknownId(_) => panic!("hook uses registered ID"), + }), + "assign" => data + .assign(&[FloatValue { id: other, value }], self) + .map_err(|e| match e { + DataError::Observer(e) => e, + DataError::UnknownId(_) => panic!("hook uses registered ID"), + }), + _ => panic!("hook"), + }; + self.nested = false; + result + } + fn assigned(&mut self, _: &mut SyncedFloats, v: &[FloatValue]) -> io::Result<()> { + self.event(&format!("assigned {}", values(Some(v)))) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let initial = parse(&f["initial"]); + let mut ids = initial.iter().map(|v| v.id).collect::>(); + ids.sort_unstable(); + let mut data = SyncedFloats::new(&initial)?; + for op in f["ops"].as_array().unwrap() { + let mut cb = Callback { + out: &mut out, + op, + calls: 0, + nested: false, + }; + let id = op["id"].as_u64().unwrap() as u8; + let result = match op["mode"].as_str().unwrap() { + "set" => data.set( + id, + single(&op["value"]), + op["force"].as_bool().unwrap(), + &mut cb, + ), + "assign" => data.assign(&parse(&op["values"]), &mut cb), + "get" => data.get(id).map_err(DataError::UnknownId).and_then(|v| { + writeln!(cb.out, "get {:08x}", bits(v)).map_err(DataError::Observer) + }), + "pack" => writeln!(cb.out, "packed {}", values(data.take_dirty().as_deref())) + .map_err(DataError::Observer), + "defaults" => { + writeln!(cb.out, "defaults {}", values(data.non_default().as_deref())) + .map_err(DataError::Observer) + } + _ => panic!("mode"), + }; + match result { + Ok(()) => writeln!(cb.out, "result ok")?, + Err(DataError::Observer(_)) => writeln!(cb.out, "error observer")?, + Err(DataError::UnknownId(_)) => writeln!(cb.out, "error id")?, + } + writeln!(cb.out, "dirty {}", data.is_dirty())?; + for id in &ids { + writeln!( + cb.out, + "state {id} {:08x} {} {}", + bits(data.get(*id).unwrap()), + data.item_dirty(*id).unwrap(), + data.is_default(*id).unwrap() + )?; + } + writeln!(cb.out, "calls {}", cb.calls)?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 54c6a1d28..014e87cf8 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -66,6 +66,7 @@ pub mod registry_fluid; pub mod retrogen; pub mod suffocation; pub mod swimming; +pub mod synced_floats; pub mod tick_data; pub mod water_splash; pub mod world_movement; diff --git a/crates/horizon-world/src/synced_floats.rs b/crates/horizon-world/src/synced_floats.rs new file mode 100644 index 000000000..0f7f3bc9b --- /dev/null +++ b/crates/horizon-world/src/synced_floats.rs @@ -0,0 +1,151 @@ +//! Multiple synchronized float fields with native callback and dirty ordering. +//! Other serializer types and wire codecs are not represented by this module. +use crate::compression::invalid; +use std::{fmt, io}; +#[derive(Clone, Copy, Debug)] +pub struct FloatValue { + pub id: u8, + pub value: f32, +} +#[derive(Clone, Copy, Debug)] +struct Entry { + id: u8, + initial: f32, + value: f32, + dirty: bool, +} +#[derive(Clone, Debug)] +pub struct SyncedFloats { + entries: Vec, + dirty: bool, +} +#[derive(Debug)] +pub enum DataError { + UnknownId(u8), + Observer(E), +} +impl fmt::Display for DataError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::UnknownId(id) => write!(f, "unknown synchronized float ID {id}"), + Self::Observer(e) => e.fmt(f), + } + } +} +impl std::error::Error for DataError {} +pub trait Observer { + type Error; + fn updated(&mut self, data: &mut SyncedFloats, id: u8) -> Result<(), Self::Error>; + fn assigned( + &mut self, + _data: &mut SyncedFloats, + _values: &[FloatValue], + ) -> Result<(), Self::Error> { + Ok(()) + } +} +fn equal(a: f32, b: f32) -> bool { + a.to_bits() == b.to_bits() || (a.is_nan() && b.is_nan()) +} +impl SyncedFloats { + pub fn new(values: &[FloatValue]) -> io::Result { + let mut entries = values + .iter() + .map(|v| Entry { + id: v.id, + initial: v.value, + value: v.value, + dirty: false, + }) + .collect::>(); + entries.sort_unstable_by_key(|e| e.id); + if entries.iter().any(|e| e.id == 255) || entries.windows(2).any(|e| e[0].id == e[1].id) { + return Err(invalid("duplicate or reserved synchronized float ID")); + } + Ok(Self { + entries, + dirty: false, + }) + } + fn index(&self, id: u8) -> Result { + self.entries + .binary_search_by_key(&id, |e| e.id) + .map_err(|_| id) + } + pub fn get(&self, id: u8) -> Result { + Ok(self.entries[self.index(id)?].value) + } + pub fn is_dirty(&self) -> bool { + self.dirty + } + pub fn item_dirty(&self, id: u8) -> Result { + Ok(self.entries[self.index(id)?].dirty) + } + pub fn is_default(&self, id: u8) -> Result { + let e = &self.entries[self.index(id)?]; + Ok(equal(e.initial, e.value)) + } + pub fn set( + &mut self, + id: u8, + value: f32, + force: bool, + observer: &mut O, + ) -> Result<(), DataError> { + let index = self.index(id).map_err(DataError::UnknownId)?; + if force || !equal(value, self.entries[index].value) { + self.entries[index].value = value; + observer.updated(self, id).map_err(DataError::Observer)?; + self.entries[index].dirty = true; + self.dirty = true; + } + Ok(()) + } + /// Received values always notify, even when equal, and do not set/clear dirty + /// flags. A failure preserves earlier entries and skips later/batch callbacks. + pub fn assign( + &mut self, + values: &[FloatValue], + observer: &mut O, + ) -> Result<(), DataError> { + for v in values { + let index = self.index(v.id).map_err(DataError::UnknownId)?; + self.entries[index].value = v.value; + observer.updated(self, v.id).map_err(DataError::Observer)?; + } + observer.assigned(self, values).map_err(DataError::Observer) + } + pub fn take_dirty(&mut self) -> Option> { + if !self.dirty { + return None; + } + self.dirty = false; + let mut values = Vec::new(); + for e in &mut self.entries { + if e.dirty { + e.dirty = false; + values.push(FloatValue { + id: e.id, + value: e.value, + }); + } + } + Some(values) + } + pub fn non_default(&self) -> Option> { + let values: Vec<_> = self + .entries + .iter() + .filter(|e| !equal(e.initial, e.value)) + .map(|e| FloatValue { + id: e.id, + value: e.value, + }) + .collect(); + if values.is_empty() { + None + } else { + Some(values) + } + } +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 208f75899..d3618ebd7 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1283,3 +1283,19 @@ resistance/stat boundaries, numeric edges, query failures/mutations and actual empty-equipment protection iteration. Targeted Clippy passes. Equipment is empty; enchanted components, actual armor durability, registered damage/effect bindings and the full hurt sequence remain pending. + + +`synced_floats` stores multiple synchronized float fields. It preserves boxed +float equality, per-field/global dirty state, ascending-ID dirty/default lists, +received assignment without newly marking dirty, per-entry and batch callbacks, +and prefix effects when an observer or field lookup fails. Callbacks may reenter +the table to set/assign fields or drain existing dirty values. + +`python3 tools/test_synced_floats_parity.py` compares actual `SynchedEntityData`. +The [synchronized float report](../benchmarks/rust-synced-floats-2026-10-07/scoped-parity.json) +records **554,909 matching lines per JAR**, including forced/equal updates, +received duplicates, reentrant operations, missing IDs, callback failures and +NaN/signed-zero equality. Native gaps are untouched default float items; observed +keys are explicit configured IDs. Targeted Clippy passes. Other serializers, +serializer-mismatch errors, wire codecs and player absorption binding remain +pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSyncedFloatsOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSyncedFloatsOracle.java new file mode 100644 index 000000000..761801c0f --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSyncedFloatsOracle.java @@ -0,0 +1,36 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.nio.file.*;import java.util.*; +import net.minecraft.network.syncher.*; +/** Native multi-float dirty/default lists, assignment and reentrant callbacks. */ +public final class VanillaSyncedFloatsOracle { + static final class Stop extends RuntimeException {} + static float single(JsonElement v){return Float.intBitsToFloat(Integer.parseUnsignedInt(v.getAsString(),16));} + static String bits(float v){return String.format("%08x",Float.floatToIntBits(v));} + static String values(List> list){if(list==null)return "none";var s=new StringJoiner(",");for(var v:list)s.add(v.id()+":"+bits((Float)v.value()));return s.length()==0?"empty":s.toString();} + static EntityDataAccessor key(int id){return new EntityDataAccessor(id,EntityDataSerializers.FLOAT);} + static List> values(JsonArray values){var result=new ArrayList>();for(var x:values){var v=x.getAsJsonObject();result.add(new SynchedEntityData.DataValue(v.get("id").getAsInt(),EntityDataSerializers.FLOAT,single(v.get("value"))));}return result;} + static final class Holder implements SyncedDataHolder { + SynchedEntityData data;SynchedEntityData.DataItem[] items;JsonObject op;PrintWriter out;int calls;boolean nested; + void event(String s){out.println(s);if(calls++==op.get("fail").getAsInt())throw new Stop();} + @Override public void onSyncedDataUpdated(EntityDataAccessor key){int id=key.id();event("updated "+id+" "+bits((Float)items[id].getValue())+" "+data.isDirty()+" "+items[id].isDirty());if(nested)return;nested=true;try{switch(op.get("hook").getAsString()){ + case "none":break;case "pack":out.println("callback-pack "+values(data.packDirty()));break; + case "set":data.set(key(op.get("other").getAsInt()),single(op.get("other_value")),op.get("other_force").getAsBoolean());break; + case "assign":data.assignValues(List.of(new SynchedEntityData.DataValue(op.get("other").getAsInt(),EntityDataSerializers.FLOAT,single(op.get("other_value")))));break; + default:throw new AssertionError();}}finally{nested=false;}} + @Override public void onSyncedDataUpdated(List> values){event("assigned "+values(values));} + } + public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();var ctor=SynchedEntityData.class.getDeclaredConstructor(SyncedDataHolder.class,SynchedEntityData.DataItem[].class);ctor.setAccessible(true);Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();var holder=new Holder();holder.out=out;var initial=f.getAsJsonArray("initial");var ids=new ArrayList();int max=-1;for(var v:initial){int id=v.getAsJsonObject().get("id").getAsInt();ids.add(id);max=Math.max(max,id);}Collections.sort(ids);holder.items=new SynchedEntityData.DataItem[max+1];for(int i=0;i<=max;i++)holder.items[i]=new SynchedEntityData.DataItem(key(i),0f);for(var v:initial){var e=v.getAsJsonObject();int id=e.get("id").getAsInt();holder.items[id]=new SynchedEntityData.DataItem(key(id),single(e.get("value")));}holder.data=ctor.newInstance(holder,holder.items); + for(var v:f.getAsJsonArray("ops")){var op=v.getAsJsonObject();holder.op=op;holder.calls=0;try{switch(op.get("mode").getAsString()){ + case "set":holder.data.set(key(op.get("id").getAsInt()),single(op.get("value")),op.get("force").getAsBoolean());break; + case "get":out.println("get "+bits(holder.data.get(key(op.get("id").getAsInt()))));break; + case "assign":holder.data.assignValues(values(op.getAsJsonArray("values")));break; + case "pack":out.println("packed "+values(holder.data.packDirty()));break; + case "defaults":out.println("defaults "+values(holder.data.getNonDefaultValues()));break; + default:throw new AssertionError();}out.println("result ok");}catch(Stop e){out.println("error observer");}catch(IndexOutOfBoundsException e){out.println("error id");} + out.println("dirty "+holder.data.isDirty());for(int id:ids){var e=holder.items[id];out.println("state "+id+" "+bits((Float)e.getValue())+" "+e.isDirty()+" "+e.isSetToDefault());}out.println("calls "+holder.calls); + } + }} + } +} diff --git a/tools/test_synced_floats_parity.py b/tools/test_synced_floats_parity.py new file mode 100644 index 000000000..1161de248 --- /dev/null +++ b/tools/test_synced_floats_parity.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python3 +"""Compare multiple synchronized float fields, assignment and reentrant callbacks with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + def bits(v):return struct.pack('>f',v).hex() + def value(id=9,v=0):return dict(id=id,value=bits(v)) + def op(mode='set',id=9,v=0,**kw): + o=dict(mode=mode,id=id,value=bits(v),force=False,values=[],hook='none',other=17,other_value=bits(7),other_force=False,fail=-1);o.update(kw);return o + def row(initial,ops):return dict(initial=initial,ops=ops) + values=[-float('inf'),-1e30,-1,-0.,0.,1e-40,.1,1,7,20,1e30,float('inf'),float('nan')] + for start in values: + for v in values: + for hook in ['none','pack','set','assign']: + for force in [False,True]:yield row([value(17),value(9,start)],[op(v=v,force=force,hook=hook),op('defaults'),op('pack'),op(v=v,hook=hook),op('assign',values=[value(17,v),value(9,start),value(9,start)],hook=hook),op('pack'),op('defaults')]) + for mode in ['set','assign']: + for hook in ['none','pack','set','assign']: + for fail in range(-1,9): + for other in [9,17]:yield row([value(9),value(17)],[op(v=3),op(mode,v=5,values=[value(9,5),value(17,7)],hook=hook,other=other,fail=fail),op('pack'),op('defaults')]) + for initial in [[],[value(0)],[value(1),value(254)],[value(i,i) for i in range(8)]]: + yield row(initial,[op('get',255),op('set',255),op('assign',values=[value(v['id'],2) for v in initial]+[value(255)]),op('assign',values=[]),op('pack'),op('defaults')]) + rng=random.Random(0x53594e43464c4f41) + for _ in range(1500): + ids=rng.sample(range(64),rng.randrange(1,12));initial=[value(id,rng.choice(values)) for id in ids];ops=[] + for __ in range(rng.randrange(5,60)): + ops.append(op(rng.choice(['set','set','get','pack','defaults','assign']),rng.choice(ids+[255]),rng.choice(values),force=bool(rng.randrange(2)),values=[value(rng.choice(ids+[255]),rng.choice(values)) for ___ in range(rng.randrange(6))],hook=rng.choice(['none','pack','set','assign']),other=rng.choice(ids),other_value=bits(rng.choice(values)),other_force=bool(rng.randrange(2)),fail=rng.choice([-1,-1,-1,0,1,2,3]))) + yield row(initial,ops) + for nan in ['7fa12345','7fc00000','ffa12345']: + initial=[value(9),value(17)];initial[0]['value']=nan;yield row(initial,[op(v=float('nan')),op('defaults'),op('pack')]) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-synced-floats-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSyncedFloatsOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/synced_floats_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaSyncedFloatsOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','synced_floats_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('synced_floats_fixture.exe' if os.name=='nt' else 'synced_floats_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} synchronized float output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual SynchedEntityData Float fields: boxed equality, forced updates, callback-before-dirty flags, ordered dirty/default extraction, received assignment including duplicates, partial unknown-ID/observer failures, batch callbacks and reentrant set/assign/pack. Native table gaps are untouched default dummy Float items; tested keys are explicit configured IDs. Other serializers, type-mismatch errors, wire codecs and player absorption integration remain pending.'} + lab.write_json(report_path,report);print(f'Scoped synchronized float parity passed: {report_path}') + + +if __name__=='__main__':main() From 4f595f34a53aae2cdf48955c759a84239187dd22 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 05:05:28 +0200 Subject: [PATCH 115/253] Bind player absorption and health to shared synchronized storage --- .../scoped-parity.json | 255 ++++++++++++++++++ .../examples/player_health_fixture.rs | 242 +++++++++++++++++ crates/horizon-world/src/lib.rs | 1 + crates/horizon-world/src/player_health.rs | 155 +++++++++++ docs/collision-geometry.md | 16 ++ .../parity/VanillaPlayerHealthOracle.java | 39 +++ tools/test_player_health_parity.py | 74 +++++ 7 files changed, 782 insertions(+) create mode 100644 benchmarks/rust-player-health-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/player_health_fixture.rs create mode 100644 crates/horizon-world/src/player_health.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerHealthOracle.java create mode 100644 tools/test_player_health_parity.py diff --git a/benchmarks/rust-player-health-2026-10-07/scoped-parity.json b/benchmarks/rust-player-health-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..215fcfb67 --- /dev/null +++ b/benchmarks/rust-player-health-2026-10-07/scoped-parity.json @@ -0,0 +1,255 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 4258, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerHealthOracle.java": "5d6dc93c0140e2b2f953fba7290721079d5a607fa81b051e2ac1e4742ab606f2", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityAttributeOracle.java": "2ad3190a9798ab54bd12e88573028d0ca6a204e2f8a92018aae98b22335213bf", + "tools/test_player_health_parity.py": "7a094194489f5e952c23737da9b352cf17d4b5b08c05d4c8dc8f50a98f194beb", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "d66b993f1b13d15977a792e04a0668ca9cc3920d49d2c7737efaffb0be03621f", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "711e78438ece3e94eb156c0e64cfea06a63f79640a7a81e396ae2c1b277cdce6", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "f417aab280331ddd6f0ca265a12c0130c78b9924f407c7e07f198140501e6010", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/player_health_fixture.rs": "7650495fbe91f9796a5b1be2115a583e4d55dba42d73ede292018711e3b9213f" + }, + "fixtures_sha256": { + ".local/rust-player-health-parity/inputs.txt": "ae26fb76cf1034d72f15095389903074ed1c435e83291ec9cb41023663481ec0", + ".local/rust-player-health-parity/catalog.json": "d1e488e4f432888beb9f643904c8bca242d1e2093f53e23e07da305d70cf7106", + ".local/rust-player-health-parity/ids.json": "f7d6037166d966e2714b01cff5626f0cc0a02ce883885ec791c93e977afde0e6" + }, + "rust_output_sha256": "546505ec6df593bc2e15ac2f28b3ee41ee0f723a537a827f982e6e34a6ad2ca0", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "546505ec6df593bc2e15ac2f28b3ee41ee0f723a537a827f982e6e34a6ad2ca0", + "matched_output_lines": 243146 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "546505ec6df593bc2e15ac2f28b3ee41ee0f723a537a827f982e6e34a6ad2ca0", + "matched_output_lines": 243146 + } + ], + "scope": "Actual Player health/absorption methods using registered player AttributeMap and one SynchedEntityData table. Exports actual health/absorption field IDs; compares modified attribute limits, healing, player absorption getter/setter, dirty/default extraction, received updates, callback packet drains and failures. Observer side effects are controlled; custom virtual data replacement, other synchronized serializers, wire codecs and full player damage/tick integration remain pending." +} diff --git a/crates/horizon-world/examples/player_health_fixture.rs b/crates/horizon-world/examples/player_health_fixture.rs new file mode 100644 index 000000000..f7b687f65 --- /dev/null +++ b/crates/horizon-world/examples/player_health_fixture.rs @@ -0,0 +1,242 @@ +use horizon_world::{ + attributes::{ + Modifier, Operation, + entity::{Catalog, EntityAttributes}, + }, + player_health::{PlayerAttributeHealth, PlayerFloatIds}, + synced_floats::{FloatValue, Observer, SyncedFloats}, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, + sync::Arc, +}; +fn single(v: &Value) -> f32 { + f32::from_bits(u32::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn bits(v: f32) -> u32 { + if v.is_nan() { + f32::NAN.to_bits() + } else { + v.to_bits() + } +} +fn values(v: Option<&[FloatValue]>) -> String { + match v { + None => "none".into(), + Some([]) => "empty".into(), + Some(v) => v + .iter() + .map(|v| format!("{}:{:08x}", v.id, bits(v.value))) + .collect::>() + .join(","), + } +} +struct Callback<'a> { + out: &'a mut dyn Write, + op: &'a Value, + calls: i64, +} +impl Callback<'_> { + fn event(&mut self, s: &str) -> io::Result<()> { + writeln!(self.out, "{s}")?; + let n = self.calls; + self.calls += 1; + if n == self.op["fail"].as_i64().unwrap() { + Err(io::Error::other("injected player health callback failure")) + } else { + Ok(()) + } + } +} +impl Observer for Callback<'_> { + type Error = io::Error; + fn updated(&mut self, data: &mut SyncedFloats, id: u8) -> io::Result<()> { + self.event(&format!( + "updated {id} {:08x} {}", + bits(data.get(id).unwrap()), + data.is_dirty() + ))?; + if self.op["pack_callback"].as_bool().unwrap() { + writeln!( + self.out, + "callback-pack {}", + values(data.take_dirty().as_deref()) + )?; + } + Ok(()) + } + fn assigned(&mut self, _: &mut SyncedFloats, v: &[FloatValue]) -> io::Result<()> { + self.event(&format!("assigned {}", values(Some(v)))) + } +} +struct State { + attributes: EntityAttributes, + data: SyncedFloats, + ids: PlayerFloatIds, + dead: bool, +} +impl State { + fn bind<'a, 'b>( + &'a mut self, + cb: &'a mut Callback<'b>, + ) -> PlayerAttributeHealth<'a, Callback<'b>> { + PlayerAttributeHealth::new( + &mut self.attributes, + &mut self.data, + self.ids, + self.dead, + cb, + ) + .unwrap() + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let ids: Value = serde_json::from_str(&fs::read_to_string(dir.join("ids.json"))?)?; + let ids = PlayerFloatIds { + health: ids["health"].as_u64().unwrap() as u8, + absorption: ids["absorption"].as_u64().unwrap() as u8, + }; + let catalog = Arc::new(Catalog::from_json(&serde_json::from_str( + &fs::read_to_string(dir.join("catalog.json"))?, + )?)?); + let keys = [ + catalog.id("minecraft:max_health").unwrap(), + catalog.id("minecraft:max_absorption").unwrap(), + ]; + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut state = State { + attributes: catalog.create("minecraft:player").unwrap(), + data: SyncedFloats::new(&[ + FloatValue { + id: ids.health, + value: single(&f["health"]), + }, + FloatValue { + id: ids.absorption, + value: single(&f["absorption"]), + }, + ])?, + ids, + dead: f["dead"].as_bool().unwrap(), + }; + for op in f["ops"].as_array().unwrap() { + let mut cb = Callback { + out: &mut out, + op, + calls: 0, + }; + let key = keys[op["attribute"].as_u64().unwrap() as usize]; + let v = single(&op["value"]); + let result = match op["mode"].as_str().unwrap() { + "set" => state.bind(&mut cb).set_health(v).map_err(|_| ()), + "heal" => state.bind(&mut cb).heal(v).map_err(|_| ()), + "absorption" => state.bind(&mut cb).set_absorption(v).map_err(|_| ()), + "get-absorption" => state + .bind(&mut cb) + .absorption() + .map_err(|_| ()) + .and_then(|v| writeln!(cb.out, "float {:08x}", bits(v)).map_err(|_| ())), + "hurt" => state + .bind(&mut cb) + .is_hurt() + .map_err(|_| ()) + .and_then(|v| writeln!(cb.out, "bool {v}").map_err(|_| ())), + "dead" => state + .bind(&mut cb) + .is_dead_or_dying() + .map_err(|_| ()) + .and_then(|v| writeln!(cb.out, "bool {v}").map_err(|_| ())), + "base" => { + state + .attributes + .edit(key, |a, o| a.set_base_value(number(&op["amount"]), o)) + .unwrap() + .unwrap(); + Ok(()) + } + "add" => { + let m = Modifier::new( + op["id"].as_str().unwrap(), + number(&op["amount"]), + Operation::ALL[op["operation"].as_u64().unwrap() as usize], + )?; + state + .attributes + .edit(key, |a, o| a.add_or_update_transient(m, o)) + .unwrap() + .unwrap(); + Ok(()) + } + "remove" => { + state + .attributes + .edit(key, |a, o| a.remove(op["id"].as_str().unwrap(), o)) + .unwrap() + .unwrap(); + Ok(()) + } + "reset" => { + state.attributes.reset_base(key); + Ok(()) + } + "pack" => writeln!( + cb.out, + "packed {}", + values(state.data.take_dirty().as_deref()) + ) + .map_err(|_| ()), + "defaults" => writeln!( + cb.out, + "defaults {}", + values(state.data.non_default().as_deref()) + ) + .map_err(|_| ()), + "assign" => { + let values = op["values"] + .as_array() + .unwrap() + .iter() + .map(|v| FloatValue { + id: if v["field"] == 0 { + ids.health + } else { + ids.absorption + }, + value: single(&v["value"]), + }) + .collect::>(); + state.data.assign(&values, &mut cb).map_err(|_| ()) + } + _ => panic!("mode"), + }; + writeln!( + cb.out, + "result {}", + if result.is_ok() { "ok" } else { "error" } + )?; + writeln!( + cb.out, + "state {:08x} {:08x} {} {} {} {} {} {}", + bits(state.data.get(ids.health).unwrap()), + bits(state.data.get(ids.absorption).unwrap()), + state.data.is_dirty(), + state.data.item_dirty(ids.health).unwrap(), + state.data.item_dirty(ids.absorption).unwrap(), + state.data.is_default(ids.health).unwrap(), + state.data.is_default(ids.absorption).unwrap(), + cb.calls + )?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 014e87cf8..f7be517de 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -56,6 +56,7 @@ pub mod nbt; pub mod piston_movement; pub mod piston_shape; pub mod player_food; +pub mod player_health; pub mod player_travel; pub mod powder_snow_collision; pub mod region; diff --git a/crates/horizon-world/src/player_health.rs b/crates/horizon-world/src/player_health.rs new file mode 100644 index 000000000..26e028833 --- /dev/null +++ b/crates/horizon-world/src/player_health.rs @@ -0,0 +1,155 @@ +//! Player absorption uses virtual synchronized-data access, unlike base living +//! absorption field storage. Health keeps its direct synchronized-data access. +use crate::{ + attributes::entity::{AttributeId, EntityAttributes, LookupError}, + compression::invalid, + living_health::{self, HealthWorld}, + synced_floats::{DataError, Observer, SyncedFloats}, +}; +use std::{fmt, io}; +pub trait PlayerHealthWorld: HealthWorld { + fn entity_data(&mut self) -> Result; + fn read_absorption(&mut self, data: Self::Data) -> Result; + fn write_absorption(&mut self, data: Self::Data, value: f32) -> Result<(), Self::Error>; +} +pub fn absorption(world: &mut W) -> Result { + let data = world.entity_data()?; + world.read_absorption(data) +} +pub fn internal_set_absorption( + world: &mut W, + value: f32, +) -> Result<(), W::Error> { + let data = world.entity_data()?; + world.write_absorption(data, value) +} +#[derive(Clone, Copy, Debug)] +pub struct PlayerFloatIds { + pub health: u8, + pub absorption: u8, +} +#[derive(Debug)] +pub enum PlayerHealthError { + Attribute(LookupError), + Data(DataError), +} +impl fmt::Display for PlayerHealthError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::Attribute(e) => write!(f, "player health attribute lookup: {e:?}"), + Self::Data(e) => e.fmt(f), + } + } +} +impl std::error::Error for PlayerHealthError {} +/// Ordinary registered-player state, borrowing its actual float table. IDs come +/// from the pinned entity-data schema; construction does not invent spawn state. +pub struct PlayerAttributeHealth<'a, O> { + attributes: &'a mut EntityAttributes, + data: &'a mut SyncedFloats, + ids: PlayerFloatIds, + max_health: AttributeId, + max_absorption: AttributeId, + dead: bool, + observer: &'a mut O, +} +impl<'a, O: Observer> PlayerAttributeHealth<'a, O> { + pub fn new( + attributes: &'a mut EntityAttributes, + data: &'a mut SyncedFloats, + ids: PlayerFloatIds, + dead: bool, + observer: &'a mut O, + ) -> io::Result { + if ids.health == ids.absorption + || data.get(ids.health).is_err() + || data.get(ids.absorption).is_err() + { + return Err(invalid("missing or aliased player float fields")); + } + let max_health = attributes + .catalog() + .id("minecraft:max_health") + .ok_or_else(|| invalid("missing MAX_HEALTH definition"))?; + let max_absorption = attributes + .catalog() + .id("minecraft:max_absorption") + .ok_or_else(|| invalid("missing MAX_ABSORPTION definition"))?; + Ok(Self { + attributes, + data, + ids, + max_health, + max_absorption, + dead, + observer, + }) + } + pub fn heal(&mut self, amount: f32) -> Result<(), PlayerHealthError> { + living_health::heal(self, amount) + } + pub fn set_health(&mut self, value: f32) -> Result<(), PlayerHealthError> { + living_health::set_health(self, value) + } + pub fn set_absorption(&mut self, value: f32) -> Result<(), PlayerHealthError> { + living_health::set_absorption(self, value) + } + pub fn absorption(&mut self) -> Result> { + absorption(self) + } + pub fn is_hurt(&mut self) -> Result> { + living_health::is_hurt(self) + } + pub fn is_dead_or_dying(&mut self) -> Result> { + living_health::is_dead_or_dying(self) + } +} +impl HealthWorld for PlayerAttributeHealth<'_, O> { + type Error = PlayerHealthError; + type Data = (); + fn health(&mut self) -> Result { + self.data + .get(self.ids.health) + .map_err(|id| PlayerHealthError::Data(DataError::UnknownId(id))) + } + fn health_data(&self) {} + fn max_health_attribute(&mut self) -> Result { + self.attributes + .value(self.max_health) + .map_err(PlayerHealthError::Attribute) + } + fn max_absorption_attribute(&mut self) -> Result { + self.attributes + .value(self.max_absorption) + .map_err(PlayerHealthError::Attribute) + } + fn store_health(&mut self, _: (), value: f32) -> Result<(), Self::Error> { + self.data + .set(self.ids.health, value, false, self.observer) + .map_err(PlayerHealthError::Data) + } + fn store_absorption(&mut self, value: f32) -> Result<(), Self::Error> { + internal_set_absorption(self, value) + } + fn dead_flag(&self) -> bool { + self.dead + } + fn dispatch_set_health(&mut self, value: f32) -> Result<(), Self::Error> { + living_health::set_health(self, value) + } +} +impl PlayerHealthWorld for PlayerAttributeHealth<'_, O> { + fn entity_data(&mut self) -> Result<(), Self::Error> { + Ok(()) + } + fn read_absorption(&mut self, _: ()) -> Result { + self.data + .get(self.ids.absorption) + .map_err(|id| PlayerHealthError::Data(DataError::UnknownId(id))) + } + fn write_absorption(&mut self, _: (), value: f32) -> Result<(), Self::Error> { + self.data + .set(self.ids.absorption, value, false, self.observer) + .map_err(PlayerHealthError::Data) + } +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index d3618ebd7..06428eee8 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1299,3 +1299,19 @@ NaN/signed-zero equality. Native gaps are untouched default float items; observe keys are explicit configured IDs. Targeted Clippy passes. Other serializers, serializer-mismatch errors, wire codecs and player absorption binding remain pending. + + +`player_health` binds ordinary registered player attributes to health and +absorption in one synchronized float table. The player absorption getter and +internal setter use virtual data access; health retains its direct data access. +The final absorption setter still applies the registered maximum before writing. + +`python3 tools/test_player_health_parity.py` compares actual Player methods, +registered player attributes and `SynchedEntityData`, exporting the actual pinned +health/absorption field IDs. The +[player health report](../benchmarks/rust-player-health-2026-10-07/scoped-parity.json) +records **243,146 matching lines per JAR**, covering modified limits, healing, +absorption reads/writes, combined dirty/default lists, received assignments, +callback packet drains and failures. Targeted Clippy passes. Observer effects +are controlled; custom virtual data replacement, other synchronized serializers, +wire codecs and full player damage/tick integration remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerHealthOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerHealthOracle.java new file mode 100644 index 000000000..3a19afd71 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerHealthOracle.java @@ -0,0 +1,39 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.lang.reflect.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.*;import net.minecraft.core.registries.*;import net.minecraft.resources.Identifier;import net.minecraft.world.entity.*;import net.minecraft.world.entity.player.Player;import net.minecraft.world.entity.ai.attributes.*;import net.minecraft.network.syncher.*; +/** Actual player health/absorption on one native synchronized table. */ +public final class VanillaPlayerHealthOracle { + static final class Stop extends RuntimeException {} + static EntityDataAccessor healthKey,absorptionKey; + static float single(JsonElement v){return Float.intBitsToFloat(Integer.parseUnsignedInt(v.getAsString(),16));} + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + static String bits(float v){return String.format("%08x",Float.floatToIntBits(v));} + static String values(List> values){if(values==null)return "none";var s=new StringJoiner(",");for(var v:values)s.add(v.id()+":"+bits((Float)v.value()));return s.length()==0?"empty":s.toString();} + static Field field(Class c,String n)throws Exception{var f=c.getDeclaredField(n);f.setAccessible(true);return f;} + static final class Data {JsonObject op;PrintWriter out;AttributeMap attributes;SynchedEntityData data;int calls; + void event(String s){out.println(s);if(calls++==op.get("fail").getAsInt())throw new Stop();}} + static final class Actor extends Player {Data d;Actor(){super(null,null);}@Override public net.minecraft.world.level.GameType gameMode(){return net.minecraft.world.level.GameType.SURVIVAL;} + @Override public double getAttributeValue(Holder a){return d.attributes.getValue(a);} + @Override public void onSyncedDataUpdated(EntityDataAccessor a){var key=a.id()==healthKey.id()?healthKey:absorptionKey;d.event("updated "+key.id()+" "+bits(d.data.get(key))+" "+d.data.isDirty());if(d.op.get("pack_callback").getAsBoolean())d.out.println("callback-pack "+values(d.data.packDirty()));} + @Override public void onSyncedDataUpdated(List> v){d.event("assigned "+values(v));} + } + @SuppressWarnings("unchecked") public static void main(String[] args)throws Exception { + Path dir=Path.of(args[1]);if(args[0].equals("export"))VanillaEntityAttributeOracle.main(args);else{net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();} + healthKey=(EntityDataAccessor)field(LivingEntity.class,"DATA_HEALTH_ID").get(null);absorptionKey=(EntityDataAccessor)field(Player.class,"DATA_PLAYER_ABSORPTION_ID").get(null);if(args[0].equals("export")){var ids=new JsonObject();ids.addProperty("health",healthKey.id());ids.addProperty("absorption",absorptionKey.id());Files.writeString(dir.resolve("ids.json"),ids.toString());return;} + var u=Class.forName("sun.misc.Unsafe");var uf=u.getDeclaredField("theUnsafe");uf.setAccessible(true);var unsafe=uf.get(null);var allocate=u.getMethod("allocateInstance",Class.class);var ctor=SynchedEntityData.class.getDeclaredConstructor(SyncedDataHolder.class,SynchedEntityData.DataItem[].class);ctor.setAccessible(true);var storage=field(Entity.class,"entityData");var dead=field(LivingEntity.class,"dead");var keys=List.of(Attributes.MAX_HEALTH,Attributes.MAX_ABSORPTION); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();var d=new Data();d.out=out;d.attributes=new AttributeMap(VanillaEntityAttributeOracle.supplier(BuiltInRegistries.ENTITY_TYPE.getValue(Identifier.parse("minecraft:player"))));var actor=(Actor)allocate.invoke(unsafe,Actor.class);actor.d=d; + var items=new SynchedEntityData.DataItem[Math.max(healthKey.id(),absorptionKey.id())+1];for(int i=0;i(new EntityDataAccessor(i,EntityDataSerializers.FLOAT),0f);var health=new SynchedEntityData.DataItem(healthKey,single(f.get("health")));var absorption=new SynchedEntityData.DataItem(absorptionKey,single(f.get("absorption")));items[healthKey.id()]=health;items[absorptionKey.id()]=absorption;d.data=ctor.newInstance(actor,items);storage.set(actor,d.data);dead.setBoolean(actor,f.get("dead").getAsBoolean()); + for(var ov:f.getAsJsonArray("ops")){var op=ov.getAsJsonObject();d.op=op;d.calls=0;var key=keys.get(op.get("attribute").getAsInt());float v=single(op.get("value"));try{switch(op.get("mode").getAsString()){ + case "set":actor.setHealth(v);break;case "heal":actor.heal(v);break;case "absorption":actor.setAbsorptionAmount(v);break;case "get-absorption":out.println("float "+bits(actor.getAbsorptionAmount()));break; + case "hurt":out.println("bool "+actor.isHurt());break;case "dead":out.println("bool "+actor.isDeadOrDying());break; + case "base":d.attributes.getInstance(key).setBaseValue(number(op.get("amount")));break; + case "add":d.attributes.getInstance(key).addOrUpdateTransientModifier(new AttributeModifier(Identifier.parse(op.get("id").getAsString()),number(op.get("amount")),AttributeModifier.Operation.values()[op.get("operation").getAsInt()]));break; + case "remove":d.attributes.getInstance(key).removeModifier(Identifier.parse(op.get("id").getAsString()));break;case "reset":d.attributes.resetBaseValue(key);break; + case "pack":out.println("packed "+values(d.data.packDirty()));break;case "defaults":out.println("defaults "+values(d.data.getNonDefaultValues()));break; + case "assign":{var data=new ArrayList>();for(var x:op.getAsJsonArray("values")){var e=x.getAsJsonObject();data.add(new SynchedEntityData.DataValue(e.get("field").getAsInt()==0?healthKey.id():absorptionKey.id(),EntityDataSerializers.FLOAT,single(e.get("value"))));}d.data.assignValues(data);break;} + default:throw new AssertionError();}out.println("result ok");}catch(Stop e){out.println("result error");} + out.println("state "+bits(health.getValue())+" "+bits(absorption.getValue())+" "+d.data.isDirty()+" "+health.isDirty()+" "+absorption.isDirty()+" "+health.isSetToDefault()+" "+absorption.isSetToDefault()+" "+d.calls); + } + }} + } +} diff --git a/tools/test_player_health_parity.py b/tools/test_player_health_parity.py new file mode 100644 index 000000000..c1d5a1ad9 --- /dev/null +++ b/tools/test_player_health_parity.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python3 +"""Compare registered player health and synchronized absorption with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(catalog): + def bits(v):return struct.pack('>f',v).hex() + def double(v):return struct.pack('>d',v).hex() + def op(mode,value=0,**kw): + o=dict(mode=mode,value=bits(value),amount=double(0),attribute=0,id='horizon:a',operation=0,values=[],fail=-1,pack_callback=False);o.update(kw);return o + def row(health,absorption,ops,dead=False):return dict(health=bits(health),absorption=bits(absorption),ops=ops,dead=dead) + values=[-float('inf'),-1e30,-1,-0.,0.,1e-40,.1,1,5,10,20,1e30,float('inf'),float('nan')] + for start in values: + for maximum in values: + for value in values: + yield row(start,start,[op('base',amount=double(maximum)),op('base',attribute=1,amount=double(maximum)),op('set',value),op('absorption',value),op('get-absorption'),op('hurt'),op('dead'),op('pack'),op('heal',value),op('defaults'),op('pack')]) + for fail in range(-1,6): + for pack in [False,True]: + ops=[op('base',attribute=1,amount=double(20)),op('set',9),op('absorption',5),op('pack'),op('set',1),op('assign',values=[dict(field=0,value=bits(20)),dict(field=1,value=bits(7)),dict(field=0,value=bits(10))]),op('pack')] + yield row(1,0,[dict(o,fail=fail,pack_callback=pack) for o in ops]) + rng=random.Random(0x504c415945524850) + for _ in range(1500): + ops=[] + for __ in range(rng.randrange(5,70)): + ops.append(op(rng.choice(['set','heal','absorption','get-absorption','hurt','dead','base','add','remove','reset','pack','defaults','assign']),rng.choice(values),attribute=rng.randrange(2),amount=double(rng.choice(values)),operation=rng.randrange(3),id=rng.choice(['horizon:a','horizon:b']),values=[dict(field=rng.randrange(2),value=bits(rng.choice(values))) for ___ in range(rng.randrange(5))],fail=rng.choice([-1,-1,-1,0,1,2]),pack_callback=bool(rng.randrange(2)))) + yield row(rng.choice(values),rng.choice(values),ops,bool(rng.randrange(2))) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-player-health-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerHealthOracle.java' + helper=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityAttributeOracle.java' + sources=[oracle,helper,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/player_health_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle,helper],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaPlayerHealthOracle',mode,path],side+'-'+mode) + java('server','export',build);states=json.loads((build/'catalog.json').read_text());fixtures=list(corpus(states));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs,build/'catalog.json',build/'ids.json'];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','player_health_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('player_health_fixture.exe' if os.name=='nt' else 'player_health_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} player health output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual Player health/absorption methods using registered player AttributeMap and one SynchedEntityData table. Exports actual health/absorption field IDs; compares modified attribute limits, healing, player absorption getter/setter, dirty/default extraction, received updates, callback packet drains and failures. Observer side effects are controlled; custom virtual data replacement, other synchronized serializers, wire codecs and full player damage/tick integration remain pending.'} + lab.write_json(report_path,report);print(f'Scoped player health parity passed: {report_path}') + + +if __name__=='__main__':main() From f454f2ab46a456253d5a13c4db80fd0a7c5512ec Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 05:17:23 +0200 Subject: [PATCH 116/253] Compose server-player damage with attributes, health and hunger --- .../scoped-parity.json | 258 ++++++++++++++++ .../examples/server_player_damage_fixture.rs | 278 ++++++++++++++++++ crates/horizon-world/src/lib.rs | 1 + .../horizon-world/src/server_player_damage.rs | 278 ++++++++++++++++++ docs/collision-geometry.md | 17 ++ .../VanillaServerPlayerDamageOracle.java | 51 ++++ tools/test_server_player_damage_parity.py | 78 +++++ 7 files changed, 961 insertions(+) create mode 100644 benchmarks/rust-server-player-damage-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/server_player_damage_fixture.rs create mode 100644 crates/horizon-world/src/server_player_damage.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaServerPlayerDamageOracle.java create mode 100644 tools/test_server_player_damage_parity.py diff --git a/benchmarks/rust-server-player-damage-2026-10-07/scoped-parity.json b/benchmarks/rust-server-player-damage-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..776f29610 --- /dev/null +++ b/benchmarks/rust-server-player-damage-2026-10-07/scoped-parity.json @@ -0,0 +1,258 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 7084, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaServerPlayerDamageOracle.java": "686bf09f482410cdbcdd10fd66ba8386f7cebff0b98e532c5f95fe8dd8674b31", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityAttributeOracle.java": "2ad3190a9798ab54bd12e88573028d0ca6a204e2f8a92018aae98b22335213bf", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerHealthOracle.java": "5d6dc93c0140e2b2f953fba7290721079d5a607fa81b051e2ac1e4742ab606f2", + "tools/test_server_player_damage_parity.py": "69740bdebd799c7e995138c42174ef467a94ed2a824e09f07877174bf3df9554", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "3d96af3fcc2eaaa746e662e5307f1f4ea7f59fcbdfcb62d8144fb1ce0ca7f671", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "711e78438ece3e94eb156c0e64cfea06a63f79640a7a81e396ae2c1b277cdce6", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/server_player_damage.rs": "c4fc29eecf2bf401680d1754bef06797a5e4608ab53c5b52e0dd4996f859dbfe", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "f417aab280331ddd6f0ca265a12c0130c78b9924f407c7e07f198140501e6010", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/server_player_damage_fixture.rs": "dd9e91f8f2a025a8674f4704c7126d68e92cb1ea839385489f4390a9fdbd6b17" + }, + "fixtures_sha256": { + ".local/rust-server-player-damage-parity/inputs.txt": "b0f5f0d59ead33819a69d4396937e0eac89864772997a684e81170caa5a05ce7", + ".local/rust-server-player-damage-parity/catalog.json": "d1e488e4f432888beb9f643904c8bca242d1e2093f53e23e07da305d70cf7106", + ".local/rust-server-player-damage-parity/ids.json": "f7d6037166d966e2714b01cff5626f0cc0a02ce883885ec791c93e977afde0e6", + ".local/rust-server-player-damage-parity/slots.json": "29101ebf1ead685029508789eee51c4d4fff65524064d8e32a48efded7036982" + }, + "rust_output_sha256": "25e4f2776522650c2b9e0043af0fd5dffadb9f19e5218aa41082cdefbc593f81", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "25e4f2776522650c2b9e0043af0fd5dffadb9f19e5218aa41082cdefbc593f81", + "matched_output_lines": 373455 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "25e4f2776522650c2b9e0043af0fd5dffadb9f19e5218aa41082cdefbc593f81", + "matched_output_lines": 373455 + } + ], + "scope": "Native ServerPlayer inner damage with actual armor/magic reduction, registered modified attributes, Player health/absorption synchronized storage and FoodData exhaustion. Repeated hits, armor attribute mutation, empty equipment, resistance, bypass tags, callback failures and packet drains. Equipment durability, effects, source tags, combat/stat/event services are controlled; outer hurt gates, enchanted equipment and full player lifecycle remain pending." +} diff --git a/crates/horizon-world/examples/server_player_damage_fixture.rs b/crates/horizon-world/examples/server_player_damage_fixture.rs new file mode 100644 index 000000000..e6eadb806 --- /dev/null +++ b/crates/horizon-world/examples/server_player_damage_fixture.rs @@ -0,0 +1,278 @@ +use horizon_world::{ + attributes::{ + Modifier, Operation, + entity::{Catalog, EntityAttributes}, + }, + combat_rules::ArmorWorld, + damage_reduction::Bypass, + food::FoodData, + living_damage::DamageStat, + player_health::PlayerFloatIds, + server_player_damage::{ServerDamageEnvironment, ServerPlayerDamage}, + synced_floats::{FloatValue, Observer, SyncedFloats}, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, + sync::Arc, +}; +fn single(v: &Value) -> f32 { + f32::from_bits(u32::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn bits(v: f32) -> u32 { + if v.is_nan() { + f32::NAN.to_bits() + } else { + v.to_bits() + } +} +fn values(v: Option<&[FloatValue]>) -> String { + match v { + None => "none".into(), + Some([]) => "empty".into(), + Some(v) => v + .iter() + .map(|v| format!("{}:{:08x}", v.id, bits(v.value))) + .collect::>() + .join(","), + } +} +struct Env<'a> { + out: &'a mut dyn Write, + op: &'a Value, + slots: &'a [Value], + calls: i64, + recorded: f32, +} +impl Env<'_> { + fn event(&mut self, s: &str) -> io::Result<()> { + writeln!(self.out, "{s}")?; + let n = self.calls; + self.calls += 1; + if n == self.op["fail"].as_i64().unwrap() { + Err(io::Error::other("injected damage callback failure")) + } else { + Ok(()) + } + } + fn flag(&self, s: &str) -> bool { + self.op[s].as_bool().unwrap() + } +} +impl Observer for Env<'_> { + type Error = io::Error; + fn updated(&mut self, data: &mut SyncedFloats, id: u8) -> io::Result<()> { + self.event(&format!( + "updated {id} {:08x} {}", + bits(data.get(id).unwrap()), + data.is_dirty() + ))?; + if self.flag("pack_callback") { + writeln!( + self.out, + "callback-pack {}", + values(data.take_dirty().as_deref()) + )?; + } + Ok(()) + } +} +impl ArmorWorld for Env<'_> { + type Error = io::Error; + type Weapon = (); + type ServerLevel = (); + fn weapon(&mut self) -> io::Result> { + self.event("weapon")?; + Ok(self.flag("weapon").then_some(())) + } + fn server_level(&mut self) -> io::Result> { + self.event("level")?; + Ok(Some(())) + } + fn modify_armor_effectiveness(&mut self, _: (), _: (), v: f32) -> io::Result { + Ok(v) + } +} +impl ServerDamageEnvironment for Env<'_> { + type Attacker = (); + fn invulnerable(&mut self) -> io::Result { + self.event("invulnerable")?; + Ok(self.flag("invulnerable")) + } + fn bypasses(&mut self, b: Bypass) -> io::Result { + let n = match b { + Bypass::Armor => "armor", + Bypass::Effects => "effects", + Bypass::Resistance => "resistance", + Bypass::Enchantments => "enchantments", + }; + self.event(&format!("bypass {n}"))?; + Ok(self.flag(&format!("bypass_{n}"))) + } + fn hurt_armor(&mut self, a: &mut EntityAttributes, v: f32) -> io::Result<()> { + self.event(&format!("hurt-armor {:08x}", bits(v)))?; + if self.flag("break_armor") { + let id = a.catalog().id("minecraft:armor").unwrap(); + a.edit(id, |a, o| { + a.set_base_value(number(&self.op["armor_after"]), o) + }) + .unwrap() + .unwrap(); + } + Ok(()) + } + fn has_resistance(&mut self) -> io::Result { + self.event("has-resistance")?; + Ok(self.flag("resistance")) + } + fn resistance_amplifier(&mut self) -> io::Result { + self.event("effect")?; + Ok(self.op["amplifier"].as_i64().unwrap() as i32) + } + fn award_resisted(&mut self, v: i32) -> io::Result<()> { + self.event(&format!("stat resisted {v}")) + } + fn attacker(&mut self) -> io::Result> { + panic!("player damage must not query attacker") + } + fn award_dealt_resisted(&mut self, _: i32) -> io::Result<()> { + panic!("player damage must award own resisted stat") + } + fn damage_protection(&mut self, _: ()) -> io::Result { + for slot in self.slots { + self.event(&format!("slot {}", slot.as_u64().unwrap()))?; + } + Ok(0.0) + } + fn award_self(&mut self, s: DamageStat, v: i32) -> io::Result<()> { + let n = match s { + DamageStat::Absorbed => "absorbed", + DamageStat::Taken => "taken", + DamageStat::DealtAbsorbed => panic!("attacker stat"), + }; + self.event(&format!("stat {n} {v}")) + } + fn award_attacker(&mut self, _: (), _: DamageStat, _: i32) -> io::Result<()> { + panic!("attacker stat") + } + fn source_food_exhaustion(&mut self) -> io::Result { + self.event("food-exhaustion")?; + Ok(single(&self.op["food_exhaustion"])) + } + fn ability_invulnerable(&self) -> bool { + self.flag("ability_invulnerable") + } + fn level_is_client(&mut self) -> io::Result { + self.event("level")?; + self.event("client")?; + Ok(self.flag("client")) + } + fn record_damage(&mut self, v: f32) -> io::Result<()> { + self.event("tracker")?; + self.event(&format!("record {:08x}", bits(v)))?; + self.recorded = v; + Ok(()) + } + fn damage_event(&mut self) -> io::Result<()> { + self.event("damage-event") + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let ids: Value = serde_json::from_str(&fs::read_to_string(dir.join("ids.json"))?)?; + let ids = PlayerFloatIds { + health: ids["health"].as_u64().unwrap() as u8, + absorption: ids["absorption"].as_u64().unwrap() as u8, + }; + let slots: Value = serde_json::from_str(&fs::read_to_string(dir.join("slots.json"))?)?; + let catalog = Arc::new(Catalog::from_json(&serde_json::from_str( + &fs::read_to_string(dir.join("catalog.json"))?, + )?)?); + let keys = [ + "minecraft:armor", + "minecraft:armor_toughness", + "minecraft:max_health", + "minecraft:max_absorption", + ] + .map(|k| catalog.id(k).unwrap()); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut attributes = catalog.create("minecraft:player").unwrap(); + for (i, key) in keys.iter().enumerate() { + let a = &f["attributes"][i]; + let m = Modifier::new( + "horizon:test", + number(&a["amount"]), + Operation::ALL[a["operation"].as_u64().unwrap() as usize], + )?; + attributes + .edit(*key, |a, o| { + a.set_base_value(number(&f["attributes"][i]["base"]), o)?; + a.add_transient(m, o) + }) + .unwrap() + .unwrap(); + } + let mut data = SyncedFloats::new(&[ + FloatValue { + id: ids.health, + value: single(&f["health"]), + }, + FloatValue { + id: ids.absorption, + value: single(&f["absorption"]), + }, + ])?; + let mut food = FoodData { + exhaustion: single(&f["exhaustion"]), + ..FoodData::default() + }; + let mut recorded = 0.0; + for op in f["ops"].as_array().unwrap() { + let mut env = Env { + out: &mut out, + op, + slots: slots.as_array().unwrap(), + calls: 0, + recorded, + }; + let result = + ServerPlayerDamage::new(&mut attributes, &mut data, &mut food, ids, &mut env)? + .apply(single(&op["damage"])); + writeln!( + env.out, + "result {}", + if result.is_ok() { "ok" } else { "error" } + )?; + recorded = env.recorded; + writeln!( + env.out, + "state {:08x} {:08x} {:08x} {:08x} {} {} {} {}", + bits(data.get(ids.health).unwrap()), + bits(data.get(ids.absorption).unwrap()), + bits(food.exhaustion), + bits(recorded), + data.is_dirty(), + data.item_dirty(ids.health).unwrap(), + data.item_dirty(ids.absorption).unwrap(), + env.calls + )?; + if env.flag("pack") { + writeln!(env.out, "packed {}", values(data.take_dirty().as_deref()))?; + } + writeln!( + env.out, + "defaults {}", + values(data.non_default().as_deref()) + )?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index f7be517de..935df7453 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -65,6 +65,7 @@ pub mod registry_collision_scan; pub mod registry_fall_ray; pub mod registry_fluid; pub mod retrogen; +pub mod server_player_damage; pub mod suffocation; pub mod swimming; pub mod synced_floats; diff --git a/crates/horizon-world/src/server_player_damage.rs b/crates/horizon-world/src/server_player_damage.rs new file mode 100644 index 000000000..c4d571059 --- /dev/null +++ b/crates/horizon-world/src/server_player_damage.rs @@ -0,0 +1,278 @@ +//! Compose ordinary server-player inner damage with registered attributes, +//! synchronized health/absorption and stored hunger. Outer hurt gates stay with +//! the caller; equipment, effect, statistic and combat services stay explicit. +use crate::{ + attributes::entity::{AttributeId, EntityAttributes, LookupError}, + combat_rules::ArmorWorld, + compression::invalid, + damage_reduction::{self, Bypass, DamageReductionWorld}, + food::FoodData, + living_damage::{self, DamageStat, DamageWorld}, + player_health::{PlayerAttributeHealth, PlayerFloatIds, PlayerHealthError}, + synced_floats::{DataError, Observer, SyncedFloats}, +}; +use std::{fmt, io}; +type EnvError = ::Error; +#[derive(Debug)] +pub enum ServerDamageError { + Attribute(LookupError), + Data(DataError), + Environment(E), +} +impl fmt::Display for ServerDamageError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::Attribute(e) => write!(f, "damage attribute lookup: {e:?}"), + Self::Data(e) => e.fmt(f), + Self::Environment(e) => e.fmt(f), + } + } +} +impl std::error::Error for ServerDamageError {} +fn health_error(e: PlayerHealthError) -> ServerDamageError { + match e { + PlayerHealthError::Attribute(e) => ServerDamageError::Attribute(e), + PlayerHealthError::Data(e) => ServerDamageError::Data(e), + } +} +pub trait ServerDamageEnvironment: + ArmorWorld + Observer::Error> +{ + type Attacker: Copy; + fn invulnerable(&mut self) -> Result>; + fn bypasses(&mut self, kind: Bypass) -> Result>; + /// Equipment breakage may update the live attribute map before armor and + /// toughness are queried by the rest of this hit. + fn hurt_armor( + &mut self, + attributes: &mut EntityAttributes, + damage: f32, + ) -> Result<(), EnvError>; + fn has_resistance(&mut self) -> Result>; + fn resistance_amplifier(&mut self) -> Result>; + fn award_resisted(&mut self, amount: i32) -> Result<(), EnvError>; + fn attacker(&mut self) -> Result, EnvError>; + fn award_dealt_resisted(&mut self, amount: i32) -> Result<(), EnvError>; + fn damage_protection(&mut self, level: Self::ServerLevel) -> Result>; + fn award_self(&mut self, stat: DamageStat, amount: i32) -> Result<(), EnvError>; + fn award_attacker( + &mut self, + attacker: Self::Attacker, + stat: DamageStat, + amount: i32, + ) -> Result<(), EnvError>; + fn source_food_exhaustion(&mut self) -> Result>; + fn ability_invulnerable(&self) -> bool; + fn level_is_client(&mut self) -> Result>; + fn record_damage(&mut self, amount: f32) -> Result<(), EnvError>; + fn damage_event(&mut self) -> Result<(), EnvError>; +} +pub struct ServerPlayerDamage<'a, E> { + attributes: &'a mut EntityAttributes, + data: &'a mut SyncedFloats, + food: &'a mut FoodData, + ids: PlayerFloatIds, + armor: AttributeId, + toughness: AttributeId, + environment: &'a mut E, +} +impl<'a, E: ServerDamageEnvironment> ServerPlayerDamage<'a, E> { + pub fn new( + attributes: &'a mut EntityAttributes, + data: &'a mut SyncedFloats, + food: &'a mut FoodData, + ids: PlayerFloatIds, + environment: &'a mut E, + ) -> io::Result { + let armor = attributes + .catalog() + .id("minecraft:armor") + .ok_or_else(|| invalid("missing ARMOR definition"))?; + let toughness = attributes + .catalog() + .id("minecraft:armor_toughness") + .ok_or_else(|| invalid("missing ARMOR_TOUGHNESS definition"))?; + PlayerAttributeHealth::new(attributes, data, ids, false, environment)?; + Ok(Self { + attributes, + data, + food, + ids, + armor, + toughness, + environment, + }) + } + fn health_binding(&mut self) -> PlayerAttributeHealth<'_, E> { + PlayerAttributeHealth::new( + self.attributes, + self.data, + self.ids, + false, + self.environment, + ) + .expect("validated immutable player float schema") + } + pub fn apply(&mut self, damage: f32) -> Result<(), ServerDamageError>> { + living_damage::actually_hurt(self, damage, true) + } +} +impl ArmorWorld for ServerPlayerDamage<'_, E> { + type Error = ServerDamageError>; + type Weapon = E::Weapon; + type ServerLevel = E::ServerLevel; + fn weapon(&mut self) -> Result, Self::Error> { + self.environment + .weapon() + .map_err(ServerDamageError::Environment) + } + fn server_level(&mut self) -> Result, Self::Error> { + self.environment + .server_level() + .map_err(ServerDamageError::Environment) + } + fn modify_armor_effectiveness( + &mut self, + l: Self::ServerLevel, + w: Self::Weapon, + v: f32, + ) -> Result { + self.environment + .modify_armor_effectiveness(l, w, v) + .map_err(ServerDamageError::Environment) + } +} +impl DamageReductionWorld for ServerPlayerDamage<'_, E> { + fn bypasses(&mut self, b: Bypass) -> Result { + self.environment + .bypasses(b) + .map_err(ServerDamageError::Environment) + } + fn hurt_armor(&mut self, v: f32) -> Result<(), Self::Error> { + self.environment + .hurt_armor(self.attributes, v) + .map_err(ServerDamageError::Environment) + } + fn armor_value(&mut self) -> Result { + self.attributes + .value(self.armor) + .map(damage_reduction::armor_from_attribute) + .map_err(ServerDamageError::Attribute) + } + fn toughness_attribute(&mut self) -> Result { + self.attributes + .value(self.toughness) + .map_err(ServerDamageError::Attribute) + } + fn has_resistance(&mut self) -> Result { + self.environment + .has_resistance() + .map_err(ServerDamageError::Environment) + } + fn resistance_amplifier(&mut self) -> Result { + self.environment + .resistance_amplifier() + .map_err(ServerDamageError::Environment) + } + fn victim_is_server_player(&self) -> bool { + true + } + fn award_resisted(&mut self, v: i32) -> Result<(), Self::Error> { + self.environment + .award_resisted(v) + .map_err(ServerDamageError::Environment) + } + fn attacker_is_server_player(&mut self) -> Result { + self.environment + .attacker() + .map(|v| v.is_some()) + .map_err(ServerDamageError::Environment) + } + fn award_dealt_resisted(&mut self, v: i32) -> Result<(), Self::Error> { + self.environment + .award_dealt_resisted(v) + .map_err(ServerDamageError::Environment) + } + fn damage_protection(&mut self, l: Self::ServerLevel) -> Result { + self.environment + .damage_protection(l) + .map_err(ServerDamageError::Environment) + } +} +impl DamageWorld for ServerPlayerDamage<'_, E> { + type Error = ServerDamageError>; + type Attacker = E::Attacker; + fn invulnerable(&mut self) -> Result { + self.environment + .invulnerable() + .map_err(ServerDamageError::Environment) + } + fn after_armor(&mut self, v: f32) -> Result { + damage_reduction::after_armor(self, v) + } + fn after_magic(&mut self, v: f32) -> Result { + damage_reduction::after_magic(self, v) + } + fn absorption(&mut self) -> Result { + self.health_binding().absorption().map_err(health_error) + } + fn set_absorption(&mut self, v: f32) -> Result<(), Self::Error> { + self.health_binding() + .set_absorption(v) + .map_err(health_error) + } + fn server_player_attacker(&mut self) -> Result, Self::Error> { + self.environment + .attacker() + .map_err(ServerDamageError::Environment) + } + fn award_attacker( + &mut self, + a: Self::Attacker, + s: DamageStat, + v: i32, + ) -> Result<(), Self::Error> { + self.environment + .award_attacker(a, s, v) + .map_err(ServerDamageError::Environment) + } + fn award_self(&mut self, s: DamageStat, v: i32) -> Result<(), Self::Error> { + self.environment + .award_self(s, v) + .map_err(ServerDamageError::Environment) + } + fn source_food_exhaustion(&mut self) -> Result { + self.environment + .source_food_exhaustion() + .map_err(ServerDamageError::Environment) + } + fn cause_food_exhaustion(&mut self, v: f32) -> Result<(), Self::Error> { + if !self.environment.ability_invulnerable() + && !self + .environment + .level_is_client() + .map_err(ServerDamageError::Environment)? + { + self.food.add_exhaustion(v); + } + Ok(()) + } + fn record_damage(&mut self, v: f32) -> Result<(), Self::Error> { + self.environment + .record_damage(v) + .map_err(ServerDamageError::Environment) + } + fn health(&mut self) -> Result { + self.data + .get(self.ids.health) + .map_err(|id| ServerDamageError::Data(DataError::UnknownId(id))) + } + fn set_health(&mut self, v: f32) -> Result<(), Self::Error> { + self.health_binding().set_health(v).map_err(health_error) + } + fn damage_event(&mut self) -> Result<(), Self::Error> { + self.environment + .damage_event() + .map_err(ServerDamageError::Environment) + } +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 06428eee8..2d6ea1e87 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1315,3 +1315,20 @@ absorption reads/writes, combined dirty/default lists, received assignments, callback packet drains and failures. Targeted Clippy passes. Observer effects are controlled; custom virtual data replacement, other synchronized serializers, wire codecs and full player damage/tick integration remain pending. + + +`server_player_damage` composes ordinary server-player inner damage with +registered armor/toughness and health/absorption limits, shared synchronized +float storage and stored hunger. Armor break callbacks may change attributes +before the hit queries armor; received damage uses the actual reduction and +health modules, and player exhaustion retains its ability/client guards. + +`python3 tools/test_server_player_damage_parity.py` compares the native Player +inner damage method on ServerPlayer receivers, using actual native reduction, +registered modified attributes, synchronized data and FoodData. The +[server-player damage report](../benchmarks/rust-server-player-damage-2026-10-07/scoped-parity.json) +records **373,455 matching lines per JAR**, covering repeated hits, bypass flags, +resistance, numeric edges, armor attribute mutation, dirty packet drains and +callback failures. Targeted Clippy passes. Empty equipment and controlled +source/effect, durability, combat/stat/event services bound this scope; outer +hurt gates, enchanted equipment and the complete player lifecycle remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaServerPlayerDamageOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaServerPlayerDamageOracle.java new file mode 100644 index 000000000..69605efd6 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaServerPlayerDamageOracle.java @@ -0,0 +1,51 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.lang.reflect.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.*;import net.minecraft.core.registries.*;import net.minecraft.resources.Identifier;import net.minecraft.tags.*;import net.minecraft.world.entity.*;import net.minecraft.world.entity.player.*;import net.minecraft.world.entity.ai.attributes.*;import net.minecraft.network.syncher.*;import net.minecraft.world.damagesource.*;import net.minecraft.world.effect.*;import net.minecraft.world.item.ItemStack;import net.minecraft.world.food.FoodData;import net.minecraft.server.level.*;import net.minecraft.stats.Stats;import net.minecraft.world.level.gameevent.GameEvent; +/** Native player inner damage with actual attributes, synchronized floats and food storage. */ +public final class VanillaServerPlayerDamageOracle { + static final class Stop extends RuntimeException {} + static Object unsafe;static Method allocate;static EntityDataAccessor healthKey,absorptionKey;static Field amplifier; + static T make(Class c)throws Exception{return c.cast(allocate.invoke(unsafe,c));} + static Field field(Class c,String n)throws Exception{var f=c.getDeclaredField(n);f.setAccessible(true);return f;} + static float single(JsonElement v){return Float.intBitsToFloat(Integer.parseUnsignedInt(v.getAsString(),16));} + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + static String bits(float v){return String.format("%08x",Float.floatToIntBits(v));} + static String values(List> values){if(values==null)return "none";var s=new StringJoiner(",");for(var v:values)s.add(v.id()+":"+bits((Float)v.value()));return s.length()==0?"empty":s.toString();} + static final class Data {JsonObject op;PrintWriter out;int calls;float recorded;AttributeMap attributes;SynchedEntityData data;Server level;Tracker tracker; + void event(String s){out.println(s);if(calls++==op.get("fail").getAsInt())throw new Stop();}} + static final class Source extends DamageSource {Data d;Source(){super(null);} + @Override public boolean is(TagKey tag){String n=tag==DamageTypeTags.BYPASSES_ARMOR?"armor":tag==DamageTypeTags.BYPASSES_EFFECTS?"effects":tag==DamageTypeTags.BYPASSES_RESISTANCE?"resistance":tag==DamageTypeTags.BYPASSES_ENCHANTMENTS?"enchantments":null;if(n==null)throw new AssertionError();d.event("bypass "+n);return d.op.get("bypass_"+n).getAsBoolean();} + @Override public ItemStack getWeaponItem(){d.event("weapon");return d.op.get("weapon").getAsBoolean()?ItemStack.EMPTY:null;} + @Override public float getFoodExhaustion(){d.event("food-exhaustion");return single(d.op.get("food_exhaustion"));}} + static final class Server extends ServerLevel {Data d;Server(){super(null,null,null,null,null,null,false,0L,List.of(),false);}@Override public boolean isClientSide(){d.event("client");return d.op.get("client").getAsBoolean();}} + static final class Tracker extends CombatTracker {Data d;Tracker(){super(null);}@Override public void recordDamage(DamageSource s,float v){d.event("record "+bits(v));d.recorded=v;}} + static final class Actor extends ServerPlayer {Data d;Actor(){super(null,null,null,null);} + @Override public boolean isInvulnerableTo(ServerLevel l,DamageSource s){d.event("invulnerable");return d.op.get("invulnerable").getAsBoolean();} + @Override public double getAttributeValue(Holder a){return d.attributes.getValue(a);} + @Override protected void hurtArmor(DamageSource s,float v){d.event("hurt-armor "+bits(v));if(d.op.get("break_armor").getAsBoolean())d.attributes.getInstance(Attributes.ARMOR).setBaseValue(number(d.op.get("armor_after")));} + @Override public boolean hasEffect(Holder e){if(e!=MobEffects.RESISTANCE)throw new AssertionError();d.event("has-resistance");return d.op.get("resistance").getAsBoolean();} + @Override public MobEffectInstance getEffect(Holder e){if(e!=MobEffects.RESISTANCE)throw new AssertionError();d.event("effect");var v=new MobEffectInstance(e,100,0);try{amplifier.setInt(v,d.op.get("amplifier").getAsInt());}catch(Exception ex){throw new AssertionError(ex);}return v;} + @Override public ServerLevel level(){d.event("level");return d.level;} + @Override public ItemStack getItemBySlot(EquipmentSlot s){d.event("slot "+s.ordinal());return ItemStack.EMPTY;} + @Override public CombatTracker getCombatTracker(){d.event("tracker");return d.tracker;} + @Override public void gameEvent(Holder e){if(e!=GameEvent.ENTITY_DAMAGE)throw new AssertionError();d.event("damage-event");} + @Override public void awardStat(Identifier s,int v){String n=s==Stats.DAMAGE_RESISTED?"resisted":s==Stats.DAMAGE_ABSORBED?"absorbed":s==Stats.DAMAGE_TAKEN?"taken":null;if(n==null)throw new AssertionError();d.event("stat "+n+" "+v);} + @Override public void onSyncedDataUpdated(EntityDataAccessor a){var k=a.id()==healthKey.id()?healthKey:absorptionKey;d.event("updated "+k.id()+" "+bits(d.data.get(k))+" "+d.data.isDirty());if(d.op.get("pack_callback").getAsBoolean())d.out.println("callback-pack "+values(d.data.packDirty()));} + void run(DamageSource s,float v){super.actuallyHurt(d.level,s,v);} + } + @SuppressWarnings("unchecked") public static void main(String[] args)throws Exception{ + Path dir=Path.of(args[1]);if(args[0].equals("export"))VanillaPlayerHealthOracle.main(args);else{net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();} + healthKey=(EntityDataAccessor)field(LivingEntity.class,"DATA_HEALTH_ID").get(null);absorptionKey=(EntityDataAccessor)field(Player.class,"DATA_PLAYER_ABSORPTION_ID").get(null); + if(args[0].equals("export")){var slots=new JsonArray();for(var s:EquipmentSlot.VALUES)slots.add(s.ordinal());Files.writeString(dir.resolve("slots.json"),slots.toString());return;} + var u=Class.forName("sun.misc.Unsafe");unsafe=field(u,"theUnsafe").get(null);allocate=u.getMethod("allocateInstance",Class.class);amplifier=field(MobEffectInstance.class,"amplifier");var ctor=SynchedEntityData.class.getDeclaredConstructor(SyncedDataHolder.class,SynchedEntityData.DataItem[].class);ctor.setAccessible(true);var storage=field(Entity.class,"entityData");var foodField=field(Player.class,"foodData");var abilityField=field(Player.class,"abilities");var exhaustion=field(FoodData.class,"exhaustionLevel");var keys=List.of(Attributes.ARMOR,Attributes.ARMOR_TOUGHNESS,Attributes.MAX_HEALTH,Attributes.MAX_ABSORPTION); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();var d=new Data();d.out=out;d.attributes=new AttributeMap(VanillaEntityAttributeOracle.supplier(BuiltInRegistries.ENTITY_TYPE.getValue(Identifier.parse("minecraft:player")))); + for(int i=0;i[Math.max(healthKey.id(),absorptionKey.id())+1];for(int i=0;i(new EntityDataAccessor(i,EntityDataSerializers.FLOAT),0f);var health=new SynchedEntityData.DataItem(healthKey,single(f.get("health")));var absorption=new SynchedEntityData.DataItem(absorptionKey,single(f.get("absorption")));items[healthKey.id()]=health;items[absorptionKey.id()]=absorption;d.data=ctor.newInstance(actor,items);storage.set(actor,d.data); + for(var ov:f.getAsJsonArray("ops")){d.op=ov.getAsJsonObject();d.calls=0;abilities.invulnerable=d.op.get("ability_invulnerable").getAsBoolean();try{actor.run(source,single(d.op.get("damage")));out.println("result ok");}catch(Stop e){out.println("result error");} + out.println("state "+bits(health.getValue())+" "+bits(absorption.getValue())+" "+bits(exhaustion.getFloat(food))+" "+bits(d.recorded)+" "+d.data.isDirty()+" "+health.isDirty()+" "+absorption.isDirty()+" "+d.calls); + if(d.op.get("pack").getAsBoolean())out.println("packed "+values(d.data.packDirty()));out.println("defaults "+values(d.data.getNonDefaultValues())); + } + }} + } +} diff --git a/tools/test_server_player_damage_parity.py b/tools/test_server_player_damage_parity.py new file mode 100644 index 000000000..240c68323 --- /dev/null +++ b/tools/test_server_player_damage_parity.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python3 +"""Compare registered server player damage and synchronized absorption with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(catalog): + def bits(v):return struct.pack('>f',v).hex() + def double(v):return struct.pack('>d',v).hex() + def op(damage=8,**kw): + o=dict(damage=bits(damage),fail=-1,invulnerable=False,ability_invulnerable=False,client=False,weapon=False,resistance=False,amplifier=0,break_armor=False,armor_after=double(0),food_exhaustion=bits(.1),pack=False,pack_callback=False,**{'bypass_'+k:False for k in ['armor','effects','resistance','enchantments']});o.update(kw);return o + def row(ops,health=20,absorption=4,armor=15,toughness=8,maximum=20,max_absorption=20,exhaustion=0,amounts=None,operations=None): + return dict(health=bits(health),absorption=bits(absorption),exhaustion=bits(exhaustion),attributes=[dict(base=double(v),amount=double((amounts or [0]*4)[i]),operation=(operations or [0]*4)[i]) for i,v in enumerate([armor,toughness,maximum,max_absorption])],ops=ops) + values=[-float('inf'),-1e30,-1,-0.,0.,1e-40,.1,1,5,10,20,1e30,float('inf'),float('nan')] + for damage in values: + for absorption in values: + for armor in [-1,0,1,15,30,100,float('nan')]: + yield row([op(damage),op(damage,weapon=True,pack=True),op(damage,resistance=True)],absorption=absorption,armor=armor) + for mask in range(16): + for amp in [-2147483648,-2,-1,0,1,4,5,2147483647]: + for fail in range(-1,28): + yield row([op(19,amplifier=amp,resistance=True,fail=fail,break_armor=True,pack_callback=True,**{'bypass_'+k:bool(mask&(1< Date: Wed, 7 Oct 2026 05:24:37 +0200 Subject: [PATCH 117/253] Implement living hurt cooldown and outer damage dispatch --- .../scoped-parity.json | 254 ++++++++++++++++++ .../examples/living_hurt_fixture.rs | 249 +++++++++++++++++ crates/horizon-world/src/lib.rs | 1 + crates/horizon-world/src/living_hurt.rs | 201 ++++++++++++++ docs/collision-geometry.md | 19 ++ .../parity/VanillaLivingHurtOracle.java | 86 ++++++ tools/test_living_hurt_parity.py | 77 ++++++ 7 files changed, 887 insertions(+) create mode 100644 benchmarks/rust-living-hurt-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/living_hurt_fixture.rs create mode 100644 crates/horizon-world/src/living_hurt.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingHurtOracle.java create mode 100644 tools/test_living_hurt_parity.py diff --git a/benchmarks/rust-living-hurt-2026-10-07/scoped-parity.json b/benchmarks/rust-living-hurt-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..78aed88c3 --- /dev/null +++ b/benchmarks/rust-living-hurt-2026-10-07/scoped-parity.json @@ -0,0 +1,254 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 5584, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingHurtOracle.java": "b5173b07be60991c6ed9cf75a1056f117459207c57411c00a0cee14fea8a51bf", + "tools/test_living_hurt_parity.py": "2e9770f9e4653feada6a758a40eeaea89f370394106f55199a9541c8c867cec3", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "3caead29ea3c4ce5da28a58f0e9071cbc5e163735bf7039adc8a698a34e6f4fd", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "711e78438ece3e94eb156c0e64cfea06a63f79640a7a81e396ae2c1b277cdce6", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_hurt.rs": "844239ad7d15c39629bb3cfc06ebae6d1cff20b7627468f26e0ee8dff3abdcb8", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/server_player_damage.rs": "c4fc29eecf2bf401680d1754bef06797a5e4608ab53c5b52e0dd4996f859dbfe", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "f417aab280331ddd6f0ca265a12c0130c78b9924f407c7e07f198140501e6010", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/living_hurt_fixture.rs": "63ecc1532d32c227855605b9be399bb1c3fc1b3c9d59b2b49a4b2d30955043e0" + }, + "fixtures_sha256": { + ".local/rust-living-hurt-parity/inputs.txt": "70ab2e85a6c2a52e042896873de6e64b51581a9455a5175dcbb1d942d08038c1" + }, + "rust_output_sha256": "0ae19c20fc44ab04a061113a9f45d1f25843f092539f935e49e36d2d366f9921", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "0ae19c20fc44ab04a061113a9f45d1f25843f092539f935e49e36d2d366f9921", + "matched_output_lines": 441413 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "0ae19c20fc44ab04a061113a9f45d1f25843f092539f935e49e36d2d366f9921", + "matched_output_lines": 441413 + } + ], + "scope": "Actual LivingEntity.hurtServer invoked directly on base and ServerPlayer receivers. Controlled blocking, inner damage, sounds, knockback, death, attribution and effect callbacks; native empty death-protection lookup and empty-listener victim criterion. Compares field write ordering, cooldown thresholds, float sanitization, modifiers, repeated hits and injected callback failure. Successful totems, attacker-player criteria, actual blocking reduction, combat/death services and full player outer gates remain pending." +} diff --git a/crates/horizon-world/examples/living_hurt_fixture.rs b/crates/horizon-world/examples/living_hurt_fixture.rs new file mode 100644 index 000000000..e9addb406 --- /dev/null +++ b/crates/horizon-world/examples/living_hurt_fixture.rs @@ -0,0 +1,249 @@ +use horizon_world::living_hurt::{HurtState, HurtTag, HurtWorld, hurt_server}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn single(v: &Value) -> f32 { + f32::from_bits(u32::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn bits(v: f32) -> u32 { + if v.is_nan() { + f32::NAN.to_bits() + } else { + v.to_bits() + } +} +fn state(s: &HurtState<()>) -> String { + format!( + "{} {} {:08x} {} {} {} {}", + s.no_action_time, + s.cooldown, + bits(s.last_hurt), + s.hurt_duration, + s.hurt_time, + s.last_source.is_some(), + s.last_stamp + ) +} +struct Env<'a> { + out: &'a mut dyn Write, + op: &'a Value, + calls: i64, + hit: bool, + recorded: f32, + player: bool, +} +impl Env<'_> { + fn flag(&self, n: &str) -> bool { + self.op[n].as_bool().unwrap() + } + fn event(&mut self, s: &str) -> io::Result<()> { + writeln!(self.out, "{s}")?; + let n = self.calls; + self.calls += 1; + if n == self.op["fail"].as_i64().unwrap() { + Err(io::Error::other("injected hurt callback failure")) + } else { + Ok(()) + } + } +} +impl HurtWorld for Env<'_> { + type Error = io::Error; + type Source = (); + type UseItem = bool; + type Blocking = (); + type Sound = (); + fn source(&self) {} + fn is_server_player(&self) -> bool { + self.player + } + fn invulnerable(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("invulnerable")?; + Ok(self.flag("invulnerable")) + } + fn fire_resistance(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("fire-resistance")?; + Ok(self.flag("fire_resistance")) + } + fn sleeping(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("sleeping")?; + Ok(self.flag("sleeping")) + } + fn freeze_hurts_extra(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("freeze-extra")?; + Ok(self.flag("freeze_extra")) + } + fn stop_sleeping(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("wake") + } + fn resolve_mob(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("resolve-mob") + } + fn resolve_player(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("resolve-player") + } + fn broadcast_damage(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("broadcast") + } + fn mark_hurt(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("mark") + } + fn secondary_sound(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("thorns") + } + fn die(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("die") + } + fn hurt_sound(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("hurt-sound") + } + + fn dead_or_dying(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("dead")?; + Ok(self.flag(if self.hit { + "dead_after" + } else { + "dead_before" + })) + } + fn tag(&mut self, _: &mut HurtState<()>, tag: HurtTag) -> io::Result { + let n = match tag { + HurtTag::Fire => "fire", + HurtTag::Freezing => "freezing", + HurtTag::DamagesHelmet => "damages_helmet", + HurtTag::BypassesCooldown => "bypasses_cooldown", + HurtTag::NoImpact => "no_impact", + HurtTag::NoKnockback => "no_knockback", + }; + self.event(&format!("tag {n}"))?; + Ok(self.flag(n)) + } + fn use_item(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("use-item")?; + Ok(self.flag("component")) + } + fn apply_blocking(&mut self, _: &mut HurtState<()>, v: f32) -> io::Result { + self.event(&format!("blocking {:08x}", bits(v)))?; + Ok(single(&self.op["blocked"])) + } + fn helmet_empty(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("helmet")?; + Ok(!self.flag("helmet")) + } + fn hurt_helmet(&mut self, _: &mut HurtState<()>, v: f32) -> io::Result<()> { + self.event(&format!("hurt-helmet {:08x}", bits(v))) + } + fn actually_hurt(&mut self, s: &mut HurtState<()>, v: f32) -> io::Result<()> { + self.event(&format!("hurt {:08x} {}", bits(v), state(s)))?; + self.hit = true; + self.recorded = v; + if self.flag("mutate_hit") { + s.cooldown = self.op["hit_cooldown"].as_i64().unwrap() as i32; + s.last_hurt = single(&self.op["hit_last"]); + s.hurt_duration = self.op["hit_duration"].as_i64().unwrap() as i32; + s.hurt_time = self.op["hit_time"].as_i64().unwrap() as i32; + } + Ok(()) + } + fn blocking_component(&mut self, v: bool) -> Option<()> { + v.then_some(()) + } + fn on_blocked(&mut self, _: &mut HurtState<()>, _: ()) -> io::Result<()> { + Ok(()) + } + fn knockback(&mut self, _: &mut HurtState<()>, v: f32, b: bool) -> io::Result<()> { + self.event(&format!("knockback {:08x} {b}", bits(v))) + } + fn death_protection(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("tag bypasses_invulnerability")?; + if !self.flag("bypasses_invulnerability") { + self.event("hand 0")?; + self.event("hand 1")?; + } + Ok(false) + } + fn death_sound(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("death-sound") + } + fn make_sound(&mut self, _: &mut HurtState<()>, _: ()) -> io::Result<()> { + self.event("make-sound") + } + fn game_time(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("level")?; + self.event("game-time")?; + Ok(self.op["game_time"].as_i64().unwrap()) + } + fn effects_on_hurt(&mut self, _: &mut HurtState<()>, v: f32) -> io::Result<()> { + self.event("effects")?; + for i in 0..self.op["effects"].as_u64().unwrap() { + self.event(&format!("effect {i} {:08x}", bits(v)))?; + } + Ok(()) + } + fn player_hurt_criterion( + &mut self, + _: &mut HurtState<()>, + _: f32, + _: f32, + _: bool, + ) -> io::Result<()> { + self.event("criterion") + } + fn award_blocked(&mut self, _: &mut HurtState<()>, v: i32) -> io::Result<()> { + self.event(&format!("blocked-stat {v}")) + } + fn attacker_criterion( + &mut self, + _: &mut HurtState<()>, + _: f32, + _: f32, + _: bool, + ) -> io::Result<()> { + self.event("attacker") + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut s = HurtState { + no_action_time: f["no_action"].as_i64().unwrap() as i32, + cooldown: f["cooldown"].as_i64().unwrap() as i32, + last_hurt: single(&f["last_hurt"]), + hurt_duration: f["duration"].as_i64().unwrap() as i32, + hurt_time: f["time"].as_i64().unwrap() as i32, + last_source: f["source"].as_bool().unwrap().then_some(()), + last_stamp: f["stamp"].as_i64().unwrap(), + }; + let mut recorded = 0.0; + for op in f["ops"].as_array().unwrap() { + let mut e = Env { + out: &mut out, + op, + calls: 0, + hit: false, + recorded, + player: f["player"].as_bool().unwrap(), + }; + match hurt_server(&mut s, &mut e, single(&op["damage"])) { + Ok(v) => writeln!(e.out, "bool {v}\nresult ok")?, + Err(_) => writeln!(e.out, "result error")?, + }; + recorded = e.recorded; + writeln!( + e.out, + "state {} {:08x} {} {}", + state(&s), + bits(recorded), + e.hit, + e.calls + )?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 935df7453..42418a8dc 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -46,6 +46,7 @@ pub mod living_damage; pub mod living_fall; pub mod living_fluid; pub mod living_health; +pub mod living_hurt; pub mod living_landing; pub mod living_motion; pub mod movement_emission; diff --git a/crates/horizon-world/src/living_hurt.rs b/crates/horizon-world/src/living_hurt.rs new file mode 100644 index 000000000..8dfc5ba69 --- /dev/null +++ b/crates/horizon-world/src/living_hurt.rs @@ -0,0 +1,201 @@ +//! Outer living damage dispatch, cooldown writes and post-hit service ordering. +use crate::living_damage::{STAT_LIMIT, stat_amount}; +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum HurtTag { + Fire, + Freezing, + DamagesHelmet, + BypassesCooldown, + NoImpact, + NoKnockback, +} +#[derive(Clone, Debug)] +pub struct HurtState { + pub no_action_time: i32, + pub cooldown: i32, + pub last_hurt: f32, + pub hurt_duration: i32, + pub hurt_time: i32, + pub last_source: Option, + pub last_stamp: i64, +} +/// One invocation retains the same incoming source and server level. Services +/// receive live state so reentrant callbacks preserve native write ordering. +pub trait HurtWorld { + type Error; + type Source: Copy; + type UseItem: Copy; + type Blocking: Copy; + type Sound: Copy; + fn source(&self) -> Self::Source; + fn is_server_player(&self) -> bool; + fn invulnerable(&mut self, s: &mut HurtState) -> Result; + fn dead_or_dying(&mut self, s: &mut HurtState) -> Result; + fn tag(&mut self, s: &mut HurtState, tag: HurtTag) -> Result; + fn fire_resistance(&mut self, s: &mut HurtState) -> Result; + fn sleeping(&mut self, s: &mut HurtState) -> Result; + fn stop_sleeping(&mut self, s: &mut HurtState) -> Result<(), Self::Error>; + fn use_item(&mut self, s: &mut HurtState) -> Result; + fn apply_blocking( + &mut self, + s: &mut HurtState, + damage: f32, + ) -> Result; + fn freeze_hurts_extra(&mut self, s: &mut HurtState) -> Result; + fn helmet_empty(&mut self, s: &mut HurtState) -> Result; + fn hurt_helmet( + &mut self, + s: &mut HurtState, + damage: f32, + ) -> Result<(), Self::Error>; + fn actually_hurt( + &mut self, + s: &mut HurtState, + damage: f32, + ) -> Result<(), Self::Error>; + fn resolve_mob(&mut self, s: &mut HurtState) -> Result<(), Self::Error>; + fn resolve_player(&mut self, s: &mut HurtState) -> Result<(), Self::Error>; + fn blocking_component(&mut self, item: Self::UseItem) -> Option; + fn on_blocked( + &mut self, + s: &mut HurtState, + block: Self::Blocking, + ) -> Result<(), Self::Error>; + fn broadcast_damage(&mut self, s: &mut HurtState) -> Result<(), Self::Error>; + fn mark_hurt(&mut self, s: &mut HurtState) -> Result<(), Self::Error>; + fn knockback( + &mut self, + s: &mut HurtState, + damage: f32, + blocked: bool, + ) -> Result<(), Self::Error>; + fn death_protection(&mut self, s: &mut HurtState) -> Result; + fn death_sound(&mut self, s: &mut HurtState) -> Result; + fn make_sound( + &mut self, + s: &mut HurtState, + sound: Self::Sound, + ) -> Result<(), Self::Error>; + fn secondary_sound(&mut self, s: &mut HurtState) -> Result<(), Self::Error>; + fn die(&mut self, s: &mut HurtState) -> Result<(), Self::Error>; + fn hurt_sound(&mut self, s: &mut HurtState) -> Result<(), Self::Error>; + fn game_time(&mut self, s: &mut HurtState) -> Result; + fn effects_on_hurt( + &mut self, + s: &mut HurtState, + damage: f32, + ) -> Result<(), Self::Error>; + fn player_hurt_criterion( + &mut self, + s: &mut HurtState, + original: f32, + damage: f32, + blocked: bool, + ) -> Result<(), Self::Error>; + fn award_blocked( + &mut self, + s: &mut HurtState, + amount: i32, + ) -> Result<(), Self::Error>; + /// Looks up the attacker, then dispatches its criterion if a server player. + fn attacker_criterion( + &mut self, + s: &mut HurtState, + original: f32, + damage: f32, + blocked: bool, + ) -> Result<(), Self::Error>; +} +pub fn hurt_server( + s: &mut HurtState, + w: &mut W, + mut damage: f32, +) -> Result { + if w.invulnerable(s)? || w.dead_or_dying(s)? { + return Ok(false); + } + if w.tag(s, HurtTag::Fire)? && w.fire_resistance(s)? { + return Ok(false); + } + if w.sleeping(s)? { + w.stop_sleeping(s)?; + } + s.no_action_time = 0; + if damage < 0.0 { + damage = 0.0; + } + let original = damage; + let item = w.use_item(s)?; + let blocked_amount = w.apply_blocking(s, damage)?; + damage -= blocked_amount; + let blocked = blocked_amount > 0.0; + if w.tag(s, HurtTag::Freezing)? && w.freeze_hurts_extra(s)? { + damage *= 5.0; + } + if w.tag(s, HurtTag::DamagesHelmet)? && !w.helmet_empty(s)? { + w.hurt_helmet(s, damage)?; + damage *= 0.75; + } + if !damage.is_finite() { + damage = f32::MAX; + } + let fresh = if s.cooldown as f32 > 10.0 && !w.tag(s, HurtTag::BypassesCooldown)? { + if damage <= s.last_hurt { + return Ok(false); + } + w.actually_hurt(s, damage - s.last_hurt)?; + s.last_hurt = damage; + false + } else { + s.last_hurt = damage; + s.cooldown = 20; + w.actually_hurt(s, damage)?; + s.hurt_duration = 10; + s.hurt_time = s.hurt_duration; + true + }; + w.resolve_mob(s)?; + w.resolve_player(s)?; + if fresh { + let component = w.blocking_component(item); + if let Some(component) = component.filter(|_| blocked) { + w.on_blocked(s, component)?; + } else { + w.broadcast_damage(s)?; + } + if !w.tag(s, HurtTag::NoImpact)? && (!blocked || damage > 0.0) { + w.mark_hurt(s)?; + } + let fully_blocked = blocked && damage <= 0.0; + if !w.tag(s, HurtTag::NoKnockback)? && !fully_blocked { + w.knockback(s, damage, blocked)?; + } + } + if w.dead_or_dying(s)? { + if !w.death_protection(s)? { + if fresh { + let sound = w.death_sound(s)?; + w.make_sound(s, sound)?; + w.secondary_sound(s)?; + } + w.die(s)?; + } + } else if fresh { + w.hurt_sound(s)?; + w.secondary_sound(s)?; + } + let accepted = !blocked || damage > 0.0; + if accepted { + s.last_source = Some(w.source()); + s.last_stamp = w.game_time(s)?; + w.effects_on_hurt(s, damage)?; + } + if w.is_server_player() { + w.player_hurt_criterion(s, original, damage, blocked)?; + if blocked_amount > 0.0 && blocked_amount < STAT_LIMIT { + w.award_blocked(s, stat_amount(blocked_amount))?; + } + } + w.attacker_criterion(s, original, damage, blocked)?; + Ok(accepted) +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 2d6ea1e87..01ff4ba9c 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1332,3 +1332,22 @@ resistance, numeric edges, armor attribute mutation, dirty packet drains and callback failures. Targeted Clippy passes. Empty equipment and controlled source/effect, durability, combat/stat/event services bound this scope; outer hurt gates, enchanted equipment and the complete player lifecycle remain pending. + + +`living_hurt` implements the outer living hurt sequence: early rejection, +blocking/freezing/helmet dispatch, non-finite damage sanitization, repeated-hit +cooldowns, hurt-animation writes, attribution, impact/knockback, death/sound +branches, last-source timestamps, effect notifications and criterion dispatch. +Services receive live hurt state, including the distinct field writes before and +after the inner hit in fresh-hit and cooldown-difference branches. + +`python3 tools/test_living_hurt_parity.py` invokes the native LivingEntity method +directly on base and ServerPlayer receivers. The +[living hurt report](../benchmarks/rust-living-hurt-2026-10-07/scoped-parity.json) +records **441,413 matching lines per JAR**, including numeric edges, repeated +hits, callback mutations/failures, empty-hand death-protection lookup, native +soundless blocking components and victim criteria with no listeners. Targeted +Clippy passes. Inner damage, blocking amounts, sounds, knockback, death and +attribution/effect services are controlled. Successful totems, attacker-player +criteria, actual blocking reduction, full service bindings and player-specific +outer gates remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingHurtOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingHurtOracle.java new file mode 100644 index 000000000..0b43ba05b --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingHurtOracle.java @@ -0,0 +1,86 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.lang.reflect.*;import java.lang.invoke.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.*;import net.minecraft.core.component.*;import net.minecraft.core.registries.*;import net.minecraft.resources.*;import net.minecraft.tags.*;import net.minecraft.world.InteractionHand;import net.minecraft.world.entity.*;import net.minecraft.world.entity.player.*;import net.minecraft.world.damagesource.*;import net.minecraft.world.effect.*;import net.minecraft.world.item.*;import net.minecraft.world.item.component.*;import net.minecraft.server.level.*;import net.minecraft.server.PlayerAdvancements;import net.minecraft.sounds.*;import net.minecraft.stats.Stats; +/** Invoke the actual LivingEntity outer hurt method, retaining virtual service hooks. */ +public final class VanillaLivingHurtOracle { + static final class Stop extends RuntimeException {} + static Object unsafe;static Method allocate;static ItemStack plain,shield;static Field stamp,lastSource,noAction,cooldown,lastHurt,duration,time; + static T make(Class c)throws Exception{return c.cast(allocate.invoke(unsafe,c));} + static Field field(Class c,String n)throws Exception{var f=c.getDeclaredField(n);f.setAccessible(true);return f;} + static float single(JsonElement v){return Float.intBitsToFloat(Integer.parseUnsignedInt(v.getAsString(),16));} + static String bits(float v){return String.format("%08x",Float.floatToIntBits(v));} + static String state(LivingEntity a){try{return noAction.getInt(a)+" "+cooldown.getInt(a)+" "+bits(lastHurt.getFloat(a))+" "+duration.getInt(a)+" "+time.getInt(a)+" "+(lastSource.get(a)!=null)+" "+stamp.getLong(a);}catch(Exception e){throw new AssertionError(e);}} + static final class Data {JsonObject op;PrintWriter out;int calls;boolean hit;float recorded;Server level;PlayerAdvancements advancements;List effects; + boolean flag(String n){return op.get(n).getAsBoolean();}void event(String s){out.println(s);if(calls++==op.get("fail").getAsInt())throw new Stop();}} + static final class Source extends DamageSource {Data d;Source(){super(null);} + @Override public boolean is(TagKey tag){String n=tag==DamageTypeTags.IS_FIRE?"fire":tag==DamageTypeTags.IS_FREEZING?"freezing":tag==DamageTypeTags.DAMAGES_HELMET?"damages_helmet":tag==DamageTypeTags.BYPASSES_COOLDOWN?"bypasses_cooldown":tag==DamageTypeTags.NO_IMPACT?"no_impact":tag==DamageTypeTags.NO_KNOCKBACK?"no_knockback":tag==DamageTypeTags.BYPASSES_INVULNERABILITY?"bypasses_invulnerability":null;if(n==null)throw new AssertionError();d.event("tag "+n);return d.flag(n);} + @Override public boolean is(ResourceKey k){if(k!=DamageTypes.THORNS)throw new AssertionError();d.event("thorns");return false;} + @Override public Entity getEntity(){d.event("attacker");return null;}} + static final class Server extends ServerLevel {Data d;Server(){super(null,null,null,null,null,null,false,0L,List.of(),false);}@Override public void broadcastDamageEvent(Entity a,DamageSource s){d.event("broadcast");}@Override public long getGameTime(){d.event("game-time");return d.op.get("game_time").getAsLong();}} + static final class Effect extends MobEffectInstance {Data d;int id;Effect(){super(MobEffects.RESISTANCE);}@Override public void onMobHurt(ServerLevel l,LivingEntity a,DamageSource s,float v){d.event("effect "+id+" "+bits(v));}} + static final class Actor extends net.minecraft.world.entity.decoration.ArmorStand {Actor(){super(null,null);} + + Data d; + @Override public boolean isInvulnerableTo(ServerLevel l,DamageSource s){d.event("invulnerable");return d.flag("invulnerable");} + @Override public boolean isDeadOrDying(){d.event("dead");return d.flag(d.hit?"dead_after":"dead_before");} + @Override public boolean hasEffect(Holder e){if(e!=MobEffects.FIRE_RESISTANCE)throw new AssertionError();d.event("fire-resistance");return d.flag("fire_resistance");} + @Override public boolean isSleeping(){d.event("sleeping");return d.flag("sleeping");} + @Override public void stopSleeping(){d.event("wake");} + @Override public ItemStack getUseItem(){d.event("use-item");return d.flag("component")?shield:ItemStack.EMPTY;} + @Override public float applyItemBlocking(ServerLevel l,DamageSource s,float v){d.event("blocking "+bits(v));return single(d.op.get("blocked"));} + @Override public boolean is(TagKey> tag){if(tag!=EntityTypeTags.FREEZE_HURTS_EXTRA_TYPES)throw new AssertionError();d.event("freeze-extra");return d.flag("freeze_extra");} + @Override public ItemStack getItemBySlot(EquipmentSlot slot){if(slot!=EquipmentSlot.HEAD)throw new AssertionError();d.event("helmet");return d.flag("helmet")?plain:ItemStack.EMPTY;} + @Override protected void hurtHelmet(DamageSource s,float v){d.event("hurt-helmet "+bits(v));} + @Override protected void actuallyHurt(ServerLevel l,DamageSource s,float v){d.event("hurt "+bits(v)+" "+state(this));d.hit=true;d.recorded=v;if(d.flag("mutate_hit")){damageCooldownTime=d.op.get("hit_cooldown").getAsInt();lastHurt=single(d.op.get("hit_last"));hurtDuration=d.op.get("hit_duration").getAsInt();hurtTime=d.op.get("hit_time").getAsInt();}} + @Override protected void resolveMobResponsibleForDamage(DamageSource s){d.event("resolve-mob");} + @Override protected Player resolvePlayerResponsibleForDamage(DamageSource s){d.event("resolve-player");return null;} + @Override protected void markHurt(){d.event("mark");} + @Override public void dealDefaultKnockback(DamageSource s,float v,boolean b){d.event("knockback "+bits(v)+" "+b);} + @Override public ItemStack getItemInHand(InteractionHand h){d.event("hand "+h.ordinal());return ItemStack.EMPTY;} + @Override protected SoundEvent getDeathSound(){d.event("death-sound");return null;} + @Override public void makeSound(SoundEvent e){d.event("make-sound");} + @Override public void die(DamageSource s){d.event("die");} + @Override protected void playHurtSound(DamageSource s){d.event("hurt-sound");} + @Override public ServerLevel level(){d.event("level");return d.level;} + @Override public Collection getActiveEffects(){d.event("effects");return d.effects;} + } + static final class Human extends ServerPlayer {Human(){super(null,null,null,null);} + + Data d; + @Override public boolean isInvulnerableTo(ServerLevel l,DamageSource s){d.event("invulnerable");return d.flag("invulnerable");} + @Override public boolean isDeadOrDying(){d.event("dead");return d.flag(d.hit?"dead_after":"dead_before");} + @Override public boolean hasEffect(Holder e){if(e!=MobEffects.FIRE_RESISTANCE)throw new AssertionError();d.event("fire-resistance");return d.flag("fire_resistance");} + @Override public boolean isSleeping(){d.event("sleeping");return d.flag("sleeping");} + @Override public void stopSleeping(){d.event("wake");} + @Override public ItemStack getUseItem(){d.event("use-item");return d.flag("component")?shield:ItemStack.EMPTY;} + @Override public float applyItemBlocking(ServerLevel l,DamageSource s,float v){d.event("blocking "+bits(v));return single(d.op.get("blocked"));} + @Override public boolean is(TagKey> tag){if(tag!=EntityTypeTags.FREEZE_HURTS_EXTRA_TYPES)throw new AssertionError();d.event("freeze-extra");return d.flag("freeze_extra");} + @Override public ItemStack getItemBySlot(EquipmentSlot slot){if(slot!=EquipmentSlot.HEAD)throw new AssertionError();d.event("helmet");return d.flag("helmet")?plain:ItemStack.EMPTY;} + @Override protected void hurtHelmet(DamageSource s,float v){d.event("hurt-helmet "+bits(v));} + @Override protected void actuallyHurt(ServerLevel l,DamageSource s,float v){d.event("hurt "+bits(v)+" "+state(this));d.hit=true;d.recorded=v;if(d.flag("mutate_hit")){damageCooldownTime=d.op.get("hit_cooldown").getAsInt();lastHurt=single(d.op.get("hit_last"));hurtDuration=d.op.get("hit_duration").getAsInt();hurtTime=d.op.get("hit_time").getAsInt();}} + @Override protected void resolveMobResponsibleForDamage(DamageSource s){d.event("resolve-mob");} + @Override protected Player resolvePlayerResponsibleForDamage(DamageSource s){d.event("resolve-player");return null;} + @Override protected void markHurt(){d.event("mark");} + @Override public void dealDefaultKnockback(DamageSource s,float v,boolean b){d.event("knockback "+bits(v)+" "+b);} + @Override public ItemStack getItemInHand(InteractionHand h){d.event("hand "+h.ordinal());return ItemStack.EMPTY;} + @Override protected SoundEvent getDeathSound(){d.event("death-sound");return null;} + @Override public void makeSound(SoundEvent e){d.event("make-sound");} + @Override public void die(DamageSource s){d.event("die");} + @Override protected void playHurtSound(DamageSource s){d.event("hurt-sound");} + @Override public ServerLevel level(){d.event("level");return d.level;} + @Override public Collection getActiveEffects(){d.event("effects");return d.effects;} + + @Override public PlayerAdvancements getAdvancements(){d.event("criterion");return d.advancements;} + @Override public void awardStat(Identifier s,int v){if(s!=Stats.DAMAGE_BLOCKED_BY_SHIELD)throw new AssertionError();d.event("blocked-stat "+v);} + } + public static void main(String[] args)throws Throwable { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();var u=Class.forName("sun.misc.Unsafe");unsafe=field(u,"theUnsafe").get(null);allocate=u.getMethod("allocateInstance",Class.class); + noAction=field(LivingEntity.class,"noActionTime");cooldown=field(LivingEntity.class,"damageCooldownTime");lastHurt=field(LivingEntity.class,"lastHurt");duration=field(LivingEntity.class,"hurtDuration");time=field(LivingEntity.class,"hurtTime");stamp=field(LivingEntity.class,"lastDamageStamp");lastSource=field(LivingEntity.class,"lastDamageSource"); + var ctor=ItemStack.class.getDeclaredConstructor(Holder.class,int.class,PatchedDataComponentMap.class);ctor.setAccessible(true);plain=(ItemStack)ctor.newInstance(BuiltInRegistries.ITEM.wrapAsHolder(Items.STICK),1,new PatchedDataComponentMap(DataComponentMap.EMPTY));shield=(ItemStack)ctor.newInstance(BuiltInRegistries.ITEM.wrapAsHolder(Items.SHIELD),1,new PatchedDataComponentMap(DataComponentMap.EMPTY));shield.set(DataComponents.BLOCKS_ATTACKS,new BlocksAttacks(0,1,List.of(),new BlocksAttacks.ItemDamageFunction(0,0,0),Optional.empty(),Optional.empty(),Optional.empty())); + var lookup=MethodHandles.privateLookupIn(LivingEntity.class,MethodHandles.lookup());var hurt=lookup.findSpecial(LivingEntity.class,"hurtServer",MethodType.methodType(boolean.class,ServerLevel.class,DamageSource.class,float.class),LivingEntity.class); + Path dir=Path.of(args[1]);try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();var d=new Data();d.out=out;d.level=make(Server.class);d.level.d=d;d.advancements=make(PlayerAdvancements.class);field(PlayerAdvancements.class,"activeTriggers").set(d.advancements,new HashMap<>());LivingEntity actor;if(f.get("player").getAsBoolean()){var a=make(Human.class);a.d=d;actor=a;}else{var a=make(Actor.class);a.d=d;actor=a;}var source=make(Source.class);source.d=d; + noAction.setInt(actor,f.get("no_action").getAsInt());cooldown.setInt(actor,f.get("cooldown").getAsInt());lastHurt.setFloat(actor,single(f.get("last_hurt")));duration.setInt(actor,f.get("duration").getAsInt());time.setInt(actor,f.get("time").getAsInt());stamp.setLong(actor,f.get("stamp").getAsLong());if(f.get("source").getAsBoolean())lastSource.set(actor,source); + for(var ov:f.getAsJsonArray("ops")){d.op=ov.getAsJsonObject();d.calls=0;d.hit=false;d.effects=new ArrayList<>();for(int i=0;if',v).hex() + def op(damage=8,**kw): + o=dict(damage=bits(damage),blocked=bits(0),fail=-1,game_time=123456789,hit_cooldown=3,hit_last=bits(99),hit_duration=2,hit_time=1,effects=0,**{k:False for k in ['invulnerable','dead_before','dead_after','fire','fire_resistance','sleeping','component','freezing','freeze_extra','damages_helmet','helmet','bypasses_cooldown','no_impact','no_knockback','bypasses_invulnerability','mutate_hit']});o.update(kw);return o + def row(ops,**kw): + f=dict(ops=ops,no_action=83,cooldown=0,last_hurt=bits(0),duration=7,time=9,stamp=-3,source=False,player=False);f.update(kw);return f + values=[-float('inf'),-1e30,-1,-0.,0.,1e-40,.1,1,5,10,20,1e30,float('inf'),float('nan')] + for v in values: + for block in values: + for cooldown in [-2147483648,0,10,11,2147483647]: + for player in [False,True]: + yield row([op(v,blocked=bits(block),effects=2),op(v,blocked=bits(block),component=True),op(v,blocked=bits(block),dead_after=True)],cooldown=cooldown,player=player,last_hurt=bits(v)) + for fail in range(-1,38): + for cooldown in [0,10,11,20]: + for dead in [False,True]: + for component in [False,True]: + yield row([op(21,fail=fail,sleeping=True,freezing=True,freeze_extra=True,damages_helmet=True,helmet=True,blocked=bits(2),component=component,dead_after=dead,effects=3,mutate_hit=True),op(22)],player=True,cooldown=cooldown) + rng=random.Random(0x4855525453455256) + for _ in range(3000): + ops=[] + for __ in range(rng.randrange(1,20)): + o=op(rng.choice(values),blocked=bits(rng.choice(values)),effects=rng.randrange(4),game_time=rng.choice([-9223372036854775808,-1,0,9223372036854775807]),fail=rng.choice([-1,-1,-1,*range(38)]),hit_last=bits(rng.choice(values)),hit_cooldown=rng.randrange(-30,31)) + for k in ['invulnerable','dead_before','dead_after','fire','fire_resistance','sleeping','component','freezing','freeze_extra','damages_helmet','helmet','bypasses_cooldown','no_impact','no_knockback','bypasses_invulnerability','mutate_hit']:o[k]=rng.randrange(4)==0 + ops.append(o) + yield row(ops,cooldown=rng.choice([-2147483648,0,10,11,20,2147483647]),last_hurt=bits(rng.choice(values)),source=bool(rng.randrange(2)),player=bool(rng.randrange(2))) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-living-hurt-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingHurtOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/living_hurt_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaLivingHurtOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','living_hurt_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('living_hurt_fixture.exe' if os.name=='nt' else 'living_hurt_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} living hurt output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual LivingEntity.hurtServer invoked directly on base and ServerPlayer receivers. Controlled blocking, inner damage, sounds, knockback, death, attribution and effect callbacks; native empty death-protection lookup and empty-listener victim criterion. Compares field write ordering, cooldown thresholds, float sanitization, modifiers, repeated hits and injected callback failure. Successful totems, attacker-player criteria, actual blocking reduction, combat/death services and full player outer gates remain pending.'} + lab.write_json(report_path,report);print(f'Scoped living hurt parity passed: {report_path}') + + +if __name__=='__main__':main() From de148eb8a85dddd254bbf2870656ddc86ef2f23e Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 05:28:01 +0200 Subject: [PATCH 118/253] Implement player difficulty and server PvP damage gates --- .../scoped-parity.json | 255 ++++++++++++++ .../examples/player_hurt_fixture.rs | 313 ++++++++++++++++++ crates/horizon-world/src/lib.rs | 1 + crates/horizon-world/src/player_hurt.rs | 108 ++++++ docs/collision-geometry.md | 17 + .../parity/VanillaPlayerHurtOracle.java | 90 +++++ tools/test_player_hurt_parity.py | 98 ++++++ 7 files changed, 882 insertions(+) create mode 100644 benchmarks/rust-player-hurt-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/player_hurt_fixture.rs create mode 100644 crates/horizon-world/src/player_hurt.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerHurtOracle.java create mode 100644 tools/test_player_hurt_parity.py diff --git a/benchmarks/rust-player-hurt-2026-10-07/scoped-parity.json b/benchmarks/rust-player-hurt-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..af64f6a27 --- /dev/null +++ b/benchmarks/rust-player-hurt-2026-10-07/scoped-parity.json @@ -0,0 +1,255 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 7068, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerHurtOracle.java": "f7d4e136f4baf5dcad2532be2f73375f22a19ebf17b8ee183c35abd8cc4dbff6", + "tools/test_player_hurt_parity.py": "3164b8644664fcd46903e801ea70d1bb866e07e7112dc94570161831644bc84d", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "62428dd3dd38eca45ff3d122387eb4ec8186161f857963d3557d5aefb85cb423", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "711e78438ece3e94eb156c0e64cfea06a63f79640a7a81e396ae2c1b277cdce6", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_hurt.rs": "844239ad7d15c39629bb3cfc06ebae6d1cff20b7627468f26e0ee8dff3abdcb8", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_hurt.rs": "99c9bbd8587ec2dc287806049897b8034d2f5349ad47fc497b70d54148844a36", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/server_player_damage.rs": "c4fc29eecf2bf401680d1754bef06797a5e4608ab53c5b52e0dd4996f859dbfe", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "f417aab280331ddd6f0ca265a12c0130c78b9924f407c7e07f198140501e6010", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/player_hurt_fixture.rs": "0d2973abaf0784d15f5c15c30f1af29953c947eea820e3c9403e3a6dc3b09947" + }, + "fixtures_sha256": { + ".local/rust-player-hurt-parity/inputs.txt": "a4c5f7f9370daf4a1e54b0ccc45e9c157f399e62834016c27ba41651071d7ed5" + }, + "rust_output_sha256": "73f8200591b6331c70aa85f2d2f7e7d3fded984a5f39a17962dc33dc34017c68", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "73f8200591b6331c70aa85f2d2f7e7d3fded984a5f39a17962dc33dc34017c68", + "matched_output_lines": 410880 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "73f8200591b6331c70aa85f2d2f7e7d3fded984a5f39a17962dc33dc34017c68", + "matched_output_lines": 410880 + } + ], + "scope": "Actual Player and ServerPlayer hurtServer methods on ServerPlayer receivers through native LivingEntity dispatch. Ability/invulnerability ordering, shoulder removal, three difficulty queries, PvP player/arrow-owner gates, repeated hits, non-finite values and callback failures. Native downstream living dispatch uses controlled inner damage/blocking/effects/death services and empty victim criterion listeners. Rules/source registries, actual PvP team permissions, successful totems, attacker server-player criteria and complete player lifecycle remain pending." +} diff --git a/crates/horizon-world/examples/player_hurt_fixture.rs b/crates/horizon-world/examples/player_hurt_fixture.rs new file mode 100644 index 000000000..54a5ed5e4 --- /dev/null +++ b/crates/horizon-world/examples/player_hurt_fixture.rs @@ -0,0 +1,313 @@ +use horizon_world::living_hurt::{HurtState, HurtTag, HurtWorld}; +use horizon_world::{ + food::Difficulty, + player_hurt::{ + CausingEntity, PlayerHurtWorld, ServerPlayerHurtWorld, player_hurt_server, + server_player_hurt_server, + }, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn single(v: &Value) -> f32 { + f32::from_bits(u32::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn bits(v: f32) -> u32 { + if v.is_nan() { + f32::NAN.to_bits() + } else { + v.to_bits() + } +} +fn state(s: &HurtState<()>) -> String { + format!( + "{} {} {:08x} {} {} {} {}", + s.no_action_time, + s.cooldown, + bits(s.last_hurt), + s.hurt_duration, + s.hurt_time, + s.last_source.is_some(), + s.last_stamp + ) +} +struct Env<'a> { + out: &'a mut dyn Write, + op: &'a Value, + calls: i64, + hit: bool, + recorded: f32, + player: bool, + difficulty_calls: usize, +} +impl Env<'_> { + fn flag(&self, n: &str) -> bool { + self.op[n].as_bool().unwrap() + } + fn event(&mut self, s: &str) -> io::Result<()> { + writeln!(self.out, "{s}")?; + let n = self.calls; + self.calls += 1; + if n == self.op["fail"].as_i64().unwrap() { + Err(io::Error::other("injected hurt callback failure")) + } else { + Ok(()) + } + } +} +impl HurtWorld for Env<'_> { + type Error = io::Error; + type Source = (); + type UseItem = bool; + type Blocking = (); + type Sound = (); + fn source(&self) {} + fn is_server_player(&self) -> bool { + self.player + } + fn invulnerable(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("invulnerable")?; + Ok(self.flag("invulnerable")) + } + fn fire_resistance(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("fire-resistance")?; + Ok(self.flag("fire_resistance")) + } + fn sleeping(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("sleeping")?; + Ok(self.flag("sleeping")) + } + fn freeze_hurts_extra(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("freeze-extra")?; + Ok(self.flag("freeze_extra")) + } + fn stop_sleeping(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("wake") + } + fn resolve_mob(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("resolve-mob") + } + fn resolve_player(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("resolve-player") + } + fn broadcast_damage(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("broadcast") + } + fn mark_hurt(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("mark") + } + fn secondary_sound(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("thorns") + } + fn die(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("die") + } + fn hurt_sound(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("hurt-sound") + } + + fn dead_or_dying(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("dead")?; + Ok(self.flag(if self.hit { + "dead_after" + } else { + "dead_before" + })) + } + fn tag(&mut self, _: &mut HurtState<()>, tag: HurtTag) -> io::Result { + let n = match tag { + HurtTag::Fire => "fire", + HurtTag::Freezing => "freezing", + HurtTag::DamagesHelmet => "damages_helmet", + HurtTag::BypassesCooldown => "bypasses_cooldown", + HurtTag::NoImpact => "no_impact", + HurtTag::NoKnockback => "no_knockback", + }; + self.event(&format!("tag {n}"))?; + Ok(self.flag(n)) + } + fn use_item(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("use-item")?; + Ok(self.flag("component")) + } + fn apply_blocking(&mut self, _: &mut HurtState<()>, v: f32) -> io::Result { + self.event(&format!("blocking {:08x}", bits(v)))?; + Ok(single(&self.op["blocked"])) + } + fn helmet_empty(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("helmet")?; + Ok(!self.flag("helmet")) + } + fn hurt_helmet(&mut self, _: &mut HurtState<()>, v: f32) -> io::Result<()> { + self.event(&format!("hurt-helmet {:08x}", bits(v))) + } + fn actually_hurt(&mut self, s: &mut HurtState<()>, v: f32) -> io::Result<()> { + self.event(&format!("hurt {:08x} {}", bits(v), state(s)))?; + self.hit = true; + self.recorded = v; + if self.flag("mutate_hit") { + s.cooldown = self.op["hit_cooldown"].as_i64().unwrap() as i32; + s.last_hurt = single(&self.op["hit_last"]); + s.hurt_duration = self.op["hit_duration"].as_i64().unwrap() as i32; + s.hurt_time = self.op["hit_time"].as_i64().unwrap() as i32; + } + Ok(()) + } + fn blocking_component(&mut self, v: bool) -> Option<()> { + v.then_some(()) + } + fn on_blocked(&mut self, _: &mut HurtState<()>, _: ()) -> io::Result<()> { + Ok(()) + } + fn knockback(&mut self, _: &mut HurtState<()>, v: f32, b: bool) -> io::Result<()> { + self.event(&format!("knockback {:08x} {b}", bits(v))) + } + fn death_protection(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("tag bypasses_invulnerability")?; + if !self.flag("bypasses_invulnerability") { + self.event("hand 0")?; + self.event("hand 1")?; + } + Ok(false) + } + fn death_sound(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("death-sound") + } + fn make_sound(&mut self, _: &mut HurtState<()>, _: ()) -> io::Result<()> { + self.event("make-sound") + } + fn game_time(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("level")?; + self.event("game-time")?; + Ok(self.op["game_time"].as_i64().unwrap()) + } + fn effects_on_hurt(&mut self, _: &mut HurtState<()>, v: f32) -> io::Result<()> { + self.event("effects")?; + for i in 0..self.op["effects"].as_u64().unwrap() { + self.event(&format!("effect {i} {:08x}", bits(v)))?; + } + Ok(()) + } + fn player_hurt_criterion( + &mut self, + _: &mut HurtState<()>, + _: f32, + _: f32, + _: bool, + ) -> io::Result<()> { + self.event("criterion") + } + fn award_blocked(&mut self, _: &mut HurtState<()>, v: i32) -> io::Result<()> { + self.event(&format!("blocked-stat {v}")) + } + fn attacker_criterion( + &mut self, + _: &mut HurtState<()>, + _: f32, + _: f32, + _: bool, + ) -> io::Result<()> { + self.event("attacker") + } +} +impl PlayerHurtWorld for Env<'_> { + fn ability_invulnerable(&self) -> bool { + self.flag("ability_invulnerable") + } + fn bypasses_invulnerability(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("tag bypasses_invulnerability")?; + Ok(self.flag("bypasses_invulnerability")) + } + fn remove_shoulders(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("shoulders") + } + fn scales_with_difficulty(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("scales")?; + Ok(self.flag("scales")) + } + fn difficulty(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("difficulty")?; + let v = self.op["difficulties"][self.difficulty_calls] + .as_u64() + .unwrap(); + self.difficulty_calls += 1; + Ok([ + Difficulty::Peaceful, + Difficulty::Easy, + Difficulty::Normal, + Difficulty::Hard, + ][v as usize]) + } +} +impl ServerPlayerHurtWorld for Env<'_> { + type Player = (); + type Arrow = (); + fn causing_entity(&mut self, _: &mut HurtState<()>) -> io::Result> { + self.event("attacker")?; + Ok(match self.op["attacker"].as_u64().unwrap() { + 0 | 1 => CausingEntity::Other, + 2 => CausingEntity::Player(()), + 3 => CausingEntity::Arrow(()), + _ => panic!("attacker"), + }) + } + fn arrow_player_owner(&mut self, _: &mut HurtState<()>, _: ()) -> io::Result> { + self.event("owner")?; + Ok((self.op["owner"] == 1).then_some(())) + } + fn can_harm_player(&mut self, _: &mut HurtState<()>, _: ()) -> io::Result { + self.event("can-harm")?; + Ok(self.flag("can_harm")) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut s = HurtState { + no_action_time: f["no_action"].as_i64().unwrap() as i32, + cooldown: f["cooldown"].as_i64().unwrap() as i32, + last_hurt: single(&f["last_hurt"]), + hurt_duration: f["duration"].as_i64().unwrap() as i32, + hurt_time: f["time"].as_i64().unwrap() as i32, + last_source: f["source"].as_bool().unwrap().then_some(()), + last_stamp: f["stamp"].as_i64().unwrap(), + }; + let mut recorded = 0.0; + for op in f["ops"].as_array().unwrap() { + let mut e = Env { + out: &mut out, + op, + calls: 0, + hit: false, + recorded, + player: true, + difficulty_calls: 0, + }; + let result = if f["server"].as_bool().unwrap() { + server_player_hurt_server(&mut s, &mut e, single(&op["damage"])) + } else { + player_hurt_server(&mut s, &mut e, single(&op["damage"])) + }; + match result { + Ok(v) => writeln!(e.out, "bool {v}\nresult ok")?, + Err(_) => writeln!(e.out, "result error")?, + }; + recorded = e.recorded; + writeln!( + e.out, + "state {} {:08x} {} {}", + state(&s), + bits(recorded), + e.hit, + e.calls + )?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 42418a8dc..07fa28f3a 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -58,6 +58,7 @@ pub mod piston_movement; pub mod piston_shape; pub mod player_food; pub mod player_health; +pub mod player_hurt; pub mod player_travel; pub mod powder_snow_collision; pub mod region; diff --git a/crates/horizon-world/src/player_hurt.rs b/crates/horizon-world/src/player_hurt.rs new file mode 100644 index 000000000..bdaa8992d --- /dev/null +++ b/crates/horizon-world/src/player_hurt.rs @@ -0,0 +1,108 @@ +//! Player difficulty/ability gates and server PvP dispatch before living hurt. +use crate::{ + food::Difficulty, + living_hurt::{self, HurtState, HurtWorld}, +}; +pub trait PlayerHurtWorld: HurtWorld { + fn ability_invulnerable(&self) -> bool; + fn bypasses_invulnerability( + &mut self, + s: &mut HurtState, + ) -> Result; + fn remove_shoulders(&mut self, s: &mut HurtState) -> Result<(), Self::Error>; + fn scales_with_difficulty( + &mut self, + s: &mut HurtState, + ) -> Result; + fn difficulty(&mut self, s: &mut HurtState) -> Result; +} +fn min(a: f32, b: f32) -> f32 { + if a.is_nan() || b.is_nan() { + f32::NAN + } else if a == 0.0 && b == 0.0 { + f32::from_bits(a.to_bits() | b.to_bits()) + } else { + a.min(b) + } +} +pub fn player_hurt_server( + s: &mut HurtState, + w: &mut W, + mut damage: f32, +) -> Result { + if w.invulnerable(s)? { + return Ok(false); + } + if w.ability_invulnerable() && !w.bypasses_invulnerability(s)? { + return Ok(false); + } + s.no_action_time = 0; + if w.dead_or_dying(s)? { + return Ok(false); + } + w.remove_shoulders(s)?; + if w.scales_with_difficulty(s)? { + if w.difficulty(s)? == Difficulty::Peaceful { + damage = 0.0; + } + if w.difficulty(s)? == Difficulty::Easy { + damage = min(damage / 2.0 + 1.0, damage); + } + if w.difficulty(s)? == Difficulty::Hard { + damage = damage * 3.0 / 2.0; + } + } + if damage == 0.0 { + return Ok(false); + } + living_hurt::hurt_server(s, w, damage) +} +#[derive(Clone, Copy, Debug)] +pub enum CausingEntity { + Other, + Player(P), + Arrow(A), +} +pub trait ServerPlayerHurtWorld: PlayerHurtWorld { + type Player: Copy; + type Arrow: Copy; + fn causing_entity( + &mut self, + s: &mut HurtState, + ) -> Result, Self::Error>; + fn arrow_player_owner( + &mut self, + s: &mut HurtState, + arrow: Self::Arrow, + ) -> Result, Self::Error>; + fn can_harm_player( + &mut self, + s: &mut HurtState, + player: Self::Player, + ) -> Result; +} +pub fn server_player_hurt_server( + s: &mut HurtState, + w: &mut W, + damage: f32, +) -> Result { + if w.invulnerable(s)? { + return Ok(false); + } + match w.causing_entity(s)? { + CausingEntity::Player(p) => { + if !w.can_harm_player(s, p)? { + return Ok(false); + } + } + CausingEntity::Arrow(a) => { + if let Some(p) = w.arrow_player_owner(s, a)? { + if !w.can_harm_player(s, p)? { + return Ok(false); + } + } + } + CausingEntity::Other => {} + } + player_hurt_server(s, w, damage) +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 01ff4ba9c..fa041528f 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1351,3 +1351,20 @@ Clippy passes. Inner damage, blocking amounts, sounds, knockback, death and attribution/effect services are controlled. Successful totems, attacker-player criteria, actual blocking reduction, full service bindings and player-specific outer gates remain pending. + + +`player_hurt` adds the player ability/invulnerability gates, no-action reset, +shoulder removal, damage-source difficulty scaling and exact-zero rejection +before living hurt. The server-player wrapper first checks PvP permission for +player attackers and player owners of arrow attackers. Difficulty is queried +separately for the peaceful, easy and hard branches as in vanilla. + +`python3 tools/test_player_hurt_parity.py` compares actual Player and ServerPlayer +methods through the native living hurt sequence. The +[player hurt report](../benchmarks/rust-player-hurt-2026-10-07/scoped-parity.json) +records **410,880 matching lines per JAR**, including all three-query difficulty +combinations, player/arrow-owner PvP gates, repeated hits and callback failures. +Targeted Clippy passes. Native downstream living services retain the controlled +fixture scope above; invulnerability internals, rule/source registries, actual +team permissions, successful totems, attacker server-player criteria and complete +player lifecycle integration remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerHurtOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerHurtOracle.java new file mode 100644 index 000000000..76e207b01 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerHurtOracle.java @@ -0,0 +1,90 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.lang.reflect.*;import java.lang.invoke.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.*;import net.minecraft.core.component.*;import net.minecraft.core.registries.*;import net.minecraft.resources.*;import net.minecraft.tags.*;import net.minecraft.world.InteractionHand;import net.minecraft.world.entity.*;import net.minecraft.world.entity.player.*;import net.minecraft.world.damagesource.*;import net.minecraft.world.effect.*;import net.minecraft.world.item.*;import net.minecraft.world.item.component.*;import net.minecraft.server.level.*;import net.minecraft.server.PlayerAdvancements;import net.minecraft.sounds.*;import net.minecraft.stats.Stats; +/** Actual Player/ServerPlayer outer gates followed by native living hurt dispatch. */ +public final class VanillaPlayerHurtOracle { + static final class Stop extends RuntimeException {} + static Object unsafe;static Method allocate;static ItemStack plain,shield;static Field stamp,lastSource,noAction,cooldown,lastHurt,duration,time; + static T make(Class c)throws Exception{return c.cast(allocate.invoke(unsafe,c));} + static Field field(Class c,String n)throws Exception{var f=c.getDeclaredField(n);f.setAccessible(true);return f;} + static float single(JsonElement v){return Float.intBitsToFloat(Integer.parseUnsignedInt(v.getAsString(),16));} + static String bits(float v){return String.format("%08x",Float.floatToIntBits(v));} + static String state(LivingEntity a){try{return noAction.getInt(a)+" "+cooldown.getInt(a)+" "+bits(lastHurt.getFloat(a))+" "+duration.getInt(a)+" "+time.getInt(a)+" "+(lastSource.get(a)!=null)+" "+stamp.getLong(a);}catch(Exception e){throw new AssertionError(e);}} + static final class Data {JsonObject op;PrintWriter out;int calls,difficultyCalls;boolean hit;Abilities abilities;PlainPlayer attacker;Arrow arrow;Actor other;float recorded;Server level;PlayerAdvancements advancements;List effects; + boolean flag(String n){return op.get(n).getAsBoolean();}void event(String s){out.println(s);if(calls++==op.get("fail").getAsInt())throw new Stop();}} + static final class Source extends DamageSource {Data d;Source(){super(null);} + @Override public boolean is(TagKey tag){String n=tag==DamageTypeTags.IS_FIRE?"fire":tag==DamageTypeTags.IS_FREEZING?"freezing":tag==DamageTypeTags.DAMAGES_HELMET?"damages_helmet":tag==DamageTypeTags.BYPASSES_COOLDOWN?"bypasses_cooldown":tag==DamageTypeTags.NO_IMPACT?"no_impact":tag==DamageTypeTags.NO_KNOCKBACK?"no_knockback":tag==DamageTypeTags.BYPASSES_INVULNERABILITY?"bypasses_invulnerability":null;if(n==null)throw new AssertionError();d.event("tag "+n);return d.flag(n);} + @Override public boolean is(ResourceKey k){if(k!=DamageTypes.THORNS)throw new AssertionError();d.event("thorns");return false;} + @Override public Entity getEntity(){d.event("attacker");return switch(d.op.get("attacker").getAsInt()){case 0->null;case 1->d.other;case 2->d.attacker;case 3->d.arrow;default->throw new AssertionError();};} + @Override public boolean scalesWithDifficulty(){d.event("scales");return d.flag("scales");}} + static final class PlainPlayer extends Player {PlainPlayer(){super(null,null);}@Override public net.minecraft.world.level.GameType gameMode(){return net.minecraft.world.level.GameType.SURVIVAL;}} + static final class Arrow extends net.minecraft.world.entity.projectile.arrow.Arrow {Data d;Arrow(){super(null,null);}@Override public Entity getOwner(){d.event("owner");return switch(d.op.get("owner").getAsInt()){case 0->null;case 1->d.attacker;case 2->d.other;default->throw new AssertionError();};}} + static final class Server extends ServerLevel {Data d;Server(){super(null,null,null,null,null,null,false,0L,List.of(),false);}@Override public void broadcastDamageEvent(Entity a,DamageSource s){d.event("broadcast");}@Override public net.minecraft.world.Difficulty getDifficulty(){d.event("difficulty");return net.minecraft.world.Difficulty.values()[d.op.getAsJsonArray("difficulties").get(d.difficultyCalls++).getAsInt()];}@Override public long getGameTime(){d.event("game-time");return d.op.get("game_time").getAsLong();}} + static final class Effect extends MobEffectInstance {Data d;int id;Effect(){super(MobEffects.RESISTANCE);}@Override public void onMobHurt(ServerLevel l,LivingEntity a,DamageSource s,float v){d.event("effect "+id+" "+bits(v));}} + static final class Actor extends net.minecraft.world.entity.decoration.ArmorStand {Actor(){super(null,null);} + + Data d; + @Override public boolean isInvulnerableTo(ServerLevel l,DamageSource s){d.event("invulnerable");return d.flag("invulnerable");} + @Override public boolean isDeadOrDying(){d.event("dead");return d.flag(d.hit?"dead_after":"dead_before");} + @Override public boolean hasEffect(Holder e){if(e!=MobEffects.FIRE_RESISTANCE)throw new AssertionError();d.event("fire-resistance");return d.flag("fire_resistance");} + @Override public boolean isSleeping(){d.event("sleeping");return d.flag("sleeping");} + @Override public void stopSleeping(){d.event("wake");} + @Override public ItemStack getUseItem(){d.event("use-item");return d.flag("component")?shield:ItemStack.EMPTY;} + @Override public float applyItemBlocking(ServerLevel l,DamageSource s,float v){d.event("blocking "+bits(v));return single(d.op.get("blocked"));} + @Override public boolean is(TagKey> tag){if(tag!=EntityTypeTags.FREEZE_HURTS_EXTRA_TYPES)throw new AssertionError();d.event("freeze-extra");return d.flag("freeze_extra");} + @Override public ItemStack getItemBySlot(EquipmentSlot slot){if(slot!=EquipmentSlot.HEAD)throw new AssertionError();d.event("helmet");return d.flag("helmet")?plain:ItemStack.EMPTY;} + @Override protected void hurtHelmet(DamageSource s,float v){d.event("hurt-helmet "+bits(v));} + @Override protected void actuallyHurt(ServerLevel l,DamageSource s,float v){d.event("hurt "+bits(v)+" "+state(this));d.hit=true;d.recorded=v;if(d.flag("mutate_hit")){damageCooldownTime=d.op.get("hit_cooldown").getAsInt();lastHurt=single(d.op.get("hit_last"));hurtDuration=d.op.get("hit_duration").getAsInt();hurtTime=d.op.get("hit_time").getAsInt();}} + @Override protected void resolveMobResponsibleForDamage(DamageSource s){d.event("resolve-mob");} + @Override protected Player resolvePlayerResponsibleForDamage(DamageSource s){d.event("resolve-player");return null;} + @Override protected void markHurt(){d.event("mark");} + @Override public void dealDefaultKnockback(DamageSource s,float v,boolean b){d.event("knockback "+bits(v)+" "+b);} + @Override public ItemStack getItemInHand(InteractionHand h){d.event("hand "+h.ordinal());return ItemStack.EMPTY;} + @Override protected SoundEvent getDeathSound(){d.event("death-sound");return null;} + @Override public void makeSound(SoundEvent e){d.event("make-sound");} + @Override public void die(DamageSource s){d.event("die");} + @Override protected void playHurtSound(DamageSource s){d.event("hurt-sound");} + @Override public ServerLevel level(){d.event("level");return d.level;} + @Override public Collection getActiveEffects(){d.event("effects");return d.effects;} + } + static final class Human extends ServerPlayer {Human(){super(null,null,null,null);} + + Data d; + @Override public boolean isInvulnerableTo(ServerLevel l,DamageSource s){d.event("invulnerable");return d.flag("invulnerable");} + @Override public boolean isDeadOrDying(){d.event("dead");return d.flag(d.hit?"dead_after":"dead_before");} + @Override public boolean hasEffect(Holder e){if(e!=MobEffects.FIRE_RESISTANCE)throw new AssertionError();d.event("fire-resistance");return d.flag("fire_resistance");} + @Override public boolean isSleeping(){d.event("sleeping");return d.flag("sleeping");} + @Override public void stopSleeping(){d.event("wake");} + @Override public ItemStack getUseItem(){d.event("use-item");return d.flag("component")?shield:ItemStack.EMPTY;} + @Override public float applyItemBlocking(ServerLevel l,DamageSource s,float v){d.event("blocking "+bits(v));return single(d.op.get("blocked"));} + @Override public boolean is(TagKey> tag){if(tag!=EntityTypeTags.FREEZE_HURTS_EXTRA_TYPES)throw new AssertionError();d.event("freeze-extra");return d.flag("freeze_extra");} + @Override public ItemStack getItemBySlot(EquipmentSlot slot){if(slot!=EquipmentSlot.HEAD)throw new AssertionError();d.event("helmet");return d.flag("helmet")?plain:ItemStack.EMPTY;} + @Override protected void hurtHelmet(DamageSource s,float v){d.event("hurt-helmet "+bits(v));} + @Override protected void actuallyHurt(ServerLevel l,DamageSource s,float v){d.event("hurt "+bits(v)+" "+state(this));d.hit=true;d.recorded=v;if(d.flag("mutate_hit")){damageCooldownTime=d.op.get("hit_cooldown").getAsInt();lastHurt=single(d.op.get("hit_last"));hurtDuration=d.op.get("hit_duration").getAsInt();hurtTime=d.op.get("hit_time").getAsInt();}} + @Override protected void resolveMobResponsibleForDamage(DamageSource s){d.event("resolve-mob");} + @Override protected Player resolvePlayerResponsibleForDamage(DamageSource s){d.event("resolve-player");return null;} + @Override protected void markHurt(){d.event("mark");} + @Override public void dealDefaultKnockback(DamageSource s,float v,boolean b){d.event("knockback "+bits(v)+" "+b);} + @Override public ItemStack getItemInHand(InteractionHand h){d.event("hand "+h.ordinal());return ItemStack.EMPTY;} + @Override protected SoundEvent getDeathSound(){d.event("death-sound");return null;} + @Override public void makeSound(SoundEvent e){d.event("make-sound");} + @Override public void die(DamageSource s){d.event("die");} + @Override protected void playHurtSound(DamageSource s){d.event("hurt-sound");} + @Override public ServerLevel level(){d.event("level");return d.level;} + @Override public Collection getActiveEffects(){d.event("effects");return d.effects;} + + @Override protected void removeEntitiesOnShoulder(){d.event("shoulders");}@Override public boolean canHarmPlayer(Player p){d.event("can-harm");return d.flag("can_harm");}@Override public PlayerAdvancements getAdvancements(){d.event("criterion");return d.advancements;} + @Override public void awardStat(Identifier s,int v){if(s!=Stats.DAMAGE_BLOCKED_BY_SHIELD)throw new AssertionError();d.event("blocked-stat "+v);} + } + public static void main(String[] args)throws Throwable { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();var u=Class.forName("sun.misc.Unsafe");unsafe=field(u,"theUnsafe").get(null);allocate=u.getMethod("allocateInstance",Class.class); + noAction=field(LivingEntity.class,"noActionTime");cooldown=field(LivingEntity.class,"damageCooldownTime");lastHurt=field(LivingEntity.class,"lastHurt");duration=field(LivingEntity.class,"hurtDuration");time=field(LivingEntity.class,"hurtTime");stamp=field(LivingEntity.class,"lastDamageStamp");lastSource=field(LivingEntity.class,"lastDamageSource"); + var ctor=ItemStack.class.getDeclaredConstructor(Holder.class,int.class,PatchedDataComponentMap.class);ctor.setAccessible(true);plain=(ItemStack)ctor.newInstance(BuiltInRegistries.ITEM.wrapAsHolder(Items.STICK),1,new PatchedDataComponentMap(DataComponentMap.EMPTY));shield=(ItemStack)ctor.newInstance(BuiltInRegistries.ITEM.wrapAsHolder(Items.SHIELD),1,new PatchedDataComponentMap(DataComponentMap.EMPTY));shield.set(DataComponents.BLOCKS_ATTACKS,new BlocksAttacks(0,1,List.of(),new BlocksAttacks.ItemDamageFunction(0,0,0),Optional.empty(),Optional.empty(),Optional.empty())); + var lookup=MethodHandles.privateLookupIn(Player.class,MethodHandles.lookup());var playerHurt=lookup.findSpecial(Player.class,"hurtServer",MethodType.methodType(boolean.class,ServerLevel.class,DamageSource.class,float.class),Player.class).asType(MethodType.methodType(boolean.class,LivingEntity.class,ServerLevel.class,DamageSource.class,float.class)); + var serverLookup=MethodHandles.privateLookupIn(ServerPlayer.class,MethodHandles.lookup());var serverHurt=serverLookup.findSpecial(ServerPlayer.class,"hurtServer",MethodType.methodType(boolean.class,ServerLevel.class,DamageSource.class,float.class),ServerPlayer.class).asType(MethodType.methodType(boolean.class,LivingEntity.class,ServerLevel.class,DamageSource.class,float.class)); + Path dir=Path.of(args[1]);try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();var d=new Data();d.out=out;d.level=make(Server.class);d.level.d=d;d.advancements=make(PlayerAdvancements.class);field(PlayerAdvancements.class,"activeTriggers").set(d.advancements,new HashMap<>());var human=make(Human.class);human.d=d;LivingEntity actor=human;d.abilities=new Abilities();field(Player.class,"abilities").set(actor,d.abilities);d.attacker=make(PlainPlayer.class);d.other=make(Actor.class);d.other.d=d;d.arrow=make(Arrow.class);d.arrow.d=d;var hurt=f.get("server").getAsBoolean()?serverHurt:playerHurt;var source=make(Source.class);source.d=d; + noAction.setInt(actor,f.get("no_action").getAsInt());cooldown.setInt(actor,f.get("cooldown").getAsInt());lastHurt.setFloat(actor,single(f.get("last_hurt")));duration.setInt(actor,f.get("duration").getAsInt());time.setInt(actor,f.get("time").getAsInt());stamp.setLong(actor,f.get("stamp").getAsLong());if(f.get("source").getAsBoolean())lastSource.set(actor,source); + for(var ov:f.getAsJsonArray("ops")){d.op=ov.getAsJsonObject();d.calls=0;d.difficultyCalls=0;d.hit=false;d.abilities.invulnerable=d.flag("ability_invulnerable");d.effects=new ArrayList<>();for(int i=0;if',v).hex() + def op(damage=8,**kw): + o=dict(damage=bits(damage),blocked=bits(0),fail=-1,game_time=123456789,hit_cooldown=3,hit_last=bits(99),hit_duration=2,hit_time=1,effects=0,**{k:False for k in ['invulnerable','dead_before','dead_after','fire','fire_resistance','sleeping','component','freezing','freeze_extra','damages_helmet','helmet','bypasses_cooldown','no_impact','no_knockback','bypasses_invulnerability','mutate_hit']});o.update(kw);return o + def row(ops,**kw): + f=dict(ops=ops,no_action=83,cooldown=0,last_hurt=bits(0),duration=7,time=9,stamp=-3,source=False,player=False);f.update(kw);return f + values=[-float('inf'),-1e30,-1,-0.,0.,1e-40,.1,1,5,10,20,1e30,float('inf'),float('nan')] + for v in values: + for block in values: + for cooldown in [-2147483648,0,10,11,2147483647]: + for player in [False,True]: + yield row([op(v,blocked=bits(block),effects=2),op(v,blocked=bits(block),component=True),op(v,blocked=bits(block),dead_after=True)],cooldown=cooldown,player=player,last_hurt=bits(v)) + for fail in range(-1,38): + for cooldown in [0,10,11,20]: + for dead in [False,True]: + for component in [False,True]: + yield row([op(21,fail=fail,sleeping=True,freezing=True,freeze_extra=True,damages_helmet=True,helmet=True,blocked=bits(2),component=component,dead_after=dead,effects=3,mutate_hit=True),op(22)],player=True,cooldown=cooldown) + rng=random.Random(0x4855525453455256) + for _ in range(3000): + ops=[] + for __ in range(rng.randrange(1,20)): + o=op(rng.choice(values),blocked=bits(rng.choice(values)),effects=rng.randrange(4),game_time=rng.choice([-9223372036854775808,-1,0,9223372036854775807]),fail=rng.choice([-1,-1,-1,*range(38)]),hit_last=bits(rng.choice(values)),hit_cooldown=rng.randrange(-30,31)) + for k in ['invulnerable','dead_before','dead_after','fire','fire_resistance','sleeping','component','freezing','freeze_extra','damages_helmet','helmet','bypasses_cooldown','no_impact','no_knockback','bypasses_invulnerability','mutate_hit']:o[k]=rng.randrange(4)==0 + ops.append(o) + yield row(ops,cooldown=rng.choice([-2147483648,0,10,11,20,2147483647]),last_hurt=bits(rng.choice(values)),source=bool(rng.randrange(2)),player=bool(rng.randrange(2))) + + +def corpus(): + rng=random.Random(0x504c415948555254) + for f in living_corpus(): + f['server']=bool(rng.randrange(2)) + for o in f['ops']: + o.update(ability_invulnerable=bool(rng.randrange(2)),scales=bool(rng.randrange(2)),difficulties=[rng.randrange(4) for _ in range(3)],attacker=rng.randrange(4),owner=rng.randrange(3),can_harm=bool(rng.randrange(2))) + yield f + template=next(living_corpus()) + import copy + values=[-float('inf'),-1e30,-1,-0.,0.,1e-40,.1,1,5,10,20,1e30,float('inf'),float('nan')] + for damage in values: + for a in range(4): + for b in range(4): + for c in range(4): + f=copy.deepcopy(template);f.update(server=True,cooldown=0,last_hurt='00000000');o=f['ops'][0];o.update(damage=struct.pack('>f',damage).hex(),blocked='00000000',ability_invulnerable=False,scales=True,difficulties=[a,b,c],attacker=0,owner=0,can_harm=True);f['ops']=[o];yield f + for fail in range(-1,48): + for attacker in range(4): + for owner in range(3): + f=copy.deepcopy(template);f.update(server=True,cooldown=0,last_hurt='00000000');o=f['ops'][0];o.update(damage='41200000',blocked='3f800000',ability_invulnerable=True,bypasses_invulnerability=True,scales=True,difficulties=[2,1,3],attacker=attacker,owner=owner,can_harm=True,fail=fail);f['ops']=[o];yield f + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-player-hurt-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerHurtOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/player_hurt_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaPlayerHurtOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','player_hurt_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('player_hurt_fixture.exe' if os.name=='nt' else 'player_hurt_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} player hurt output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual Player and ServerPlayer hurtServer methods on ServerPlayer receivers through native LivingEntity dispatch. Ability/invulnerability ordering, shoulder removal, three difficulty queries, PvP player/arrow-owner gates, repeated hits, non-finite values and callback failures. Native downstream living dispatch uses controlled inner damage/blocking/effects/death services and empty victim criterion listeners. Rules/source registries, actual PvP team permissions, successful totems, attacker server-player criteria and complete player lifecycle remain pending.'} + lab.write_json(report_path,report);print(f'Scoped player hurt parity passed: {report_path}') + + +if __name__=='__main__':main() From 04e57a5d72ad54f4004a3b56781edd238332b153 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 05:31:45 +0200 Subject: [PATCH 119/253] Implement entity and player damage immunity predicates --- .../scoped-parity.json | 257 ++++++++++++++++++ .../examples/damage_immunity_fixture.rs | 123 +++++++++ crates/horizon-world/src/damage_immunity.rs | 73 +++++ crates/horizon-world/src/lib.rs | 1 + docs/collision-geometry.md | 15 + .../parity/VanillaDamageImmunityOracle.java | 35 +++ tools/test_damage_immunity_parity.py | 73 +++++ 7 files changed, 577 insertions(+) create mode 100644 benchmarks/rust-damage-immunity-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/damage_immunity_fixture.rs create mode 100644 crates/horizon-world/src/damage_immunity.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDamageImmunityOracle.java create mode 100644 tools/test_damage_immunity_parity.py diff --git a/benchmarks/rust-damage-immunity-2026-10-07/scoped-parity.json b/benchmarks/rust-damage-immunity-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..7724dca87 --- /dev/null +++ b/benchmarks/rust-damage-immunity-2026-10-07/scoped-parity.json @@ -0,0 +1,257 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 17988, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDamageImmunityOracle.java": "cd682badfda7a54fcb983b14ff1c86cec5c02f84f2106b802bd0911414ff651b", + "tools/test_damage_immunity_parity.py": "5ea56eef2595014881a9117370bed5ecad24a72eead1d8bfdf34eb23b896e414", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_immunity.rs": "fd39c41124d694e755cf7faadcf93c636df4042c78ec345092a856b5f952dbcf", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "cfe2f36e811e8e4c7a4868226e5aa341f07568be1e7879d59dbe2c225d146932", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "711e78438ece3e94eb156c0e64cfea06a63f79640a7a81e396ae2c1b277cdce6", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_hurt.rs": "844239ad7d15c39629bb3cfc06ebae6d1cff20b7627468f26e0ee8dff3abdcb8", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_hurt.rs": "99c9bbd8587ec2dc287806049897b8034d2f5349ad47fc497b70d54148844a36", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/server_player_damage.rs": "c4fc29eecf2bf401680d1754bef06797a5e4608ab53c5b52e0dd4996f859dbfe", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "f417aab280331ddd6f0ca265a12c0130c78b9924f407c7e07f198140501e6010", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/damage_immunity_fixture.rs": "991af9c1e73bf4d6341ef0e4f7af5d4a10001781e625d9ef929e7112d6139288" + }, + "fixtures_sha256": { + ".local/rust-damage-immunity-parity/inputs.txt": "e7eb796384e9ffc2e675757e5f7c7a61f494999625db7a03a4b0defd76897089", + ".local/rust-damage-immunity-parity/slots.json": "29101ebf1ead685029508789eee51c4d4fff65524064d8e32a48efded7036982" + }, + "rust_output_sha256": "74fb7a0069c40808a43fbefd9ebdf6a48ffbda144facb6fbdab36fcb5ee3a009", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "74fb7a0069c40808a43fbefd9ebdf6a48ffbda144facb6fbdab36fcb5ee3a009", + "matched_output_lines": 170314 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "74fb7a0069c40808a43fbefd9ebdf6a48ffbda144facb6fbdab36fcb5ee3a009", + "matched_output_lines": 170314 + } + ], + "scope": "Actual Entity invulnerability/base immunity, LivingEntity enchantment dispatch, Player gamerule immunity and ServerPlayer dimension/client-loading predicates. Controlled virtual flags, source tags and rules; real empty-equipment enchantment iteration. Compares short-circuit ordering, mixed tags, virtual state changes and callback failures. Registered source/rule bindings, nonempty enchantment immunity and full damage-pipeline integration remain pending." +} diff --git a/crates/horizon-world/examples/damage_immunity_fixture.rs b/crates/horizon-world/examples/damage_immunity_fixture.rs new file mode 100644 index 000000000..b404b27b2 --- /dev/null +++ b/crates/horizon-world/examples/damage_immunity_fixture.rs @@ -0,0 +1,123 @@ +use horizon_world::damage_immunity::{self, DamageRule, ImmunityTag, ImmunityWorld}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +struct Env<'a> { + f: &'a Value, + out: &'a mut dyn Write, + slots: &'a [Value], + calls: i64, + changed: bool, +} +impl Env<'_> { + fn flag(&self, n: &str) -> bool { + self.f[if self.changed { "after" } else { "initial" }][n] + .as_bool() + .unwrap() + } + fn event(&mut self, s: &str) -> io::Result<()> { + writeln!(self.out, "{s}")?; + let n = self.calls; + self.calls += 1; + if n == self.f["fail"].as_i64().unwrap() { + return Err(io::Error::other("injected immunity callback failure")); + } + if n == self.f["mutate_at"].as_i64().unwrap() { + self.changed = true; + } + Ok(()) + } + fn query(&mut self, n: &str, k: &str) -> io::Result { + self.event(n)?; + Ok(self.flag(k)) + } +} +impl ImmunityWorld for Env<'_> { + type Error = io::Error; + fn removed(&self) -> bool { + self.f["initial"]["removed"].as_bool().unwrap() + } + fn permanently_invulnerable(&mut self) -> io::Result { + self.query("permanent", "permanent") + } + fn temporarily_invulnerable(&mut self) -> io::Result { + self.query("temporary", "temporary") + } + fn tag(&mut self, t: ImmunityTag) -> io::Result { + let n = match t { + ImmunityTag::BypassesInvulnerability => "bypass", + ImmunityTag::Fire => "fire", + ImmunityTag::Fall => "fall", + ImmunityTag::Drowning => "drowning", + ImmunityTag::Freezing => "freezing", + }; + self.query(&format!("tag {n}"), n) + } + fn creative_source(&mut self) -> io::Result { + self.query("creative", "creative") + } + fn fire_immune(&mut self) -> io::Result { + self.query("fire-immune", "fire_immune") + } + fn fall_immune(&mut self) -> io::Result { + self.query("fall-immune", "fall_immune") + } + fn enchantment_immunity(&mut self) -> io::Result { + for s in self.slots { + self.event(&format!("slot {}", s.as_u64().unwrap()))?; + } + Ok(false) + } + fn damage_rule(&mut self, r: DamageRule) -> io::Result { + let n = match r { + DamageRule::Drowning => "drowning", + DamageRule::Fall => "fall", + DamageRule::Fire => "fire", + DamageRule::Freeze => "freeze", + }; + self.event("rules")?; + self.query(&format!("rule {n}"), &format!("rule_{n}")) + } + fn changing_dimension(&mut self) -> io::Result { + self.query("changing", "changing") + } + fn ender_pearl(&mut self) -> io::Result { + self.query("pearl", "pearl") + } + fn client_loaded(&mut self) -> io::Result { + self.query("loaded", "loaded") + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let slots: Value = serde_json::from_str(&fs::read_to_string(dir.join("slots.json"))?)?; + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut e = Env { + f: &f, + out: &mut out, + slots: slots.as_array().unwrap(), + calls: 0, + changed: false, + }; + let result = match f["mode"].as_str().unwrap() { + "entity" => damage_immunity::entity_invulnerable(&mut e), + "base" => damage_immunity::base_immunity(&mut e), + "living" => damage_immunity::living_immunity(&mut e), + "player" => damage_immunity::player_immunity(&mut e), + "server" => damage_immunity::server_player_immunity(&mut e), + _ => panic!("mode"), + }; + match result { + Ok(v) => writeln!(e.out, "bool {v}\nresult ok")?, + Err(_) => writeln!(e.out, "result error")?, + }; + writeln!(e.out, "queries {} {}", e.calls, e.changed)?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/damage_immunity.rs b/crates/horizon-world/src/damage_immunity.rs new file mode 100644 index 000000000..c71be64da --- /dev/null +++ b/crates/horizon-world/src/damage_immunity.rs @@ -0,0 +1,73 @@ +//! Entity, living and player damage-immunity predicate ordering. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum ImmunityTag { + BypassesInvulnerability, + Fire, + Fall, + Drowning, + Freezing, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum DamageRule { + Drowning, + Fall, + Fire, + Freeze, +} +pub trait ImmunityWorld { + type Error; + fn removed(&self) -> bool; + fn permanently_invulnerable(&mut self) -> Result; + fn temporarily_invulnerable(&mut self) -> Result; + fn invulnerable(&mut self) -> Result { + entity_invulnerable(self) + } + fn tag(&mut self, tag: ImmunityTag) -> Result; + fn creative_source(&mut self) -> Result; + fn fire_immune(&mut self) -> Result; + fn fall_immune(&mut self) -> Result; + fn enchantment_immunity(&mut self) -> Result; + fn damage_rule(&mut self, rule: DamageRule) -> Result; + fn changing_dimension(&mut self) -> Result; + fn ender_pearl(&mut self) -> Result; + fn client_loaded(&mut self) -> Result; +} +pub fn entity_invulnerable(w: &mut W) -> Result { + Ok(w.permanently_invulnerable()? || w.temporarily_invulnerable()?) +} +pub fn base_immunity(w: &mut W) -> Result { + if w.removed() { + return Ok(true); + } + if w.invulnerable()? && !w.tag(ImmunityTag::BypassesInvulnerability)? && !w.creative_source()? { + return Ok(true); + } + if w.tag(ImmunityTag::Fire)? && w.fire_immune()? { + return Ok(true); + } + Ok(w.tag(ImmunityTag::Fall)? && w.fall_immune()?) +} +pub fn living_immunity(w: &mut W) -> Result { + Ok(base_immunity(w)? || w.enchantment_immunity()?) +} +pub fn player_immunity(w: &mut W) -> Result { + if living_immunity(w)? { + return Ok(true); + } + for (tag, rule) in [ + (ImmunityTag::Drowning, DamageRule::Drowning), + (ImmunityTag::Fall, DamageRule::Fall), + (ImmunityTag::Fire, DamageRule::Fire), + (ImmunityTag::Freezing, DamageRule::Freeze), + ] { + if w.tag(tag)? { + return Ok(!w.damage_rule(rule)?); + } + } + Ok(false) +} +pub fn server_player_immunity(w: &mut W) -> Result { + Ok(player_immunity(w)? + || (w.changing_dimension()? && !w.ender_pearl()?) + || !w.client_loaded()?) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 07fa28f3a..ceea22652 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -20,6 +20,7 @@ pub mod collision; pub mod collision_context; pub mod combat_rules; pub mod compression; +pub mod damage_immunity; pub mod damage_reduction; pub mod dynamic_support; pub mod edge_backoff; diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index fa041528f..92f7097b5 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1368,3 +1368,18 @@ Targeted Clippy passes. Native downstream living services retain the controlled fixture scope above; invulnerability internals, rule/source registries, actual team permissions, successful totems, attacker server-player criteria and complete player lifecycle integration remain pending. + + +`damage_immunity` implements entity permanent/temporary invulnerability and base +source immunity, living enchantment dispatch, ordered player damage gamerules, +and server-player dimension-change/client-loading checks. It preserves early +returns and repeated source-tag queries across the inheritance layers. + +`python3 tools/test_damage_immunity_parity.py` compares each native layer on +ServerPlayer receivers, retaining native empty-equipment enchantment iteration. +The [damage immunity report](../benchmarks/rust-damage-immunity-2026-10-07/scoped-parity.json) +records **170,314 matching lines per JAR**, including mixed damage tags, rule +precedence, virtual flag mutations and callback failures. Targeted Clippy passes. +Source/rule queries and virtual flags are controlled; registered source/rule +bindings, nonempty enchantment immunity and full pipeline integration remain +pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDamageImmunityOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDamageImmunityOracle.java new file mode 100644 index 000000000..a70a289c5 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDamageImmunityOracle.java @@ -0,0 +1,35 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.lang.reflect.*;import java.lang.invoke.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.*;import net.minecraft.resources.*;import net.minecraft.tags.*;import net.minecraft.world.entity.*;import net.minecraft.world.entity.player.*;import net.minecraft.world.damagesource.*;import net.minecraft.world.item.*;import net.minecraft.world.level.gamerules.*;import net.minecraft.world.flag.FeatureFlagSet;import net.minecraft.server.level.*;import net.minecraft.server.network.ServerGamePacketListenerImpl; +/** Native immunity layers with empty equipment and controlled source/rule queries. */ +public final class VanillaDamageImmunityOracle { + static final class Stop extends RuntimeException {} + static Object unsafe;static Method allocate; + static T make(Class c)throws Exception{return c.cast(allocate.invoke(unsafe,c));} + static Field field(Class c,String n)throws Exception{var f=c.getDeclaredField(n);f.setAccessible(true);return f;} + static final class Data {JsonObject f;PrintWriter out;int calls;boolean changed;Rules rules; + JsonObject state(){return f.getAsJsonObject(changed?"after":"initial");}boolean flag(String n){return state().get(n).getAsBoolean();}void event(String s){out.println(s);int n=calls++;if(n==f.get("fail").getAsInt())throw new Stop();if(n==f.get("mutate_at").getAsInt())changed=true;}} + static final class Source extends DamageSource {Data d;Source(){super(null);} + @Override public boolean is(TagKey tag){String n=tag==DamageTypeTags.BYPASSES_INVULNERABILITY?"bypass":tag==DamageTypeTags.IS_FIRE?"fire":tag==DamageTypeTags.IS_FALL?"fall":tag==DamageTypeTags.IS_DROWNING?"drowning":tag==DamageTypeTags.IS_FREEZING?"freezing":null;if(n==null)throw new AssertionError();d.event("tag "+n);return d.flag(n);} + @Override public boolean is(ResourceKey k){if(k!=DamageTypes.ENDER_PEARL)throw new AssertionError();d.event("pearl");return d.flag("pearl");} + @Override public boolean isCreativePlayer(){d.event("creative");return d.flag("creative");}} + static final class Rules extends GameRules {Data d;Rules(){super(FeatureFlagSet.of());}@SuppressWarnings("unchecked") @Override public T get(GameRule rule){String n=rule==GameRules.DROWNING_DAMAGE?"drowning":rule==GameRules.FALL_DAMAGE?"fall":rule==GameRules.FIRE_DAMAGE?"fire":rule==GameRules.FREEZE_DAMAGE?"freeze":null;if(n==null)throw new AssertionError();d.event("rule "+n);return (T)Boolean.valueOf(d.flag("rule_"+n));}} + static final class Server extends ServerLevel {Data d;Server(){super(null,null,null,null,null,null,false,0L,List.of(),false);}@Override public GameRules getGameRules(){d.event("rules");return d.rules;}} + static final class Connection extends ServerGamePacketListenerImpl {Data d;Connection(){super(null,null,null,null);}@Override public boolean hasClientLoaded(){d.event("loaded");return d.flag("loaded");}} + static final class Human extends ServerPlayer {Data d;Human(){super(null,null,null,null);} + @Override public boolean isPermanentlyInvulnerable(){d.event("permanent");return d.flag("permanent");} + @Override public boolean isTemporarilyInvulnerable(){d.event("temporary");return d.flag("temporary");} + @Override public boolean fireImmune(){d.event("fire-immune");return d.flag("fire_immune");} + @Override public boolean is(TagKey> tag){if(tag!=EntityTypeTags.FALL_DAMAGE_IMMUNE)throw new AssertionError();d.event("fall-immune");return d.flag("fall_immune");} + @Override public ItemStack getItemBySlot(EquipmentSlot s){d.event("slot "+s.ordinal());return ItemStack.EMPTY;} + @Override public boolean isChangingDimension(){d.event("changing");return d.flag("changing");} + boolean base(DamageSource s){return super.isInvulnerableToBase(s);} + } + public static void main(String[] args)throws Throwable{ + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();Path dir=Path.of(args[1]);if(args[0].equals("export")){var slots=new JsonArray();for(var s:EquipmentSlot.VALUES)slots.add(s.ordinal());Files.writeString(dir.resolve("slots.json"),slots.toString());return;} + var u=Class.forName("sun.misc.Unsafe");unsafe=field(u,"theUnsafe").get(null);allocate=u.getMethod("allocateInstance",Class.class);var handles=new HashMap();for(var entry:Map.of("living",LivingEntity.class,"player",Player.class,"server",ServerPlayer.class).entrySet()){var type=entry.getValue();var lookup=MethodHandles.privateLookupIn(type,MethodHandles.lookup());handles.put(entry.getKey(),lookup.findSpecial(type,"isInvulnerableTo",MethodType.methodType(boolean.class,ServerLevel.class,DamageSource.class),type).asType(MethodType.methodType(boolean.class,Human.class,ServerLevel.class,DamageSource.class)));} + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var d=new Data();d.f=JsonParser.parseString(line).getAsJsonObject();d.out=out;d.rules=make(Rules.class);d.rules.d=d;var actor=make(Human.class);actor.d=d;var connection=make(Connection.class);connection.d=d;actor.connection=connection;var level=make(Server.class);level.d=d;var source=make(Source.class);source.d=d;if(d.flag("removed"))field(Entity.class,"removalReason").set(actor,Entity.RemovalReason.DISCARDED); + try{String mode=d.f.get("mode").getAsString();boolean v=switch(mode){case "entity"->actor.isInvulnerable();case "base"->actor.base(source);default->(boolean)handles.get(mode).invokeExact(actor,(ServerLevel)level,(DamageSource)source);};out.println("bool "+v);out.println("result ok");}catch(Stop e){out.println("result error");}out.println("queries "+d.calls+" "+d.changed); + }} + } +} diff --git a/tools/test_damage_immunity_parity.py b/tools/test_damage_immunity_parity.py new file mode 100644 index 000000000..057d7a4ad --- /dev/null +++ b/tools/test_damage_immunity_parity.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python3 +"""Compare native entity/living/player damage immunity with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + names=['removed','permanent','temporary','bypass','creative','fire','fire_immune','fall','fall_immune','drowning','freezing','rule_drowning','rule_fall','rule_fire','rule_freeze','changing','pearl','loaded'] + modes=['entity','base','living','player','server'] + def state(**kw): + s={n:False for n in names};s.update(rule_drowning=True,rule_fall=True,rule_fire=True,rule_freeze=True,loaded=True);s.update(kw);return s + def row(s,mode='server',**kw): + f=dict(initial=s,after=s,mode=mode,fail=-1,mutate_at=-1);f.update(kw);return f + for mask in range(512): + s=state(**{n:bool(mask&(1< Date: Wed, 7 Oct 2026 05:36:49 +0200 Subject: [PATCH 120/253] Compose server-player hurt gates with live health and hunger storage --- .../scoped-parity.json | 264 +++++++++ .../examples/server_player_combat_fixture.rs | 522 ++++++++++++++++++ crates/horizon-world/src/lib.rs | 1 + .../horizon-world/src/server_player_combat.rs | 301 ++++++++++ docs/collision-geometry.md | 19 + docs/rust-parity.md | 22 +- .../VanillaServerPlayerCombatOracle.java | 107 ++++ tools/test_server_player_combat_parity.py | 82 +++ 8 files changed, 1309 insertions(+), 9 deletions(-) create mode 100644 benchmarks/rust-server-player-combat-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/server_player_combat_fixture.rs create mode 100644 crates/horizon-world/src/server_player_combat.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaServerPlayerCombatOracle.java create mode 100644 tools/test_server_player_combat_parity.py diff --git a/benchmarks/rust-server-player-combat-2026-10-07/scoped-parity.json b/benchmarks/rust-server-player-combat-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..73bea6731 --- /dev/null +++ b/benchmarks/rust-server-player-combat-2026-10-07/scoped-parity.json @@ -0,0 +1,264 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 7465, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaServerPlayerCombatOracle.java": "f3a850b7c42ffa5b38a8a526290e4655da2c11220989acffd3a7808325fb8b7e", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityAttributeOracle.java": "2ad3190a9798ab54bd12e88573028d0ca6a204e2f8a92018aae98b22335213bf", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerHealthOracle.java": "5d6dc93c0140e2b2f953fba7290721079d5a607fa81b051e2ac1e4742ab606f2", + "tools/test_server_player_combat_parity.py": "45c75e5f82049081a14af57106e24762ef664124635c8cccc53e66cf08539dde", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/test_player_hurt_parity.py": "3164b8644664fcd46903e801ea70d1bb866e07e7112dc94570161831644bc84d", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_immunity.rs": "fd39c41124d694e755cf7faadcf93c636df4042c78ec345092a856b5f952dbcf", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "06065c36a17442ea9e5369fd7eeada9b4c2f823863c0590d917b20693e97fdea", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "711e78438ece3e94eb156c0e64cfea06a63f79640a7a81e396ae2c1b277cdce6", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_hurt.rs": "844239ad7d15c39629bb3cfc06ebae6d1cff20b7627468f26e0ee8dff3abdcb8", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_hurt.rs": "99c9bbd8587ec2dc287806049897b8034d2f5349ad47fc497b70d54148844a36", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/server_player_combat.rs": "b32663be1f83167735fd50cea9851b0e0e3c147e6a2be2b5ab40bf268ddbc01a", + "crates/horizon-world/src/server_player_damage.rs": "c4fc29eecf2bf401680d1754bef06797a5e4608ab53c5b52e0dd4996f859dbfe", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "f417aab280331ddd6f0ca265a12c0130c78b9924f407c7e07f198140501e6010", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/server_player_combat_fixture.rs": "47ee61368412fd1602ae4eb3441315f57bf846fff1fc1caea384a6db9ec70ddd" + }, + "fixtures_sha256": { + ".local/rust-server-player-combat-parity/inputs.txt": "f3b1edb606a64067457fdc1e9420f6c893c3928cad7f983cd0f7a92c1cdee541", + ".local/rust-server-player-combat-parity/catalog.json": "d1e488e4f432888beb9f643904c8bca242d1e2093f53e23e07da305d70cf7106", + ".local/rust-server-player-combat-parity/ids.json": "f7d6037166d966e2714b01cff5626f0cc0a02ce883885ec791c93e977afde0e6", + ".local/rust-server-player-combat-parity/slots.json": "29101ebf1ead685029508789eee51c4d4fff65524064d8e32a48efded7036982", + ".local/rust-server-player-combat-parity/head.json": "ef2d127de37b942baad06145e54b0c619a1f22327b2ebbcfbec78f5564afe39d" + }, + "rust_output_sha256": "fe33d2fb5cd941b3c57138518bb349f06922ace7367b720bb6ee3ffaff7a0a0b", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "fe33d2fb5cd941b3c57138518bb349f06922ace7367b720bb6ee3ffaff7a0a0b", + "matched_output_lines": 561528 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "fe33d2fb5cd941b3c57138518bb349f06922ace7367b720bb6ee3ffaff7a0a0b", + "matched_output_lines": 561528 + } + ], + "scope": "Actual ServerPlayer outer hurt through Player/LivingEntity gates and actual Player inner damage, native armor/resistance reduction, registered modified attributes, synchronized health/absorption and FoodData exhaustion. Repeated hits, cooldown/state writes, death rejection, callbacks and numeric edges. Invulnerability predicate, blocking amount, durability, effects, PvP permission, attribution, knockback, death services and criterion listeners remain controlled; enchanted items, registered sources and complete entity/game lifecycle remain pending." +} diff --git a/crates/horizon-world/examples/server_player_combat_fixture.rs b/crates/horizon-world/examples/server_player_combat_fixture.rs new file mode 100644 index 000000000..25c07da32 --- /dev/null +++ b/crates/horizon-world/examples/server_player_combat_fixture.rs @@ -0,0 +1,522 @@ +use horizon_world::living_hurt::{HurtState, HurtTag, HurtWorld}; +use horizon_world::{ + attributes::{ + Modifier, Operation, + entity::{Catalog, EntityAttributes}, + }, + combat_rules::ArmorWorld, + damage_reduction::Bypass, + food::FoodData, + living_damage::DamageStat, + player_health::PlayerFloatIds, + server_player_combat::{CombatEnvironment, ServerPlayerCombat}, + server_player_damage::ServerDamageEnvironment, + synced_floats::{FloatValue, Observer, SyncedFloats}, +}; +use horizon_world::{ + food::Difficulty, + player_hurt::{CausingEntity, PlayerHurtWorld, ServerPlayerHurtWorld}, +}; +use serde_json::Value; +use std::sync::Arc; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn single(v: &Value) -> f32 { + f32::from_bits(u32::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn bits(v: f32) -> u32 { + if v.is_nan() { + f32::NAN.to_bits() + } else { + v.to_bits() + } +} +fn state(s: &HurtState<()>) -> String { + format!( + "{} {} {:08x} {} {} {} {}", + s.no_action_time, + s.cooldown, + bits(s.last_hurt), + s.hurt_duration, + s.hurt_time, + s.last_source.is_some(), + s.last_stamp + ) +} +struct Env<'a> { + out: &'a mut dyn Write, + op: &'a Value, + calls: i64, + hit: bool, + recorded: f32, + player: bool, + difficulty_calls: usize, + slots: &'a [Value], + head: u64, + dead: bool, +} +impl Env<'_> { + fn flag(&self, n: &str) -> bool { + self.op[n].as_bool().unwrap() + } + fn event(&mut self, s: &str) -> io::Result<()> { + writeln!(self.out, "{s}")?; + let n = self.calls; + self.calls += 1; + if n == self.op["fail"].as_i64().unwrap() { + Err(io::Error::other("injected hurt callback failure")) + } else { + Ok(()) + } + } +} +impl HurtWorld for Env<'_> { + type Error = io::Error; + type Source = (); + type UseItem = bool; + type Blocking = (); + type Sound = (); + fn source(&self) {} + fn is_server_player(&self) -> bool { + self.player + } + fn invulnerable(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("invulnerable")?; + Ok(self.flag("invulnerable")) + } + fn fire_resistance(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("fire-resistance")?; + Ok(self.flag("fire_resistance")) + } + fn sleeping(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("sleeping")?; + Ok(self.flag("sleeping")) + } + fn freeze_hurts_extra(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("freeze-extra")?; + Ok(self.flag("freeze_extra")) + } + fn stop_sleeping(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("wake") + } + fn resolve_mob(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("resolve-mob") + } + fn resolve_player(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("resolve-player") + } + fn broadcast_damage(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("broadcast") + } + fn mark_hurt(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("mark") + } + fn secondary_sound(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("thorns") + } + fn die(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("die")?; + self.dead = true; + Ok(()) + } + fn hurt_sound(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("hurt-sound") + } + + fn dead_or_dying(&mut self, _: &mut HurtState<()>) -> io::Result { + panic!("combat binding supplies stored health/death predicate") + } + fn tag(&mut self, _: &mut HurtState<()>, tag: HurtTag) -> io::Result { + let n = match tag { + HurtTag::Fire => "fire", + HurtTag::Freezing => "freezing", + HurtTag::DamagesHelmet => "damages_helmet", + HurtTag::BypassesCooldown => "bypasses_cooldown", + HurtTag::NoImpact => "no_impact", + HurtTag::NoKnockback => "no_knockback", + }; + self.event(&format!("tag {n}"))?; + Ok(self.flag(n)) + } + fn use_item(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("use-item")?; + Ok(self.flag("component")) + } + fn apply_blocking(&mut self, _: &mut HurtState<()>, v: f32) -> io::Result { + self.event(&format!("blocking {:08x}", bits(v)))?; + Ok(single(&self.op["blocked"])) + } + fn helmet_empty(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event(&format!("slot {}", self.head))?; + Ok(!self.flag("helmet")) + } + fn hurt_helmet(&mut self, _: &mut HurtState<()>, v: f32) -> io::Result<()> { + self.event(&format!("hurt-helmet {:08x}", bits(v))) + } + fn actually_hurt(&mut self, _s: &mut HurtState<()>, _v: f32) -> io::Result<()> { + panic!("combat binding supplies actual inner damage") + } + fn blocking_component(&mut self, v: bool) -> Option<()> { + v.then_some(()) + } + fn on_blocked(&mut self, _: &mut HurtState<()>, _: ()) -> io::Result<()> { + Ok(()) + } + fn knockback(&mut self, _: &mut HurtState<()>, v: f32, b: bool) -> io::Result<()> { + self.event(&format!("knockback {:08x} {b}", bits(v))) + } + fn death_protection(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("tag bypasses_invulnerability")?; + if !self.flag("bypasses_invulnerability") { + self.event("hand 0")?; + self.event("hand 1")?; + } + Ok(false) + } + fn death_sound(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("death-sound") + } + fn make_sound(&mut self, _: &mut HurtState<()>, _: ()) -> io::Result<()> { + self.event("make-sound") + } + fn game_time(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("level")?; + self.event("game-time")?; + Ok(self.op["game_time"].as_i64().unwrap()) + } + fn effects_on_hurt(&mut self, _: &mut HurtState<()>, v: f32) -> io::Result<()> { + self.event("effects")?; + for i in 0..self.op["effects"].as_u64().unwrap() { + self.event(&format!("effect {i} {:08x}", bits(v)))?; + } + Ok(()) + } + fn player_hurt_criterion( + &mut self, + _: &mut HurtState<()>, + _: f32, + _: f32, + _: bool, + ) -> io::Result<()> { + self.event("criterion") + } + fn award_blocked(&mut self, _: &mut HurtState<()>, v: i32) -> io::Result<()> { + self.event(&format!("blocked-stat {v}")) + } + fn attacker_criterion( + &mut self, + _: &mut HurtState<()>, + _: f32, + _: f32, + _: bool, + ) -> io::Result<()> { + self.event("attacker") + } +} +impl PlayerHurtWorld for Env<'_> { + fn ability_invulnerable(&self) -> bool { + self.flag("ability_invulnerable") + } + fn bypasses_invulnerability(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("tag bypasses_invulnerability")?; + Ok(self.flag("bypasses_invulnerability")) + } + fn remove_shoulders(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("shoulders") + } + fn scales_with_difficulty(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("scales")?; + Ok(self.flag("scales")) + } + fn difficulty(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("difficulty")?; + let v = self.op["difficulties"][self.difficulty_calls] + .as_u64() + .unwrap(); + self.difficulty_calls += 1; + Ok([ + Difficulty::Peaceful, + Difficulty::Easy, + Difficulty::Normal, + Difficulty::Hard, + ][v as usize]) + } +} +impl ServerPlayerHurtWorld for Env<'_> { + type Player = (); + type Arrow = (); + fn causing_entity(&mut self, _: &mut HurtState<()>) -> io::Result> { + self.event("attacker")?; + Ok(match self.op["attacker"].as_u64().unwrap() { + 0 | 1 => CausingEntity::Other, + 2 => CausingEntity::Player(()), + 3 => CausingEntity::Arrow(()), + _ => panic!("attacker"), + }) + } + fn arrow_player_owner(&mut self, _: &mut HurtState<()>, _: ()) -> io::Result> { + self.event("owner")?; + Ok((self.op["owner"] == 1).then_some(())) + } + fn can_harm_player(&mut self, _: &mut HurtState<()>, _: ()) -> io::Result { + self.event("can-harm")?; + Ok(self.flag("can_harm")) + } +} +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn values(v: Option<&[FloatValue]>) -> String { + match v { + None => "none".into(), + Some([]) => "empty".into(), + Some(v) => v + .iter() + .map(|v| format!("{}:{:08x}", v.id, bits(v.value))) + .collect::>() + .join(","), + } +} +impl Observer for Env<'_> { + type Error = io::Error; + fn updated(&mut self, data: &mut SyncedFloats, id: u8) -> io::Result<()> { + self.event(&format!( + "updated {id} {:08x} {}", + bits(data.get(id).unwrap()), + data.is_dirty() + ))?; + if self.flag("pack_callback") { + writeln!( + self.out, + "callback-pack {}", + values(data.take_dirty().as_deref()) + )?; + } + Ok(()) + } +} +impl ArmorWorld for Env<'_> { + type Error = io::Error; + type Weapon = (); + type ServerLevel = (); + fn weapon(&mut self) -> io::Result> { + self.event("weapon")?; + Ok(self.flag("weapon").then_some(())) + } + fn server_level(&mut self) -> io::Result> { + self.event("level")?; + Ok(Some(())) + } + fn modify_armor_effectiveness(&mut self, _: (), _: (), v: f32) -> io::Result { + Ok(v) + } +} +impl ServerDamageEnvironment for Env<'_> { + type Attacker = (); + fn invulnerable(&mut self) -> io::Result { + self.event("invulnerable")?; + Ok(self.flag("invulnerable")) + } + fn bypasses(&mut self, b: Bypass) -> io::Result { + let n = match b { + Bypass::Armor => "armor", + Bypass::Effects => "effects", + Bypass::Resistance => "resistance", + Bypass::Enchantments => "enchantments", + }; + self.event(&format!("tag bypass_{n}"))?; + Ok(self.flag(&format!("bypass_{n}"))) + } + fn hurt_armor(&mut self, a: &mut EntityAttributes, v: f32) -> io::Result<()> { + self.event(&format!("hurt-armor {:08x}", bits(v)))?; + if self.flag("break_armor") { + let id = a.catalog().id("minecraft:armor").unwrap(); + a.edit(id, |a, o| { + a.set_base_value(number(&self.op["armor_after"]), o) + }) + .unwrap() + .unwrap(); + } + Ok(()) + } + fn has_resistance(&mut self) -> io::Result { + self.event("has-resistance")?; + Ok(self.flag("resistance")) + } + fn resistance_amplifier(&mut self) -> io::Result { + self.event("effect")?; + Ok(self.op["amplifier"].as_i64().unwrap() as i32) + } + fn award_resisted(&mut self, v: i32) -> io::Result<()> { + self.event(&format!("stat resisted {v}")) + } + fn attacker(&mut self) -> io::Result> { + panic!("player damage must not query attacker") + } + fn award_dealt_resisted(&mut self, _: i32) -> io::Result<()> { + panic!("player damage must award own resisted stat") + } + fn damage_protection(&mut self, _: ()) -> io::Result { + for slot in self.slots { + self.event(&format!("slot {}", slot.as_u64().unwrap()))?; + } + Ok(0.0) + } + fn award_self(&mut self, s: DamageStat, v: i32) -> io::Result<()> { + let n = match s { + DamageStat::Absorbed => "absorbed", + DamageStat::Taken => "taken", + DamageStat::DealtAbsorbed => panic!("attacker stat"), + }; + self.event(&format!("stat {n} {v}")) + } + fn award_attacker(&mut self, _: (), _: DamageStat, _: i32) -> io::Result<()> { + panic!("attacker stat") + } + fn source_food_exhaustion(&mut self) -> io::Result { + self.event("food-exhaustion")?; + Ok(single(&self.op["food_exhaustion"])) + } + fn ability_invulnerable(&self) -> bool { + self.flag("ability_invulnerable") + } + fn level_is_client(&mut self) -> io::Result { + self.event("level")?; + self.event("client")?; + Ok(self.flag("client")) + } + fn record_damage(&mut self, v: f32) -> io::Result<()> { + self.event("tracker")?; + self.event(&format!("record {:08x}", bits(v)))?; + self.recorded = v; + self.hit = true; + Ok(()) + } + fn damage_event(&mut self) -> io::Result<()> { + self.event("damage-event") + } +} +impl CombatEnvironment for Env<'_> { + fn dead_flag(&self) -> bool { + self.dead + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let ids: Value = serde_json::from_str(&fs::read_to_string(dir.join("ids.json"))?)?; + let ids = PlayerFloatIds { + health: ids["health"].as_u64().unwrap() as u8, + absorption: ids["absorption"].as_u64().unwrap() as u8, + }; + let slots: Value = serde_json::from_str(&fs::read_to_string(dir.join("slots.json"))?)?; + let head: u64 = serde_json::from_str(&fs::read_to_string(dir.join("head.json"))?)?; + let catalog = Arc::new(Catalog::from_json(&serde_json::from_str( + &fs::read_to_string(dir.join("catalog.json"))?, + )?)?); + let keys = [ + "minecraft:armor", + "minecraft:armor_toughness", + "minecraft:max_health", + "minecraft:max_absorption", + ] + .map(|k| catalog.id(k).unwrap()); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut attributes = catalog.create("minecraft:player").unwrap(); + for (i, key) in keys.iter().enumerate() { + let a = &f["attributes"][i]; + let m = Modifier::new( + "horizon:test", + number(&a["amount"]), + Operation::ALL[a["operation"].as_u64().unwrap() as usize], + )?; + attributes + .edit(*key, |a, o| { + a.set_base_value(number(&f["attributes"][i]["base"]), o)?; + a.add_transient(m, o) + }) + .unwrap() + .unwrap(); + } + let mut data = SyncedFloats::new(&[ + FloatValue { + id: ids.health, + value: single(&f["health"]), + }, + FloatValue { + id: ids.absorption, + value: single(&f["absorption"]), + }, + ])?; + let mut food = FoodData { + exhaustion: single(&f["exhaustion"]), + ..FoodData::default() + }; + let mut recorded = 0.0; + let mut dead = f["dead"].as_bool().unwrap(); + let mut s = HurtState { + no_action_time: f["no_action"].as_i64().unwrap() as i32, + cooldown: f["cooldown"].as_i64().unwrap() as i32, + last_hurt: single(&f["last_hurt"]), + hurt_duration: f["duration"].as_i64().unwrap() as i32, + hurt_time: f["time"].as_i64().unwrap() as i32, + last_source: f["source"].as_bool().unwrap().then_some(()), + last_stamp: f["stamp"].as_i64().unwrap(), + }; + for op in f["ops"].as_array().unwrap() { + if op["reset_cooldown"].as_bool().unwrap_or(false) { + s.cooldown = 0; + } + let mut e = Env { + out: &mut out, + op, + calls: 0, + hit: false, + recorded, + player: true, + difficulty_calls: 0, + slots: slots.as_array().unwrap(), + head, + dead, + }; + let result = + ServerPlayerCombat::new(&mut attributes, &mut data, &mut food, ids, &mut e)? + .hurt(&mut s, single(&op["damage"])); + match result { + Ok(v) => writeln!(e.out, "bool {v}\nresult ok")?, + Err(_) => writeln!(e.out, "result error")?, + }; + recorded = e.recorded; + dead = e.dead; + writeln!( + e.out, + "state {} {:08x} {} {}", + state(&s), + bits(recorded), + e.hit, + e.calls + )?; + writeln!( + e.out, + "storage {:08x} {:08x} {:08x} {} {} {} {}", + bits(data.get(ids.health).unwrap()), + bits(data.get(ids.absorption).unwrap()), + bits(food.exhaustion), + data.is_dirty(), + data.item_dirty(ids.health).unwrap(), + data.item_dirty(ids.absorption).unwrap(), + dead + )?; + if e.flag("pack") { + writeln!(e.out, "packed {}", values(data.take_dirty().as_deref()))?; + } + writeln!(e.out, "defaults {}", values(data.non_default().as_deref()))?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index ceea22652..6a3c561e0 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -68,6 +68,7 @@ pub mod registry_collision_scan; pub mod registry_fall_ray; pub mod registry_fluid; pub mod retrogen; +pub mod server_player_combat; pub mod server_player_damage; pub mod suffocation; pub mod swimming; diff --git a/crates/horizon-world/src/server_player_combat.rs b/crates/horizon-world/src/server_player_combat.rs new file mode 100644 index 000000000..fda98b07f --- /dev/null +++ b/crates/horizon-world/src/server_player_combat.rs @@ -0,0 +1,301 @@ +//! Server-player outer hurt composed with registered attributes and player storage. +use crate::{ + attributes::entity::EntityAttributes, + combat_rules::ArmorWorld, + food::{Difficulty, FoodData}, + living_hurt::{HurtState, HurtTag, HurtWorld}, + player_health::PlayerFloatIds, + player_hurt::{ + CausingEntity, PlayerHurtWorld, ServerPlayerHurtWorld, server_player_hurt_server, + }, + server_player_damage::{ServerDamageEnvironment, ServerDamageError, ServerPlayerDamage}, + synced_floats::{DataError, SyncedFloats}, +}; +use std::io; +type Error = ::Error; +pub trait CombatEnvironment: + ServerDamageEnvironment + ServerPlayerHurtWorld::Error> +{ + /// Direct death flag, read only after health fails the native <= zero test. + fn dead_flag(&self) -> bool; +} +pub struct ServerPlayerCombat<'a, E> { + attributes: &'a mut EntityAttributes, + data: &'a mut SyncedFloats, + food: &'a mut FoodData, + ids: PlayerFloatIds, + environment: &'a mut E, +} +impl<'a, E: CombatEnvironment> ServerPlayerCombat<'a, E> { + pub fn new( + attributes: &'a mut EntityAttributes, + data: &'a mut SyncedFloats, + food: &'a mut FoodData, + ids: PlayerFloatIds, + environment: &'a mut E, + ) -> io::Result { + ServerPlayerDamage::new(attributes, data, food, ids, environment)?; + Ok(Self { + attributes, + data, + food, + ids, + environment, + }) + } + pub fn hurt( + &mut self, + state: &mut HurtState, + damage: f32, + ) -> Result>> { + server_player_hurt_server(state, self, damage) + } +} +impl HurtWorld for ServerPlayerCombat<'_, E> { + type Error = ServerDamageError>; + type Source = E::Source; + type UseItem = E::UseItem; + type Blocking = E::Blocking; + type Sound = E::Sound; + fn source(&self) -> Self::Source { + self.environment.source() + } + fn is_server_player(&self) -> bool { + true + } + fn dead_or_dying(&mut self, _: &mut HurtState) -> Result { + let health = self + .data + .get(self.ids.health) + .map_err(|id| ServerDamageError::Data(DataError::UnknownId(id)))?; + Ok(health <= 0.0 || self.environment.dead_flag()) + } + fn actually_hurt( + &mut self, + _: &mut HurtState, + damage: f32, + ) -> Result<(), Self::Error> { + ServerPlayerDamage::new( + self.attributes, + self.data, + self.food, + self.ids, + self.environment, + ) + .expect("validated immutable player schema") + .apply(damage) + } + fn blocking_component(&mut self, item: Self::UseItem) -> Option { + self.environment.blocking_component(item) + } + fn invulnerable(&mut self, state: &mut HurtState) -> Result { + HurtWorld::invulnerable(self.environment, state).map_err(ServerDamageError::Environment) + } + fn tag( + &mut self, + state: &mut HurtState, + tag: HurtTag, + ) -> Result { + HurtWorld::tag(self.environment, state, tag).map_err(ServerDamageError::Environment) + } + fn fire_resistance( + &mut self, + state: &mut HurtState, + ) -> Result { + HurtWorld::fire_resistance(self.environment, state).map_err(ServerDamageError::Environment) + } + fn sleeping(&mut self, state: &mut HurtState) -> Result { + HurtWorld::sleeping(self.environment, state).map_err(ServerDamageError::Environment) + } + fn stop_sleeping(&mut self, state: &mut HurtState) -> Result<(), Self::Error> { + HurtWorld::stop_sleeping(self.environment, state).map_err(ServerDamageError::Environment) + } + fn use_item( + &mut self, + state: &mut HurtState, + ) -> Result { + HurtWorld::use_item(self.environment, state).map_err(ServerDamageError::Environment) + } + fn apply_blocking( + &mut self, + state: &mut HurtState, + damage: f32, + ) -> Result { + HurtWorld::apply_blocking(self.environment, state, damage) + .map_err(ServerDamageError::Environment) + } + fn freeze_hurts_extra( + &mut self, + state: &mut HurtState, + ) -> Result { + HurtWorld::freeze_hurts_extra(self.environment, state) + .map_err(ServerDamageError::Environment) + } + fn helmet_empty(&mut self, state: &mut HurtState) -> Result { + HurtWorld::helmet_empty(self.environment, state).map_err(ServerDamageError::Environment) + } + fn hurt_helmet( + &mut self, + state: &mut HurtState, + damage: f32, + ) -> Result<(), Self::Error> { + HurtWorld::hurt_helmet(self.environment, state, damage) + .map_err(ServerDamageError::Environment) + } + fn resolve_mob(&mut self, state: &mut HurtState) -> Result<(), Self::Error> { + HurtWorld::resolve_mob(self.environment, state).map_err(ServerDamageError::Environment) + } + fn resolve_player(&mut self, state: &mut HurtState) -> Result<(), Self::Error> { + HurtWorld::resolve_player(self.environment, state).map_err(ServerDamageError::Environment) + } + fn on_blocked( + &mut self, + state: &mut HurtState, + block: Self::Blocking, + ) -> Result<(), Self::Error> { + HurtWorld::on_blocked(self.environment, state, block) + .map_err(ServerDamageError::Environment) + } + fn broadcast_damage(&mut self, state: &mut HurtState) -> Result<(), Self::Error> { + HurtWorld::broadcast_damage(self.environment, state).map_err(ServerDamageError::Environment) + } + fn mark_hurt(&mut self, state: &mut HurtState) -> Result<(), Self::Error> { + HurtWorld::mark_hurt(self.environment, state).map_err(ServerDamageError::Environment) + } + fn knockback( + &mut self, + state: &mut HurtState, + damage: f32, + blocked: bool, + ) -> Result<(), Self::Error> { + HurtWorld::knockback(self.environment, state, damage, blocked) + .map_err(ServerDamageError::Environment) + } + fn death_protection( + &mut self, + state: &mut HurtState, + ) -> Result { + HurtWorld::death_protection(self.environment, state).map_err(ServerDamageError::Environment) + } + fn death_sound( + &mut self, + state: &mut HurtState, + ) -> Result { + HurtWorld::death_sound(self.environment, state).map_err(ServerDamageError::Environment) + } + fn make_sound( + &mut self, + state: &mut HurtState, + sound: Self::Sound, + ) -> Result<(), Self::Error> { + HurtWorld::make_sound(self.environment, state, sound) + .map_err(ServerDamageError::Environment) + } + fn secondary_sound(&mut self, state: &mut HurtState) -> Result<(), Self::Error> { + HurtWorld::secondary_sound(self.environment, state).map_err(ServerDamageError::Environment) + } + fn die(&mut self, state: &mut HurtState) -> Result<(), Self::Error> { + HurtWorld::die(self.environment, state).map_err(ServerDamageError::Environment) + } + fn hurt_sound(&mut self, state: &mut HurtState) -> Result<(), Self::Error> { + HurtWorld::hurt_sound(self.environment, state).map_err(ServerDamageError::Environment) + } + fn game_time(&mut self, state: &mut HurtState) -> Result { + HurtWorld::game_time(self.environment, state).map_err(ServerDamageError::Environment) + } + fn effects_on_hurt( + &mut self, + state: &mut HurtState, + damage: f32, + ) -> Result<(), Self::Error> { + HurtWorld::effects_on_hurt(self.environment, state, damage) + .map_err(ServerDamageError::Environment) + } + fn player_hurt_criterion( + &mut self, + state: &mut HurtState, + original: f32, + damage: f32, + blocked: bool, + ) -> Result<(), Self::Error> { + HurtWorld::player_hurt_criterion(self.environment, state, original, damage, blocked) + .map_err(ServerDamageError::Environment) + } + fn award_blocked( + &mut self, + state: &mut HurtState, + amount: i32, + ) -> Result<(), Self::Error> { + HurtWorld::award_blocked(self.environment, state, amount) + .map_err(ServerDamageError::Environment) + } + fn attacker_criterion( + &mut self, + state: &mut HurtState, + original: f32, + damage: f32, + blocked: bool, + ) -> Result<(), Self::Error> { + HurtWorld::attacker_criterion(self.environment, state, original, damage, blocked) + .map_err(ServerDamageError::Environment) + } +} +impl PlayerHurtWorld for ServerPlayerCombat<'_, E> { + fn ability_invulnerable(&self) -> bool { + ServerDamageEnvironment::ability_invulnerable(self.environment) + } + fn bypasses_invulnerability( + &mut self, + state: &mut HurtState, + ) -> Result { + PlayerHurtWorld::bypasses_invulnerability(self.environment, state) + .map_err(ServerDamageError::Environment) + } + fn remove_shoulders(&mut self, state: &mut HurtState) -> Result<(), Self::Error> { + PlayerHurtWorld::remove_shoulders(self.environment, state) + .map_err(ServerDamageError::Environment) + } + fn scales_with_difficulty( + &mut self, + state: &mut HurtState, + ) -> Result { + PlayerHurtWorld::scales_with_difficulty(self.environment, state) + .map_err(ServerDamageError::Environment) + } + fn difficulty( + &mut self, + state: &mut HurtState, + ) -> Result { + PlayerHurtWorld::difficulty(self.environment, state).map_err(ServerDamageError::Environment) + } +} +impl ServerPlayerHurtWorld for ServerPlayerCombat<'_, E> { + type Player = E::Player; + type Arrow = E::Arrow; + fn causing_entity( + &mut self, + state: &mut HurtState, + ) -> Result, Self::Error> { + self.environment + .causing_entity(state) + .map_err(ServerDamageError::Environment) + } + fn arrow_player_owner( + &mut self, + state: &mut HurtState, + arrow: Self::Arrow, + ) -> Result, Self::Error> { + self.environment + .arrow_player_owner(state, arrow) + .map_err(ServerDamageError::Environment) + } + fn can_harm_player( + &mut self, + state: &mut HurtState, + player: Self::Player, + ) -> Result { + self.environment + .can_harm_player(state, player) + .map_err(ServerDamageError::Environment) + } +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 92f7097b5..2b8716897 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1383,3 +1383,22 @@ precedence, virtual flag mutations and callback failures. Targeted Clippy passes Source/rule queries and virtual flags are controlled; registered source/rule bindings, nonempty enchantment immunity and full pipeline integration remain pending. + + +`server_player_combat` binds server/player/living outer hurt to the checked +registered-attribute, synchronized-health/absorption and hunger inner damage +path. Dead-or-dying reads live health and the direct death flag; the outer +cooldown/animation state is shared across hits. PvP, blocking, effects, +attribution, knockback, death and other world services remain explicit. + +`python3 tools/test_server_player_combat_parity.py` compares the actual native +ServerPlayer hurt chain through actual inner reduction and player storage. The +[server-player combat report](../benchmarks/rust-server-player-combat-2026-10-07/scoped-parity.json) +records **561,528 matching lines per JAR**, including repeated hits, death +rejection, modified attributes, cooldown differences, packet drains, numeric +edges and failures after partial writes. Some fixtures explicitly reset cooldown +between hits; they do not claim entity-tick coverage. Targeted Clippy passes. +Invulnerability answers, blocking amounts, armor-durability callbacks, effects, +PvP permission, combat/event/knockback/death services and criterion listeners are +controlled. Enchanted items, registered sources, actual lifecycle services and +playable integration remain pending. diff --git a/docs/rust-parity.md b/docs/rust-parity.md index 9a85a7658..12f2e8e8c 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -9,7 +9,10 @@ complete game server or gameplay simulation. The Rust workspace implements core arithmetic/random streams, world data and resident sections, scheduled tick ordering, geometry, contained fluid states, noise/density evaluation, biome and terrain generation kernels, material rules, -and parts of feature placement and decoration. All pinned block-survival +and parts of feature placement and decoration. Movement/fluid interactions, +registered attributes, hunger storage/ticks, synchronized player health and +absorption, damage reduction and outer hurt gates have scoped native comparisons. +These kernels still need complete entity/world lifecycle bindings. All pinned block-survival families now have native differential coverage. Full simulation callbacks, complete chunk generation, entity behavior, networking, rendering and playable integration remain unfinished. The linked subsystem documents and hashed reports @@ -320,21 +323,22 @@ encoding plus malformed-property fallback. Block gameplay remains pending. | Registries, block states, items and data components | Block-state IDs, property descriptors and defaults imported and checked; items/components absent | Registry lifecycle, remaining registries, data components and behavior | | World/chunk storage, NBT and region files | Bounded NBT, four codecs, region export, saved and resident section palettes | Generated-save integration, entity/POI integration, upgrades, live saves and crash recovery | | Terrain, biomes, structures and lighting | Seeded noise/density graphs, bundled registry and router loading, climate sampling/search and imported-table multi-noise biome resolution, aquifer decisions, noise-stage filling and surface-stage application implemented; complete terrain generation absent | Remaining terrain/biome codecs and world fields, seeded generated-chunk comparisons, biome/feature/structure placement, chunk lifecycle and light propagation | -| Tick scheduling, blocks, fluids and redstone | Scheduled queues, eligibility, callback mutations and saved tick data implemented; block/fluid/redstone behavior absent | Actual block/fluid state transitions, neighbor updates, world integration and end-to-end ordered traces | -| Entities, AI, movement and combat | Bounding-box and voxel collision geometry implemented; live entities absent | Context-dependent collision/physics and tick traces, spawning, pathfinding, damage, equipment and lifecycle | -| Survival, inventory, crafting and progression | Not implemented | Recipes, item transitions, hunger/health, effects, experience and advancement behavior | +| Tick scheduling, blocks, fluids and redstone | Scheduled queues and saved ticks, block survival families, fluid geometry/flow and entity immersion kernels checked; complete live block/fluid/redstone simulation absent | Actual block/fluid state transitions, neighbor updates, world integration and end-to-end ordered traces | +| Entities, AI, movement and combat | Collision, movement/fluid kernels, registered attributes, damage reduction, hurt gates and immunity predicates checked; complete live entity simulation absent | Context-dependent collision/physics and tick traces, spawning, pathfinding, damage, equipment and lifecycle | +| Survival, inventory, crafting and progression | Hunger ticks/storage and synchronized health/absorption implemented and checked; inventory/crafting/progression absent | Recipes, item transitions, hunger/health, effects, experience and advancement behavior | | Dimensions, portals, weather and game rules | Not implemented | Cross-dimension state, transitions, time/weather and rule-dependent behavior | | Multiplayer, protocol, authentication and commands | Not implemented | Packet/codec fixtures, vanilla interoperability, reconnects and command behavior | -| Rendering, resources, sound, UI and input | Not implemented | Resource compatibility, render/culling correctness, controls and playable interaction tests | -| Performance and platform support | Not measured for a Rust game | Repeated matched gameplay workloads, frame/tick distributions, memory and physical GPU tests | +| Rendering, resources, sound, UI and input | Native inspection client with selected block models, neighbor visibility, greedy meshing and a free camera; gameplay rendering/audio/UI incomplete | Resource compatibility, render/culling correctness, controls and playable interaction tests | +| Performance and platform support | Registered-attribute allocation reduction measured on Linux; whole-game performance and playable platform packages pending | Repeated matched gameplay workloads, frame/tick distributions, memory and physical GPU tests | The next simulation milestone is integrating the checked scheduler and registry-backed sections with actual block behavior and neighbor updates. World generation now has noise-stage filling, aquifers and surface-stage application; biome assignment and remaining generation stages need work, -followed by complete seeded-world comparisons. A renderer needs -actual block models, neighboring sections and light data. Simplified geometry -alone cannot establish vanilla behavior. Performance tuning must preserve the +followed by complete seeded-world comparisons. The inspection renderer needs +complete material/lighting support, chunk streaming and a simulated world. +Movement, health and combat kernels need shared live player/entity state and +world services. Scoped comparisons alone cannot establish complete gameplay parity. Performance tuning must preserve the validated simulation and use measured workloads; changing render distance, simulation distance or terrain detail invalidates an equal-workload speed claim. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaServerPlayerCombatOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaServerPlayerCombatOracle.java new file mode 100644 index 000000000..f9ad6de15 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaServerPlayerCombatOracle.java @@ -0,0 +1,107 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.lang.reflect.*;import java.lang.invoke.*;import java.nio.file.*;import java.util.*; +import net.minecraft.network.syncher.*;import net.minecraft.world.entity.ai.attributes.*;import net.minecraft.world.food.FoodData;import net.minecraft.core.*;import net.minecraft.core.component.*;import net.minecraft.core.registries.*;import net.minecraft.resources.*;import net.minecraft.tags.*;import net.minecraft.world.InteractionHand;import net.minecraft.world.entity.*;import net.minecraft.world.entity.player.*;import net.minecraft.world.damagesource.*;import net.minecraft.world.effect.*;import net.minecraft.world.item.*;import net.minecraft.world.item.component.*;import net.minecraft.server.level.*;import net.minecraft.server.PlayerAdvancements;import net.minecraft.sounds.*;import net.minecraft.stats.Stats; +/** Native ServerPlayer hurt through actual reduction, attributes, health/absorption and hunger. */ +public final class VanillaServerPlayerCombatOracle { + static final class Stop extends RuntimeException {} + static EntityDataAccessor healthKey,absorptionKey;static Field amplifier;static Object unsafe;static Method allocate;static ItemStack plain,shield;static Field stamp,lastSource,noAction,cooldown,lastHurt,duration,time; + static T make(Class c)throws Exception{return c.cast(allocate.invoke(unsafe,c));} + static Field field(Class c,String n)throws Exception{var f=c.getDeclaredField(n);f.setAccessible(true);return f;} + static float single(JsonElement v){return Float.intBitsToFloat(Integer.parseUnsignedInt(v.getAsString(),16));} + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + static String values(List> v){return VanillaPlayerHealthOracle.values(v);} + static String bits(float v){return String.format("%08x",Float.floatToIntBits(v));} + static String state(LivingEntity a){try{return noAction.getInt(a)+" "+cooldown.getInt(a)+" "+bits(lastHurt.getFloat(a))+" "+duration.getInt(a)+" "+time.getInt(a)+" "+(lastSource.get(a)!=null)+" "+stamp.getLong(a);}catch(Exception e){throw new AssertionError(e);}} + static final class Data {JsonObject op;PrintWriter out;AttributeMap attributes;SynchedEntityData data;Tracker tracker;int calls,difficultyCalls;boolean hit;Abilities abilities;PlainPlayer attacker;Arrow arrow;Actor other;float recorded;Server level;PlayerAdvancements advancements;List effects; + boolean flag(String n){return op.get(n).getAsBoolean();}void event(String s){out.println(s);if(calls++==op.get("fail").getAsInt())throw new Stop();}} + static final class Source extends DamageSource {Data d;Source(){super(null);} + @Override public boolean is(TagKey tag){String n=tag==DamageTypeTags.BYPASSES_ARMOR?"bypass_armor":tag==DamageTypeTags.BYPASSES_EFFECTS?"bypass_effects":tag==DamageTypeTags.BYPASSES_RESISTANCE?"bypass_resistance":tag==DamageTypeTags.BYPASSES_ENCHANTMENTS?"bypass_enchantments":tag==DamageTypeTags.IS_FIRE?"fire":tag==DamageTypeTags.IS_FREEZING?"freezing":tag==DamageTypeTags.DAMAGES_HELMET?"damages_helmet":tag==DamageTypeTags.BYPASSES_COOLDOWN?"bypasses_cooldown":tag==DamageTypeTags.NO_IMPACT?"no_impact":tag==DamageTypeTags.NO_KNOCKBACK?"no_knockback":tag==DamageTypeTags.BYPASSES_INVULNERABILITY?"bypasses_invulnerability":null;if(n==null)throw new AssertionError();d.event("tag "+n);return d.flag(n);} + @Override public boolean is(ResourceKey k){if(k!=DamageTypes.THORNS)throw new AssertionError();d.event("thorns");return false;} + @Override public Entity getEntity(){d.event("attacker");return switch(d.op.get("attacker").getAsInt()){case 0->null;case 1->d.other;case 2->d.attacker;case 3->d.arrow;default->throw new AssertionError();};} + @Override public ItemStack getWeaponItem(){d.event("weapon");return d.flag("weapon")?ItemStack.EMPTY:null;}@Override public float getFoodExhaustion(){d.event("food-exhaustion");return single(d.op.get("food_exhaustion"));} + @Override public boolean scalesWithDifficulty(){d.event("scales");return d.flag("scales");}} + static final class PlainPlayer extends Player {PlainPlayer(){super(null,null);}@Override public net.minecraft.world.level.GameType gameMode(){return net.minecraft.world.level.GameType.SURVIVAL;}} + static final class Arrow extends net.minecraft.world.entity.projectile.arrow.Arrow {Data d;Arrow(){super(null,null);}@Override public Entity getOwner(){d.event("owner");return switch(d.op.get("owner").getAsInt()){case 0->null;case 1->d.attacker;case 2->d.other;default->throw new AssertionError();};}} + static final class Tracker extends CombatTracker {Data d;Tracker(){super(null);}@Override public void recordDamage(DamageSource s,float v){d.event("record "+bits(v));d.recorded=v;d.hit=true;}} + static final class Server extends ServerLevel {Data d;Server(){super(null,null,null,null,null,null,false,0L,List.of(),false);}@Override public void broadcastDamageEvent(Entity a,DamageSource s){d.event("broadcast");}@Override public boolean isClientSide(){d.event("client");return d.flag("client");}@Override public net.minecraft.world.Difficulty getDifficulty(){d.event("difficulty");return net.minecraft.world.Difficulty.values()[d.op.getAsJsonArray("difficulties").get(d.difficultyCalls++).getAsInt()];}@Override public long getGameTime(){d.event("game-time");return d.op.get("game_time").getAsLong();}} + static final class Effect extends MobEffectInstance {Data d;int id;Effect(){super(MobEffects.RESISTANCE);}@Override public void onMobHurt(ServerLevel l,LivingEntity a,DamageSource s,float v){d.event("effect "+id+" "+bits(v));}} + static final class Actor extends net.minecraft.world.entity.decoration.ArmorStand {Actor(){super(null,null);} + + Data d; + @Override public boolean isInvulnerableTo(ServerLevel l,DamageSource s){d.event("invulnerable");return d.flag("invulnerable");} + @Override public boolean hasEffect(Holder e){if(e==MobEffects.FIRE_RESISTANCE){d.event("fire-resistance");return d.flag("fire_resistance");}if(e!=MobEffects.RESISTANCE)throw new AssertionError();d.event("has-resistance");return d.flag("resistance");} + @Override public MobEffectInstance getEffect(Holder e){if(e!=MobEffects.RESISTANCE)throw new AssertionError();d.event("effect");var v=new MobEffectInstance(e,100,0);try{amplifier.setInt(v,d.op.get("amplifier").getAsInt());}catch(Exception ex){throw new AssertionError(ex);}return v;} + @Override public double getAttributeValue(Holder a){return d.attributes.getValue(a);} + @Override protected void hurtArmor(DamageSource s,float v){d.event("hurt-armor "+bits(v));if(d.flag("break_armor"))d.attributes.getInstance(Attributes.ARMOR).setBaseValue(number(d.op.get("armor_after")));} + @Override public CombatTracker getCombatTracker(){d.event("tracker");return d.tracker;} + @Override public void gameEvent(Holder e){if(e!=net.minecraft.world.level.gameevent.GameEvent.ENTITY_DAMAGE)throw new AssertionError();d.event("damage-event");} + @Override public void onSyncedDataUpdated(EntityDataAccessor a){var k=a.id()==healthKey.id()?healthKey:absorptionKey;d.event("updated "+k.id()+" "+bits(d.data.get(k))+" "+d.data.isDirty());if(d.flag("pack_callback"))d.out.println("callback-pack "+values(d.data.packDirty()));} + @Override public boolean isSleeping(){d.event("sleeping");return d.flag("sleeping");} + @Override public void stopSleeping(){d.event("wake");} + @Override public ItemStack getUseItem(){d.event("use-item");return d.flag("component")?shield:ItemStack.EMPTY;} + @Override public float applyItemBlocking(ServerLevel l,DamageSource s,float v){d.event("blocking "+bits(v));return single(d.op.get("blocked"));} + @Override public boolean is(TagKey> tag){if(tag!=EntityTypeTags.FREEZE_HURTS_EXTRA_TYPES)throw new AssertionError();d.event("freeze-extra");return d.flag("freeze_extra");} + @Override public ItemStack getItemBySlot(EquipmentSlot slot){d.event("slot "+slot.ordinal());return slot==EquipmentSlot.HEAD&&d.flag("helmet")?plain:ItemStack.EMPTY;} + @Override protected void hurtHelmet(DamageSource s,float v){d.event("hurt-helmet "+bits(v));} + @Override protected void resolveMobResponsibleForDamage(DamageSource s){d.event("resolve-mob");} + @Override protected Player resolvePlayerResponsibleForDamage(DamageSource s){d.event("resolve-player");return null;} + @Override protected void markHurt(){d.event("mark");} + @Override public void dealDefaultKnockback(DamageSource s,float v,boolean b){d.event("knockback "+bits(v)+" "+b);} + @Override public ItemStack getItemInHand(InteractionHand h){d.event("hand "+h.ordinal());return ItemStack.EMPTY;} + @Override protected SoundEvent getDeathSound(){d.event("death-sound");return null;} + @Override public void makeSound(SoundEvent e){d.event("make-sound");} + @Override public void die(DamageSource s){d.event("die");dead=true;} + @Override protected void playHurtSound(DamageSource s){d.event("hurt-sound");} + @Override public ServerLevel level(){d.event("level");return d.level;} + @Override public Collection getActiveEffects(){d.event("effects");return d.effects;} + } + static final class Human extends ServerPlayer {Human(){super(null,null,null,null);} + + Data d; + @Override public boolean isInvulnerableTo(ServerLevel l,DamageSource s){d.event("invulnerable");return d.flag("invulnerable");} + @Override public boolean hasEffect(Holder e){if(e==MobEffects.FIRE_RESISTANCE){d.event("fire-resistance");return d.flag("fire_resistance");}if(e!=MobEffects.RESISTANCE)throw new AssertionError();d.event("has-resistance");return d.flag("resistance");} + @Override public MobEffectInstance getEffect(Holder e){if(e!=MobEffects.RESISTANCE)throw new AssertionError();d.event("effect");var v=new MobEffectInstance(e,100,0);try{amplifier.setInt(v,d.op.get("amplifier").getAsInt());}catch(Exception ex){throw new AssertionError(ex);}return v;} + @Override public double getAttributeValue(Holder a){return d.attributes.getValue(a);} + @Override protected void hurtArmor(DamageSource s,float v){d.event("hurt-armor "+bits(v));if(d.flag("break_armor"))d.attributes.getInstance(Attributes.ARMOR).setBaseValue(number(d.op.get("armor_after")));} + @Override public CombatTracker getCombatTracker(){d.event("tracker");return d.tracker;} + @Override public void gameEvent(Holder e){if(e!=net.minecraft.world.level.gameevent.GameEvent.ENTITY_DAMAGE)throw new AssertionError();d.event("damage-event");} + @Override public void onSyncedDataUpdated(EntityDataAccessor a){var k=a.id()==healthKey.id()?healthKey:absorptionKey;d.event("updated "+k.id()+" "+bits(d.data.get(k))+" "+d.data.isDirty());if(d.flag("pack_callback"))d.out.println("callback-pack "+values(d.data.packDirty()));} + @Override public boolean isSleeping(){d.event("sleeping");return d.flag("sleeping");} + @Override public void stopSleeping(){d.event("wake");} + @Override public ItemStack getUseItem(){d.event("use-item");return d.flag("component")?shield:ItemStack.EMPTY;} + @Override public float applyItemBlocking(ServerLevel l,DamageSource s,float v){d.event("blocking "+bits(v));return single(d.op.get("blocked"));} + @Override public boolean is(TagKey> tag){if(tag!=EntityTypeTags.FREEZE_HURTS_EXTRA_TYPES)throw new AssertionError();d.event("freeze-extra");return d.flag("freeze_extra");} + @Override public ItemStack getItemBySlot(EquipmentSlot slot){d.event("slot "+slot.ordinal());return slot==EquipmentSlot.HEAD&&d.flag("helmet")?plain:ItemStack.EMPTY;} + @Override protected void hurtHelmet(DamageSource s,float v){d.event("hurt-helmet "+bits(v));} + @Override protected void resolveMobResponsibleForDamage(DamageSource s){d.event("resolve-mob");} + @Override protected Player resolvePlayerResponsibleForDamage(DamageSource s){d.event("resolve-player");return null;} + @Override protected void markHurt(){d.event("mark");} + @Override public void dealDefaultKnockback(DamageSource s,float v,boolean b){d.event("knockback "+bits(v)+" "+b);} + @Override public ItemStack getItemInHand(InteractionHand h){d.event("hand "+h.ordinal());return ItemStack.EMPTY;} + @Override protected SoundEvent getDeathSound(){d.event("death-sound");return null;} + @Override public void makeSound(SoundEvent e){d.event("make-sound");} + @Override public void die(DamageSource s){d.event("die");dead=true;} + @Override protected void playHurtSound(DamageSource s){d.event("hurt-sound");} + @Override public ServerLevel level(){d.event("level");return d.level;} + @Override public Collection getActiveEffects(){d.event("effects");return d.effects;} + + @Override protected void removeEntitiesOnShoulder(){d.event("shoulders");}@Override public boolean canHarmPlayer(Player p){d.event("can-harm");return d.flag("can_harm");}@Override public PlayerAdvancements getAdvancements(){d.event("criterion");return d.advancements;} + @Override public void awardStat(Identifier s,int v){if(s==Stats.DAMAGE_BLOCKED_BY_SHIELD){d.event("blocked-stat "+v);return;}String n=s==Stats.DAMAGE_RESISTED?"resisted":s==Stats.DAMAGE_ABSORBED?"absorbed":s==Stats.DAMAGE_TAKEN?"taken":null;if(n==null)throw new AssertionError();d.event("stat "+n+" "+v);} + } + @SuppressWarnings("unchecked") public static void main(String[] args)throws Throwable { + Path dir=Path.of(args[1]);if(args[0].equals("export"))VanillaPlayerHealthOracle.main(args);else{net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();} + healthKey=(EntityDataAccessor)field(LivingEntity.class,"DATA_HEALTH_ID").get(null);absorptionKey=(EntityDataAccessor)field(Player.class,"DATA_PLAYER_ABSORPTION_ID").get(null);if(args[0].equals("export")){var slots=new JsonArray();for(var s:EquipmentSlot.VALUES)slots.add(s.ordinal());Files.writeString(dir.resolve("slots.json"),slots.toString());Files.writeString(dir.resolve("head.json"),Integer.toString(EquipmentSlot.HEAD.ordinal()));return;} + var dataCtor=SynchedEntityData.class.getDeclaredConstructor(SyncedDataHolder.class,SynchedEntityData.DataItem[].class);dataCtor.setAccessible(true);amplifier=field(MobEffectInstance.class,"amplifier");var exhaustion=field(FoodData.class,"exhaustionLevel");var keys=List.of(Attributes.ARMOR,Attributes.ARMOR_TOUGHNESS,Attributes.MAX_HEALTH,Attributes.MAX_ABSORPTION);var u=Class.forName("sun.misc.Unsafe");unsafe=field(u,"theUnsafe").get(null);allocate=u.getMethod("allocateInstance",Class.class); + noAction=field(LivingEntity.class,"noActionTime");cooldown=field(LivingEntity.class,"damageCooldownTime");lastHurt=field(LivingEntity.class,"lastHurt");duration=field(LivingEntity.class,"hurtDuration");time=field(LivingEntity.class,"hurtTime");stamp=field(LivingEntity.class,"lastDamageStamp");lastSource=field(LivingEntity.class,"lastDamageSource"); + var ctor=ItemStack.class.getDeclaredConstructor(Holder.class,int.class,PatchedDataComponentMap.class);ctor.setAccessible(true);plain=(ItemStack)ctor.newInstance(BuiltInRegistries.ITEM.wrapAsHolder(Items.STICK),1,new PatchedDataComponentMap(DataComponentMap.EMPTY));shield=(ItemStack)ctor.newInstance(BuiltInRegistries.ITEM.wrapAsHolder(Items.SHIELD),1,new PatchedDataComponentMap(DataComponentMap.EMPTY));shield.set(DataComponents.BLOCKS_ATTACKS,new BlocksAttacks(0,1,List.of(),new BlocksAttacks.ItemDamageFunction(0,0,0),Optional.empty(),Optional.empty(),Optional.empty())); + var lookup=MethodHandles.privateLookupIn(Player.class,MethodHandles.lookup());var playerHurt=lookup.findSpecial(Player.class,"hurtServer",MethodType.methodType(boolean.class,ServerLevel.class,DamageSource.class,float.class),Player.class).asType(MethodType.methodType(boolean.class,LivingEntity.class,ServerLevel.class,DamageSource.class,float.class)); + var serverLookup=MethodHandles.privateLookupIn(ServerPlayer.class,MethodHandles.lookup());var serverHurt=serverLookup.findSpecial(ServerPlayer.class,"hurtServer",MethodType.methodType(boolean.class,ServerLevel.class,DamageSource.class,float.class),ServerPlayer.class).asType(MethodType.methodType(boolean.class,LivingEntity.class,ServerLevel.class,DamageSource.class,float.class)); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();var d=new Data();d.out=out;d.level=make(Server.class);d.level.d=d;d.advancements=make(PlayerAdvancements.class);field(PlayerAdvancements.class,"activeTriggers").set(d.advancements,new HashMap<>());var human=make(Human.class);human.d=d;LivingEntity actor=human;d.abilities=new Abilities();field(Player.class,"abilities").set(actor,d.abilities);d.attacker=make(PlainPlayer.class);d.other=make(Actor.class);d.other.d=d;d.arrow=make(Arrow.class);d.arrow.d=d;var hurt=serverHurt;var source=make(Source.class);source.d=d; + d.attributes=new AttributeMap(VanillaEntityAttributeOracle.supplier(BuiltInRegistries.ENTITY_TYPE.getValue(Identifier.parse("minecraft:player"))));for(int i=0;i[Math.max(healthKey.id(),absorptionKey.id())+1];for(int i=0;i(new EntityDataAccessor(i,EntityDataSerializers.FLOAT),0f);var health=new SynchedEntityData.DataItem(healthKey,single(f.get("health")));var absorption=new SynchedEntityData.DataItem(absorptionKey,single(f.get("absorption")));items[healthKey.id()]=health;items[absorptionKey.id()]=absorption;d.data=dataCtor.newInstance(actor,items);field(Entity.class,"entityData").set(actor,d.data);field(LivingEntity.class,"dead").setBoolean(actor,f.get("dead").getAsBoolean());var food=new FoodData();exhaustion.setFloat(food,single(f.get("exhaustion")));field(Player.class,"foodData").set(actor,food);d.tracker=make(Tracker.class);d.tracker.d=d; + noAction.setInt(actor,f.get("no_action").getAsInt());cooldown.setInt(actor,f.get("cooldown").getAsInt());lastHurt.setFloat(actor,single(f.get("last_hurt")));duration.setInt(actor,f.get("duration").getAsInt());time.setInt(actor,f.get("time").getAsInt());stamp.setLong(actor,f.get("stamp").getAsLong());if(f.get("source").getAsBoolean())lastSource.set(actor,source); + for(var ov:f.getAsJsonArray("ops")){d.op=ov.getAsJsonObject();if(d.op.has("reset_cooldown")&&d.flag("reset_cooldown"))cooldown.setInt(actor,0);d.calls=0;d.difficultyCalls=0;d.hit=false;d.abilities.invulnerable=d.flag("ability_invulnerable");d.effects=new ArrayList<>();for(int i=0;if',v).hex() + def double(v):return struct.pack('>d',v).hex() + rng=random.Random(0x434f4d424154) + values=[-float('inf'),-1e30,-1,-0.,0.,1e-40,.1,1,5,10,20,1e30,float('inf'),float('nan')] + def extend(f,randomize=False): + f=copy.deepcopy(f);f.update(health=bits(20),absorption=bits(4),exhaustion=bits(0),dead=False,attributes=[dict(base=double(v),amount=double(0),operation=0) for v in [15,8,20,20]]) + if randomize: + for k in ['health','absorption','exhaustion']:f[k]=bits(rng.choice(values)) + f['dead']=rng.randrange(8)==0 + for a in f['attributes']:a.update(base=double(rng.choice(values)),amount=double(rng.choice(values)),operation=rng.randrange(3)) + for o in f['ops']: + o.update(weapon=False,resistance=False,amplifier=0,break_armor=False,armor_after=double(0),food_exhaustion=bits(.1),pack=False,pack_callback=False,client=False,bypass_armor=False,bypass_effects=False,bypass_resistance=False,bypass_enchantments=False) + if randomize: + for k in ['weapon','resistance','break_armor','pack','pack_callback','client','bypass_armor','bypass_effects','bypass_resistance','bypass_enchantments']:o[k]=bool(rng.randrange(2)) + o.update(amplifier=rng.choice([-2147483648,-2,-1,0,1,4,5,2147483647]),armor_after=double(rng.choice(values)),food_exhaustion=bits(rng.choice(values)),fail=rng.choice([-1,-1,-1,*range(65)])) + return f + for i,f in enumerate(hurt.corpus()):yield extend(f,i%2==0) + template=extend(next(hurt.corpus())) + clean=copy.deepcopy(template['ops'][0]);clean.update(damage=bits(8),blocked=bits(0),ability_invulnerable=False,scales=False,attacker=0,owner=0,can_harm=True,difficulties=[2,2,2],fail=-1,reset_cooldown=True) + for health in values: + for absorption in values: + f=copy.deepcopy(template);f.update(health=bits(health),absorption=bits(absorption),cooldown=0,last_hurt=bits(0));f['ops']=[dict(clean,damage=bits(v),pack=i%2==0) for i,v in enumerate([1,2,4,8,16,32,64])];yield f + for fail in range(-1,66): + for absorption in [0,4,40]: + f=copy.deepcopy(template);f.update(absorption=bits(absorption),cooldown=0,last_hurt=bits(0));f['ops']=[dict(clean,fail=fail,pack_callback=True,break_armor=True,resistance=True,amplifier=0),dict(clean,damage=bits(25),pack=True)];yield f + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-server-player-combat-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaServerPlayerCombatOracle.java' + helper=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityAttributeOracle.java' + health_helper=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerHealthOracle.java' + sources=[oracle,helper,health_helper,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/test_player_hurt_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/server_player_combat_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle,helper,health_helper],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaServerPlayerCombatOracle',mode,path],side+'-'+mode) + java('server','export',build);states=json.loads((build/'catalog.json').read_text());fixtures=list(corpus(states));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs,build/'catalog.json',build/'ids.json',build/'slots.json',build/'head.json'];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','server_player_combat_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('server_player_combat_fixture.exe' if os.name=='nt' else 'server_player_combat_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} server player combat output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual ServerPlayer outer hurt through Player/LivingEntity gates and actual Player inner damage, native armor/resistance reduction, registered modified attributes, synchronized health/absorption and FoodData exhaustion. Repeated hits, cooldown/state writes, death rejection, callbacks and numeric edges. Invulnerability predicate, blocking amount, durability, effects, PvP permission, attribution, knockback, death services and criterion listeners remain controlled; enchanted items, registered sources and complete entity/game lifecycle remain pending.'} + lab.write_json(report_path,report);print(f'Scoped server player combat parity passed: {report_path}') + + +if __name__=='__main__':main() From 81ee9fc7ec15eb84931ac43f68c44c97e73e80cb Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 05:40:21 +0200 Subject: [PATCH 121/253] Integrate actual immunity decisions throughout player combat --- .../inner-damage-regression.json | 257 +++++++++++++++++ .../scoped-parity.json | 264 ++++++++++++++++++ .../examples/server_player_combat_fixture.rs | 62 ++++ crates/horizon-world/src/living_damage.rs | 8 + .../horizon-world/src/server_player_combat.rs | 17 +- .../horizon-world/src/server_player_damage.rs | 6 + docs/collision-geometry.md | 16 ++ .../VanillaServerPlayerCombatOracle.java | 32 ++- tools/test_server_player_combat_parity.py | 15 +- 9 files changed, 658 insertions(+), 19 deletions(-) create mode 100644 benchmarks/rust-server-player-combat-immunity-2026-10-07/inner-damage-regression.json create mode 100644 benchmarks/rust-server-player-combat-immunity-2026-10-07/scoped-parity.json diff --git a/benchmarks/rust-server-player-combat-immunity-2026-10-07/inner-damage-regression.json b/benchmarks/rust-server-player-combat-immunity-2026-10-07/inner-damage-regression.json new file mode 100644 index 000000000..e33d407e5 --- /dev/null +++ b/benchmarks/rust-server-player-combat-immunity-2026-10-07/inner-damage-regression.json @@ -0,0 +1,257 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 14696, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLivingDamageOracle.java": "f6901c9875488132658fd99410958f072976c553f1badf25c50727873c9240c4", + "tools/test_living_damage_parity.py": "f858e0f3ee9498e0960dc527ac393ebc4154503a8c8ff3971ce64d9430e4111a", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_immunity.rs": "fd39c41124d694e755cf7faadcf93c636df4042c78ec345092a856b5f952dbcf", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "06065c36a17442ea9e5369fd7eeada9b4c2f823863c0590d917b20693e97fdea", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "2b448209629b9bf2e678d667ad0d6c7fa22146892dd106b169d96b31b0df12bb", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_hurt.rs": "844239ad7d15c39629bb3cfc06ebae6d1cff20b7627468f26e0ee8dff3abdcb8", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_hurt.rs": "99c9bbd8587ec2dc287806049897b8034d2f5349ad47fc497b70d54148844a36", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/server_player_combat.rs": "a9743971581af86d926eeba42004d932caf83382c470dd98bf613cb9c417db58", + "crates/horizon-world/src/server_player_damage.rs": "828a4649fec3e9bda2dfe20aced8c95922c697321de2be4127bd4e5712ecbb7c", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "f417aab280331ddd6f0ca265a12c0130c78b9924f407c7e07f198140501e6010", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/living_damage_fixture.rs": "c00017fed110ab6ebb229791d59ca7d3dd0ecaa48a8030ae7f156672a88dd02b" + }, + "fixtures_sha256": { + ".local/rust-living-damage-parity/inputs.txt": "5815be47de0e489e8439e61e868595aeb3ace34317841b31cdaab6eecfb4dbff" + }, + "rust_output_sha256": "2d5568691fefb75c1dfb914f390860d6b008d8cef18b743b78277941936dc19b", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "2d5568691fefb75c1dfb914f390860d6b008d8cef18b743b78277941936dc19b", + "matched_output_lines": 161198 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "2d5568691fefb75c1dfb914f390860d6b008d8cef18b743b78277941936dc19b", + "matched_output_lines": 161198 + } + ], + "scope": "Actual LivingEntity and Player actuallyHurt with observable phase/storage/stat/combat/event hooks; real final absorption clamping. Invulnerability, armor/magic dispatch, two absorption reads, absorbed statistics and Java rounding, player exhaustion/taken statistics, base-living second absorption write, health and damage-event ordering, mutation/failure retention. Armor/magic results, storage, combat/stat sinks and exhaustion delivery are controlled; outer hurt gates, full damage binding and live gameplay remain pending." +} diff --git a/benchmarks/rust-server-player-combat-immunity-2026-10-07/scoped-parity.json b/benchmarks/rust-server-player-combat-immunity-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..da544da9b --- /dev/null +++ b/benchmarks/rust-server-player-combat-immunity-2026-10-07/scoped-parity.json @@ -0,0 +1,264 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 7465, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaServerPlayerCombatOracle.java": "1c4fac076598ff3cb6e23059355781a42d5a992ac720fa3c6dc0f26131c30f08", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityAttributeOracle.java": "2ad3190a9798ab54bd12e88573028d0ca6a204e2f8a92018aae98b22335213bf", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerHealthOracle.java": "5d6dc93c0140e2b2f953fba7290721079d5a607fa81b051e2ac1e4742ab606f2", + "tools/test_server_player_combat_parity.py": "79e74d60c3f4a9534c28642a6907271739f084ebb15b53009a747065733025bf", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/test_player_hurt_parity.py": "3164b8644664fcd46903e801ea70d1bb866e07e7112dc94570161831644bc84d", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_immunity.rs": "fd39c41124d694e755cf7faadcf93c636df4042c78ec345092a856b5f952dbcf", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "06065c36a17442ea9e5369fd7eeada9b4c2f823863c0590d917b20693e97fdea", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "2b448209629b9bf2e678d667ad0d6c7fa22146892dd106b169d96b31b0df12bb", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_hurt.rs": "844239ad7d15c39629bb3cfc06ebae6d1cff20b7627468f26e0ee8dff3abdcb8", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_hurt.rs": "99c9bbd8587ec2dc287806049897b8034d2f5349ad47fc497b70d54148844a36", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/server_player_combat.rs": "a9743971581af86d926eeba42004d932caf83382c470dd98bf613cb9c417db58", + "crates/horizon-world/src/server_player_damage.rs": "828a4649fec3e9bda2dfe20aced8c95922c697321de2be4127bd4e5712ecbb7c", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "f417aab280331ddd6f0ca265a12c0130c78b9924f407c7e07f198140501e6010", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "d35ded93fe6e95ea045cadcf4925e656dc34ef832b742179b9ad0cc49f902f31", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/server_player_combat_fixture.rs": "31708a06086de4fd510426c8f4f52e73065bf8fdf43cb2492215e957a5cc3895" + }, + "fixtures_sha256": { + ".local/rust-server-player-combat-parity/inputs.txt": "0267042ca199aba2647667b349b22be374c83fbae3d9846a33519c1f96a402b4", + ".local/rust-server-player-combat-parity/catalog.json": "d1e488e4f432888beb9f643904c8bca242d1e2093f53e23e07da305d70cf7106", + ".local/rust-server-player-combat-parity/ids.json": "f7d6037166d966e2714b01cff5626f0cc0a02ce883885ec791c93e977afde0e6", + ".local/rust-server-player-combat-parity/slots.json": "29101ebf1ead685029508789eee51c4d4fff65524064d8e32a48efded7036982", + ".local/rust-server-player-combat-parity/head.json": "ef2d127de37b942baad06145e54b0c619a1f22327b2ebbcfbec78f5564afe39d" + }, + "rust_output_sha256": "e2e937abc1e00904c23573390279fb6f7474b88e0adf8ebb0f0019504e888939", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "e2e937abc1e00904c23573390279fb6f7474b88e0adf8ebb0f0019504e888939", + "matched_output_lines": 1176994 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "e2e937abc1e00904c23573390279fb6f7474b88e0adf8ebb0f0019504e888939", + "matched_output_lines": 1176994 + } + ], + "scope": "Actual ServerPlayer outer hurt through Player/LivingEntity gates and actual Player inner damage, native armor/resistance reduction, registered modified attributes, synchronized health/absorption and FoodData exhaustion. Repeated hits, cooldown/state writes, death rejection, callbacks and numeric edges. Actual inherited invulnerability predicates include virtual flags, empty-equipment enchantment immunity, damage gamerules and client-loading/dimension guards; blocking amount, durability, effects, PvP permission, attribution, knockback, death services and criterion listeners remain controlled; enchanted items, registered sources and complete entity/game lifecycle remain pending." +} diff --git a/crates/horizon-world/examples/server_player_combat_fixture.rs b/crates/horizon-world/examples/server_player_combat_fixture.rs index 25c07da32..f6a2202db 100644 --- a/crates/horizon-world/examples/server_player_combat_fixture.rs +++ b/crates/horizon-world/examples/server_player_combat_fixture.rs @@ -1,3 +1,4 @@ +use horizon_world::damage_immunity::{DamageRule, ImmunityTag, ImmunityWorld}; use horizon_world::living_hurt::{HurtState, HurtTag, HurtWorld}; use horizon_world::{ attributes::{ @@ -59,6 +60,11 @@ struct Env<'a> { dead: bool, } impl Env<'_> { + fn query(&mut self, event: &str, key: &str) -> io::Result { + self.event(event)?; + Ok(self.flag(key)) + } + fn flag(&self, n: &str) -> bool { self.op[n].as_bool().unwrap() } @@ -520,3 +526,59 @@ fn main() -> Result<(), Box> { } Ok(()) } +impl ImmunityWorld for Env<'_> { + type Error = io::Error; + fn removed(&self) -> bool { + self.flag("removed") + } + fn permanently_invulnerable(&mut self) -> io::Result { + self.query("permanent", "permanent") + } + fn temporarily_invulnerable(&mut self) -> io::Result { + self.query("temporary", "temporary") + } + fn tag(&mut self, t: ImmunityTag) -> io::Result { + let n = match t { + ImmunityTag::BypassesInvulnerability => "bypasses_invulnerability", + ImmunityTag::Fire => "fire", + ImmunityTag::Fall => "fall", + ImmunityTag::Drowning => "drowning", + ImmunityTag::Freezing => "freezing", + }; + self.query(&format!("tag {n}"), n) + } + fn creative_source(&mut self) -> io::Result { + self.query("creative", "creative") + } + fn fire_immune(&mut self) -> io::Result { + self.query("fire-immune", "fire_immune") + } + fn fall_immune(&mut self) -> io::Result { + self.query("fall-immune", "fall_immune") + } + fn enchantment_immunity(&mut self) -> io::Result { + for s in self.slots { + self.event(&format!("slot {}", s.as_u64().unwrap()))?; + } + Ok(false) + } + fn damage_rule(&mut self, r: DamageRule) -> io::Result { + let n = match r { + DamageRule::Drowning => "drowning", + DamageRule::Fall => "fall", + DamageRule::Fire => "fire", + DamageRule::Freeze => "freeze", + }; + self.event("rules")?; + self.query(&format!("rule {n}"), &format!("rule_{n}")) + } + fn changing_dimension(&mut self) -> io::Result { + self.query("changing", "changing") + } + fn ender_pearl(&mut self) -> io::Result { + self.query("pearl", "pearl") + } + fn client_loaded(&mut self) -> io::Result { + self.query("loaded", "loaded") + } +} diff --git a/crates/horizon-world/src/living_damage.rs b/crates/horizon-world/src/living_damage.rs index 11b531a08..9abf38199 100644 --- a/crates/horizon-world/src/living_damage.rs +++ b/crates/horizon-world/src/living_damage.rs @@ -61,6 +61,14 @@ pub fn actually_hurt( if world.invulnerable()? { return Ok(()); } + actually_hurt_after_immunity_check(world, damage, player) +} +/// Caller must have performed this hit's native invulnerability query. +pub(crate) fn actually_hurt_after_immunity_check( + world: &mut W, + damage: f32, + player: bool, +) -> Result<(), W::Error> { let damage = world.after_armor(damage)?; let damage = world.after_magic(damage)?; let remaining = positive(damage - world.absorption()?); diff --git a/crates/horizon-world/src/server_player_combat.rs b/crates/horizon-world/src/server_player_combat.rs index fda98b07f..52d1b0b97 100644 --- a/crates/horizon-world/src/server_player_combat.rs +++ b/crates/horizon-world/src/server_player_combat.rs @@ -2,6 +2,7 @@ use crate::{ attributes::entity::EntityAttributes, combat_rules::ArmorWorld, + damage_immunity::{self, ImmunityWorld}, food::{Difficulty, FoodData}, living_hurt::{HurtState, HurtTag, HurtWorld}, player_health::PlayerFloatIds, @@ -14,7 +15,9 @@ use crate::{ use std::io; type Error = ::Error; pub trait CombatEnvironment: - ServerDamageEnvironment + ServerPlayerHurtWorld::Error> + ServerDamageEnvironment + + ServerPlayerHurtWorld::Error> + + ImmunityWorld::Error> { /// Direct death flag, read only after health fails the native <= zero test. fn dead_flag(&self) -> bool; @@ -75,6 +78,11 @@ impl HurtWorld for ServerPlayerCombat<'_, E> { _: &mut HurtState, damage: f32, ) -> Result<(), Self::Error> { + if damage_immunity::server_player_immunity(self.environment) + .map_err(ServerDamageError::Environment)? + { + return Ok(()); + } ServerPlayerDamage::new( self.attributes, self.data, @@ -83,13 +91,14 @@ impl HurtWorld for ServerPlayerCombat<'_, E> { self.environment, ) .expect("validated immutable player schema") - .apply(damage) + .apply_after_immunity_check(damage) } fn blocking_component(&mut self, item: Self::UseItem) -> Option { self.environment.blocking_component(item) } - fn invulnerable(&mut self, state: &mut HurtState) -> Result { - HurtWorld::invulnerable(self.environment, state).map_err(ServerDamageError::Environment) + fn invulnerable(&mut self, _: &mut HurtState) -> Result { + damage_immunity::server_player_immunity(self.environment) + .map_err(ServerDamageError::Environment) } fn tag( &mut self, diff --git a/crates/horizon-world/src/server_player_damage.rs b/crates/horizon-world/src/server_player_damage.rs index c4d571059..c8418552d 100644 --- a/crates/horizon-world/src/server_player_damage.rs +++ b/crates/horizon-world/src/server_player_damage.rs @@ -116,6 +116,12 @@ impl<'a, E: ServerDamageEnvironment> ServerPlayerDamage<'a, E> { pub fn apply(&mut self, damage: f32) -> Result<(), ServerDamageError>> { living_damage::actually_hurt(self, damage, true) } + pub(crate) fn apply_after_immunity_check( + &mut self, + damage: f32, + ) -> Result<(), ServerDamageError>> { + living_damage::actually_hurt_after_immunity_check(self, damage, true) + } } impl ArmorWorld for ServerPlayerDamage<'_, E> { type Error = ServerDamageError>; diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 2b8716897..9d7e0946c 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1402,3 +1402,19 @@ Invulnerability answers, blocking amounts, armor-durability callbacks, effects, PvP permission, combat/event/knockback/death services and criterion listeners are controlled. Enchanted items, registered sources, actual lifecycle services and playable integration remain pending. + + +The stored-player combat binding now executes the verified server-player +invulnerability predicates at every outer and inner query. Its inner damage body +is shared with standalone living/player damage after the required predicate has +run. Native integration retains inherited Entity/LivingEntity/Player/ServerPlayer +immunity methods, including empty-equipment enchantment iteration, gamerule +precedence, dimension changes and client-loading guards. + +The [combat immunity integration report](../benchmarks/rust-server-player-combat-immunity-2026-10-07/scoped-parity.json) +records **1,176,994 matching lines per JAR**. The standalone inner-damage +[regression report](../benchmarks/rust-server-player-combat-immunity-2026-10-07/inner-damage-regression.json) +retains **161,198 matching lines per JAR** after extracting the shared body. +Targeted Clippy passes. Virtual flags, source tags/rule values and the other +world services listed above remain controlled; the fixture now executes the +immunity decisions themselves instead of supplying their final result. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaServerPlayerCombatOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaServerPlayerCombatOracle.java index f9ad6de15..26ac59fb6 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaServerPlayerCombatOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaServerPlayerCombatOracle.java @@ -1,6 +1,6 @@ package dev.horizonlab.parity; import com.google.gson.*;import java.io.*;import java.lang.reflect.*;import java.lang.invoke.*;import java.nio.file.*;import java.util.*; -import net.minecraft.network.syncher.*;import net.minecraft.world.entity.ai.attributes.*;import net.minecraft.world.food.FoodData;import net.minecraft.core.*;import net.minecraft.core.component.*;import net.minecraft.core.registries.*;import net.minecraft.resources.*;import net.minecraft.tags.*;import net.minecraft.world.InteractionHand;import net.minecraft.world.entity.*;import net.minecraft.world.entity.player.*;import net.minecraft.world.damagesource.*;import net.minecraft.world.effect.*;import net.minecraft.world.item.*;import net.minecraft.world.item.component.*;import net.minecraft.server.level.*;import net.minecraft.server.PlayerAdvancements;import net.minecraft.sounds.*;import net.minecraft.stats.Stats; +import net.minecraft.network.syncher.*;import net.minecraft.world.entity.ai.attributes.*;import net.minecraft.world.food.FoodData;import net.minecraft.world.level.gamerules.*;import net.minecraft.world.flag.FeatureFlagSet;import net.minecraft.server.network.ServerGamePacketListenerImpl;import net.minecraft.core.*;import net.minecraft.core.component.*;import net.minecraft.core.registries.*;import net.minecraft.resources.*;import net.minecraft.tags.*;import net.minecraft.world.InteractionHand;import net.minecraft.world.entity.*;import net.minecraft.world.entity.player.*;import net.minecraft.world.damagesource.*;import net.minecraft.world.effect.*;import net.minecraft.world.item.*;import net.minecraft.world.item.component.*;import net.minecraft.server.level.*;import net.minecraft.server.PlayerAdvancements;import net.minecraft.sounds.*;import net.minecraft.stats.Stats; /** Native ServerPlayer hurt through actual reduction, attributes, health/absorption and hunger. */ public final class VanillaServerPlayerCombatOracle { static final class Stop extends RuntimeException {} @@ -12,23 +12,27 @@ public final class VanillaServerPlayerCombatOracle { static String values(List> v){return VanillaPlayerHealthOracle.values(v);} static String bits(float v){return String.format("%08x",Float.floatToIntBits(v));} static String state(LivingEntity a){try{return noAction.getInt(a)+" "+cooldown.getInt(a)+" "+bits(lastHurt.getFloat(a))+" "+duration.getInt(a)+" "+time.getInt(a)+" "+(lastSource.get(a)!=null)+" "+stamp.getLong(a);}catch(Exception e){throw new AssertionError(e);}} - static final class Data {JsonObject op;PrintWriter out;AttributeMap attributes;SynchedEntityData data;Tracker tracker;int calls,difficultyCalls;boolean hit;Abilities abilities;PlainPlayer attacker;Arrow arrow;Actor other;float recorded;Server level;PlayerAdvancements advancements;List effects; + static final class Data {JsonObject op;PrintWriter out;AttributeMap attributes;SynchedEntityData data;Tracker tracker;Rules rules;int calls,difficultyCalls;boolean hit;Abilities abilities;PlainPlayer attacker;Arrow arrow;Actor other;float recorded;Server level;PlayerAdvancements advancements;List effects; boolean flag(String n){return op.get(n).getAsBoolean();}void event(String s){out.println(s);if(calls++==op.get("fail").getAsInt())throw new Stop();}} static final class Source extends DamageSource {Data d;Source(){super(null);} - @Override public boolean is(TagKey tag){String n=tag==DamageTypeTags.BYPASSES_ARMOR?"bypass_armor":tag==DamageTypeTags.BYPASSES_EFFECTS?"bypass_effects":tag==DamageTypeTags.BYPASSES_RESISTANCE?"bypass_resistance":tag==DamageTypeTags.BYPASSES_ENCHANTMENTS?"bypass_enchantments":tag==DamageTypeTags.IS_FIRE?"fire":tag==DamageTypeTags.IS_FREEZING?"freezing":tag==DamageTypeTags.DAMAGES_HELMET?"damages_helmet":tag==DamageTypeTags.BYPASSES_COOLDOWN?"bypasses_cooldown":tag==DamageTypeTags.NO_IMPACT?"no_impact":tag==DamageTypeTags.NO_KNOCKBACK?"no_knockback":tag==DamageTypeTags.BYPASSES_INVULNERABILITY?"bypasses_invulnerability":null;if(n==null)throw new AssertionError();d.event("tag "+n);return d.flag(n);} - @Override public boolean is(ResourceKey k){if(k!=DamageTypes.THORNS)throw new AssertionError();d.event("thorns");return false;} + @Override public boolean is(TagKey tag){String n=tag==DamageTypeTags.BYPASSES_ARMOR?"bypass_armor":tag==DamageTypeTags.BYPASSES_EFFECTS?"bypass_effects":tag==DamageTypeTags.BYPASSES_RESISTANCE?"bypass_resistance":tag==DamageTypeTags.BYPASSES_ENCHANTMENTS?"bypass_enchantments":tag==DamageTypeTags.IS_DROWNING?"drowning":tag==DamageTypeTags.IS_FALL?"fall":tag==DamageTypeTags.IS_FIRE?"fire":tag==DamageTypeTags.IS_FREEZING?"freezing":tag==DamageTypeTags.DAMAGES_HELMET?"damages_helmet":tag==DamageTypeTags.BYPASSES_COOLDOWN?"bypasses_cooldown":tag==DamageTypeTags.NO_IMPACT?"no_impact":tag==DamageTypeTags.NO_KNOCKBACK?"no_knockback":tag==DamageTypeTags.BYPASSES_INVULNERABILITY?"bypasses_invulnerability":null;if(n==null)throw new AssertionError();d.event("tag "+n);return d.flag(n);} + @Override public boolean is(ResourceKey k){if(k==DamageTypes.ENDER_PEARL){d.event("pearl");return d.flag("pearl");}if(k!=DamageTypes.THORNS)throw new AssertionError();d.event("thorns");return false;} @Override public Entity getEntity(){d.event("attacker");return switch(d.op.get("attacker").getAsInt()){case 0->null;case 1->d.other;case 2->d.attacker;case 3->d.arrow;default->throw new AssertionError();};} @Override public ItemStack getWeaponItem(){d.event("weapon");return d.flag("weapon")?ItemStack.EMPTY:null;}@Override public float getFoodExhaustion(){d.event("food-exhaustion");return single(d.op.get("food_exhaustion"));} - @Override public boolean scalesWithDifficulty(){d.event("scales");return d.flag("scales");}} + @Override public boolean isCreativePlayer(){d.event("creative");return d.flag("creative");}@Override public boolean scalesWithDifficulty(){d.event("scales");return d.flag("scales");}} static final class PlainPlayer extends Player {PlainPlayer(){super(null,null);}@Override public net.minecraft.world.level.GameType gameMode(){return net.minecraft.world.level.GameType.SURVIVAL;}} static final class Arrow extends net.minecraft.world.entity.projectile.arrow.Arrow {Data d;Arrow(){super(null,null);}@Override public Entity getOwner(){d.event("owner");return switch(d.op.get("owner").getAsInt()){case 0->null;case 1->d.attacker;case 2->d.other;default->throw new AssertionError();};}} static final class Tracker extends CombatTracker {Data d;Tracker(){super(null);}@Override public void recordDamage(DamageSource s,float v){d.event("record "+bits(v));d.recorded=v;d.hit=true;}} - static final class Server extends ServerLevel {Data d;Server(){super(null,null,null,null,null,null,false,0L,List.of(),false);}@Override public void broadcastDamageEvent(Entity a,DamageSource s){d.event("broadcast");}@Override public boolean isClientSide(){d.event("client");return d.flag("client");}@Override public net.minecraft.world.Difficulty getDifficulty(){d.event("difficulty");return net.minecraft.world.Difficulty.values()[d.op.getAsJsonArray("difficulties").get(d.difficultyCalls++).getAsInt()];}@Override public long getGameTime(){d.event("game-time");return d.op.get("game_time").getAsLong();}} + static final class Rules extends GameRules {Data d;Rules(){super(FeatureFlagSet.of());}@SuppressWarnings("unchecked") @Override public T get(GameRule rule){String n=rule==GameRules.DROWNING_DAMAGE?"drowning":rule==GameRules.FALL_DAMAGE?"fall":rule==GameRules.FIRE_DAMAGE?"fire":rule==GameRules.FREEZE_DAMAGE?"freeze":null;if(n==null)throw new AssertionError();d.event("rule "+n);return (T)Boolean.valueOf(d.flag("rule_"+n));}} + static final class Connection extends ServerGamePacketListenerImpl {Data d;Connection(){super(null,null,null,null);}@Override public boolean hasClientLoaded(){d.event("loaded");return d.flag("loaded");}} + static final class Server extends ServerLevel {Data d;Server(){super(null,null,null,null,null,null,false,0L,List.of(),false);}@Override public GameRules getGameRules(){d.event("rules");return d.rules;}@Override public void broadcastDamageEvent(Entity a,DamageSource s){d.event("broadcast");}@Override public boolean isClientSide(){d.event("client");return d.flag("client");}@Override public net.minecraft.world.Difficulty getDifficulty(){d.event("difficulty");return net.minecraft.world.Difficulty.values()[d.op.getAsJsonArray("difficulties").get(d.difficultyCalls++).getAsInt()];}@Override public long getGameTime(){d.event("game-time");return d.op.get("game_time").getAsLong();}} static final class Effect extends MobEffectInstance {Data d;int id;Effect(){super(MobEffects.RESISTANCE);}@Override public void onMobHurt(ServerLevel l,LivingEntity a,DamageSource s,float v){d.event("effect "+id+" "+bits(v));}} static final class Actor extends net.minecraft.world.entity.decoration.ArmorStand {Actor(){super(null,null);} Data d; - @Override public boolean isInvulnerableTo(ServerLevel l,DamageSource s){d.event("invulnerable");return d.flag("invulnerable");} + @Override public boolean isPermanentlyInvulnerable(){d.event("permanent");return d.flag("permanent");} + @Override public boolean isTemporarilyInvulnerable(){d.event("temporary");return d.flag("temporary");} + @Override public boolean fireImmune(){d.event("fire-immune");return d.flag("fire_immune");} @Override public boolean hasEffect(Holder e){if(e==MobEffects.FIRE_RESISTANCE){d.event("fire-resistance");return d.flag("fire_resistance");}if(e!=MobEffects.RESISTANCE)throw new AssertionError();d.event("has-resistance");return d.flag("resistance");} @Override public MobEffectInstance getEffect(Holder e){if(e!=MobEffects.RESISTANCE)throw new AssertionError();d.event("effect");var v=new MobEffectInstance(e,100,0);try{amplifier.setInt(v,d.op.get("amplifier").getAsInt());}catch(Exception ex){throw new AssertionError(ex);}return v;} @Override public double getAttributeValue(Holder a){return d.attributes.getValue(a);} @@ -40,7 +44,7 @@ public final class VanillaServerPlayerCombatOracle { @Override public void stopSleeping(){d.event("wake");} @Override public ItemStack getUseItem(){d.event("use-item");return d.flag("component")?shield:ItemStack.EMPTY;} @Override public float applyItemBlocking(ServerLevel l,DamageSource s,float v){d.event("blocking "+bits(v));return single(d.op.get("blocked"));} - @Override public boolean is(TagKey> tag){if(tag!=EntityTypeTags.FREEZE_HURTS_EXTRA_TYPES)throw new AssertionError();d.event("freeze-extra");return d.flag("freeze_extra");} + @Override public boolean is(TagKey> tag){if(tag==EntityTypeTags.FALL_DAMAGE_IMMUNE){d.event("fall-immune");return d.flag("fall_immune");}if(tag!=EntityTypeTags.FREEZE_HURTS_EXTRA_TYPES)throw new AssertionError();d.event("freeze-extra");return d.flag("freeze_extra");} @Override public ItemStack getItemBySlot(EquipmentSlot slot){d.event("slot "+slot.ordinal());return slot==EquipmentSlot.HEAD&&d.flag("helmet")?plain:ItemStack.EMPTY;} @Override protected void hurtHelmet(DamageSource s,float v){d.event("hurt-helmet "+bits(v));} @Override protected void resolveMobResponsibleForDamage(DamageSource s){d.event("resolve-mob");} @@ -58,7 +62,9 @@ public final class VanillaServerPlayerCombatOracle { static final class Human extends ServerPlayer {Human(){super(null,null,null,null);} Data d; - @Override public boolean isInvulnerableTo(ServerLevel l,DamageSource s){d.event("invulnerable");return d.flag("invulnerable");} + @Override public boolean isPermanentlyInvulnerable(){d.event("permanent");return d.flag("permanent");} + @Override public boolean isTemporarilyInvulnerable(){d.event("temporary");return d.flag("temporary");} + @Override public boolean fireImmune(){d.event("fire-immune");return d.flag("fire_immune");} @Override public boolean hasEffect(Holder e){if(e==MobEffects.FIRE_RESISTANCE){d.event("fire-resistance");return d.flag("fire_resistance");}if(e!=MobEffects.RESISTANCE)throw new AssertionError();d.event("has-resistance");return d.flag("resistance");} @Override public MobEffectInstance getEffect(Holder e){if(e!=MobEffects.RESISTANCE)throw new AssertionError();d.event("effect");var v=new MobEffectInstance(e,100,0);try{amplifier.setInt(v,d.op.get("amplifier").getAsInt());}catch(Exception ex){throw new AssertionError(ex);}return v;} @Override public double getAttributeValue(Holder a){return d.attributes.getValue(a);} @@ -70,7 +76,7 @@ public final class VanillaServerPlayerCombatOracle { @Override public void stopSleeping(){d.event("wake");} @Override public ItemStack getUseItem(){d.event("use-item");return d.flag("component")?shield:ItemStack.EMPTY;} @Override public float applyItemBlocking(ServerLevel l,DamageSource s,float v){d.event("blocking "+bits(v));return single(d.op.get("blocked"));} - @Override public boolean is(TagKey> tag){if(tag!=EntityTypeTags.FREEZE_HURTS_EXTRA_TYPES)throw new AssertionError();d.event("freeze-extra");return d.flag("freeze_extra");} + @Override public boolean is(TagKey> tag){if(tag==EntityTypeTags.FALL_DAMAGE_IMMUNE){d.event("fall-immune");return d.flag("fall_immune");}if(tag!=EntityTypeTags.FREEZE_HURTS_EXTRA_TYPES)throw new AssertionError();d.event("freeze-extra");return d.flag("freeze_extra");} @Override public ItemStack getItemBySlot(EquipmentSlot slot){d.event("slot "+slot.ordinal());return slot==EquipmentSlot.HEAD&&d.flag("helmet")?plain:ItemStack.EMPTY;} @Override protected void hurtHelmet(DamageSource s,float v){d.event("hurt-helmet "+bits(v));} @Override protected void resolveMobResponsibleForDamage(DamageSource s){d.event("resolve-mob");} @@ -85,7 +91,7 @@ public final class VanillaServerPlayerCombatOracle { @Override public ServerLevel level(){d.event("level");return d.level;} @Override public Collection getActiveEffects(){d.event("effects");return d.effects;} - @Override protected void removeEntitiesOnShoulder(){d.event("shoulders");}@Override public boolean canHarmPlayer(Player p){d.event("can-harm");return d.flag("can_harm");}@Override public PlayerAdvancements getAdvancements(){d.event("criterion");return d.advancements;} + @Override public boolean isChangingDimension(){d.event("changing");return d.flag("changing");}@Override protected void removeEntitiesOnShoulder(){d.event("shoulders");}@Override public boolean canHarmPlayer(Player p){d.event("can-harm");return d.flag("can_harm");}@Override public PlayerAdvancements getAdvancements(){d.event("criterion");return d.advancements;} @Override public void awardStat(Identifier s,int v){if(s==Stats.DAMAGE_BLOCKED_BY_SHIELD){d.event("blocked-stat "+v);return;}String n=s==Stats.DAMAGE_RESISTED?"resisted":s==Stats.DAMAGE_ABSORBED?"absorbed":s==Stats.DAMAGE_TAKEN?"taken":null;if(n==null)throw new AssertionError();d.event("stat "+n+" "+v);} } @SuppressWarnings("unchecked") public static void main(String[] args)throws Throwable { @@ -96,11 +102,11 @@ public final class VanillaServerPlayerCombatOracle { var ctor=ItemStack.class.getDeclaredConstructor(Holder.class,int.class,PatchedDataComponentMap.class);ctor.setAccessible(true);plain=(ItemStack)ctor.newInstance(BuiltInRegistries.ITEM.wrapAsHolder(Items.STICK),1,new PatchedDataComponentMap(DataComponentMap.EMPTY));shield=(ItemStack)ctor.newInstance(BuiltInRegistries.ITEM.wrapAsHolder(Items.SHIELD),1,new PatchedDataComponentMap(DataComponentMap.EMPTY));shield.set(DataComponents.BLOCKS_ATTACKS,new BlocksAttacks(0,1,List.of(),new BlocksAttacks.ItemDamageFunction(0,0,0),Optional.empty(),Optional.empty(),Optional.empty())); var lookup=MethodHandles.privateLookupIn(Player.class,MethodHandles.lookup());var playerHurt=lookup.findSpecial(Player.class,"hurtServer",MethodType.methodType(boolean.class,ServerLevel.class,DamageSource.class,float.class),Player.class).asType(MethodType.methodType(boolean.class,LivingEntity.class,ServerLevel.class,DamageSource.class,float.class)); var serverLookup=MethodHandles.privateLookupIn(ServerPlayer.class,MethodHandles.lookup());var serverHurt=serverLookup.findSpecial(ServerPlayer.class,"hurtServer",MethodType.methodType(boolean.class,ServerLevel.class,DamageSource.class,float.class),ServerPlayer.class).asType(MethodType.methodType(boolean.class,LivingEntity.class,ServerLevel.class,DamageSource.class,float.class)); - try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();var d=new Data();d.out=out;d.level=make(Server.class);d.level.d=d;d.advancements=make(PlayerAdvancements.class);field(PlayerAdvancements.class,"activeTriggers").set(d.advancements,new HashMap<>());var human=make(Human.class);human.d=d;LivingEntity actor=human;d.abilities=new Abilities();field(Player.class,"abilities").set(actor,d.abilities);d.attacker=make(PlainPlayer.class);d.other=make(Actor.class);d.other.d=d;d.arrow=make(Arrow.class);d.arrow.d=d;var hurt=serverHurt;var source=make(Source.class);source.d=d; + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();var d=new Data();d.out=out;d.level=make(Server.class);d.level.d=d;d.advancements=make(PlayerAdvancements.class);field(PlayerAdvancements.class,"activeTriggers").set(d.advancements,new HashMap<>());d.rules=make(Rules.class);d.rules.d=d;var human=make(Human.class);human.d=d;var connection=make(Connection.class);connection.d=d;human.connection=connection;LivingEntity actor=human;d.abilities=new Abilities();field(Player.class,"abilities").set(actor,d.abilities);d.attacker=make(PlainPlayer.class);d.other=make(Actor.class);d.other.d=d;d.arrow=make(Arrow.class);d.arrow.d=d;var hurt=serverHurt;var source=make(Source.class);source.d=d; d.attributes=new AttributeMap(VanillaEntityAttributeOracle.supplier(BuiltInRegistries.ENTITY_TYPE.getValue(Identifier.parse("minecraft:player"))));for(int i=0;i[Math.max(healthKey.id(),absorptionKey.id())+1];for(int i=0;i(new EntityDataAccessor(i,EntityDataSerializers.FLOAT),0f);var health=new SynchedEntityData.DataItem(healthKey,single(f.get("health")));var absorption=new SynchedEntityData.DataItem(absorptionKey,single(f.get("absorption")));items[healthKey.id()]=health;items[absorptionKey.id()]=absorption;d.data=dataCtor.newInstance(actor,items);field(Entity.class,"entityData").set(actor,d.data);field(LivingEntity.class,"dead").setBoolean(actor,f.get("dead").getAsBoolean());var food=new FoodData();exhaustion.setFloat(food,single(f.get("exhaustion")));field(Player.class,"foodData").set(actor,food);d.tracker=make(Tracker.class);d.tracker.d=d; noAction.setInt(actor,f.get("no_action").getAsInt());cooldown.setInt(actor,f.get("cooldown").getAsInt());lastHurt.setFloat(actor,single(f.get("last_hurt")));duration.setInt(actor,f.get("duration").getAsInt());time.setInt(actor,f.get("time").getAsInt());stamp.setLong(actor,f.get("stamp").getAsLong());if(f.get("source").getAsBoolean())lastSource.set(actor,source); - for(var ov:f.getAsJsonArray("ops")){d.op=ov.getAsJsonObject();if(d.op.has("reset_cooldown")&&d.flag("reset_cooldown"))cooldown.setInt(actor,0);d.calls=0;d.difficultyCalls=0;d.hit=false;d.abilities.invulnerable=d.flag("ability_invulnerable");d.effects=new ArrayList<>();for(int i=0;i();for(int i=0;if',v).hex() def double(v):return struct.pack('>d',v).hex() @@ -46,6 +46,17 @@ def corpus(catalog): f=copy.deepcopy(template);f.update(absorption=bits(absorption),cooldown=0,last_hurt=bits(0));f['ops']=[dict(clean,fail=fail,pack_callback=True,break_armor=True,resistance=True,amplifier=0),dict(clean,damage=bits(25),pack=True)];yield f +def corpus(catalog): + rng=random.Random(0x494d4d554e45434f) + for i,f in enumerate(storage_corpus(catalog)): + for o in f['ops']: + o.update(removed=False,permanent=o['invulnerable'],temporary=False,creative=False,fire_immune=False,fall_immune=False,fall=False,drowning=False,rule_drowning=True,rule_fall=True,rule_fire=True,rule_freeze=True,changing=False,pearl=False,loaded=True) + if i%3==0: + for k in ['removed','temporary','creative','fire_immune','fall_immune','fall','drowning','changing','pearl']:o[k]=rng.randrange(8)==0 + for k in ['rule_drowning','rule_fall','rule_fire','rule_freeze','loaded']:o[k]=rng.randrange(4)!=0 + yield f + + def main(): parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() build=lab.LOCAL/'rust-server-player-combat-parity';build.mkdir(parents=True,exist_ok=True) @@ -75,7 +86,7 @@ def main(): references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) print(f'{side}: {matched:,} server player combat output lines match Rust',flush=True) base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) - report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual ServerPlayer outer hurt through Player/LivingEntity gates and actual Player inner damage, native armor/resistance reduction, registered modified attributes, synchronized health/absorption and FoodData exhaustion. Repeated hits, cooldown/state writes, death rejection, callbacks and numeric edges. Invulnerability predicate, blocking amount, durability, effects, PvP permission, attribution, knockback, death services and criterion listeners remain controlled; enchanted items, registered sources and complete entity/game lifecycle remain pending.'} + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual ServerPlayer outer hurt through Player/LivingEntity gates and actual Player inner damage, native armor/resistance reduction, registered modified attributes, synchronized health/absorption and FoodData exhaustion. Repeated hits, cooldown/state writes, death rejection, callbacks and numeric edges. Actual inherited invulnerability predicates include virtual flags, empty-equipment enchantment immunity, damage gamerules and client-loading/dimension guards; blocking amount, durability, effects, PvP permission, attribution, knockback, death services and criterion listeners remain controlled; enchanted items, registered sources and complete entity/game lifecycle remain pending.'} lab.write_json(report_path,report);print(f'Scoped server player combat parity passed: {report_path}') From ede46ac7482702463803ea9a39c2f39049e932e9 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 05:47:53 +0200 Subject: [PATCH 122/253] Implement registered damage types, tags and source identity queries --- .../scoped-parity.json | 261 ++++++++++++++++++ .../examples/damage_source_fixture.rs | 170 ++++++++++++ crates/horizon-world/src/damage_source.rs | 256 +++++++++++++++++ crates/horizon-world/src/lib.rs | 1 + crates/horizon-world/src/worldgen/tags.rs | 2 +- docs/collision-geometry.md | 18 ++ .../parity/VanillaDamageSourceOracle.java | 52 ++++ tools/test_damage_source_parity.py | 72 +++++ 8 files changed, 831 insertions(+), 1 deletion(-) create mode 100644 benchmarks/rust-damage-source-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/damage_source_fixture.rs create mode 100644 crates/horizon-world/src/damage_source.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDamageSourceOracle.java create mode 100644 tools/test_damage_source_parity.py diff --git a/benchmarks/rust-damage-source-2026-10-07/scoped-parity.json b/benchmarks/rust-damage-source-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..9b515214c --- /dev/null +++ b/benchmarks/rust-damage-source-2026-10-07/scoped-parity.json @@ -0,0 +1,261 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 15100, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDamageSourceOracle.java": "0cf0126d69d1052dea74a6bfb5a97250ab69d8f7a95360d9c6399fe03376dcd2", + "tools/test_damage_source_parity.py": "3598b5401983e7c904a5674b38a8b64fb948c64af16355aa9c474fcb2e937532", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_immunity.rs": "fd39c41124d694e755cf7faadcf93c636df4042c78ec345092a856b5f952dbcf", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/damage_source.rs": "0225398b1e9b1c3901fab0bead65ff022b34a809a51805f6cce293c20dbb7d78", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "d659328576264bc7a454d4520dfba50664cdc86a617707b7caba0396965c1d97", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "2b448209629b9bf2e678d667ad0d6c7fa22146892dd106b169d96b31b0df12bb", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_hurt.rs": "844239ad7d15c39629bb3cfc06ebae6d1cff20b7627468f26e0ee8dff3abdcb8", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_hurt.rs": "99c9bbd8587ec2dc287806049897b8034d2f5349ad47fc497b70d54148844a36", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/server_player_combat.rs": "a9743971581af86d926eeba42004d932caf83382c470dd98bf613cb9c417db58", + "crates/horizon-world/src/server_player_damage.rs": "828a4649fec3e9bda2dfe20aced8c95922c697321de2be4127bd4e5712ecbb7c", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "f417aab280331ddd6f0ca265a12c0130c78b9924f407c7e07f198140501e6010", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "74e4110fb19c4c4047192fd65c38015b8afc7f9fc50404d75380b5063808148c", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/damage_source_fixture.rs": "a0e3941fec8bd009a48f3e42782d505774f903538f843b07e307a24500b86b23" + }, + "fixtures_sha256": { + ".local/rust-damage-source-parity/inputs.txt": "80f28c50242eafe34c168a4f457eedd0bfc60b5c4943ab53e4ceb06b75f2a1df", + ".local/rust-damage-source-parity/catalog.json": "1c40ea4dc7430aa7ad737258a320ef35e72df977370d1a228bc2876d69289598", + ".local/rust-damage-source-parity/types.json": "ec99090df073d7fdad34de5c8930f9e09e25a04b432bb890120fedefb7bea30f", + ".local/rust-damage-source-parity/tags.json": "df5da1c56b40691bac096e0e8c98a77063b6f056a5f53e75068e5fef89595af8" + }, + "rust_output_sha256": "a2e2595df33133fe0bf98e270bb93ed68b06fbc1e2085328c8611e59d68056e8", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "a2e2595df33133fe0bf98e270bb93ed68b06fbc1e2085328c8611e59d68056e8", + "matched_output_lines": 152175 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "a2e2595df33133fe0bf98e270bb93ed68b06fbc1e2085328c8611e59d68056e8", + "matched_output_lines": 152175 + } + ], + "scope": "Native DamageType codec export and TagLoader resolution for all bundled vanilla damage definitions/tags; ordinary DamageSource constructor identity, difficulty scaling, exhaustion, type/tag membership, weapon/direct-position access and virtual creative-source dispatch. Entity position/weapon/ability queries are controlled, including mutation and failures. Catalog indices are local, not network IDs; live registry reload, damage definition codecs in Rust, death-message generation and combat registry binding remain pending." +} diff --git a/crates/horizon-world/examples/damage_source_fixture.rs b/crates/horizon-world/examples/damage_source_fixture.rs new file mode 100644 index 000000000..7e8bfdaee --- /dev/null +++ b/crates/horizon-world/examples/damage_source_fixture.rs @@ -0,0 +1,170 @@ +use horizon_world::damage_source::{Catalog, EntityKind, SourceWorld}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn position(v: &Value) -> [f64; 3] { + std::array::from_fn(|i| number(&v[i])) +} +fn bits(v: f64) -> u64 { + if v.is_nan() { + f64::NAN.to_bits() + } else { + v.to_bits() + } +} +fn vec(v: Option<[f64; 3]>) -> String { + match v { + None => "none".into(), + Some(v) => format!( + "{:016x} {:016x} {:016x}", + bits(v[0]), + bits(v[1]), + bits(v[2]) + ), + } +} +struct World<'a> { + f: &'a Value, + out: &'a mut dyn Write, + calls: i64, + changed: bool, +} +impl World<'_> { + fn state(&self) -> &Value { + &self.f[if self.changed { "after" } else { "initial" }] + } + fn event(&mut self, s: &str) -> io::Result<()> { + writeln!(self.out, "{s}")?; + let n = self.calls; + self.calls += 1; + if n == self.f["fail"].as_i64().unwrap() { + return Err(io::Error::other("injected damage source query failure")); + } + if n == self.f["mutate_at"].as_i64().unwrap() { + self.changed = true; + } + Ok(()) + } +} +impl SourceWorld for World<'_> { + type Error = io::Error; + type Entity = usize; + type Weapon = (); + fn kind(&self, id: usize) -> EntityKind { + match id { + 2 => EntityKind::Living, + 3 | 4 => EntityKind::Player, + _ => EntityKind::Other, + } + } + fn weapon(&mut self, id: usize) -> io::Result> { + self.event(&format!("weapon {id}"))?; + Ok(self.state()["weapons"][id].as_bool().unwrap().then_some(())) + } + fn position(&mut self, id: usize) -> io::Result<[f64; 3]> { + self.event(&format!("position {id}"))?; + Ok(position(&self.state()["positions"][id])) + } + fn causing_entity(&mut self, stored: Option) -> io::Result> { + self.event("entity")?; + Ok(if self.f["virtual"].as_bool().unwrap() { + let id = self.state()["virtual_entity"].as_u64().unwrap() as usize; + (id != 0).then_some(id) + } else { + stored + }) + } + fn instabuild(&mut self, id: usize) -> io::Result { + self.event(&format!("abilities {id}"))?; + Ok(self.state()["creative"][id].as_bool().unwrap()) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let catalog = Catalog::from_json( + &serde_json::from_str(&fs::read_to_string(dir.join("catalog.json"))?)?, + &serde_json::from_str(&fs::read_to_string(dir.join("tags.json"))?)?, + )?; + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for (id, d) in catalog.entries() { + writeln!( + out, + "definition {} {} {:08x} {} {} {}", + d.name, + d.message_id, + d.exhaustion.to_bits(), + d.scaling.name(), + d.effects, + d.death_message_type + )?; + for tag in catalog.tags() { + writeln!(out, "tag {tag} {}", catalog.in_tag(id, tag))?; + } + } + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let entity = |key: &str| { + let id = f[key].as_u64().unwrap() as usize; + (id != 0).then_some(id) + }; + let (direct, causing, pos) = match f["constructor"].as_u64().unwrap() { + 0 => (entity("direct"), entity("causing"), None), + 1 => (entity("direct"), entity("direct"), None), + 2 => (None, None, Some(position(&f["position"]))), + 3 => (None, None, None), + _ => panic!("constructor"), + }; + let source = catalog + .source( + catalog.id(f["type"].as_str().unwrap()).unwrap(), + direct, + causing, + pos, + ) + .unwrap(); + let mut w = World { + f: &f, + out: &mut out, + calls: 0, + changed: false, + }; + let result = (|| -> io::Result<()> { + writeln!( + w.out, + "direct {} {} {}", + source.is_direct(), + source.direct_entity().unwrap_or(0), + source.causing_entity().unwrap_or(0) + )?; + let scales = source.scales_with_difficulty(&w); + writeln!(w.out, "scales {scales}")?; + let weapon = source.weapon(&mut w)?; + writeln!(w.out, "weapon-result {}", weapon.is_some())?; + let creative = source.creative_player(&mut w)?; + writeln!(w.out, "creative {creative}")?; + let pos = source.position(&mut w)?; + writeln!(w.out, "position-result {}", vec(pos))?; + writeln!(w.out, "raw {}", vec(source.position_raw()))?; + writeln!( + w.out, + "type {}", + source.is_type(f["check_type"].as_str().unwrap()) + )?; + Ok(()) + })(); + writeln!( + w.out, + "result {}", + if result.is_ok() { "ok" } else { "error" } + )?; + writeln!(w.out, "queries {} {}", w.calls, w.changed)?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/damage_source.rs b/crates/horizon-world/src/damage_source.rs new file mode 100644 index 000000000..f9b910fde --- /dev/null +++ b/crates/horizon-world/src/damage_source.rs @@ -0,0 +1,256 @@ +//! Version-checked damage definitions/tags and ordinary source identity queries. +//! Catalogs are immutable snapshots; runtime registry reload and wire IDs remain +//! separate from these local definition indices. +use crate::{ + DATA_VERSION, + compression::invalid, + worldgen::tags::{TagDefinitions, identifier}, +}; +use serde_json::Value; +use std::{ + collections::{BTreeMap, BTreeSet}, + io, +}; +#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct DamageTypeId(usize); +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum Scaling { + Never, + LivingNonPlayer, + Always, +} +impl Scaling { + pub fn name(self) -> &'static str { + match self { + Self::Never => "never", + Self::LivingNonPlayer => "when_caused_by_living_non_player", + Self::Always => "always", + } + } +} +#[derive(Debug)] +pub struct Definition { + pub name: String, + pub message_id: String, + pub exhaustion: f32, + pub scaling: Scaling, + pub effects: String, + pub death_message_type: String, +} +#[derive(Debug)] +pub struct Catalog { + definitions: Vec, + ids: BTreeMap, + tags: BTreeMap>, +} +fn string(v: &Value) -> io::Result<&str> { + v.as_str() + .ok_or_else(|| invalid("expected damage catalog string")) +} +impl Catalog { + /// Imports native decoded definitions and resolves raw tag resources with + /// the shared tag implementation. No data-pack or network IDs are invented. + pub fn from_json(v: &Value, resources: &Value) -> io::Result { + if v["data_version"].as_i64() != Some(i64::from(DATA_VERSION)) { + return Err(invalid("damage catalog data version mismatch")); + } + let mut definitions = Vec::new(); + let mut ids = BTreeMap::new(); + for d in v["types"] + .as_array() + .ok_or_else(|| invalid("missing damage definitions"))? + { + let name = string(&d["id"])?; + if identifier(name).map_err(|e| invalid(e.to_string()))? != name + || ids + .insert(name.into(), DamageTypeId(definitions.len())) + .is_some() + { + return Err(invalid("noncanonical or duplicate damage type")); + } + let bits = string(&d["exhaustion"])?; + if bits.len() != 8 { + return Err(invalid("expected damage exhaustion float bits")); + } + let exhaustion = + f32::from_bits(u32::from_str_radix(bits, 16).map_err(|e| invalid(e.to_string()))?); + let scaling = match string(&d["scaling"])? { + "never" => Scaling::Never, + "when_caused_by_living_non_player" => Scaling::LivingNonPlayer, + "always" => Scaling::Always, + _ => return Err(invalid("unknown damage scaling")), + }; + let effects = string(&d["effects"])?; + if ![ + "hurt", "thorns", "drowning", "burning", "poking", "freezing", + ] + .contains(&effects) + { + return Err(invalid("unknown damage effects")); + } + let death = string(&d["death_message_type"])?; + if !["default", "fall_variants", "intentional_game_design"].contains(&death) { + return Err(invalid("unknown death message type")); + } + definitions.push(Definition { + name: name.into(), + message_id: string(&d["message_id"])?.into(), + exhaustion, + scaling, + effects: effects.into(), + death_message_type: death.into(), + }); + } + let mut tags = TagDefinitions::default(); + for (id, json) in resources + .as_object() + .ok_or_else(|| invalid("expected damage tag resources"))? + { + tags.apply_json(id, "vanilla", string(json)?) + .map_err(|e| invalid(e.to_string()))?; + } + let tags = tags + .build(|id, _| ids.get(id).copied()) + .map_err(|e| invalid(e.to_string()))?; + if !tags.missing.is_empty() { + return Err(invalid("unresolved required damage tag references")); + } + Ok(Self { + definitions, + ids, + tags: tags + .tags + .into_iter() + .map(|(id, v)| (id, v.into_iter().collect())) + .collect(), + }) + } + pub fn id(&self, name: &str) -> Option { + self.ids.get(name).copied() + } + pub fn definition(&self, id: DamageTypeId) -> Option<&Definition> { + self.definitions.get(id.0) + } + pub fn entries(&self) -> impl Iterator { + self.definitions + .iter() + .enumerate() + .map(|(i, d)| (DamageTypeId(i), d)) + } + pub fn tags(&self) -> impl Iterator { + self.tags.keys().map(String::as_str) + } + pub fn in_tag(&self, id: DamageTypeId, tag: &str) -> bool { + self.tags.get(tag).is_some_and(|v| v.contains(&id)) + } + pub fn source( + &self, + id: DamageTypeId, + direct: Option, + causing: Option, + position: Option<[f64; 3]>, + ) -> Option> { + self.definition(id)?; + Some(DamageSource { + catalog: self, + id, + direct, + causing, + position, + }) + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum EntityKind { + Other, + Living, + Player, +} +pub trait SourceWorld { + type Error; + type Entity: Copy + Eq; + type Weapon; + fn kind(&self, entity: Self::Entity) -> EntityKind; + fn weapon(&mut self, entity: Self::Entity) -> Result, Self::Error>; + fn position(&mut self, entity: Self::Entity) -> Result<[f64; 3], Self::Error>; + /// Virtual getEntity dispatch is used by the creative-source predicate; + /// difficulty scaling deliberately reads the stored causing entity instead. + fn causing_entity( + &mut self, + stored: Option, + ) -> Result, Self::Error>; + fn instabuild(&mut self, player: Self::Entity) -> Result; +} +#[derive(Clone, Copy, Debug)] +pub struct DamageSource<'a, E> { + catalog: &'a Catalog, + id: DamageTypeId, + direct: Option, + causing: Option, + position: Option<[f64; 3]>, +} +impl DamageSource<'_, E> { + pub fn definition(&self) -> &Definition { + &self.catalog.definitions[self.id.0] + } + pub fn type_id(&self) -> DamageTypeId { + self.id + } + pub fn is_type(&self, name: &str) -> bool { + self.definition().name == name + } + pub fn in_tag(&self, tag: &str) -> bool { + self.catalog.in_tag(self.id, tag) + } + pub fn direct_entity(&self) -> Option { + self.direct + } + pub fn causing_entity(&self) -> Option { + self.causing + } + pub fn is_direct(&self) -> bool { + self.direct == self.causing + } + pub fn position_raw(&self) -> Option<[f64; 3]> { + self.position + } + pub fn food_exhaustion(&self) -> f32 { + self.definition().exhaustion + } + pub fn scales_with_difficulty>(&self, w: &W) -> bool { + match self.definition().scaling { + Scaling::Never => false, + Scaling::Always => true, + Scaling::LivingNonPlayer => self + .causing + .is_some_and(|e| w.kind(e) == EntityKind::Living), + } + } + pub fn weapon>( + &self, + w: &mut W, + ) -> Result, W::Error> { + match self.direct { + Some(e) => w.weapon(e), + None => Ok(None), + } + } + pub fn position>( + &self, + w: &mut W, + ) -> Result, W::Error> { + if let Some(p) = self.position { + return Ok(Some(p)); + } + match self.direct { + Some(e) => w.position(e).map(Some), + None => Ok(None), + } + } + pub fn creative_player>(&self, w: &mut W) -> Result { + match w.causing_entity(self.causing)? { + Some(e) if w.kind(e) == EntityKind::Player => w.instabuild(e), + _ => Ok(false), + } + } +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 6a3c561e0..9b2c4086f 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -22,6 +22,7 @@ pub mod combat_rules; pub mod compression; pub mod damage_immunity; pub mod damage_reduction; +pub mod damage_source; pub mod dynamic_support; pub mod edge_backoff; pub mod entity_collision; diff --git a/crates/horizon-world/src/worldgen/tags.rs b/crates/horizon-world/src/worldgen/tags.rs index 6cc94a467..9c22abc76 100644 --- a/crates/horizon-world/src/worldgen/tags.rs +++ b/crates/horizon-world/src/worldgen/tags.rs @@ -64,7 +64,7 @@ impl TagFile { } } // Identifier.CODEC permits the empty path as well as an omitted namespace. -pub(super) fn identifier(name: &str) -> Result { +pub(crate) fn identifier(name: &str) -> Result { let (namespace, path) = name.split_once(':').unwrap_or(("minecraft", name)); let namespace = if namespace.is_empty() { "minecraft" diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 9d7e0946c..f6582288f 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1418,3 +1418,21 @@ retains **161,198 matching lines per JAR** after extracting the shared body. Targeted Clippy passes. Virtual flags, source tags/rule values and the other world services listed above remain controlled; the fixture now executes the immunity decisions themselves instead of supplying their final result. + + +`damage_source` imports version-checked native decoded damage definitions and +resolves their raw tag resources with the shared tag implementation. Sources +retain distinct direct/causing entities and optional explicit positions. Weapon +and fallback position queries use the direct entity; difficulty scaling uses +the stored causing entity, while creative-source detection dispatches virtual +causing-entity access before reading player abilities. + +`python3 tools/test_damage_source_parity.py` covers all **51 bundled damage +types and 36 damage-type tags**, using the actual native DamageType codec and +TagLoader. The [damage-source report](../benchmarks/rust-damage-source-2026-10-07/scoped-parity.json) +records **152,175 matching lines per JAR**, including constructor identities, +scaling, exhaustion, tag/type membership, position/weapon queries, virtual +causing-entity replacement, mutations and failures. Targeted Clippy passes. +Catalogs are immutable snapshots with local indices, not network IDs. Rust +DamageType codecs, runtime reload, death-message generation, full entity query +bindings and combat source integration remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDamageSourceOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDamageSourceOracle.java new file mode 100644 index 000000000..49558dd2a --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDamageSourceOracle.java @@ -0,0 +1,52 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import com.mojang.serialization.*;import java.io.*;import java.lang.reflect.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.*;import net.minecraft.core.registries.*;import net.minecraft.resources.*;import net.minecraft.tags.*;import net.minecraft.world.entity.*;import net.minecraft.world.entity.player.*;import net.minecraft.world.damagesource.*;import net.minecraft.world.item.*;import net.minecraft.world.phys.Vec3; +/** Native decoded damage definitions, resolved tags and source query behavior. */ +public final class VanillaDamageSourceOracle { + static final class Stop extends RuntimeException {} + static Object unsafe;static Method allocate; + static T make(Class c)throws Exception{return c.cast(allocate.invoke(unsafe,c));} + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + static Vec3 position(JsonElement v){var a=v.getAsJsonArray();return new Vec3(number(a.get(0)),number(a.get(1)),number(a.get(2)));} + static String bits(float v){return String.format("%08x",Float.floatToIntBits(v));} + static String vec(Vec3 v){return v==null?"none":String.format("%016x %016x %016x",Double.doubleToLongBits(v.x),Double.doubleToLongBits(v.y),Double.doubleToLongBits(v.z));} + static final class Data {JsonObject f;PrintWriter out;int calls;boolean changed;Entity[] entities; + JsonObject state(){return f.getAsJsonObject(changed?"after":"initial");}void event(String s){out.println(s);int n=calls++;if(n==f.get("fail").getAsInt())throw new Stop();if(n==f.get("mutate_at").getAsInt())changed=true;} + int id(Entity e){for(int i=0;i t,Entity direct,Entity causing){super(t,direct,causing);}Source(Holder t,Entity entity){super(t,entity);}Source(Holder t,Vec3 p){super(t,p);}Source(Holder t){super(t);} + @Override public Entity getEntity(){d.event("entity");return d.f.get("virtual").getAsBoolean()?d.entities[d.state().get("virtual_entity").getAsInt()]:super.getEntity();} + Entity stored(){return super.getEntity();}} + static final class Other extends net.minecraft.world.entity.Marker {Other(){super(null,null);} +Data d;int id; + @Override public ItemStack getWeaponItem(){d.event("weapon "+id);return d.state().getAsJsonArray("weapons").get(id).getAsBoolean()?ItemStack.EMPTY:null;} + @Override public Vec3 position(){d.event("position "+id);return VanillaDamageSourceOracle.position(d.state().getAsJsonArray("positions").get(id));} + } + static final class Living extends net.minecraft.world.entity.decoration.ArmorStand {Living(){super(null,null);} +Data d;int id; + @Override public ItemStack getWeaponItem(){d.event("weapon "+id);return d.state().getAsJsonArray("weapons").get(id).getAsBoolean()?ItemStack.EMPTY:null;} + @Override public Vec3 position(){d.event("position "+id);return VanillaDamageSourceOracle.position(d.state().getAsJsonArray("positions").get(id));} + } + static final class Human extends Player {Human(){super(null,null);} +Data d;int id; + @Override public ItemStack getWeaponItem(){d.event("weapon "+id);return d.state().getAsJsonArray("weapons").get(id).getAsBoolean()?ItemStack.EMPTY:null;} + @Override public Vec3 position(){d.event("position "+id);return VanillaDamageSourceOracle.position(d.state().getAsJsonArray("positions").get(id));} + @Override public net.minecraft.world.level.GameType gameMode(){return net.minecraft.world.level.GameType.SURVIVAL;} + @Override public Abilities getAbilities(){d.event("abilities "+id);var a=new Abilities();a.instabuild=d.state().getAsJsonArray("creative").get(id).getAsBoolean();return a;} + } + static MappedRegistry registry(Path dir)throws Exception { + var registry=new MappedRegistry(Registries.DAMAGE_TYPE,Lifecycle.stable());var resources=JsonParser.parseString(Files.readString(dir.resolve("types.json"))).getAsJsonObject();for(var e:resources.entrySet())registry.register(ResourceKey.create(Registries.DAMAGE_TYPE,Identifier.parse(e.getKey())),DamageType.DIRECT_CODEC.parse(JsonOps.INSTANCE,JsonParser.parseString(e.getValue().getAsString())).getOrThrow(),RegistrationInfo.BUILT_IN);registry.bindAllTagsToEmpty();registry.freeze(); + var loader=new TagLoader>((id,required)->registry.get(id).map(v->(Holder)v),"tags/damage_type");var definitions=new HashMap>();for(var e:JsonParser.parseString(Files.readString(dir.resolve("tags.json"))).getAsJsonObject().entrySet()){var file=TagFile.CODEC.parse(JsonOps.INSTANCE,JsonParser.parseString(e.getValue().getAsString())).getOrThrow();var entries=new ArrayList();for(var entry:file.entries())entries.add(new TagLoader.EntryWithSource(entry,"vanilla"));definitions.put(Identifier.parse(e.getKey()),entries);}var tags=new HashMap,List>>();loader.build(definitions).forEach((id,values)->tags.put(TagKey.create(Registries.DAMAGE_TYPE,id),List.copyOf(values)));if(tags.size()!=definitions.size())throw new AssertionError("missing tags");registry.prepareTagReload(new TagLoader.LoadResult<>(Registries.DAMAGE_TYPE,tags)).apply();return registry; + } + public static void main(String[] args)throws Exception{ + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();Path dir=Path.of(args[1]);var registry=registry(dir);var names=new TreeSet(Comparator.comparing(Identifier::toString));names.addAll(registry.keySet());var tagNames=new TreeSet();tagNames.addAll(JsonParser.parseString(Files.readString(dir.resolve("tags.json"))).getAsJsonObject().keySet()); + if(args[0].equals("export")){var root=new JsonObject();root.addProperty("data_version",net.minecraft.SharedConstants.getCurrentVersion().dataVersion().version());var types=new JsonArray();for(var id:names){var t=registry.getValue(id);var d=new JsonObject();d.addProperty("id",id.toString());d.addProperty("message_id",t.msgId());d.addProperty("exhaustion",bits(t.exhaustion()));d.addProperty("scaling",t.scaling().getSerializedName());d.addProperty("effects",t.effects().getSerializedName());d.addProperty("death_message_type",t.deathMessageType().getSerializedName());types.add(d);}root.add("types",types);Files.writeString(dir.resolve("catalog.json"),root.toString());return;} + var u=Class.forName("sun.misc.Unsafe");var uf=u.getDeclaredField("theUnsafe");uf.setAccessible(true);unsafe=uf.get(null);allocate=u.getMethod("allocateInstance",Class.class); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){ + for(var id:names){var holder=registry.get(id).orElseThrow();var source=new DamageSource(holder);var t=source.type();out.println("definition "+id+" "+source.getMsgId()+" "+bits(source.getFoodExhaustion())+" "+t.scaling().getSerializedName()+" "+t.effects().getSerializedName()+" "+t.deathMessageType().getSerializedName());for(var tag:tagNames)out.println("tag "+tag+" "+source.is(TagKey.create(Registries.DAMAGE_TYPE,Identifier.parse(tag))));} + for(var line:(Iterable)lines::iterator){var d=new Data();d.f=JsonParser.parseString(line).getAsJsonObject();d.out=out;var other=make(Other.class);other.d=d;other.id=1;var living=make(Living.class);living.d=d;living.id=2;var a=make(Human.class);a.d=d;a.id=3;var b=make(Human.class);b.d=d;b.id=4;d.entities=new Entity[]{null,other,living,a,b};var f=d.f;var holder=registry.get(Identifier.parse(f.get("type").getAsString())).orElseThrow();int direct=f.get("direct").getAsInt(),causing=f.get("causing").getAsInt();var source=switch(f.get("constructor").getAsInt()){case 0->new Source(holder,d.entities[direct],d.entities[causing]);case 1->new Source(holder,d.entities[direct]);case 2->new Source(holder,position(f.get("position")));case 3->new Source(holder);default->throw new AssertionError();};source.d=d; + try{out.println("direct "+source.isDirect()+" "+d.id(source.getDirectEntity())+" "+d.id(source.stored()));out.println("scales "+source.scalesWithDifficulty());out.println("weapon-result "+(source.getWeaponItem()!=null));out.println("creative "+source.isCreativePlayer());out.println("position-result "+vec(source.getSourcePosition()));out.println("raw "+vec(source.sourcePositionRaw()));out.println("type "+source.is(ResourceKey.create(Registries.DAMAGE_TYPE,Identifier.parse(f.get("check_type").getAsString()))));out.println("result ok");}catch(Stop e){out.println("result error");}out.println("queries "+d.calls+" "+d.changed); + } + } + } +} diff --git a/tools/test_damage_source_parity.py b/tools/test_damage_source_parity.py new file mode 100644 index 000000000..1e7af0480 --- /dev/null +++ b/tools/test_damage_source_parity.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python3 +"""Compare registered damage-source identity and gameplay queries with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +import zipfile +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(catalog): + def bits(v):return struct.pack('>d',v).hex() + names=[d['id'] for d in catalog['types']] + def state(**kw): + s=dict(weapons=[False,True,False,True,False],creative=[False,False,False,True,False],positions=[[bits(i*.25),bits(-i),bits(i+.75)] for i in range(5)],virtual_entity=4);s.update(kw);return s + def row(name,direct=0,causing=0,constructor=0,**kw): + f=dict(type=name,direct=direct,causing=causing,constructor=constructor,position=[bits(-0.),bits(10),bits(-20)],initial=state(),after=state(),virtual=False,fail=-1,mutate_at=-1,check_type=name);f.update(kw);return f + for name in names: + for direct in range(5): + for causing in range(5): + for constructor in range(4):yield row(name,direct,causing,constructor) + values=[-float('inf'),-1e30,-1,-0.,0.,1e-300,.1,1,5,10,20,1e30,float('inf'),float('nan')] + rng=random.Random(0x44414d4147455352) + def random_state():return state(weapons=[bool(rng.randrange(2)) for _ in range(5)],creative=[bool(rng.randrange(2)) for _ in range(5)],positions=[[bits(rng.choice(values)) for _ in range(3)] for _ in range(5)],virtual_entity=rng.randrange(5)) + for _ in range(10000):yield row(rng.choice(names),rng.randrange(5),rng.randrange(5),rng.randrange(4),initial=random_state(),after=random_state(),virtual=bool(rng.randrange(2)),fail=rng.randrange(-1,5),mutate_at=rng.randrange(-1,5),position=[bits(rng.choice(values)) for _ in range(3)],check_type=rng.choice(names+['minecraft:unknown'])) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-damage-source-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + with zipfile.ZipFile(jars['server']) as archive: + for file,prefix in [('types.json','data/minecraft/damage_type/'),('tags.json','data/minecraft/tags/damage_type/')]: + resources={'minecraft:'+n[len(prefix):-5]:archive.read(n).decode('utf-8') for n in sorted(archive.namelist()) if n.startswith(prefix) and n.endswith('.json')};lab.write_json(build/file,resources) + + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDamageSourceOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/damage_source_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaDamageSourceOracle',mode,path],side+'-'+mode) + java('server','export',build);catalog=json.loads((build/'catalog.json').read_text());fixtures=list(corpus(catalog));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs,build/'catalog.json',build/'types.json',build/'tags.json'];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','damage_source_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('damage_source_fixture.exe' if os.name=='nt' else 'damage_source_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} damage source output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Native DamageType codec export and TagLoader resolution for all bundled vanilla damage definitions/tags; ordinary DamageSource constructor identity, difficulty scaling, exhaustion, type/tag membership, weapon/direct-position access and virtual creative-source dispatch. Entity position/weapon/ability queries are controlled, including mutation and failures. Catalog indices are local, not network IDs; live registry reload, damage definition codecs in Rust, death-message generation and combat registry binding remain pending.'} + lab.write_json(report_path,report);print(f'Scoped damage source parity passed: {report_path}') + + +if __name__=='__main__':main() From a6b7598c164be43698530abf95dfb80930354468 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 05:54:59 +0200 Subject: [PATCH 123/253] Drive composed player combat with registered vanilla damage sources --- .../scoped-parity.json | 270 ++++++++ .../registered_player_combat_fixture.rs | 615 ++++++++++++++++++ crates/horizon-world/src/damage_source.rs | 30 + docs/collision-geometry.md | 17 + .../VanillaRegisteredPlayerCombatOracle.java | 108 +++ tools/test_registered_player_combat_parity.py | 75 +++ 6 files changed, 1115 insertions(+) create mode 100644 benchmarks/rust-registered-player-combat-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/registered_player_combat_fixture.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegisteredPlayerCombatOracle.java create mode 100644 tools/test_registered_player_combat_parity.py diff --git a/benchmarks/rust-registered-player-combat-2026-10-07/scoped-parity.json b/benchmarks/rust-registered-player-combat-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..0d747b10c --- /dev/null +++ b/benchmarks/rust-registered-player-combat-2026-10-07/scoped-parity.json @@ -0,0 +1,270 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 9097, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegisteredPlayerCombatOracle.java": "3411a6ffdb1126e8650231e727aea6710d40ac160d6589d68d78b8a54636ef42", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityAttributeOracle.java": "2ad3190a9798ab54bd12e88573028d0ca6a204e2f8a92018aae98b22335213bf", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerHealthOracle.java": "5d6dc93c0140e2b2f953fba7290721079d5a607fa81b051e2ac1e4742ab606f2", + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDamageSourceOracle.java": "0cf0126d69d1052dea74a6bfb5a97250ab69d8f7a95360d9c6399fe03376dcd2", + "tools/test_server_player_combat_parity.py": "79e74d60c3f4a9534c28642a6907271739f084ebb15b53009a747065733025bf", + "tools/test_registered_player_combat_parity.py": "9203869ccde846aa4c0caadedf519dc6a29c20dae403c922d45531803d2abc30", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/test_player_hurt_parity.py": "3164b8644664fcd46903e801ea70d1bb866e07e7112dc94570161831644bc84d", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_immunity.rs": "fd39c41124d694e755cf7faadcf93c636df4042c78ec345092a856b5f952dbcf", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/damage_source.rs": "24945e397a926d34695652980923609e4723e02fe6b6e56d4aaf673e45d759f7", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "d659328576264bc7a454d4520dfba50664cdc86a617707b7caba0396965c1d97", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "2b448209629b9bf2e678d667ad0d6c7fa22146892dd106b169d96b31b0df12bb", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_hurt.rs": "844239ad7d15c39629bb3cfc06ebae6d1cff20b7627468f26e0ee8dff3abdcb8", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_hurt.rs": "99c9bbd8587ec2dc287806049897b8034d2f5349ad47fc497b70d54148844a36", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/server_player_combat.rs": "a9743971581af86d926eeba42004d932caf83382c470dd98bf613cb9c417db58", + "crates/horizon-world/src/server_player_damage.rs": "828a4649fec3e9bda2dfe20aced8c95922c697321de2be4127bd4e5712ecbb7c", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "f417aab280331ddd6f0ca265a12c0130c78b9924f407c7e07f198140501e6010", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "74e4110fb19c4c4047192fd65c38015b8afc7f9fc50404d75380b5063808148c", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/registered_player_combat_fixture.rs": "7cde48fad3d4c26ab045127bdbaa6682b6c3156955588b30d350f36223d4d78f" + }, + "fixtures_sha256": { + ".local/rust-registered-player-combat-parity/inputs.txt": "f267227ed7120264697470d8ce9908c2b8dd5bfe5b354a8176c17deeb678f6b3", + ".local/rust-registered-player-combat-parity/catalog.json": "d1e488e4f432888beb9f643904c8bca242d1e2093f53e23e07da305d70cf7106", + ".local/rust-registered-player-combat-parity/ids.json": "f7d6037166d966e2714b01cff5626f0cc0a02ce883885ec791c93e977afde0e6", + ".local/rust-registered-player-combat-parity/slots.json": "29101ebf1ead685029508789eee51c4d4fff65524064d8e32a48efded7036982", + ".local/rust-registered-player-combat-parity/head.json": "ef2d127de37b942baad06145e54b0c619a1f22327b2ebbcfbec78f5564afe39d", + ".local/rust-registered-player-combat-parity/damage/catalog.json": "1c40ea4dc7430aa7ad737258a320ef35e72df977370d1a228bc2876d69289598", + ".local/rust-registered-player-combat-parity/damage/types.json": "ec99090df073d7fdad34de5c8930f9e09e25a04b432bb890120fedefb7bea30f", + ".local/rust-registered-player-combat-parity/damage/tags.json": "df5da1c56b40691bac096e0e8c98a77063b6f056a5f53e75068e5fef89595af8" + }, + "rust_output_sha256": "a0a044f256685a9db4da3fdb7041891d631748a4dd1a4dc18bc3e3149a6de2a3", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "a0a044f256685a9db4da3fdb7041891d631748a4dd1a4dc18bc3e3149a6de2a3", + "matched_output_lines": 1431711 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "a0a044f256685a9db4da3fdb7041891d631748a4dd1a4dc18bc3e3149a6de2a3", + "matched_output_lines": 1431711 + } + ], + "scope": "All 51 bundled registered damage types and 36 native-resolved tags drive the actual ServerPlayer damage chain, immunity, difficulty scaling, armor/resistance, exhaustion, health/absorption and hurt state. Direct/causing entity identity and creative-source abilities use real DamageSource methods. Equipment is unenchanted; virtual flags/rule values, blocking amount, durability, PvP permission, attribution/effect/knockback/death services and empty criterion listeners are controlled. No full entity lifecycle, enchantments, death messages or playable integration claim." +} diff --git a/crates/horizon-world/examples/registered_player_combat_fixture.rs b/crates/horizon-world/examples/registered_player_combat_fixture.rs new file mode 100644 index 000000000..01afec289 --- /dev/null +++ b/crates/horizon-world/examples/registered_player_combat_fixture.rs @@ -0,0 +1,615 @@ +use horizon_world::damage_immunity::{DamageRule, ImmunityTag, ImmunityWorld}; +use horizon_world::damage_source::{ + Catalog as DamageCatalog, DamageSource, EntityKind, SourceWorld, +}; +use horizon_world::living_hurt::{HurtState, HurtTag, HurtWorld}; +use horizon_world::{ + attributes::{ + Modifier, Operation, + entity::{Catalog, EntityAttributes}, + }, + combat_rules::ArmorWorld, + damage_reduction::Bypass, + food::FoodData, + living_damage::DamageStat, + player_health::PlayerFloatIds, + server_player_combat::{CombatEnvironment, ServerPlayerCombat}, + server_player_damage::ServerDamageEnvironment, + synced_floats::{FloatValue, Observer, SyncedFloats}, +}; +use horizon_world::{ + food::Difficulty, + player_hurt::{CausingEntity, PlayerHurtWorld, ServerPlayerHurtWorld}, +}; +use serde_json::Value; +use std::sync::Arc; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn single(v: &Value) -> f32 { + f32::from_bits(u32::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn bits(v: f32) -> u32 { + if v.is_nan() { + f32::NAN.to_bits() + } else { + v.to_bits() + } +} +fn state(s: &HurtState<()>) -> String { + format!( + "{} {} {:08x} {} {} {} {}", + s.no_action_time, + s.cooldown, + bits(s.last_hurt), + s.hurt_duration, + s.hurt_time, + s.last_source.is_some(), + s.last_stamp + ) +} +struct Env<'a> { + out: &'a mut dyn Write, + op: &'a Value, + calls: i64, + hit: bool, + recorded: f32, + player: bool, + difficulty_calls: usize, + slots: &'a [Value], + head: u64, + dead: bool, + source: DamageSource<'a, usize>, +} +impl Env<'_> { + fn query(&mut self, event: &str, key: &str) -> io::Result { + self.event(event)?; + Ok(self.flag(key)) + } + + fn flag(&self, n: &str) -> bool { + self.op[n].as_bool().unwrap() + } + fn event(&mut self, s: &str) -> io::Result<()> { + writeln!(self.out, "{s}")?; + let n = self.calls; + self.calls += 1; + if n == self.op["fail"].as_i64().unwrap() { + Err(io::Error::other("injected hurt callback failure")) + } else { + Ok(()) + } + } +} +impl HurtWorld for Env<'_> { + type Error = io::Error; + type Source = (); + type UseItem = bool; + type Blocking = (); + type Sound = (); + fn source(&self) {} + fn is_server_player(&self) -> bool { + self.player + } + fn invulnerable(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("invulnerable")?; + Ok(self.flag("invulnerable")) + } + fn fire_resistance(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("fire-resistance")?; + Ok(self.flag("fire_resistance")) + } + fn sleeping(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("sleeping")?; + Ok(self.flag("sleeping")) + } + fn freeze_hurts_extra(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("freeze-extra")?; + Ok(self.flag("freeze_extra")) + } + fn stop_sleeping(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("wake") + } + fn resolve_mob(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("resolve-mob") + } + fn resolve_player(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("resolve-player") + } + fn broadcast_damage(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("broadcast") + } + fn mark_hurt(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("mark") + } + fn secondary_sound(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + if self.source.is_type("minecraft:thorns") { + self.event("level")?; + self.event("thorns-sound")?; + } + Ok(()) + } + fn die(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("die")?; + self.dead = true; + Ok(()) + } + fn hurt_sound(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("hurt-sound") + } + + fn dead_or_dying(&mut self, _: &mut HurtState<()>) -> io::Result { + panic!("combat binding supplies stored health/death predicate") + } + fn tag(&mut self, _: &mut HurtState<()>, tag: HurtTag) -> io::Result { + Ok(self.source.hurt_tag(tag)) + } + fn use_item(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("use-item")?; + Ok(self.flag("component")) + } + fn apply_blocking(&mut self, _: &mut HurtState<()>, v: f32) -> io::Result { + self.event(&format!("blocking {:08x}", bits(v)))?; + Ok(single(&self.op["blocked"])) + } + fn helmet_empty(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event(&format!("slot {}", self.head))?; + Ok(!self.flag("helmet")) + } + fn hurt_helmet(&mut self, _: &mut HurtState<()>, v: f32) -> io::Result<()> { + self.event(&format!("hurt-helmet {:08x}", bits(v))) + } + fn actually_hurt(&mut self, _s: &mut HurtState<()>, _v: f32) -> io::Result<()> { + panic!("combat binding supplies actual inner damage") + } + fn blocking_component(&mut self, v: bool) -> Option<()> { + v.then_some(()) + } + fn on_blocked(&mut self, _: &mut HurtState<()>, _: ()) -> io::Result<()> { + Ok(()) + } + fn knockback(&mut self, _: &mut HurtState<()>, v: f32, b: bool) -> io::Result<()> { + self.event(&format!("knockback {:08x} {b}", bits(v))) + } + fn death_protection(&mut self, _: &mut HurtState<()>) -> io::Result { + if !self + .source + .immunity_tag(ImmunityTag::BypassesInvulnerability) + { + self.event("hand 0")?; + self.event("hand 1")?; + } + Ok(false) + } + fn death_sound(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("death-sound") + } + fn make_sound(&mut self, _: &mut HurtState<()>, _: ()) -> io::Result<()> { + self.event("make-sound") + } + fn game_time(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("level")?; + self.event("game-time")?; + Ok(self.op["game_time"].as_i64().unwrap()) + } + fn effects_on_hurt(&mut self, _: &mut HurtState<()>, v: f32) -> io::Result<()> { + self.event("effects")?; + for i in 0..self.op["effects"].as_u64().unwrap() { + self.event(&format!("effect {i} {:08x}", bits(v)))?; + } + Ok(()) + } + fn player_hurt_criterion( + &mut self, + _: &mut HurtState<()>, + _: f32, + _: f32, + _: bool, + ) -> io::Result<()> { + self.event("criterion") + } + fn award_blocked(&mut self, _: &mut HurtState<()>, v: i32) -> io::Result<()> { + self.event(&format!("blocked-stat {v}")) + } + fn attacker_criterion( + &mut self, + _: &mut HurtState<()>, + _: f32, + _: f32, + _: bool, + ) -> io::Result<()> { + Ok(()) + } +} +impl PlayerHurtWorld for Env<'_> { + fn ability_invulnerable(&self) -> bool { + self.flag("ability_invulnerable") + } + fn bypasses_invulnerability(&mut self, _: &mut HurtState<()>) -> io::Result { + Ok(self + .source + .immunity_tag(ImmunityTag::BypassesInvulnerability)) + } + fn remove_shoulders(&mut self, _: &mut HurtState<()>) -> io::Result<()> { + self.event("shoulders") + } + fn scales_with_difficulty(&mut self, _: &mut HurtState<()>) -> io::Result { + Ok(self.source.scales_with_difficulty(self)) + } + fn difficulty(&mut self, _: &mut HurtState<()>) -> io::Result { + self.event("difficulty")?; + let v = self.op["difficulties"][self.difficulty_calls] + .as_u64() + .unwrap(); + self.difficulty_calls += 1; + Ok([ + Difficulty::Peaceful, + Difficulty::Easy, + Difficulty::Normal, + Difficulty::Hard, + ][v as usize]) + } +} +impl ServerPlayerHurtWorld for Env<'_> { + type Player = (); + type Arrow = (); + fn causing_entity(&mut self, _: &mut HurtState<()>) -> io::Result> { + Ok(match self.source.causing_entity() { + Some(2) => CausingEntity::Player(()), + Some(3) => CausingEntity::Arrow(()), + _ => CausingEntity::Other, + }) + } + fn arrow_player_owner(&mut self, _: &mut HurtState<()>, _: ()) -> io::Result> { + self.event("owner")?; + Ok((self.op["owner"] == 1).then_some(())) + } + fn can_harm_player(&mut self, _: &mut HurtState<()>, _: ()) -> io::Result { + self.event("can-harm")?; + Ok(self.flag("can_harm")) + } +} +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn values(v: Option<&[FloatValue]>) -> String { + match v { + None => "none".into(), + Some([]) => "empty".into(), + Some(v) => v + .iter() + .map(|v| format!("{}:{:08x}", v.id, bits(v.value))) + .collect::>() + .join(","), + } +} +impl Observer for Env<'_> { + type Error = io::Error; + fn updated(&mut self, data: &mut SyncedFloats, id: u8) -> io::Result<()> { + self.event(&format!( + "updated {id} {:08x} {}", + bits(data.get(id).unwrap()), + data.is_dirty() + ))?; + if self.flag("pack_callback") { + writeln!( + self.out, + "callback-pack {}", + values(data.take_dirty().as_deref()) + )?; + } + Ok(()) + } +} +impl ArmorWorld for Env<'_> { + type Error = io::Error; + type Weapon = (); + type ServerLevel = (); + fn weapon(&mut self) -> io::Result> { + let source = self.source; + source.weapon(self) + } + fn server_level(&mut self) -> io::Result> { + self.event("level")?; + Ok(Some(())) + } + fn modify_armor_effectiveness(&mut self, _: (), _: (), v: f32) -> io::Result { + Ok(v) + } +} +impl ServerDamageEnvironment for Env<'_> { + type Attacker = (); + fn invulnerable(&mut self) -> io::Result { + self.event("invulnerable")?; + Ok(self.flag("invulnerable")) + } + fn bypasses(&mut self, b: Bypass) -> io::Result { + Ok(self.source.bypasses(b)) + } + fn hurt_armor(&mut self, a: &mut EntityAttributes, v: f32) -> io::Result<()> { + self.event(&format!("hurt-armor {:08x}", bits(v)))?; + if self.flag("break_armor") { + let id = a.catalog().id("minecraft:armor").unwrap(); + a.edit(id, |a, o| { + a.set_base_value(number(&self.op["armor_after"]), o) + }) + .unwrap() + .unwrap(); + } + Ok(()) + } + fn has_resistance(&mut self) -> io::Result { + self.event("has-resistance")?; + Ok(self.flag("resistance")) + } + fn resistance_amplifier(&mut self) -> io::Result { + self.event("effect")?; + Ok(self.op["amplifier"].as_i64().unwrap() as i32) + } + fn award_resisted(&mut self, v: i32) -> io::Result<()> { + self.event(&format!("stat resisted {v}")) + } + fn attacker(&mut self) -> io::Result> { + panic!("player damage must not query attacker") + } + fn award_dealt_resisted(&mut self, _: i32) -> io::Result<()> { + panic!("player damage must award own resisted stat") + } + fn damage_protection(&mut self, _: ()) -> io::Result { + for slot in self.slots { + self.event(&format!("slot {}", slot.as_u64().unwrap()))?; + } + Ok(0.0) + } + fn award_self(&mut self, s: DamageStat, v: i32) -> io::Result<()> { + let n = match s { + DamageStat::Absorbed => "absorbed", + DamageStat::Taken => "taken", + DamageStat::DealtAbsorbed => panic!("attacker stat"), + }; + self.event(&format!("stat {n} {v}")) + } + fn award_attacker(&mut self, _: (), _: DamageStat, _: i32) -> io::Result<()> { + panic!("attacker stat") + } + fn source_food_exhaustion(&mut self) -> io::Result { + Ok(self.source.food_exhaustion()) + } + fn ability_invulnerable(&self) -> bool { + self.flag("ability_invulnerable") + } + fn level_is_client(&mut self) -> io::Result { + self.event("level")?; + self.event("client")?; + Ok(self.flag("client")) + } + fn record_damage(&mut self, v: f32) -> io::Result<()> { + self.event("tracker")?; + self.event(&format!("record {:08x}", bits(v)))?; + self.recorded = v; + self.hit = true; + Ok(()) + } + fn damage_event(&mut self) -> io::Result<()> { + self.event("damage-event") + } +} +impl CombatEnvironment for Env<'_> { + fn dead_flag(&self) -> bool { + self.dead + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let damage_catalog = DamageCatalog::from_json( + &serde_json::from_str(&fs::read_to_string(dir.join("damage/catalog.json"))?)?, + &serde_json::from_str(&fs::read_to_string(dir.join("damage/tags.json"))?)?, + )?; + let ids: Value = serde_json::from_str(&fs::read_to_string(dir.join("ids.json"))?)?; + let ids = PlayerFloatIds { + health: ids["health"].as_u64().unwrap() as u8, + absorption: ids["absorption"].as_u64().unwrap() as u8, + }; + let slots: Value = serde_json::from_str(&fs::read_to_string(dir.join("slots.json"))?)?; + let head: u64 = serde_json::from_str(&fs::read_to_string(dir.join("head.json"))?)?; + let catalog = Arc::new(Catalog::from_json(&serde_json::from_str( + &fs::read_to_string(dir.join("catalog.json"))?, + )?)?); + let keys = [ + "minecraft:armor", + "minecraft:armor_toughness", + "minecraft:max_health", + "minecraft:max_absorption", + ] + .map(|k| catalog.id(k).unwrap()); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut attributes = catalog.create("minecraft:player").unwrap(); + for (i, key) in keys.iter().enumerate() { + let a = &f["attributes"][i]; + let m = Modifier::new( + "horizon:test", + number(&a["amount"]), + Operation::ALL[a["operation"].as_u64().unwrap() as usize], + )?; + attributes + .edit(*key, |a, o| { + a.set_base_value(number(&f["attributes"][i]["base"]), o)?; + a.add_transient(m, o) + }) + .unwrap() + .unwrap(); + } + let mut data = SyncedFloats::new(&[ + FloatValue { + id: ids.health, + value: single(&f["health"]), + }, + FloatValue { + id: ids.absorption, + value: single(&f["absorption"]), + }, + ])?; + let mut food = FoodData { + exhaustion: single(&f["exhaustion"]), + ..FoodData::default() + }; + let mut recorded = 0.0; + let mut dead = f["dead"].as_bool().unwrap(); + let mut s = HurtState { + no_action_time: f["no_action"].as_i64().unwrap() as i32, + cooldown: f["cooldown"].as_i64().unwrap() as i32, + last_hurt: single(&f["last_hurt"]), + hurt_duration: f["duration"].as_i64().unwrap() as i32, + hurt_time: f["time"].as_i64().unwrap() as i32, + last_source: f["source"].as_bool().unwrap().then_some(()), + last_stamp: f["stamp"].as_i64().unwrap(), + }; + for op in f["ops"].as_array().unwrap() { + if op["reset_cooldown"].as_bool().unwrap_or(false) { + s.cooldown = 0; + } + let entity = |key: &str| { + let id = op[key].as_u64().unwrap() as usize; + (id != 0).then_some(id) + }; + let source = damage_catalog + .source( + damage_catalog + .id(op["source_type"].as_str().unwrap()) + .unwrap(), + entity("direct"), + entity("attacker"), + None, + ) + .unwrap(); + let mut e = Env { + source, + out: &mut out, + op, + calls: 0, + hit: false, + recorded, + player: true, + difficulty_calls: 0, + slots: slots.as_array().unwrap(), + head, + dead, + }; + let result = + ServerPlayerCombat::new(&mut attributes, &mut data, &mut food, ids, &mut e)? + .hurt(&mut s, single(&op["damage"])); + match result { + Ok(v) => writeln!(e.out, "bool {v}\nresult ok")?, + Err(_) => writeln!(e.out, "result error")?, + }; + recorded = e.recorded; + dead = e.dead; + writeln!( + e.out, + "state {} {:08x} {} {}", + state(&s), + bits(recorded), + e.hit, + e.calls + )?; + writeln!( + e.out, + "storage {:08x} {:08x} {:08x} {} {} {} {}", + bits(data.get(ids.health).unwrap()), + bits(data.get(ids.absorption).unwrap()), + bits(food.exhaustion), + data.is_dirty(), + data.item_dirty(ids.health).unwrap(), + data.item_dirty(ids.absorption).unwrap(), + dead + )?; + if e.flag("pack") { + writeln!(e.out, "packed {}", values(data.take_dirty().as_deref()))?; + } + writeln!(e.out, "defaults {}", values(data.non_default().as_deref()))?; + } + } + Ok(()) +} +impl ImmunityWorld for Env<'_> { + type Error = io::Error; + fn removed(&self) -> bool { + self.flag("removed") + } + fn permanently_invulnerable(&mut self) -> io::Result { + self.query("permanent", "permanent") + } + fn temporarily_invulnerable(&mut self) -> io::Result { + self.query("temporary", "temporary") + } + fn tag(&mut self, t: ImmunityTag) -> io::Result { + Ok(self.source.immunity_tag(t)) + } + fn creative_source(&mut self) -> io::Result { + let source = self.source; + source.creative_player(self) + } + fn fire_immune(&mut self) -> io::Result { + self.query("fire-immune", "fire_immune") + } + fn fall_immune(&mut self) -> io::Result { + self.query("fall-immune", "fall_immune") + } + fn enchantment_immunity(&mut self) -> io::Result { + for s in self.slots { + self.event(&format!("slot {}", s.as_u64().unwrap()))?; + } + Ok(false) + } + fn damage_rule(&mut self, r: DamageRule) -> io::Result { + let n = match r { + DamageRule::Drowning => "drowning", + DamageRule::Fall => "fall", + DamageRule::Fire => "fire", + DamageRule::Freeze => "freeze", + }; + self.event("rules")?; + self.query(&format!("rule {n}"), &format!("rule_{n}")) + } + fn changing_dimension(&mut self) -> io::Result { + self.query("changing", "changing") + } + fn ender_pearl(&mut self) -> io::Result { + Ok(self.source.is_type("minecraft:ender_pearl")) + } + fn client_loaded(&mut self) -> io::Result { + self.query("loaded", "loaded") + } +} + +impl SourceWorld for Env<'_> { + type Error = io::Error; + type Entity = usize; + type Weapon = (); + fn kind(&self, id: usize) -> EntityKind { + match id { + 1 => EntityKind::Living, + 2 => EntityKind::Player, + _ => EntityKind::Other, + } + } + fn weapon(&mut self, id: usize) -> io::Result> { + self.event(&format!("source-weapon {id}"))?; + Ok(self.flag("weapon").then_some(())) + } + fn position(&mut self, _: usize) -> io::Result<[f64; 3]> { + panic!("controlled knockback must not query source position") + } + fn causing_entity(&mut self, stored: Option) -> io::Result> { + Ok(stored) + } + fn instabuild(&mut self, _: usize) -> io::Result { + self.event("source-abilities")?; + Ok(self.flag("creative")) + } +} diff --git a/crates/horizon-world/src/damage_source.rs b/crates/horizon-world/src/damage_source.rs index f9b910fde..6af30f736 100644 --- a/crates/horizon-world/src/damage_source.rs +++ b/crates/horizon-world/src/damage_source.rs @@ -202,6 +202,36 @@ impl DamageSource<'_, E> { pub fn in_tag(&self, tag: &str) -> bool { self.catalog.in_tag(self.id, tag) } + pub fn bypasses(&self, kind: crate::damage_reduction::Bypass) -> bool { + use crate::damage_reduction::Bypass; + self.in_tag(match kind { + Bypass::Armor => "minecraft:bypasses_armor", + Bypass::Effects => "minecraft:bypasses_effects", + Bypass::Resistance => "minecraft:bypasses_resistance", + Bypass::Enchantments => "minecraft:bypasses_enchantments", + }) + } + pub fn hurt_tag(&self, tag: crate::living_hurt::HurtTag) -> bool { + use crate::living_hurt::HurtTag; + self.in_tag(match tag { + HurtTag::Fire => "minecraft:is_fire", + HurtTag::Freezing => "minecraft:is_freezing", + HurtTag::DamagesHelmet => "minecraft:damages_helmet", + HurtTag::BypassesCooldown => "minecraft:bypasses_cooldown", + HurtTag::NoImpact => "minecraft:no_impact", + HurtTag::NoKnockback => "minecraft:no_knockback", + }) + } + pub fn immunity_tag(&self, tag: crate::damage_immunity::ImmunityTag) -> bool { + use crate::damage_immunity::ImmunityTag; + self.in_tag(match tag { + ImmunityTag::BypassesInvulnerability => "minecraft:bypasses_invulnerability", + ImmunityTag::Fire => "minecraft:is_fire", + ImmunityTag::Fall => "minecraft:is_fall", + ImmunityTag::Drowning => "minecraft:is_drowning", + ImmunityTag::Freezing => "minecraft:is_freezing", + }) + } pub fn direct_entity(&self) -> Option { self.direct } diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index f6582288f..1ebbd22da 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1436,3 +1436,20 @@ causing-entity replacement, mutations and failures. Targeted Clippy passes. Catalogs are immutable snapshots with local indices, not network IDs. Rust DamageType codecs, runtime reload, death-message generation, full entity query bindings and combat source integration remain pending. + + +Registered damage sources now drive a composed player-combat fixture. Source +helpers map the immunity, outer-hurt and reduction tag enums to the imported +vanilla tags. Native source methods supply exhaustion, difficulty scaling, +creative-source abilities and direct-entity weapon selection through the real +ServerPlayer hurt chain; thorns also follows its native secondary-sound branch. + +`python3 tools/test_registered_player_combat_parity.py` records **1,431,711 +matching lines per JAR** in the +[registered player-combat report](../benchmarks/rust-registered-player-combat-2026-10-07/scoped-parity.json), +covering all 51 damage types and 36 tags, direct/causing entity combinations, +repeated hits, health/absorption/hunger, cooldown state and callback failures. +Targeted Clippy passes. Equipment is unenchanted; virtual entity flags/rule +values, blocking amounts, durability, PvP permission, attribution, effects, +knockback/death services and empty criterion listeners remain controlled. +Complete entity lifecycle and playable game integration remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegisteredPlayerCombatOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegisteredPlayerCombatOracle.java new file mode 100644 index 000000000..fb87832dd --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegisteredPlayerCombatOracle.java @@ -0,0 +1,108 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.lang.reflect.*;import java.lang.invoke.*;import java.nio.file.*;import java.util.*; +import net.minecraft.network.syncher.*;import net.minecraft.world.entity.ai.attributes.*;import net.minecraft.world.food.FoodData;import net.minecraft.world.level.gamerules.*;import net.minecraft.world.flag.FeatureFlagSet;import net.minecraft.server.network.ServerGamePacketListenerImpl;import net.minecraft.core.*;import net.minecraft.core.component.*;import net.minecraft.core.registries.*;import net.minecraft.resources.*;import net.minecraft.tags.*;import net.minecraft.world.InteractionHand;import net.minecraft.world.entity.*;import net.minecraft.world.entity.player.*;import net.minecraft.world.damagesource.*;import net.minecraft.world.effect.*;import net.minecraft.world.item.*;import net.minecraft.world.item.component.*;import net.minecraft.server.level.*;import net.minecraft.server.PlayerAdvancements;import net.minecraft.sounds.*;import net.minecraft.stats.Stats; +/** Native ServerPlayer hurt through actual reduction, attributes, health/absorption and hunger. */ +public final class VanillaRegisteredPlayerCombatOracle { + static final class Stop extends RuntimeException {} + static EntityDataAccessor healthKey,absorptionKey;static Field amplifier;static Object unsafe;static Method allocate;static ItemStack plain,shield;static Field stamp,lastSource,noAction,cooldown,lastHurt,duration,time; + static T make(Class c)throws Exception{return c.cast(allocate.invoke(unsafe,c));} + static Field field(Class c,String n)throws Exception{var f=c.getDeclaredField(n);f.setAccessible(true);return f;} + static float single(JsonElement v){return Float.intBitsToFloat(Integer.parseUnsignedInt(v.getAsString(),16));} + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + static String values(List> v){return VanillaPlayerHealthOracle.values(v);} + static String bits(float v){return String.format("%08x",Float.floatToIntBits(v));} + static String state(LivingEntity a){try{return noAction.getInt(a)+" "+cooldown.getInt(a)+" "+bits(lastHurt.getFloat(a))+" "+duration.getInt(a)+" "+time.getInt(a)+" "+(lastSource.get(a)!=null)+" "+stamp.getLong(a);}catch(Exception e){throw new AssertionError(e);}} + static final class Data {JsonObject op;PrintWriter out;AttributeMap attributes;SynchedEntityData data;Tracker tracker;Rules rules;int calls,difficultyCalls;boolean hit;Abilities abilities;PlainPlayer attacker;Arrow arrow;Actor other;float recorded;Server level;PlayerAdvancements advancements;List effects; + boolean flag(String n){return op.get(n).getAsBoolean();}void event(String s){out.println(s);if(calls++==op.get("fail").getAsInt())throw new Stop();}} + static final class PlainPlayer extends Player {Data d;PlainPlayer(){super(null,null);}@Override public Abilities getAbilities(){d.event("source-abilities");var a=new Abilities();a.instabuild=d.flag("creative");return a;}@Override public ItemStack getWeaponItem(){d.event("source-weapon 2");return d.flag("weapon")?ItemStack.EMPTY:null;}@Override public net.minecraft.world.level.GameType gameMode(){return net.minecraft.world.level.GameType.SURVIVAL;}} + static final class Arrow extends net.minecraft.world.entity.projectile.arrow.Arrow {Data d;Arrow(){super(null,null);}@Override public ItemStack getWeaponItem(){d.event("source-weapon 3");return d.flag("weapon")?ItemStack.EMPTY:null;}@Override public Entity getOwner(){d.event("owner");return switch(d.op.get("owner").getAsInt()){case 0->null;case 1->d.attacker;case 2->d.other;default->throw new AssertionError();};}} + static final class Tracker extends CombatTracker {Data d;Tracker(){super(null);}@Override public void recordDamage(DamageSource s,float v){d.event("record "+bits(v));d.recorded=v;d.hit=true;}} + static final class Rules extends GameRules {Data d;Rules(){super(FeatureFlagSet.of());}@SuppressWarnings("unchecked") @Override public T get(GameRule rule){String n=rule==GameRules.DROWNING_DAMAGE?"drowning":rule==GameRules.FALL_DAMAGE?"fall":rule==GameRules.FIRE_DAMAGE?"fire":rule==GameRules.FREEZE_DAMAGE?"freeze":null;if(n==null)throw new AssertionError();d.event("rule "+n);return (T)Boolean.valueOf(d.flag("rule_"+n));}} + static final class Connection extends ServerGamePacketListenerImpl {Data d;Connection(){super(null,null,null,null);}@Override public boolean hasClientLoaded(){d.event("loaded");return d.flag("loaded");}} + static final class Server extends ServerLevel {Data d;Server(){super(null,null,null,null,null,null,false,0L,List.of(),false);}@Override public void playSound(Entity e,double x,double y,double z,SoundEvent sound,SoundSource category){d.event("thorns-sound");}@Override public GameRules getGameRules(){d.event("rules");return d.rules;}@Override public void broadcastDamageEvent(Entity a,DamageSource s){d.event("broadcast");}@Override public boolean isClientSide(){d.event("client");return d.flag("client");}@Override public net.minecraft.world.Difficulty getDifficulty(){d.event("difficulty");return net.minecraft.world.Difficulty.values()[d.op.getAsJsonArray("difficulties").get(d.difficultyCalls++).getAsInt()];}@Override public long getGameTime(){d.event("game-time");return d.op.get("game_time").getAsLong();}} + static final class Effect extends MobEffectInstance {Data d;int id;Effect(){super(MobEffects.RESISTANCE);}@Override public void onMobHurt(ServerLevel l,LivingEntity a,DamageSource s,float v){d.event("effect "+id+" "+bits(v));}} + static final class Actor extends net.minecraft.world.entity.decoration.ArmorStand {Actor(){super(null,null);}@Override public ItemStack getWeaponItem(){d.event("source-weapon 1");return d.flag("weapon")?ItemStack.EMPTY:null;} + + Data d; + @Override public boolean isPermanentlyInvulnerable(){d.event("permanent");return d.flag("permanent");} + @Override public boolean isTemporarilyInvulnerable(){d.event("temporary");return d.flag("temporary");} + @Override public boolean fireImmune(){d.event("fire-immune");return d.flag("fire_immune");} + @Override public boolean hasEffect(Holder e){if(e==MobEffects.FIRE_RESISTANCE){d.event("fire-resistance");return d.flag("fire_resistance");}if(e!=MobEffects.RESISTANCE)throw new AssertionError();d.event("has-resistance");return d.flag("resistance");} + @Override public MobEffectInstance getEffect(Holder e){if(e!=MobEffects.RESISTANCE)throw new AssertionError();d.event("effect");var v=new MobEffectInstance(e,100,0);try{amplifier.setInt(v,d.op.get("amplifier").getAsInt());}catch(Exception ex){throw new AssertionError(ex);}return v;} + @Override public double getAttributeValue(Holder a){return d.attributes.getValue(a);} + @Override protected void hurtArmor(DamageSource s,float v){d.event("hurt-armor "+bits(v));if(d.flag("break_armor"))d.attributes.getInstance(Attributes.ARMOR).setBaseValue(number(d.op.get("armor_after")));} + @Override public CombatTracker getCombatTracker(){d.event("tracker");return d.tracker;} + @Override public void gameEvent(Holder e){if(e!=net.minecraft.world.level.gameevent.GameEvent.ENTITY_DAMAGE)throw new AssertionError();d.event("damage-event");} + @Override public void onSyncedDataUpdated(EntityDataAccessor a){var k=a.id()==healthKey.id()?healthKey:absorptionKey;d.event("updated "+k.id()+" "+bits(d.data.get(k))+" "+d.data.isDirty());if(d.flag("pack_callback"))d.out.println("callback-pack "+values(d.data.packDirty()));} + @Override public boolean isSleeping(){d.event("sleeping");return d.flag("sleeping");} + @Override public void stopSleeping(){d.event("wake");} + @Override public ItemStack getUseItem(){d.event("use-item");return d.flag("component")?shield:ItemStack.EMPTY;} + @Override public float applyItemBlocking(ServerLevel l,DamageSource s,float v){d.event("blocking "+bits(v));return single(d.op.get("blocked"));} + @Override public boolean is(TagKey> tag){if(tag==EntityTypeTags.FALL_DAMAGE_IMMUNE){d.event("fall-immune");return d.flag("fall_immune");}if(tag!=EntityTypeTags.FREEZE_HURTS_EXTRA_TYPES)throw new AssertionError();d.event("freeze-extra");return d.flag("freeze_extra");} + @Override public ItemStack getItemBySlot(EquipmentSlot slot){d.event("slot "+slot.ordinal());return slot==EquipmentSlot.HEAD&&d.flag("helmet")?plain:ItemStack.EMPTY;} + @Override protected void hurtHelmet(DamageSource s,float v){d.event("hurt-helmet "+bits(v));} + @Override protected void resolveMobResponsibleForDamage(DamageSource s){d.event("resolve-mob");} + @Override protected Player resolvePlayerResponsibleForDamage(DamageSource s){d.event("resolve-player");return null;} + @Override protected void markHurt(){d.event("mark");} + @Override public void dealDefaultKnockback(DamageSource s,float v,boolean b){d.event("knockback "+bits(v)+" "+b);} + @Override public ItemStack getItemInHand(InteractionHand h){d.event("hand "+h.ordinal());return ItemStack.EMPTY;} + @Override protected SoundEvent getDeathSound(){d.event("death-sound");return null;} + @Override public void makeSound(SoundEvent e){d.event("make-sound");} + @Override public void die(DamageSource s){d.event("die");dead=true;} + @Override protected void playHurtSound(DamageSource s){d.event("hurt-sound");} + @Override public ServerLevel level(){d.event("level");return d.level;} + @Override public Collection getActiveEffects(){d.event("effects");return d.effects;} + } + static final class Human extends ServerPlayer {Human(){super(null,null,null,null);} + + Data d; + @Override public boolean isPermanentlyInvulnerable(){d.event("permanent");return d.flag("permanent");} + @Override public boolean isTemporarilyInvulnerable(){d.event("temporary");return d.flag("temporary");} + @Override public boolean fireImmune(){d.event("fire-immune");return d.flag("fire_immune");} + @Override public boolean hasEffect(Holder e){if(e==MobEffects.FIRE_RESISTANCE){d.event("fire-resistance");return d.flag("fire_resistance");}if(e!=MobEffects.RESISTANCE)throw new AssertionError();d.event("has-resistance");return d.flag("resistance");} + @Override public MobEffectInstance getEffect(Holder e){if(e!=MobEffects.RESISTANCE)throw new AssertionError();d.event("effect");var v=new MobEffectInstance(e,100,0);try{amplifier.setInt(v,d.op.get("amplifier").getAsInt());}catch(Exception ex){throw new AssertionError(ex);}return v;} + @Override public double getAttributeValue(Holder a){return d.attributes.getValue(a);} + @Override protected void hurtArmor(DamageSource s,float v){d.event("hurt-armor "+bits(v));if(d.flag("break_armor"))d.attributes.getInstance(Attributes.ARMOR).setBaseValue(number(d.op.get("armor_after")));} + @Override public CombatTracker getCombatTracker(){d.event("tracker");return d.tracker;} + @Override public void gameEvent(Holder e){if(e!=net.minecraft.world.level.gameevent.GameEvent.ENTITY_DAMAGE)throw new AssertionError();d.event("damage-event");} + @Override public void onSyncedDataUpdated(EntityDataAccessor a){var k=a.id()==healthKey.id()?healthKey:absorptionKey;d.event("updated "+k.id()+" "+bits(d.data.get(k))+" "+d.data.isDirty());if(d.flag("pack_callback"))d.out.println("callback-pack "+values(d.data.packDirty()));} + @Override public boolean isSleeping(){d.event("sleeping");return d.flag("sleeping");} + @Override public void stopSleeping(){d.event("wake");} + @Override public ItemStack getUseItem(){d.event("use-item");return d.flag("component")?shield:ItemStack.EMPTY;} + @Override public float applyItemBlocking(ServerLevel l,DamageSource s,float v){d.event("blocking "+bits(v));return single(d.op.get("blocked"));} + @Override public boolean is(TagKey> tag){if(tag==EntityTypeTags.FALL_DAMAGE_IMMUNE){d.event("fall-immune");return d.flag("fall_immune");}if(tag!=EntityTypeTags.FREEZE_HURTS_EXTRA_TYPES)throw new AssertionError();d.event("freeze-extra");return d.flag("freeze_extra");} + @Override public ItemStack getItemBySlot(EquipmentSlot slot){d.event("slot "+slot.ordinal());return slot==EquipmentSlot.HEAD&&d.flag("helmet")?plain:ItemStack.EMPTY;} + @Override protected void hurtHelmet(DamageSource s,float v){d.event("hurt-helmet "+bits(v));} + @Override protected void resolveMobResponsibleForDamage(DamageSource s){d.event("resolve-mob");} + @Override protected Player resolvePlayerResponsibleForDamage(DamageSource s){d.event("resolve-player");return null;} + @Override protected void markHurt(){d.event("mark");} + @Override public void dealDefaultKnockback(DamageSource s,float v,boolean b){d.event("knockback "+bits(v)+" "+b);} + @Override public ItemStack getItemInHand(InteractionHand h){d.event("hand "+h.ordinal());return ItemStack.EMPTY;} + @Override protected SoundEvent getDeathSound(){d.event("death-sound");return null;} + @Override public void makeSound(SoundEvent e){d.event("make-sound");} + @Override public void die(DamageSource s){d.event("die");dead=true;} + @Override protected void playHurtSound(DamageSource s){d.event("hurt-sound");} + @Override public ServerLevel level(){d.event("level");return d.level;} + @Override public Collection getActiveEffects(){d.event("effects");return d.effects;} + + @Override public boolean isChangingDimension(){d.event("changing");return d.flag("changing");}@Override protected void removeEntitiesOnShoulder(){d.event("shoulders");}@Override public boolean canHarmPlayer(Player p){d.event("can-harm");return d.flag("can_harm");}@Override public PlayerAdvancements getAdvancements(){d.event("criterion");return d.advancements;} + @Override public void awardStat(Identifier s,int v){if(s==Stats.DAMAGE_BLOCKED_BY_SHIELD){d.event("blocked-stat "+v);return;}String n=s==Stats.DAMAGE_RESISTED?"resisted":s==Stats.DAMAGE_ABSORBED?"absorbed":s==Stats.DAMAGE_TAKEN?"taken":null;if(n==null)throw new AssertionError();d.event("stat "+n+" "+v);} + } + @SuppressWarnings("unchecked") public static void main(String[] args)throws Throwable { + Path dir=Path.of(args[1]);if(args[0].equals("export")){VanillaPlayerHealthOracle.main(args);VanillaDamageSourceOracle.main(new String[]{"export",dir.resolve("damage").toString()});}else{net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();} + healthKey=(EntityDataAccessor)field(LivingEntity.class,"DATA_HEALTH_ID").get(null);absorptionKey=(EntityDataAccessor)field(Player.class,"DATA_PLAYER_ABSORPTION_ID").get(null);if(args[0].equals("export")){var slots=new JsonArray();for(var s:EquipmentSlot.VALUES)slots.add(s.ordinal());Files.writeString(dir.resolve("slots.json"),slots.toString());Files.writeString(dir.resolve("head.json"),Integer.toString(EquipmentSlot.HEAD.ordinal()));return;} + var damageRegistry=VanillaDamageSourceOracle.registry(dir.resolve("damage")); + var dataCtor=SynchedEntityData.class.getDeclaredConstructor(SyncedDataHolder.class,SynchedEntityData.DataItem[].class);dataCtor.setAccessible(true);amplifier=field(MobEffectInstance.class,"amplifier");var exhaustion=field(FoodData.class,"exhaustionLevel");var keys=List.of(Attributes.ARMOR,Attributes.ARMOR_TOUGHNESS,Attributes.MAX_HEALTH,Attributes.MAX_ABSORPTION);var u=Class.forName("sun.misc.Unsafe");unsafe=field(u,"theUnsafe").get(null);allocate=u.getMethod("allocateInstance",Class.class); + noAction=field(LivingEntity.class,"noActionTime");cooldown=field(LivingEntity.class,"damageCooldownTime");lastHurt=field(LivingEntity.class,"lastHurt");duration=field(LivingEntity.class,"hurtDuration");time=field(LivingEntity.class,"hurtTime");stamp=field(LivingEntity.class,"lastDamageStamp");lastSource=field(LivingEntity.class,"lastDamageSource"); + var ctor=ItemStack.class.getDeclaredConstructor(Holder.class,int.class,PatchedDataComponentMap.class);ctor.setAccessible(true);plain=(ItemStack)ctor.newInstance(BuiltInRegistries.ITEM.wrapAsHolder(Items.STICK),1,new PatchedDataComponentMap(DataComponentMap.EMPTY));shield=(ItemStack)ctor.newInstance(BuiltInRegistries.ITEM.wrapAsHolder(Items.SHIELD),1,new PatchedDataComponentMap(DataComponentMap.EMPTY));shield.set(DataComponents.BLOCKS_ATTACKS,new BlocksAttacks(0,1,List.of(),new BlocksAttacks.ItemDamageFunction(0,0,0),Optional.empty(),Optional.empty(),Optional.empty())); + var lookup=MethodHandles.privateLookupIn(Player.class,MethodHandles.lookup());var playerHurt=lookup.findSpecial(Player.class,"hurtServer",MethodType.methodType(boolean.class,ServerLevel.class,DamageSource.class,float.class),Player.class).asType(MethodType.methodType(boolean.class,LivingEntity.class,ServerLevel.class,DamageSource.class,float.class)); + var serverLookup=MethodHandles.privateLookupIn(ServerPlayer.class,MethodHandles.lookup());var serverHurt=serverLookup.findSpecial(ServerPlayer.class,"hurtServer",MethodType.methodType(boolean.class,ServerLevel.class,DamageSource.class,float.class),ServerPlayer.class).asType(MethodType.methodType(boolean.class,LivingEntity.class,ServerLevel.class,DamageSource.class,float.class)); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();var d=new Data();d.out=out;d.level=make(Server.class);d.level.d=d;d.advancements=make(PlayerAdvancements.class);field(PlayerAdvancements.class,"activeTriggers").set(d.advancements,new HashMap<>());d.rules=make(Rules.class);d.rules.d=d;var human=make(Human.class);human.d=d;var connection=make(Connection.class);connection.d=d;human.connection=connection;LivingEntity actor=human;d.abilities=new Abilities();field(Player.class,"abilities").set(actor,d.abilities);d.attacker=make(PlainPlayer.class);d.attacker.d=d;d.other=make(Actor.class);d.other.d=d;d.arrow=make(Arrow.class);d.arrow.d=d;var hurt=serverHurt;DamageSource source=new DamageSource(damageRegistry.get(Identifier.parse("minecraft:generic")).orElseThrow());field(Entity.class,"position").set(actor,net.minecraft.world.phys.Vec3.ZERO); + d.attributes=new AttributeMap(VanillaEntityAttributeOracle.supplier(BuiltInRegistries.ENTITY_TYPE.getValue(Identifier.parse("minecraft:player"))));for(int i=0;i[Math.max(healthKey.id(),absorptionKey.id())+1];for(int i=0;i(new EntityDataAccessor(i,EntityDataSerializers.FLOAT),0f);var health=new SynchedEntityData.DataItem(healthKey,single(f.get("health")));var absorption=new SynchedEntityData.DataItem(absorptionKey,single(f.get("absorption")));items[healthKey.id()]=health;items[absorptionKey.id()]=absorption;d.data=dataCtor.newInstance(actor,items);field(Entity.class,"entityData").set(actor,d.data);field(LivingEntity.class,"dead").setBoolean(actor,f.get("dead").getAsBoolean());var food=new FoodData();exhaustion.setFloat(food,single(f.get("exhaustion")));field(Player.class,"foodData").set(actor,food);d.tracker=make(Tracker.class);d.tracker.d=d; + noAction.setInt(actor,f.get("no_action").getAsInt());cooldown.setInt(actor,f.get("cooldown").getAsInt());lastHurt.setFloat(actor,single(f.get("last_hurt")));duration.setInt(actor,f.get("duration").getAsInt());time.setInt(actor,f.get("time").getAsInt());stamp.setLong(actor,f.get("stamp").getAsLong());if(f.get("source").getAsBoolean())lastSource.set(actor,source); + for(var ov:f.getAsJsonArray("ops")){d.op=ov.getAsJsonObject();var sourceEntities=new Entity[]{null,d.other,d.attacker,d.arrow};source=new DamageSource(damageRegistry.get(Identifier.parse(d.op.get("source_type").getAsString())).orElseThrow(),sourceEntities[d.op.get("direct").getAsInt()],sourceEntities[d.op.get("attacker").getAsInt()]);field(Entity.class,"removalReason").set(actor,d.flag("removed")?Entity.RemovalReason.DISCARDED:null);if(d.op.has("reset_cooldown")&&d.flag("reset_cooldown"))cooldown.setInt(actor,0);d.calls=0;d.difficultyCalls=0;d.hit=false;d.abilities.invulnerable=d.flag("ability_invulnerable");d.effects=new ArrayList<>();for(int i=0;if',v).hex()) for v in [1,3,8,20]];yield f + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-registered-player-combat-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + damage_dir=build/'damage';damage_dir.mkdir(exist_ok=True) + with zipfile.ZipFile(jars['server']) as archive: + for file,prefix in [('types.json','data/minecraft/damage_type/'),('tags.json','data/minecraft/tags/damage_type/')]: + resources={'minecraft:'+n[len(prefix):-5]:archive.read(n).decode('utf-8') for n in sorted(archive.namelist()) if n.startswith(prefix) and n.endswith('.json')};lab.write_json(damage_dir/file,resources) + + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaRegisteredPlayerCombatOracle.java' + helper=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityAttributeOracle.java' + health_helper=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerHealthOracle.java' + damage_helper=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDamageSourceOracle.java' + sources=[oracle,helper,health_helper,damage_helper,lab.ROOT/'tools/test_server_player_combat_parity.py',Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/test_player_hurt_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/registered_player_combat_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle,helper,health_helper,damage_helper],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaRegisteredPlayerCombatOracle',mode,path],side+'-'+mode) + java('server','export',build);states=json.loads((build/'catalog.json').read_text());damage=json.loads((damage_dir/'catalog.json').read_text());fixtures=list(corpus(states,damage));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs,build/'catalog.json',build/'ids.json',build/'slots.json',build/'head.json',damage_dir/'catalog.json',damage_dir/'types.json',damage_dir/'tags.json'];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','registered_player_combat_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('registered_player_combat_fixture.exe' if os.name=='nt' else 'registered_player_combat_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} registered player combat output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'All 51 bundled registered damage types and 36 native-resolved tags drive the actual ServerPlayer damage chain, immunity, difficulty scaling, armor/resistance, exhaustion, health/absorption and hurt state. Direct/causing entity identity and creative-source abilities use real DamageSource methods. Equipment is unenchanted; virtual flags/rule values, blocking amount, durability, PvP permission, attribution/effect/knockback/death services and empty criterion listeners are controlled. No full entity lifecycle, enchantments, death messages or playable integration claim.'} + lab.write_json(report_path,report);print(f'Scoped registered player combat parity passed: {report_path}') + + +if __name__=='__main__':main() From 765f89c6680285402e2b9bce1c7ea20062d6a20f Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 06:00:28 +0200 Subject: [PATCH 124/253] Implement blocking reduction, timer and item-damage rules --- .../scoped-parity.json | 259 ++++++++++++++++++ .../examples/blocking_rules_fixture.rs | 105 +++++++ crates/horizon-world/src/blocking_rules.rs | 95 +++++++ crates/horizon-world/src/lib.rs | 1 + docs/collision-geometry.md | 15 + .../parity/VanillaBlockingRulesOracle.java | 17 ++ tools/test_blocking_rules_parity.py | 76 +++++ 7 files changed, 568 insertions(+) create mode 100644 benchmarks/rust-blocking-rules-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/blocking_rules_fixture.rs create mode 100644 crates/horizon-world/src/blocking_rules.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockingRulesOracle.java create mode 100644 tools/test_blocking_rules_parity.py diff --git a/benchmarks/rust-blocking-rules-2026-10-07/scoped-parity.json b/benchmarks/rust-blocking-rules-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..cf2007849 --- /dev/null +++ b/benchmarks/rust-blocking-rules-2026-10-07/scoped-parity.json @@ -0,0 +1,259 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 14360, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockingRulesOracle.java": "ff8cf707d14d3fcb9af6b93b3a9cdc0290094c8bdbeb8c4764d038bc4d47d983", + "tools/test_blocking_rules_parity.py": "0a6e1c943e624ef04895dfdc7f94b24625c5aa511a02e5b96dc2862d4931d48d", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "cb1e87d449114a63edd904c0559d631e8fa9feeb27efd6539aacdcfeae178876", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "977338bf3e654193685b015d383493b9f59ff6f5d6210bec212cef8ac4a50bed", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/blocking_rules.rs": "83c5e2105cec56a90182ce582e1c67ade2b189be6de1a34d08035000cc07c492", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_immunity.rs": "fd39c41124d694e755cf7faadcf93c636df4042c78ec345092a856b5f952dbcf", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/damage_source.rs": "24945e397a926d34695652980923609e4723e02fe6b6e56d4aaf673e45d759f7", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "4ce6bfa959b22b32d3b461614ad65cb22d0d74971e83ca96cc7e22bae9954391", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "2b448209629b9bf2e678d667ad0d6c7fa22146892dd106b169d96b31b0df12bb", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_hurt.rs": "844239ad7d15c39629bb3cfc06ebae6d1cff20b7627468f26e0ee8dff3abdcb8", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_hurt.rs": "99c9bbd8587ec2dc287806049897b8034d2f5349ad47fc497b70d54148844a36", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/server_player_combat.rs": "a9743971581af86d926eeba42004d932caf83382c470dd98bf613cb9c417db58", + "crates/horizon-world/src/server_player_damage.rs": "828a4649fec3e9bda2dfe20aced8c95922c697321de2be4127bd4e5712ecbb7c", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "f417aab280331ddd6f0ca265a12c0130c78b9924f407c7e07f198140501e6010", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "74e4110fb19c4c4047192fd65c38015b8afc7f9fc50404d75380b5063808148c", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/blocking_rules_fixture.rs": "af2f202ca110684dbc4f0a03c064c0c07f48939434aeef1f9c562856c7ce586f" + }, + "fixtures_sha256": { + ".local/rust-blocking-rules-parity/inputs.txt": "44c056afe8e3d461155e1a0799b8049b62e2f3945dc2a370f6d444bc05910dca" + }, + "rust_output_sha256": "723e42fa1d78554388b17e82b305aa9fe635e869da646112f7d3c573dde59760", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "723e42fa1d78554388b17e82b305aa9fe635e869da646112f7d3c573dde59760", + "matched_output_lines": 105068 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "723e42fa1d78554388b17e82b305aa9fe635e869da646112f7d3c573dde59760", + "matched_output_lines": 105068 + } + ], + "scope": "Actual BlocksAttacks damage reduction records and ordered sums, native direct HolderSet membership through virtual source typeHolder queries, delay/disable tick rounding and ItemDamageFunction thresholds/flooring. Covers NaN/infinity/signed zero, exact angle boundaries, randomized float bits, membership mutations and query failures. Direction/acos calculation, component codecs, item durability, sounds and full blocking dispatch remain pending." +} diff --git a/crates/horizon-world/examples/blocking_rules_fixture.rs b/crates/horizon-world/examples/blocking_rules_fixture.rs new file mode 100644 index 000000000..c0e19d541 --- /dev/null +++ b/crates/horizon-world/examples/blocking_rules_fixture.rs @@ -0,0 +1,105 @@ +use horizon_world::blocking_rules::{ + BlockingRules, DamageReduction, ItemDamageFunction, TypeMatchWorld, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn single(v: &Value) -> f32 { + f32::from_bits(u32::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn bits(v: f32) -> u32 { + if v.is_nan() { + f32::NAN.to_bits() + } else { + v.to_bits() + } +} +struct World<'a> { + f: &'a Value, + out: &'a mut dyn Write, + calls: i64, + changed: bool, +} +impl TypeMatchWorld for World<'_> { + type Error = io::Error; + type Set = u64; + fn source_in_set(&mut self, set: u64) -> io::Result { + writeln!(self.out, "type-holder")?; + let n = self.calls; + self.calls += 1; + if n == self.f["fail"].as_i64().unwrap() { + return Err(io::Error::other("injected holder query failure")); + } + if n == self.f["mutate_at"].as_i64().unwrap() { + self.changed = true; + } + let id = self.f[if self.changed { "after_type" } else { "type" }] + .as_u64() + .unwrap(); + Ok(match set { + 1 => id == 0, + 2 => id == 1, + 3 => true, + 4 => false, + _ => panic!("set"), + }) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let item = &f["item"]; + let rules = BlockingRules { + delay_seconds: single(&f["delay"]), + disable_scale: single(&f["disable_scale"]), + item_damage: ItemDamageFunction { + threshold: single(&item["threshold"]), + base: single(&item["base"]), + factor: single(&item["factor"]), + }, + reductions: f["reductions"] + .as_array() + .unwrap() + .iter() + .map(|r| { + let set = r["set"].as_u64().unwrap(); + DamageReduction { + horizontal_angle: single(&r["angle"]), + types: (set != 0).then_some(set), + base: single(&r["base"]), + factor: single(&r["factor"]), + } + }) + .collect(), + }; + let damage = single(&f["damage"]); + let mut w = World { + f: &f, + out: &mut out, + calls: 0, + changed: false, + }; + writeln!(w.out, "delay {}", rules.delay_ticks())?; + writeln!( + w.out, + "disable {}", + rules.disable_ticks(single(&f["disable_seconds"])) + )?; + writeln!(w.out, "item {}", rules.item_damage.apply(damage))?; + match rules.resolve(&mut w, damage, number(&f["angle"])) { + Ok(v) => writeln!(w.out, "blocked {:08x}\nresult ok", bits(v))?, + Err(_) => writeln!(w.out, "result error")?, + }; + writeln!(w.out, "queries {} {}", w.calls, w.changed)?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/blocking_rules.rs b/crates/horizon-world/src/blocking_rules.rs new file mode 100644 index 000000000..c990b991a --- /dev/null +++ b/crates/horizon-world/src/blocking_rules.rs @@ -0,0 +1,95 @@ +//! Blocks-attacks scalar reduction, delay/cooldown and item-damage rules. +//! Direction calculation, component codecs, equipment mutation and sounds are +//! separate services; angles here are the native caller's radians. +pub trait TypeMatchWorld { + type Error; + type Set: Copy; + fn source_in_set(&mut self, set: Self::Set) -> Result; +} +#[derive(Clone, Copy, Debug)] +pub struct DamageReduction { + pub horizontal_angle: f32, + pub types: Option, + pub base: f32, + pub factor: f32, +} +fn min(a: f32, b: f32) -> f32 { + if a.is_nan() || b.is_nan() { + f32::NAN + } else if a == 0.0 && b == 0.0 { + f32::from_bits(a.to_bits() | b.to_bits()) + } else { + a.min(b) + } +} +fn clamp(value: f32, damage: f32) -> f32 { + if value < 0.0 { 0.0 } else { min(value, damage) } +} +fn round(value: f32) -> i32 { + (f64::from(value) + 0.5).floor() as i32 +} +impl DamageReduction { + pub fn resolve>( + &self, + world: &mut W, + damage: f32, + angle: f64, + ) -> Result { + if angle > f64::from(0.017_453_292_f32 * self.horizontal_angle) { + return Ok(0.0); + } + if let Some(set) = self.types { + if !world.source_in_set(set)? { + return Ok(0.0); + } + } + Ok(clamp(self.base + self.factor * damage, damage)) + } +} +#[derive(Clone, Copy, Debug)] +pub struct ItemDamageFunction { + pub threshold: f32, + pub base: f32, + pub factor: f32, +} +impl ItemDamageFunction { + pub fn apply(self, damage: f32) -> i32 { + if damage < self.threshold { + 0 + } else { + (self.base + self.factor * damage).floor() as i32 + } + } +} +#[derive(Clone, Debug)] +pub struct BlockingRules { + pub delay_seconds: f32, + pub disable_scale: f32, + pub reductions: Vec>, + pub item_damage: ItemDamageFunction, +} +impl BlockingRules { + pub fn delay_ticks(&self) -> i32 { + round(self.delay_seconds * 20.0) + } + pub fn disable_ticks(&self, seconds: f32) -> i32 { + let duration = seconds * self.disable_scale; + if duration > 0.0 { + round(duration * 20.0) + } else { + 0 + } + } + pub fn resolve>( + &self, + world: &mut W, + damage: f32, + angle: f64, + ) -> Result { + let mut blocked = 0.0; + for reduction in &self.reductions { + blocked += reduction.resolve(world, damage, angle)?; + } + Ok(clamp(blocked, damage)) + } +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 9b2c4086f..641565cd1 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -13,6 +13,7 @@ pub mod block_properties; pub mod block_render; pub mod block_support; pub mod block_survival; +pub mod blocking_rules; pub mod chunk; pub mod chunk_status; pub mod climbing; diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 1ebbd22da..44f929a55 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1453,3 +1453,18 @@ Targeted Clippy passes. Equipment is unenchanted; virtual entity flags/rule values, blocking amounts, durability, PvP permission, attribution, effects, knockback/death services and empty criterion listeners remain controlled. Complete entity lifecycle and playable game integration remain pending. + + +`blocking_rules` implements damage-reduction angle/type conditions, ordered +reduction sums and clamping, block delay/disable tick rounding and item-damage +threshold/floor arithmetic. Source type-set membership is queried only when its +entry's angle condition reaches that check. + +`python3 tools/test_blocking_rules_parity.py` compares native BlocksAttacks +records and direct holder-set membership. The +[blocking rules report](../benchmarks/rust-blocking-rules-2026-10-07/scoped-parity.json) +records **105,068 matching lines per JAR**, including exact angle boundaries, +NaN/infinity/signed zero, randomized float bits, source-type mutations and query +failures. Targeted Clippy passes. Angles are supplied in radians; direction/acos +calculation, component codecs, item durability, sounds and full blocking +integration remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockingRulesOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockingRulesOracle.java new file mode 100644 index 000000000..ddd36c22a --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockingRulesOracle.java @@ -0,0 +1,17 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.*;import net.minecraft.world.damagesource.*;import net.minecraft.world.item.component.BlocksAttacks; +/** Actual blocking component math with native direct holder-set membership. */ +public final class VanillaBlockingRulesOracle { + static final class Stop extends RuntimeException {} + static float single(JsonElement v){return Float.intBitsToFloat(Integer.parseUnsignedInt(v.getAsString(),16));} + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + static String bits(float v){return String.format("%08x",Float.floatToIntBits(v));} + static final class Source extends DamageSource {JsonObject f;PrintWriter out;int calls;boolean changed;List> types;Source(){super(null);}@Override public Holder typeHolder(){out.println("type-holder");int n=calls++;if(n==f.get("fail").getAsInt())throw new Stop();if(n==f.get("mutate_at").getAsInt())changed=true;return types.get(f.get(changed?"after_type":"type").getAsInt());}} + public static void main(String[] args)throws Exception{ + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();var a=Holder.direct(new DamageType("a",0));var b=Holder.direct(new DamageType("b",0));List> types=List.of(a,b);List> sets=List.of(HolderSet.direct(List.of(a)),HolderSet.direct(List.of(b)),HolderSet.direct(List.of(a,b)),HolderSet.direct(List.of()));var disable=BlocksAttacks.class.getDeclaredMethod("disableBlockingForTicks",float.class);disable.setAccessible(true);Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();var source=new Source();source.f=f;source.out=out;source.types=types;var reductions=new ArrayList();for(var rv:f.getAsJsonArray("reductions")){var r=rv.getAsJsonObject();int set=r.get("set").getAsInt();reductions.add(new BlocksAttacks.DamageReduction(single(r.get("angle")),set==0?Optional.empty():Optional.of(sets.get(set-1)),single(r.get("base")),single(r.get("factor"))));}var item=f.getAsJsonObject("item");var itemDamage=new BlocksAttacks.ItemDamageFunction(single(item.get("threshold")),single(item.get("base")),single(item.get("factor")));var rules=new BlocksAttacks(single(f.get("delay")),single(f.get("disable_scale")),reductions,itemDamage,Optional.empty(),Optional.empty(),Optional.empty());float damage=single(f.get("damage"));double angle=number(f.get("angle")); + try{out.println("delay "+rules.blockDelayTicks());out.println("disable "+disable.invoke(rules,single(f.get("disable_seconds"))));out.println("item "+itemDamage.apply(damage));out.println("blocked "+bits(rules.resolveBlockedDamage(source,damage,angle)));out.println("result ok");}catch(Stop e){out.println("result error");}out.println("queries "+source.calls+" "+source.changed); + }} + } +} diff --git a/tools/test_blocking_rules_parity.py b/tools/test_blocking_rules_parity.py new file mode 100644 index 000000000..29f58fd1b --- /dev/null +++ b/tools/test_blocking_rules_parity.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python3 +"""Compare native blocking reductions, timers and item-damage arithmetic.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + def bits(v):return struct.pack('>f',v).hex() + def double(v):return struct.pack('>d',v).hex() + def reduction(angle=90,base=0,factor=1,set=0):return dict(angle=bits(angle),base=bits(base),factor=bits(factor),set=set) + def row(damage=8,angle=0,reductions=None,delay=.25,scale=1,seconds=1,threshold=3,base=1,factor=1,**kw): + f=dict(damage=bits(damage),angle=double(angle),reductions=reductions if reductions is not None else [reduction()],delay=bits(delay),disable_scale=bits(scale),disable_seconds=bits(seconds),item=dict(threshold=bits(threshold),base=bits(base),factor=bits(factor)),type=0,after_type=1,fail=-1,mutate_at=-1);f.update(kw);return f + values=[-float('inf'),-1e30,-1,-.5,-0.,0.,1e-40,.1,.5,1,5,20,1e30,float('inf'),float('nan')] + for damage in values: + for base in values: + for factor in values: + yield row(damage,base=base,factor=factor,threshold=base,delay=damage,scale=base,seconds=factor,reductions=[reduction(base=base,factor=factor),reduction(angle=float('nan'),base=factor,factor=base,set=1)]) + for degrees in [-float('inf'),-360,-90,-0.,0.,1e-40,.1,45,90,180,360,float('inf'),float('nan')]: + c=struct.unpack('>f',struct.pack('>f',.017453292))[0] + radians=struct.unpack('>f',struct.pack('>f',c*degrees))[0] + for angle in [radians,math.nextafter(radians,-float('inf')),math.nextafter(radians,float('inf')),-float('inf'),float('inf'),float('nan')]: + for set in range(5): + for t in range(2):yield row(angle=angle,reductions=[reduction(angle=degrees,set=set)],type=t) + for delay in [i/40 for i in range(-100,101)]+[53687088.,107374176.,107374184.,float('nan')]: + yield row(delay=delay,scale=1,seconds=delay) + rng=random.Random(0x424c4f434b52554c) + def random_float():return struct.unpack('>f',struct.pack('>I',rng.getrandbits(32)))[0] + for _ in range(10000): + v=lambda:rng.choice(values) if rng.randrange(2) else random_float() + yield row(damage=v(),angle=rng.choice([float('nan'),-float('inf'),float('inf'),rng.uniform(-10,10)]),reductions=[reduction(angle=v(),base=v(),factor=v(),set=rng.randrange(5)) for _ in range(rng.randrange(9))],delay=v(),scale=v(),seconds=v(),threshold=v(),base=v(),factor=v(),type=rng.randrange(2),after_type=rng.randrange(2),fail=rng.choice([-1,-1,*range(8)]),mutate_at=rng.randrange(-1,8)) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-blocking-rules-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockingRulesOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/blocking_rules_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaBlockingRulesOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','blocking_rules_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('blocking_rules_fixture.exe' if os.name=='nt' else 'blocking_rules_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} blocking rules output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual BlocksAttacks damage reduction records and ordered sums, native direct HolderSet membership through virtual source typeHolder queries, delay/disable tick rounding and ItemDamageFunction thresholds/flooring. Covers NaN/infinity/signed zero, exact angle boundaries, randomized float bits, membership mutations and query failures. Direction/acos calculation, component codecs, item durability, sounds and full blocking dispatch remain pending.'} + lab.write_json(report_path,report);print(f'Scoped blocking rules parity passed: {report_path}') + + +if __name__=='__main__':main() From 5563c8708a789301a2b57120c5327d94a2d31c2c Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 06:07:40 +0200 Subject: [PATCH 125/253] Match native view vectors and blocking-angle inverse cosine --- Cargo.lock | 1 + .../scoped-parity.json | 260 ++++++++++++++++++ crates/horizon-world/Cargo.toml | 1 + .../examples/view_direction_fixture.rs | 65 +++++ crates/horizon-world/src/lib.rs | 1 + crates/horizon-world/src/view_direction.rs | 24 ++ docs/collision-geometry.md | 15 + .../parity/VanillaViewDirectionOracle.java | 19 ++ tools/test_view_direction_parity.py | 74 +++++ 9 files changed, 460 insertions(+) create mode 100644 benchmarks/rust-view-direction-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/view_direction_fixture.rs create mode 100644 crates/horizon-world/src/view_direction.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaViewDirectionOracle.java create mode 100644 tools/test_view_direction_parity.py diff --git a/Cargo.lock b/Cargo.lock index 51f4e52c6..3f0756271 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -609,6 +609,7 @@ version = "0.1.0" dependencies = [ "flate2", "horizon-core", + "libm", "lz4_flex", "serde_json", "xxhash-rust", diff --git a/benchmarks/rust-view-direction-2026-10-07/scoped-parity.json b/benchmarks/rust-view-direction-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..3716bc833 --- /dev/null +++ b/benchmarks/rust-view-direction-2026-10-07/scoped-parity.json @@ -0,0 +1,260 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 226459, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaViewDirectionOracle.java": "f26bbbf155fcc1d1b4b2f2a714413b4fd7e19f03970c4e5b0915a1415d413275", + "tools/test_view_direction_parity.py": "361b91caf0e53e11978017f588ca091ba2f3cffd72d57e7feeb378d3870a8e79", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "6884c7209f007ab9ee742b9c3c73828cfa1c6753d35b5fe25a87cab5955b33f8", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "18bbad377a8047e4d4ecd0fc87d83d46d1c0f1ce2b8c47bbe64633e7b4420b57", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/blocking_rules.rs": "83c5e2105cec56a90182ce582e1c67ade2b189be6de1a34d08035000cc07c492", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_immunity.rs": "fd39c41124d694e755cf7faadcf93c636df4042c78ec345092a856b5f952dbcf", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/damage_source.rs": "24945e397a926d34695652980923609e4723e02fe6b6e56d4aaf673e45d759f7", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/lib.rs": "ac2cca14198b7890bb748e77843ae087a0b6a40e8496e0053e4c817cdad01883", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "2b448209629b9bf2e678d667ad0d6c7fa22146892dd106b169d96b31b0df12bb", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_hurt.rs": "844239ad7d15c39629bb3cfc06ebae6d1cff20b7627468f26e0ee8dff3abdcb8", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_hurt.rs": "99c9bbd8587ec2dc287806049897b8034d2f5349ad47fc497b70d54148844a36", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/server_player_combat.rs": "a9743971581af86d926eeba42004d932caf83382c470dd98bf613cb9c417db58", + "crates/horizon-world/src/server_player_damage.rs": "828a4649fec3e9bda2dfe20aced8c95922c697321de2be4127bd4e5712ecbb7c", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "f417aab280331ddd6f0ca265a12c0130c78b9924f407c7e07f198140501e6010", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/view_direction.rs": "e18120ae26dc5cf702b29fc4c8487088bab133c8ce5abce01226833fafb0d5a4", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "74e4110fb19c4c4047192fd65c38015b8afc7f9fc50404d75380b5063808148c", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/view_direction_fixture.rs": "28c23881c7ea170dc9cbc4db9abbe278c391b38f2aa9a0ba8a3765625daf90e5" + }, + "fixtures_sha256": { + ".local/rust-view-direction-parity/inputs.txt": "b41c7a2cd7259bed9e5f833a68da8e192066f8beb632dc4ff91b5a22cf72e078" + }, + "rust_output_sha256": "3aed71ef2a5ad3e1f2cf944abc5b614d937d3128ead9e24213a763855566dbd0", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "3aed71ef2a5ad3e1f2cf944abc5b614d937d3128ead9e24213a763855566dbd0", + "matched_output_lines": 226459 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "3aed71ef2a5ad3e1f2cf944abc5b614d937d3128ead9e24213a763855566dbd0", + "matched_output_lines": 226459 + } + ], + "scope": "Actual Entity.calculateViewVector and Java Math.acos, plus the blocking-direction composition of native view vector, Vec3 subtraction/normalization/dot and acos. Exact bit comparisons cover random doubles, inverse-cosine boundaries, float-table directions, nonfinite/zero/near-zero horizontal vectors and the float-PI fallback. Uses pinned pure-Rust libm 0.2.16; full item-blocking dispatch and other platform JVMs remain pending." +} diff --git a/crates/horizon-world/Cargo.toml b/crates/horizon-world/Cargo.toml index 4c8c4f43a..f8fb09adf 100644 --- a/crates/horizon-world/Cargo.toml +++ b/crates/horizon-world/Cargo.toml @@ -7,6 +7,7 @@ rust-version.workspace = true description = "Horizon vanilla world data, NBT, regions and chunk storage" [dependencies] +libm = "=0.2.16" serde_json = { version = "1.0.151", features = ["raw_value"] } horizon-core = { path = "../horizon-core" } flate2 = { version = "1.1.10", default-features = false, features = ["rust_backend"] } diff --git a/crates/horizon-world/examples/view_direction_fixture.rs b/crates/horizon-world/examples/view_direction_fixture.rs new file mode 100644 index 000000000..6fa6ccd55 --- /dev/null +++ b/crates/horizon-world/examples/view_direction_fixture.rs @@ -0,0 +1,65 @@ +use horizon_core::geometry::Vec3; +use horizon_world::view_direction; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn single(v: &Value) -> f32 { + f32::from_bits(u32::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn vec(v: &Value) -> Vec3 { + Vec3::new(number(&v[0]), number(&v[1]), number(&v[2])) +} +fn bits(v: f64) -> u64 { + if v.is_nan() { + f64::NAN.to_bits() + } else { + v.to_bits() + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + match f["mode"].as_str().unwrap() { + "acos" => writeln!( + out, + "angle {:016x}", + bits(view_direction::acos(number(&f["value"]))) + )?, + "view" => { + let v = view_direction::view_vector(single(&f["pitch"]), single(&f["yaw"])); + writeln!( + out, + "view {:016x} {:016x} {:016x}", + bits(v.x), + bits(v.y), + bits(v.z) + )?; + } + "blocking" => writeln!( + out, + "angle {:016x}", + bits(view_direction::blocking_angle( + vec(&f["source"]), + vec(&f["position"]), + single(&f["yaw"]) + )) + )?, + "fallback" => writeln!( + out, + "angle {:016x}", + bits(view_direction::BLOCKING_FALLBACK_ANGLE) + )?, + _ => panic!("mode"), + } + } + Ok(()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 641565cd1..b22adfcee 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -76,6 +76,7 @@ pub mod suffocation; pub mod swimming; pub mod synced_floats; pub mod tick_data; +pub mod view_direction; pub mod water_splash; pub mod world_movement; pub mod world_ray; diff --git a/crates/horizon-world/src/view_direction.rs b/crates/horizon-world/src/view_direction.rs new file mode 100644 index 000000000..d33a14289 --- /dev/null +++ b/crates/horizon-world/src/view_direction.rs @@ -0,0 +1,24 @@ +//! Native float-table view direction and horizontal blocking angle arithmetic. +use horizon_core::geometry::{Vec3, trig}; +pub fn view_vector(pitch: f32, yaw: f32) -> Vec3 { + let pitch = pitch * trig::DEG_TO_RAD; + let yaw = -yaw * trig::DEG_TO_RAD; + let cy = trig::cos(f64::from(yaw)); + let sy = trig::sin(f64::from(yaw)); + let cp = trig::cos(f64::from(pitch)); + let sp = trig::sin(f64::from(pitch)); + Vec3::new(f64::from(sy * cp), f64::from(-sp), f64::from(cy * cp)) +} +/// Java Math.acos comparisons use the pinned pure-Rust implementation. The +/// platform C-library acos is not bit-identical to the reference JVM. +pub fn acos(value: f64) -> f64 { + libm::acos(value) +} +pub fn blocking_angle(source: Vec3, position: Vec3, head_yaw: f32) -> f64 { + let view = view_vector(0.0, head_yaw); + let delta = source.subtract(position); + let horizontal = Vec3::new(delta.x, 0.0, delta.z).normalize(); + acos(horizontal.dot(view)) +} +/// Native no-source-position fallback widens the float PI constant to double. +pub const BLOCKING_FALLBACK_ANGLE: f64 = std::f32::consts::PI as f64; diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 44f929a55..48c91c47c 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1468,3 +1468,18 @@ NaN/infinity/signed zero, randomized float bits, source-type mutations and query failures. Targeted Clippy passes. Angles are supplied in radians; direction/acos calculation, component codecs, item durability, sounds and full blocking integration remain pending. + + +`view_direction` implements native float-table pitch/yaw vectors and horizontal +blocking angles, using the pinned pure-Rust `libm` 0.2.16 inverse cosine. A local +203,072-input probe found 7,908 differences with the platform `acos`, versus none +with this pinned implementation, so platform math is not used for this path. + +`python3 tools/test_view_direction_parity.py` compares actual native view vectors +and Java Math.acos, plus the native view/subtract/normalize/dot/acos composition +used by blocking. The [view-direction report](../benchmarks/rust-view-direction-2026-10-07/scoped-parity.json) +records **226,459 matching lines per JAR**, including random doubles, inverse- +cosine boundaries, arbitrary float rotations, degenerate horizontal vectors and +the widened float-PI fallback. Targeted Clippy passes. Full item-blocking dispatch +and validation against JVMs on other platforms remain pending. This does not +resolve the separately tracked Math.cos/Gaussian portability differences. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaViewDirectionOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaViewDirectionOracle.java new file mode 100644 index 000000000..c882cb891 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaViewDirectionOracle.java @@ -0,0 +1,19 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.nio.file.*; +import net.minecraft.world.entity.Entity;import net.minecraft.world.phys.Vec3; +/** Native view vectors and native geometry/acos composition used by blocking. */ +public final class VanillaViewDirectionOracle { + static float single(JsonElement v){return Float.intBitsToFloat(Integer.parseUnsignedInt(v.getAsString(),16));} + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + static Vec3 vec(JsonElement v){var a=v.getAsJsonArray();return new Vec3(number(a.get(0)),number(a.get(1)),number(a.get(2)));} + static String bits(double v){return String.format("%016x",Double.doubleToLongBits(v));} + public static void main(String[] args)throws Exception{ + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();Path dir=Path.of(args[1]);try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();switch(f.get("mode").getAsString()){ + case "acos":out.println("angle "+bits(Math.acos(number(f.get("value")))));break; + case "view":{var v=Entity.calculateViewVector(single(f.get("pitch")),single(f.get("yaw")));out.println("view "+bits(v.x)+" "+bits(v.y)+" "+bits(v.z));break;} + case "blocking":{var view=Entity.calculateViewVector(0,single(f.get("yaw")));var delta=vec(f.get("source")).subtract(vec(f.get("position")));var horizontal=new Vec3(delta.x,0,delta.z).normalize();out.println("angle "+bits(Math.acos(horizontal.dot(view))));break;} + case "fallback":out.println("angle "+bits((double)(float)Math.PI));break; + default:throw new AssertionError();} + }} + } +} diff --git a/tools/test_view_direction_parity.py b/tools/test_view_direction_parity.py new file mode 100644 index 000000000..c48627380 --- /dev/null +++ b/tools/test_view_direction_parity.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python3 +"""Compare native view vectors and blocking-angle arithmetic.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + def single(v):return struct.pack('>f',v).hex() + def double(v):return struct.pack('>d',v).hex() + def vec(v):return [double(x) for x in v] + rng=random.Random(0x41434f53) + for _ in range(100000):yield dict(mode='acos',value=double(rng.uniform(-1,1))) + for _ in range(100000):yield dict(mode='acos',value=f'{rng.getrandbits(64):016x}') + for pivot in [-1,-.5,-0.,0.,.5,1]: + for direction in [-float('inf'),float('inf')]: + v=pivot + for _ in range(256):yield dict(mode='acos',value=double(v));v=math.nextafter(v,direction) + values=[-float('inf'),-1e30,-720,-360,-180,-90,-45,-1,-0.,0.,1e-40,.1,1,45,90,180,360,720,1e30,float('inf'),float('nan')] + for pitch in values: + for yaw in values:yield dict(mode='view',pitch=single(pitch),yaw=single(yaw)) + for _ in range(10000):yield dict(mode='view',pitch=f'{rng.getrandbits(32):08x}',yaw=f'{rng.getrandbits(32):08x}') + for yaw in values: + for x in [-1,-1e-5,-0.,0.,1e-6,1e-5,1,float('inf'),float('nan')]: + for z in [-1,-1e-5,0.,1e-5,1]:yield dict(mode='blocking',source=vec([x,99,z]),position=vec([0,0,0]),yaw=single(yaw)) + for _ in range(12000): + value=lambda:rng.choice(values) if rng.randrange(4)==0 else rng.uniform(-10000,10000) + yield dict(mode='blocking',source=vec([value(),value(),value()]),position=vec([value(),value(),value()]),yaw=single(rng.choice(values) if rng.randrange(4)==0 else rng.uniform(-10000,10000))) + yield dict(mode='fallback') + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-view-direction-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaViewDirectionOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/view_direction_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaViewDirectionOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','view_direction_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('view_direction_fixture.exe' if os.name=='nt' else 'view_direction_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} view direction output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual Entity.calculateViewVector and Java Math.acos, plus the blocking-direction composition of native view vector, Vec3 subtraction/normalization/dot and acos. Exact bit comparisons cover random doubles, inverse-cosine boundaries, float-table directions, nonfinite/zero/near-zero horizontal vectors and the float-PI fallback. Uses pinned pure-Rust libm 0.2.16; full item-blocking dispatch and other platform JVMs remain pending.'} + lab.write_json(report_path,report);print(f'Scoped view direction parity passed: {report_path}') + + +if __name__=='__main__':main() From a980b89b33ad6b0bc51bd6734ed767b04e14451a Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 06:12:53 +0200 Subject: [PATCH 126/253] Implement living item-blocking direction and dispatch ordering --- .../scoped-parity.json | 261 ++++++++++++++++++ .../examples/item_blocking_fixture.rs | 217 +++++++++++++++ crates/horizon-world/src/item_blocking.rs | 83 ++++++ crates/horizon-world/src/lib.rs | 1 + docs/collision-geometry.md | 16 ++ .../parity/VanillaItemBlockingOracle.java | 48 ++++ tools/test_item_blocking_parity.py | 74 +++++ 7 files changed, 700 insertions(+) create mode 100644 benchmarks/rust-item-blocking-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/item_blocking_fixture.rs create mode 100644 crates/horizon-world/src/item_blocking.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemBlockingOracle.java create mode 100644 tools/test_item_blocking_parity.py diff --git a/benchmarks/rust-item-blocking-2026-10-07/scoped-parity.json b/benchmarks/rust-item-blocking-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..d833adda9 --- /dev/null +++ b/benchmarks/rust-item-blocking-2026-10-07/scoped-parity.json @@ -0,0 +1,261 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 12058, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemBlockingOracle.java": "fbac19e0b43c505b92ed0ea3a9e05345e946db1013a1349104a1dc1584e15658", + "tools/test_item_blocking_parity.py": "bf08f663ddef4d75aaa4d5747721cab0105344f2bc659cd94c3c1c436a8b5037", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "6884c7209f007ab9ee742b9c3c73828cfa1c6753d35b5fe25a87cab5955b33f8", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "18bbad377a8047e4d4ecd0fc87d83d46d1c0f1ce2b8c47bbe64633e7b4420b57", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/blocking_rules.rs": "83c5e2105cec56a90182ce582e1c67ade2b189be6de1a34d08035000cc07c492", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_immunity.rs": "fd39c41124d694e755cf7faadcf93c636df4042c78ec345092a856b5f952dbcf", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/damage_source.rs": "24945e397a926d34695652980923609e4723e02fe6b6e56d4aaf673e45d759f7", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/item_blocking.rs": "f6eee0d6d177cc3148960122327ba1b459a2f0e85241c1d9a3e40f0b8c169296", + "crates/horizon-world/src/lib.rs": "7e35fc2dd1a25f6c1cc49e7acad4c3e7b3cbd02086f7a8590cc2c171009b3c7c", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "2b448209629b9bf2e678d667ad0d6c7fa22146892dd106b169d96b31b0df12bb", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_hurt.rs": "844239ad7d15c39629bb3cfc06ebae6d1cff20b7627468f26e0ee8dff3abdcb8", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_hurt.rs": "99c9bbd8587ec2dc287806049897b8034d2f5349ad47fc497b70d54148844a36", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/server_player_combat.rs": "a9743971581af86d926eeba42004d932caf83382c470dd98bf613cb9c417db58", + "crates/horizon-world/src/server_player_damage.rs": "828a4649fec3e9bda2dfe20aced8c95922c697321de2be4127bd4e5712ecbb7c", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "f417aab280331ddd6f0ca265a12c0130c78b9924f407c7e07f198140501e6010", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/view_direction.rs": "e18120ae26dc5cf702b29fc4c8487088bab133c8ce5abce01226833fafb0d5a4", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "74e4110fb19c4c4047192fd65c38015b8afc7f9fc50404d75380b5063808148c", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/item_blocking_fixture.rs": "13b8197d2ad51b495b487d3903bc1d0cec1d6c0809b1e0d5ba5731e3d366b4c1" + }, + "fixtures_sha256": { + ".local/rust-item-blocking-parity/inputs.txt": "80405b85b3b9d47bda0c03e7c2fb68ed218ce0aeb081b68bebe4324b72719444" + }, + "rust_output_sha256": "91d6b2dccc5bcd2606d3daef5bda4a219830ae06448e1d7fcf1b20af64ca8b73", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "91d6b2dccc5bcd2606d3daef5bda4a219830ae06448e1d7fcf1b20af64ca8b73", + "matched_output_lines": 87930 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "91d6b2dccc5bcd2606d3daef5bda4a219830ae06448e1d7fcf1b20af64ca8b73", + "matched_output_lines": 87930 + } + ], + "scope": "Actual LivingEntity.applyItemBlocking on base and ServerPlayer receivers, using native BlocksAttacks reductions/holder sets and actual stat/durability dispatch on undamageable stacks. Tests bypass/piercing, source direction, component/item capture across mutations, client/stat guards, repeated direct-entity lookup, melee response and callback failures. Actual damageable-item mutation, blocking-item eligibility/timing, component codecs and full combat/world integration remain pending." +} diff --git a/crates/horizon-world/examples/item_blocking_fixture.rs b/crates/horizon-world/examples/item_blocking_fixture.rs new file mode 100644 index 000000000..c4889925a --- /dev/null +++ b/crates/horizon-world/examples/item_blocking_fixture.rs @@ -0,0 +1,217 @@ +use horizon_core::geometry::Vec3; +use horizon_world::{ + blocking_rules::{BlockingRules, DamageReduction, ItemDamageFunction, TypeMatchWorld}, + item_blocking::{self, ItemBlockingWorld}, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, + sync::Arc, +}; +fn single(v: &Value) -> f32 { + f32::from_bits(u32::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn number(v: &Value) -> f64 { + f64::from_bits(u64::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn vec(v: &Value) -> Option { + (!v.is_null()).then(|| Vec3::new(number(&v[0]), number(&v[1]), number(&v[2]))) +} +fn bits(v: f32) -> u32 { + if v.is_nan() { + f32::NAN.to_bits() + } else { + v.to_bits() + } +} +struct Component { + present: bool, + bypass: Option, + rules: Arc>, +} +struct World<'a> { + f: &'a Value, + out: &'a mut dyn Write, + components: Vec, + calls: i64, + changed: bool, +} +impl World<'_> { + fn state(&self) -> &Value { + &self.f[if self.changed { "after" } else { "initial" }] + } + fn event(&mut self, s: &str) -> io::Result<()> { + writeln!(self.out, "{s}")?; + let n = self.calls; + self.calls += 1; + if n == self.f["fail"].as_i64().unwrap() { + return Err(io::Error::other("injected blocking callback failure")); + } + if n == self.f["mutate_at"].as_i64().unwrap() { + self.changed = true; + } + Ok(()) + } +} +impl TypeMatchWorld for World<'_> { + type Error = io::Error; + type Set = u64; + fn source_in_set(&mut self, set: u64) -> io::Result { + self.event("type-holder")?; + let id = self.state()["type"].as_u64().unwrap(); + Ok(match set { + 1 => id == 0, + 2 => id == 1, + 3 => true, + 4 => false, + _ => panic!("set"), + }) + } +} +impl ItemBlockingWorld for World<'_> { + type Error = io::Error; + type Item = usize; + type Component = usize; + type Entity = u64; + type Level = u64; + type Hand = u64; + fn blocking_item(&mut self) -> io::Result> { + self.event("blocking-item")?; + let id = self.state()["item"].as_i64().unwrap(); + Ok((id >= 0).then_some(id as usize)) + } + fn component(&mut self, item: usize) -> Option { + self.components[item].present.then_some(item) + } + fn bypasses_component(&mut self, c: usize) -> io::Result { + match self.components[c].bypass { + Some(set) => self.source_in_set(set), + None => Ok(false), + } + } + fn direct_entity(&mut self) -> io::Result> { + self.event("direct")?; + let id = self.state()["direct"].as_u64().unwrap(); + Ok((id != 0).then_some(id)) + } + fn is_arrow(&self, e: u64) -> bool { + e == 2 + } + fn pierce_level(&mut self, _: u64) -> io::Result { + self.event("pierce")?; + Ok(self.state()["pierce"].as_i64().unwrap() as i8) + } + fn source_position(&mut self) -> io::Result> { + self.event("source-position")?; + Ok(vec(&self.state()["source"])) + } + fn head_yaw(&mut self) -> io::Result { + self.event("yaw")?; + Ok(single(&self.state()["yaw"])) + } + fn position(&mut self) -> io::Result { + self.event("position")?; + Ok(vec(&self.state()["position"]).unwrap()) + } + fn resolve(&mut self, c: usize, damage: f32, angle: f64) -> io::Result { + let rules = Arc::clone(&self.components[c].rules); + rules.resolve(self, damage, angle) + } + fn level(&mut self) -> io::Result { + self.event("level")?; + Ok(self.state()["level"].as_u64().unwrap()) + } + fn used_hand(&mut self) -> io::Result { + self.event("hand")?; + Ok(self.state()["hand"].as_u64().unwrap()) + } + fn hurt_blocking_item( + &mut self, + c: usize, + level: u64, + item: usize, + _: u64, + blocked: f32, + ) -> io::Result<()> { + if self.f["player"].as_bool().unwrap() { + self.event(&format!("client {level}"))?; + if !self.state()["client"].as_bool().unwrap() { + self.event(&format!("stat {item}"))?; + } + if self.components[c].rules.item_damage.apply(blocked) > 0 { + self.event("level")?; + } + } + Ok(()) + } + fn source_is_projectile(&mut self) -> io::Result { + self.event("projectile")?; + Ok(self.state()["projectile"].as_bool().unwrap()) + } + fn is_living(&self, e: u64) -> bool { + e == 1 + } + fn block_using_item(&mut self, _: u64, damage: f32, fully: bool) -> io::Result<()> { + self.event(&format!("block-using 0 {:08x} {fully}", bits(damage))) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let components = f["components"] + .as_array() + .unwrap() + .iter() + .map(|c| { + let item = &c["item_damage"]; + let bypass = c["bypass"].as_u64().unwrap(); + Component { + present: c["present"].as_bool().unwrap(), + bypass: (bypass != 0).then_some(bypass), + rules: Arc::new(BlockingRules { + delay_seconds: 0.0, + disable_scale: 1.0, + item_damage: ItemDamageFunction { + threshold: single(&item["threshold"]), + base: single(&item["base"]), + factor: single(&item["factor"]), + }, + reductions: c["reductions"] + .as_array() + .unwrap() + .iter() + .map(|r| { + let set = r["set"].as_u64().unwrap(); + DamageReduction { + horizontal_angle: single(&r["angle"]), + types: (set != 0).then_some(set), + base: single(&r["base"]), + factor: single(&r["factor"]), + } + }) + .collect(), + }), + } + }) + .collect(); + let mut w = World { + f: &f, + out: &mut out, + components, + calls: 0, + changed: false, + }; + match item_blocking::apply(&mut w, single(&f["damage"])) { + Ok(v) => writeln!(w.out, "blocked {:08x}\nresult ok", bits(v))?, + Err(_) => writeln!(w.out, "result error")?, + }; + writeln!(w.out, "queries {} {}", w.calls, w.changed)?; + writeln!(w.out, "items 1 0 1 0")?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/item_blocking.rs b/crates/horizon-world/src/item_blocking.rs new file mode 100644 index 000000000..d2561df5e --- /dev/null +++ b/crates/horizon-world/src/item_blocking.rs @@ -0,0 +1,83 @@ +//! Living item-blocking dispatch around direction and component reductions. +use crate::view_direction; +use horizon_core::geometry::Vec3; +pub trait ItemBlockingWorld { + type Error; + type Item: Copy; + type Component: Copy; + type Entity: Copy; + type Level: Copy; + type Hand: Copy; + fn blocking_item(&mut self) -> Result, Self::Error>; + fn component(&mut self, item: Self::Item) -> Option; + fn bypasses_component(&mut self, component: Self::Component) -> Result; + fn direct_entity(&mut self) -> Result, Self::Error>; + fn is_arrow(&self, entity: Self::Entity) -> bool; + fn pierce_level(&mut self, arrow: Self::Entity) -> Result; + fn source_position(&mut self) -> Result, Self::Error>; + fn head_yaw(&mut self) -> Result; + fn position(&mut self) -> Result; + fn resolve( + &mut self, + component: Self::Component, + damage: f32, + angle: f64, + ) -> Result; + fn level(&mut self) -> Result; + fn used_hand(&mut self) -> Result; + fn hurt_blocking_item( + &mut self, + component: Self::Component, + level: Self::Level, + item: Self::Item, + hand: Self::Hand, + blocked: f32, + ) -> Result<(), Self::Error>; + fn source_is_projectile(&mut self) -> Result; + fn is_living(&self, entity: Self::Entity) -> bool; + /// Uses the original server-level argument, not the later virtual level. + fn block_using_item( + &mut self, + attacker: Self::Entity, + damage: f32, + fully_blocked: bool, + ) -> Result<(), Self::Error>; +} +pub fn apply(world: &mut W, damage: f32) -> Result { + if damage <= 0.0 { + return Ok(0.0); + } + let Some(item) = world.blocking_item()? else { + return Ok(0.0); + }; + let Some(component) = world.component(item) else { + return Ok(0.0); + }; + if world.bypasses_component(component)? { + return Ok(0.0); + } + if let Some(entity) = world.direct_entity()? { + if world.is_arrow(entity) && world.pierce_level(entity)? > 0 { + return Ok(0.0); + } + } + let angle = if let Some(source) = world.source_position()? { + let yaw = world.head_yaw()?; + let position = world.position()?; + view_direction::blocking_angle(source, position, yaw) + } else { + view_direction::BLOCKING_FALLBACK_ANGLE + }; + let blocked = world.resolve(component, damage, angle)?; + let level = world.level()?; + let hand = world.used_hand()?; + world.hurt_blocking_item(component, level, item, hand, blocked)?; + if blocked > 0.0 && !world.source_is_projectile()? { + if let Some(entity) = world.direct_entity()? { + if world.is_living(entity) { + world.block_using_item(entity, damage, blocked >= damage)?; + } + } + } + Ok(blocked) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index b22adfcee..0bad82fc6 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -43,6 +43,7 @@ pub mod free_space; pub mod ground_support; pub mod heightmap; pub mod interaction_shapes; +pub mod item_blocking; pub mod liquid_collision; pub mod living_air; pub mod living_damage; diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 48c91c47c..a598b20fb 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1483,3 +1483,19 @@ cosine boundaries, arbitrary float rotations, degenerate horizontal vectors and the widened float-PI fallback. Targeted Clippy passes. Full item-blocking dispatch and validation against JVMs on other platforms remain pending. This does not resolve the separately tracked Math.cos/Gaussian portability differences. + + +`item_blocking` implements living blocking dispatch: item/component capture, +bypass and pierced-arrow rejection, source direction, component reduction, +blocking-item damage dispatch and the later non-projectile melee response. +The virtual level/used hand are queried after reduction; melee response retains +the original server-level argument and performs a fresh direct-entity lookup. + +`python3 tools/test_item_blocking_parity.py` compares actual LivingEntity +applyItemBlocking with native components on base and ServerPlayer receivers. +The [item-blocking report](../benchmarks/rust-item-blocking-2026-10-07/scoped-parity.json) +records **87,930 matching lines per JAR**, including callback mutations/failures, +captured items/components, piercing/bypass combinations, native direction/math, +client/stat guards and melee responses. Targeted Clippy passes. Native stacks +are explicitly undamageable; actual damageable-item mutation, blocking eligibility, +component codecs and complete combat/world integration remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemBlockingOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemBlockingOracle.java new file mode 100644 index 000000000..1dede3a19 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemBlockingOracle.java @@ -0,0 +1,48 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.lang.reflect.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.*;import net.minecraft.core.component.*;import net.minecraft.core.registries.*;import net.minecraft.tags.*;import net.minecraft.world.InteractionHand;import net.minecraft.world.entity.*;import net.minecraft.world.entity.player.*;import net.minecraft.world.damagesource.*;import net.minecraft.world.item.*;import net.minecraft.world.item.component.BlocksAttacks;import net.minecraft.server.level.*;import net.minecraft.stats.*;import net.minecraft.world.phys.Vec3; +/** Actual living item-blocking dispatch with native components and undamageable stacks. */ +public final class VanillaItemBlockingOracle { + static final class Stop extends RuntimeException {} + static Object unsafe;static Method allocate; + static T make(Class c)throws Exception{return c.cast(allocate.invoke(unsafe,c));} + static float single(JsonElement v){return Float.intBitsToFloat(Integer.parseUnsignedInt(v.getAsString(),16));} + static double number(JsonElement v){return Double.longBitsToDouble(Long.parseUnsignedLong(v.getAsString(),16));} + static Vec3 vec(JsonElement v){if(v.isJsonNull())return null;var a=v.getAsJsonArray();return new Vec3(number(a.get(0)),number(a.get(1)),number(a.get(2)));} + static String bits(float v){return String.format("%08x",Float.floatToIntBits(v));} + static final class Data {JsonObject f;PrintWriter out;int calls;boolean changed;ItemStack[] items;Server[] levels;Entity[] entities;List> types; + JsonObject state(){return f.getAsJsonObject(changed?"after":"initial");}void event(String s){out.println(s);int n=calls++;if(n==f.get("fail").getAsInt())throw new Stop();if(n==f.get("mutate_at").getAsInt())changed=true;}} + static final class Source extends DamageSource {Data d;Source(){super(null);} + @Override public Holder typeHolder(){d.event("type-holder");return d.types.get(d.state().get("type").getAsInt());} + @Override public Entity getDirectEntity(){d.event("direct");return d.entities[d.state().get("direct").getAsInt()];} + @Override public Vec3 getSourcePosition(){d.event("source-position");return vec(d.state().get("source"));} + @Override public boolean is(TagKey tag){if(tag!=DamageTypeTags.IS_PROJECTILE)throw new AssertionError();d.event("projectile");return d.state().get("projectile").getAsBoolean();}} + static final class Arrow extends net.minecraft.world.entity.projectile.arrow.Arrow {Data d;Arrow(){super(null,null);}@Override public byte getPierceLevel(){d.event("pierce");return d.state().get("pierce").getAsByte();}} + static final class Server extends ServerLevel {Data d;int id;Server(){super(null,null,null,null,null,null,false,0L,List.of(),false);}@Override public boolean isClientSide(){d.event("client "+id);return d.state().get("client").getAsBoolean();}} + static final class Actor extends net.minecraft.world.entity.decoration.ArmorStand {Actor(){super(null,null);} +Data d; + @Override public ItemStack getItemBlockingWith(){d.event("blocking-item");int id=d.state().get("item").getAsInt();return id<0?null:d.items[id];} + @Override public float getYHeadRot(){d.event("yaw");return single(d.state().get("yaw"));} + @Override public Vec3 position(){d.event("position");return vec(d.state().get("position"));} + @Override public ServerLevel level(){d.event("level");return d.levels[d.state().get("level").getAsInt()];} + @Override public InteractionHand getUsedItemHand(){d.event("hand");return InteractionHand.values()[d.state().get("hand").getAsInt()];} + @Override protected void blockUsingItem(ServerLevel l,LivingEntity attacker,DamageSource source,float damage,boolean full){d.event("block-using "+(l==d.levels[0]?0:1)+" "+bits(damage)+" "+full);} + } + static final class Human extends ServerPlayer {Human(){super(null,null,null,null);} +Data d; + @Override public ItemStack getItemBlockingWith(){d.event("blocking-item");int id=d.state().get("item").getAsInt();return id<0?null:d.items[id];} + @Override public float getYHeadRot(){d.event("yaw");return single(d.state().get("yaw"));} + @Override public Vec3 position(){d.event("position");return vec(d.state().get("position"));} + @Override public ServerLevel level(){d.event("level");return d.levels[d.state().get("level").getAsInt()];} + @Override public InteractionHand getUsedItemHand(){d.event("hand");return InteractionHand.values()[d.state().get("hand").getAsInt()];} + @Override protected void blockUsingItem(ServerLevel l,LivingEntity attacker,DamageSource source,float damage,boolean full){d.event("block-using "+(l==d.levels[0]?0:1)+" "+bits(damage)+" "+full);} + @Override public void awardStat(Stat s){if(s.getType()!=Stats.ITEM_USED)throw new AssertionError();d.event("stat "+(s.getValue()==Items.SHIELD?0:s.getValue()==Items.STICK?1:-1));} + } + public static void main(String[] args)throws Exception{ + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();var u=Class.forName("sun.misc.Unsafe");var uf=u.getDeclaredField("theUnsafe");uf.setAccessible(true);unsafe=uf.get(null);allocate=u.getMethod("allocateInstance",Class.class);var ctor=ItemStack.class.getDeclaredConstructor(Holder.class,int.class,PatchedDataComponentMap.class);ctor.setAccessible(true);var a=Holder.direct(new DamageType("a",0));var b=Holder.direct(new DamageType("b",0));List> types=List.of(a,b);List> sets=List.of(HolderSet.direct(List.of(a)),HolderSet.direct(List.of(b)),HolderSet.direct(List.of(a,b)),HolderSet.direct(List.of())); + Path dir=Path.of(args[1]);try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();var d=new Data();d.f=f;d.out=out;d.types=types;d.items=new ItemStack[2];for(int i=0;i<2;i++){var c=f.getAsJsonArray("components").get(i).getAsJsonObject();d.items[i]=(ItemStack)ctor.newInstance(BuiltInRegistries.ITEM.wrapAsHolder(i==0?Items.SHIELD:Items.STICK),1,new PatchedDataComponentMap(DataComponentMap.EMPTY));if(!c.get("present").getAsBoolean())continue;var reductions=new ArrayList();for(var rv:c.getAsJsonArray("reductions")){var r=rv.getAsJsonObject();int set=r.get("set").getAsInt();reductions.add(new BlocksAttacks.DamageReduction(single(r.get("angle")),set==0?Optional.empty():Optional.of(sets.get(set-1)),single(r.get("base")),single(r.get("factor"))));}var item=c.getAsJsonObject("item_damage");int bypass=c.get("bypass").getAsInt();d.items[i].set(DataComponents.BLOCKS_ATTACKS,new BlocksAttacks(0,1,reductions,new BlocksAttacks.ItemDamageFunction(single(item.get("threshold")),single(item.get("base")),single(item.get("factor"))),bypass==0?Optional.empty():Optional.of(sets.get(bypass-1)),Optional.empty(),Optional.empty()));} + d.levels=new Server[]{make(Server.class),make(Server.class)};for(int i=0;i<2;i++){d.levels[i].d=d;d.levels[i].id=i;}var arrow=make(Arrow.class);arrow.d=d;d.entities=new Entity[]{null,make(Actor.class),arrow,make(Marker.class)};var source=new Source();source.d=d;LivingEntity actor;if(f.get("player").getAsBoolean()){var p=make(Human.class);p.d=d;actor=p;}else{var p=make(Actor.class);p.d=d;actor=p;} + try{out.println("blocked "+bits(actor.applyItemBlocking(d.levels[0],source,single(f.get("damage")))));out.println("result ok");}catch(Stop e){out.println("result error");}out.println("queries "+d.calls+" "+d.changed);out.println("items "+d.items[0].getCount()+" "+d.items[0].getDamageValue()+" "+d.items[1].getCount()+" "+d.items[1].getDamageValue()); + }} + } +} diff --git a/tools/test_item_blocking_parity.py b/tools/test_item_blocking_parity.py new file mode 100644 index 000000000..7b82875b8 --- /dev/null +++ b/tools/test_item_blocking_parity.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python3 +"""Compare actual living item-blocking dispatch with native components.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + def single(v):return struct.pack('>f',v).hex() + def double(v):return struct.pack('>d',v).hex() + def vec(v):return [double(x) for x in v] + def reduction(angle=90,base=0,factor=1,set=0):return dict(angle=single(angle),base=single(base),factor=single(factor),set=set) + def component(present=True,bypass=0,reductions=None,threshold=3,base=1,factor=1):return dict(present=present,bypass=bypass,reductions=reductions if reductions is not None else [reduction()],item_damage=dict(threshold=single(threshold),base=single(base),factor=single(factor))) + def state(**kw): + s=dict(item=0,direct=1,source=vec([0,0,1]),position=vec([0,0,0]),yaw=single(0),pierce=0,projectile=False,type=0,level=0,hand=0,client=False);s.update(kw);return s + def row(damage=8,initial=None,after=None,components=None,**kw): + f=dict(damage=single(damage),initial=initial or state(),after=after or state(),components=components or [component(),component(reductions=[reduction(angle=180,factor=.5,set=2)])],player=False,fail=-1,mutate_at=-1);f.update(kw);return f + values=[-float('inf'),-1e30,-1,-0.,0.,1e-40,.1,1,5,20,1e30,float('inf'),float('nan')] + for damage in values: + for direct in range(4): + for pierce in [-128,-1,0,1,127]: + for player in [False,True]: + for bypass in range(5):yield row(damage,initial=state(direct=direct,pierce=pierce),components=[component(bypass=bypass),component()],player=player) + for fail in range(-1,26): + for mutate in range(-1,26): + for player in [False,True]:yield row(initial=state(direct=2,pierce=0),after=state(item=1,direct=1,source=None,position=vec([.5,0,0]),yaw=single(45),type=1,level=1,hand=1,client=True),components=[component(bypass=2,reductions=[reduction(set=1),reduction(angle=180,factor=.5)]),component()],player=player,fail=fail,mutate_at=mutate) + rng=random.Random(0x4954454d424c4f43) + def random_state():return state(item=rng.randrange(-1,2),direct=rng.randrange(4),source=None if rng.randrange(4)==0 else vec([rng.choice(values) for _ in range(3)]),position=vec([rng.choice(values) for _ in range(3)]),yaw=single(rng.choice(values+[45,90,180,360])),pierce=rng.randrange(-128,128),projectile=bool(rng.randrange(2)),type=rng.randrange(2),level=rng.randrange(2),hand=rng.randrange(2),client=bool(rng.randrange(2))) + for _ in range(8000):yield row(rng.choice(values),initial=random_state(),after=random_state(),components=[component(present=rng.randrange(4)!=0,bypass=rng.randrange(5),reductions=[reduction(angle=rng.choice(values+[45,90,180,360]),base=rng.choice(values),factor=rng.choice(values),set=rng.randrange(5)) for _ in range(rng.randrange(6))],threshold=rng.choice(values),base=rng.choice(values),factor=rng.choice(values)) for _ in range(2)],player=bool(rng.randrange(2)),fail=rng.choice([-1,-1,*range(26)]),mutate_at=rng.randrange(-1,26)) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-item-blocking-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemBlockingOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/item_blocking_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaItemBlockingOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','item_blocking_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('item_blocking_fixture.exe' if os.name=='nt' else 'item_blocking_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} item blocking output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual LivingEntity.applyItemBlocking on base and ServerPlayer receivers, using native BlocksAttacks reductions/holder sets and actual stat/durability dispatch on undamageable stacks. Tests bypass/piercing, source direction, component/item capture across mutations, client/stat guards, repeated direct-entity lookup, melee response and callback failures. Actual damageable-item mutation, blocking-item eligibility/timing, component codecs and full combat/world integration remain pending.'} + lab.write_json(report_path,report);print(f'Scoped item blocking parity passed: {report_path}') + + +if __name__=='__main__':main() From 6f01a1426e0e148f5fcdbbd2a6cc7f918c2ca67f Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 06:20:34 +0200 Subject: [PATCH 127/253] Match blocking-item eligibility and elapsed item-use timers --- .../scoped-parity.json | 262 ++++++++++++++++++ .../examples/item_use_fixture.rs | 145 ++++++++++ crates/horizon-world/src/item_use.rs | 62 +++++ crates/horizon-world/src/lib.rs | 1 + docs/collision-geometry.md | 15 + .../parity/VanillaItemUseOracle.java | 24 ++ tools/test_item_use_parity.py | 82 ++++++ 7 files changed, 591 insertions(+) create mode 100644 benchmarks/rust-item-use-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/item_use_fixture.rs create mode 100644 crates/horizon-world/src/item_use.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemUseOracle.java create mode 100644 tools/test_item_use_parity.py diff --git a/benchmarks/rust-item-use-2026-10-07/scoped-parity.json b/benchmarks/rust-item-use-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..a89b5038f --- /dev/null +++ b/benchmarks/rust-item-use-2026-10-07/scoped-parity.json @@ -0,0 +1,262 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 22296, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemUseOracle.java": "b6d102e72dc166cdd2ae35dc13c4bf08c36265dcb42369ec9e15da16f8b6284f", + "tools/test_item_use_parity.py": "2e3c5ff8250e8d1d9d8a564d6d65b049b0d80fc9630bd12d907cccb55b00ab0a", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "6884c7209f007ab9ee742b9c3c73828cfa1c6753d35b5fe25a87cab5955b33f8", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "18bbad377a8047e4d4ecd0fc87d83d46d1c0f1ce2b8c47bbe64633e7b4420b57", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/blocking_rules.rs": "83c5e2105cec56a90182ce582e1c67ade2b189be6de1a34d08035000cc07c492", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_immunity.rs": "fd39c41124d694e755cf7faadcf93c636df4042c78ec345092a856b5f952dbcf", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/damage_source.rs": "24945e397a926d34695652980923609e4723e02fe6b6e56d4aaf673e45d759f7", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/item_blocking.rs": "f6eee0d6d177cc3148960122327ba1b459a2f0e85241c1d9a3e40f0b8c169296", + "crates/horizon-world/src/item_use.rs": "1d0a3afa61b60d356e81a063da79ec6cd38730315976640a591325fc4c8ab98c", + "crates/horizon-world/src/lib.rs": "6b9962670f09d1223c251bdf3ebc021917ea7a527a82b465db60c8cab0df9deb", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "2b448209629b9bf2e678d667ad0d6c7fa22146892dd106b169d96b31b0df12bb", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_hurt.rs": "844239ad7d15c39629bb3cfc06ebae6d1cff20b7627468f26e0ee8dff3abdcb8", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_hurt.rs": "99c9bbd8587ec2dc287806049897b8034d2f5349ad47fc497b70d54148844a36", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/server_player_combat.rs": "a9743971581af86d926eeba42004d932caf83382c470dd98bf613cb9c417db58", + "crates/horizon-world/src/server_player_damage.rs": "828a4649fec3e9bda2dfe20aced8c95922c697321de2be4127bd4e5712ecbb7c", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "f417aab280331ddd6f0ca265a12c0130c78b9924f407c7e07f198140501e6010", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/view_direction.rs": "e18120ae26dc5cf702b29fc4c8487088bab133c8ce5abce01226833fafb0d5a4", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "74e4110fb19c4c4047192fd65c38015b8afc7f9fc50404d75380b5063808148c", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/item_use_fixture.rs": "ae94d70ce98734d9b4025137962de43cdfef89963bad3800f0d9a54385366421" + }, + "fixtures_sha256": { + ".local/rust-item-use-parity/inputs.txt": "37dc2ae8be576a3f3d933b752baf4edfefb1c61a77af521e7e5580fc36fd7ffd" + }, + "rust_output_sha256": "47c017ea6a6010c6a136fbdc5f7f1521490c8e418e4e9b5f95c77d08ed716425", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "47c017ea6a6010c6a136fbdc5f7f1521490c8e418e4e9b5f95c77d08ed716425", + "matched_output_lines": 108690 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "47c017ea6a6010c6a136fbdc5f7f1521490c8e418e4e9b5f95c77d08ed716425", + "matched_output_lines": 108690 + } + ], + "scope": "Actual LivingEntity blocking-item eligibility, isBlocking and both use-timer overloads. Controlled item types supply virtual duration queries; actual use-item/remaining fields and BlocksAttacks components provide captured and reread state. Covers wrapping tick arithmetic, delay boundaries, absent components, empty stacks, shared item types, partial-tick float bits, callback mutations and failures. Item-use lifecycle, durability, codecs and complete combat/world integration remain pending." +} diff --git a/crates/horizon-world/examples/item_use_fixture.rs b/crates/horizon-world/examples/item_use_fixture.rs new file mode 100644 index 000000000..74436d1f3 --- /dev/null +++ b/crates/horizon-world/examples/item_use_fixture.rs @@ -0,0 +1,145 @@ +use horizon_world::{ + blocking_rules::{BlockingRules, ItemDamageFunction}, + item_use::{self, ItemUseWorld}, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn single(v: &Value) -> f32 { + f32::from_bits(u32::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +fn bits(v: f32) -> u32 { + if v.is_nan() { + f32::NAN.to_bits() + } else { + v.to_bits() + } +} +struct World<'a> { + f: &'a Value, + out: &'a mut dyn Write, + calls: i64, + changed: bool, + item: usize, + remaining: i32, + delays: [Option; 2], +} +impl World<'_> { + fn state(&self) -> &Value { + &self.f[if self.changed { "after" } else { "initial" }] + } + fn reset(&mut self) { + self.item = self.state()["item"].as_u64().unwrap() as usize; + self.remaining = self.state()["remaining"].as_i64().unwrap() as i32; + } + fn event(&mut self, s: &str) -> io::Result<()> { + writeln!(self.out, "{s}")?; + let n = self.calls; + self.calls += 1; + if n == self.f["fail"].as_i64().unwrap() { + return Err(io::Error::other("injected use callback failure")); + } + if n == self.f["mutate_at"].as_i64().unwrap() { + self.changed = true; + self.reset(); + } + Ok(()) + } +} +impl ItemUseWorld for World<'_> { + type Error = io::Error; + type Item = usize; + type ItemType = usize; + fn using_item(&mut self) -> io::Result { + self.event("using")?; + Ok(self.state()["using"].as_bool().unwrap()) + } + fn use_item(&self) -> usize { + self.item + } + fn blocking_delay(&self, item: usize) -> Option { + self.delays.get(item).copied().flatten() + } + fn item_type(&self, item: usize) -> usize { + if item == 1 && self.f["shared_type"].as_bool().unwrap() { + 0 + } else { + item + } + } + fn use_duration(&mut self, kind: usize, item: usize) -> io::Result { + if kind == 2 { + return Ok(0); + } + self.event(&format!("duration {kind} {item}"))?; + Ok(self.state()["durations"][kind].as_i64().unwrap() as i32) + } + fn remaining_ticks(&self) -> i32 { + self.remaining + } + fn remaining_ticks_virtual(&mut self) -> io::Result { + self.event("remaining")?; + Ok(self.state()["virtual_remaining"].as_i64().unwrap() as i32) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let delays = std::array::from_fn(|i| { + let c = &f["components"][i]; + c["present"].as_bool().unwrap().then(|| { + BlockingRules::<()> { + delay_seconds: single(&c["delay"]), + disable_scale: 1.0, + reductions: vec![], + item_damage: ItemDamageFunction { + threshold: 0.0, + base: 0.0, + factor: 0.0, + }, + } + .delay_ticks() + }) + }); + let mut w = World { + f: &f, + out: &mut out, + calls: 0, + changed: false, + item: 0, + remaining: 0, + delays, + }; + w.reset(); + let result = match f["mode"].as_str().unwrap() { + "blocking" => item_use::blocking_item(&mut w) + .and_then(|v| writeln!(w.out, "item {}", v.map_or(-1, |v| v as i32))), + "is-blocking" => { + item_use::is_blocking(&mut w).and_then(|v| writeln!(w.out, "bool {v}")) + } + "ticks" => { + item_use::ticks_using_item(&mut w).and_then(|v| writeln!(w.out, "ticks {v}")) + } + "partial" => item_use::ticks_using_item_partial(&mut w, single(&f["partial"])) + .and_then(|v| writeln!(w.out, "float {:08x}", bits(v))), + _ => panic!("mode"), + }; + writeln!( + w.out, + "result {}", + if result.is_ok() { "ok" } else { "error" } + )?; + writeln!( + w.out, + "state {} {} {} {}", + w.item, w.remaining, w.calls, w.changed + )?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/item_use.rs b/crates/horizon-world/src/item_use.rs new file mode 100644 index 000000000..ccd9e3a44 --- /dev/null +++ b/crates/horizon-world/src/item_use.rs @@ -0,0 +1,62 @@ +//! Living blocking-item eligibility retains the component's delay, but rereads +//! use-item storage and remaining ticks around the virtual item-duration query. +pub trait ItemUseWorld { + type Error; + type Item: Copy; + type ItemType: Copy; + fn using_item(&mut self) -> Result; + fn use_item(&self) -> Self::Item; + fn blocking_delay(&self, item: Self::Item) -> Option; + fn item_type(&self, item: Self::Item) -> Self::ItemType; + fn use_duration( + &mut self, + item_type: Self::ItemType, + item: Self::Item, + ) -> Result; + fn remaining_ticks(&self) -> i32; + fn remaining_ticks_virtual(&mut self) -> Result; + fn query_blocking_item(&mut self) -> Result, Self::Error> + where + Self: Sized, + { + blocking_item(self) + } + fn query_ticks_using_item(&mut self) -> Result + where + Self: Sized, + { + ticks_using_item(self) + } +} +pub fn blocking_item(w: &mut W) -> Result, W::Error> { + if !w.using_item()? { + return Ok(None); + } + let Some(delay) = w.blocking_delay(w.use_item()) else { + return Ok(None); + }; + let item_type = w.item_type(w.use_item()); + let item = w.use_item(); + let duration = w.use_duration(item_type, item)?; + let elapsed = duration.wrapping_sub(w.remaining_ticks()); + Ok((elapsed >= delay).then(|| w.use_item())) +} + +pub fn is_blocking(w: &mut W) -> Result { + Ok(w.query_blocking_item()?.is_some()) +} +pub fn ticks_using_item(w: &mut W) -> Result { + if !w.using_item()? { + return Ok(0); + } + let item = w.use_item(); + let item_type = w.item_type(item); + let duration = w.use_duration(item_type, item)?; + Ok(duration.wrapping_sub(w.remaining_ticks_virtual()?)) +} +pub fn ticks_using_item_partial(w: &mut W, partial: f32) -> Result { + if !w.using_item()? { + return Ok(0.0); + } + Ok(w.query_ticks_using_item()? as f32 + partial) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 0bad82fc6..c2ac01361 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -44,6 +44,7 @@ pub mod ground_support; pub mod heightmap; pub mod interaction_shapes; pub mod item_blocking; +pub mod item_use; pub mod liquid_collision; pub mod living_air; pub mod living_damage; diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index a598b20fb..0d06c5306 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1499,3 +1499,18 @@ captured items/components, piercing/bypass combinations, native direction/math, client/stat guards and melee responses. Targeted Clippy passes. Native stacks are explicitly undamageable; actual damageable-item mutation, blocking eligibility, component codecs and complete combat/world integration remain pending. + + +`item_use` implements blocking-item eligibility and both elapsed-use timer +overloads. It retains the original blocking delay while rereading active-item +storage and remaining ticks after the virtual duration query; partial-tick +queries preserve the second virtual use-state check. + +`python3 tools/test_item_use_parity.py` compares the actual inherited native +methods with real blocking components and controlled virtual item durations. +The [item-use report](../benchmarks/rust-item-use-2026-10-07/scoped-parity.json) +records **108,690 matching lines per JAR**, covering wrapping tick arithmetic, +delay boundaries, absent components, empty stacks, shared item types, partial +float values and callback mutations/failures. Targeted Clippy passes. Full +item-use lifecycle, damageable-item storage and complete combat/world integration +remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemUseOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemUseOracle.java new file mode 100644 index 000000000..5421a1f61 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemUseOracle.java @@ -0,0 +1,24 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.lang.reflect.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.*;import net.minecraft.core.component.*;import net.minecraft.world.entity.*;import net.minecraft.world.item.*;import net.minecraft.world.item.component.BlocksAttacks; +/** Native blocking eligibility and use timers, with controlled virtual item durations. */ +public final class VanillaItemUseOracle { + static final class Stop extends RuntimeException {} + static Object unsafe;static Method allocate;static Field useItem,remaining; + static T make(Class c)throws Exception{return c.cast(allocate.invoke(unsafe,c));} + static Field field(Class c,String n)throws Exception{var f=c.getDeclaredField(n);f.setAccessible(true);return f;} + static float single(JsonElement v){return Float.intBitsToFloat(Integer.parseUnsignedInt(v.getAsString(),16));} + static String bits(float v){return String.format("%08x",Float.floatToIntBits(v));} + static final class Data {JsonObject f;PrintWriter out;int calls;boolean changed;Actor actor;ItemStack[] items; + JsonObject state(){return f.getAsJsonObject(changed?"after":"initial");}void reset(){try{useItem.set(actor,items[state().get("item").getAsInt()]);remaining.setInt(actor,state().get("remaining").getAsInt());}catch(Exception e){throw new AssertionError(e);}} + void event(String s){out.println(s);int n=calls++;if(n==f.get("fail").getAsInt())throw new Stop();if(n==f.get("mutate_at").getAsInt()){changed=true;reset();}} + int id(ItemStack item){for(int i=0;i)lines::iterator){var d=new Data();d.f=JsonParser.parseString(line).getAsJsonObject();d.out=out;d.actor=make(Actor.class);d.actor.d=d;var a=make(CustomItem.class);a.d=d;a.id=0;var b=make(CustomItem.class);b.d=d;b.id=1;d.items=new ItemStack[]{(ItemStack)ctor.newInstance(Holder.direct(a),1,new PatchedDataComponentMap(DataComponentMap.EMPTY)),(ItemStack)ctor.newInstance(Holder.direct(d.f.get("shared_type").getAsBoolean()?a:b),1,new PatchedDataComponentMap(DataComponentMap.EMPTY)),ItemStack.EMPTY};for(int i=0;i<2;i++){var c=d.f.getAsJsonArray("components").get(i).getAsJsonObject();if(c.get("present").getAsBoolean())d.items[i].set(DataComponents.BLOCKS_ATTACKS,new BlocksAttacks(single(c.get("delay")),1,List.of(),new BlocksAttacks.ItemDamageFunction(0,0,0),Optional.empty(),Optional.empty(),Optional.empty()));}d.reset(); + try{switch(d.f.get("mode").getAsString()){case "blocking":{var item=d.actor.getItemBlockingWith();out.println("item "+(item==null?-1:d.id(item)));break;}case "is-blocking":out.println("bool "+d.actor.isBlocking());break;case "ticks":out.println("ticks "+d.actor.getTicksUsingItem());break;case "partial":out.println("float "+bits(d.actor.getTicksUsingItem(single(d.f.get("partial")))));break;default:throw new AssertionError();}out.println("result ok");}catch(Stop e){out.println("result error");}out.println("state "+d.id((ItemStack)useItem.get(d.actor))+" "+remaining.getInt(d.actor)+" "+d.calls+" "+d.changed); + }} + } +} diff --git a/tools/test_item_use_parity.py b/tools/test_item_use_parity.py new file mode 100644 index 000000000..d5d5e1e20 --- /dev/null +++ b/tools/test_item_use_parity.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python3 +"""Compare native living item-use timers and blocking-item eligibility.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + def bits(v): return struct.pack('>f', v).hex() + modes = ['blocking', 'is-blocking', 'ticks', 'partial'] + ints = [-2147483648, -2147483647, -1, 0, 1, 4, 5, 6, 20, 72000, 2147483646, 2147483647] + floats = [-float('inf'), -1e30, -1, -.025, -0., 0., 1e-40, .025, .25, 1, 1e30, float('inf'), float('nan')] + def state(item=0, remaining=71995, virtual_remaining=71995, durations=None, using=True): + return dict(item=item, remaining=remaining, virtual_remaining=virtual_remaining, durations=durations or [72000, 20], using=using) + def row(mode='blocking', **kw): + f = dict(mode=mode, partial=bits(.5), shared_type=False, components=[dict(present=True, delay=bits(.25)), dict(present=True, delay=bits(1))], initial=state(), after=state(item=1, remaining=0, virtual_remaining=-1, durations=[20, 5]), fail=-1, mutate_at=-1) + f.update(kw) + return f + for mode in modes: + for duration in ints: + for remaining in ints: + for item in range(3): + yield row(mode, initial=state(item=item, remaining=remaining, virtual_remaining=remaining, durations=[duration, duration])) + for delay in floats + [i / 40 for i in range(-100, 101)]: + for elapsed in [-1, 0, 1, 4, 5, 6, 19, 20, 21]: + yield row(mode, components=[dict(present=True, delay=bits(delay)), dict(present=False, delay=bits(0))], initial=state(remaining=72000-elapsed, virtual_remaining=72000-elapsed), partial=bits(delay)) + for mutate in range(-1, 5): + for fail in range(-1, 5): + for item in range(3): + for using in [False, True]: + yield row(mode, mutate_at=mutate, fail=fail, after=state(item=item, using=using)) + rng = random.Random(0x4954454d555345) + def number(): return rng.choice(ints) if rng.randrange(2) else rng.randrange(-2147483648, 2147483648) + def random_state(): return state(rng.randrange(3), number(), number(), [number(), number()], bool(rng.randrange(2))) + def floating(): return bits(rng.choice(floats)) if rng.randrange(2) else f'{rng.getrandbits(32):08x}' + for _ in range(12000): + yield row(rng.choice(modes), partial=floating(), shared_type=bool(rng.randrange(2)), components=[dict(present=bool(rng.randrange(2)), delay=floating()) for _ in range(2)], initial=random_state(), after=random_state(), fail=rng.choice([-1, -1, *range(5)]), mutate_at=rng.randrange(-1, 5)) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-item-use-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemUseOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/item_use_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaItemUseOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','item_use_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('item_use_fixture.exe' if os.name=='nt' else 'item_use_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} item use output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual LivingEntity blocking-item eligibility, isBlocking and both use-timer overloads. Controlled item types supply virtual duration queries; actual use-item/remaining fields and BlocksAttacks components provide captured and reread state. Covers wrapping tick arithmetic, delay boundaries, absent components, empty stacks, shared item types, partial-tick float bits, callback mutations and failures. Item-use lifecycle, durability, codecs and complete combat/world integration remain pending.'} + lab.write_json(report_path,report);print(f'Scoped item use parity passed: {report_path}') + + +if __name__=='__main__':main() From 2f432d7cc9c80f6b2d433a9ef80548d91155d8ad Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 06:25:12 +0200 Subject: [PATCH 128/253] Implement stored item durability and native break ordering --- .../scoped-parity.json | 263 ++++++++++++++++++ .../examples/item_durability_fixture.rs | 128 +++++++++ crates/horizon-world/src/item_durability.rs | 160 +++++++++++ crates/horizon-world/src/lib.rs | 1 + docs/collision-geometry.md | 16 ++ .../parity/VanillaItemDurabilityOracle.java | 23 ++ tools/test_item_durability_parity.py | 77 +++++ 7 files changed, 668 insertions(+) create mode 100644 benchmarks/rust-item-durability-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/item_durability_fixture.rs create mode 100644 crates/horizon-world/src/item_durability.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemDurabilityOracle.java create mode 100644 tools/test_item_durability_parity.py diff --git a/benchmarks/rust-item-durability-2026-10-07/scoped-parity.json b/benchmarks/rust-item-durability-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..8d22d3349 --- /dev/null +++ b/benchmarks/rust-item-durability-2026-10-07/scoped-parity.json @@ -0,0 +1,263 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 30052, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemDurabilityOracle.java": "0e548d6b362588f73cbc1c2f24bdd5408d36e82db716af4a95f82aad265ae0ea", + "tools/test_item_durability_parity.py": "4f00e1eb1b72bca43eeffff842d98d7008279c6a9613d1dcc771bfe62d6c26fe", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "6884c7209f007ab9ee742b9c3c73828cfa1c6753d35b5fe25a87cab5955b33f8", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "18bbad377a8047e4d4ecd0fc87d83d46d1c0f1ce2b8c47bbe64633e7b4420b57", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/blocking_rules.rs": "83c5e2105cec56a90182ce582e1c67ade2b189be6de1a34d08035000cc07c492", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_immunity.rs": "fd39c41124d694e755cf7faadcf93c636df4042c78ec345092a856b5f952dbcf", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/damage_source.rs": "24945e397a926d34695652980923609e4723e02fe6b6e56d4aaf673e45d759f7", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/item_blocking.rs": "f6eee0d6d177cc3148960122327ba1b459a2f0e85241c1d9a3e40f0b8c169296", + "crates/horizon-world/src/item_durability.rs": "6a67fd660d771c59ffa9f4aa3225a25b56da31ea1079ca2efa4a915be6464179", + "crates/horizon-world/src/item_use.rs": "1d0a3afa61b60d356e81a063da79ec6cd38730315976640a591325fc4c8ab98c", + "crates/horizon-world/src/lib.rs": "f985d2e8f6f8710ebd815a6b6120d5a2286eb7cd4fb165b777d1df264c9f9829", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "2b448209629b9bf2e678d667ad0d6c7fa22146892dd106b169d96b31b0df12bb", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_hurt.rs": "844239ad7d15c39629bb3cfc06ebae6d1cff20b7627468f26e0ee8dff3abdcb8", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_hurt.rs": "99c9bbd8587ec2dc287806049897b8034d2f5349ad47fc497b70d54148844a36", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/server_player_combat.rs": "a9743971581af86d926eeba42004d932caf83382c470dd98bf613cb9c417db58", + "crates/horizon-world/src/server_player_damage.rs": "828a4649fec3e9bda2dfe20aced8c95922c697321de2be4127bd4e5712ecbb7c", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "f417aab280331ddd6f0ca265a12c0130c78b9924f407c7e07f198140501e6010", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/view_direction.rs": "e18120ae26dc5cf702b29fc4c8487088bab133c8ce5abce01226833fafb0d5a4", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "74e4110fb19c4c4047192fd65c38015b8afc7f9fc50404d75380b5063808148c", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/item_durability_fixture.rs": "a077112aae50746212280ced771735a90f7d68b2a04d25db1b993a4737239d61" + }, + "fixtures_sha256": { + ".local/rust-item-durability-parity/inputs.txt": "9d9f7f0a6f05230baf2538b26ee3f02b39f018b31d35801e2af8ccbfc1503eca" + }, + "rust_output_sha256": "0ed852826d375dd35268608045756abcb6e152cef9840ef464b3f00254da4675", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "0ed852826d375dd35268608045756abcb6e152cef9840ef464b3f00254da4675", + "matched_output_lines": 81762 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "0ed852826d375dd35268608045756abcb6e152cef9840ef464b3f00254da4675", + "matched_output_lines": 81762 + } + ], + "scope": "Actual unenchanted ItemStack damage predicates, clamped reads/writes, integer-wrapping count changes, server-level hurtAndBreak and ServerPlayer hurtWithoutBreaking. Real component maps cover absent fields, empty/air stacks, unbreakable and invalid numeric values; callbacks mutate storage and inject failures at infinite-material, empty-listener advancement and break dispatch boundaries. Covers the positive integer-to-float enchantment pipeline with no enchantments. Complete component storage/codecs, enchantment effects, entity equipment break handling and combat/world integration remain pending." +} diff --git a/crates/horizon-world/examples/item_durability_fixture.rs b/crates/horizon-world/examples/item_durability_fixture.rs new file mode 100644 index 000000000..b5109b89b --- /dev/null +++ b/crates/horizon-world/examples/item_durability_fixture.rs @@ -0,0 +1,128 @@ +use horizon_world::item_durability::{self, DurabilityStack, DurabilityWorld}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn stack(v: &Value, air: bool) -> DurabilityStack { + DurabilityStack { + count: v["count"].as_i64().unwrap() as i32, + air, + max_damage: v["max"].as_i64().map(|v| v as i32), + damage: v["damage"].as_i64().map(|v| v as i32), + unbreakable: v["unbreakable"].as_bool().unwrap(), + } +} +fn optional(v: Option) -> String { + v.map_or("none".into(), |v| v.to_string()) +} +fn snapshot(s: &DurabilityStack) -> String { + format!( + "{} {} {} {} {} {} {} {} {} {} {} {}", + s.count, + s.count(), + optional(s.max_damage), + optional(s.damage), + s.unbreakable, + s.max_damage(), + s.damage(), + s.is_empty(), + s.is_damageable(), + s.is_damaged(), + s.is_broken(), + s.next_damage_will_break() + ) +} +struct World<'a> { + f: &'a Value, + out: &'a mut dyn Write, + calls: i64, + changed: bool, +} +impl World<'_> { + fn event(&mut self, s: &mut DurabilityStack, name: &str) -> io::Result<()> { + writeln!(self.out, "{name} | {}", snapshot(s))?; + let n = self.calls; + self.calls += 1; + if n == self.f["fail"].as_i64().unwrap() { + return Err(io::Error::other("injected callback failure")); + } + if n == self.f["mutate_at"].as_i64().unwrap() { + self.changed = true; + *s = stack(&self.f["after"], s.air); + } + Ok(()) + } +} +impl DurabilityWorld for World<'_> { + type Error = io::Error; + fn infinite_materials(&mut self, s: &mut DurabilityStack) -> io::Result { + self.event(s, "infinite")?; + Ok(self.f[if self.changed { + "after_infinite" + } else { + "infinite" + }] + .as_bool() + .unwrap()) + } + fn process_enchantments(&mut self, _: &mut DurabilityStack, amount: i32) -> io::Result { + Ok(item_durability::unenchanted_change(amount)) + } + fn durability_changed(&mut self, s: &mut DurabilityStack, _: i32) -> io::Result<()> { + self.event(s, "criterion") + } + fn broken(&mut self, s: &mut DurabilityStack, copy: DurabilityStack) -> io::Result<()> { + writeln!(self.out, "copy {}", snapshot(©))?; + self.event(s, "break") + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut s = stack(&f["initial"], f["air"].as_bool().unwrap()); + let mut w = World { + f: &f, + out: &mut out, + calls: 0, + changed: false, + }; + let amount = f["amount"].as_i64().unwrap() as i32; + let result = match f["mode"].as_str().unwrap() { + "hurt" => item_durability::hurt_and_break( + &mut s, + &mut w, + amount, + f["player"].as_bool().unwrap(), + ), + "without" => w + .event(&mut s, "level") + .and_then(|()| item_durability::hurt_without_breaking(&mut s, &mut w, amount)), + "set" => { + s.set_damage(amount); + Ok(()) + } + "grow" => { + s.grow(amount); + Ok(()) + } + "shrink" => { + s.shrink(amount); + Ok(()) + } + "query" => Ok(()), + _ => panic!("mode"), + }; + writeln!( + w.out, + "result {}", + if result.is_ok() { "ok" } else { "error" } + )?; + writeln!(w.out, "state {} {} {}", snapshot(&s), w.calls, w.changed)?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/item_durability.rs b/crates/horizon-world/src/item_durability.rs new file mode 100644 index 000000000..fda13034c --- /dev/null +++ b/crates/horizon-world/src/item_durability.rs @@ -0,0 +1,160 @@ +//! Item-stack durability storage and mutation ordering. This is the durability +//! projection of a stack, not a replacement for its complete component map. +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct DurabilityStack { + pub count: i32, + pub air: bool, + pub max_damage: Option, + pub damage: Option, + pub unbreakable: bool, +} + +impl DurabilityStack { + pub fn is_empty(&self) -> bool { + self.air || self.count <= 0 + } + pub fn count(&self) -> i32 { + if self.is_empty() { 0 } else { self.count } + } + pub fn max_damage(&self) -> i32 { + if self.is_empty() { + 0 + } else { + self.max_damage.unwrap_or(0) + } + } + pub fn damage(&self) -> i32 { + let value = if self.is_empty() { + 0 + } else { + self.damage.unwrap_or(0) + }; + value.max(0).min(self.max_damage()) + } + pub fn set_damage(&mut self, value: i32) { + self.damage = Some(value.max(0).min(self.max_damage())); + } + pub fn is_damageable(&self) -> bool { + !self.is_empty() && self.max_damage.is_some() && !self.unbreakable && self.damage.is_some() + } + pub fn is_damaged(&self) -> bool { + self.is_damageable() && self.damage() > 0 + } + pub fn is_broken(&self) -> bool { + self.is_damageable() && self.damage() >= self.max_damage() + } + pub fn next_damage_will_break(&self) -> bool { + self.is_damageable() && self.damage() >= self.max_damage().wrapping_sub(1) + } + pub fn grow(&mut self, amount: i32) { + self.count = self.count().wrapping_add(amount); + } + pub fn shrink(&mut self, amount: i32) { + self.grow(amount.wrapping_neg()); + } +} + +pub trait DurabilityWorld { + type Error; + fn infinite_materials(&mut self, stack: &mut DurabilityStack) -> Result; + /// Positive durability changes pass through the enchantment float pipeline, + /// including when the stack has no enchantments. + fn process_enchantments( + &mut self, + stack: &mut DurabilityStack, + amount: i32, + ) -> Result; + fn durability_changed( + &mut self, + stack: &mut DurabilityStack, + damage: i32, + ) -> Result<(), Self::Error>; + /// Called after shrinking the original stack, with the pre-shrink copy. + fn broken( + &mut self, + stack: &mut DurabilityStack, + copy: DurabilityStack, + ) -> Result<(), Self::Error>; +} + +pub fn unenchanted_change(amount: i32) -> i32 { + (amount as f32) as i32 +} + +pub fn process_change( + stack: &mut DurabilityStack, + world: &mut W, + amount: i32, + server_player: bool, +) -> Result { + if !stack.is_damageable() || (server_player && world.infinite_materials(stack)?) { + return Ok(0); + } + if amount > 0 { + world.process_enchantments(stack, amount) + } else { + Ok(amount) + } +} + +pub fn apply_damage( + stack: &mut DurabilityStack, + world: &mut W, + damage: i32, + server_player: bool, +) -> Result<(), W::Error> { + apply_damage_with_break_callback(stack, world, damage, server_player, true) +} + +fn apply_damage_with_break_callback( + stack: &mut DurabilityStack, + world: &mut W, + damage: i32, + server_player: bool, + notify_break: bool, +) -> Result<(), W::Error> { + if server_player { + world.durability_changed(stack, damage)?; + } + stack.set_damage(damage); + if stack.is_broken() { + let copy = stack.clone(); + stack.shrink(1); + if notify_break { + world.broken(stack, copy)?; + } + } + Ok(()) +} + +/// The server-level overload; callers supply the already selected player kind. +pub fn hurt_and_break( + stack: &mut DurabilityStack, + world: &mut W, + amount: i32, + server_player: bool, +) -> Result<(), W::Error> { + let amount = process_change(stack, world, amount, server_player)?; + if amount != 0 { + let damage = stack.damage().wrapping_add(amount); + apply_damage(stack, world, damage, server_player)?; + } + Ok(()) +} + +/// The body after the server-player/level checks of hurtWithoutBreaking. +pub fn hurt_without_breaking( + stack: &mut DurabilityStack, + world: &mut W, + amount: i32, +) -> Result<(), W::Error> { + let amount = process_change(stack, world, amount, true)?; + if amount != 0 { + let damage = stack + .damage() + .wrapping_add(amount) + .min(stack.max_damage().wrapping_sub(1)); + apply_damage_with_break_callback(stack, world, damage, true, false)?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index c2ac01361..22a79a052 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -44,6 +44,7 @@ pub mod ground_support; pub mod heightmap; pub mod interaction_shapes; pub mod item_blocking; +pub mod item_durability; pub mod item_use; pub mod liquid_collision; pub mod living_air; diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 0d06c5306..d7e98098c 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1514,3 +1514,19 @@ delay boundaries, absent components, empty stacks, shared item types, partial float values and callback mutations/failures. Targeted Clippy passes. Full item-use lifecycle, damageable-item storage and complete combat/world integration remain pending. + + +`item_durability` stores the durability projection of an item stack, including +raw versus visible counts/components, clamped damage access, damageability/break +predicates and wrapping count changes. Server-level damage preserves creative +immunity, the positive float enchantment pipeline, advancement-before-write and +copy-before-shrink ordering. The non-breaking variant retains its native empty +break consumer, including unusual invalid component values. + +`python3 tools/test_item_durability_parity.py` compares actual unenchanted native +ItemStack operations. The [durability report](../benchmarks/rust-item-durability-2026-10-07/scoped-parity.json) +records **81,762 matching lines per JAR**, including absent components, empty/air +stacks, unbreakable flags, integer boundaries, callback mutations and failures. +Targeted Clippy passes. This is a durability projection, not complete item-stack +component storage. Enchantment effects, component codecs, equipment break +handling and full gameplay integration remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemDurabilityOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemDurabilityOracle.java new file mode 100644 index 000000000..0c2a98eaa --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemDurabilityOracle.java @@ -0,0 +1,23 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.lang.reflect.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.*;import net.minecraft.core.component.*;import net.minecraft.core.registries.*;import net.minecraft.world.item.*;import net.minecraft.server.level.*;import net.minecraft.server.PlayerAdvancements; +/** Real ItemStack durability mutations, with unenchanted component maps. */ +public final class VanillaItemDurabilityOracle { + static final class Stop extends RuntimeException {} + static Object unsafe;static Method allocate;static Field components,count; + static T make(Class c)throws Exception{return c.cast(allocate.invoke(unsafe,c));} + static Field field(Class c,String n)throws Exception{var f=c.getDeclaredField(n);f.setAccessible(true);return f;} + static String optional(Object v){return v==null?"none":v.toString();} + static String snapshot(ItemStack s){try{var c=(PatchedDataComponentMap)components.get(s);return count.getInt(s)+" "+s.getCount()+" "+optional(c.get(DataComponents.MAX_DAMAGE))+" "+optional(c.get(DataComponents.DAMAGE))+" "+c.has(DataComponents.UNBREAKABLE)+" "+s.getMaxDamage()+" "+s.getDamageValue()+" "+s.isEmpty()+" "+s.isDamageableItem()+" "+s.isDamaged()+" "+s.isBroken()+" "+s.nextDamageWillBreak();}catch(Exception e){throw new AssertionError(e);}} + static void reset(ItemStack s,JsonObject f){s.setCount(f.get("count").getAsInt());if(f.get("max").isJsonNull())s.remove(DataComponents.MAX_DAMAGE);else s.set(DataComponents.MAX_DAMAGE,f.get("max").getAsInt());if(f.get("damage").isJsonNull())s.remove(DataComponents.DAMAGE);else s.set(DataComponents.DAMAGE,f.get("damage").getAsInt());if(f.get("unbreakable").getAsBoolean())s.set(DataComponents.UNBREAKABLE,net.minecraft.util.Unit.INSTANCE);else s.remove(DataComponents.UNBREAKABLE);} + static final class Data {JsonObject f;PrintWriter out;int calls;boolean changed;ItemStack stack;PlayerAdvancements advancements; + void event(String s){out.println(s+" | "+snapshot(stack));int n=calls++;if(n==f.get("fail").getAsInt())throw new Stop();if(n==f.get("mutate_at").getAsInt()){changed=true;reset(stack,f.getAsJsonObject("after"));}} + boolean infinite(){return f.get(changed?"after_infinite":"infinite").getAsBoolean();}} + static final class Human extends ServerPlayer {Data d;Human(){super(null,null,null,null);}@Override public boolean hasInfiniteMaterials(){d.event("infinite");return d.infinite();}@Override public PlayerAdvancements getAdvancements(){d.event("criterion");return d.advancements;}@Override public ServerLevel level(){d.event("level");return null;}} + public static void main(String[] args)throws Exception{ + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();var u=Class.forName("sun.misc.Unsafe");unsafe=field(u,"theUnsafe").get(null);allocate=u.getMethod("allocateInstance",Class.class);components=field(ItemStack.class,"components");count=field(ItemStack.class,"count");var ctor=ItemStack.class.getDeclaredConstructor(Holder.class,int.class,PatchedDataComponentMap.class);ctor.setAccessible(true);Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var d=new Data();d.f=JsonParser.parseString(line).getAsJsonObject();d.out=out;d.advancements=make(PlayerAdvancements.class);field(PlayerAdvancements.class,"activeTriggers").set(d.advancements,new HashMap<>());var actor=make(Human.class);actor.d=d;d.stack=(ItemStack)ctor.newInstance(BuiltInRegistries.ITEM.wrapAsHolder(d.f.get("air").getAsBoolean()?Items.AIR:Items.SHIELD),1,new PatchedDataComponentMap(DataComponentMap.EMPTY));reset(d.stack,d.f.getAsJsonObject("initial"));int amount=d.f.get("amount").getAsInt(); + try{switch(d.f.get("mode").getAsString()){case "hurt":d.stack.hurtAndBreak(amount,(ServerLevel)null,d.f.get("player").getAsBoolean()?actor:null,copy->{out.println("copy "+snapshot(copy));d.event("break");});break;case "without":d.stack.hurtWithoutBreaking(amount,actor);break;case "set":d.stack.setDamageValue(amount);break;case "grow":d.stack.grow(amount);break;case "shrink":d.stack.shrink(amount);break;case "query":break;default:throw new AssertionError();}out.println("result ok");}catch(Stop e){out.println("result error");}out.println("state "+snapshot(d.stack)+" "+d.calls+" "+d.changed); + }} + } +} diff --git a/tools/test_item_durability_parity.py b/tools/test_item_durability_parity.py new file mode 100644 index 000000000..924c8d089 --- /dev/null +++ b/tools/test_item_durability_parity.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python3 +"""Compare actual native unenchanted item-stack durability mutation.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + modes = ['hurt', 'without', 'set', 'query', 'grow', 'shrink'] + edges = [-2147483648, -2147483647, -1, 0, 1, 2, 19, 20, 21, 16777215, 16777216, 16777217, 2147483646, 2147483647] + def state(count=1, maximum=20, damage=0, unbreakable=False): + return dict(count=count, max=maximum, damage=damage, unbreakable=unbreakable) + def row(mode='hurt', amount=1, **kw): + f = dict(mode=mode, amount=amount, air=False, player=True, infinite=False, after_infinite=False, initial=state(), after=state(count=2, maximum=5, damage=4), fail=-1, mutate_at=-1) + f.update(kw) + return f + for mode in modes: + for maximum in [None, *edges]: + for damage in [None, *edges]: + for amount in edges: + yield row(mode, amount, initial=state(maximum=maximum, damage=damage)) + for mode in ['hurt', 'without']: + for mutate in range(-1, 5): + for fail in range(-1, 5): + for count in [-1, 0, 1, 2]: + for maximum in [None, 0, 5, 20]: + yield row(mode, 20, mutate_at=mutate, fail=fail, after=state(count=count, maximum=maximum, damage=4)) + rng = random.Random(0x4455524142494c) + def integer(): return rng.choice(edges) if rng.randrange(2) else rng.randrange(-2147483648, 2147483648) + def random_state(): return state(rng.choice([-2, 0, 1, 2, 64, 2147483647]), rng.choice([None, integer()]), rng.choice([None, integer()]), bool(rng.randrange(2))) + for _ in range(10000): + yield row(rng.choice(modes), integer(), air=bool(rng.randrange(5)==0), player=bool(rng.randrange(2)), infinite=bool(rng.randrange(2)), after_infinite=bool(rng.randrange(2)), initial=random_state(), after=random_state(), fail=rng.choice([-1, -1, *range(5)]), mutate_at=rng.randrange(-1, 5)) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-item-durability-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemDurabilityOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/item_durability_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaItemDurabilityOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','item_durability_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('item_durability_fixture.exe' if os.name=='nt' else 'item_durability_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} item durability output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual unenchanted ItemStack damage predicates, clamped reads/writes, integer-wrapping count changes, server-level hurtAndBreak and ServerPlayer hurtWithoutBreaking. Real component maps cover absent fields, empty/air stacks, unbreakable and invalid numeric values; callbacks mutate storage and inject failures at infinite-material, empty-listener advancement and break dispatch boundaries. Covers the positive integer-to-float enchantment pipeline with no enchantments. Complete component storage/codecs, enchantment effects, entity equipment break handling and combat/world integration remain pending.'} + lab.write_json(report_path,report);print(f'Scoped item durability parity passed: {report_path}') + + +if __name__=='__main__':main() From 3e60a149e3bcddd6b71ea641ab399302542251f0 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 06:29:06 +0200 Subject: [PATCH 129/253] Bind blocking-item damage to native-compatible durability storage --- .../scoped-parity.json | 264 ++++++++++++++++++ .../examples/blocking_item_damage_fixture.rs | 144 ++++++++++ .../horizon-world/src/blocking_item_damage.rs | 40 +++ crates/horizon-world/src/lib.rs | 1 + docs/collision-geometry.md | 15 + .../VanillaBlockingItemDamageOracle.java | 29 ++ tools/test_blocking_item_damage_parity.py | 76 +++++ 7 files changed, 569 insertions(+) create mode 100644 benchmarks/rust-blocking-item-damage-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/blocking_item_damage_fixture.rs create mode 100644 crates/horizon-world/src/blocking_item_damage.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockingItemDamageOracle.java create mode 100644 tools/test_blocking_item_damage_parity.py diff --git a/benchmarks/rust-blocking-item-damage-2026-10-07/scoped-parity.json b/benchmarks/rust-blocking-item-damage-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..8be7941a5 --- /dev/null +++ b/benchmarks/rust-blocking-item-damage-2026-10-07/scoped-parity.json @@ -0,0 +1,264 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 20895, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockingItemDamageOracle.java": "adeccd0b712a9b5987f663871a86d7d40fbd1b1f9b68c585dc3f7c6fea567c43", + "tools/test_blocking_item_damage_parity.py": "69cb5aa34d08fc19d0fab38da776de27e22290c10020f2444e2c9fa3f9c70f2f", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "6884c7209f007ab9ee742b9c3c73828cfa1c6753d35b5fe25a87cab5955b33f8", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "18bbad377a8047e4d4ecd0fc87d83d46d1c0f1ce2b8c47bbe64633e7b4420b57", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/blocking_item_damage.rs": "9b1ae81c5bd0aea5982e03da1973f15fd46757354b8dd539bbd27449cff45e6a", + "crates/horizon-world/src/blocking_rules.rs": "83c5e2105cec56a90182ce582e1c67ade2b189be6de1a34d08035000cc07c492", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_immunity.rs": "fd39c41124d694e755cf7faadcf93c636df4042c78ec345092a856b5f952dbcf", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/damage_source.rs": "24945e397a926d34695652980923609e4723e02fe6b6e56d4aaf673e45d759f7", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/item_blocking.rs": "f6eee0d6d177cc3148960122327ba1b459a2f0e85241c1d9a3e40f0b8c169296", + "crates/horizon-world/src/item_durability.rs": "6a67fd660d771c59ffa9f4aa3225a25b56da31ea1079ca2efa4a915be6464179", + "crates/horizon-world/src/item_use.rs": "1d0a3afa61b60d356e81a063da79ec6cd38730315976640a591325fc4c8ab98c", + "crates/horizon-world/src/lib.rs": "902fb8a41e1c805f15c699b66737a274eb8fd21b4a16ff63347f10a5499b34b7", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "2b448209629b9bf2e678d667ad0d6c7fa22146892dd106b169d96b31b0df12bb", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_hurt.rs": "844239ad7d15c39629bb3cfc06ebae6d1cff20b7627468f26e0ee8dff3abdcb8", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_hurt.rs": "99c9bbd8587ec2dc287806049897b8034d2f5349ad47fc497b70d54148844a36", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/server_player_combat.rs": "a9743971581af86d926eeba42004d932caf83382c470dd98bf613cb9c417db58", + "crates/horizon-world/src/server_player_damage.rs": "828a4649fec3e9bda2dfe20aced8c95922c697321de2be4127bd4e5712ecbb7c", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "f417aab280331ddd6f0ca265a12c0130c78b9924f407c7e07f198140501e6010", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/view_direction.rs": "e18120ae26dc5cf702b29fc4c8487088bab133c8ce5abce01226833fafb0d5a4", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "74e4110fb19c4c4047192fd65c38015b8afc7f9fc50404d75380b5063808148c", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/blocking_item_damage_fixture.rs": "9dad7235e6fa50ca00723d6d6c1f0838443443fae1d2a90a141e1cf012f7cf64" + }, + "fixtures_sha256": { + ".local/rust-blocking-item-damage-parity/inputs.txt": "0cb79d37f95adc2a95ddd2c18aa8b1e24142fafe12fffe4f9a56e95b64278b0f" + }, + "rust_output_sha256": "c78041fca237ef15364ce2a42dba44d3acd41b852d2c84daadcc52117ab905cc", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "c78041fca237ef15364ce2a42dba44d3acd41b852d2c84daadcc52117ab905cc", + "matched_output_lines": 71800 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "c78041fca237ef15364ce2a42dba44d3acd41b852d2c84daadcc52117ab905cc", + "matched_output_lines": 71800 + } + ], + "scope": "Actual BlocksAttacks hurtBlockingItem into native unenchanted ItemStack durability storage, on non-player, Player and ServerPlayer receivers. Native statistic item capture, client/level guards, scalar item-damage rules, creative immunity, empty-listener advancement ordering, stack mutation/shrink and equipment-break callback copy/slot are compared with Rust composition. Covers scalar float boundaries, absent/invalid durability components, callback storage mutations and failures. Complete components/codecs, enchantment effects, inventory/equipment lifecycle and full combat/world integration remain pending." +} diff --git a/crates/horizon-world/examples/blocking_item_damage_fixture.rs b/crates/horizon-world/examples/blocking_item_damage_fixture.rs new file mode 100644 index 000000000..123369aaf --- /dev/null +++ b/crates/horizon-world/examples/blocking_item_damage_fixture.rs @@ -0,0 +1,144 @@ +use horizon_world::item_durability::{self, DurabilityStack, DurabilityWorld}; +use horizon_world::{ + blocking_item_damage::{self, BlockingItemDamageWorld}, + blocking_rules::ItemDamageFunction, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn stack(v: &Value, air: bool) -> DurabilityStack { + DurabilityStack { + count: v["count"].as_i64().unwrap() as i32, + air, + max_damage: v["max"].as_i64().map(|v| v as i32), + damage: v["damage"].as_i64().map(|v| v as i32), + unbreakable: v["unbreakable"].as_bool().unwrap(), + } +} +fn optional(v: Option) -> String { + v.map_or("none".into(), |v| v.to_string()) +} +fn snapshot(s: &DurabilityStack) -> String { + format!( + "{} {} {} {} {} {} {} {} {} {} {} {}", + s.count, + s.count(), + optional(s.max_damage), + optional(s.damage), + s.unbreakable, + s.max_damage(), + s.damage(), + s.is_empty(), + s.is_damageable(), + s.is_damaged(), + s.is_broken(), + s.next_damage_will_break() + ) +} +struct World<'a> { + f: &'a Value, + out: &'a mut dyn Write, + calls: i64, + changed: bool, +} +impl World<'_> { + fn event(&mut self, s: &mut DurabilityStack, name: &str) -> io::Result<()> { + writeln!(self.out, "{name} | {}", snapshot(s))?; + let n = self.calls; + self.calls += 1; + if n == self.f["fail"].as_i64().unwrap() { + return Err(io::Error::other("injected callback failure")); + } + if n == self.f["mutate_at"].as_i64().unwrap() { + self.changed = true; + *s = stack(&self.f["after"], s.air); + } + Ok(()) + } +} +impl DurabilityWorld for World<'_> { + type Error = io::Error; + fn infinite_materials(&mut self, s: &mut DurabilityStack) -> io::Result { + self.event(s, "infinite")?; + Ok(self.f[if self.changed { + "after_infinite" + } else { + "infinite" + }] + .as_bool() + .unwrap()) + } + fn process_enchantments(&mut self, _: &mut DurabilityStack, amount: i32) -> io::Result { + Ok(item_durability::unenchanted_change(amount)) + } + fn durability_changed(&mut self, s: &mut DurabilityStack, _: i32) -> io::Result<()> { + self.event(s, "criterion") + } + fn broken(&mut self, s: &mut DurabilityStack, copy: DurabilityStack) -> io::Result<()> { + writeln!(self.out, "copy {}", snapshot(©))?; + self.event(s, &format!("break {}", self.f["hand"].as_u64().unwrap())) + } +} +fn single(v: &Value) -> f32 { + f32::from_bits(u32::from_str_radix(v.as_str().unwrap(), 16).unwrap()) +} +impl World<'_> { + fn flag(&self, name: &str) -> bool { + self.f[format!("{}{name}", if self.changed { "after_" } else { "" })] + .as_bool() + .unwrap() + } +} +impl BlockingItemDamageWorld for World<'_> { + type Level = (); + fn is_player(&self) -> bool { + self.f["kind"].as_u64().unwrap() > 0 + } + fn is_server_player(&self) -> bool { + self.f["kind"].as_u64().unwrap() == 2 + } + fn level_is_client(&mut self, s: &mut DurabilityStack, _: ()) -> io::Result { + self.event(s, "client")?; + Ok(self.flag("client")) + } + fn award_item_used(&mut self, s: &mut DurabilityStack) -> io::Result<()> { + let kind = if s.is_empty() { 0 } else { 1 }; + self.event(s, &format!("stat {kind}")) + } + fn entity_level_is_server(&mut self, s: &mut DurabilityStack) -> io::Result { + self.event(s, "level")?; + Ok(self.flag("server")) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut s = stack(&f["initial"], f["air"].as_bool().unwrap()); + let mut w = World { + f: &f, + out: &mut out, + calls: 0, + changed: false, + }; + let r = &f["rule"]; + let rule = ItemDamageFunction { + threshold: single(&r["threshold"]), + base: single(&r["base"]), + factor: single(&r["factor"]), + }; + let result = blocking_item_damage::hurt(&mut s, &mut w, (), single(&f["damage"]), rule); + writeln!( + w.out, + "result {}", + if result.is_ok() { "ok" } else { "error" } + )?; + writeln!(w.out, "state {} {} {}", snapshot(&s), w.calls, w.changed)?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/blocking_item_damage.rs b/crates/horizon-world/src/blocking_item_damage.rs new file mode 100644 index 000000000..df2ec4b90 --- /dev/null +++ b/crates/horizon-world/src/blocking_item_damage.rs @@ -0,0 +1,40 @@ +//! Blocking-component durability dispatch bound to stored item durability. +use crate::{ + blocking_rules::ItemDamageFunction, + item_durability::{self, DurabilityStack, DurabilityWorld}, +}; + +pub trait BlockingItemDamageWorld: DurabilityWorld { + type Level: Copy; + fn is_player(&self) -> bool; + fn is_server_player(&self) -> bool; + fn level_is_client( + &mut self, + stack: &mut DurabilityStack, + level: Self::Level, + ) -> Result; + /// Implementations capture the stack's current item type before awarding it. + fn award_item_used(&mut self, stack: &mut DurabilityStack) -> Result<(), Self::Error>; + fn entity_level_is_server(&mut self, stack: &mut DurabilityStack) -> Result; +} + +pub fn hurt( + stack: &mut DurabilityStack, + world: &mut W, + level: W::Level, + damage: f32, + rule: ItemDamageFunction, +) -> Result<(), W::Error> { + if !world.is_player() { + return Ok(()); + } + if !world.level_is_client(stack, level)? { + world.award_item_used(stack)?; + } + let amount = rule.apply(damage); + if amount > 0 && world.entity_level_is_server(stack)? { + let player = world.is_server_player(); + item_durability::hurt_and_break(stack, world, amount, player)?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 22a79a052..eafd315bc 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -13,6 +13,7 @@ pub mod block_properties; pub mod block_render; pub mod block_support; pub mod block_survival; +pub mod blocking_item_damage; pub mod blocking_rules; pub mod chunk; pub mod chunk_status; diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index d7e98098c..1f993eb8a 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1530,3 +1530,18 @@ stacks, unbreakable flags, integer boundaries, callback mutations and failures. Targeted Clippy passes. This is a durability projection, not complete item-stack component storage. Enchantment effects, component codecs, equipment break handling and full gameplay integration remain pending. + + +`blocking_item_damage` composes blocking-component item-damage arithmetic with +stored durability. It preserves player-only handling, the passed level's client +guard for item-use statistics, the later virtual entity-level check and the +server-player-only creative/advancement queries. Break callbacks receive the +pre-shrink stack copy and the caller's original equipment slot. + +`python3 tools/test_blocking_item_damage_parity.py` compares actual native +BlocksAttacks calls into ItemStack storage on non-player, Player and ServerPlayer +receivers. The [blocking durability report](../benchmarks/rust-blocking-item-damage-2026-10-07/scoped-parity.json) +records **71,800 matching lines per JAR**, including scalar float boundaries, +invalid/absent durability components, statistic item capture, callback mutations +and failures. Targeted Clippy passes. Stacks are unenchanted; full component +storage, equipment lifecycle and complete combat/world integration remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockingItemDamageOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockingItemDamageOracle.java new file mode 100644 index 000000000..4d611fd32 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockingItemDamageOracle.java @@ -0,0 +1,29 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.lang.reflect.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.*;import net.minecraft.core.component.*;import net.minecraft.core.registries.*;import net.minecraft.world.item.*;import net.minecraft.server.level.*;import net.minecraft.server.PlayerAdvancements; +/** Native BlocksAttacks durability dispatch into actual ItemStack storage. */ +public final class VanillaBlockingItemDamageOracle { + static final class Stop extends RuntimeException {} + static Object unsafe;static Method allocate;static Field components,count; + static T make(Class c)throws Exception{return c.cast(allocate.invoke(unsafe,c));} + static Field field(Class c,String n)throws Exception{var f=c.getDeclaredField(n);f.setAccessible(true);return f;} + static String optional(Object v){return v==null?"none":v.toString();} + static String snapshot(ItemStack s){try{var c=(PatchedDataComponentMap)components.get(s);return count.getInt(s)+" "+s.getCount()+" "+optional(c.get(DataComponents.MAX_DAMAGE))+" "+optional(c.get(DataComponents.DAMAGE))+" "+c.has(DataComponents.UNBREAKABLE)+" "+s.getMaxDamage()+" "+s.getDamageValue()+" "+s.isEmpty()+" "+s.isDamageableItem()+" "+s.isDamaged()+" "+s.isBroken()+" "+s.nextDamageWillBreak();}catch(Exception e){throw new AssertionError(e);}} + static void reset(ItemStack s,JsonObject f){s.setCount(f.get("count").getAsInt());if(f.get("max").isJsonNull())s.remove(DataComponents.MAX_DAMAGE);else s.set(DataComponents.MAX_DAMAGE,f.get("max").getAsInt());if(f.get("damage").isJsonNull())s.remove(DataComponents.DAMAGE);else s.set(DataComponents.DAMAGE,f.get("damage").getAsInt());if(f.get("unbreakable").getAsBoolean())s.set(DataComponents.UNBREAKABLE,net.minecraft.util.Unit.INSTANCE);else s.remove(DataComponents.UNBREAKABLE);} + static float single(JsonElement v){return Float.intBitsToFloat(Integer.parseUnsignedInt(v.getAsString(),16));} + static final class Data {Server level;JsonObject f;PrintWriter out;int calls;boolean changed;ItemStack stack;PlayerAdvancements advancements; + void event(String s){out.println(s+" | "+snapshot(stack));int n=calls++;if(n==f.get("fail").getAsInt())throw new Stop();if(n==f.get("mutate_at").getAsInt()){changed=true;reset(stack,f.getAsJsonObject("after"));}} + boolean flag(String name){return f.get((changed?"after_":"")+name).getAsBoolean();} boolean infinite(){return flag("infinite");}} + static final class Server extends ServerLevel {Data d;Server(){super(null,null,null,null,null,null,false,0L,List.of(),false);}@Override public boolean isClientSide(){d.event("client");return d.flag("client");}} + static final class Actor extends net.minecraft.world.entity.decoration.ArmorStand {Actor(){super(null,null);}} + static void broken(Data d,ItemStack copy,net.minecraft.world.entity.EquipmentSlot slot){d.out.println("copy "+snapshot(copy));d.event("break "+(slot==net.minecraft.world.entity.EquipmentSlot.MAINHAND?0:1));} + static void stat(Data d,net.minecraft.stats.Stat s){if(s.getType()!=net.minecraft.stats.Stats.ITEM_USED)throw new AssertionError();d.event("stat "+(s.getValue()==Items.AIR?0:1));} + static final class Human extends ServerPlayer {Data d;Human(){super(null,null,null,null);}@Override public boolean hasInfiniteMaterials(){d.event("infinite");return d.infinite();}@Override public PlayerAdvancements getAdvancements(){d.event("criterion");return d.advancements;}@Override public ServerLevel level(){d.event("level");return d.flag("server")?d.level:null;}@Override public void awardStat(net.minecraft.stats.Stat s){stat(d,s);}@Override public void onEquippedItemBroken(ItemStack copy,net.minecraft.world.entity.EquipmentSlot slot){broken(d,copy,slot);}} + static final class PlainPlayer extends net.minecraft.world.entity.player.Player {Data d;PlainPlayer(){super(null,null);}@Override public net.minecraft.world.level.GameType gameMode(){return net.minecraft.world.level.GameType.SURVIVAL;}@Override public boolean isSpectator(){return false;}@Override public boolean isCreative(){return false;}@Override public net.minecraft.world.level.Level level(){d.event("level");return d.flag("server")?d.level:null;}@Override public void awardStat(net.minecraft.stats.Stat s){stat(d,s);}@Override public void onEquippedItemBroken(ItemStack copy,net.minecraft.world.entity.EquipmentSlot slot){broken(d,copy,slot);}} + public static void main(String[] args)throws Exception{ + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();var u=Class.forName("sun.misc.Unsafe");unsafe=field(u,"theUnsafe").get(null);allocate=u.getMethod("allocateInstance",Class.class);components=field(ItemStack.class,"components");count=field(ItemStack.class,"count");var ctor=ItemStack.class.getDeclaredConstructor(Holder.class,int.class,PatchedDataComponentMap.class);ctor.setAccessible(true);Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var d=new Data();d.f=JsonParser.parseString(line).getAsJsonObject();d.out=out;d.advancements=make(PlayerAdvancements.class);field(PlayerAdvancements.class,"activeTriggers").set(d.advancements,new HashMap<>());d.level=make(Server.class);d.level.d=d;var human=make(Human.class);human.d=d;var plain=make(PlainPlayer.class);plain.d=d;net.minecraft.world.entity.LivingEntity actor=switch(d.f.get("kind").getAsInt()){case 0->make(Actor.class);case 1->plain;default->human;};d.stack=(ItemStack)ctor.newInstance(BuiltInRegistries.ITEM.wrapAsHolder(d.f.get("air").getAsBoolean()?Items.AIR:Items.SHIELD),1,new PatchedDataComponentMap(DataComponentMap.EMPTY));reset(d.stack,d.f.getAsJsonObject("initial"));var rule=d.f.getAsJsonObject("rule");var component=new net.minecraft.world.item.component.BlocksAttacks(0,1,List.of(),new net.minecraft.world.item.component.BlocksAttacks.ItemDamageFunction(single(rule.get("threshold")),single(rule.get("base")),single(rule.get("factor"))),Optional.empty(),Optional.empty(),Optional.empty()); + try{component.hurtBlockingItem(d.level,d.stack,actor,net.minecraft.world.InteractionHand.values()[d.f.get("hand").getAsInt()],single(d.f.get("damage")));out.println("result ok");}catch(Stop e){out.println("result error");}out.println("state "+snapshot(d.stack)+" "+d.calls+" "+d.changed); + }} + } +} diff --git a/tools/test_blocking_item_damage_parity.py b/tools/test_blocking_item_damage_parity.py new file mode 100644 index 000000000..7d0f3db4f --- /dev/null +++ b/tools/test_blocking_item_damage_parity.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python3 +"""Compare native blocking-item damage bound to actual item-stack durability.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + def bits(v):return struct.pack('>f',v).hex() + floats = [-float('inf'), -1e30, -1, -0., 0., 1e-40, .5, 1, 5, 20, 1e30, float('inf'), float('nan')] + def state(count=1, maximum=20, damage=0, unbreakable=False): return dict(count=count, max=maximum, damage=damage, unbreakable=unbreakable) + def rule(threshold=3, base=1, factor=1):return dict(threshold=bits(threshold),base=bits(base),factor=bits(factor)) + def row(damage=20, **kw): + f=dict(damage=bits(damage),rule=rule(),air=False,kind=2,hand=0,infinite=False,after_infinite=False,client=False,after_client=False,server=True,after_server=True,initial=state(),after=state(count=2,maximum=5,damage=4),fail=-1,mutate_at=-1);f.update(kw);return f + for damage in floats: + for base in floats: + for factor in floats: + for kind in range(3):yield row(damage,rule=rule(threshold=base,base=base,factor=factor),kind=kind) + for kind in range(3): + for mutate in range(-1,7): + for fail in range(-1,7): + for count in [0,1,2]: + for maximum in [None,0,5,20]:yield row(kind=kind,fail=fail,mutate_at=mutate,hand=1,after=state(count=count,maximum=maximum,damage=4)) + rng=random.Random(0x424c4f434b445552) + edges=[-2147483648,-1,0,1,2,19,20,21,16777217,2147483647] + def integer():return rng.choice(edges) if rng.randrange(2) else rng.randrange(-2147483648,2147483648) + def random_state():return state(rng.choice([-1,0,1,2,64]),rng.choice([None,integer()]),rng.choice([None,integer()]),bool(rng.randrange(2))) + def floating():return bits(rng.choice(floats)) if rng.randrange(2) else f'{rng.getrandbits(32):08x}' + for _ in range(12000): + flags={name:bool(rng.randrange(2)) for name in ['infinite','after_infinite','client','after_client','server','after_server']} + yield row(damage=0,**flags,rule={name:floating() for name in ['threshold','base','factor']},kind=rng.randrange(3),hand=rng.randrange(2),air=bool(rng.randrange(5)==0),initial=random_state(),after=random_state(),fail=rng.choice([-1,-1,*range(7)]),mutate_at=rng.randrange(-1,7)) | dict(damage=floating()) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-blocking-item-damage-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockingItemDamageOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/blocking_item_damage_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaBlockingItemDamageOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','blocking_item_damage_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('blocking_item_damage_fixture.exe' if os.name=='nt' else 'blocking_item_damage_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} blocking item damage output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual BlocksAttacks hurtBlockingItem into native unenchanted ItemStack durability storage, on non-player, Player and ServerPlayer receivers. Native statistic item capture, client/level guards, scalar item-damage rules, creative immunity, empty-listener advancement ordering, stack mutation/shrink and equipment-break callback copy/slot are compared with Rust composition. Covers scalar float boundaries, absent/invalid durability components, callback storage mutations and failures. Complete components/codecs, enchantment effects, inventory/equipment lifecycle and full combat/world integration remain pending.'} + lab.write_json(report_path,report);print(f'Scoped blocking item damage parity passed: {report_path}') + + +if __name__=='__main__':main() From 9b15ab46d0128b917342f038bfc5f5638b19d28d Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 06:35:37 +0200 Subject: [PATCH 130/253] Implement living item-use tick release and completion lifecycle --- .../scoped-parity.json | 265 ++++++++++++++++++ .../examples/item_use_lifecycle_fixture.rs | 204 ++++++++++++++ .../horizon-world/src/item_use_lifecycle.rs | 172 ++++++++++++ crates/horizon-world/src/lib.rs | 1 + docs/collision-geometry.md | 16 ++ .../parity/VanillaItemUseLifecycleOracle.java | 38 +++ tools/test_item_use_lifecycle_parity.py | 73 +++++ 7 files changed, 769 insertions(+) create mode 100644 benchmarks/rust-item-use-lifecycle-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/item_use_lifecycle_fixture.rs create mode 100644 crates/horizon-world/src/item_use_lifecycle.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemUseLifecycleOracle.java create mode 100644 tools/test_item_use_lifecycle_parity.py diff --git a/benchmarks/rust-item-use-lifecycle-2026-10-07/scoped-parity.json b/benchmarks/rust-item-use-lifecycle-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..6e5d81565 --- /dev/null +++ b/benchmarks/rust-item-use-lifecycle-2026-10-07/scoped-parity.json @@ -0,0 +1,265 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 19900, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemUseLifecycleOracle.java": "7a024212a18eff1891996fe5979c2d35aea36a4cef80c70638bb5ead4fbcaf57", + "tools/test_item_use_lifecycle_parity.py": "0856dc5003cc3eee7e6673601db53b80f3ef8c650c37cbb17eebcfae63b5de91", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "6884c7209f007ab9ee742b9c3c73828cfa1c6753d35b5fe25a87cab5955b33f8", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "18bbad377a8047e4d4ecd0fc87d83d46d1c0f1ce2b8c47bbe64633e7b4420b57", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/blocking_item_damage.rs": "9b1ae81c5bd0aea5982e03da1973f15fd46757354b8dd539bbd27449cff45e6a", + "crates/horizon-world/src/blocking_rules.rs": "83c5e2105cec56a90182ce582e1c67ade2b189be6de1a34d08035000cc07c492", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_immunity.rs": "fd39c41124d694e755cf7faadcf93c636df4042c78ec345092a856b5f952dbcf", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/damage_source.rs": "24945e397a926d34695652980923609e4723e02fe6b6e56d4aaf673e45d759f7", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/item_blocking.rs": "f6eee0d6d177cc3148960122327ba1b459a2f0e85241c1d9a3e40f0b8c169296", + "crates/horizon-world/src/item_durability.rs": "6a67fd660d771c59ffa9f4aa3225a25b56da31ea1079ca2efa4a915be6464179", + "crates/horizon-world/src/item_use.rs": "1d0a3afa61b60d356e81a063da79ec6cd38730315976640a591325fc4c8ab98c", + "crates/horizon-world/src/item_use_lifecycle.rs": "f9b29f42a528493d0d2521110d4f6e0bc89af8f579d539648cb7c3a9e68e31cd", + "crates/horizon-world/src/lib.rs": "9b549992c2c8e118013f64c15cbc79ca9c66c681d0692bef655fd939812dd19c", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "2b448209629b9bf2e678d667ad0d6c7fa22146892dd106b169d96b31b0df12bb", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_hurt.rs": "844239ad7d15c39629bb3cfc06ebae6d1cff20b7627468f26e0ee8dff3abdcb8", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_hurt.rs": "99c9bbd8587ec2dc287806049897b8034d2f5349ad47fc497b70d54148844a36", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/server_player_combat.rs": "a9743971581af86d926eeba42004d932caf83382c470dd98bf613cb9c417db58", + "crates/horizon-world/src/server_player_damage.rs": "828a4649fec3e9bda2dfe20aced8c95922c697321de2be4127bd4e5712ecbb7c", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "f417aab280331ddd6f0ca265a12c0130c78b9924f407c7e07f198140501e6010", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/view_direction.rs": "e18120ae26dc5cf702b29fc4c8487088bab133c8ce5abce01226833fafb0d5a4", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "74e4110fb19c4c4047192fd65c38015b8afc7f9fc50404d75380b5063808148c", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/item_use_lifecycle_fixture.rs": "bad2f2236179b953dd4cbeac7a7c27ded23cfff11b474b4e5284bedf54c4fcaa" + }, + "fixtures_sha256": { + ".local/rust-item-use-lifecycle-parity/inputs.txt": "32379ce9a26546173d4a88d55665609aad15f6e6a38c6b6e3cc00d2e7a6c76a4" + }, + "rust_output_sha256": "79addc5b3f5d14a54965ff68a71ed18989490e00a103368c75a1825236166f95", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "79addc5b3f5d14a54965ff68a71ed18989490e00a103368c75a1825236166f95", + "matched_output_lines": 144736 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "79addc5b3f5d14a54965ff68a71ed18989490e00a103368c75a1825236166f95", + "matched_output_lines": 144736 + } + ], + "scope": "Actual LivingEntity private using-item tick, updateUsingItem, completeUsingItem, releaseUsingItem and stopUsingItem. Real ItemStack/UseEffects components call controlled custom item handlers; virtual level/hand queries and using flag updates are observed. Covers captured stack/level references, same-type versus stack-identity checks, callback mutations/failures, empty stacks, wrapping countdowns, returned item placement, finish vibration and kinetic-enemy-map presence. Starting use, actual synchronized flags, consumables/kinetic item effects, use remainders/cooldowns, full inventory/equipment and game tick integration remain pending." +} diff --git a/crates/horizon-world/examples/item_use_lifecycle_fixture.rs b/crates/horizon-world/examples/item_use_lifecycle_fixture.rs new file mode 100644 index 000000000..65dae5214 --- /dev/null +++ b/crates/horizon-world/examples/item_use_lifecycle_fixture.rs @@ -0,0 +1,204 @@ +use horizon_world::item_use_lifecycle::{self, UseLifecycleWorld, UseState}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +struct World<'a> { + f: &'a Value, + out: &'a mut dyn Write, + calls: i64, + changed: bool, + using: bool, + hands: [usize; 2], +} +impl World<'_> { + fn state(&self) -> &Value { + &self.f[if self.changed { "after" } else { "initial" }] + } + fn reset(&mut self, s: &mut UseState) { + s.item = self.state()["item"].as_u64().unwrap() as usize; + s.remaining = self.state()["remaining"].as_i64().unwrap() as i32; + s.has_recent_kinetic_enemies = self.state()["kinetic"].as_bool().unwrap(); + self.using = self.state()["using"].as_bool().unwrap(); + self.hands = std::array::from_fn(|i| self.state()["hands"][i].as_u64().unwrap() as usize); + } + fn event(&mut self, s: &mut UseState, name: &str) -> io::Result<()> { + writeln!(self.out, "{name}")?; + let n = self.calls; + self.calls += 1; + if n == self.f["fail"].as_i64().unwrap() { + return Err(io::Error::other("injected lifecycle failure")); + } + if n == self.f["mutate_at"].as_i64().unwrap() { + self.changed = true; + self.reset(s); + } + Ok(()) + } + fn kind(&self, item: usize) -> usize { + if item == 1 && self.f["shared_type"].as_bool().unwrap() { + 0 + } else { + item + } + } +} +impl UseLifecycleWorld for World<'_> { + type Error = io::Error; + type Item = usize; + type Hand = usize; + type Level = usize; + fn empty_item(&self) -> usize { + 2 + } + fn is_empty(&self, item: usize) -> bool { + item == 2 + } + fn same_item_type(&self, a: usize, b: usize) -> bool { + self.kind(a) == self.kind(b) + } + fn using_item(&mut self, s: &mut UseState) -> io::Result { + self.event(s, "using")?; + Ok(self.using) + } + fn used_hand(&mut self, s: &mut UseState) -> io::Result { + self.event(s, "hand")?; + Ok(self.state()["hand"].as_u64().unwrap() as usize) + } + fn hand_item(&mut self, s: &mut UseState, hand: usize) -> io::Result { + self.event(s, &format!("get-hand {hand}"))?; + Ok(self.hands[hand]) + } + fn set_hand_item( + &mut self, + s: &mut UseState, + hand: usize, + item: usize, + ) -> io::Result<()> { + self.event(s, &format!("set-hand {hand} {item}"))?; + self.hands[hand] = item; + Ok(()) + } + fn level(&mut self, s: &mut UseState) -> io::Result { + self.event(s, "level")?; + Ok(self.state()["level"].as_u64().unwrap() as usize) + } + fn is_client(&mut self, s: &mut UseState, level: usize) -> io::Result { + self.event(s, &format!("client {level}"))?; + Ok(self.state()["clients"][level].as_bool().unwrap()) + } + fn remaining_ticks(&mut self, s: &mut UseState) -> io::Result { + self.event(s, "remaining")?; + Ok(self.state()["virtual_remaining"].as_i64().unwrap() as i32) + } + fn item_tick( + &mut self, + s: &mut UseState, + item: usize, + level: usize, + remaining: i32, + ) -> io::Result<()> { + let kind = self.kind(item); + if kind == 2 { + return Ok(()); + } + self.event(s, &format!("tick {kind} {item} {level} {remaining}")) + } + fn use_on_release(&mut self, s: &mut UseState, item: usize) -> io::Result { + let kind = self.kind(item); + if kind == 2 { + return Ok(false); + } + self.event(s, &format!("release-query {kind} {item}"))?; + Ok(self.state()["releases"][kind].as_bool().unwrap()) + } + fn release_item( + &mut self, + s: &mut UseState, + item: usize, + level: usize, + remaining: i32, + ) -> io::Result<()> { + let kind = self.kind(item); + if kind == 2 { + return Ok(()); + } + self.event(s, &format!("release {kind} {item} {level} {remaining}")) + } + fn finish_item( + &mut self, + s: &mut UseState, + item: usize, + level: usize, + ) -> io::Result { + let kind = self.kind(item); + if kind == 2 { + return Ok(item); + } + self.event(s, &format!("finish {kind} {item} {level}"))?; + Ok(self.state()["finishes"][kind].as_u64().unwrap() as usize) + } + fn set_using_flag(&mut self, s: &mut UseState, using: bool) -> io::Result<()> { + self.event(s, &format!("flag {using}"))?; + self.using = using; + Ok(()) + } + fn finish_vibration(&mut self, s: &mut UseState, item: usize) -> io::Result<()> { + if item < 2 && self.f["vibrations"][item].as_bool().unwrap() { + self.event(s, "vibration")?; + } + Ok(()) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut s = UseState { + item: 2, + remaining: 0, + has_recent_kinetic_enemies: false, + }; + let mut w = World { + f: &f, + out: &mut out, + calls: 0, + changed: false, + using: false, + hands: [2, 2], + }; + w.reset(&mut s); + let result = match f["mode"].as_str().unwrap() { + "tick" => item_use_lifecycle::tick(&mut w, &mut s), + "update" => { + item_use_lifecycle::update(&mut w, &mut s, f["argument"].as_u64().unwrap() as usize) + } + "complete" => item_use_lifecycle::complete(&mut w, &mut s), + "release" => item_use_lifecycle::release(&mut w, &mut s), + "stop" => item_use_lifecycle::stop(&mut w, &mut s), + _ => panic!("mode"), + }; + writeln!( + w.out, + "result {}", + if result.is_ok() { "ok" } else { "error" } + )?; + writeln!( + w.out, + "state {} {} {} {} {} {} {} {}", + s.item, + s.remaining, + s.has_recent_kinetic_enemies, + w.using, + w.hands[0], + w.hands[1], + w.calls, + w.changed + )?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/item_use_lifecycle.rs b/crates/horizon-world/src/item_use_lifecycle.rs new file mode 100644 index 000000000..fa9f78540 --- /dev/null +++ b/crates/horizon-world/src/item_use_lifecycle.rs @@ -0,0 +1,172 @@ +//! Living item-use lifecycle ordering over stable item-stack handles. +#[derive(Clone, Copy, Debug)] +pub struct UseState { + pub item: I, + pub remaining: i32, + pub has_recent_kinetic_enemies: bool, +} +pub trait UseLifecycleWorld: Sized { + type Error; + type Item: Copy + Eq; + type Hand: Copy; + type Level: Copy; + fn empty_item(&self) -> Self::Item; + fn is_empty(&self, item: Self::Item) -> bool; + fn same_item_type(&self, a: Self::Item, b: Self::Item) -> bool; + fn using_item(&mut self, s: &mut UseState) -> Result; + fn used_hand(&mut self, s: &mut UseState) -> Result; + fn hand_item( + &mut self, + s: &mut UseState, + hand: Self::Hand, + ) -> Result; + fn set_hand_item( + &mut self, + s: &mut UseState, + hand: Self::Hand, + item: Self::Item, + ) -> Result<(), Self::Error>; + fn level(&mut self, s: &mut UseState) -> Result; + fn is_client( + &mut self, + s: &mut UseState, + level: Self::Level, + ) -> Result; + fn remaining_ticks(&mut self, s: &mut UseState) -> Result; + fn item_tick( + &mut self, + s: &mut UseState, + item: Self::Item, + level: Self::Level, + remaining: i32, + ) -> Result<(), Self::Error>; + fn use_on_release( + &mut self, + s: &mut UseState, + item: Self::Item, + ) -> Result; + fn release_item( + &mut self, + s: &mut UseState, + item: Self::Item, + level: Self::Level, + remaining: i32, + ) -> Result<(), Self::Error>; + fn finish_item( + &mut self, + s: &mut UseState, + item: Self::Item, + level: Self::Level, + ) -> Result; + fn set_using_flag( + &mut self, + s: &mut UseState, + using: bool, + ) -> Result<(), Self::Error>; + fn finish_vibration( + &mut self, + s: &mut UseState, + item: Self::Item, + ) -> Result<(), Self::Error>; + fn update_using_item( + &mut self, + s: &mut UseState, + item: Self::Item, + ) -> Result<(), Self::Error> { + update(self, s, item) + } + fn complete_using_item(&mut self, s: &mut UseState) -> Result<(), Self::Error> { + complete(self, s) + } + fn release_using_item(&mut self, s: &mut UseState) -> Result<(), Self::Error> { + release(self, s) + } + fn stop_using_item(&mut self, s: &mut UseState) -> Result<(), Self::Error> { + stop(self, s) + } +} +pub fn tick(w: &mut W, s: &mut UseState) -> Result<(), W::Error> { + if w.using_item(s)? { + let hand = w.used_hand(s)?; + let held = w.hand_item(s, hand)?; + if w.same_item_type(held, s.item) { + let hand = w.used_hand(s)?; + s.item = w.hand_item(s, hand)?; + w.update_using_item(s, s.item)?; + } else { + w.stop_using_item(s)?; + } + } + Ok(()) +} +pub fn update( + w: &mut W, + s: &mut UseState, + item: W::Item, +) -> Result<(), W::Error> { + let level = w.level(s)?; + let remaining = w.remaining_ticks(s)?; + w.item_tick(s, item, level, remaining)?; + s.remaining = s.remaining.wrapping_sub(1); + if s.remaining == 0 { + let level = w.level(s)?; + if !w.is_client(s, level)? && !w.use_on_release(s, item)? { + w.complete_using_item(s)?; + } + } + Ok(()) +} +pub fn complete( + w: &mut W, + s: &mut UseState, +) -> Result<(), W::Error> { + let level = w.level(s)?; + if w.is_client(s, level)? && !w.using_item(s)? { + return Ok(()); + } + let hand = w.used_hand(s)?; + let original = s.item; + if original != w.hand_item(s, hand)? { + w.release_using_item(s)?; + return Ok(()); + } + if !w.is_empty(s.item) && w.using_item(s)? { + let item = s.item; + let level = w.level(s)?; + let result = w.finish_item(s, item, level)?; + if result != s.item { + w.set_hand_item(s, hand, result)?; + } + w.stop_using_item(s)?; + } + Ok(()) +} +pub fn release(w: &mut W, s: &mut UseState) -> Result<(), W::Error> { + let hand = w.used_hand(s)?; + let held = w.hand_item(s, hand)?; + if !w.is_empty(s.item) && w.same_item_type(held, s.item) { + s.item = held; + let item = s.item; + let level = w.level(s)?; + let remaining = w.remaining_ticks(s)?; + w.release_item(s, item, level, remaining)?; + if w.use_on_release(s, s.item)? { + tick(w, s)?; + } + } + w.stop_using_item(s) +} +pub fn stop(w: &mut W, s: &mut UseState) -> Result<(), W::Error> { + let level = w.level(s)?; + if !w.is_client(s, level)? { + let using = w.using_item(s)?; + s.has_recent_kinetic_enemies = false; + w.set_using_flag(s, false)?; + if using { + w.finish_vibration(s, s.item)?; + } + } + s.item = w.empty_item(); + s.remaining = 0; + Ok(()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index eafd315bc..dc6fa7ad8 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -47,6 +47,7 @@ pub mod interaction_shapes; pub mod item_blocking; pub mod item_durability; pub mod item_use; +pub mod item_use_lifecycle; pub mod liquid_collision; pub mod living_air; pub mod living_damage; diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 1f993eb8a..add58b7c3 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1545,3 +1545,19 @@ records **71,800 matching lines per JAR**, including scalar float boundaries, invalid/absent durability components, statistic item capture, callback mutations and failures. Targeted Clippy passes. Stacks are unenchanted; full component storage, equipment lifecycle and complete combat/world integration remain pending. + + +`item_use_lifecycle` implements living use ticks, per-item updates, completion, +release and stop ordering. Stable stack handles preserve type versus identity +checks, rereads after virtual hand queries, captured level/item arguments, +wrapping countdowns, returned-item placement and failure-visible state changes. + +`python3 tools/test_item_use_lifecycle_parity.py` compares actual inherited native +methods and ItemStack dispatch with controlled custom item handlers. The +[lifecycle report](../benchmarks/rust-item-use-lifecycle-2026-10-07/scoped-parity.json) +records **144,736 matching lines per JAR**, including empty stacks, changed +held/active items, shared item types, client/server queries, finish vibrations, +kinetic-map presence and callback mutation/failure ordering. Targeted Clippy +passes. Starting use, actual synchronized flags, consumable/kinetic effects, +remainder/cooldown components and full inventory/game-tick integration remain +pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemUseLifecycleOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemUseLifecycleOracle.java new file mode 100644 index 000000000..db0180ef0 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemUseLifecycleOracle.java @@ -0,0 +1,38 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.lang.reflect.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.*;import net.minecraft.core.component.*;import net.minecraft.world.entity.*;import net.minecraft.world.item.*;import net.minecraft.world.InteractionHand;import net.minecraft.world.level.*;import net.minecraft.world.level.gameevent.GameEvent;import net.minecraft.server.level.*; +/** Actual inherited living tick/release/complete/stop lifecycle with custom items. */ +public final class VanillaItemUseLifecycleOracle { + static final class Stop extends RuntimeException {} + static Object unsafe;static Method allocate;static Field useItem,remaining,kinetic; + static T make(Class c)throws Exception{return c.cast(allocate.invoke(unsafe,c));} + static Field field(Class c,String n)throws Exception{var f=c.getDeclaredField(n);f.setAccessible(true);return f;} + static final class Data {JsonObject f;PrintWriter out;int calls;boolean changed,using;Actor actor;ItemStack[] items,hands;Server[] levels; + JsonObject state(){return f.getAsJsonObject(changed?"after":"initial");} + void reset(){try{var s=state();useItem.set(actor,items[s.get("item").getAsInt()]);remaining.setInt(actor,s.get("remaining").getAsInt());kinetic.set(actor,s.get("kinetic").getAsBoolean()?new it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<>():null);using=s.get("using").getAsBoolean();hands=new ItemStack[]{items[s.getAsJsonArray("hands").get(0).getAsInt()],items[s.getAsJsonArray("hands").get(1).getAsInt()]};}catch(Exception e){throw new AssertionError(e);}} + void event(String name){out.println(name);int n=calls++;if(n==f.get("fail").getAsInt())throw new Stop();if(n==f.get("mutate_at").getAsInt()){changed=true;reset();}} + int id(ItemStack s){for(int i=0;i event){if(event!=GameEvent.ITEM_INTERACT_FINISH)throw new AssertionError();d.event("vibration");} + void update(ItemStack s){super.updateUsingItem(s);}void complete(){super.completeUsingItem();}} + public static void main(String[] args)throws Exception{ + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();var u=Class.forName("sun.misc.Unsafe");unsafe=field(u,"theUnsafe").get(null);allocate=u.getMethod("allocateInstance",Class.class);useItem=field(LivingEntity.class,"useItem");remaining=field(LivingEntity.class,"useItemRemaining");kinetic=field(LivingEntity.class,"recentKineticEnemies");var tick=LivingEntity.class.getDeclaredMethod("updatingUsingItem");tick.setAccessible(true);var ctor=ItemStack.class.getDeclaredConstructor(Holder.class,int.class,PatchedDataComponentMap.class);ctor.setAccessible(true);Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var d=new Data();d.f=JsonParser.parseString(line).getAsJsonObject();d.out=out;d.actor=make(Actor.class);d.actor.d=d;d.levels=new Server[]{make(Server.class),make(Server.class)};for(int i=0;i<2;i++){d.levels[i].d=d;d.levels[i].id=i;}var a=make(CustomItem.class);a.d=d;a.id=0;var b=make(CustomItem.class);b.d=d;b.id=1;d.items=new ItemStack[]{(ItemStack)ctor.newInstance(Holder.direct(a),1,new PatchedDataComponentMap(DataComponentMap.EMPTY)),(ItemStack)ctor.newInstance(Holder.direct(d.f.get("shared_type").getAsBoolean()?a:b),1,new PatchedDataComponentMap(DataComponentMap.EMPTY)),ItemStack.EMPTY};for(int i=0;i<2;i++)if(d.f.getAsJsonArray("vibrations").get(i).getAsBoolean())d.items[i].set(DataComponents.USE_EFFECTS,new net.minecraft.world.item.component.UseEffects(false,true,1));d.reset(); + try{switch(d.f.get("mode").getAsString()){case "tick":try{tick.invoke(d.actor);}catch(InvocationTargetException e){if(e.getCause() instanceof Stop)throw new Stop();throw new AssertionError(e.getCause());}break;case "update":d.actor.update(d.items[d.f.get("argument").getAsInt()]);break;case "complete":d.actor.complete();break;case "release":d.actor.releaseUsingItem();break;case "stop":d.actor.stopUsingItem();break;default:throw new AssertionError();}out.println("result ok");}catch(Stop e){out.println("result error");}out.println("state "+d.snapshot()); + }} + } +} diff --git a/tools/test_item_use_lifecycle_parity.py b/tools/test_item_use_lifecycle_parity.py new file mode 100644 index 000000000..6ee8b59f4 --- /dev/null +++ b/tools/test_item_use_lifecycle_parity.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python3 +"""Compare native living item-use tick, release, completion and stop lifecycle.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + modes=['tick','update','complete','release','stop'] + ints=[-2147483648,-1,0,1,2,20,2147483647] + def state(**kw): + s=dict(item=0,remaining=1,virtual_remaining=1,kinetic=True,using=True,hand=0,hands=[0,1],level=0,clients=[False,True],releases=[False,True],finishes=[1,0]);s.update(kw);return s + def row(mode='tick',**kw): + f=dict(mode=mode,argument=0,shared_type=False,vibrations=[True,True],initial=state(),after=state(item=1,remaining=0,virtual_remaining=-1,hand=1,hands=[1,0],level=1),fail=-1,mutate_at=-1);f.update(kw);return f + for mode in modes: + for item in range(3): + for hand_item in range(3): + for remaining in ints: + for using in [False,True]: + for client in [False,True]: + for shared in [False,True]: + yield row(mode,argument=item,shared_type=shared,initial=state(item=item,hands=[hand_item,hand_item],remaining=remaining,virtual_remaining=remaining,using=using,clients=[client,client])) + for mutate in range(-1,25): + for fail in range(-1,25): + yield row(mode,mutate_at=mutate,fail=fail) + rng=random.Random(0x5553454c494645) + def random_state():return state(item=rng.randrange(3),remaining=rng.choice(ints),virtual_remaining=rng.choice(ints),kinetic=bool(rng.randrange(2)),using=bool(rng.randrange(2)),hand=rng.randrange(2),hands=[rng.randrange(3),rng.randrange(3)],level=rng.randrange(2),clients=[bool(rng.randrange(2)),bool(rng.randrange(2))],releases=[bool(rng.randrange(2)),bool(rng.randrange(2))],finishes=[rng.randrange(3),rng.randrange(3)]) + for _ in range(14000):yield row(rng.choice(modes),argument=rng.randrange(3),shared_type=bool(rng.randrange(2)),vibrations=[bool(rng.randrange(2)),bool(rng.randrange(2))],initial=random_state(),after=random_state(),fail=rng.choice([-1,-1,*range(25)]),mutate_at=rng.randrange(-1,25)) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-item-use-lifecycle-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemUseLifecycleOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/item_use_lifecycle_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaItemUseLifecycleOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','item_use_lifecycle_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('item_use_lifecycle_fixture.exe' if os.name=='nt' else 'item_use_lifecycle_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} item use lifecycle output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual LivingEntity private using-item tick, updateUsingItem, completeUsingItem, releaseUsingItem and stopUsingItem. Real ItemStack/UseEffects components call controlled custom item handlers; virtual level/hand queries and using flag updates are observed. Covers captured stack/level references, same-type versus stack-identity checks, callback mutations/failures, empty stacks, wrapping countdowns, returned item placement, finish vibration and kinetic-enemy-map presence. Starting use, actual synchronized flags, consumables/kinetic item effects, use remainders/cooldowns, full inventory/equipment and game tick integration remain pending.'} + lab.write_json(report_path,report);print(f'Scoped item use lifecycle parity passed: {report_path}') + + +if __name__=='__main__':main() From c45d0c7965d96d2e23ec186ab1655bdd6a1ecdb2 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 06:42:53 +0200 Subject: [PATCH 131/253] Match item-use start equipment synchronization and flag ordering --- .../scoped-parity.json | 266 ++++++++++++++++++ .../examples/item_use_start_fixture.rs | 247 ++++++++++++++++ crates/horizon-world/src/item_use_start.rs | 54 ++++ crates/horizon-world/src/lib.rs | 1 + docs/collision-geometry.md | 16 ++ docs/rust-parity.md | 3 +- .../parity/VanillaItemUseStartOracle.java | 39 +++ tools/test_item_use_start_parity.py | 73 +++++ 8 files changed, 698 insertions(+), 1 deletion(-) create mode 100644 benchmarks/rust-item-use-start-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/item_use_start_fixture.rs create mode 100644 crates/horizon-world/src/item_use_start.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemUseStartOracle.java create mode 100644 tools/test_item_use_start_parity.py diff --git a/benchmarks/rust-item-use-start-2026-10-07/scoped-parity.json b/benchmarks/rust-item-use-start-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..5f6b29136 --- /dev/null +++ b/benchmarks/rust-item-use-start-2026-10-07/scoped-parity.json @@ -0,0 +1,266 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 14886, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemUseStartOracle.java": "630ce7f2bea3915d3de64263c6a78c8f93caee71d72c519b788956eab46ce00a", + "tools/test_item_use_start_parity.py": "fdbd4054287457d60b862a307555d59d6ec43f0be86bf6b8a65eb9e88b3905a0", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "6884c7209f007ab9ee742b9c3c73828cfa1c6753d35b5fe25a87cab5955b33f8", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "18bbad377a8047e4d4ecd0fc87d83d46d1c0f1ce2b8c47bbe64633e7b4420b57", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/blocking_item_damage.rs": "9b1ae81c5bd0aea5982e03da1973f15fd46757354b8dd539bbd27449cff45e6a", + "crates/horizon-world/src/blocking_rules.rs": "83c5e2105cec56a90182ce582e1c67ade2b189be6de1a34d08035000cc07c492", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_immunity.rs": "fd39c41124d694e755cf7faadcf93c636df4042c78ec345092a856b5f952dbcf", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/damage_source.rs": "24945e397a926d34695652980923609e4723e02fe6b6e56d4aaf673e45d759f7", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/item_blocking.rs": "f6eee0d6d177cc3148960122327ba1b459a2f0e85241c1d9a3e40f0b8c169296", + "crates/horizon-world/src/item_durability.rs": "6a67fd660d771c59ffa9f4aa3225a25b56da31ea1079ca2efa4a915be6464179", + "crates/horizon-world/src/item_use.rs": "1d0a3afa61b60d356e81a063da79ec6cd38730315976640a591325fc4c8ab98c", + "crates/horizon-world/src/item_use_lifecycle.rs": "f9b29f42a528493d0d2521110d4f6e0bc89af8f579d539648cb7c3a9e68e31cd", + "crates/horizon-world/src/item_use_start.rs": "9996a9b90c313925cd90e78c02880f2a1d2ae65aef53f4ce081578a9dcd10c62", + "crates/horizon-world/src/lib.rs": "bcafb706cd8e2f905071828e1c9bfb536da348857f8c955599907bd7b85bd3f3", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "2b448209629b9bf2e678d667ad0d6c7fa22146892dd106b169d96b31b0df12bb", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_hurt.rs": "844239ad7d15c39629bb3cfc06ebae6d1cff20b7627468f26e0ee8dff3abdcb8", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_hurt.rs": "99c9bbd8587ec2dc287806049897b8034d2f5349ad47fc497b70d54148844a36", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/server_player_combat.rs": "a9743971581af86d926eeba42004d932caf83382c470dd98bf613cb9c417db58", + "crates/horizon-world/src/server_player_damage.rs": "828a4649fec3e9bda2dfe20aced8c95922c697321de2be4127bd4e5712ecbb7c", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "f417aab280331ddd6f0ca265a12c0130c78b9924f407c7e07f198140501e6010", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/view_direction.rs": "e18120ae26dc5cf702b29fc4c8487088bab133c8ce5abce01226833fafb0d5a4", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "74e4110fb19c4c4047192fd65c38015b8afc7f9fc50404d75380b5063808148c", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/item_use_start_fixture.rs": "80d62405d6cb626f86e23f9c6d6bc38441578674a8885e6e329ab85eb9993776" + }, + "fixtures_sha256": { + ".local/rust-item-use-start-parity/inputs.txt": "494e8b41f2336559f73fa4e6dad133614d9e240d8f44a51c416a348098c62701" + }, + "rust_output_sha256": "8268f65a5a4ac92739d7e8f6d3d8e287a48684e69ad4abbec18fa978d9606bff", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "8268f65a5a4ac92739d7e8f6d3d8e287a48684e69ad4abbec18fa978d9606bff", + "matched_output_lines": 84873 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "8268f65a5a4ac92739d7e8f6d3d8e287a48684e69ad4abbec18fa978d9606bff", + "matched_output_lines": 84873 + } + ], + "scope": "Actual inherited LivingEntity startUsingItem, native private equipment synchronization and ClientboundSetEquipmentPacket construction, item duration dispatch, using/offhand flag ordering, native UseEffects vibration and KineticWeapon presence. Covers captured held-stack/level/hand arguments, callback mutations/failures, empty stacks, client/server queries and recent-kinetic-map reset. Flag writes and delivery services are controlled; synchronized-data storage, wire encoding, kinetic combat, full inventory/equipment and game tick integration remain pending." +} diff --git a/crates/horizon-world/examples/item_use_start_fixture.rs b/crates/horizon-world/examples/item_use_start_fixture.rs new file mode 100644 index 000000000..19cb859f8 --- /dev/null +++ b/crates/horizon-world/examples/item_use_start_fixture.rs @@ -0,0 +1,247 @@ +use horizon_world::item_use_lifecycle::{UseLifecycleWorld, UseState}; +use horizon_world::item_use_start::{self, StartUseWorld}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +struct World<'a> { + f: &'a Value, + out: &'a mut dyn Write, + calls: i64, + changed: bool, + using: bool, + hands: [usize; 2], + off: bool, + kinetic_count: i32, +} +impl World<'_> { + fn state(&self) -> &Value { + &self.f[if self.changed { "after" } else { "initial" }] + } + fn reset(&mut self, s: &mut UseState) { + s.item = self.state()["item"].as_u64().unwrap() as usize; + s.remaining = self.state()["remaining"].as_i64().unwrap() as i32; + s.has_recent_kinetic_enemies = self.state()["kinetic"].as_bool().unwrap(); + self.using = self.state()["using"].as_bool().unwrap(); + self.off = self.state()["off"].as_bool().unwrap(); + self.kinetic_count = if s.has_recent_kinetic_enemies { 1 } else { -1 }; + self.hands = std::array::from_fn(|i| self.state()["hands"][i].as_u64().unwrap() as usize); + } + fn event(&mut self, s: &mut UseState, name: &str) -> io::Result<()> { + writeln!(self.out, "{name}")?; + let n = self.calls; + self.calls += 1; + if n == self.f["fail"].as_i64().unwrap() { + return Err(io::Error::other("injected lifecycle failure")); + } + if n == self.f["mutate_at"].as_i64().unwrap() { + self.changed = true; + self.reset(s); + } + Ok(()) + } + fn kind(&self, item: usize) -> usize { + if item == 1 && self.f["shared_type"].as_bool().unwrap() { + 0 + } else { + item + } + } +} +impl UseLifecycleWorld for World<'_> { + type Error = io::Error; + type Item = usize; + type Hand = usize; + type Level = usize; + fn empty_item(&self) -> usize { + 2 + } + fn is_empty(&self, item: usize) -> bool { + item == 2 + } + fn same_item_type(&self, a: usize, b: usize) -> bool { + self.kind(a) == self.kind(b) + } + fn using_item(&mut self, s: &mut UseState) -> io::Result { + self.event(s, "using")?; + Ok(self.using) + } + fn used_hand(&mut self, s: &mut UseState) -> io::Result { + self.event(s, "hand")?; + Ok(self.state()["hand"].as_u64().unwrap() as usize) + } + fn hand_item(&mut self, s: &mut UseState, hand: usize) -> io::Result { + self.event(s, &format!("get-hand {hand}"))?; + Ok(self.hands[hand]) + } + fn set_hand_item( + &mut self, + s: &mut UseState, + hand: usize, + item: usize, + ) -> io::Result<()> { + self.event(s, &format!("set-hand {hand} {item}"))?; + self.hands[hand] = item; + Ok(()) + } + fn level(&mut self, s: &mut UseState) -> io::Result { + self.event(s, "level")?; + Ok(self.state()["level"].as_u64().unwrap() as usize) + } + fn is_client(&mut self, s: &mut UseState, level: usize) -> io::Result { + self.event(s, &format!("client {level}"))?; + Ok(self.state()["clients"][level].as_bool().unwrap()) + } + fn remaining_ticks(&mut self, s: &mut UseState) -> io::Result { + self.event(s, "remaining")?; + Ok(self.state()["virtual_remaining"].as_i64().unwrap() as i32) + } + fn item_tick( + &mut self, + s: &mut UseState, + item: usize, + level: usize, + remaining: i32, + ) -> io::Result<()> { + let kind = self.kind(item); + if kind == 2 { + return Ok(()); + } + self.event(s, &format!("tick {kind} {item} {level} {remaining}")) + } + fn use_on_release(&mut self, s: &mut UseState, item: usize) -> io::Result { + let kind = self.kind(item); + if kind == 2 { + return Ok(false); + } + self.event(s, &format!("release-query {kind} {item}"))?; + Ok(self.state()["releases"][kind].as_bool().unwrap()) + } + fn release_item( + &mut self, + s: &mut UseState, + item: usize, + level: usize, + remaining: i32, + ) -> io::Result<()> { + let kind = self.kind(item); + if kind == 2 { + return Ok(()); + } + self.event(s, &format!("release {kind} {item} {level} {remaining}")) + } + fn finish_item( + &mut self, + s: &mut UseState, + item: usize, + level: usize, + ) -> io::Result { + let kind = self.kind(item); + if kind == 2 { + return Ok(item); + } + self.event(s, &format!("finish {kind} {item} {level}"))?; + Ok(self.state()["finishes"][kind].as_u64().unwrap() as usize) + } + fn set_using_flag(&mut self, s: &mut UseState, using: bool) -> io::Result<()> { + self.event(s, &format!("flag 1 {using}"))?; + self.using = using; + Ok(()) + } + fn finish_vibration(&mut self, s: &mut UseState, item: usize) -> io::Result<()> { + if item < 2 && self.f["vibrations"][item].as_bool().unwrap() { + self.event(s, "vibration")?; + } + Ok(()) + } +} +impl StartUseWorld for World<'_> { + fn duration(&mut self, s: &mut UseState, item: usize) -> io::Result { + let kind = self.kind(item); + if kind == 2 { + return Ok(0); + } + self.event(s, &format!("duration {kind} {item}"))?; + Ok(self.state()["durations"][kind].as_i64().unwrap() as i32) + } + fn synchronize_equipment( + &mut self, + s: &mut UseState, + level: usize, + hand: usize, + item: usize, + ) -> io::Result<()> { + self.event(s, &format!("chunks {level}"))?; + self.event(s, "id")?; + self.event(s, &format!("equipment {level} {hand} {item} 17")) + } + fn is_off_hand(&self, hand: usize) -> bool { + hand == 1 + } + fn set_off_hand_flag(&mut self, s: &mut UseState, off: bool) -> io::Result<()> { + self.event(s, &format!("flag 2 {off}"))?; + self.off = off; + Ok(()) + } + fn start_vibration(&mut self, s: &mut UseState, item: usize) -> io::Result<()> { + if item < 2 && self.f["vibrations"][item].as_bool().unwrap() { + self.event(s, "vibration-start")?; + } + Ok(()) + } + fn has_kinetic_weapon(&self, item: usize) -> bool { + item < 2 && self.f["kinetic_items"][item].as_bool().unwrap() + } + fn reset_recent_kinetic_enemies(&mut self, s: &mut UseState) { + s.has_recent_kinetic_enemies = true; + self.kinetic_count = 0; + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut s = UseState { + item: 2, + remaining: 0, + has_recent_kinetic_enemies: false, + }; + let mut w = World { + f: &f, + out: &mut out, + calls: 0, + changed: false, + using: false, + hands: [2, 2], + off: false, + kinetic_count: -1, + }; + w.reset(&mut s); + let result = + item_use_start::start(&mut w, &mut s, f["start_hand"].as_u64().unwrap() as usize); + writeln!( + w.out, + "result {}", + if result.is_ok() { "ok" } else { "error" } + )?; + writeln!( + w.out, + "state {} {} {} {} {} {} {} {} {} {}", + s.item, + s.remaining, + s.has_recent_kinetic_enemies, + w.using, + w.hands[0], + w.hands[1], + w.calls, + w.changed, + w.off, + w.kinetic_count + )?; + } + Ok(()) +} diff --git a/crates/horizon-world/src/item_use_start.rs b/crates/horizon-world/src/item_use_start.rs new file mode 100644 index 000000000..594046a30 --- /dev/null +++ b/crates/horizon-world/src/item_use_start.rs @@ -0,0 +1,54 @@ +//! Begin using a held stack, retaining native callback and flag ordering. +use crate::item_use_lifecycle::{UseLifecycleWorld, UseState}; +pub trait StartUseWorld: UseLifecycleWorld { + fn duration( + &mut self, + s: &mut UseState, + item: Self::Item, + ) -> Result; + fn synchronize_equipment( + &mut self, + s: &mut UseState, + level: Self::Level, + hand: Self::Hand, + item: Self::Item, + ) -> Result<(), Self::Error>; + fn is_off_hand(&self, hand: Self::Hand) -> bool; + fn set_off_hand_flag( + &mut self, + s: &mut UseState, + off: bool, + ) -> Result<(), Self::Error>; + fn start_vibration( + &mut self, + s: &mut UseState, + item: Self::Item, + ) -> Result<(), Self::Error>; + fn has_kinetic_weapon(&self, item: Self::Item) -> bool; + fn reset_recent_kinetic_enemies(&mut self, s: &mut UseState); +} +pub fn start( + w: &mut W, + s: &mut UseState, + hand: W::Hand, +) -> Result<(), W::Error> { + let item = w.hand_item(s, hand)?; + if w.is_empty(item) || w.using_item(s)? { + return Ok(()); + } + s.item = item; + s.remaining = w.duration(s, item)?; + let level = w.level(s)?; + if !w.is_client(s, level)? { + let level = w.level(s)?; + w.synchronize_equipment(s, level, hand, s.item)?; + w.set_using_flag(s, true)?; + let off = w.is_off_hand(hand); + w.set_off_hand_flag(s, off)?; + w.start_vibration(s, s.item)?; + if w.has_kinetic_weapon(s.item) { + w.reset_recent_kinetic_enemies(s); + } + } + Ok(()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index dc6fa7ad8..072215b7d 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -48,6 +48,7 @@ pub mod item_blocking; pub mod item_durability; pub mod item_use; pub mod item_use_lifecycle; +pub mod item_use_start; pub mod liquid_collision; pub mod living_air; pub mod living_damage; diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index add58b7c3..cd020074b 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1561,3 +1561,19 @@ kinetic-map presence and callback mutation/failure ordering. Targeted Clippy passes. Starting use, actual synchronized flags, consumable/kinetic effects, remainder/cooldown components and full inventory/game-tick integration remain pending. + + +`item_use_start` starts use from a captured held stack, writes the returned +duration after its callback, synchronizes equipment before changing using/offhand +flags, emits the component's start vibration and resets recent kinetic enemies +when the final active stack has a kinetic-weapon component. + +`python3 tools/test_item_use_start_parity.py` compares inherited native +startUsingItem and its private equipment packet construction. The +[start-use report](../benchmarks/rust-item-use-start-2026-10-07/scoped-parity.json) +records **84,873 matching lines per JAR**, including captured stack/level/hand +arguments, empty stacks, callback mutation/failure ordering, flag writes, native +UseEffects/KineticWeapon presence and clearing a populated kinetic-enemy map. +Targeted Clippy passes; all 20 existing horizon-world library tests pass with +these changes. Synchronized flag storage, packet encoding/delivery, kinetic +combat and complete inventory/game-tick integration remain pending. diff --git a/docs/rust-parity.md b/docs/rust-parity.md index 12f2e8e8c..8d5c284ac 100644 --- a/docs/rust-parity.md +++ b/docs/rust-parity.md @@ -11,7 +11,8 @@ resident sections, scheduled tick ordering, geometry, contained fluid states, noise/density evaluation, biome and terrain generation kernels, material rules, and parts of feature placement and decoration. Movement/fluid interactions, registered attributes, hunger storage/ticks, synchronized player health and -absorption, damage reduction and outer hurt gates have scoped native comparisons. +absorption, damage reduction, outer hurt gates, blocking-item damage, item +durability and item-use start/tick/release/completion have scoped native comparisons. These kernels still need complete entity/world lifecycle bindings. All pinned block-survival families now have native differential coverage. Full simulation callbacks, complete chunk generation, entity behavior, networking, rendering and playable diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemUseStartOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemUseStartOracle.java new file mode 100644 index 000000000..24041611c --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemUseStartOracle.java @@ -0,0 +1,39 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.lang.reflect.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.*;import net.minecraft.core.component.*;import net.minecraft.world.entity.*;import net.minecraft.world.item.*;import net.minecraft.world.InteractionHand;import net.minecraft.world.level.*;import net.minecraft.world.level.gameevent.GameEvent;import net.minecraft.server.level.*; +/** Actual inherited startUsingItem with native equipment packet construction. */ +public final class VanillaItemUseStartOracle { + static final class Stop extends RuntimeException {} + static Object unsafe;static Method allocate;static Field useItem,remaining,kinetic; + static T make(Class c)throws Exception{return c.cast(allocate.invoke(unsafe,c));} + static Field field(Class c,String n)throws Exception{var f=c.getDeclaredField(n);f.setAccessible(true);return f;} + static final class Data {JsonObject f;PrintWriter out;int calls;boolean changed,using,off;Entity enemy;Actor actor;ItemStack[] items,hands;Server[] levels;Chunks[] chunks; + JsonObject state(){return f.getAsJsonObject(changed?"after":"initial");} + void reset(){try{var s=state();useItem.set(actor,items[s.get("item").getAsInt()]);remaining.setInt(actor,s.get("remaining").getAsInt());kinetic.set(actor,s.get("kinetic").getAsBoolean()?new it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<>():null);using=s.get("using").getAsBoolean();off=s.get("off").getAsBoolean();if(kinetic.get(actor)!=null)((it.unimi.dsi.fastutil.objects.Object2LongMap)kinetic.get(actor)).put(enemy,99L);hands=new ItemStack[]{items[s.getAsJsonArray("hands").get(0).getAsInt()],items[s.getAsJsonArray("hands").get(1).getAsInt()]};}catch(Exception e){throw new AssertionError(e);}} + void event(String name){out.println(name);int n=calls++;if(n==f.get("fail").getAsInt())throw new Stop();if(n==f.get("mutate_at").getAsInt()){changed=true;reset();}} + int id(ItemStack s){for(int i=0;i)kinetic.get(actor)).size());}catch(Exception e){throw new AssertionError(e);}}} + static final class Chunks extends ServerChunkCache {Data d;int id;Chunks(){super(null,null,null,null,null,null,0,0,false,null);}@Override public void sendToTrackingPlayers(Entity e,net.minecraft.network.protocol.Packet packet){var p=(net.minecraft.network.protocol.game.ClientboundSetEquipmentPacket)packet;var entry=p.getSlots().getFirst();d.event("equipment "+id+" "+(entry.getFirst()==EquipmentSlot.MAINHAND?0:1)+" "+d.id(entry.getSecond())+" "+p.getEntity());}} + static final class Server extends ServerLevel {Data d;int id;Server(){super(null,null,null,null,null,null,false,0L,List.of(),false);}@Override public ServerChunkCache getChunkSource(){d.event("chunks "+id);return d.chunks[id];}@Override public boolean isClientSide(){d.event("client "+id);return d.state().getAsJsonArray("clients").get(id).getAsBoolean();}} + static final class CustomItem extends Item {Data d;int id;CustomItem(){super(null);}@Override public int getUseDuration(ItemStack s,LivingEntity e){d.event("duration "+id+" "+d.id(s));return d.state().getAsJsonArray("durations").get(id).getAsInt();} + @Override public void onUseTick(Level l,LivingEntity a,ItemStack s,int remaining){d.event("tick "+id+" "+d.id(s)+" "+((Server)l).id+" "+remaining);} + @Override public boolean useOnRelease(ItemStack s){d.event("release-query "+id+" "+d.id(s));return d.state().getAsJsonArray("releases").get(id).getAsBoolean();} + @Override public boolean releaseUsing(ItemStack s,Level l,LivingEntity a,int remaining){d.event("release "+id+" "+d.id(s)+" "+((Server)l).id+" "+remaining);return false;} + @Override public ItemStack finishUsingItem(ItemStack s,Level l,LivingEntity a){d.event("finish "+id+" "+d.id(s)+" "+((Server)l).id);return d.items[d.state().getAsJsonArray("finishes").get(id).getAsInt()];}} + static final class Actor extends net.minecraft.world.entity.decoration.ArmorStand {Data d;Actor(){super(null,null);}@Override public int getId(){d.event("id");return 17;} + @Override public boolean isUsingItem(){d.event("using");return d.using;} + @Override public InteractionHand getUsedItemHand(){d.event("hand");return InteractionHand.values()[d.state().get("hand").getAsInt()];} + @Override public ItemStack getItemInHand(InteractionHand h){d.event("get-hand "+h.ordinal());return d.hands[h.ordinal()];} + @Override public void setItemInHand(InteractionHand h,ItemStack s){d.event("set-hand "+h.ordinal()+" "+d.id(s));d.hands[h.ordinal()]=s;} + @Override public ServerLevel level(){d.event("level");return d.levels[d.state().get("level").getAsInt()];} + @Override public int getUseItemRemainingTicks(){d.event("remaining");return d.state().get("virtual_remaining").getAsInt();} + @Override protected void setLivingEntityFlag(int flag,boolean value){d.event("flag "+flag+" "+value);if(flag==1)d.using=value;else if(flag==2)d.off=value;else throw new AssertionError();} + @Override public void gameEvent(Holder event){if(event!=GameEvent.ITEM_INTERACT_START)throw new AssertionError();d.event("vibration-start");} + void update(ItemStack s){super.updateUsingItem(s);}void complete(){super.completeUsingItem();}} + public static void main(String[] args)throws Exception{ + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();var u=Class.forName("sun.misc.Unsafe");unsafe=field(u,"theUnsafe").get(null);allocate=u.getMethod("allocateInstance",Class.class);useItem=field(LivingEntity.class,"useItem");remaining=field(LivingEntity.class,"useItemRemaining");kinetic=field(LivingEntity.class,"recentKineticEnemies");var tick=LivingEntity.class.getDeclaredMethod("updatingUsingItem");tick.setAccessible(true);var ctor=ItemStack.class.getDeclaredConstructor(Holder.class,int.class,PatchedDataComponentMap.class);ctor.setAccessible(true);Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var d=new Data();d.f=JsonParser.parseString(line).getAsJsonObject();d.out=out;d.enemy=make(net.minecraft.world.entity.decoration.ArmorStand.class);d.enemy.setId(99);d.actor=make(Actor.class);d.actor.d=d;d.chunks=new Chunks[]{make(Chunks.class),make(Chunks.class)};for(int i=0;i<2;i++){d.chunks[i].d=d;d.chunks[i].id=i;}d.levels=new Server[]{make(Server.class),make(Server.class)};for(int i=0;i<2;i++){d.levels[i].d=d;d.levels[i].id=i;}var a=make(CustomItem.class);a.d=d;a.id=0;var b=make(CustomItem.class);b.d=d;b.id=1;d.items=new ItemStack[]{(ItemStack)ctor.newInstance(Holder.direct(a),1,new PatchedDataComponentMap(DataComponentMap.EMPTY)),(ItemStack)ctor.newInstance(Holder.direct(d.f.get("shared_type").getAsBoolean()?a:b),1,new PatchedDataComponentMap(DataComponentMap.EMPTY)),ItemStack.EMPTY};for(int i=0;i<2;i++)if(d.f.getAsJsonArray("vibrations").get(i).getAsBoolean())d.items[i].set(DataComponents.USE_EFFECTS,new net.minecraft.world.item.component.UseEffects(false,true,1));for(int i=0;i<2;i++)if(d.f.getAsJsonArray("kinetic_items").get(i).getAsBoolean())d.items[i].set(DataComponents.KINETIC_WEAPON,new net.minecraft.world.item.component.KineticWeapon(0,0,Optional.empty(),Optional.empty(),Optional.empty(),0,0,Optional.empty(),Optional.empty()));d.reset(); + try{d.actor.startUsingItem(InteractionHand.values()[d.f.get("start_hand").getAsInt()]);out.println("result ok");}catch(Stop e){out.println("result error");}out.println("state "+d.snapshot()); + }} + } +} diff --git a/tools/test_item_use_start_parity.py b/tools/test_item_use_start_parity.py new file mode 100644 index 000000000..abc7f9aa8 --- /dev/null +++ b/tools/test_item_use_start_parity.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python3 +"""Compare native startUsingItem equipment, timer and flag ordering.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + ints=[-2147483648,-1,0,1,2,20,72000,2147483647] + def state(**kw): + s=dict(item=2,remaining=3,virtual_remaining=1,kinetic=True,using=False,off=False,hand=0,hands=[0,1],level=0,clients=[False,True],releases=[False,True],finishes=[1,0],durations=[72000,20]);s.update(kw);return s + def row(**kw): + f=dict(start_hand=0,shared_type=False,vibrations=[True,True],kinetic_items=[True,False],initial=state(),after=state(item=1,remaining=0,off=True,using=False,hand=1,hands=[1,0],level=1,clients=[False,False],durations=[5,9]),fail=-1,mutate_at=-1);f.update(kw);return f + for item in range(3): + for held in range(3): + for hand in range(2): + for duration in ints: + for using in [False,True]: + for client in [False,True]: + for shared in [False,True]: + yield row(start_hand=hand,shared_type=shared,initial=state(item=item,hands=[held,held],durations=[duration,duration],using=using,clients=[client,client])) + for mutate in range(-1,16): + for fail in range(-1,16): + for item in range(3): + for kinetic in [False,True]:yield row(mutate_at=mutate,fail=fail,after=state(item=item,kinetic=kinetic,durations=[9,5])) + rng=random.Random(0x5553455354415254) + def random_state():return state(item=rng.randrange(3),remaining=rng.choice(ints),virtual_remaining=rng.choice(ints),kinetic=bool(rng.randrange(2)),using=bool(rng.randrange(2)),off=bool(rng.randrange(2)),hand=rng.randrange(2),hands=[rng.randrange(3),rng.randrange(3)],level=rng.randrange(2),clients=[bool(rng.randrange(2)),bool(rng.randrange(2))],durations=[rng.choice(ints),rng.choice(ints)]) + for _ in range(12000):yield row(start_hand=rng.randrange(2),shared_type=bool(rng.randrange(2)),vibrations=[bool(rng.randrange(2)),bool(rng.randrange(2))],kinetic_items=[bool(rng.randrange(2)),bool(rng.randrange(2))],initial=random_state(),after=random_state(),fail=rng.choice([-1,-1,*range(16)]),mutate_at=rng.randrange(-1,16)) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-item-use-start-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemUseStartOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/item_use_start_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaItemUseStartOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','item_use_start_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('item_use_start_fixture.exe' if os.name=='nt' else 'item_use_start_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} item use start output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual inherited LivingEntity startUsingItem, native private equipment synchronization and ClientboundSetEquipmentPacket construction, item duration dispatch, using/offhand flag ordering, native UseEffects vibration and KineticWeapon presence. Covers captured held-stack/level/hand arguments, callback mutations/failures, empty stacks, client/server queries and recent-kinetic-map reset. Flag writes and delivery services are controlled; synchronized-data storage, wire encoding, kinetic combat, full inventory/equipment and game tick integration remain pending.'} + lab.write_json(report_path,report);print(f'Scoped item use start parity passed: {report_path}') + + +if __name__=='__main__':main() From 5d8ad5fc3ab00e98edefffab0c13e90eaa5161a6 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 06:58:53 +0200 Subject: [PATCH 132/253] Bind registered item defaults to use and durability behavior --- .../scoped-parity.json | 269 ++++++++++++++++++ .../examples/item_use_catalog_fixture.rs | 73 +++++ crates/horizon-world/src/item_use_catalog.rs | 239 ++++++++++++++++ crates/horizon-world/src/lib.rs | 1 + docs/collision-geometry.md | 17 ++ .../parity/VanillaItemUseCatalogOracle.java | 28 ++ tools/test_item_use_catalog_parity.py | 79 +++++ 7 files changed, 706 insertions(+) create mode 100644 benchmarks/rust-item-use-catalog-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/item_use_catalog_fixture.rs create mode 100644 crates/horizon-world/src/item_use_catalog.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemUseCatalogOracle.java create mode 100644 tools/test_item_use_catalog_parity.py diff --git a/benchmarks/rust-item-use-catalog-2026-10-07/scoped-parity.json b/benchmarks/rust-item-use-catalog-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..597c4d1bd --- /dev/null +++ b/benchmarks/rust-item-use-catalog-2026-10-07/scoped-parity.json @@ -0,0 +1,269 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 18836, + "registered_items": 1658, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemUseCatalogOracle.java": "f54a19d9544d53484d103722fa3f4b24462eb77650499f1b2323d152902c821b", + "tools/test_item_use_catalog_parity.py": "b33aa8f2480ca9d7ddfc946a2e43a245239930704ba1167d2f451f1a7c7f1691", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "6884c7209f007ab9ee742b9c3c73828cfa1c6753d35b5fe25a87cab5955b33f8", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "18bbad377a8047e4d4ecd0fc87d83d46d1c0f1ce2b8c47bbe64633e7b4420b57", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/blocking_item_damage.rs": "9b1ae81c5bd0aea5982e03da1973f15fd46757354b8dd539bbd27449cff45e6a", + "crates/horizon-world/src/blocking_rules.rs": "83c5e2105cec56a90182ce582e1c67ade2b189be6de1a34d08035000cc07c492", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_immunity.rs": "fd39c41124d694e755cf7faadcf93c636df4042c78ec345092a856b5f952dbcf", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/damage_source.rs": "24945e397a926d34695652980923609e4723e02fe6b6e56d4aaf673e45d759f7", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/item_blocking.rs": "f6eee0d6d177cc3148960122327ba1b459a2f0e85241c1d9a3e40f0b8c169296", + "crates/horizon-world/src/item_durability.rs": "6a67fd660d771c59ffa9f4aa3225a25b56da31ea1079ca2efa4a915be6464179", + "crates/horizon-world/src/item_use.rs": "1d0a3afa61b60d356e81a063da79ec6cd38730315976640a591325fc4c8ab98c", + "crates/horizon-world/src/item_use_catalog.rs": "a9b53d2e816583239a75c3c61e78dacc5e3b27dee595be34b1c7fa169f17a571", + "crates/horizon-world/src/item_use_lifecycle.rs": "f9b29f42a528493d0d2521110d4f6e0bc89af8f579d539648cb7c3a9e68e31cd", + "crates/horizon-world/src/item_use_start.rs": "9996a9b90c313925cd90e78c02880f2a1d2ae65aef53f4ce081578a9dcd10c62", + "crates/horizon-world/src/lib.rs": "261efcad4395e057c632d9b3041081f8dc7633b748e5ef4229d3a8677461aaec", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "2b448209629b9bf2e678d667ad0d6c7fa22146892dd106b169d96b31b0df12bb", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_hurt.rs": "844239ad7d15c39629bb3cfc06ebae6d1cff20b7627468f26e0ee8dff3abdcb8", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_hurt.rs": "99c9bbd8587ec2dc287806049897b8034d2f5349ad47fc497b70d54148844a36", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/server_player_combat.rs": "a9743971581af86d926eeba42004d932caf83382c470dd98bf613cb9c417db58", + "crates/horizon-world/src/server_player_damage.rs": "828a4649fec3e9bda2dfe20aced8c95922c697321de2be4127bd4e5712ecbb7c", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "f417aab280331ddd6f0ca265a12c0130c78b9924f407c7e07f198140501e6010", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/view_direction.rs": "e18120ae26dc5cf702b29fc4c8487088bab133c8ce5abce01226833fafb0d5a4", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "74e4110fb19c4c4047192fd65c38015b8afc7f9fc50404d75380b5063808148c", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/item_use_catalog_fixture.rs": "630427d080ebcdbb14528ebba3176e70e52b0dc58057d1dd6539cc4c5907b0d7" + }, + "fixtures_sha256": { + ".local/rust-item-use-catalog-parity/inputs.txt": "e2554974193c9ca6eaf6d0dca1d18a795c6bcb687f73c4c3fb6c293d4c47404a", + ".local/rust-item-use-catalog-parity/catalog.json": "0eda211435c02f7bc2dc248f86ebd0e6a9a941e906663ddf712a981b42d6efa9" + }, + "rust_output_sha256": "8bde2160d339d0828fa4456022aa43f4b95aa2ffe30e3846f2644e662ce9af6a", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "8bde2160d339d0828fa4456022aa43f4b95aa2ffe30e3846f2644e662ce9af6a", + "matched_output_lines": 246715 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "8bde2160d339d0828fa4456022aa43f4b95aa2ffe30e3846f2644e662ce9af6a", + "matched_output_lines": 246715 + } + ], + "scope": "All 1658 built-in item identities with bound native default component maps. Parsed exports from both JARs agree; Rust imports the component projection for stack size, durability and item-use duration/release behavior. Native ItemStack queries cover every default plus component/count mutations, empty/air behavior, registered method overrides, consumable truncation versus instrument flooring, integer and float boundaries. Other item components, arbitrary component codecs, full inventory/equipment, enchantment effects and gameplay integration remain pending." +} diff --git a/crates/horizon-world/examples/item_use_catalog_fixture.rs b/crates/horizon-world/examples/item_use_catalog_fixture.rs new file mode 100644 index 000000000..406ba521d --- /dev/null +++ b/crates/horizon-world/examples/item_use_catalog_fixture.rs @@ -0,0 +1,73 @@ +use horizon_world::item_use_catalog::{ItemUseCatalog, ItemUseStack}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn float(v: &Value) -> Option { + v.as_str() + .map(|s| f32::from_bits(u32::from_str_radix(s, 16).unwrap())) +} +fn snapshot(out: &mut dyn Write, s: &ItemUseStack<'_>) -> io::Result<()> { + let d = s.durability(); + writeln!( + out, + "stack {} {} {} {} {} {} {} {} {} {} {} {} {}", + if s.is_empty() { + 0 + } else { + s.definition().id().raw() + }, + d.count(), + s.max_stack_size(), + d.max_damage(), + d.damage(), + s.is_empty(), + d.is_damageable(), + d.is_damaged(), + d.is_broken(), + d.next_damage_will_break(), + s.is_stackable(), + s.use_duration(), + s.use_on_release() + ) +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let catalog = ItemUseCatalog::from_json(&serde_json::from_str(&fs::read_to_string( + dir.join("catalog.json"), + )?)?)?; + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let mut s = catalog + .by_name(f["name"].as_str().unwrap()) + .unwrap() + .stack(f["count"].as_i64().unwrap() as i32); + snapshot(&mut out, &s)?; + for op in f["ops"].as_array().unwrap() { + let v = &op["value"]; + match op["kind"].as_str().unwrap() { + "count" => s.count = v.as_i64().unwrap() as i32, + "set-damage" => { + let mut d = s.durability(); + d.set_damage(v.as_i64().unwrap() as i32); + s.components.damage = d.damage; + } + "damage" => s.components.damage = v.as_i64().map(|v| v as i32), + "max-damage" => s.components.max_damage = v.as_i64().map(|v| v as i32), + "max-stack" => s.components.max_stack_size = v.as_i64().map(|v| v as i32), + "unbreakable" => s.components.unbreakable = v.as_bool().unwrap(), + "consume" => s.components.consume_seconds = float(v), + "blocking" => s.components.block_delay_seconds = float(v), + "kinetic" => s.components.kinetic_weapon = v.as_bool().unwrap(), + "instrument" => s.components.instrument_seconds = float(v), + _ => panic!("operation"), + }; + snapshot(&mut out, &s)?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/src/item_use_catalog.rs b/crates/horizon-world/src/item_use_catalog.rs new file mode 100644 index 000000000..943099692 --- /dev/null +++ b/crates/horizon-world/src/item_use_catalog.rs @@ -0,0 +1,239 @@ +//! Version-pinned registered item identities and the component projection used +//! by duration/durability queries. Unrepresented components remain outside this +//! catalog; importing defaults does not implement their gameplay or codecs. +use crate::{DATA_VERSION, compression::invalid, item_durability::DurabilityStack}; +use serde_json::Value; +use std::{collections::BTreeMap, io}; +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct ItemId(u32); +impl ItemId { + pub fn raw(self) -> u32 { + self.0 + } +} +#[derive(Clone, Copy, Debug)] +enum Duration { + Components, + Constant(i32), + Instrument, +} +#[derive(Clone, Copy, Debug)] +pub struct UseComponents { + pub max_stack_size: Option, + pub max_damage: Option, + pub damage: Option, + pub unbreakable: bool, + pub consume_seconds: Option, + pub block_delay_seconds: Option, + pub kinetic_weapon: bool, + pub instrument_seconds: Option, +} +#[derive(Debug)] +pub struct ItemDefinition { + id: ItemId, + name: String, + duration: Duration, + crossbow_release: bool, + pub defaults: UseComponents, +} +impl ItemDefinition { + pub fn id(&self) -> ItemId { + self.id + } + pub fn name(&self) -> &str { + &self.name + } + pub fn stack(&self, count: i32) -> ItemUseStack<'_> { + ItemUseStack { + definition: self, + count, + components: self.defaults, + } + } +} +#[derive(Clone, Debug)] +pub struct ItemUseStack<'a> { + definition: &'a ItemDefinition, + pub count: i32, + pub components: UseComponents, +} +impl ItemUseStack<'_> { + pub fn definition(&self) -> &ItemDefinition { + self.definition + } + pub fn is_empty(&self) -> bool { + self.count <= 0 || self.definition.name == "minecraft:air" + } + pub fn max_stack_size(&self) -> i32 { + if self.is_empty() { + 1 + } else { + self.components.max_stack_size.unwrap_or(1) + } + } + pub fn durability(&self) -> DurabilityStack { + DurabilityStack { + count: self.count, + air: self.definition.name == "minecraft:air", + max_damage: self.components.max_damage, + damage: self.components.damage, + unbreakable: self.components.unbreakable, + } + } + pub fn is_stackable(&self) -> bool { + let d = self.durability(); + self.max_stack_size() > 1 && (!d.is_damageable() || !d.is_damaged()) + } + pub fn use_duration(&self) -> i32 { + if self.is_empty() { + return 0; + } + match self.definition.duration { + Duration::Constant(value) => value, + Duration::Instrument => self + .components + .instrument_seconds + .map_or(0, |v| (v * 20.0).floor() as i32), + Duration::Components => { + if let Some(seconds) = self.components.consume_seconds { + (seconds * 20.0) as i32 + } else if self.components.block_delay_seconds.is_some() + || self.components.kinetic_weapon + { + 72000 + } else { + 0 + } + } + } + } + pub fn use_on_release(&self) -> bool { + !self.is_empty() && self.definition.crossbow_release + } +} +#[derive(Debug)] +pub struct ItemUseCatalog { + items: Vec, + names: BTreeMap, +} +fn string<'a>(v: &'a Value, key: &str) -> io::Result<&'a str> { + v[key] + .as_str() + .ok_or_else(|| invalid(format!("missing item export string {key}"))) +} +fn optional_int(v: &Value, key: &str) -> io::Result> { + v.get(key) + .map(|v| { + v.as_i64() + .and_then(|n| i32::try_from(n).ok()) + .ok_or_else(|| invalid(format!("invalid item integer {key}"))) + }) + .transpose() +} +fn number(v: &Value, key: &str, default: f32) -> io::Result { + v.get(key).map_or(Ok(default), |v| { + v.as_f64() + .map(|n| n as f32) + .ok_or_else(|| invalid(format!("invalid item number {key}"))) + }) +} +impl ItemUseCatalog { + pub fn from_json(value: &Value) -> io::Result { + if value["schema"].as_i64() != Some(1) + || value["DataVersion"].as_i64() != Some(i64::from(DATA_VERSION)) + { + return Err(invalid("item catalog version mismatch")); + } + let rows = value["items"] + .as_array() + .ok_or_else(|| invalid("missing item catalog entries"))?; + let instruments = value["instruments"] + .as_object() + .ok_or_else(|| invalid("missing item instruments"))?; + let mut items = Vec::with_capacity(rows.len()); + let mut names = BTreeMap::new(); + for (index, row) in rows.iter().enumerate() { + let raw = u32::try_from(index).map_err(|_| invalid("item catalog too large"))?; + if row["id"].as_u64() != Some(u64::from(raw)) { + return Err(invalid("non-contiguous item catalog ID")); + } + let name = string(row, "name")?; + if crate::worldgen::tags::identifier(name).ok().as_deref() != Some(name) { + return Err(invalid("noncanonical item identifier")); + } + let id = ItemId(raw); + if names.insert(name.to_owned(), id).is_some() { + return Err(invalid("duplicate item identifier")); + } + let duration = match string(row, "duration_impl")? { + "Item" => Duration::Components, + "BowItem" | "CrossbowItem" | "TridentItem" => Duration::Constant(72000), + "BundleItem" | "BrushItem" => Duration::Constant(200), + "SpyglassItem" => Duration::Constant(1200), + "EnderEyeItem" => Duration::Constant(0), + "InstrumentItem" => Duration::Instrument, + _ => return Err(invalid("unsupported item duration implementation")), + }; + let crossbow_release = match string(row, "release_impl")? { + "Item" => false, + "CrossbowItem" => true, + _ => return Err(invalid("unsupported release implementation")), + }; + let c = row + .get("components") + .filter(|c| c.is_object()) + .ok_or_else(|| invalid("missing item component defaults"))?; + let instrument_seconds = c + .get("minecraft:instrument") + .map(|v| { + let name = v + .as_str() + .ok_or_else(|| invalid("expected exported instrument reference"))?; + let bits = instruments + .get(name) + .and_then(Value::as_str) + .ok_or_else(|| invalid("unknown item instrument"))?; + u32::from_str_radix(bits, 16) + .map(f32::from_bits) + .map_err(|_| invalid("invalid instrument duration bits")) + }) + .transpose()?; + let defaults = UseComponents { + max_stack_size: optional_int(c, "minecraft:max_stack_size")?, + max_damage: optional_int(c, "minecraft:max_damage")?, + damage: optional_int(c, "minecraft:damage")?, + unbreakable: c.get("minecraft:unbreakable").is_some(), + consume_seconds: c + .get("minecraft:consumable") + .map(|v| number(v, "consume_seconds", 1.6)) + .transpose()?, + block_delay_seconds: c + .get("minecraft:blocks_attacks") + .map(|v| number(v, "block_delay_seconds", 0.0)) + .transpose()?, + kinetic_weapon: c.get("minecraft:kinetic_weapon").is_some(), + instrument_seconds, + }; + items.push(ItemDefinition { + id, + name: name.to_owned(), + duration, + crossbow_release, + defaults, + }); + } + if items.first().is_none_or(|i| i.name != "minecraft:air") { + return Err(invalid("item registry must start with air")); + } + Ok(Self { items, names }) + } + pub fn get(&self, id: ItemId) -> Option<&ItemDefinition> { + self.items.get(id.0 as usize) + } + pub fn by_name(&self, name: &str) -> Option<&ItemDefinition> { + self.get(*self.names.get(name)?) + } + pub fn items(&self) -> &[ItemDefinition] { + &self.items + } +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 072215b7d..0bf51f80b 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -47,6 +47,7 @@ pub mod interaction_shapes; pub mod item_blocking; pub mod item_durability; pub mod item_use; +pub mod item_use_catalog; pub mod item_use_lifecycle; pub mod item_use_start; pub mod liquid_collision; diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index cd020074b..7c16fa3cf 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1577,3 +1577,20 @@ UseEffects/KineticWeapon presence and clearing a populated kinetic-enemy map. Targeted Clippy passes; all 20 existing horizon-world library tests pass with these changes. Synchronized flag storage, packet encoding/delivery, kinetic combat and complete inventory/game-tick integration remain pending. + + +`item_use_catalog` imports all 1,658 pinned item identities and a typed projection +of their default components for stack size, durability and use-duration/release +queries. Component-driven use preserves consumable precedence over blocking and +kinetic weapons. Registered duration overrides remain separate; consumables +truncate float ticks while instruments floor them. Empty stacks query air +behavior and hide their stored components. + +`python3 tools/test_item_use_catalog_parity.py` binds vanilla's actual component +initializers and confirms both JARs export equivalent defaults. The +[registered item-use report](../benchmarks/rust-item-use-catalog-2026-10-07/scoped-parity.json) +records **246,715 matching lines per JAR**, covering every item default, count +changes and component mutation sequences, override behavior, stackability, +durability and integer/float extremes. Targeted Clippy passes. The imported +projection does not implement all item components or their codecs; full inventory, +enchantment effects and stored gameplay integration remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemUseCatalogOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemUseCatalogOracle.java new file mode 100644 index 000000000..0c69903d3 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemUseCatalogOracle.java @@ -0,0 +1,28 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.*;import net.minecraft.core.component.*;import net.minecraft.core.registries.*;import net.minecraft.world.item.*;import net.minecraft.world.item.component.*;import net.minecraft.resources.*;import com.mojang.serialization.JsonOps; +/** Bound built-in prototypes, queried through actual registered item methods. */ +public final class VanillaItemUseCatalogOracle { + static float single(JsonElement v){return Float.intBitsToFloat(Integer.parseUnsignedInt(v.getAsString(),16));} + static String bits(float v){return String.format("%08x",Float.floatToIntBits(v));} + static KineticWeapon kinetic(){return new KineticWeapon(0,0,Optional.empty(),Optional.empty(),Optional.empty(),0,0,Optional.empty(),Optional.empty());} + static BlocksAttacks blocking(float delay){return new BlocksAttacks(delay,1,List.of(),new BlocksAttacks.ItemDamageFunction(0,0,0),Optional.empty(),Optional.empty(),Optional.empty());} + static void snapshot(PrintWriter out,ItemStack s){out.println("stack "+BuiltInRegistries.ITEM.getId(s.getItem())+" "+s.getCount()+" "+s.getMaxStackSize()+" "+s.getMaxDamage()+" "+s.getDamageValue()+" "+s.isEmpty()+" "+s.isDamageableItem()+" "+s.isDamaged()+" "+s.isBroken()+" "+s.nextDamageWillBreak()+" "+s.isStackable()+" "+s.getUseDuration(null)+" "+s.useOnRelease());} + public static void main(String[] args)throws Exception{ + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();var lookup=net.minecraft.data.registries.VanillaRegistries.createWorldLookup();for(var p:BuiltInRegistries.DATA_COMPONENT_INITIALIZERS.build(lookup))p.apply();Path dir=Path.of(args[1]); + if(args[0].equals("export")){var root=new JsonObject();root.addProperty("schema",1);root.addProperty("DataVersion",5023);var instruments=new JsonObject();lookup.lookupOrThrow(Registries.INSTRUMENT).listElements().forEach(h->instruments.addProperty(h.key().identifier().toString(),bits(h.value().useDuration())));root.add("instruments",instruments);var rows=new JsonArray();var ops=RegistryOps.create(JsonOps.INSTANCE,lookup);for(var item:BuiltInRegistries.ITEM){var row=new JsonObject();row.addProperty("name",BuiltInRegistries.ITEM.getKey(item).toString());row.addProperty("id",BuiltInRegistries.ITEM.getId(item));row.addProperty("duration_impl",item.getClass().getMethod("getUseDuration",ItemStack.class,net.minecraft.world.entity.LivingEntity.class).getDeclaringClass().getSimpleName());row.addProperty("release_impl",item.getClass().getMethod("useOnRelease",ItemStack.class).getDeclaringClass().getSimpleName());row.add("components",DataComponentMap.CODEC.encodeStart(ops,item.builtInRegistryHolder().components()).getOrThrow());rows.add(row);}root.add("items",rows);Files.writeString(dir.resolve("catalog.json"),root.toString());return;} + var sound=net.minecraft.sounds.SoundEvents.GENERIC_EAT; + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();var item=BuiltInRegistries.ITEM.getValue(Identifier.parse(f.get("name").getAsString()));var stack=new ItemStack(item,f.get("count").getAsInt());snapshot(out,stack);for(var ov:f.getAsJsonArray("ops")){var op=ov.getAsJsonObject();var v=op.get("value");switch(op.get("kind").getAsString()){ + case "count":stack.setCount(v.getAsInt());break; + case "set-damage":stack.setDamageValue(v.getAsInt());break; + case "damage":stack.set(DataComponents.DAMAGE,v.isJsonNull()?null:v.getAsInt());break; + case "max-damage":stack.set(DataComponents.MAX_DAMAGE,v.isJsonNull()?null:v.getAsInt());break; + case "max-stack":stack.set(DataComponents.MAX_STACK_SIZE,v.isJsonNull()?null:v.getAsInt());break; + case "unbreakable":stack.set(DataComponents.UNBREAKABLE,v.getAsBoolean()?net.minecraft.util.Unit.INSTANCE:null);break; + case "consume":stack.set(DataComponents.CONSUMABLE,v.isJsonNull()?null:new Consumable(single(v),ItemUseAnimation.EAT,sound,false,List.of()));break; + case "blocking":stack.set(DataComponents.BLOCKS_ATTACKS,v.isJsonNull()?null:blocking(single(v)));break; + case "kinetic":stack.set(DataComponents.KINETIC_WEAPON,v.getAsBoolean()?kinetic():null);break; + case "instrument":stack.set(DataComponents.INSTRUMENT,v.isJsonNull()?null:new InstrumentComponent(Holder.direct(new Instrument(sound,single(v),1,0,net.minecraft.network.chat.Component.empty()))));break; + default:throw new AssertionError();}snapshot(out,stack);}}} + } +} diff --git a/tools/test_item_use_catalog_parity.py b/tools/test_item_use_catalog_parity.py new file mode 100644 index 000000000..ba94c6ea2 --- /dev/null +++ b/tools/test_item_use_catalog_parity.py @@ -0,0 +1,79 @@ +#!/usr/bin/env python3 +"""Compare registered item default components and use/durability query binding.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(catalog): + def bits(v):return struct.pack('>f',v).hex() + def op(kind,value):return dict(kind=kind,value=value) + names=[r['name'] for r in catalog['items']] + for name in names: + for count in [-1,0,1,2,64]: + yield dict(name=name,count=count,ops=[op('set-damage',1),op('count',1),op('consume',bits(.75)),op('blocking',bits(.25)),op('kinetic',True),op('consume',None),op('blocking',None),op('kinetic',False),op('instrument',bits(1.25)),op('unbreakable',True),op('count',0),op('count',2)]) + floats=[-float('inf'),-1e30,-1,-.025,-0.,0.,1e-40,.025,.5,1,1.6,1e30,float('inf'),float('nan')] + representatives=['minecraft:'+n for n in ['stone','apple','shield','wooden_spear','bow','crossbow','trident','bundle','brush','spyglass','ender_eye','goat_horn','air']] + for name in representatives: + for value in floats: + for count in [0,1,2]:yield dict(name=name,count=count,ops=[op('consume',bits(value)),op('instrument',bits(value)),op('max-stack',2),op('max-damage',3),op('damage',0),op('damage',3),op('max-damage',None),op('max-stack',None)]) + rng=random.Random(0x4954454d434154) + edges=[-2147483648,-2147483647,-1,0,1,2,20,2147483646,2147483647] + def integer():return rng.choice(edges) if rng.randrange(2) else rng.randrange(-2147483648,2147483648) + def random_op(): + kind=rng.choice(['count','set-damage','damage','max-damage','max-stack','unbreakable','consume','blocking','kinetic','instrument']) + if kind in ['consume','blocking','instrument']:value=rng.choice([None,bits(rng.choice(floats)),f'{rng.getrandbits(32):08x}']) + elif kind in ['unbreakable','kinetic']:value=bool(rng.randrange(2)) + elif kind in ['count','set-damage']:value=integer() + else:value=rng.choice([None,integer()]) + return op(kind,value) + for _ in range(10000):yield dict(name=rng.choice(representatives if rng.randrange(2) else names),count=rng.choice([-1,0,1,2,64]),ops=[random_op() for _ in range(rng.randrange(1,25))]) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-item-use-catalog-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemUseCatalogOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/item_use_catalog_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaItemUseCatalogOracle',mode,path],side+'-'+mode) + exports=[] + for side in jars: + folder=build/(side+'-export');folder.mkdir(exist_ok=True);java(side,'export',folder);exports.append(json.loads((folder/'catalog.json').read_text())) + if exports[0]!=exports[1]:raise RuntimeError('native item catalogs differ') + catalog_path=build/'catalog.json';lab.write_json(catalog_path,exports[0]);fixtures=list(corpus(exports[0]));inputs=build/'inputs.txt' ;inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs,catalog_path];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','item_use_catalog_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('item_use_catalog_fixture.exe' if os.name=='nt' else 'item_use_catalog_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} item use catalog output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'registered_items':len(exports[0]['items']),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'All 1658 built-in item identities with bound native default component maps. Parsed exports from both JARs agree; Rust imports the component projection for stack size, durability and item-use duration/release behavior. Native ItemStack queries cover every default plus component/count mutations, empty/air behavior, registered method overrides, consumable truncation versus instrument flooring, integer and float boundaries. Other item components, arbitrary component codecs, full inventory/equipment, enchantment effects and gameplay integration remain pending.'} + lab.write_json(report_path,report);print(f'Scoped item use catalog parity passed: {report_path}') + + +if __name__=='__main__':main() From c37a622f9cf1e7f9e0b7b2bd869044ee91c13c38 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 07:06:29 +0200 Subject: [PATCH 133/253] Implement shared component prototypes and ordered copy-on-write patches --- .../scoped-parity.json | 268 ++++++++++++++++++ .../examples/component_patch_fixture.rs | 136 +++++++++ crates/horizon-world/src/component_patch.rs | 190 +++++++++++++ crates/horizon-world/src/lib.rs | 1 + docs/collision-geometry.md | 16 ++ .../parity/VanillaComponentPatchOracle.java | 25 ++ tools/test_component_patch_parity.py | 73 +++++ 7 files changed, 709 insertions(+) create mode 100644 benchmarks/rust-component-patch-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/component_patch_fixture.rs create mode 100644 crates/horizon-world/src/component_patch.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaComponentPatchOracle.java create mode 100644 tools/test_component_patch_parity.py diff --git a/benchmarks/rust-component-patch-2026-10-07/scoped-parity.json b/benchmarks/rust-component-patch-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..66c4468c6 --- /dev/null +++ b/benchmarks/rust-component-patch-2026-10-07/scoped-parity.json @@ -0,0 +1,268 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 4585, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaComponentPatchOracle.java": "c9a78740021f3529f30b9b127672f6b3f9f4ee8139b864edc08b32dfd18732ef", + "tools/test_component_patch_parity.py": "02c893ec443258f44ecc6a57f73a72419b0d08e45c0b8061e7e9417feb859216", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "6884c7209f007ab9ee742b9c3c73828cfa1c6753d35b5fe25a87cab5955b33f8", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "18bbad377a8047e4d4ecd0fc87d83d46d1c0f1ce2b8c47bbe64633e7b4420b57", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/blocking_item_damage.rs": "9b1ae81c5bd0aea5982e03da1973f15fd46757354b8dd539bbd27449cff45e6a", + "crates/horizon-world/src/blocking_rules.rs": "83c5e2105cec56a90182ce582e1c67ade2b189be6de1a34d08035000cc07c492", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/component_patch.rs": "3622244ccdee46e13956c64ffe9be6234e686adf58dbc3a24cece0f1814301a1", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_immunity.rs": "fd39c41124d694e755cf7faadcf93c636df4042c78ec345092a856b5f952dbcf", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/damage_source.rs": "24945e397a926d34695652980923609e4723e02fe6b6e56d4aaf673e45d759f7", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/item_blocking.rs": "f6eee0d6d177cc3148960122327ba1b459a2f0e85241c1d9a3e40f0b8c169296", + "crates/horizon-world/src/item_durability.rs": "6a67fd660d771c59ffa9f4aa3225a25b56da31ea1079ca2efa4a915be6464179", + "crates/horizon-world/src/item_use.rs": "1d0a3afa61b60d356e81a063da79ec6cd38730315976640a591325fc4c8ab98c", + "crates/horizon-world/src/item_use_catalog.rs": "a9b53d2e816583239a75c3c61e78dacc5e3b27dee595be34b1c7fa169f17a571", + "crates/horizon-world/src/item_use_lifecycle.rs": "f9b29f42a528493d0d2521110d4f6e0bc89af8f579d539648cb7c3a9e68e31cd", + "crates/horizon-world/src/item_use_start.rs": "9996a9b90c313925cd90e78c02880f2a1d2ae65aef53f4ce081578a9dcd10c62", + "crates/horizon-world/src/lib.rs": "7b3c6671ac24942730e1c70cab097b7fcde8b63e556074557c499b9e824346a4", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "2b448209629b9bf2e678d667ad0d6c7fa22146892dd106b169d96b31b0df12bb", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_hurt.rs": "844239ad7d15c39629bb3cfc06ebae6d1cff20b7627468f26e0ee8dff3abdcb8", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_hurt.rs": "99c9bbd8587ec2dc287806049897b8034d2f5349ad47fc497b70d54148844a36", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/server_player_combat.rs": "a9743971581af86d926eeba42004d932caf83382c470dd98bf613cb9c417db58", + "crates/horizon-world/src/server_player_damage.rs": "828a4649fec3e9bda2dfe20aced8c95922c697321de2be4127bd4e5712ecbb7c", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "f417aab280331ddd6f0ca265a12c0130c78b9924f407c7e07f198140501e6010", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/view_direction.rs": "e18120ae26dc5cf702b29fc4c8487088bab133c8ce5abce01226833fafb0d5a4", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "74e4110fb19c4c4047192fd65c38015b8afc7f9fc50404d75380b5063808148c", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/component_patch_fixture.rs": "cb84b45649fda6c0cca3fe6bc798d7e41a6e3a8ed6edfc1ef6e5f01db1250948" + }, + "fixtures_sha256": { + ".local/rust-component-patch-parity/inputs.txt": "bb70bc0eca0351ea7bf3bee91ff2d1dbb03753ce42910bc8181501846659172e" + }, + "rust_output_sha256": "03bed8f8da5e4965999e42081eae378ba343562ffa80b5415168b3a1963b03f0", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "03bed8f8da5e4965999e42081eae378ba343562ffa80b5415168b3a1963b03f0", + "matched_output_lines": 622680 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "03bed8f8da5e4965999e42081eae378ba343562ffa80b5415168b3a1963b03f0", + "matched_output_lines": 622680 + } + ], + "scope": "Actual PatchedDataComponentMap reads, set/remove return values, ordered patch iteration/key sets, apply versus unsanitized restore, fromPatch sanitation, saved patches and independent map copies. Immutable prototypes have at most seven keys so native builder order is defined without identity-hash tables. Integer and boxed-float values cover NaN/signed zero; generic Rust callers must supply native value equality and prototype order. Includes mutation-before-error for removal markers without prototype defaults. Component codecs, prototype hash-table construction, object identity hashes, mutable payload aliases and full item/inventory integration remain pending." +} diff --git a/crates/horizon-world/examples/component_patch_fixture.rs b/crates/horizon-world/examples/component_patch_fixture.rs new file mode 100644 index 000000000..29b345c8d --- /dev/null +++ b/crates/horizon-world/examples/component_patch_fixture.rs @@ -0,0 +1,136 @@ +use horizon_world::component_patch::{ComponentMap, Patch, Prototype}; +use serde_json::Value as Json; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +#[derive(Clone, Debug, PartialEq)] +enum Value { + Int(i32), + Float(u32), +} +fn value(v: &Json) -> Option { + if v.is_null() { + None + } else if let Some(s) = v.as_str() { + let raw = u32::from_str_radix(s, 16).unwrap(); + Some(Value::Float(if f32::from_bits(raw).is_nan() { + f32::NAN.to_bits() + } else { + raw + })) + } else { + Some(Value::Int(v.as_i64().unwrap() as i32)) + } +} +fn text(v: Option<&Value>) -> String { + match v { + None => "none".into(), + Some(Value::Int(v)) => format!("i{v}"), + Some(Value::Float(v)) => format!("f{v:08x}"), + } +} +fn patch(v: &Json) -> Patch { + Patch::new( + v.as_array() + .unwrap() + .iter() + .map(|v| (v[0].as_u64().unwrap() as usize, value(&v[1]))), + ) +} +fn patch_text(p: &Patch) -> String { + p.entries() + .iter() + .map(|(k, v)| format!("{k}={}", text(v.as_ref()))) + .collect::>() + .join(",") +} +fn snapshot( + out: &mut dyn Write, + maps: &[ComponentMap; 3], + patches: &[Patch; 3], +) -> io::Result<()> { + for (i, m) in maps.iter().enumerate() { + let entries = m + .entries() + .map(|(k, v)| format!("{k}={}", text(Some(v)))) + .collect::>() + .join(","); + let keys = m + .keys() + .iter() + .map(usize::to_string) + .collect::>() + .join(","); + let values = (0..16) + .map(|k| text(m.get(&k))) + .collect::>() + .join(","); + let flags = (0..16) + .filter(|k| m.has_non_default(k)) + .fold(0u32, |v, k| v | (1 << k)); + writeln!( + out, + "map {i} {} {entries} | {keys} | {values} | {flags} | {}", + m.len(), + patch_text(&m.as_patch()) + )?; + } + for (i, p) in patches.iter().enumerate() { + writeln!(out, "patch {i} {}", patch_text(p))?; + } + writeln!( + out, + "equal {} {} {}", + maps[0] == maps[1], + maps[0] == maps[2], + maps[1] == maps[2] + ) +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Json = serde_json::from_str(line)?; + let base = Prototype::new( + f["prototype"] + .as_array() + .unwrap() + .iter() + .map(|v| (v[0].as_u64().unwrap() as usize, value(&v[1]).unwrap())), + ); + let mut maps = std::array::from_fn(|_| ComponentMap::new(base.clone())); + let mut patches = std::array::from_fn(|_| Patch::new([])); + snapshot(&mut out, &maps, &patches)?; + for op in f["ops"].as_array().unwrap() { + let a = op["a"].as_u64().unwrap() as usize; + let b = op["b"].as_u64().unwrap() as usize; + let mut success = true; + match op["kind"].as_str().unwrap() { + "set" => { + match maps[a].set(op["key"].as_u64().unwrap() as usize, value(&op["value"])) { + Ok(v) => writeln!(out, "old {}", text(v.as_ref()))?, + Err(_) => success = false, + } + } + "remove" => { + let v = maps[a].remove(op["key"].as_u64().unwrap() as usize); + writeln!(out, "old {}", text(v.as_ref()))?; + } + "copy" => maps[b] = maps[a].clone(), + "save" => patches[b] = maps[a].as_patch(), + "apply" => maps[a].apply_patch(&patches[b]), + "restore" => maps[a].restore_patch(&patches[b]), + "clear" => maps[a].clear_patch(), + "build" => patches[b] = patch(&op["entries"]), + "from" => maps[a] = ComponentMap::from_patch(base.clone(), &patches[b]), + _ => panic!("operation"), + }; + writeln!(out, "result {}", if success { "ok" } else { "error" })?; + snapshot(&mut out, &maps, &patches)?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/src/component_patch.rs b/crates/horizon-world/src/component_patch.rs new file mode 100644 index 000000000..0bb5c2d52 --- /dev/null +++ b/crates/horizon-world/src/component_patch.rs @@ -0,0 +1,190 @@ +//! Shared immutable prototypes with ordered, copy-on-write component patches. +//! Keys stand for stable component-type identities. Callers supply prototype +//! iteration order and values whose equality matches their native component. +use std::{fmt, sync::Arc}; +#[derive(Clone, Debug)] +pub struct Prototype(Arc>); +#[derive(Clone, Debug)] +pub struct Patch(Arc)>>); +#[derive(Clone, Debug)] +pub struct ComponentMap { + prototype: Prototype, + patch: Patch, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct MissingPrototype; +impl fmt::Display for MissingPrototype { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str("removed component has no prototype value") + } +} +impl std::error::Error for MissingPrototype {} +fn index(entries: &[(K, V)], key: &K) -> Option { + entries.iter().position(|(k, _)| k == key) +} +fn put(entries: &mut Vec<(K, V)>, key: K, value: V) -> Option { + if let Some(i) = index(entries, &key) { + Some(std::mem::replace(&mut entries[i].1, value)) + } else { + entries.push((key, value)); + None + } +} +fn remove(entries: &mut Vec<(K, V)>, key: &K) -> Option { + index(entries, key).map(|i| entries.remove(i).1) +} +fn map_equal(a: &[(K, V)], b: &[(K, V)]) -> bool { + a.len() == b.len() + && a.iter() + .all(|(k, v)| index(b, k).is_some_and(|i| b[i].1 == *v)) +} +impl Prototype { + pub fn new(entries: impl IntoIterator) -> Self { + let mut values = Vec::new(); + for (k, v) in entries { + put(&mut values, k, v); + } + Self(Arc::new(values)) + } + pub fn get(&self, key: &K) -> Option<&V> { + index(&self.0, key).map(|i| &self.0[i].1) + } + pub fn entries(&self) -> &[(K, V)] { + &self.0 + } +} +impl Patch { + /// None is an explicit removal, distinct from a missing patch entry. + pub fn new(entries: impl IntoIterator)>) -> Self { + let mut values = Vec::new(); + for (k, v) in entries { + put(&mut values, k, v); + } + Self(Arc::new(values)) + } + pub fn entries(&self) -> &[(K, Option)] { + &self.0 + } +} +impl ComponentMap { + pub fn new(prototype: Prototype) -> Self { + Self { + prototype, + patch: Patch(Arc::new(Vec::new())), + } + } + pub fn from_patch(prototype: Prototype, patch: &Patch) -> Self { + let sanitized = patch.0.iter().all(|(k, v)| match v { + Some(v) => Some(v) != prototype.get(k), + None => prototype.get(k).is_some(), + }); + if sanitized { + Self { + prototype, + patch: patch.clone(), + } + } else { + let mut result = Self::new(prototype); + result.apply_patch(patch); + result + } + } + pub fn prototype(&self) -> &Prototype { + &self.prototype + } + pub fn get(&self, key: &K) -> Option<&V> { + match index(&self.patch.0, key) { + Some(i) => self.patch.0[i].1.as_ref(), + None => self.prototype.get(key), + } + } + pub fn has_non_default(&self, key: &K) -> bool { + index(&self.patch.0, key).is_some() + } + /// Vanilla set returns the prototype value for an earlier removal marker. + /// An unsanitized removal with no prototype causes an error after mutation. + pub fn set(&mut self, key: K, value: Option) -> Result, MissingPrototype> { + let base = self.prototype.get(&key).cloned(); + let entries = Arc::make_mut(&mut self.patch.0); + let previous = if value == base { + remove(entries, &key) + } else { + put(entries, key, value) + }; + match previous { + Some(Some(v)) => Ok(Some(v)), + Some(None) => base.map(Some).ok_or(MissingPrototype), + None => Ok(base), + } + } + pub fn remove(&mut self, key: K) -> Option { + let base = self.prototype.get(&key).cloned(); + let entries = Arc::make_mut(&mut self.patch.0); + let previous = if base.is_some() { + put(entries, key, None) + } else { + remove(entries, &key) + }; + previous.unwrap_or(base) + } + pub fn apply_patch(&mut self, patch: &Patch) { + let entries = Arc::make_mut(&mut self.patch.0); + for (k, v) in patch.0.iter() { + if v.as_ref() == self.prototype.get(k) { + remove(entries, k); + } else { + put(entries, k.clone(), v.clone()); + } + } + } + /// Restore preserves redundant values and removals, unlike apply_patch. + pub fn restore_patch(&mut self, patch: &Patch) { + self.patch = patch.clone(); + } + pub fn clear_patch(&mut self) { + self.patch = Patch(Arc::new(Vec::new())); + } + pub fn as_patch(&self) -> Patch { + self.patch.clone() + } + pub fn len(&self) -> usize { + self.entries().count() + } + pub fn is_empty(&self) -> bool { + self.len() == 0 + } + /// Patched values precede untouched prototype values; removed keys vanish. + pub fn entries(&self) -> impl Iterator { + self.patch + .0 + .iter() + .filter_map(|(k, v)| v.as_ref().map(|v| (k, v))) + .chain( + self.prototype + .0 + .iter() + .filter(|(k, _)| !self.has_non_default(k)) + .map(|(k, v)| (k, v)), + ) + } + /// Key-set order instead starts with prototype keys, then applies the patch. + pub fn keys(&self) -> Vec { + let mut keys: Vec<_> = self.prototype.0.iter().map(|(k, _)| k.clone()).collect(); + for (k, v) in self.patch.0.iter() { + let i = keys.iter().position(|key| key == k); + if v.is_some() { + if i.is_none() { + keys.push(k.clone()); + } + } else if let Some(i) = i { + keys.remove(i); + } + } + keys + } +} +impl PartialEq for ComponentMap { + fn eq(&self, other: &Self) -> bool { + map_equal(&self.prototype.0, &other.prototype.0) && map_equal(&self.patch.0, &other.patch.0) + } +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 0bf51f80b..daf2c8f2e 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -21,6 +21,7 @@ pub mod climbing; pub mod collision; pub mod collision_context; pub mod combat_rules; +pub mod component_patch; pub mod compression; pub mod damage_immunity; pub mod damage_reduction; diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 7c16fa3cf..883c00a18 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1594,3 +1594,19 @@ changes and component mutation sequences, override behavior, stackability, durability and integer/float extremes. Targeted Clippy passes. The imported projection does not implement all item components or their codecs; full inventory, enchantment effects and stored gameplay integration remain pending. + + +`component_patch` stores shared immutable prototypes and ordered copy-on-write +patches. Set/remove return values, redundant-value sanitation, explicit removals, +unsanitized restoration, independent copies and saved patch snapshots retain +native behavior. Entry iteration emits patched values before untouched defaults; +key-set order instead applies the patch to the prototype's key sequence. + +`python3 tools/test_component_patch_parity.py` compares actual native patched +maps. The [component-patch report](../benchmarks/rust-component-patch-2026-10-07/scoped-parity.json) +records **622,680 matching lines per JAR**, including integer/boxed-float equality, +NaN/signed zero, copy isolation and mutation-before-error when a restored removal +has no prototype default. Targeted Clippy passes. Prototypes have at most seven +keys in this suite; callers supply prototype order and native value equality. +Native large-prototype identity-hash ordering, codecs, mutable payload aliases +and full item/inventory integration remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaComponentPatchOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaComponentPatchOracle.java new file mode 100644 index 000000000..724b81ab5 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaComponentPatchOracle.java @@ -0,0 +1,25 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import com.mojang.serialization.Codec;import java.io.*;import java.nio.file.*;import java.lang.reflect.*;import java.util.*; +import net.minecraft.core.component.*; +/** Actual patched maps, ordered immutable prototypes and shared copies. */ +public final class VanillaComponentPatchOracle { + static DataComponentType[] keys;static Field patchMap;static Object removed; + static Object value(JsonElement v){if(v.isJsonNull())return null;if(v.getAsJsonPrimitive().isString())return Float.valueOf(Float.intBitsToFloat(Integer.parseUnsignedInt(v.getAsString(),16)));return Integer.valueOf(v.getAsInt());} + static String text(Object v){if(v==null||v==removed)return "none";if(v instanceof Float f)return "f"+String.format("%08x",Float.floatToIntBits(f));return "i"+v;} + static int id(Object key){for(int i=0;i)patchMap.get(p)).entrySet())result.add(id(e.getKey())+"="+text(e.getValue()));return result.toString();} + static void snapshot(PrintWriter out,PatchedDataComponentMap[] maps,DataComponentPatch[] patches)throws Exception{for(int i=0;i)(DataComponentType)DataComponentType.builder().persistent(Codec.INT).build();patchMap=DataComponentPatch.class.getDeclaredField("map");patchMap.setAccessible(true);Path dir=Path.of(args[1]);try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();var base=prototype(f.getAsJsonArray("prototype"));PatchedDataComponentMap[] maps={new PatchedDataComponentMap(base),new PatchedDataComponentMap(base),new PatchedDataComponentMap(base)};DataComponentPatch[] patches={DataComponentPatch.EMPTY,DataComponentPatch.EMPTY,DataComponentPatch.EMPTY};snapshot(out,maps,patches);for(var ov:f.getAsJsonArray("ops")){var op=ov.getAsJsonObject();int a=op.get("a").getAsInt(),b=op.get("b").getAsInt();try{switch(op.get("kind").getAsString()){ + case "set":out.println("old "+text(maps[a].set(keys[op.get("key").getAsInt()],value(op.get("value")))));break; + case "remove":out.println("old "+text(maps[a].remove(keys[op.get("key").getAsInt()])));break; + case "copy":maps[b]=maps[a].copy();break; + case "save":patches[b]=maps[a].asPatch();break; + case "apply":maps[a].applyPatch(patches[b]);break; + case "restore":maps[a].restorePatch(patches[b]);break; + case "clear":maps[a].clearPatch();break; + case "build":patches[b]=patch(op.getAsJsonArray("entries"));break; + case "from":maps[a]=PatchedDataComponentMap.fromPatch(base,patches[b]);break; + default:throw new AssertionError();}out.println("result ok");}catch(NullPointerException e){out.println("result error");}snapshot(out,maps,patches);}}}} +} diff --git a/tools/test_component_patch_parity.py b/tools/test_component_patch_parity.py new file mode 100644 index 000000000..5e7572369 --- /dev/null +++ b/tools/test_component_patch_parity.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python3 +"""Compare native component patch storage, ordered mutations and shared copies.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + def op(kind,a=0,b=0,**kw):return dict(kind=kind,a=a,b=b,**kw) + values=[-2147483648,-1,0,1,2147483647,'00000000','80000000','7fc00000','7fa12345','ff800000','3f800000'] + for initial in values: + for first in [None,*values]: + for second in [None,*values]: + yield dict(prototype=[[0,initial]],ops=[op('set',key=0,value=first),op('copy',b=1),op('save',b=0),op('set',key=0,value=second),op('remove',key=0),op('restore',a=2,b=0),op('set',a=2,key=0,value=second)]) + yield dict(prototype=[],ops=[op('build',entries=[[0,None],[1,2],[0,None]]),op('restore'),op('set',key=0,value=1),op('clear'),op('from'),op('set',key=0,value=1)]) + rng=random.Random(0x434f4d504f4e454e) + def val():return rng.choice(values) if rng.randrange(2) else (rng.randrange(-2147483648,2147483648) if rng.randrange(2) else f'{rng.getrandbits(32):08x}') + for _ in range(3000): + prototype=[[k,val()] for k in rng.sample(range(16),rng.randrange(8))] + ops=[] + for __ in range(rng.randrange(10,31)): + kind=rng.choice(['set','set','remove','copy','save','apply','restore','clear','build','from']);a=rng.randrange(3);b=rng.randrange(3) + if kind=='set':v=op(kind,a,b,key=rng.randrange(16),value=rng.choice([None,val()])) + elif kind=='remove':v=op(kind,a,b,key=rng.randrange(16)) + elif kind=='build':v=op(kind,a,b,entries=[[rng.randrange(16),rng.choice([None,val()])] for ___ in range(rng.randrange(20))]) + else:v=op(kind,a,b) + ops.append(v) + yield dict(prototype=prototype,ops=ops) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-component-patch-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaComponentPatchOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/component_patch_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaComponentPatchOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','component_patch_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('component_patch_fixture.exe' if os.name=='nt' else 'component_patch_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} component patch output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual PatchedDataComponentMap reads, set/remove return values, ordered patch iteration/key sets, apply versus unsanitized restore, fromPatch sanitation, saved patches and independent map copies. Immutable prototypes have at most seven keys so native builder order is defined without identity-hash tables. Integer and boxed-float values cover NaN/signed zero; generic Rust callers must supply native value equality and prototype order. Includes mutation-before-error for removal markers without prototype defaults. Component codecs, prototype hash-table construction, object identity hashes, mutable payload aliases and full item/inventory integration remain pending.'} + lab.write_json(report_path,report);print(f'Scoped component patch parity passed: {report_path}') + + +if __name__=='__main__':main() From dd02942c9046cf142248c5d61c0b5bf090401395 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 07:16:41 +0200 Subject: [PATCH 134/253] Bind durability algorithms directly to component patch storage --- .../blocking-regression.json | 269 ++++++++++++++++++ .../scalar-regression.json | 269 ++++++++++++++++++ .../scoped-parity.json | 269 ++++++++++++++++++ .../examples/blocking_item_damage_fixture.rs | 4 + .../examples/component_durability_fixture.rs | 187 ++++++++++++ .../examples/item_durability_fixture.rs | 4 + .../horizon-world/src/blocking_item_damage.rs | 10 +- .../horizon-world/src/component_durability.rs | 193 +++++++++++++ crates/horizon-world/src/item_durability.rs | 59 +++- crates/horizon-world/src/lib.rs | 1 + docs/collision-geometry.md | 19 ++ .../VanillaComponentDurabilityOracle.java | 26 ++ tools/test_component_durability_parity.py | 87 ++++++ 13 files changed, 1378 insertions(+), 19 deletions(-) create mode 100644 benchmarks/rust-component-durability-2026-10-07/blocking-regression.json create mode 100644 benchmarks/rust-component-durability-2026-10-07/scalar-regression.json create mode 100644 benchmarks/rust-component-durability-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/component_durability_fixture.rs create mode 100644 crates/horizon-world/src/component_durability.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaComponentDurabilityOracle.java create mode 100644 tools/test_component_durability_parity.py diff --git a/benchmarks/rust-component-durability-2026-10-07/blocking-regression.json b/benchmarks/rust-component-durability-2026-10-07/blocking-regression.json new file mode 100644 index 000000000..dddc1dd84 --- /dev/null +++ b/benchmarks/rust-component-durability-2026-10-07/blocking-regression.json @@ -0,0 +1,269 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 20895, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockingItemDamageOracle.java": "adeccd0b712a9b5987f663871a86d7d40fbd1b1f9b68c585dc3f7c6fea567c43", + "tools/test_blocking_item_damage_parity.py": "69cb5aa34d08fc19d0fab38da776de27e22290c10020f2444e2c9fa3f9c70f2f", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "6884c7209f007ab9ee742b9c3c73828cfa1c6753d35b5fe25a87cab5955b33f8", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "18bbad377a8047e4d4ecd0fc87d83d46d1c0f1ce2b8c47bbe64633e7b4420b57", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/blocking_item_damage.rs": "afea3cb5761e8b82ee4d9bb4ef3c6fd10182a324dbaec99e6c9ebfac255dda09", + "crates/horizon-world/src/blocking_rules.rs": "83c5e2105cec56a90182ce582e1c67ade2b189be6de1a34d08035000cc07c492", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/component_durability.rs": "37a46e184f95bc5027e2b9af72ff52f729ad03601d08e1827f181fca383a35af", + "crates/horizon-world/src/component_patch.rs": "3622244ccdee46e13956c64ffe9be6234e686adf58dbc3a24cece0f1814301a1", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_immunity.rs": "fd39c41124d694e755cf7faadcf93c636df4042c78ec345092a856b5f952dbcf", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/damage_source.rs": "24945e397a926d34695652980923609e4723e02fe6b6e56d4aaf673e45d759f7", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/item_blocking.rs": "f6eee0d6d177cc3148960122327ba1b459a2f0e85241c1d9a3e40f0b8c169296", + "crates/horizon-world/src/item_durability.rs": "9fdf835e5c7bd0e1dd63ef2ba0076b770cdd4d6d14cdcd11de27690f0702f94e", + "crates/horizon-world/src/item_use.rs": "1d0a3afa61b60d356e81a063da79ec6cd38730315976640a591325fc4c8ab98c", + "crates/horizon-world/src/item_use_catalog.rs": "a9b53d2e816583239a75c3c61e78dacc5e3b27dee595be34b1c7fa169f17a571", + "crates/horizon-world/src/item_use_lifecycle.rs": "f9b29f42a528493d0d2521110d4f6e0bc89af8f579d539648cb7c3a9e68e31cd", + "crates/horizon-world/src/item_use_start.rs": "9996a9b90c313925cd90e78c02880f2a1d2ae65aef53f4ce081578a9dcd10c62", + "crates/horizon-world/src/lib.rs": "8ac28b12b1c40b73a24d37aca33eee26c7894d38cd56aaf8d60c9530b4874069", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "2b448209629b9bf2e678d667ad0d6c7fa22146892dd106b169d96b31b0df12bb", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_hurt.rs": "844239ad7d15c39629bb3cfc06ebae6d1cff20b7627468f26e0ee8dff3abdcb8", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_hurt.rs": "99c9bbd8587ec2dc287806049897b8034d2f5349ad47fc497b70d54148844a36", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/server_player_combat.rs": "a9743971581af86d926eeba42004d932caf83382c470dd98bf613cb9c417db58", + "crates/horizon-world/src/server_player_damage.rs": "828a4649fec3e9bda2dfe20aced8c95922c697321de2be4127bd4e5712ecbb7c", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "f417aab280331ddd6f0ca265a12c0130c78b9924f407c7e07f198140501e6010", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/view_direction.rs": "e18120ae26dc5cf702b29fc4c8487088bab133c8ce5abce01226833fafb0d5a4", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "74e4110fb19c4c4047192fd65c38015b8afc7f9fc50404d75380b5063808148c", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/blocking_item_damage_fixture.rs": "fc6d76c0421b39a9bd5c186f597110130deb35c1c47f0ac3036fe12b69c3bd1a" + }, + "fixtures_sha256": { + ".local/rust-blocking-item-damage-parity/inputs.txt": "0cb79d37f95adc2a95ddd2c18aa8b1e24142fafe12fffe4f9a56e95b64278b0f" + }, + "rust_output_sha256": "c78041fca237ef15364ce2a42dba44d3acd41b852d2c84daadcc52117ab905cc", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "c78041fca237ef15364ce2a42dba44d3acd41b852d2c84daadcc52117ab905cc", + "matched_output_lines": 71800 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "c78041fca237ef15364ce2a42dba44d3acd41b852d2c84daadcc52117ab905cc", + "matched_output_lines": 71800 + } + ], + "scope": "Actual BlocksAttacks hurtBlockingItem into native unenchanted ItemStack durability storage, on non-player, Player and ServerPlayer receivers. Native statistic item capture, client/level guards, scalar item-damage rules, creative immunity, empty-listener advancement ordering, stack mutation/shrink and equipment-break callback copy/slot are compared with Rust composition. Covers scalar float boundaries, absent/invalid durability components, callback storage mutations and failures. Complete components/codecs, enchantment effects, inventory/equipment lifecycle and full combat/world integration remain pending." +} diff --git a/benchmarks/rust-component-durability-2026-10-07/scalar-regression.json b/benchmarks/rust-component-durability-2026-10-07/scalar-regression.json new file mode 100644 index 000000000..8bd2d40fc --- /dev/null +++ b/benchmarks/rust-component-durability-2026-10-07/scalar-regression.json @@ -0,0 +1,269 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 30052, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemDurabilityOracle.java": "0e548d6b362588f73cbc1c2f24bdd5408d36e82db716af4a95f82aad265ae0ea", + "tools/test_item_durability_parity.py": "4f00e1eb1b72bca43eeffff842d98d7008279c6a9613d1dcc771bfe62d6c26fe", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "6884c7209f007ab9ee742b9c3c73828cfa1c6753d35b5fe25a87cab5955b33f8", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "18bbad377a8047e4d4ecd0fc87d83d46d1c0f1ce2b8c47bbe64633e7b4420b57", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/blocking_item_damage.rs": "afea3cb5761e8b82ee4d9bb4ef3c6fd10182a324dbaec99e6c9ebfac255dda09", + "crates/horizon-world/src/blocking_rules.rs": "83c5e2105cec56a90182ce582e1c67ade2b189be6de1a34d08035000cc07c492", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/component_durability.rs": "37a46e184f95bc5027e2b9af72ff52f729ad03601d08e1827f181fca383a35af", + "crates/horizon-world/src/component_patch.rs": "3622244ccdee46e13956c64ffe9be6234e686adf58dbc3a24cece0f1814301a1", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_immunity.rs": "fd39c41124d694e755cf7faadcf93c636df4042c78ec345092a856b5f952dbcf", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/damage_source.rs": "24945e397a926d34695652980923609e4723e02fe6b6e56d4aaf673e45d759f7", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/item_blocking.rs": "f6eee0d6d177cc3148960122327ba1b459a2f0e85241c1d9a3e40f0b8c169296", + "crates/horizon-world/src/item_durability.rs": "9fdf835e5c7bd0e1dd63ef2ba0076b770cdd4d6d14cdcd11de27690f0702f94e", + "crates/horizon-world/src/item_use.rs": "1d0a3afa61b60d356e81a063da79ec6cd38730315976640a591325fc4c8ab98c", + "crates/horizon-world/src/item_use_catalog.rs": "a9b53d2e816583239a75c3c61e78dacc5e3b27dee595be34b1c7fa169f17a571", + "crates/horizon-world/src/item_use_lifecycle.rs": "f9b29f42a528493d0d2521110d4f6e0bc89af8f579d539648cb7c3a9e68e31cd", + "crates/horizon-world/src/item_use_start.rs": "9996a9b90c313925cd90e78c02880f2a1d2ae65aef53f4ce081578a9dcd10c62", + "crates/horizon-world/src/lib.rs": "8ac28b12b1c40b73a24d37aca33eee26c7894d38cd56aaf8d60c9530b4874069", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "2b448209629b9bf2e678d667ad0d6c7fa22146892dd106b169d96b31b0df12bb", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_hurt.rs": "844239ad7d15c39629bb3cfc06ebae6d1cff20b7627468f26e0ee8dff3abdcb8", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_hurt.rs": "99c9bbd8587ec2dc287806049897b8034d2f5349ad47fc497b70d54148844a36", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/server_player_combat.rs": "a9743971581af86d926eeba42004d932caf83382c470dd98bf613cb9c417db58", + "crates/horizon-world/src/server_player_damage.rs": "828a4649fec3e9bda2dfe20aced8c95922c697321de2be4127bd4e5712ecbb7c", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "f417aab280331ddd6f0ca265a12c0130c78b9924f407c7e07f198140501e6010", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/view_direction.rs": "e18120ae26dc5cf702b29fc4c8487088bab133c8ce5abce01226833fafb0d5a4", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "74e4110fb19c4c4047192fd65c38015b8afc7f9fc50404d75380b5063808148c", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/item_durability_fixture.rs": "7ed7b96860d60a5629a59e16f2c416ad8b28d79e795276c11b7d1abcf64e974b" + }, + "fixtures_sha256": { + ".local/rust-item-durability-parity/inputs.txt": "9d9f7f0a6f05230baf2538b26ee3f02b39f018b31d35801e2af8ccbfc1503eca" + }, + "rust_output_sha256": "0ed852826d375dd35268608045756abcb6e152cef9840ef464b3f00254da4675", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "0ed852826d375dd35268608045756abcb6e152cef9840ef464b3f00254da4675", + "matched_output_lines": 81762 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "0ed852826d375dd35268608045756abcb6e152cef9840ef464b3f00254da4675", + "matched_output_lines": 81762 + } + ], + "scope": "Actual unenchanted ItemStack damage predicates, clamped reads/writes, integer-wrapping count changes, server-level hurtAndBreak and ServerPlayer hurtWithoutBreaking. Real component maps cover absent fields, empty/air stacks, unbreakable and invalid numeric values; callbacks mutate storage and inject failures at infinite-material, empty-listener advancement and break dispatch boundaries. Covers the positive integer-to-float enchantment pipeline with no enchantments. Complete component storage/codecs, enchantment effects, entity equipment break handling and combat/world integration remain pending." +} diff --git a/benchmarks/rust-component-durability-2026-10-07/scoped-parity.json b/benchmarks/rust-component-durability-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..5cf2427e6 --- /dev/null +++ b/benchmarks/rust-component-durability-2026-10-07/scoped-parity.json @@ -0,0 +1,269 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 30142, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaComponentDurabilityOracle.java": "9cb21d37cf2ee4707bd3850765cd519bd0fa6ef15e6acda80329bdf24523d678", + "tools/test_component_durability_parity.py": "6e7eb212266e3616f5d2940b5cf3a4de7a8319ecbd2e914e3072c8e9cb49776e", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "6884c7209f007ab9ee742b9c3c73828cfa1c6753d35b5fe25a87cab5955b33f8", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "18bbad377a8047e4d4ecd0fc87d83d46d1c0f1ce2b8c47bbe64633e7b4420b57", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/blocking_item_damage.rs": "afea3cb5761e8b82ee4d9bb4ef3c6fd10182a324dbaec99e6c9ebfac255dda09", + "crates/horizon-world/src/blocking_rules.rs": "83c5e2105cec56a90182ce582e1c67ade2b189be6de1a34d08035000cc07c492", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/component_durability.rs": "37a46e184f95bc5027e2b9af72ff52f729ad03601d08e1827f181fca383a35af", + "crates/horizon-world/src/component_patch.rs": "3622244ccdee46e13956c64ffe9be6234e686adf58dbc3a24cece0f1814301a1", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_immunity.rs": "fd39c41124d694e755cf7faadcf93c636df4042c78ec345092a856b5f952dbcf", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/damage_source.rs": "24945e397a926d34695652980923609e4723e02fe6b6e56d4aaf673e45d759f7", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/item_blocking.rs": "f6eee0d6d177cc3148960122327ba1b459a2f0e85241c1d9a3e40f0b8c169296", + "crates/horizon-world/src/item_durability.rs": "9fdf835e5c7bd0e1dd63ef2ba0076b770cdd4d6d14cdcd11de27690f0702f94e", + "crates/horizon-world/src/item_use.rs": "1d0a3afa61b60d356e81a063da79ec6cd38730315976640a591325fc4c8ab98c", + "crates/horizon-world/src/item_use_catalog.rs": "a9b53d2e816583239a75c3c61e78dacc5e3b27dee595be34b1c7fa169f17a571", + "crates/horizon-world/src/item_use_lifecycle.rs": "f9b29f42a528493d0d2521110d4f6e0bc89af8f579d539648cb7c3a9e68e31cd", + "crates/horizon-world/src/item_use_start.rs": "9996a9b90c313925cd90e78c02880f2a1d2ae65aef53f4ce081578a9dcd10c62", + "crates/horizon-world/src/lib.rs": "8ac28b12b1c40b73a24d37aca33eee26c7894d38cd56aaf8d60c9530b4874069", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "2b448209629b9bf2e678d667ad0d6c7fa22146892dd106b169d96b31b0df12bb", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_hurt.rs": "844239ad7d15c39629bb3cfc06ebae6d1cff20b7627468f26e0ee8dff3abdcb8", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_hurt.rs": "99c9bbd8587ec2dc287806049897b8034d2f5349ad47fc497b70d54148844a36", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/server_player_combat.rs": "a9743971581af86d926eeba42004d932caf83382c470dd98bf613cb9c417db58", + "crates/horizon-world/src/server_player_damage.rs": "828a4649fec3e9bda2dfe20aced8c95922c697321de2be4127bd4e5712ecbb7c", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "f417aab280331ddd6f0ca265a12c0130c78b9924f407c7e07f198140501e6010", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/view_direction.rs": "e18120ae26dc5cf702b29fc4c8487088bab133c8ce5abce01226833fafb0d5a4", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "74e4110fb19c4c4047192fd65c38015b8afc7f9fc50404d75380b5063808148c", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/component_durability_fixture.rs": "0742bc08fdb8df34fea31ce3106b068b20657b9ee91715077de67af5361faff2" + }, + "fixtures_sha256": { + ".local/rust-component-durability-parity/inputs.txt": "2fda29555c2f6a6ff6524352105a0ac3c0557f17e894c493e0ecc9b72fed43a2" + }, + "rust_output_sha256": "1b6178df52a47a16066177ea127e9b036e27ecd3c1d68a1ddb7b81617bbe0a27", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "1b6178df52a47a16066177ea127e9b036e27ecd3c1d68a1ddb7b81617bbe0a27", + "matched_output_lines": 83727 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "1b6178df52a47a16066177ea127e9b036e27ecd3c1d68a1ddb7b81617bbe0a27", + "matched_output_lines": 83727 + } + ], + "scope": "Actual unenchanted ItemStack durability operations with nonempty prototypes, visible component patches at callbacks, stack copies before/after original mutation and unsanitized restored removals. Rust durability algorithms operate directly on copy-on-write component storage through DurabilityStorage. Includes creative/stat callback ordering, clamped writes, shrink/break state, empty stacks and storage mutation-before-error. Full item-component storage/codecs, enchantments, equipment lifecycle and complete gameplay integration remain pending." +} diff --git a/crates/horizon-world/examples/blocking_item_damage_fixture.rs b/crates/horizon-world/examples/blocking_item_damage_fixture.rs index 123369aaf..2fd39bea0 100644 --- a/crates/horizon-world/examples/blocking_item_damage_fixture.rs +++ b/crates/horizon-world/examples/blocking_item_damage_fixture.rs @@ -61,6 +61,10 @@ impl World<'_> { } impl DurabilityWorld for World<'_> { type Error = io::Error; + type Stack = DurabilityStack; + fn storage_error(error: std::convert::Infallible) -> Self::Error { + match error {} + } fn infinite_materials(&mut self, s: &mut DurabilityStack) -> io::Result { self.event(s, "infinite")?; Ok(self.f[if self.changed { diff --git a/crates/horizon-world/examples/component_durability_fixture.rs b/crates/horizon-world/examples/component_durability_fixture.rs new file mode 100644 index 000000000..99f6c2389 --- /dev/null +++ b/crates/horizon-world/examples/component_durability_fixture.rs @@ -0,0 +1,187 @@ +use horizon_world::{ + component_durability::{ + Change, ComponentDurability, DurabilityPatch, DurabilityPrototype, Key, + }, + component_patch::MissingPrototype, + item_durability::{self, DurabilityWorld}, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn changes(v: &Value) -> [Change; 3] { + [ + Change::MaxDamage(v["max"].as_i64().map(|v| v as i32)), + Change::Damage(v["damage"].as_i64().map(|v| v as i32)), + Change::Unbreakable(v["unbreakable"].as_bool().unwrap()), + ] +} +fn reset(s: &mut ComponentDurability, v: &Value) -> io::Result<()> { + s.count = v["count"].as_i64().unwrap() as i32; + for change in changes(v) { + match change { + Change::MaxDamage(None) => { + s.remove(Key::MaxDamage); + } + Change::Damage(None) => { + s.remove(Key::Damage); + } + Change::Unbreakable(false) => { + s.remove(Key::Unbreakable); + } + _ => { + s.set(change).map_err(io::Error::other)?; + } + } + } + Ok(()) +} +fn patch(v: &Value) -> DurabilityPatch { + DurabilityPatch::new( + v.as_array() + .unwrap() + .iter() + .map(|v| match v[0].as_u64().unwrap() { + 0 => Change::MaxDamage(v[1].as_i64().map(|v| v as i32)), + 1 => Change::Damage(v[1].as_i64().map(|v| v as i32)), + _ => Change::Unbreakable(!v[1].is_null()), + }), + ) +} +fn patch_text(s: &ComponentDurability) -> String { + s.as_patch() + .changes() + .map(|c| match c { + Change::MaxDamage(v) => format!("0={}", optional(v)), + Change::Damage(v) => format!("1={}", optional(v)), + Change::Unbreakable(v) => format!("2={}", if v { "0" } else { "none" }), + }) + .collect::>() + .join(",") +} +fn optional(v: Option) -> String { + v.map_or("none".into(), |v| v.to_string()) +} +fn snapshot(s: &ComponentDurability) -> String { + format!( + "{} {} {} {} {} {} {} {} {} {} {} {} | {}", + s.count, + s.count(), + optional(s.raw_component(Key::MaxDamage)), + optional(s.raw_component(Key::Damage)), + s.raw_component(Key::Unbreakable).is_some(), + s.max_damage(), + s.damage(), + s.is_empty(), + s.is_damageable(), + s.is_damaged(), + s.is_broken(), + s.next_damage_will_break(), + patch_text(s) + ) +} +struct World<'a> { + f: &'a Value, + out: &'a mut dyn Write, + calls: i64, + changed: bool, +} +impl World<'_> { + fn event(&mut self, s: &mut ComponentDurability, name: &str) -> io::Result<()> { + writeln!(self.out, "{name} | {}", snapshot(s))?; + let n = self.calls; + self.calls += 1; + if n == self.f["fail"].as_i64().unwrap() { + return Err(io::Error::other("injected callback failure")); + } + if n == self.f["mutate_at"].as_i64().unwrap() { + self.changed = true; + reset(s, &self.f["after"])?; + } + Ok(()) + } +} +impl DurabilityWorld for World<'_> { + type Error = io::Error; + type Stack = ComponentDurability; + fn storage_error(error: MissingPrototype) -> Self::Error { + io::Error::other(error) + } + fn infinite_materials(&mut self, s: &mut ComponentDurability) -> io::Result { + self.event(s, "infinite")?; + Ok(self.f[if self.changed { + "after_infinite" + } else { + "infinite" + }] + .as_bool() + .unwrap()) + } + fn process_enchantments( + &mut self, + _: &mut ComponentDurability, + amount: i32, + ) -> io::Result { + Ok(item_durability::unenchanted_change(amount)) + } + fn durability_changed(&mut self, s: &mut ComponentDurability, _: i32) -> io::Result<()> { + self.event(s, "criterion") + } + fn broken(&mut self, s: &mut ComponentDurability, copy: ComponentDurability) -> io::Result<()> { + writeln!(self.out, "copy {}", snapshot(©))?; + self.event(s, "break")?; + writeln!(self.out, "copy-after {}", snapshot(©)) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let prototype = DurabilityPrototype::new(changes(&f["prototype"])); + let mut s = ComponentDurability::new(&prototype, 1, f["air"].as_bool().unwrap()); + reset(&mut s, &f["initial"])?; + if let Some(v) = f.get("restore") { + s.restore_patch(&patch(v)); + } + let mut w = World { + f: &f, + out: &mut out, + calls: 0, + changed: false, + }; + let amount = f["amount"].as_i64().unwrap() as i32; + let result = match f["mode"].as_str().unwrap() { + "hurt" => item_durability::hurt_and_break( + &mut s, + &mut w, + amount, + f["player"].as_bool().unwrap(), + ), + "without" => w + .event(&mut s, "level") + .and_then(|()| item_durability::hurt_without_breaking(&mut s, &mut w, amount)), + "set" => s.set_damage(amount).map_err(io::Error::other), + "grow" => { + s.grow(amount); + Ok(()) + } + "shrink" => { + s.shrink(amount); + Ok(()) + } + "query" => Ok(()), + _ => panic!("mode"), + }; + writeln!( + w.out, + "result {}", + if result.is_ok() { "ok" } else { "error" } + )?; + writeln!(w.out, "state {} {} {}", snapshot(&s), w.calls, w.changed)?; + } + Ok(()) +} diff --git a/crates/horizon-world/examples/item_durability_fixture.rs b/crates/horizon-world/examples/item_durability_fixture.rs index b5109b89b..f051bb91c 100644 --- a/crates/horizon-world/examples/item_durability_fixture.rs +++ b/crates/horizon-world/examples/item_durability_fixture.rs @@ -57,6 +57,10 @@ impl World<'_> { } impl DurabilityWorld for World<'_> { type Error = io::Error; + type Stack = DurabilityStack; + fn storage_error(error: std::convert::Infallible) -> Self::Error { + match error {} + } fn infinite_materials(&mut self, s: &mut DurabilityStack) -> io::Result { self.event(s, "infinite")?; Ok(self.f[if self.changed { diff --git a/crates/horizon-world/src/blocking_item_damage.rs b/crates/horizon-world/src/blocking_item_damage.rs index df2ec4b90..466532f87 100644 --- a/crates/horizon-world/src/blocking_item_damage.rs +++ b/crates/horizon-world/src/blocking_item_damage.rs @@ -1,7 +1,7 @@ //! Blocking-component durability dispatch bound to stored item durability. use crate::{ blocking_rules::ItemDamageFunction, - item_durability::{self, DurabilityStack, DurabilityWorld}, + item_durability::{self, DurabilityWorld}, }; pub trait BlockingItemDamageWorld: DurabilityWorld { @@ -10,16 +10,16 @@ pub trait BlockingItemDamageWorld: DurabilityWorld { fn is_server_player(&self) -> bool; fn level_is_client( &mut self, - stack: &mut DurabilityStack, + stack: &mut Self::Stack, level: Self::Level, ) -> Result; /// Implementations capture the stack's current item type before awarding it. - fn award_item_used(&mut self, stack: &mut DurabilityStack) -> Result<(), Self::Error>; - fn entity_level_is_server(&mut self, stack: &mut DurabilityStack) -> Result; + fn award_item_used(&mut self, stack: &mut Self::Stack) -> Result<(), Self::Error>; + fn entity_level_is_server(&mut self, stack: &mut Self::Stack) -> Result; } pub fn hurt( - stack: &mut DurabilityStack, + stack: &mut W::Stack, world: &mut W, level: W::Level, damage: f32, diff --git a/crates/horizon-world/src/component_durability.rs b/crates/horizon-world/src/component_durability.rs new file mode 100644 index 000000000..15237133b --- /dev/null +++ b/crates/horizon-world/src/component_durability.rs @@ -0,0 +1,193 @@ +//! Durability backed by native-style component prototypes and patches. +//! Other item components and item identity are supplied by the containing stack. +use crate::{ + component_patch::{ComponentMap, MissingPrototype, Patch, Prototype}, + item_durability::DurabilityStorage, + item_use_catalog::UseComponents, +}; +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum Key { + MaxDamage, + Damage, + Unbreakable, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum Change { + MaxDamage(Option), + Damage(Option), + Unbreakable(bool), +} +impl Change { + fn parts(self) -> (Key, Option) { + match self { + Self::MaxDamage(v) => (Key::MaxDamage, v), + Self::Damage(v) => (Key::Damage, v), + Self::Unbreakable(v) => (Key::Unbreakable, v.then_some(0)), + } + } + fn from_parts(key: Key, v: Option) -> Self { + match key { + Key::MaxDamage => Self::MaxDamage(v), + Key::Damage => Self::Damage(v), + Key::Unbreakable => Self::Unbreakable(v.is_some()), + } + } +} +#[derive(Clone, Debug)] +pub struct DurabilityPrototype(Prototype); +impl DurabilityPrototype { + pub fn new(changes: impl IntoIterator) -> Self { + let mut entries = Vec::new(); + for change in changes { + let (k, v) = change.parts(); + let i = entries.iter().position(|(key, _)| *key == k); + match (v, i) { + (Some(v), Some(i)) => entries[i] = (k, v), + (Some(v), None) => entries.push((k, v)), + (None, Some(i)) => { + entries.remove(i); + } + (None, None) => {} + } + } + Self(Prototype::new(entries)) + } + pub fn from_defaults(defaults: &UseComponents) -> Self { + Self::new([ + Change::MaxDamage(defaults.max_damage), + Change::Damage(defaults.damage), + Change::Unbreakable(defaults.unbreakable), + ]) + } +} +#[derive(Clone, Debug)] +pub struct DurabilityPatch(Patch); +impl DurabilityPatch { + pub fn new(changes: impl IntoIterator) -> Self { + Self(Patch::new(changes.into_iter().map(Change::parts))) + } + pub fn changes(&self) -> impl Iterator + '_ { + self.0 + .entries() + .iter() + .map(|(k, v)| Change::from_parts(*k, *v)) + } +} +#[derive(Clone, Debug)] +pub struct ComponentDurability { + pub count: i32, + pub air: bool, + components: ComponentMap, +} +impl ComponentDurability { + pub fn new(prototype: &DurabilityPrototype, count: i32, air: bool) -> Self { + Self { + count, + air, + components: ComponentMap::new(prototype.0.clone()), + } + } + pub fn from_patch( + prototype: &DurabilityPrototype, + patch: &DurabilityPatch, + count: i32, + air: bool, + ) -> Self { + Self { + count, + air, + components: ComponentMap::from_patch(prototype.0.clone(), &patch.0), + } + } + pub fn is_empty(&self) -> bool { + self.air || self.count <= 0 + } + pub fn count(&self) -> i32 { + if self.is_empty() { 0 } else { self.count } + } + /// Raw storage remains present while the containing item stack is empty. + pub fn raw_component(&self, key: Key) -> Option { + self.components.get(&key).copied() + } + pub fn set(&mut self, change: Change) -> Result, MissingPrototype> { + let (k, v) = change.parts(); + self.components + .set(k, v) + .map(|old| old.map(|v| Change::from_parts(k, Some(v)))) + } + pub fn remove(&mut self, key: Key) -> Option { + self.components + .remove(key) + .map(|v| Change::from_parts(key, Some(v))) + } + pub fn apply_patch(&mut self, patch: &DurabilityPatch) { + self.components.apply_patch(&patch.0); + } + pub fn restore_patch(&mut self, patch: &DurabilityPatch) { + self.components.restore_patch(&patch.0); + } + pub fn as_patch(&self) -> DurabilityPatch { + DurabilityPatch(self.components.as_patch()) + } + pub fn max_damage(&self) -> i32 { + if self.is_empty() { + 0 + } else { + self.raw_component(Key::MaxDamage).unwrap_or(0) + } + } + pub fn damage(&self) -> i32 { + let value = if self.is_empty() { + 0 + } else { + self.raw_component(Key::Damage).unwrap_or(0) + }; + value.max(0).min(self.max_damage()) + } + pub fn set_damage(&mut self, value: i32) -> Result<(), MissingPrototype> { + self.set(Change::Damage(Some(value.max(0).min(self.max_damage())))) + .map(|_| ()) + } + pub fn is_damageable(&self) -> bool { + !self.is_empty() + && self.raw_component(Key::MaxDamage).is_some() + && self.raw_component(Key::Unbreakable).is_none() + && self.raw_component(Key::Damage).is_some() + } + pub fn is_damaged(&self) -> bool { + self.is_damageable() && self.damage() > 0 + } + pub fn is_broken(&self) -> bool { + self.is_damageable() && self.damage() >= self.max_damage() + } + pub fn next_damage_will_break(&self) -> bool { + self.is_damageable() && self.damage() >= self.max_damage().wrapping_sub(1) + } + pub fn grow(&mut self, amount: i32) { + self.count = self.count().wrapping_add(amount); + } + pub fn shrink(&mut self, amount: i32) { + self.grow(amount.wrapping_neg()); + } +} +impl DurabilityStorage for ComponentDurability { + type Error = MissingPrototype; + fn is_damageable(&self) -> bool { + self.is_damageable() + } + fn damage(&self) -> i32 { + self.damage() + } + fn max_damage(&self) -> i32 { + self.max_damage() + } + fn set_damage(&mut self, value: i32) -> Result<(), Self::Error> { + self.set_damage(value) + } + fn is_broken(&self) -> bool { + self.is_broken() + } + fn shrink(&mut self, amount: i32) { + self.shrink(amount); + } +} diff --git a/crates/horizon-world/src/item_durability.rs b/crates/horizon-world/src/item_durability.rs index fda13034c..9f48955fc 100644 --- a/crates/horizon-world/src/item_durability.rs +++ b/crates/horizon-world/src/item_durability.rs @@ -54,27 +54,58 @@ impl DurabilityStack { } } +/// Storage operations used by the native durability algorithm. Component-backed +/// implementations can preserve patch mutations and errors at each write. +pub trait DurabilityStorage: Clone { + type Error; + fn is_damageable(&self) -> bool; + fn damage(&self) -> i32; + fn max_damage(&self) -> i32; + fn set_damage(&mut self, value: i32) -> Result<(), Self::Error>; + fn is_broken(&self) -> bool; + fn shrink(&mut self, amount: i32); +} +impl DurabilityStorage for DurabilityStack { + type Error = std::convert::Infallible; + fn is_damageable(&self) -> bool { + self.is_damageable() + } + fn damage(&self) -> i32 { + self.damage() + } + fn max_damage(&self) -> i32 { + self.max_damage() + } + fn set_damage(&mut self, value: i32) -> Result<(), Self::Error> { + self.set_damage(value); + Ok(()) + } + fn is_broken(&self) -> bool { + self.is_broken() + } + fn shrink(&mut self, amount: i32) { + self.shrink(amount); + } +} pub trait DurabilityWorld { type Error; - fn infinite_materials(&mut self, stack: &mut DurabilityStack) -> Result; + type Stack: DurabilityStorage; + fn storage_error(error: ::Error) -> Self::Error; + fn infinite_materials(&mut self, stack: &mut Self::Stack) -> Result; /// Positive durability changes pass through the enchantment float pipeline, /// including when the stack has no enchantments. fn process_enchantments( &mut self, - stack: &mut DurabilityStack, + stack: &mut Self::Stack, amount: i32, ) -> Result; fn durability_changed( &mut self, - stack: &mut DurabilityStack, + stack: &mut Self::Stack, damage: i32, ) -> Result<(), Self::Error>; /// Called after shrinking the original stack, with the pre-shrink copy. - fn broken( - &mut self, - stack: &mut DurabilityStack, - copy: DurabilityStack, - ) -> Result<(), Self::Error>; + fn broken(&mut self, stack: &mut Self::Stack, copy: Self::Stack) -> Result<(), Self::Error>; } pub fn unenchanted_change(amount: i32) -> i32 { @@ -82,7 +113,7 @@ pub fn unenchanted_change(amount: i32) -> i32 { } pub fn process_change( - stack: &mut DurabilityStack, + stack: &mut W::Stack, world: &mut W, amount: i32, server_player: bool, @@ -98,7 +129,7 @@ pub fn process_change( } pub fn apply_damage( - stack: &mut DurabilityStack, + stack: &mut W::Stack, world: &mut W, damage: i32, server_player: bool, @@ -107,7 +138,7 @@ pub fn apply_damage( } fn apply_damage_with_break_callback( - stack: &mut DurabilityStack, + stack: &mut W::Stack, world: &mut W, damage: i32, server_player: bool, @@ -116,7 +147,7 @@ fn apply_damage_with_break_callback( if server_player { world.durability_changed(stack, damage)?; } - stack.set_damage(damage); + stack.set_damage(damage).map_err(W::storage_error)?; if stack.is_broken() { let copy = stack.clone(); stack.shrink(1); @@ -129,7 +160,7 @@ fn apply_damage_with_break_callback( /// The server-level overload; callers supply the already selected player kind. pub fn hurt_and_break( - stack: &mut DurabilityStack, + stack: &mut W::Stack, world: &mut W, amount: i32, server_player: bool, @@ -144,7 +175,7 @@ pub fn hurt_and_break( /// The body after the server-player/level checks of hurtWithoutBreaking. pub fn hurt_without_breaking( - stack: &mut DurabilityStack, + stack: &mut W::Stack, world: &mut W, amount: i32, ) -> Result<(), W::Error> { diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index daf2c8f2e..7fe60dbbe 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -21,6 +21,7 @@ pub mod climbing; pub mod collision; pub mod collision_context; pub mod combat_rules; +pub mod component_durability; pub mod component_patch; pub mod compression; pub mod damage_immunity; diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 883c00a18..0ce7ddc16 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1610,3 +1610,22 @@ has no prototype default. Targeted Clippy passes. Prototypes have at most seven keys in this suite; callers supply prototype order and native value equality. Native large-prototype identity-hash ordering, codecs, mutable payload aliases and full item/inventory integration remain pending. + + +`component_durability` binds damage/count queries and mutations directly to +shared component prototypes and patches. The durability algorithm now accepts +`DurabilityStorage`, so writes and storage errors occur at their native points, +including before break callbacks. The earlier plain durability projection +remains supported through the same interface. + +`python3 tools/test_component_durability_parity.py` compares native ItemStack +operations with nonempty prototypes and observable patches at every callback. +The [component durability report](../benchmarks/rust-component-durability-2026-10-07/scoped-parity.json) +records **83,727 matching lines per JAR**, including original/copy independence +and mutation-before-error for unsanitized restored removals. Targeted Clippy +passes. The refactor also preserves both native regression suites: +[scalar durability](../benchmarks/rust-component-durability-2026-10-07/scalar-regression.json) +(**81,762 lines per JAR**) and +[blocking durability](../benchmarks/rust-component-durability-2026-10-07/blocking-regression.json) +(**71,800 lines per JAR**). Full component codecs, enchanted durability, equipment +and complete gameplay integration remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaComponentDurabilityOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaComponentDurabilityOracle.java new file mode 100644 index 000000000..8d73686f7 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaComponentDurabilityOracle.java @@ -0,0 +1,26 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.lang.reflect.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.*;import net.minecraft.core.component.*;import net.minecraft.core.registries.*;import net.minecraft.world.item.*;import net.minecraft.server.level.*;import net.minecraft.server.PlayerAdvancements; +/** Actual durability writes into shared prototypes and observable component patches. */ +public final class VanillaComponentDurabilityOracle { + static final class Stop extends RuntimeException {} + static Object unsafe;static Method allocate;static Field components,count,patchMap;static Object removed; + static T make(Class c)throws Exception{return c.cast(allocate.invoke(unsafe,c));} + static Field field(Class c,String n)throws Exception{var f=c.getDeclaredField(n);f.setAccessible(true);return f;} + static String optional(Object v){return v==null?"none":v.toString();} + static DataComponentMap prototype(JsonObject f){var b=DataComponentMap.builder();if(!f.get("max").isJsonNull())b.set(DataComponents.MAX_DAMAGE,f.get("max").getAsInt());if(!f.get("damage").isJsonNull())b.set(DataComponents.DAMAGE,f.get("damage").getAsInt());if(f.get("unbreakable").getAsBoolean())b.set(DataComponents.UNBREAKABLE,net.minecraft.util.Unit.INSTANCE);return b.build();} + static DataComponentPatch patch(JsonArray a){var b=DataComponentPatch.builder();for(var e:a){var pair=e.getAsJsonArray();int key=pair.get(0).getAsInt();var v=pair.get(1);if(key==0){if(v.isJsonNull())b.remove(DataComponents.MAX_DAMAGE);else b.set(DataComponents.MAX_DAMAGE,v.getAsInt());}else if(key==1){if(v.isJsonNull())b.remove(DataComponents.DAMAGE);else b.set(DataComponents.DAMAGE,v.getAsInt());}else{if(v.isJsonNull())b.remove(DataComponents.UNBREAKABLE);else b.set(DataComponents.UNBREAKABLE,net.minecraft.util.Unit.INSTANCE);}}return b.build();} + static String patchText(PatchedDataComponentMap c)throws Exception{var join=new StringJoiner(",");for(var e:((Map)patchMap.get(c.asPatch())).entrySet()){int key=e.getKey()==DataComponents.MAX_DAMAGE?0:e.getKey()==DataComponents.DAMAGE?1:2;join.add(key+"="+(e.getValue()==removed?"none":key==2?"0":e.getValue().toString()));}return join.toString();} + static String snapshot(ItemStack s){try{var c=(PatchedDataComponentMap)components.get(s);return count.getInt(s)+" "+s.getCount()+" "+optional(c.get(DataComponents.MAX_DAMAGE))+" "+optional(c.get(DataComponents.DAMAGE))+" "+c.has(DataComponents.UNBREAKABLE)+" "+s.getMaxDamage()+" "+s.getDamageValue()+" "+s.isEmpty()+" "+s.isDamageableItem()+" "+s.isDamaged()+" "+s.isBroken()+" "+s.nextDamageWillBreak()+" | "+patchText(c);}catch(Exception e){throw new AssertionError(e);}} + static void reset(ItemStack s,JsonObject f){s.setCount(f.get("count").getAsInt());if(f.get("max").isJsonNull())s.remove(DataComponents.MAX_DAMAGE);else s.set(DataComponents.MAX_DAMAGE,f.get("max").getAsInt());if(f.get("damage").isJsonNull())s.remove(DataComponents.DAMAGE);else s.set(DataComponents.DAMAGE,f.get("damage").getAsInt());if(f.get("unbreakable").getAsBoolean())s.set(DataComponents.UNBREAKABLE,net.minecraft.util.Unit.INSTANCE);else s.remove(DataComponents.UNBREAKABLE);} + static final class Data {JsonObject f;PrintWriter out;int calls;boolean changed;ItemStack stack;PlayerAdvancements advancements; + void event(String s){out.println(s+" | "+snapshot(stack));int n=calls++;if(n==f.get("fail").getAsInt())throw new Stop();if(n==f.get("mutate_at").getAsInt()){changed=true;reset(stack,f.getAsJsonObject("after"));}} + boolean infinite(){return f.get(changed?"after_infinite":"infinite").getAsBoolean();}} + static final class Human extends ServerPlayer {Data d;Human(){super(null,null,null,null);}@Override public boolean hasInfiniteMaterials(){d.event("infinite");return d.infinite();}@Override public PlayerAdvancements getAdvancements(){d.event("criterion");return d.advancements;}@Override public ServerLevel level(){d.event("level");return null;}} + public static void main(String[] args)throws Exception{ + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();var u=Class.forName("sun.misc.Unsafe");unsafe=field(u,"theUnsafe").get(null);allocate=u.getMethod("allocateInstance",Class.class);patchMap=field(DataComponentPatch.class,"map");removed=field(Class.forName("net.minecraft.core.component.Removed"),"INSTANCE").get(null);components=field(ItemStack.class,"components");count=field(ItemStack.class,"count");var ctor=ItemStack.class.getDeclaredConstructor(Holder.class,int.class,PatchedDataComponentMap.class);ctor.setAccessible(true);Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var d=new Data();d.f=JsonParser.parseString(line).getAsJsonObject();d.out=out;d.advancements=make(PlayerAdvancements.class);field(PlayerAdvancements.class,"activeTriggers").set(d.advancements,new HashMap<>());var actor=make(Human.class);actor.d=d;d.stack=(ItemStack)ctor.newInstance(BuiltInRegistries.ITEM.wrapAsHolder(d.f.get("air").getAsBoolean()?Items.AIR:Items.SHIELD),1,new PatchedDataComponentMap(prototype(d.f.getAsJsonObject("prototype"))));reset(d.stack,d.f.getAsJsonObject("initial"));if(d.f.has("restore"))((PatchedDataComponentMap)components.get(d.stack)).restorePatch(patch(d.f.getAsJsonArray("restore")));int amount=d.f.get("amount").getAsInt(); + try{switch(d.f.get("mode").getAsString()){case "hurt":d.stack.hurtAndBreak(amount,(ServerLevel)null,d.f.get("player").getAsBoolean()?actor:null,copy->{out.println("copy "+snapshot(copy));d.event("break");out.println("copy-after "+snapshot(copy));});break;case "without":d.stack.hurtWithoutBreaking(amount,actor);break;case "set":d.stack.setDamageValue(amount);break;case "grow":d.stack.grow(amount);break;case "shrink":d.stack.shrink(amount);break;case "query":break;default:throw new AssertionError();}out.println("result ok");}catch(Stop|NullPointerException e){out.println("result error");}out.println("state "+snapshot(d.stack)+" "+d.calls+" "+d.changed); + }} + } +} diff --git a/tools/test_component_durability_parity.py b/tools/test_component_durability_parity.py new file mode 100644 index 000000000..f37b501a9 --- /dev/null +++ b/tools/test_component_durability_parity.py @@ -0,0 +1,87 @@ +#!/usr/bin/env python3 +"""Compare durability algorithms bound to actual prototype/patch storage.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def base_corpus(): + modes = ['hurt', 'without', 'set', 'query', 'grow', 'shrink'] + edges = [-2147483648, -2147483647, -1, 0, 1, 2, 19, 20, 21, 16777215, 16777216, 16777217, 2147483646, 2147483647] + def state(count=1, maximum=20, damage=0, unbreakable=False): + return dict(count=count, max=maximum, damage=damage, unbreakable=unbreakable) + def row(mode='hurt', amount=1, **kw): + f = dict(mode=mode, amount=amount, air=False, player=True, infinite=False, after_infinite=False, initial=state(), after=state(count=2, maximum=5, damage=4), fail=-1, mutate_at=-1) + f.update(kw) + return f + for mode in modes: + for maximum in [None, *edges]: + for damage in [None, *edges]: + for amount in edges: + yield row(mode, amount, initial=state(maximum=maximum, damage=damage)) + for mode in ['hurt', 'without']: + for mutate in range(-1, 5): + for fail in range(-1, 5): + for count in [-1, 0, 1, 2]: + for maximum in [None, 0, 5, 20]: + yield row(mode, 20, mutate_at=mutate, fail=fail, after=state(count=count, maximum=maximum, damage=4)) + rng = random.Random(0x4455524142494c) + def integer(): return rng.choice(edges) if rng.randrange(2) else rng.randrange(-2147483648, 2147483648) + def random_state(): return state(rng.choice([-2, 0, 1, 2, 64, 2147483647]), rng.choice([None, integer()]), rng.choice([None, integer()]), bool(rng.randrange(2))) + for _ in range(10000): + yield row(rng.choice(modes), integer(), air=bool(rng.randrange(5)==0), player=bool(rng.randrange(2)), infinite=bool(rng.randrange(2)), after_infinite=bool(rng.randrange(2)), initial=random_state(), after=random_state(), fail=rng.choice([-1, -1, *range(5)]), mutate_at=rng.randrange(-1, 5)) + + +def corpus(): + prototypes=[dict(max=None,damage=None,unbreakable=False),dict(max=20,damage=0,unbreakable=False),dict(max=20,damage=0,unbreakable=True),dict(max=None,damage=5,unbreakable=False),dict(max=-2147483648,damage=-1,unbreakable=False)] + for i,row in enumerate(base_corpus()): + yield row | dict(prototype=prototypes[i%len(prototypes)]) + for prototype in prototypes: + for amount in [-2147483648,-1,0,1,20,2147483647]: + for mode in ['hurt','without','set']: + yield dict(mode=mode,amount=amount,air=False,player=True,infinite=False,after_infinite=False,prototype=prototype,initial=dict(count=1,max=20,damage=0,unbreakable=False),after=dict(count=2,max=5,damage=4,unbreakable=False),fail=-1,mutate_at=-1,restore=[[1,None],[0,20]]) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-component-durability-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaComponentDurabilityOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/component_durability_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaComponentDurabilityOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','component_durability_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('component_durability_fixture.exe' if os.name=='nt' else 'component_durability_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} component durability output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual unenchanted ItemStack durability operations with nonempty prototypes, visible component patches at callbacks, stack copies before/after original mutation and unsanitized restored removals. Rust durability algorithms operate directly on copy-on-write component storage through DurabilityStorage. Includes creative/stat callback ordering, clamped writes, shrink/break state, empty stacks and storage mutation-before-error. Full item-component storage/codecs, enchantments, equipment lifecycle and complete gameplay integration remain pending.'} + lab.write_json(report_path,report);print(f'Scoped component durability parity passed: {report_path}') + + +if __name__=='__main__':main() From cda5895cab5910cf67cfecc6f70a2b04dd784330 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 07:30:19 +0200 Subject: [PATCH 135/253] Implement item stack storage, copy identity and consumption semantics --- .../scoped-parity.json | 270 ++++++++++++++++++ .../examples/item_stack_storage_fixture.rs | 208 ++++++++++++++ .../horizon-world/src/item_stack_storage.rs | 142 +++++++++ crates/horizon-world/src/lib.rs | 1 + docs/collision-geometry.md | 17 ++ .../parity/VanillaItemStackStorageOracle.java | 28 ++ tools/test_item_stack_storage_parity.py | 75 +++++ 7 files changed, 741 insertions(+) create mode 100644 benchmarks/rust-item-stack-storage-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/item_stack_storage_fixture.rs create mode 100644 crates/horizon-world/src/item_stack_storage.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemStackStorageOracle.java create mode 100644 tools/test_item_stack_storage_parity.py diff --git a/benchmarks/rust-item-stack-storage-2026-10-07/scoped-parity.json b/benchmarks/rust-item-stack-storage-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..c663d8efd --- /dev/null +++ b/benchmarks/rust-item-stack-storage-2026-10-07/scoped-parity.json @@ -0,0 +1,270 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 7856, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemStackStorageOracle.java": "c0d3bc4258af40bd30cd7050c9924214cf47fbbfffb86b2a78391a04a07e349f", + "tools/test_item_stack_storage_parity.py": "a59129e0acdf6d97ba8f29440b26a77b58940ba28e58b5b1b515b1c48380f37a", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "6884c7209f007ab9ee742b9c3c73828cfa1c6753d35b5fe25a87cab5955b33f8", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "18bbad377a8047e4d4ecd0fc87d83d46d1c0f1ce2b8c47bbe64633e7b4420b57", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/blocking_item_damage.rs": "afea3cb5761e8b82ee4d9bb4ef3c6fd10182a324dbaec99e6c9ebfac255dda09", + "crates/horizon-world/src/blocking_rules.rs": "83c5e2105cec56a90182ce582e1c67ade2b189be6de1a34d08035000cc07c492", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/component_durability.rs": "37a46e184f95bc5027e2b9af72ff52f729ad03601d08e1827f181fca383a35af", + "crates/horizon-world/src/component_patch.rs": "3622244ccdee46e13956c64ffe9be6234e686adf58dbc3a24cece0f1814301a1", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_immunity.rs": "fd39c41124d694e755cf7faadcf93c636df4042c78ec345092a856b5f952dbcf", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/damage_source.rs": "24945e397a926d34695652980923609e4723e02fe6b6e56d4aaf673e45d759f7", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/item_blocking.rs": "f6eee0d6d177cc3148960122327ba1b459a2f0e85241c1d9a3e40f0b8c169296", + "crates/horizon-world/src/item_durability.rs": "9fdf835e5c7bd0e1dd63ef2ba0076b770cdd4d6d14cdcd11de27690f0702f94e", + "crates/horizon-world/src/item_stack_storage.rs": "b4dcb83dcaa346848c5484161feb3e2cf08e83f7793d7ed83be25b14b9d12884", + "crates/horizon-world/src/item_use.rs": "1d0a3afa61b60d356e81a063da79ec6cd38730315976640a591325fc4c8ab98c", + "crates/horizon-world/src/item_use_catalog.rs": "a9b53d2e816583239a75c3c61e78dacc5e3b27dee595be34b1c7fa169f17a571", + "crates/horizon-world/src/item_use_lifecycle.rs": "f9b29f42a528493d0d2521110d4f6e0bc89af8f579d539648cb7c3a9e68e31cd", + "crates/horizon-world/src/item_use_start.rs": "9996a9b90c313925cd90e78c02880f2a1d2ae65aef53f4ce081578a9dcd10c62", + "crates/horizon-world/src/lib.rs": "30f06d90b851c51290d33731f12e9ca6b5c8f7ddb1490556fe8e525e0225f439", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "2b448209629b9bf2e678d667ad0d6c7fa22146892dd106b169d96b31b0df12bb", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_hurt.rs": "844239ad7d15c39629bb3cfc06ebae6d1cff20b7627468f26e0ee8dff3abdcb8", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_hurt.rs": "99c9bbd8587ec2dc287806049897b8034d2f5349ad47fc497b70d54148844a36", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/server_player_combat.rs": "a9743971581af86d926eeba42004d932caf83382c470dd98bf613cb9c417db58", + "crates/horizon-world/src/server_player_damage.rs": "828a4649fec3e9bda2dfe20aced8c95922c697321de2be4127bd4e5712ecbb7c", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "f417aab280331ddd6f0ca265a12c0130c78b9924f407c7e07f198140501e6010", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/view_direction.rs": "e18120ae26dc5cf702b29fc4c8487088bab133c8ce5abce01226833fafb0d5a4", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "74e4110fb19c4c4047192fd65c38015b8afc7f9fc50404d75380b5063808148c", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/item_stack_storage_fixture.rs": "879e8d9b020d0e26509c5f956422cfe8b18f3660af28a7288223ac5cd007a3e3" + }, + "fixtures_sha256": { + ".local/rust-item-stack-storage-parity/inputs.txt": "223f3aaf0ce510f847d985a2b07bd308b3390f928ac629fa70e34f08f406bfac" + }, + "rust_output_sha256": "e3a8ddede3cc75d9a148e2d619d083c9a9764594e99a87629a4bafc4fb4c80e2", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "e3a8ddede3cc75d9a148e2d619d083c9a9764594e99a87629a4bafc4fb4c80e2", + "matched_output_lines": 568580 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "e3a8ddede3cc75d9a148e2d619d083c9a9764594e99a87629a4bafc4fb4c80e2", + "matched_output_lines": 568580 + } + ], + "scope": "Actual ItemStack count/pop-time storage, component visibility, copy/copyWithCount/copyAndClear, split, grow/shrink/limit, transmuteCopy, consume and consumeAndReturn. Bound small native prototypes and integer components expose patch sanitation, copies and iterator order. Fixture item-store handles preserve canonical EMPTY aliases, including mutations; callbacks cover creative material queries, original mutation and failures after the returned copy is captured. Count/type/component comparison predicates are compared throughout. Full component codecs, inventory transactions, use/equipment lifecycle and complete gameplay integration remain pending." +} diff --git a/crates/horizon-world/examples/item_stack_storage_fixture.rs b/crates/horizon-world/examples/item_stack_storage_fixture.rs new file mode 100644 index 000000000..bceb9f797 --- /dev/null +++ b/crates/horizon-world/examples/item_stack_storage_fixture.rs @@ -0,0 +1,208 @@ +use horizon_world::{ + component_patch::{Patch, Prototype}, + item_stack_storage::{CopyResult, ItemStackData}, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +type Stack = ItemStackData; +fn optional(v: Option) -> String { + v.map_or("none".into(), |v| v.to_string()) +} +fn patch(v: &Value) -> Patch { + Patch::new(v.as_array().unwrap().iter().map(|v| { + ( + v[0].as_u64().unwrap() as usize, + v[1].as_i64().map(|v| v as i32), + ) + })) +} +fn patch_text(p: &Patch) -> String { + p.entries() + .iter() + .map(|(k, v)| format!("{k}={}", optional(*v))) + .collect::>() + .join(",") +} +fn snapshot(s: &Stack, canonical: bool) -> String { + let visible = (0..4) + .map(|k| optional(s.component(&k).copied())) + .collect::>() + .join(","); + let entries = s + .components + .entries() + .map(|(k, v)| format!("{k}={v}")) + .collect::>() + .join(","); + format!( + "{} {} {} {} {} {} {} | {} | {} | {} | {}", + canonical, + if canonical { + -1 + } else { + i32::from(s.stored_item()) + }, + s.item(), + s.count, + s.count(), + s.pop_time, + s.is_empty(), + visible, + entries, + patch_text(&s.components.as_patch()), + patch_text(&s.visible_patch()) + ) +} +fn all(out: &mut dyn Write, arena: &[Stack], slots: &[usize; 3]) -> io::Result<()> { + for (i, id) in slots.iter().enumerate() { + writeln!(out, "slot {i} {}", snapshot(&arena[*id], *id == 0))?; + } + for a in 0..3 { + for b in a + 1..3 { + let sa = &arena[slots[a]]; + let sb = &arena[slots[b]]; + writeln!( + out, + "equal {a} {b} {} {} {} {}", + slots[a] == slots[b], + sa.same_item(sb), + sa.same_item_components(sb), + sa.matches(sb) + )?; + } + } + Ok(()) +} +fn append(arena: &mut Vec, copy: CopyResult) -> usize { + match copy { + CopyResult::Empty => 0, + CopyResult::Stack(s) => { + arena.push(s); + arena.len() - 1 + } + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let prototypes: Vec<_> = f["prototypes"] + .as_array() + .unwrap() + .iter() + .map(|p| { + Prototype::new(p.as_array().unwrap().iter().map(|v| { + ( + v[0].as_u64().unwrap() as usize, + v[1].as_i64().unwrap() as i32, + ) + })) + }) + .collect(); + let mut arena = vec![Stack::new(0, 0, 0, Prototype::new([]))]; + let mut slots = [0; 3]; + for (i, v) in f["stacks"].as_array().unwrap().iter().enumerate() { + let item = v["item"].as_i64().unwrap(); + if item >= 0 { + let mut s = Stack::new( + item as u8, + 0, + v["count"].as_i64().unwrap() as i32, + prototypes[item as usize].clone(), + ); + s.pop_time = v["pop"].as_i64().unwrap() as i32; + s.components.restore_patch(&patch(&v["patch"])); + arena.push(s); + slots[i] = arena.len() - 1; + } + } + all(&mut out, &arena, &slots)?; + for op in f["ops"].as_array().unwrap() { + let a = op["a"].as_u64().unwrap() as usize; + let b = op["b"].as_u64().unwrap() as usize; + let amount = op["amount"].as_i64().unwrap() as i32; + let id = slots[a]; + let mut calls = 0; + let result = (|| -> io::Result<()> { + match op["kind"].as_str().unwrap() { + "count" => arena[id].count = amount, + "pop" => arena[id].pop_time = amount, + "grow" => arena[id].grow(amount), + "shrink" => arena[id].shrink(amount), + "limit" => arena[id].limit_size(amount), + "set" => { + let value = arena[id] + .components + .set( + op["key"].as_u64().unwrap() as usize, + op["value"].as_i64().map(|v| v as i32), + ) + .map_err(io::Error::other)?; + writeln!(out, "old {}", optional(value))?; + } + "copy" | "copy-count" | "copy-clear" | "split" | "transmute" => { + let copy = match op["kind"].as_str().unwrap() { + "copy" => arena[id].copy(), + "copy-count" => arena[id].copy_with_count(amount), + "copy-clear" => arena[id].copy_and_clear(), + "split" => arena[id].split(amount), + _ => { + let item = op["item"].as_u64().unwrap() as usize; + arena[id].transmute_copy( + item as u8, + prototypes[item].clone(), + amount, + ) + } + }; + slots[b] = append(&mut arena, copy); + } + "consume" | "consume-return" => { + let infinite = |s: &mut Stack| -> io::Result { + writeln!(out, "infinite | {}", snapshot(s, id == 0))?; + calls += 1; + if op["fail"].as_bool().unwrap() { + return Err(io::Error::other("injected callback failure")); + } + if op["mutate"].as_bool().unwrap() { + s.count = op["after_count"].as_i64().unwrap() as i32; + s.pop_time = op["after_pop"].as_i64().unwrap() as i32; + for pair in op["after_components"].as_array().unwrap() { + s.components + .set( + pair[0].as_u64().unwrap() as usize, + pair[1].as_i64().map(|v| v as i32), + ) + .map_err(io::Error::other)?; + } + } + Ok(op["infinite"].as_bool().unwrap()) + }; + let actor = op["actor"].as_bool().unwrap(); + if op["kind"] == "consume" { + arena[id].consume(amount, actor, infinite)?; + } else { + let copy = arena[id].consume_and_return(amount, actor, infinite)?; + slots[b] = append(&mut arena, copy); + } + } + _ => panic!("operation"), + }; + Ok(()) + })(); + writeln!( + out, + "result {} {calls}", + if result.is_ok() { "ok" } else { "error" } + )?; + all(&mut out, &arena, &slots)?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/src/item_stack_storage.rs b/crates/horizon-world/src/item_stack_storage.rs new file mode 100644 index 000000000..8b5092a62 --- /dev/null +++ b/crates/horizon-world/src/item_stack_storage.rs @@ -0,0 +1,142 @@ +//! Item-stack data kernels over component storage. Stable object identity belongs +//! to the containing item store; CopyResult::Empty means its canonical EMPTY. +use crate::component_patch::{ComponentMap, Patch, Prototype}; +#[derive(Clone, Debug)] +pub struct ItemStackData { + item: I, + air: I, + pub count: i32, + pub pop_time: i32, + pub components: ComponentMap, +} +#[derive(Clone, Debug)] +pub enum CopyResult { + Empty, + Stack(T), +} +impl ItemStackData { + pub fn new(item: I, air: I, count: i32, prototype: Prototype) -> Self { + Self { + item, + air, + count, + pop_time: 0, + components: ComponentMap::new(prototype), + } + } + pub fn is_empty(&self) -> bool { + self.item == self.air || self.count <= 0 + } + pub fn stored_item(&self) -> I { + self.item + } + pub fn item(&self) -> I { + if self.is_empty() { self.air } else { self.item } + } + pub fn count(&self) -> i32 { + if self.is_empty() { 0 } else { self.count } + } + pub fn component(&self, key: &K) -> Option<&V> { + if self.is_empty() { + None + } else { + self.components.get(key) + } + } + pub fn visible_patch(&self) -> Patch { + if self.is_empty() { + Patch::new([]) + } else { + self.components.as_patch() + } + } + pub fn copy(&self) -> CopyResult { + if self.is_empty() { + CopyResult::Empty + } else { + CopyResult::Stack(self.clone()) + } + } + pub fn copy_with_count(&self, count: i32) -> CopyResult { + match self.copy() { + CopyResult::Empty => CopyResult::Empty, + CopyResult::Stack(mut s) => { + s.count = count; + CopyResult::Stack(s) + } + } + } + pub fn copy_and_clear(&mut self) -> CopyResult { + if self.is_empty() { + return CopyResult::Empty; + } + let copy = self.copy(); + self.count = 0; + copy + } + pub fn grow(&mut self, amount: i32) { + self.count = self.count().wrapping_add(amount); + } + pub fn shrink(&mut self, amount: i32) { + self.grow(amount.wrapping_neg()); + } + pub fn limit_size(&mut self, limit: i32) { + if !self.is_empty() && self.count() > limit { + self.count = limit; + } + } + pub fn split(&mut self, amount: i32) -> CopyResult { + let amount = amount.min(self.count()); + let copy = self.copy_with_count(amount); + self.shrink(amount); + copy + } + pub fn transmute_copy( + &self, + item: I, + prototype: Prototype, + count: i32, + ) -> CopyResult { + if self.is_empty() { + return CopyResult::Empty; + } + CopyResult::Stack(Self { + item, + air: self.air, + count, + pop_time: 0, + components: ComponentMap::from_patch(prototype, &self.components.as_patch()), + }) + } + pub fn same_item(&self, other: &Self) -> bool { + self.item() == other.item() + } + pub fn same_item_components(&self, other: &Self) -> bool { + self.same_item(other) + && ((self.is_empty() && other.is_empty()) || self.components == other.components) + } + pub fn matches(&self, other: &Self) -> bool { + self.count() == other.count() && self.same_item_components(other) + } + pub fn consume( + &mut self, + amount: i32, + has_actor: bool, + infinite: impl FnOnce(&mut Self) -> Result, + ) -> Result<(), E> { + if !has_actor || !infinite(self)? { + self.shrink(amount); + } + Ok(()) + } + pub fn consume_and_return( + &mut self, + amount: i32, + has_actor: bool, + infinite: impl FnOnce(&mut Self) -> Result, + ) -> Result, E> { + let copy = self.copy_with_count(amount); + self.consume(amount, has_actor, infinite)?; + Ok(copy) + } +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 7fe60dbbe..33dc676b8 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -48,6 +48,7 @@ pub mod heightmap; pub mod interaction_shapes; pub mod item_blocking; pub mod item_durability; +pub mod item_stack_storage; pub mod item_use; pub mod item_use_catalog; pub mod item_use_lifecycle; diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 0ce7ddc16..3d0ba68cc 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1629,3 +1629,20 @@ passes. The refactor also preserves both native regression suites: [blocking durability](../benchmarks/rust-component-durability-2026-10-07/blocking-regression.json) (**71,800 lines per JAR**). Full component codecs, enchanted durability, equipment and complete gameplay integration remain pending. + + +`item_stack_storage` implements stored item identity, count/pop-time storage, +component visibility, copying, splitting, transmutation and consumption. Copies +share component data until a write; canonical empty results are explicit so a +containing item store can preserve reference identity. Negative counts and +wrapping arithmetic follow the pinned methods, including mutations to an empty +stack and consumption callbacks that change or fail after a copy is captured. + +`python3 tools/test_item_stack_storage_parity.py` compares 7,856 fixtures with +actual native ItemStack methods and small bound integer-component prototypes. +The [storage report](../benchmarks/rust-item-stack-storage-2026-10-07/scoped-parity.json) +records **568,580 matching lines per JAR**. Comparisons include raw and visible +state, component patch order, stack identity and item/component/count equality. +Targeted Clippy passes. The fixture arena preserves canonical EMPTY aliases; +a production inventory, full component values/codecs and complete item-use, +equipment and game-tick integration remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemStackStorageOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemStackStorageOracle.java new file mode 100644 index 000000000..34c5bfa86 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemStackStorageOracle.java @@ -0,0 +1,28 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import com.mojang.serialization.Codec;import java.io.*;import java.lang.reflect.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.*;import net.minecraft.core.component.*;import net.minecraft.world.item.*; +/** Native item-stack copy/count/component kernels, retaining canonical EMPTY identity. */ +public final class VanillaItemStackStorageOracle { + static final class Stop extends RuntimeException {} + static DataComponentType[] keys;static Item[] items;static Field components,count,item,patchMap;static Object removed,unsafe;static Method allocate; + static Field field(Class c,String n)throws Exception{var f=c.getDeclaredField(n);f.setAccessible(true);return f;} + static T make(Class c)throws Exception{return c.cast(allocate.invoke(unsafe,c));} + static String optional(Object v){return v==null||v==removed?"none":v.toString();} + static int kind(Item i){for(int k=0;k)patchMap.get(p)).entrySet())join.add(key(e.getKey())+"="+optional(e.getValue()));return join.toString();} + static String snapshot(ItemStack s){try{var raw=(PatchedDataComponentMap)components.get(s);var h=(Holder)item.get(s);var visible=new StringJoiner(",");for(var k:keys)visible.add(optional(s.get(k)));var entries=new StringJoiner(",");for(var e:raw)entries.add(key(e.type())+"="+e.value());return (s==ItemStack.EMPTY)+" "+(h==null?-1:kind((Item)h.value()))+" "+kind(s.getItem())+" "+count.getInt(s)+" "+s.getCount()+" "+s.getPopTime()+" "+s.isEmpty()+" | "+visible+" | "+entries+" | "+patchText(raw.asPatch())+" | "+patchText(s.getComponentsPatch());}catch(Exception e){throw new AssertionError(e);}} + static void all(PrintWriter out,ItemStack[] slots){for(int i=0;ibuilder().persistent(Codec.INT).build();items=new Item[]{Items.AIR,Items.STICK,Items.SHIELD};components=field(ItemStack.class,"components");count=field(ItemStack.class,"count");item=field(ItemStack.class,"item");patchMap=field(DataComponentPatch.class,"map");removed=field(Class.forName("net.minecraft.core.component.Removed"),"INSTANCE").get(null);var u=Class.forName("sun.misc.Unsafe");unsafe=field(u,"theUnsafe").get(null);allocate=u.getMethod("allocateInstance",Class.class);Path dir=Path.of(args[1]);try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();for(int i=0;i<3;i++)items[i].builtInRegistryHolder().bindComponents(prototype(f.getAsJsonArray("prototypes").get(i).getAsJsonArray()));ItemStack.EMPTY.setCount(0);ItemStack.EMPTY.setPopTime(0);((PatchedDataComponentMap)components.get(ItemStack.EMPTY)).clearPatch();var slots=new ItemStack[3];for(int i=0;i<3;i++){var v=f.getAsJsonArray("stacks").get(i).getAsJsonObject();int type=v.get("item").getAsInt();slots[i]=type<0?ItemStack.EMPTY:new ItemStack(items[type],v.get("count").getAsInt());if(type>=0){slots[i].setPopTime(v.get("pop").getAsInt());((PatchedDataComponentMap)components.get(slots[i])).restorePatch(patch(v.getAsJsonArray("patch")));}}var d=new Data();d.out=out;var actor=make(Actor.class);actor.d=d;all(out,slots);for(var ov:f.getAsJsonArray("ops")){var op=ov.getAsJsonObject();d.op=op;d.calls=0;int a=op.get("a").getAsInt(),b=op.get("b").getAsInt(),amount=op.get("amount").getAsInt();d.target=slots[a];try{switch(op.get("kind").getAsString()){ + case "count":slots[a].setCount(amount);break;case "pop":slots[a].setPopTime(amount);break;case "grow":slots[a].grow(amount);break;case "shrink":slots[a].shrink(amount);break;case "limit":slots[a].limitSize(amount);break; + case "set":out.println("old "+optional(slots[a].set(keys[op.get("key").getAsInt()],op.get("value").isJsonNull()?null:op.get("value").getAsInt())));break; + case "copy":slots[b]=slots[a].copy();break;case "copy-count":slots[b]=slots[a].copyWithCount(amount);break;case "copy-clear":slots[b]=slots[a].copyAndClear();break;case "split":slots[b]=slots[a].split(amount);break; + case "transmute":slots[b]=slots[a].transmuteCopy(items[op.get("item").getAsInt()],amount);break; + case "consume":slots[a].consume(amount,op.get("actor").getAsBoolean()?actor:null);break; + case "consume-return":slots[b]=slots[a].consumeAndReturn(amount,op.get("actor").getAsBoolean()?actor:null);break; + default:throw new AssertionError();}out.println("result ok "+d.calls);}catch(Stop|NullPointerException e){out.println("result error "+d.calls);}all(out,slots);}}}} +} diff --git a/tools/test_item_stack_storage_parity.py b/tools/test_item_stack_storage_parity.py new file mode 100644 index 000000000..a882c6db2 --- /dev/null +++ b/tools/test_item_stack_storage_parity.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python3 +"""Compare native item-stack data, copies, split/transmute and consumption.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + kinds=['count','pop','grow','shrink','limit','set','copy','copy-count','copy-clear','split','transmute','consume','consume-return'] + edges=[-2147483648,-2147483647,-1,0,1,2,64,2147483646,2147483647] + def op(kind,amount=1,**kw): + v=dict(kind=kind,a=0,b=1,amount=amount,key=0,value=1,item=2,actor=True,fail=False,mutate=False,infinite=False,after_count=2,after_pop=8,after_components=[[0,9],[1,None]]);v.update(kw);return v + def row(item=1,count=1,ops=None):return dict(prototypes=[[],[[0,2],[1,3]],[[0,8],[2,4]]],stacks=[dict(item=item,count=count,pop=5,patch=[]),dict(item=2,count=2,pop=9,patch=[]),dict(item=-1,count=0,pop=0,patch=[])],ops=ops or []) + for kind in kinds: + for item in [-1,0,1,2]: + for count in edges: + for amount in edges:yield row(item,count,[op(kind,amount),op('count',1),op('set',value=3)]) + for kind in ['consume','consume-return']: + for mutate in [False,True]: + for infinite in [False,True]: + for fail in [False,True]: + for count in edges:yield row(1,count,[op(kind,-1,mutate=mutate,infinite=infinite,fail=fail)]) + rng=random.Random(0x535441434b444154) + def integer():return rng.choice(edges) if rng.randrange(2) else rng.randrange(-2147483648,2147483648) + def entries():return [[rng.randrange(4),rng.choice([None,integer()])] for _ in range(rng.randrange(9))] + for _ in range(3500): + prototypes=[[[k,integer()] for k in rng.sample(range(4),rng.randrange(5))] for __ in range(3)] + stacks=[dict(item=rng.randrange(-1,3),count=integer(),pop=integer(),patch=entries()) for __ in range(3)] + ops=[op(rng.choice(kinds),integer(),a=rng.randrange(3),b=rng.randrange(3),key=rng.randrange(4),value=rng.choice([None,integer()]),item=rng.randrange(3),actor=bool(rng.randrange(2)),fail=bool(rng.randrange(2)),mutate=bool(rng.randrange(2)),infinite=bool(rng.randrange(2)),after_count=integer(),after_pop=integer(),after_components=entries()) for __ in range(rng.randrange(10,25))] + yield dict(prototypes=prototypes,stacks=stacks,ops=ops) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-item-stack-storage-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemStackStorageOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/item_stack_storage_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaItemStackStorageOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','item_stack_storage_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('item_stack_storage_fixture.exe' if os.name=='nt' else 'item_stack_storage_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} item stack storage output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual ItemStack count/pop-time storage, component visibility, copy/copyWithCount/copyAndClear, split, grow/shrink/limit, transmuteCopy, consume and consumeAndReturn. Bound small native prototypes and integer components expose patch sanitation, copies and iterator order. Fixture item-store handles preserve canonical EMPTY aliases, including mutations; callbacks cover creative material queries, original mutation and failures after the returned copy is captured. Count/type/component comparison predicates are compared throughout. Full component codecs, inventory transactions, use/equipment lifecycle and complete gameplay integration remain pending.'} + lab.write_json(report_path,report);print(f'Scoped item stack storage parity passed: {report_path}') + + +if __name__=='__main__':main() From 202dad8192cddea32acdc89cada7dfc2aa236b5e Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 07:41:29 +0200 Subject: [PATCH 136/253] Add shared item references and native container transfer behavior --- .../scoped-parity.json | 272 ++++++++++++++++++ .../examples/simple_container_fixture.rs | 253 ++++++++++++++++ crates/horizon-world/src/item_stack_refs.rs | 64 +++++ crates/horizon-world/src/lib.rs | 3 + crates/horizon-world/src/simple_container.rs | 220 ++++++++++++++ docs/collision-geometry.md | 18 ++ .../parity/VanillaSimpleContainerOracle.java | 28 ++ tools/test_simple_container_parity.py | 86 ++++++ 8 files changed, 944 insertions(+) create mode 100644 benchmarks/rust-simple-container-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/simple_container_fixture.rs create mode 100644 crates/horizon-world/src/item_stack_refs.rs create mode 100644 crates/horizon-world/src/simple_container.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleContainerOracle.java create mode 100644 tools/test_simple_container_parity.py diff --git a/benchmarks/rust-simple-container-2026-10-07/scoped-parity.json b/benchmarks/rust-simple-container-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..c614edde5 --- /dev/null +++ b/benchmarks/rust-simple-container-2026-10-07/scoped-parity.json @@ -0,0 +1,272 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 6273, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleContainerOracle.java": "9757a90d83941614d94a089a60cc7309db617991e1d99a22d9f6b73c3b06a572", + "tools/test_simple_container_parity.py": "53e810759ea1e12025f419e2c89133e8eed2fb1f841388a753be14e4b2d304a1", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "6884c7209f007ab9ee742b9c3c73828cfa1c6753d35b5fe25a87cab5955b33f8", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "18bbad377a8047e4d4ecd0fc87d83d46d1c0f1ce2b8c47bbe64633e7b4420b57", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/blocking_item_damage.rs": "afea3cb5761e8b82ee4d9bb4ef3c6fd10182a324dbaec99e6c9ebfac255dda09", + "crates/horizon-world/src/blocking_rules.rs": "83c5e2105cec56a90182ce582e1c67ade2b189be6de1a34d08035000cc07c492", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/component_durability.rs": "37a46e184f95bc5027e2b9af72ff52f729ad03601d08e1827f181fca383a35af", + "crates/horizon-world/src/component_patch.rs": "3622244ccdee46e13956c64ffe9be6234e686adf58dbc3a24cece0f1814301a1", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_immunity.rs": "fd39c41124d694e755cf7faadcf93c636df4042c78ec345092a856b5f952dbcf", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/damage_source.rs": "24945e397a926d34695652980923609e4723e02fe6b6e56d4aaf673e45d759f7", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/item_blocking.rs": "f6eee0d6d177cc3148960122327ba1b459a2f0e85241c1d9a3e40f0b8c169296", + "crates/horizon-world/src/item_durability.rs": "9fdf835e5c7bd0e1dd63ef2ba0076b770cdd4d6d14cdcd11de27690f0702f94e", + "crates/horizon-world/src/item_stack_refs.rs": "1a83604c256a51898b59b0087c2378282bcebe7883add2c4634dc7f9183d6e49", + "crates/horizon-world/src/item_stack_storage.rs": "b4dcb83dcaa346848c5484161feb3e2cf08e83f7793d7ed83be25b14b9d12884", + "crates/horizon-world/src/item_use.rs": "1d0a3afa61b60d356e81a063da79ec6cd38730315976640a591325fc4c8ab98c", + "crates/horizon-world/src/item_use_catalog.rs": "a9b53d2e816583239a75c3c61e78dacc5e3b27dee595be34b1c7fa169f17a571", + "crates/horizon-world/src/item_use_lifecycle.rs": "f9b29f42a528493d0d2521110d4f6e0bc89af8f579d539648cb7c3a9e68e31cd", + "crates/horizon-world/src/item_use_start.rs": "9996a9b90c313925cd90e78c02880f2a1d2ae65aef53f4ce081578a9dcd10c62", + "crates/horizon-world/src/lib.rs": "2145c37c7daadf735451a1e3f8e39fff005243861d1d8261cdb557dea7b8c466", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "2b448209629b9bf2e678d667ad0d6c7fa22146892dd106b169d96b31b0df12bb", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_hurt.rs": "844239ad7d15c39629bb3cfc06ebae6d1cff20b7627468f26e0ee8dff3abdcb8", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_hurt.rs": "99c9bbd8587ec2dc287806049897b8034d2f5349ad47fc497b70d54148844a36", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/server_player_combat.rs": "a9743971581af86d926eeba42004d932caf83382c470dd98bf613cb9c417db58", + "crates/horizon-world/src/server_player_damage.rs": "828a4649fec3e9bda2dfe20aced8c95922c697321de2be4127bd4e5712ecbb7c", + "crates/horizon-world/src/simple_container.rs": "0fedbc7e974b1db79b88bd6aff977654189a5d553cf42852fe8bf0885cf90b30", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "f417aab280331ddd6f0ca265a12c0130c78b9924f407c7e07f198140501e6010", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/view_direction.rs": "e18120ae26dc5cf702b29fc4c8487088bab133c8ce5abce01226833fafb0d5a4", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "74e4110fb19c4c4047192fd65c38015b8afc7f9fc50404d75380b5063808148c", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/simple_container_fixture.rs": "72eeb6dd9ae37b35643d9231047785dae0307d396ec2850e865f18a554580928" + }, + "fixtures_sha256": { + ".local/rust-simple-container-parity/inputs.txt": "4335da72561507dd19276c020cd198aa0d91d9034839f83707fcf75b4cc3df6b" + }, + "rust_output_sha256": "d8d71155d43f9cd6874344c27da2b0a07eaca7803592dfe53d98347c0dff12a5", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "d8d71155d43f9cd6874344c27da2b0a07eaca7803592dfe53d98347c0dff12a5", + "matched_output_lines": 590402 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "d8d71155d43f9cd6874344c27da2b0a07eaca7803592dfe53d98347c0dff12a5", + "matched_output_lines": 590402 + } + ], + "scope": "Actual SimpleContainer get/set/add/removal, reverse remove-by-type, clear/remove-all, can-add and count queries over real shared ItemStack storage. Small native prototypes expose component equality and copy isolation; alias identities and raw/visible state are traced. Native size/change callbacks cover mutations and failures before/after storage writes. Rust uses production reference-counted stack storage and container methods. Persistence, recipe accounting, arbitrary getItem/setItem overrides, player inventory/menu transactions, full component values and complete gameplay integration remain pending." +} diff --git a/crates/horizon-world/examples/simple_container_fixture.rs b/crates/horizon-world/examples/simple_container_fixture.rs new file mode 100644 index 000000000..44f9a382a --- /dev/null +++ b/crates/horizon-world/examples/simple_container_fixture.rs @@ -0,0 +1,253 @@ +use horizon_world::{ + component_patch::{Patch, Prototype}, + item_stack_refs::{ItemStacks, StackRef}, + simple_container::{ContainerHooks, SimpleContainer}, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +type Stack = StackRef; +type Container = SimpleContainer; +fn integer(v: &Value, k: &str) -> i32 { + v[k].as_i64().unwrap() as i32 +} +fn opt(v: Option) -> String { + v.map_or("none".into(), |v| v.to_string()) +} +fn max(s: &Stack) -> i32 { + s.read().component(&0).copied().unwrap_or(1) +} +struct World { + out: io::BufWriter, + refs: Vec, + ids: Vec, + empty: Stack, + op: Value, + calls: i32, +} +impl World { + fn snapshot(&mut self, s: &Stack) -> String { + let id = self + .ids + .iter() + .position(|v| v.same_reference(s)) + .unwrap_or_else(|| { + self.ids.push(s.clone()); + self.ids.len() - 1 + }); + let s = s.read(); + let patch = s.components.as_patch(); + format!( + "{} {} {} {} {} {} {} | {} | {}", + id, + s.item(), + s.count, + s.count(), + s.pop_time, + s.is_empty(), + s.component(&0).copied().unwrap_or(1), + (0..3) + .map(|k| opt(s.component(&k).copied())) + .collect::>() + .join(","), + patch + .entries() + .iter() + .map(|(k, v)| format!("{k}={}", opt(*v))) + .collect::>() + .join(",") + ) + } + fn all(&mut self, c: &Container) { + for i in 0..self.refs.len() { + let s = self.snapshot(&self.refs[i].clone()); + writeln!(self.out, "ref {i} {s}").unwrap(); + } + for (i, s) in c.items().iter().enumerate() { + let s = self.snapshot(s); + writeln!(self.out, "slot {i} {s}").unwrap(); + } + let s = self.snapshot(&self.empty.clone()); + writeln!(self.out, "empty {s}").unwrap(); + writeln!( + self.out, + "container {} {} {} {} {}", + c.size(), + c.is_empty(), + c.count_item(0), + c.count_item(1), + c.count_item(2) + ) + .unwrap(); + } + fn event(&mut self, c: &mut Container, name: &str) -> Result<(), ()> { + self.calls += 1; + writeln!(self.out, "event {name} {}", self.calls).unwrap(); + self.all(c); + if self.calls == integer(&self.op, "fail_at") { + return Err(()); + } + if self.calls == integer(&self.op, "mutate_at") { + let i = integer(&self.op, "mutate_ref") as usize; + let mut s = self.refs[i].write(); + s.count = integer(&self.op, "after_count"); + s.components + .set(0, Some(integer(&self.op, "after_max"))) + .map_err(|_| ())?; + drop(s); + let slot = integer(&self.op, "mutate_slot"); + if slot >= 0 && (slot as usize) < c.size() { + c.items_mut()[slot as usize] = + self.refs[integer(&self.op, "replace_ref") as usize].clone(); + } + } + Ok(()) + } +} +impl ContainerHooks for World { + type Error = (); + fn max_stack_size(&mut self, c: &mut Container) -> Result { + self.event(c, "max")?; + Ok(integer(&self.op, "max")) + } + fn item_max_stack_size(&self, s: &Stack) -> i32 { + max(s) + } + fn changed(&mut self, c: &mut Container) -> Result<(), ()> { + self.event(c, "changed") + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let prototypes: Vec<_> = f["prototypes"] + .as_array() + .unwrap() + .iter() + .map(|p| { + Prototype::new(p.as_array().unwrap().iter().map(|v| { + ( + v[0].as_u64().unwrap() as usize, + v[1].as_i64().unwrap() as i32, + ) + })) + }) + .collect(); + let stacks = ItemStacks::new(0); + let empty = stacks.empty(); + let refs: Vec<_> = f["stacks"] + .as_array() + .unwrap() + .iter() + .map(|v| { + let item = integer(v, "item"); + if item < 0 { + empty.clone() + } else { + let s = stacks.create( + item as u8, + integer(v, "count"), + prototypes[item as usize].clone(), + ); + s.write().pop_time = integer(v, "pop"); + s.write().components.restore_patch(&Patch::new( + v["patch"].as_array().unwrap().iter().map(|v| { + ( + v[0].as_u64().unwrap() as usize, + v[1].as_i64().map(|n| n as i32), + ) + }), + )); + s + } + }) + .collect(); + let mut c = Container::from_items( + f["slots"] + .as_array() + .unwrap() + .iter() + .map(|i| refs[i.as_u64().unwrap() as usize].clone()) + .collect(), + stacks.clone(), + ); + let mut w = World { + out, + refs, + ids: vec![empty.clone()], + empty, + op: Value::Null, + calls: 0, + }; + w.all(&c); + for op in f["ops"].as_array().unwrap() { + w.op = op.clone(); + w.calls = 0; + let a = integer(op, "a") as usize; + let b = integer(op, "b") as usize; + let slot = integer(op, "slot"); + let amount = integer(op, "amount"); + let result = (|| -> Result<(), ()> { + match op["kind"].as_str().unwrap() { + "set" => c.set(slot, w.refs[a].clone(), &mut w).map_err(|_| ())?, + "add" => { + let input = w.refs[a].clone(); + w.refs[b] = c.add(&input, &mut w).map_err(|_| ())?; + } + "remove" => w.refs[b] = c.remove(slot, amount, &mut w).map_err(|_| ())?, + "remove-type" => { + let i = integer(op, "item") as usize; + w.refs[b] = c + .remove_type(i as u8, prototypes[i].clone(), amount, &mut w) + .map_err(|_| ())?; + } + "no-update" => w.refs[b] = c.remove_no_update::<()>(slot).map_err(|_| ())?, + "clear" => c.clear(&mut w).map_err(|_| ())?, + "all" => { + let result = c.remove_all(&mut w).map_err(|_| ())?; + writeln!(w.out, "all-size {}", result.len()).unwrap(); + for s in result { + let s = w.snapshot(&s); + writeln!(w.out, "removed {s}").unwrap(); + } + } + "can-add" => { + let v = c.can_add(&w.refs[a], &w); + writeln!(w.out, "can-add {v}").unwrap(); + } + "get" => w.refs[b] = c.get(slot), + "alias" => w.refs[b] = w.refs[a].clone(), + "copy" => w.refs[b] = stacks.copy(&w.refs[a]), + "count" => w.refs[a].write().count = amount, + "component" => { + w.refs[a] + .write() + .components + .set( + integer(op, "key") as usize, + op["value"].as_i64().map(|n| n as i32), + ) + .map_err(|_| ())?; + } + _ => panic!("operation"), + } + Ok(()) + })(); + writeln!( + w.out, + "result {} {}", + if result.is_ok() { "ok" } else { "error" }, + w.calls + )?; + w.all(&c); + } + out = w.out; + } + Ok(()) +} diff --git a/crates/horizon-world/src/item_stack_refs.rs b/crates/horizon-world/src/item_stack_refs.rs new file mode 100644 index 000000000..e74af1aaf --- /dev/null +++ b/crates/horizon-world/src/item_stack_refs.rs @@ -0,0 +1,64 @@ +//! Shared stack identity for inventories. Cloning a reference retains the same +//! stack; `ItemStacks::copy` copies its value with copy-on-write components. +//! These references belong to the simulation thread and release unreachable +//! stacks automatically. No borrow is held across a container callback. +use crate::{ + component_patch::Prototype, + item_stack_storage::{CopyResult, ItemStackData}, +}; +use std::{ + cell::{Ref, RefCell, RefMut}, + rc::Rc, +}; +#[derive(Debug)] +pub struct StackRef(Rc>>); +impl Clone for StackRef { + fn clone(&self) -> Self { + Self(self.0.clone()) + } +} +impl StackRef { + pub fn new(data: ItemStackData) -> Self { + Self(Rc::new(RefCell::new(data))) + } + pub fn read(&self) -> Ref<'_, ItemStackData> { + self.0.borrow() + } + pub fn write(&self) -> RefMut<'_, ItemStackData> { + self.0.borrow_mut() + } + pub fn same_reference(&self, other: &Self) -> bool { + Rc::ptr_eq(&self.0, &other.0) + } +} +#[derive(Clone, Debug)] +pub struct ItemStacks { + air: I, + empty: StackRef, +} +impl ItemStacks { + pub fn new(air: I) -> Self { + Self { + air, + empty: StackRef::new(ItemStackData::new(air, air, 0, Prototype::new([]))), + } + } + pub fn empty(&self) -> StackRef { + self.empty.clone() + } + pub fn create(&self, item: I, count: i32, prototype: Prototype) -> StackRef { + StackRef::new(ItemStackData::new(item, self.air, count, prototype)) + } + pub fn resolve(&self, copy: CopyResult>) -> StackRef { + match copy { + CopyResult::Empty => self.empty(), + CopyResult::Stack(data) => StackRef::new(data), + } + } + pub fn copy(&self, stack: &StackRef) -> StackRef { + self.resolve(stack.read().copy()) + } + pub fn split(&self, stack: &StackRef, amount: i32) -> StackRef { + self.resolve(stack.write().split(amount)) + } +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 33dc676b8..5d2b7b506 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -93,3 +93,6 @@ pub mod world_ray; pub mod worldgen; pub const DATA_VERSION: i32 = 5023; + +pub mod item_stack_refs; +pub mod simple_container; diff --git a/crates/horizon-world/src/simple_container.rs b/crates/horizon-world/src/simple_container.rs new file mode 100644 index 000000000..b0e4a7ba0 --- /dev/null +++ b/crates/horizon-world/src/simple_container.rs @@ -0,0 +1,220 @@ +//! SimpleContainer storage and transfers using shared stack references. +//! Item component semantics and the virtual size/change hooks are supplied by +//! the caller. Menu transactions, persistence and recipe accounting are separate. +use crate::{ + component_patch::Prototype, + item_stack_refs::{ItemStacks, StackRef}, +}; +#[derive(Debug)] +pub enum ContainerError { + Index, + Callback(E), +} +pub type ContainerResult = Result>; +#[derive(Debug)] +pub struct SimpleContainer { + items: Vec>, + stacks: ItemStacks, +} +pub trait ContainerHooks { + type Error; + /// Native getMaxStackSize(), normally 99; called before the item's limit. + fn max_stack_size( + &mut self, + container: &mut SimpleContainer, + ) -> Result; + fn item_max_stack_size(&self, stack: &StackRef) -> i32; + fn changed(&mut self, container: &mut SimpleContainer) -> Result<(), Self::Error>; +} +impl SimpleContainer { + pub fn new(size: usize, stacks: ItemStacks) -> Self { + Self { + items: vec![stacks.empty(); size], + stacks, + } + } + /// Like the native varargs constructor, this retains aliases without limits. + pub fn from_items(items: Vec>, stacks: ItemStacks) -> Self { + Self { items, stacks } + } + pub fn items(&self) -> &[StackRef] { + &self.items + } + pub fn items_mut(&mut self) -> &mut [StackRef] { + &mut self.items + } + pub fn size(&self) -> usize { + self.items.len() + } + pub fn is_empty(&self) -> bool { + self.items.iter().all(|s| s.read().is_empty()) + } + pub fn get(&self, index: i32) -> StackRef { + usize::try_from(index) + .ok() + .and_then(|i| self.items.get(i)) + .cloned() + .unwrap_or_else(|| self.stacks.empty()) + } + pub fn count_item(&self, item: I) -> i32 { + self.items.iter().fold(0_i32, |total, s| { + let s = s.read(); + if s.item() == item { + total.wrapping_add(s.count()) + } else { + total + } + }) + } + pub fn can_add>( + &self, + stack: &StackRef, + hooks: &H, + ) -> bool { + self.items.iter().any(|s| { + s.read().is_empty() + || (s.read().same_item_components(&stack.read()) + && s.read().count() < hooks.item_max_stack_size(s)) + }) + } + fn limit>( + &mut self, + stack: &StackRef, + hooks: &mut H, + ) -> Result> { + let container = hooks + .max_stack_size(self) + .map_err(ContainerError::Callback)?; + Ok(container.min(hooks.item_max_stack_size(stack))) + } + pub fn set>( + &mut self, + index: i32, + stack: StackRef, + hooks: &mut H, + ) -> Result<(), ContainerError> { + let slot = usize::try_from(index) + .ok() + .and_then(|i| self.items.get_mut(i)) + .ok_or(ContainerError::Index)?; + *slot = stack.clone(); + let limit = self.limit(&stack, hooks)?; + stack.write().limit_size(limit); + hooks.changed(self).map_err(ContainerError::Callback) + } + pub fn remove>( + &mut self, + index: i32, + amount: i32, + hooks: &mut H, + ) -> Result, ContainerError> { + let s = self.get(index); + let result = if amount > 0 && !s.read().is_empty() { + self.stacks.split(&s, amount) + } else { + self.stacks.empty() + }; + if !result.read().is_empty() { + hooks.changed(self).map_err(ContainerError::Callback)?; + } + Ok(result) + } + pub fn remove_no_update( + &mut self, + index: i32, + ) -> Result, ContainerError> { + let slot = usize::try_from(index) + .ok() + .and_then(|i| self.items.get_mut(i)) + .ok_or(ContainerError::Index)?; + if slot.read().is_empty() { + Ok(self.stacks.empty()) + } else { + Ok(std::mem::replace(slot, self.stacks.empty())) + } + } + pub fn remove_type>( + &mut self, + item: I, + prototype: Prototype, + amount: i32, + hooks: &mut H, + ) -> Result, ContainerError> { + let result = self.stacks.create(item, 0, prototype); + for index in (0..self.size()).rev() { + let s = self.items[index].clone(); + if s.read().item() == item { + let wanted = amount.wrapping_sub(result.read().count()); + let removed = self.stacks.split(&s, wanted); + result.write().grow(removed.read().count()); + if result.read().count() == amount { + break; + } + } + } + if !result.read().is_empty() { + hooks.changed(self).map_err(ContainerError::Callback)?; + } + Ok(result) + } + pub fn clear>( + &mut self, + hooks: &mut H, + ) -> Result<(), ContainerError> { + self.items.fill(self.stacks.empty()); + hooks.changed(self).map_err(ContainerError::Callback) + } + pub fn remove_all>( + &mut self, + hooks: &mut H, + ) -> ContainerResult>, H::Error> { + let result = self + .items + .iter() + .filter(|s| !s.read().is_empty()) + .cloned() + .collect(); + self.clear(hooks)?; + Ok(result) + } + pub fn add>( + &mut self, + stack: &StackRef, + hooks: &mut H, + ) -> Result, ContainerError> { + if stack.read().is_empty() { + return Ok(self.stacks.empty()); + } + let remainder = self.stacks.copy(stack); + for index in 0..self.size() { + let target = self.items[index].clone(); + if target.read().same_item_components(&remainder.read()) { + let limit = self.limit(&target, hooks)?; + let amount = remainder + .read() + .count() + .min(limit.wrapping_sub(target.read().count())); + if amount > 0 { + target.write().grow(amount); + remainder.write().shrink(amount); + hooks.changed(self).map_err(ContainerError::Callback)?; + } + if remainder.read().is_empty() { + return Ok(self.stacks.empty()); + } + } + } + for index in 0..self.size() { + if self.items[index].read().is_empty() { + let moved = self.stacks.resolve(remainder.write().copy_and_clear()); + self.set(index as i32, moved, hooks)?; + break; + } + } + if remainder.read().is_empty() { + Ok(self.stacks.empty()) + } else { + Ok(remainder) + } + } +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 3d0ba68cc..28fe03e77 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1646,3 +1646,21 @@ state, component patch order, stack identity and item/component/count equality. Targeted Clippy passes. The fixture arena preserves canonical EMPTY aliases; a production inventory, full component values/codecs and complete item-use, equipment and game-tick integration remain pending. + + +`item_stack_refs` adds shared stack identity with automatic reference-counted +lifetime management on the simulation thread. `simple_container` uses these +references for get/set, merging, removals, reverse removal by type, clearing, +capacity checks and item counts. Copies retain independent component patches; +container slots and callers can deliberately share the same stack. + +`python3 tools/test_simple_container_parity.py` compares actual native container +and stack methods, including changes and failures in virtual size/change hooks. +The [container report](../benchmarks/rust-simple-container-2026-10-07/scoped-parity.json) +records **590,402 matching lines per JAR**. It checks alias identity, raw/visible +counts, empty-stack references, component-sensitive merging, overflow, invalid +indices and mutation prefixes on failure. In particular, native insertion into +the first empty slot clears the remainder before limiting the inserted copy. +Targeted Clippy passes. Player inventory, menus, crafting accounting, persistence, +arbitrary getItem/setItem overrides and complete gameplay integration remain +pending. Reference counting here has not been benchmarked as a performance gain. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleContainerOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleContainerOracle.java new file mode 100644 index 000000000..e26350caa --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSimpleContainerOracle.java @@ -0,0 +1,28 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import com.mojang.serialization.Codec;import java.io.*;import java.lang.reflect.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.component.*;import net.minecraft.world.item.*;import net.minecraft.world.SimpleContainer; +/** Actual SimpleContainer methods over aliased ItemStack objects and bound prototypes. */ +public final class VanillaSimpleContainerOracle { + static final class Stop extends RuntimeException {} + static Item[] items;static DataComponentType[] keys;static Field components,count,patchMap;static Object removed; + static Field field(Class c,String n)throws Exception{var f=c.getDeclaredField(n);f.setAccessible(true);return f;} + static int integer(JsonObject o,String k){return o.get(k).getAsInt();} + static int key(Object k){for(int i=0;i identities=new IdentityHashMap<>(); + int id(ItemStack s){return identities.computeIfAbsent(s,k->identities.size());} + String snapshot(ItemStack s){try{var raw=(PatchedDataComponentMap)components.get(s);var p=new StringJoiner(",");for(var e:((Map)patchMap.get(raw.asPatch())).entrySet())p.add(key(e.getKey())+"="+opt(e.getValue()));var v=new StringJoiner(",");for(var k:keys)v.add(opt(s.get(k)));return id(s)+" "+item(s.getItem())+" "+count.getInt(s)+" "+s.getCount()+" "+s.getPopTime()+" "+s.isEmpty()+" "+s.getMaxStackSize()+" | "+v+" | "+p;}catch(Exception e){throw new AssertionError(e);}} + void all(){for(int i=0;i=0&&slotbuilder().persistent(Codec.INT).build()};components=field(ItemStack.class,"components");count=field(ItemStack.class,"count");patchMap=field(DataComponentPatch.class,"map");removed=field(Class.forName("net.minecraft.core.component.Removed"),"INSTANCE").get(null);Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();for(int i=0;i<3;i++)items[i].builtInRegistryHolder().bindComponents(prototype(f.getAsJsonArray("prototypes").get(i).getAsJsonArray()));ItemStack.EMPTY.setCount(0);ItemStack.EMPTY.setPopTime(0);((PatchedDataComponentMap)components.get(ItemStack.EMPTY)).clearPatch();var d=new Data();d.out=out;d.identities.put(ItemStack.EMPTY,0);d.refs=new ItemStack[f.getAsJsonArray("stacks").size()];for(int i=0;i=0){d.refs[i].setPopTime(integer(v,"pop"));((PatchedDataComponentMap)components.get(d.refs[i])).restorePatch(patch(v.getAsJsonArray("patch")));}}var slots=new ItemStack[f.getAsJsonArray("slots").size()];for(int i=0;i Date: Wed, 7 Oct 2026 07:47:32 +0200 Subject: [PATCH 137/253] Implement player inventory storage and shared equipment selection --- .../scoped-parity.json | 273 ++++++++++++++ .../examples/player_inventory_fixture.rs | 303 ++++++++++++++++ crates/horizon-world/src/lib.rs | 2 + crates/horizon-world/src/player_inventory.rs | 336 ++++++++++++++++++ docs/collision-geometry.md | 20 ++ .../parity/VanillaPlayerInventoryOracle.java | 37 ++ tools/test_player_inventory_parity.py | 84 +++++ 7 files changed, 1055 insertions(+) create mode 100644 benchmarks/rust-player-inventory-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/player_inventory_fixture.rs create mode 100644 crates/horizon-world/src/player_inventory.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerInventoryOracle.java create mode 100644 tools/test_player_inventory_parity.py diff --git a/benchmarks/rust-player-inventory-2026-10-07/scoped-parity.json b/benchmarks/rust-player-inventory-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..62eee6f69 --- /dev/null +++ b/benchmarks/rust-player-inventory-2026-10-07/scoped-parity.json @@ -0,0 +1,273 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 3960, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerInventoryOracle.java": "dc30eda6ef4b858b8cd43e7d486895b4b3be3e6454b013ac1b86ef231ca36294", + "tools/test_player_inventory_parity.py": "e9330270104479af8d7b7ba360d2b66f64f0960a6b13351c113d00967e7f3fc0", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "6884c7209f007ab9ee742b9c3c73828cfa1c6753d35b5fe25a87cab5955b33f8", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "18bbad377a8047e4d4ecd0fc87d83d46d1c0f1ce2b8c47bbe64633e7b4420b57", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/blocking_item_damage.rs": "afea3cb5761e8b82ee4d9bb4ef3c6fd10182a324dbaec99e6c9ebfac255dda09", + "crates/horizon-world/src/blocking_rules.rs": "83c5e2105cec56a90182ce582e1c67ade2b189be6de1a34d08035000cc07c492", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/component_durability.rs": "37a46e184f95bc5027e2b9af72ff52f729ad03601d08e1827f181fca383a35af", + "crates/horizon-world/src/component_patch.rs": "3622244ccdee46e13956c64ffe9be6234e686adf58dbc3a24cece0f1814301a1", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_immunity.rs": "fd39c41124d694e755cf7faadcf93c636df4042c78ec345092a856b5f952dbcf", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/damage_source.rs": "24945e397a926d34695652980923609e4723e02fe6b6e56d4aaf673e45d759f7", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/item_blocking.rs": "f6eee0d6d177cc3148960122327ba1b459a2f0e85241c1d9a3e40f0b8c169296", + "crates/horizon-world/src/item_durability.rs": "9fdf835e5c7bd0e1dd63ef2ba0076b770cdd4d6d14cdcd11de27690f0702f94e", + "crates/horizon-world/src/item_stack_refs.rs": "1a83604c256a51898b59b0087c2378282bcebe7883add2c4634dc7f9183d6e49", + "crates/horizon-world/src/item_stack_storage.rs": "b4dcb83dcaa346848c5484161feb3e2cf08e83f7793d7ed83be25b14b9d12884", + "crates/horizon-world/src/item_use.rs": "1d0a3afa61b60d356e81a063da79ec6cd38730315976640a591325fc4c8ab98c", + "crates/horizon-world/src/item_use_catalog.rs": "a9b53d2e816583239a75c3c61e78dacc5e3b27dee595be34b1c7fa169f17a571", + "crates/horizon-world/src/item_use_lifecycle.rs": "f9b29f42a528493d0d2521110d4f6e0bc89af8f579d539648cb7c3a9e68e31cd", + "crates/horizon-world/src/item_use_start.rs": "9996a9b90c313925cd90e78c02880f2a1d2ae65aef53f4ce081578a9dcd10c62", + "crates/horizon-world/src/lib.rs": "73067d8cbb5b1b6a6e460abc0a36ba4ea79de2d3c6d664374fb06f7c256aa0d1", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "2b448209629b9bf2e678d667ad0d6c7fa22146892dd106b169d96b31b0df12bb", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_hurt.rs": "844239ad7d15c39629bb3cfc06ebae6d1cff20b7627468f26e0ee8dff3abdcb8", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_hurt.rs": "99c9bbd8587ec2dc287806049897b8034d2f5349ad47fc497b70d54148844a36", + "crates/horizon-world/src/player_inventory.rs": "e1d08747516ba9a8b3c8f7627ba9b6caa14677a53efacfe863ab782d13c6110f", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/server_player_combat.rs": "a9743971581af86d926eeba42004d932caf83382c470dd98bf613cb9c417db58", + "crates/horizon-world/src/server_player_damage.rs": "828a4649fec3e9bda2dfe20aced8c95922c697321de2be4127bd4e5712ecbb7c", + "crates/horizon-world/src/simple_container.rs": "0fedbc7e974b1db79b88bd6aff977654189a5d553cf42852fe8bf0885cf90b30", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "f417aab280331ddd6f0ca265a12c0130c78b9924f407c7e07f198140501e6010", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/view_direction.rs": "e18120ae26dc5cf702b29fc4c8487088bab133c8ce5abce01226833fafb0d5a4", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "74e4110fb19c4c4047192fd65c38015b8afc7f9fc50404d75380b5063808148c", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/player_inventory_fixture.rs": "5e8f93f623b225ad65721058b61269763b8d49179166fe8dcb45b83e5de794fd" + }, + "fixtures_sha256": { + ".local/rust-player-inventory-parity/inputs.txt": "01e7711fd5f12f3b3c4e47b263f5a98751a146aec217255ef0182b5e76ba1cc3" + }, + "rust_output_sha256": "003e761e441fad8b82b169f8ac04d228237236fb492e74690d85ded629278297", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "003e761e441fad8b82b169f8ac04d228237236fb492e74690d85ded629278297", + "matched_output_lines": 790440 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "003e761e441fad8b82b169f8ac04d228237236fb492e74690d85ded629278297", + "matched_output_lines": 790440 + } + ], + "scope": "Actual player Inventory storage, equipment, selected slots, hotbar picking, matching/crafting eligibility, reference removals, clear/replacement, counts and change counter. Actual ItemStack components cover damage, unbreakable, one enchantment and custom names; fixture-controlled equipment-map iteration order isolates native JVM Map.of random ordering. Shared stack and equipment references are traced across two inventories, including self-replacement and failures after selection changes. Pickup, item/equipment ticks, menus, recipes, persistence, arbitrary virtual overrides, full components and complete gameplay integration remain pending." +} diff --git a/crates/horizon-world/examples/player_inventory_fixture.rs b/crates/horizon-world/examples/player_inventory_fixture.rs new file mode 100644 index 000000000..a3e2625e2 --- /dev/null +++ b/crates/horizon-world/examples/player_inventory_fixture.rs @@ -0,0 +1,303 @@ +use horizon_world::{ + component_patch::{Patch, Prototype}, + item_stack_refs::{ItemStacks, StackRef}, + player_inventory::{EntityEquipment, EquipmentSlot, InventoryRules, PlayerInventory}, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +type Stack = StackRef; +type Inventory = PlayerInventory; +struct Rules; +impl InventoryRules for Rules { + fn is_enchanted(&self, s: &Stack) -> bool { + s.read().component(&4).is_some_and(|n| *n != 0) + } + fn is_damaged(&self, s: &Stack) -> bool { + let s = s.read(); + s.component(&2).is_some() + && s.component(&3).is_none() + && s.component(&1).is_some() + && s.component(&1) + .copied() + .unwrap_or(0) + .max(0) + .min(s.component(&2).copied().unwrap_or(0)) + > 0 + } + fn has_custom_name(&self, s: &Stack) -> bool { + s.read().component(&5).is_some() + } +} +fn n(v: &Value, k: &str) -> i32 { + v[k].as_i64().unwrap() as i32 +} +fn opt(v: Option) -> String { + v.map_or("none".into(), |n| n.to_string()) +} +struct Output { + out: io::BufWriter, + ids: Vec, +} +impl Output { + fn snapshot(&mut self, s: &Stack) -> String { + let id = self + .ids + .iter() + .position(|v| v.same_reference(s)) + .unwrap_or_else(|| { + self.ids.push(s.clone()); + self.ids.len() - 1 + }); + let damaged = Rules.is_damaged(s); + let enchanted = Rules.is_enchanted(s); + let s = s.read(); + format!( + "{}:{}:{}:{}:{}:{}:{}:{}:{}:{}", + id, + s.item(), + s.count, + s.count(), + s.pop_time, + s.is_empty(), + damaged, + enchanted, + (0..6) + .map(|k| opt(s.component(&k).copied())) + .collect::>() + .join(","), + s.components + .as_patch() + .entries() + .iter() + .map(|(k, v)| format!("{k}={}", opt(*v))) + .collect::>() + .join(",") + ) + } + fn all(&mut self, refs: &[Stack], inv: &[Inventory; 2], empty: &Stack) { + for (i, s) in refs.iter().enumerate() { + let s = self.snapshot(s); + writeln!(self.out, "ref {i} {s}").unwrap(); + } + for (i, c) in inv.iter().enumerate() { + writeln!( + self.out, + "inventory {} {} {} {} {} {} {} {} {}", + i, + c.selected(), + c.times_changed, + c.free_slot(), + c.suitable_hotbar(&Rules), + c.is_empty(), + c.count_item(0), + c.count_item(1), + c.count_item(2) + ) + .unwrap(); + let slots = (0..43) + .map(|j| self.snapshot(&c.get(j).unwrap())) + .collect::>() + .join(" | "); + writeln!(self.out, "slots {slots}").unwrap(); + let eq = c + .equipment() + .entries() + .into_iter() + .map(|(s, v)| { + format!( + "{}={}", + match s { + EquipmentSlot::MainHand => "MAINHAND", + EquipmentSlot::OffHand => "OFFHAND", + EquipmentSlot::Feet => "FEET", + EquipmentSlot::Legs => "LEGS", + EquipmentSlot::Chest => "CHEST", + EquipmentSlot::Head => "HEAD", + EquipmentSlot::Body => "BODY", + EquipmentSlot::Saddle => "SADDLE", + }, + self.snapshot(&v) + ) + }) + .collect::>() + .join(" | "); + writeln!(self.out, "equipment {eq}").unwrap(); + for (j, s) in refs.iter().enumerate() { + writeln!( + self.out, + "query {} {} {} {}", + j, + c.contains(s), + c.find_matching(s), + c.find_crafting(1, s, &Rules) + ) + .unwrap(); + } + } + let e = self.snapshot(empty); + writeln!(self.out, "empty {e}").unwrap(); + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let stacks = ItemStacks::new(0); + let empty = stacks.empty(); + let prototypes: Vec<_> = f["prototypes"] + .as_array() + .unwrap() + .iter() + .map(|p| { + Prototype::new(p.as_array().unwrap().iter().map(|v| { + ( + v[0].as_u64().unwrap() as usize, + v[1].as_i64().unwrap() as i32, + ) + })) + }) + .collect(); + let mut refs: Vec<_> = f["stacks"] + .as_array() + .unwrap() + .iter() + .map(|v| { + let item = n(v, "item"); + if item < 0 { + empty.clone() + } else { + let s = + stacks.create(item as u8, n(v, "count"), prototypes[item as usize].clone()); + s.write().pop_time = n(v, "pop"); + s.write().components.restore_patch(&Patch::new( + v["patch"].as_array().unwrap().iter().map(|v| { + ( + v[0].as_u64().unwrap() as usize, + v[1].as_i64().map(|n| n as i32), + ) + }), + )); + s + } + }) + .collect(); + let equipment = EntityEquipment::new(empty.clone()); + let other = if f["shared_equipment"].as_bool().unwrap() { + equipment.clone() + } else { + EntityEquipment::new(empty.clone()) + }; + let mut inv = [ + Inventory::new(stacks.clone(), equipment), + Inventory::new(stacks.clone(), other), + ]; + let order: [EquipmentSlot; 7] = std::array::from_fn(|i| { + EquipmentSlot::from_inventory_slot( + 36 + f["equipment_order"][i].as_i64().unwrap() as i32, + ) + .unwrap() + }); + for (i, c) in inv.iter_mut().enumerate() { + let initial = &f["inventories"][i]; + c.set_selected(n(initial, "selected")).unwrap(); + c.times_changed = n(initial, "changed"); + for p in initial["slots"].as_array().unwrap() { + c.set( + p[0].as_i64().unwrap() as i32, + refs[p[1].as_u64().unwrap() as usize].clone(), + ) + .unwrap(); + } + if n(initial, "mainhand") >= 0 { + c.equipment().set( + EquipmentSlot::MainHand, + refs[n(initial, "mainhand") as usize].clone(), + ); + } + } + let mut w = Output { + out, + ids: vec![empty.clone()], + }; + w.all(&refs, &inv, &empty); + for op in f["ops"].as_array().unwrap() { + let target = n(op, "inventory") as usize; + let a = n(op, "a") as usize; + let b = n(op, "b") as usize; + let slot = n(op, "slot"); + let amount = n(op, "amount"); + let result = (|| -> Result<(), ()> { + match op["kind"].as_str().unwrap() { + "get" => refs[b] = inv[target].get(slot).map_err(|_| ())?, + "set" => inv[target].set(slot, refs[a].clone()).map_err(|_| ())?, + "remove" => refs[b] = inv[target].remove(slot, amount), + "no-update" => refs[b] = inv[target].remove_no_update(slot).map_err(|_| ())?, + "remove-ref" => inv[target].remove_reference(&refs[a], &order), + "select" => inv[target].set_selected(slot).map_err(|_| ())?, + "selected" => refs[b] = inv[target].selected_item(), + "set-selected" => refs[b] = inv[target].set_selected_item(refs[a].clone()), + "remove-selected" => { + refs[b] = inv[target].remove_selected(op["all"].as_bool().unwrap()) + } + "pick" => inv[target].pick_slot(slot, &Rules).map_err(|_| ())?, + "add-pick" => inv[target].add_and_pick(refs[a].clone(), &Rules), + "clear" => inv[target].clear(), + "changed" => inv[target].changed(), + "replace" => { + let other = n(op, "other") as usize; + if other == target { + inv[target].replace_self(); + } else { + let (first, second) = inv.split_at_mut(1); + if target == 0 { + first[0].replace_with(&second[0]); + } else { + second[0].replace_with(&first[0]); + } + } + } + "equip" => { + refs[b] = inv[target].equipment().set( + EquipmentSlot::ALL[n(op, "equipment") as usize], + refs[a].clone(), + ) + } + "get-equip" => { + refs[b] = inv[target] + .equipment() + .get(EquipmentSlot::ALL[n(op, "equipment") as usize]) + } + "alias" => refs[b] = refs[a].clone(), + "copy" => refs[b] = stacks.copy(&refs[a]), + "count" => refs[a].write().count = amount, + "component" => { + refs[a] + .write() + .components + .set( + n(op, "key") as usize, + op["value"].as_i64().map(|n| n as i32), + ) + .map_err(|_| ())?; + } + _ => panic!("operation"), + } + Ok(()) + })(); + writeln!( + w.out, + "result {}", + if result.is_ok() { "ok" } else { "error" } + )?; + w.all(&refs, &inv, &empty); + } + out = w.out; + } + Ok(()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 5d2b7b506..62b67b942 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -96,3 +96,5 @@ pub const DATA_VERSION: i32 = 5023; pub mod item_stack_refs; pub mod simple_container; + +pub mod player_inventory; diff --git a/crates/horizon-world/src/player_inventory.rs b/crates/horizon-world/src/player_inventory.rs new file mode 100644 index 000000000..05faa335c --- /dev/null +++ b/crates/horizon-world/src/player_inventory.rs @@ -0,0 +1,336 @@ +//! Player inventory storage and selection. Equipment is shared with its entity; +//! stack references preserve aliases across inventories and external callers. +//! Pickup, ticking, menus and persistence are implemented separately. +use crate::item_stack_refs::{ItemStacks, StackRef}; +use std::{cell::RefCell, rc::Rc}; +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[repr(usize)] +pub enum EquipmentSlot { + MainHand, + OffHand, + Feet, + Legs, + Chest, + Head, + Body, + Saddle, +} +impl EquipmentSlot { + pub const ALL: [Self; 8] = [ + Self::MainHand, + Self::OffHand, + Self::Feet, + Self::Legs, + Self::Chest, + Self::Head, + Self::Body, + Self::Saddle, + ]; + pub fn inventory_slot(self) -> Option { + match self { + Self::MainHand => None, + Self::OffHand => Some(40), + Self::Feet => Some(36), + Self::Legs => Some(37), + Self::Chest => Some(38), + Self::Head => Some(39), + Self::Body => Some(41), + Self::Saddle => Some(42), + } + } + pub fn from_inventory_slot(index: i32) -> Option { + match index { + 36 => Some(Self::Feet), + 37 => Some(Self::Legs), + 38 => Some(Self::Chest), + 39 => Some(Self::Head), + 40 => Some(Self::OffHand), + 41 => Some(Self::Body), + 42 => Some(Self::Saddle), + _ => None, + } + } +} +type EquipmentItems = [Option>; 8]; +#[derive(Debug)] +pub struct EntityEquipment { + items: Rc>>, + empty: StackRef, +} +impl Clone for EntityEquipment { + fn clone(&self) -> Self { + Self { + items: self.items.clone(), + empty: self.empty.clone(), + } + } +} +impl EntityEquipment { + pub fn new(empty: StackRef) -> Self { + Self { + items: Rc::new(RefCell::new(std::array::from_fn(|_| None))), + empty, + } + } + pub fn get(&self, slot: EquipmentSlot) -> StackRef { + self.items.borrow()[slot as usize] + .clone() + .unwrap_or_else(|| self.empty.clone()) + } + pub fn set(&self, slot: EquipmentSlot, stack: StackRef) -> StackRef { + self.items.borrow_mut()[slot as usize] + .replace(stack) + .unwrap_or_else(|| self.empty.clone()) + } + /// Native clear preserves which enum-map entries have been populated. + pub fn clear(&self) { + for s in self.items.borrow_mut().iter_mut().flatten() { + *s = self.empty.clone(); + } + } + pub fn entries(&self) -> Vec<(EquipmentSlot, StackRef)> { + let items = self.items.borrow(); + EquipmentSlot::ALL + .into_iter() + .filter_map(|s| items[s as usize].clone().map(|v| (s, v))) + .collect() + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum InventoryError { + Index, + Selection, +} +pub trait InventoryRules { + fn is_enchanted(&self, stack: &StackRef) -> bool; + fn is_damaged(&self, stack: &StackRef) -> bool; + fn has_custom_name(&self, stack: &StackRef) -> bool; +} +#[derive(Debug)] +pub struct PlayerInventory { + items: [StackRef; 36], + equipment: EntityEquipment, + stacks: ItemStacks, + selected: usize, + pub times_changed: i32, +} +impl PlayerInventory { + pub fn new(stacks: ItemStacks, equipment: EntityEquipment) -> Self { + Self { + items: std::array::from_fn(|_| stacks.empty()), + equipment, + stacks, + selected: 0, + times_changed: 0, + } + } + pub fn items(&self) -> &[StackRef; 36] { + &self.items + } + pub fn equipment(&self) -> &EntityEquipment { + &self.equipment + } + pub fn selected(&self) -> usize { + self.selected + } + pub fn set_selected(&mut self, selected: i32) -> Result<(), InventoryError> { + if !(0..9).contains(&selected) { + return Err(InventoryError::Selection); + } + self.selected = selected as usize; + Ok(()) + } + pub fn selected_item(&self) -> StackRef { + self.items[self.selected].clone() + } + pub fn set_selected_item(&mut self, stack: StackRef) -> StackRef { + std::mem::replace(&mut self.items[self.selected], stack) + } + pub fn get(&self, index: i32) -> Result, InventoryError> { + if index < 0 { + return Err(InventoryError::Index); + } + Ok(if index < 36 { + self.items[index as usize].clone() + } else { + EquipmentSlot::from_inventory_slot(index) + .map_or_else(|| self.stacks.empty(), |s| self.equipment.get(s)) + }) + } + pub fn set(&mut self, index: i32, stack: StackRef) -> Result<(), InventoryError> { + if index < 0 { + return Err(InventoryError::Index); + } + if index < 36 { + self.items[index as usize] = stack; + } else if let Some(s) = EquipmentSlot::from_inventory_slot(index) { + self.equipment.set(s, stack); + } + Ok(()) + } + pub fn remove(&mut self, index: i32, amount: i32) -> StackRef { + if index < 0 || (index < 36 && amount <= 0) { + return self.stacks.empty(); + } + let s = self.get(index).expect("nonnegative index"); + if s.read().is_empty() { + self.stacks.empty() + } else { + self.stacks.split(&s, amount) + } + } + pub fn remove_no_update(&mut self, index: i32) -> Result, InventoryError> { + if index < 0 { + return Err(InventoryError::Index); + } + Ok(if index < 36 { + std::mem::replace(&mut self.items[index as usize], self.stacks.empty()) + } else { + EquipmentSlot::from_inventory_slot(index).map_or_else( + || self.stacks.empty(), + |s| self.equipment.set(s, self.stacks.empty()), + ) + }) + } + /// The native Map.of equipment iteration order varies by JVM. The caller + /// supplies its pinned runtime order when reference aliases span equipment. + pub fn remove_reference( + &mut self, + stack: &StackRef, + equipment_order: &[EquipmentSlot; 7], + ) { + for s in &mut self.items { + if s.same_reference(stack) { + *s = self.stacks.empty(); + return; + } + } + for slot in equipment_order { + if self.equipment.get(*slot).same_reference(stack) { + self.equipment.set(*slot, self.stacks.empty()); + return; + } + } + } + pub fn free_slot(&self) -> i32 { + self.items + .iter() + .position(|s| s.read().is_empty()) + .map_or(-1, |i| i as i32) + } + pub fn find_matching(&self, stack: &StackRef) -> i32 { + self.items + .iter() + .position(|s| !s.read().is_empty() && stack.read().same_item_components(&s.read())) + .map_or(-1, |i| i as i32) + } + pub fn contains(&self, stack: &StackRef) -> bool { + (0..43).any(|i| { + let s = self.get(i).expect("valid slot"); + !s.read().is_empty() && s.read().same_item_components(&stack.read()) + }) + } + pub fn count_item(&self, item: I) -> i32 { + (0..43).fold(0_i32, |n, i| { + let s = self.get(i).expect("valid slot"); + let s = s.read(); + if s.item() == item { + n.wrapping_add(s.count()) + } else { + n + } + }) + } + pub fn suitable_hotbar>(&self, rules: &R) -> usize { + for delta in 0..9 { + let i = (self.selected + delta) % 9; + if self.items[i].read().is_empty() { + return i; + } + } + for delta in 0..9 { + let i = (self.selected + delta) % 9; + if !rules.is_enchanted(&self.items[i]) { + return i; + } + } + self.selected + } + pub fn find_crafting>( + &self, + item: I, + stack: &StackRef, + rules: &R, + ) -> i32 { + self.items + .iter() + .position(|s| { + !s.read().is_empty() + && s.read().item() == item + && !rules.is_damaged(s) + && !rules.is_enchanted(s) + && !rules.has_custom_name(s) + && (stack.read().is_empty() || stack.read().same_item_components(&s.read())) + }) + .map_or(-1, |i| i as i32) + } + pub fn add_and_pick>( + &mut self, + stack: StackRef, + rules: &R, + ) { + self.selected = self.suitable_hotbar(rules); + if !self.items[self.selected].read().is_empty() { + let free = self.free_slot(); + if free >= 0 { + self.items[free as usize] = self.items[self.selected].clone(); + } + } + self.items[self.selected] = stack; + } + pub fn pick_slot>( + &mut self, + index: i32, + rules: &R, + ) -> Result<(), InventoryError> { + self.selected = self.suitable_hotbar(rules); + // Selection changes even when the following list access fails. + let index = usize::try_from(index) + .ok() + .filter(|i| *i < 36) + .ok_or(InventoryError::Index)?; + self.items.swap(self.selected, index); + Ok(()) + } + pub fn remove_selected(&mut self, all: bool) -> StackRef { + let s = self.selected_item(); + if s.read().is_empty() { + return self.stacks.empty(); + } + let amount = if all { s.read().count() } else { 1 }; + self.remove(self.selected as i32, amount) + } + pub fn changed(&mut self) { + self.times_changed = self.times_changed.wrapping_add(1); + } + pub fn clear(&mut self) { + self.items.fill(self.stacks.empty()); + self.equipment.clear(); + } + pub fn is_empty(&self) -> bool { + (0..43).all(|i| self.get(i).expect("valid slot").read().is_empty()) + } + pub fn replace_self(&mut self) { + for i in 0..43 { + self.set(i, self.get(i).expect("valid slot")) + .expect("valid slot"); + } + } + pub fn replace_with(&mut self, other: &Self) { + for i in 0..43 { + self.set(i, other.get(i).expect("valid slot")) + .expect("valid slot"); + } + self.selected = other.selected; + } +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 28fe03e77..0f2c8c095 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1664,3 +1664,23 @@ the first empty slot clears the remainder before limiting the inserted copy. Targeted Clippy passes. Player inventory, menus, crafting accounting, persistence, arbitrary getItem/setItem overrides and complete gameplay integration remain pending. Reference counting here has not been benchmarked as a performance gain. + + +`player_inventory` implements the 36 ordinary slots, seven mapped equipment +slots, shared entity equipment, selected hotbar slot, picking, matching/crafting +eligibility, removals, replacement, clearing and the change counter. Equipment +retains populated entries when cleared. Stack and equipment references can be +shared across inventories; replacing an inventory retains stack aliases. + +`python3 tools/test_player_inventory_parity.py` compares actual native Inventory, +EntityEquipment and ItemStack methods. The +[inventory report](../benchmarks/rust-player-inventory-2026-10-07/scoped-parity.json) +records **790,440 matching lines per JAR**, including invalid-index failure +prefixes, selected-slot changes, negative equipment removal amounts, ordinary +versus equipment identity, self-replacement and shared equipment clearing. +Components cover damage, unbreakable presence, a fixed enchantment and literal +custom names. Native Map.of iteration order varies by JVM; fixtures explicitly +supply equipment-map order to both sides when removing an aliased reference. +Targeted Clippy passes. Pickup, inventory/equipment ticks, menus, recipe +accounting, persistence, full component values and complete gameplay integration +remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerInventoryOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerInventoryOracle.java new file mode 100644 index 000000000..79ceee563 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerInventoryOracle.java @@ -0,0 +1,37 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.lang.reflect.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.component.*;import net.minecraft.world.item.*;import net.minecraft.world.entity.*;import net.minecraft.world.entity.player.Inventory;import net.minecraft.world.item.enchantment.*; +/** Native Inventory storage/selection with real stack/component and equipment aliases. */ +@SuppressWarnings({"unchecked","rawtypes"}) +public final class VanillaPlayerInventoryOracle { + static Item[] items;static DataComponentType[] keys;static Field components,count,patchMap,equipmentItems,changed;static Object removed;static ItemEnchantments enchanted; + static EquipmentSlot[] mapped={EquipmentSlot.FEET,EquipmentSlot.LEGS,EquipmentSlot.CHEST,EquipmentSlot.HEAD,EquipmentSlot.OFFHAND,EquipmentSlot.BODY,EquipmentSlot.SADDLE}; + static Field field(Class c,String n)throws Exception{var f=c.getDeclaredField(n);f.setAccessible(true);return f;} + static int n(JsonObject o,String k){return o.get(k).getAsInt();} + static int key(Object k){for(int i=0;inet.minecraft.util.Unit.INSTANCE;case 4->n==0?ItemEnchantments.EMPTY:enchanted;case 5->net.minecraft.network.chat.Component.literal(Integer.toString(n));default->n;};} + static String text(int k,Object v){if(v==null||v==removed)return "none";return switch(k){case 3->"0";case 4->((ItemEnchantments)v).isEmpty()?"0":"1";case 5->((net.minecraft.network.chat.Component)v).getString();default->v.toString();};} + static DataComponentMap prototype(JsonArray a){var b=DataComponentMap.builder();for(var e:a){var p=e.getAsJsonArray();int k=p.get(0).getAsInt();b.set(keys[k],value(k,p.get(1)));}return b.build();} + static DataComponentPatch patch(JsonArray a){var b=DataComponentPatch.builder();for(var e:a){var p=e.getAsJsonArray();int k=p.get(0).getAsInt();if(p.get(1).isJsonNull())b.remove(keys[k]);else b.set(keys[k],value(k,p.get(1)));}return b.build();} + static final class Data { + PrintWriter out;ItemStack[] refs;Inventory[] inv;EntityEquipment[] equipment;IdentityHashMap ids=new IdentityHashMap<>(); + int id(ItemStack s){return ids.computeIfAbsent(s,k->ids.size());} + String snapshot(ItemStack s){try{var raw=(PatchedDataComponentMap)components.get(s);var p=new StringJoiner(",");for(var e:((Map)patchMap.get(raw.asPatch())).entrySet())p.add(key(e.getKey())+"="+text(key(e.getKey()),e.getValue()));var v=new StringJoiner(",");for(int k=0;k)equipmentItems.get(equipment[i])).entrySet())eq.add(e.getKey().name()+"="+snapshot(e.getValue()));out.println("equipment "+eq);for(int j=0;j)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();for(int i=0;i<3;i++)items[i].builtInRegistryHolder().bindComponents(prototype(f.getAsJsonArray("prototypes").get(i).getAsJsonArray()));Inventory.EQUIPMENT_SLOT_MAPPING.clear();for(var e:f.getAsJsonArray("equipment_order")){int i=e.getAsInt();Inventory.EQUIPMENT_SLOT_MAPPING.put(36+i,mapped[i]);}ItemStack.EMPTY.setCount(0);ItemStack.EMPTY.setPopTime(0);((PatchedDataComponentMap)components.get(ItemStack.EMPTY)).clearPatch();var d=new Data();d.out=out;d.ids.put(ItemStack.EMPTY,0);d.refs=new ItemStack[4];for(int i=0;i<4;i++){var v=f.getAsJsonArray("stacks").get(i).getAsJsonObject();int type=n(v,"item");d.refs[i]=type<0?ItemStack.EMPTY:new ItemStack(items[type],n(v,"count"));if(type>=0){d.refs[i].setPopTime(n(v,"pop"));((PatchedDataComponentMap)components.get(d.refs[i])).restorePatch(patch(v.getAsJsonArray("patch")));}} + d.equipment=new EntityEquipment[]{new EntityEquipment(),new EntityEquipment()};if(f.get("shared_equipment").getAsBoolean())d.equipment[1]=d.equipment[0];d.inv=new Inventory[]{new Inventory(null,d.equipment[0]),new Inventory(null,d.equipment[1])}; + for(int i=0;i<2;i++){var initial=f.getAsJsonArray("inventories").get(i).getAsJsonObject();d.inv[i].setSelectedSlot(n(initial,"selected"));changed.setInt(d.inv[i],n(initial,"changed"));for(var entry:initial.getAsJsonArray("slots")){var pair=entry.getAsJsonArray();d.inv[i].setItem(pair.get(0).getAsInt(),d.refs[pair.get(1).getAsInt()]);}if(n(initial,"mainhand")>=0)d.equipment[i].set(EquipmentSlot.MAINHAND,d.refs[n(initial,"mainhand")]);} + d.all();for(var ov:f.getAsJsonArray("ops")){var op=ov.getAsJsonObject();var c=d.inv[n(op,"inventory")];int a=n(op,"a"),b=n(op,"b"),slot=n(op,"slot"),amount=n(op,"amount");try{switch(op.get("kind").getAsString()){ + case "get":d.refs[b]=c.getItem(slot);break;case "set":c.setItem(slot,d.refs[a]);break;case "remove":d.refs[b]=c.removeItem(slot,amount);break;case "no-update":d.refs[b]=c.removeItemNoUpdate(slot);break;case "remove-ref":c.removeItem(d.refs[a]);break;case "select":c.setSelectedSlot(slot);break;case "selected":d.refs[b]=c.getSelectedItem();break;case "set-selected":d.refs[b]=c.setSelectedItem(d.refs[a]);break;case "remove-selected":d.refs[b]=c.removeFromSelected(op.get("all").getAsBoolean());break;case "pick":c.pickSlot(slot);break;case "add-pick":c.addAndPickItem(d.refs[a]);break;case "clear":c.clearContent();break;case "changed":c.setChanged();break;case "replace":c.replaceWith(d.inv[n(op,"other")]);break;case "equip":d.refs[b]=d.equipment[n(op,"inventory")].set(EquipmentSlot.values()[n(op,"equipment")],d.refs[a]);break;case "get-equip":d.refs[b]=d.equipment[n(op,"inventory")].get(EquipmentSlot.values()[n(op,"equipment")]);break;case "alias":d.refs[b]=d.refs[a];break;case "copy":d.refs[b]=d.refs[a].copy();break;case "count":d.refs[a].setCount(amount);break;case "component":int k=n(op,"key");d.refs[a].set(keys[k],value(k,op.get("value")));break;default:throw new AssertionError();}out.println("result ok");}catch(IndexOutOfBoundsException|IllegalArgumentException|NullPointerException e){out.println("result error");}d.all();} + }} + } +} diff --git a/tools/test_player_inventory_parity.py b/tools/test_player_inventory_parity.py new file mode 100644 index 000000000..808691ab9 --- /dev/null +++ b/tools/test_player_inventory_parity.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python3 +"""Compare native PlayerInventory transfers, shared stack identity and change callbacks.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + kinds=['get','set','remove','no-update','remove-ref','select','selected','set-selected','remove-selected','pick','add-pick','clear','changed','replace','equip','get-equip','alias','copy','count','component'] + edges=[-2147483648,-1,0,1,2,8,9,35,36,39,40,41,42,43,64,2147483647] + def op(kind,**kw): + v=dict(kind=kind,inventory=0,other=1,a=0,b=3,slot=0,amount=1,all=False,equipment=0,key=0,value=64);v.update(kw);return v + def stack(item,count,patch=None):return dict(item=item,count=count,pop=7,patch=patch or []) + def row(ops,count=5,slots=None,selected=0):return dict(prototypes=[[],[[0,64]],[[0,1],[1,0],[2,100]]],stacks=[stack(1,count),stack(1,60),stack(2,1),stack(-1,0)],equipment_order=list(range(7)),shared_equipment=False,inventories=[dict(selected=selected,changed=2147483647,mainhand=0,slots=slots if slots is not None else [[0,0],[8,1],[35,2],[36,2],[40,0],[42,1]]),dict(selected=8,changed=0,mainhand=-1,slots=[[2,1],[39,0]])],ops=ops) + for kind in kinds: + for slot in edges: + for amount in [-2147483648,-1,0,1,64,2147483647]: + yield row([op(kind,slot=slot,amount=amount),op('changed'),op('copy'),op('count',a=3,amount=3)]) + for enchanted in [False,True]: + for selected in range(9): + for free in [-1,0,1,8,9,35]: + for kind in ['pick','add-pick','replace','remove-ref','remove-selected']: + slots=[[i,1] for i in range(43) if i!=free] + v=row([op(kind,slot=35),op('replace',other=0)],slots=slots,selected=selected) + if enchanted:v['stacks'][1]['patch']=[[4,1]] + yield v + rng=random.Random(0x504c41594552494e) + def integer():return rng.choice(edges) if rng.randrange(2) else rng.randrange(-2147483648,2147483648) + def value(k):return 0 if k==3 else rng.randrange(2) if k==4 else integer() + def patch():return [[k,rng.choice([None,value(k)])] for k in rng.sample(range(6),rng.randrange(7))] + for _ in range(1500): + prototypes=[[[k,value(k)] for k in rng.sample(range(6),rng.randrange(7))] for __ in range(3)] + stacks=[dict(item=rng.randrange(-1,3),count=integer(),pop=integer(),patch=patch()) for __ in range(4)] + inventories=[dict(selected=rng.randrange(9),changed=integer(),mainhand=rng.randrange(-1,4),slots=[[i,rng.randrange(4)] for i in rng.sample(range(43),rng.randrange(44))]) for __ in range(2)] + ops=[] + for __ in range(18): + k=rng.randrange(6) + ops.append(op(rng.choice(kinds),inventory=rng.randrange(2),other=rng.randrange(2),a=rng.randrange(4),b=rng.randrange(4),slot=rng.choice(edges) if rng.randrange(2) else rng.randrange(43),amount=integer(),all=bool(rng.randrange(2)),equipment=rng.randrange(8),key=k,value=rng.choice([None,value(k)]))) + yield dict(prototypes=prototypes,stacks=stacks,inventories=inventories,equipment_order=rng.sample(range(7),7),shared_equipment=bool(rng.randrange(2)),ops=ops) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-player-inventory-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerInventoryOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/player_inventory_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaPlayerInventoryOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','player_inventory_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('player_inventory_fixture.exe' if os.name=='nt' else 'player_inventory_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} player inventory output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual player Inventory storage, equipment, selected slots, hotbar picking, matching/crafting eligibility, reference removals, clear/replacement, counts and change counter. Actual ItemStack components cover damage, unbreakable, one enchantment and custom names; fixture-controlled equipment-map iteration order isolates native JVM Map.of random ordering. Shared stack and equipment references are traced across two inventories, including self-replacement and failures after selection changes. Pickup, item/equipment ticks, menus, recipes, persistence, arbitrary virtual overrides, full components and complete gameplay integration remain pending.'} + lab.write_json(report_path,report);print(f'Scoped player inventory parity passed: {report_path}') + + +if __name__=='__main__':main() From 843cabc03891c67b7d2f03987a3f3556b384256f Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 07:54:29 +0200 Subject: [PATCH 138/253] Compose inventory pickup with shared stacks and creative fallback --- .../scoped-parity.json | 274 ++++++++++++ .../examples/inventory_pickup_fixture.rs | 410 ++++++++++++++++++ crates/horizon-world/src/inventory_pickup.rs | 159 +++++++ crates/horizon-world/src/lib.rs | 2 + crates/horizon-world/src/player_inventory.rs | 15 + docs/collision-geometry.md | 16 + .../parity/VanillaInventoryPickupOracle.java | 42 ++ tools/test_inventory_pickup_parity.py | 88 ++++ 8 files changed, 1006 insertions(+) create mode 100644 benchmarks/rust-inventory-pickup-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/inventory_pickup_fixture.rs create mode 100644 crates/horizon-world/src/inventory_pickup.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaInventoryPickupOracle.java create mode 100644 tools/test_inventory_pickup_parity.py diff --git a/benchmarks/rust-inventory-pickup-2026-10-07/scoped-parity.json b/benchmarks/rust-inventory-pickup-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..3e7502659 --- /dev/null +++ b/benchmarks/rust-inventory-pickup-2026-10-07/scoped-parity.json @@ -0,0 +1,274 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 2060, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaInventoryPickupOracle.java": "13a12385c05ccc177f66534e0194b0d5ccd9a58dcc19c002257754b715eb0e91", + "tools/test_inventory_pickup_parity.py": "b8153c3dc4c6ef7cc7f14782ace862356b3a33dd6a9bb8eb07790df3f08e0772", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "6884c7209f007ab9ee742b9c3c73828cfa1c6753d35b5fe25a87cab5955b33f8", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "18bbad377a8047e4d4ecd0fc87d83d46d1c0f1ce2b8c47bbe64633e7b4420b57", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/blocking_item_damage.rs": "afea3cb5761e8b82ee4d9bb4ef3c6fd10182a324dbaec99e6c9ebfac255dda09", + "crates/horizon-world/src/blocking_rules.rs": "83c5e2105cec56a90182ce582e1c67ade2b189be6de1a34d08035000cc07c492", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/component_durability.rs": "37a46e184f95bc5027e2b9af72ff52f729ad03601d08e1827f181fca383a35af", + "crates/horizon-world/src/component_patch.rs": "3622244ccdee46e13956c64ffe9be6234e686adf58dbc3a24cece0f1814301a1", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_immunity.rs": "fd39c41124d694e755cf7faadcf93c636df4042c78ec345092a856b5f952dbcf", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/damage_source.rs": "24945e397a926d34695652980923609e4723e02fe6b6e56d4aaf673e45d759f7", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/inventory_pickup.rs": "ea830c7916e7f2d95c6db7ef48be1e876e6ebafcb438e47fc72f9a5bd7c37d07", + "crates/horizon-world/src/item_blocking.rs": "f6eee0d6d177cc3148960122327ba1b459a2f0e85241c1d9a3e40f0b8c169296", + "crates/horizon-world/src/item_durability.rs": "9fdf835e5c7bd0e1dd63ef2ba0076b770cdd4d6d14cdcd11de27690f0702f94e", + "crates/horizon-world/src/item_stack_refs.rs": "1a83604c256a51898b59b0087c2378282bcebe7883add2c4634dc7f9183d6e49", + "crates/horizon-world/src/item_stack_storage.rs": "b4dcb83dcaa346848c5484161feb3e2cf08e83f7793d7ed83be25b14b9d12884", + "crates/horizon-world/src/item_use.rs": "1d0a3afa61b60d356e81a063da79ec6cd38730315976640a591325fc4c8ab98c", + "crates/horizon-world/src/item_use_catalog.rs": "a9b53d2e816583239a75c3c61e78dacc5e3b27dee595be34b1c7fa169f17a571", + "crates/horizon-world/src/item_use_lifecycle.rs": "f9b29f42a528493d0d2521110d4f6e0bc89af8f579d539648cb7c3a9e68e31cd", + "crates/horizon-world/src/item_use_start.rs": "9996a9b90c313925cd90e78c02880f2a1d2ae65aef53f4ce081578a9dcd10c62", + "crates/horizon-world/src/lib.rs": "abba94d6a397e0a4055d7b238edc042494836247e0bd1e355f42dbda61f825ac", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "2b448209629b9bf2e678d667ad0d6c7fa22146892dd106b169d96b31b0df12bb", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_hurt.rs": "844239ad7d15c39629bb3cfc06ebae6d1cff20b7627468f26e0ee8dff3abdcb8", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_hurt.rs": "99c9bbd8587ec2dc287806049897b8034d2f5349ad47fc497b70d54148844a36", + "crates/horizon-world/src/player_inventory.rs": "f4f67d8312793f25930626c4ac06db688fcf2e2292d6675071d105fb1708d952", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/server_player_combat.rs": "a9743971581af86d926eeba42004d932caf83382c470dd98bf613cb9c417db58", + "crates/horizon-world/src/server_player_damage.rs": "828a4649fec3e9bda2dfe20aced8c95922c697321de2be4127bd4e5712ecbb7c", + "crates/horizon-world/src/simple_container.rs": "0fedbc7e974b1db79b88bd6aff977654189a5d553cf42852fe8bf0885cf90b30", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "f417aab280331ddd6f0ca265a12c0130c78b9924f407c7e07f198140501e6010", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/view_direction.rs": "e18120ae26dc5cf702b29fc4c8487088bab133c8ce5abce01226833fafb0d5a4", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "74e4110fb19c4c4047192fd65c38015b8afc7f9fc50404d75380b5063808148c", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/inventory_pickup_fixture.rs": "ba554d971a0096e542b1065f7a6de3f0899702ea711344f68d504838e0e1b1d0" + }, + "fixtures_sha256": { + ".local/rust-inventory-pickup-parity/inputs.txt": "3f431461bca23ec28749376f53f509fbc78d74eeca0ceb3b64332085aac4d718" + }, + "rust_output_sha256": "4f48394f182e327ac19a7b69d32a97048d7eb9f6c7d2cfaab492ddd1aba64116", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "4f48394f182e327ac19a7b69d32a97048d7eb9f6c7d2cfaab492ddd1aba64116", + "matched_output_lines": 424282 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "4f48394f182e327ac19a7b69d32a97048d7eb9f6c7d2cfaab492ddd1aba64116", + "matched_output_lines": 424282 + } + ], + "scope": "Actual Inventory.add and getSlotWithRemainingSpace over stored ItemStack and shared equipment. Traces cover selected/offhand/ordinary slot search, component-sensitive stacking, damaged copy-and-clear, source aliases, pop time, creative fallback and virtual size/material callbacks with mutations/failures. Native crash-report wrapping is represented as an error without rendering its diagnostic text. Item entity pickup events, networking, menus, arbitrary method overrides, full item components and complete gameplay integration remain pending." +} diff --git a/crates/horizon-world/examples/inventory_pickup_fixture.rs b/crates/horizon-world/examples/inventory_pickup_fixture.rs new file mode 100644 index 000000000..b3f742aa0 --- /dev/null +++ b/crates/horizon-world/examples/inventory_pickup_fixture.rs @@ -0,0 +1,410 @@ +use horizon_world::{ + component_patch::{Patch, Prototype}, + item_stack_refs::{ItemStacks, StackRef}, + player_inventory::{EntityEquipment, EquipmentSlot, InventoryRules, PlayerInventory}, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +type Stack = StackRef; +type Inventory = PlayerInventory; +struct Rules; +impl InventoryRules for Rules { + fn is_enchanted(&self, s: &Stack) -> bool { + s.read().component(&4).is_some_and(|n| *n != 0) + } + fn is_damaged(&self, s: &Stack) -> bool { + let s = s.read(); + s.component(&2).is_some() + && s.component(&3).is_none() + && s.component(&1).is_some() + && s.component(&1) + .copied() + .unwrap_or(0) + .max(0) + .min(s.component(&2).copied().unwrap_or(0)) + > 0 + } + fn has_custom_name(&self, s: &Stack) -> bool { + s.read().component(&5).is_some() + } +} +fn n(v: &Value, k: &str) -> i32 { + v[k].as_i64().unwrap() as i32 +} +fn opt(v: Option) -> String { + v.map_or("none".into(), |n| n.to_string()) +} +struct Output { + out: io::BufWriter, + ids: Vec, +} +impl Output { + fn snapshot(&mut self, s: &Stack) -> String { + let id = self + .ids + .iter() + .position(|v| v.same_reference(s)) + .unwrap_or_else(|| { + self.ids.push(s.clone()); + self.ids.len() - 1 + }); + let damaged = Rules.is_damaged(s); + let enchanted = Rules.is_enchanted(s); + let s = s.read(); + format!( + "{}:{}:{}:{}:{}:{}:{}:{}:{}:{}", + id, + s.item(), + s.count, + s.count(), + s.pop_time, + s.is_empty(), + damaged, + enchanted, + (0..6) + .map(|k| opt(s.component(&k).copied())) + .collect::>() + .join(","), + s.components + .as_patch() + .entries() + .iter() + .map(|(k, v)| format!("{k}={}", opt(*v))) + .collect::>() + .join(",") + ) + } + fn all(&mut self, refs: &[Stack], inv: &[Inventory; 2], empty: &Stack) { + for (i, s) in refs.iter().enumerate() { + let s = self.snapshot(s); + writeln!(self.out, "ref {i} {s}").unwrap(); + } + for (i, c) in inv.iter().enumerate() { + writeln!( + self.out, + "inventory {} {} {} {} {} {} {} {} {}", + i, + c.selected(), + c.times_changed, + c.free_slot(), + c.suitable_hotbar(&Rules), + c.is_empty(), + c.count_item(0), + c.count_item(1), + c.count_item(2) + ) + .unwrap(); + let slots = (0..43) + .map(|j| self.snapshot(&c.get(j).unwrap())) + .collect::>() + .join(" | "); + writeln!(self.out, "slots {slots}").unwrap(); + let eq = c + .equipment() + .entries() + .into_iter() + .map(|(s, v)| { + format!( + "{}={}", + match s { + EquipmentSlot::MainHand => "MAINHAND", + EquipmentSlot::OffHand => "OFFHAND", + EquipmentSlot::Feet => "FEET", + EquipmentSlot::Legs => "LEGS", + EquipmentSlot::Chest => "CHEST", + EquipmentSlot::Head => "HEAD", + EquipmentSlot::Body => "BODY", + EquipmentSlot::Saddle => "SADDLE", + }, + self.snapshot(&v) + ) + }) + .collect::>() + .join(" | "); + writeln!(self.out, "equipment {eq}").unwrap(); + for (j, s) in refs.iter().enumerate() { + writeln!( + self.out, + "query {} {} {} {}", + j, + c.contains(s), + c.find_matching(s), + c.find_crafting(1, s, &Rules) + ) + .unwrap(); + } + } + let e = self.snapshot(empty); + writeln!(self.out, "empty {e}").unwrap(); + } +} +struct World { + report: Output, + refs: Vec, + op: Value, + calls: i32, +} +impl World { + fn event(&mut self, c: &mut Inventory, name: &str) -> Result<(), ()> { + self.calls += 1; + writeln!(self.report.out, "event {name} {}", self.calls).unwrap(); + writeln!( + self.report.out, + "active {} {}", + c.selected(), + c.times_changed + ) + .unwrap(); + for i in 0..self.refs.len() { + let s = self.report.snapshot(&self.refs[i]); + writeln!(self.report.out, "active-ref {i} {s}").unwrap(); + } + let slots = (0..43) + .map(|j| self.report.snapshot(&c.get(j).unwrap())) + .collect::>() + .join(" | "); + writeln!(self.report.out, "active-slots {slots}").unwrap(); + if self.calls == n(&self.op, "fail_at") { + return Err(()); + } + if self.calls == n(&self.op, "mutate_at") { + let mut s = self.refs[n(&self.op, "mutate_ref") as usize].write(); + s.count = n(&self.op, "after_count"); + s.components + .set(0, Some(n(&self.op, "after_max"))) + .map_err(|_| ())?; + drop(s); + if n(&self.op, "mutate_slot") >= 0 { + c.set( + n(&self.op, "mutate_slot"), + self.refs[n(&self.op, "replace_ref") as usize].clone(), + ) + .map_err(|_| ())?; + } + if n(&self.op, "after_selected") >= 0 { + c.set_selected(n(&self.op, "after_selected")) + .map_err(|_| ())?; + } + } + Ok(()) + } +} +impl InventoryRules for World { + fn is_enchanted(&self, s: &Stack) -> bool { + Rules.is_enchanted(s) + } + fn is_damaged(&self, s: &Stack) -> bool { + Rules.is_damaged(s) + } + fn has_custom_name(&self, s: &Stack) -> bool { + Rules.has_custom_name(s) + } +} +impl horizon_world::inventory_pickup::PickupHooks for World { + type Error = (); + fn item_max_stack_size(&self, s: &Stack) -> i32 { + s.read().component(&0).copied().unwrap_or(1) + } + fn max_stack_size(&mut self, c: &mut Inventory) -> Result { + self.event(c, "max")?; + Ok(n(&self.op, "max")) + } + fn infinite_materials(&mut self, c: &mut Inventory) -> Result { + self.event(c, "infinite")?; + Ok(self.op["infinite"].as_bool().unwrap()) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let stacks = ItemStacks::new(0); + let empty = stacks.empty(); + let prototypes: Vec<_> = f["prototypes"] + .as_array() + .unwrap() + .iter() + .map(|p| { + Prototype::new(p.as_array().unwrap().iter().map(|v| { + ( + v[0].as_u64().unwrap() as usize, + v[1].as_i64().unwrap() as i32, + ) + })) + }) + .collect(); + let refs: Vec<_> = f["stacks"] + .as_array() + .unwrap() + .iter() + .map(|v| { + let item = n(v, "item"); + if item < 0 { + empty.clone() + } else { + let s = + stacks.create(item as u8, n(v, "count"), prototypes[item as usize].clone()); + s.write().pop_time = n(v, "pop"); + s.write().components.restore_patch(&Patch::new( + v["patch"].as_array().unwrap().iter().map(|v| { + ( + v[0].as_u64().unwrap() as usize, + v[1].as_i64().map(|n| n as i32), + ) + }), + )); + s + } + }) + .collect(); + let equipment = EntityEquipment::new(empty.clone()); + let other = if f["shared_equipment"].as_bool().unwrap() { + equipment.clone() + } else { + EntityEquipment::new(empty.clone()) + }; + let mut inv = [ + Inventory::new(stacks.clone(), equipment), + Inventory::new(stacks.clone(), other), + ]; + let order: [EquipmentSlot; 7] = std::array::from_fn(|i| { + EquipmentSlot::from_inventory_slot( + 36 + f["equipment_order"][i].as_i64().unwrap() as i32, + ) + .unwrap() + }); + for (i, c) in inv.iter_mut().enumerate() { + let initial = &f["inventories"][i]; + c.set_selected(n(initial, "selected")).unwrap(); + c.times_changed = n(initial, "changed"); + for p in initial["slots"].as_array().unwrap() { + c.set( + p[0].as_i64().unwrap() as i32, + refs[p[1].as_u64().unwrap() as usize].clone(), + ) + .unwrap(); + } + if n(initial, "mainhand") >= 0 { + c.equipment().set( + EquipmentSlot::MainHand, + refs[n(initial, "mainhand") as usize].clone(), + ); + } + } + let mut w = World { + report: Output { + out, + ids: vec![empty.clone()], + }, + refs, + op: Value::Null, + calls: 0, + }; + w.report.all(&w.refs, &inv, &empty); + for op in f["ops"].as_array().unwrap() { + w.op = op.clone(); + w.calls = 0; + let target = n(op, "inventory") as usize; + let a = n(op, "a") as usize; + let b = n(op, "b") as usize; + let slot = n(op, "slot"); + let amount = n(op, "amount"); + let result = (|| -> Result<(), ()> { + match op["kind"].as_str().unwrap() { + "add" => { + let input = w.refs[a].clone(); + let added = horizon_world::inventory_pickup::add( + &mut inv[target], + slot, + &input, + &mut w, + ) + .map_err(|_| ())?; + writeln!(w.report.out, "added {added}").unwrap(); + } + "space" => { + let input = w.refs[a].clone(); + let space = horizon_world::inventory_pickup::slot_with_space( + &mut inv[target], + &input, + &mut w, + ) + .map_err(|_| ())?; + writeln!(w.report.out, "space {space}").unwrap(); + } + "get" => w.refs[b] = inv[target].get(slot).map_err(|_| ())?, + "set" => inv[target].set(slot, w.refs[a].clone()).map_err(|_| ())?, + "remove" => w.refs[b] = inv[target].remove(slot, amount), + "no-update" => { + w.refs[b] = inv[target].remove_no_update(slot).map_err(|_| ())? + } + "remove-ref" => inv[target].remove_reference(&w.refs[a], &order), + "select" => inv[target].set_selected(slot).map_err(|_| ())?, + "selected" => w.refs[b] = inv[target].selected_item(), + "set-selected" => w.refs[b] = inv[target].set_selected_item(w.refs[a].clone()), + "remove-selected" => { + w.refs[b] = inv[target].remove_selected(op["all"].as_bool().unwrap()) + } + "pick" => inv[target].pick_slot(slot, &Rules).map_err(|_| ())?, + "add-pick" => inv[target].add_and_pick(w.refs[a].clone(), &Rules), + "clear" => inv[target].clear(), + "changed" => inv[target].changed(), + "replace" => { + let other = n(op, "other") as usize; + if other == target { + inv[target].replace_self(); + } else { + let (first, second) = inv.split_at_mut(1); + if target == 0 { + first[0].replace_with(&second[0]); + } else { + second[0].replace_with(&first[0]); + } + } + } + "equip" => { + w.refs[b] = inv[target].equipment().set( + EquipmentSlot::ALL[n(op, "equipment") as usize], + w.refs[a].clone(), + ) + } + "get-equip" => { + w.refs[b] = inv[target] + .equipment() + .get(EquipmentSlot::ALL[n(op, "equipment") as usize]) + } + "alias" => w.refs[b] = w.refs[a].clone(), + "copy" => w.refs[b] = stacks.copy(&w.refs[a]), + "count" => w.refs[a].write().count = amount, + "component" => { + w.refs[a] + .write() + .components + .set( + n(op, "key") as usize, + op["value"].as_i64().map(|n| n as i32), + ) + .map_err(|_| ())?; + } + _ => panic!("operation"), + } + Ok(()) + })(); + writeln!( + w.report.out, + "result {} {}", + if result.is_ok() { "ok" } else { "error" }, + w.calls + )?; + w.report.all(&w.refs, &inv, &empty); + } + out = w.report.out; + } + Ok(()) +} diff --git a/crates/horizon-world/src/inventory_pickup.rs b/crates/horizon-world/src/inventory_pickup.rs new file mode 100644 index 000000000..8d9545cd3 --- /dev/null +++ b/crates/horizon-world/src/inventory_pickup.rs @@ -0,0 +1,159 @@ +//! Player inventory resource insertion. The source stack is consumed in place; +//! callbacks can mutate aliased stacks or inventory slots at native boundaries. +use crate::{ + item_stack_refs::StackRef, + player_inventory::{InventoryError, InventoryRules, PlayerInventory}, +}; +#[derive(Debug)] +pub enum PickupError { + Inventory(InventoryError), + Callback(E), +} +pub trait PickupHooks: InventoryRules { + type Error; + fn item_max_stack_size(&self, stack: &StackRef) -> i32; + fn max_stack_size( + &mut self, + inventory: &mut PlayerInventory, + ) -> Result; + fn infinite_materials( + &mut self, + inventory: &mut PlayerInventory, + ) -> Result; +} +fn limit>( + inv: &mut PlayerInventory, + stack: &StackRef, + hooks: &mut H, +) -> Result> { + let max = hooks.max_stack_size(inv).map_err(PickupError::Callback)?; + Ok(max.min(hooks.item_max_stack_size(stack))) +} +fn remaining>( + inv: &mut PlayerInventory, + target: &StackRef, + stack: &StackRef, + hooks: &mut H, +) -> Result> { + if target.read().is_empty() + || !target.read().same_item_components(&stack.read()) + || hooks.item_max_stack_size(target) <= 1 + || hooks.is_damaged(target) + { + return Ok(false); + } + let count = target.read().count(); + Ok(count < limit(inv, target, hooks)?) +} +pub fn slot_with_space< + I: Copy + Eq, + K: Clone + Eq, + V: Clone + PartialEq, + H: PickupHooks, +>( + inv: &mut PlayerInventory, + stack: &StackRef, + hooks: &mut H, +) -> Result> { + let target = inv.selected_item(); + if remaining(inv, &target, stack, hooks)? { + return Ok(inv.selected() as i32); + } + let target = inv.get(40).expect("offhand"); + if remaining(inv, &target, stack, hooks)? { + return Ok(40); + } + for i in 0..36 { + let target = inv.get(i).expect("valid slot"); + if remaining(inv, &target, stack, hooks)? { + return Ok(i); + } + } + Ok(-1) +} +fn add_resource>( + inv: &mut PlayerInventory, + index: i32, + stack: &StackRef, + hooks: &mut H, +) -> Result> { + let count = stack.read().count(); + let mut target = inv.get(index).map_err(PickupError::Inventory)?; + if target.read().is_empty() { + target = inv.stacks().resolve(stack.read().copy_with_count(0)); + inv.set(index, target.clone()) + .map_err(PickupError::Inventory)?; + } + let max = limit(inv, &target, hooks)?; + let amount = count.min(max.wrapping_sub(target.read().count())); + if amount == 0 { + return Ok(count); + } + let count = count.wrapping_sub(amount); + target.write().grow(amount); + target.write().pop_time = 5; + Ok(count) +} +pub fn add>( + inv: &mut PlayerInventory, + mut index: i32, + stack: &StackRef, + hooks: &mut H, +) -> Result> { + if stack.read().is_empty() { + return Ok(false); + } + if hooks.is_damaged(stack) { + if index == -1 { + index = inv.free_slot(); + } + if index >= 0 { + // copyAndClear is evaluated before List.set validates its index. + let copy = inv.stacks().resolve(stack.write().copy_and_clear()); + inv.set_non_equipment(index, copy) + .map_err(PickupError::Inventory)?; + inv.get(index) + .expect("validated ordinary slot") + .write() + .pop_time = 5; + return Ok(true); + } + if hooks + .infinite_materials(inv) + .map_err(PickupError::Callback)? + { + stack.write().count = 0; + return Ok(true); + } + return Ok(false); + } + let before = loop { + let before = stack.read().count(); + let left = if index == -1 { + let mut slot = slot_with_space(inv, stack, hooks)?; + if slot == -1 { + slot = inv.free_slot(); + } + if slot == -1 { + stack.read().count() + } else { + add_resource(inv, slot, stack, hooks)? + } + } else { + add_resource(inv, index, stack, hooks)? + }; + stack.write().count = left; + if stack.read().is_empty() || stack.read().count() >= before { + break before; + } + }; + if stack.read().count() == before + && hooks + .infinite_materials(inv) + .map_err(PickupError::Callback)? + { + stack.write().count = 0; + return Ok(true); + } + Ok(stack.read().count() < before) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 62b67b942..41407a767 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -98,3 +98,5 @@ pub mod item_stack_refs; pub mod simple_container; pub mod player_inventory; + +pub mod inventory_pickup; diff --git a/crates/horizon-world/src/player_inventory.rs b/crates/horizon-world/src/player_inventory.rs index 05faa335c..189662aa5 100644 --- a/crates/horizon-world/src/player_inventory.rs +++ b/crates/horizon-world/src/player_inventory.rs @@ -124,6 +124,21 @@ impl PlayerInventory times_changed: 0, } } + pub(crate) fn stacks(&self) -> &ItemStacks { + &self.stacks + } + pub(crate) fn set_non_equipment( + &mut self, + index: i32, + stack: StackRef, + ) -> Result<(), InventoryError> { + let index = usize::try_from(index) + .ok() + .filter(|i| *i < 36) + .ok_or(InventoryError::Index)?; + self.items[index] = stack; + Ok(()) + } pub fn items(&self) -> &[StackRef; 36] { &self.items } diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 0f2c8c095..864024e86 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1684,3 +1684,19 @@ supply equipment-map order to both sides when removing an aliased reference. Targeted Clippy passes. Pickup, inventory/equipment ticks, menus, recipe accounting, persistence, full component values and complete gameplay integration remain pending. + + +`inventory_pickup` composes player slot search and insertion with shared stack +storage. Search checks the selected slot, offhand, then ordinary slots. Insertion +consumes its source, preserves component-sensitive merging and pop time, and +handles damaged stacks and creative fallback at their native callback points. + +`python3 tools/test_inventory_pickup_parity.py` compares actual native +Inventory.add/getSlotWithRemainingSpace, ItemStack operations and shared +equipment. The [pickup report](../benchmarks/rust-inventory-pickup-2026-10-07/scoped-parity.json) +records **424,282 matching lines per JAR**, including source/destination aliases, +callback mutations, failures, count overflow, invalid slots and the damaged +copy-and-clear that happens before slot validation. Targeted Clippy passes. +Native crash-report wrapping is represented as an error; diagnostic text is not +compared. Item-entity pickup events, networking, inventory ticks, menus, full +components and complete gameplay integration remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaInventoryPickupOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaInventoryPickupOracle.java new file mode 100644 index 000000000..7ed3e8845 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaInventoryPickupOracle.java @@ -0,0 +1,42 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.lang.reflect.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.component.*;import net.minecraft.world.item.*;import net.minecraft.world.entity.*;import net.minecraft.world.entity.player.Inventory;import net.minecraft.world.item.enchantment.*; +/** Native Inventory pickup and storage with real stack/component and equipment aliases. */ +@SuppressWarnings({"unchecked","rawtypes"}) +public final class VanillaInventoryPickupOracle { + static Item[] items;static DataComponentType[] keys;static Field components,count,patchMap,equipmentItems,changed;static Object removed;static ItemEnchantments enchanted; + static EquipmentSlot[] mapped={EquipmentSlot.FEET,EquipmentSlot.LEGS,EquipmentSlot.CHEST,EquipmentSlot.HEAD,EquipmentSlot.OFFHAND,EquipmentSlot.BODY,EquipmentSlot.SADDLE}; + static Field field(Class c,String n)throws Exception{var f=c.getDeclaredField(n);f.setAccessible(true);return f;} + static int n(JsonObject o,String k){return o.get(k).getAsInt();} + static int key(Object k){for(int i=0;inet.minecraft.util.Unit.INSTANCE;case 4->n==0?ItemEnchantments.EMPTY:enchanted;case 5->net.minecraft.network.chat.Component.literal(Integer.toString(n));default->n;};} + static String text(int k,Object v){if(v==null||v==removed)return "none";return switch(k){case 3->"0";case 4->((ItemEnchantments)v).isEmpty()?"0":"1";case 5->((net.minecraft.network.chat.Component)v).getString();default->v.toString();};} + static DataComponentMap prototype(JsonArray a){var b=DataComponentMap.builder();for(var e:a){var p=e.getAsJsonArray();int k=p.get(0).getAsInt();b.set(keys[k],value(k,p.get(1)));}return b.build();} + static DataComponentPatch patch(JsonArray a){var b=DataComponentPatch.builder();for(var e:a){var p=e.getAsJsonArray();int k=p.get(0).getAsInt();if(p.get(1).isJsonNull())b.remove(keys[k]);else b.set(keys[k],value(k,p.get(1)));}return b.build();} + static final class Stop extends RuntimeException {} + static final class Actor extends net.minecraft.world.entity.player.Player {Data d;Actor(){super(null,null);}@Override public net.minecraft.world.level.GameType gameMode(){return net.minecraft.world.level.GameType.SURVIVAL;}@Override public boolean isSpectator(){return false;}@Override public boolean isCreative(){return false;}@Override public boolean hasInfiniteMaterials(){d.event("infinite");return d.op.get("infinite").getAsBoolean();}} + static final class Inv extends Inventory {Data d;Inv(Actor actor,EntityEquipment equipment){super(actor,equipment);}@Override public int getMaxStackSize(){d.event("max");return n(d.op,"max");}} + static final class Data { JsonObject op;int calls,active; + void event(String name){calls++;out.println("event "+name+" "+calls);var c=inv[active];out.println("active "+c.getSelectedSlot()+" "+c.getTimesChanged());for(int i=0;i=0)c.setItem(n(op,"mutate_slot"),refs[n(op,"replace_ref")]);if(n(op,"after_selected")>=0)c.setSelectedSlot(n(op,"after_selected"));}} + + PrintWriter out;ItemStack[] refs;Inventory[] inv;EntityEquipment[] equipment;IdentityHashMap ids=new IdentityHashMap<>(); + int id(ItemStack s){return ids.computeIfAbsent(s,k->ids.size());} + String snapshot(ItemStack s){try{var raw=(PatchedDataComponentMap)components.get(s);var p=new StringJoiner(",");for(var e:((Map)patchMap.get(raw.asPatch())).entrySet())p.add(key(e.getKey())+"="+text(key(e.getKey()),e.getValue()));var v=new StringJoiner(",");for(int k=0;k)equipmentItems.get(equipment[i])).entrySet())eq.add(e.getKey().name()+"="+snapshot(e.getValue()));out.println("equipment "+eq);for(int j=0;j)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();for(int i=0;i<3;i++)items[i].builtInRegistryHolder().bindComponents(prototype(f.getAsJsonArray("prototypes").get(i).getAsJsonArray()));Inventory.EQUIPMENT_SLOT_MAPPING.clear();for(var e:f.getAsJsonArray("equipment_order")){int i=e.getAsInt();Inventory.EQUIPMENT_SLOT_MAPPING.put(36+i,mapped[i]);}ItemStack.EMPTY.setCount(0);ItemStack.EMPTY.setPopTime(0);((PatchedDataComponentMap)components.get(ItemStack.EMPTY)).clearPatch();var d=new Data();d.out=out;d.ids.put(ItemStack.EMPTY,0);d.refs=new ItemStack[4];for(int i=0;i<4;i++){var v=f.getAsJsonArray("stacks").get(i).getAsJsonObject();int type=n(v,"item");d.refs[i]=type<0?ItemStack.EMPTY:new ItemStack(items[type],n(v,"count"));if(type>=0){d.refs[i].setPopTime(n(v,"pop"));((PatchedDataComponentMap)components.get(d.refs[i])).restorePatch(patch(v.getAsJsonArray("patch")));}} + d.equipment=new EntityEquipment[]{new EntityEquipment(),new EntityEquipment()};if(f.get("shared_equipment").getAsBoolean())d.equipment[1]=d.equipment[0];var u=Class.forName("sun.misc.Unsafe");var unsafe=field(u,"theUnsafe").get(null);var allocate=u.getMethod("allocateInstance",Class.class);var actor=(Actor)allocate.invoke(unsafe,Actor.class);actor.d=d;d.inv=new Inventory[]{new Inv(actor,d.equipment[0]),new Inv(actor,d.equipment[1])};for(var c:d.inv)((Inv)c).d=d; + for(int i=0;i<2;i++){var initial=f.getAsJsonArray("inventories").get(i).getAsJsonObject();d.inv[i].setSelectedSlot(n(initial,"selected"));changed.setInt(d.inv[i],n(initial,"changed"));for(var entry:initial.getAsJsonArray("slots")){var pair=entry.getAsJsonArray();d.inv[i].setItem(pair.get(0).getAsInt(),d.refs[pair.get(1).getAsInt()]);}if(n(initial,"mainhand")>=0)d.equipment[i].set(EquipmentSlot.MAINHAND,d.refs[n(initial,"mainhand")]);} + d.all();for(var ov:f.getAsJsonArray("ops")){var op=ov.getAsJsonObject();d.op=op;d.calls=0;d.active=n(op,"inventory");var c=d.inv[d.active];int a=n(op,"a"),b=n(op,"b"),slot=n(op,"slot"),amount=n(op,"amount");try{switch(op.get("kind").getAsString()){ + case "add":out.println("added "+c.add(slot,d.refs[a]));break;case "space":out.println("space "+c.getSlotWithRemainingSpace(d.refs[a]));break;case "get":d.refs[b]=c.getItem(slot);break;case "set":c.setItem(slot,d.refs[a]);break;case "remove":d.refs[b]=c.removeItem(slot,amount);break;case "no-update":d.refs[b]=c.removeItemNoUpdate(slot);break;case "remove-ref":c.removeItem(d.refs[a]);break;case "select":c.setSelectedSlot(slot);break;case "selected":d.refs[b]=c.getSelectedItem();break;case "set-selected":d.refs[b]=c.setSelectedItem(d.refs[a]);break;case "remove-selected":d.refs[b]=c.removeFromSelected(op.get("all").getAsBoolean());break;case "pick":c.pickSlot(slot);break;case "add-pick":c.addAndPickItem(d.refs[a]);break;case "clear":c.clearContent();break;case "changed":c.setChanged();break;case "replace":c.replaceWith(d.inv[n(op,"other")]);break;case "equip":d.refs[b]=d.equipment[n(op,"inventory")].set(EquipmentSlot.values()[n(op,"equipment")],d.refs[a]);break;case "get-equip":d.refs[b]=d.equipment[n(op,"inventory")].get(EquipmentSlot.values()[n(op,"equipment")]);break;case "alias":d.refs[b]=d.refs[a];break;case "copy":d.refs[b]=d.refs[a].copy();break;case "count":d.refs[a].setCount(amount);break;case "component":int k=n(op,"key");d.refs[a].set(keys[k],value(k,op.get("value")));break;default:throw new AssertionError();}out.println("result ok "+d.calls);}catch(Stop|net.minecraft.ReportedException|IndexOutOfBoundsException|IllegalArgumentException|NullPointerException e){out.println("result error "+d.calls);}d.all();} + }} + } +} diff --git a/tools/test_inventory_pickup_parity.py b/tools/test_inventory_pickup_parity.py new file mode 100644 index 000000000..0975a77c3 --- /dev/null +++ b/tools/test_inventory_pickup_parity.py @@ -0,0 +1,88 @@ +#!/usr/bin/env python3 +"""Compare native InventoryPickup transfers, shared stack identity and change callbacks.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + edges=[-2147483648,-1,0,1,2,64,2147483647] + def op(kind,**kw): + v=dict(kind=kind,inventory=0,other=1,a=0,b=3,slot=-1,amount=1,all=False,equipment=0,key=0,value=64,max=99,infinite=False,fail_at=0,mutate_at=0,mutate_ref=0,after_count=2,after_max=8,mutate_slot=1,replace_ref=2,after_selected=-1);v.update(kw);return v + def stack(item,count,patch=None):return dict(item=item,count=count,pop=7,patch=patch or []) + def row(ops,count=5,slots=None,damaged=False):return dict(prototypes=[[],[[0,64]],[[0,1],[1,0],[2,100]]],stacks=[stack(2 if damaged else 1,count,[[1,3]] if damaged else []),stack(1,60),stack(2,1),stack(-1,0)],equipment_order=list(range(7)),shared_equipment=False,inventories=[dict(selected=0,changed=2147483647,mainhand=0,slots=slots if slots is not None else [[0,1],[35,2],[40,1]]),dict(selected=8,changed=0,mainhand=-1,slots=[[2,1],[39,0]])],ops=ops) + for damaged in [False,True]: + for slot in [-2,-1,0,8,35,36,40,42,43,2147483647]: + for count in edges: + for infinite in [False,True]: + # Unknown positive slots discard newly created copies on + # every iteration; bound counts to avoid billions of steps. + if slot>=43 and count>3:continue + yield row([op('space'),op('add',slot=slot,infinite=infinite),op('space')],count=count,damaged=damaged) + for damaged in [False,True]: + for slots in [[],[[0,0]],[[i,1] for i in range(43)],[[0,1],[40,1]],[[i,2] for i in range(43)]]: + for fail in range(5): + for mutate in range(4): + for after in [-1,0,4]: + yield row([op('add',fail_at=fail,mutate_at=mutate,after_selected=after)],slots=slots,damaged=damaged) + for limit in edges: + for count in edges: + for size in [0,1,64,2147483647]: + v=row([op('space',max=limit),op('add',max=limit)],count=count) + v['prototypes'][1]=[[0,size]] + yield v + rng=random.Random(0x5049434b5550) + for _ in range(1000): + damaged=bool(rng.randrange(2)) + v=row([],count=rng.choice(edges),slots=[[i,rng.randrange(4)] for i in rng.sample(range(43),rng.randrange(44))],damaged=damaged) + v['shared_equipment']=bool(rng.randrange(2)) + # Restrict insertion to actual slots; counts can cover the entire int. + for __ in range(10): + kind=rng.choice(['add','add','space','set','select','clear','count','alias','copy','remove']) + v['ops'].append(op(kind,inventory=rng.randrange(2),a=rng.randrange(4),b=rng.randrange(4),slot=rng.choice([-2,-1,0,8,35,36,40,42]),amount=rng.choice(edges),max=rng.choice(edges+[99]),infinite=bool(rng.randrange(2)),fail_at=rng.randrange(5),mutate_at=rng.randrange(4),mutate_ref=rng.randrange(4),after_count=rng.choice(edges),after_max=rng.choice(edges),mutate_slot=rng.choice([-1,0,8,40]),replace_ref=rng.randrange(4),after_selected=rng.choice([-1,0,8]))) + yield v + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-inventory-pickup-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaInventoryPickupOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/inventory_pickup_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaInventoryPickupOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','inventory_pickup_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('inventory_pickup_fixture.exe' if os.name=='nt' else 'inventory_pickup_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} inventory pickup output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual Inventory.add and getSlotWithRemainingSpace over stored ItemStack and shared equipment. Traces cover selected/offhand/ordinary slot search, component-sensitive stacking, damaged copy-and-clear, source aliases, pop time, creative fallback and virtual size/material callbacks with mutations/failures. Native crash-report wrapping is represented as an error without rendering its diagnostic text. Item entity pickup events, networking, menus, arbitrary method overrides, full item components and complete gameplay integration remain pending.'} + lab.write_json(report_path,report);print(f'Scoped inventory pickup parity passed: {report_path}') + + +if __name__=='__main__':main() From a3cecfdead12553421394eb2d29e4faf9f08d032 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 07:59:07 +0200 Subject: [PATCH 139/253] Compose native inventory and equipment ticks with shared stack state --- .../scoped-parity.json | 275 ++++++++++++++++++ .../examples/inventory_tick_fixture.rs | 231 +++++++++++++++ crates/horizon-world/src/inventory_tick.rs | 87 ++++++ crates/horizon-world/src/lib.rs | 2 + docs/collision-geometry.md | 17 ++ .../parity/VanillaInventoryTickOracle.java | 28 ++ tools/test_inventory_tick_parity.py | 76 +++++ 7 files changed, 716 insertions(+) create mode 100644 benchmarks/rust-inventory-tick-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/inventory_tick_fixture.rs create mode 100644 crates/horizon-world/src/inventory_tick.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaInventoryTickOracle.java create mode 100644 tools/test_inventory_tick_parity.py diff --git a/benchmarks/rust-inventory-tick-2026-10-07/scoped-parity.json b/benchmarks/rust-inventory-tick-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..bdfa02202 --- /dev/null +++ b/benchmarks/rust-inventory-tick-2026-10-07/scoped-parity.json @@ -0,0 +1,275 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 4464, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaInventoryTickOracle.java": "d816bbd310ab1e28c09e8a3952aed7b16363e02a15c46f429591fcb78fd59dad", + "tools/test_inventory_tick_parity.py": "2297ac921c8167255d9b700f246e02ba1a030571d42600e2b78aaa0c7b3d35e3", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "6884c7209f007ab9ee742b9c3c73828cfa1c6753d35b5fe25a87cab5955b33f8", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "18bbad377a8047e4d4ecd0fc87d83d46d1c0f1ce2b8c47bbe64633e7b4420b57", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/blocking_item_damage.rs": "afea3cb5761e8b82ee4d9bb4ef3c6fd10182a324dbaec99e6c9ebfac255dda09", + "crates/horizon-world/src/blocking_rules.rs": "83c5e2105cec56a90182ce582e1c67ade2b189be6de1a34d08035000cc07c492", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/component_durability.rs": "37a46e184f95bc5027e2b9af72ff52f729ad03601d08e1827f181fca383a35af", + "crates/horizon-world/src/component_patch.rs": "3622244ccdee46e13956c64ffe9be6234e686adf58dbc3a24cece0f1814301a1", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_immunity.rs": "fd39c41124d694e755cf7faadcf93c636df4042c78ec345092a856b5f952dbcf", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/damage_source.rs": "24945e397a926d34695652980923609e4723e02fe6b6e56d4aaf673e45d759f7", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/inventory_pickup.rs": "ea830c7916e7f2d95c6db7ef48be1e876e6ebafcb438e47fc72f9a5bd7c37d07", + "crates/horizon-world/src/inventory_tick.rs": "293a3d57a1689337cfd58e5a73dcdbed4cb360f94d98ff5458f0df92de387365", + "crates/horizon-world/src/item_blocking.rs": "f6eee0d6d177cc3148960122327ba1b459a2f0e85241c1d9a3e40f0b8c169296", + "crates/horizon-world/src/item_durability.rs": "9fdf835e5c7bd0e1dd63ef2ba0076b770cdd4d6d14cdcd11de27690f0702f94e", + "crates/horizon-world/src/item_stack_refs.rs": "1a83604c256a51898b59b0087c2378282bcebe7883add2c4634dc7f9183d6e49", + "crates/horizon-world/src/item_stack_storage.rs": "b4dcb83dcaa346848c5484161feb3e2cf08e83f7793d7ed83be25b14b9d12884", + "crates/horizon-world/src/item_use.rs": "1d0a3afa61b60d356e81a063da79ec6cd38730315976640a591325fc4c8ab98c", + "crates/horizon-world/src/item_use_catalog.rs": "a9b53d2e816583239a75c3c61e78dacc5e3b27dee595be34b1c7fa169f17a571", + "crates/horizon-world/src/item_use_lifecycle.rs": "f9b29f42a528493d0d2521110d4f6e0bc89af8f579d539648cb7c3a9e68e31cd", + "crates/horizon-world/src/item_use_start.rs": "9996a9b90c313925cd90e78c02880f2a1d2ae65aef53f4ce081578a9dcd10c62", + "crates/horizon-world/src/lib.rs": "e211ca0595ae93b335b19f621b6db600f622191fd92d09c1e7b8588124a973fa", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "2b448209629b9bf2e678d667ad0d6c7fa22146892dd106b169d96b31b0df12bb", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_hurt.rs": "844239ad7d15c39629bb3cfc06ebae6d1cff20b7627468f26e0ee8dff3abdcb8", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_hurt.rs": "99c9bbd8587ec2dc287806049897b8034d2f5349ad47fc497b70d54148844a36", + "crates/horizon-world/src/player_inventory.rs": "f4f67d8312793f25930626c4ac06db688fcf2e2292d6675071d105fb1708d952", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/server_player_combat.rs": "a9743971581af86d926eeba42004d932caf83382c470dd98bf613cb9c417db58", + "crates/horizon-world/src/server_player_damage.rs": "828a4649fec3e9bda2dfe20aced8c95922c697321de2be4127bd4e5712ecbb7c", + "crates/horizon-world/src/simple_container.rs": "0fedbc7e974b1db79b88bd6aff977654189a5d553cf42852fe8bf0885cf90b30", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "f417aab280331ddd6f0ca265a12c0130c78b9924f407c7e07f198140501e6010", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/view_direction.rs": "e18120ae26dc5cf702b29fc4c8487088bab133c8ce5abce01226833fafb0d5a4", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "74e4110fb19c4c4047192fd65c38015b8afc7f9fc50404d75380b5063808148c", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/inventory_tick_fixture.rs": "0011f15f2015e391feb3c8d027f1a629005d467d4c2a6555618fc343532d6e3b" + }, + "fixtures_sha256": { + ".local/rust-inventory-tick-parity/inputs.txt": "81d8c628cb7854f5aa206937b5ddc789fb11b0eb8e8d8e8362b21987b4301b2a" + }, + "rust_output_sha256": "2f11b5e52df3fb3ef4952e75a3ad3961dbbc3c9c07472c4bd92cbac30a10382f", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "2f11b5e52df3fb3ef4952e75a3ad3961dbbc3c9c07472c4bd92cbac30a10382f", + "matched_output_lines": 195957 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "2f11b5e52df3fb3ef4952e75a3ad3961dbbc3c9c07472c4bd92cbac30a10382f", + "matched_output_lines": 195957 + } + ], + "scope": "Actual Inventory.tick, EntityEquipment.tick and ItemStack.inventoryTick composed over shared stacks. Custom item handlers trace server dispatch; level/item callbacks mutate counts, pop time, selection and future slot/enum-map entries or fail. Client JAR uses an actual allocated ClientLevel for the non-server branch; dedicated server uses null because ClientLevel is absent. Concrete registered item tick effects, arbitrary getItem overrides, whole entity/world ticks and complete gameplay integration remain pending." +} diff --git a/crates/horizon-world/examples/inventory_tick_fixture.rs b/crates/horizon-world/examples/inventory_tick_fixture.rs new file mode 100644 index 000000000..974ed6760 --- /dev/null +++ b/crates/horizon-world/examples/inventory_tick_fixture.rs @@ -0,0 +1,231 @@ +use horizon_world::{ + component_patch::Prototype, + inventory_tick::{self, InventoryTickWorld}, + item_stack_refs::{ItemStacks, StackRef}, + player_inventory::{EntityEquipment, EquipmentSlot, PlayerInventory}, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +type Stack = StackRef; +type Inventory = PlayerInventory; +fn n(v: &Value, k: &str) -> i32 { + v[k].as_i64().unwrap() as i32 +} +struct World { + out: io::BufWriter, + f: Value, + refs: Vec, + ids: Vec, + empty: Stack, + level: u8, + calls: i32, +} +impl World { + fn id(&mut self, s: &Stack) -> usize { + self.ids + .iter() + .position(|v| v.same_reference(s)) + .unwrap_or_else(|| { + self.ids.push(s.clone()); + self.ids.len() - 1 + }) + } + fn snapshot(&mut self, s: &Stack) -> String { + let id = self.id(s); + let s = s.read(); + format!( + "{}:{}:{}:{}:{}:{}", + id, + s.item(), + s.count, + s.count(), + s.pop_time, + s.is_empty() + ) + } + fn all(&mut self, inv: &Inventory) { + for i in 0..self.refs.len() { + let s = self.snapshot(&self.refs[i].clone()); + writeln!(self.out, "ref {i} {s}").unwrap(); + } + writeln!( + self.out, + "state {} {} {}", + inv.selected(), + self.level, + self.calls + ) + .unwrap(); + let slots = (0..43) + .map(|i| self.snapshot(&inv.get(i).unwrap())) + .collect::>() + .join(" | "); + writeln!(self.out, "slots {slots}").unwrap(); + let entries = inv + .equipment() + .entries() + .into_iter() + .map(|(s, v)| { + format!( + "{}={}", + match s { + EquipmentSlot::MainHand => "MAINHAND", + EquipmentSlot::OffHand => "OFFHAND", + EquipmentSlot::Feet => "FEET", + EquipmentSlot::Legs => "LEGS", + EquipmentSlot::Chest => "CHEST", + EquipmentSlot::Head => "HEAD", + EquipmentSlot::Body => "BODY", + EquipmentSlot::Saddle => "SADDLE", + }, + self.snapshot(&v) + ) + }) + .collect::>() + .join(" | "); + writeln!(self.out, "equipment {entries}").unwrap(); + let s = self.snapshot(&self.empty.clone()); + writeln!(self.out, "empty {s}").unwrap(); + } + fn event(&mut self, inv: &mut Inventory, name: &str) -> Result<(), ()> { + writeln!(self.out, "{name}").unwrap(); + self.calls += 1; + self.all(inv); + if self.calls == n(&self.f, "fail_at") { + return Err(()); + } + if self.calls == n(&self.f, "mutate_at") { + self.refs[n(&self.f, "mutate_ref") as usize].write().count = n(&self.f, "after_count"); + self.refs[n(&self.f, "pop_ref") as usize].write().pop_time = n(&self.f, "after_pop"); + if n(&self.f, "replace_slot") >= 0 { + inv.set( + n(&self.f, "replace_slot"), + self.refs[n(&self.f, "replace_ref") as usize].clone(), + ) + .unwrap(); + } + if n(&self.f, "equipment_slot") >= 0 { + inv.equipment().set( + EquipmentSlot::ALL[n(&self.f, "equipment_slot") as usize], + self.refs[n(&self.f, "equipment_ref") as usize].clone(), + ); + } + inv.set_selected(n(&self.f, "after_selected")).unwrap(); + self.level = n(&self.f, "after_level") as u8; + } + Ok(()) + } +} +impl InventoryTickWorld for World { + type Error = (); + type Level = u8; + fn level(&mut self, inv: &mut Inventory) -> Result { + self.event(inv, "level")?; + Ok(self.level) + } + fn is_server_level(&self, level: u8) -> bool { + level == 1 + } + fn item_tick( + &mut self, + inv: &mut Inventory, + item: u8, + stack: Stack, + level: u8, + slot: Option, + ) -> Result<(), ()> { + assert_eq!(level, 1); + if item != 0 { + let id = self.id(&stack); + self.event( + inv, + &format!("tick {item} {id} {}", slot.map_or(-1, |s| s as i32)), + )?; + } + Ok(()) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let stacks = ItemStacks::new(0); + let empty = stacks.empty(); + let refs: Vec<_> = f["stacks"] + .as_array() + .unwrap() + .iter() + .map(|v| { + let item = n(v, "item"); + if item < 0 { + empty.clone() + } else { + let s = stacks.create(item as u8, n(v, "count"), Prototype::new([])); + s.write().pop_time = n(v, "pop"); + s + } + }) + .collect(); + let equipment = EntityEquipment::new(empty.clone()); + let mut inv = Inventory::new(stacks, equipment); + inv.set_selected(n(&f, "selected")).unwrap(); + for p in f["slots"].as_array().unwrap() { + inv.set( + p[0].as_i64().unwrap() as i32, + refs[p[1].as_u64().unwrap() as usize].clone(), + ) + .unwrap(); + } + for p in f["equipment"].as_array().unwrap() { + inv.equipment().set( + EquipmentSlot::ALL[p[0].as_u64().unwrap() as usize], + refs[p[1].as_u64().unwrap() as usize].clone(), + ); + } + let mut w = World { + out, + f: f.clone(), + refs, + ids: vec![empty.clone()], + empty, + level: n(&f, "level") as u8, + calls: 0, + }; + w.all(&inv); + let result = match f["mode"].as_str().unwrap() { + "inventory" => inventory_tick::tick_inventory(&mut w, &mut inv), + "equipment" => inventory_tick::tick_equipment(&mut w, &mut inv), + "both" => inventory_tick::tick_inventory(&mut w, &mut inv) + .and_then(|()| inventory_tick::tick_equipment(&mut w, &mut inv)), + "stack" => { + let stack = w.refs[n(&f, "argument") as usize].clone(); + inventory_tick::tick_stack( + &mut w, + &mut inv, + stack, + n(&f, "argument_level") as u8, + if n(&f, "slot") < 0 { + None + } else { + Some(EquipmentSlot::ALL[n(&f, "slot") as usize]) + }, + ) + } + _ => panic!("mode"), + }; + writeln!( + w.out, + "result {}", + if result.is_ok() { "ok" } else { "error" } + )?; + w.all(&inv); + out = w.out; + } + Ok(()) +} diff --git a/crates/horizon-world/src/inventory_tick.rs b/crates/horizon-world/src/inventory_tick.rs new file mode 100644 index 000000000..aaa75a639 --- /dev/null +++ b/crates/horizon-world/src/inventory_tick.rs @@ -0,0 +1,87 @@ +//! Inventory/equipment ticking composed with ItemStack's pop-time update and +//! server-only item dispatch. All references are captured at native boundaries. +use crate::{ + item_stack_refs::StackRef, + player_inventory::{EquipmentSlot, PlayerInventory}, +}; +pub trait InventoryTickWorld { + type Error; + type Level: Copy; + fn level( + &mut self, + inventory: &mut PlayerInventory, + ) -> Result; + /// This is a ServerLevel type test, not Level.isClientSide(). + fn is_server_level(&self, level: Self::Level) -> bool; + fn item_tick( + &mut self, + inventory: &mut PlayerInventory, + item: I, + stack: StackRef, + level: Self::Level, + slot: Option, + ) -> Result<(), Self::Error>; +} +pub fn tick_stack< + I: Copy + Eq, + K: Clone + Eq, + V: Clone + PartialEq, + W: InventoryTickWorld, +>( + w: &mut W, + inventory: &mut PlayerInventory, + stack: StackRef, + level: W::Level, + slot: Option, +) -> Result<(), W::Error> { + { + let mut data = stack.write(); + if data.pop_time > 0 { + data.pop_time = data.pop_time.wrapping_sub(1); + } + } + if w.is_server_level(level) { + let item = stack.read().item(); + w.item_tick(inventory, item, stack, level, slot)?; + } + Ok(()) +} +pub fn tick_inventory< + I: Copy + Eq, + K: Clone + Eq, + V: Clone + PartialEq, + W: InventoryTickWorld, +>( + w: &mut W, + inventory: &mut PlayerInventory, +) -> Result<(), W::Error> { + for index in 0..36 { + let stack = inventory.get(index).expect("ordinary slot"); + if !stack.read().is_empty() { + let level = w.level(inventory)?; + let slot = (index as usize == inventory.selected()).then_some(EquipmentSlot::MainHand); + tick_stack(w, inventory, stack, level, slot)?; + } + } + Ok(()) +} +pub fn tick_equipment< + I: Copy + Eq, + K: Clone + Eq, + V: Clone + PartialEq, + W: InventoryTickWorld, +>( + w: &mut W, + inventory: &mut PlayerInventory, +) -> Result<(), W::Error> { + // EnumMap iteration is weakly consistent. Read each entry when reached so + // writes to later slots during a callback are visible in this same tick. + for slot in EquipmentSlot::ALL { + let stack = inventory.equipment().get(slot); + if !stack.read().is_empty() { + let level = w.level(inventory)?; + tick_stack(w, inventory, stack, level, Some(slot))?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 41407a767..c0a9dee85 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -100,3 +100,5 @@ pub mod simple_container; pub mod player_inventory; pub mod inventory_pickup; + +pub mod inventory_tick; diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 864024e86..9d8f4e897 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1700,3 +1700,20 @@ copy-and-clear that happens before slot validation. Targeted Clippy passes. Native crash-report wrapping is represented as an error; diagnostic text is not compared. Item-entity pickup events, networking, inventory ticks, menus, full components and complete gameplay integration remain pending. + + +`inventory_tick` composes inventory/equipment iteration with ItemStack's pop-time +update and ServerLevel-only item dispatch. It retains stack arguments across +level callbacks, reads hotbar selection at the native point and observes changes +to later equipment entries during the same tick. Aliased stacks can be visited +more than once, with each visit updating their shared pop-time counter. + +`python3 tools/test_inventory_tick_parity.py` compares actual Inventory.tick, +EntityEquipment.tick and ItemStack.inventoryTick with custom item handlers. The +[tick report](../benchmarks/rust-inventory-tick-2026-10-07/scoped-parity.json) +records **195,957 matching lines per JAR**, including empty stacks, callbacks +that mutate later slots, weakly consistent equipment iteration and failure +prefixes. The client comparison uses an actual allocated ClientLevel for the +non-server branch; the dedicated JAR uses null because ClientLevel is absent. +Targeted Clippy passes. Registered items' individual tick effects, full entity +and world ticking and complete gameplay integration remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaInventoryTickOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaInventoryTickOracle.java new file mode 100644 index 000000000..8ad5d1f67 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaInventoryTickOracle.java @@ -0,0 +1,28 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.lang.reflect.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.*;import net.minecraft.core.component.*;import net.minecraft.world.item.*;import net.minecraft.world.entity.*;import net.minecraft.world.entity.player.*;import net.minecraft.world.level.Level;import net.minecraft.server.level.ServerLevel; +/** Native inventory/equipment loops composed with actual ItemStack.inventoryTick. */ +public final class VanillaInventoryTickOracle { + static final class Stop extends RuntimeException {} + static Object unsafe;static Method allocate;static Field count,eqItems;static Constructor ctor; + static Field field(Class c,String n)throws Exception{var f=c.getDeclaredField(n);f.setAccessible(true);return f;} + static T make(Class c)throws Exception{return c.cast(allocate.invoke(unsafe,c));} + static int n(JsonObject o,String k){return o.get(k).getAsInt();} + static final class Data { + PrintWriter out;JsonObject f;ItemStack[] refs;Item[] types;Inventory inv;EntityEquipment equipment;Actor actor;Level[] levels;int level,calls;IdentityHashMap ids=new IdentityHashMap<>(); + int type(Item item){for(int i=0;iids.size());} + String snapshot(ItemStack s){try{return id(s)+":"+type(s.getItem())+":"+count.getInt(s)+":"+s.getCount()+":"+s.getPopTime()+":"+s.isEmpty();}catch(Exception e){throw new AssertionError(e);}} + void all(){try{for(int i=0;i)eqItems.get(equipment)).entrySet())entries.add(e.getKey().name()+"="+snapshot(e.getValue()));out.println("equipment "+entries);out.println("empty "+snapshot(ItemStack.EMPTY));}catch(Exception e){throw new AssertionError(e);}} + void event(String name){out.println(name);calls++;all();if(calls==n(f,"fail_at"))throw new Stop();if(calls==n(f,"mutate_at")){refs[n(f,"mutate_ref")].setCount(n(f,"after_count"));refs[n(f,"pop_ref")].setPopTime(n(f,"after_pop"));if(n(f,"replace_slot")>=0)inv.setItem(n(f,"replace_slot"),refs[n(f,"replace_ref")]);if(n(f,"equipment_slot")>=0)equipment.set(EquipmentSlot.values()[n(f,"equipment_slot")],refs[n(f,"equipment_ref")]);inv.setSelectedSlot(n(f,"after_selected"));level=n(f,"after_level");}} + } + static final class Actor extends Player {Data d;Actor(){super(null,null);}@Override public net.minecraft.world.level.GameType gameMode(){return net.minecraft.world.level.GameType.SURVIVAL;}@Override public boolean isSpectator(){return false;}@Override public boolean isCreative(){return false;}@Override public Level level(){d.event("level");return d.levels[d.level];}} + static final class TickItem extends Item {Data d;int type;TickItem(){super(null);}@Override public void inventoryTick(ItemStack s,ServerLevel level,Entity owner,EquipmentSlot slot){if(owner!=d.actor||level!=d.levels[1])throw new AssertionError();d.event("tick "+type+" "+d.id(s)+" "+(slot==null?-1:slot.ordinal()));}} + @SuppressWarnings("unchecked")public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();var u=Class.forName("sun.misc.Unsafe");unsafe=field(u,"theUnsafe").get(null);allocate=u.getMethod("allocateInstance",Class.class);count=field(ItemStack.class,"count");eqItems=field(EntityEquipment.class,"items");ctor=ItemStack.class.getDeclaredConstructor(Holder.class,int.class,PatchedDataComponentMap.class);ctor.setAccessible(true); + // ClientLevel is absent from the dedicated JAR. Null exercises the same + // non-ServerLevel branch there; client comparisons use an actual ClientLevel. + Level client=null;try{client=(Level)allocate.invoke(unsafe,Class.forName("net.minecraft.client.multiplayer.ClientLevel"));}catch(ClassNotFoundException ignored){} + Path dir=Path.of(args[1]);try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var d=new Data();d.out=out;d.f=JsonParser.parseString(line).getAsJsonObject();d.ids.put(ItemStack.EMPTY,0);ItemStack.EMPTY.setCount(0);ItemStack.EMPTY.setPopTime(0);d.actor=make(Actor.class);d.actor.d=d;d.levels=new Level[]{client,make(ServerLevel.class)};d.level=n(d.f,"level");var first=make(TickItem.class);first.d=d;first.type=1;var second=make(TickItem.class);second.d=d;second.type=2;d.types=new Item[]{Items.AIR,first,second};d.refs=new ItemStack[4];for(int i=0;i<4;i++){var v=d.f.getAsJsonArray("stacks").get(i).getAsJsonObject();int item=n(v,"item");d.refs[i]=item<0?ItemStack.EMPTY:ctor.newInstance(Holder.direct(d.types[item]),n(v,"count"),new PatchedDataComponentMap(DataComponentMap.EMPTY));if(item>=0)d.refs[i].setPopTime(n(v,"pop"));}d.equipment=new EntityEquipment();d.inv=new Inventory(d.actor,d.equipment);d.inv.setSelectedSlot(n(d.f,"selected"));for(var e:d.f.getAsJsonArray("slots")){var p=e.getAsJsonArray();d.inv.setItem(p.get(0).getAsInt(),d.refs[p.get(1).getAsInt()]);}for(var e:d.f.getAsJsonArray("equipment")){var p=e.getAsJsonArray();d.equipment.set(EquipmentSlot.values()[p.get(0).getAsInt()],d.refs[p.get(1).getAsInt()]);}d.all();try{switch(d.f.get("mode").getAsString()){case "inventory":d.inv.tick();break;case "equipment":d.equipment.tick(d.actor);break;case "both":d.inv.tick();d.equipment.tick(d.actor);break;case "stack":int slot=n(d.f,"slot");d.refs[n(d.f,"argument")].inventoryTick(d.levels[n(d.f,"argument_level")],d.actor,slot<0?null:EquipmentSlot.values()[slot]);break;default:throw new AssertionError();}out.println("result ok");}catch(Stop e){out.println("result error");}d.all();}} + } +} diff --git a/tools/test_inventory_tick_parity.py b/tools/test_inventory_tick_parity.py new file mode 100644 index 000000000..b8c817cf9 --- /dev/null +++ b/tools/test_inventory_tick_parity.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python3 +"""Compare native InventoryTick transfers, shared stack identity and change callbacks.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + edges=[-2147483648,-1,0,1,2,5,2147483647] + def row(mode='both',**kw): + v=dict(mode=mode,stacks=[dict(item=1,count=2,pop=5),dict(item=2,count=1,pop=2),dict(item=1,count=1,pop=0),dict(item=-1,count=0,pop=0)],slots=[[0,0],[1,0],[8,1],[35,2]],equipment=[[0,0],[1,1],[7,2]],selected=0,level=1,argument=0,argument_level=1,slot=-1,fail_at=0,mutate_at=0,mutate_ref=0,after_count=1,pop_ref=1,after_pop=5,replace_slot=8,replace_ref=2,equipment_slot=7,equipment_ref=0,after_selected=8,after_level=1);v.update(kw);return v + for mode in ['inventory','equipment','both','stack']: + for item in [-1,0,1,2]: + for count in edges: + for pop in edges: + for level in [0,1]: + v=row(mode,level=level,argument_level=level) + v['stacks'][0]=dict(item=item,count=count,pop=pop) + yield v + for mode in ['inventory','equipment','both','stack']: + for fail in range(1,9): + for mutate in range(1,9): + for count in [-1,0,2]:yield row(mode,fail_at=fail,mutate_at=mutate,after_count=count) + # Inserts into an unpopulated EnumMap entry after iteration has begun. + for initial in range(8): + for inserted in range(8): + for mutate in [1,2]:yield row('equipment',equipment=[[initial,0]],equipment_slot=inserted,mutate_at=mutate) + rng=random.Random(0x494e565449434b) + for _ in range(2000): + v=row(rng.choice(['inventory','equipment','both','stack']),stacks=[dict(item=rng.randrange(-1,3),count=rng.choice(edges),pop=rng.choice(edges)) for __ in range(4)],slots=[[i,rng.randrange(4)] for i in rng.sample(range(43),rng.randrange(44))],equipment=[[i,rng.randrange(4)] for i in rng.sample(range(8),rng.randrange(9))],selected=rng.randrange(9),level=rng.randrange(2),argument=rng.randrange(4),argument_level=rng.randrange(2),slot=rng.randrange(-1,8),fail_at=rng.randrange(10),mutate_at=rng.randrange(10),mutate_ref=rng.randrange(4),after_count=rng.choice(edges),pop_ref=rng.randrange(4),after_pop=rng.choice(edges),replace_slot=rng.randrange(-1,43),replace_ref=rng.randrange(4),equipment_slot=rng.randrange(-1,8),equipment_ref=rng.randrange(4),after_selected=rng.randrange(9),after_level=rng.randrange(2)) + yield v + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-inventory-tick-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaInventoryTickOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/inventory_tick_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaInventoryTickOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','inventory_tick_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('inventory_tick_fixture.exe' if os.name=='nt' else 'inventory_tick_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} inventory tick output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual Inventory.tick, EntityEquipment.tick and ItemStack.inventoryTick composed over shared stacks. Custom item handlers trace server dispatch; level/item callbacks mutate counts, pop time, selection and future slot/enum-map entries or fail. Client JAR uses an actual allocated ClientLevel for the non-server branch; dedicated server uses null because ClientLevel is absent. Concrete registered item tick effects, arbitrary getItem overrides, whole entity/world ticks and complete gameplay integration remain pending.'} + lab.write_json(report_path,report);print(f'Scoped inventory tick parity passed: {report_path}') + + +if __name__=='__main__':main() From 5f8c41aaad2a4b6a1601b36f3a4f227728a082cf Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 08:03:42 +0200 Subject: [PATCH 140/253] Bind player hand access to selected inventory and shared equipment --- .../scoped-parity.json | 276 ++++++++++++++++++ .../examples/player_equipment_fixture.rs | 273 +++++++++++++++++ crates/horizon-world/src/lib.rs | 2 + crates/horizon-world/src/player_equipment.rs | 83 ++++++ docs/collision-geometry.md | 15 + .../parity/VanillaPlayerEquipmentOracle.java | 26 ++ tools/test_player_equipment_parity.py | 78 +++++ 7 files changed, 753 insertions(+) create mode 100644 benchmarks/rust-player-equipment-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/player_equipment_fixture.rs create mode 100644 crates/horizon-world/src/player_equipment.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerEquipmentOracle.java create mode 100644 tools/test_player_equipment_parity.py diff --git a/benchmarks/rust-player-equipment-2026-10-07/scoped-parity.json b/benchmarks/rust-player-equipment-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..62f6fdef1 --- /dev/null +++ b/benchmarks/rust-player-equipment-2026-10-07/scoped-parity.json @@ -0,0 +1,276 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 3571, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerEquipmentOracle.java": "e6713f951ef5583ccb06167613221e94a120ab1dac775aca732b220eeb1ee394", + "tools/test_player_equipment_parity.py": "80b3be0e7ba7c0fecaa73eb3324f61c91410657ec398b3801f992958ad4b05a9", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "6884c7209f007ab9ee742b9c3c73828cfa1c6753d35b5fe25a87cab5955b33f8", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "18bbad377a8047e4d4ecd0fc87d83d46d1c0f1ce2b8c47bbe64633e7b4420b57", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/blocking_item_damage.rs": "afea3cb5761e8b82ee4d9bb4ef3c6fd10182a324dbaec99e6c9ebfac255dda09", + "crates/horizon-world/src/blocking_rules.rs": "83c5e2105cec56a90182ce582e1c67ade2b189be6de1a34d08035000cc07c492", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/component_durability.rs": "37a46e184f95bc5027e2b9af72ff52f729ad03601d08e1827f181fca383a35af", + "crates/horizon-world/src/component_patch.rs": "3622244ccdee46e13956c64ffe9be6234e686adf58dbc3a24cece0f1814301a1", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_immunity.rs": "fd39c41124d694e755cf7faadcf93c636df4042c78ec345092a856b5f952dbcf", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/damage_source.rs": "24945e397a926d34695652980923609e4723e02fe6b6e56d4aaf673e45d759f7", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/inventory_pickup.rs": "ea830c7916e7f2d95c6db7ef48be1e876e6ebafcb438e47fc72f9a5bd7c37d07", + "crates/horizon-world/src/inventory_tick.rs": "293a3d57a1689337cfd58e5a73dcdbed4cb360f94d98ff5458f0df92de387365", + "crates/horizon-world/src/item_blocking.rs": "f6eee0d6d177cc3148960122327ba1b459a2f0e85241c1d9a3e40f0b8c169296", + "crates/horizon-world/src/item_durability.rs": "9fdf835e5c7bd0e1dd63ef2ba0076b770cdd4d6d14cdcd11de27690f0702f94e", + "crates/horizon-world/src/item_stack_refs.rs": "1a83604c256a51898b59b0087c2378282bcebe7883add2c4634dc7f9183d6e49", + "crates/horizon-world/src/item_stack_storage.rs": "b4dcb83dcaa346848c5484161feb3e2cf08e83f7793d7ed83be25b14b9d12884", + "crates/horizon-world/src/item_use.rs": "1d0a3afa61b60d356e81a063da79ec6cd38730315976640a591325fc4c8ab98c", + "crates/horizon-world/src/item_use_catalog.rs": "a9b53d2e816583239a75c3c61e78dacc5e3b27dee595be34b1c7fa169f17a571", + "crates/horizon-world/src/item_use_lifecycle.rs": "f9b29f42a528493d0d2521110d4f6e0bc89af8f579d539648cb7c3a9e68e31cd", + "crates/horizon-world/src/item_use_start.rs": "9996a9b90c313925cd90e78c02880f2a1d2ae65aef53f4ce081578a9dcd10c62", + "crates/horizon-world/src/lib.rs": "71dc72ba5c6c461456201f6f6cb28942223ecac7f899940d46d30fc15ec9b18a", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "2b448209629b9bf2e678d667ad0d6c7fa22146892dd106b169d96b31b0df12bb", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_hurt.rs": "844239ad7d15c39629bb3cfc06ebae6d1cff20b7627468f26e0ee8dff3abdcb8", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_equipment.rs": "1fa8c53e67624c4641246249d79a800a28a4858c62482bd880b4e3b866b936ef", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_hurt.rs": "99c9bbd8587ec2dc287806049897b8034d2f5349ad47fc497b70d54148844a36", + "crates/horizon-world/src/player_inventory.rs": "f4f67d8312793f25930626c4ac06db688fcf2e2292d6675071d105fb1708d952", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/server_player_combat.rs": "a9743971581af86d926eeba42004d932caf83382c470dd98bf613cb9c417db58", + "crates/horizon-world/src/server_player_damage.rs": "828a4649fec3e9bda2dfe20aced8c95922c697321de2be4127bd4e5712ecbb7c", + "crates/horizon-world/src/simple_container.rs": "0fedbc7e974b1db79b88bd6aff977654189a5d553cf42852fe8bf0885cf90b30", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "f417aab280331ddd6f0ca265a12c0130c78b9924f407c7e07f198140501e6010", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/view_direction.rs": "e18120ae26dc5cf702b29fc4c8487088bab133c8ce5abce01226833fafb0d5a4", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "74e4110fb19c4c4047192fd65c38015b8afc7f9fc50404d75380b5063808148c", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/player_equipment_fixture.rs": "9cf7128f3da64bf2ed64547d0397a584b18a27d0fb085d95489d32b45dba1310" + }, + "fixtures_sha256": { + ".local/rust-player-equipment-parity/inputs.txt": "8e3e0acd6656382699f5d128231a2ff7178d67ec09cc123aceb518cef249b900" + }, + "rust_output_sha256": "41c0d61417e9fdb12847097bb988fa88303d20ca71a71304085f22ca84c390b7", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "41c0d61417e9fdb12847097bb988fa88303d20ca71a71304085f22ca84c390b7", + "matched_output_lines": 408852 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "41c0d61417e9fdb12847097bb988fa88303d20ca71a71304085f22ca84c390b7", + "matched_output_lines": 408852 + } + ], + "scope": "Actual PlayerEquipment get/set/isEmpty and inherited LivingEntity hand/slot access over a real Inventory and shared ItemStack references. Equipment changes write storage before the controlled onEquipItem callback; mutations/failures and main-hand selection changes retain native prefixes. Raw enum-map main-hand entries exercise base storage independently from the selected main-hand override. Full onEquipItem effects, synchronized flags, active-use integration and complete gameplay integration remain pending." +} diff --git a/crates/horizon-world/examples/player_equipment_fixture.rs b/crates/horizon-world/examples/player_equipment_fixture.rs new file mode 100644 index 000000000..a7349b78c --- /dev/null +++ b/crates/horizon-world/examples/player_equipment_fixture.rs @@ -0,0 +1,273 @@ +use horizon_world::{ + component_patch::Prototype, + item_stack_refs::{ItemStacks, StackRef}, + player_equipment::{self, EquipWorld, InteractionHand}, + player_inventory::{EntityEquipment, EquipmentSlot, PlayerInventory}, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +type Stack = StackRef; +type Inventory = PlayerInventory; +fn n(v: &Value, k: &str) -> i32 { + v[k].as_i64().unwrap() as i32 +} +struct World { + out: io::BufWriter, + f: Value, + refs: Vec, + ids: Vec, + empty: Stack, + calls: i32, +} +impl World { + fn id(&mut self, s: &Stack) -> usize { + self.ids + .iter() + .position(|v| v.same_reference(s)) + .unwrap_or_else(|| { + self.ids.push(s.clone()); + self.ids.len() - 1 + }) + } + fn snapshot(&mut self, s: &Stack) -> String { + let id = self.id(s); + let s = s.read(); + format!( + "{}:{}:{}:{}:{}:{}", + id, + s.item(), + s.count, + s.count(), + s.pop_time, + s.is_empty() + ) + } + fn all(&mut self, inv: &Inventory) { + for i in 0..self.refs.len() { + let s = self.snapshot(&self.refs[i].clone()); + writeln!(self.out, "ref {i} {s}").unwrap(); + } + writeln!( + self.out, + "state {} {} {}", + inv.selected(), + self.calls, + player_equipment::is_empty(inv) + ) + .unwrap(); + let slots = (0..43) + .map(|i| self.snapshot(&inv.get(i).unwrap())) + .collect::>() + .join(" | "); + writeln!(self.out, "slots {slots}").unwrap(); + let entries = inv + .equipment() + .entries() + .into_iter() + .map(|(s, v)| { + format!( + "{}={}", + match s { + EquipmentSlot::MainHand => "MAINHAND", + EquipmentSlot::OffHand => "OFFHAND", + EquipmentSlot::Feet => "FEET", + EquipmentSlot::Legs => "LEGS", + EquipmentSlot::Chest => "CHEST", + EquipmentSlot::Head => "HEAD", + EquipmentSlot::Body => "BODY", + EquipmentSlot::Saddle => "SADDLE", + }, + self.snapshot(&v) + ) + }) + .collect::>() + .join(" | "); + writeln!(self.out, "raw-equipment {entries}").unwrap(); + let equipped = EquipmentSlot::ALL + .into_iter() + .map(|slot| self.snapshot(&player_equipment::get(inv, slot))) + .collect::>() + .join(" | "); + writeln!(self.out, "equipped {equipped}").unwrap(); + let main = self.snapshot(&player_equipment::get_hand(inv, InteractionHand::Main)); + let off = self.snapshot(&player_equipment::get_hand(inv, InteractionHand::Off)); + writeln!(self.out, "hands {main} | {off}").unwrap(); + let s = self.snapshot(&self.empty.clone()); + writeln!(self.out, "empty {s}").unwrap(); + } +} +impl EquipWorld for World { + type Error = (); + fn on_equip( + &mut self, + inv: &mut Inventory, + slot: EquipmentSlot, + old: Stack, + next: Stack, + ) -> Result<(), ()> { + self.calls += 1; + let old = self.id(&old); + let next = self.id(&next); + writeln!(self.out, "equip {} {old} {next}", slot as usize).unwrap(); + self.all(inv); + if self.f["fail"].as_bool().unwrap() { + return Err(()); + } + if self.f["mutate"].as_bool().unwrap() { + self.refs[n(&self.f, "mutate_ref") as usize].write().count = n(&self.f, "after_count"); + inv.set_selected(n(&self.f, "after_selected")) + .map_err(|_| ())?; + inv.set( + n(&self.f, "replace_slot"), + self.refs[n(&self.f, "replace_ref") as usize].clone(), + ) + .map_err(|_| ())?; + } + Ok(()) + } +} + +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let stacks = ItemStacks::new(0); + let empty = stacks.empty(); + let refs: Vec<_> = f["stacks"] + .as_array() + .unwrap() + .iter() + .map(|v| { + let item = n(v, "item"); + if item < 0 { + empty.clone() + } else { + let s = stacks.create(item as u8, n(v, "count"), Prototype::new([])); + s.write().pop_time = n(v, "pop"); + s + } + }) + .collect(); + let equipment = EntityEquipment::new(empty.clone()); + let mut inv = Inventory::new(stacks, equipment); + inv.set_selected(n(&f, "selected")).unwrap(); + for p in f["slots"].as_array().unwrap() { + inv.set( + p[0].as_i64().unwrap() as i32, + refs[p[1].as_u64().unwrap() as usize].clone(), + ) + .unwrap(); + } + for p in f["equipment"].as_array().unwrap() { + player_equipment::set( + &mut inv, + EquipmentSlot::ALL[p[0].as_u64().unwrap() as usize], + refs[p[1].as_u64().unwrap() as usize].clone(), + ); + } + for p in f["raw_entries"].as_array().unwrap() { + inv.equipment().set( + EquipmentSlot::ALL[p[0].as_u64().unwrap() as usize], + refs[p[1].as_u64().unwrap() as usize].clone(), + ); + } + let mut w = World { + out, + f: Value::Null, + refs, + ids: vec![empty.clone()], + empty, + calls: 0, + }; + w.all(&inv); + for op in f["ops"].as_array().unwrap() { + w.f = op.clone(); + w.calls = 0; + let a = n(op, "a") as usize; + let b = n(op, "b") as usize; + let slot = n(op, "slot"); + let result = (|| -> Result<(), ()> { + match op["kind"].as_str().unwrap() { + "get-hand" => { + w.refs[b] = player_equipment::get_hand( + &inv, + if n(op, "hand") == 0 { + InteractionHand::Main + } else { + InteractionHand::Off + }, + ) + } + "set-hand" => { + let s = w.refs[a].clone(); + player_equipment::set_hand( + &mut w, + &mut inv, + if n(op, "hand") == 0 { + InteractionHand::Main + } else { + InteractionHand::Off + }, + s, + )?; + } + "get-item" => { + w.refs[b] = player_equipment::get( + &inv, + EquipmentSlot::ALL[n(op, "equipment") as usize], + ) + } + "set-item" => { + let s = w.refs[a].clone(); + player_equipment::set_item_slot( + &mut w, + &mut inv, + EquipmentSlot::ALL[n(op, "equipment") as usize], + s, + )?; + } + "set-equipment" => { + w.refs[b] = player_equipment::set( + &mut inv, + EquipmentSlot::ALL[n(op, "equipment") as usize], + w.refs[a].clone(), + ) + } + "clear-equipment" => inv.equipment().clear(), + "clear" => inv.clear(), + "select" => inv.set_selected(slot).map_err(|_| ())?, + "get" => w.refs[b] = inv.get(slot).map_err(|_| ())?, + "set" => inv.set(slot, w.refs[a].clone()).map_err(|_| ())?, + "count" => w.refs[a].write().count = n(op, "amount"), + "alias" => w.refs[b] = w.refs[a].clone(), + "copy" => { + let copied = w.refs[a].read().copy(); + w.refs[b] = match copied { + horizon_world::item_stack_storage::CopyResult::Empty => w.empty.clone(), + horizon_world::item_stack_storage::CopyResult::Stack(data) => { + Stack::new(data) + } + }; + } + _ => panic!("operation"), + } + Ok(()) + })(); + writeln!( + w.out, + "result {} {}", + if result.is_ok() { "ok" } else { "error" }, + w.calls + )?; + w.all(&inv); + } + out = w.out; + } + Ok(()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index c0a9dee85..5da6a4d26 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -102,3 +102,5 @@ pub mod player_inventory; pub mod inventory_pickup; pub mod inventory_tick; + +pub mod player_equipment; diff --git a/crates/horizon-world/src/player_equipment.rs b/crates/horizon-world/src/player_equipment.rs new file mode 100644 index 000000000..7e9c9b95f --- /dev/null +++ b/crates/horizon-world/src/player_equipment.rs @@ -0,0 +1,83 @@ +//! Player hand access through the selected inventory slot and shared equipment. +//! Equipping writes storage before invoking LivingEntity's onEquipItem hook. +use crate::{ + item_stack_refs::StackRef, + player_inventory::{EquipmentSlot, PlayerInventory}, +}; +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum InteractionHand { + Main, + Off, +} +impl InteractionHand { + pub fn slot(self) -> EquipmentSlot { + match self { + Self::Main => EquipmentSlot::MainHand, + Self::Off => EquipmentSlot::OffHand, + } + } +} +pub fn get( + inv: &PlayerInventory, + slot: EquipmentSlot, +) -> StackRef { + if slot == EquipmentSlot::MainHand { + inv.selected_item() + } else { + inv.equipment().get(slot) + } +} +pub fn set( + inv: &mut PlayerInventory, + slot: EquipmentSlot, + stack: StackRef, +) -> StackRef { + if slot == EquipmentSlot::MainHand { + inv.set_selected_item(stack) + } else { + inv.equipment().set(slot, stack) + } +} +pub fn is_empty( + inv: &PlayerInventory, +) -> bool { + inv.selected_item().read().is_empty() + && inv + .equipment() + .entries() + .iter() + .all(|(_, s)| s.read().is_empty()) +} +pub trait EquipWorld { + type Error; + fn on_equip( + &mut self, + inv: &mut PlayerInventory, + slot: EquipmentSlot, + old: StackRef, + new: StackRef, + ) -> Result<(), Self::Error>; +} +pub fn set_item_slot>( + w: &mut W, + inv: &mut PlayerInventory, + slot: EquipmentSlot, + stack: StackRef, +) -> Result<(), W::Error> { + let old = set(inv, slot, stack.clone()); + w.on_equip(inv, slot, old, stack) +} +pub fn get_hand( + inv: &PlayerInventory, + hand: InteractionHand, +) -> StackRef { + get(inv, hand.slot()) +} +pub fn set_hand>( + w: &mut W, + inv: &mut PlayerInventory, + hand: InteractionHand, + stack: StackRef, +) -> Result<(), W::Error> { + set_item_slot(w, inv, hand.slot(), stack) +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 9d8f4e897..55ae4ff4f 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1717,3 +1717,18 @@ prefixes. The client comparison uses an actual allocated ClientLevel for the non-server branch; the dedicated JAR uses null because ClientLevel is absent. Targeted Clippy passes. Registered items' individual tick effects, full entity and world ticking and complete gameplay integration remain pending. + + +`player_equipment` binds the main hand to the selected inventory slot and other +equipment to the shared entity map. Hand/slot writes capture the previous item, +store the new reference and then invoke the equip callback. Clearing the base +equipment map does not clear the selected stack; clearing the inventory does. + +`python3 tools/test_player_equipment_parity.py` compares actual PlayerEquipment +and inherited LivingEntity hand/slot access over a real native Inventory. The +[equipment report](../benchmarks/rust-player-equipment-2026-10-07/scoped-parity.json) +records **408,852 matching lines per JAR**, including selection changes, callback +mutations/failures, old/new aliases, raw enum-map main-hand entries and the +selected main-hand override. Targeted Clippy passes. Full onEquipItem effects, +synchronized flags, active-use integration and complete gameplay integration +remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerEquipmentOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerEquipmentOracle.java new file mode 100644 index 000000000..d26528a66 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerEquipmentOracle.java @@ -0,0 +1,26 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.lang.reflect.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.component.*;import net.minecraft.world.item.*;import net.minecraft.world.entity.*;import net.minecraft.world.entity.player.*;import net.minecraft.world.InteractionHand; +/** Real player equipment and inherited hand access through its selected slot. */ +public final class VanillaPlayerEquipmentOracle { + static final class Stop extends RuntimeException {} + static Object unsafe;static Method allocate;static Field count,eqItems,inventory,entityEquipment;static Item[] items; + static Field field(Class c,String n)throws Exception{var f=c.getDeclaredField(n);f.setAccessible(true);return f;} + static T make(Class c)throws Exception{return c.cast(allocate.invoke(unsafe,c));} + static int n(JsonObject o,String k){return o.get(k).getAsInt();} + static int type(Item item){for(int i=0;i ids=new IdentityHashMap<>(); + int id(ItemStack s){return ids.computeIfAbsent(s,k->ids.size());} + String snapshot(ItemStack s){try{return id(s)+":"+type(s.getItem())+":"+count.getInt(s)+":"+s.getCount()+":"+s.getPopTime()+":"+s.isEmpty();}catch(Exception e){throw new AssertionError(e);}} + void all(){try{for(int i=0;i)eqItems.get(equipment)).entrySet())entries.add(e.getKey().name()+"="+snapshot(e.getValue()));out.println("raw-equipment "+entries);var equipped=new StringJoiner(" | ");for(var s:EquipmentSlot.values())equipped.add(snapshot(actor.getItemBySlot(s)));out.println("equipped "+equipped);out.println("hands "+snapshot(actor.getMainHandItem())+" | "+snapshot(actor.getOffhandItem()));out.println("empty "+snapshot(ItemStack.EMPTY));}catch(Exception e){throw new AssertionError(e);}} + void event(EquipmentSlot slot,ItemStack old,ItemStack next){calls++;out.println("equip "+slot.ordinal()+" "+id(old)+" "+id(next));all();if(op.get("fail").getAsBoolean())throw new Stop();if(op.get("mutate").getAsBoolean()){refs[n(op,"mutate_ref")].setCount(n(op,"after_count"));inv.setSelectedSlot(n(op,"after_selected"));inv.setItem(n(op,"replace_slot"),refs[n(op,"replace_ref")]);}} + } + static final class Actor extends Player {Data d;Actor(){super(null,null);}@Override public net.minecraft.world.level.GameType gameMode(){return net.minecraft.world.level.GameType.SURVIVAL;}@Override public boolean isSpectator(){return false;}@Override public boolean isCreative(){return false;}@Override public void onEquipItem(EquipmentSlot slot,ItemStack old,ItemStack next){d.event(slot,old,next);}} + @SuppressWarnings("unchecked")public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();var u=Class.forName("sun.misc.Unsafe");unsafe=field(u,"theUnsafe").get(null);allocate=u.getMethod("allocateInstance",Class.class);count=field(ItemStack.class,"count");eqItems=field(EntityEquipment.class,"items");inventory=field(Player.class,"inventory");entityEquipment=field(LivingEntity.class,"equipment");items=new Item[]{Items.AIR,Items.STICK,Items.SHIELD};for(var item:items)item.builtInRegistryHolder().bindComponents(DataComponentMap.EMPTY);Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();var d=new Data();d.out=out;d.ids.put(ItemStack.EMPTY,0);ItemStack.EMPTY.setCount(0);ItemStack.EMPTY.setPopTime(0);d.actor=make(Actor.class);d.actor.d=d;d.refs=new ItemStack[4];for(int i=0;i<4;i++){var v=f.getAsJsonArray("stacks").get(i).getAsJsonObject();int item=n(v,"item");d.refs[i]=item<0?ItemStack.EMPTY:new ItemStack(items[item],n(v,"count"));if(item>=0)d.refs[i].setPopTime(n(v,"pop"));}d.equipment=new PlayerEquipment(d.actor);d.inv=new Inventory(d.actor,d.equipment);inventory.set(d.actor,d.inv);entityEquipment.set(d.actor,d.equipment);d.inv.setSelectedSlot(n(f,"selected"));for(var e:f.getAsJsonArray("slots")){var p=e.getAsJsonArray();d.inv.setItem(p.get(0).getAsInt(),d.refs[p.get(1).getAsInt()]);}for(var e:f.getAsJsonArray("equipment")){var p=e.getAsJsonArray();d.equipment.set(EquipmentSlot.values()[p.get(0).getAsInt()],d.refs[p.get(1).getAsInt()]);}for(var e:f.getAsJsonArray("raw_entries")){var p=e.getAsJsonArray();((EnumMap)eqItems.get(d.equipment)).put(EquipmentSlot.values()[p.get(0).getAsInt()],d.refs[p.get(1).getAsInt()]);}d.all();for(var ov:f.getAsJsonArray("ops")){var op=ov.getAsJsonObject();d.op=op;d.calls=0;int a=n(op,"a"),b=n(op,"b"),slot=n(op,"slot");try{switch(op.get("kind").getAsString()){ + case "get-hand":d.refs[b]=d.actor.getItemInHand(InteractionHand.values()[n(op,"hand")]);break;case "set-hand":d.actor.setItemInHand(InteractionHand.values()[n(op,"hand")],d.refs[a]);break;case "get-item":d.refs[b]=d.actor.getItemBySlot(EquipmentSlot.values()[n(op,"equipment")]);break;case "set-item":d.actor.setItemSlot(EquipmentSlot.values()[n(op,"equipment")],d.refs[a]);break;case "set-equipment":d.refs[b]=d.equipment.set(EquipmentSlot.values()[n(op,"equipment")],d.refs[a]);break;case "clear-equipment":d.equipment.clear();break;case "clear":d.inv.clearContent();break;case "select":d.inv.setSelectedSlot(slot);break;case "get":d.refs[b]=d.inv.getItem(slot);break;case "set":d.inv.setItem(slot,d.refs[a]);break;case "count":d.refs[a].setCount(n(op,"amount"));break;case "alias":d.refs[b]=d.refs[a];break;case "copy":d.refs[b]=d.refs[a].copy();break;default:throw new AssertionError();}out.println("result ok "+d.calls);}catch(Stop|IllegalArgumentException|IndexOutOfBoundsException e){out.println("result error "+d.calls);}d.all();}} + } + } +} diff --git a/tools/test_player_equipment_parity.py b/tools/test_player_equipment_parity.py new file mode 100644 index 000000000..f0a06a2f7 --- /dev/null +++ b/tools/test_player_equipment_parity.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python3 +"""Compare native PlayerEquipment transfers, shared stack identity and change callbacks.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + edges=[-2147483648,-1,0,1,2,5,2147483647] + kinds=['get-hand','set-hand','get-item','set-item','set-equipment','clear-equipment','clear','select','get','set','count','alias','copy'] + def op(kind,**kw): + v=dict(kind=kind,a=0,b=3,slot=0,hand=0,equipment=0,amount=1,fail=False,mutate=False,mutate_ref=0,after_count=2,after_selected=8,replace_slot=0,replace_ref=1);v.update(kw);return v + def row(ops,**kw): + v=dict(stacks=[dict(item=1,count=2,pop=5),dict(item=2,count=1,pop=2),dict(item=1,count=1,pop=0),dict(item=-1,count=0,pop=0)],slots=[[0,0],[1,0],[8,1],[35,2]],equipment=[[0,0],[1,1],[7,2]],raw_entries=[],selected=0,ops=ops);v.update(kw);return v + for kind in kinds: + for equipment in range(8): + for count in edges: + for hand in [0,1]: + v=row([op(kind,equipment=equipment,hand=hand,amount=count),op('select',slot=8),op('get-hand',hand=0)]) + v['stacks'][0]['count']=count + yield v + for kind in ['set-item','set-hand']: + for equipment in range(8): + for hand in [0,1]: + for fail in [False,True]: + for mutate in [False,True]: + for selected in [-1,0,8,9]: + yield row([op(kind,equipment=equipment,hand=hand,fail=fail,mutate=mutate,after_selected=selected),op('get-hand',hand=0)]) + for raw in [[],[[0,0]],[[0,3]]]: + yield row([op('clear-equipment'),op('set-equipment',equipment=0),op('clear-equipment'),op('clear')],raw_entries=raw) + rng=random.Random(0x45515549504d454e) + for _ in range(1600): + yield row([op(rng.choice(kinds),a=rng.randrange(4),b=rng.randrange(4),slot=rng.choice([-1,0,8,9,35,36,40,42,43]),hand=rng.randrange(2),equipment=rng.randrange(8),amount=rng.choice(edges),fail=bool(rng.randrange(2)),mutate=bool(rng.randrange(2)),mutate_ref=rng.randrange(4),after_count=rng.choice(edges),after_selected=rng.choice([-1,0,8,9]),replace_slot=rng.choice([-1,0,8,40]),replace_ref=rng.randrange(4)) for __ in range(15)],stacks=[dict(item=rng.randrange(-1,3),count=rng.choice(edges),pop=rng.choice(edges)) for __ in range(4)],slots=[[i,rng.randrange(4)] for i in rng.sample(range(43),rng.randrange(44))],equipment=[[i,rng.randrange(4)] for i in rng.sample(range(8),rng.randrange(9))],raw_entries=[[0,rng.randrange(4)]] if rng.randrange(2) else [],selected=rng.randrange(9)) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-player-equipment-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPlayerEquipmentOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/player_equipment_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaPlayerEquipmentOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','player_equipment_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('player_equipment_fixture.exe' if os.name=='nt' else 'player_equipment_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} player equipment output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual PlayerEquipment get/set/isEmpty and inherited LivingEntity hand/slot access over a real Inventory and shared ItemStack references. Equipment changes write storage before the controlled onEquipItem callback; mutations/failures and main-hand selection changes retain native prefixes. Raw enum-map main-hand entries exercise base storage independently from the selected main-hand override. Full onEquipItem effects, synchronized flags, active-use integration and complete gameplay integration remain pending.'} + lab.write_json(report_path,report);print(f'Scoped player equipment parity passed: {report_path}') + + +if __name__=='__main__':main() From 93ab6348433d3fe47a04ed83388b42bd02ce6268 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 08:08:32 +0200 Subject: [PATCH 141/253] Retain shared item references through use lifecycle callbacks --- .../item-use-lifecycle.json | 276 ++++++++++++++++++ .../item-use-start.json | 276 ++++++++++++++++++ .../item-use.json | 276 ++++++++++++++++++ .../examples/item_use_lifecycle_fixture.rs | 132 +++++---- crates/horizon-world/src/item_stack_refs.rs | 8 + crates/horizon-world/src/item_use.rs | 4 +- .../horizon-world/src/item_use_lifecycle.rs | 22 +- crates/horizon-world/src/item_use_start.rs | 10 +- docs/collision-geometry.md | 16 + tools/test_item_use_lifecycle_parity.py | 2 +- 10 files changed, 952 insertions(+), 70 deletions(-) create mode 100644 benchmarks/rust-shared-item-use-2026-10-07/item-use-lifecycle.json create mode 100644 benchmarks/rust-shared-item-use-2026-10-07/item-use-start.json create mode 100644 benchmarks/rust-shared-item-use-2026-10-07/item-use.json diff --git a/benchmarks/rust-shared-item-use-2026-10-07/item-use-lifecycle.json b/benchmarks/rust-shared-item-use-2026-10-07/item-use-lifecycle.json new file mode 100644 index 000000000..1f578582e --- /dev/null +++ b/benchmarks/rust-shared-item-use-2026-10-07/item-use-lifecycle.json @@ -0,0 +1,276 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 19900, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemUseLifecycleOracle.java": "7a024212a18eff1891996fe5979c2d35aea36a4cef80c70638bb5ead4fbcaf57", + "tools/test_item_use_lifecycle_parity.py": "5bae87adf6b7591670a3f1b387f6bc85e70c11c1eadab0ede569266619b6afc4", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "6884c7209f007ab9ee742b9c3c73828cfa1c6753d35b5fe25a87cab5955b33f8", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "18bbad377a8047e4d4ecd0fc87d83d46d1c0f1ce2b8c47bbe64633e7b4420b57", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/blocking_item_damage.rs": "afea3cb5761e8b82ee4d9bb4ef3c6fd10182a324dbaec99e6c9ebfac255dda09", + "crates/horizon-world/src/blocking_rules.rs": "83c5e2105cec56a90182ce582e1c67ade2b189be6de1a34d08035000cc07c492", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/component_durability.rs": "37a46e184f95bc5027e2b9af72ff52f729ad03601d08e1827f181fca383a35af", + "crates/horizon-world/src/component_patch.rs": "3622244ccdee46e13956c64ffe9be6234e686adf58dbc3a24cece0f1814301a1", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_immunity.rs": "fd39c41124d694e755cf7faadcf93c636df4042c78ec345092a856b5f952dbcf", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/damage_source.rs": "24945e397a926d34695652980923609e4723e02fe6b6e56d4aaf673e45d759f7", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/inventory_pickup.rs": "ea830c7916e7f2d95c6db7ef48be1e876e6ebafcb438e47fc72f9a5bd7c37d07", + "crates/horizon-world/src/inventory_tick.rs": "293a3d57a1689337cfd58e5a73dcdbed4cb360f94d98ff5458f0df92de387365", + "crates/horizon-world/src/item_blocking.rs": "f6eee0d6d177cc3148960122327ba1b459a2f0e85241c1d9a3e40f0b8c169296", + "crates/horizon-world/src/item_durability.rs": "9fdf835e5c7bd0e1dd63ef2ba0076b770cdd4d6d14cdcd11de27690f0702f94e", + "crates/horizon-world/src/item_stack_refs.rs": "18d3ca85cac0daf59200857513761359e5690f719cb3f7f64ae552f0c4169ea3", + "crates/horizon-world/src/item_stack_storage.rs": "b4dcb83dcaa346848c5484161feb3e2cf08e83f7793d7ed83be25b14b9d12884", + "crates/horizon-world/src/item_use.rs": "b1c79428986efbf9dd5ede703a39eb387fb6dcc7d9950f0e49243a353a5b8070", + "crates/horizon-world/src/item_use_catalog.rs": "a9b53d2e816583239a75c3c61e78dacc5e3b27dee595be34b1c7fa169f17a571", + "crates/horizon-world/src/item_use_lifecycle.rs": "4639b70440cf811e79de09c48a3e035143fcb6be8a64c2f61b10ae55a2f133b7", + "crates/horizon-world/src/item_use_start.rs": "a84092dfb8b8f0a89d0928bb2f8ac252bd9bfd3f8d74fce1a7f7a5b3c3f4f50b", + "crates/horizon-world/src/lib.rs": "71dc72ba5c6c461456201f6f6cb28942223ecac7f899940d46d30fc15ec9b18a", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "2b448209629b9bf2e678d667ad0d6c7fa22146892dd106b169d96b31b0df12bb", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_hurt.rs": "844239ad7d15c39629bb3cfc06ebae6d1cff20b7627468f26e0ee8dff3abdcb8", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_equipment.rs": "1fa8c53e67624c4641246249d79a800a28a4858c62482bd880b4e3b866b936ef", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_hurt.rs": "99c9bbd8587ec2dc287806049897b8034d2f5349ad47fc497b70d54148844a36", + "crates/horizon-world/src/player_inventory.rs": "f4f67d8312793f25930626c4ac06db688fcf2e2292d6675071d105fb1708d952", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/server_player_combat.rs": "a9743971581af86d926eeba42004d932caf83382c470dd98bf613cb9c417db58", + "crates/horizon-world/src/server_player_damage.rs": "828a4649fec3e9bda2dfe20aced8c95922c697321de2be4127bd4e5712ecbb7c", + "crates/horizon-world/src/simple_container.rs": "0fedbc7e974b1db79b88bd6aff977654189a5d553cf42852fe8bf0885cf90b30", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "f417aab280331ddd6f0ca265a12c0130c78b9924f407c7e07f198140501e6010", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/view_direction.rs": "e18120ae26dc5cf702b29fc4c8487088bab133c8ce5abce01226833fafb0d5a4", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "74e4110fb19c4c4047192fd65c38015b8afc7f9fc50404d75380b5063808148c", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/item_use_lifecycle_fixture.rs": "e87046bfb6b2d15be0e781a9c81d9f49c7279f202d8ce888156146024adc241c" + }, + "fixtures_sha256": { + ".local/rust-item-use-lifecycle-parity/inputs.txt": "32379ce9a26546173d4a88d55665609aad15f6e6a38c6b6e3cc00d2e7a6c76a4" + }, + "rust_output_sha256": "79addc5b3f5d14a54965ff68a71ed18989490e00a103368c75a1825236166f95", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "79addc5b3f5d14a54965ff68a71ed18989490e00a103368c75a1825236166f95", + "matched_output_lines": 144736 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "79addc5b3f5d14a54965ff68a71ed18989490e00a103368c75a1825236166f95", + "matched_output_lines": 144736 + } + ], + "scope": "Actual LivingEntity private using-item tick, updateUsingItem, completeUsingItem, releaseUsingItem and stopUsingItem. Real ItemStack/UseEffects components call controlled custom item handlers; virtual level/hand queries and using flag updates are observed. Rust lifecycle now uses production reference-counted StackRef values with native identity equality. Covers captured stack/level references, same-type versus stack-identity checks, callback mutations/failures, empty stacks, wrapping countdowns, returned item placement, finish vibration and kinetic-enemy-map presence. Starting use, actual synchronized flags, consumables/kinetic item effects, use remainders/cooldowns, full inventory/equipment and game tick integration remain pending." +} diff --git a/benchmarks/rust-shared-item-use-2026-10-07/item-use-start.json b/benchmarks/rust-shared-item-use-2026-10-07/item-use-start.json new file mode 100644 index 000000000..682e04217 --- /dev/null +++ b/benchmarks/rust-shared-item-use-2026-10-07/item-use-start.json @@ -0,0 +1,276 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 14886, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemUseStartOracle.java": "630ce7f2bea3915d3de64263c6a78c8f93caee71d72c519b788956eab46ce00a", + "tools/test_item_use_start_parity.py": "fdbd4054287457d60b862a307555d59d6ec43f0be86bf6b8a65eb9e88b3905a0", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "6884c7209f007ab9ee742b9c3c73828cfa1c6753d35b5fe25a87cab5955b33f8", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "18bbad377a8047e4d4ecd0fc87d83d46d1c0f1ce2b8c47bbe64633e7b4420b57", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/blocking_item_damage.rs": "afea3cb5761e8b82ee4d9bb4ef3c6fd10182a324dbaec99e6c9ebfac255dda09", + "crates/horizon-world/src/blocking_rules.rs": "83c5e2105cec56a90182ce582e1c67ade2b189be6de1a34d08035000cc07c492", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/component_durability.rs": "37a46e184f95bc5027e2b9af72ff52f729ad03601d08e1827f181fca383a35af", + "crates/horizon-world/src/component_patch.rs": "3622244ccdee46e13956c64ffe9be6234e686adf58dbc3a24cece0f1814301a1", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_immunity.rs": "fd39c41124d694e755cf7faadcf93c636df4042c78ec345092a856b5f952dbcf", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/damage_source.rs": "24945e397a926d34695652980923609e4723e02fe6b6e56d4aaf673e45d759f7", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/inventory_pickup.rs": "ea830c7916e7f2d95c6db7ef48be1e876e6ebafcb438e47fc72f9a5bd7c37d07", + "crates/horizon-world/src/inventory_tick.rs": "293a3d57a1689337cfd58e5a73dcdbed4cb360f94d98ff5458f0df92de387365", + "crates/horizon-world/src/item_blocking.rs": "f6eee0d6d177cc3148960122327ba1b459a2f0e85241c1d9a3e40f0b8c169296", + "crates/horizon-world/src/item_durability.rs": "9fdf835e5c7bd0e1dd63ef2ba0076b770cdd4d6d14cdcd11de27690f0702f94e", + "crates/horizon-world/src/item_stack_refs.rs": "18d3ca85cac0daf59200857513761359e5690f719cb3f7f64ae552f0c4169ea3", + "crates/horizon-world/src/item_stack_storage.rs": "b4dcb83dcaa346848c5484161feb3e2cf08e83f7793d7ed83be25b14b9d12884", + "crates/horizon-world/src/item_use.rs": "b1c79428986efbf9dd5ede703a39eb387fb6dcc7d9950f0e49243a353a5b8070", + "crates/horizon-world/src/item_use_catalog.rs": "a9b53d2e816583239a75c3c61e78dacc5e3b27dee595be34b1c7fa169f17a571", + "crates/horizon-world/src/item_use_lifecycle.rs": "4639b70440cf811e79de09c48a3e035143fcb6be8a64c2f61b10ae55a2f133b7", + "crates/horizon-world/src/item_use_start.rs": "a84092dfb8b8f0a89d0928bb2f8ac252bd9bfd3f8d74fce1a7f7a5b3c3f4f50b", + "crates/horizon-world/src/lib.rs": "71dc72ba5c6c461456201f6f6cb28942223ecac7f899940d46d30fc15ec9b18a", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "2b448209629b9bf2e678d667ad0d6c7fa22146892dd106b169d96b31b0df12bb", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_hurt.rs": "844239ad7d15c39629bb3cfc06ebae6d1cff20b7627468f26e0ee8dff3abdcb8", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_equipment.rs": "1fa8c53e67624c4641246249d79a800a28a4858c62482bd880b4e3b866b936ef", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_hurt.rs": "99c9bbd8587ec2dc287806049897b8034d2f5349ad47fc497b70d54148844a36", + "crates/horizon-world/src/player_inventory.rs": "f4f67d8312793f25930626c4ac06db688fcf2e2292d6675071d105fb1708d952", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/server_player_combat.rs": "a9743971581af86d926eeba42004d932caf83382c470dd98bf613cb9c417db58", + "crates/horizon-world/src/server_player_damage.rs": "828a4649fec3e9bda2dfe20aced8c95922c697321de2be4127bd4e5712ecbb7c", + "crates/horizon-world/src/simple_container.rs": "0fedbc7e974b1db79b88bd6aff977654189a5d553cf42852fe8bf0885cf90b30", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "f417aab280331ddd6f0ca265a12c0130c78b9924f407c7e07f198140501e6010", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/view_direction.rs": "e18120ae26dc5cf702b29fc4c8487088bab133c8ce5abce01226833fafb0d5a4", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "74e4110fb19c4c4047192fd65c38015b8afc7f9fc50404d75380b5063808148c", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/item_use_start_fixture.rs": "80d62405d6cb626f86e23f9c6d6bc38441578674a8885e6e329ab85eb9993776" + }, + "fixtures_sha256": { + ".local/rust-item-use-start-parity/inputs.txt": "494e8b41f2336559f73fa4e6dad133614d9e240d8f44a51c416a348098c62701" + }, + "rust_output_sha256": "8268f65a5a4ac92739d7e8f6d3d8e287a48684e69ad4abbec18fa978d9606bff", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "8268f65a5a4ac92739d7e8f6d3d8e287a48684e69ad4abbec18fa978d9606bff", + "matched_output_lines": 84873 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "8268f65a5a4ac92739d7e8f6d3d8e287a48684e69ad4abbec18fa978d9606bff", + "matched_output_lines": 84873 + } + ], + "scope": "Actual inherited LivingEntity startUsingItem, native private equipment synchronization and ClientboundSetEquipmentPacket construction, item duration dispatch, using/offhand flag ordering, native UseEffects vibration and KineticWeapon presence. Covers captured held-stack/level/hand arguments, callback mutations/failures, empty stacks, client/server queries and recent-kinetic-map reset. Flag writes and delivery services are controlled; synchronized-data storage, wire encoding, kinetic combat, full inventory/equipment and game tick integration remain pending." +} diff --git a/benchmarks/rust-shared-item-use-2026-10-07/item-use.json b/benchmarks/rust-shared-item-use-2026-10-07/item-use.json new file mode 100644 index 000000000..1ee4f76a7 --- /dev/null +++ b/benchmarks/rust-shared-item-use-2026-10-07/item-use.json @@ -0,0 +1,276 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 22296, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemUseOracle.java": "b6d102e72dc166cdd2ae35dc13c4bf08c36265dcb42369ec9e15da16f8b6284f", + "tools/test_item_use_parity.py": "2e3c5ff8250e8d1d9d8a564d6d65b049b0d80fc9630bd12d907cccb55b00ab0a", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "6884c7209f007ab9ee742b9c3c73828cfa1c6753d35b5fe25a87cab5955b33f8", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "18bbad377a8047e4d4ecd0fc87d83d46d1c0f1ce2b8c47bbe64633e7b4420b57", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/blocking_item_damage.rs": "afea3cb5761e8b82ee4d9bb4ef3c6fd10182a324dbaec99e6c9ebfac255dda09", + "crates/horizon-world/src/blocking_rules.rs": "83c5e2105cec56a90182ce582e1c67ade2b189be6de1a34d08035000cc07c492", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/component_durability.rs": "37a46e184f95bc5027e2b9af72ff52f729ad03601d08e1827f181fca383a35af", + "crates/horizon-world/src/component_patch.rs": "3622244ccdee46e13956c64ffe9be6234e686adf58dbc3a24cece0f1814301a1", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_immunity.rs": "fd39c41124d694e755cf7faadcf93c636df4042c78ec345092a856b5f952dbcf", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/damage_source.rs": "24945e397a926d34695652980923609e4723e02fe6b6e56d4aaf673e45d759f7", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/inventory_pickup.rs": "ea830c7916e7f2d95c6db7ef48be1e876e6ebafcb438e47fc72f9a5bd7c37d07", + "crates/horizon-world/src/inventory_tick.rs": "293a3d57a1689337cfd58e5a73dcdbed4cb360f94d98ff5458f0df92de387365", + "crates/horizon-world/src/item_blocking.rs": "f6eee0d6d177cc3148960122327ba1b459a2f0e85241c1d9a3e40f0b8c169296", + "crates/horizon-world/src/item_durability.rs": "9fdf835e5c7bd0e1dd63ef2ba0076b770cdd4d6d14cdcd11de27690f0702f94e", + "crates/horizon-world/src/item_stack_refs.rs": "18d3ca85cac0daf59200857513761359e5690f719cb3f7f64ae552f0c4169ea3", + "crates/horizon-world/src/item_stack_storage.rs": "b4dcb83dcaa346848c5484161feb3e2cf08e83f7793d7ed83be25b14b9d12884", + "crates/horizon-world/src/item_use.rs": "b1c79428986efbf9dd5ede703a39eb387fb6dcc7d9950f0e49243a353a5b8070", + "crates/horizon-world/src/item_use_catalog.rs": "a9b53d2e816583239a75c3c61e78dacc5e3b27dee595be34b1c7fa169f17a571", + "crates/horizon-world/src/item_use_lifecycle.rs": "4639b70440cf811e79de09c48a3e035143fcb6be8a64c2f61b10ae55a2f133b7", + "crates/horizon-world/src/item_use_start.rs": "a84092dfb8b8f0a89d0928bb2f8ac252bd9bfd3f8d74fce1a7f7a5b3c3f4f50b", + "crates/horizon-world/src/lib.rs": "71dc72ba5c6c461456201f6f6cb28942223ecac7f899940d46d30fc15ec9b18a", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "2b448209629b9bf2e678d667ad0d6c7fa22146892dd106b169d96b31b0df12bb", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_hurt.rs": "844239ad7d15c39629bb3cfc06ebae6d1cff20b7627468f26e0ee8dff3abdcb8", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_equipment.rs": "1fa8c53e67624c4641246249d79a800a28a4858c62482bd880b4e3b866b936ef", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_hurt.rs": "99c9bbd8587ec2dc287806049897b8034d2f5349ad47fc497b70d54148844a36", + "crates/horizon-world/src/player_inventory.rs": "f4f67d8312793f25930626c4ac06db688fcf2e2292d6675071d105fb1708d952", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/server_player_combat.rs": "a9743971581af86d926eeba42004d932caf83382c470dd98bf613cb9c417db58", + "crates/horizon-world/src/server_player_damage.rs": "828a4649fec3e9bda2dfe20aced8c95922c697321de2be4127bd4e5712ecbb7c", + "crates/horizon-world/src/simple_container.rs": "0fedbc7e974b1db79b88bd6aff977654189a5d553cf42852fe8bf0885cf90b30", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "f417aab280331ddd6f0ca265a12c0130c78b9924f407c7e07f198140501e6010", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/view_direction.rs": "e18120ae26dc5cf702b29fc4c8487088bab133c8ce5abce01226833fafb0d5a4", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "74e4110fb19c4c4047192fd65c38015b8afc7f9fc50404d75380b5063808148c", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/item_use_fixture.rs": "ae94d70ce98734d9b4025137962de43cdfef89963bad3800f0d9a54385366421" + }, + "fixtures_sha256": { + ".local/rust-item-use-parity/inputs.txt": "37dc2ae8be576a3f3d933b752baf4edfefb1c61a77af521e7e5580fc36fd7ffd" + }, + "rust_output_sha256": "47c017ea6a6010c6a136fbdc5f7f1521490c8e418e4e9b5f95c77d08ed716425", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "47c017ea6a6010c6a136fbdc5f7f1521490c8e418e4e9b5f95c77d08ed716425", + "matched_output_lines": 108690 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "47c017ea6a6010c6a136fbdc5f7f1521490c8e418e4e9b5f95c77d08ed716425", + "matched_output_lines": 108690 + } + ], + "scope": "Actual LivingEntity blocking-item eligibility, isBlocking and both use-timer overloads. Controlled item types supply virtual duration queries; actual use-item/remaining fields and BlocksAttacks components provide captured and reread state. Covers wrapping tick arithmetic, delay boundaries, absent components, empty stacks, shared item types, partial-tick float bits, callback mutations and failures. Item-use lifecycle, durability, codecs and complete combat/world integration remain pending." +} diff --git a/crates/horizon-world/examples/item_use_lifecycle_fixture.rs b/crates/horizon-world/examples/item_use_lifecycle_fixture.rs index 65dae5214..404f6ba17 100644 --- a/crates/horizon-world/examples/item_use_lifecycle_fixture.rs +++ b/crates/horizon-world/examples/item_use_lifecycle_fixture.rs @@ -1,4 +1,9 @@ -use horizon_world::item_use_lifecycle::{self, UseLifecycleWorld, UseState}; +use horizon_world::{ + component_patch::Prototype, + item_stack_refs::{ItemStacks, StackRef}, + item_use_lifecycle::{self, UseLifecycleWorld, UseState}, +}; +type Stack = StackRef; use serde_json::Value; use std::{ fs, @@ -12,19 +17,20 @@ struct World<'a> { changed: bool, using: bool, hands: [usize; 2], + items: [Stack; 3], } impl World<'_> { fn state(&self) -> &Value { &self.f[if self.changed { "after" } else { "initial" }] } - fn reset(&mut self, s: &mut UseState) { - s.item = self.state()["item"].as_u64().unwrap() as usize; + fn reset(&mut self, s: &mut UseState) { + s.item = self.items[self.state()["item"].as_u64().unwrap() as usize].clone(); s.remaining = self.state()["remaining"].as_i64().unwrap() as i32; s.has_recent_kinetic_enemies = self.state()["kinetic"].as_bool().unwrap(); self.using = self.state()["using"].as_bool().unwrap(); self.hands = std::array::from_fn(|i| self.state()["hands"][i].as_u64().unwrap() as usize); } - fn event(&mut self, s: &mut UseState, name: &str) -> io::Result<()> { + fn event(&mut self, s: &mut UseState, name: &str) -> io::Result<()> { writeln!(self.out, "{name}")?; let n = self.calls; self.calls += 1; @@ -37,116 +43,124 @@ impl World<'_> { } Ok(()) } - fn kind(&self, item: usize) -> usize { - if item == 1 && self.f["shared_type"].as_bool().unwrap() { - 0 - } else { - item - } + fn id(&self, item: &Stack) -> usize { + self.items + .iter() + .position(|s| s.same_reference(item)) + .unwrap() + } + fn kind(&self, item: &Stack) -> usize { + item.read().item() } } impl UseLifecycleWorld for World<'_> { type Error = io::Error; - type Item = usize; + type Item = Stack; type Hand = usize; type Level = usize; - fn empty_item(&self) -> usize { - 2 + fn empty_item(&self) -> Stack { + self.items[2].clone() } - fn is_empty(&self, item: usize) -> bool { - item == 2 + fn is_empty(&self, item: Stack) -> bool { + item.read().is_empty() } - fn same_item_type(&self, a: usize, b: usize) -> bool { - self.kind(a) == self.kind(b) + fn same_item_type(&self, a: Stack, b: Stack) -> bool { + a.read().same_item(&b.read()) } - fn using_item(&mut self, s: &mut UseState) -> io::Result { + fn using_item(&mut self, s: &mut UseState) -> io::Result { self.event(s, "using")?; Ok(self.using) } - fn used_hand(&mut self, s: &mut UseState) -> io::Result { + fn used_hand(&mut self, s: &mut UseState) -> io::Result { self.event(s, "hand")?; Ok(self.state()["hand"].as_u64().unwrap() as usize) } - fn hand_item(&mut self, s: &mut UseState, hand: usize) -> io::Result { + fn hand_item(&mut self, s: &mut UseState, hand: usize) -> io::Result { self.event(s, &format!("get-hand {hand}"))?; - Ok(self.hands[hand]) + Ok(self.items[self.hands[hand]].clone()) } fn set_hand_item( &mut self, - s: &mut UseState, + s: &mut UseState, hand: usize, - item: usize, + item: Stack, ) -> io::Result<()> { - self.event(s, &format!("set-hand {hand} {item}"))?; - self.hands[hand] = item; + self.event(s, &format!("set-hand {hand} {}", self.id(&item)))?; + self.hands[hand] = self.id(&item); Ok(()) } - fn level(&mut self, s: &mut UseState) -> io::Result { + fn level(&mut self, s: &mut UseState) -> io::Result { self.event(s, "level")?; Ok(self.state()["level"].as_u64().unwrap() as usize) } - fn is_client(&mut self, s: &mut UseState, level: usize) -> io::Result { + fn is_client(&mut self, s: &mut UseState, level: usize) -> io::Result { self.event(s, &format!("client {level}"))?; Ok(self.state()["clients"][level].as_bool().unwrap()) } - fn remaining_ticks(&mut self, s: &mut UseState) -> io::Result { + fn remaining_ticks(&mut self, s: &mut UseState) -> io::Result { self.event(s, "remaining")?; Ok(self.state()["virtual_remaining"].as_i64().unwrap() as i32) } fn item_tick( &mut self, - s: &mut UseState, - item: usize, + s: &mut UseState, + item: Stack, level: usize, remaining: i32, ) -> io::Result<()> { - let kind = self.kind(item); + let kind = self.kind(&item); if kind == 2 { return Ok(()); } - self.event(s, &format!("tick {kind} {item} {level} {remaining}")) + self.event( + s, + &format!("tick {kind} {} {level} {remaining}", self.id(&item)), + ) } - fn use_on_release(&mut self, s: &mut UseState, item: usize) -> io::Result { - let kind = self.kind(item); + fn use_on_release(&mut self, s: &mut UseState, item: Stack) -> io::Result { + let kind = self.kind(&item); if kind == 2 { return Ok(false); } - self.event(s, &format!("release-query {kind} {item}"))?; + self.event(s, &format!("release-query {kind} {}", self.id(&item)))?; Ok(self.state()["releases"][kind].as_bool().unwrap()) } fn release_item( &mut self, - s: &mut UseState, - item: usize, + s: &mut UseState, + item: Stack, level: usize, remaining: i32, ) -> io::Result<()> { - let kind = self.kind(item); + let kind = self.kind(&item); if kind == 2 { return Ok(()); } - self.event(s, &format!("release {kind} {item} {level} {remaining}")) + self.event( + s, + &format!("release {kind} {} {level} {remaining}", self.id(&item)), + ) } fn finish_item( &mut self, - s: &mut UseState, - item: usize, + s: &mut UseState, + item: Stack, level: usize, - ) -> io::Result { - let kind = self.kind(item); + ) -> io::Result { + let kind = self.kind(&item); if kind == 2 { return Ok(item); } - self.event(s, &format!("finish {kind} {item} {level}"))?; - Ok(self.state()["finishes"][kind].as_u64().unwrap() as usize) + self.event(s, &format!("finish {kind} {} {level}", self.id(&item)))?; + Ok(self.items[self.state()["finishes"][kind].as_u64().unwrap() as usize].clone()) } - fn set_using_flag(&mut self, s: &mut UseState, using: bool) -> io::Result<()> { + fn set_using_flag(&mut self, s: &mut UseState, using: bool) -> io::Result<()> { self.event(s, &format!("flag {using}"))?; self.using = using; Ok(()) } - fn finish_vibration(&mut self, s: &mut UseState, item: usize) -> io::Result<()> { - if item < 2 && self.f["vibrations"][item].as_bool().unwrap() { + fn finish_vibration(&mut self, s: &mut UseState, item: Stack) -> io::Result<()> { + if self.id(&item) < 2 && self.f["vibrations"][self.id(&item)].as_bool().unwrap() { self.event(s, "vibration")?; } Ok(()) @@ -158,8 +172,22 @@ fn main() -> Result<(), Box> { let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { let f: Value = serde_json::from_str(line)?; + let stacks = ItemStacks::new(2); + let items = [ + stacks.create(0, 1, Prototype::new([])), + stacks.create( + if f["shared_type"].as_bool().unwrap() { + 0 + } else { + 1 + }, + 1, + Prototype::new([]), + ), + stacks.empty(), + ]; let mut s = UseState { - item: 2, + item: items[2].clone(), remaining: 0, has_recent_kinetic_enemies: false, }; @@ -170,12 +198,14 @@ fn main() -> Result<(), Box> { changed: false, using: false, hands: [2, 2], + items, }; w.reset(&mut s); let result = match f["mode"].as_str().unwrap() { "tick" => item_use_lifecycle::tick(&mut w, &mut s), "update" => { - item_use_lifecycle::update(&mut w, &mut s, f["argument"].as_u64().unwrap() as usize) + let item = w.items[f["argument"].as_u64().unwrap() as usize].clone(); + item_use_lifecycle::update(&mut w, &mut s, item) } "complete" => item_use_lifecycle::complete(&mut w, &mut s), "release" => item_use_lifecycle::release(&mut w, &mut s), @@ -190,7 +220,7 @@ fn main() -> Result<(), Box> { writeln!( w.out, "state {} {} {} {} {} {} {} {}", - s.item, + w.id(&s.item), s.remaining, s.has_recent_kinetic_enemies, w.using, diff --git a/crates/horizon-world/src/item_stack_refs.rs b/crates/horizon-world/src/item_stack_refs.rs index e74af1aaf..a516c93d6 100644 --- a/crates/horizon-world/src/item_stack_refs.rs +++ b/crates/horizon-world/src/item_stack_refs.rs @@ -17,6 +17,14 @@ impl Clone for StackRef { Self(self.0.clone()) } } +// Native ItemStack object equality is reference identity. Value comparisons +// remain explicit on ItemStackData (same_item_components/matches). +impl PartialEq for StackRef { + fn eq(&self, other: &Self) -> bool { + self.same_reference(other) + } +} +impl Eq for StackRef {} impl StackRef { pub fn new(data: ItemStackData) -> Self { Self(Rc::new(RefCell::new(data))) diff --git a/crates/horizon-world/src/item_use.rs b/crates/horizon-world/src/item_use.rs index ccd9e3a44..2ffef560f 100644 --- a/crates/horizon-world/src/item_use.rs +++ b/crates/horizon-world/src/item_use.rs @@ -2,7 +2,7 @@ //! use-item storage and remaining ticks around the virtual item-duration query. pub trait ItemUseWorld { type Error; - type Item: Copy; + type Item: Clone; type ItemType: Copy; fn using_item(&mut self) -> Result; fn use_item(&self) -> Self::Item; @@ -50,7 +50,7 @@ pub fn ticks_using_item(w: &mut W) -> Result { return Ok(0); } let item = w.use_item(); - let item_type = w.item_type(item); + let item_type = w.item_type(item.clone()); let duration = w.use_duration(item_type, item)?; Ok(duration.wrapping_sub(w.remaining_ticks_virtual()?)) } diff --git a/crates/horizon-world/src/item_use_lifecycle.rs b/crates/horizon-world/src/item_use_lifecycle.rs index fa9f78540..f0f15096f 100644 --- a/crates/horizon-world/src/item_use_lifecycle.rs +++ b/crates/horizon-world/src/item_use_lifecycle.rs @@ -7,7 +7,7 @@ pub struct UseState { } pub trait UseLifecycleWorld: Sized { type Error; - type Item: Copy + Eq; + type Item: Clone + Eq; type Hand: Copy; type Level: Copy; fn empty_item(&self) -> Self::Item; @@ -89,10 +89,10 @@ pub fn tick(w: &mut W, s: &mut UseState) -> Resul if w.using_item(s)? { let hand = w.used_hand(s)?; let held = w.hand_item(s, hand)?; - if w.same_item_type(held, s.item) { + if w.same_item_type(held.clone(), s.item.clone()) { let hand = w.used_hand(s)?; s.item = w.hand_item(s, hand)?; - w.update_using_item(s, s.item)?; + w.update_using_item(s, s.item.clone())?; } else { w.stop_using_item(s)?; } @@ -106,7 +106,7 @@ pub fn update( ) -> Result<(), W::Error> { let level = w.level(s)?; let remaining = w.remaining_ticks(s)?; - w.item_tick(s, item, level, remaining)?; + w.item_tick(s, item.clone(), level, remaining)?; s.remaining = s.remaining.wrapping_sub(1); if s.remaining == 0 { let level = w.level(s)?; @@ -125,13 +125,13 @@ pub fn complete( return Ok(()); } let hand = w.used_hand(s)?; - let original = s.item; + let original = s.item.clone(); if original != w.hand_item(s, hand)? { w.release_using_item(s)?; return Ok(()); } - if !w.is_empty(s.item) && w.using_item(s)? { - let item = s.item; + if !w.is_empty(s.item.clone()) && w.using_item(s)? { + let item = s.item.clone(); let level = w.level(s)?; let result = w.finish_item(s, item, level)?; if result != s.item { @@ -144,13 +144,13 @@ pub fn complete( pub fn release(w: &mut W, s: &mut UseState) -> Result<(), W::Error> { let hand = w.used_hand(s)?; let held = w.hand_item(s, hand)?; - if !w.is_empty(s.item) && w.same_item_type(held, s.item) { + if !w.is_empty(s.item.clone()) && w.same_item_type(held.clone(), s.item.clone()) { s.item = held; - let item = s.item; + let item = s.item.clone(); let level = w.level(s)?; let remaining = w.remaining_ticks(s)?; w.release_item(s, item, level, remaining)?; - if w.use_on_release(s, s.item)? { + if w.use_on_release(s, s.item.clone())? { tick(w, s)?; } } @@ -163,7 +163,7 @@ pub fn stop(w: &mut W, s: &mut UseState) -> Resul s.has_recent_kinetic_enemies = false; w.set_using_flag(s, false)?; if using { - w.finish_vibration(s, s.item)?; + w.finish_vibration(s, s.item.clone())?; } } s.item = w.empty_item(); diff --git a/crates/horizon-world/src/item_use_start.rs b/crates/horizon-world/src/item_use_start.rs index 594046a30..376b1d257 100644 --- a/crates/horizon-world/src/item_use_start.rs +++ b/crates/horizon-world/src/item_use_start.rs @@ -33,20 +33,20 @@ pub fn start( hand: W::Hand, ) -> Result<(), W::Error> { let item = w.hand_item(s, hand)?; - if w.is_empty(item) || w.using_item(s)? { + if w.is_empty(item.clone()) || w.using_item(s)? { return Ok(()); } - s.item = item; + s.item = item.clone(); s.remaining = w.duration(s, item)?; let level = w.level(s)?; if !w.is_client(s, level)? { let level = w.level(s)?; - w.synchronize_equipment(s, level, hand, s.item)?; + w.synchronize_equipment(s, level, hand, s.item.clone())?; w.set_using_flag(s, true)?; let off = w.is_off_hand(hand); w.set_off_hand_flag(s, off)?; - w.start_vibration(s, s.item)?; - if w.has_kinetic_weapon(s.item) { + w.start_vibration(s, s.item.clone())?; + if w.has_kinetic_weapon(s.item.clone()) { w.reset_recent_kinetic_enemies(s); } } diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 55ae4ff4f..d666c3329 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1732,3 +1732,19 @@ mutations/failures, old/new aliases, raw enum-map main-hand entries and the selected main-hand override. Targeted Clippy passes. Full onEquipItem effects, synchronized flags, active-use integration and complete gameplay integration remain pending. + + +The item-use interfaces now accept cloned shared references as well as small +copyable handles. `StackRef` equality compares object identity; component/count +value comparisons remain explicit. Captured references stay alive through +callbacks that replace the active or held stack. The lifecycle fixture now uses +the production reference-counted stack implementation. + +The native regressions retain **144,736 lifecycle**, **84,873 start-use** and +**108,690 eligibility/timing** matching lines per JAR. Reports: +[lifecycle](../benchmarks/rust-shared-item-use-2026-10-07/item-use-lifecycle.json), +[start](../benchmarks/rust-shared-item-use-2026-10-07/item-use-start.json), +[eligibility](../benchmarks/rust-shared-item-use-2026-10-07/item-use.json). +Targeted Clippy and all 20 horizon-world library tests pass. Hand queries and +flags remain controlled in these fixtures; composing them with actual player +inventory, synchronized flags and full item effects remains pending. diff --git a/tools/test_item_use_lifecycle_parity.py b/tools/test_item_use_lifecycle_parity.py index 6ee8b59f4..adbfe20fd 100644 --- a/tools/test_item_use_lifecycle_parity.py +++ b/tools/test_item_use_lifecycle_parity.py @@ -66,7 +66,7 @@ def main(): references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) print(f'{side}: {matched:,} item use lifecycle output lines match Rust',flush=True) base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) - report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual LivingEntity private using-item tick, updateUsingItem, completeUsingItem, releaseUsingItem and stopUsingItem. Real ItemStack/UseEffects components call controlled custom item handlers; virtual level/hand queries and using flag updates are observed. Covers captured stack/level references, same-type versus stack-identity checks, callback mutations/failures, empty stacks, wrapping countdowns, returned item placement, finish vibration and kinetic-enemy-map presence. Starting use, actual synchronized flags, consumables/kinetic item effects, use remainders/cooldowns, full inventory/equipment and game tick integration remain pending.'} + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual LivingEntity private using-item tick, updateUsingItem, completeUsingItem, releaseUsingItem and stopUsingItem. Real ItemStack/UseEffects components call controlled custom item handlers; virtual level/hand queries and using flag updates are observed. Rust lifecycle now uses production reference-counted StackRef values with native identity equality. Covers captured stack/level references, same-type versus stack-identity checks, callback mutations/failures, empty stacks, wrapping countdowns, returned item placement, finish vibration and kinetic-enemy-map presence. Starting use, actual synchronized flags, consumables/kinetic item effects, use remainders/cooldowns, full inventory/equipment and game tick integration remain pending.'} lab.write_json(report_path,report);print(f'Scoped item use lifecycle parity passed: {report_path}') From fb57fc5ee74c54914e568e1e76d1553033fe1854 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 08:15:15 +0200 Subject: [PATCH 142/253] Back living item-use flags with synchronized byte storage --- .../float-regression.json | 278 ++++++++++++++++++ .../scoped-parity.json | 278 ++++++++++++++++++ .../examples/synced_bytes_fixture.rs | 188 ++++++++++++ crates/horizon-world/src/lib.rs | 3 + crates/horizon-world/src/living_use_flags.rs | 26 ++ crates/horizon-world/src/synced_floats.rs | 157 +--------- crates/horizon-world/src/synced_values.rs | 162 ++++++++++ docs/collision-geometry.md | 17 ++ .../parity/VanillaSyncedBytesOracle.java | 40 +++ tools/test_synced_bytes_parity.py | 73 +++++ 10 files changed, 1071 insertions(+), 151 deletions(-) create mode 100644 benchmarks/rust-synced-bytes-2026-10-07/float-regression.json create mode 100644 benchmarks/rust-synced-bytes-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/synced_bytes_fixture.rs create mode 100644 crates/horizon-world/src/living_use_flags.rs create mode 100644 crates/horizon-world/src/synced_values.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSyncedBytesOracle.java create mode 100644 tools/test_synced_bytes_parity.py diff --git a/benchmarks/rust-synced-bytes-2026-10-07/float-regression.json b/benchmarks/rust-synced-bytes-2026-10-07/float-regression.json new file mode 100644 index 000000000..0245009a7 --- /dev/null +++ b/benchmarks/rust-synced-bytes-2026-10-07/float-regression.json @@ -0,0 +1,278 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 3019, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSyncedFloatsOracle.java": "567a871ed82ad0c0d1fef6f84cc2a68732ddae9110a9926c659af77933c6f61d", + "tools/test_synced_floats_parity.py": "64a2a3ef6c4ab63fcfd18fb3cd0442e2bbe2249481cbf7899aeadb3b6b61256f", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "6884c7209f007ab9ee742b9c3c73828cfa1c6753d35b5fe25a87cab5955b33f8", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "18bbad377a8047e4d4ecd0fc87d83d46d1c0f1ce2b8c47bbe64633e7b4420b57", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/blocking_item_damage.rs": "afea3cb5761e8b82ee4d9bb4ef3c6fd10182a324dbaec99e6c9ebfac255dda09", + "crates/horizon-world/src/blocking_rules.rs": "83c5e2105cec56a90182ce582e1c67ade2b189be6de1a34d08035000cc07c492", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/component_durability.rs": "37a46e184f95bc5027e2b9af72ff52f729ad03601d08e1827f181fca383a35af", + "crates/horizon-world/src/component_patch.rs": "3622244ccdee46e13956c64ffe9be6234e686adf58dbc3a24cece0f1814301a1", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_immunity.rs": "fd39c41124d694e755cf7faadcf93c636df4042c78ec345092a856b5f952dbcf", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/damage_source.rs": "24945e397a926d34695652980923609e4723e02fe6b6e56d4aaf673e45d759f7", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/inventory_pickup.rs": "ea830c7916e7f2d95c6db7ef48be1e876e6ebafcb438e47fc72f9a5bd7c37d07", + "crates/horizon-world/src/inventory_tick.rs": "293a3d57a1689337cfd58e5a73dcdbed4cb360f94d98ff5458f0df92de387365", + "crates/horizon-world/src/item_blocking.rs": "f6eee0d6d177cc3148960122327ba1b459a2f0e85241c1d9a3e40f0b8c169296", + "crates/horizon-world/src/item_durability.rs": "9fdf835e5c7bd0e1dd63ef2ba0076b770cdd4d6d14cdcd11de27690f0702f94e", + "crates/horizon-world/src/item_stack_refs.rs": "18d3ca85cac0daf59200857513761359e5690f719cb3f7f64ae552f0c4169ea3", + "crates/horizon-world/src/item_stack_storage.rs": "b4dcb83dcaa346848c5484161feb3e2cf08e83f7793d7ed83be25b14b9d12884", + "crates/horizon-world/src/item_use.rs": "b1c79428986efbf9dd5ede703a39eb387fb6dcc7d9950f0e49243a353a5b8070", + "crates/horizon-world/src/item_use_catalog.rs": "a9b53d2e816583239a75c3c61e78dacc5e3b27dee595be34b1c7fa169f17a571", + "crates/horizon-world/src/item_use_lifecycle.rs": "4639b70440cf811e79de09c48a3e035143fcb6be8a64c2f61b10ae55a2f133b7", + "crates/horizon-world/src/item_use_start.rs": "a84092dfb8b8f0a89d0928bb2f8ac252bd9bfd3f8d74fce1a7f7a5b3c3f4f50b", + "crates/horizon-world/src/lib.rs": "b4e17db9fc9e788e979a8bba1e3a10d77178f010b55814e4e087c8febfdea746", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "2b448209629b9bf2e678d667ad0d6c7fa22146892dd106b169d96b31b0df12bb", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_hurt.rs": "844239ad7d15c39629bb3cfc06ebae6d1cff20b7627468f26e0ee8dff3abdcb8", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/living_use_flags.rs": "826f4fdeba7e208368cbbf910fa408db0afbc6442d842d178a70fae53e0d0ea6", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_equipment.rs": "1fa8c53e67624c4641246249d79a800a28a4858c62482bd880b4e3b866b936ef", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_hurt.rs": "99c9bbd8587ec2dc287806049897b8034d2f5349ad47fc497b70d54148844a36", + "crates/horizon-world/src/player_inventory.rs": "f4f67d8312793f25930626c4ac06db688fcf2e2292d6675071d105fb1708d952", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/server_player_combat.rs": "a9743971581af86d926eeba42004d932caf83382c470dd98bf613cb9c417db58", + "crates/horizon-world/src/server_player_damage.rs": "828a4649fec3e9bda2dfe20aced8c95922c697321de2be4127bd4e5712ecbb7c", + "crates/horizon-world/src/simple_container.rs": "0fedbc7e974b1db79b88bd6aff977654189a5d553cf42852fe8bf0885cf90b30", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "0152f2752bafaf68769d56dbc88494a976496a680c6b113d6b48a446158ba072", + "crates/horizon-world/src/synced_values.rs": "adffa15026497d6671ffd12e5e17df9329c93f0e022700cdfebb80ab494382ae", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/view_direction.rs": "e18120ae26dc5cf702b29fc4c8487088bab133c8ce5abce01226833fafb0d5a4", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "74e4110fb19c4c4047192fd65c38015b8afc7f9fc50404d75380b5063808148c", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/synced_floats_fixture.rs": "71858a47a15cb62eb8b53dfb507d6e2e96d23dda04b84bdd660b49301eeb9757" + }, + "fixtures_sha256": { + ".local/rust-synced-floats-parity/inputs.txt": "22904cc4d2748db510a0a5935c1024fb2d8d5bc9ce994b414cf6d265d6ca60c9" + }, + "rust_output_sha256": "80bb47d39c2d89981b03a0dd25715fcf9ab6d3f41671e9074f3a143b0bc78c2b", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "80bb47d39c2d89981b03a0dd25715fcf9ab6d3f41671e9074f3a143b0bc78c2b", + "matched_output_lines": 554909 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "80bb47d39c2d89981b03a0dd25715fcf9ab6d3f41671e9074f3a143b0bc78c2b", + "matched_output_lines": 554909 + } + ], + "scope": "Actual SynchedEntityData Float fields: boxed equality, forced updates, callback-before-dirty flags, ordered dirty/default extraction, received assignment including duplicates, partial unknown-ID/observer failures, batch callbacks and reentrant set/assign/pack. Native table gaps are untouched default dummy Float items; tested keys are explicit configured IDs. Other serializers, type-mismatch errors, wire codecs and player absorption integration remain pending." +} diff --git a/benchmarks/rust-synced-bytes-2026-10-07/scoped-parity.json b/benchmarks/rust-synced-bytes-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..0a251b57b --- /dev/null +++ b/benchmarks/rust-synced-bytes-2026-10-07/scoped-parity.json @@ -0,0 +1,278 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 7842, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSyncedBytesOracle.java": "db5fd583900168ee962dec3d1712d1bd4c2e300b10fda0e880427805345e039b", + "tools/test_synced_bytes_parity.py": "506e437e8a3d2fe1993acb68d52765cf599d793e41be177692e5669f92e3ae52", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "6884c7209f007ab9ee742b9c3c73828cfa1c6753d35b5fe25a87cab5955b33f8", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "18bbad377a8047e4d4ecd0fc87d83d46d1c0f1ce2b8c47bbe64633e7b4420b57", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/blocking_item_damage.rs": "afea3cb5761e8b82ee4d9bb4ef3c6fd10182a324dbaec99e6c9ebfac255dda09", + "crates/horizon-world/src/blocking_rules.rs": "83c5e2105cec56a90182ce582e1c67ade2b189be6de1a34d08035000cc07c492", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/component_durability.rs": "37a46e184f95bc5027e2b9af72ff52f729ad03601d08e1827f181fca383a35af", + "crates/horizon-world/src/component_patch.rs": "3622244ccdee46e13956c64ffe9be6234e686adf58dbc3a24cece0f1814301a1", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_immunity.rs": "fd39c41124d694e755cf7faadcf93c636df4042c78ec345092a856b5f952dbcf", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/damage_source.rs": "24945e397a926d34695652980923609e4723e02fe6b6e56d4aaf673e45d759f7", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/inventory_pickup.rs": "ea830c7916e7f2d95c6db7ef48be1e876e6ebafcb438e47fc72f9a5bd7c37d07", + "crates/horizon-world/src/inventory_tick.rs": "293a3d57a1689337cfd58e5a73dcdbed4cb360f94d98ff5458f0df92de387365", + "crates/horizon-world/src/item_blocking.rs": "f6eee0d6d177cc3148960122327ba1b459a2f0e85241c1d9a3e40f0b8c169296", + "crates/horizon-world/src/item_durability.rs": "9fdf835e5c7bd0e1dd63ef2ba0076b770cdd4d6d14cdcd11de27690f0702f94e", + "crates/horizon-world/src/item_stack_refs.rs": "18d3ca85cac0daf59200857513761359e5690f719cb3f7f64ae552f0c4169ea3", + "crates/horizon-world/src/item_stack_storage.rs": "b4dcb83dcaa346848c5484161feb3e2cf08e83f7793d7ed83be25b14b9d12884", + "crates/horizon-world/src/item_use.rs": "b1c79428986efbf9dd5ede703a39eb387fb6dcc7d9950f0e49243a353a5b8070", + "crates/horizon-world/src/item_use_catalog.rs": "a9b53d2e816583239a75c3c61e78dacc5e3b27dee595be34b1c7fa169f17a571", + "crates/horizon-world/src/item_use_lifecycle.rs": "4639b70440cf811e79de09c48a3e035143fcb6be8a64c2f61b10ae55a2f133b7", + "crates/horizon-world/src/item_use_start.rs": "a84092dfb8b8f0a89d0928bb2f8ac252bd9bfd3f8d74fce1a7f7a5b3c3f4f50b", + "crates/horizon-world/src/lib.rs": "b4e17db9fc9e788e979a8bba1e3a10d77178f010b55814e4e087c8febfdea746", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "2b448209629b9bf2e678d667ad0d6c7fa22146892dd106b169d96b31b0df12bb", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_hurt.rs": "844239ad7d15c39629bb3cfc06ebae6d1cff20b7627468f26e0ee8dff3abdcb8", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/living_use_flags.rs": "826f4fdeba7e208368cbbf910fa408db0afbc6442d842d178a70fae53e0d0ea6", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_equipment.rs": "1fa8c53e67624c4641246249d79a800a28a4858c62482bd880b4e3b866b936ef", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_hurt.rs": "99c9bbd8587ec2dc287806049897b8034d2f5349ad47fc497b70d54148844a36", + "crates/horizon-world/src/player_inventory.rs": "f4f67d8312793f25930626c4ac06db688fcf2e2292d6675071d105fb1708d952", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/server_player_combat.rs": "a9743971581af86d926eeba42004d932caf83382c470dd98bf613cb9c417db58", + "crates/horizon-world/src/server_player_damage.rs": "828a4649fec3e9bda2dfe20aced8c95922c697321de2be4127bd4e5712ecbb7c", + "crates/horizon-world/src/simple_container.rs": "0fedbc7e974b1db79b88bd6aff977654189a5d553cf42852fe8bf0885cf90b30", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "0152f2752bafaf68769d56dbc88494a976496a680c6b113d6b48a446158ba072", + "crates/horizon-world/src/synced_values.rs": "adffa15026497d6671ffd12e5e17df9329c93f0e022700cdfebb80ab494382ae", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/view_direction.rs": "e18120ae26dc5cf702b29fc4c8487088bab133c8ce5abce01226833fafb0d5a4", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "74e4110fb19c4c4047192fd65c38015b8afc7f9fc50404d75380b5063808148c", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/synced_bytes_fixture.rs": "3f422e3a1dcb6815cf90a765ad3d42a2126352523a8b5d369249e8809c688b2d" + }, + "fixtures_sha256": { + ".local/rust-synced-bytes-parity/inputs.txt": "114892687b60fa881c44ef391250db430852e4f221bc28406983c204dbf00364" + }, + "rust_output_sha256": "0faa1e20a530ac978ebb54b68731242ce7212aee21bb4c5c3782e79a11dcbdf4", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "0faa1e20a530ac978ebb54b68731242ce7212aee21bb4c5c3782e79a11dcbdf4", + "matched_output_lines": 572100 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "0faa1e20a530ac978ebb54b68731242ce7212aee21bb4c5c3782e79a11dcbdf4", + "matched_output_lines": 572100 + } + ], + "scope": "Actual byte SynchedEntityData values and inherited LivingEntity using-item/offhand queries plus protected flag writes. Covers every initial byte, signed masks, ordered dirty/default output, assignment, reentrant flag/data writes, callback packing and failures before dirty marking. Rust shares a typed scalar implementation with existing synchronized floats. Heterogeneous serializer maps, entity schema/network codecs and full item-use/gameplay integration remain pending." +} diff --git a/crates/horizon-world/examples/synced_bytes_fixture.rs b/crates/horizon-world/examples/synced_bytes_fixture.rs new file mode 100644 index 000000000..288e5fa7c --- /dev/null +++ b/crates/horizon-world/examples/synced_bytes_fixture.rs @@ -0,0 +1,188 @@ +use horizon_world::{ + living_use_flags, + player_equipment::InteractionHand, + synced_values::{DataError, DataValue, Observer, SyncedValues}, +}; +type ByteValue = DataValue; +type SyncedBytes = SyncedValues; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +fn single(v: &Value) -> u8 { + u8::from_str_radix(v.as_str().unwrap(), 16).unwrap() +} +fn bits(v: u8) -> u8 { + v +} +fn parse(v: &Value) -> Vec { + v.as_array() + .unwrap() + .iter() + .map(|v| ByteValue { + id: v["id"].as_u64().unwrap() as u8, + value: single(&v["value"]), + }) + .collect() +} +fn values(v: Option<&[ByteValue]>) -> String { + match v { + None => "none".into(), + Some([]) => "empty".into(), + Some(v) => v + .iter() + .map(|v| format!("{}:{:02x}", v.id, bits(v.value))) + .collect::>() + .join(","), + } +} +struct Callback<'a> { + out: &'a mut dyn Write, + op: &'a Value, + calls: i64, + nested: bool, +} +impl Callback<'_> { + fn event(&mut self, s: &str) -> io::Result<()> { + writeln!(self.out, "{s}")?; + let n = self.calls; + self.calls += 1; + if n == self.op["fail"].as_i64().unwrap() { + Err(io::Error::other("injected synchronized callback failure")) + } else { + Ok(()) + } + } +} +impl Observer for Callback<'_> { + type Error = io::Error; + fn updated(&mut self, data: &mut SyncedBytes, id: u8) -> io::Result<()> { + self.event(&format!( + "updated {id} {:02x} {} {}", + bits(data.get(id).unwrap()), + data.is_dirty(), + data.item_dirty(id).unwrap() + ))?; + if self.nested { + return Ok(()); + } + self.nested = true; + let other = self.op["other"].as_u64().unwrap() as u8; + let value = single(&self.op["other_value"]); + let result = match self.op["hook"].as_str().unwrap() { + "none" => Ok(()), + "pack" => writeln!( + self.out, + "callback-pack {}", + values(data.take_dirty().as_deref()) + ), + "flag" => living_use_flags::set_flag( + data, + self.op["mask"].as_i64().unwrap() as i32, + self.op["flag"].as_bool().unwrap(), + self, + ) + .map_err(|e| match e { + DataError::Observer(e) => e, + DataError::UnknownId(_) => panic!("flags registered"), + }), + "set" => data + .set( + other, + value, + self.op["other_force"].as_bool().unwrap(), + self, + ) + .map_err(|e| match e { + DataError::Observer(e) => e, + DataError::UnknownId(_) => panic!("hook uses registered ID"), + }), + "assign" => data + .assign(&[ByteValue { id: other, value }], self) + .map_err(|e| match e { + DataError::Observer(e) => e, + DataError::UnknownId(_) => panic!("hook uses registered ID"), + }), + _ => panic!("hook"), + }; + self.nested = false; + result + } + fn assigned(&mut self, _: &mut SyncedBytes, v: &[ByteValue]) -> io::Result<()> { + self.event(&format!("assigned {}", values(Some(v)))) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let initial = parse(&f["initial"]); + let mut ids = initial.iter().map(|v| v.id).collect::>(); + ids.sort_unstable(); + let mut data = SyncedBytes::new(&initial)?; + for op in f["ops"].as_array().unwrap() { + let mut cb = Callback { + out: &mut out, + op, + calls: 0, + nested: false, + }; + let id = op["id"].as_u64().unwrap() as u8; + let result = match op["mode"].as_str().unwrap() { + "flag" => living_use_flags::set_flag( + &mut data, + op["mask"].as_i64().unwrap() as i32, + op["flag"].as_bool().unwrap(), + &mut cb, + ), + "set" => data.set( + id, + single(&op["value"]), + op["force"].as_bool().unwrap(), + &mut cb, + ), + "assign" => data.assign(&parse(&op["values"]), &mut cb), + "get" => data.get(id).map_err(DataError::UnknownId).and_then(|v| { + writeln!(cb.out, "get {:02x}", bits(v)).map_err(DataError::Observer) + }), + "pack" => writeln!(cb.out, "packed {}", values(data.take_dirty().as_deref())) + .map_err(DataError::Observer), + "defaults" => { + writeln!(cb.out, "defaults {}", values(data.non_default().as_deref())) + .map_err(DataError::Observer) + } + _ => panic!("mode"), + }; + match result { + Ok(()) => writeln!(cb.out, "result ok")?, + Err(DataError::Observer(_)) => writeln!(cb.out, "error observer")?, + Err(DataError::UnknownId(_)) => writeln!(cb.out, "error id")?, + } + writeln!(cb.out, "dirty {}", data.is_dirty())?; + for id in &ids { + writeln!( + cb.out, + "state {id} {:02x} {} {}", + bits(data.get(*id).unwrap()), + data.item_dirty(*id).unwrap(), + data.is_default(*id).unwrap() + )?; + } + writeln!(cb.out, "calls {}", cb.calls)?; + writeln!( + cb.out, + "flags {} {}", + living_use_flags::using_item(&data).unwrap(), + match living_use_flags::used_hand(&data).unwrap() { + InteractionHand::Main => 0, + InteractionHand::Off => 1, + } + )?; + } + } + Ok(()) +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 5da6a4d26..09ea12154 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -104,3 +104,6 @@ pub mod inventory_pickup; pub mod inventory_tick; pub mod player_equipment; + +pub mod living_use_flags; +pub mod synced_values; diff --git a/crates/horizon-world/src/living_use_flags.rs b/crates/horizon-world/src/living_use_flags.rs new file mode 100644 index 000000000..ae1ecb31e --- /dev/null +++ b/crates/horizon-world/src/living_use_flags.rs @@ -0,0 +1,26 @@ +//! Pinned living-entity use flags backed by synchronized byte storage. +use crate::{ + player_equipment::InteractionHand, + synced_values::{DataError, Observer, SyncedValues}, +}; +pub const FLAGS_ID: u8 = 8; +pub fn using_item(data: &SyncedValues) -> Result { + Ok(data.get(FLAGS_ID)? & 1 != 0) +} +pub fn used_hand(data: &SyncedValues) -> Result { + Ok(if data.get(FLAGS_ID)? & 2 != 0 { + InteractionHand::Off + } else { + InteractionHand::Main + }) +} +pub fn set_flag>( + data: &mut SyncedValues, + mask: i32, + value: bool, + observer: &mut O, +) -> Result<(), DataError> { + let old = i32::from(data.get(FLAGS_ID).map_err(DataError::UnknownId)? as i8); + let next = if value { old | mask } else { old & !mask }; + data.set(FLAGS_ID, next as u8, false, observer) +} diff --git a/crates/horizon-world/src/synced_floats.rs b/crates/horizon-world/src/synced_floats.rs index 0f7f3bc9b..54aa541c9 100644 --- a/crates/horizon-world/src/synced_floats.rs +++ b/crates/horizon-world/src/synced_floats.rs @@ -1,151 +1,6 @@ -//! Multiple synchronized float fields with native callback and dirty ordering. -//! Other serializer types and wire codecs are not represented by this module. -use crate::compression::invalid; -use std::{fmt, io}; -#[derive(Clone, Copy, Debug)] -pub struct FloatValue { - pub id: u8, - pub value: f32, -} -#[derive(Clone, Copy, Debug)] -struct Entry { - id: u8, - initial: f32, - value: f32, - dirty: bool, -} -#[derive(Clone, Debug)] -pub struct SyncedFloats { - entries: Vec, - dirty: bool, -} -#[derive(Debug)] -pub enum DataError { - UnknownId(u8), - Observer(E), -} -impl fmt::Display for DataError { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - Self::UnknownId(id) => write!(f, "unknown synchronized float ID {id}"), - Self::Observer(e) => e.fmt(f), - } - } -} -impl std::error::Error for DataError {} -pub trait Observer { - type Error; - fn updated(&mut self, data: &mut SyncedFloats, id: u8) -> Result<(), Self::Error>; - fn assigned( - &mut self, - _data: &mut SyncedFloats, - _values: &[FloatValue], - ) -> Result<(), Self::Error> { - Ok(()) - } -} -fn equal(a: f32, b: f32) -> bool { - a.to_bits() == b.to_bits() || (a.is_nan() && b.is_nan()) -} -impl SyncedFloats { - pub fn new(values: &[FloatValue]) -> io::Result { - let mut entries = values - .iter() - .map(|v| Entry { - id: v.id, - initial: v.value, - value: v.value, - dirty: false, - }) - .collect::>(); - entries.sort_unstable_by_key(|e| e.id); - if entries.iter().any(|e| e.id == 255) || entries.windows(2).any(|e| e[0].id == e[1].id) { - return Err(invalid("duplicate or reserved synchronized float ID")); - } - Ok(Self { - entries, - dirty: false, - }) - } - fn index(&self, id: u8) -> Result { - self.entries - .binary_search_by_key(&id, |e| e.id) - .map_err(|_| id) - } - pub fn get(&self, id: u8) -> Result { - Ok(self.entries[self.index(id)?].value) - } - pub fn is_dirty(&self) -> bool { - self.dirty - } - pub fn item_dirty(&self, id: u8) -> Result { - Ok(self.entries[self.index(id)?].dirty) - } - pub fn is_default(&self, id: u8) -> Result { - let e = &self.entries[self.index(id)?]; - Ok(equal(e.initial, e.value)) - } - pub fn set( - &mut self, - id: u8, - value: f32, - force: bool, - observer: &mut O, - ) -> Result<(), DataError> { - let index = self.index(id).map_err(DataError::UnknownId)?; - if force || !equal(value, self.entries[index].value) { - self.entries[index].value = value; - observer.updated(self, id).map_err(DataError::Observer)?; - self.entries[index].dirty = true; - self.dirty = true; - } - Ok(()) - } - /// Received values always notify, even when equal, and do not set/clear dirty - /// flags. A failure preserves earlier entries and skips later/batch callbacks. - pub fn assign( - &mut self, - values: &[FloatValue], - observer: &mut O, - ) -> Result<(), DataError> { - for v in values { - let index = self.index(v.id).map_err(DataError::UnknownId)?; - self.entries[index].value = v.value; - observer.updated(self, v.id).map_err(DataError::Observer)?; - } - observer.assigned(self, values).map_err(DataError::Observer) - } - pub fn take_dirty(&mut self) -> Option> { - if !self.dirty { - return None; - } - self.dirty = false; - let mut values = Vec::new(); - for e in &mut self.entries { - if e.dirty { - e.dirty = false; - values.push(FloatValue { - id: e.id, - value: e.value, - }); - } - } - Some(values) - } - pub fn non_default(&self) -> Option> { - let values: Vec<_> = self - .entries - .iter() - .filter(|e| !equal(e.initial, e.value)) - .map(|e| FloatValue { - id: e.id, - value: e.value, - }) - .collect(); - if values.is_empty() { - None - } else { - Some(values) - } - } -} +//! Synchronized float storage using boxed Java Float equality. +//! The scalar implementation also supports bytes; full entity schemas and +//! heterogeneous serializer storage remain separate. +pub use crate::synced_values::{DataError, Observer}; +pub type FloatValue = crate::synced_values::DataValue; +pub type SyncedFloats = crate::synced_values::SyncedValues; diff --git a/crates/horizon-world/src/synced_values.rs b/crates/horizon-world/src/synced_values.rs new file mode 100644 index 000000000..7ed44166b --- /dev/null +++ b/crates/horizon-world/src/synced_values.rs @@ -0,0 +1,162 @@ +//! Homogeneous synchronized scalar fields with native callback/dirty ordering. +//! Mixed serializers, packet codecs and complete entity schemas are separate. +use crate::compression::invalid; +use std::{fmt, io}; +#[derive(Clone, Copy, Debug)] +pub struct DataValue { + pub id: u8, + pub value: T, +} +#[derive(Clone, Copy, Debug)] +struct Entry { + id: u8, + initial: T, + value: T, + dirty: bool, +} +#[derive(Clone, Debug)] +pub struct SyncedValues { + entries: Vec>, + dirty: bool, +} +#[derive(Debug)] +pub enum DataError { + UnknownId(u8), + Observer(E), +} +impl fmt::Display for DataError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::UnknownId(id) => write!(f, "unknown synchronized field ID {id}"), + Self::Observer(e) => e.fmt(f), + } + } +} +impl std::error::Error for DataError {} +pub trait Observer { + type Error; + fn updated(&mut self, data: &mut SyncedValues, id: u8) -> Result<(), Self::Error>; + fn assigned( + &mut self, + _data: &mut SyncedValues, + _values: &[DataValue], + ) -> Result<(), Self::Error> { + Ok(()) + } +} +/// Equality used by the corresponding boxed native serializer value. +pub trait SyncedValue: Copy { + fn native_equal(self, other: Self) -> bool; +} +impl SyncedValue for f32 { + fn native_equal(self, other: Self) -> bool { + self.to_bits() == other.to_bits() || (self.is_nan() && other.is_nan()) + } +} +impl SyncedValue for u8 { + fn native_equal(self, other: Self) -> bool { + self == other + } +} +impl SyncedValues { + pub fn new(values: &[DataValue]) -> io::Result { + let mut entries = values + .iter() + .map(|v| Entry { + id: v.id, + initial: v.value, + value: v.value, + dirty: false, + }) + .collect::>(); + entries.sort_unstable_by_key(|e| e.id); + if entries.iter().any(|e| e.id == 255) || entries.windows(2).any(|e| e[0].id == e[1].id) { + return Err(invalid("duplicate or reserved synchronized field ID")); + } + Ok(Self { + entries, + dirty: false, + }) + } + fn index(&self, id: u8) -> Result { + self.entries + .binary_search_by_key(&id, |e| e.id) + .map_err(|_| id) + } + pub fn get(&self, id: u8) -> Result { + Ok(self.entries[self.index(id)?].value) + } + pub fn is_dirty(&self) -> bool { + self.dirty + } + pub fn item_dirty(&self, id: u8) -> Result { + Ok(self.entries[self.index(id)?].dirty) + } + pub fn is_default(&self, id: u8) -> Result { + let e = &self.entries[self.index(id)?]; + Ok(e.initial.native_equal(e.value)) + } + pub fn set>( + &mut self, + id: u8, + value: T, + force: bool, + observer: &mut O, + ) -> Result<(), DataError> { + let index = self.index(id).map_err(DataError::UnknownId)?; + if force || !value.native_equal(self.entries[index].value) { + self.entries[index].value = value; + observer.updated(self, id).map_err(DataError::Observer)?; + self.entries[index].dirty = true; + self.dirty = true; + } + Ok(()) + } + /// Received values always notify, even when equal, and do not set/clear dirty + /// flags. A failure preserves earlier entries and skips later/batch callbacks. + pub fn assign>( + &mut self, + values: &[DataValue], + observer: &mut O, + ) -> Result<(), DataError> { + for v in values { + let index = self.index(v.id).map_err(DataError::UnknownId)?; + self.entries[index].value = v.value; + observer.updated(self, v.id).map_err(DataError::Observer)?; + } + observer.assigned(self, values).map_err(DataError::Observer) + } + pub fn take_dirty(&mut self) -> Option>> { + if !self.dirty { + return None; + } + self.dirty = false; + let mut values = Vec::new(); + for e in &mut self.entries { + if e.dirty { + e.dirty = false; + values.push(DataValue { + id: e.id, + value: e.value, + }); + } + } + Some(values) + } + pub fn non_default(&self) -> Option>> { + let values: Vec<_> = self + .entries + .iter() + .filter(|e| !e.initial.native_equal(e.value)) + .map(|e| DataValue { + id: e.id, + value: e.value, + }) + .collect(); + if values.is_empty() { + None + } else { + Some(values) + } + } +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index d666c3329..8b8b70e5b 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1748,3 +1748,20 @@ The native regressions retain **144,736 lifecycle**, **84,873 start-use** and Targeted Clippy and all 20 horizon-world library tests pass. Hand queries and flags remain controlled in these fixtures; composing them with actual player inventory, synchronized flags and full item effects remains pending. + + +`synced_values` shares the synchronized scalar algorithm between bytes and +floats, retaining Java boxed-float equality. `living_use_flags` binds the pinned +byte field to using-item/offhand queries and signed-mask flag writes. Flag writes +use the same write-before-callback, callback-before-dirty ordering as other +synchronized values. + +`python3 tools/test_synced_bytes_parity.py` compares actual byte SynchedEntityData +and inherited LivingEntity flag methods. The +[byte/flag report](../benchmarks/rust-synced-bytes-2026-10-07/scoped-parity.json) +records **572,100 matching lines per JAR**, covering all initial bytes, signed +masks, forced updates, assignments, reentrant callbacks, dirty packing and +failures. The [float regression](../benchmarks/rust-synced-bytes-2026-10-07/float-regression.json) +retains **554,909 matching lines per JAR**. Targeted Clippy passes. Mixed-serializer +storage, entity schemas, wire codecs and full item-use/gameplay integration remain +pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSyncedBytesOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSyncedBytesOracle.java new file mode 100644 index 000000000..b3b54e26b --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSyncedBytesOracle.java @@ -0,0 +1,40 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.nio.file.*;import java.util.*; +import net.minecraft.network.syncher.*; +/** Native multi-byte dirty/default lists, assignment and reentrant callbacks. */ +public final class VanillaSyncedBytesOracle { + static final class Stop extends RuntimeException {} + static byte single(JsonElement v){return (byte)Integer.parseUnsignedInt(v.getAsString(),16);} + static String bits(byte v){return String.format("%02x",Byte.toUnsignedInt(v));} + static String values(List> list){if(list==null)return "none";var s=new StringJoiner(",");for(var v:list)s.add(v.id()+":"+bits((Byte)v.value()));return s.length()==0?"empty":s.toString();} + static EntityDataAccessor key(int id){return new EntityDataAccessor(id,EntityDataSerializers.BYTE);} + static List> values(JsonArray values){var result=new ArrayList>();for(var x:values){var v=x.getAsJsonObject();result.add(new SynchedEntityData.DataValue(v.get("id").getAsInt(),EntityDataSerializers.BYTE,single(v.get("value"))));}return result;} + static final class Holder extends net.minecraft.world.entity.decoration.ArmorStand { + Holder(){super(null,null);} + void flag(int mask,boolean value){super.setLivingEntityFlag(mask,value);} + + SynchedEntityData data;SynchedEntityData.DataItem[] items;JsonObject op;PrintWriter out;int calls;boolean nested; + void event(String s){out.println(s);if(calls++==op.get("fail").getAsInt())throw new Stop();} + @Override public void onSyncedDataUpdated(EntityDataAccessor key){int id=key.id();event("updated "+id+" "+bits((Byte)items[id].getValue())+" "+data.isDirty()+" "+items[id].isDirty());if(nested)return;nested=true;try{switch(op.get("hook").getAsString()){ + case "flag":flag(op.get("mask").getAsInt(),op.get("flag").getAsBoolean());break;case "none":break;case "pack":out.println("callback-pack "+values(data.packDirty()));break; + case "set":data.set(key(op.get("other").getAsInt()),single(op.get("other_value")),op.get("other_force").getAsBoolean());break; + case "assign":data.assignValues(List.of(new SynchedEntityData.DataValue(op.get("other").getAsInt(),EntityDataSerializers.BYTE,single(op.get("other_value")))));break; + default:throw new AssertionError();}}finally{nested=false;}} + @Override public void onSyncedDataUpdated(List> values){event("assigned "+values(values));} + } + public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();var ctor=SynchedEntityData.class.getDeclaredConstructor(SyncedDataHolder.class,SynchedEntityData.DataItem[].class);ctor.setAccessible(true);var u=Class.forName("sun.misc.Unsafe");var uf=u.getDeclaredField("theUnsafe");uf.setAccessible(true);var unsafe=uf.get(null);var allocate=u.getMethod("allocateInstance",Class.class);var storage=net.minecraft.world.entity.Entity.class.getDeclaredField("entityData");storage.setAccessible(true);Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var f=JsonParser.parseString(line).getAsJsonObject();var holder=(Holder)allocate.invoke(unsafe,Holder.class);holder.out=out;var initial=f.getAsJsonArray("initial");var ids=new ArrayList();int max=-1;for(var v:initial){int id=v.getAsJsonObject().get("id").getAsInt();ids.add(id);max=Math.max(max,id);}Collections.sort(ids);holder.items=new SynchedEntityData.DataItem[max+1];for(int i=0;i<=max;i++)holder.items[i]=new SynchedEntityData.DataItem(key(i),(byte)0);for(var v:initial){var e=v.getAsJsonObject();int id=e.get("id").getAsInt();holder.items[id]=new SynchedEntityData.DataItem(key(id),single(e.get("value")));}holder.data=ctor.newInstance(holder,holder.items);storage.set(holder,holder.data); + for(var v:f.getAsJsonArray("ops")){var op=v.getAsJsonObject();holder.op=op;holder.calls=0;try{switch(op.get("mode").getAsString()){ + case "flag":holder.flag(op.get("mask").getAsInt(),op.get("flag").getAsBoolean());break; + case "set":holder.data.set(key(op.get("id").getAsInt()),single(op.get("value")),op.get("force").getAsBoolean());break; + case "get":out.println("get "+bits(holder.data.get(key(op.get("id").getAsInt()))));break; + case "assign":holder.data.assignValues(values(op.getAsJsonArray("values")));break; + case "pack":out.println("packed "+values(holder.data.packDirty()));break; + case "defaults":out.println("defaults "+values(holder.data.getNonDefaultValues()));break; + default:throw new AssertionError();}out.println("result ok");}catch(Stop e){out.println("error observer");}catch(IndexOutOfBoundsException e){out.println("error id");} + out.println("dirty "+holder.data.isDirty());for(int id:ids){var e=holder.items[id];out.println("state "+id+" "+bits((Byte)e.getValue())+" "+e.isDirty()+" "+e.isSetToDefault());}out.println("calls "+holder.calls);out.println("flags "+holder.isUsingItem()+" "+holder.getUsedItemHand().ordinal()); + } + }} + } +} diff --git a/tools/test_synced_bytes_parity.py b/tools/test_synced_bytes_parity.py new file mode 100644 index 000000000..496e694f4 --- /dev/null +++ b/tools/test_synced_bytes_parity.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python3 +"""Compare multiple synchronized byte fields, assignment and reentrant callbacks with vanilla.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + def bits(v):return f'{v&255:02x}' + def value(id=8,v=0):return dict(id=id,value=bits(v)) + def op(mode='set',id=8,v=0,**kw): + o=dict(mode=mode,id=id,value=bits(v),force=False,values=[],hook='none',other=17,other_value=bits(7),other_force=False,fail=-1,mask=1,flag=True);o.update(kw);return o + def row(initial,ops):return dict(initial=initial,ops=ops) + for start in range(256): + for mask in [-2147483648,-1,0,1,2,3,4,128,255,256,2147483647]: + for flag in [False,True]: + yield row([value(17),value(8,start)],[op('flag',mask=mask,flag=flag),op('defaults'),op('pack'),op('flag',mask=mask,flag=flag)]) + for mode in ['set','assign','flag']: + for hook in ['none','pack','set','assign','flag']: + for fail in range(-1,6): + for other in [8,17]: + yield row([value(8),value(17)],[op(v=3),op(mode,v=5,values=[value(8,5),value(17,7),value(8,3)],hook=hook,other=other,mask=129,flag=False,fail=fail),op('pack'),op('defaults')]) + rng=random.Random(0x53594e4342595445) + for _ in range(2000): + ids=[8]+rng.sample([i for i in range(64) if i!=8],rng.randrange(0,10));initial=[value(id,rng.randrange(256)) for id in ids];ops=[] + for __ in range(rng.randrange(5,35)): + ops.append(op(rng.choice(['set','set','get','pack','defaults','assign','flag']),rng.choice(ids+[255]),rng.randrange(256),force=bool(rng.randrange(2)),values=[value(rng.choice(ids+[255]),rng.randrange(256)) for ___ in range(rng.randrange(6))],hook=rng.choice(['none','pack','set','assign','flag']),other=rng.choice(ids),other_value=bits(rng.randrange(256)),other_force=bool(rng.randrange(2)),mask=rng.randrange(-2147483648,2147483648),flag=bool(rng.randrange(2)),fail=rng.choice([-1,-1,-1,0,1,2,3]))) + yield row(initial,ops) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-synced-bytes-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSyncedBytesOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/synced_bytes_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaSyncedBytesOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','synced_bytes_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('synced_bytes_fixture.exe' if os.name=='nt' else 'synced_bytes_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} synchronized byte output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual byte SynchedEntityData values and inherited LivingEntity using-item/offhand queries plus protected flag writes. Covers every initial byte, signed masks, ordered dirty/default output, assignment, reentrant flag/data writes, callback packing and failures before dirty marking. Rust shares a typed scalar implementation with existing synchronized floats. Heterogeneous serializer maps, entity schema/network codecs and full item-use/gameplay integration remain pending.'} + lab.write_json(report_path,report);print(f'Scoped synchronized byte parity passed: {report_path}') + + +if __name__=='__main__':main() From f367641aa779df65b5f280bad0c6bf8adaa36ef1 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 08:25:27 +0200 Subject: [PATCH 143/253] Bind item-use lifecycle to player inventory and synchronized flags --- .../scoped-parity.json | 279 +++++++++++++++ .../examples/inventory_use_fixture.rs | 331 ++++++++++++++++++ crates/horizon-world/src/inventory_use.rs | 304 ++++++++++++++++ crates/horizon-world/src/lib.rs | 2 + docs/collision-geometry.md | 17 + .../parity/VanillaInventoryUseOracle.java | 40 +++ tools/test_inventory_use_parity.py | 71 ++++ 7 files changed, 1044 insertions(+) create mode 100644 benchmarks/rust-inventory-use-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/inventory_use_fixture.rs create mode 100644 crates/horizon-world/src/inventory_use.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaInventoryUseOracle.java create mode 100644 tools/test_inventory_use_parity.py diff --git a/benchmarks/rust-inventory-use-2026-10-07/scoped-parity.json b/benchmarks/rust-inventory-use-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..3805afb96 --- /dev/null +++ b/benchmarks/rust-inventory-use-2026-10-07/scoped-parity.json @@ -0,0 +1,279 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 10920, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaInventoryUseOracle.java": "7f13ce494c879e66b97d094f53b17c401cc9aca50e6b6c6facce8c52a853974f", + "tools/test_inventory_use_parity.py": "72102046260fae6b079b170a7ff14b481ec2b45edc604b3e32c295bc3ec4f562", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "6884c7209f007ab9ee742b9c3c73828cfa1c6753d35b5fe25a87cab5955b33f8", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "18bbad377a8047e4d4ecd0fc87d83d46d1c0f1ce2b8c47bbe64633e7b4420b57", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/blocking_item_damage.rs": "afea3cb5761e8b82ee4d9bb4ef3c6fd10182a324dbaec99e6c9ebfac255dda09", + "crates/horizon-world/src/blocking_rules.rs": "83c5e2105cec56a90182ce582e1c67ade2b189be6de1a34d08035000cc07c492", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/component_durability.rs": "37a46e184f95bc5027e2b9af72ff52f729ad03601d08e1827f181fca383a35af", + "crates/horizon-world/src/component_patch.rs": "3622244ccdee46e13956c64ffe9be6234e686adf58dbc3a24cece0f1814301a1", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_immunity.rs": "fd39c41124d694e755cf7faadcf93c636df4042c78ec345092a856b5f952dbcf", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/damage_source.rs": "24945e397a926d34695652980923609e4723e02fe6b6e56d4aaf673e45d759f7", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/inventory_pickup.rs": "ea830c7916e7f2d95c6db7ef48be1e876e6ebafcb438e47fc72f9a5bd7c37d07", + "crates/horizon-world/src/inventory_tick.rs": "293a3d57a1689337cfd58e5a73dcdbed4cb360f94d98ff5458f0df92de387365", + "crates/horizon-world/src/inventory_use.rs": "c7aa789fab78147b45119eff5265dd67828b927edb6673a498f861d2408a6a48", + "crates/horizon-world/src/item_blocking.rs": "f6eee0d6d177cc3148960122327ba1b459a2f0e85241c1d9a3e40f0b8c169296", + "crates/horizon-world/src/item_durability.rs": "9fdf835e5c7bd0e1dd63ef2ba0076b770cdd4d6d14cdcd11de27690f0702f94e", + "crates/horizon-world/src/item_stack_refs.rs": "18d3ca85cac0daf59200857513761359e5690f719cb3f7f64ae552f0c4169ea3", + "crates/horizon-world/src/item_stack_storage.rs": "b4dcb83dcaa346848c5484161feb3e2cf08e83f7793d7ed83be25b14b9d12884", + "crates/horizon-world/src/item_use.rs": "b1c79428986efbf9dd5ede703a39eb387fb6dcc7d9950f0e49243a353a5b8070", + "crates/horizon-world/src/item_use_catalog.rs": "a9b53d2e816583239a75c3c61e78dacc5e3b27dee595be34b1c7fa169f17a571", + "crates/horizon-world/src/item_use_lifecycle.rs": "4639b70440cf811e79de09c48a3e035143fcb6be8a64c2f61b10ae55a2f133b7", + "crates/horizon-world/src/item_use_start.rs": "a84092dfb8b8f0a89d0928bb2f8ac252bd9bfd3f8d74fce1a7f7a5b3c3f4f50b", + "crates/horizon-world/src/lib.rs": "f0328adcaf4f61835ab48344be73941c65927c3f08c0adb0012a8abef7cb730b", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "2b448209629b9bf2e678d667ad0d6c7fa22146892dd106b169d96b31b0df12bb", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_hurt.rs": "844239ad7d15c39629bb3cfc06ebae6d1cff20b7627468f26e0ee8dff3abdcb8", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/living_use_flags.rs": "826f4fdeba7e208368cbbf910fa408db0afbc6442d842d178a70fae53e0d0ea6", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_equipment.rs": "1fa8c53e67624c4641246249d79a800a28a4858c62482bd880b4e3b866b936ef", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_hurt.rs": "99c9bbd8587ec2dc287806049897b8034d2f5349ad47fc497b70d54148844a36", + "crates/horizon-world/src/player_inventory.rs": "f4f67d8312793f25930626c4ac06db688fcf2e2292d6675071d105fb1708d952", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/server_player_combat.rs": "a9743971581af86d926eeba42004d932caf83382c470dd98bf613cb9c417db58", + "crates/horizon-world/src/server_player_damage.rs": "828a4649fec3e9bda2dfe20aced8c95922c697321de2be4127bd4e5712ecbb7c", + "crates/horizon-world/src/simple_container.rs": "0fedbc7e974b1db79b88bd6aff977654189a5d553cf42852fe8bf0885cf90b30", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "0152f2752bafaf68769d56dbc88494a976496a680c6b113d6b48a446158ba072", + "crates/horizon-world/src/synced_values.rs": "adffa15026497d6671ffd12e5e17df9329c93f0e022700cdfebb80ab494382ae", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/view_direction.rs": "e18120ae26dc5cf702b29fc4c8487088bab133c8ce5abce01226833fafb0d5a4", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "74e4110fb19c4c4047192fd65c38015b8afc7f9fc50404d75380b5063808148c", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/inventory_use_fixture.rs": "454729db9a51afa8c9fd6811fd86bbd725a1fb8dbd76466d4986c90cad8abb78" + }, + "fixtures_sha256": { + ".local/rust-inventory-use-parity/inputs.txt": "35b22bede9b7fd6c5d755da374452f8aa419a24fecbf43ae45839ba057792cf7" + }, + "rust_output_sha256": "5ca5dc4d199c0dec5901b7d5c48bba4d6f1654781a0a3324c3ea2435ac61abd2", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "5ca5dc4d199c0dec5901b7d5c48bba4d6f1654781a0a3324c3ea2435ac61abd2", + "matched_output_lines": 349310 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "5ca5dc4d199c0dec5901b7d5c48bba4d6f1654781a0a3324c3ea2435ac61abd2", + "matched_output_lines": 349310 + } + ], + "scope": "Actual inherited LivingEntity use tick/update/completion/release/stop composed with real Player Inventory, PlayerEquipment hand access and byte SynchedEntityData flags. Traces compare held/active reference identity, live count mutations, selected/offhand writes, onEquipItem callbacks, synchronized value/dirty prefixes, finish vibration and kinetic-map presence. Custom item/level effects remain controlled; starting use, complete onEquipItem effects, consumables, kinetic combat, remainders/cooldowns and complete gameplay integration remain pending." +} diff --git a/crates/horizon-world/examples/inventory_use_fixture.rs b/crates/horizon-world/examples/inventory_use_fixture.rs new file mode 100644 index 000000000..2f5ed557b --- /dev/null +++ b/crates/horizon-world/examples/inventory_use_fixture.rs @@ -0,0 +1,331 @@ +use horizon_world::{ + component_patch::Prototype, + inventory_use::{ActiveStack, InventoryUse, UseServices, UseView}, + item_stack_refs::{ItemStacks, StackRef}, + item_use_lifecycle::{self, UseState}, + living_use_flags, + player_equipment::InteractionHand, + player_inventory::{EntityEquipment, EquipmentSlot, PlayerInventory}, + synced_values::{DataValue, SyncedValues}, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +type Stack = StackRef; +type State = ActiveStack; +type View<'a> = UseView<'a, usize, u8, bool>; +fn n(v: &Value, k: &str) -> i32 { + v[k].as_i64().unwrap() as i32 +} +struct Services { + f: Value, + out: io::BufWriter, + calls: i32, + changed: bool, + items: [Stack; 3], +} +impl Services { + fn config(&self) -> &Value { + &self.f[if self.changed { "after" } else { "initial" }] + } + fn id(&self, s: &Stack) -> usize { + self.items.iter().position(|v| v.same_reference(s)).unwrap() + } + fn reset(&self, view: View<'_>, state: &mut State) { + let c = self.config(); + state.item = self.items[n(c, "item") as usize].clone(); + state.remaining = n(c, "remaining"); + state.has_recent_kinetic_enemies = c["kinetic"].as_bool().unwrap(); + for i in 0..3 { + self.items[i].write().count = c["counts"][i].as_i64().unwrap() as i32; + } + view.inventory.clear(); + view.inventory.set_selected(n(c, "selected")).unwrap(); + for p in c["slots"].as_array().unwrap() { + view.inventory + .set( + p[0].as_i64().unwrap() as i32, + self.items[p[1].as_u64().unwrap() as usize].clone(), + ) + .unwrap(); + } + } + fn all(&mut self, view: &View<'_>, state: &State) -> io::Result<()> { + writeln!( + self.out, + "state {} {} {} {} {} {} {} {} {} {} {}", + self.id(&state.item), + state.remaining, + state.has_recent_kinetic_enemies, + living_use_flags::using_item(view.flags).unwrap(), + match living_use_flags::used_hand(view.flags).unwrap() { + InteractionHand::Main => 0, + InteractionHand::Off => 1, + }, + view.flags.get(8).unwrap(), + view.flags.is_dirty(), + view.flags.item_dirty(8).unwrap(), + view.inventory.selected(), + self.calls, + self.changed + )?; + writeln!( + self.out, + "counts {} {} {}", + self.items[0].read().count, + self.items[1].read().count, + self.items[2].read().count + )?; + let slots = (0..43) + .map(|i| self.id(&view.inventory.get(i).unwrap()).to_string()) + .collect::>() + .join(","); + writeln!(self.out, "slots {slots}")?; + let eq = view + .inventory + .equipment() + .entries() + .iter() + .map(|(slot, s)| format!("{}={}", *slot as usize, self.id(s))) + .collect::>() + .join(","); + writeln!(self.out, "equipment {eq}")?; + Ok(()) + } + fn event(&mut self, view: View<'_>, state: &mut State, name: &str) -> io::Result<()> { + writeln!(self.out, "{name}")?; + let index = self.calls; + self.calls += 1; + self.all(&view, state)?; + if index == n(&self.f, "fail") { + return Err(io::Error::other("injected callback failure")); + } + if index == n(&self.f, "mutate_at") { + self.changed = true; + self.reset(view, state); + } + Ok(()) + } +} +impl UseServices for Services { + type Error = io::Error; + type Level = usize; + fn level(&mut self, view: View<'_>, state: &mut State) -> io::Result { + self.event(view, state, "level")?; + Ok(n(self.config(), "level") as usize) + } + fn is_client(&mut self, view: View<'_>, state: &mut State, level: usize) -> io::Result { + self.event(view, state, &format!("client {level}"))?; + Ok(self.config()["clients"][level].as_bool().unwrap()) + } + fn remaining_ticks(&mut self, view: View<'_>, state: &mut State) -> io::Result { + self.event(view, state, "remaining")?; + Ok(n(self.config(), "virtual_remaining")) + } + fn item_tick( + &mut self, + view: View<'_>, + state: &mut State, + item: Stack, + level: usize, + remaining: i32, + ) -> io::Result<()> { + let kind = item.read().item(); + if kind != 2 { + self.event( + view, + state, + &format!("tick {kind} {} {level} {remaining}", self.id(&item)), + )?; + } + Ok(()) + } + fn use_on_release( + &mut self, + view: View<'_>, + state: &mut State, + item: Stack, + ) -> io::Result { + let kind = item.read().item(); + if kind == 2 { + return Ok(false); + } + self.event( + view, + state, + &format!("release-query {kind} {}", self.id(&item)), + )?; + Ok(self.config()["releases"][kind].as_bool().unwrap()) + } + fn release_item( + &mut self, + view: View<'_>, + state: &mut State, + item: Stack, + level: usize, + remaining: i32, + ) -> io::Result<()> { + let kind = item.read().item(); + if kind != 2 { + self.event( + view, + state, + &format!("release {kind} {} {level} {remaining}", self.id(&item)), + )?; + } + Ok(()) + } + fn finish_item( + &mut self, + view: View<'_>, + state: &mut State, + item: Stack, + level: usize, + ) -> io::Result { + let kind = item.read().item(); + if kind == 2 { + return Ok(item); + } + self.event( + view, + state, + &format!("finish {kind} {} {level}", self.id(&item)), + )?; + Ok(self.items[self.config()["finishes"][kind].as_u64().unwrap() as usize].clone()) + } + fn finish_vibration( + &mut self, + view: View<'_>, + state: &mut State, + item: Stack, + ) -> io::Result<()> { + if item.read().component(&0).copied().unwrap_or(false) { + self.event(view, state, "vibration")?; + } + Ok(()) + } + fn on_equip( + &mut self, + view: View<'_>, + state: &mut State, + slot: EquipmentSlot, + old: Stack, + new: Stack, + ) -> io::Result<()> { + self.event( + view, + state, + &format!( + "equip {} {} {}", + slot as usize, + self.id(&old), + self.id(&new) + ), + ) + } + fn on_synced(&mut self, view: View<'_>, state: &mut State, id: u8) -> io::Result<()> { + self.event(view, state, &format!("synced {id}")) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let stacks = ItemStacks::new(2); + let items = [ + stacks.create(0, 1, Prototype::new([])), + stacks.create( + if f["shared_type"].as_bool().unwrap() { + 0 + } else { + 1 + }, + 1, + Prototype::new([]), + ), + stacks.empty(), + ]; + for i in 0..2 { + if f["vibrations"][i].as_bool().unwrap() { + items[i].write().components.set(0, Some(true)).unwrap(); + } + } + let mut state = UseState { + item: items[2].clone(), + remaining: 0, + has_recent_kinetic_enemies: false, + }; + let inventory = PlayerInventory::new(stacks.clone(), EntityEquipment::new(stacks.empty())); + let flags = SyncedValues::new(&[DataValue { + id: 8, + value: n(&f, "flags") as u8, + }])?; + let services = Services { + f: f.clone(), + out, + calls: 0, + changed: false, + items, + }; + let mut world = InventoryUse::new(inventory, flags, services).unwrap(); + world.services.reset( + UseView { + inventory: &mut world.inventory, + flags: &mut world.flags, + }, + &mut state, + ); + world.services.all( + &UseView { + inventory: &mut world.inventory, + flags: &mut world.flags, + }, + &state, + )?; + let result = match f["mode"].as_str().unwrap() { + "tick" => item_use_lifecycle::tick(&mut world, &mut state), + "update" => { + let item = world.services.items[n(&f, "argument") as usize].clone(); + item_use_lifecycle::update(&mut world, &mut state, item) + } + "complete" => item_use_lifecycle::complete(&mut world, &mut state), + "release" => item_use_lifecycle::release(&mut world, &mut state), + "stop" => item_use_lifecycle::stop(&mut world, &mut state), + _ => panic!("mode"), + }; + writeln!( + world.services.out, + "result {}", + if result.is_ok() { "ok" } else { "error" } + )?; + world.services.all( + &UseView { + inventory: &mut world.inventory, + flags: &mut world.flags, + }, + &state, + )?; + let packed = world.flags.take_dirty().map_or("none".into(), |values| { + values + .iter() + .map(|v| format!("{}:{}", v.id, v.value)) + .collect::>() + .join(",") + }); + writeln!(world.services.out, "packed {packed}")?; + world.services.all( + &UseView { + inventory: &mut world.inventory, + flags: &mut world.flags, + }, + &state, + )?; + out = world.services.out; + } + Ok(()) +} diff --git a/crates/horizon-world/src/inventory_use.rs b/crates/horizon-world/src/inventory_use.rs new file mode 100644 index 000000000..93e68a268 --- /dev/null +++ b/crates/horizon-world/src/inventory_use.rs @@ -0,0 +1,304 @@ +//! Living item-use lifecycle bound to player inventory, shared stack identity +//! and synchronized using/offhand bytes. Item effects and level services remain +//! explicit so their callbacks can observe or mutate the same stored state. +use crate::{ + item_stack_refs::StackRef, + item_use_lifecycle::{UseLifecycleWorld, UseState}, + living_use_flags, + player_equipment::{self, InteractionHand}, + player_inventory::{EquipmentSlot, PlayerInventory}, + synced_values::{DataError, Observer, SyncedValues}, +}; +pub type ActiveStack = UseState>; +pub struct UseView<'a, I, K, V> { + pub inventory: &'a mut PlayerInventory, + pub flags: &'a mut SyncedValues, +} +pub trait UseServices { + type Error; + type Level: Copy; + fn level( + &mut self, + view: UseView<'_, I, K, V>, + state: &mut ActiveStack, + ) -> Result; + fn is_client( + &mut self, + view: UseView<'_, I, K, V>, + state: &mut ActiveStack, + level: Self::Level, + ) -> Result; + fn remaining_ticks( + &mut self, + _view: UseView<'_, I, K, V>, + state: &mut ActiveStack, + ) -> Result { + Ok(state.remaining) + } + fn item_tick( + &mut self, + view: UseView<'_, I, K, V>, + state: &mut ActiveStack, + item: StackRef, + level: Self::Level, + remaining: i32, + ) -> Result<(), Self::Error>; + fn use_on_release( + &mut self, + view: UseView<'_, I, K, V>, + state: &mut ActiveStack, + item: StackRef, + ) -> Result; + fn release_item( + &mut self, + view: UseView<'_, I, K, V>, + state: &mut ActiveStack, + item: StackRef, + level: Self::Level, + remaining: i32, + ) -> Result<(), Self::Error>; + fn finish_item( + &mut self, + view: UseView<'_, I, K, V>, + state: &mut ActiveStack, + item: StackRef, + level: Self::Level, + ) -> Result, Self::Error>; + fn finish_vibration( + &mut self, + view: UseView<'_, I, K, V>, + state: &mut ActiveStack, + item: StackRef, + ) -> Result<(), Self::Error>; + fn on_equip( + &mut self, + view: UseView<'_, I, K, V>, + state: &mut ActiveStack, + slot: EquipmentSlot, + old: StackRef, + new: StackRef, + ) -> Result<(), Self::Error>; + fn on_synced( + &mut self, + view: UseView<'_, I, K, V>, + state: &mut ActiveStack, + id: u8, + ) -> Result<(), Self::Error>; +} +pub struct InventoryUse { + pub inventory: PlayerInventory, + pub flags: SyncedValues, + pub services: S, + empty: StackRef, +} +impl InventoryUse { + pub fn new( + inventory: PlayerInventory, + flags: SyncedValues, + services: S, + ) -> Result { + flags.get(living_use_flags::FLAGS_ID)?; + let empty = inventory.stacks().empty(); + Ok(Self { + inventory, + flags, + services, + empty, + }) + } +} +struct FlagObserver<'a, I, K, V, S> { + inventory: &'a mut PlayerInventory, + state: &'a mut ActiveStack, + services: &'a mut S, +} +impl> Observer for FlagObserver<'_, I, K, V, S> { + type Error = S::Error; + fn updated(&mut self, flags: &mut SyncedValues, id: u8) -> Result<(), Self::Error> { + self.services.on_synced( + UseView { + inventory: self.inventory, + flags, + }, + self.state, + id, + ) + } +} +impl> UseLifecycleWorld + for InventoryUse +{ + type Error = S::Error; + type Item = StackRef; + type Hand = InteractionHand; + type Level = S::Level; + fn empty_item(&self) -> Self::Item { + self.empty.clone() + } + fn is_empty(&self, item: Self::Item) -> bool { + item.read().is_empty() + } + fn same_item_type(&self, a: Self::Item, b: Self::Item) -> bool { + a.read().same_item(&b.read()) + } + fn using_item(&mut self, _: &mut ActiveStack) -> Result { + Ok(living_use_flags::using_item(&self.flags).expect("validated flags")) + } + fn used_hand(&mut self, _: &mut ActiveStack) -> Result { + Ok(living_use_flags::used_hand(&self.flags).expect("validated flags")) + } + fn hand_item( + &mut self, + _: &mut ActiveStack, + hand: InteractionHand, + ) -> Result { + Ok(player_equipment::get_hand(&self.inventory, hand)) + } + fn set_hand_item( + &mut self, + state: &mut ActiveStack, + hand: InteractionHand, + item: Self::Item, + ) -> Result<(), Self::Error> { + let old = player_equipment::set(&mut self.inventory, hand.slot(), item.clone()); + self.services.on_equip( + UseView { + inventory: &mut self.inventory, + flags: &mut self.flags, + }, + state, + hand.slot(), + old, + item, + ) + } + fn level(&mut self, state: &mut ActiveStack) -> Result { + self.services.level( + UseView { + inventory: &mut self.inventory, + flags: &mut self.flags, + }, + state, + ) + } + fn is_client( + &mut self, + state: &mut ActiveStack, + level: Self::Level, + ) -> Result { + self.services.is_client( + UseView { + inventory: &mut self.inventory, + flags: &mut self.flags, + }, + state, + level, + ) + } + fn remaining_ticks(&mut self, state: &mut ActiveStack) -> Result { + self.services.remaining_ticks( + UseView { + inventory: &mut self.inventory, + flags: &mut self.flags, + }, + state, + ) + } + fn item_tick( + &mut self, + state: &mut ActiveStack, + item: Self::Item, + level: Self::Level, + remaining: i32, + ) -> Result<(), Self::Error> { + self.services.item_tick( + UseView { + inventory: &mut self.inventory, + flags: &mut self.flags, + }, + state, + item, + level, + remaining, + ) + } + fn use_on_release( + &mut self, + state: &mut ActiveStack, + item: Self::Item, + ) -> Result { + self.services.use_on_release( + UseView { + inventory: &mut self.inventory, + flags: &mut self.flags, + }, + state, + item, + ) + } + fn release_item( + &mut self, + state: &mut ActiveStack, + item: Self::Item, + level: Self::Level, + remaining: i32, + ) -> Result<(), Self::Error> { + self.services.release_item( + UseView { + inventory: &mut self.inventory, + flags: &mut self.flags, + }, + state, + item, + level, + remaining, + ) + } + fn finish_item( + &mut self, + state: &mut ActiveStack, + item: Self::Item, + level: Self::Level, + ) -> Result { + self.services.finish_item( + UseView { + inventory: &mut self.inventory, + flags: &mut self.flags, + }, + state, + item, + level, + ) + } + fn set_using_flag( + &mut self, + state: &mut ActiveStack, + using: bool, + ) -> Result<(), Self::Error> { + let mut observer = FlagObserver { + inventory: &mut self.inventory, + state, + services: &mut self.services, + }; + living_use_flags::set_flag(&mut self.flags, 1, using, &mut observer).map_err(|error| { + match error { + DataError::Observer(e) => e, + DataError::UnknownId(_) => unreachable!("validated flags"), + } + }) + } + fn finish_vibration( + &mut self, + state: &mut ActiveStack, + item: Self::Item, + ) -> Result<(), Self::Error> { + self.services.finish_vibration( + UseView { + inventory: &mut self.inventory, + flags: &mut self.flags, + }, + state, + item, + ) + } +} diff --git a/crates/horizon-world/src/lib.rs b/crates/horizon-world/src/lib.rs index 09ea12154..2f9966bb8 100644 --- a/crates/horizon-world/src/lib.rs +++ b/crates/horizon-world/src/lib.rs @@ -107,3 +107,5 @@ pub mod player_equipment; pub mod living_use_flags; pub mod synced_values; + +pub mod inventory_use; diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 8b8b70e5b..06185defe 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1765,3 +1765,20 @@ failures. The [float regression](../benchmarks/rust-synced-bytes-2026-10-07/floa retains **554,909 matching lines per JAR**. Targeted Clippy passes. Mixed-serializer storage, entity schemas, wire codecs and full item-use/gameplay integration remain pending. + + +`inventory_use` binds living item-use ticks, completion, release and stop to +actual player inventory/hands, shared stack references and synchronized byte +flags. Equipment storage changes precede equip callbacks; synchronized flag +writes retain their value/callback/dirty ordering. Effects receive the same +mutable inventory, flag storage and active-use state. + +`python3 tools/test_inventory_use_parity.py` compares inherited native lifecycle +methods composed with real Inventory, PlayerEquipment and SynchedEntityData. The +[combined report](../benchmarks/rust-inventory-use-2026-10-07/scoped-parity.json) +records **349,310 matching lines per JAR**, including live count mutations, +selection/offhand changes, equipment callbacks, flag dirty prefixes, completion +replacement and failed callbacks. Targeted Clippy passes. Item/level effects and +the equip/synchronized observers are controlled; starting use, default observer +reactions, consumables, kinetic combat, remainders/cooldowns and complete gameplay +integration remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaInventoryUseOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaInventoryUseOracle.java new file mode 100644 index 000000000..45f3d1191 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaInventoryUseOracle.java @@ -0,0 +1,40 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.lang.reflect.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.*;import net.minecraft.core.component.*;import net.minecraft.world.entity.*;import net.minecraft.world.entity.player.*;import net.minecraft.world.item.*;import net.minecraft.world.level.*;import net.minecraft.world.level.gameevent.GameEvent;import net.minecraft.server.level.*;import net.minecraft.network.syncher.*; +/** Native use lifecycle with actual Inventory, PlayerEquipment and synchronized flags. */ +public final class VanillaInventoryUseOracle { + static final class Stop extends RuntimeException {} + static Object unsafe;static Method allocate;static Field useItem,remaining,kinetic,count,eqItems; + static T make(Class c)throws Exception{return c.cast(allocate.invoke(unsafe,c));} + static Field field(Class c,String n)throws Exception{var f=c.getDeclaredField(n);f.setAccessible(true);return f;} + static int n(JsonObject o,String k){return o.get(k).getAsInt();} + static final class Data { + JsonObject f;PrintWriter out;int calls;boolean changed;Actor actor;ItemStack[] items;Server[] levels;Inventory inv;PlayerEquipment equipment;SynchedEntityData data;SynchedEntityData.DataItem flags; + JsonObject state(){return f.getAsJsonObject(changed?"after":"initial");} + int id(ItemStack s){for(int i=0;i():null);for(int i=0;i<3;i++)items[i].setCount(s.getAsJsonArray("counts").get(i).getAsInt());inv.clearContent();inv.setSelectedSlot(n(s,"selected"));for(var e:s.getAsJsonArray("slots")){var p=e.getAsJsonArray();inv.setItem(p.get(0).getAsInt(),items[p.get(1).getAsInt()]);}}catch(Exception e){throw new AssertionError(e);}} + void all(){try{out.println("state "+id((ItemStack)useItem.get(actor))+" "+remaining.getInt(actor)+" "+(kinetic.get(actor)!=null)+" "+actor.isUsingItem()+" "+actor.getUsedItemHand().ordinal()+" "+Byte.toUnsignedInt(flags.getValue())+" "+data.isDirty()+" "+flags.isDirty()+" "+inv.getSelectedSlot()+" "+calls+" "+changed);out.println("counts "+count.getInt(items[0])+" "+count.getInt(items[1])+" "+count.getInt(items[2]));var slots=new StringJoiner(",");for(int i=0;i<43;i++)slots.add(Integer.toString(id(inv.getItem(i))));out.println("slots "+slots);var eq=new StringJoiner(",");for(var e:((EnumMap)eqItems.get(equipment)).entrySet())eq.add(e.getKey().ordinal()+"="+id(e.getValue()));out.println("equipment "+eq);}catch(Exception e){throw new AssertionError(e);}} + void event(String name){out.println(name);int index=calls++;all();if(index==n(f,"fail"))throw new Stop();if(index==n(f,"mutate_at")){changed=true;reset();}} + } + static final class Server extends ServerLevel {Data d;int id;Server(){super(null,null,null,null,null,null,false,0L,List.of(),false);}@Override public boolean isClientSide(){d.event("client "+id);return d.state().getAsJsonArray("clients").get(id).getAsBoolean();}} + static final class CustomItem extends Item {Data d;int id;CustomItem(){super(null);} + @Override public void onUseTick(Level l,LivingEntity a,ItemStack s,int ticks){d.event("tick "+id+" "+d.id(s)+" "+((Server)l).id+" "+ticks);} + @Override public boolean useOnRelease(ItemStack s){d.event("release-query "+id+" "+d.id(s));return d.state().getAsJsonArray("releases").get(id).getAsBoolean();} + @Override public boolean releaseUsing(ItemStack s,Level l,LivingEntity a,int ticks){d.event("release "+id+" "+d.id(s)+" "+((Server)l).id+" "+ticks);return false;} + @Override public ItemStack finishUsingItem(ItemStack s,Level l,LivingEntity a){d.event("finish "+id+" "+d.id(s)+" "+((Server)l).id);return d.items[d.state().getAsJsonArray("finishes").get(id).getAsInt()];} + } + static final class Actor extends Player {Data d;Actor(){super(null,null);}@Override public GameType gameMode(){return GameType.SURVIVAL;}@Override public boolean isSpectator(){return false;}@Override public boolean isCreative(){return false;} + @Override public ServerLevel level(){d.event("level");return d.levels[n(d.state(),"level")];} + @Override public int getUseItemRemainingTicks(){d.event("remaining");return n(d.state(),"virtual_remaining");} + @Override public void onEquipItem(EquipmentSlot slot,ItemStack old,ItemStack next){d.event("equip "+slot.ordinal()+" "+d.id(old)+" "+d.id(next));} + @Override public void onSyncedDataUpdated(EntityDataAccessor key){d.event("synced "+key.id());} + @Override public void gameEvent(Holder event){if(event!=GameEvent.ITEM_INTERACT_FINISH)throw new AssertionError();d.event("vibration");} + void update(ItemStack s){super.updateUsingItem(s);}void complete(){super.completeUsingItem();} + } + @SuppressWarnings("unchecked")public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();Items.AIR.builtInRegistryHolder().bindComponents(DataComponentMap.EMPTY);var u=Class.forName("sun.misc.Unsafe");unsafe=field(u,"theUnsafe").get(null);allocate=u.getMethod("allocateInstance",Class.class);useItem=field(LivingEntity.class,"useItem");remaining=field(LivingEntity.class,"useItemRemaining");kinetic=field(LivingEntity.class,"recentKineticEnemies");count=field(ItemStack.class,"count");eqItems=field(EntityEquipment.class,"items");var invField=field(Player.class,"inventory");var equipmentField=field(LivingEntity.class,"equipment");var dataField=field(Entity.class,"entityData");var flagKey=(EntityDataAccessor)field(LivingEntity.class,"DATA_LIVING_ENTITY_FLAGS").get(null);if(flagKey.id()!=8)throw new AssertionError();var dataCtor=SynchedEntityData.class.getDeclaredConstructor(SyncedDataHolder.class,SynchedEntityData.DataItem[].class);dataCtor.setAccessible(true);var tick=LivingEntity.class.getDeclaredMethod("updatingUsingItem");tick.setAccessible(true);var ctor=ItemStack.class.getDeclaredConstructor(Holder.class,int.class,PatchedDataComponentMap.class);ctor.setAccessible(true);Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var d=new Data();d.f=JsonParser.parseString(line).getAsJsonObject();d.out=out;d.actor=make(Actor.class);d.actor.d=d;d.levels=new Server[]{make(Server.class),make(Server.class)};for(int i=0;i<2;i++){d.levels[i].d=d;d.levels[i].id=i;}var first=make(CustomItem.class);first.d=d;first.id=0;var second=make(CustomItem.class);second.d=d;second.id=1;d.items=new ItemStack[]{ctor.newInstance(Holder.direct(first),1,new PatchedDataComponentMap(DataComponentMap.EMPTY)),ctor.newInstance(Holder.direct(d.f.get("shared_type").getAsBoolean()?first:second),1,new PatchedDataComponentMap(DataComponentMap.EMPTY)),ItemStack.EMPTY};ItemStack.EMPTY.setCount(0);ItemStack.EMPTY.setPopTime(0);for(int i=0;i<2;i++)if(d.f.getAsJsonArray("vibrations").get(i).getAsBoolean())d.items[i].set(DataComponents.USE_EFFECTS,new net.minecraft.world.item.component.UseEffects(false,true,1));d.equipment=new PlayerEquipment(d.actor);d.inv=new Inventory(d.actor,d.equipment);invField.set(d.actor,d.inv);equipmentField.set(d.actor,d.equipment);var entries=new SynchedEntityData.DataItem[9];for(int i=0;i<9;i++)entries[i]=new SynchedEntityData.DataItem(new EntityDataAccessor(i,EntityDataSerializers.BYTE),(byte)0);d.flags=new SynchedEntityData.DataItem(flagKey,(byte)n(d.f,"flags"));entries[8]=d.flags;d.data=dataCtor.newInstance(d.actor,entries);dataField.set(d.actor,d.data);d.reset();d.all(); + try{switch(d.f.get("mode").getAsString()){case "tick":try{tick.invoke(d.actor);}catch(InvocationTargetException e){if(e.getCause() instanceof Stop)throw new Stop();throw new AssertionError(e.getCause());}break;case "update":d.actor.update(d.items[n(d.f,"argument")]);break;case "complete":d.actor.complete();break;case "release":d.actor.releaseUsingItem();break;case "stop":d.actor.stopUsingItem();break;default:throw new AssertionError();}out.println("result ok");}catch(Stop e){out.println("result error");}d.all();var packed=d.data.packDirty();out.println("packed "+(packed==null?"none":packed.stream().map(v->v.id()+":"+Byte.toUnsignedInt((Byte)v.value())).collect(java.util.stream.Collectors.joining(","))));d.all(); + }} + } +} diff --git a/tools/test_inventory_use_parity.py b/tools/test_inventory_use_parity.py new file mode 100644 index 000000000..8b08f37db --- /dev/null +++ b/tools/test_inventory_use_parity.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python3 +"""Compare native living item-use tick, release, completion and stop lifecycle.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + modes=['tick','update','complete','release','stop'] + ints=[-2147483648,-1,0,1,2,20,2147483647] + def state(**kw): + s=dict(item=0,remaining=1,virtual_remaining=1,kinetic=True,selected=0,counts=[1,1,0],slots=[[0,0],[8,1],[40,1]],level=0,clients=[False,True],releases=[False,True],finishes=[1,0]);s.update(kw);return s + def row(mode='tick',**kw): + f=dict(mode=mode,argument=0,flags=1,shared_type=False,vibrations=[True,True],initial=state(),after=state(item=1,remaining=0,virtual_remaining=-1,counts=[0,2,0],selected=8,slots=[[0,1],[8,0],[40,0]],level=1),fail=-1,mutate_at=-1);f.update(kw);return f + for mode in modes: + for flags in range(256): + for selected in [0,1,8]:yield row(mode,flags=flags,initial=state(selected=selected)) + for item in range(3): + for count in ints: + for remaining in ints: + yield row(mode,argument=item,initial=state(item=item,counts=[count,count,count],remaining=remaining,virtual_remaining=remaining)) + for mutate in range(-1,12): + for fail in range(-1,12):yield row(mode,mutate_at=mutate,fail=fail) + rng=random.Random(0x494e56555345) + def random_state():return state(item=rng.randrange(3),remaining=rng.choice(ints),virtual_remaining=rng.choice(ints),kinetic=bool(rng.randrange(2)),selected=rng.randrange(9),counts=[rng.choice(ints) for _ in range(3)],slots=[[i,rng.randrange(3)] for i in rng.sample(range(43),rng.randrange(12))],level=rng.randrange(2),clients=[bool(rng.randrange(2)),bool(rng.randrange(2))],releases=[bool(rng.randrange(2)),bool(rng.randrange(2))],finishes=[rng.randrange(3),rng.randrange(3)]) + for _ in range(5500):yield row(rng.choice(modes),argument=rng.randrange(3),flags=rng.randrange(256),shared_type=bool(rng.randrange(2)),vibrations=[bool(rng.randrange(2)),bool(rng.randrange(2))],initial=random_state(),after=random_state(),fail=rng.choice([-1,-1,*range(12)]),mutate_at=rng.randrange(-1,12)) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-inventory-use-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaInventoryUseOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/inventory_use_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaInventoryUseOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','inventory_use_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('inventory_use_fixture.exe' if os.name=='nt' else 'inventory_use_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} inventory use output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual inherited LivingEntity use tick/update/completion/release/stop composed with real Player Inventory, PlayerEquipment hand access and byte SynchedEntityData flags. Traces compare held/active reference identity, live count mutations, selected/offhand writes, onEquipItem callbacks, synchronized value/dirty prefixes, finish vibration and kinetic-map presence. Custom item/level effects remain controlled; starting use, complete onEquipItem effects, consumables, kinetic combat, remainders/cooldowns and complete gameplay integration remain pending.'} + lab.write_json(report_path,report);print(f'Scoped inventory use parity passed: {report_path}') + + +if __name__=='__main__':main() From 826ace51026055d6647439c513884820d371c74d Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 08:34:24 +0200 Subject: [PATCH 144/253] Apply native client use-flag reactions to stored player state --- .../scoped-parity.json | 279 +++++++++++++ .../examples/use_flag_reaction_fixture.rs | 369 ++++++++++++++++++ crates/horizon-world/src/inventory_use.rs | 83 +++- docs/collision-geometry.md | 17 + .../parity/VanillaUseFlagReactionOracle.java | 41 ++ tools/test_use_flag_reaction_parity.py | 76 ++++ 6 files changed, 864 insertions(+), 1 deletion(-) create mode 100644 benchmarks/rust-use-flag-reaction-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/use_flag_reaction_fixture.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaUseFlagReactionOracle.java create mode 100644 tools/test_use_flag_reaction_parity.py diff --git a/benchmarks/rust-use-flag-reaction-2026-10-07/scoped-parity.json b/benchmarks/rust-use-flag-reaction-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..2fa60abee --- /dev/null +++ b/benchmarks/rust-use-flag-reaction-2026-10-07/scoped-parity.json @@ -0,0 +1,279 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 12504, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaUseFlagReactionOracle.java": "e2916bc1169f27e962a89969dce03e5cc461cd19a499bcd1dbdeafd5066a6f61", + "tools/test_use_flag_reaction_parity.py": "6b5b7057ebc91ad094aea6b5040207e4876090ef12ade3895826dfc811cca722", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "6884c7209f007ab9ee742b9c3c73828cfa1c6753d35b5fe25a87cab5955b33f8", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "18bbad377a8047e4d4ecd0fc87d83d46d1c0f1ce2b8c47bbe64633e7b4420b57", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/blocking_item_damage.rs": "afea3cb5761e8b82ee4d9bb4ef3c6fd10182a324dbaec99e6c9ebfac255dda09", + "crates/horizon-world/src/blocking_rules.rs": "83c5e2105cec56a90182ce582e1c67ade2b189be6de1a34d08035000cc07c492", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/component_durability.rs": "37a46e184f95bc5027e2b9af72ff52f729ad03601d08e1827f181fca383a35af", + "crates/horizon-world/src/component_patch.rs": "3622244ccdee46e13956c64ffe9be6234e686adf58dbc3a24cece0f1814301a1", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_immunity.rs": "fd39c41124d694e755cf7faadcf93c636df4042c78ec345092a856b5f952dbcf", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/damage_source.rs": "24945e397a926d34695652980923609e4723e02fe6b6e56d4aaf673e45d759f7", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/inventory_pickup.rs": "ea830c7916e7f2d95c6db7ef48be1e876e6ebafcb438e47fc72f9a5bd7c37d07", + "crates/horizon-world/src/inventory_tick.rs": "293a3d57a1689337cfd58e5a73dcdbed4cb360f94d98ff5458f0df92de387365", + "crates/horizon-world/src/inventory_use.rs": "15957ee9cee0c7e9ce1a3b109ec5a772f119ce4176c6ff0316812ac3a3d16ff9", + "crates/horizon-world/src/item_blocking.rs": "f6eee0d6d177cc3148960122327ba1b459a2f0e85241c1d9a3e40f0b8c169296", + "crates/horizon-world/src/item_durability.rs": "9fdf835e5c7bd0e1dd63ef2ba0076b770cdd4d6d14cdcd11de27690f0702f94e", + "crates/horizon-world/src/item_stack_refs.rs": "18d3ca85cac0daf59200857513761359e5690f719cb3f7f64ae552f0c4169ea3", + "crates/horizon-world/src/item_stack_storage.rs": "b4dcb83dcaa346848c5484161feb3e2cf08e83f7793d7ed83be25b14b9d12884", + "crates/horizon-world/src/item_use.rs": "b1c79428986efbf9dd5ede703a39eb387fb6dcc7d9950f0e49243a353a5b8070", + "crates/horizon-world/src/item_use_catalog.rs": "a9b53d2e816583239a75c3c61e78dacc5e3b27dee595be34b1c7fa169f17a571", + "crates/horizon-world/src/item_use_lifecycle.rs": "4639b70440cf811e79de09c48a3e035143fcb6be8a64c2f61b10ae55a2f133b7", + "crates/horizon-world/src/item_use_start.rs": "a84092dfb8b8f0a89d0928bb2f8ac252bd9bfd3f8d74fce1a7f7a5b3c3f4f50b", + "crates/horizon-world/src/lib.rs": "f0328adcaf4f61835ab48344be73941c65927c3f08c0adb0012a8abef7cb730b", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "2b448209629b9bf2e678d667ad0d6c7fa22146892dd106b169d96b31b0df12bb", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_hurt.rs": "844239ad7d15c39629bb3cfc06ebae6d1cff20b7627468f26e0ee8dff3abdcb8", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/living_use_flags.rs": "826f4fdeba7e208368cbbf910fa408db0afbc6442d842d178a70fae53e0d0ea6", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_equipment.rs": "1fa8c53e67624c4641246249d79a800a28a4858c62482bd880b4e3b866b936ef", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_hurt.rs": "99c9bbd8587ec2dc287806049897b8034d2f5349ad47fc497b70d54148844a36", + "crates/horizon-world/src/player_inventory.rs": "f4f67d8312793f25930626c4ac06db688fcf2e2292d6675071d105fb1708d952", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/server_player_combat.rs": "a9743971581af86d926eeba42004d932caf83382c470dd98bf613cb9c417db58", + "crates/horizon-world/src/server_player_damage.rs": "828a4649fec3e9bda2dfe20aced8c95922c697321de2be4127bd4e5712ecbb7c", + "crates/horizon-world/src/simple_container.rs": "0fedbc7e974b1db79b88bd6aff977654189a5d553cf42852fe8bf0885cf90b30", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "0152f2752bafaf68769d56dbc88494a976496a680c6b113d6b48a446158ba072", + "crates/horizon-world/src/synced_values.rs": "adffa15026497d6671ffd12e5e17df9329c93f0e022700cdfebb80ab494382ae", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/view_direction.rs": "e18120ae26dc5cf702b29fc4c8487088bab133c8ce5abce01226833fafb0d5a4", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "74e4110fb19c4c4047192fd65c38015b8afc7f9fc50404d75380b5063808148c", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/use_flag_reaction_fixture.rs": "b33182dbc907b4cdd3283ec4cb37d9a26e8fb0a35fdf99d95eae9201dd62ccc3" + }, + "fixtures_sha256": { + ".local/rust-use-flag-reaction-parity/inputs.txt": "f5fda04be588eaff2148b2e553f0785b8cca032adb12929c68ed4a90454caef2" + }, + "rust_output_sha256": "fbb8c9622200f26e64c93bfc2d4a1ba88706948e5546b9b57348d1a57f443c82", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "fbb8c9622200f26e64c93bfc2d4a1ba88706948e5546b9b57348d1a57f443c82", + "matched_output_lines": 366331 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "fbb8c9622200f26e64c93bfc2d4a1ba88706948e5546b9b57348d1a57f443c82", + "matched_output_lines": 366331 + } + ], + "scope": "Actual inherited LivingEntity synchronized-use-flag observer reaction, composed with Inventory/PlayerEquipment, shared stacks and SynchedEntityData writes/assignments. Client reactions initialize a newly active held stack and duration or clear an existing active stack; server reactions leave active use untouched. Includes ordinary use tick/completion/release/stop, same-value received updates, duration callbacks, dirty packing, mutations and failure prefixes. Other synchronized keys, start-use packet flow, full equip/item effects and complete gameplay integration remain pending." +} diff --git a/crates/horizon-world/examples/use_flag_reaction_fixture.rs b/crates/horizon-world/examples/use_flag_reaction_fixture.rs new file mode 100644 index 000000000..038b529fc --- /dev/null +++ b/crates/horizon-world/examples/use_flag_reaction_fixture.rs @@ -0,0 +1,369 @@ +use horizon_world::{ + component_patch::Prototype, + inventory_use::{ + ActiveStack, DurationServices, InventoryUse, UseServices, UseView, flags_updated, + }, + item_stack_refs::{ItemStacks, StackRef}, + item_use_lifecycle::{self, UseState}, + living_use_flags, + player_equipment::InteractionHand, + player_inventory::{EntityEquipment, EquipmentSlot, PlayerInventory}, + synced_values::{DataValue, SyncedValues}, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +type Stack = StackRef; +type State = ActiveStack; +type View<'a> = UseView<'a, usize, u8, bool>; +fn n(v: &Value, k: &str) -> i32 { + v[k].as_i64().unwrap() as i32 +} +struct Services { + f: Value, + out: io::BufWriter, + calls: i32, + changed: bool, + items: [Stack; 3], +} +impl Services { + fn config(&self) -> &Value { + &self.f[if self.changed { "after" } else { "initial" }] + } + fn id(&self, s: &Stack) -> usize { + self.items.iter().position(|v| v.same_reference(s)).unwrap() + } + fn reset(&self, view: View<'_>, state: &mut State) { + let c = self.config(); + state.item = self.items[n(c, "item") as usize].clone(); + state.remaining = n(c, "remaining"); + state.has_recent_kinetic_enemies = c["kinetic"].as_bool().unwrap(); + for i in 0..3 { + self.items[i].write().count = c["counts"][i].as_i64().unwrap() as i32; + } + view.inventory.clear(); + view.inventory.set_selected(n(c, "selected")).unwrap(); + for p in c["slots"].as_array().unwrap() { + view.inventory + .set( + p[0].as_i64().unwrap() as i32, + self.items[p[1].as_u64().unwrap() as usize].clone(), + ) + .unwrap(); + } + } + fn all(&mut self, view: &View<'_>, state: &State) -> io::Result<()> { + writeln!( + self.out, + "state {} {} {} {} {} {} {} {} {} {} {}", + self.id(&state.item), + state.remaining, + state.has_recent_kinetic_enemies, + living_use_flags::using_item(view.flags).unwrap(), + match living_use_flags::used_hand(view.flags).unwrap() { + InteractionHand::Main => 0, + InteractionHand::Off => 1, + }, + view.flags.get(8).unwrap(), + view.flags.is_dirty(), + view.flags.item_dirty(8).unwrap(), + view.inventory.selected(), + self.calls, + self.changed + )?; + writeln!( + self.out, + "counts {} {} {}", + self.items[0].read().count, + self.items[1].read().count, + self.items[2].read().count + )?; + let slots = (0..43) + .map(|i| self.id(&view.inventory.get(i).unwrap()).to_string()) + .collect::>() + .join(","); + writeln!(self.out, "slots {slots}")?; + let eq = view + .inventory + .equipment() + .entries() + .iter() + .map(|(slot, s)| format!("{}={}", *slot as usize, self.id(s))) + .collect::>() + .join(","); + writeln!(self.out, "equipment {eq}")?; + Ok(()) + } + fn event(&mut self, view: View<'_>, state: &mut State, name: &str) -> io::Result<()> { + writeln!(self.out, "{name}")?; + let index = self.calls; + self.calls += 1; + self.all(&view, state)?; + if index == n(&self.f, "fail") { + return Err(io::Error::other("injected callback failure")); + } + if index == n(&self.f, "mutate_at") { + self.changed = true; + self.reset(view, state); + } + Ok(()) + } +} +impl UseServices for Services { + type Error = io::Error; + type Level = usize; + fn level(&mut self, view: View<'_>, state: &mut State) -> io::Result { + self.event(view, state, "level")?; + Ok(n(self.config(), "level") as usize) + } + fn is_client(&mut self, view: View<'_>, state: &mut State, level: usize) -> io::Result { + self.event(view, state, &format!("client {level}"))?; + Ok(self.config()["clients"][level].as_bool().unwrap()) + } + fn remaining_ticks(&mut self, view: View<'_>, state: &mut State) -> io::Result { + self.event(view, state, "remaining")?; + Ok(n(self.config(), "virtual_remaining")) + } + fn item_tick( + &mut self, + view: View<'_>, + state: &mut State, + item: Stack, + level: usize, + remaining: i32, + ) -> io::Result<()> { + let kind = item.read().item(); + if kind != 2 { + self.event( + view, + state, + &format!("tick {kind} {} {level} {remaining}", self.id(&item)), + )?; + } + Ok(()) + } + fn use_on_release( + &mut self, + view: View<'_>, + state: &mut State, + item: Stack, + ) -> io::Result { + let kind = item.read().item(); + if kind == 2 { + return Ok(false); + } + self.event( + view, + state, + &format!("release-query {kind} {}", self.id(&item)), + )?; + Ok(self.config()["releases"][kind].as_bool().unwrap()) + } + fn release_item( + &mut self, + view: View<'_>, + state: &mut State, + item: Stack, + level: usize, + remaining: i32, + ) -> io::Result<()> { + let kind = item.read().item(); + if kind != 2 { + self.event( + view, + state, + &format!("release {kind} {} {level} {remaining}", self.id(&item)), + )?; + } + Ok(()) + } + fn finish_item( + &mut self, + view: View<'_>, + state: &mut State, + item: Stack, + level: usize, + ) -> io::Result { + let kind = item.read().item(); + if kind == 2 { + return Ok(item); + } + self.event( + view, + state, + &format!("finish {kind} {} {level}", self.id(&item)), + )?; + Ok(self.items[self.config()["finishes"][kind].as_u64().unwrap() as usize].clone()) + } + fn finish_vibration( + &mut self, + view: View<'_>, + state: &mut State, + item: Stack, + ) -> io::Result<()> { + if item.read().component(&0).copied().unwrap_or(false) { + self.event(view, state, "vibration")?; + } + Ok(()) + } + fn on_equip( + &mut self, + view: View<'_>, + state: &mut State, + slot: EquipmentSlot, + old: Stack, + new: Stack, + ) -> io::Result<()> { + self.event( + view, + state, + &format!( + "equip {} {} {}", + slot as usize, + self.id(&old), + self.id(&new) + ), + ) + } + fn on_synced(&mut self, mut view: View<'_>, state: &mut State, id: u8) -> io::Result<()> { + self.event(view.reborrow(), state, &format!("synced {id}"))?; + flags_updated(self, view, state) + } +} +impl DurationServices for Services { + fn duration(&mut self, view: View<'_>, state: &mut State, item: Stack) -> io::Result { + let kind = item.read().item(); + if kind == 2 { + return Ok(0); + } + self.event(view, state, &format!("duration {kind} {}", self.id(&item)))?; + Ok(self.config()["durations"][kind].as_i64().unwrap() as i32) + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let stacks = ItemStacks::new(2); + let items = [ + stacks.create(0, 1, Prototype::new([])), + stacks.create( + if f["shared_type"].as_bool().unwrap() { + 0 + } else { + 1 + }, + 1, + Prototype::new([]), + ), + stacks.empty(), + ]; + for i in 0..2 { + if f["vibrations"][i].as_bool().unwrap() { + items[i].write().components.set(0, Some(true)).unwrap(); + } + } + let mut state = UseState { + item: items[2].clone(), + remaining: 0, + has_recent_kinetic_enemies: false, + }; + let inventory = PlayerInventory::new(stacks.clone(), EntityEquipment::new(stacks.empty())); + let flags = SyncedValues::new(&[DataValue { + id: 8, + value: n(&f, "flags") as u8, + }])?; + let services = Services { + f: f.clone(), + out, + calls: 0, + changed: false, + items, + }; + let mut world = InventoryUse::new(inventory, flags, services).unwrap(); + world.services.reset( + UseView { + inventory: &mut world.inventory, + flags: &mut world.flags, + }, + &mut state, + ); + world.services.all( + &UseView { + inventory: &mut world.inventory, + flags: &mut world.flags, + }, + &state, + )?; + let result = match f["mode"].as_str().unwrap() { + "notify" => world.services.on_synced( + UseView { + inventory: &mut world.inventory, + flags: &mut world.flags, + }, + &mut state, + 8, + ), + "flag" => world + .set_flag(&mut state, n(&f, "mask"), f["value"].as_bool().unwrap()) + .map_err(io::Error::other), + "assign" => { + let values: Vec<_> = f["values"] + .as_array() + .unwrap() + .iter() + .map(|v| DataValue { + id: 8, + value: v.as_u64().unwrap() as u8, + }) + .collect(); + world + .assign_flags(&mut state, &values) + .map_err(io::Error::other) + } + "tick" => item_use_lifecycle::tick(&mut world, &mut state), + "update" => { + let item = world.services.items[n(&f, "argument") as usize].clone(); + item_use_lifecycle::update(&mut world, &mut state, item) + } + "complete" => item_use_lifecycle::complete(&mut world, &mut state), + "release" => item_use_lifecycle::release(&mut world, &mut state), + "stop" => item_use_lifecycle::stop(&mut world, &mut state), + _ => panic!("mode"), + }; + writeln!( + world.services.out, + "result {}", + if result.is_ok() { "ok" } else { "error" } + )?; + world.services.all( + &UseView { + inventory: &mut world.inventory, + flags: &mut world.flags, + }, + &state, + )?; + let packed = world.flags.take_dirty().map_or("none".into(), |values| { + values + .iter() + .map(|v| format!("{}:{}", v.id, v.value)) + .collect::>() + .join(",") + }); + writeln!(world.services.out, "packed {packed}")?; + world.services.all( + &UseView { + inventory: &mut world.inventory, + flags: &mut world.flags, + }, + &state, + )?; + out = world.services.out; + } + Ok(()) +} diff --git a/crates/horizon-world/src/inventory_use.rs b/crates/horizon-world/src/inventory_use.rs index 93e68a268..268012d73 100644 --- a/crates/horizon-world/src/inventory_use.rs +++ b/crates/horizon-world/src/inventory_use.rs @@ -7,13 +7,21 @@ use crate::{ living_use_flags, player_equipment::{self, InteractionHand}, player_inventory::{EquipmentSlot, PlayerInventory}, - synced_values::{DataError, Observer, SyncedValues}, + synced_values::{DataError, DataValue, Observer, SyncedValues}, }; pub type ActiveStack = UseState>; pub struct UseView<'a, I, K, V> { pub inventory: &'a mut PlayerInventory, pub flags: &'a mut SyncedValues, } +impl UseView<'_, I, K, V> { + pub fn reborrow(&mut self) -> UseView<'_, I, K, V> { + UseView { + inventory: self.inventory, + flags: self.flags, + } + } +} pub trait UseServices { type Error; type Level: Copy; @@ -302,3 +310,76 @@ impl> ) } } + +/// Duration dispatch used when client synchronization discovers a newly held +/// active stack. Implementations retain the captured stack across callbacks. +pub trait DurationServices: UseServices { + fn duration( + &mut self, + view: UseView<'_, I, K, V>, + state: &mut ActiveStack, + item: StackRef, + ) -> Result; +} +/// LivingEntity's reaction to DATA_LIVING_ENTITY_FLAGS after Entity's observer +/// has run. Other synchronized keys (pose, sleeping position, etc.) are separate. +pub fn flags_updated< + I: Copy + Eq, + K: Clone + Eq, + V: Clone + PartialEq, + S: DurationServices, +>( + services: &mut S, + mut view: UseView<'_, I, K, V>, + state: &mut ActiveStack, +) -> Result<(), S::Error> { + let level = services.level(view.reborrow(), state)?; + if !services.is_client(view.reborrow(), state, level)? { + return Ok(()); + } + if living_use_flags::using_item(view.flags).expect("validated flags") + && state.item.read().is_empty() + { + let hand = living_use_flags::used_hand(view.flags).expect("validated flags"); + state.item = player_equipment::get_hand(view.inventory, hand); + if !state.item.read().is_empty() { + let item = state.item.clone(); + state.remaining = services.duration(view, state, item)?; + } + } else if !living_use_flags::using_item(view.flags).expect("validated flags") + && !state.item.read().is_empty() + { + state.item = view.inventory.stacks().empty(); + state.remaining = 0; + } + Ok(()) +} +impl> + InventoryUse +{ + pub fn assign_flags( + &mut self, + state: &mut ActiveStack, + values: &[DataValue], + ) -> Result<(), DataError> { + let mut observer = FlagObserver { + inventory: &mut self.inventory, + state, + services: &mut self.services, + }; + self.flags.assign(values, &mut observer) + } + pub fn set_flag( + &mut self, + state: &mut ActiveStack, + mask: i32, + value: bool, + ) -> Result<(), DataError> { + let mut observer = FlagObserver { + inventory: &mut self.inventory, + state, + services: &mut self.services, + }; + living_use_flags::set_flag(&mut self.flags, mask, value, &mut observer) + } +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index 06185defe..b3c3947f3 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1782,3 +1782,20 @@ replacement and failed callbacks. Targeted Clippy passes. Item/level effects and the equip/synchronized observers are controlled; starting use, default observer reactions, consumables, kinetic combat, remainders/cooldowns and complete gameplay integration remain pending. + + +`inventory_use::flags_updated` implements LivingEntity's synchronized use-flag +reaction. On clients, a using flag can select the held stack and query its +duration; clearing use can clear the active stack and remaining time. Server +notifications leave active-use state unchanged. Received assignments notify even +when the byte value is unchanged, while ordinary unchanged writes do not. + +`python3 tools/test_use_flag_reaction_parity.py` invokes the inherited native +observer through actual synchronized writes/assignments, player inventory and +equipment. The [reaction report](../benchmarks/rust-use-flag-reaction-2026-10-07/scoped-parity.json) +records **366,331 matching lines per JAR**, including duration callbacks, +empty-but-distinct stack references, signed masks, repeated received values, +selection/count mutations and failures before dirty marking. Ordinary lifecycle +operations are also exercised with the real observer reaction. Targeted Clippy +passes. Other synchronized keys, start-use packet flow, full item/equip effects +and complete gameplay integration remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaUseFlagReactionOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaUseFlagReactionOracle.java new file mode 100644 index 000000000..aa5726099 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaUseFlagReactionOracle.java @@ -0,0 +1,41 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.lang.reflect.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.*;import net.minecraft.core.component.*;import net.minecraft.world.entity.*;import net.minecraft.world.entity.player.*;import net.minecraft.world.item.*;import net.minecraft.world.level.*;import net.minecraft.world.level.gameevent.GameEvent;import net.minecraft.server.level.*;import net.minecraft.network.syncher.*; +/** Native use lifecycle with actual Inventory, PlayerEquipment and synchronized flags. */ +public final class VanillaUseFlagReactionOracle { + static final class Stop extends RuntimeException {} + static Object unsafe;static Method allocate;static Field useItem,remaining,kinetic,count,eqItems; + static T make(Class c)throws Exception{return c.cast(allocate.invoke(unsafe,c));} + static Field field(Class c,String n)throws Exception{var f=c.getDeclaredField(n);f.setAccessible(true);return f;} + static int n(JsonObject o,String k){return o.get(k).getAsInt();} + static final class Data { + JsonObject f;PrintWriter out;int calls;boolean changed;Actor actor;ItemStack[] items;Server[] levels;Inventory inv;PlayerEquipment equipment;SynchedEntityData data;SynchedEntityData.DataItem flags; + JsonObject state(){return f.getAsJsonObject(changed?"after":"initial");} + int id(ItemStack s){for(int i=0;i():null);for(int i=0;i<3;i++)items[i].setCount(s.getAsJsonArray("counts").get(i).getAsInt());inv.clearContent();inv.setSelectedSlot(n(s,"selected"));for(var e:s.getAsJsonArray("slots")){var p=e.getAsJsonArray();inv.setItem(p.get(0).getAsInt(),items[p.get(1).getAsInt()]);}}catch(Exception e){throw new AssertionError(e);}} + void all(){try{out.println("state "+id((ItemStack)useItem.get(actor))+" "+remaining.getInt(actor)+" "+(kinetic.get(actor)!=null)+" "+actor.isUsingItem()+" "+actor.getUsedItemHand().ordinal()+" "+Byte.toUnsignedInt(flags.getValue())+" "+data.isDirty()+" "+flags.isDirty()+" "+inv.getSelectedSlot()+" "+calls+" "+changed);out.println("counts "+count.getInt(items[0])+" "+count.getInt(items[1])+" "+count.getInt(items[2]));var slots=new StringJoiner(",");for(int i=0;i<43;i++)slots.add(Integer.toString(id(inv.getItem(i))));out.println("slots "+slots);var eq=new StringJoiner(",");for(var e:((EnumMap)eqItems.get(equipment)).entrySet())eq.add(e.getKey().ordinal()+"="+id(e.getValue()));out.println("equipment "+eq);}catch(Exception e){throw new AssertionError(e);}} + void event(String name){out.println(name);int index=calls++;all();if(index==n(f,"fail"))throw new Stop();if(index==n(f,"mutate_at")){changed=true;reset();}} + } + static final class Server extends ServerLevel {Data d;int id;Server(){super(null,null,null,null,null,null,false,0L,List.of(),false);}@Override public boolean isClientSide(){d.event("client "+id);return d.state().getAsJsonArray("clients").get(id).getAsBoolean();}} + static final class CustomItem extends Item {Data d;int id;CustomItem(){super(null);} + @Override public int getUseDuration(ItemStack stack,LivingEntity actor){d.event("duration "+id+" "+d.id(stack));return d.state().getAsJsonArray("durations").get(id).getAsInt();} + @Override public void onUseTick(Level l,LivingEntity a,ItemStack s,int ticks){d.event("tick "+id+" "+d.id(s)+" "+((Server)l).id+" "+ticks);} + @Override public boolean useOnRelease(ItemStack s){d.event("release-query "+id+" "+d.id(s));return d.state().getAsJsonArray("releases").get(id).getAsBoolean();} + @Override public boolean releaseUsing(ItemStack s,Level l,LivingEntity a,int ticks){d.event("release "+id+" "+d.id(s)+" "+((Server)l).id+" "+ticks);return false;} + @Override public ItemStack finishUsingItem(ItemStack s,Level l,LivingEntity a){d.event("finish "+id+" "+d.id(s)+" "+((Server)l).id);return d.items[d.state().getAsJsonArray("finishes").get(id).getAsInt()];} + } + static final class Actor extends Player {Data d;Actor(){super(null,null);}@Override public GameType gameMode(){return GameType.SURVIVAL;}@Override public boolean isSpectator(){return false;}@Override public boolean isCreative(){return false;} + @Override public ServerLevel level(){d.event("level");return d.levels[n(d.state(),"level")];} + @Override public int getUseItemRemainingTicks(){d.event("remaining");return n(d.state(),"virtual_remaining");} + @Override public void onEquipItem(EquipmentSlot slot,ItemStack old,ItemStack next){d.event("equip "+slot.ordinal()+" "+d.id(old)+" "+d.id(next));} + @Override public void onSyncedDataUpdated(EntityDataAccessor key){d.event("synced "+key.id());super.onSyncedDataUpdated(key);} + @Override public void gameEvent(Holder event){if(event!=GameEvent.ITEM_INTERACT_FINISH)throw new AssertionError();d.event("vibration");} + void flag(int mask,boolean value){super.setLivingEntityFlag(mask,value);}void update(ItemStack s){super.updateUsingItem(s);}void complete(){super.completeUsingItem();} + } + @SuppressWarnings("unchecked")public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();Items.AIR.builtInRegistryHolder().bindComponents(DataComponentMap.EMPTY);var u=Class.forName("sun.misc.Unsafe");unsafe=field(u,"theUnsafe").get(null);allocate=u.getMethod("allocateInstance",Class.class);useItem=field(LivingEntity.class,"useItem");remaining=field(LivingEntity.class,"useItemRemaining");kinetic=field(LivingEntity.class,"recentKineticEnemies");count=field(ItemStack.class,"count");eqItems=field(EntityEquipment.class,"items");var invField=field(Player.class,"inventory");var equipmentField=field(LivingEntity.class,"equipment");var dataField=field(Entity.class,"entityData");var flagKey=(EntityDataAccessor)field(LivingEntity.class,"DATA_LIVING_ENTITY_FLAGS").get(null);if(flagKey.id()!=8)throw new AssertionError();var dataCtor=SynchedEntityData.class.getDeclaredConstructor(SyncedDataHolder.class,SynchedEntityData.DataItem[].class);dataCtor.setAccessible(true);var tick=LivingEntity.class.getDeclaredMethod("updatingUsingItem");tick.setAccessible(true);var ctor=ItemStack.class.getDeclaredConstructor(Holder.class,int.class,PatchedDataComponentMap.class);ctor.setAccessible(true);Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var d=new Data();d.f=JsonParser.parseString(line).getAsJsonObject();d.out=out;d.actor=make(Actor.class);d.actor.d=d;d.levels=new Server[]{make(Server.class),make(Server.class)};for(int i=0;i<2;i++){d.levels[i].d=d;d.levels[i].id=i;}var first=make(CustomItem.class);first.d=d;first.id=0;var second=make(CustomItem.class);second.d=d;second.id=1;d.items=new ItemStack[]{ctor.newInstance(Holder.direct(first),1,new PatchedDataComponentMap(DataComponentMap.EMPTY)),ctor.newInstance(Holder.direct(d.f.get("shared_type").getAsBoolean()?first:second),1,new PatchedDataComponentMap(DataComponentMap.EMPTY)),ItemStack.EMPTY};ItemStack.EMPTY.setCount(0);ItemStack.EMPTY.setPopTime(0);for(int i=0;i<2;i++)if(d.f.getAsJsonArray("vibrations").get(i).getAsBoolean())d.items[i].set(DataComponents.USE_EFFECTS,new net.minecraft.world.item.component.UseEffects(false,true,1));d.equipment=new PlayerEquipment(d.actor);d.inv=new Inventory(d.actor,d.equipment);invField.set(d.actor,d.inv);equipmentField.set(d.actor,d.equipment);var entries=new SynchedEntityData.DataItem[9];for(int i=0;i<9;i++)entries[i]=new SynchedEntityData.DataItem(new EntityDataAccessor(i,EntityDataSerializers.BYTE),(byte)0);d.flags=new SynchedEntityData.DataItem(flagKey,(byte)n(d.f,"flags"));entries[8]=d.flags;d.data=dataCtor.newInstance(d.actor,entries);dataField.set(d.actor,d.data);d.reset();d.all(); + try{switch(d.f.get("mode").getAsString()){case "notify":d.actor.onSyncedDataUpdated(flagKey);break;case "flag":d.actor.flag(n(d.f,"mask"),d.f.get("value").getAsBoolean());break;case "assign":var values=new ArrayList>();for(var value:d.f.getAsJsonArray("values"))values.add(new SynchedEntityData.DataValue(8,EntityDataSerializers.BYTE,(byte)value.getAsInt()));d.data.assignValues(values);break;case "tick":try{tick.invoke(d.actor);}catch(InvocationTargetException e){if(e.getCause() instanceof Stop)throw new Stop();throw new AssertionError(e.getCause());}break;case "update":d.actor.update(d.items[n(d.f,"argument")]);break;case "complete":d.actor.complete();break;case "release":d.actor.releaseUsingItem();break;case "stop":d.actor.stopUsingItem();break;default:throw new AssertionError();}out.println("result ok");}catch(Stop e){out.println("result error");}d.all();var packed=d.data.packDirty();out.println("packed "+(packed==null?"none":packed.stream().map(v->v.id()+":"+Byte.toUnsignedInt((Byte)v.value())).collect(java.util.stream.Collectors.joining(","))));d.all(); + }} + } +} diff --git a/tools/test_use_flag_reaction_parity.py b/tools/test_use_flag_reaction_parity.py new file mode 100644 index 000000000..08437e229 --- /dev/null +++ b/tools/test_use_flag_reaction_parity.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python3 +"""Compare native living item-use tick, release, completion and stop lifecycle.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + modes=['tick','update','complete','release','stop','notify','flag','assign'] + ints=[-2147483648,-1,0,1,2,20,2147483647] + def state(**kw): + s=dict(item=0,remaining=1,virtual_remaining=1,kinetic=True,selected=0,counts=[1,1,0],slots=[[0,0],[8,1],[40,1]],level=0,clients=[False,True],releases=[False,True],finishes=[1,0],durations=[32,72000]);s.update(kw);return s + def row(mode='tick',**kw): + f=dict(mode=mode,argument=0,flags=1,shared_type=False,vibrations=[True,True],initial=state(),after=state(item=1,remaining=0,virtual_remaining=-1,counts=[0,2,0],selected=8,slots=[[0,1],[8,0],[40,0]],level=1,durations=[-1,2147483647]),fail=-1,mutate_at=-1,mask=1,value=True,values=[0,1,3,2]);f.update(kw);return f + for mode in modes: + for flags in [0,1,2,3,127,128,254,255]: + for item in range(3): + for held in range(3): + for client in [False,True]: + yield row(mode,flags=flags,initial=state(item=item,slots=[[0,held],[40,held]],clients=[client,client])) + for mutate in range(-1,15): + for fail in range(-1,15):yield row(mode,mutate_at=mutate,fail=fail) + for flags in range(256): + for mask in [-2147483648,-1,0,1,2,3,128,256,2147483647]: + for value in [False,True]:yield row('flag',flags=flags,mask=mask,value=value,initial=state(item=2,clients=[True,True])) + for count in ints: + for remaining in ints: + for value in [0,1,2,3]:yield row('assign',values=[value,value],initial=state(counts=[count,count,count],remaining=remaining,clients=[True,True])) + rng=random.Random(0x555345464c4147) + def random_state():return state(item=rng.randrange(3),remaining=rng.choice(ints),virtual_remaining=rng.choice(ints),kinetic=bool(rng.randrange(2)),selected=rng.randrange(9),counts=[rng.choice(ints) for _ in range(3)],slots=[[i,rng.randrange(3)] for i in rng.sample(range(43),rng.randrange(12))],level=rng.randrange(2),clients=[bool(rng.randrange(2)),bool(rng.randrange(2))],releases=[bool(rng.randrange(2)),bool(rng.randrange(2))],finishes=[rng.randrange(3),rng.randrange(3)],durations=[rng.choice(ints),rng.choice(ints)]) + for _ in range(4500):yield row(rng.choice(modes),argument=rng.randrange(3),flags=rng.randrange(256),shared_type=bool(rng.randrange(2)),vibrations=[bool(rng.randrange(2)),bool(rng.randrange(2))],initial=random_state(),after=random_state(),fail=rng.choice([-1,-1,*range(15)]),mutate_at=rng.randrange(-1,15),mask=rng.randrange(-2147483648,2147483648),value=bool(rng.randrange(2)),values=[rng.randrange(256) for __ in range(rng.randrange(6))]) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-use-flag-reaction-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaUseFlagReactionOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/use_flag_reaction_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaUseFlagReactionOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','use_flag_reaction_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('use_flag_reaction_fixture.exe' if os.name=='nt' else 'use_flag_reaction_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} use flag reaction output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual inherited LivingEntity synchronized-use-flag observer reaction, composed with Inventory/PlayerEquipment, shared stacks and SynchedEntityData writes/assignments. Client reactions initialize a newly active held stack and duration or clear an existing active stack; server reactions leave active use untouched. Includes ordinary use tick/completion/release/stop, same-value received updates, duration callbacks, dirty packing, mutations and failure prefixes. Other synchronized keys, start-use packet flow, full equip/item effects and complete gameplay integration remain pending.'} + lab.write_json(report_path,report);print(f'Scoped use flag reaction parity passed: {report_path}') + + +if __name__=='__main__':main() From 1ff987590ce1974172519dbff2f028e09c0c0e4b Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 08:43:08 +0200 Subject: [PATCH 145/253] Integrate start-use with inventory, synchronized flags and equipment flow --- .../scoped-parity.json | 279 +++++++++++ .../examples/inventory_use_start_fixture.rs | 436 ++++++++++++++++++ crates/horizon-world/src/inventory_use.rs | 100 ++++ docs/collision-geometry.md | 15 + .../VanillaInventoryUseStartOracle.java | 42 ++ tools/test_inventory_use_start_parity.py | 71 +++ 6 files changed, 943 insertions(+) create mode 100644 benchmarks/rust-inventory-use-start-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/inventory_use_start_fixture.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaInventoryUseStartOracle.java create mode 100644 tools/test_inventory_use_start_parity.py diff --git a/benchmarks/rust-inventory-use-start-2026-10-07/scoped-parity.json b/benchmarks/rust-inventory-use-start-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..16e35f18c --- /dev/null +++ b/benchmarks/rust-inventory-use-start-2026-10-07/scoped-parity.json @@ -0,0 +1,279 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 9506, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaInventoryUseStartOracle.java": "e88d7949b4a6c67dc5a9ad3ad7ff3f59e5de418867339186f3f711ea33002e08", + "tools/test_inventory_use_start_parity.py": "64537b0a44f6fe390a19313d08e59314a3565fa2f01187cfa6ce722adb278538", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "6884c7209f007ab9ee742b9c3c73828cfa1c6753d35b5fe25a87cab5955b33f8", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "18bbad377a8047e4d4ecd0fc87d83d46d1c0f1ce2b8c47bbe64633e7b4420b57", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/blocking_item_damage.rs": "afea3cb5761e8b82ee4d9bb4ef3c6fd10182a324dbaec99e6c9ebfac255dda09", + "crates/horizon-world/src/blocking_rules.rs": "83c5e2105cec56a90182ce582e1c67ade2b189be6de1a34d08035000cc07c492", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/component_durability.rs": "37a46e184f95bc5027e2b9af72ff52f729ad03601d08e1827f181fca383a35af", + "crates/horizon-world/src/component_patch.rs": "3622244ccdee46e13956c64ffe9be6234e686adf58dbc3a24cece0f1814301a1", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_immunity.rs": "fd39c41124d694e755cf7faadcf93c636df4042c78ec345092a856b5f952dbcf", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/damage_source.rs": "24945e397a926d34695652980923609e4723e02fe6b6e56d4aaf673e45d759f7", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/inventory_pickup.rs": "ea830c7916e7f2d95c6db7ef48be1e876e6ebafcb438e47fc72f9a5bd7c37d07", + "crates/horizon-world/src/inventory_tick.rs": "293a3d57a1689337cfd58e5a73dcdbed4cb360f94d98ff5458f0df92de387365", + "crates/horizon-world/src/inventory_use.rs": "6a6c2ecc73c83dda4cd798c0304df12ace6096eb110d899f4f0c7ffd852bf001", + "crates/horizon-world/src/item_blocking.rs": "f6eee0d6d177cc3148960122327ba1b459a2f0e85241c1d9a3e40f0b8c169296", + "crates/horizon-world/src/item_durability.rs": "9fdf835e5c7bd0e1dd63ef2ba0076b770cdd4d6d14cdcd11de27690f0702f94e", + "crates/horizon-world/src/item_stack_refs.rs": "18d3ca85cac0daf59200857513761359e5690f719cb3f7f64ae552f0c4169ea3", + "crates/horizon-world/src/item_stack_storage.rs": "b4dcb83dcaa346848c5484161feb3e2cf08e83f7793d7ed83be25b14b9d12884", + "crates/horizon-world/src/item_use.rs": "b1c79428986efbf9dd5ede703a39eb387fb6dcc7d9950f0e49243a353a5b8070", + "crates/horizon-world/src/item_use_catalog.rs": "a9b53d2e816583239a75c3c61e78dacc5e3b27dee595be34b1c7fa169f17a571", + "crates/horizon-world/src/item_use_lifecycle.rs": "4639b70440cf811e79de09c48a3e035143fcb6be8a64c2f61b10ae55a2f133b7", + "crates/horizon-world/src/item_use_start.rs": "a84092dfb8b8f0a89d0928bb2f8ac252bd9bfd3f8d74fce1a7f7a5b3c3f4f50b", + "crates/horizon-world/src/lib.rs": "f0328adcaf4f61835ab48344be73941c65927c3f08c0adb0012a8abef7cb730b", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "2b448209629b9bf2e678d667ad0d6c7fa22146892dd106b169d96b31b0df12bb", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_hurt.rs": "844239ad7d15c39629bb3cfc06ebae6d1cff20b7627468f26e0ee8dff3abdcb8", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/living_use_flags.rs": "826f4fdeba7e208368cbbf910fa408db0afbc6442d842d178a70fae53e0d0ea6", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_equipment.rs": "1fa8c53e67624c4641246249d79a800a28a4858c62482bd880b4e3b866b936ef", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_hurt.rs": "99c9bbd8587ec2dc287806049897b8034d2f5349ad47fc497b70d54148844a36", + "crates/horizon-world/src/player_inventory.rs": "f4f67d8312793f25930626c4ac06db688fcf2e2292d6675071d105fb1708d952", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/server_player_combat.rs": "a9743971581af86d926eeba42004d932caf83382c470dd98bf613cb9c417db58", + "crates/horizon-world/src/server_player_damage.rs": "828a4649fec3e9bda2dfe20aced8c95922c697321de2be4127bd4e5712ecbb7c", + "crates/horizon-world/src/simple_container.rs": "0fedbc7e974b1db79b88bd6aff977654189a5d553cf42852fe8bf0885cf90b30", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "0152f2752bafaf68769d56dbc88494a976496a680c6b113d6b48a446158ba072", + "crates/horizon-world/src/synced_values.rs": "adffa15026497d6671ffd12e5e17df9329c93f0e022700cdfebb80ab494382ae", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/view_direction.rs": "e18120ae26dc5cf702b29fc4c8487088bab133c8ce5abce01226833fafb0d5a4", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "74e4110fb19c4c4047192fd65c38015b8afc7f9fc50404d75380b5063808148c", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/inventory_use_start_fixture.rs": "68b5bdf071b7238999cd58981f2789e84e05bb67cbdb2fba8cfc8eba2fa60721" + }, + "fixtures_sha256": { + ".local/rust-inventory-use-start-parity/inputs.txt": "30dcb1de98fa473de4f6be5652dd7b63d29159606351fb209cb1b91bb6e4d6e8" + }, + "rust_output_sha256": "d0ac036e8f86d181e67f6202ec6eb906e685fe4a879dea78e84a5e73dab2b4fb", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "d0ac036e8f86d181e67f6202ec6eb906e685fe4a879dea78e84a5e73dab2b4fb", + "matched_output_lines": 223004 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "d0ac036e8f86d181e67f6202ec6eb906e685fe4a879dea78e84a5e73dab2b4fb", + "matched_output_lines": 223004 + } + ], + "scope": "Actual LivingEntity.startUsingItem composed with real Inventory/PlayerEquipment, synchronized flag storage and inherited observer reactions. Native ClientboundSetEquipmentPacket construction reaches a controlled ServerChunkCache sender; item/level/ID callbacks expose captured arguments and mutation/failure prefixes. Includes start vibration and clearing a populated kinetic-enemy map. Rust binds the existing start algorithm to inventory use services and shared stack references. Packet encoding/delivery, complete enemy-map/kinetic combat, full item/equip effects and complete gameplay integration remain pending." +} diff --git a/crates/horizon-world/examples/inventory_use_start_fixture.rs b/crates/horizon-world/examples/inventory_use_start_fixture.rs new file mode 100644 index 000000000..f887e5688 --- /dev/null +++ b/crates/horizon-world/examples/inventory_use_start_fixture.rs @@ -0,0 +1,436 @@ +use horizon_world::{ + component_patch::Prototype, + inventory_use::{ + ActiveStack, DurationServices, InventoryUse, StartServices, UseServices, UseView, + flags_updated, + }, + item_stack_refs::{ItemStacks, StackRef}, + item_use_lifecycle::{self, UseState}, + living_use_flags, + player_equipment::InteractionHand, + player_inventory::{EntityEquipment, EquipmentSlot, PlayerInventory}, + synced_values::{DataValue, SyncedValues}, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +type Stack = StackRef; +type State = ActiveStack; +type View<'a> = UseView<'a, usize, u8, bool>; +fn n(v: &Value, k: &str) -> i32 { + v[k].as_i64().unwrap() as i32 +} +struct Services { + f: Value, + out: io::BufWriter, + calls: i32, + changed: bool, + kinetic_count: i32, + items: [Stack; 3], +} +impl Services { + fn config(&self) -> &Value { + &self.f[if self.changed { "after" } else { "initial" }] + } + fn id(&self, s: &Stack) -> usize { + self.items.iter().position(|v| v.same_reference(s)).unwrap() + } + fn reset(&mut self, view: View<'_>, state: &mut State) { + let c = self.config(); + state.item = self.items[n(c, "item") as usize].clone(); + state.remaining = n(c, "remaining"); + state.has_recent_kinetic_enemies = c["kinetic"].as_bool().unwrap(); + for i in 0..3 { + self.items[i].write().count = c["counts"][i].as_i64().unwrap() as i32; + } + view.inventory.clear(); + view.inventory.set_selected(n(c, "selected")).unwrap(); + for p in c["slots"].as_array().unwrap() { + view.inventory + .set( + p[0].as_i64().unwrap() as i32, + self.items[p[1].as_u64().unwrap() as usize].clone(), + ) + .unwrap(); + } + self.kinetic_count = if state.has_recent_kinetic_enemies { + 1 + } else { + -1 + }; + } + fn all(&mut self, view: &View<'_>, state: &State) -> io::Result<()> { + writeln!( + self.out, + "state {} {} {} {} {} {} {} {} {} {} {} {}", + self.id(&state.item), + state.remaining, + state.has_recent_kinetic_enemies, + living_use_flags::using_item(view.flags).unwrap(), + match living_use_flags::used_hand(view.flags).unwrap() { + InteractionHand::Main => 0, + InteractionHand::Off => 1, + }, + view.flags.get(8).unwrap(), + view.flags.is_dirty(), + view.flags.item_dirty(8).unwrap(), + view.inventory.selected(), + self.calls, + self.changed, + if state.has_recent_kinetic_enemies { + self.kinetic_count + } else { + -1 + } + )?; + writeln!( + self.out, + "counts {} {} {}", + self.items[0].read().count, + self.items[1].read().count, + self.items[2].read().count + )?; + let slots = (0..43) + .map(|i| self.id(&view.inventory.get(i).unwrap()).to_string()) + .collect::>() + .join(","); + writeln!(self.out, "slots {slots}")?; + let eq = view + .inventory + .equipment() + .entries() + .iter() + .map(|(slot, s)| format!("{}={}", *slot as usize, self.id(s))) + .collect::>() + .join(","); + writeln!(self.out, "equipment {eq}")?; + Ok(()) + } + fn event(&mut self, view: View<'_>, state: &mut State, name: &str) -> io::Result<()> { + writeln!(self.out, "{name}")?; + let index = self.calls; + self.calls += 1; + self.all(&view, state)?; + if index == n(&self.f, "fail") { + return Err(io::Error::other("injected callback failure")); + } + if index == n(&self.f, "mutate_at") { + self.changed = true; + self.reset(view, state); + } + Ok(()) + } +} +impl UseServices for Services { + type Error = io::Error; + type Level = usize; + fn level(&mut self, view: View<'_>, state: &mut State) -> io::Result { + self.event(view, state, "level")?; + Ok(n(self.config(), "level") as usize) + } + fn is_client(&mut self, view: View<'_>, state: &mut State, level: usize) -> io::Result { + self.event(view, state, &format!("client {level}"))?; + Ok(self.config()["clients"][level].as_bool().unwrap()) + } + fn remaining_ticks(&mut self, view: View<'_>, state: &mut State) -> io::Result { + self.event(view, state, "remaining")?; + Ok(n(self.config(), "virtual_remaining")) + } + fn item_tick( + &mut self, + view: View<'_>, + state: &mut State, + item: Stack, + level: usize, + remaining: i32, + ) -> io::Result<()> { + let kind = item.read().item(); + if kind != 2 { + self.event( + view, + state, + &format!("tick {kind} {} {level} {remaining}", self.id(&item)), + )?; + } + Ok(()) + } + fn use_on_release( + &mut self, + view: View<'_>, + state: &mut State, + item: Stack, + ) -> io::Result { + let kind = item.read().item(); + if kind == 2 { + return Ok(false); + } + self.event( + view, + state, + &format!("release-query {kind} {}", self.id(&item)), + )?; + Ok(self.config()["releases"][kind].as_bool().unwrap()) + } + fn release_item( + &mut self, + view: View<'_>, + state: &mut State, + item: Stack, + level: usize, + remaining: i32, + ) -> io::Result<()> { + let kind = item.read().item(); + if kind != 2 { + self.event( + view, + state, + &format!("release {kind} {} {level} {remaining}", self.id(&item)), + )?; + } + Ok(()) + } + fn finish_item( + &mut self, + view: View<'_>, + state: &mut State, + item: Stack, + level: usize, + ) -> io::Result { + let kind = item.read().item(); + if kind == 2 { + return Ok(item); + } + self.event( + view, + state, + &format!("finish {kind} {} {level}", self.id(&item)), + )?; + Ok(self.items[self.config()["finishes"][kind].as_u64().unwrap() as usize].clone()) + } + fn finish_vibration( + &mut self, + view: View<'_>, + state: &mut State, + item: Stack, + ) -> io::Result<()> { + if item.read().component(&0).copied().unwrap_or(false) { + self.event(view, state, "vibration")?; + } + Ok(()) + } + fn on_equip( + &mut self, + view: View<'_>, + state: &mut State, + slot: EquipmentSlot, + old: Stack, + new: Stack, + ) -> io::Result<()> { + self.event( + view, + state, + &format!( + "equip {} {} {}", + slot as usize, + self.id(&old), + self.id(&new) + ), + ) + } + fn on_synced(&mut self, mut view: View<'_>, state: &mut State, id: u8) -> io::Result<()> { + self.event(view.reborrow(), state, &format!("synced {id}"))?; + flags_updated(self, view, state) + } +} +impl DurationServices for Services { + fn duration(&mut self, view: View<'_>, state: &mut State, item: Stack) -> io::Result { + let kind = item.read().item(); + if kind == 2 { + return Ok(0); + } + self.event(view, state, &format!("duration {kind} {}", self.id(&item)))?; + Ok(self.config()["durations"][kind].as_i64().unwrap() as i32) + } +} +impl StartServices for Services { + fn synchronize_equipment( + &mut self, + mut view: View<'_>, + state: &mut State, + level: usize, + hand: InteractionHand, + item: Stack, + ) -> io::Result<()> { + self.event(view.reborrow(), state, &format!("chunks {level}"))?; + self.event(view.reborrow(), state, "id")?; + self.event( + view, + state, + &format!( + "equipment {level} {} {} 17", + if hand == InteractionHand::Main { 0 } else { 1 }, + self.id(&item) + ), + ) + } + fn start_vibration( + &mut self, + view: View<'_>, + state: &mut State, + item: Stack, + ) -> io::Result<()> { + if item.read().component(&0).copied().unwrap_or(false) { + self.event(view, state, "vibration-start")?; + } + Ok(()) + } + fn has_kinetic_weapon(&self, item: &Stack) -> bool { + item.read().component(&1).copied().unwrap_or(false) + } + fn reset_recent_kinetic_enemies(&mut self, _view: View<'_>, state: &mut State) { + state.has_recent_kinetic_enemies = true; + self.kinetic_count = 0; + } +} +fn main() -> Result<(), Box> { + let arg = std::env::args().nth(1).unwrap(); + let dir = Path::new(&arg); + let mut out = io::BufWriter::new(fs::File::create(dir.join("rust.txt"))?); + for line in fs::read_to_string(dir.join("inputs.txt"))?.lines() { + let f: Value = serde_json::from_str(line)?; + let stacks = ItemStacks::new(2); + let items = [ + stacks.create(0, 1, Prototype::new([])), + stacks.create( + if f["shared_type"].as_bool().unwrap() { + 0 + } else { + 1 + }, + 1, + Prototype::new([]), + ), + stacks.empty(), + ]; + for i in 0..2 { + if f["vibrations"][i].as_bool().unwrap() { + items[i].write().components.set(0, Some(true)).unwrap(); + } + } + for i in 0..2 { + if f["kinetic_items"][i].as_bool().unwrap() { + items[i].write().components.set(1, Some(true)).unwrap(); + } + } + let mut state = UseState { + item: items[2].clone(), + remaining: 0, + has_recent_kinetic_enemies: false, + }; + let inventory = PlayerInventory::new(stacks.clone(), EntityEquipment::new(stacks.empty())); + let flags = SyncedValues::new(&[DataValue { + id: 8, + value: n(&f, "flags") as u8, + }])?; + let services = Services { + f: f.clone(), + out, + calls: 0, + changed: false, + kinetic_count: -1, + items, + }; + let mut world = InventoryUse::new(inventory, flags, services).unwrap(); + world.services.reset( + UseView { + inventory: &mut world.inventory, + flags: &mut world.flags, + }, + &mut state, + ); + world.services.all( + &UseView { + inventory: &mut world.inventory, + flags: &mut world.flags, + }, + &state, + )?; + let result = match f["mode"].as_str().unwrap() { + "start" => horizon_world::item_use_start::start( + &mut world, + &mut state, + if n(&f, "start_hand") == 0 { + InteractionHand::Main + } else { + InteractionHand::Off + }, + ), + "notify" => world.services.on_synced( + UseView { + inventory: &mut world.inventory, + flags: &mut world.flags, + }, + &mut state, + 8, + ), + "flag" => world + .set_flag(&mut state, n(&f, "mask"), f["value"].as_bool().unwrap()) + .map_err(io::Error::other), + "assign" => { + let values: Vec<_> = f["values"] + .as_array() + .unwrap() + .iter() + .map(|v| DataValue { + id: 8, + value: v.as_u64().unwrap() as u8, + }) + .collect(); + world + .assign_flags(&mut state, &values) + .map_err(io::Error::other) + } + "tick" => item_use_lifecycle::tick(&mut world, &mut state), + "update" => { + let item = world.services.items[n(&f, "argument") as usize].clone(); + item_use_lifecycle::update(&mut world, &mut state, item) + } + "complete" => item_use_lifecycle::complete(&mut world, &mut state), + "release" => item_use_lifecycle::release(&mut world, &mut state), + "stop" => item_use_lifecycle::stop(&mut world, &mut state), + _ => panic!("mode"), + }; + writeln!( + world.services.out, + "result {}", + if result.is_ok() { "ok" } else { "error" } + )?; + world.services.all( + &UseView { + inventory: &mut world.inventory, + flags: &mut world.flags, + }, + &state, + )?; + let packed = world.flags.take_dirty().map_or("none".into(), |values| { + values + .iter() + .map(|v| format!("{}:{}", v.id, v.value)) + .collect::>() + .join(",") + }); + writeln!(world.services.out, "packed {packed}")?; + world.services.all( + &UseView { + inventory: &mut world.inventory, + flags: &mut world.flags, + }, + &state, + )?; + out = world.services.out; + } + Ok(()) +} diff --git a/crates/horizon-world/src/inventory_use.rs b/crates/horizon-world/src/inventory_use.rs index 268012d73..d37ea341a 100644 --- a/crates/horizon-world/src/inventory_use.rs +++ b/crates/horizon-world/src/inventory_use.rs @@ -383,3 +383,103 @@ impl> living_use_flags::set_flag(&mut self.flags, mask, value, &mut observer) } } + +/// Services needed by startUsingItem in addition to the stored lifecycle. +pub trait StartServices: DurationServices { + fn synchronize_equipment( + &mut self, + view: UseView<'_, I, K, V>, + state: &mut ActiveStack, + level: Self::Level, + hand: InteractionHand, + item: StackRef, + ) -> Result<(), Self::Error>; + fn start_vibration( + &mut self, + view: UseView<'_, I, K, V>, + state: &mut ActiveStack, + item: StackRef, + ) -> Result<(), Self::Error>; + fn has_kinetic_weapon(&self, item: &StackRef) -> bool; + /// The caller owns the actual enemy map. Reset it at this native point. + fn reset_recent_kinetic_enemies( + &mut self, + view: UseView<'_, I, K, V>, + state: &mut ActiveStack, + ); +} +impl> + crate::item_use_start::StartUseWorld for InventoryUse +{ + fn duration( + &mut self, + state: &mut ActiveStack, + item: StackRef, + ) -> Result { + self.services.duration( + UseView { + inventory: &mut self.inventory, + flags: &mut self.flags, + }, + state, + item, + ) + } + fn synchronize_equipment( + &mut self, + state: &mut ActiveStack, + level: Self::Level, + hand: InteractionHand, + item: StackRef, + ) -> Result<(), Self::Error> { + self.services.synchronize_equipment( + UseView { + inventory: &mut self.inventory, + flags: &mut self.flags, + }, + state, + level, + hand, + item, + ) + } + fn is_off_hand(&self, hand: InteractionHand) -> bool { + hand == InteractionHand::Off + } + fn set_off_hand_flag( + &mut self, + state: &mut ActiveStack, + off: bool, + ) -> Result<(), Self::Error> { + self.set_flag(state, 2, off).map_err(|error| match error { + DataError::Observer(e) => e, + DataError::UnknownId(_) => unreachable!("validated flags"), + }) + } + fn start_vibration( + &mut self, + state: &mut ActiveStack, + item: StackRef, + ) -> Result<(), Self::Error> { + self.services.start_vibration( + UseView { + inventory: &mut self.inventory, + flags: &mut self.flags, + }, + state, + item, + ) + } + fn has_kinetic_weapon(&self, item: StackRef) -> bool { + self.services.has_kinetic_weapon(&item) + } + fn reset_recent_kinetic_enemies(&mut self, state: &mut ActiveStack) { + self.services.reset_recent_kinetic_enemies( + UseView { + inventory: &mut self.inventory, + flags: &mut self.flags, + }, + state, + ) + } +} diff --git a/docs/collision-geometry.md b/docs/collision-geometry.md index b3c3947f3..fbc4d8b10 100644 --- a/docs/collision-geometry.md +++ b/docs/collision-geometry.md @@ -1799,3 +1799,18 @@ selection/count mutations and failures before dirty marking. Ordinary lifecycle operations are also exercised with the real observer reaction. Targeted Clippy passes. Other synchronized keys, start-use packet flow, full item/equip effects and complete gameplay integration remain pending. + + +`inventory_use` now binds start-use to stored inventory, shared active stacks +and synchronized flag reactions. Server equipment synchronization precedes flag +writes, followed by start vibration and the kinetic-enemy reset service. Captured +stack/hand arguments and live state reads retain native callback ordering. + +`python3 tools/test_inventory_use_start_parity.py` exercises inherited native +start-use with actual Inventory, PlayerEquipment and synchronized storage. The +[start report](../benchmarks/rust-inventory-use-start-2026-10-07/scoped-parity.json) +records **9,506 fixtures and 223,004 matching lines per JAR**, including native +equipment packet construction, observer reactions, callback mutations/failures +and clearing a populated kinetic-enemy map. Targeted Clippy passes. Packet +encoding/delivery, the full kinetic-enemy map and combat, complete item/equip +effects and full gameplay integration remain pending. diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaInventoryUseStartOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaInventoryUseStartOracle.java new file mode 100644 index 000000000..8a8478e69 --- /dev/null +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaInventoryUseStartOracle.java @@ -0,0 +1,42 @@ +package dev.horizonlab.parity; +import com.google.gson.*;import java.io.*;import java.lang.reflect.*;import java.nio.file.*;import java.util.*; +import net.minecraft.core.*;import net.minecraft.core.component.*;import net.minecraft.world.entity.*;import net.minecraft.world.entity.player.*;import net.minecraft.world.item.*;import net.minecraft.world.level.*;import net.minecraft.world.level.gameevent.GameEvent;import net.minecraft.server.level.*;import net.minecraft.network.syncher.*; +/** Native use lifecycle with actual Inventory, PlayerEquipment and synchronized flags. */ +public final class VanillaInventoryUseStartOracle { + static final class Stop extends RuntimeException {} + static Object unsafe;static Method allocate;static Field useItem,remaining,kinetic,count,eqItems; + static T make(Class c)throws Exception{return c.cast(allocate.invoke(unsafe,c));} + static Field field(Class c,String n)throws Exception{var f=c.getDeclaredField(n);f.setAccessible(true);return f;} + static int n(JsonObject o,String k){return o.get(k).getAsInt();} + static final class Data { + JsonObject f;PrintWriter out;int calls;boolean changed;Entity enemy;Chunks[] chunks;Actor actor;ItemStack[] items;Server[] levels;Inventory inv;PlayerEquipment equipment;SynchedEntityData data;SynchedEntityData.DataItem flags; + JsonObject state(){return f.getAsJsonObject(changed?"after":"initial");} + int id(ItemStack s){for(int i=0;i():null);if(kinetic.get(actor)!=null)((it.unimi.dsi.fastutil.objects.Object2LongMap)kinetic.get(actor)).put(enemy,99L);for(int i=0;i<3;i++)items[i].setCount(s.getAsJsonArray("counts").get(i).getAsInt());inv.clearContent();inv.setSelectedSlot(n(s,"selected"));for(var e:s.getAsJsonArray("slots")){var p=e.getAsJsonArray();inv.setItem(p.get(0).getAsInt(),items[p.get(1).getAsInt()]);}}catch(Exception e){throw new AssertionError(e);}} + void all(){try{out.println("state "+id((ItemStack)useItem.get(actor))+" "+remaining.getInt(actor)+" "+(kinetic.get(actor)!=null)+" "+actor.isUsingItem()+" "+actor.getUsedItemHand().ordinal()+" "+Byte.toUnsignedInt(flags.getValue())+" "+data.isDirty()+" "+flags.isDirty()+" "+inv.getSelectedSlot()+" "+calls+" "+changed+" "+(kinetic.get(actor)==null?-1:((it.unimi.dsi.fastutil.objects.Object2LongMap)kinetic.get(actor)).size()));out.println("counts "+count.getInt(items[0])+" "+count.getInt(items[1])+" "+count.getInt(items[2]));var slots=new StringJoiner(",");for(int i=0;i<43;i++)slots.add(Integer.toString(id(inv.getItem(i))));out.println("slots "+slots);var eq=new StringJoiner(",");for(var e:((EnumMap)eqItems.get(equipment)).entrySet())eq.add(e.getKey().ordinal()+"="+id(e.getValue()));out.println("equipment "+eq);}catch(Exception e){throw new AssertionError(e);}} + void event(String name){out.println(name);int index=calls++;all();if(index==n(f,"fail"))throw new Stop();if(index==n(f,"mutate_at")){changed=true;reset();}} + } + static final class Chunks extends ServerChunkCache {Data d;int id;Chunks(){super(null,null,null,null,null,null,0,0,false,null);}@Override public void sendToTrackingPlayers(Entity e,net.minecraft.network.protocol.Packet packet){var p=(net.minecraft.network.protocol.game.ClientboundSetEquipmentPacket)packet;var entry=p.getSlots().getFirst();d.event("equipment "+id+" "+(entry.getFirst()==EquipmentSlot.MAINHAND?0:1)+" "+d.id(entry.getSecond())+" "+p.getEntity());}} + static final class Server extends ServerLevel {Data d;int id;Server(){super(null,null,null,null,null,null,false,0L,List.of(),false);}@Override public ServerChunkCache getChunkSource(){d.event("chunks "+id);return d.chunks[id];}@Override public boolean isClientSide(){d.event("client "+id);return d.state().getAsJsonArray("clients").get(id).getAsBoolean();}} + static final class CustomItem extends Item {Data d;int id;CustomItem(){super(null);} + @Override public int getUseDuration(ItemStack stack,LivingEntity actor){d.event("duration "+id+" "+d.id(stack));return d.state().getAsJsonArray("durations").get(id).getAsInt();} + @Override public void onUseTick(Level l,LivingEntity a,ItemStack s,int ticks){d.event("tick "+id+" "+d.id(s)+" "+((Server)l).id+" "+ticks);} + @Override public boolean useOnRelease(ItemStack s){d.event("release-query "+id+" "+d.id(s));return d.state().getAsJsonArray("releases").get(id).getAsBoolean();} + @Override public boolean releaseUsing(ItemStack s,Level l,LivingEntity a,int ticks){d.event("release "+id+" "+d.id(s)+" "+((Server)l).id+" "+ticks);return false;} + @Override public ItemStack finishUsingItem(ItemStack s,Level l,LivingEntity a){d.event("finish "+id+" "+d.id(s)+" "+((Server)l).id);return d.items[d.state().getAsJsonArray("finishes").get(id).getAsInt()];} + } + static final class Actor extends Player {Data d;Actor(){super(null,null);}@Override public int getId(){d.event("id");return 17;}@Override public GameType gameMode(){return GameType.SURVIVAL;}@Override public boolean isSpectator(){return false;}@Override public boolean isCreative(){return false;} + @Override public ServerLevel level(){d.event("level");return d.levels[n(d.state(),"level")];} + @Override public int getUseItemRemainingTicks(){d.event("remaining");return n(d.state(),"virtual_remaining");} + @Override public void onEquipItem(EquipmentSlot slot,ItemStack old,ItemStack next){d.event("equip "+slot.ordinal()+" "+d.id(old)+" "+d.id(next));} + @Override public void onSyncedDataUpdated(EntityDataAccessor key){d.event("synced "+key.id());super.onSyncedDataUpdated(key);} + @Override public void gameEvent(Holder event){if(event==GameEvent.ITEM_INTERACT_START)d.event("vibration-start");else if(event==GameEvent.ITEM_INTERACT_FINISH)d.event("vibration");else throw new AssertionError();} + void flag(int mask,boolean value){super.setLivingEntityFlag(mask,value);}void update(ItemStack s){super.updateUsingItem(s);}void complete(){super.completeUsingItem();} + } + @SuppressWarnings("unchecked")public static void main(String[] args)throws Exception { + net.minecraft.SharedConstants.tryDetectVersion();net.minecraft.server.Bootstrap.bootStrap();Items.AIR.builtInRegistryHolder().bindComponents(DataComponentMap.EMPTY);var u=Class.forName("sun.misc.Unsafe");unsafe=field(u,"theUnsafe").get(null);allocate=u.getMethod("allocateInstance",Class.class);useItem=field(LivingEntity.class,"useItem");remaining=field(LivingEntity.class,"useItemRemaining");kinetic=field(LivingEntity.class,"recentKineticEnemies");count=field(ItemStack.class,"count");eqItems=field(EntityEquipment.class,"items");var invField=field(Player.class,"inventory");var equipmentField=field(LivingEntity.class,"equipment");var dataField=field(Entity.class,"entityData");var flagKey=(EntityDataAccessor)field(LivingEntity.class,"DATA_LIVING_ENTITY_FLAGS").get(null);if(flagKey.id()!=8)throw new AssertionError();var dataCtor=SynchedEntityData.class.getDeclaredConstructor(SyncedDataHolder.class,SynchedEntityData.DataItem[].class);dataCtor.setAccessible(true);var tick=LivingEntity.class.getDeclaredMethod("updatingUsingItem");tick.setAccessible(true);var ctor=ItemStack.class.getDeclaredConstructor(Holder.class,int.class,PatchedDataComponentMap.class);ctor.setAccessible(true);Path dir=Path.of(args[1]); + try(var out=new PrintWriter(Files.newBufferedWriter(dir.resolve(args[0]+".txt")));var lines=Files.lines(dir.resolve("inputs.txt"))){for(var line:(Iterable)lines::iterator){var d=new Data();d.f=JsonParser.parseString(line).getAsJsonObject();d.out=out;d.enemy=make(net.minecraft.world.entity.decoration.ArmorStand.class);d.enemy.setId(99);d.actor=make(Actor.class);d.actor.d=d;d.chunks=new Chunks[]{make(Chunks.class),make(Chunks.class)};for(int i=0;i<2;i++){d.chunks[i].d=d;d.chunks[i].id=i;}d.levels=new Server[]{make(Server.class),make(Server.class)};for(int i=0;i<2;i++){d.levels[i].d=d;d.levels[i].id=i;}var first=make(CustomItem.class);first.d=d;first.id=0;var second=make(CustomItem.class);second.d=d;second.id=1;d.items=new ItemStack[]{ctor.newInstance(Holder.direct(first),1,new PatchedDataComponentMap(DataComponentMap.EMPTY)),ctor.newInstance(Holder.direct(d.f.get("shared_type").getAsBoolean()?first:second),1,new PatchedDataComponentMap(DataComponentMap.EMPTY)),ItemStack.EMPTY};ItemStack.EMPTY.setCount(0);ItemStack.EMPTY.setPopTime(0);for(int i=0;i<2;i++)if(d.f.getAsJsonArray("vibrations").get(i).getAsBoolean())d.items[i].set(DataComponents.USE_EFFECTS,new net.minecraft.world.item.component.UseEffects(false,true,1));for(int i=0;i<2;i++)if(d.f.getAsJsonArray("kinetic_items").get(i).getAsBoolean())d.items[i].set(DataComponents.KINETIC_WEAPON,new net.minecraft.world.item.component.KineticWeapon(0,0,Optional.empty(),Optional.empty(),Optional.empty(),0,0,Optional.empty(),Optional.empty()));d.equipment=new PlayerEquipment(d.actor);d.inv=new Inventory(d.actor,d.equipment);invField.set(d.actor,d.inv);equipmentField.set(d.actor,d.equipment);var entries=new SynchedEntityData.DataItem[9];for(int i=0;i<9;i++)entries[i]=new SynchedEntityData.DataItem(new EntityDataAccessor(i,EntityDataSerializers.BYTE),(byte)0);d.flags=new SynchedEntityData.DataItem(flagKey,(byte)n(d.f,"flags"));entries[8]=d.flags;d.data=dataCtor.newInstance(d.actor,entries);dataField.set(d.actor,d.data);d.reset();d.all(); + try{switch(d.f.get("mode").getAsString()){case "start":d.actor.startUsingItem(net.minecraft.world.InteractionHand.values()[n(d.f,"start_hand")]);break;case "notify":d.actor.onSyncedDataUpdated(flagKey);break;case "flag":d.actor.flag(n(d.f,"mask"),d.f.get("value").getAsBoolean());break;case "assign":var values=new ArrayList>();for(var value:d.f.getAsJsonArray("values"))values.add(new SynchedEntityData.DataValue(8,EntityDataSerializers.BYTE,(byte)value.getAsInt()));d.data.assignValues(values);break;case "tick":try{tick.invoke(d.actor);}catch(InvocationTargetException e){if(e.getCause() instanceof Stop)throw new Stop();throw new AssertionError(e.getCause());}break;case "update":d.actor.update(d.items[n(d.f,"argument")]);break;case "complete":d.actor.complete();break;case "release":d.actor.releaseUsingItem();break;case "stop":d.actor.stopUsingItem();break;default:throw new AssertionError();}out.println("result ok");}catch(Stop e){out.println("result error");}d.all();var packed=d.data.packDirty();out.println("packed "+(packed==null?"none":packed.stream().map(v->v.id()+":"+Byte.toUnsignedInt((Byte)v.value())).collect(java.util.stream.Collectors.joining(","))));d.all(); + }} + } +} diff --git a/tools/test_inventory_use_start_parity.py b/tools/test_inventory_use_start_parity.py new file mode 100644 index 000000000..736c22e95 --- /dev/null +++ b/tools/test_inventory_use_start_parity.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python3 +"""Compare native living item-use tick, release, completion and stop lifecycle.""" +import argparse +import json +import os +from pathlib import Path +import platform +import subprocess +import random +import struct +import math +try: + from . import lab, test_rust_parity as base +except ImportError: + import lab + import test_rust_parity as base + + +def corpus(): + ints=[-2147483648,-1,0,1,2,20,2147483647] + def state(**kw): + s=dict(item=0,remaining=1,virtual_remaining=1,kinetic=True,selected=0,counts=[1,1,0],slots=[[0,0],[8,1],[40,1]],level=0,clients=[False,True],releases=[False,True],finishes=[1,0],durations=[32,72000]);s.update(kw);return s + def row(**kw): + f=dict(mode='start',argument=0,start_hand=0,kinetic_items=[True,True],flags=0,shared_type=False,vibrations=[True,True],initial=state(),after=state(item=1,remaining=0,virtual_remaining=-1,counts=[0,2,0],selected=8,slots=[[0,1],[8,0],[40,0]],level=1,durations=[-1,2147483647]),fail=-1,mutate_at=-1,mask=1,value=True,values=[0,1,3,2]);f.update(kw);return f + for flags in range(256): + for hand in [0,1]: + for selected in [0,1,8]:yield row(flags=flags,start_hand=hand,initial=state(selected=selected)) + for hand in [0,1]: + for held in range(3): + for count in ints: + for duration in ints: + for client in [False,True]:yield row(start_hand=hand,initial=state(counts=[count,count,count],slots=[[0,held],[40,held]],durations=[duration,duration],clients=[client,client])) + for mutate in range(-1,20): + for fail in range(-1,20):yield row(start_hand=hand,mutate_at=mutate,fail=fail) + rng=random.Random(0x494e565553455354) + def random_state():return state(item=rng.randrange(3),remaining=rng.choice(ints),virtual_remaining=rng.choice(ints),kinetic=bool(rng.randrange(2)),selected=rng.randrange(9),counts=[rng.choice(ints) for _ in range(3)],slots=[[i,rng.randrange(3)] for i in rng.sample(range(43),rng.randrange(12))],level=rng.randrange(2),clients=[bool(rng.randrange(2)),bool(rng.randrange(2))],releases=[bool(rng.randrange(2)),bool(rng.randrange(2))],finishes=[rng.randrange(3),rng.randrange(3)],durations=[rng.choice(ints),rng.choice(ints)]) + for _ in range(6500):yield row(start_hand=rng.randrange(2),flags=rng.randrange(256),shared_type=bool(rng.randrange(2)),vibrations=[bool(rng.randrange(2)),bool(rng.randrange(2))],kinetic_items=[bool(rng.randrange(2)),bool(rng.randrange(2))],initial=random_state(),after=random_state(),fail=rng.choice([-1,-1,*range(20)]),mutate_at=rng.randrange(-1,20)) + + +def main(): + parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--prepare',action='store_true');args=parser.parse_args() + build=lab.LOCAL/'rust-inventory-use-start-parity';build.mkdir(parents=True,exist_ok=True) + report_path=build/'report.json';report_path.unlink(missing_ok=True) + if args.prepare:lab.prepare() + lock,jars,libraries=base.verify_artifacts() + oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaInventoryUseStartOracle.java' + sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/inventory_use_start_fixture.rs'] + tested_sources=base.source_hashes(sources) + classes=build/'classes';classes.mkdir(exist_ok=True) + def run(command,name): + with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT) + dependency_path=os.pathsep.join(map(str,libraries)) + run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java') + def java(side,mode,path): + run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaInventoryUseStartOracle',mode,path],side+'-'+mode) + fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8') + fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths) + run(['cargo','build','--release','-p','horizon-world','--example','inventory_use_start_fixture'],'compile-rust') + metadata=json.loads(subprocess.check_output(['cargo','metadata','--no-deps','--format-version','1'],cwd=lab.ROOT,text=True)) + binary=Path(metadata['target_directory'])/'release/examples'/('inventory_use_start_fixture.exe' if os.name=='nt' else 'inventory_use_start_fixture') + run([binary,build],'rust');references=[] + for side,jar in jars.items(): + java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt') + references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched}) + print(f'{side}: {matched:,} inventory use start output lines match Rust',flush=True) + base.ensure_sources_unchanged(sources,tested_sources);base.ensure_sources_unchanged(fixture_paths,tested_fixtures) + report={'schema':1,'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'fixtures':len(fixtures),'sources_sha256':tested_sources,'fixtures_sha256':tested_fixtures,'rust_output_sha256':lab.digest(build/'rust.txt','sha256'),'references':references,'scope':'Actual LivingEntity.startUsingItem composed with real Inventory/PlayerEquipment, synchronized flag storage and inherited observer reactions. Native ClientboundSetEquipmentPacket construction reaches a controlled ServerChunkCache sender; item/level/ID callbacks expose captured arguments and mutation/failure prefixes. Includes start vibration and clearing a populated kinetic-enemy map. Rust binds the existing start algorithm to inventory use services and shared stack references. Packet encoding/delivery, complete enemy-map/kinetic combat, full item/equip effects and complete gameplay integration remain pending.'} + lab.write_json(report_path,report);print(f'Scoped inventory use start parity passed: {report_path}') + + +if __name__=='__main__':main() From 0a582b56d640a9946c346b501fadeb9bf4fb149c Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 7 Oct 2026 08:50:15 +0200 Subject: [PATCH 146/253] Implement item templates and strict scalar stack validation --- .../scoped-parity.json | 280 ++++++++++++++++++ .../examples/item_template_fixture.rs | 237 +++++++++++++++ crates/horizon-world/src/item_template.rs | 188 ++++++++++++ crates/horizon-world/src/lib.rs | 1 + docs/collision-geometry.md | 18 ++ .../parity/VanillaItemTemplateOracle.java | 39 +++ tools/test_item_template_parity.py | 74 +++++ 7 files changed, 837 insertions(+) create mode 100644 benchmarks/rust-item-template-2026-10-07/scoped-parity.json create mode 100644 crates/horizon-world/examples/item_template_fixture.rs create mode 100644 crates/horizon-world/src/item_template.rs create mode 100644 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemTemplateOracle.java create mode 100644 tools/test_item_template_parity.py diff --git a/benchmarks/rust-item-template-2026-10-07/scoped-parity.json b/benchmarks/rust-item-template-2026-10-07/scoped-parity.json new file mode 100644 index 000000000..836a56231 --- /dev/null +++ b/benchmarks/rust-item-template-2026-10-07/scoped-parity.json @@ -0,0 +1,280 @@ +{ + "schema": 1, + "minecraft": "26.3", + "manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3", + "platform": "Linux-7.0.0-31-generic-x86_64-with-glibc2.43", + "java": "openjdk 25.0.4.1 2026-08-18", + "rustc": "rustc 1.99.0 (b940084d7 2026-09-28)", + "fixtures": 3744, + "sources_sha256": { + "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemTemplateOracle.java": "1d40c19f17ee8d666d40737af2301a5e57945626e93bf464682e7218767d34fa", + "tools/test_item_template_parity.py": "945e94f9562e63fdd7d560acf74bf6ada7f6a8ecf35dddb6b12f1bcc39f4e6a5", + "tools/test_rust_parity.py": "29d3db08005873528894b45ca10dcd6278753650473b3eb574e53e06ede40ec6", + "tools/lab.py": "d00bf107fa01b6c579734a082c3ca4ade3018f0d6851d46844acf17574f66e64", + "Cargo.toml": "3f93319c1eb70dbd7ba25cd74ef343fbf35c52c7c4752f955605c58699cbff9d", + "Cargo.lock": "6884c7209f007ab9ee742b9c3c73828cfa1c6753d35b5fe25a87cab5955b33f8", + "crates/horizon-core/Cargo.toml": "e21b502c949da93cf67826592459b687a8cbf737ef92fee514e3ed2cc7cd27ad", + "crates/horizon-world/Cargo.toml": "18bbad377a8047e4d4ecd0fc87d83d46d1c0f1ce2b8c47bbe64633e7b4420b57", + "crates/horizon-core/src/bin/density_parity.rs": "e5b1dd33b7d01306c73cf072629b4fb186e9ab87b672a00108999d1a72263fd0", + "crates/horizon-core/src/bin/float_log_parity.rs": "4a655fcf8822ee7668c4bd126bc84d0b118864a6fc7f5a6aeee667d8bf2590b1", + "crates/horizon-core/src/bin/geometry_parity.rs": "27f6c09fe5018ac3de8e70e0f0bbf78f9abb14f5e4783bcaf46e8ca87b9c6f8a", + "crates/horizon-core/src/bin/noise_parity.rs": "c135bfc708d853e7061e81487d2cfe10de64b2f65677d3b4837cbfe0b8341010", + "crates/horizon-core/src/bin/parity.rs": "f35d928c66f958de39fac5e7e836a657eed95f83599e84899f7ea7a5802ba481", + "crates/horizon-core/src/bin/tick_parity.rs": "a54c164fe4814034d369947a887f5273966f5a878ba849204b80d1c729526a8f", + "crates/horizon-core/src/biome/seed_hash.rs": "5afbb4921c750826b395a08bf06f382fc7f01b5759a93de02a2749c523e2a317", + "crates/horizon-core/src/biome.rs": "908efa8cd4aa0a7adf1cb5e1a222e3dfb640eed5e9172e0fe7f0d1287afae7e8", + "crates/horizon-core/src/carving/ellipsoid.rs": "09232a7588610e8a9176fd9c62d40afb1fb89f2ecab6d555536a1d847b142d86", + "crates/horizon-core/src/carving.rs": "0aa3093caa0437868a8c0ed52a6c6e1993bd51c03583c670a2837e749eae5426", + "crates/horizon-core/src/density/arithmetic.rs": "372faec96c923e2cf4aa6c66c1ac398e676853274557823850dbc8933dd15ab1", + "crates/horizon-core/src/density/beardifier.rs": "bb1052e27dae4a01954ca78d7d5babafef85f3b2c704ccaf1920cb85a098cb50", + "crates/horizon-core/src/density/cache.rs": "38d0b6c9dd04ffef979fdad3f29cfebf98d331c8c9d430be5f39aa34f6c30975", + "crates/horizon-core/src/density/end_islands.rs": "168b9384237bd2e41d0ae5a74e944da4dc74e493bdec31fb73184c9a49e3de55", + "crates/horizon-core/src/density/graph/compiler.rs": "ac67deeb16f16d0859aa20e5a165811a29aca0b910037ee6bf5098211f3a6ede", + "crates/horizon-core/src/density/graph/mod.rs": "b776e7da934cb03051a3053d56d461c71e9978e084922fe4194147aa580c07bf", + "crates/horizon-core/src/density/graph/seeded.rs": "6bcdcaa3dffcfa9df673bbbea35120057a16ba3d2b506c52709c36cf8976b74a", + "crates/horizon-core/src/density/graph/tests.rs": "6bfb8cbff462587dd147b0775ea01d370abbd97544b9bd596c792df1b5f7e634", + "crates/horizon-core/src/density/interpolation.rs": "8c890f52b6467f38a94c654986a6a484b8e0b296ab98c398e60a6ce465b5b010", + "crates/horizon-core/src/density/interval.rs": "b42629163baa6b599a233afe8596d1c370cd81d015cc6fc36a9663aa47b98424", + "crates/horizon-core/src/density/mod.rs": "ca0d77d3282e3746ddcbc92bee97dbf640b9a56214e6ac1537f51f9a5b63d6e7", + "crates/horizon-core/src/density/power.rs": "d5b7270a128d4264268cd772109ad16d71a8ec3ff2d3b63b84cb985296d54a91", + "crates/horizon-core/src/density/rounding.rs": "71840c5206ff8d218ac29bf6f66915d5212764ba270c675711a866ba5b55a7a6", + "crates/horizon-core/src/density/selection.rs": "0dd26af2e85004ec5e053039ad11c384c17c56ace9ab45eb3f5cb3503c0b0330", + "crates/horizon-core/src/density/slice.rs": "5d77605573c0deda47778f1f78f7fa3fbf1944d8f5efbcc65cf589181cadf80b", + "crates/horizon-core/src/density/spline.rs": "6bb2e40f940fc6544d6fb09cb0b8cac722be03bc663dbdfb0f61faae207400bc", + "crates/horizon-core/src/density/surface.rs": "159e0e69cda74f870e80ea64fe523c4397e64af4ccb861bb9fd07b2c3cb91b00", + "crates/horizon-core/src/density/terrain_noise.rs": "8d0059d25eb5d248cb97a4c5a2e670d61528928ea151495c004f25adb723fe3e", + "crates/horizon-core/src/density/tests.rs": "7817796ee40d0ae241bfbebec6bca190e0a8e7d5a1caa8ddf858c3eaa58b8858", + "crates/horizon-core/src/density/world_fields.rs": "c1ce305cb8046b384d90c564cafb24af7365d580389637910f3d8b0cc18eb583", + "crates/horizon-core/src/geometry/border.rs": "1386f8080521231d05ba3e84d94a3e1d5218d35ccb3d5e9fe2bbb05a8739e573", + "crates/horizon-core/src/geometry/mod.rs": "c650386f9860e44a96c55f18c8f1428ca715fcb0bc5c2434db5b1caa43df27fe", + "crates/horizon-core/src/geometry/movement.rs": "bcfb452752940ce53ae6dc267a3c4eb29459046a063c1f884684ab4f4bd0068f", + "crates/horizon-core/src/geometry/shape/create.rs": "189812b91d5e0e3ad963afcd1a6e2831b31b8188df91a904ef27061e644806ad", + "crates/horizon-core/src/geometry/shape/face.rs": "f243bce81384040a95ce7984b02b5699206c596c537b2713097e86005b4d3a5c", + "crates/horizon-core/src/geometry/shape/join.rs": "f1b51887b7bf9482557e3ffa99e136f2e5db07ceeb05fdb116adf45e87129075", + "crates/horizon-core/src/geometry/shape.rs": "e8d88a763de1525f77a30b99591641e8a8b80946263acbde035a9bcc356df960", + "crates/horizon-core/src/geometry/sweep.rs": "abd6009c61555161ef2f18b431b2aa384b126c0871cae8b96a62358498a56a1d", + "crates/horizon-core/src/geometry/traversal.rs": "77a3da570a0b85582b669cf4d841cba4b06327006dda26d4a26df4e8ce05bae4", + "crates/horizon-core/src/geometry/trig.rs": "05cef9341a298a474221a0556a11ddf47650393ea7a97b4b2022a4da6628fe37", + "crates/horizon-core/src/lib.rs": "4255e16837fde42a52ba118f60581d197c571bb530b60d635e506184ebf4db0b", + "crates/horizon-core/src/noise/mod.rs": "1dab5a713abf702402e69ace1bf9e476bba544b0ede5a61c3c3afc60af0a03f3", + "crates/horizon-core/src/noise/normal.rs": "e9e7a46472a54a02c98c46da819842090567153b32fe0c84249009ef19af7aad", + "crates/horizon-core/src/noise/perlin.rs": "e73815447432eab7542f67366cb3f1b368d164e33f6c9cdbd045ac8e4db0932a", + "crates/horizon-core/src/noise/simplex.rs": "6c0dbc15b2b7510195dd28fceca01dcaac1847ccc4a84d299c351589c642fe7a", + "crates/horizon-core/src/noise/stack.rs": "7f6ef0e7d920139ef1a6ad3ec5640f92765715f86dcc5ec29f1a149984f45fa3", + "crates/horizon-core/src/noise/volume.rs": "3f05d2b1780acfdfee60037677d309937a5033b45ef428fc2d540942d4b56b43", + "crates/horizon-core/src/position/iter.rs": "32d2d8e74821cc4e49e3354202d35d3120e4415bfdda9375a73f2137ef651129", + "crates/horizon-core/src/position.rs": "e10101088e6902386b9b6d27773d44312f1ff72bebb19e57967a54945dde9dcd", + "crates/horizon-core/src/random/hash.rs": "0f88a127a1ba2705d3d6c0ebd009324d6ba86ffa2d27edf2d2a84765e690e4a3", + "crates/horizon-core/src/random/positional.rs": "35494745e5d4cf89e282c3ae0ee245e9f2640ddbbc03bc0055df742006a9c862", + "crates/horizon-core/src/random/worldgen.rs": "9f07ff33bcc038d34e27aa5465753bb21df18f2975e43cae201f709bc186945a", + "crates/horizon-core/src/random.rs": "ddb95d3a83e28ad605ff1f49f5df270cc543ca5ef1130e37d989dc74c8d861e6", + "crates/horizon-core/src/storage.rs": "f6c32201c64aefde06e57a2c767be46918df613548a322801546b133799cc33d", + "crates/horizon-core/src/text.rs": "e6553ddb5db5039e8dc4614b6a6dc9f35a26dc3d1673b68a04e72e7983b67abb", + "crates/horizon-core/src/ticks/generation.rs": "be1237e790693f633a61714ddae68c6506a777588a8a3ab5efbe53a35774dbd2", + "crates/horizon-core/src/ticks/heap.rs": "bf28afab8af77c3d243aa96cd8a1fb8d934140a4dbd07dbfdbf4e7908bb4b845", + "crates/horizon-core/src/ticks/index.rs": "1f1a6a568c2a30eafecb020ca4d5f5fc414860de85b8b381fc419a2e3e65c24a", + "crates/horizon-core/src/ticks/mod.rs": "01634630668172516b8b79d0907bad47f6e2c543a6d499c2fa4b201823b375cb", + "crates/horizon-world/src/attribute_health.rs": "6135beb1baf9a55745ab95955bcd05e585e4042a6cffda0a14c13f05593e7186", + "crates/horizon-world/src/attributes/entity.rs": "56fb96b1beb9caaa769369bf7cddf522d2f2e84e241c213b51ae8d39d31a9f13", + "crates/horizon-world/src/attributes/mod.rs": "3d05ce2ff10c1b68540e3c87bbd2ac65c56a2e7b7127a7865b60890a2e9a690d", + "crates/horizon-world/src/attributes/operation_map.rs": "fc5bc8921d78ea6721a2eaa915e67483e2a33683927467bdba24f0492356ad97", + "crates/horizon-world/src/bin/worldgen_parity.rs": "3143ceb9b56eecfd7667e5feb5f9f0cd13cfb8754b38d4ea338dbba97f2819da", + "crates/horizon-world/src/block_collision.rs": "39207247f2f6dd3ddc77640229044246f91b32054563f88a435f1bd92ad2092c", + "crates/horizon-world/src/block_collision_scan.rs": "20802862364c110ff85eeaf48606596a8468b83768dda46b412d337958790b41", + "crates/horizon-world/src/block_entities.rs": "a9deae92e6e5a1fcf4f0476c33ea4d170ddad6fd4b3303e1bb66d933973d5e06", + "crates/horizon-world/src/block_entity_push.rs": "12ee91bf604946234b24a0da4333f07d1830ab9743a422d41c8d0afac7d49cfd", + "crates/horizon-world/src/block_landing.rs": "33083fe39266fbefec1b3ea1a19f2afc609791d189da247c895e116ad6eb266a", + "crates/horizon-world/src/block_placement.rs": "524f4892d50bab77b7d89d19f7b048ffe746996f2ed7f376db2c6ab00ed75c24", + "crates/horizon-world/src/block_properties.rs": "b0bd8a983336c48e488a20caa77dd5c39b1a74bbd14ebc03b3b64556a1c864fc", + "crates/horizon-world/src/block_render.rs": "8df52ee11aef406a1571198a64048062a0ef6864e0058d9293a57f64b73c916a", + "crates/horizon-world/src/block_support.rs": "ade4fbd47284b450dabdd682dc86138b2ac05a0fd379525d7110648908245476", + "crates/horizon-world/src/block_survival.rs": "28ce64375e09819a4f13da9cfbe37c08b5ad0daf01b289c1c360b4567e50e811", + "crates/horizon-world/src/blocking_item_damage.rs": "afea3cb5761e8b82ee4d9bb4ef3c6fd10182a324dbaec99e6c9ebfac255dda09", + "crates/horizon-world/src/blocking_rules.rs": "83c5e2105cec56a90182ce582e1c67ade2b189be6de1a34d08035000cc07c492", + "crates/horizon-world/src/chunk.rs": "795895284d6e615bcb2082fceacdfe7025c152fb2934bb43f598f17a00ab46f1", + "crates/horizon-world/src/chunk_status.rs": "dbb8583cfa775203c544d24d69e03720385428f15a267a561356c21f5025e9c7", + "crates/horizon-world/src/climbing.rs": "6cd2f919872ff0b726effddaa57eccb805b8eae43f9d01144716010853891879", + "crates/horizon-world/src/collision.rs": "a749794d5c27ccd6c0d964ad02f9dc31d49d9f4fe4b7366cd4bd8155e681b00b", + "crates/horizon-world/src/collision_context.rs": "2176c7034e07f547510a8327cdad9d3b63f26e4754032b76b7d5fe13166c333c", + "crates/horizon-world/src/combat_rules.rs": "01131f70d1acdd96a910e7f96deaa12e51a1e3bb9208085f04e3ec7b657d3cd4", + "crates/horizon-world/src/component_durability.rs": "37a46e184f95bc5027e2b9af72ff52f729ad03601d08e1827f181fca383a35af", + "crates/horizon-world/src/component_patch.rs": "3622244ccdee46e13956c64ffe9be6234e686adf58dbc3a24cece0f1814301a1", + "crates/horizon-world/src/compression.rs": "4db73e6ca9a0d552d415ce60e7e88b89c9cf2b7d060a669ff8328f518316e101", + "crates/horizon-world/src/damage_immunity.rs": "fd39c41124d694e755cf7faadcf93c636df4042c78ec345092a856b5f952dbcf", + "crates/horizon-world/src/damage_reduction.rs": "f5a599ab11e077f526237018aeda803ea3c420c5b35c78ae9d85e32267e23bf3", + "crates/horizon-world/src/damage_source.rs": "24945e397a926d34695652980923609e4723e02fe6b6e56d4aaf673e45d759f7", + "crates/horizon-world/src/dynamic_support.rs": "5996bc1c436fb6215d8fc3d0bb4de5dd9b966d842d432580d624195771697fb8", + "crates/horizon-world/src/edge_backoff.rs": "5259d7aa44e64f88351d1556c44dd0edcad3b400a099c659755792efba7b5773", + "crates/horizon-world/src/entity_collision.rs": "09f2fd7f6cd56fc282f468ecfa765a94506929e9684bd3a5c90123e5b51cd627", + "crates/horizon-world/src/entity_fluid.rs": "02991040ae879a8914f09913128a3506e9e7a1ca33ffc0a22b5729a168346600", + "crates/horizon-world/src/entity_fluid_tick.rs": "4f9e070b88a73c98a4e2e659360ddd6edee636bca29377f1ea9011fd5a556f64", + "crates/horizon-world/src/entity_move.rs": "a40a50d3e841625a75d4cfbb7c2630ab5a62a574456567e7234f401ae8441b32", + "crates/horizon-world/src/entity_obstruction.rs": "a4b28a19bf83b23611c59d94535c488db37e4aee24b22c973c545910894a809f", + "crates/horizon-world/src/fall_damage.rs": "8c28e2933493569fe05dea22332024287d28b0746b514dd465681040b003296b", + "crates/horizon-world/src/fluid.rs": "a0a1f34ba94d8b59dc975becee8952960764d67ae08cf2d6a8bcd40a614b15c4", + "crates/horizon-world/src/fluid_box.rs": "b586af72b1c04a9354fe66205c28dc8b619e205ab9ea19a68232722e4b6e96c1", + "crates/horizon-world/src/fluid_flow.rs": "7c7e486b5c565df3602799648b37b879bcca51414337f607962d6c7951b86d05", + "crates/horizon-world/src/fluid_occupancy.rs": "26037579caeef6c8a5a2bde2c3d142d278558b76d77ebff401cee6e35f2ea961", + "crates/horizon-world/src/fluid_shape.rs": "28bb65a72f5bd074a354ba38a1b1707fcb0947537977a11540bba0adb85995c2", + "crates/horizon-world/src/food.rs": "3cf416fa632a5555a8116bb528a6e80bcb5b6b754b0748b4959ed310102418d3", + "crates/horizon-world/src/food_storage.rs": "58c433801a285efcc973638c11d694a41f85dc96703a3a7ce8d3673f3eb31d52", + "crates/horizon-world/src/free_space.rs": "913536bf4c85ddeeb378d76d1b5110b4175f5688e1a749f32fe6a6d86fbb478e", + "crates/horizon-world/src/ground_support.rs": "3e371d74ecede4d30beef0a7e8a2ee33463584a5b1ed3d852b394efcce1ffbe0", + "crates/horizon-world/src/heightmap.rs": "a5edef082b5af40d814421ea17e129b3b06d70abee6434ed263e4bba58571698", + "crates/horizon-world/src/interaction_shapes.rs": "f321284ddab440a394372b6dedc8b5cc29a653c0745251a9e96c650f21c33dea", + "crates/horizon-world/src/inventory_pickup.rs": "ea830c7916e7f2d95c6db7ef48be1e876e6ebafcb438e47fc72f9a5bd7c37d07", + "crates/horizon-world/src/inventory_tick.rs": "293a3d57a1689337cfd58e5a73dcdbed4cb360f94d98ff5458f0df92de387365", + "crates/horizon-world/src/inventory_use.rs": "6a6c2ecc73c83dda4cd798c0304df12ace6096eb110d899f4f0c7ffd852bf001", + "crates/horizon-world/src/item_blocking.rs": "f6eee0d6d177cc3148960122327ba1b459a2f0e85241c1d9a3e40f0b8c169296", + "crates/horizon-world/src/item_durability.rs": "9fdf835e5c7bd0e1dd63ef2ba0076b770cdd4d6d14cdcd11de27690f0702f94e", + "crates/horizon-world/src/item_stack_refs.rs": "18d3ca85cac0daf59200857513761359e5690f719cb3f7f64ae552f0c4169ea3", + "crates/horizon-world/src/item_stack_storage.rs": "b4dcb83dcaa346848c5484161feb3e2cf08e83f7793d7ed83be25b14b9d12884", + "crates/horizon-world/src/item_template.rs": "d9ab7958a55c695142403195244b14946caa2bf527bcbb4193b1372cd748e9a8", + "crates/horizon-world/src/item_use.rs": "b1c79428986efbf9dd5ede703a39eb387fb6dcc7d9950f0e49243a353a5b8070", + "crates/horizon-world/src/item_use_catalog.rs": "a9b53d2e816583239a75c3c61e78dacc5e3b27dee595be34b1c7fa169f17a571", + "crates/horizon-world/src/item_use_lifecycle.rs": "4639b70440cf811e79de09c48a3e035143fcb6be8a64c2f61b10ae55a2f133b7", + "crates/horizon-world/src/item_use_start.rs": "a84092dfb8b8f0a89d0928bb2f8ac252bd9bfd3f8d74fce1a7f7a5b3c3f4f50b", + "crates/horizon-world/src/lib.rs": "32e4ab1773ffacd063ffacf10bd148d43e69fefaed7109b39bbff475417528e6", + "crates/horizon-world/src/liquid_collision.rs": "0f0a83b04e5a5bc9d98ed05fde4d6584ba69642e93522e726e4cfc325d6fcb1d", + "crates/horizon-world/src/living_air.rs": "b2de36bb50bed15e2808fe4a874fcef07f9fea0d2c96385b7b5e8ee9560d4442", + "crates/horizon-world/src/living_damage.rs": "2b448209629b9bf2e678d667ad0d6c7fa22146892dd106b169d96b31b0df12bb", + "crates/horizon-world/src/living_fall.rs": "da0f176f4731e1c86e08bfeee8167742fd1b86380ff0e9304c13c1ce3f1c67ab", + "crates/horizon-world/src/living_fluid.rs": "d7cd914cfb2a1f4876ce0ae95e999bf0ff1af732cce3ab4a3aa2d1ab881c7339", + "crates/horizon-world/src/living_health.rs": "221659f85552424e937d503bba6d8003006b106ced042b32d3a6f6cc23e12ed0", + "crates/horizon-world/src/living_hurt.rs": "844239ad7d15c39629bb3cfc06ebae6d1cff20b7627468f26e0ee8dff3abdcb8", + "crates/horizon-world/src/living_landing.rs": "8bca4eb7977abc2b14fb7174be4ea355352106ea1e76ff5f3ad8696969d9eefd", + "crates/horizon-world/src/living_motion.rs": "56f8c84cfbe205a7a69912d5f76b52ef1efca149c1b6801d4684e25fb179aeb9", + "crates/horizon-world/src/living_use_flags.rs": "826f4fdeba7e208368cbbf910fa408db0afbc6442d842d178a70fae53e0d0ea6", + "crates/horizon-world/src/main.rs": "fce57418b8c22a6a0a9044baa89ed3d9c243bc2e8413fea3ff0f32985daba021", + "crates/horizon-world/src/movement_emission.rs": "76e7d6f5b19c94676190f54389f9c4ce12cf89945ccfcb9c750de473223e7753", + "crates/horizon-world/src/movement_properties.rs": "6f01ab920b376a13f5ae12c3718f4dd067e1dff2b829585af00a8b2100f3775d", + "crates/horizon-world/src/movement_restitution.rs": "04b4fe0947e7e52576145bd8ed15920278e8a538afcc74d125eaca513dffa0ef", + "crates/horizon-world/src/movement_support.rs": "02d85cf572847f2e60b5a7f9d60b856888a67b3c1f4df03e81998c66fdf874be", + "crates/horizon-world/src/nbt.rs": "60262c3de8c8f68bc2da0370ccb17393d32b85f5f5022c6358599a7d32119ea6", + "crates/horizon-world/src/piston_movement.rs": "7a3fd2549a582b5f3a5c21aa05d67d944d62ca1105856679e100ac5b44e9a52f", + "crates/horizon-world/src/piston_shape.rs": "399c2337103b8e7e0eb5667227c5aa14f9549d6a467b7be7da3d0717f0263500", + "crates/horizon-world/src/player_equipment.rs": "1fa8c53e67624c4641246249d79a800a28a4858c62482bd880b4e3b866b936ef", + "crates/horizon-world/src/player_food.rs": "f188dc110745bcc7acc15e6c521db943b06b404f69cd251bf74a345516070304", + "crates/horizon-world/src/player_health.rs": "79ecb6b4d7a044dc98e5552c53a5ac2724545b1c1cec4d797eb52576728e3480", + "crates/horizon-world/src/player_hurt.rs": "99c9bbd8587ec2dc287806049897b8034d2f5349ad47fc497b70d54148844a36", + "crates/horizon-world/src/player_inventory.rs": "f4f67d8312793f25930626c4ac06db688fcf2e2292d6675071d105fb1708d952", + "crates/horizon-world/src/player_travel.rs": "6841a677a900495eb6223031ef3ebe8d859bb98908dda0e2209e5f28839dc593", + "crates/horizon-world/src/powder_snow_collision.rs": "7289946a21478d11abfd2bdcdddff3d7f98e25bf6a68564fed45c3cc01ac2a36", + "crates/horizon-world/src/region.rs": "72b642e87fed37ed17f54d4c30f96c3b64d26c14bc0589c31ef40ff1616188fc", + "crates/horizon-world/src/registry/json.rs": "7a683afcd1742c5307756927d7f0aa779c7d7992af87d8d371dd98108728e235", + "crates/horizon-world/src/registry.rs": "f2e58b2b4d944ac8fc6226bd3352cefc3d2052d8473e02ccf7dc402b176df435", + "crates/horizon-world/src/registry_collision_scan.rs": "97cc950a9a4ba387b78e368f36d595f8664ab7730d132900d220ce23b92826ea", + "crates/horizon-world/src/registry_fall_ray.rs": "52935436132df505691144840dcbd858b15d00d8305997284e3a542ecf6bc0dc", + "crates/horizon-world/src/registry_fluid.rs": "b8959c05850cfeaaad1e4de8ca7c7d0d6ac56da9b2c1de3ebefa5871a11ed35e", + "crates/horizon-world/src/retrogen.rs": "6efd36a6293756688c1990a7965bd65609d7c5e2bf2a5f4f01d54932d2b9386b", + "crates/horizon-world/src/server_player_combat.rs": "a9743971581af86d926eeba42004d932caf83382c470dd98bf613cb9c417db58", + "crates/horizon-world/src/server_player_damage.rs": "828a4649fec3e9bda2dfe20aced8c95922c697321de2be4127bd4e5712ecbb7c", + "crates/horizon-world/src/simple_container.rs": "0fedbc7e974b1db79b88bd6aff977654189a5d553cf42852fe8bf0885cf90b30", + "crates/horizon-world/src/suffocation.rs": "bed219dd5bbab6263b98fbe3d0eb512cb96c52ae847210efe49514d05f22f11e", + "crates/horizon-world/src/swimming.rs": "49d2dae13c109b37ff832cde98a857944ff45247b864a527b9c4f03ecca7a7b7", + "crates/horizon-world/src/synced_floats.rs": "0152f2752bafaf68769d56dbc88494a976496a680c6b113d6b48a446158ba072", + "crates/horizon-world/src/synced_values.rs": "adffa15026497d6671ffd12e5e17df9329c93f0e022700cdfebb80ab494382ae", + "crates/horizon-world/src/tick_data.rs": "f8d04a69ea263f4168bce33f92e5b4ee2fe07d7caf50a1621c6b3ef6eb2479f3", + "crates/horizon-world/src/view_direction.rs": "e18120ae26dc5cf702b29fc4c8487088bab133c8ce5abce01226833fafb0d5a4", + "crates/horizon-world/src/water_splash.rs": "e0461ae1b2e8c851cca6e3251a188334293292201d7f80dc9e7d60fd1815f4d1", + "crates/horizon-world/src/world_movement.rs": "f8fe9e34f2395d2a04c839d1c8ba78e09ce493c26de6f6e4e237b9c19c061da5", + "crates/horizon-world/src/world_ray.rs": "879bdbbe12f56deb705cc183933431489e840b71eade40c33391eed5949c2e61", + "crates/horizon-world/src/worldgen/anchor.rs": "d156b8a0b147a274cdd143409b441f4f43edecde6e8ee14ef9cf0309f743143a", + "crates/horizon-world/src/worldgen/aquifer/config.rs": "fcd2cc3a520c1527c88f095a3b5d38487e7ebb1ccecc5f757f93d04a069add4f", + "crates/horizon-world/src/worldgen/aquifer/noise_based.rs": "74daaa389b5c3dfdc99214dfff256a9e172f83548d2326cbc941d9637cc53fb7", + "crates/horizon-world/src/worldgen/aquifer.rs": "cb4b66d87de3f9f79ae6ffe4badd6f0f44886cd42ad9de2771b8b56c4f1e28c7", + "crates/horizon-world/src/worldgen/bamboo.rs": "d9b47113c99be34256e58308bc6f40072ff25c579d6bf995182aa862c0006102", + "crates/horizon-world/src/worldgen/biome.rs": "3fe316b875aa32683759c337dc71f624910faf0812a2d6d83b8098d6d0bac7a0", + "crates/horizon-world/src/worldgen/biome_chunk.rs": "8fdfe6ebe3ffeca97611fd5991a5bc6b2783ea1c62f4d8ef3b2dd53c04a5dc1d", + "crates/horizon-world/src/worldgen/biome_predicate.rs": "bfc581bc40077cc74ffda43e990a55fe997adc04c7130f98e039c3305ca79aac", + "crates/horizon-world/src/worldgen/biome_source/codec.rs": "2b9e4f5d679eb444cb73174f511e3b9f32e9eb138248ab12cffc6cfd76adf3a8", + "crates/horizon-world/src/worldgen/biome_source/runtime.rs": "f0b02c1521178e4d0377c6ca62694604b6a773f1f234f070ff0cde4685911d45", + "crates/horizon-world/src/worldgen/biome_source.rs": "e181e1736f3e0b75f7091a24c88de3fd116e01b98424d02382aea7a503d1eb54", + "crates/horizon-world/src/worldgen/biome_temperature.rs": "cde4bbab5e260c4065b113376c423b8511ade93c5aa5fd976e245ee8a58b5ad1", + "crates/horizon-world/src/worldgen/biome_weather.rs": "96b1f9494559ed31d06257b83d604d00cc069ccc8c7b68094117e034b4a71bd7", + "crates/horizon-world/src/worldgen/block_blob.rs": "c608c57b3d77279646ecb89e50677dd8e452b0422ffd357ba755536c5589eb89", + "crates/horizon-world/src/worldgen/block_column.rs": "f72c21a9066ee0aa68c2fb79fba436d05afb14c6ef5a2cb012f1ed35fc17cd22", + "crates/horizon-world/src/worldgen/block_feature.rs": "36b4e46ee7f7f73bcb94d8bce8d99013e4b16234c9a03542eeb3186e88dd1c21", + "crates/horizon-world/src/worldgen/block_pile.rs": "623e369b77e0526ed2756485a6c0bb09683cd28ad8876dea907360ca6665b39d", + "crates/horizon-world/src/worldgen/block_predicate.rs": "074c692367e3f2191a1bb28d87b23402430a843c246bd30a4ea838ee3500280e", + "crates/horizon-world/src/worldgen/blue_ice.rs": "eedd77bdaff808330b864166d303378096daa5c7d235e925770b171c05109247", + "crates/horizon-world/src/worldgen/bonus_chest.rs": "05d0f63fbc7412f13ba1fa37a7238114b8f70bfff318beb2dece590482d49cc0", + "crates/horizon-world/src/worldgen/bulk_section.rs": "eecf61532d7793f853884c5a18a7f436a59835c7b13d3ec9075804511553c9ba", + "crates/horizon-world/src/worldgen/carver/canyon.rs": "509c4d5a9d689849e98e894ab14a9fbf82d10707d38e9cc688ded3c4778df3e2", + "crates/horizon-world/src/worldgen/carver/generation.rs": "a4498d0d1457536de3922a08e9c40ccce8d2ef9cc263801c15a412327513c098", + "crates/horizon-world/src/worldgen/carver.rs": "46b251e28225fe1250de38f49dec5dacda4e2c4ba1e556e21e6d1e14e2651fc3", + "crates/horizon-world/src/worldgen/carving.rs": "4e77d4e5c4a0ca55ca3563b9bdf6f379342e0bdf9d019d60f7bc57ce4afb5fbd", + "crates/horizon-world/src/worldgen/chorus_plant.rs": "29224c164ede919e280a65a68f155c873e2c8fd0aa7d7e244d8fa9e468760250", + "crates/horizon-world/src/worldgen/climate/codec.rs": "d567adeb5d837816fca69102db51d790f71aec1b51c09298230d24612e400a14", + "crates/horizon-world/src/worldgen/climate/index.rs": "c5ce61679a5f0e0f2f0af2a373424effa124d0cce8250609eff38b7034650756", + "crates/horizon-world/src/worldgen/climate.rs": "1b9ad44407f40aee4c1cd5357a5c9c443c1b105728f01cf5c644072f99f8357e", + "crates/horizon-world/src/worldgen/decoration.rs": "75a79b20b21e133816e729f16e758be6165d0db18a64bfbd5fd3618325a2adf3", + "crates/horizon-world/src/worldgen/delta.rs": "c2bf49ddf3231d28c109e68871429bc13d76a7bebe14eb33e84aa856bdd66145", + "crates/horizon-world/src/worldgen/density.rs": "65a98c156a290a6b374ef670d28cd5dfbe0aa93171824d1bbd96422536273f84", + "crates/horizon-world/src/worldgen/disk.rs": "6f8f9e059755af44c9bfa1b91eba54a7d13fad811dce31717c5502d7f6df33d7", + "crates/horizon-world/src/worldgen/end_gateway.rs": "f53fde77d6a36a525cd15d890003b2c129d0689a4cbfa2cf443a0c2e3acae040", + "crates/horizon-world/src/worldgen/end_podium.rs": "8f6d0d6d60ff0fde63de5781e867239db321f82cf12639f0537d410a3731ee1d", + "crates/horizon-world/src/worldgen/feature.rs": "40500af71ee6628dfb27518262d99f08d0383ae6c7b9397452feef0c213eadd9", + "crates/horizon-world/src/worldgen/feature_catalog.rs": "efc7b17b227e71622ef34108be9abd010f5675b68ea0409fcab82581d9aab88a", + "crates/horizon-world/src/worldgen/feature_graph.rs": "da132fca9fdafb0d89a917d5f4b68c60b70fb33cadf948a107da0e35d83dcd91", + "crates/horizon-world/src/worldgen/feature_region.rs": "df0ff142a461cafa9a3b42b949ad3376887f2be8d4ea5cc794a3ed2e977bb499", + "crates/horizon-world/src/worldgen/feature_sort.rs": "3488a093dfe1321aaa29d8a30cfb115d8e666a81bf195514e87b170de626835c", + "crates/horizon-world/src/worldgen/fluid_predicate.rs": "64197c9e63bebf1ce04bc280bfe980bb6c1b9aa887ca5cded904aeb0d9ae6c46", + "crates/horizon-world/src/worldgen/height_provider.rs": "368d4dc119854742a045c4a717679c921456da681fc5f71aa9b37102d6f33b47", + "crates/horizon-world/src/worldgen/material_condition/codec.rs": "09b909bc384472f76d163c8069ec6b507c7d5c6a028a36d5e0e3df20deff7b3b", + "crates/horizon-world/src/worldgen/material_condition/density.rs": "df9d0761e978e5010663ae8b44f2d6c1ecb4907331e333bdb6a2b487c1e107de", + "crates/horizon-world/src/worldgen/material_condition/library.rs": "a55534c5da97575a819af5a7dc0dbec9069993fa8b2619c6c9d5576946e683fa", + "crates/horizon-world/src/worldgen/material_condition/noise.rs": "ffb59cc6be2275d7a5621bf7d768527e74a8326ed7ad78618746711540921675", + "crates/horizon-world/src/worldgen/material_condition/rule.rs": "fed643352efbcb1f68f29b6241896617db889fc7c577a6247564e01922fec1fe", + "crates/horizon-world/src/worldgen/material_condition.rs": "d638dcb8cbcb5da20b3cb29602b0ae6a86c4fdf9d8c0fb725de8ec5fc108717e", + "crates/horizon-world/src/worldgen/material_extensions.rs": "ab806eb679d5116e1aebb64fca70e1499ae71f83c9507a8cb4c3201c2b1bf037", + "crates/horizon-world/src/worldgen/material_stage.rs": "698cbc786eff13c246e2bc2ea062401918cd4265899fbc3d53abc87e45a8e7a1", + "crates/horizon-world/src/worldgen/material_surface.rs": "5d37b90099df3d6da0845dab164e71469fb287019c2ee74bc6714f3b9d6d6d5b", + "crates/horizon-world/src/worldgen/ore_feature.rs": "83b89fd3be691c5412c0215b6abefdcaa44119a05aa41217e061970eb7e12ebd", + "crates/horizon-world/src/worldgen/placement/chain.rs": "9218399b4d3757f7bbc550d7729a7201f32a1c83a7030865e0c12aab8a80d116", + "crates/horizon-world/src/worldgen/placement/context.rs": "a278304795136677ad4b4933ea50c972b9729a1c671c03fa309c193e224b1fd6", + "crates/horizon-world/src/worldgen/placement/layer.rs": "a0f5ca776f33f9d4f72b8fdcd163426152e5e43cb4a7572fc1d4fc57bf965de1", + "crates/horizon-world/src/worldgen/placement.rs": "b0397e5818fae84358546193a95f84bcb0b5bffafce909e6fcb3386179ee8023", + "crates/horizon-world/src/worldgen/replace_blobs.rs": "bf3377d86d2570cd15288ba69dde64a2cf67c5bcbb9a31d0c23421964af74afa", + "crates/horizon-world/src/worldgen/router.rs": "2cee7cf15a0d2ada12be6b39d83e78177fd3033922e4f4cce87a64073cec2847", + "crates/horizon-world/src/worldgen/rule_test.rs": "d1662ec492489ebaa4b87e20f9a8c809dcf3a223a151211bd65ec241a63692fc", + "crates/horizon-world/src/worldgen/settings.rs": "a8fe87752e1982ef11cb67f8d80d8e3428b2c27db178044cb425ba803e689e59", + "crates/horizon-world/src/worldgen/simple_block.rs": "9ba1a88d5db4925f8c37366557887f776c805f9a6444781615b5dbaff52e92a4", + "crates/horizon-world/src/worldgen/snow_freeze.rs": "9040be3d5c7f8f0fd812d2df45e154bf8a9eeef038530b83fa4159d246eac35f", + "crates/horizon-world/src/worldgen/speleothem.rs": "c71651c1c97818a8a85863e14414d6139ea3bdeb897fa422043bcc1499d99aae", + "crates/horizon-world/src/worldgen/spike.rs": "eacf0d9d3d2bc3d4bcf62bc87555f90031138236a5bfef0eb5270204f7c2a4fc", + "crates/horizon-world/src/worldgen/spring.rs": "830849e9b89fcdf09e9b06fbefdcdebe3c8c3f82804f60b8bd5de04ba303cb62", + "crates/horizon-world/src/worldgen/state_provider/catalog.rs": "c8687e15a4887a9200c8d365857d801efaa8f90e669eee3e600a1db4905119eb", + "crates/horizon-world/src/worldgen/state_provider/noise.rs": "7ee369c2a032e5620cb9bdf9ee7adad1f70870fb0a27efb7b7c514d92f83491f", + "crates/horizon-world/src/worldgen/state_provider/properties.rs": "9909139aaca1dc4f743957257fadaa9d423d21fa401fa9abc050505f79365139", + "crates/horizon-world/src/worldgen/state_provider.rs": "be29ada818826a90afe01ab60916360fdfc4cbde5af15c9359cd56b1f1f7b156", + "crates/horizon-world/src/worldgen/tags.rs": "74e4110fb19c4c4047192fd65c38015b8afc7f9fc50404d75380b5063808148c", + "crates/horizon-world/src/worldgen/terrain.rs": "fd1f2e0afc15daf66f484ea40a1f2b7013650bda0941b23c64c81ee9f79cb673", + "crates/horizon-world/src/worldgen/underwater_magma.rs": "7317e40af5ee5a9780f90ce358fa5d3e7f5b3d513b731df6ff97754d9c2a0154", + "crates/horizon-world/src/worldgen/value_provider.rs": "3358b563db8cb0bc8a9cfbbe2b8b3e70941cd2d37a0b519fbb6545f8d0dcbb69", + "crates/horizon-world/src/worldgen/vines.rs": "ee9b79b65012bd86a838241d2ef708680f7fe8eafc8aa656dae9cf2abf3c6418", + "crates/horizon-world/src/worldgen/weighted.rs": "839840aae25302933bbd97a81a2336330e2d03a0ad1684e1e16ac769ed408e6b", + "crates/horizon-world/src/worldgen/write_zone.rs": "8e17a179764d3f68c05882aef35f6810c28a0000f9a83e58bd6030660b76e64e", + "crates/horizon-world/src/worldgen.rs": "e8e9f099ee1fcec8eedce31805d676d3f89c18e84f494a147ffcbfee23d3d54f", + "crates/horizon-world/examples/item_template_fixture.rs": "75350137e055a30ebc10c6fd09e9c53dfbbddb3acf7c440baeac752f1d3bb6af" + }, + "fixtures_sha256": { + ".local/rust-item-template-parity/inputs.txt": "0b58f234b8f8e705797d678c6b481b411064b9207af9b3b14bfeded8c28444b2" + }, + "rust_output_sha256": "cd281b5adda0e521e767773b365f46c4a79a590c315c03629cee85a8ca94cb7b", + "references": [ + { + "side": "client", + "jar_sha256": "4508d006323f24fa02876310c192d739af56516eb259000ac50f0909a68c9a2d", + "output_sha256": "cd281b5adda0e521e767773b365f46c4a79a590c315c03629cee85a8ca94cb7b", + "matched_output_lines": 518556 + }, + { + "side": "server", + "jar_sha256": "a362163eec5d1612d520772bc16e5b39c09e3b234fdc045f56bf544284ee8ae6", + "output_sha256": "cd281b5adda0e521e767773b365f46c4a79a590c315c03629cee85a8ca94cb7b", + "matched_output_lines": 518556 + } + ], + "scope": "Actual ItemStackTemplate constructors, fromStack/fromNonEmptyStack, withCount identity, current-prototype component queries, create/apply patch precedence, canonical EMPTY on failed strict validation, and ItemStack.applyComponentsAndValidate rollback. Real max-stack-size/max-damage/damage scalar components include redundant and removed patches and invalid counts. Contained component validation is a required Rust schema service and is not exercised by this scalar corpus. Component codecs, containers/bundle weight, use-remainder integration and complete gameplay integration remain pending." +} diff --git a/crates/horizon-world/examples/item_template_fixture.rs b/crates/horizon-world/examples/item_template_fixture.rs new file mode 100644 index 000000000..6a8df6cc0 --- /dev/null +++ b/crates/horizon-world/examples/item_template_fixture.rs @@ -0,0 +1,237 @@ +use horizon_world::{ + component_patch::{Patch, Prototype}, + item_stack_refs::{ItemStacks, StackRef}, + item_stack_storage::ItemStackData, + item_template::{self, ItemTemplate, ValidationRules}, +}; +use serde_json::Value; +use std::{ + fs, + io::{self, Write}, + path::Path, +}; +type Stack = StackRef; +type Template = ItemTemplate; +struct Rules; +impl ValidationRules for Rules { + type ContentsError = std::convert::Infallible; + fn has_max_damage(&self, s: &ItemStackData) -> bool { + s.component(&1).is_some() + } + fn max_stack_size(&self, s: &ItemStackData) -> i32 { + s.component(&0).copied().unwrap_or(1) + } + fn validate_contents( + &self, + _: &ItemStackData, + ) -> Result<(), Self::ContentsError> { + Ok(()) + } +} +fn opt(v: Option) -> String { + v.map_or("none".into(), |v| v.to_string()) +} +fn patch(v: &Value) -> Patch { + Patch::new(v.as_array().unwrap().iter().map(|v| { + ( + v[0].as_u64().unwrap() as usize, + v[1].as_i64().map(|n| n as i32), + ) + })) +} +fn proto(v: &Value) -> Prototype { + Prototype::new(v.as_array().unwrap().iter().map(|v| { + ( + v[0].as_u64().unwrap() as usize, + v[1].as_i64().unwrap() as i32, + ) + })) +} +fn patch_text(p: &Patch) -> String { + p.entries() + .iter() + .map(|(k, v)| format!("{k}={}", opt(*v))) + .collect::>() + .join(",") +} +fn all( + out: &mut dyn Write, + stacks: &[Stack], + templates: &[Option